diff --git a/go.mod b/go.mod index 7824623642c9..5d4ea1563afa 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,6 @@ require ( github.com/google/go-containerregistry v0.13.0 github.com/google/go-containerregistry/pkg/authn/k8schain v0.0.0-20230209165335-3624968304fd github.com/google/gofuzz v1.2.0 - github.com/google/mako v0.0.0-20190821191249-122f8dcef9e3 github.com/gorilla/websocket v1.5.0 github.com/hashicorp/golang-lru v0.5.4 github.com/influxdata/influxdb-client-go/v2 v2.9.0 @@ -95,13 +94,10 @@ require ( github.com/go-openapi/swag v0.22.3 // indirect github.com/gobuffalo/flect v1.0.2 // indirect github.com/golang-jwt/jwt/v4 v4.4.2 // indirect - github.com/golang/glog v1.1.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/google/gnostic v0.6.9 // indirect github.com/google/go-containerregistry/pkg/authn/kubernetes v0.0.0-20230209165335-3624968304fd // indirect - github.com/google/go-github/v27 v27.0.6 // indirect - github.com/google/go-querystring v1.0.0 // indirect github.com/google/s2a-go v0.1.4 // indirect github.com/google/uuid v1.3.0 // indirect github.com/googleapis/enterprise-certificate-proxy v0.2.5 // indirect diff --git a/go.sum b/go.sum index 791d9d05c7e0..d48644c7e5a4 100644 --- a/go.sum +++ b/go.sum @@ -231,7 +231,6 @@ github.com/golang-jwt/jwt/v4 v4.4.2 h1:rcc4lwaZgFMCZ5jxF9ABolDcIHdBytAFgqFPbSJQA github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= -github.com/golang/glog v1.1.0/go.mod h1:pfYeQZ3JWZoXTV5sFc986z3HTpwQs9At6P4ImfuP3NQ= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -287,16 +286,10 @@ github.com/google/go-containerregistry/pkg/authn/k8schain v0.0.0-20230209165335- github.com/google/go-containerregistry/pkg/authn/k8schain v0.0.0-20230209165335-3624968304fd/go.mod h1:x5fIlj5elU+/eYF60q4eASMQ9kDc+GMFa7UU9M3mFFw= github.com/google/go-containerregistry/pkg/authn/kubernetes v0.0.0-20230209165335-3624968304fd h1:AQZlI371LcvBYY/7Q55TjxrpZJs6wtEXMw4Wq38XLy8= github.com/google/go-containerregistry/pkg/authn/kubernetes v0.0.0-20230209165335-3624968304fd/go.mod h1:6pjZpt+0dg+Z0kUEn53qLtD57raiZo/bqWzsuX6dDjo= -github.com/google/go-github/v27 v27.0.6 h1:oiOZuBmGHvrGM1X9uNUAUlLgp5r1UUO/M/KnbHnLRlQ= -github.com/google/go-github/v27 v27.0.6/go.mod h1:/0Gr8pJ55COkmv+S/yPKCczSkUPIM/LnFyubufRNIS0= -github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk= -github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/mako v0.0.0-20190821191249-122f8dcef9e3 h1:/o5e44nTD/QEEiWPGSFT3bSqcq3Qg7q27N9bv4gKh5M= -github.com/google/mako v0.0.0-20190821191249-122f8dcef9e3/go.mod h1:YzLcVlL+NqWnmUEPuhS1LxDDwGO9WNbVlEXaF4IH35g= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= diff --git a/hack/tools.go b/hack/tools.go index 13464e22bbe2..5cc2e3fbec62 100644 --- a/hack/tools.go +++ b/hack/tools.go @@ -34,9 +34,6 @@ import ( // Migration job. _ "knative.dev/pkg/apiextensions/storageversion/cmd/migrate" - // Mako stub - _ "knative.dev/pkg/test/mako/stub-sidecar" - _ "k8s.io/code-generator/cmd/client-gen" _ "k8s.io/code-generator/cmd/deepcopy-gen" _ "k8s.io/code-generator/cmd/defaulter-gen" diff --git a/test/config/ytt/performance/influx/influx-secret.yaml b/test/config/ytt/performance/influx/influx-secret.yaml deleted file mode 100644 index 28d3755e3684..000000000000 --- a/test/config/ytt/performance/influx/influx-secret.yaml +++ /dev/null @@ -1,19 +0,0 @@ -#@ load("@ytt:base64", "base64") -#@ load("@ytt:data", "data") - ---- -apiVersion: v1 -kind: Secret -metadata: - name: influx-url-secret - namespace: default -data: - influxdb-url: #@ base64.encode("{}".format(data.values.influxurl)) ---- -apiVersion: v1 -kind: Secret -metadata: - name: influx-token-secret - namespace: default -data: - influxdb-token: #@ base64.encode("{}".format(data.values.influxtoken)) diff --git a/test/config/ytt/performance/kperf-test-namespace.yaml b/test/config/ytt/performance/kperf-test-namespace.yaml deleted file mode 100644 index 0c05831a93e2..000000000000 --- a/test/config/ytt/performance/kperf-test-namespace.yaml +++ /dev/null @@ -1,5 +0,0 @@ ---- -apiVersion: v1 -kind: Namespace -metadata: - name: kperf diff --git a/test/config/ytt/performance/overlay-activator-min-replicas.yaml b/test/config/ytt/performance/overlay-activator-min-replicas.yaml deleted file mode 100644 index 7fdcf2a1a003..000000000000 --- a/test/config/ytt/performance/overlay-activator-min-replicas.yaml +++ /dev/null @@ -1,11 +0,0 @@ -#@ load("@ytt:overlay", "overlay") -#@ load("@ytt:data", "data") - -#@ load("helpers.lib.yaml", "system_resource") - -#@overlay/match by=system_resource(name="activator", kind="HorizontalPodAutoscaler"), expects=1 ---- -#@overlay/match-child-defaults missing_ok=True -spec: - minReplicas: 10 - maxReplicas: 10 diff --git a/test/config/ytt/performance/overlay-config-autoscaler.yaml b/test/config/ytt/performance/overlay-config-autoscaler.yaml deleted file mode 100644 index cb232fff3fad..000000000000 --- a/test/config/ytt/performance/overlay-config-autoscaler.yaml +++ /dev/null @@ -1,8 +0,0 @@ -#@ load("@ytt:overlay", "overlay") -#@ load("helpers.lib.yaml", "system_configmap") - -#@overlay/match by=system_configmap("config-autoscaler"), expects=1 ---- -#@overlay/match-child-defaults missing_ok=True -data: - scale-to-zero-grace-period: "10s" diff --git a/test/config/ytt/performance/overlay-config-network.yaml b/test/config/ytt/performance/overlay-config-network.yaml deleted file mode 100644 index 3cf5cb519f7e..000000000000 --- a/test/config/ytt/performance/overlay-config-network.yaml +++ /dev/null @@ -1,10 +0,0 @@ -#@ load("@ytt:overlay", "overlay") -#@ load("helpers.lib.yaml", "system_configmap") - -#@overlay/match by=system_configmap("config-network"), expects=1 ---- -#! Ensure gradual rollout is enabled. - -#@overlay/match-child-defaults missing_ok=True -data: - rolloutDuration: "240" diff --git a/test/e2e-common.sh b/test/e2e-common.sh index 242d984b698d..1026a0bd3543 100644 --- a/test/e2e-common.sh +++ b/test/e2e-common.sh @@ -37,7 +37,6 @@ export ENABLE_HA=0 export ENABLE_TLS=${ENABLE_TLS:-0} export MESH=0 export AMBIENT=${AMBIENT:-0} -export PERF=0 export KIND=${KIND:-0} export CLUSTER_DOMAIN=${CLUSTER_DOMAIN:-cluster.local} @@ -131,10 +130,6 @@ function parse_flags() { readonly MESH=0 return 1 ;; - --perf) - readonly PERF=1 - return 1 - ;; --enable-ha) readonly ENABLE_HA=1 return 1 @@ -312,10 +307,6 @@ function install() { YTT_FILES+=("${REPO_ROOT_DIR}/test/config/ytt/ha") fi - if (( PERF )); then - YTT_FILES+=("${REPO_ROOT_DIR}/test/config/ytt/performance") - fi - if (( KIND )); then YTT_FILES+=("${REPO_ROOT_DIR}/test/config/ytt/kind/core") fi diff --git a/test/performance/profiling.md b/test/performance/PROFILING.md similarity index 100% rename from test/performance/profiling.md rename to test/performance/PROFILING.md diff --git a/test/performance/README.md b/test/performance/README.md index a367874326c7..7329a6850940 100644 --- a/test/performance/README.md +++ b/test/performance/README.md @@ -3,7 +3,7 @@ Knative performance tests are tests geared towards producing useful performance metrics of the knative system. As such they can choose to take a closed-box point-of-view of the system and use it just like an end-user might see it. They -can also go more open-boxy to narrow down the components under test. +can also go more open-box to narrow down the components under test. ## Load Generator @@ -15,11 +15,29 @@ different rate, you can write your own pacer by implementing interface. Custom pacer implementations used in Knative tests are under [pacers](https://github.com/knative/pkg/tree/main/test/vegeta/pacers). -## Benchmarking using Mako -The benchmarks were originally built to use [mako](https://github.com/google/mako), but currently -running without connecting to the Mako backend, and collecting the data using -a Mako sidecar stub. +## Testing architecture + + + +## Benchmarks + +Knative Serving has different benchmarking scenarios: + +* [deployment-probe](./benchmarks/deployment-probe) = Measure deployment latency +* + + +## Running the benchmarks + +### Development + +You can run all the benchmarks directly by calling the `main()` method in `main.go` in the respective [benchmarks](./benchmarks) folders. + +### On cluster + + + ### Run without Mako @@ -41,6 +59,31 @@ To run a benchmark once, and use the result from `mako-stub` for plotting: **Note:** Running `performance-tests-mako.sh` creates a cluster and runs all the benchmarks in sequence. Results are downloaded in a temp folder -### Benchmarking using Kperf -Running `performance-tests.sh` runs performance tests using [kperf](https://github.com/knative-extensions/kperf) +## Forwarding the results to Prometheus + +Prerequisites +* You need a running Prometheus instance +* If you want to visualize the results, you also need Grafana and install the [dashboards](./TODO) +* For a local-setup you can use the following resources + +```bash +# Setup Influx DB in local cluster +helm repo add influxdata https://helm.influxdata.com/ +kubectl create ns influx +helm upgrade --install -n influx local-influx influxdata/influxdb2 +echo $(kubectl get secret local-influx-influxdb2-auth -o "jsonpath={.data['admin-password']}" --namespace influx | base64 --decode) +kubectl port-forward -n influx svc/local-influx-influxdb2 8080:80 +``` + +### Influx DB Setup + +* Log in to influx UI and create an organization `Knativetest` with bucket `knative-serving`. +* Create a new user (or use admin) and grab it's token: + * Load Data -> API Tokens -> Generate API token + * Pass the token and URL to your tests using env variables: + +```bash +export INFLUX_URL= +export INFLUX_TOKEN=xxx +``` diff --git a/test/performance/benchmarks/dataplane-probe/continuous/dataplane-probe-direct.yaml b/test/performance/benchmarks/dataplane-probe/continuous/dataplane-probe-direct.yaml deleted file mode 100644 index aa3fe6e09eeb..000000000000 --- a/test/performance/benchmarks/dataplane-probe/continuous/dataplane-probe-direct.yaml +++ /dev/null @@ -1,201 +0,0 @@ -# Copyright 2022 The Knative Authors -# -# Licensed under the Apache License, Version 2.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. ---- -apiVersion: v1 -kind: ServiceAccount -metadata: - name: prober - namespace: default ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: prober - namespace: default -subjects: - - kind: ServiceAccount - name: prober - namespace: default -roleRef: - kind: ClusterRole - name: cluster-admin - apiGroup: rbac.authorization.k8s.io ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: dataplane-probe-deployment - namespace: default -spec: - parallelism: 1 - backoffLimit: 0 - template: - spec: - serviceAccountName: prober - restartPolicy: Never - containers: - - name: dataplane-probe - image: ko://knative.dev/serving/test/performance/benchmarks/dataplane-probe/continuous - args: ["-target=deployment", "--duration=3m"] - resources: - requests: - cpu: 1000m - memory: 3Gi - volumeMounts: - - name: config-mako - mountPath: /etc/config-mako - - name: mako-stub - image: ko://knative.dev/pkg/test/mako/stub-sidecar - args: - - "-p=10001" - ports: - - name: quickstore - containerPort: 9813 - volumeMounts: - - name: config-mako - mountPath: /etc/config-mako - terminationMessagePolicy: FallbackToLogsOnError - resources: - requests: - memory: 4Gi - volumes: - - name: config-mako - configMap: - name: config-mako ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: dataplane-probe-istio - namespace: default -spec: - parallelism: 1 - backoffLimit: 0 - template: - spec: - serviceAccountName: prober - restartPolicy: Never - containers: - - name: dataplane-probe - image: ko://knative.dev/serving/test/performance/benchmarks/dataplane-probe/continuous - args: ["-target=istio", "--duration=3m"] - resources: - requests: - cpu: 1000m - memory: 3Gi - volumeMounts: - - name: config-mako - mountPath: /etc/config-mako - - name: mako-stub - image: ko://knative.dev/pkg/test/mako/stub-sidecar - args: - - "-p=10001" - ports: - - name: quickstore - containerPort: 9813 - volumeMounts: - - name: config-mako - mountPath: /etc/config-mako - terminationMessagePolicy: FallbackToLogsOnError - resources: - requests: - memory: 4Gi - volumes: - - name: config-mako - configMap: - name: config-mako ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: dataplane-probe-queue - namespace: default -spec: - parallelism: 1 - backoffLimit: 0 - template: - spec: - serviceAccountName: prober - restartPolicy: Never - containers: - - name: dataplane-probe - image: ko://knative.dev/serving/test/performance/benchmarks/dataplane-probe/continuous - args: ["-target=queue", "--duration=3m"] - resources: - requests: - cpu: 1000m - memory: 3Gi - volumeMounts: - - name: config-mako - mountPath: /etc/config-mako - - name: mako-stub - image: ko://knative.dev/pkg/test/mako/stub-sidecar - args: - - "-p=10001" - ports: - - name: quickstore - containerPort: 9813 - volumeMounts: - - name: config-mako - mountPath: /etc/config-mako - terminationMessagePolicy: FallbackToLogsOnError - resources: - requests: - memory: 4Gi - volumes: - - name: config-mako - configMap: - name: config-mako ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: dataplane-probe-activator - namespace: default -spec: - parallelism: 1 - backoffLimit: 0 - template: - spec: - serviceAccountName: prober - restartPolicy: Never - containers: - - name: dataplane-probe - image: ko://knative.dev/serving/test/performance/benchmarks/dataplane-probe/continuous - args: ["-target=activator", "--duration=3m"] - resources: - requests: - cpu: 1000m - memory: 3Gi - volumeMounts: - - name: config-mako - mountPath: /etc/config-mako - - name: mako-stub - image: ko://knative.dev/pkg/test/mako/stub-sidecar - args: - - "-p=10001" - ports: - - name: quickstore - containerPort: 9813 - volumeMounts: - - name: config-mako - mountPath: /etc/config-mako - terminationMessagePolicy: FallbackToLogsOnError - resources: - requests: - memory: 4Gi - volumes: - - name: config-mako - configMap: - name: config-mako diff --git a/test/performance/benchmarks/dataplane-probe/continuous/dataplane-probe-setup.yaml b/test/performance/benchmarks/dataplane-probe/continuous/dataplane-probe-setup.yaml deleted file mode 100644 index c124f0afd22e..000000000000 --- a/test/performance/benchmarks/dataplane-probe/continuous/dataplane-probe-setup.yaml +++ /dev/null @@ -1,228 +0,0 @@ -# Copyright 2022 The Knative Authors -# -# Licensed under the Apache License, Version 2.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. - -apiVersion: serving.knative.dev/v1 -kind: Service -metadata: - name: activator - namespace: default -spec: - template: - metadata: - annotations: - autoscaling.knative.dev/minScale: "5" - autoscaling.knative.dev/maxScale: "5" - # Always hook the activator in. - autoscaling.knative.dev/targetBurstCapacity: "-1" - spec: - containers: - - image: ko://knative.dev/serving/test/test_images/autoscale - containerConcurrency: 0 # Explicitly set the default, since it might be overridden in CM. ---- -apiVersion: serving.knative.dev/v1 -kind: Service -metadata: - name: activator-with-cc - namespace: default -spec: - template: - metadata: - annotations: - autoscaling.knative.dev/minScale: "5" - autoscaling.knative.dev/maxScale: "5" - # Always hook the activator in. - autoscaling.knative.dev/targetBurstCapacity: "-1" - spec: - containers: - - image: ko://knative.dev/serving/test/test_images/autoscale - containerConcurrency: 100 ---- -apiVersion: serving.knative.dev/v1 -kind: Service -metadata: - name: activator-with-cc-10 - namespace: default -spec: - template: - metadata: - annotations: - autoscaling.knative.dev/minScale: "15" - autoscaling.knative.dev/maxScale: "15" - # Always hook the activator in. - autoscaling.knative.dev/targetBurstCapacity: "-1" - spec: - containers: - - image: ko://knative.dev/serving/test/test_images/autoscale - containerConcurrency: 10 ---- -apiVersion: serving.knative.dev/v1 -kind: Service -metadata: - name: activator-with-cc-1 - namespace: default -spec: - template: - metadata: - annotations: - autoscaling.knative.dev/minScale: "150" - autoscaling.knative.dev/maxScale: "150" - # Always hook the activator in. - autoscaling.knative.dev/targetBurstCapacity: "-1" - spec: - containers: - - image: ko://knative.dev/serving/test/test_images/autoscale - containerConcurrency: 1 ---- -apiVersion: serving.knative.dev/v1 -kind: Service -metadata: - name: queue-proxy - namespace: default -spec: - template: - metadata: - annotations: - autoscaling.knative.dev/minScale: "5" - autoscaling.knative.dev/maxScale: "5" - # Only hook the activator in when scaled to zero. - autoscaling.knative.dev/targetBurstCapacity: "0" - spec: - containers: - - image: ko://knative.dev/serving/test/test_images/autoscale - containerConcurrency: 0 # Explicitly set the default, since it might be overridden in CM. ---- -apiVersion: serving.knative.dev/v1 -kind: Service -metadata: - name: queue-proxy-with-cc - namespace: default -spec: - template: - metadata: - annotations: - autoscaling.knative.dev/minScale: "5" - autoscaling.knative.dev/maxScale: "5" - # Only hook the activator in when scaled to zero. - autoscaling.knative.dev/targetBurstCapacity: "0" - spec: - containers: - - image: ko://knative.dev/serving/test/test_images/autoscale - containerConcurrency: 100 ---- -apiVersion: serving.knative.dev/v1 -kind: Service -metadata: - name: queue-proxy-with-cc-10 - namespace: default -spec: - template: - metadata: - annotations: - autoscaling.knative.dev/minScale: "15" - autoscaling.knative.dev/maxScale: "15" - # Only hook the activator in when scaled to zero. - autoscaling.knative.dev/targetBurstCapacity: "0" - spec: - containers: - - image: ko://knative.dev/serving/test/test_images/autoscale - containerConcurrency: 10 ---- -apiVersion: serving.knative.dev/v1 -kind: Service -metadata: - name: queue-proxy-with-cc-1 - namespace: default -spec: - template: - metadata: - annotations: - autoscaling.knative.dev/minScale: "150" - autoscaling.knative.dev/maxScale: "150" - # Only hook the activator in when scaled to zero. - autoscaling.knative.dev/targetBurstCapacity: "0" - spec: - containers: - - image: ko://knative.dev/serving/test/test_images/autoscale - containerConcurrency: 1 ---- -apiVersion: v1 -kind: Service -metadata: - name: deployment - namespace: default -spec: - ports: - - port: 80 - targetPort: 8080 - selector: - app: app1 ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: deployment - namespace: default -spec: - replicas: 5 - selector: - matchLabels: - app: app1 - template: - metadata: - labels: - app: app1 - spec: - containers: - - name: user-container - image: ko://knative.dev/serving/test/test_images/autoscale - ports: - - name: app1 - containerPort: 8080 ---- -apiVersion: v1 -kind: Service -metadata: - name: istio - namespace: default -spec: - externalName: istio-ingressgateway.istio-system.svc.cluster.local - sessionAffinity: None - type: ExternalName ---- -apiVersion: networking.istio.io/v1alpha3 -kind: VirtualService -metadata: - name: dataplane-probe - namespace: default -spec: - gateways: - - knative-ingress-gateway.knative-serving.svc.cluster.local - hosts: - - istio.default - - istio.default.svc - - istio.default.svc.cluster.local - http: - - match: - - authority: - regex: ^istio\.default(?::\d{1,5})?$ - - authority: - regex: ^istio\.default\.svc(?::\d{1,5})?$ - - authority: - regex: ^istio\.default\.svc\.cluster\.local(?::\d{1,5})?$ - route: - - destination: - host: deployment.default.svc.cluster.local - port: - number: 80 - weight: 100 diff --git a/test/performance/benchmarks/dataplane-probe/continuous/kodata/dev.config b/test/performance/benchmarks/dataplane-probe/continuous/kodata/dev.config deleted file mode 120000 index ee953f22c05e..000000000000 --- a/test/performance/benchmarks/dataplane-probe/continuous/kodata/dev.config +++ /dev/null @@ -1 +0,0 @@ -../../dev.config \ No newline at end of file diff --git a/test/performance/benchmarks/dataplane-probe/continuous/main.go b/test/performance/benchmarks/dataplane-probe/continuous/main.go deleted file mode 100644 index a7279f349961..000000000000 --- a/test/performance/benchmarks/dataplane-probe/continuous/main.go +++ /dev/null @@ -1,147 +0,0 @@ -/* -Copyright 2022 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES 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 ( - "context" - "flag" - "log" - "time" - - vegeta "github.com/tsenart/vegeta/v12/lib" - - "knative.dev/pkg/signals" - "knative.dev/pkg/system" - "knative.dev/pkg/test/mako" - - "knative.dev/serving/test/performance" - "knative.dev/serving/test/performance/metrics" - - _ "knative.dev/pkg/system/testing" -) - -const ( - benchmarkName = "Development - Serving dataplane probe" -) - -var ( - target = flag.String("target", "", "The target to attack.") - duration = flag.Duration("duration", 5*time.Minute, "The duration of the probe") -) - -func main() { - flag.Parse() - - // We want this for properly handling Kubernetes container lifecycle events. - ctx := signals.NewContext() - - // We cron quite often, so make sure that we don't severely overrun to - // limit how noisy a neighbor we can be. - ctx, cancel := context.WithTimeout(ctx, *duration+time.Minute) - defer cancel() - - // Use the benchmark key created - mc, err := mako.Setup(ctx) - if err != nil { - log.Fatal("Failed to setup mako: ", err) - } - q, qclose, ctx := mc.Quickstore, mc.ShutDownFunc, mc.Context - // Use a fresh context here so that our RPC to terminate the sidecar - // isn't subject to our timeout (or we won't shut it down when we time out) - defer qclose(context.Background()) - - // Wrap fatalf in a helper or our sidecar will live forever. - fatalf := func(f string, args ...interface{}) { - qclose(context.Background()) - log.Fatalf(f, args...) - } - - // Validate flags after setting up "fatalf" or our sidecar will run forever. - if *target == "" { - fatalf("Missing flag: -target") - } - - // Based on the "target" flag, load up our target benchmark. - // We only run one variation per run to avoid the runs being noisy neighbors, - // which in early iterations of the benchmark resulted in latency bleeding - // across the different workload types. - t, ok := targets[*target] - if !ok { - fatalf("Unrecognized target: %s", *target) - } - - // Make sure the target is ready before sending the large amount of requests. - if err := performance.ProbeTargetTillReady(t.target.URL, *duration); err != nil { - fatalf("Failed to get target ready for attacking: %v", err) - } - - // Set up the threshold analyzers for the selected benchmark. This will - // cause Mako/Quickstore to analyze the results we are storing and flag - // things that are outside of expected bounds. - q.Input.ThresholdInputs = append(q.Input.ThresholdInputs, t.analyzers...) - - // Send 1000 QPS (1 per ms) for the given duration with a 30s request timeout. - rate := vegeta.Rate{Freq: 1, Per: time.Millisecond} - targeter := vegeta.NewStaticTargeter(t.target) - attacker := vegeta.NewAttacker(vegeta.Timeout(30 * time.Second)) - - // Create a new aggregateResult to accumulate the results. - ar := metrics.NewAggregateResult(int(duration.Seconds())) - - // Start the attack! - results := attacker.Attack(targeter, rate, *duration, "load-test") - deploymentStatus := metrics.FetchDeploymentStatus(ctx, system.Namespace(), "activator", time.Second) -LOOP: - for { - select { - case <-ctx.Done(): - // If we timeout or the pod gets shutdown via SIGTERM then start to - // clean thing up. - break LOOP - - case ds := <-deploymentStatus: - // Report number of ready activators. - q.AddSamplePoint(mako.XTime(ds.Time), map[string]float64{ - "ap": float64(ds.ReadyReplicas), - }) - performance.AddInfluxPoint(benchmarkName, map[string]interface{}{"ap": float64(ds.ReadyReplicas)}) - case res, ok := <-results: - if !ok { - // Once we have read all of the request results, break out of - // our loop. - break LOOP - } - // Handle the result for this request - metrics.HandleResult(q, benchmarkName, *res, t.stat, ar) - } - } - - // Walk over our accumulated per-second error rates and report them as - // sample points. The key is seconds since the Unix epoch, and the value - // is the number of errors observed in that second. - for ts, count := range ar.ErrorRates { - q.AddSamplePoint(mako.XTime(time.Unix(ts, 0)), map[string]float64{ - t.estat: float64(count), - }) - performance.AddInfluxPoint(benchmarkName, map[string]interface{}{t.estat: float64(count)}) - } - - // Commit data to Mako and handle the result. - if err := mc.StoreAndHandleResult(); err != nil { - fatalf("Failed to store and handle benchmarking result: %v", err) - } -} diff --git a/test/performance/benchmarks/dataplane-probe/continuous/sla.go b/test/performance/benchmarks/dataplane-probe/continuous/sla.go deleted file mode 100644 index 37e254c21f60..000000000000 --- a/test/performance/benchmarks/dataplane-probe/continuous/sla.go +++ /dev/null @@ -1,190 +0,0 @@ -/* -Copyright 2022 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES 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 ( - "net/http" - "time" - - tpb "github.com/google/mako/clients/proto/analyzers/threshold_analyzer_go_proto" - mpb "github.com/google/mako/spec/proto/mako_go_proto" - vegeta "github.com/tsenart/vegeta/v12/lib" - "knative.dev/pkg/ptr" - "knative.dev/pkg/test/mako" -) - -var ( - minDefault = 100 * time.Millisecond -) - -// This function constructs an analyzer that validates the p95 aggregate value of the given metric. -func new95PercentileLatency(name, valueKey string, min, max time.Duration) *tpb.ThresholdAnalyzerInput { - return &tpb.ThresholdAnalyzerInput{ - Name: ptr.String(name), - Configs: []*tpb.ThresholdConfig{{ - Min: bound(min), - Max: bound(max), - DataFilter: &mpb.DataFilter{ - DataType: mpb.DataFilter_METRIC_AGGREGATE_PERCENTILE.Enum(), - PercentileMilliRank: ptr.Int32(95000), - ValueKey: ptr.String(valueKey), - }, - }}, - CrossRunConfig: mako.NewCrossRunConfig(10), - } -} - -// This analyzer validates that the p95 latency talking to pods through a Kubernetes -// Service falls in the +5ms range. This does not have Knative or Istio components -// on the dataplane, and so it is intended as a canary to flag environmental -// problems that might be causing contemporaneous Knative or Istio runs to fall out of SLA. -func newKubernetes95PercentileLatency(valueKey string) *tpb.ThresholdAnalyzerInput { - return new95PercentileLatency("Kubernetes baseline", valueKey, minDefault, 105*time.Millisecond) -} - -// This analyzer validates that the p95 latency talking to pods through Istio -// falls in the +8ms range. This does not actually have Knative components -// on the dataplane, and so it is intended as a canary to flag environmental -// problems that might be causing contemporaneous Knative runs to fall out of SLA. -func newIstio95PercentileLatency(valueKey string) *tpb.ThresholdAnalyzerInput { - return new95PercentileLatency("Istio baseline", valueKey, minDefault, 108*time.Millisecond) -} - -// This analyzer validates that the p95 latency hitting a Knative Service -// going through JUST the queue-proxy falls in the +10ms range. -func newQueue95PercentileLatency(valueKey string) *tpb.ThresholdAnalyzerInput { - return new95PercentileLatency("Queue p95 latency", valueKey, minDefault, 110*time.Millisecond) -} - -// This analyzer validates that the p95 latency hitting a Knative Service -// going through BOTH the activator and queue-proxy falls in the +10ms range. -func newActivator95PercentileLatency(valueKey string) *tpb.ThresholdAnalyzerInput { - return new95PercentileLatency("Activator p95 latency", valueKey, minDefault, 110*time.Millisecond) -} - -var ( - // Map the above to our benchmark targets. - targets = map[string]struct { - target vegeta.Target - stat string - estat string - analyzers []*tpb.ThresholdAnalyzerInput - }{ - "deployment": { - target: vegeta.Target{ - Method: http.MethodGet, - URL: "http://deployment.default.svc.cluster.local?sleep=100", - }, - stat: "kd", - estat: "ke", - analyzers: []*tpb.ThresholdAnalyzerInput{newKubernetes95PercentileLatency("kd")}, - }, - "istio": { - target: vegeta.Target{ - Method: http.MethodGet, - URL: "http://istio.default.svc.cluster.local?sleep=100", - }, - stat: "id", - estat: "ie", - analyzers: []*tpb.ThresholdAnalyzerInput{newIstio95PercentileLatency("id")}, - }, - "queue": { - target: vegeta.Target{ - Method: http.MethodGet, - URL: "http://queue-proxy.default.svc.cluster.local?sleep=100", - }, - stat: "qp", - estat: "qe", - analyzers: []*tpb.ThresholdAnalyzerInput{newQueue95PercentileLatency("qp")}, - }, - "queue-with-cc": { - target: vegeta.Target{ - Method: http.MethodGet, - URL: "http://queue-proxy-with-cc.default.svc.cluster.local?sleep=100", - }, - stat: "qc", - estat: "re", - // We use the same threshold analyzer, since we want Breaker to exert minimal latency impact. - analyzers: []*tpb.ThresholdAnalyzerInput{newQueue95PercentileLatency("qc")}, - }, - "queue-with-cc-10": { - target: vegeta.Target{ - Method: http.MethodGet, - URL: "http://queue-proxy-with-cc-10.default.svc.cluster.local?sleep=100", - }, - stat: "qct", - estat: "ret", - // TODO(vagababov): determine values here. - analyzers: []*tpb.ThresholdAnalyzerInput{}, - }, - "queue-with-cc-1": { - target: vegeta.Target{ - Method: http.MethodGet, - URL: "http://queue-proxy-with-cc-1.default.svc.cluster.local?sleep=100", - }, - stat: "qc1", - estat: "re1", - // TODO(vagababov): determine values here. - analyzers: []*tpb.ThresholdAnalyzerInput{}, - }, - "activator": { - target: vegeta.Target{ - Method: http.MethodGet, - URL: "http://activator.default.svc.cluster.local?sleep=100", - }, - stat: "a", - estat: "ae", - analyzers: []*tpb.ThresholdAnalyzerInput{newActivator95PercentileLatency("a")}, - }, - "activator-with-cc": { - target: vegeta.Target{ - Method: http.MethodGet, - URL: "http://activator-with-cc.default.svc.cluster.local?sleep=100", - }, - stat: "ac", - estat: "be", - // We use the same threshold analyzer, since we want Throttler/Breaker to exert minimal latency impact. - analyzers: []*tpb.ThresholdAnalyzerInput{newActivator95PercentileLatency("ac")}, - }, - "activator-with-cc-10": { - target: vegeta.Target{ - Method: http.MethodGet, - URL: "http://activator-with-cc-10.default.svc.cluster.local?sleep=100", - }, - stat: "act", - estat: "bet", - // TODO(vagababov): determine values here. - analyzers: []*tpb.ThresholdAnalyzerInput{}, - }, - "activator-with-cc-1": { - target: vegeta.Target{ - Method: http.MethodGet, - URL: "http://activator-with-cc-1.default.svc.cluster.local?sleep=100", - }, - stat: "ac1", - estat: "be1", - // TODO(vagababov): determine values here. - analyzers: []*tpb.ThresholdAnalyzerInput{}, - }, - } -) - -// bound is a helper for making the inline SLOs more readable by expressing -// them as durations. -func bound(d time.Duration) *float64 { - return ptr.Float64(d.Seconds()) -} diff --git a/test/performance/benchmarks/dataplane-probe/dataplane-probe-activator.yaml b/test/performance/benchmarks/dataplane-probe/dataplane-probe-activator.yaml new file mode 100644 index 000000000000..eb4203ea4308 --- /dev/null +++ b/test/performance/benchmarks/dataplane-probe/dataplane-probe-activator.yaml @@ -0,0 +1,74 @@ +# Copyright 2022 The Knative Authors +# +# Licensed under the Apache License, Version 2.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. +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: prober + namespace: default +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: prober + namespace: default +subjects: + - kind: ServiceAccount + name: prober + namespace: default +roleRef: + kind: ClusterRole + name: cluster-admin + apiGroup: rbac.authorization.k8s.io +--- +apiVersion: batch/v1 +kind: Job +metadata: + name: dataplane-probe-activator + namespace: default +spec: + parallelism: 1 + backoffLimit: 0 + template: + spec: + serviceAccountName: prober + restartPolicy: Never + containers: + - name: dataplane-probe + image: ko://knative.dev/serving/test/performance/benchmarks/dataplane-probe + args: ["-target=activator", "--duration=3m"] + env: + - name: KO_DOCKER_REPO + value: @KO_DOCKER_REPO@ + - name: SYSTEM_NAMESPACE + value: @SYSTEM_NAMESPACE@ + - name: INFLUX_URL + valueFrom: + secretKeyRef: + name: performance-test-config + key: influxurl + - name: INFLUX_TOKEN + valueFrom: + secretKeyRef: + name: performance-test-config + key: influxtoken + - name: PROW_TAG + valueFrom: + secretKeyRef: + name: performance-test-config + key: prowtag + resources: + requests: + cpu: 1000m + memory: 3Gi diff --git a/test/performance/benchmarks/dataplane-probe/dataplane-probe-deployment.yaml b/test/performance/benchmarks/dataplane-probe/dataplane-probe-deployment.yaml new file mode 100644 index 000000000000..d625596fe351 --- /dev/null +++ b/test/performance/benchmarks/dataplane-probe/dataplane-probe-deployment.yaml @@ -0,0 +1,75 @@ +# Copyright 2022 The Knative Authors +# +# Licensed under the Apache License, Version 2.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. +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: prober + namespace: default +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: prober + namespace: default +subjects: + - kind: ServiceAccount + name: prober + namespace: default +roleRef: + kind: ClusterRole + name: cluster-admin + apiGroup: rbac.authorization.k8s.io +--- +apiVersion: batch/v1 +kind: Job +metadata: + name: dataplane-probe-deployment + namespace: default +spec: + parallelism: 1 + backoffLimit: 0 + template: + spec: + serviceAccountName: prober + restartPolicy: Never + containers: + - name: dataplane-probe + image: ko://knative.dev/serving/test/performance/benchmarks/dataplane-probe + args: ["-target=deployment", "--duration=3m"] + env: + - name: KO_DOCKER_REPO + value: @KO_DOCKER_REPO@ + - name: SYSTEM_NAMESPACE + value: @SYSTEM_NAMESPACE@ + - name: INFLUX_URL + valueFrom: + secretKeyRef: + name: performance-test-config + key: influxurl + - name: INFLUX_TOKEN + valueFrom: + secretKeyRef: + name: performance-test-config + key: influxtoken + - name: PROW_TAG + valueFrom: + secretKeyRef: + name: performance-test-config + key: prowtag + resources: + requests: + cpu: 1000m + memory: 3Gi +--- diff --git a/test/performance/benchmarks/dataplane-probe/dataplane-probe-queue.yaml b/test/performance/benchmarks/dataplane-probe/dataplane-probe-queue.yaml new file mode 100644 index 000000000000..4f0b312ad602 --- /dev/null +++ b/test/performance/benchmarks/dataplane-probe/dataplane-probe-queue.yaml @@ -0,0 +1,75 @@ +# Copyright 2022 The Knative Authors +# +# Licensed under the Apache License, Version 2.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. +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: prober + namespace: default +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: prober + namespace: default +subjects: + - kind: ServiceAccount + name: prober + namespace: default +roleRef: + kind: ClusterRole + name: cluster-admin + apiGroup: rbac.authorization.k8s.io +--- +apiVersion: batch/v1 +kind: Job +metadata: + name: dataplane-probe-queue + namespace: default +spec: + parallelism: 1 + backoffLimit: 0 + template: + spec: + serviceAccountName: prober + restartPolicy: Never + containers: + - name: dataplane-probe + image: ko://knative.dev/serving/test/performance/benchmarks/dataplane-probe + args: ["-target=queue", "--duration=3m"] + env: + - name: KO_DOCKER_REPO + value: @KO_DOCKER_REPO@ + - name: SYSTEM_NAMESPACE + value: @SYSTEM_NAMESPACE@ + - name: INFLUX_URL + valueFrom: + secretKeyRef: + name: performance-test-config + key: influxurl + - name: INFLUX_TOKEN + valueFrom: + secretKeyRef: + name: performance-test-config + key: influxtoken + - name: PROW_TAG + valueFrom: + secretKeyRef: + name: performance-test-config + key: prowtag + resources: + requests: + cpu: 1000m + memory: 3Gi +--- diff --git a/test/performance/benchmarks/rollout-probe/continuous/rollout-probe-setup.yaml b/test/performance/benchmarks/dataplane-probe/dataplane-probe-setup.yaml similarity index 53% rename from test/performance/benchmarks/rollout-probe/continuous/rollout-probe-setup.yaml rename to test/performance/benchmarks/dataplane-probe/dataplane-probe-setup.yaml index 58995b653a5a..4846af44cf05 100644 --- a/test/performance/benchmarks/rollout-probe/continuous/rollout-probe-setup.yaml +++ b/test/performance/benchmarks/dataplane-probe/dataplane-probe-setup.yaml @@ -15,76 +15,70 @@ apiVersion: serving.knative.dev/v1 kind: Service metadata: - name: activator-with-cc + name: activator namespace: default spec: template: metadata: annotations: - autoscaling.knative.dev/minScale: "100" - autoscaling.knative.dev/maxScale: "150" + autoscaling.knative.dev/minScale: "5" + autoscaling.knative.dev/maxScale: "5" # Always hook the activator in. autoscaling.knative.dev/targetBurstCapacity: "-1" - autoscaling.knative.dev/metricAggregationAlgorithm: "weightedExponential" spec: containers: - image: ko://knative.dev/serving/test/test_images/autoscale - resources: - requests: - cpu: 20m - memory: 20Mi - limits: - cpu: 50m - memory: 50Mi - containerConcurrency: 5 + containerConcurrency: 0 # Explicitly set the default, since it might be overridden in CM. --- apiVersion: serving.knative.dev/v1 kind: Service metadata: - name: activator-with-cc-lin + name: queue-proxy namespace: default spec: template: metadata: annotations: - autoscaling.knative.dev/minScale: "100" - autoscaling.knative.dev/maxScale: "150" - # Always hook the activator in. - autoscaling.knative.dev/targetBurstCapacity: "-1" + autoscaling.knative.dev/minScale: "5" + autoscaling.knative.dev/maxScale: "5" + # Only hook the activator in when scaled to zero. + autoscaling.knative.dev/targetBurstCapacity: "0" spec: containers: - image: ko://knative.dev/serving/test/test_images/autoscale - resources: - requests: - cpu: 20m - memory: 20Mi - limits: - cpu: 50m - memory: 50Mi - containerConcurrency: 5 + containerConcurrency: 0 # Explicitly set the default, since it might be overridden in CM. --- -apiVersion: serving.knative.dev/v1 +apiVersion: v1 kind: Service metadata: - name: queue-proxy-with-cc + name: deployment namespace: default spec: + ports: + - port: 80 + targetPort: 8080 + selector: + app: app1 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: deployment + namespace: default +spec: + replicas: 5 + selector: + matchLabels: + app: app1 template: metadata: - annotations: - autoscaling.knative.dev/minScale: "100" - autoscaling.knative.dev/maxScale: "150" - # Only hook the activator in when scaled to zero. - autoscaling.knative.dev/targetBurstCapacity: "0" + labels: + app: app1 spec: containers: - - image: ko://knative.dev/serving/test/test_images/autoscale - resources: - requests: - cpu: 20m - memory: 20Mi - limits: - cpu: 50m - memory: 50Mi - containerConcurrency: 5 + - name: user-container + image: ko://knative.dev/serving/test/test_images/autoscale + ports: + - name: app1 + containerPort: 8080 --- diff --git a/test/performance/benchmarks/dataplane-probe/dev.config b/test/performance/benchmarks/dataplane-probe/dev.config deleted file mode 100644 index 971a9ff23b21..000000000000 --- a/test/performance/benchmarks/dataplane-probe/dev.config +++ /dev/null @@ -1,109 +0,0 @@ -# Creating this benchmark: -# mako create_benchmark \ -# test/performance/benchmarks/dataplane-probe/dev.config -# Updating this benchmark -# mako update_benchmark \ -# test/performance/benchmarks/dataplane-probe/dev.config -project_name: "Knative" -benchmark_name: "Development - Serving dataplane probe" -description: "Measure dataplane component latency and reliability." -benchmark_key: '6316266134437888' - -# Human owners for manual benchmark adjustments. - -# Anyone can add their IAM robot here to publish to this benchmark. -owner_list: "mako-job@knative-performance.iam.gserviceaccount.com" - -# Define the name and type for x-axis of run charts -input_value_info: { - value_key: "t" - label: "time" - type: TIMESTAMP -} - -# Note: value_key is stored repeatedly and should be very short (ideally one or two characters). -metric_info_list: { - value_key: "kd" - label: "kube-deployment" -} -metric_info_list: { - value_key: "id" - label: "istio-deployment" -} -metric_info_list: { - value_key: "qp" - label: "queue-proxy" -} -metric_info_list: { - value_key: "a" - label: "activator" -} -metric_info_list: { - value_key: "qc" - label: "queue-proxy-with-cc-100" -} -metric_info_list: { - value_key: "qc1" - label: "queue-proxy-with-cc-1" -} -metric_info_list: { - value_key: "qct" - label: "queue-proxy-with-cc-10" -} -metric_info_list: { - value_key: "ac" - label: "activator-with-cc-100" -} -metric_info_list: { - value_key: "act" - label: "activator-with-cc-10" -} -metric_info_list: { - value_key: "ac1" - label: "activator-with-cc-1" -} - -metric_info_list: { - value_key: "ke" - label: "kube-errors" -} -metric_info_list: { - value_key: "ie" - label: "istio-errors" -} -metric_info_list: { - value_key: "qe" - label: "queue-errors" -} -metric_info_list: { - value_key: "ae" - label: "activator-errors" -} -metric_info_list: { - value_key: "re" - label: "queue-errors-with-cc-100" -} -metric_info_list: { - value_key: "ret" - label: "queue-errors-with-cc-10" -} -metric_info_list: { - value_key: "re1" - label: "queue-errors-with-cc-1" -} -metric_info_list: { - value_key: "be" - label: "activator-errors-with-cc-100" -} -metric_info_list: { - value_key: "bet" - label: "activator-errors-with-cc-10" -} -metric_info_list: { - value_key: "be1" - label: "activator-errors-with-cc-1" -} -metric_info_list: { - value_key: "ap" - label: "activator-pod-count" -} diff --git a/test/performance/benchmarks/dataplane-probe/main.go b/test/performance/benchmarks/dataplane-probe/main.go new file mode 100644 index 000000000000..ca5f7ccdf234 --- /dev/null +++ b/test/performance/benchmarks/dataplane-probe/main.go @@ -0,0 +1,184 @@ +/* +Copyright 2022 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES 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 ( + "context" + "flag" + "fmt" + "log" + "net/http" + "os" + "time" + + vegeta "github.com/tsenart/vegeta/v12/lib" + "knative.dev/pkg/injection" + "knative.dev/serving/test/performance/performance" + + "knative.dev/pkg/signals" + "knative.dev/pkg/system" +) + +const ( + benchmarkName = "Knative Serving dataplane probe" +) + +var ( + target = flag.String("target", "", "The target to attack.") + duration = flag.Duration("duration", 5*time.Minute, "The duration of the probe") + minDefault = 100 * time.Millisecond +) + +var ( + // Map the above to our benchmark targets. + targets = map[string]struct { + target vegeta.Target + slaMin time.Duration + slaMax time.Duration + }{ + "deployment": { + target: vegeta.Target{ + Method: http.MethodGet, + URL: "http://deployment.default.svc.cluster.local?sleep=100", + }, + // vanilla deployment falls in the +5ms range. This does not have Knative or Istio components + // on the dataplane, and so it is intended as a canary to flag environmental + // problems that might be causing contemporaneous Knative or Istio runs to fall out of SLA. + slaMin: minDefault, + slaMax: 105 * time.Millisecond, + }, + "queue": { + target: vegeta.Target{ + Method: http.MethodGet, + URL: "http://queue-proxy.default.svc.cluster.local?sleep=100", + }, + // hitting a Knative Service + // going through JUST the queue-proxy falls in the +10ms range. + slaMin: minDefault, + slaMax: 110 * time.Millisecond, + }, + "activator": { + target: vegeta.Target{ + Method: http.MethodGet, + URL: "http://activator.default.svc.cluster.local?sleep=100", + }, + // hitting a Knative Service + // going through BOTH the activator and queue-proxy falls in the +10ms range. + slaMin: minDefault, + slaMax: 110 * time.Millisecond, + }, + } +) + +func main() { + ctx := signals.NewContext() + cfg := injection.ParseAndGetRESTConfigOrDie() + ctx, startInformers := injection.EnableInjectionOrDie(ctx, cfg) + startInformers() + + if *target == "" { + log.Fatalf("-target is a required flag.") + } + + log.Println("Starting dataplane probe for target:", *target) + + ctx, cancel := context.WithTimeout(ctx, *duration+time.Minute) + defer cancel() + + // Based on the "target" flag, load up our target benchmark. + // We only run one variation per run to avoid the runs being noisy neighbors, + // which in early iterations of the benchmark resulted in latency bleeding + // across the different workload types. + t, ok := targets[*target] + if !ok { + log.Fatalf("Unrecognized target: %s", *target) + } + + // Make sure the target is ready before sending the large amount of requests. + if err := performance.ProbeTargetTillReady(t.target.URL, *duration); err != nil { + log.Fatalf("Failed to get target ready for attacking: %v", err) + } + + // Send 1000 QPS (1 per ms) for the given duration with a 30s request timeout. + rate := vegeta.Rate{Freq: 1, Per: time.Millisecond} + targeter := vegeta.NewStaticTargeter(t.target) + attacker := vegeta.NewAttacker(vegeta.Timeout(30 * time.Second)) + + influxReporter, err := performance.NewInfluxReporter(map[string]string{"target": *target}) + if err != nil { + log.Fatalf("failed to create influx reporter: %v", err.Error()) + } + defer influxReporter.FlushAndShutdown() + + // Start the attack! + results := attacker.Attack(targeter, rate, *duration, "load-test") + deploymentStatus := performance.FetchDeploymentStatus(ctx, system.Namespace(), "activator", time.Second) + + var metricResults vegeta.Metrics + +LOOP: + for { + select { + case <-ctx.Done(): + // If we time out or the pod gets shutdown via SIGTERM then start to + // clean thing up. + break LOOP + + case ds := <-deploymentStatus: + // Report number of ready activators. + influxReporter.AddDataPoint(benchmarkName, map[string]interface{}{"activator-pod-count": float64(ds.ReadyReplicas)}) + + case res, ok := <-results: + if ok { + metricResults.Add(res) + } else { + // If there are no more results, then we're done! + // Compute latency percentiles + metricResults.Close() + break LOOP + } + } + } + + // Report results to influx + influxReporter.AddDataPoint(benchmarkName, map[string]interface{}{"requests": float64(metricResults.Requests)}) + influxReporter.AddDataPoint(benchmarkName, map[string]interface{}{"latency-mean": float64(metricResults.Latencies.Mean)}) + influxReporter.AddDataPoint(benchmarkName, map[string]interface{}{"latency-min": float64(metricResults.Latencies.Min)}) + influxReporter.AddDataPoint(benchmarkName, map[string]interface{}{"latency-max": float64(metricResults.Latencies.Max)}) + influxReporter.AddDataPoint(benchmarkName, map[string]interface{}{"errors": float64(len(metricResults.Errors))}) + + // Report to stdout + _ = vegeta.NewTextReporter(&metricResults).Report(os.Stdout) + + if err := checkSLA(metricResults, t.slaMin, t.slaMax); err != nil { + log.Fatalf(err.Error()) + } + + log.Println("Dataplane probe test finished") +} + +func checkSLA(results vegeta.Metrics, slaMin time.Duration, slaMax time.Duration) error { + // SLA 1: The p95 latency hitting the target has to be between the range defined + // in the target map on top. + if results.Latencies.P95 >= slaMin && results.Latencies.P95 <= slaMax { + log.Printf("SLA 1 passed. P95 latency is in %d-%dms time range", slaMin, slaMax) + } else { + return fmt.Errorf("SLA 1 failed. P95 latency is not in %d-%dms time range: %s", slaMin, slaMax, results.Latencies.P95) + } + + return nil +} diff --git a/test/performance/benchmarks/deployment-probe/continuous/kodata/dev.config b/test/performance/benchmarks/deployment-probe/continuous/kodata/dev.config deleted file mode 120000 index ee953f22c05e..000000000000 --- a/test/performance/benchmarks/deployment-probe/continuous/kodata/dev.config +++ /dev/null @@ -1 +0,0 @@ -../../dev.config \ No newline at end of file diff --git a/test/performance/benchmarks/deployment-probe/continuous/sla.go b/test/performance/benchmarks/deployment-probe/continuous/sla.go deleted file mode 100644 index 2a0f92a5f774..000000000000 --- a/test/performance/benchmarks/deployment-probe/continuous/sla.go +++ /dev/null @@ -1,70 +0,0 @@ -/* -Copyright 2022 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES 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 ( - "time" - - tpb "github.com/google/mako/clients/proto/analyzers/threshold_analyzer_go_proto" - mpb "github.com/google/mako/spec/proto/mako_go_proto" - - "knative.dev/pkg/ptr" - "knative.dev/pkg/test/mako" -) - -// This analyzer validates that the p95 latency deploying a new service takes up -// to 25 seconds. -func newDeploy95PercentileLatency(tags ...string) *tpb.ThresholdAnalyzerInput { - return &tpb.ThresholdAnalyzerInput{ - Name: ptr.String("Deploy p95 latency"), - Configs: []*tpb.ThresholdConfig{{ - Min: bound(0 * time.Second), - Max: bound(25 * time.Second), - DataFilter: &mpb.DataFilter{ - DataType: mpb.DataFilter_METRIC_AGGREGATE_PERCENTILE.Enum(), - PercentileMilliRank: ptr.Int32(95000), - ValueKey: ptr.String("dl"), - }, - }}, - CrossRunConfig: mako.NewCrossRunConfig(10, tags...), - } -} - -// This analyzer validates that the number of services deployed to "Ready=True". -// Configured to run for 35m with a frequency of 5s, the theoretical limit is 420 -// if deployments take 0s. Factoring in deployment latency, we will miss a -// handful of the trailing deployments, so we relax this to 410. -func newReadyDeploymentCount(tags ...string) *tpb.ThresholdAnalyzerInput { - return &tpb.ThresholdAnalyzerInput{ - Name: ptr.String("Ready deployment count"), - Configs: []*tpb.ThresholdConfig{{ - Min: ptr.Float64(410), - Max: ptr.Float64(420), - DataFilter: &mpb.DataFilter{ - DataType: mpb.DataFilter_METRIC_AGGREGATE_COUNT.Enum(), - ValueKey: ptr.String("dl"), - }, - }}, - CrossRunConfig: mako.NewCrossRunConfig(10, tags...), - } -} - -// bound is a helper for making the inline SLOs more readable by expressing -// them as durations. -func bound(d time.Duration) *float64 { - return ptr.Float64(d.Seconds()) -} diff --git a/test/performance/benchmarks/deployment-probe/dev.config b/test/performance/benchmarks/deployment-probe/dev.config deleted file mode 100644 index 97460b393a94..000000000000 --- a/test/performance/benchmarks/deployment-probe/dev.config +++ /dev/null @@ -1,52 +0,0 @@ -# Creating this benchmark: -# mako create_benchmark \ -# test/performance/benchmarks/deployment-probe/dev.config -# Updating this benchmark -# mako update_benchmark \ -# test/performance/benchmarks/deployment-probe/dev.config -project_name: "Knative" -benchmark_name: "Development - Serving deployment probe" -description: "Measure deployment latency." -benchmark_key: '5915474038620160' - -# Human owners for manual benchmark adjustments. - -# Anyone can add their IAM robot here to publish to this benchmark. -owner_list: "mako-job@knative-performance.iam.gserviceaccount.com" - -# Define the name and type for x-axis of run charts -input_value_info: { - value_key: "t" - label: "time" - type: TIMESTAMP -} - -# Note: value_key is stored repeatedly and should be very short (ideally one or two characters). -metric_info_list: { - value_key: "dl" - label: "deployment-latency" -} -metric_info_list: { - value_key: "cl" - label: "configuration-latency" -} -metric_info_list: { - value_key: "rl" - label: "route-latency" -} -metric_info_list: { - value_key: "rvl" - label: "revision-latency" -} -metric_info_list: { - value_key: "il" - label: "ingress-latency" -} -metric_info_list: { - value_key: "sksl" - label: "sks-latency" -} -metric_info_list: { - value_key: "pal" - label: "podautoscaler-latency" -} diff --git a/test/performance/benchmarks/load-test/continuous/kodata/dev.config b/test/performance/benchmarks/load-test/continuous/kodata/dev.config deleted file mode 120000 index ee953f22c05e..000000000000 --- a/test/performance/benchmarks/load-test/continuous/kodata/dev.config +++ /dev/null @@ -1 +0,0 @@ -../../dev.config \ No newline at end of file diff --git a/test/performance/benchmarks/load-test/continuous/main.go b/test/performance/benchmarks/load-test/continuous/main.go deleted file mode 100644 index 099b8a69cffc..000000000000 --- a/test/performance/benchmarks/load-test/continuous/main.go +++ /dev/null @@ -1,182 +0,0 @@ -/* -Copyright 2022 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES 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 ( - "context" - "flag" - "fmt" - "log" - "net/http" - "time" - - "github.com/google/mako/go/quickstore" - vegeta "github.com/tsenart/vegeta/v12/lib" - "k8s.io/apimachinery/pkg/labels" - - netv1alpha1 "knative.dev/networking/pkg/apis/networking/v1alpha1" - "knative.dev/pkg/signals" - "knative.dev/pkg/test/mako" - pkgpacers "knative.dev/pkg/test/vegeta/pacers" - "knative.dev/serving/pkg/apis/serving" - "knative.dev/serving/test/performance" - "knative.dev/serving/test/performance/metrics" -) - -const ( - namespace = "default" - benchmarkName = "Development - Serving load testing" -) - -var ( - flavor = flag.String("flavor", "", "The flavor of the benchmark to run.") - selector labels.Selector -) - -func processResults(ctx context.Context, q *quickstore.Quickstore, results <-chan *vegeta.Result) { - // Create a new aggregateResult to accumulate the results. - ar := metrics.NewAggregateResult(0) - - // When the benchmark completes, iterate over the accumulated rates - // and add them as sample points. - defer func() { - for t, req := range ar.RequestRates { - q.AddSamplePoint(mako.XTime(time.Unix(t, 0)), map[string]float64{ - "rs": float64(req), - }) - performance.AddInfluxPoint(benchmarkName, map[string]interface{}{"rs": float64(req)}) - } - for t, err := range ar.ErrorRates { - q.AddSamplePoint(mako.XTime(time.Unix(t, 0)), map[string]float64{ - "es": float64(err), - }) - performance.AddInfluxPoint(benchmarkName, map[string]interface{}{"es": float64(err)}) - } - }() - - ctx, cancel := context.WithCancel(ctx) - deploymentStatus := metrics.FetchDeploymentsStatus(ctx, namespace, selector, time.Second) - sksMode := metrics.FetchSKSStatus(ctx, namespace, selector, time.Second) - defer cancel() - - for { - select { - case res, ok := <-results: - // If there are no more results, then we're done! - if !ok { - return - } - // Handle the result for this request - metrics.HandleResult(q, benchmarkName, *res, "l", ar) - case ds := <-deploymentStatus: - // Add a sample point for the deployment status - q.AddSamplePoint(mako.XTime(ds.Time), map[string]float64{ - "dp": float64(ds.DesiredReplicas), - "ap": float64(ds.ReadyReplicas), - }) - performance.AddInfluxPoint(benchmarkName, - map[string]interface{}{"ap": float64(ds.ReadyReplicas), "dp": float64(ds.DesiredReplicas)}) - case sksm := <-sksMode: - // Add a sample point for the serverless service mode - mode := float64(0) - if sksm.Mode == netv1alpha1.SKSOperationModeProxy { - mode = 1.0 - } - q.AddSamplePoint(mako.XTime(sksm.Time), map[string]float64{ - "sks": mode, - "na": float64(sksm.NumActivators), - }) - performance.AddInfluxPoint(benchmarkName, - map[string]interface{}{"sks": mode, "na": float64(sksm.NumActivators)}) - } - } -} - -func main() { - flag.Parse() - - if *flavor == "" { - log.Fatalf("-flavor is a required flag.") - } - selector = labels.SelectorFromSet(labels.Set{ - serving.ServiceLabelKey: "load-test-" + *flavor, - }) - - // We want this for properly handling Kubernetes container lifecycle events. - ctx := signals.NewContext() - - // We cron every 10 minutes, so give ourselves 8 minutes to complete. - ctx, cancel := context.WithTimeout(ctx, 8*time.Minute) - defer cancel() - - // Use the benchmark key created. - tbcTag := "tbc=" + *flavor - mc, err := mako.Setup(ctx, tbcTag) - if err != nil { - log.Fatal("Failed to setup mako: ", err) - } - q, qclose, ctx := mc.Quickstore, mc.ShutDownFunc, mc.Context - // Use a fresh context here so that our RPC to terminate the sidecar - // isn't subject to our timeout (or we won't shut it down when we time out) - defer qclose(context.Background()) - - // Wrap fatalf in a helper or our sidecar will live forever. - fatalf := func(f string, args ...interface{}) { - qclose(context.Background()) - log.Fatalf(f, args...) - } - - q.Input.ThresholdInputs = append(q.Input.ThresholdInputs, - newLoadTest95PercentileLatency(tbcTag), - newLoadTestMaximumLatency(tbcTag), - newLoadTestMaximumErrorRate(tbcTag)) - - log.Print("Starting the load test.") - // Ramp up load from 1k to 3k in 2 minute steps. - const duration = 2 * time.Minute - url := fmt.Sprintf("http://load-test-%s.default.svc.cluster.local?sleep=100", *flavor) - targeter := vegeta.NewStaticTargeter(vegeta.Target{ - Method: http.MethodGet, - URL: url, - }) - - // Make sure the target is ready before sending the large amount of requests. - if err := performance.ProbeTargetTillReady(url, duration); err != nil { - fatalf("Failed to get target ready for attacking: %v", err) - } - // Wait for scale back to 0 - if err := performance.WaitForScaleToZero(ctx, namespace, selector, 2*time.Minute); err != nil { - fatalf("Failed to wait for scale-to-0: %v", err) - } - - pacers := make([]vegeta.Pacer, 3) - durations := make([]time.Duration, 3) - for i := 1; i < 4; i++ { - pacers[i-1] = vegeta.Rate{Freq: i, Per: time.Millisecond} - durations[i-1] = duration - } - pacer, err := pkgpacers.NewCombined(pacers, durations) - if err != nil { - fatalf("Error creating the pacer: %v", err) - } - results := vegeta.NewAttacker().Attack(targeter, pacer, 3*duration, "load-test") - processResults(ctx, q, results) - - if err := mc.StoreAndHandleResult(); err != nil { - fatalf("Failed to store and handle benchmarking result: %v", err) - } -} diff --git a/test/performance/benchmarks/load-test/continuous/sla.go b/test/performance/benchmarks/load-test/continuous/sla.go deleted file mode 100644 index be9a308c6176..000000000000 --- a/test/performance/benchmarks/load-test/continuous/sla.go +++ /dev/null @@ -1,87 +0,0 @@ -/* -Copyright 2022 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES 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 ( - "time" - - tpb "github.com/google/mako/clients/proto/analyzers/threshold_analyzer_go_proto" - mpb "github.com/google/mako/spec/proto/mako_go_proto" - "knative.dev/pkg/ptr" - "knative.dev/pkg/test/mako" -) - -// This analyzer validates that the p95 latency over the 0->3k stepped burst -// falls in the +15ms range. This includes a mix of cold-starts and steady -// state (once the autoscaling decisions have leveled off). -func newLoadTest95PercentileLatency(tags ...string) *tpb.ThresholdAnalyzerInput { - return &tpb.ThresholdAnalyzerInput{ - Name: ptr.String("95p latency"), - Configs: []*tpb.ThresholdConfig{{ - Min: bound(100 * time.Millisecond), - Max: bound(115 * time.Millisecond), - DataFilter: &mpb.DataFilter{ - DataType: mpb.DataFilter_METRIC_AGGREGATE_PERCENTILE.Enum(), - PercentileMilliRank: ptr.Int32(95000), - ValueKey: ptr.String("l"), - }, - }}, - CrossRunConfig: mako.NewCrossRunConfig(10, tags...), - } -} - -// This analyzer validates that the maximum request latency observed over the 0->3k -// stepped burst is no more than +10 seconds. This is not strictly a cold-start -// metric, but it is a superset that includes steady state latency and the latency -// of non-cold-start overload requests. -func newLoadTestMaximumLatency(tags ...string) *tpb.ThresholdAnalyzerInput { - return &tpb.ThresholdAnalyzerInput{ - Name: ptr.String("Maximum latency"), - Configs: []*tpb.ThresholdConfig{{ - Min: bound(100 * time.Millisecond), - Max: bound(100*time.Millisecond + 10*time.Second), - DataFilter: &mpb.DataFilter{ - DataType: mpb.DataFilter_METRIC_AGGREGATE_MAX.Enum(), - ValueKey: ptr.String("l"), - }, - }}, - CrossRunConfig: mako.NewCrossRunConfig(10, tags...), - } -} - -// This analyzer validates that the mean error rate observed over the 0->3k -// stepped burst is 0. -func newLoadTestMaximumErrorRate(tags ...string) *tpb.ThresholdAnalyzerInput { - return &tpb.ThresholdAnalyzerInput{ - Name: ptr.String("Mean error rate"), - Configs: []*tpb.ThresholdConfig{{ - // TODO(chizhg): set the error rate check back to 0 after https://github.com/knative/serving/issues/10074 is fixed. - Max: ptr.Float64(1), - DataFilter: &mpb.DataFilter{ - DataType: mpb.DataFilter_METRIC_AGGREGATE_MEAN.Enum(), - ValueKey: ptr.String("es"), - }, - }}, - CrossRunConfig: mako.NewCrossRunConfig(10, tags...), - } -} - -// bound is a helper for making the inline SLOs more readable by expressing -// them as durations. -func bound(d time.Duration) *float64 { - return ptr.Float64(d.Seconds()) -} diff --git a/test/performance/benchmarks/load-test/dev.config b/test/performance/benchmarks/load-test/dev.config deleted file mode 100644 index fd613436bd90..000000000000 --- a/test/performance/benchmarks/load-test/dev.config +++ /dev/null @@ -1,56 +0,0 @@ -# Creating this benchmark: -# mako create_benchmark \ -# test/performance/benchmarks/load-test/dev.config -# Updating this benchmark: -# mako update_benchmark \ -# test/performance/benchmarks/load-test/dev.config -project_name: "Knative" -benchmark_name: "Development - Serving load testing" -description: "Load test 0->1k->2k->3k against a ksvc (with several TBC values)." -benchmark_key: '6297841731371008' - -# Human owners for manual benchmark adjustments. - -# Anyone can add their IAM robot here to publish to this benchmark. -owner_list: "mako-job@knative-performance.iam.gserviceaccount.com" - -# Define the name and type for x-axis of run charts -input_value_info: { - value_key: "t" - label: "time" - type: TIMESTAMP -} - -# Note: value_key is stored repeatedly and should be very short (ideally one or two characters). -metric_info_list: { - value_key: "l" - label: "latency" -} - -# Used to track errors/sec and requests/sec alongside latency -metric_info_list: { - value_key: "es" - label: "errs-sec" -} -metric_info_list: { - value_key: "rs" - label: "requests-sec" -} - -# Used to track desired and actual pod counts alongside latency -metric_info_list: { - value_key: "dp" - label: "desired-pods" -} -metric_info_list: { - value_key: "ap" - label: "available-pods" -} -metric_info_list: { - value_key: "sks" - label: "sks-proxy" -} -metric_info_list: { - value_key: "na" - label: "num-activators" -} diff --git a/test/performance/benchmarks/load-test/continuous/load-test-0-direct.yaml b/test/performance/benchmarks/load-test/load-test-0-direct.yaml similarity index 68% rename from test/performance/benchmarks/load-test/continuous/load-test-0-direct.yaml rename to test/performance/benchmarks/load-test/load-test-0-direct.yaml index e8ce6c75c357..fb0e7fe0906a 100644 --- a/test/performance/benchmarks/load-test/continuous/load-test-0-direct.yaml +++ b/test/performance/benchmarks/load-test/load-test-0-direct.yaml @@ -45,32 +45,31 @@ spec: serviceAccountName: loader containers: - name: load-test - image: ko://knative.dev/serving/test/performance/benchmarks/load-test/continuous + image: ko://knative.dev/serving/test/performance/benchmarks/load-test args: - "-flavor=zero" + env: + - name: KO_DOCKER_REPO + value: @KO_DOCKER_REPO@ + - name: SYSTEM_NAMESPACE + value: @SYSTEM_NAMESPACE@ + - name: INFLUX_URL + valueFrom: + secretKeyRef: + name: performance-test-config + key: influxurl + - name: INFLUX_TOKEN + valueFrom: + secretKeyRef: + name: performance-test-config + key: influxtoken + - name: PROW_TAG + valueFrom: + secretKeyRef: + name: performance-test-config + key: prowtag resources: requests: cpu: 1000m memory: 3Gi - volumeMounts: - - name: config-mako - mountPath: /etc/config-mako - - name: mako-stub - image: ko://knative.dev/pkg/test/mako/stub-sidecar - args: - - "-p=10001" - ports: - - name: quickstore - containerPort: 9813 - volumeMounts: - - name: config-mako - mountPath: /etc/config-mako - terminationMessagePolicy: FallbackToLogsOnError - resources: - requests: - memory: 4Gi - volumes: - - name: config-mako - configMap: - name: config-mako restartPolicy: Never diff --git a/test/performance/benchmarks/load-test/continuous/load-test-200-direct.yaml b/test/performance/benchmarks/load-test/load-test-200-direct.yaml similarity index 68% rename from test/performance/benchmarks/load-test/continuous/load-test-200-direct.yaml rename to test/performance/benchmarks/load-test/load-test-200-direct.yaml index ecc0492cc6cf..d339106d227c 100644 --- a/test/performance/benchmarks/load-test/continuous/load-test-200-direct.yaml +++ b/test/performance/benchmarks/load-test/load-test-200-direct.yaml @@ -45,32 +45,31 @@ spec: serviceAccountName: loader containers: - name: load-test - image: ko://knative.dev/serving/test/performance/benchmarks/load-test/continuous + image: ko://knative.dev/serving/test/performance/benchmarks/load-test args: - "-flavor=200" + env: + - name: KO_DOCKER_REPO + value: @KO_DOCKER_REPO@ + - name: SYSTEM_NAMESPACE + value: @SYSTEM_NAMESPACE@ + - name: INFLUX_URL + valueFrom: + secretKeyRef: + name: performance-test-config + key: influxurl + - name: INFLUX_TOKEN + valueFrom: + secretKeyRef: + name: performance-test-config + key: influxtoken + - name: PROW_TAG + valueFrom: + secretKeyRef: + name: performance-test-config + key: prowtag resources: requests: cpu: 1000m memory: 3Gi - volumeMounts: - - name: config-mako - mountPath: /etc/config-mako - - name: mako-stub - image: ko://knative.dev/pkg/test/mako/stub-sidecar - args: - - "-p=10001" - ports: - - name: quickstore - containerPort: 9813 - volumeMounts: - - name: config-mako - mountPath: /etc/config-mako - terminationMessagePolicy: FallbackToLogsOnError - resources: - requests: - memory: 4Gi - volumes: - - name: config-mako - configMap: - name: config-mako restartPolicy: Never diff --git a/test/performance/benchmarks/load-test/continuous/load-test-always-direct.yaml b/test/performance/benchmarks/load-test/load-test-always-direct.yaml similarity index 68% rename from test/performance/benchmarks/load-test/continuous/load-test-always-direct.yaml rename to test/performance/benchmarks/load-test/load-test-always-direct.yaml index ecd16d94909c..56bd8e0ee1c7 100644 --- a/test/performance/benchmarks/load-test/continuous/load-test-always-direct.yaml +++ b/test/performance/benchmarks/load-test/load-test-always-direct.yaml @@ -45,32 +45,31 @@ spec: serviceAccountName: loader containers: - name: load-test - image: ko://knative.dev/serving/test/performance/benchmarks/load-test/continuous + image: ko://knative.dev/serving/test/performance/benchmarks/load-test args: - "-flavor=always" + env: + - name: KO_DOCKER_REPO + value: @KO_DOCKER_REPO@ + - name: SYSTEM_NAMESPACE + value: @SYSTEM_NAMESPACE@ + - name: INFLUX_URL + valueFrom: + secretKeyRef: + name: performance-test-config + key: influxurl + - name: INFLUX_TOKEN + valueFrom: + secretKeyRef: + name: performance-test-config + key: influxtoken + - name: PROW_TAG + valueFrom: + secretKeyRef: + name: performance-test-config + key: prowtag resources: requests: cpu: 1000m memory: 3Gi - volumeMounts: - - name: config-mako - mountPath: /etc/config-mako - - name: mako-stub - image: ko://knative.dev/pkg/test/mako/stub-sidecar - args: - - "-p=10001" - ports: - - name: quickstore - containerPort: 9813 - volumeMounts: - - name: config-mako - mountPath: /etc/config-mako - terminationMessagePolicy: FallbackToLogsOnError - resources: - requests: - memory: 4Gi - volumes: - - name: config-mako - configMap: - name: config-mako restartPolicy: Never diff --git a/test/performance/benchmarks/load-test/continuous/load-test-setup.yaml b/test/performance/benchmarks/load-test/load-test-setup.yaml similarity index 100% rename from test/performance/benchmarks/load-test/continuous/load-test-setup.yaml rename to test/performance/benchmarks/load-test/load-test-setup.yaml diff --git a/test/performance/benchmarks/load-test/main.go b/test/performance/benchmarks/load-test/main.go new file mode 100644 index 000000000000..76db78d2e67a --- /dev/null +++ b/test/performance/benchmarks/load-test/main.go @@ -0,0 +1,191 @@ +/* +Copyright 2022 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES 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 ( + "context" + "flag" + "fmt" + "log" + "net/http" + "os" + "time" + + vegeta "github.com/tsenart/vegeta/v12/lib" + "k8s.io/apimachinery/pkg/labels" + "knative.dev/pkg/injection" + "knative.dev/serving/test/performance/performance" + + netv1alpha1 "knative.dev/networking/pkg/apis/networking/v1alpha1" + "knative.dev/pkg/signals" + pkgpacers "knative.dev/pkg/test/vegeta/pacers" + "knative.dev/serving/pkg/apis/serving" +) + +const ( + namespace = "default" + benchmarkName = "Knative Serving load test" +) + +var ( + flavor = flag.String("flavor", "", "The flavor of the benchmark to run.") +) + +func main() { + ctx := signals.NewContext() + cfg := injection.ParseAndGetRESTConfigOrDie() + ctx, startInformers := injection.EnableInjectionOrDie(ctx, cfg) + startInformers() + + if *flavor == "" { + log.Fatalf("-flavor is a required flag.") + } + selector := labels.SelectorFromSet(labels.Set{ + serving.ServiceLabelKey: "load-test-" + *flavor, + }) + + // We cron every 10 minutes, so give ourselves 8 minutes to complete. + ctx, cancel := context.WithTimeout(ctx, 8*time.Minute) + defer cancel() + + influxReporter, err := performance.NewInfluxReporter(map[string]string{"flavor": *flavor}) + if err != nil { + log.Fatalf("failed to create influx reporter: %v", err.Error()) + } + defer influxReporter.FlushAndShutdown() + + log.Print("Starting the load test.") + // Ramp up load from 1k to 3k in 2 minute steps. + const duration = 2 * time.Minute + url := fmt.Sprintf("http://load-test-%s.default.svc.cluster.local?sleep=100", *flavor) + targeter := vegeta.NewStaticTargeter(vegeta.Target{ + Method: http.MethodGet, + URL: url, + }) + + // Make sure the target is ready before sending the large amount of requests. + if err := performance.ProbeTargetTillReady(url, duration); err != nil { + log.Fatalf("Failed to get target ready for attacking: %v", err) + } + // Wait for scale back to 0 + if err := performance.WaitForScaleToZero(ctx, namespace, selector, 2*time.Minute); err != nil { + log.Fatalf("Failed to wait for scale-to-0: %v", err) + } + + // Run vegeta attack with custom pacers and process results from channel + pacers := make([]vegeta.Pacer, 3) + durations := make([]time.Duration, 3) + for i := 1; i < 4; i++ { + pacers[i-1] = vegeta.Rate{Freq: i, Per: time.Millisecond} + durations[i-1] = duration + } + pacer, err := pkgpacers.NewCombined(pacers, durations) + if err != nil { + log.Fatalf("Error creating the pacer: %v", err) + } + resultsChan := vegeta.NewAttacker().Attack(targeter, pacer, 3*duration, "load-test") + metricResults := processResults(ctx, resultsChan, influxReporter, selector) + + // Report results to influx + influxReporter.AddDataPoint(benchmarkName, map[string]interface{}{"requests": float64(metricResults.Requests)}) + influxReporter.AddDataPoint(benchmarkName, map[string]interface{}{"latency-mean": float64(metricResults.Latencies.Mean)}) + influxReporter.AddDataPoint(benchmarkName, map[string]interface{}{"latency-min": float64(metricResults.Latencies.Min)}) + influxReporter.AddDataPoint(benchmarkName, map[string]interface{}{"latency-max": float64(metricResults.Latencies.Max)}) + influxReporter.AddDataPoint(benchmarkName, map[string]interface{}{"errors": float64(len(metricResults.Errors))}) + + // Report to stdout + _ = vegeta.NewTextReporter(metricResults).Report(os.Stdout) + + if err := checkSLA(metricResults); err != nil { + log.Fatalf(err.Error()) + } + + log.Println("Load test finished") +} + +func processResults(ctx context.Context, results <-chan *vegeta.Result, reporter *performance.InfluxReporter, selector labels.Selector) *vegeta.Metrics { + ctx, cancel := context.WithCancel(ctx) + deploymentStatus := performance.FetchDeploymentsStatus(ctx, namespace, selector, time.Second) + sksMode := performance.FetchSKSStatus(ctx, namespace, selector, time.Second) + defer cancel() + + var metricResults *vegeta.Metrics + + for { + select { + case <-ctx.Done(): + // If we time out or the pod gets shutdown via SIGTERM then start to + // clean thing up. + return nil + + case res, ok := <-results: + if ok { + metricResults.Add(res) + } else { + // If there are no more results, then we're done! + // Compute latency percentiles + metricResults.Close() + + return metricResults + } + + case ds := <-deploymentStatus: + // Add a sample point for the deployment status + reporter.AddDataPoint(benchmarkName, + map[string]interface{}{"ready-replicas": float64(ds.ReadyReplicas), "desired-replicas": float64(ds.DesiredReplicas)}) + + case sksm := <-sksMode: + // Add a sample point for the serverless service mode + mode := float64(0) + if sksm.Mode == netv1alpha1.SKSOperationModeProxy { + mode = 1.0 + } + reporter.AddDataPoint(benchmarkName, + map[string]interface{}{"sks": mode, "num-activators": float64(sksm.NumActivators)}) + } + } +} + +func checkSLA(results *vegeta.Metrics) error { + // SLA 1: the p95 latency has to be over the 0->3k stepped burst + // falls in the +15ms range (we sleep 100 ms, so 100-115ms). + // This includes a mix of cold-starts and steady state (once the autoscaling decisions have leveled off). + if results.Latencies.P95 >= 100*time.Millisecond && results.Latencies.P95 <= 115*time.Millisecond { + log.Println("SLA 1 passed. P95 latency is in 100-115ms time range") + } else { + return fmt.Errorf("SLA 1 failed. P95 latency is not in 100-115ms time range: %s", results.Latencies.P95) + } + + // SLA 2: the maximum request latency observed over the 0->3k + // stepped burst is no more than +10 seconds. This is not strictly a cold-start + // metric, but it is a superset that includes steady state latency and the latency + // of non-cold-start overload requests. + if results.Latencies.Max <= 10*time.Second { + log.Println("SLA 2 passed. Max latency is below 10s") + } else { + return fmt.Errorf("SLA 2 failed. Max latency is above 10s: %s", results.Latencies.Max) + } + + // SLA 3: The mean error rate observed over the 0->3k stepped burst is 0. + if len(results.Errors) == 0 { + log.Println("SLA 3 passed. No errors occurred") + } else { + return fmt.Errorf("SLA 3 failed. Errors occurred: %d", len(results.Errors)) + } + + return nil +} diff --git a/test/performance/benchmarks/deployment-probe/continuous/kodata/basic-template.yaml b/test/performance/benchmarks/reconciliation-delay/kodata/knative-service-template.yaml similarity index 94% rename from test/performance/benchmarks/deployment-probe/continuous/kodata/basic-template.yaml rename to test/performance/benchmarks/reconciliation-delay/kodata/knative-service-template.yaml index 3b792f0639bb..057059891e2a 100644 --- a/test/performance/benchmarks/deployment-probe/continuous/kodata/basic-template.yaml +++ b/test/performance/benchmarks/reconciliation-delay/kodata/knative-service-template.yaml @@ -22,7 +22,7 @@ spec: spec: enableServiceLinks: false containers: - - image: gcr.io/knative-samples/autoscale-go:0.1 + - image: ghcr.io/knative/autoscale-go:latest # Limit resources so that we can pack more on-cluster. resources: requests: diff --git a/test/performance/benchmarks/deployment-probe/continuous/main.go b/test/performance/benchmarks/reconciliation-delay/main.go similarity index 54% rename from test/performance/benchmarks/deployment-probe/continuous/main.go rename to test/performance/benchmarks/reconciliation-delay/main.go index db5ff24c8599..81e3f72b9437 100644 --- a/test/performance/benchmarks/deployment-probe/continuous/main.go +++ b/test/performance/benchmarks/reconciliation-delay/main.go @@ -19,182 +19,106 @@ package main import ( "context" "flag" + "fmt" "log" + "math" "os" "path/filepath" "time" - "github.com/google/mako/go/quickstore" + vegeta "github.com/tsenart/vegeta/v12/lib" + "k8s.io/apimachinery/pkg/types" + "knative.dev/pkg/injection" + "knative.dev/pkg/signals" "sigs.k8s.io/yaml" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/watch" "knative.dev/pkg/apis" + netv1alpha1 "knative.dev/networking/pkg/apis/networking/v1alpha1" + networkingclient "knative.dev/networking/pkg/client/injection/client" duckv1 "knative.dev/pkg/apis/duck/v1" "knative.dev/pkg/kmeta" "knative.dev/pkg/ptr" - "knative.dev/pkg/signals" - - netv1alpha1 "knative.dev/networking/pkg/apis/networking/v1alpha1" - networkingclient "knative.dev/networking/pkg/client/injection/client" - "knative.dev/pkg/test/mako" autoscalingv1alpha1 "knative.dev/serving/pkg/apis/autoscaling/v1alpha1" v1 "knative.dev/serving/pkg/apis/serving/v1" servingclient "knative.dev/serving/pkg/client/injection/client" - "knative.dev/serving/test/performance" + "knative.dev/serving/test/performance/performance" ) const ( - benchmarkName = "Development - Serving deployment probe" + benchmarkName = "Knative Serving reconciliation delay" + template = "knative-service-template.yaml" ) var ( - template = flag.String("template", "", "The service template to load from kodata/") - duration = flag.Duration("duration", 5*time.Minute, "The duration of the benchmark to run.") + duration = flag.Duration("duration", 1*time.Minute, "The duration of the benchmark to run.") frequency = flag.Duration("frequency", 5*time.Second, "The frequency at which to create services.") ) -func readTemplate() (*v1.Service, error) { - path := filepath.Join(os.Getenv("KO_DATA_PATH"), *template+"-template.yaml") - b, err := os.ReadFile(path) - if err != nil { - return nil, err - } - svc := &v1.Service{} - if err := yaml.Unmarshal(b, svc); err != nil { - return nil, err - } - - svc.OwnerReferences = []metav1.OwnerReference{{ - APIVersion: "v1", - Kind: "Pod", - Name: os.Getenv("POD_NAME"), - UID: types.UID(os.Getenv("POD_UID")), - Controller: ptr.Bool(true), - BlockOwnerDeletion: ptr.Bool(true), - }} - - return svc, nil -} - -func handle(q *quickstore.Quickstore, svc kmeta.Accessor, status duckv1.Status, - seen sets.String, metric string) { - if seen.Has(svc.GetName()) { - return - } - cc := status.GetCondition(apis.ConditionReady) - if cc == nil || cc.Status == corev1.ConditionUnknown { - return - } - seen.Insert(svc.GetName()) - created := svc.GetCreationTimestamp().Time - ready := cc.LastTransitionTime.Inner.Time - elapsed := ready.Sub(created) - - if cc.Status == corev1.ConditionTrue { - q.AddSamplePoint(mako.XTime(created), map[string]float64{ - metric: elapsed.Seconds(), - }) - log.Print("Ready: ", svc.GetName()) - performance.AddInfluxPoint(benchmarkName, map[string]interface{}{metric: elapsed.Seconds()}) - } else if cc.Status == corev1.ConditionFalse { - q.AddError(mako.XTime(created), cc.Message) - log.Printf("Not Ready: %s; %s: %s", svc.GetName(), cc.Reason, cc.Message) - } -} - func main() { - flag.Parse() - - // We want this for properly handling Kubernetes container lifecycle events. ctx := signals.NewContext() + cfg := injection.ParseAndGetRESTConfigOrDie() + ctx, startInformers := injection.EnableInjectionOrDie(ctx, cfg) + startInformers() tmpl, err := readTemplate() if err != nil { - log.Fatalf("Unable to read template %s: %v", *template, err) + log.Fatalf("Unable to read template %s: %v", template, err) } - // We cron every 30 minutes, so make sure that we don't severely overrun to - // limit how noisy a neighbor we can be. ctx, cancel := context.WithTimeout(ctx, *duration) defer cancel() - // Tag this run with the various flag values. - tags := []string{ - "template=" + *template, - "duration=" + duration.String(), - "frequency=" + frequency.String(), - } - mc, err := mako.Setup(ctx, tags...) - if err != nil { - log.Fatal("Failed to setup mako: ", err) - } - q, qclose, ctx := mc.Quickstore, mc.ShutDownFunc, mc.Context - // Use a fresh context here so that our RPC to terminate the sidecar - // isn't subject to our timeout (or we won't shut it down when we time out) - defer qclose(context.Background()) - sc := servingclient.Get(ctx) - cleanup := func() error { + cleanupServices := func() error { return sc.ServingV1().Services(tmpl.Namespace).DeleteCollection( context.Background(), metav1.DeleteOptions{}, metav1.ListOptions{}) } - defer cleanup() + defer cleanupServices() - // Wrap fatalf in a helper or our sidecar will live forever. + // Wrap fatalf to make sure we clean up our created resources fatalf := func(f string, args ...interface{}) { - qclose(context.Background()) - cleanup() + cleanupServices() log.Fatalf(f, args...) } - // Set up the threshold analyzers for the selected benchmark. This will - // cause Mako/Quickstore to analyze the results we are storing and flag - // things that are outside of expected bounds. - q.Input.ThresholdInputs = append(q.Input.ThresholdInputs, - newDeploy95PercentileLatency(tags...), - newReadyDeploymentCount(tags...), - ) - - if err := cleanup(); err != nil { + if err := cleanupServices(); err != nil { fatalf("Error cleaning up services: %v", err) } lo := metav1.ListOptions{TimeoutSeconds: ptr.Int64(int64(duration.Seconds()))} - // TODO(mattmoor): We could maybe use a duckv1.KResource to eliminate this boilerplate. - serviceWI, err := sc.ServingV1().Services(tmpl.Namespace).Watch(ctx, lo) if err != nil { fatalf("Unable to watch services: %v", err) } defer serviceWI.Stop() - serviceSeen := sets.String{} + serviceSeen := sets.Set[string]{} configurationWI, err := sc.ServingV1().Configurations(tmpl.Namespace).Watch(ctx, lo) if err != nil { fatalf("Unable to watch configurations: %v", err) } defer configurationWI.Stop() - configurationSeen := sets.String{} + configurationSeen := sets.Set[string]{} routeWI, err := sc.ServingV1().Routes(tmpl.Namespace).Watch(ctx, lo) if err != nil { fatalf("Unable to watch routes: %v", err) } defer routeWI.Stop() - routeSeen := sets.String{} + routeSeen := sets.Set[string]{} revisionWI, err := sc.ServingV1().Revisions(tmpl.Namespace).Watch(ctx, lo) if err != nil { fatalf("Unable to watch revisions: %v", err) } defer revisionWI.Stop() - revisionSeen := sets.String{} + revisionSeen := sets.Set[string]{} nc := networkingclient.Get(ctx) ingressWI, err := nc.NetworkingV1alpha1().Ingresses(tmpl.Namespace).Watch(ctx, lo) @@ -202,35 +126,43 @@ func main() { fatalf("Unable to watch ingresss: %v", err) } defer ingressWI.Stop() - ingressSeen := sets.String{} + ingressSeen := sets.Set[string]{} sksWI, err := nc.NetworkingV1alpha1().ServerlessServices(tmpl.Namespace).Watch(ctx, lo) if err != nil { fatalf("Unable to watch skss: %v", err) } defer sksWI.Stop() - sksSeen := sets.String{} + sksSeen := sets.Set[string]{} paWI, err := sc.AutoscalingV1alpha1().PodAutoscalers(tmpl.Namespace).Watch(ctx, lo) if err != nil { fatalf("Unable to watch pas: %v", err) } defer paWI.Stop() - paSeen := sets.String{} + paSeen := sets.Set[string]{} tick := time.NewTicker(*frequency) - func() { + metricResults := func() *vegeta.Metrics { + influxReporter, err := performance.NewInfluxReporter(map[string]string{}) + if err != nil { + fatalf(fmt.Sprintf("failed to create influx reporter: %v", err.Error())) + } + defer influxReporter.FlushAndShutdown() + + // We use vegeta.Metrics here as a metrics collector because it already contains logic to calculate percentiles + mr := &vegeta.Metrics{} for { select { case <-ctx.Done(): - // If we timeout or the pod gets shutdown via SIGTERM then start to - // clean thing up. - return + // If we time out or the pod gets shutdown via SIGTERM then start to clean thing up. + // Compute latency percentiles + mr.Close() + return mr - case ts := <-tick.C: + case <-tick.C: svc, err := sc.ServingV1().Services(tmpl.Namespace).Create(ctx, tmpl, metav1.CreateOptions{}) if err != nil { - q.AddError(mako.XTime(ts), err.Error()) log.Println("Error creating service:", err) break } @@ -242,7 +174,7 @@ func main() { break } svc := event.Object.(*v1.Service) - handle(q, svc, svc.Status.Status, serviceSeen, "dl") + handleEvent(influxReporter, mr, svc, svc.Status.Status, serviceSeen, "Service") case event := <-configurationWI.ResultChan(): if event.Type != watch.Modified { @@ -250,7 +182,7 @@ func main() { break } cfg := event.Object.(*v1.Configuration) - handle(q, cfg, cfg.Status.Status, configurationSeen, "cl") + handleEvent(influxReporter, mr, cfg, cfg.Status.Status, configurationSeen, "Configuration") case event := <-routeWI.ResultChan(): if event.Type != watch.Modified { @@ -258,7 +190,7 @@ func main() { break } rt := event.Object.(*v1.Route) - handle(q, rt, rt.Status.Status, routeSeen, "rl") + handleEvent(influxReporter, mr, rt, rt.Status.Status, routeSeen, "Route") case event := <-revisionWI.ResultChan(): if event.Type != watch.Modified { @@ -266,7 +198,7 @@ func main() { break } rev := event.Object.(*v1.Revision) - handle(q, rev, rev.Status.Status, revisionSeen, "rvl") + handleEvent(influxReporter, mr, rev, rev.Status.Status, revisionSeen, "Revision") case event := <-ingressWI.ResultChan(): if event.Type != watch.Modified { @@ -274,7 +206,7 @@ func main() { break } ing := event.Object.(*netv1alpha1.Ingress) - handle(q, ing, ing.Status.Status, ingressSeen, "il") + handleEvent(influxReporter, mr, ing, ing.Status.Status, ingressSeen, "Ingress") case event := <-sksWI.ResultChan(): if event.Type != watch.Modified { @@ -282,7 +214,7 @@ func main() { break } ing := event.Object.(*netv1alpha1.ServerlessService) - handle(q, ing, ing.Status.Status, sksSeen, "sksl") + handleEvent(influxReporter, mr, ing, ing.Status.Status, sksSeen, "ServerlessService") case event := <-paWI.ResultChan(): if event.Type != watch.Modified { @@ -290,15 +222,102 @@ func main() { break } pa := event.Object.(*autoscalingv1alpha1.PodAutoscaler) - handle(q, pa, pa.Status.Status, paSeen, "pal") + handleEvent(influxReporter, mr, pa, pa.Status.Status, paSeen, "PodAutoscaler") } } }() - // Commit this benchmark run to Mako! - out, err := q.Store() + // Report to stdout + _ = vegeta.NewTextReporter(metricResults).Report(os.Stdout) + + expectedServices := duration.Seconds() / frequency.Seconds() + if err := checkSLA(metricResults, expectedServices); err != nil { + fatalf(err.Error()) + } + + log.Println("Reconciliation delay run finished") +} + +func handleEvent(influxReporter *performance.InfluxReporter, metricResults *vegeta.Metrics, svc kmeta.Accessor, + status duckv1.Status, seen sets.Set[string], metric string) { + if seen.Has(svc.GetName()) { + return + } + + cc := status.GetCondition(apis.ConditionReady) + if cc == nil || cc.Status == corev1.ConditionUnknown { + return + } + + seen.Insert(svc.GetName()) + created := svc.GetCreationTimestamp().Time + ready := cc.LastTransitionTime.Inner.Time + elapsed := ready.Sub(created) + + if cc.Status == corev1.ConditionTrue { + influxReporter.AddDataPoint(benchmarkName, map[string]interface{}{metric: elapsed.Seconds()}) + result := vegeta.Result{ + Latency: elapsed, + } + // We need to count ready Services separately, for the SLA + if metric == "Service" { + result.Code = 200 + } + metricResults.Add(&result) + } else if cc.Status == corev1.ConditionFalse { + log.Printf("Not Ready: %s; %s: %s", svc.GetName(), cc.Reason, cc.Message) + } +} + +func readTemplate() (*v1.Service, error) { + path := filepath.Join(os.Getenv("KO_DATA_PATH"), template) + b, err := os.ReadFile(path) if err != nil { - fatalf("q.Store error: %v: %v", out, err) + return nil, err } - log.Printf("Done! Run: %s\n", out.GetRunChartLink()) + svc := &v1.Service{} + if err := yaml.Unmarshal(b, svc); err != nil { + return nil, err + } + + // only set ownerReferences when deployed to a cluster + podName := os.Getenv("POD_NAME") + if podName != "" { + svc.OwnerReferences = []metav1.OwnerReference{{ + APIVersion: "v1", + Kind: "Pod", + Name: podName, + UID: types.UID(os.Getenv("POD_UID")), + Controller: ptr.Bool(true), + BlockOwnerDeletion: ptr.Bool(true), + }} + } + + return svc, nil +} + +func checkSLA(results *vegeta.Metrics, expectedReadyServices float64) error { + // SLA 1: The p95 latency deploying a new service takes up to max 25 seconds. + if results.Latencies.P95 >= 0*time.Second && results.Latencies.P95 <= 25*time.Second { + log.Println("SLA 1 passed. P95 latency is in 0-25s time range") + } else { + return fmt.Errorf("SLA 1 failed. P95 latency is not in 0-25s time range: %s", results.Latencies.P95) + } + + // SLA 2: The number of services deployed to "Ready=True" should be reached. + // Example: Configured to run for 35m with a frequency of 5s, the theoretical limit is 420 + // if deployments take 0s. Factoring in deployment latency, we will miss a + // handful of the trailing deployments, so we relax this a bit to 97% of that. + relaxedExpectedReadyServices := math.Floor(expectedReadyServices * 0.97) + + // Success is a percentage of all requests, so we need to multiply this by the total requests + readyServices := results.Success * float64(results.Requests) + if readyServices >= relaxedExpectedReadyServices && readyServices <= expectedReadyServices { + log.Println("SLA 2 passed. Amount of ready services is within the expected range") + } else { + return fmt.Errorf("SLA 2 failed. Amount of ready services is out of the expected range. Is: %f, Range: %f-%f", + readyServices, relaxedExpectedReadyServices, expectedReadyServices) + } + + return nil } diff --git a/test/performance/benchmarks/deployment-probe/continuous/benchmark-direct.yaml b/test/performance/benchmarks/reconciliation-delay/reconciliation-delay.yaml similarity index 56% rename from test/performance/benchmarks/deployment-probe/continuous/benchmark-direct.yaml rename to test/performance/benchmarks/reconciliation-delay/reconciliation-delay.yaml index 64ce68f4e59c..ec89288676a1 100644 --- a/test/performance/benchmarks/deployment-probe/continuous/benchmark-direct.yaml +++ b/test/performance/benchmarks/reconciliation-delay/reconciliation-delay.yaml @@ -15,7 +15,7 @@ apiVersion: v1 kind: ServiceAccount metadata: - name: prober + name: reconciliation-delay namespace: default --- apiVersion: rbac.authorization.k8s.io/v1 @@ -25,7 +25,7 @@ metadata: namespace: default subjects: - kind: ServiceAccount - name: prober + name: reconciliation-delay namespace: default roleRef: kind: ClusterRole @@ -35,52 +35,49 @@ roleRef: apiVersion: batch/v1 kind: Job metadata: - name: deployment-probe + name: reconciliation-delay namespace: default spec: parallelism: 1 backoffLimit: 0 template: spec: - serviceAccountName: prober + serviceAccountName: reconciliation-delay containers: - name: probe - image: ko://knative.dev/serving/test/performance/benchmarks/deployment-probe/continuous + image: ko://knative.dev/serving/test/performance/benchmarks/reconciliation-delay args: - - "-template=basic" - "-duration=35m" - "-frequency=5s" resources: requests: cpu: 100m env: - - name: POD_NAME - valueFrom: - fieldRef: - fieldPath: metadata.name - - name: POD_UID - valueFrom: - fieldRef: - fieldPath: metadata.uid - volumeMounts: - - name: config-mako - mountPath: /etc/config-mako - - name: mako-stub - image: ko://knative.dev/pkg/test/mako/stub-sidecar - args: - - "-p=10001" - ports: - - name: quickstore - containerPort: 9813 - volumeMounts: - - name: config-mako - mountPath: /etc/config-mako - terminationMessagePolicy: FallbackToLogsOnError - resources: - requests: - memory: 4Gi - volumes: - - name: config-mako - configMap: - name: config-mako + - name: KO_DOCKER_REPO + value: @KO_DOCKER_REPO@ + - name: SYSTEM_NAMESPACE + value: @SYSTEM_NAMESPACE@ + - name: INFLUX_URL + valueFrom: + secretKeyRef: + name: performance-test-config + key: influxurl + - name: INFLUX_TOKEN + valueFrom: + secretKeyRef: + name: performance-test-config + key: influxtoken + - name: PROW_TAG + valueFrom: + secretKeyRef: + name: performance-test-config + key: prowtag + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: POD_UID + valueFrom: + fieldRef: + fieldPath: metadata.uid restartPolicy: Never diff --git a/test/performance/benchmarks/rollout-probe/continuous/kodata/dev.config b/test/performance/benchmarks/rollout-probe/continuous/kodata/dev.config deleted file mode 120000 index ee953f22c05e..000000000000 --- a/test/performance/benchmarks/rollout-probe/continuous/kodata/dev.config +++ /dev/null @@ -1 +0,0 @@ -../../dev.config \ No newline at end of file diff --git a/test/performance/benchmarks/rollout-probe/continuous/main.go b/test/performance/benchmarks/rollout-probe/continuous/main.go deleted file mode 100644 index 46228213f427..000000000000 --- a/test/performance/benchmarks/rollout-probe/continuous/main.go +++ /dev/null @@ -1,250 +0,0 @@ -/* -Copyright 2022 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES 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 ( - "context" - "flag" - "log" - "strings" - "time" - - vegeta "github.com/tsenart/vegeta/v12/lib" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/labels" - - servingclient "knative.dev/serving/pkg/client/injection/client" - - "knative.dev/pkg/signals" - "knative.dev/pkg/test/mako" - "knative.dev/serving/pkg/apis/autoscaling" - "knative.dev/serving/pkg/apis/serving" - "knative.dev/serving/test/performance" - "knative.dev/serving/test/performance/metrics" -) - -var ( - target = flag.String("target", "", "The target to attack.") - duration = flag.Duration("duration", 5*time.Minute, "The duration of the probe") -) - -const ( - namespace = "default" - benchmarkName = "Development - Serving rollout probe" -) - -func main() { - flag.Parse() - - // We want this for properly handling Kubernetes container lifecycle events. - ctx := signals.NewContext() - - // We cron quite often, so make sure that we don't severely overrun to - // limit how noisy a neighbor we can be. - ctx, cancel := context.WithTimeout(ctx, *duration+time.Minute) - defer cancel() - - // Use the benchmark key created - mc, err := mako.Setup(ctx) - if err != nil { - log.Fatal("Failed to setup mako: ", err) - } - q, qclose, ctx := mc.Quickstore, mc.ShutDownFunc, mc.Context - // Use a fresh context here so that our RPC to terminate the sidecar - // isn't subject to our timeout (or we won't shut it down when we time out) - defer qclose(context.Background()) - - // Wrap fatalf in a helper or our sidecar will live forever. - fatalf := func(f string, args ...interface{}) { - qclose(context.Background()) - log.Fatalf(f, args...) - } - - // Validate flags after setting up "fatalf" or our sidecar will run forever. - if *target == "" { - fatalf("Missing flag: -target") - } - - // Based on the "target" flag, load up our target benchmark. - // We only run one variation per run to avoid the runs being noisy neighbors, - // which in early iterations of the benchmark resulted in latency bleeding - // across the different workload types. - t, ok := targets[*target] - if !ok { - fatalf("Unrecognized target: %s", *target) - } - - // Make sure the target is ready before sending the large amount of requests. - if err := performance.ProbeTargetTillReady(t.target.URL, *duration); err != nil { - fatalf("Failed to get target ready for attacking: %v", err) - } - - // Set up the threshold analyzers for the selected benchmark. This will - // cause Mako/Quickstore to analyze the results we are storing and flag - // things that are outside of expected bounds. - q.Input.ThresholdInputs = append(q.Input.ThresholdInputs, t.analyzers...) - - // Send 1k QPS for the given duration with a 30s request timeout. - rate := vegeta.Rate{Freq: 3600, Per: time.Second} - targeter := vegeta.NewStaticTargeter(t.target) - attacker := vegeta.NewAttacker(vegeta.Timeout(30 * time.Second)) - - // Create a new aggregateResult to accumulate the results. - ar := metrics.NewAggregateResult(int(duration.Seconds())) - - selector := labels.SelectorFromSet(labels.Set{ - serving.ServiceLabelKey: *target, - }) - log.Print("Selector: ", selector) - - // Setup background metric processes - deploymentStatus := metrics.FetchDeploymentsStatus(ctx, namespace, selector, time.Second) - routeStatus := metrics.FetchRouteStatus(ctx, namespace, *target, time.Second) - - // Start the attack! - results := attacker.Attack(targeter, rate, *duration, "rollout-test") - firstRev, secondRev := "", "" - - // After a minute, update the Ksvc. - updateSvc := time.After(30 * time.Second) - - // Since we might qfatal in the end, this would not execute the deferred calls - // thus failing the restore. So bind and execute explicitly. - var restoreFn func() -LOOP: - for { - select { - case <-ctx.Done(): - // If we timeout or the pod gets shutdown via SIGTERM then start to - // clean thing up. - break LOOP - - case <-updateSvc: - log.Println("Updating the service:", *target) - sc := servingclient.Get(ctx) - svc, err := sc.ServingV1().Services(namespace).Get(context.Background(), *target, metav1.GetOptions{}) - if err != nil { - log.Fatalf("Error getting ksvc %s: %v", *target, err) - } - svc = svc.DeepCopy() - // Make sure we start with a single instance. - - // At the end of the benchmark, restore to the previous value. - if prev := svc.Spec.Template.Annotations[autoscaling.MinScaleAnnotationKey]; prev != "" { - restoreFn = func() { - restore, err := sc.ServingV1().Services(namespace).Get(context.Background(), *target, metav1.GetOptions{}) - if err != nil { - log.Println("Error getting service", err) - return - } - restore = restore.DeepCopy() - restore.Spec.Template.Annotations[autoscaling.MinScaleAnnotationKey] = prev - _, err = sc.ServingV1().Services(namespace).Update( - context.Background(), restore, metav1.UpdateOptions{}) - log.Printf("Restoring the service to initial minScale = %s, err: %#v", prev, err) - // Also remove the oldest revision, to keep the list of revisions short. - sc.ServingV1().Revisions(namespace).Delete(ctx, restore.Status.LatestReadyRevisionName, - metav1.DeleteOptions{}) - } - } - svc.Spec.Template.Annotations[autoscaling.MinScaleAnnotationKey] = "1" - _, err = sc.ServingV1().Services(namespace).Update(context.Background(), svc, metav1.UpdateOptions{}) - if err != nil { - fatalf("Error updating ksvc %s: %v", *target, err) - } - log.Println("Successfully updated the service.") - case res, ok := <-results: - if !ok { - // Once we have read all of the request results, break out of - // our loop. - break LOOP - } - // Handle the result for this request. - metrics.HandleResult(q, benchmarkName, *res, t.stat, ar) - case ds := <-deploymentStatus: - // Ignore deployment updates until we get current one. - if firstRev == "" { - break LOOP - } - // Deployment name contains revision name. - // If it is the first one -- report it. - if strings.Contains(ds.DeploymentName, firstRev) { - // Add a sample point for the deployment status. - q.AddSamplePoint(mako.XTime(ds.Time), map[string]float64{ - "dp": float64(ds.DesiredReplicas), - "ap": float64(ds.ReadyReplicas), - }) - performance.AddInfluxPoint(benchmarkName, - map[string]interface{}{"dp": float64(ds.DesiredReplicas), "ap": float64(ds.ReadyReplicas)}) - } else if secondRev != "" && strings.Contains(ds.DeploymentName, secondRev) { - // Otherwise eport the pods for the new deployment. - q.AddSamplePoint(mako.XTime(ds.Time), map[string]float64{ - "dp2": float64(ds.DesiredReplicas), - "ap2": float64(ds.ReadyReplicas), - }) - performance.AddInfluxPoint(benchmarkName, - map[string]interface{}{"dp2": float64(ds.DesiredReplicas), "ap2": float64(ds.ReadyReplicas)}) - // Ignore all other revisions' deployments if there are, since - // they are from previous test run iterations and we don't care about - // their reported scale values (should be 0 & 100 depending on which - // one it is). - } - case rs := <-routeStatus: - if firstRev == "" { - firstRev = rs.Traffic[0].RevisionName - log.Println("Inferred first revision =", firstRev) - } - v := make(map[string]float64, 2) - if len(rs.Traffic) == 1 { - // If the name matches the first revision then it's before - // we started the rollout. If not, then the rollout is - // 100% complete. - if rs.Traffic[0].RevisionName == firstRev { - v["t1"] = float64(*rs.Traffic[0].Percent) - } else { - v["t2"] = float64(*rs.Traffic[0].Percent) - } - } else { - v["t1"] = float64(*rs.Traffic[0].Percent) - v["t2"] = float64(*rs.Traffic[1].Percent) - if secondRev == "" { - secondRev = rs.Traffic[1].RevisionName - log.Println("Inferred second revision =", secondRev) - } - } - q.AddSamplePoint(mako.XTime(rs.Time), v) - } - } - if restoreFn != nil { - restoreFn() - } - - // Walk over our accumulated per-second error rates and report them as - // sample points. The key is seconds since the Unix epoch, and the value - // is the number of errors observed in that second. - for ts, count := range ar.ErrorRates { - q.AddSamplePoint(mako.XTime(time.Unix(ts, 0)), map[string]float64{ - t.estat: float64(count), - }) - } - - // Commit data to Mako and handle the result. - if err := mc.StoreAndHandleResult(); err != nil { - fatalf("Failed to store and handle benchmarking result: %v", err) - } -} diff --git a/test/performance/benchmarks/rollout-probe/continuous/sla.go b/test/performance/benchmarks/rollout-probe/continuous/sla.go deleted file mode 100644 index 3b5980e17932..000000000000 --- a/test/performance/benchmarks/rollout-probe/continuous/sla.go +++ /dev/null @@ -1,122 +0,0 @@ -/* -Copyright 2022 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES 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 ( - "net/http" - "time" - - tpb "github.com/google/mako/clients/proto/analyzers/threshold_analyzer_go_proto" - mpb "github.com/google/mako/spec/proto/mako_go_proto" - vegeta "github.com/tsenart/vegeta/v12/lib" - "knative.dev/pkg/ptr" - "knative.dev/pkg/test/mako" -) - -// This function constructs an analyzer that validates the p95 aggregate value of the given metric. -func new95PercentileLatency(name, valueKey string, min, max time.Duration) *tpb.ThresholdAnalyzerInput { - return &tpb.ThresholdAnalyzerInput{ - Name: ptr.String(name), - Configs: []*tpb.ThresholdConfig{{ - Min: bound(min), - Max: bound(max), - DataFilter: &mpb.DataFilter{ - DataType: mpb.DataFilter_METRIC_AGGREGATE_PERCENTILE.Enum(), - PercentileMilliRank: ptr.Int32(95000), - ValueKey: ptr.String(valueKey), - }, - }}, - CrossRunConfig: mako.NewCrossRunConfig(10), - } -} - -// This analyzer validates that the p95 latency hitting a Knative Service -// going through JUST the queue-proxy falls in the +10ms range. -func newQueue95PercentileLatency(valueKey string) *tpb.ThresholdAnalyzerInput { - return new95PercentileLatency("Queue p95 latency", valueKey, 100*time.Millisecond, 110*time.Millisecond) -} - -// This analyzer validates that the p95 latency hitting a Knative Service -// going through BOTH the activator and queue-proxy falls in the +10ms range. -func newActivator95PercentileLatency(valueKey string) *tpb.ThresholdAnalyzerInput { - return new95PercentileLatency("Activator p95 latency", valueKey, 100*time.Millisecond, 110*time.Millisecond) -} - -var ( - // Map the above to our benchmark targets. - targets = map[string]struct { - target vegeta.Target - stat string - estat string - analyzers []*tpb.ThresholdAnalyzerInput - }{ - "queue-proxy": { - target: vegeta.Target{ - Method: http.MethodGet, - URL: "http://queue-proxy.default.svc.cluster.local?sleep=100", - }, - stat: "q", - estat: "qe", - analyzers: []*tpb.ThresholdAnalyzerInput{newQueue95PercentileLatency("q")}, - }, - "queue-proxy-with-cc": { - target: vegeta.Target{ - Method: http.MethodGet, - URL: "http://queue-proxy-with-cc.default.svc.cluster.local?sleep=100", - }, - stat: "qc", - estat: "qce", - // We use the same threshold analyzer, since we want Breaker to exert minimal latency impact. - analyzers: []*tpb.ThresholdAnalyzerInput{newQueue95PercentileLatency("qc")}, - }, - "activator": { - target: vegeta.Target{ - Method: http.MethodGet, - URL: "http://activator.default.svc.cluster.local?sleep=100", - }, - stat: "a", - estat: "ae", - analyzers: []*tpb.ThresholdAnalyzerInput{newActivator95PercentileLatency("a")}, - }, - "activator-with-cc": { - target: vegeta.Target{ - Method: http.MethodGet, - URL: "http://activator-with-cc.default.svc.cluster.local?sleep=100", - }, - stat: "ac", - estat: "ace", - // We use the same threshold analyzer, since we want Throttler/Breaker to exert minimal latency impact. - analyzers: []*tpb.ThresholdAnalyzerInput{newActivator95PercentileLatency("ac")}, - }, - "activator-with-cc-lin": { - target: vegeta.Target{ - Method: http.MethodGet, - URL: "http://activator-with-cc-lin.default.svc.cluster.local?sleep=100", - }, - stat: "ac", - estat: "ace", - // We use the same threshold analyzer, since we want Throttler/Breaker to exert minimal latency impact. - analyzers: []*tpb.ThresholdAnalyzerInput{newActivator95PercentileLatency("ac")}, - }, - } -) - -// bound is a helper for making the inline SLOs more readable by expressing -// them as durations. -func bound(d time.Duration) *float64 { - return ptr.Float64(d.Seconds()) -} diff --git a/test/performance/benchmarks/rollout-probe/dev.config b/test/performance/benchmarks/rollout-probe/dev.config deleted file mode 100644 index d92e25fbcacb..000000000000 --- a/test/performance/benchmarks/rollout-probe/dev.config +++ /dev/null @@ -1,92 +0,0 @@ -# Creating this benchmark: -# mako create_benchmark \ -# test/performance/benchmarks/rollout-probe/continuous/dev.config -# Updating this benchmark -# mako update_benchmark \ -# test/performance/benchmarks/rollout-probe/dev.config -project_name: "Knative" -benchmark_name: "Development - Serving rollout probe" -description: "Measure rollout flakiness under load" -benchmark_key: '5205911243063296' - -# Human owners for manual benchmark adjustments. - -# Anyone can add their IAM robot here to publish to this benchmark. -owner_list: "mako-job@knative-performance.iam.gserviceaccount.com" - -# Define the name and type for x-axis of run charts -input_value_info: { - value_key: "t" - label: "time" - type: TIMESTAMP -} - -# Note: value_key is stored repeatedly and should be very short (ideally one or two characters). -metric_info_list: { - value_key: "q" - label: "queue-proxy" -} -metric_info_list: { - value_key: "al" - label: "activator-linear" -} -metric_info_list: { - value_key: "a" - label: "activator" -} -metric_info_list: { - value_key: "qc" - label: "queue-proxy-with-cc" -} -metric_info_list: { - value_key: "ac" - label: "activator-with-cc" -} - -# error metrics. -metric_info_list: { - value_key: "qe" - label: "queue-errors" -} -metric_info_list: { - value_key: "qce" - label: "queue-cc-errors" -} -metric_info_list: { - value_key: "el" - label: "activator-linear-errors" -} -metric_info_list: { - value_key: "ae" - label: "activator-errors" -} -metric_info_list: { - value_key: "ace" - label: "activator-cc-errors" -} - -# additional metrics -metric_info_list: { - value_key: "dp" - label: "desired-pods" -} -metric_info_list: { - value_key: "ap" - label: "available-pods" -} -metric_info_list: { - value_key: "dp2" - label: "desired-pods-new" -} -metric_info_list: { - value_key: "ap2" - label: "available-pods-new" -} -metric_info_list: { - value_key: "t1" - label: "tarffic-old" -} -metric_info_list: { - value_key: "t2" - label: "tarffic-new" -} diff --git a/test/performance/benchmarks/rollout-probe/main.go b/test/performance/benchmarks/rollout-probe/main.go new file mode 100644 index 000000000000..6f229a59110c --- /dev/null +++ b/test/performance/benchmarks/rollout-probe/main.go @@ -0,0 +1,236 @@ +/* +Copyright 2022 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES 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 ( + "context" + "flag" + "fmt" + "log" + "net/http" + "os" + "strings" + "time" + + vegeta "github.com/tsenart/vegeta/v12/lib" + "knative.dev/pkg/injection" + "knative.dev/serving/test/performance/performance" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + + servingclient "knative.dev/serving/pkg/client/injection/client" + + "knative.dev/pkg/signals" + "knative.dev/serving/pkg/apis/autoscaling" + "knative.dev/serving/pkg/apis/serving" +) + +var ( + target = flag.String("target", "", "The target to attack.") + duration = flag.Duration("duration", 5*time.Minute, "The duration of the probe") +) + +var ( + // Map the above to our benchmark targets. + targets = map[string]struct{ target vegeta.Target }{ + "queue-proxy-with-cc": { + target: vegeta.Target{ + Method: http.MethodGet, + URL: "http://queue-proxy-with-cc.default.svc.cluster.local?sleep=100", + }, + }, + "activator-with-cc": { + target: vegeta.Target{ + Method: http.MethodGet, + URL: "http://activator-with-cc.default.svc.cluster.local?sleep=100", + }, + }, + "activator-with-cc-lin": { + target: vegeta.Target{ + Method: http.MethodGet, + URL: "http://activator-with-cc-lin.default.svc.cluster.local?sleep=100", + }, + }, + } +) + +const ( + namespace = "default" + benchmarkName = "Knative Serving rollout probe" +) + +func main() { + ctx := signals.NewContext() + cfg := injection.ParseAndGetRESTConfigOrDie() + ctx, startInformers := injection.EnableInjectionOrDie(ctx, cfg) + startInformers() + + if *target == "" { + log.Fatalf("-target is a required flag.") + } + + // We cron quite often, so make sure that we don't severely overrun to + // limit how noisy a neighbor we can be. + ctx, cancel := context.WithTimeout(ctx, *duration+time.Minute) + defer cancel() + + // Based on the "target" flag, load up our target benchmark. + // We only run one variation per run to avoid the runs being noisy neighbors, + // which in early iterations of the benchmark resulted in latency bleeding + // across the different workload types. + t, ok := targets[*target] + if !ok { + log.Fatalf("Unrecognized target: %s", *target) + } + + // Make sure the target is ready before sending the large amount of requests. + if err := performance.ProbeTargetTillReady(t.target.URL, *duration); err != nil { + log.Fatalf("Failed to get target ready for attacking: %v", err) + } + + // Send 1k QPS for the given duration with a 30s request timeout. + rate := vegeta.Rate{Freq: 3600, Per: time.Second} + targeter := vegeta.NewStaticTargeter(t.target) + attacker := vegeta.NewAttacker(vegeta.Timeout(30 * time.Second)) + + selector := labels.SelectorFromSet(labels.Set{ + serving.ServiceLabelKey: *target, + }) + log.Print("Running rollout probe test with selector: ", selector) + + influxReporter, err := performance.NewInfluxReporter(map[string]string{"target": *target}) + if err != nil { + log.Fatalf("failed to create influx reporter: %v", err.Error()) + } + defer influxReporter.FlushAndShutdown() + + // Setup background metric processes + deploymentStatus := performance.FetchDeploymentsStatus(ctx, namespace, selector, time.Second) + routeStatus := performance.FetchRouteStatus(ctx, namespace, *target, time.Second) + + // Start the attack! + results := attacker.Attack(targeter, rate, *duration, "rollout-test") + firstRev, secondRev := "", "" + + // After a minute, update the Ksvc. + updateSvc := time.After(30 * time.Second) + + var metricResults vegeta.Metrics + +LOOP: + for { + select { + case <-ctx.Done(): + // If we time out or the pod gets shutdown via SIGTERM then start to + // clean thing up. + break LOOP + + case <-updateSvc: + log.Println("Updating the service:", *target) + sc := servingclient.Get(ctx) + svc, err := sc.ServingV1().Services(namespace).Get(context.Background(), *target, metav1.GetOptions{}) + if err != nil { + log.Fatalf("Error getting ksvc %s: %v", *target, err) + } + svc = svc.DeepCopy() + + // Update min-scale to 1 + svc.Spec.Template.Annotations[autoscaling.MinScaleAnnotationKey] = "1" + _, err = sc.ServingV1().Services(namespace).Update(context.Background(), svc, metav1.UpdateOptions{}) + if err != nil { + log.Fatalf("Error updating ksvc %s: %v", *target, err) + } + log.Println("Successfully updated the service.") + + case res, ok := <-results: + if ok { + metricResults.Add(res) + } else { + // If there are no more results, then we're done! + // Compute latency percentiles + metricResults.Close() + break LOOP + } + + case ds := <-deploymentStatus: + // Ignore deployment updates until we get current one. + if firstRev == "" { + break LOOP + } + // Deployment name contains revision name. + // If it is the first one -- report it. + if strings.Contains(ds.DeploymentName, firstRev) { + // Add a sample point for the deployment status. + influxReporter.AddDataPoint(benchmarkName, + map[string]interface{}{"desired-pods": float64(ds.DesiredReplicas), "available-pods": float64(ds.ReadyReplicas)}) + } else if secondRev != "" && strings.Contains(ds.DeploymentName, secondRev) { + // Otherwise eport the pods for the new deployment. + influxReporter.AddDataPoint(benchmarkName, + map[string]interface{}{"desired-pods-new": float64(ds.DesiredReplicas), "available-pods-new": float64(ds.ReadyReplicas)}) + // Ignore all other revisions' deployments if there are, since + // they are from previous test run iterations, and we don't care about + // their reported scale values (should be 0 & 100 depending on which + // one it is). + } + + case rs := <-routeStatus: + if firstRev == "" { + firstRev = rs.Traffic[0].RevisionName + log.Println("Inferred first revision =", firstRev) + } + if len(rs.Traffic) != 1 { + // If the name matches the first revision then it's before + // we started the rollout. If not, then the rollout is + // 100% complete. + if secondRev == "" { + secondRev = rs.Traffic[1].RevisionName + log.Println("Inferred second revision =", secondRev) + } + } + } + } + + // Report results to influx + influxReporter.AddDataPoint(benchmarkName, map[string]interface{}{"requests": float64(metricResults.Requests)}) + influxReporter.AddDataPoint(benchmarkName, map[string]interface{}{"latency-mean": float64(metricResults.Latencies.Mean)}) + influxReporter.AddDataPoint(benchmarkName, map[string]interface{}{"latency-min": float64(metricResults.Latencies.Min)}) + influxReporter.AddDataPoint(benchmarkName, map[string]interface{}{"latency-max": float64(metricResults.Latencies.Max)}) + influxReporter.AddDataPoint(benchmarkName, map[string]interface{}{"errors": float64(len(metricResults.Errors))}) + + // Report to stdout + _ = vegeta.NewTextReporter(&metricResults).Report(os.Stdout) + + if err := checkSLA(metricResults); err != nil { + log.Fatalf(err.Error()) + } + + log.Println("Load test finished") +} + +func checkSLA(results vegeta.Metrics) error { + // SLA 1: The p95 latency hitting a Knative Service + // going through either JUST the queue-proxy or BOTH the activator and queue-proxy + // falls in the +10ms range. Given that we sleep 100ms, the SLA is between 100-110ms. + if results.Latencies.P95 >= 100*time.Millisecond && results.Latencies.P95 <= 110*time.Millisecond { + log.Println("SLA 1 passed. P95 latency is in 100-110ms time range") + } else { + return fmt.Errorf("SLA 1 failed. P95 latency is not in 100-110ms time range: %s", results.Latencies.P95) + } + + return nil +} diff --git a/test/performance/benchmarks/rollout-probe/continuous/rollout-probe-activator-lin-direct.yaml b/test/performance/benchmarks/rollout-probe/rollout-probe-activator-direct-lin.yaml similarity index 67% rename from test/performance/benchmarks/rollout-probe/continuous/rollout-probe-activator-lin-direct.yaml rename to test/performance/benchmarks/rollout-probe/rollout-probe-activator-direct-lin.yaml index 88f95837af1b..c601e863e9c0 100644 --- a/test/performance/benchmarks/rollout-probe/continuous/rollout-probe-activator-lin-direct.yaml +++ b/test/performance/benchmarks/rollout-probe/rollout-probe-activator-direct-lin.yaml @@ -35,7 +35,7 @@ roleRef: apiVersion: batch/v1 kind: Job metadata: - name: rollout-probe-activator-with-cc-lin + name: rollout-probe-activator-direct-lin namespace: default spec: parallelism: 1 @@ -45,31 +45,30 @@ spec: serviceAccountName: prober containers: - name: rollout-probe - image: ko://knative.dev/serving/test/performance/benchmarks/rollout-probe/continuous + image: ko://knative.dev/serving/test/performance/benchmarks/rollout-probe args: ["-target=activator-with-cc-lin", "--duration=3m"] + env: + - name: KO_DOCKER_REPO + value: @KO_DOCKER_REPO@ + - name: SYSTEM_NAMESPACE + value: @SYSTEM_NAMESPACE@ + - name: INFLUX_URL + valueFrom: + secretKeyRef: + name: performance-test-config + key: influxurl + - name: INFLUX_TOKEN + valueFrom: + secretKeyRef: + name: performance-test-config + key: influxtoken + - name: PROW_TAG + valueFrom: + secretKeyRef: + name: performance-test-config + key: prowtag resources: requests: cpu: 1000m memory: 3Gi - volumeMounts: - - name: config-mako - mountPath: /etc/config-mako - - name: mako-stub - image: ko://knative.dev/pkg/test/mako/stub-sidecar - args: - - "-p=10001" - ports: - - name: quickstore - containerPort: 9813 - volumeMounts: - - name: config-mako - mountPath: /etc/config-mako - terminationMessagePolicy: FallbackToLogsOnError - resources: - requests: - memory: 4Gi - volumes: - - name: config-mako - configMap: - name: config-mako restartPolicy: Never diff --git a/test/performance/benchmarks/rollout-probe/continuous/rollout-probe-activator-direct.yaml b/test/performance/benchmarks/rollout-probe/rollout-probe-activator-direct.yaml similarity index 67% rename from test/performance/benchmarks/rollout-probe/continuous/rollout-probe-activator-direct.yaml rename to test/performance/benchmarks/rollout-probe/rollout-probe-activator-direct.yaml index b870a1c933f4..717d063ef38e 100644 --- a/test/performance/benchmarks/rollout-probe/continuous/rollout-probe-activator-direct.yaml +++ b/test/performance/benchmarks/rollout-probe/rollout-probe-activator-direct.yaml @@ -35,7 +35,7 @@ roleRef: apiVersion: batch/v1 kind: Job metadata: - name: rollout-probe-activator-with-cc + name: rollout-probe-activator-direct namespace: default spec: parallelism: 1 @@ -45,31 +45,30 @@ spec: serviceAccountName: prober containers: - name: rollout-probe - image: ko://knative.dev/serving/test/performance/benchmarks/rollout-probe/continuous + image: ko://knative.dev/serving/test/performance/benchmarks/rollout-probe args: ["-target=activator-with-cc", "--duration=3m"] + env: + - name: KO_DOCKER_REPO + value: @KO_DOCKER_REPO@ + - name: SYSTEM_NAMESPACE + value: @SYSTEM_NAMESPACE@ + - name: INFLUX_URL + valueFrom: + secretKeyRef: + name: performance-test-config + key: influxurl + - name: INFLUX_TOKEN + valueFrom: + secretKeyRef: + name: performance-test-config + key: influxtoken + - name: PROW_TAG + valueFrom: + secretKeyRef: + name: performance-test-config + key: prowtag resources: requests: cpu: 1000m memory: 3Gi - volumeMounts: - - name: config-mako - mountPath: /etc/config-mako - - name: mako-stub - image: ko://knative.dev/pkg/test/mako/stub-sidecar - args: - - "-p=10001" - ports: - - name: quickstore - containerPort: 9813 - volumeMounts: - - name: config-mako - mountPath: /etc/config-mako - terminationMessagePolicy: FallbackToLogsOnError - resources: - requests: - memory: 4Gi - volumes: - - name: config-mako - configMap: - name: config-mako restartPolicy: Never diff --git a/test/performance/benchmarks/rollout-probe/continuous/rollout-probe-queue-direct.yaml b/test/performance/benchmarks/rollout-probe/rollout-probe-queue-proxy-direct.yaml similarity index 67% rename from test/performance/benchmarks/rollout-probe/continuous/rollout-probe-queue-direct.yaml rename to test/performance/benchmarks/rollout-probe/rollout-probe-queue-proxy-direct.yaml index a1492e7c0fdc..bb693b6564a5 100644 --- a/test/performance/benchmarks/rollout-probe/continuous/rollout-probe-queue-direct.yaml +++ b/test/performance/benchmarks/rollout-probe/rollout-probe-queue-proxy-direct.yaml @@ -35,7 +35,7 @@ roleRef: apiVersion: batch/v1 kind: Job metadata: - name: rollout-probe-queue-with-cc + name: rollout-probe-queue-direct namespace: default spec: parallelism: 1 @@ -45,31 +45,30 @@ spec: serviceAccountName: prober containers: - name: rollout-probe - image: ko://knative.dev/serving/test/performance/benchmarks/rollout-probe/continuous + image: ko://knative.dev/serving/test/performance/benchmarks/rollout-probe args: ["-target=queue-proxy-with-cc", "--duration=3m"] + env: + - name: KO_DOCKER_REPO + value: @KO_DOCKER_REPO@ + - name: SYSTEM_NAMESPACE + value: @SYSTEM_NAMESPACE@ + - name: INFLUX_URL + valueFrom: + secretKeyRef: + name: performance-test-config + key: influxurl + - name: INFLUX_TOKEN + valueFrom: + secretKeyRef: + name: performance-test-config + key: influxtoken + - name: PROW_TAG + valueFrom: + secretKeyRef: + name: performance-test-config + key: prowtag resources: requests: cpu: 1000m memory: 3Gi - volumeMounts: - - name: config-mako - mountPath: /etc/config-mako - - name: mako-stub - image: ko://knative.dev/pkg/test/mako/stub-sidecar - args: - - "-p=10001" - ports: - - name: quickstore - containerPort: 9813 - volumeMounts: - - name: config-mako - mountPath: /etc/config-mako - terminationMessagePolicy: FallbackToLogsOnError - resources: - requests: - memory: 4Gi - volumes: - - name: config-mako - configMap: - name: config-mako restartPolicy: Never diff --git a/test/performance/benchmarks/rollout-probe/rollout-probe-setup-activator-direct-lin.yaml b/test/performance/benchmarks/rollout-probe/rollout-probe-setup-activator-direct-lin.yaml new file mode 100644 index 000000000000..aa41be2c2b02 --- /dev/null +++ b/test/performance/benchmarks/rollout-probe/rollout-probe-setup-activator-direct-lin.yaml @@ -0,0 +1,39 @@ +# Copyright 2022 The Knative Authors +# +# Licensed under the Apache License, Version 2.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. + +apiVersion: serving.knative.dev/v1 +kind: Service +metadata: + name: activator-with-cc-lin + namespace: default +spec: + template: + metadata: + annotations: + autoscaling.knative.dev/minScale: "100" + autoscaling.knative.dev/maxScale: "150" + # Always hook the activator in. + autoscaling.knative.dev/targetBurstCapacity: "-1" + spec: + containers: + - image: ghcr.io/knative/autoscale-go:latest + resources: + requests: + cpu: 20m + memory: 20Mi + limits: + cpu: 50m + memory: 50Mi + containerConcurrency: 5 +--- diff --git a/test/performance/benchmarks/rollout-probe/rollout-probe-setup-activator-direct.yaml b/test/performance/benchmarks/rollout-probe/rollout-probe-setup-activator-direct.yaml new file mode 100644 index 000000000000..25c4260ab7c2 --- /dev/null +++ b/test/performance/benchmarks/rollout-probe/rollout-probe-setup-activator-direct.yaml @@ -0,0 +1,40 @@ +# Copyright 2022 The Knative Authors +# +# Licensed under the Apache License, Version 2.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. + +apiVersion: serving.knative.dev/v1 +kind: Service +metadata: + name: activator-with-cc + namespace: default +spec: + template: + metadata: + annotations: + autoscaling.knative.dev/minScale: "100" + autoscaling.knative.dev/maxScale: "150" + # Always hook the activator in. + autoscaling.knative.dev/targetBurstCapacity: "-1" + autoscaling.knative.dev/metricAggregationAlgorithm: "weightedExponential" + spec: + containers: + - image: ghcr.io/knative/autoscale-go:latest + resources: + requests: + cpu: 20m + memory: 20Mi + limits: + cpu: 50m + memory: 50Mi + containerConcurrency: 5 +--- diff --git a/test/performance/benchmarks/rollout-probe/rollout-probe-setup-queue-proxy-direct.yaml b/test/performance/benchmarks/rollout-probe/rollout-probe-setup-queue-proxy-direct.yaml new file mode 100644 index 000000000000..8d90868dceac --- /dev/null +++ b/test/performance/benchmarks/rollout-probe/rollout-probe-setup-queue-proxy-direct.yaml @@ -0,0 +1,39 @@ +# Copyright 2022 The Knative Authors +# +# Licensed under the Apache License, Version 2.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. + +apiVersion: serving.knative.dev/v1 +kind: Service +metadata: + name: queue-proxy-with-cc + namespace: default +spec: + template: + metadata: + annotations: + autoscaling.knative.dev/minScale: "100" + autoscaling.knative.dev/maxScale: "150" + # Only hook the activator in when scaled to zero. + autoscaling.knative.dev/targetBurstCapacity: "0" + spec: + containers: + - image: ghcr.io/knative/autoscale-go:latest + resources: + requests: + cpu: 20m + memory: 20Mi + limits: + cpu: 50m + memory: 50Mi + containerConcurrency: 5 +--- diff --git a/test/performance/benchmarks/scale-from-zero/continuous/kodata/dev.config b/test/performance/benchmarks/scale-from-zero/continuous/kodata/dev.config deleted file mode 120000 index ee953f22c05e..000000000000 --- a/test/performance/benchmarks/scale-from-zero/continuous/kodata/dev.config +++ /dev/null @@ -1 +0,0 @@ -../../dev.config \ No newline at end of file diff --git a/test/performance/benchmarks/scale-from-zero/continuous/scale-from-zero-direct.yaml b/test/performance/benchmarks/scale-from-zero/continuous/scale-from-zero-direct.yaml deleted file mode 100644 index 53012016926e..000000000000 --- a/test/performance/benchmarks/scale-from-zero/continuous/scale-from-zero-direct.yaml +++ /dev/null @@ -1,160 +0,0 @@ -# Copyright 2022 The Knative Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -apiVersion: v1 -kind: ServiceAccount -metadata: - name: scale-from-zero - namespace: default ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: scale-from-zero - namespace: default -subjects: - - kind: ServiceAccount - name: scale-from-zero - namespace: default -roleRef: - kind: ClusterRole - name: cluster-admin - apiGroup: rbac.authorization.k8s.io ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: scale-from-zero-1 - namespace: default -spec: - parallelism: 1 - template: - spec: - serviceAccountName: scale-from-zero - containers: - - name: scale-from-zero - image: ko://knative.dev/serving/test/performance/benchmarks/scale-from-zero/continuous - args: - - "-parallel=1" - resources: - requests: - cpu: 1000m - memory: 3Gi - volumeMounts: - - name: config-mako - mountPath: /etc/config-mako - - name: mako-stub - image: ko://knative.dev/pkg/test/mako/stub-sidecar - args: - - "-p=10001" - ports: - - name: quickstore - containerPort: 9813 - volumeMounts: - - name: config-mako - mountPath: /etc/config-mako - terminationMessagePolicy: FallbackToLogsOnError - resources: - requests: - memory: 4Gi - volumes: - - name: config-mako - configMap: - name: config-mako - restartPolicy: Never ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: scale-from-zero-5 - namespace: default -spec: - parallelism: 1 - template: - spec: - serviceAccountName: scale-from-zero - containers: - - name: scale-from-zero - image: ko://knative.dev/serving/test/performance/benchmarks/scale-from-zero/continuous - args: - - "-parallel=5" - resources: - requests: - cpu: 1000m - memory: 3Gi - volumeMounts: - - name: config-mako - mountPath: /etc/config-mako - - name: mako-stub - image: ko://knative.dev/pkg/test/mako/stub-sidecar - args: - - "-p=10001" - ports: - - name: quickstore - containerPort: 9813 - volumeMounts: - - name: config-mako - mountPath: /etc/config-mako - terminationMessagePolicy: FallbackToLogsOnError - resources: - requests: - memory: 4Gi - volumes: - - name: config-mako - configMap: - name: config-mako - restartPolicy: Never ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: scale-from-zero-25 - namespace: default -spec: - parallelism: 1 - template: - spec: - serviceAccountName: scale-from-zero - containers: - - name: scale-from-zero - image: ko://knative.dev/serving/test/performance/benchmarks/scale-from-zero/continuous - args: - - "-parallel=25" - resources: - requests: - cpu: 1000m - memory: 3Gi - volumeMounts: - - name: config-mako - mountPath: /etc/config-mako - - name: mako-stub - image: ko://knative.dev/pkg/test/mako/stub-sidecar - args: - - "-p=10001" - ports: - - name: quickstore - containerPort: 9813 - volumeMounts: - - name: config-mako - mountPath: /etc/config-mako - terminationMessagePolicy: FallbackToLogsOnError - resources: - requests: - memory: 4Gi - volumes: - - name: config-mako - configMap: - name: config-mako - restartPolicy: Never - diff --git a/test/performance/benchmarks/scale-from-zero/continuous/sla.go b/test/performance/benchmarks/scale-from-zero/continuous/sla.go deleted file mode 100644 index 91e6a373292e..000000000000 --- a/test/performance/benchmarks/scale-from-zero/continuous/sla.go +++ /dev/null @@ -1,19 +0,0 @@ -/* -Copyright 2022 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES 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 - -// TODO: Determine the SLAs. diff --git a/test/performance/benchmarks/scale-from-zero/dev.config b/test/performance/benchmarks/scale-from-zero/dev.config deleted file mode 100644 index b367d1738168..000000000000 --- a/test/performance/benchmarks/scale-from-zero/dev.config +++ /dev/null @@ -1,62 +0,0 @@ -# Creating this benchmark: -# mako create_benchmark \ -# test/performance/benchmarks/scale-from-zero/dev.config -# Updating this benchmark: -# mako update_benchmark \ -# test/performance/benchmarks/scale-from-zero/dev.config -project_name: "Knative" -benchmark_name: "Development - Serving scale from zero" -description: "Scale from zero test against ksvcs in parallel." -benchmark_key: '5024954898710528' - -# Human owners for manual benchmark adjustments. - -# Anyone can add their IAM robot here to publish to this benchmark. -owner_list: "mako-job@knative-performance.iam.gserviceaccount.com" - -# Define the name and type for x-axis of run charts -input_value_info: { - value_key: "t" - label: "time" - type: TIMESTAMP -} - -# Note: value_key is stored repeatedly and should be very short (ideally one or two characters). -metric_info_list: { - value_key: "l1" - label: "latency1" -} -metric_info_list: { - value_key: "dl1" - label: "deployment-latency1" -} -metric_info_list: { - value_key: "e1" - label: "error1" -} - -metric_info_list: { - value_key: "l5" - label: "latency5" -} -metric_info_list: { - value_key: "dl5" - label: "deployment-latency5" -} -metric_info_list: { - value_key: "e5" - label: "error5" -} - -metric_info_list: { - value_key: "l25" - label: "latency25" -} -metric_info_list: { - value_key: "dl25" - label: "deployment-latency25" -} -metric_info_list: { - value_key: "e25" - label: "error25" -} diff --git a/test/performance/benchmarks/scale-from-zero/continuous/main.go b/test/performance/benchmarks/scale-from-zero/main.go similarity index 70% rename from test/performance/benchmarks/scale-from-zero/continuous/main.go rename to test/performance/benchmarks/scale-from-zero/main.go index db68c0ef0872..5dc66e8fb2af 100644 --- a/test/performance/benchmarks/scale-from-zero/continuous/main.go +++ b/test/performance/benchmarks/scale-from-zero/main.go @@ -28,15 +28,15 @@ import ( "time" v1 "k8s.io/api/apps/v1" + "knative.dev/pkg/environment" + "knative.dev/pkg/injection" + "knative.dev/pkg/signals" + "knative.dev/serving/test/performance/performance" - "github.com/google/mako/go/quickstore" "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/watch" - "knative.dev/pkg/environment" - "knative.dev/pkg/test/mako" "knative.dev/pkg/test/spoof" "knative.dev/serving/pkg/apis/serving" - "knative.dev/serving/test/performance" "golang.org/x/sync/errgroup" @@ -56,14 +56,72 @@ var ( ) const ( - benchmarkName = "Development - Serving scale from zero" - testNamespace = "default" + benchmarkName = "Serving Serving scale from zero" + namespace = "default" serviceName = "perftest-scalefromzero" helloWorldExpectedOutput = "Hello World!" helloWorldImage = "helloworld" waitToServe = 2 * time.Minute ) +func main() { + log.Println("Starting scale from zero test") + + ctx := signals.NewContext() + ctx, cancel := context.WithTimeout(ctx, 10*time.Minute) + defer cancel() + + // To make testing.T work properly + testing.Init() + + env := environment.ClientConfig{} + + // The local domain is directly resolvable by the test + flag.Set("resolvabledomain", "true") + flag.Parse() + + cfg, err := env.GetRESTConfig() + if err != nil { + log.Fatalf("failed to get kubeconfig %s", err) + } + + ctx, _ = injection.EnableInjectionOrDie(ctx, cfg) + + clients, err := test.NewClients(cfg, namespace) + if err != nil { + log.Fatal("Failed to setup clients: ", err) + } + + influxReporter, err := performance.NewInfluxReporter(map[string]string{"parallel": strconv.Itoa(*parallelCount)}) + if err != nil { + log.Fatalf("Failed to create InfluxReporter: %v", err) + } + + // Create the services once. + services, cleanup, err := createServices(clients, *parallelCount) + + // Wrap fatalf in a helper to clean up created resources + fatalf := func(f string, args ...interface{}) { + cleanup() + log.Fatalf(f, args...) + } + if err != nil { + fatalf("Failed to create services: %v", err) + } + defer cleanup() + + // Wait all services scaling to zero. + if err := waitForScaleToZero(ctx, services); err != nil { + fatalf("Failed to wait for all services to scale to zero: %v", err) + } + + parallelScaleFromZero(ctx, clients, services, influxReporter) + + influxReporter.FlushAndShutdown() + + log.Println("Scale from zero test completed") +} + func createServices(clients *test.Clients, count int) ([]*v1test.ResourceObjects, func(), error) { testNames := make([]*test.ResourceNames, count) @@ -129,7 +187,7 @@ func waitForScaleToZero(ctx context.Context, objs []*v1test.ResourceObjects) err serving.ServiceLabelKey: ro.Service.Name, }) - if err := performance.WaitForScaleToZero(ctx, testNamespace, selector, 2*time.Minute); err != nil { + if err := performance.WaitForScaleToZero(ctx, namespace, selector, 2*time.Minute); err != nil { m := fmt.Sprintf("%02d: failed waiting for deployment to scale to zero: %v", idx, err) log.Println(m) return errors.New(m) @@ -140,37 +198,27 @@ func waitForScaleToZero(ctx context.Context, objs []*v1test.ResourceObjects) err return g.Wait() } -func parallelScaleFromZero(ctx context.Context, clients *test.Clients, objs []*v1test.ResourceObjects, q *quickstore.Quickstore) { +func parallelScaleFromZero(ctx context.Context, clients *test.Clients, objs []*v1test.ResourceObjects, reporter *performance.InfluxReporter) { count := len(objs) - // Get the key for saving latency and error metrics in the benchmark. - lk := "l" + strconv.Itoa(count) - dlk := "dl" + strconv.Itoa(count) - ek := "e" + strconv.Itoa(count) var wg sync.WaitGroup wg.Add(count) for i := 0; i < count; i++ { ndx := i go func() { defer wg.Done() - sdur, ddur, err := runScaleFromZero(ctx, clients, ndx, objs[ndx]) + serviceReadyDuration, deploymentUpdatedDuration, err := runScaleFromZero(ctx, clients, ndx, objs[ndx]) if err == nil { - q.AddSamplePoint(mako.XTime(time.Now()), map[string]float64{ - lk: sdur.Seconds(), + reporter.AddDataPoint(benchmarkName, map[string]interface{}{ + "service-ready-latency": serviceReadyDuration.Milliseconds(), }) - q.AddSamplePoint(mako.XTime(time.Now()), map[string]float64{ - dlk: ddur.Seconds(), + reporter.AddDataPoint(benchmarkName, map[string]interface{}{ + "deployment-updated-latency": deploymentUpdatedDuration.Milliseconds(), }) - performance.AddInfluxPoint(benchmarkName, map[string]interface{}{"lk": sdur.Seconds()}) - performance.AddInfluxPoint(benchmarkName, map[string]interface{}{"dlk": ddur.Seconds()}) } else { // Add 1 to the error metric whenever there is an error. - q.AddSamplePoint(mako.XTime(time.Now()), map[string]float64{ - ek: 1, + reporter.AddDataPoint(benchmarkName, map[string]interface{}{ + "errors": float64(1), }) - performance.AddInfluxPoint(benchmarkName, map[string]interface{}{"ek": float64(1)}) - // By reporting errors like this, the error strings show up on - // the details page for each Mako run. - q.AddError(mako.XTime(time.Now()), err.Error()) } }() } @@ -183,18 +231,18 @@ func runScaleFromZero(ctx context.Context, clients *test.Clients, idx int, ro *v serving.ServiceLabelKey: ro.Service.Name, }) - watcher, err := clients.KubeClient.AppsV1().Deployments(testNamespace).Watch( + watcher, err := clients.KubeClient.AppsV1().Deployments(namespace).Watch( ctx, metav1.ListOptions{LabelSelector: selector.String()}) if err != nil { - m := fmt.Sprintf("%02d: unable to watch the deployment for the service: %v", idx, err) - log.Println(m) - return 0, 0, errors.New(m) + msg := fmt.Sprintf("%02d: unable to watch the deployment for the service: %v", idx, err) + log.Println(msg) + return 0, 0, errors.New(msg) } defer watcher.Stop() - ddch := watcher.ResultChan() - sdch := make(chan struct{}) - errch := make(chan error) + deploymentChangeChan := watcher.ResultChan() + serviceReadyChan := make(chan struct{}) + errorChan := make(chan error) go func() { log.Printf("%02d: waiting for endpoint to serve request", idx) @@ -211,11 +259,11 @@ func runScaleFromZero(ctx context.Context, clients *test.Clients, idx int, ro *v if err != nil { m := fmt.Sprintf("%02d: the endpoint for Route %q at %q didn't serve the expected text %q: %v", idx, ro.Route.Name, url, helloWorldExpectedOutput, err) log.Println(m) - errch <- errors.New(m) + errorChan <- errors.New(m) return } - sdch <- struct{}{} + serviceReadyChan <- struct{}{} }() start := time.Now() @@ -223,67 +271,20 @@ func runScaleFromZero(ctx context.Context, clients *test.Clients, idx int, ro *v var dd time.Duration for { select { - case event := <-ddch: + case event := <-deploymentChangeChan: if event.Type == watch.Modified { dm := event.Object.(*v1.Deployment) if *dm.Spec.Replicas != 0 && dd == 0 { + log.Println("Deployment replicas updated", ro.Service.Name) dd = time.Since(start) } } - case <-sdch: + case <-serviceReadyChan: + log.Println("Service is ready after", ro.Service.Name, time.Since(start)) return time.Since(start), dd, nil - case err := <-errch: + case err := <-errorChan: + log.Println("Service scaling failed: ", ro.Service.Name, err.Error()) return 0, 0, err } } } - -func testScaleFromZero(clients *test.Clients, count int) { - parallelTag := fmt.Sprintf("parallel=%d", count) - mc, err := mako.Setup(context.Background(), parallelTag) - if err != nil { - log.Fatal("failed to setup mako: ", err) - } - q, qclose, ctx := mc.Quickstore, mc.ShutDownFunc, mc.Context - defer qclose(ctx) - - // Create the services once. - objs, cleanup, err := createServices(clients, count) - // Wrap fatalf in a helper or our sidecar will live forever, also wrap cleanup. - fatalf := func(f string, args ...interface{}) { - cleanup() - qclose(ctx) - log.Fatalf(f, args...) - } - if err != nil { - fatalf("Failed to create services: %v", err) - } - defer cleanup() - - // Wait all services scaling to zero. - if err := waitForScaleToZero(ctx, objs); err != nil { - fatalf("Failed to wait for all services to scale to zero: %v", err) - } - - parallelScaleFromZero(ctx, clients, objs, q) - if err := mc.StoreAndHandleResult(); err != nil { - fatalf("Failed to store and handle benchmarking result: %v", err) - } -} - -func main() { - env := environment.ClientConfig{} - flag.Parse() - - cfg, err := env.GetRESTConfig() - if err != nil { - log.Fatalf("failed to get kubeconfig %s", err) - } - - clients, err := test.NewClients(cfg, testNamespace) - if err != nil { - log.Fatal("Failed to setup clients: ", err) - } - - testScaleFromZero(clients, *parallelCount) -} diff --git a/test/performance/benchmarks/scale-from-zero/scale-from-zero-1.yaml b/test/performance/benchmarks/scale-from-zero/scale-from-zero-1.yaml new file mode 100644 index 000000000000..79c37412b534 --- /dev/null +++ b/test/performance/benchmarks/scale-from-zero/scale-from-zero-1.yaml @@ -0,0 +1,75 @@ +# Copyright 2022 The Knative Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: v1 +kind: ServiceAccount +metadata: + name: scale-from-zero + namespace: default +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: scale-from-zero + namespace: default +subjects: + - kind: ServiceAccount + name: scale-from-zero + namespace: default +roleRef: + kind: ClusterRole + name: cluster-admin + apiGroup: rbac.authorization.k8s.io +--- +apiVersion: batch/v1 +kind: Job +metadata: + name: scale-from-zero-1 + namespace: default +spec: + parallelism: 1 + template: + spec: + serviceAccountName: scale-from-zero + containers: + - name: scale-from-zero + image: ko://knative.dev/serving/test/performance/benchmarks/scale-from-zero + args: + - "-parallel=1" + env: + - name: KO_DOCKER_REPO + value: @KO_DOCKER_REPO@ + - name: SYSTEM_NAMESPACE + value: @SYSTEM_NAMESPACE@ + - name: INFLUX_URL + valueFrom: + secretKeyRef: + name: performance-test-config + key: influxurl + - name: INFLUX_TOKEN + valueFrom: + secretKeyRef: + name: performance-test-config + key: influxtoken + - name: PROW_TAG + valueFrom: + secretKeyRef: + name: performance-test-config + key: prowtag + resources: + requests: + cpu: 1000m + memory: 3Gi + restartPolicy: Never +--- diff --git a/test/performance/benchmarks/scale-from-zero/scale-from-zero-100.yaml b/test/performance/benchmarks/scale-from-zero/scale-from-zero-100.yaml new file mode 100644 index 000000000000..ad602b86be2d --- /dev/null +++ b/test/performance/benchmarks/scale-from-zero/scale-from-zero-100.yaml @@ -0,0 +1,75 @@ +# Copyright 2022 The Knative Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: v1 +kind: ServiceAccount +metadata: + name: scale-from-zero + namespace: default +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: scale-from-zero + namespace: default +subjects: + - kind: ServiceAccount + name: scale-from-zero + namespace: default +roleRef: + kind: ClusterRole + name: cluster-admin + apiGroup: rbac.authorization.k8s.io +--- +apiVersion: batch/v1 +kind: Job +metadata: + name: scale-from-zero-100 + namespace: default +spec: + parallelism: 1 + template: + spec: + serviceAccountName: scale-from-zero + containers: + - name: scale-from-zero + image: ko://knative.dev/serving/test/performance/benchmarks/scale-from-zero + args: + - "-parallel=100" + env: + - name: KO_DOCKER_REPO + value: @KO_DOCKER_REPO@ + - name: SYSTEM_NAMESPACE + value: @SYSTEM_NAMESPACE@ + - name: INFLUX_URL + valueFrom: + secretKeyRef: + name: performance-test-config + key: influxurl + - name: INFLUX_TOKEN + valueFrom: + secretKeyRef: + name: performance-test-config + key: influxtoken + - name: PROW_TAG + valueFrom: + secretKeyRef: + name: performance-test-config + key: prowtag + resources: + requests: + cpu: 1500m + memory: 6Gi + restartPolicy: Never +--- diff --git a/test/performance/benchmarks/scale-from-zero/scale-from-zero-25.yaml b/test/performance/benchmarks/scale-from-zero/scale-from-zero-25.yaml new file mode 100644 index 000000000000..f75d29495849 --- /dev/null +++ b/test/performance/benchmarks/scale-from-zero/scale-from-zero-25.yaml @@ -0,0 +1,75 @@ +# Copyright 2022 The Knative Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: v1 +kind: ServiceAccount +metadata: + name: scale-from-zero + namespace: default +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: scale-from-zero + namespace: default +subjects: + - kind: ServiceAccount + name: scale-from-zero + namespace: default +roleRef: + kind: ClusterRole + name: cluster-admin + apiGroup: rbac.authorization.k8s.io +--- +apiVersion: batch/v1 +kind: Job +metadata: + name: scale-from-zero-25 + namespace: default +spec: + parallelism: 1 + template: + spec: + serviceAccountName: scale-from-zero + containers: + - name: scale-from-zero + image: ko://knative.dev/serving/test/performance/benchmarks/scale-from-zero + args: + - "-parallel=25" + env: + - name: KO_DOCKER_REPO + value: @KO_DOCKER_REPO@ + - name: SYSTEM_NAMESPACE + value: @SYSTEM_NAMESPACE@ + - name: INFLUX_URL + valueFrom: + secretKeyRef: + name: performance-test-config + key: influxurl + - name: INFLUX_TOKEN + valueFrom: + secretKeyRef: + name: performance-test-config + key: influxtoken + - name: PROW_TAG + valueFrom: + secretKeyRef: + name: performance-test-config + key: prowtag + resources: + requests: + cpu: 1000m + memory: 4Gi + restartPolicy: Never +--- diff --git a/test/performance/benchmarks/scale-from-zero/scale-from-zero-5.yaml b/test/performance/benchmarks/scale-from-zero/scale-from-zero-5.yaml new file mode 100644 index 000000000000..f03429b2a1d1 --- /dev/null +++ b/test/performance/benchmarks/scale-from-zero/scale-from-zero-5.yaml @@ -0,0 +1,75 @@ +# Copyright 2022 The Knative Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: v1 +kind: ServiceAccount +metadata: + name: scale-from-zero + namespace: default +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: scale-from-zero + namespace: default +subjects: + - kind: ServiceAccount + name: scale-from-zero + namespace: default +roleRef: + kind: ClusterRole + name: cluster-admin + apiGroup: rbac.authorization.k8s.io +--- +apiVersion: batch/v1 +kind: Job +metadata: + name: scale-from-zero-5 + namespace: default +spec: + parallelism: 1 + template: + spec: + serviceAccountName: scale-from-zero + containers: + - name: scale-from-zero + image: ko://knative.dev/serving/test/performance/benchmarks/scale-from-zero + args: + - "-parallel=5" + env: + - name: KO_DOCKER_REPO + value: @KO_DOCKER_REPO@ + - name: SYSTEM_NAMESPACE + value: @SYSTEM_NAMESPACE@ + - name: INFLUX_URL + valueFrom: + secretKeyRef: + name: performance-test-config + key: influxurl + - name: INFLUX_TOKEN + valueFrom: + secretKeyRef: + name: performance-test-config + key: influxtoken + - name: PROW_TAG + valueFrom: + secretKeyRef: + name: performance-test-config + key: prowtag + resources: + requests: + cpu: 1000m + memory: 3Gi + restartPolicy: Never +--- diff --git a/test/performance/config/README.md b/test/performance/config/README.md deleted file mode 100644 index 8fb844b7a38b..000000000000 --- a/test/performance/config/README.md +++ /dev/null @@ -1,65 +0,0 @@ -### Vegeta-based load generator - -This directory contains a simple `vegeta`-based load generator, which can be run -with: - -```shell -ko apply -f test/performance/config -``` - -By default, it is configured to load test the -[autoscale-go](https://github.com/knative/docs/tree/main/docs/serving/autoscaling/autoscale-go) -sample, which must already be deployed. You can change the target by altering -the `ConfigMap` to point to a different endpoint. - -### Examining output - -Once the load generation pods terminate, their outputs can be examined with: - -```shell -for x in $(kubectl get pods -l app=load-test -oname); do - kubectl logs $x | python -mjson.tool -done -``` - -This will produce a series of pretty-printed JSON blocks like: - -```json -{ - "bytes_in": { - "mean": 38.15242083333333, - "total": 9156581 - }, - "bytes_out": { - "mean": 0, - "total": 0 - }, - "duration": 240001544213, - "earliest": "2019-06-29T22:49:57.272758595Z", - "end": "2019-06-29T22:53:57.399043387Z", - "errors": [ - "503 Service Unavailable", - "502 Bad Gateway", - "Get http://autoscale-go.default.svc.cluster.local?sleep=100: net/http: request canceled (Client.Timeout exceeded while awaiting headers)" - ], - "latencies": { - "50th": 102296894, - "95th": 29927947157, - "99th": 30000272067, - "max": 30186427377, - "mean": 2483484840, - "total": 596036361667202 - }, - "latest": "2019-06-29T22:53:57.274302808Z", - "rate": 999.9935658205657, - "requests": 240000, - "status_codes": { - "0": 12302, - "200": 185803, - "502": 7, - "503": 41888 - }, - "success": 0.7741791666666666, - "wait": 124740579 -} -``` diff --git a/test/performance/config/config-mako.yaml b/test/performance/config/config-mako.yaml deleted file mode 100644 index 91b25069c6f8..000000000000 --- a/test/performance/config/config-mako.yaml +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright 2019 The Knative Authors -# -# Licensed under the Apache License, Version 2.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. - -apiVersion: v1 -kind: ConfigMap -metadata: - name: config-mako - -data: - _example: | - ################################ - # # - # EXAMPLE CONFIGURATION # - # # - ################################ - - # This block is not actually functional configuration, - # but serves to illustrate the available configuration - # options and document them in a way that is accessible - # to users that `kubectl edit` this config map. - # - # These sample configuration options may be copied out of - # this example block and unindented to be in the data block - # to actually change the configuration. - - # The Mako environment in which we are running. - # Only our performance automation should run in "prod", but - # there should be a "dev" environment with a fairly broad - # write ACL. Users can also develop against custom configurations - # by adding `foo.config` under their benchmark's kodata directory. - environment: dev - - # Additional tags to tag the runs. These tags are added - # to the list that the binary itself publishes (Kubernetes version, etc). - # It is a comma separated list of tags. - additionalTags: "key=value,absolute" diff --git a/test/performance/config/job.yaml b/test/performance/config/job.yaml deleted file mode 100644 index b8f9b94ddaa4..000000000000 --- a/test/performance/config/job.yaml +++ /dev/null @@ -1,52 +0,0 @@ -# Copyright 2019 The Knative Authors -# -# Licensed under the Apache License, Version 2.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. - -apiVersion: v1 -kind: ConfigMap -metadata: - name: vegeta-payload -data: - payload: | - GET http://autoscale-go.default.svc.cluster.local?sleep=100 ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: load-test - namespace: default -spec: - parallelism: 1 - template: - metadata: - labels: - app: load-test - spec: - containers: - - name: vegeta - image: ko://github.com/tsenart/vegeta/v12 - command: ["/bin/bash", "-c"] - args: - - "/ko-app/vegeta -cpus=1 attack -duration=4m -rate=1000/1s -targets=/var/vegeta/payload | /ko-app/vegeta report -type=json" - resources: - requests: - cpu: 1000m - memory: 3Gi - volumeMounts: - - name: vegeta-payload - mountPath: /var/vegeta - volumes: - - name: vegeta-payload - configMap: - name: vegeta-payload - restartPolicy: Never diff --git a/test/performance/influx/dashboard.json b/test/performance/influx/dashboard.json new file mode 100644 index 000000000000..91d04b227dbc --- /dev/null +++ b/test/performance/influx/dashboard.json @@ -0,0 +1,2891 @@ +{ + "meta": { + "version": "1", + "type": "dashboard", + "name": "Knative Performance Tests-Template", + "description": "template created from dashboard: Knative Performance Tests" + }, + "content": { + "data": { + "type": "dashboard", + "attributes": { + "name": "Knative Performance Tests", + "description": "" + }, + "relationships": { + "label": { + "data": [] + }, + "cell": { + "data": [ + { + "type": "cell", + "id": "0bab61c9c02dd000" + }, + { + "type": "cell", + "id": "0bab653c652dd000" + }, + { + "type": "cell", + "id": "0bab6567fe2dd000" + }, + { + "type": "cell", + "id": "0bab6892c62dd000" + }, + { + "type": "cell", + "id": "0bab689fe36dd000" + }, + { + "type": "cell", + "id": "0bab68df4fedd000" + }, + { + "type": "cell", + "id": "0bab68f2f1edd000" + }, + { + "type": "cell", + "id": "0bab68ff0dadd000" + }, + { + "type": "cell", + "id": "0bab6910a3edd000" + }, + { + "type": "cell", + "id": "0bab691eb4add000" + }, + { + "type": "cell", + "id": "0bab695c48edd000" + }, + { + "type": "cell", + "id": "0bab696865add000" + }, + { + "type": "cell", + "id": "0bab69eb996dd000" + }, + { + "type": "cell", + "id": "0bab6a0308edd000" + }, + { + "type": "cell", + "id": "0bab6a102a2dd000" + }, + { + "type": "cell", + "id": "0bab6a209e6dd000" + }, + { + "type": "cell", + "id": "0bab6a2e3e6dd000" + }, + { + "type": "cell", + "id": "0bab6b8c582dd000" + }, + { + "type": "cell", + "id": "0bacae4a1fdc3000" + }, + { + "type": "cell", + "id": "0bacaf09181c3000" + }, + { + "type": "cell", + "id": "0bacba9c90dc3000" + }, + { + "type": "cell", + "id": "0bacd823795c3000" + }, + { + "type": "cell", + "id": "0bacd850a09c3000" + }, + { + "type": "cell", + "id": "0bacd8839b1c3000" + }, + { + "type": "cell", + "id": "0bacd899fe1c3000" + }, + { + "type": "cell", + "id": "0bacd8bf225c3000" + }, + { + "type": "cell", + "id": "0bacd8d7af9c3000" + }, + { + "type": "cell", + "id": "0bacd8e66a5c3000" + }, + { + "type": "cell", + "id": "0bacd8f8459c3000" + }, + { + "type": "cell", + "id": "0bacd97e2d5c3000" + }, + { + "type": "cell", + "id": "0bacda1bca5c3000" + }, + { + "type": "cell", + "id": "0bacda84055c3000" + }, + { + "type": "cell", + "id": "0bacda960e1c3000" + }, + { + "type": "cell", + "id": "0bacdaa14c9c3000" + }, + { + "type": "cell", + "id": "0bacdab6a61c3000" + }, + { + "type": "cell", + "id": "0bacdac4589c3000" + }, + { + "type": "cell", + "id": "0bacdad2359c3000" + }, + { + "type": "cell", + "id": "0bacdb69b39c3000" + } + ] + }, + "variable": { + "data": [] + } + } + }, + "included": [ + { + "id": "0bab61c9c02dd000", + "type": "cell", + "attributes": { + "x": 0, + "y": 2, + "w": 2, + "h": 2 + }, + "relationships": { + "view": { + "data": { + "type": "view", + "id": "0bab61c9c02dd000" + } + } + } + }, + { + "id": "0bab653c652dd000", + "type": "cell", + "attributes": { + "x": 4, + "y": 2, + "w": 2, + "h": 2 + }, + "relationships": { + "view": { + "data": { + "type": "view", + "id": "0bab653c652dd000" + } + } + } + }, + { + "id": "0bab6567fe2dd000", + "type": "cell", + "attributes": { + "x": 2, + "y": 2, + "w": 2, + "h": 2 + }, + "relationships": { + "view": { + "data": { + "type": "view", + "id": "0bab6567fe2dd000" + } + } + } + }, + { + "id": "0bab6892c62dd000", + "type": "cell", + "attributes": { + "x": 6, + "y": 2, + "w": 2, + "h": 2 + }, + "relationships": { + "view": { + "data": { + "type": "view", + "id": "0bab6892c62dd000" + } + } + } + }, + { + "id": "0bab689fe36dd000", + "type": "cell", + "attributes": { + "x": 8, + "y": 2, + "w": 2, + "h": 2 + }, + "relationships": { + "view": { + "data": { + "type": "view", + "id": "0bab689fe36dd000" + } + } + } + }, + { + "id": "0bab68df4fedd000", + "type": "cell", + "attributes": { + "x": 0, + "y": 4, + "w": 2, + "h": 2 + }, + "relationships": { + "view": { + "data": { + "type": "view", + "id": "0bab68df4fedd000" + } + } + } + }, + { + "id": "0bab68f2f1edd000", + "type": "cell", + "attributes": { + "x": 2, + "y": 4, + "w": 2, + "h": 2 + }, + "relationships": { + "view": { + "data": { + "type": "view", + "id": "0bab68f2f1edd000" + } + } + } + }, + { + "id": "0bab68ff0dadd000", + "type": "cell", + "attributes": { + "x": 4, + "y": 4, + "w": 2, + "h": 2 + }, + "relationships": { + "view": { + "data": { + "type": "view", + "id": "0bab68ff0dadd000" + } + } + } + }, + { + "id": "0bab6910a3edd000", + "type": "cell", + "attributes": { + "x": 6, + "y": 4, + "w": 2, + "h": 2 + }, + "relationships": { + "view": { + "data": { + "type": "view", + "id": "0bab6910a3edd000" + } + } + } + }, + { + "id": "0bab691eb4add000", + "type": "cell", + "attributes": { + "x": 8, + "y": 4, + "w": 2, + "h": 2 + }, + "relationships": { + "view": { + "data": { + "type": "view", + "id": "0bab691eb4add000" + } + } + } + }, + { + "id": "0bab695c48edd000", + "type": "cell", + "attributes": { + "x": 0, + "y": 0, + "w": 10, + "h": 2 + }, + "relationships": { + "view": { + "data": { + "type": "view", + "id": "0bab695c48edd000" + } + } + } + }, + { + "id": "0bab696865add000", + "type": "cell", + "attributes": { + "x": 0, + "y": 8, + "w": 10, + "h": 1 + }, + "relationships": { + "view": { + "data": { + "type": "view", + "id": "0bab696865add000" + } + } + } + }, + { + "id": "0bab69eb996dd000", + "type": "cell", + "attributes": { + "x": 0, + "y": 6, + "w": 2, + "h": 2 + }, + "relationships": { + "view": { + "data": { + "type": "view", + "id": "0bab69eb996dd000" + } + } + } + }, + { + "id": "0bab6a0308edd000", + "type": "cell", + "attributes": { + "x": 2, + "y": 6, + "w": 2, + "h": 2 + }, + "relationships": { + "view": { + "data": { + "type": "view", + "id": "0bab6a0308edd000" + } + } + } + }, + { + "id": "0bab6a102a2dd000", + "type": "cell", + "attributes": { + "x": 4, + "y": 6, + "w": 2, + "h": 2 + }, + "relationships": { + "view": { + "data": { + "type": "view", + "id": "0bab6a102a2dd000" + } + } + } + }, + { + "id": "0bab6a209e6dd000", + "type": "cell", + "attributes": { + "x": 6, + "y": 6, + "w": 2, + "h": 2 + }, + "relationships": { + "view": { + "data": { + "type": "view", + "id": "0bab6a209e6dd000" + } + } + } + }, + { + "id": "0bab6a2e3e6dd000", + "type": "cell", + "attributes": { + "x": 8, + "y": 6, + "w": 2, + "h": 2 + }, + "relationships": { + "view": { + "data": { + "type": "view", + "id": "0bab6a2e3e6dd000" + } + } + } + }, + { + "id": "0bab6b8c582dd000", + "type": "cell", + "attributes": { + "x": 0, + "y": 9, + "w": 10, + "h": 4 + }, + "relationships": { + "view": { + "data": { + "type": "view", + "id": "0bab6b8c582dd000" + } + } + } + }, + { + "id": "0bacae4a1fdc3000", + "type": "cell", + "attributes": { + "x": 0, + "y": 13, + "w": 10, + "h": 1 + }, + "relationships": { + "view": { + "data": { + "type": "view", + "id": "0bacae4a1fdc3000" + } + } + } + }, + { + "id": "0bacaf09181c3000", + "type": "cell", + "attributes": { + "x": 0, + "y": 14, + "w": 8, + "h": 4 + }, + "relationships": { + "view": { + "data": { + "type": "view", + "id": "0bacaf09181c3000" + } + } + } + }, + { + "id": "0bacba9c90dc3000", + "type": "cell", + "attributes": { + "x": 8, + "y": 14, + "w": 2, + "h": 4 + }, + "relationships": { + "view": { + "data": { + "type": "view", + "id": "0bacba9c90dc3000" + } + } + } + }, + { + "id": "0bacd823795c3000", + "type": "cell", + "attributes": { + "x": 0, + "y": 18, + "w": 10, + "h": 2 + }, + "relationships": { + "view": { + "data": { + "type": "view", + "id": "0bacd823795c3000" + } + } + } + }, + { + "id": "0bacd850a09c3000", + "type": "cell", + "attributes": { + "x": 0, + "y": 22, + "w": 2, + "h": 2 + }, + "relationships": { + "view": { + "data": { + "type": "view", + "id": "0bacd850a09c3000" + } + } + } + }, + { + "id": "0bacd8839b1c3000", + "type": "cell", + "attributes": { + "x": 0, + "y": 20, + "w": 2, + "h": 2 + }, + "relationships": { + "view": { + "data": { + "type": "view", + "id": "0bacd8839b1c3000" + } + } + } + }, + { + "id": "0bacd899fe1c3000", + "type": "cell", + "attributes": { + "x": 0, + "y": 24, + "w": 2, + "h": 2 + }, + "relationships": { + "view": { + "data": { + "type": "view", + "id": "0bacd899fe1c3000" + } + } + } + }, + { + "id": "0bacd8bf225c3000", + "type": "cell", + "attributes": { + "x": 2, + "y": 22, + "w": 2, + "h": 2 + }, + "relationships": { + "view": { + "data": { + "type": "view", + "id": "0bacd8bf225c3000" + } + } + } + }, + { + "id": "0bacd8d7af9c3000", + "type": "cell", + "attributes": { + "x": 2, + "y": 20, + "w": 2, + "h": 2 + }, + "relationships": { + "view": { + "data": { + "type": "view", + "id": "0bacd8d7af9c3000" + } + } + } + }, + { + "id": "0bacd8e66a5c3000", + "type": "cell", + "attributes": { + "x": 2, + "y": 24, + "w": 2, + "h": 2 + }, + "relationships": { + "view": { + "data": { + "type": "view", + "id": "0bacd8e66a5c3000" + } + } + } + }, + { + "id": "0bacd8f8459c3000", + "type": "cell", + "attributes": { + "x": 4, + "y": 20, + "w": 2, + "h": 2 + }, + "relationships": { + "view": { + "data": { + "type": "view", + "id": "0bacd8f8459c3000" + } + } + } + }, + { + "id": "0bacd97e2d5c3000", + "type": "cell", + "attributes": { + "x": 4, + "y": 22, + "w": 2, + "h": 2 + }, + "relationships": { + "view": { + "data": { + "type": "view", + "id": "0bacd97e2d5c3000" + } + } + } + }, + { + "id": "0bacda1bca5c3000", + "type": "cell", + "attributes": { + "x": 4, + "y": 24, + "w": 2, + "h": 2 + }, + "relationships": { + "view": { + "data": { + "type": "view", + "id": "0bacda1bca5c3000" + } + } + } + }, + { + "id": "0bacda84055c3000", + "type": "cell", + "attributes": { + "x": 6, + "y": 20, + "w": 2, + "h": 2 + }, + "relationships": { + "view": { + "data": { + "type": "view", + "id": "0bacda84055c3000" + } + } + } + }, + { + "id": "0bacda960e1c3000", + "type": "cell", + "attributes": { + "x": 6, + "y": 22, + "w": 2, + "h": 2 + }, + "relationships": { + "view": { + "data": { + "type": "view", + "id": "0bacda960e1c3000" + } + } + } + }, + { + "id": "0bacdaa14c9c3000", + "type": "cell", + "attributes": { + "x": 6, + "y": 24, + "w": 2, + "h": 2 + }, + "relationships": { + "view": { + "data": { + "type": "view", + "id": "0bacdaa14c9c3000" + } + } + } + }, + { + "id": "0bacdab6a61c3000", + "type": "cell", + "attributes": { + "x": 8, + "y": 20, + "w": 2, + "h": 2 + }, + "relationships": { + "view": { + "data": { + "type": "view", + "id": "0bacdab6a61c3000" + } + } + } + }, + { + "id": "0bacdac4589c3000", + "type": "cell", + "attributes": { + "x": 8, + "y": 22, + "w": 2, + "h": 2 + }, + "relationships": { + "view": { + "data": { + "type": "view", + "id": "0bacdac4589c3000" + } + } + } + }, + { + "id": "0bacdad2359c3000", + "type": "cell", + "attributes": { + "x": 8, + "y": 24, + "w": 2, + "h": 2 + }, + "relationships": { + "view": { + "data": { + "type": "view", + "id": "0bacdad2359c3000" + } + } + } + }, + { + "id": "0bacdb69b39c3000", + "type": "cell", + "attributes": { + "x": 0, + "y": 26, + "w": 10, + "h": 2 + }, + "relationships": { + "view": { + "data": { + "type": "view", + "id": "0bacdb69b39c3000" + } + } + } + }, + { + "type": "view", + "id": "0bab61c9c02dd000", + "attributes": { + "name": "Load test zero: Requests", + "properties": { + "shape": "chronograf-v2", + "type": "single-stat", + "queries": [ + { + "text": "from(bucket: \"knative-serving\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"Knative Serving load test\")\n |> filter(fn: (r) => r[\"_field\"] == \"requests\")\n |> filter(fn: (r) => r[\"flavor\"] == \"zero\")\n |> aggregateWindow(every: v.windowPeriod, fn: last, createEmpty: false)\n |> yield(name: \"last\")", + "editMode": "advanced", + "name": "", + "builderConfig": { + "buckets": [], + "tags": [ + { + "key": "_measurement", + "values": [], + "aggregateFunctionType": "filter" + } + ], + "functions": [ + { + "name": "mean" + } + ], + "aggregateWindow": { + "period": "auto", + "fillValues": false + } + } + } + ], + "prefix": "", + "tickPrefix": "", + "suffix": "", + "tickSuffix": "", + "colors": [ + { + "id": "base", + "type": "text", + "hex": "#00C9FF", + "name": "laser", + "value": 0 + } + ], + "decimalPlaces": { + "isEnforced": true, + "digits": 0 + }, + "note": "", + "showNoteWhenEmpty": false + } + } + }, + { + "type": "view", + "id": "0bab653c652dd000", + "attributes": { + "name": "Load test zero: Latency min", + "properties": { + "shape": "chronograf-v2", + "type": "single-stat", + "queries": [ + { + "text": "from(bucket: \"knative-serving\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"Knative Serving load test\")\n |> filter(fn: (r) => r[\"_field\"] == \"latency-min\")\n |> filter(fn: (r) => r[\"flavor\"] == \"zero\")\n |> map(fn: (r) => ({r with _value: r._value / 1000.0 / 1000.0}))\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n |> yield(name: \"mean\")\n", + "editMode": "advanced", + "name": "", + "builderConfig": { + "buckets": [], + "tags": [ + { + "key": "_measurement", + "values": [], + "aggregateFunctionType": "filter" + } + ], + "functions": [ + { + "name": "mean" + } + ], + "aggregateWindow": { + "period": "auto", + "fillValues": false + } + } + } + ], + "prefix": "", + "tickPrefix": "", + "suffix": "ms", + "tickSuffix": "", + "colors": [ + { + "id": "base", + "type": "text", + "hex": "#00C9FF", + "name": "laser", + "value": 0 + } + ], + "decimalPlaces": { + "isEnforced": true, + "digits": 0 + }, + "note": "", + "showNoteWhenEmpty": false + } + } + }, + { + "type": "view", + "id": "0bab6567fe2dd000", + "attributes": { + "name": "Load test zero: Errors", + "properties": { + "shape": "chronograf-v2", + "type": "single-stat", + "queries": [ + { + "text": "from(bucket: \"knative-serving\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"Knative Serving load test\")\n |> filter(fn: (r) => r[\"_field\"] == \"errors\")\n |> filter(fn: (r) => r[\"flavor\"] == \"zero\")\n |> aggregateWindow(every: v.windowPeriod, fn: last, createEmpty: false)\n |> yield(name: \"last\")", + "editMode": "advanced", + "name": "", + "builderConfig": { + "buckets": [], + "tags": [ + { + "key": "_measurement", + "values": [], + "aggregateFunctionType": "filter" + } + ], + "functions": [ + { + "name": "mean" + } + ], + "aggregateWindow": { + "period": "auto", + "fillValues": false + } + } + } + ], + "prefix": "", + "tickPrefix": "", + "suffix": "", + "tickSuffix": "", + "colors": [ + { + "id": "base", + "type": "text", + "hex": "#00C9FF", + "name": "laser", + "value": 0 + } + ], + "decimalPlaces": { + "isEnforced": true, + "digits": 0 + }, + "note": "", + "showNoteWhenEmpty": false + } + } + }, + { + "type": "view", + "id": "0bab6892c62dd000", + "attributes": { + "name": "Load test zero: Latency mean", + "properties": { + "shape": "chronograf-v2", + "type": "single-stat", + "queries": [ + { + "text": "from(bucket: \"knative-serving\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"Knative Serving load test\")\n |> filter(fn: (r) => r[\"_field\"] == \"latency-mean\")\n |> filter(fn: (r) => r[\"flavor\"] == \"zero\")\n |> map(fn: (r) => ({r with _value: r._value / 1000.0 / 1000.0}))\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n |> yield(name: \"mean\")\n", + "editMode": "advanced", + "name": "", + "builderConfig": { + "buckets": [], + "tags": [ + { + "key": "_measurement", + "values": [], + "aggregateFunctionType": "filter" + } + ], + "functions": [ + { + "name": "mean" + } + ], + "aggregateWindow": { + "period": "auto", + "fillValues": false + } + } + } + ], + "prefix": "", + "tickPrefix": "", + "suffix": "ms", + "tickSuffix": "", + "colors": [ + { + "id": "base", + "type": "text", + "hex": "#00C9FF", + "name": "laser", + "value": 0 + } + ], + "decimalPlaces": { + "isEnforced": true, + "digits": 0 + }, + "note": "", + "showNoteWhenEmpty": false + } + } + }, + { + "type": "view", + "id": "0bab689fe36dd000", + "attributes": { + "name": "Load test zero: Latency max", + "properties": { + "shape": "chronograf-v2", + "type": "single-stat", + "queries": [ + { + "text": "from(bucket: \"knative-serving\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"Knative Serving load test\")\n |> filter(fn: (r) => r[\"_field\"] == \"latency-max\")\n |> filter(fn: (r) => r[\"flavor\"] == \"zero\")\n |> map(fn: (r) => ({r with _value: r._value / 1000.0 / 1000.0}))\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n |> yield(name: \"mean\")\n", + "editMode": "advanced", + "name": "", + "builderConfig": { + "buckets": [], + "tags": [ + { + "key": "_measurement", + "values": [], + "aggregateFunctionType": "filter" + } + ], + "functions": [ + { + "name": "mean" + } + ], + "aggregateWindow": { + "period": "auto", + "fillValues": false + } + } + } + ], + "prefix": "", + "tickPrefix": "", + "suffix": "ms", + "tickSuffix": "", + "colors": [ + { + "id": "base", + "type": "text", + "hex": "#00C9FF", + "name": "laser", + "value": 0 + } + ], + "decimalPlaces": { + "isEnforced": true, + "digits": 0 + }, + "note": "", + "showNoteWhenEmpty": false + } + } + }, + { + "type": "view", + "id": "0bab68df4fedd000", + "attributes": { + "name": "Load test always: Requests", + "properties": { + "shape": "chronograf-v2", + "type": "single-stat", + "queries": [ + { + "text": "from(bucket: \"knative-serving\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"Knative Serving load test\")\n |> filter(fn: (r) => r[\"_field\"] == \"requests\")\n |> filter(fn: (r) => r[\"flavor\"] == \"always\")\n |> aggregateWindow(every: v.windowPeriod, fn: last, createEmpty: false)\n |> yield(name: \"last\")", + "editMode": "advanced", + "name": "", + "builderConfig": { + "buckets": [], + "tags": [ + { + "key": "_measurement", + "values": [], + "aggregateFunctionType": "filter" + } + ], + "functions": [ + { + "name": "mean" + } + ], + "aggregateWindow": { + "period": "auto", + "fillValues": false + } + } + } + ], + "prefix": "", + "tickPrefix": "", + "suffix": "", + "tickSuffix": "", + "colors": [ + { + "id": "base", + "type": "text", + "hex": "#00C9FF", + "name": "laser", + "value": 0 + } + ], + "decimalPlaces": { + "isEnforced": true, + "digits": 0 + }, + "note": "", + "showNoteWhenEmpty": false + } + } + }, + { + "type": "view", + "id": "0bab68f2f1edd000", + "attributes": { + "name": "Load test always: Errors", + "properties": { + "shape": "chronograf-v2", + "type": "single-stat", + "queries": [ + { + "text": "from(bucket: \"knative-serving\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"Knative Serving load test\")\n |> filter(fn: (r) => r[\"_field\"] == \"errors\")\n |> filter(fn: (r) => r[\"flavor\"] == \"always\")\n |> aggregateWindow(every: v.windowPeriod, fn: last, createEmpty: false)\n |> yield(name: \"last\")", + "editMode": "advanced", + "name": "", + "builderConfig": { + "buckets": [], + "tags": [ + { + "key": "_measurement", + "values": [], + "aggregateFunctionType": "filter" + } + ], + "functions": [ + { + "name": "mean" + } + ], + "aggregateWindow": { + "period": "auto", + "fillValues": false + } + } + } + ], + "prefix": "", + "tickPrefix": "", + "suffix": "", + "tickSuffix": "", + "colors": [ + { + "id": "base", + "type": "text", + "hex": "#00C9FF", + "name": "laser", + "value": 0 + } + ], + "decimalPlaces": { + "isEnforced": true, + "digits": 0 + }, + "note": "", + "showNoteWhenEmpty": false + } + } + }, + { + "type": "view", + "id": "0bab68ff0dadd000", + "attributes": { + "name": "Load test always: Latency min", + "properties": { + "shape": "chronograf-v2", + "type": "single-stat", + "queries": [ + { + "text": "from(bucket: \"knative-serving\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"Knative Serving load test\")\n |> filter(fn: (r) => r[\"_field\"] == \"latency-min\")\n |> filter(fn: (r) => r[\"flavor\"] == \"always\")\n |> map(fn: (r) => ({r with _value: r._value / 1000.0 / 1000.0}))\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n |> yield(name: \"mean\")\n", + "editMode": "advanced", + "name": "", + "builderConfig": { + "buckets": [], + "tags": [ + { + "key": "_measurement", + "values": [], + "aggregateFunctionType": "filter" + } + ], + "functions": [ + { + "name": "mean" + } + ], + "aggregateWindow": { + "period": "auto", + "fillValues": false + } + } + } + ], + "prefix": "", + "tickPrefix": "", + "suffix": "ms", + "tickSuffix": "", + "colors": [ + { + "id": "base", + "type": "text", + "hex": "#00C9FF", + "name": "laser", + "value": 0 + } + ], + "decimalPlaces": { + "isEnforced": true, + "digits": 0 + }, + "note": "", + "showNoteWhenEmpty": false + } + } + }, + { + "type": "view", + "id": "0bab6910a3edd000", + "attributes": { + "name": "Load test always: Latency mean", + "properties": { + "shape": "chronograf-v2", + "type": "single-stat", + "queries": [ + { + "text": "from(bucket: \"knative-serving\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"Knative Serving load test\")\n |> filter(fn: (r) => r[\"_field\"] == \"latency-mean\")\n |> filter(fn: (r) => r[\"flavor\"] == \"always\")\n |> map(fn: (r) => ({r with _value: r._value / 1000.0 / 1000.0}))\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n |> yield(name: \"mean\")\n", + "editMode": "advanced", + "name": "", + "builderConfig": { + "buckets": [], + "tags": [ + { + "key": "_measurement", + "values": [], + "aggregateFunctionType": "filter" + } + ], + "functions": [ + { + "name": "mean" + } + ], + "aggregateWindow": { + "period": "auto", + "fillValues": false + } + } + } + ], + "prefix": "", + "tickPrefix": "", + "suffix": "ms", + "tickSuffix": "", + "colors": [ + { + "id": "base", + "type": "text", + "hex": "#00C9FF", + "name": "laser", + "value": 0 + } + ], + "decimalPlaces": { + "isEnforced": true, + "digits": 0 + }, + "note": "", + "showNoteWhenEmpty": false + } + } + }, + { + "type": "view", + "id": "0bab691eb4add000", + "attributes": { + "name": "Load test always: Latency max", + "properties": { + "shape": "chronograf-v2", + "type": "single-stat", + "queries": [ + { + "text": "from(bucket: \"knative-serving\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"Knative Serving load test\")\n |> filter(fn: (r) => r[\"_field\"] == \"latency-max\")\n |> filter(fn: (r) => r[\"flavor\"] == \"always\")\n |> map(fn: (r) => ({r with _value: r._value / 1000.0 / 1000.0}))\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n |> yield(name: \"mean\")\n", + "editMode": "advanced", + "name": "", + "builderConfig": { + "buckets": [], + "tags": [ + { + "key": "_measurement", + "values": [], + "aggregateFunctionType": "filter" + } + ], + "functions": [ + { + "name": "mean" + } + ], + "aggregateWindow": { + "period": "auto", + "fillValues": false + } + } + } + ], + "prefix": "", + "tickPrefix": "", + "suffix": "ms", + "tickSuffix": "", + "colors": [ + { + "id": "base", + "type": "text", + "hex": "#00C9FF", + "name": "laser", + "value": 0 + } + ], + "decimalPlaces": { + "isEnforced": true, + "digits": 0 + }, + "note": "", + "showNoteWhenEmpty": false + } + } + }, + { + "type": "view", + "id": "0bab695c48edd000", + "attributes": { + "name": "Name this Cell", + "properties": { + "shape": "chronograf-v2", + "type": "markdown", + "note": "#### Load test results\n* Zero = Only hook the activator in at zero\n* Always = Always hook the activator in.\n* 200 = Hook the activator in until we reach 200 concurrent requests" + } + } + }, + { + "type": "view", + "id": "0bab696865add000", + "attributes": { + "name": "Name this Cell (Clone)", + "properties": { + "shape": "chronograf-v2", + "type": "markdown", + "note": "#### Reconciler delay results" + } + } + }, + { + "type": "view", + "id": "0bab69eb996dd000", + "attributes": { + "name": "Load test 200: Requests", + "properties": { + "shape": "chronograf-v2", + "type": "single-stat", + "queries": [ + { + "text": "from(bucket: \"knative-serving\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"Knative Serving load test\")\n |> filter(fn: (r) => r[\"_field\"] == \"requests\")\n |> filter(fn: (r) => r[\"flavor\"] == \"200\")\n |> aggregateWindow(every: v.windowPeriod, fn: last, createEmpty: false)\n |> yield(name: \"last\")", + "editMode": "advanced", + "name": "", + "builderConfig": { + "buckets": [], + "tags": [ + { + "key": "_measurement", + "values": [], + "aggregateFunctionType": "filter" + } + ], + "functions": [ + { + "name": "mean" + } + ], + "aggregateWindow": { + "period": "auto", + "fillValues": false + } + } + } + ], + "prefix": "", + "tickPrefix": "", + "suffix": "", + "tickSuffix": "", + "colors": [ + { + "id": "base", + "type": "text", + "hex": "#00C9FF", + "name": "laser", + "value": 0 + } + ], + "decimalPlaces": { + "isEnforced": true, + "digits": 0 + }, + "note": "", + "showNoteWhenEmpty": false + } + } + }, + { + "type": "view", + "id": "0bab6a0308edd000", + "attributes": { + "name": "Load test 200: Errors", + "properties": { + "shape": "chronograf-v2", + "type": "single-stat", + "queries": [ + { + "text": "from(bucket: \"knative-serving\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"Knative Serving load test\")\n |> filter(fn: (r) => r[\"_field\"] == \"errors\")\n |> filter(fn: (r) => r[\"flavor\"] == \"200\")\n |> aggregateWindow(every: v.windowPeriod, fn: last, createEmpty: false)\n |> yield(name: \"last\")", + "editMode": "advanced", + "name": "", + "builderConfig": { + "buckets": [], + "tags": [ + { + "key": "_measurement", + "values": [], + "aggregateFunctionType": "filter" + } + ], + "functions": [ + { + "name": "mean" + } + ], + "aggregateWindow": { + "period": "auto", + "fillValues": false + } + } + } + ], + "prefix": "", + "tickPrefix": "", + "suffix": "", + "tickSuffix": "", + "colors": [ + { + "id": "base", + "type": "text", + "hex": "#00C9FF", + "name": "laser", + "value": 0 + } + ], + "decimalPlaces": { + "isEnforced": true, + "digits": 0 + }, + "note": "", + "showNoteWhenEmpty": false + } + } + }, + { + "type": "view", + "id": "0bab6a102a2dd000", + "attributes": { + "name": "Load test 200: Latency min", + "properties": { + "shape": "chronograf-v2", + "type": "single-stat", + "queries": [ + { + "text": "from(bucket: \"knative-serving\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"Knative Serving load test\")\n |> filter(fn: (r) => r[\"_field\"] == \"latency-min\")\n |> filter(fn: (r) => r[\"flavor\"] == \"200\")\n |> map(fn: (r) => ({r with _value: r._value / 1000.0 / 1000.0}))\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n |> yield(name: \"mean\")\n", + "editMode": "advanced", + "name": "", + "builderConfig": { + "buckets": [], + "tags": [ + { + "key": "_measurement", + "values": [], + "aggregateFunctionType": "filter" + } + ], + "functions": [ + { + "name": "mean" + } + ], + "aggregateWindow": { + "period": "auto", + "fillValues": false + } + } + } + ], + "prefix": "", + "tickPrefix": "", + "suffix": "ms", + "tickSuffix": "", + "colors": [ + { + "id": "base", + "type": "text", + "hex": "#00C9FF", + "name": "laser", + "value": 0 + } + ], + "decimalPlaces": { + "isEnforced": true, + "digits": 0 + }, + "note": "", + "showNoteWhenEmpty": false + } + } + }, + { + "type": "view", + "id": "0bab6a209e6dd000", + "attributes": { + "name": "Load test 200: Latency mean", + "properties": { + "shape": "chronograf-v2", + "type": "single-stat", + "queries": [ + { + "text": "from(bucket: \"knative-serving\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"Knative Serving load test\")\n |> filter(fn: (r) => r[\"_field\"] == \"latency-mean\")\n |> filter(fn: (r) => r[\"flavor\"] == \"200\")\n |> map(fn: (r) => ({r with _value: r._value / 1000.0 / 1000.0}))\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n |> yield(name: \"mean\")\n", + "editMode": "advanced", + "name": "", + "builderConfig": { + "buckets": [], + "tags": [ + { + "key": "_measurement", + "values": [], + "aggregateFunctionType": "filter" + } + ], + "functions": [ + { + "name": "mean" + } + ], + "aggregateWindow": { + "period": "auto", + "fillValues": false + } + } + } + ], + "prefix": "", + "tickPrefix": "", + "suffix": "ms", + "tickSuffix": "", + "colors": [ + { + "id": "base", + "type": "text", + "hex": "#00C9FF", + "name": "laser", + "value": 0 + } + ], + "decimalPlaces": { + "isEnforced": true, + "digits": 0 + }, + "note": "", + "showNoteWhenEmpty": false + } + } + }, + { + "type": "view", + "id": "0bab6a2e3e6dd000", + "attributes": { + "name": "Load test 200: Latency max", + "properties": { + "shape": "chronograf-v2", + "type": "single-stat", + "queries": [ + { + "text": "from(bucket: \"knative-serving\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"Knative Serving load test\")\n |> filter(fn: (r) => r[\"_field\"] == \"latency-max\")\n |> filter(fn: (r) => r[\"flavor\"] == \"200\")\n |> map(fn: (r) => ({r with _value: r._value / 1000.0 / 1000.0}))\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n |> yield(name: \"mean\")\n", + "editMode": "advanced", + "name": "", + "builderConfig": { + "buckets": [], + "tags": [ + { + "key": "_measurement", + "values": [], + "aggregateFunctionType": "filter" + } + ], + "functions": [ + { + "name": "mean" + } + ], + "aggregateWindow": { + "period": "auto", + "fillValues": false + } + } + } + ], + "prefix": "", + "tickPrefix": "", + "suffix": "ms", + "tickSuffix": "", + "colors": [ + { + "id": "base", + "type": "text", + "hex": "#00C9FF", + "name": "laser", + "value": 0 + } + ], + "decimalPlaces": { + "isEnforced": true, + "digits": 0 + }, + "note": "", + "showNoteWhenEmpty": false + } + } + }, + { + "type": "view", + "id": "0bab6b8c582dd000", + "attributes": { + "name": "Reconciler delay per CR", + "properties": { + "shape": "chronograf-v2", + "queries": [ + { + "text": "from(bucket: \"knative-serving\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"Knative Serving reconciliation delay\")\n |> filter(fn: (r) => r[\"_field\"] == \"Configuration\" or r[\"_field\"] == \"Ingress\" or r[\"_field\"] == \"PodAutoscaler\" or r[\"_field\"] == \"Revision\" or r[\"_field\"] == \"Route\" or r[\"_field\"] == \"Service\" or r[\"_field\"] == \"ServerlessService\")\n |> filter(fn: (r) => r[\"PROW_TAG\"] == \"local\")\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n |> yield(name: \"mean\")", + "editMode": "advanced", + "name": "", + "builderConfig": { + "buckets": [], + "tags": [ + { + "key": "_measurement", + "values": [], + "aggregateFunctionType": "filter" + } + ], + "functions": [ + { + "name": "mean" + } + ], + "aggregateWindow": { + "period": "auto", + "fillValues": false + } + } + } + ], + "axes": { + "x": { + "bounds": [ + "", + "" + ], + "label": "", + "prefix": "", + "suffix": "", + "base": "10", + "scale": "linear" + }, + "y": { + "bounds": [ + "", + "" + ], + "label": "", + "prefix": "", + "suffix": "", + "base": "10", + "scale": "linear" + } + }, + "type": "xy", + "staticLegend": { + "colorizeRows": true, + "heightRatio": 0.22, + "show": true, + "opacity": 1, + "orientationThreshold": 100000000, + "valueAxis": "y", + "widthRatio": 1 + }, + "geom": "line", + "colors": [ + { + "id": "c4637f28-66af-4b8e-817d-8a7bf4f4c673", + "type": "scale", + "hex": "#31C0F6", + "name": "Nineteen Eighty Four", + "value": 0 + }, + { + "id": "4a1e9419-947c-4e20-b507-3f169c914e5d", + "type": "scale", + "hex": "#A500A5", + "name": "Nineteen Eighty Four", + "value": 0 + }, + { + "id": "0ebeec39-b94d-405b-8258-e40ad61efed5", + "type": "scale", + "hex": "#FF7E27", + "name": "Nineteen Eighty Four", + "value": 0 + } + ], + "note": "", + "showNoteWhenEmpty": false, + "xColumn": "_time", + "generateXAxisTicks": [], + "xTotalTicks": 0, + "xTickStart": 0, + "xTickStep": 0, + "yColumn": "_value", + "generateYAxisTicks": [], + "yTotalTicks": 0, + "yTickStart": 0, + "yTickStep": 0, + "shadeBelow": false, + "position": "overlaid", + "timeFormat": "", + "hoverDimension": "auto", + "legendColorizeRows": true, + "legendHide": false, + "legendOpacity": 1, + "legendOrientationThreshold": 100000000 + } + } + }, + { + "type": "view", + "id": "0bacae4a1fdc3000", + "attributes": { + "name": "Name this Cell", + "properties": { + "shape": "chronograf-v2", + "type": "markdown", + "note": "#### Scale from zero results" + } + } + }, + { + "type": "view", + "id": "0bacaf09181c3000", + "attributes": { + "name": "Deployment & Service ready delays", + "properties": { + "shape": "chronograf-v2", + "queries": [ + { + "text": "from(bucket: \"knative-serving\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"Serving Serving scale from zero\")\n |> filter(fn: (r) => r[\"_field\"] == \"deployment-updated-latency\" or r[\"_field\"] == \"service-ready-latency\")\n |> map(fn: (r) => ({r with _value: r._value / 1000 }))", + "editMode": "advanced", + "name": "", + "builderConfig": { + "buckets": [], + "tags": [ + { + "key": "_measurement", + "values": [], + "aggregateFunctionType": "filter" + } + ], + "functions": [ + { + "name": "mean" + } + ], + "aggregateWindow": { + "period": "auto", + "fillValues": false + } + } + } + ], + "axes": { + "x": { + "bounds": [ + "", + "" + ], + "label": "", + "prefix": "", + "suffix": "", + "base": "10", + "scale": "linear" + }, + "y": { + "bounds": [ + "", + "" + ], + "label": "seconds", + "prefix": "", + "suffix": "", + "base": "10", + "scale": "linear" + } + }, + "type": "xy", + "staticLegend": { + "colorizeRows": true, + "heightRatio": 0.21070615034168566, + "show": true, + "opacity": 1, + "orientationThreshold": 100000000, + "widthRatio": 1 + }, + "geom": "line", + "colors": [ + { + "id": "233e4497-8b3d-4753-b15f-2451dd0e5b68", + "type": "scale", + "hex": "#31C0F6", + "name": "Nineteen Eighty Four", + "value": 0 + }, + { + "id": "d0c48283-77dc-4c32-b436-11f6e9468088", + "type": "scale", + "hex": "#A500A5", + "name": "Nineteen Eighty Four", + "value": 0 + }, + { + "id": "1e8df3ce-f00a-4d6f-bf80-d076fc67dd1c", + "type": "scale", + "hex": "#FF7E27", + "name": "Nineteen Eighty Four", + "value": 0 + } + ], + "note": "", + "showNoteWhenEmpty": false, + "xColumn": "_time", + "generateXAxisTicks": [], + "xTotalTicks": 0, + "xTickStart": 0, + "xTickStep": 0, + "yColumn": "_value", + "generateYAxisTicks": [], + "yTotalTicks": 0, + "yTickStart": 0, + "yTickStep": 0, + "shadeBelow": false, + "position": "overlaid", + "timeFormat": "", + "hoverDimension": "auto", + "legendColorizeRows": true, + "legendHide": false, + "legendOpacity": 1, + "legendOrientationThreshold": 100000000 + } + } + }, + { + "type": "view", + "id": "0bacba9c90dc3000", + "attributes": { + "name": "Errors", + "properties": { + "shape": "chronograf-v2", + "type": "single-stat", + "queries": [ + { + "text": "from(bucket: \"knative-serving\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"Serving Serving scale from zero\")\n |> filter(fn: (r) => r[\"_field\"] == \"errors\")\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n |> yield(name: \"mean\")", + "editMode": "advanced", + "name": "", + "builderConfig": { + "buckets": [], + "tags": [ + { + "key": "_measurement", + "values": [], + "aggregateFunctionType": "filter" + } + ], + "functions": [ + { + "name": "mean" + } + ], + "aggregateWindow": { + "period": "auto", + "fillValues": false + } + } + } + ], + "prefix": "", + "tickPrefix": "", + "suffix": "", + "tickSuffix": "", + "colors": [ + { + "id": "base", + "type": "text", + "hex": "#00C9FF", + "name": "laser", + "value": 0 + } + ], + "decimalPlaces": { + "isEnforced": true, + "digits": 2 + }, + "note": "", + "showNoteWhenEmpty": false + } + } + }, + { + "type": "view", + "id": "0bacd823795c3000", + "attributes": { + "name": "Name this Cell (Clone)", + "properties": { + "shape": "chronograf-v2", + "type": "markdown", + "note": "#### Dataplane probe results\n* Deployment = Vanilla k8s Deployment\n* Activator = Always hook the activator in\n* Queue = Only hook the activator in when scaled to zero.\n" + } + } + }, + { + "type": "view", + "id": "0bacd850a09c3000", + "attributes": { + "name": "Dataplane probe activator: Requests", + "properties": { + "shape": "chronograf-v2", + "type": "single-stat", + "queries": [ + { + "text": "from(bucket: \"knative-serving\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"Knative Serving dataplane probe\")\n |> filter(fn: (r) => r[\"_field\"] == \"requests\")\n |> filter(fn: (r) => r[\"target\"] == \"activator\")\n |> aggregateWindow(every: v.windowPeriod, fn: last, createEmpty: false)\n |> yield(name: \"last\")", + "editMode": "advanced", + "name": "", + "builderConfig": { + "buckets": [], + "tags": [ + { + "key": "_measurement", + "values": [], + "aggregateFunctionType": "filter" + } + ], + "functions": [ + { + "name": "mean" + } + ], + "aggregateWindow": { + "period": "auto", + "fillValues": false + } + } + } + ], + "prefix": "", + "tickPrefix": "", + "suffix": "", + "tickSuffix": "", + "colors": [ + { + "id": "base", + "type": "text", + "hex": "#00C9FF", + "name": "laser", + "value": 0 + } + ], + "decimalPlaces": { + "isEnforced": true, + "digits": 0 + }, + "note": "", + "showNoteWhenEmpty": false + } + } + }, + { + "type": "view", + "id": "0bacd8839b1c3000", + "attributes": { + "name": "Dataplane probe deployment: Requests", + "properties": { + "shape": "chronograf-v2", + "type": "single-stat", + "queries": [ + { + "text": "from(bucket: \"knative-serving\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"Knative Serving dataplane probe\")\n |> filter(fn: (r) => r[\"_field\"] == \"requests\")\n |> filter(fn: (r) => r[\"target\"] == \"deployment\")\n |> aggregateWindow(every: v.windowPeriod, fn: last, createEmpty: false)\n |> yield(name: \"last\")", + "editMode": "advanced", + "name": "", + "builderConfig": { + "buckets": [], + "tags": [ + { + "key": "_measurement", + "values": [], + "aggregateFunctionType": "filter" + } + ], + "functions": [ + { + "name": "mean" + } + ], + "aggregateWindow": { + "period": "auto", + "fillValues": false + } + } + } + ], + "prefix": "", + "tickPrefix": "", + "suffix": "", + "tickSuffix": "", + "colors": [ + { + "id": "base", + "type": "text", + "hex": "#00C9FF", + "name": "laser", + "value": 0 + } + ], + "decimalPlaces": { + "isEnforced": true, + "digits": 0 + }, + "note": "", + "showNoteWhenEmpty": false + } + } + }, + { + "type": "view", + "id": "0bacd899fe1c3000", + "attributes": { + "name": "Dataplane probe queue: Requests", + "properties": { + "shape": "chronograf-v2", + "type": "single-stat", + "queries": [ + { + "text": "from(bucket: \"knative-serving\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"Knative Serving dataplane probe\")\n |> filter(fn: (r) => r[\"_field\"] == \"requests\")\n |> filter(fn: (r) => r[\"target\"] == \"queue\")\n |> aggregateWindow(every: v.windowPeriod, fn: last, createEmpty: false)\n |> yield(name: \"last\")", + "editMode": "advanced", + "name": "", + "builderConfig": { + "buckets": [], + "tags": [ + { + "key": "_measurement", + "values": [], + "aggregateFunctionType": "filter" + } + ], + "functions": [ + { + "name": "mean" + } + ], + "aggregateWindow": { + "period": "auto", + "fillValues": false + } + } + } + ], + "prefix": "", + "tickPrefix": "", + "suffix": "", + "tickSuffix": "", + "colors": [ + { + "id": "base", + "type": "text", + "hex": "#00C9FF", + "name": "laser", + "value": 0 + } + ], + "decimalPlaces": { + "isEnforced": true, + "digits": 0 + }, + "note": "", + "showNoteWhenEmpty": false + } + } + }, + { + "type": "view", + "id": "0bacd8bf225c3000", + "attributes": { + "name": "Dataplane probe activator: Errors", + "properties": { + "shape": "chronograf-v2", + "type": "single-stat", + "queries": [ + { + "text": "from(bucket: \"knative-serving\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"Knative Serving dataplane probe\")\n |> filter(fn: (r) => r[\"_field\"] == \"errors\")\n |> filter(fn: (r) => r[\"target\"] == \"activator\")\n |> aggregateWindow(every: v.windowPeriod, fn: last, createEmpty: false)\n |> yield(name: \"last\")", + "editMode": "advanced", + "name": "", + "builderConfig": { + "buckets": [], + "tags": [ + { + "key": "_measurement", + "values": [], + "aggregateFunctionType": "filter" + } + ], + "functions": [ + { + "name": "mean" + } + ], + "aggregateWindow": { + "period": "auto", + "fillValues": false + } + } + } + ], + "prefix": "", + "tickPrefix": "", + "suffix": "", + "tickSuffix": "", + "colors": [ + { + "id": "base", + "type": "text", + "hex": "#00C9FF", + "name": "laser", + "value": 0 + } + ], + "decimalPlaces": { + "isEnforced": true, + "digits": 0 + }, + "note": "", + "showNoteWhenEmpty": false + } + } + }, + { + "type": "view", + "id": "0bacd8d7af9c3000", + "attributes": { + "name": "Dataplane probe deployment: Errors", + "properties": { + "shape": "chronograf-v2", + "type": "single-stat", + "queries": [ + { + "text": "from(bucket: \"knative-serving\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"Knative Serving dataplane probe\")\n |> filter(fn: (r) => r[\"_field\"] == \"errors\")\n |> filter(fn: (r) => r[\"target\"] == \"deployment\")\n |> aggregateWindow(every: v.windowPeriod, fn: last, createEmpty: false)\n |> yield(name: \"last\")", + "editMode": "advanced", + "name": "", + "builderConfig": { + "buckets": [], + "tags": [ + { + "key": "_measurement", + "values": [], + "aggregateFunctionType": "filter" + } + ], + "functions": [ + { + "name": "mean" + } + ], + "aggregateWindow": { + "period": "auto", + "fillValues": false + } + } + } + ], + "prefix": "", + "tickPrefix": "", + "suffix": "", + "tickSuffix": "", + "colors": [ + { + "id": "base", + "type": "text", + "hex": "#00C9FF", + "name": "laser", + "value": 0 + } + ], + "decimalPlaces": { + "isEnforced": true, + "digits": 0 + }, + "note": "", + "showNoteWhenEmpty": false + } + } + }, + { + "type": "view", + "id": "0bacd8e66a5c3000", + "attributes": { + "name": "Dataplane probe queue: Errors", + "properties": { + "shape": "chronograf-v2", + "type": "single-stat", + "queries": [ + { + "text": "from(bucket: \"knative-serving\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"Knative Serving dataplane probe\")\n |> filter(fn: (r) => r[\"_field\"] == \"errors\")\n |> filter(fn: (r) => r[\"target\"] == \"queue\")\n |> aggregateWindow(every: v.windowPeriod, fn: last, createEmpty: false)\n |> yield(name: \"last\")", + "editMode": "advanced", + "name": "", + "builderConfig": { + "buckets": [], + "tags": [ + { + "key": "_measurement", + "values": [], + "aggregateFunctionType": "filter" + } + ], + "functions": [ + { + "name": "mean" + } + ], + "aggregateWindow": { + "period": "auto", + "fillValues": false + } + } + } + ], + "prefix": "", + "tickPrefix": "", + "suffix": "", + "tickSuffix": "", + "colors": [ + { + "id": "base", + "type": "text", + "hex": "#00C9FF", + "name": "laser", + "value": 0 + } + ], + "decimalPlaces": { + "isEnforced": true, + "digits": 0 + }, + "note": "", + "showNoteWhenEmpty": false + } + } + }, + { + "type": "view", + "id": "0bacd8f8459c3000", + "attributes": { + "name": "Dataplane probe deployment: Latency min", + "properties": { + "shape": "chronograf-v2", + "type": "single-stat", + "queries": [ + { + "text": "from(bucket: \"knative-serving\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"Knative Serving dataplane probe\")\n |> filter(fn: (r) => r[\"_field\"] == \"latency-min\")\n |> filter(fn: (r) => r[\"target\"] == \"deployment\")\n |> map(fn: (r) => ({r with _value: r._value / 1000.0 / 1000.0}))\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n |> yield(name: \"mean\")\n", + "editMode": "advanced", + "name": "", + "builderConfig": { + "buckets": [], + "tags": [ + { + "key": "_measurement", + "values": [], + "aggregateFunctionType": "filter" + } + ], + "functions": [ + { + "name": "mean" + } + ], + "aggregateWindow": { + "period": "auto", + "fillValues": false + } + } + } + ], + "prefix": "", + "tickPrefix": "", + "suffix": "ms", + "tickSuffix": "", + "colors": [ + { + "id": "base", + "type": "text", + "hex": "#00C9FF", + "name": "laser", + "value": 0 + } + ], + "decimalPlaces": { + "isEnforced": true, + "digits": 0 + }, + "note": "", + "showNoteWhenEmpty": false + } + } + }, + { + "type": "view", + "id": "0bacd97e2d5c3000", + "attributes": { + "name": "Dataplane probe activator: Latency min", + "properties": { + "shape": "chronograf-v2", + "type": "single-stat", + "queries": [ + { + "text": "from(bucket: \"knative-serving\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"Knative Serving dataplane probe\")\n |> filter(fn: (r) => r[\"_field\"] == \"latency-min\")\n |> filter(fn: (r) => r[\"target\"] == \"activator\")\n |> map(fn: (r) => ({r with _value: r._value / 1000.0 / 1000.0}))\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n |> yield(name: \"mean\")\n", + "editMode": "advanced", + "name": "", + "builderConfig": { + "buckets": [], + "tags": [ + { + "key": "_measurement", + "values": [], + "aggregateFunctionType": "filter" + } + ], + "functions": [ + { + "name": "mean" + } + ], + "aggregateWindow": { + "period": "auto", + "fillValues": false + } + } + } + ], + "prefix": "", + "tickPrefix": "", + "suffix": "ms", + "tickSuffix": "", + "colors": [ + { + "id": "base", + "type": "text", + "hex": "#00C9FF", + "name": "laser", + "value": 0 + } + ], + "decimalPlaces": { + "isEnforced": true, + "digits": 0 + }, + "note": "", + "showNoteWhenEmpty": false + } + } + }, + { + "type": "view", + "id": "0bacda1bca5c3000", + "attributes": { + "name": "Dataplane probe queue: Latency min", + "properties": { + "shape": "chronograf-v2", + "type": "single-stat", + "queries": [ + { + "text": "from(bucket: \"knative-serving\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"Knative Serving dataplane probe\")\n |> filter(fn: (r) => r[\"_field\"] == \"latency-min\")\n |> filter(fn: (r) => r[\"target\"] == \"queue\")\n |> map(fn: (r) => ({r with _value: r._value / 1000.0 / 1000.0}))\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n |> yield(name: \"mean\")\n", + "editMode": "advanced", + "name": "", + "builderConfig": { + "buckets": [], + "tags": [ + { + "key": "_measurement", + "values": [], + "aggregateFunctionType": "filter" + } + ], + "functions": [ + { + "name": "mean" + } + ], + "aggregateWindow": { + "period": "auto", + "fillValues": false + } + } + } + ], + "prefix": "", + "tickPrefix": "", + "suffix": "ms", + "tickSuffix": "", + "colors": [ + { + "id": "base", + "type": "text", + "hex": "#00C9FF", + "name": "laser", + "value": 0 + } + ], + "decimalPlaces": { + "isEnforced": true, + "digits": 0 + }, + "note": "", + "showNoteWhenEmpty": false + } + } + }, + { + "type": "view", + "id": "0bacda84055c3000", + "attributes": { + "name": "Dataplane probe deployment: Latency mean", + "properties": { + "shape": "chronograf-v2", + "type": "single-stat", + "queries": [ + { + "text": "from(bucket: \"knative-serving\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"Knative Serving dataplane probe\")\n |> filter(fn: (r) => r[\"_field\"] == \"latency-mean\")\n |> filter(fn: (r) => r[\"target\"] == \"deployment\")\n |> map(fn: (r) => ({r with _value: r._value / 1000.0 / 1000.0}))\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n |> yield(name: \"mean\")\n", + "editMode": "advanced", + "name": "", + "builderConfig": { + "buckets": [], + "tags": [ + { + "key": "_measurement", + "values": [], + "aggregateFunctionType": "filter" + } + ], + "functions": [ + { + "name": "mean" + } + ], + "aggregateWindow": { + "period": "auto", + "fillValues": false + } + } + } + ], + "prefix": "", + "tickPrefix": "", + "suffix": "ms", + "tickSuffix": "", + "colors": [ + { + "id": "base", + "type": "text", + "hex": "#00C9FF", + "name": "laser", + "value": 0 + } + ], + "decimalPlaces": { + "isEnforced": true, + "digits": 0 + }, + "note": "", + "showNoteWhenEmpty": false + } + } + }, + { + "type": "view", + "id": "0bacda960e1c3000", + "attributes": { + "name": "Dataplane probe activator: Latency mean", + "properties": { + "shape": "chronograf-v2", + "type": "single-stat", + "queries": [ + { + "text": "from(bucket: \"knative-serving\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"Knative Serving dataplane probe\")\n |> filter(fn: (r) => r[\"_field\"] == \"latency-mean\")\n |> filter(fn: (r) => r[\"target\"] == \"activator\")\n |> map(fn: (r) => ({r with _value: r._value / 1000.0 / 1000.0}))\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n |> yield(name: \"mean\")\n", + "editMode": "advanced", + "name": "", + "builderConfig": { + "buckets": [], + "tags": [ + { + "key": "_measurement", + "values": [], + "aggregateFunctionType": "filter" + } + ], + "functions": [ + { + "name": "mean" + } + ], + "aggregateWindow": { + "period": "auto", + "fillValues": false + } + } + } + ], + "prefix": "", + "tickPrefix": "", + "suffix": "ms", + "tickSuffix": "", + "colors": [ + { + "id": "base", + "type": "text", + "hex": "#00C9FF", + "name": "laser", + "value": 0 + } + ], + "decimalPlaces": { + "isEnforced": true, + "digits": 0 + }, + "note": "", + "showNoteWhenEmpty": false + } + } + }, + { + "type": "view", + "id": "0bacdaa14c9c3000", + "attributes": { + "name": "Dataplane probe queue: Latency mean", + "properties": { + "shape": "chronograf-v2", + "type": "single-stat", + "queries": [ + { + "text": "from(bucket: \"knative-serving\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"Knative Serving dataplane probe\")\n |> filter(fn: (r) => r[\"_field\"] == \"latency-mean\")\n |> filter(fn: (r) => r[\"target\"] == \"queue\")\n |> map(fn: (r) => ({r with _value: r._value / 1000.0 / 1000.0}))\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n |> yield(name: \"mean\")\n", + "editMode": "advanced", + "name": "", + "builderConfig": { + "buckets": [], + "tags": [ + { + "key": "_measurement", + "values": [], + "aggregateFunctionType": "filter" + } + ], + "functions": [ + { + "name": "mean" + } + ], + "aggregateWindow": { + "period": "auto", + "fillValues": false + } + } + } + ], + "prefix": "", + "tickPrefix": "", + "suffix": "ms", + "tickSuffix": "", + "colors": [ + { + "id": "base", + "type": "text", + "hex": "#00C9FF", + "name": "laser", + "value": 0 + } + ], + "decimalPlaces": { + "isEnforced": true, + "digits": 0 + }, + "note": "", + "showNoteWhenEmpty": false + } + } + }, + { + "type": "view", + "id": "0bacdab6a61c3000", + "attributes": { + "name": "Dataplane probe deployment: Latency max", + "properties": { + "shape": "chronograf-v2", + "type": "single-stat", + "queries": [ + { + "text": "from(bucket: \"knative-serving\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"Knative Serving dataplane probe\")\n |> filter(fn: (r) => r[\"_field\"] == \"latency-max\")\n |> filter(fn: (r) => r[\"target\"] == \"deployment\")\n |> map(fn: (r) => ({r with _value: r._value / 1000.0 / 1000.0}))\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n |> yield(name: \"mean\")\n", + "editMode": "advanced", + "name": "", + "builderConfig": { + "buckets": [], + "tags": [ + { + "key": "_measurement", + "values": [], + "aggregateFunctionType": "filter" + } + ], + "functions": [ + { + "name": "mean" + } + ], + "aggregateWindow": { + "period": "auto", + "fillValues": false + } + } + } + ], + "prefix": "", + "tickPrefix": "", + "suffix": "ms", + "tickSuffix": "", + "colors": [ + { + "id": "base", + "type": "text", + "hex": "#00C9FF", + "name": "laser", + "value": 0 + } + ], + "decimalPlaces": { + "isEnforced": true, + "digits": 0 + }, + "note": "", + "showNoteWhenEmpty": false + } + } + }, + { + "type": "view", + "id": "0bacdac4589c3000", + "attributes": { + "name": "Dataplane probe activator: Latency max", + "properties": { + "shape": "chronograf-v2", + "type": "single-stat", + "queries": [ + { + "text": "from(bucket: \"knative-serving\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"Knative Serving dataplane probe\")\n |> filter(fn: (r) => r[\"_field\"] == \"latency-max\")\n |> filter(fn: (r) => r[\"target\"] == \"activator\")\n |> map(fn: (r) => ({r with _value: r._value / 1000.0 / 1000.0}))\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n |> yield(name: \"mean\")\n", + "editMode": "advanced", + "name": "", + "builderConfig": { + "buckets": [], + "tags": [ + { + "key": "_measurement", + "values": [], + "aggregateFunctionType": "filter" + } + ], + "functions": [ + { + "name": "mean" + } + ], + "aggregateWindow": { + "period": "auto", + "fillValues": false + } + } + } + ], + "prefix": "", + "tickPrefix": "", + "suffix": "ms", + "tickSuffix": "", + "colors": [ + { + "id": "base", + "type": "text", + "hex": "#00C9FF", + "name": "laser", + "value": 0 + } + ], + "decimalPlaces": { + "isEnforced": true, + "digits": 0 + }, + "note": "", + "showNoteWhenEmpty": false + } + } + }, + { + "type": "view", + "id": "0bacdad2359c3000", + "attributes": { + "name": "Dataplane probe queue: Latency max", + "properties": { + "shape": "chronograf-v2", + "type": "single-stat", + "queries": [ + { + "text": "from(bucket: \"knative-serving\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"Knative Serving dataplane probe\")\n |> filter(fn: (r) => r[\"_field\"] == \"latency-max\")\n |> filter(fn: (r) => r[\"target\"] == \"queue\")\n |> map(fn: (r) => ({r with _value: r._value / 1000.0 / 1000.0}))\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n |> yield(name: \"mean\")\n", + "editMode": "advanced", + "name": "", + "builderConfig": { + "buckets": [], + "tags": [ + { + "key": "_measurement", + "values": [], + "aggregateFunctionType": "filter" + } + ], + "functions": [ + { + "name": "mean" + } + ], + "aggregateWindow": { + "period": "auto", + "fillValues": false + } + } + } + ], + "prefix": "", + "tickPrefix": "", + "suffix": "ms", + "tickSuffix": "", + "colors": [ + { + "id": "base", + "type": "text", + "hex": "#00C9FF", + "name": "laser", + "value": 0 + } + ], + "decimalPlaces": { + "isEnforced": true, + "digits": 0 + }, + "note": "", + "showNoteWhenEmpty": false + } + } + }, + { + "type": "view", + "id": "0bacdb69b39c3000", + "attributes": { + "name": "Name this Cell (Clone) (Clone)", + "properties": { + "shape": "chronograf-v2", + "type": "markdown", + "note": "#### Rollout probe results\n* Activator Direct = Always hook the activator in: weightedExponential\n* Activator Direct Lin = Always hook the activator in: linear\n* Queue = Only hook the activator in when scaled to zero.\n" + } + } + } + ] + }, + "labels": [] +} \ No newline at end of file diff --git a/test/performance/influx_client.go b/test/performance/influx_client.go deleted file mode 100644 index 06e532fa63b4..000000000000 --- a/test/performance/influx_client.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2022 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package performance - -import ( - "crypto/tls" - "fmt" - "os" - "time" - - influxdb2 "github.com/influxdata/influxdb-client-go/v2" -) - -const ( - influxToken = "INFLUX_TOKEN" - influxURL = "INFLUX_URL" - prowTag = "PROW_TAG" - org = "Knativetest" - bucket = "knative-serving" - influxURLSecretVolume = "influx-url-secret-volume" - influxTokenSecretVolume = "influx-token-secret-volume" - influxURLSecretKey = "influxdb-url" - influxTokenSecretKey = "influxdb-token" -) - -func AddInfluxPoint(measurement string, fields map[string]interface{}) error { - - url, err := getSecretValue(influxURLSecretVolume, influxURLSecretKey, influxURL) - if err != nil { - return err - } - - token, err := getSecretValue(influxTokenSecretVolume, influxTokenSecretKey, influxToken) - if err != nil { - return err - } - - tags := map[string]string{} - build, found := os.LookupEnv(prowTag) - if found { - tags[prowTag] = build - } - - client := influxdb2.NewClientWithOptions(url, token, - influxdb2.DefaultOptions(). - SetUseGZip(true). - SetBatchSize(20). - //nolint:gosec // We explicitly don't need to check certs here since this is test code. - SetTLSConfig(&tls.Config{InsecureSkipVerify: true})) - defer client.Close() - - writeAPI := client.WriteAPI(org, bucket) - p := influxdb2.NewPoint(measurement, - tags, - fields, - time.Now()) - // Write point asynchronously - writeAPI.WritePoint(p) - // Force all unwritten data to be sent - writeAPI.Flush() - - return nil -} - -func getSecretValue(secretVolume, secretKey, envVarName string) (string, error) { - value, err := os.ReadFile(fmt.Sprintf("/etc/%s/%s", secretVolume, secretKey)) - if err != nil { - valueFromEnv, ok := os.LookupEnv(envVarName) - if !ok { - return "", fmt.Errorf("failed to get INFLUX %s", secretKey) - } - return valueFromEnv, nil - } - return string(value), nil -} diff --git a/test/performance/metrics/request.go b/test/performance/metrics/request.go deleted file mode 100644 index 8a74ebaab5ad..000000000000 --- a/test/performance/metrics/request.go +++ /dev/null @@ -1,72 +0,0 @@ -/* -Copyright 2019 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package metrics - -import ( - "log" - - "github.com/google/mako/go/quickstore" - vegeta "github.com/tsenart/vegeta/v12/lib" - - "knative.dev/pkg/test/mako" - "knative.dev/serving/test/performance" -) - -// AggregateResult is the aggregated result of requests for better visualization. -type AggregateResult struct { - // ErrorRates is a map that saves the number of errors for each timestamp (in secs) - ErrorRates map[int64]int64 - // RequestRates is a map that saves the number of requests for each timestamp (in secs) - RequestRates map[int64]int64 -} - -// NewAggregateResult returns the pointer of a new AggregateResult object. -func NewAggregateResult(initialSize int) *AggregateResult { - return &AggregateResult{ - ErrorRates: make(map[int64]int64, initialSize), - RequestRates: make(map[int64]int64, initialSize), - } -} - -// HandleResult will handle the attack result by: -// 1. Adding its latency as a sample point if no error, or adding it as an error if there is -// 2. Updating the aggregate results -func HandleResult(q *quickstore.Quickstore, benchmarkName string, res vegeta.Result, latencyKey string, ar *AggregateResult) { - // Handle the result by reporting an error or a latency sample point. - var isAnError int64 - if res.Error != "" { - // By reporting errors like this the error strings show up on - // the details page for each Mako run. - q.AddError(mako.XTime(res.Timestamp), res.Error) - isAnError = 1 - log.Printf("Error from the app: %#v", res.Error) - } else { - // Add a sample points for the target benchmark's latency stat - // with the latency of the request this result is for. - q.AddSamplePoint(mako.XTime(res.Timestamp), map[string]float64{ - latencyKey: res.Latency.Seconds(), - }) - performance.AddInfluxPoint(benchmarkName, map[string]interface{}{latencyKey: res.Latency.Seconds()}) - isAnError = 0 - } - - // Update our error and request rates. - // We handle errors this way to force zero values into every time for - // which we have data, even if there is no error. - ar.ErrorRates[res.Timestamp.Unix()] += isAnError - ar.RequestRates[res.Timestamp.Unix()]++ -} diff --git a/test/performance/performance-tests-mako.sh b/test/performance/performance-tests-mako.sh index dcf865ec7b84..6cde144043bb 100755 --- a/test/performance/performance-tests-mako.sh +++ b/test/performance/performance-tests-mako.sh @@ -14,219 +14,228 @@ # See the License for the specific language governing permissions and # limitations under the License. -# This script runs the performance tests using mako sidecar stub against Knative +# This script runs the performance tests against Knative # Serving built from source. It can be optionally started for each PR. # For convenience, it can also be executed manually. -# If you already have a Kubernetes cluster setup and kubectl pointing -# to it, call this script with the --run-tests arguments and it will use -# the cluster and run the tests. - # Calling this script without arguments will create a new cluster in # project $PROJECT_ID, start knative in it, run the tests and delete the # cluster. source $(dirname $0)/../e2e-common.sh +set -o errexit +set -o nounset +set -o pipefail + +declare PROW_TAG +declare PROW_JOB_ID + +ns="default" + # Skip installing istio as an add-on. # Temporarily increasing the cluster size for serving tests to rule out # resource/eviction as causes of flakiness. -initialize --num-nodes=10 --perf --cluster-version=1.25 "$@" - -# Run tests serially in the mesh and https scenarios. -parallelism="" -use_https="" - -function wait_for_test() { - echo "waiting for test to complete" - for i in {1..600}; do - echo -n "#" - sleep 1 - done - echo "" -} +initialize --num-nodes=10 --cluster-version=1.25 "$@" -function run_ytt_for_test() { - run_ytt \ - -f "$@" \ - -f "${REPO_ROOT_DIR}/test/config/ytt/performance/influx" \ - -f "${REPO_ROOT_DIR}/test/config/ytt/performance/pods" \ - --data-value dockerrepo="${KO_DOCKER_REPO}" \ - --data-value prowtag="${PROW_TAG}" \ - --data-value influxurl="${INFLUX_URL}" \ - --data-value influxtoken="${INFLUX_TOKEN}" \ - --output-files "${ARTIFACTS}/mako-overlay" +function scale_activator() { + local replicas=$1 + + echo "Setting activator replicas to ${replicas}" + kubectl -n "${SYSTEM_NAMESPACE}" patch hpa activator --patch "{\"spec\":{\"minReplicas\": ${replicas}, \"maxReplicas\": ${replicas} }}" + + # Wait for HPA to do the scaling + sleep 30 } -mkdir -p "${ARTIFACTS}/mako" -echo Results downloaded to "${ARTIFACTS}/mako" +function run_job() { + local name=$1 + local file=$2 + + # cleanup from old runs + kubectl delete job "$name" -n "$ns" --ignore-not-found=true + + # start the load test and get the logs + # todo: check if we can add envsubst to build image to make this easier + # using kapp seems like a massive overhead just to replace two variables + # envsubst < "$file" | ko apply --sbom=none -f - + sed "s/@SYSTEM_NAMESPACE@/$SYSTEM_NAMESPACE/g" "$file" | sed "s/@KO_DOCKER_REPO@/$KO_DOCKER_REPO/g" | ko apply --sbom=none -f - -mkdir -p "${ARTIFACTS}/mako-overlay" + # Follow logs to wait for job termination + kubectl wait --for=condition=ready -n "$ns" pod --selector=job-name="$name" --timeout=-1s + kubectl logs -n "$ns" -f "job.batch/$name" + + # Dump logs to a file to upload it as CI job artifact + kubectl logs -n "$ns" "job.batch/$name" >"$name.log" + + # clean up + kubectl delete "job/$name" -n "$ns" --ignore-not-found=true + kubectl wait --for=delete "job/$name" --timeout=60s -n "$ns" +} export PROW_TAG="local" -if (( IS_PROW )); then - export PROW_TAG=${PROW_JOB_ID} - export INFLUX_URL=$(cat /etc/influx-url-secret-volume/influxdb-url) - export INFLUX_TOKEN=$(cat /etc/influx-token-secret-volume/influxdb-token) +if ((IS_PROW)); then + export PROW_TAG=${PROW_JOB_ID} + export INFLUX_URL=$(cat /etc/influx-url-secret-volume/influxdb-url) + export INFLUX_TOKEN=$(cat /etc/influx-token-secret-volume/influxdb-token) fi -echo ${PROW_JOB_ID} -echo ${PROW_TAG} -############################################################################################### -header "Create influx secret" -run_ytt \ - -f "${REPO_ROOT_DIR}/test/config/ytt/performance/influx" \ - --data-value influxurl="${INFLUX_URL}" \ - --data-value influxtoken="${INFLUX_TOKEN}" \ - --output-files "${ARTIFACTS}/mako-overlay" +if [[ -z "${INFLUX_URL}" ]]; then + echo "env variable 'INFLUX_URL' not specified!" + exit 1 +fi +if [[ -z "${INFLUX_TOKEN}" ]]; then + echo "env variable 'INFLUX_TOKEN' not specified!" + exit 1 +fi -kubectl apply -f "${ARTIFACTS}/mako-overlay/influx-secret.yaml" +echo "Running load test with PROW_TAG: ${PROW_TAG}, reporting results to: ${INFLUX_URL}" ############################################################################################### -header "Dataplane probe performance test" -kubectl delete job dataplane-probe-deployment dataplane-probe-istio dataplane-probe-queue dataplane-probe-activator --ignore-not-found=true -kubectl delete configmap config-mako -n default --ignore-not-found=true +#header "Preparing cluster config" +# +kubectl delete secret performance-test-config -n "$ns" --ignore-not-found=true +kubectl create secret generic performance-test-config -n "$ns" \ + --from-literal=influxurl="${INFLUX_URL}" \ + --from-literal=influxtoken="${INFLUX_TOKEN}" \ + --from-literal=prowtag="${PROW_TAG}" -kubectl create configmap config-mako -n default --from-file=test/performance/benchmarks/dataplane-probe/dev.config +# Tweak configuration for performance tests +scale_activator 10 +toggle_feature rolloutDuration 240 config-network +toggle_feature scale-to-zero-grace-period 10s config-autoscaler -run_ytt_for_test "${REPO_ROOT_DIR}/test/performance/benchmarks/dataplane-probe/continuous/dataplane-probe-direct.yaml" +echo ">> Upload the test images" +ko resolve --sbom=none -RBf test/test_images/autoscale > /dev/null +ko resolve --sbom=none -RBf test/test_images/helloworld > /dev/null -ko apply -f test/performance/benchmarks/dataplane-probe/continuous/dataplane-probe-setup.yaml -ko apply -f "${ARTIFACTS}/mako-overlay/dataplane-probe-direct.yaml" +############################################################################################### +header "Dataplane probe: Setup" -wait_for_test +ko apply -f "${REPO_ROOT_DIR}/test/performance/benchmarks/dataplane-probe/dataplane-probe-setup.yaml" +kubectl wait --timeout=60s --for=condition=ready ksvc -n "$ns" --all +kubectl wait --timeout=60s --for=condition=available deploy -n "$ns" deployment ############################################################################################ -header "Deployment probe performance test" -kubectl delete job deployment-probe --ignore-not-found=true -kubectl delete configmap config-mako -n default --ignore-not-found=true -kubectl create configmap config-mako -n default --from-file=test/performance/benchmarks/deployment-probe/dev.config +header "Dataplane probe: deployment" -run_ytt_for_test "${REPO_ROOT_DIR}/test/performance/benchmarks/deployment-probe/continuous/benchmark-direct.yaml" +run_job dataplane-probe-deployment "${REPO_ROOT_DIR}/test/performance/benchmarks/dataplane-probe/dataplane-probe-deployment.yaml" -ko apply -f "${ARTIFACTS}/mako-overlay/benchmark-direct.yaml" +# additional clean up +kubectl delete deploy deployment -n "$ns" --ignore-not-found=true +kubectl delete svc deployment -n "$ns" --ignore-not-found=true +kubectl wait --for=delete deploy/deployment --timeout=60s -n "$ns" +kubectl wait --for=delete svc/deployment --timeout=60s -n "$ns" +# +############################################################################################# +header "Dataplane probe: activator" -wait_for_test +run_job dataplane-probe-activator "${REPO_ROOT_DIR}/test/performance/benchmarks/dataplane-probe/dataplane-probe-activator.yaml" -############################################################################################### -header "Scale from Zero performance test" +# additional clean up +kubectl delete ksvc activator -n "$ns" --ignore-not-found=true +kubectl wait --for=delete ksvc/activator --timeout=60s -n "$ns" -kubectl delete job scale-from-zero-1 scale-from-zero-5 scale-from-zero-25 --ignore-not-found=true -kubectl delete configmap config-mako -n default --ignore-not-found=true +############################################################################################ +header "Dataplane probe: queue proxy" -kubectl create configmap config-mako -n default --from-file=test/performance/benchmarks/scale-from-zero/dev.config +run_job dataplane-probe-queue "${REPO_ROOT_DIR}/test/performance/benchmarks/dataplane-probe/dataplane-probe-queue.yaml" -run_ytt_for_test "${REPO_ROOT_DIR}/test/performance/benchmarks/scale-from-zero/continuous/scale-from-zero-direct.yaml" +# additional clean up +kubectl delete ksvc queue-proxy -n "$ns" --ignore-not-found=true +kubectl wait --for=delete ksvc/queue-proxy --timeout=60s -n "$ns" -echo ">> Upload the test images" -# Upload helloworld test image as it's used by the scale-from-zero benchmark. -ko resolve -RBf test/test_images/helloworld > /dev/null - -ko apply -f "${ARTIFACTS}/mako-overlay/scale-from-zero-direct.yaml" +############################################################################################ +header "Reconciliation delay test" -wait_for_test +run_job reconciliation-delay "${REPO_ROOT_DIR}/test/performance/benchmarks/reconciliation-delay/reconciliation-delay.yaml" ############################################################################################### -header "Load test" -kubectl delete configmap config-mako -n default --ignore-not-found=true +header "Scale from Zero test" -kubectl create configmap config-mako -n default --from-file=test/performance/benchmarks/load-test/dev.config +run_job scale-from-zero-1 "${REPO_ROOT_DIR}/test/performance/benchmarks/scale-from-zero/scale-from-zero-1.yaml" +kubectl delete ksvc -n "$ns" --all --wait --now +sleep 5 # wait a bit for the cleanup to be done -ko apply -f test/performance/benchmarks/load-test/continuous/load-test-setup.yaml - -############################################################################################### -header "Load test zero" -kubectl delete job load-test-zero --ignore-not-found=true +run_job scale-from-zero-5 "${REPO_ROOT_DIR}/test/performance/benchmarks/scale-from-zero/scale-from-zero-5.yaml" +kubectl delete ksvc -n "$ns" --all --wait --now +sleep 25 # wait a bit for the cleanup to be done -run_ytt_for_test "${REPO_ROOT_DIR}/test/performance/benchmarks/load-test/continuous/load-test-0-direct.yaml" +run_job scale-from-zero-25 "${REPO_ROOT_DIR}/test/performance/benchmarks/scale-from-zero/scale-from-zero-25.yaml" +kubectl delete ksvc -n "$ns" --all --wait --now +sleep 50 # wait a bit for the cleanup to be done -ko apply -f "${ARTIFACTS}/mako-overlay/load-test-0-direct.yaml" +run_job scale-from-zero-100 "${REPO_ROOT_DIR}/test/performance/benchmarks/scale-from-zero/scale-from-zero-100.yaml" +kubectl delete ksvc -n "$ns" --all --wait --now +sleep 100 # wait a bit for the cleanup to be done -wait_for_test +################################################################################################ +header "Load test: Setup" -# clean up for the next test -kubectl delete job load-test-zero --ignore-not-found=true -kubectl delete ksvc load-test-zero --ignore-not-found=true -echo "waiting for cleanup to complete" -for i in {1..60}; do - echo -n "#" - sleep 1 -done -echo "" +ko apply -f "${REPO_ROOT_DIR}/test/performance/benchmarks/load-test/load-test-setup.yaml" +kubectl wait --timeout=60s --for=condition=ready ksvc -n "$ns" --all -############################################################################################### -header "Load test always" -kubectl delete job load-test-always --ignore-not-found=true +################################################################################################ +header "Load test: zero" -run_ytt_for_test "${REPO_ROOT_DIR}/test/performance/benchmarks/load-test/continuous/load-test-always-direct.yaml" +run_job load-test-zero "${REPO_ROOT_DIR}/test/performance/benchmarks/load-test/load-test-0-direct.yaml" -ko apply -f "${ARTIFACTS}/mako-overlay/load-test-always-direct.yaml" +# additional clean up +kubectl delete ksvc load-test-zero -n "$ns" --ignore-not-found=true +kubectl wait --for=delete ksvc/load-test-zero --timeout=60s -n "$ns" -wait_for_test +################################################################################################# +header "Load test: always direct" -# clean up for the next test -kubectl delete job load-test-always --ignore-not-found=true -kubectl delete ksvc load-test-always --ignore-not-found=true -echo "waiting for cleanup to complete" -for i in {1..60}; do - echo -n "#" - sleep 1 -done -echo "" +run_job load-test-always "${REPO_ROOT_DIR}/test/performance/benchmarks/load-test/load-test-always-direct.yaml" -############################################################################################# -header "Load test 200" -kubectl delete job load-test-200 --ignore-not-found=true +# additional clean up +kubectl delete ksvc load-test-always -n "$ns" --ignore-not-found=true +kubectl wait --for=delete ksvc/load-test-always --timeout=60s -n "$ns" -run_ytt_for_test "${REPO_ROOT_DIR}/test/performance/benchmarks/load-test/continuous/load-test-200-direct.yaml" +############################################################################################### +header "Load test: 200 direct" -ko apply -f "${ARTIFACTS}/mako-overlay/load-test-200-direct.yaml" +run_job load-test-200 "${REPO_ROOT_DIR}/test/performance/benchmarks/load-test/load-test-200-direct.yaml" -wait_for_test +# additional clean up +kubectl delete ksvc load-test-200 -n "$ns" --ignore-not-found=true +kubectl wait --for=delete ksvc/load-test-200 --timeout=60s -n "$ns" -# clean up for the next test -kubectl delete job load-test-200 --ignore-not-found=true -kubectl delete ksvc load-test-200 --ignore-not-found=true -echo "waiting for cleanup to complete" -for i in {1..60}; do - echo -n "#" - sleep 1 -done -echo "" +############################################################################################### +header "Rollout probe: activator direct" -############################################################################################## -header "Rollout probe performance test" -kubectl delete configmap config-mako -n default --ignore-not-found=true +ko apply -f "${REPO_ROOT_DIR}/test/performance/benchmarks/rollout-probe/rollout-probe-setup-activator-direct.yaml" +kubectl wait --timeout=800s --for=condition=ready ksvc -n "$ns" --all -kubectl create configmap config-mako -n default --from-file=test/performance/benchmarks/rollout-probe/dev.config +run_job rollout-probe-activator-direct "${REPO_ROOT_DIR}/test/performance/benchmarks/rollout-probe/rollout-probe-activator-direct.yaml" -ko apply -f test/performance/benchmarks/rollout-probe/continuous/rollout-probe-setup.yaml +# additional clean up +kubectl delete ksvc activator-with-cc -n "$ns" --ignore-not-found=true +kubectl wait --for=delete ksvc/activator-with-cc --timeout=60s -n "$ns" ################################################################################################ -header "Rollout probe performance test with activator" -kubectl delete job rollout-probe-activator-with-cc --ignore-not-found=true +header "Rollout probe: activator direct lin" -run_ytt_for_test "${REPO_ROOT_DIR}/test/performance/benchmarks/rollout-probe/continuous/rollout-probe-activator-direct.yaml" +ko apply -f "${REPO_ROOT_DIR}/test/performance/benchmarks/rollout-probe/rollout-probe-setup-activator-direct-lin.yaml" +kubectl wait --timeout=800s --for=condition=ready ksvc -n "$ns" --all -wait_for_test -echo "" +run_job rollout-probe-activator-direct-lin "${REPO_ROOT_DIR}/test/performance/benchmarks/rollout-probe/rollout-probe-activator-direct-lin.yaml" -############################################################################################## -header "Rollout probe performance test with activator lin" -kubectl delete job rollout-probe-activator-with-cc-lin --ignore-not-found=true +# additional clean up +kubectl delete ksvc activator-with-cc-lin -n "$ns" --ignore-not-found=true +kubectl wait --for=delete ksvc/activator-with-cc-lin --timeout=60s -n "$ns" -run_ytt_for_test "${REPO_ROOT_DIR}/test/performance/benchmarks/rollout-probe/continuous/rollout-probe-activator-lin-direct.yaml" +################################################################################################# +header "Rollout probe: queue-proxy direct" -wait_for_test -echo "" - -############################################################################################### -header "Rollout probe performance test with queue" -kubectl delete job rollout-probe-queue-with-cc --ignore-not-found=true +ko apply -f "${REPO_ROOT_DIR}/test/performance/benchmarks/rollout-probe/rollout-probe-setup-queue-proxy-direct.yaml" +kubectl wait --timeout=800s --for=condition=ready ksvc -n "$ns" --all -run_ytt_for_test "${REPO_ROOT_DIR}/test/performance/benchmarks/rollout-probe/continuous/rollout-probe-queue-direct.yaml" +run_job rollout-probe-queue-proxy-direct "${REPO_ROOT_DIR}/test/performance/benchmarks/rollout-probe/rollout-probe-queue-proxy-direct.yaml" -wait_for_test -echo "" +# additional clean up +kubectl delete ksvc queue-proxy-with-cc -n "$ns" --ignore-not-found=true +kubectl wait --for=delete ksvc/queue-proxy-with-cc --timeout=60s -n "$ns" success diff --git a/test/performance/performance-tests.sh b/test/performance/performance-tests.sh deleted file mode 100755 index 4a2c0368d3e4..000000000000 --- a/test/performance/performance-tests.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env bash - -# Copyright 2022 The Knative Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# This script runs the end-to-end tests against Knative Serving built from source. -# It is started by prow for each PR. For convenience, it can also be executed manually. - -# If you already have a Kubernetes cluster setup and kubectl pointing -# to it, call this script with the --run-tests arguments and it will use -# the cluster and run the tests. - -# Calling this script without arguments will create a new cluster in -# project $PROJECT_ID, start knative in it, run the tests and delete the -# cluster. - -source $(dirname $0)/../e2e-common.sh - -# Skip installing istio as an add-on. -# Temporarily increasing the cluster size for serving tests to rule out -# resource/eviction as causes of flakiness. -initialize --num-nodes=4 --perf --cluster-version=1.25 "$@" - -header "Running tests" - -function run_kperf() { - go_run knative.dev/kperf/cmd/kperf@latest "$@" -} - -mkdir -p "${ARTIFACTS}/kperf" - -header "Running performance tests" -export TIMEOUT=30m - -# create services -run_kperf service generate --number 100 --batch 30 --concurrency 10 --interval 15 --namespace kperf --svc-prefix ktest --wait --timeout 30s --max-scale 3 --min-scale 0 || fail_test "kperf service generate failed" - -# wait for scale to zero -counter=100 -until counter=0 -do - sleep 1 - counter="kubectl get pods -n kperf | awk '{print $1}' | grep domain | wc -l" -done - -#scale and measure -run_kperf service scale --namespace kperf --svc-prefix ktest --range 0,99 --verbose --output "${ARTIFACTS}/kperf" || fail_test "kperf service scale failed" - -run_kperf service clean --namespace kperf --svc-prefix ktest || fail_test "kperf service clean failed" - -# Remove the kail log file if the test flow passes. -# This is for preventing too many large log files to be uploaded to GCS in CI. -rm "${ARTIFACTS}/k8s.log-$(basename "${E2E_SCRIPT}").txt" -success diff --git a/test/performance/performance/influx.go b/test/performance/performance/influx.go new file mode 100644 index 000000000000..7bb7b6e09954 --- /dev/null +++ b/test/performance/performance/influx.go @@ -0,0 +1,103 @@ +/* +Copyright 2022 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package performance + +import ( + "crypto/tls" + "fmt" + "log" + "os" + "time" + + influxdb2 "github.com/influxdata/influxdb-client-go/v2" + "github.com/influxdata/influxdb-client-go/v2/api" +) + +const ( + influxToken = "INFLUX_TOKEN" + influxURL = "INFLUX_URL" + prowTag = "PROW_TAG" + org = "Knativetest" + bucket = "knative-serving" +) + +// InfluxReporter wraps a influxdb client +type InfluxReporter struct { + client influxdb2.Client + writeAPI api.WriteAPI + tags map[string]string +} + +// NewInfluxReporter creates a InfluxReporter +// The method expects tags to be provided as a map. These are used to identify different runs. +func NewInfluxReporter(tags map[string]string) (*InfluxReporter, error) { + url, err := getEnvVariable(influxURL) + if err != nil { + return nil, err + } + + token, err := getEnvVariable(influxToken) + if err != nil { + return nil, err + } + + client := influxdb2.NewClientWithOptions(url, token, + influxdb2.DefaultOptions(). + SetUseGZip(true). + SetBatchSize(20). + //nolint:gosec // We explicitly don't need to check certs here since this is test code. + SetTLSConfig(&tls.Config{InsecureSkipVerify: true})) + + writeAPI := client.WriteAPI(org, bucket) + + build, found := os.LookupEnv(prowTag) + if found { + tags[prowTag] = build + } + + return &InfluxReporter{ + client: client, + writeAPI: writeAPI, + tags: tags, + }, nil +} + +// FlushAndShutdown flushes the data to influxdb and terminates the client. +func (ir *InfluxReporter) FlushAndShutdown() { + log.Println("Shutting down InfluxReporter") + ir.writeAPI.Flush() + ir.client.Close() +} + +// AddDataPoint asynchronously writes a new data-point to influxdb. +func (ir *InfluxReporter) AddDataPoint(measurement string, fields map[string]interface{}) { + p := influxdb2.NewPoint(measurement, + ir.tags, + fields, + time.Now()) + + // Write point asynchronously + ir.writeAPI.WritePoint(p) +} + +func getEnvVariable(envVarName string) (string, error) { + valueFromEnv, ok := os.LookupEnv(envVarName) + if !ok { + return "", fmt.Errorf("failed to get env variable: %s", envVarName) + } + return valueFromEnv, nil +} diff --git a/test/performance/performance.go b/test/performance/performance/performance.go similarity index 96% rename from test/performance/performance.go rename to test/performance/performance/performance.go index 1c235defef08..22b096f7c66c 100644 --- a/test/performance/performance.go +++ b/test/performance/performance/performance.go @@ -73,7 +73,7 @@ func WaitForScaleToZero(ctx context.Context, namespace string, selector labels.S return false, nil } } - log.Print("All pods are done or terminating after ", time.Since(begin)) + log.Print("All pods are done (scaled to zero) or terminating after ", time.Since(begin)) return true, nil }) } diff --git a/test/performance/metrics/runtime.go b/test/performance/performance/runtime.go similarity index 99% rename from test/performance/metrics/runtime.go rename to test/performance/performance/runtime.go index 295f8509794a..699dd69736a2 100644 --- a/test/performance/metrics/runtime.go +++ b/test/performance/performance/runtime.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package metrics +package performance import ( "context" diff --git a/test/performance/read_results.sh b/test/performance/read_results.sh deleted file mode 100755 index 4fa53399987a..000000000000 --- a/test/performance/read_results.sh +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/env bash - -# Copyright 2022 The Knative Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# This script runs the end-to-end tests against Knative Serving built from source. -# It is started by prow for each PR. For convenience, it can also be executed manually. - -# If you already have a Kubernetes cluster setup and kubectl pointing -# to it, call this script with the --run-tests arguments and it will use -# the cluster and run the tests. - -# Calling this script without arguments will create a new cluster in -# project $PROJECT_ID, start knative in it, run the tests and delete the -# cluster. - -check_command_exists() { - CMD_NAME=$1 - command -v "$CMD_NAME" > /dev/null || { - echo "Command $CMD_NAME does not exist" - exit 1 - } -} - -check_command_exists kubectl -check_command_exists curl - -if [[ $# -lt 7 ]] -then - echo "Usage: $0 " - exit 1 -fi - -MAKO_STUB_POD_NAME="$1" -MAKO_STUB_NAMESPACE="$2" -MAKO_STUB_PORT="$3" -TIMEOUT="$4" -RETRIES="$5" -RETRIES_INTERVAL="$6" -OUTPUT_FILE="$7" - -# Find port ready to use - -port=10000 -isfree=$(netstat -tapln | grep $port) - -while [[ -n "$isfree" ]]; do - port=$((port + 1)) - isfree=$(netstat -tapln | grep $port) -done - -for i in $(seq $RETRIES); do - kubectl port-forward -n "$MAKO_STUB_NAMESPACE" "$MAKO_STUB_POD_NAME" $port:$MAKO_STUB_PORT & - PORT_FORWARD_PID=$! - - sleep 10 - - curl --connect-timeout $TIMEOUT "http://localhost:$port/results" > $OUTPUT_FILE - curl_exit_status=$? - - kill $PORT_FORWARD_PID - wait $PORT_FORWARD_PID 2>/dev/null - - if [ 0 -eq $curl_exit_status ]; then - exit 0 - else - sleep $RETRIES_INTERVAL - fi - -done - -exit 1 diff --git a/third_party/VENDOR-LICENSE/github.com/golang/glog/LICENSE b/third_party/VENDOR-LICENSE/github.com/golang/glog/LICENSE deleted file mode 100644 index 37ec93a14fdc..000000000000 --- a/third_party/VENDOR-LICENSE/github.com/golang/glog/LICENSE +++ /dev/null @@ -1,191 +0,0 @@ -Apache License -Version 2.0, January 2004 -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, and -distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright -owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities -that control, are controlled by, or are under common control with that entity. -For the purposes of this definition, "control" means (i) the power, direct or -indirect, to cause the direction or management of such entity, whether by -contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the -outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising -permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including -but not limited to software source code, documentation source, and configuration -files. - -"Object" form shall mean any form resulting from mechanical transformation or -translation of a Source form, including but not limited to compiled object code, -generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made -available under the License, as indicated by a copyright notice that is included -in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that -is based on (or derived from) the Work and for which the editorial revisions, -annotations, elaborations, or other modifications represent, as a whole, an -original work of authorship. For the purposes of this License, Derivative Works -shall not include works that remain separable from, or merely link (or bind by -name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version -of the Work and any modifications or additions to that Work or Derivative Works -thereof, that is intentionally submitted to Licensor for inclusion in the Work -by the copyright owner or by an individual or Legal Entity authorized to submit -on behalf of the copyright owner. For the purposes of this definition, -"submitted" means any form of electronic, verbal, or written communication sent -to the Licensor or its representatives, including but not limited to -communication on electronic mailing lists, source code control systems, and -issue tracking systems that are managed by, or on behalf of, the Licensor for -the purpose of discussing and improving the Work, but excluding communication -that is conspicuously marked or otherwise designated in writing by the copyright -owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf -of whom a Contribution has been received by Licensor and subsequently -incorporated within the Work. - -2. Grant of Copyright License. - -Subject to the terms and conditions of this License, each Contributor hereby -grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, -irrevocable copyright license to reproduce, prepare Derivative Works of, -publicly display, publicly perform, sublicense, and distribute the Work and such -Derivative Works in Source or Object form. - -3. Grant of Patent License. - -Subject to the terms and conditions of this License, each Contributor hereby -grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, -irrevocable (except as stated in this section) patent license to make, have -made, use, offer to sell, sell, import, and otherwise transfer the Work, where -such license applies only to those patent claims licensable by such Contributor -that are necessarily infringed by their Contribution(s) alone or by combination -of their Contribution(s) with the Work to which such Contribution(s) was -submitted. If You institute patent litigation against any entity (including a -cross-claim or counterclaim in a lawsuit) alleging that the Work or a -Contribution incorporated within the Work constitutes direct or contributory -patent infringement, then any patent licenses granted to You under this License -for that Work shall terminate as of the date such litigation is filed. - -4. Redistribution. - -You may reproduce and distribute copies of the Work or Derivative Works thereof -in any medium, with or without modifications, and in Source or Object form, -provided that You meet the following conditions: - -You must give any other recipients of the Work or Derivative Works a copy of -this License; and -You must cause any modified files to carry prominent notices stating that You -changed the files; and -You must retain, in the Source form of any Derivative Works that You distribute, -all copyright, patent, trademark, and attribution notices from the Source form -of the Work, excluding those notices that do not pertain to any part of the -Derivative Works; and -If the Work includes a "NOTICE" text file as part of its distribution, then any -Derivative Works that You distribute must include a readable copy of the -attribution notices contained within such NOTICE file, excluding those notices -that do not pertain to any part of the Derivative Works, in at least one of the -following places: within a NOTICE text file distributed as part of the -Derivative Works; within the Source form or documentation, if provided along -with the Derivative Works; or, within a display generated by the Derivative -Works, if and wherever such third-party notices normally appear. The contents of -the NOTICE file are for informational purposes only and do not modify the -License. You may add Your own attribution notices within Derivative Works that -You distribute, alongside or as an addendum to the NOTICE text from the Work, -provided that such additional attribution notices cannot be construed as -modifying the License. -You may add Your own copyright statement to Your modifications and may provide -additional or different license terms and conditions for use, reproduction, or -distribution of Your modifications, or for any such Derivative Works as a whole, -provided Your use, reproduction, and distribution of the Work otherwise complies -with the conditions stated in this License. - -5. Submission of Contributions. - -Unless You explicitly state otherwise, any Contribution intentionally submitted -for inclusion in the Work by You to the Licensor shall be under the terms and -conditions of this License, without any additional terms or conditions. -Notwithstanding the above, nothing herein shall supersede or modify the terms of -any separate license agreement you may have executed with Licensor regarding -such Contributions. - -6. Trademarks. - -This License does not grant permission to use the trade names, trademarks, -service marks, or product names of the Licensor, except as required for -reasonable and customary use in describing the origin of the Work and -reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. - -Unless required by applicable law or agreed to in writing, Licensor provides the -Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, -including, without limitation, any warranties or conditions of TITLE, -NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are -solely responsible for determining the appropriateness of using or -redistributing the Work and assume any risks associated with Your exercise of -permissions under this License. - -8. Limitation of Liability. - -In no event and under no legal theory, whether in tort (including negligence), -contract, or otherwise, unless required by applicable law (such as deliberate -and grossly negligent acts) or agreed to in writing, shall any Contributor be -liable to You for damages, including any direct, indirect, special, incidental, -or consequential damages of any character arising as a result of this License or -out of the use or inability to use the Work (including but not limited to -damages for loss of goodwill, work stoppage, computer failure or malfunction, or -any and all other commercial damages or losses), even if such Contributor has -been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. - -While redistributing the Work or Derivative Works thereof, You may choose to -offer, and charge a fee for, acceptance of support, warranty, indemnity, or -other liability obligations and/or rights consistent with this License. However, -in accepting such obligations, You may act only on Your own behalf and on Your -sole responsibility, not on behalf of any other Contributor, and only if You -agree to indemnify, defend, and hold each Contributor harmless for any liability -incurred by, or claims asserted against, such Contributor by reason of your -accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work - -To apply the Apache License to your work, attach the following boilerplate -notice, with the fields enclosed by brackets "[]" replaced with your own -identifying information. (Don't include the brackets!) The text should be -enclosed in the appropriate comment syntax for the file format. We also -recommend that a file or class name and description of purpose be included on -the same "printed page" as the copyright notice for easier identification within -third-party archives. - - Copyright [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/third_party/VENDOR-LICENSE/github.com/google/go-github/v27/github/LICENSE b/third_party/VENDOR-LICENSE/github.com/google/go-github/v27/github/LICENSE deleted file mode 100644 index 28b6486f0b8e..000000000000 --- a/third_party/VENDOR-LICENSE/github.com/google/go-github/v27/github/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2013 The go-github 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/third_party/VENDOR-LICENSE/github.com/google/go-querystring/query/LICENSE b/third_party/VENDOR-LICENSE/github.com/google/go-querystring/query/LICENSE deleted file mode 100644 index ae121a1e46df..000000000000 --- a/third_party/VENDOR-LICENSE/github.com/google/go-querystring/query/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2013 Google. 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/third_party/VENDOR-LICENSE/github.com/google/mako/LICENSE b/third_party/VENDOR-LICENSE/github.com/google/mako/LICENSE deleted file mode 100644 index fef7d967815b..000000000000 --- a/third_party/VENDOR-LICENSE/github.com/google/mako/LICENSE +++ /dev/null @@ -1,204 +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. - - \ No newline at end of file diff --git a/vendor/github.com/golang/glog/LICENSE b/vendor/github.com/golang/glog/LICENSE deleted file mode 100644 index 37ec93a14fdc..000000000000 --- a/vendor/github.com/golang/glog/LICENSE +++ /dev/null @@ -1,191 +0,0 @@ -Apache License -Version 2.0, January 2004 -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, and -distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright -owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities -that control, are controlled by, or are under common control with that entity. -For the purposes of this definition, "control" means (i) the power, direct or -indirect, to cause the direction or management of such entity, whether by -contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the -outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising -permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including -but not limited to software source code, documentation source, and configuration -files. - -"Object" form shall mean any form resulting from mechanical transformation or -translation of a Source form, including but not limited to compiled object code, -generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made -available under the License, as indicated by a copyright notice that is included -in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that -is based on (or derived from) the Work and for which the editorial revisions, -annotations, elaborations, or other modifications represent, as a whole, an -original work of authorship. For the purposes of this License, Derivative Works -shall not include works that remain separable from, or merely link (or bind by -name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version -of the Work and any modifications or additions to that Work or Derivative Works -thereof, that is intentionally submitted to Licensor for inclusion in the Work -by the copyright owner or by an individual or Legal Entity authorized to submit -on behalf of the copyright owner. For the purposes of this definition, -"submitted" means any form of electronic, verbal, or written communication sent -to the Licensor or its representatives, including but not limited to -communication on electronic mailing lists, source code control systems, and -issue tracking systems that are managed by, or on behalf of, the Licensor for -the purpose of discussing and improving the Work, but excluding communication -that is conspicuously marked or otherwise designated in writing by the copyright -owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf -of whom a Contribution has been received by Licensor and subsequently -incorporated within the Work. - -2. Grant of Copyright License. - -Subject to the terms and conditions of this License, each Contributor hereby -grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, -irrevocable copyright license to reproduce, prepare Derivative Works of, -publicly display, publicly perform, sublicense, and distribute the Work and such -Derivative Works in Source or Object form. - -3. Grant of Patent License. - -Subject to the terms and conditions of this License, each Contributor hereby -grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, -irrevocable (except as stated in this section) patent license to make, have -made, use, offer to sell, sell, import, and otherwise transfer the Work, where -such license applies only to those patent claims licensable by such Contributor -that are necessarily infringed by their Contribution(s) alone or by combination -of their Contribution(s) with the Work to which such Contribution(s) was -submitted. If You institute patent litigation against any entity (including a -cross-claim or counterclaim in a lawsuit) alleging that the Work or a -Contribution incorporated within the Work constitutes direct or contributory -patent infringement, then any patent licenses granted to You under this License -for that Work shall terminate as of the date such litigation is filed. - -4. Redistribution. - -You may reproduce and distribute copies of the Work or Derivative Works thereof -in any medium, with or without modifications, and in Source or Object form, -provided that You meet the following conditions: - -You must give any other recipients of the Work or Derivative Works a copy of -this License; and -You must cause any modified files to carry prominent notices stating that You -changed the files; and -You must retain, in the Source form of any Derivative Works that You distribute, -all copyright, patent, trademark, and attribution notices from the Source form -of the Work, excluding those notices that do not pertain to any part of the -Derivative Works; and -If the Work includes a "NOTICE" text file as part of its distribution, then any -Derivative Works that You distribute must include a readable copy of the -attribution notices contained within such NOTICE file, excluding those notices -that do not pertain to any part of the Derivative Works, in at least one of the -following places: within a NOTICE text file distributed as part of the -Derivative Works; within the Source form or documentation, if provided along -with the Derivative Works; or, within a display generated by the Derivative -Works, if and wherever such third-party notices normally appear. The contents of -the NOTICE file are for informational purposes only and do not modify the -License. You may add Your own attribution notices within Derivative Works that -You distribute, alongside or as an addendum to the NOTICE text from the Work, -provided that such additional attribution notices cannot be construed as -modifying the License. -You may add Your own copyright statement to Your modifications and may provide -additional or different license terms and conditions for use, reproduction, or -distribution of Your modifications, or for any such Derivative Works as a whole, -provided Your use, reproduction, and distribution of the Work otherwise complies -with the conditions stated in this License. - -5. Submission of Contributions. - -Unless You explicitly state otherwise, any Contribution intentionally submitted -for inclusion in the Work by You to the Licensor shall be under the terms and -conditions of this License, without any additional terms or conditions. -Notwithstanding the above, nothing herein shall supersede or modify the terms of -any separate license agreement you may have executed with Licensor regarding -such Contributions. - -6. Trademarks. - -This License does not grant permission to use the trade names, trademarks, -service marks, or product names of the Licensor, except as required for -reasonable and customary use in describing the origin of the Work and -reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. - -Unless required by applicable law or agreed to in writing, Licensor provides the -Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, -including, without limitation, any warranties or conditions of TITLE, -NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are -solely responsible for determining the appropriateness of using or -redistributing the Work and assume any risks associated with Your exercise of -permissions under this License. - -8. Limitation of Liability. - -In no event and under no legal theory, whether in tort (including negligence), -contract, or otherwise, unless required by applicable law (such as deliberate -and grossly negligent acts) or agreed to in writing, shall any Contributor be -liable to You for damages, including any direct, indirect, special, incidental, -or consequential damages of any character arising as a result of this License or -out of the use or inability to use the Work (including but not limited to -damages for loss of goodwill, work stoppage, computer failure or malfunction, or -any and all other commercial damages or losses), even if such Contributor has -been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. - -While redistributing the Work or Derivative Works thereof, You may choose to -offer, and charge a fee for, acceptance of support, warranty, indemnity, or -other liability obligations and/or rights consistent with this License. However, -in accepting such obligations, You may act only on Your own behalf and on Your -sole responsibility, not on behalf of any other Contributor, and only if You -agree to indemnify, defend, and hold each Contributor harmless for any liability -incurred by, or claims asserted against, such Contributor by reason of your -accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work - -To apply the Apache License to your work, attach the following boilerplate -notice, with the fields enclosed by brackets "[]" replaced with your own -identifying information. (Don't include the brackets!) The text should be -enclosed in the appropriate comment syntax for the file format. We also -recommend that a file or class name and description of purpose be included on -the same "printed page" as the copyright notice for easier identification within -third-party archives. - - Copyright [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/glog/README.md b/vendor/github.com/golang/glog/README.md deleted file mode 100644 index a4f73883b2d8..000000000000 --- a/vendor/github.com/golang/glog/README.md +++ /dev/null @@ -1,36 +0,0 @@ -# glog - -[![PkgGoDev](https://pkg.go.dev/badge/github.com/golang/glog)](https://pkg.go.dev/github.com/golang/glog) - -Leveled execution logs for Go. - -This is an efficient pure Go implementation of leveled logs in the -manner of the open source C++ package [_glog_](https://github.com/google/glog). - -By binding methods to booleans it is possible to use the log package without paying the expense of evaluating the arguments to the log. Through the `-vmodule` flag, the package also provides fine-grained -control over logging at the file level. - -The comment from `glog.go` introduces the ideas: - -Package _glog_ implements logging analogous to the Google-internal C++ INFO/ERROR/V setup. It provides the functions Info, Warning, Error, Fatal, plus formatting variants such as Infof. It also provides V-style loggingcontrolled by the `-v` and `-vmodule=file=2` flags. - -Basic examples: - -```go -glog.Info("Prepare to repel boarders") - -glog.Fatalf("Initialization failed: %s", err) -``` - -See the documentation for the V function for an explanation of these examples: - -```go -if glog.V(2) { - glog.Info("Starting transaction...") -} -glog.V(2).Infoln("Processed", nItems, "elements") -``` - -The repository contains an open source version of the log package used inside Google. The master copy of the source lives inside Google, not here. The code in this repo is for export only and is not itself under development. Feature requests will be ignored. - -Send bug reports to golang-nuts@googlegroups.com. diff --git a/vendor/github.com/golang/glog/glog.go b/vendor/github.com/golang/glog/glog.go deleted file mode 100644 index e108ae8b4f86..000000000000 --- a/vendor/github.com/golang/glog/glog.go +++ /dev/null @@ -1,621 +0,0 @@ -// Go support for leveled logs, analogous to https://github.com/google/glog. -// -// Copyright 2023 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 glog implements logging analogous to the Google-internal C++ INFO/ERROR/V setup. -// It provides functions Info, Warning, Error, Fatal, plus formatting variants such as -// Infof. It also provides V-style logging controlled by the -v and -vmodule=file=2 flags. -// -// Basic examples: -// -// glog.Info("Prepare to repel boarders") -// -// glog.Fatalf("Initialization failed: %s", err) -// -// See the documentation for the V function for an explanation of these examples: -// -// if glog.V(2) { -// glog.Info("Starting transaction...") -// } -// -// glog.V(2).Infoln("Processed", nItems, "elements") -// -// Log output is buffered and written periodically using Flush. Programs -// should call Flush before exiting to guarantee all log output is written. -// -// By default, all log statements write to files in a temporary directory. -// This package provides several flags that modify this behavior. -// As a result, flag.Parse must be called before any logging is done. -// -// -logtostderr=false -// Logs are written to standard error instead of to files. -// -alsologtostderr=false -// Logs are written to standard error as well as to files. -// -stderrthreshold=ERROR -// Log events at or above this severity are logged to standard -// error as well as to files. -// -log_dir="" -// Log files will be written to this directory instead of the -// default temporary directory. -// -// Other flags provide aids to debugging. -// -// -log_backtrace_at="" -// A comma-separated list of file and line numbers holding a logging -// statement, such as -// -log_backtrace_at=gopherflakes.go:234 -// A stack trace will be written to the Info log whenever execution -// hits one of these statements. (Unlike with -vmodule, the ".go" -// must bepresent.) -// -v=0 -// Enable V-leveled logging at the specified level. -// -vmodule="" -// The syntax of the argument is a comma-separated list of pattern=N, -// where pattern is a literal file name (minus the ".go" suffix) or -// "glob" pattern and N is a V level. For instance, -// -vmodule=gopher*=3 -// sets the V level to 3 in all Go files whose names begin with "gopher", -// and -// -vmodule=/path/to/glog/glog_test=1 -// sets the V level to 1 in the Go file /path/to/glog/glog_test.go. -// If a glob pattern contains a slash, it is matched against the full path, -// and the file name. Otherwise, the pattern is -// matched only against the file's basename. When both -vmodule and -v -// are specified, the -vmodule values take precedence for the specified -// modules. -package glog - -// This file contains the parts of the log package that are shared among all -// implementations (file, envelope, and appengine). - -import ( - "bytes" - "errors" - "fmt" - stdLog "log" - "os" - "reflect" - "runtime" - "runtime/pprof" - "strconv" - "sync" - "sync/atomic" - "syscall" - "time" - - "github.com/golang/glog/internal/logsink" - "github.com/golang/glog/internal/stackdump" -) - -var timeNow = time.Now // Stubbed out for testing. - -// MaxSize is the maximum size of a log file in bytes. -var MaxSize uint64 = 1024 * 1024 * 1800 - -// ErrNoLog is the error we return if no log file has yet been created -// for the specified log type. -var ErrNoLog = errors.New("log file not yet created") - -// OutputStats tracks the number of output lines and bytes written. -type OutputStats struct { - lines int64 - bytes int64 -} - -// Lines returns the number of lines written. -func (s *OutputStats) Lines() int64 { - return atomic.LoadInt64(&s.lines) -} - -// Bytes returns the number of bytes written. -func (s *OutputStats) Bytes() int64 { - return atomic.LoadInt64(&s.bytes) -} - -// Stats tracks the number of lines of output and number of bytes -// per severity level. Values must be read with atomic.LoadInt64. -var Stats struct { - Info, Warning, Error OutputStats -} - -var severityStats = [...]*OutputStats{ - logsink.Info: &Stats.Info, - logsink.Warning: &Stats.Warning, - logsink.Error: &Stats.Error, - logsink.Fatal: nil, -} - -// Level specifies a level of verbosity for V logs. The -v flag is of type -// Level and should be modified only through the flag.Value interface. -type Level int32 - -var metaPool sync.Pool // Pool of *logsink.Meta. - -// metaPoolGet returns a *logsink.Meta from metaPool as both an interface and a -// pointer, allocating a new one if necessary. (Returning the interface value -// directly avoids an allocation if there was an existing pointer in the pool.) -func metaPoolGet() (any, *logsink.Meta) { - if metai := metaPool.Get(); metai != nil { - return metai, metai.(*logsink.Meta) - } - meta := new(logsink.Meta) - return meta, meta -} - -type stack bool - -const ( - noStack = stack(false) - withStack = stack(true) -) - -func appendBacktrace(depth int, format string, args []any) (string, []any) { - // Capture a backtrace as a stackdump.Stack (both text and PC slice). - // Structured log sinks can extract the backtrace in whichever format they - // prefer (PCs or text), and Text sinks will include it as just another part - // of the log message. - // - // Use depth instead of depth+1 so that the backtrace always includes the - // log function itself - otherwise the reason for the trace appearing in the - // log may not be obvious to the reader. - dump := stackdump.Caller(depth) - - // Add an arg and an entry in the format string for the stack dump. - // - // Copy the "args" slice to avoid a rare but serious aliasing bug - // (corrupting the caller's slice if they passed it to a non-Fatal call - // using "..."). - format = format + "\n\n%v\n" - args = append(append([]any(nil), args...), dump) - - return format, args -} - -// logf writes a log message for a log function call (or log function wrapper) -// at the given depth in the current goroutine's stack. -func logf(depth int, severity logsink.Severity, verbose bool, stack stack, format string, args ...any) { - now := timeNow() - _, file, line, ok := runtime.Caller(depth + 1) - if !ok { - file = "???" - line = 1 - } - - if stack == withStack || backtraceAt(file, line) { - format, args = appendBacktrace(depth+1, format, args) - } - - metai, meta := metaPoolGet() - *meta = logsink.Meta{ - Time: now, - File: file, - Line: line, - Depth: depth + 1, - Severity: severity, - Verbose: verbose, - Thread: int64(pid), - } - sinkf(meta, format, args...) - metaPool.Put(metai) -} - -func sinkf(meta *logsink.Meta, format string, args ...any) { - meta.Depth++ - n, err := logsink.Printf(meta, format, args...) - if stats := severityStats[meta.Severity]; stats != nil { - atomic.AddInt64(&stats.lines, 1) - atomic.AddInt64(&stats.bytes, int64(n)) - } - - if err != nil { - logsink.Printf(meta, "glog: exiting because of error: %s", err) - sinks.file.Flush() - os.Exit(2) - } -} - -// CopyStandardLogTo arranges for messages written to the Go "log" package's -// default logs to also appear in the Google logs for the named and lower -// severities. Subsequent changes to the standard log's default output location -// or format may break this behavior. -// -// Valid names are "INFO", "WARNING", "ERROR", and "FATAL". If the name is not -// recognized, CopyStandardLogTo panics. -func CopyStandardLogTo(name string) { - sev, err := logsink.ParseSeverity(name) - if err != nil { - panic(fmt.Sprintf("log.CopyStandardLogTo(%q): %v", name, err)) - } - // Set a log format that captures the user's file and line: - // d.go:23: message - stdLog.SetFlags(stdLog.Lshortfile) - stdLog.SetOutput(logBridge(sev)) -} - -// NewStandardLogger returns a Logger that writes to the Google logs for the -// named and lower severities. -// -// Valid names are "INFO", "WARNING", "ERROR", and "FATAL". If the name is not -// recognized, NewStandardLogger panics. -func NewStandardLogger(name string) *stdLog.Logger { - sev, err := logsink.ParseSeverity(name) - if err != nil { - panic(fmt.Sprintf("log.NewStandardLogger(%q): %v", name, err)) - } - return stdLog.New(logBridge(sev), "", stdLog.Lshortfile) -} - -// logBridge provides the Write method that enables CopyStandardLogTo to connect -// Go's standard logs to the logs provided by this package. -type logBridge logsink.Severity - -// Write parses the standard logging line and passes its components to the -// logger for severity(lb). -func (lb logBridge) Write(b []byte) (n int, err error) { - var ( - file = "???" - line = 1 - text string - ) - // Split "d.go:23: message" into "d.go", "23", and "message". - if parts := bytes.SplitN(b, []byte{':'}, 3); len(parts) != 3 || len(parts[0]) < 1 || len(parts[2]) < 1 { - text = fmt.Sprintf("bad log format: %s", b) - } else { - file = string(parts[0]) - text = string(parts[2][1:]) // skip leading space - line, err = strconv.Atoi(string(parts[1])) - if err != nil { - text = fmt.Sprintf("bad line number: %s", b) - line = 1 - } - } - - // The depth below hard-codes details of how stdlog gets here. The alternative would be to walk - // up the stack looking for src/log/log.go but that seems like it would be - // unfortunately slow. - const stdLogDepth = 4 - - metai, meta := metaPoolGet() - *meta = logsink.Meta{ - Time: timeNow(), - File: file, - Line: line, - Depth: stdLogDepth, - Severity: logsink.Severity(lb), - Thread: int64(pid), - } - - format := "%s" - args := []any{text} - if backtraceAt(file, line) { - format, args = appendBacktrace(meta.Depth, format, args) - } - - sinkf(meta, format, args...) - metaPool.Put(metai) - - return len(b), nil -} - -// defaultFormat returns a fmt.Printf format specifier that formats its -// arguments as if they were passed to fmt.Print. -func defaultFormat(args []any) string { - n := len(args) - switch n { - case 0: - return "" - case 1: - return "%v" - } - - b := make([]byte, 0, n*3-1) - wasString := true // Suppress leading space. - for _, arg := range args { - isString := arg != nil && reflect.TypeOf(arg).Kind() == reflect.String - if wasString || isString { - b = append(b, "%v"...) - } else { - b = append(b, " %v"...) - } - wasString = isString - } - return string(b) -} - -// lnFormat returns a fmt.Printf format specifier that formats its arguments -// as if they were passed to fmt.Println. -func lnFormat(args []any) string { - if len(args) == 0 { - return "\n" - } - - b := make([]byte, 0, len(args)*3) - for range args { - b = append(b, "%v "...) - } - b[len(b)-1] = '\n' // Replace the last space with a newline. - return string(b) -} - -// Verbose is a boolean type that implements Infof (like Printf) etc. -// See the documentation of V for more information. -type Verbose bool - -// V reports whether verbosity at the call site is at least the requested level. -// The returned value is a boolean of type Verbose, which implements Info, Infoln -// and Infof. These methods will write to the Info log if called. -// Thus, one may write either -// -// if glog.V(2) { glog.Info("log this") } -// -// or -// -// glog.V(2).Info("log this") -// -// The second form is shorter but the first is cheaper if logging is off because it does -// not evaluate its arguments. -// -// Whether an individual call to V generates a log record depends on the setting of -// the -v and --vmodule flags; both are off by default. If the level in the call to -// V is at most the value of -v, or of -vmodule for the source file containing the -// call, the V call will log. -func V(level Level) Verbose { - return VDepth(1, level) -} - -// VDepth acts as V but uses depth to determine which call frame to check vmodule for. -// VDepth(0, level) is the same as V(level). -func VDepth(depth int, level Level) Verbose { - return Verbose(verboseEnabled(depth+1, level)) -} - -// Info is equivalent to the global Info function, guarded by the value of v. -// See the documentation of V for usage. -func (v Verbose) Info(args ...any) { - v.InfoDepth(1, args...) -} - -// InfoDepth is equivalent to the global InfoDepth function, guarded by the value of v. -// See the documentation of V for usage. -func (v Verbose) InfoDepth(depth int, args ...any) { - if v { - logf(depth+1, logsink.Info, true, noStack, defaultFormat(args), args...) - } -} - -// InfoDepthf is equivalent to the global InfoDepthf function, guarded by the value of v. -// See the documentation of V for usage. -func (v Verbose) InfoDepthf(depth int, format string, args ...any) { - if v { - logf(depth+1, logsink.Info, true, noStack, format, args...) - } -} - -// Infoln is equivalent to the global Infoln function, guarded by the value of v. -// See the documentation of V for usage. -func (v Verbose) Infoln(args ...any) { - if v { - logf(1, logsink.Info, true, noStack, lnFormat(args), args...) - } -} - -// Infof is equivalent to the global Infof function, guarded by the value of v. -// See the documentation of V for usage. -func (v Verbose) Infof(format string, args ...any) { - if v { - logf(1, logsink.Info, true, noStack, format, args...) - } -} - -// Info logs to the INFO log. -// Arguments are handled in the manner of fmt.Print; a newline is appended if missing. -func Info(args ...any) { - InfoDepth(1, args...) -} - -// InfoDepth calls Info from a different depth in the call stack. -// This enables a callee to emit logs that use the callsite information of its caller -// or any other callers in the stack. When depth == 0, the original callee's line -// information is emitted. When depth > 0, depth frames are skipped in the call stack -// and the final frame is treated like the original callee to Info. -func InfoDepth(depth int, args ...any) { - logf(depth+1, logsink.Info, false, noStack, defaultFormat(args), args...) -} - -// InfoDepthf acts as InfoDepth but with format string. -func InfoDepthf(depth int, format string, args ...any) { - logf(depth+1, logsink.Info, false, noStack, format, args...) -} - -// Infoln logs to the INFO log. -// Arguments are handled in the manner of fmt.Println; a newline is appended if missing. -func Infoln(args ...any) { - logf(1, logsink.Info, false, noStack, lnFormat(args), args...) -} - -// Infof logs to the INFO log. -// Arguments are handled in the manner of fmt.Printf; a newline is appended if missing. -func Infof(format string, args ...any) { - logf(1, logsink.Info, false, noStack, format, args...) -} - -// Warning logs to the WARNING and INFO logs. -// Arguments are handled in the manner of fmt.Print; a newline is appended if missing. -func Warning(args ...any) { - WarningDepth(1, args...) -} - -// WarningDepth acts as Warning but uses depth to determine which call frame to log. -// WarningDepth(0, "msg") is the same as Warning("msg"). -func WarningDepth(depth int, args ...any) { - logf(depth+1, logsink.Warning, false, noStack, defaultFormat(args), args...) -} - -// WarningDepthf acts as Warningf but uses depth to determine which call frame to log. -// WarningDepthf(0, "msg") is the same as Warningf("msg"). -func WarningDepthf(depth int, format string, args ...any) { - logf(depth+1, logsink.Warning, false, noStack, format, args...) -} - -// Warningln logs to the WARNING and INFO logs. -// Arguments are handled in the manner of fmt.Println; a newline is appended if missing. -func Warningln(args ...any) { - logf(1, logsink.Warning, false, noStack, lnFormat(args), args...) -} - -// Warningf logs to the WARNING and INFO logs. -// Arguments are handled in the manner of fmt.Printf; a newline is appended if missing. -func Warningf(format string, args ...any) { - logf(1, logsink.Warning, false, noStack, format, args...) -} - -// Error logs to the ERROR, WARNING, and INFO logs. -// Arguments are handled in the manner of fmt.Print; a newline is appended if missing. -func Error(args ...any) { - ErrorDepth(1, args...) -} - -// ErrorDepth acts as Error but uses depth to determine which call frame to log. -// ErrorDepth(0, "msg") is the same as Error("msg"). -func ErrorDepth(depth int, args ...any) { - logf(depth+1, logsink.Error, false, noStack, defaultFormat(args), args...) -} - -// ErrorDepthf acts as Errorf but uses depth to determine which call frame to log. -// ErrorDepthf(0, "msg") is the same as Errorf("msg"). -func ErrorDepthf(depth int, format string, args ...any) { - logf(depth+1, logsink.Error, false, noStack, format, args...) -} - -// Errorln logs to the ERROR, WARNING, and INFO logs. -// Arguments are handled in the manner of fmt.Println; a newline is appended if missing. -func Errorln(args ...any) { - logf(1, logsink.Error, false, noStack, lnFormat(args), args...) -} - -// Errorf logs to the ERROR, WARNING, and INFO logs. -// Arguments are handled in the manner of fmt.Printf; a newline is appended if missing. -func Errorf(format string, args ...any) { - logf(1, logsink.Error, false, noStack, format, args...) -} - -func fatalf(depth int, format string, args ...any) { - logf(depth+1, logsink.Fatal, false, withStack, format, args...) - sinks.file.Flush() - - err := abortProcess() // Should not return. - - // Failed to abort the process using signals. Dump a stack trace and exit. - Errorf("abortProcess returned unexpectedly: %v", err) - sinks.file.Flush() - pprof.Lookup("goroutine").WriteTo(os.Stderr, 1) - os.Exit(2) // Exit with the same code as the default SIGABRT handler. -} - -// abortProcess attempts to kill the current process in a way that will dump the -// currently-running goroutines someplace useful (Coroner or stderr). -// -// It does this by sending SIGABRT to the current process. Unfortunately, the -// signal may or may not be delivered to the current thread; in order to do that -// portably, we would need to add a cgo dependency and call pthread_kill. -// -// If successful, abortProcess does not return. -func abortProcess() error { - p, err := os.FindProcess(os.Getpid()) - if err != nil { - return err - } - if err := p.Signal(syscall.SIGABRT); err != nil { - return err - } - - // Sent the signal. Now we wait for it to arrive and any SIGABRT handlers to - // run (and eventually terminate the process themselves). - // - // We could just "select{}" here, but there's an outside chance that would - // trigger the runtime's deadlock detector if there happen not to be any - // background goroutines running. So we'll sleep a while first to give - // the signal some time. - time.Sleep(10 * time.Second) - select {} -} - -// Fatal logs to the FATAL, ERROR, WARNING, and INFO logs, -// including a stack trace of all running goroutines, then calls os.Exit(2). -// Arguments are handled in the manner of fmt.Print; a newline is appended if missing. -func Fatal(args ...any) { - FatalDepth(1, args...) -} - -// FatalDepth acts as Fatal but uses depth to determine which call frame to log. -// FatalDepth(0, "msg") is the same as Fatal("msg"). -func FatalDepth(depth int, args ...any) { - fatalf(depth+1, defaultFormat(args), args...) -} - -// FatalDepthf acts as Fatalf but uses depth to determine which call frame to log. -// FatalDepthf(0, "msg") is the same as Fatalf("msg"). -func FatalDepthf(depth int, format string, args ...any) { - fatalf(depth+1, format, args...) -} - -// Fatalln logs to the FATAL, ERROR, WARNING, and INFO logs, -// including a stack trace of all running goroutines, then calls os.Exit(2). -// Arguments are handled in the manner of fmt.Println; a newline is appended if missing. -func Fatalln(args ...any) { - fatalf(1, lnFormat(args), args...) -} - -// Fatalf logs to the FATAL, ERROR, WARNING, and INFO logs, -// including a stack trace of all running goroutines, then calls os.Exit(2). -// Arguments are handled in the manner of fmt.Printf; a newline is appended if missing. -func Fatalf(format string, args ...any) { - fatalf(1, format, args...) -} - -func exitf(depth int, format string, args ...any) { - logf(depth+1, logsink.Fatal, false, noStack, format, args...) - sinks.file.Flush() - os.Exit(1) -} - -// Exit logs to the FATAL, ERROR, WARNING, and INFO logs, then calls os.Exit(1). -// Arguments are handled in the manner of fmt.Print; a newline is appended if missing. -func Exit(args ...any) { - ExitDepth(1, args...) -} - -// ExitDepth acts as Exit but uses depth to determine which call frame to log. -// ExitDepth(0, "msg") is the same as Exit("msg"). -func ExitDepth(depth int, args ...any) { - exitf(depth+1, defaultFormat(args), args...) -} - -// ExitDepthf acts as Exitf but uses depth to determine which call frame to log. -// ExitDepthf(0, "msg") is the same as Exitf("msg"). -func ExitDepthf(depth int, format string, args ...any) { - exitf(depth+1, format, args...) -} - -// Exitln logs to the FATAL, ERROR, WARNING, and INFO logs, then calls os.Exit(1). -func Exitln(args ...any) { - exitf(1, lnFormat(args), args...) -} - -// Exitf logs to the FATAL, ERROR, WARNING, and INFO logs, then calls os.Exit(1). -// Arguments are handled in the manner of fmt.Printf; a newline is appended if missing. -func Exitf(format string, args ...any) { - exitf(1, format, args...) -} diff --git a/vendor/github.com/golang/glog/glog_file.go b/vendor/github.com/golang/glog/glog_file.go deleted file mode 100644 index af1c934b8200..000000000000 --- a/vendor/github.com/golang/glog/glog_file.go +++ /dev/null @@ -1,407 +0,0 @@ -// Go support for leveled logs, analogous to https://github.com/google/glog. -// -// Copyright 2023 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. - -// File I/O for logs. - -package glog - -import ( - "bufio" - "bytes" - "errors" - "flag" - "fmt" - "io" - "os" - "os/user" - "path/filepath" - "runtime" - "strings" - "sync" - "time" - - "github.com/golang/glog/internal/logsink" -) - -// logDirs lists the candidate directories for new log files. -var logDirs []string - -var ( - // If non-empty, overrides the choice of directory in which to write logs. - // See createLogDirs for the full list of possible destinations. - logDir = flag.String("log_dir", "", "If non-empty, write log files in this directory") - logLink = flag.String("log_link", "", "If non-empty, add symbolic links in this directory to the log files") - logBufLevel = flag.Int("logbuflevel", int(logsink.Info), "Buffer log messages logged at this level or lower"+ - " (-1 means don't buffer; 0 means buffer INFO only; ...). Has limited applicability on non-prod platforms.") -) - -func createLogDirs() { - if *logDir != "" { - logDirs = append(logDirs, *logDir) - } - logDirs = append(logDirs, os.TempDir()) -} - -var ( - pid = os.Getpid() - program = filepath.Base(os.Args[0]) - host = "unknownhost" - userName = "unknownuser" -) - -func init() { - h, err := os.Hostname() - if err == nil { - host = shortHostname(h) - } - - current, err := user.Current() - if err == nil { - userName = current.Username - } - // Sanitize userName since it is used to construct file paths. - userName = strings.Map(func(r rune) rune { - switch { - case r >= 'a' && r <= 'z': - case r >= 'A' && r <= 'Z': - case r >= '0' && r <= '9': - default: - return '_' - } - return r - }, userName) -} - -// shortHostname returns its argument, truncating at the first period. -// For instance, given "www.google.com" it returns "www". -func shortHostname(hostname string) string { - if i := strings.Index(hostname, "."); i >= 0 { - return hostname[:i] - } - return hostname -} - -// logName returns a new log file name containing tag, with start time t, and -// the name for the symlink for tag. -func logName(tag string, t time.Time) (name, link string) { - name = fmt.Sprintf("%s.%s.%s.log.%s.%04d%02d%02d-%02d%02d%02d.%d", - program, - host, - userName, - tag, - t.Year(), - t.Month(), - t.Day(), - t.Hour(), - t.Minute(), - t.Second(), - pid) - return name, program + "." + tag -} - -var onceLogDirs sync.Once - -// create creates a new log file and returns the file and its filename, which -// contains tag ("INFO", "FATAL", etc.) and t. If the file is created -// successfully, create also attempts to update the symlink for that tag, ignoring -// errors. -func create(tag string, t time.Time) (f *os.File, filename string, err error) { - onceLogDirs.Do(createLogDirs) - if len(logDirs) == 0 { - return nil, "", errors.New("log: no log dirs") - } - name, link := logName(tag, t) - var lastErr error - for _, dir := range logDirs { - fname := filepath.Join(dir, name) - f, err := os.Create(fname) - if err == nil { - symlink := filepath.Join(dir, link) - os.Remove(symlink) // ignore err - os.Symlink(name, symlink) // ignore err - return f, fname, nil - } - lastErr = err - } - return nil, "", fmt.Errorf("log: cannot create log: %v", lastErr) -} - -// flushSyncWriter is the interface satisfied by logging destinations. -type flushSyncWriter interface { - Flush() error - Sync() error - io.Writer - filenames() []string -} - -var sinks struct { - stderr stderrSink - file fileSink -} - -func init() { - sinks.stderr.w = os.Stderr - - // Register stderr first: that way if we crash during file-writing at least - // the log will have gone somewhere. - logsink.TextSinks = append(logsink.TextSinks, &sinks.stderr, &sinks.file) - - sinks.file.flushChan = make(chan logsink.Severity, 1) - go sinks.file.flushDaemon() -} - -// stderrSink is a logsink.Text that writes log entries to stderr -// if they meet certain conditions. -type stderrSink struct { - mu sync.Mutex - w io.Writer -} - -// Enabled implements logsink.Text.Enabled. It returns true if any of the -// various stderr flags are enabled for logs of the given severity, if the log -// message is from the standard "log" package, or if google.Init has not yet run -// (and hence file logging is not yet initialized). -func (s *stderrSink) Enabled(m *logsink.Meta) bool { - return toStderr || alsoToStderr || m.Severity >= stderrThreshold.get() -} - -// Emit implements logsink.Text.Emit. -func (s *stderrSink) Emit(m *logsink.Meta, data []byte) (n int, err error) { - s.mu.Lock() - defer s.mu.Unlock() - - dn, err := s.w.Write(data) - n += dn - return n, err -} - -// severityWriters is an array of flushSyncWriter with a value for each -// logsink.Severity. -type severityWriters [4]flushSyncWriter - -// fileSink is a logsink.Text that prints to a set of Google log files. -type fileSink struct { - mu sync.Mutex - // file holds writer for each of the log types. - file severityWriters - flushChan chan logsink.Severity -} - -// Enabled implements logsink.Text.Enabled. It returns true if google.Init -// has run and both --disable_log_to_disk and --logtostderr are false. -func (s *fileSink) Enabled(m *logsink.Meta) bool { - return !toStderr -} - -// Emit implements logsink.Text.Emit -func (s *fileSink) Emit(m *logsink.Meta, data []byte) (n int, err error) { - s.mu.Lock() - defer s.mu.Unlock() - - if err = s.createMissingFiles(m.Severity); err != nil { - return 0, err - } - for sev := m.Severity; sev >= logsink.Info; sev-- { - if _, fErr := s.file[sev].Write(data); fErr != nil && err == nil { - err = fErr // Take the first error. - } - } - n = len(data) - if int(m.Severity) > *logBufLevel { - select { - case s.flushChan <- m.Severity: - default: - } - } - - return n, err -} - -// syncBuffer joins a bufio.Writer to its underlying file, providing access to the -// file's Sync method and providing a wrapper for the Write method that provides log -// file rotation. There are conflicting methods, so the file cannot be embedded. -// s.mu is held for all its methods. -type syncBuffer struct { - sink *fileSink - *bufio.Writer - file *os.File - names []string - sev logsink.Severity - nbytes uint64 // The number of bytes written to this file -} - -func (sb *syncBuffer) Sync() error { - return sb.file.Sync() -} - -func (sb *syncBuffer) Write(p []byte) (n int, err error) { - if sb.nbytes+uint64(len(p)) >= MaxSize { - if err := sb.rotateFile(time.Now()); err != nil { - return 0, err - } - } - n, err = sb.Writer.Write(p) - sb.nbytes += uint64(n) - return n, err -} - -func (sb *syncBuffer) filenames() []string { - return sb.names -} - -const footer = "\nCONTINUED IN NEXT FILE\n" - -// rotateFile closes the syncBuffer's file and starts a new one. -func (sb *syncBuffer) rotateFile(now time.Time) error { - var err error - pn := "" - file, name, err := create(sb.sev.String(), now) - - if sb.file != nil { - // The current log file becomes the previous log at the end of - // this block, so save its name for use in the header of the next - // file. - pn = sb.file.Name() - sb.Flush() - // If there's an existing file, write a footer with the name of - // the next file in the chain, followed by the constant string - // \nCONTINUED IN NEXT FILE\n to make continuation detection simple. - sb.file.Write([]byte("Next log: ")) - sb.file.Write([]byte(name)) - sb.file.Write([]byte(footer)) - sb.file.Close() - } - - sb.file = file - sb.names = append(sb.names, name) - sb.nbytes = 0 - if err != nil { - return err - } - - sb.Writer = bufio.NewWriterSize(sb.file, bufferSize) - - // Write header. - var buf bytes.Buffer - fmt.Fprintf(&buf, "Log file created at: %s\n", now.Format("2006/01/02 15:04:05")) - fmt.Fprintf(&buf, "Running on machine: %s\n", host) - fmt.Fprintf(&buf, "Binary: Built with %s %s for %s/%s\n", runtime.Compiler, runtime.Version(), runtime.GOOS, runtime.GOARCH) - fmt.Fprintf(&buf, "Previous log: %s\n", pn) - fmt.Fprintf(&buf, "Log line format: [IWEF]mmdd hh:mm:ss.uuuuuu threadid file:line] msg\n") - n, err := sb.file.Write(buf.Bytes()) - sb.nbytes += uint64(n) - return err -} - -// bufferSize sizes the buffer associated with each log file. It's large -// so that log records can accumulate without the logging thread blocking -// on disk I/O. The flushDaemon will block instead. -const bufferSize = 256 * 1024 - -// createMissingFiles creates all the log files for severity from infoLog up to -// upTo that have not already been created. -// s.mu is held. -func (s *fileSink) createMissingFiles(upTo logsink.Severity) error { - if s.file[upTo] != nil { - return nil - } - now := time.Now() - // Files are created in increasing severity order, so we can be assured that - // if a high severity logfile exists, then so do all of lower severity. - for sev := logsink.Info; sev <= upTo; sev++ { - if s.file[sev] != nil { - continue - } - sb := &syncBuffer{ - sink: s, - sev: sev, - } - if err := sb.rotateFile(now); err != nil { - return err - } - s.file[sev] = sb - } - return nil -} - -// flushDaemon periodically flushes the log file buffers. -func (s *fileSink) flushDaemon() { - tick := time.NewTicker(30 * time.Second) - defer tick.Stop() - for { - select { - case <-tick.C: - s.Flush() - case sev := <-s.flushChan: - s.flush(sev) - } - } -} - -// Flush flushes all pending log I/O. -func Flush() { - sinks.file.Flush() -} - -// Flush flushes all the logs and attempts to "sync" their data to disk. -func (s *fileSink) Flush() error { - return s.flush(logsink.Info) -} - -// flush flushes all logs of severity threshold or greater. -func (s *fileSink) flush(threshold logsink.Severity) error { - s.mu.Lock() - defer s.mu.Unlock() - - var firstErr error - updateErr := func(err error) { - if err != nil && firstErr == nil { - firstErr = err - } - } - - // Flush from fatal down, in case there's trouble flushing. - for sev := logsink.Fatal; sev >= threshold; sev-- { - file := s.file[sev] - if file != nil { - updateErr(file.Flush()) - updateErr(file.Sync()) - } - } - - return firstErr -} - -// Names returns the names of the log files holding the FATAL, ERROR, -// WARNING, or INFO logs. Returns ErrNoLog if the log for the given -// level doesn't exist (e.g. because no messages of that level have been -// written). This may return multiple names if the log type requested -// has rolled over. -func Names(s string) ([]string, error) { - severity, err := logsink.ParseSeverity(s) - if err != nil { - return nil, err - } - - sinks.file.mu.Lock() - defer sinks.file.mu.Unlock() - f := sinks.file.file[severity] - if f == nil { - return nil, ErrNoLog - } - - return f.filenames(), nil -} diff --git a/vendor/github.com/golang/glog/glog_flags.go b/vendor/github.com/golang/glog/glog_flags.go deleted file mode 100644 index 3060e54d9dc5..000000000000 --- a/vendor/github.com/golang/glog/glog_flags.go +++ /dev/null @@ -1,395 +0,0 @@ -// Go support for leveled logs, analogous to https://github.com/google/glog. -// -// Copyright 2023 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 glog - -import ( - "bytes" - "errors" - "flag" - "fmt" - "path/filepath" - "runtime" - "strconv" - "strings" - "sync" - "sync/atomic" - - "github.com/golang/glog/internal/logsink" -) - -// modulePat contains a filter for the -vmodule flag. -// It holds a verbosity level and a file pattern to match. -type modulePat struct { - pattern string - literal bool // The pattern is a literal string - full bool // The pattern wants to match the full path - level Level -} - -// match reports whether the file matches the pattern. It uses a string -// comparison if the pattern contains no metacharacters. -func (m *modulePat) match(full, file string) bool { - if m.literal { - if m.full { - return full == m.pattern - } - return file == m.pattern - } - if m.full { - match, _ := filepath.Match(m.pattern, full) - return match - } - match, _ := filepath.Match(m.pattern, file) - return match -} - -// isLiteral reports whether the pattern is a literal string, that is, has no metacharacters -// that require filepath.Match to be called to match the pattern. -func isLiteral(pattern string) bool { - return !strings.ContainsAny(pattern, `\*?[]`) -} - -// isFull reports whether the pattern matches the full file path, that is, -// whether it contains /. -func isFull(pattern string) bool { - return strings.ContainsRune(pattern, '/') -} - -// verboseFlags represents the setting of the -v and -vmodule flags. -type verboseFlags struct { - // moduleLevelCache is a sync.Map storing the -vmodule Level for each V() - // call site, identified by PC. If there is no matching -vmodule filter, - // the cached value is exactly v. moduleLevelCache is replaced with a new - // Map whenever the -vmodule or -v flag changes state. - moduleLevelCache atomic.Value - - // mu guards all fields below. - mu sync.Mutex - - // v stores the value of the -v flag. It may be read safely using - // sync.LoadInt32, but is only modified under mu. - v Level - - // module stores the parsed -vmodule flag. - module []modulePat - - // moduleLength caches len(module). If greater than zero, it - // means vmodule is enabled. It may be read safely using sync.LoadInt32, but - // is only modified under mu. - moduleLength int32 -} - -// NOTE: For compatibility with the open-sourced v1 version of this -// package (github.com/golang/glog) we need to retain that flag.Level -// implements the flag.Value interface. See also go/log-vs-glog. - -// String is part of the flag.Value interface. -func (l *Level) String() string { - return strconv.FormatInt(int64(l.Get().(Level)), 10) -} - -// Get is part of the flag.Value interface. -func (l *Level) Get() any { - if l == &vflags.v { - // l is the value registered for the -v flag. - return Level(atomic.LoadInt32((*int32)(l))) - } - return *l -} - -// Set is part of the flag.Value interface. -func (l *Level) Set(value string) error { - v, err := strconv.Atoi(value) - if err != nil { - return err - } - if l == &vflags.v { - // l is the value registered for the -v flag. - vflags.mu.Lock() - defer vflags.mu.Unlock() - vflags.moduleLevelCache.Store(&sync.Map{}) - atomic.StoreInt32((*int32)(l), int32(v)) - return nil - } - *l = Level(v) - return nil -} - -// vModuleFlag is the flag.Value for the --vmodule flag. -type vModuleFlag struct{ *verboseFlags } - -func (f vModuleFlag) String() string { - f.mu.Lock() - defer f.mu.Unlock() - - var b bytes.Buffer - for i, f := range f.module { - if i > 0 { - b.WriteRune(',') - } - fmt.Fprintf(&b, "%s=%d", f.pattern, f.level) - } - return b.String() -} - -// Get returns nil for this flag type since the struct is not exported. -func (f vModuleFlag) Get() any { return nil } - -var errVmoduleSyntax = errors.New("syntax error: expect comma-separated list of filename=N") - -// Syntax: -vmodule=recordio=2,foo/bar/baz=1,gfs*=3 -func (f vModuleFlag) Set(value string) error { - var filter []modulePat - for _, pat := range strings.Split(value, ",") { - if len(pat) == 0 { - // Empty strings such as from a trailing comma can be ignored. - continue - } - patLev := strings.Split(pat, "=") - if len(patLev) != 2 || len(patLev[0]) == 0 || len(patLev[1]) == 0 { - return errVmoduleSyntax - } - pattern := patLev[0] - v, err := strconv.Atoi(patLev[1]) - if err != nil { - return errors.New("syntax error: expect comma-separated list of filename=N") - } - // TODO: check syntax of filter? - filter = append(filter, modulePat{pattern, isLiteral(pattern), isFull(pattern), Level(v)}) - } - - f.mu.Lock() - defer f.mu.Unlock() - f.module = filter - atomic.StoreInt32((*int32)(&f.moduleLength), int32(len(f.module))) - f.moduleLevelCache.Store(&sync.Map{}) - return nil -} - -func (f *verboseFlags) levelForPC(pc uintptr) Level { - if level, ok := f.moduleLevelCache.Load().(*sync.Map).Load(pc); ok { - return level.(Level) - } - - f.mu.Lock() - defer f.mu.Unlock() - level := Level(f.v) - fn := runtime.FuncForPC(pc) - file, _ := fn.FileLine(pc) - // The file is something like /a/b/c/d.go. We want just the d for - // regular matches, /a/b/c/d for full matches. - if strings.HasSuffix(file, ".go") { - file = file[:len(file)-3] - } - full := file - if slash := strings.LastIndex(file, "/"); slash >= 0 { - file = file[slash+1:] - } - for _, filter := range f.module { - if filter.match(full, file) { - level = filter.level - break // Use the first matching level. - } - } - f.moduleLevelCache.Load().(*sync.Map).Store(pc, level) - return level -} - -func (f *verboseFlags) enabled(callerDepth int, level Level) bool { - if atomic.LoadInt32(&f.moduleLength) == 0 { - // No vmodule values specified, so compare against v level. - return Level(atomic.LoadInt32((*int32)(&f.v))) >= level - } - - pcs := [1]uintptr{} - if runtime.Callers(callerDepth+2, pcs[:]) < 1 { - return false - } - frame, _ := runtime.CallersFrames(pcs[:]).Next() - return f.levelForPC(frame.Entry) >= level -} - -// traceLocation represents an entry in the -log_backtrace_at flag. -type traceLocation struct { - file string - line int -} - -var errTraceSyntax = errors.New("syntax error: expect file.go:234") - -func parseTraceLocation(value string) (traceLocation, error) { - fields := strings.Split(value, ":") - if len(fields) != 2 { - return traceLocation{}, errTraceSyntax - } - file, lineStr := fields[0], fields[1] - if !strings.Contains(file, ".") { - return traceLocation{}, errTraceSyntax - } - line, err := strconv.Atoi(lineStr) - if err != nil { - return traceLocation{}, errTraceSyntax - } - if line < 0 { - return traceLocation{}, errors.New("negative value for line") - } - return traceLocation{file, line}, nil -} - -// match reports whether the specified file and line matches the trace location. -// The argument file name is the full path, not the basename specified in the flag. -func (t traceLocation) match(file string, line int) bool { - if t.line != line { - return false - } - if i := strings.LastIndex(file, "/"); i >= 0 { - file = file[i+1:] - } - return t.file == file -} - -func (t traceLocation) String() string { - return fmt.Sprintf("%s:%d", t.file, t.line) -} - -// traceLocations represents the -log_backtrace_at flag. -// Syntax: -log_backtrace_at=recordio.go:234,sstable.go:456 -// Note that unlike vmodule the file extension is included here. -type traceLocations struct { - mu sync.Mutex - locsLen int32 // Safe for atomic read without mu. - locs []traceLocation -} - -func (t *traceLocations) String() string { - t.mu.Lock() - defer t.mu.Unlock() - - var buf bytes.Buffer - for i, tl := range t.locs { - if i > 0 { - buf.WriteString(",") - } - buf.WriteString(tl.String()) - } - return buf.String() -} - -// Get always returns nil for this flag type since the struct is not exported -func (t *traceLocations) Get() any { return nil } - -func (t *traceLocations) Set(value string) error { - var locs []traceLocation - for _, s := range strings.Split(value, ",") { - if s == "" { - continue - } - loc, err := parseTraceLocation(s) - if err != nil { - return err - } - locs = append(locs, loc) - } - - t.mu.Lock() - defer t.mu.Unlock() - atomic.StoreInt32(&t.locsLen, int32(len(locs))) - t.locs = locs - return nil -} - -func (t *traceLocations) match(file string, line int) bool { - if atomic.LoadInt32(&t.locsLen) == 0 { - return false - } - - t.mu.Lock() - defer t.mu.Unlock() - for _, tl := range t.locs { - if tl.match(file, line) { - return true - } - } - return false -} - -// severityFlag is an atomic flag.Value implementation for logsink.Severity. -type severityFlag int32 - -func (s *severityFlag) get() logsink.Severity { - return logsink.Severity(atomic.LoadInt32((*int32)(s))) -} -func (s *severityFlag) String() string { return strconv.FormatInt(int64(*s), 10) } -func (s *severityFlag) Get() any { return s.get() } -func (s *severityFlag) Set(value string) error { - threshold, err := logsink.ParseSeverity(value) - if err != nil { - // Not a severity name. Try a raw number. - v, err := strconv.Atoi(value) - if err != nil { - return err - } - threshold = logsink.Severity(v) - if threshold < logsink.Info || threshold > logsink.Fatal { - return fmt.Errorf("Severity %d out of range (min %d, max %d).", v, logsink.Info, logsink.Fatal) - } - } - atomic.StoreInt32((*int32)(s), int32(threshold)) - return nil -} - -var ( - vflags verboseFlags // The -v and -vmodule flags. - - logBacktraceAt traceLocations // The -log_backtrace_at flag. - - // Boolean flags. Not handled atomically because the flag.Value interface - // does not let us avoid the =true, and that shorthand is necessary for - // compatibility. TODO: does this matter enough to fix? Seems unlikely. - toStderr bool // The -logtostderr flag. - alsoToStderr bool // The -alsologtostderr flag. - - stderrThreshold severityFlag // The -stderrthreshold flag. -) - -// verboseEnabled returns whether the caller at the given depth should emit -// verbose logs at the given level, with depth 0 identifying the caller of -// verboseEnabled. -func verboseEnabled(callerDepth int, level Level) bool { - return vflags.enabled(callerDepth+1, level) -} - -// backtraceAt returns whether the logging call at the given function and line -// should also emit a backtrace of the current call stack. -func backtraceAt(file string, line int) bool { - return logBacktraceAt.match(file, line) -} - -func init() { - vflags.moduleLevelCache.Store(&sync.Map{}) - - flag.Var(&vflags.v, "v", "log level for V logs") - flag.Var(vModuleFlag{&vflags}, "vmodule", "comma-separated list of pattern=N settings for file-filtered logging") - - flag.Var(&logBacktraceAt, "log_backtrace_at", "when logging hits line file:N, emit a stack trace") - - stderrThreshold = severityFlag(logsink.Error) - - flag.BoolVar(&toStderr, "logtostderr", false, "log to standard error instead of files") - flag.BoolVar(&alsoToStderr, "alsologtostderr", false, "log to standard error as well as files") - flag.Var(&stderrThreshold, "stderrthreshold", "logs at or above this threshold go to stderr") -} diff --git a/vendor/github.com/golang/glog/internal/logsink/logsink.go b/vendor/github.com/golang/glog/internal/logsink/logsink.go deleted file mode 100644 index 53758e1c9f5e..000000000000 --- a/vendor/github.com/golang/glog/internal/logsink/logsink.go +++ /dev/null @@ -1,387 +0,0 @@ -// Copyright 2023 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 logsink - -import ( - "bytes" - "fmt" - "strconv" - "strings" - "sync" - "time" - - "github.com/golang/glog/internal/stackdump" -) - -// MaxLogMessageLen is the limit on length of a formatted log message, including -// the standard line prefix and trailing newline. -// -// Chosen to match C++ glog. -const MaxLogMessageLen = 15000 - -// A Severity is a severity at which a message can be logged. -type Severity int8 - -// These constants identify the log levels in order of increasing severity. -// A message written to a high-severity log file is also written to each -// lower-severity log file. -const ( - Info Severity = iota - Warning - Error - - // Fatal contains logs written immediately before the process terminates. - // - // Sink implementations should not terminate the process themselves: the log - // package will perform any necessary cleanup and terminate the process as - // appropriate. - Fatal -) - -func (s Severity) String() string { - switch s { - case Info: - return "INFO" - case Warning: - return "WARNING" - case Error: - return "ERROR" - case Fatal: - return "FATAL" - } - return fmt.Sprintf("%T(%d)", s, s) -} - -// ParseSeverity returns the case-insensitive Severity value for the given string. -func ParseSeverity(name string) (Severity, error) { - name = strings.ToUpper(name) - for s := Info; s <= Fatal; s++ { - if s.String() == name { - return s, nil - } - } - return -1, fmt.Errorf("logsink: invalid severity %q", name) -} - -// Meta is metadata about a logging call. -type Meta struct { - // Time is the time at which the log call was made. - Time time.Time - - // File is the source file from which the log entry originates. - File string - // Line is the line offset within the source file. - Line int - // Depth is the number of stack frames between the logsink and the log call. - Depth int - - Severity Severity - - // Verbose indicates whether the call was made via "log.V". Log entries below - // the current verbosity threshold are not sent to the sink. - Verbose bool - - // Thread ID. This can be populated with a thread ID from another source, - // such as a system we are importing logs from. In the normal case, this - // will be set to the process ID (PID), since Go doesn't have threads. - Thread int64 - - // Stack trace starting in the logging function. May be nil. - // A logsink should implement the StackWanter interface to request this. - // - // Even if WantStack returns false, this field may be set (e.g. if another - // sink wants a stack trace). - Stack *stackdump.Stack -} - -// Structured is a logging destination that accepts structured data as input. -type Structured interface { - // Printf formats according to a fmt.Printf format specifier and writes a log - // entry. The precise result of formatting depends on the sink, but should - // aim for consistency with fmt.Printf. - // - // Printf returns the number of bytes occupied by the log entry, which - // may not be equal to the total number of bytes written. - // - // Printf returns any error encountered *if* it is severe enough that the log - // package should terminate the process. - // - // The sink must not modify the *Meta parameter, nor reference it after - // Printf has returned: it may be reused in subsequent calls. - Printf(meta *Meta, format string, a ...any) (n int, err error) -} - -// StackWanter can be implemented by a logsink.Structured to indicate that it -// wants a stack trace to accompany at least some of the log messages it receives. -type StackWanter interface { - // WantStack returns true if the sink requires a stack trace for a log message - // with this metadata. - // - // NOTE: Returning true implies that meta.Stack will be non-nil. Returning - // false does NOT imply that meta.Stack will be nil. - WantStack(meta *Meta) bool -} - -// Text is a logging destination that accepts pre-formatted log lines (instead of -// structured data). -type Text interface { - // Enabled returns whether this sink should output messages for the given - // Meta. If the sink returns false for a given Meta, the Printf function will - // not call Emit on it for the corresponding log message. - Enabled(*Meta) bool - - // Emit writes a pre-formatted text log entry (including any applicable - // header) to the log. It returns the number of bytes occupied by the entry - // (which may differ from the length of the passed-in slice). - // - // Emit returns any error encountered *if* it is severe enough that the log - // package should terminate the process. - // - // The sink must not modify the *Meta parameter, nor reference it after - // Printf has returned: it may be reused in subsequent calls. - // - // NOTE: When developing a text sink, keep in mind the surface in which the - // logs will be displayed, and whether it's important that the sink be - // resistent to tampering in the style of b/211428300. Standard text sinks - // (like `stderrSink`) do not protect against this (e.g. by escaping - // characters) because the cases where they would show user-influenced bytes - // are vanishingly small. - Emit(*Meta, []byte) (n int, err error) -} - -// bufs is a pool of *bytes.Buffer used in formatting log entries. -var bufs sync.Pool // Pool of *bytes.Buffer. - -// textPrintf formats a text log entry and emits it to all specified Text sinks. -// -// The returned n is the maximum across all Emit calls. -// The returned err is the first non-nil error encountered. -// Sinks that are disabled by configuration should return (0, nil). -func textPrintf(m *Meta, textSinks []Text, format string, args ...any) (n int, err error) { - // We expect at most file, stderr, and perhaps syslog. If there are more, - // we'll end up allocating - no big deal. - const maxExpectedTextSinks = 3 - var noAllocSinks [maxExpectedTextSinks]Text - - sinks := noAllocSinks[:0] - for _, s := range textSinks { - if s.Enabled(m) { - sinks = append(sinks, s) - } - } - if len(sinks) == 0 && m.Severity != Fatal { - return 0, nil // No TextSinks specified; don't bother formatting. - } - - bufi := bufs.Get() - var buf *bytes.Buffer - if bufi == nil { - buf = bytes.NewBuffer(nil) - bufi = buf - } else { - buf = bufi.(*bytes.Buffer) - buf.Reset() - } - - // Lmmdd hh:mm:ss.uuuuuu PID/GID file:line] - // - // The "PID" entry arguably ought to be TID for consistency with other - // environments, but TID is not meaningful in a Go program due to the - // multiplexing of goroutines across threads. - // - // Avoid Fprintf, for speed. The format is so simple that we can do it quickly by hand. - // It's worth about 3X. Fprintf is hard. - const severityChar = "IWEF" - buf.WriteByte(severityChar[m.Severity]) - - _, month, day := m.Time.Date() - hour, minute, second := m.Time.Clock() - twoDigits(buf, int(month)) - twoDigits(buf, day) - buf.WriteByte(' ') - twoDigits(buf, hour) - buf.WriteByte(':') - twoDigits(buf, minute) - buf.WriteByte(':') - twoDigits(buf, second) - buf.WriteByte('.') - nDigits(buf, 6, uint64(m.Time.Nanosecond()/1000), '0') - buf.WriteByte(' ') - - nDigits(buf, 7, uint64(m.Thread), ' ') - buf.WriteByte(' ') - - { - file := m.File - if i := strings.LastIndex(file, "/"); i >= 0 { - file = file[i+1:] - } - buf.WriteString(file) - } - - buf.WriteByte(':') - { - var tmp [19]byte - buf.Write(strconv.AppendInt(tmp[:0], int64(m.Line), 10)) - } - buf.WriteString("] ") - - msgStart := buf.Len() - fmt.Fprintf(buf, format, args...) - if buf.Len() > MaxLogMessageLen-1 { - buf.Truncate(MaxLogMessageLen - 1) - } - msgEnd := buf.Len() - if b := buf.Bytes(); b[len(b)-1] != '\n' { - buf.WriteByte('\n') - } - - for _, s := range sinks { - sn, sErr := s.Emit(m, buf.Bytes()) - if sn > n { - n = sn - } - if sErr != nil && err == nil { - err = sErr - } - } - - if m.Severity == Fatal { - savedM := *m - fatalMessageStore(savedEntry{ - meta: &savedM, - msg: buf.Bytes()[msgStart:msgEnd], - }) - } else { - bufs.Put(bufi) - } - return n, err -} - -const digits = "0123456789" - -// twoDigits formats a zero-prefixed two-digit integer to buf. -func twoDigits(buf *bytes.Buffer, d int) { - buf.WriteByte(digits[(d/10)%10]) - buf.WriteByte(digits[d%10]) -} - -// nDigits formats an n-digit integer to buf, padding with pad on the left. It -// assumes d != 0. -func nDigits(buf *bytes.Buffer, n int, d uint64, pad byte) { - var tmp [20]byte - - cutoff := len(tmp) - n - j := len(tmp) - 1 - for ; d > 0; j-- { - tmp[j] = digits[d%10] - d /= 10 - } - for ; j >= cutoff; j-- { - tmp[j] = pad - } - j++ - buf.Write(tmp[j:]) -} - -// Printf writes a log entry to all registered TextSinks in this package, then -// to all registered StructuredSinks. -// -// The returned n is the maximum across all Emit and Printf calls. -// The returned err is the first non-nil error encountered. -// Sinks that are disabled by configuration should return (0, nil). -func Printf(m *Meta, format string, args ...any) (n int, err error) { - m.Depth++ - n, err = textPrintf(m, TextSinks, format, args...) - - for _, sink := range StructuredSinks { - // TODO: Support TextSinks that implement StackWanter? - if sw, ok := sink.(StackWanter); ok && sw.WantStack(m) { - if m.Stack == nil { - // First, try to find a stacktrace in args, otherwise generate one. - for _, arg := range args { - if stack, ok := arg.(stackdump.Stack); ok { - m.Stack = &stack - break - } - } - if m.Stack == nil { - stack := stackdump.Caller( /* skipDepth = */ m.Depth) - m.Stack = &stack - } - } - } - sn, sErr := sink.Printf(m, format, args...) - if sn > n { - n = sn - } - if sErr != nil && err == nil { - err = sErr - } - } - return n, err -} - -// The sets of sinks to which logs should be written. -// -// These must only be modified during package init, and are read-only thereafter. -var ( - // StructuredSinks is the set of Structured sink instances to which logs - // should be written. - StructuredSinks []Structured - - // TextSinks is the set of Text sink instances to which logs should be - // written. - // - // These are registered separately from Structured sink implementations to - // avoid the need to repeat the work of formatting a message for each Text - // sink that writes it. The package-level Printf function writes to both sets - // independenty, so a given log destination should only register a Structured - // *or* a Text sink (not both). - TextSinks []Text -) - -type savedEntry struct { - meta *Meta - msg []byte -} - -// StructuredTextWrapper is a Structured sink which forwards logs to a set of Text sinks. -// -// The purpose of this sink is to allow applications to intercept logging calls before they are -// serialized and sent to Text sinks. For example, if one needs to redact PII from logging -// arguments before they reach STDERR, one solution would be to do the redacting in a Structured -// sink that forwards logs to a StructuredTextWrapper instance, and make STDERR a child of that -// StructuredTextWrapper instance. This is how one could set this up in their application: -// -// func init() { -// -// wrapper := logsink.StructuredTextWrapper{TextSinks: logsink.TextSinks} -// // sanitizersink will intercept logs and remove PII -// sanitizer := sanitizersink{Sink: &wrapper} -// logsink.StructuredSinks = append(logsink.StructuredSinks, &sanitizer) -// logsink.TextSinks = nil -// -// } -type StructuredTextWrapper struct { - // TextSinks is the set of Text sinks that should receive logs from this - // StructuredTextWrapper instance. - TextSinks []Text -} - -// Printf forwards logs to all Text sinks registered in the StructuredTextWrapper. -func (w *StructuredTextWrapper) Printf(meta *Meta, format string, args ...any) (n int, err error) { - return textPrintf(meta, w.TextSinks, format, args...) -} diff --git a/vendor/github.com/golang/glog/internal/logsink/logsink_fatal.go b/vendor/github.com/golang/glog/internal/logsink/logsink_fatal.go deleted file mode 100644 index 3dc269abc21f..000000000000 --- a/vendor/github.com/golang/glog/internal/logsink/logsink_fatal.go +++ /dev/null @@ -1,35 +0,0 @@ -package logsink - -import ( - "sync/atomic" - "unsafe" -) - -func fatalMessageStore(e savedEntry) { - // Only put a new one in if we haven't assigned before. - atomic.CompareAndSwapPointer(&fatalMessage, nil, unsafe.Pointer(&e)) -} - -var fatalMessage unsafe.Pointer // savedEntry stored with CompareAndSwapPointer - -// FatalMessage returns the Meta and message contents of the first message -// logged with Fatal severity, or false if none has occurred. -func FatalMessage() (*Meta, []byte, bool) { - e := (*savedEntry)(atomic.LoadPointer(&fatalMessage)) - if e == nil { - return nil, nil, false - } - return e.meta, e.msg, true -} - -// DoNotUseRacyFatalMessage is FatalMessage, but worse. -// -//go:norace -//go:nosplit -func DoNotUseRacyFatalMessage() (*Meta, []byte, bool) { - e := (*savedEntry)(fatalMessage) - if e == nil { - return nil, nil, false - } - return e.meta, e.msg, true -} diff --git a/vendor/github.com/golang/glog/internal/stackdump/stackdump.go b/vendor/github.com/golang/glog/internal/stackdump/stackdump.go deleted file mode 100644 index 3427c9d6bd00..000000000000 --- a/vendor/github.com/golang/glog/internal/stackdump/stackdump.go +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright 2023 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 stackdump provides wrappers for runtime.Stack and runtime.Callers -// with uniform support for skipping caller frames. -// -// ⚠ Unlike the functions in the runtime package, these may allocate a -// non-trivial quantity of memory: use them with care. ⚠ -package stackdump - -import ( - "bytes" - "runtime" -) - -// runtimeStackSelfFrames is 1 if runtime.Stack includes the call to -// runtime.Stack itself or 0 if it does not. -// -// As of 2016-04-27, the gccgo compiler includes runtime.Stack but the gc -// compiler does not. -var runtimeStackSelfFrames = func() int { - for n := 1 << 10; n < 1<<20; n *= 2 { - buf := make([]byte, n) - n := runtime.Stack(buf, false) - if bytes.Contains(buf[:n], []byte("runtime.Stack")) { - return 1 - } else if n < len(buf) || bytes.Count(buf, []byte("\n")) >= 3 { - return 0 - } - } - return 0 -}() - -// Stack is a stack dump for a single goroutine. -type Stack struct { - // Text is a representation of the stack dump in a human-readable format. - Text []byte - - // PC is a representation of the stack dump using raw program counter values. - PC []uintptr -} - -func (s Stack) String() string { return string(s.Text) } - -// Caller returns the Stack dump for the calling goroutine, starting skipDepth -// frames before the caller of Caller. (Caller(0) provides a dump starting at -// the caller of this function.) -func Caller(skipDepth int) Stack { - return Stack{ - Text: CallerText(skipDepth + 1), - PC: CallerPC(skipDepth + 1), - } -} - -// CallerText returns a textual dump of the stack starting skipDepth frames before -// the caller. (CallerText(0) provides a dump starting at the caller of this -// function.) -func CallerText(skipDepth int) []byte { - for n := 1 << 10; ; n *= 2 { - buf := make([]byte, n) - n := runtime.Stack(buf, false) - if n < len(buf) { - return pruneFrames(skipDepth+1+runtimeStackSelfFrames, buf[:n]) - } - } -} - -// CallerPC returns a dump of the program counters of the stack starting -// skipDepth frames before the caller. (CallerPC(0) provides a dump starting at -// the caller of this function.) -func CallerPC(skipDepth int) []uintptr { - for n := 1 << 8; ; n *= 2 { - buf := make([]uintptr, n) - n := runtime.Callers(skipDepth+2, buf) - if n < len(buf) { - return buf[:n] - } - } -} - -// pruneFrames removes the topmost skipDepth frames of the first goroutine in a -// textual stack dump. It overwrites the passed-in slice. -// -// If there are fewer than skipDepth frames in the first goroutine's stack, -// pruneFrames prunes it to an empty stack and leaves the remaining contents -// intact. -func pruneFrames(skipDepth int, stack []byte) []byte { - headerLen := 0 - for i, c := range stack { - if c == '\n' { - headerLen = i + 1 - break - } - } - if headerLen == 0 { - return stack // No header line - not a well-formed stack trace. - } - - skipLen := headerLen - skipNewlines := skipDepth * 2 - for ; skipLen < len(stack) && skipNewlines > 0; skipLen++ { - c := stack[skipLen] - if c != '\n' { - continue - } - skipNewlines-- - skipLen++ - if skipNewlines == 0 || skipLen == len(stack) || stack[skipLen] == '\n' { - break - } - } - - pruned := stack[skipLen-headerLen:] - copy(pruned, stack[:headerLen]) - return pruned -} diff --git a/vendor/github.com/google/go-github/v27/AUTHORS b/vendor/github.com/google/go-github/v27/AUTHORS deleted file mode 100644 index d38236ed45ff..000000000000 --- a/vendor/github.com/google/go-github/v27/AUTHORS +++ /dev/null @@ -1,251 +0,0 @@ -# This is the official list of go-github authors for copyright purposes. -# -# This does not necessarily list everyone who has contributed code, since in -# some cases, their employer may be the copyright holder. To see the full list -# of contributors, see the revision history in source control or -# https://github.com/google/go-github/graphs/contributors. -# -# Authors who wish to be recognized in this file should add themselves (or -# their employer, as appropriate). - -178inaba -Abhinav Gupta -adrienzieba -Ahmed Hagy -Aidan Steele -Ainsley Chong -Akeda Bagus -Akhil Mohan -Alec Thomas -Aleks Clark -Alex Bramley -Alexander Harkness -Allen Sun -Amey Sakhadeo -Andreas Garnæs -Andrew Ryabchun -Andy Grunwald -Andy Hume -Andy Lindeman -anjanashenoy -Anshuman Bhartiya -Antoine -Antoine Pelisse -Anubha Kushwaha -appilon -Aravind -Arda Kuyumcu -Arıl Bozoluk -Austin Dizzy -Ben Batha -Benjamen Keroack -Beshr Kayali -Beyang Liu -Billy Lynch -Björn Häuser -Brad Harris -Brad Moylan -Bradley Falzon -Brandon Cook -Brian Egizi -Bryan Boreham -Cami Diez -Carlos Alexandro Becker -Carlos Tadeu Panato Junior -chandresh-pancholi -Charles Fenwick Elliott -Charlie Yan -Chris King -Chris Roche -Chris Schaefer -chrisforrette -Christian Muehlhaeuser -Christoph Sassenberg -Colin Misare -Craig Peterson -Cristian Maglie -Daehyeok Mun -Daniel Leavitt -Daniel Nilsson -Dave Du Cros -Dave Henderson -David Deng -David Jannotta -David Ji -Davide Zipeto -Dennis Webb -Dhi Aurrahman -Diego Lapiduz -Dmitri Shuralyov -dmnlk -Don Petersen -Doug Turner -Drew Fradette -Eli Uriegas -Elliott Beach -Emerson Wood -eperm -Erick Fejta -erwinvaneyk -Evan Elias -Fabrice -Felix Geisendörfer -Filippo Valsorda -Florian Forster -Francesc Gil -Francis -Fredrik Jönsson -Garrett Squire -George Kontridze -Georgy Buranov -Gnahz -Google Inc. -Grachev Mikhail -griffin_stewie -Guillaume Jacquet -Guz Alexander -Guðmundur Bjarni Ólafsson -Hanno Hecker -Hari haran -haya14busa -Huy Tr -huydx -i2bskn -Isao Jonas -isqua -Jameel Haffejee -Jan Kosecki -Javier Campanini -Jens Rantil -Jeremy Morris -Jesse Newland -Jihoon Chung -Jimmi Dyson -Joan Saum -Joe Tsai -John Barton -John Engelman -Jordan Brockopp -Jordan Sussman -Joshua Bezaleel Abednego -JP Phillips -jpbelanger-mtl -Juan Basso -Julien Garcia Gonzalez -Julien Rostand -Justin Abrahms -Jusung Lee -jzhoucliqr -Katrina Owen -Kautilya Tripathi < tripathi.kautilya@gmail.com> -Kautilya Tripathi -Keita Urashima -Kevin Burke -Konrad Malawski -Kookheon Kwon -Krzysztof Kowalczyk -Kshitij Saraogi -kyokomi -Laurent Verdoïa -Liam Galvin -Lovro Mažgon -Lucas Alcantara -Luke Evers -Luke Kysow -Luke Roberts -Luke Young -Maksim Zhylinski -Mark Tareshawty -Martin-Louis Bright -Marwan Sulaiman -Masayuki Izumi -Mat Geist -Matt -Matt Brender -Matt Gaunt -Matt Landis -Maxime Bury -Michael Spiegel -Michael Tiller -Michał Glapa -Nadav Kaner -Nathan VanBenschoten -Navaneeth Suresh -Neil O'Toole -Nick Miyake -Nick Spragg -Nikhita Raghunath -Noah Zoschke -ns-cweber -Oleg Kovalov -Ondřej Kupka -Palash Nigam -Panagiotis Moustafellos -Parham Alvani -Parker Moore -parkhyukjun89 -Pavel Shtanko -Pete Wagner -Petr Shevtsov -Pierre Carrier -Piotr Zurek -Quentin Leffray -Quinn Slack -Rackspace US, Inc. -Radek Simko -Radliński Ignacy -Rajendra arora -Ranbir Singh -RaviTeja Pothana -rc1140 -Red Hat, Inc. -Ricco Førgaard -Rob Figueiredo -Rohit Upadhyay -Ronak Jain -Ruben Vereecken -Ryan Leung -Ryan Lower -Sahil Dua -saisi -Sam Minnée -Sandeep Sukhani -Sander van Harmelen -Sanket Payghan -Sarasa Kisaragi -Sean Wang -Sebastian Mandrean -Sebastian Mæland Pedersen -Sergey Romanov -Sevki -Shagun Khemka -shakeelrao -Shawn Catanzarite -Shawn Smith -Shrikrishna Singh -sona-tar -SoundCloud, Ltd. -Sridhar Mocherla -SriVignessh Pss -Stian Eikeland -Tasya Aditya Rukmana -Thomas Bruyelle -Timothée Peignier -Trey Tacon -ttacon -Vaibhav Singh -Varadarajan Aravamudhan -Victor Castell -Victor Vrantchan -Vlad Ungureanu -Wasim Thabraze -Will Maier -William Bailey -William Cooke -xibz -Yann Malet -Yannick Utard -Yicheng Qin -Yosuke Akatsuka -Yumikiyo Osanai -Zach Latta diff --git a/vendor/github.com/google/go-github/v27/LICENSE b/vendor/github.com/google/go-github/v27/LICENSE deleted file mode 100644 index 28b6486f0b8e..000000000000 --- a/vendor/github.com/google/go-github/v27/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2013 The go-github 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/github.com/google/go-github/v27/github/activity.go b/vendor/github.com/google/go-github/v27/github/activity.go deleted file mode 100644 index d6c992c7f507..000000000000 --- a/vendor/github.com/google/go-github/v27/github/activity.go +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2013 The go-github 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 - -import "context" - -// ActivityService handles communication with the activity related -// methods of the GitHub API. -// -// GitHub API docs: https://developer.github.com/v3/activity/ -type ActivityService service - -// FeedLink represents a link to a related resource. -type FeedLink struct { - HRef *string `json:"href,omitempty"` - Type *string `json:"type,omitempty"` -} - -// Feeds represents timeline resources in Atom format. -type Feeds struct { - TimelineURL *string `json:"timeline_url,omitempty"` - UserURL *string `json:"user_url,omitempty"` - CurrentUserPublicURL *string `json:"current_user_public_url,omitempty"` - CurrentUserURL *string `json:"current_user_url,omitempty"` - CurrentUserActorURL *string `json:"current_user_actor_url,omitempty"` - CurrentUserOrganizationURL *string `json:"current_user_organization_url,omitempty"` - CurrentUserOrganizationURLs []string `json:"current_user_organization_urls,omitempty"` - Links *struct { - Timeline *FeedLink `json:"timeline,omitempty"` - User *FeedLink `json:"user,omitempty"` - CurrentUserPublic *FeedLink `json:"current_user_public,omitempty"` - CurrentUser *FeedLink `json:"current_user,omitempty"` - CurrentUserActor *FeedLink `json:"current_user_actor,omitempty"` - CurrentUserOrganization *FeedLink `json:"current_user_organization,omitempty"` - CurrentUserOrganizations []FeedLink `json:"current_user_organizations,omitempty"` - } `json:"_links,omitempty"` -} - -// ListFeeds lists all the feeds available to the authenticated user. -// -// GitHub provides several timeline resources in Atom format: -// Timeline: The GitHub global public timeline -// User: The public timeline for any user, using URI template -// Current user public: The public timeline for the authenticated user -// Current user: The private timeline for the authenticated user -// Current user actor: The private timeline for activity created by the -// authenticated user -// Current user organizations: The private timeline for the organizations -// the authenticated user is a member of. -// -// Note: Private feeds are only returned when authenticating via Basic Auth -// since current feed URIs use the older, non revocable auth tokens. -func (s *ActivityService) ListFeeds(ctx context.Context) (*Feeds, *Response, error) { - req, err := s.client.NewRequest("GET", "feeds", nil) - if err != nil { - return nil, nil, err - } - - f := &Feeds{} - resp, err := s.client.Do(ctx, req, f) - if err != nil { - return nil, resp, err - } - - return f, resp, nil -} diff --git a/vendor/github.com/google/go-github/v27/github/activity_events.go b/vendor/github.com/google/go-github/v27/github/activity_events.go deleted file mode 100644 index 1754b78e9da8..000000000000 --- a/vendor/github.com/google/go-github/v27/github/activity_events.go +++ /dev/null @@ -1,215 +0,0 @@ -// Copyright 2013 The go-github 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 - -import ( - "context" - "fmt" -) - -// ListEvents drinks from the firehose of all public events across GitHub. -// -// GitHub API docs: https://developer.github.com/v3/activity/events/#list-public-events -func (s *ActivityService) ListEvents(ctx context.Context, opt *ListOptions) ([]*Event, *Response, error) { - u, err := addOptions("events", opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var events []*Event - resp, err := s.client.Do(ctx, req, &events) - if err != nil { - return nil, resp, err - } - - return events, resp, nil -} - -// ListRepositoryEvents lists events for a repository. -// -// GitHub API docs: https://developer.github.com/v3/activity/events/#list-repository-events -func (s *ActivityService) ListRepositoryEvents(ctx context.Context, owner, repo string, opt *ListOptions) ([]*Event, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/events", owner, repo) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var events []*Event - resp, err := s.client.Do(ctx, req, &events) - if err != nil { - return nil, resp, err - } - - return events, resp, nil -} - -// ListIssueEventsForRepository lists issue events for a repository. -// -// GitHub API docs: https://developer.github.com/v3/activity/events/#list-issue-events-for-a-repository -func (s *ActivityService) ListIssueEventsForRepository(ctx context.Context, owner, repo string, opt *ListOptions) ([]*IssueEvent, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/events", owner, repo) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var events []*IssueEvent - resp, err := s.client.Do(ctx, req, &events) - if err != nil { - return nil, resp, err - } - - return events, resp, nil -} - -// ListEventsForRepoNetwork lists public events for a network of repositories. -// -// GitHub API docs: https://developer.github.com/v3/activity/events/#list-public-events-for-a-network-of-repositories -func (s *ActivityService) ListEventsForRepoNetwork(ctx context.Context, owner, repo string, opt *ListOptions) ([]*Event, *Response, error) { - u := fmt.Sprintf("networks/%v/%v/events", owner, repo) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var events []*Event - resp, err := s.client.Do(ctx, req, &events) - if err != nil { - return nil, resp, err - } - - return events, resp, nil -} - -// ListEventsForOrganization lists public events for an organization. -// -// GitHub API docs: https://developer.github.com/v3/activity/events/#list-public-events-for-an-organization -func (s *ActivityService) ListEventsForOrganization(ctx context.Context, org string, opt *ListOptions) ([]*Event, *Response, error) { - u := fmt.Sprintf("orgs/%v/events", org) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var events []*Event - resp, err := s.client.Do(ctx, req, &events) - if err != nil { - return nil, resp, err - } - - return events, resp, nil -} - -// ListEventsPerformedByUser lists the events performed by a user. If publicOnly is -// true, only public events will be returned. -// -// GitHub API docs: https://developer.github.com/v3/activity/events/#list-events-performed-by-a-user -func (s *ActivityService) ListEventsPerformedByUser(ctx context.Context, user string, publicOnly bool, opt *ListOptions) ([]*Event, *Response, error) { - var u string - if publicOnly { - u = fmt.Sprintf("users/%v/events/public", user) - } else { - u = fmt.Sprintf("users/%v/events", user) - } - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var events []*Event - resp, err := s.client.Do(ctx, req, &events) - if err != nil { - return nil, resp, err - } - - return events, resp, nil -} - -// ListEventsReceivedByUser lists the events received by a user. If publicOnly is -// true, only public events will be returned. -// -// GitHub API docs: https://developer.github.com/v3/activity/events/#list-events-that-a-user-has-received -func (s *ActivityService) ListEventsReceivedByUser(ctx context.Context, user string, publicOnly bool, opt *ListOptions) ([]*Event, *Response, error) { - var u string - if publicOnly { - u = fmt.Sprintf("users/%v/received_events/public", user) - } else { - u = fmt.Sprintf("users/%v/received_events", user) - } - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var events []*Event - resp, err := s.client.Do(ctx, req, &events) - if err != nil { - return nil, resp, err - } - - return events, resp, nil -} - -// ListUserEventsForOrganization provides the user’s organization dashboard. You -// must be authenticated as the user to view this. -// -// GitHub API docs: https://developer.github.com/v3/activity/events/#list-events-for-an-organization -func (s *ActivityService) ListUserEventsForOrganization(ctx context.Context, org, user string, opt *ListOptions) ([]*Event, *Response, error) { - u := fmt.Sprintf("users/%v/events/orgs/%v", user, org) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var events []*Event - resp, err := s.client.Do(ctx, req, &events) - if err != nil { - return nil, resp, err - } - - return events, resp, nil -} diff --git a/vendor/github.com/google/go-github/v27/github/activity_notifications.go b/vendor/github.com/google/go-github/v27/github/activity_notifications.go deleted file mode 100644 index 45c8b2aeced2..000000000000 --- a/vendor/github.com/google/go-github/v27/github/activity_notifications.go +++ /dev/null @@ -1,223 +0,0 @@ -// Copyright 2014 The go-github 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 - -import ( - "context" - "fmt" - "time" -) - -// Notification identifies a GitHub notification for a user. -type Notification struct { - ID *string `json:"id,omitempty"` - Repository *Repository `json:"repository,omitempty"` - Subject *NotificationSubject `json:"subject,omitempty"` - - // Reason identifies the event that triggered the notification. - // - // GitHub API docs: https://developer.github.com/v3/activity/notifications/#notification-reasons - Reason *string `json:"reason,omitempty"` - - Unread *bool `json:"unread,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` - LastReadAt *time.Time `json:"last_read_at,omitempty"` - URL *string `json:"url,omitempty"` -} - -// NotificationSubject identifies the subject of a notification. -type NotificationSubject struct { - Title *string `json:"title,omitempty"` - URL *string `json:"url,omitempty"` - LatestCommentURL *string `json:"latest_comment_url,omitempty"` - Type *string `json:"type,omitempty"` -} - -// NotificationListOptions specifies the optional parameters to the -// ActivityService.ListNotifications method. -type NotificationListOptions struct { - All bool `url:"all,omitempty"` - Participating bool `url:"participating,omitempty"` - Since time.Time `url:"since,omitempty"` - Before time.Time `url:"before,omitempty"` - - ListOptions -} - -// ListNotifications lists all notifications for the authenticated user. -// -// GitHub API docs: https://developer.github.com/v3/activity/notifications/#list-your-notifications -func (s *ActivityService) ListNotifications(ctx context.Context, opt *NotificationListOptions) ([]*Notification, *Response, error) { - u := fmt.Sprintf("notifications") - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var notifications []*Notification - resp, err := s.client.Do(ctx, req, ¬ifications) - if err != nil { - return nil, resp, err - } - - return notifications, resp, nil -} - -// ListRepositoryNotifications lists all notifications in a given repository -// for the authenticated user. -// -// GitHub API docs: https://developer.github.com/v3/activity/notifications/#list-your-notifications-in-a-repository -func (s *ActivityService) ListRepositoryNotifications(ctx context.Context, owner, repo string, opt *NotificationListOptions) ([]*Notification, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/notifications", owner, repo) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var notifications []*Notification - resp, err := s.client.Do(ctx, req, ¬ifications) - if err != nil { - return nil, resp, err - } - - return notifications, resp, nil -} - -type markReadOptions struct { - LastReadAt time.Time `json:"last_read_at,omitempty"` -} - -// MarkNotificationsRead marks all notifications up to lastRead as read. -// -// GitHub API docs: https://developer.github.com/v3/activity/notifications/#mark-as-read -func (s *ActivityService) MarkNotificationsRead(ctx context.Context, lastRead time.Time) (*Response, error) { - opts := &markReadOptions{ - LastReadAt: lastRead, - } - req, err := s.client.NewRequest("PUT", "notifications", opts) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} - -// MarkRepositoryNotificationsRead marks all notifications up to lastRead in -// the specified repository as read. -// -// GitHub API docs: https://developer.github.com/v3/activity/notifications/#mark-notifications-as-read-in-a-repository -func (s *ActivityService) MarkRepositoryNotificationsRead(ctx context.Context, owner, repo string, lastRead time.Time) (*Response, error) { - opts := &markReadOptions{ - LastReadAt: lastRead, - } - u := fmt.Sprintf("repos/%v/%v/notifications", owner, repo) - req, err := s.client.NewRequest("PUT", u, opts) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} - -// GetThread gets the specified notification thread. -// -// GitHub API docs: https://developer.github.com/v3/activity/notifications/#view-a-single-thread -func (s *ActivityService) GetThread(ctx context.Context, id string) (*Notification, *Response, error) { - u := fmt.Sprintf("notifications/threads/%v", id) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - notification := new(Notification) - resp, err := s.client.Do(ctx, req, notification) - if err != nil { - return nil, resp, err - } - - return notification, resp, nil -} - -// MarkThreadRead marks the specified thread as read. -// -// GitHub API docs: https://developer.github.com/v3/activity/notifications/#mark-a-thread-as-read -func (s *ActivityService) MarkThreadRead(ctx context.Context, id string) (*Response, error) { - u := fmt.Sprintf("notifications/threads/%v", id) - - req, err := s.client.NewRequest("PATCH", u, nil) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} - -// GetThreadSubscription checks to see if the authenticated user is subscribed -// to a thread. -// -// GitHub API docs: https://developer.github.com/v3/activity/notifications/#get-a-thread-subscription -func (s *ActivityService) GetThreadSubscription(ctx context.Context, id string) (*Subscription, *Response, error) { - u := fmt.Sprintf("notifications/threads/%v/subscription", id) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - sub := new(Subscription) - resp, err := s.client.Do(ctx, req, sub) - if err != nil { - return nil, resp, err - } - - return sub, resp, nil -} - -// SetThreadSubscription sets the subscription for the specified thread for the -// authenticated user. -// -// GitHub API docs: https://developer.github.com/v3/activity/notifications/#set-a-thread-subscription -func (s *ActivityService) SetThreadSubscription(ctx context.Context, id string, subscription *Subscription) (*Subscription, *Response, error) { - u := fmt.Sprintf("notifications/threads/%v/subscription", id) - - req, err := s.client.NewRequest("PUT", u, subscription) - if err != nil { - return nil, nil, err - } - - sub := new(Subscription) - resp, err := s.client.Do(ctx, req, sub) - if err != nil { - return nil, resp, err - } - - return sub, resp, nil -} - -// DeleteThreadSubscription deletes the subscription for the specified thread -// for the authenticated user. -// -// GitHub API docs: https://developer.github.com/v3/activity/notifications/#delete-a-thread-subscription -func (s *ActivityService) DeleteThreadSubscription(ctx context.Context, id string) (*Response, error) { - u := fmt.Sprintf("notifications/threads/%v/subscription", id) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} diff --git a/vendor/github.com/google/go-github/v27/github/activity_star.go b/vendor/github.com/google/go-github/v27/github/activity_star.go deleted file mode 100644 index 5ae5c101651f..000000000000 --- a/vendor/github.com/google/go-github/v27/github/activity_star.go +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright 2013 The go-github 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 - -import ( - "context" - "fmt" - "strings" -) - -// StarredRepository is returned by ListStarred. -type StarredRepository struct { - StarredAt *Timestamp `json:"starred_at,omitempty"` - Repository *Repository `json:"repo,omitempty"` -} - -// Stargazer represents a user that has starred a repository. -type Stargazer struct { - StarredAt *Timestamp `json:"starred_at,omitempty"` - User *User `json:"user,omitempty"` -} - -// ListStargazers lists people who have starred the specified repo. -// -// GitHub API docs: https://developer.github.com/v3/activity/starring/#list-stargazers -func (s *ActivityService) ListStargazers(ctx context.Context, owner, repo string, opt *ListOptions) ([]*Stargazer, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/stargazers", owner, repo) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches - req.Header.Set("Accept", mediaTypeStarringPreview) - - var stargazers []*Stargazer - resp, err := s.client.Do(ctx, req, &stargazers) - if err != nil { - return nil, resp, err - } - - return stargazers, resp, nil -} - -// ActivityListStarredOptions specifies the optional parameters to the -// ActivityService.ListStarred method. -type ActivityListStarredOptions struct { - // How to sort the repository list. Possible values are: created, updated, - // pushed, full_name. Default is "full_name". - Sort string `url:"sort,omitempty"` - - // Direction in which to sort repositories. Possible values are: asc, desc. - // Default is "asc" when sort is "full_name", otherwise default is "desc". - Direction string `url:"direction,omitempty"` - - ListOptions -} - -// ListStarred lists all the repos starred by a user. Passing the empty string -// will list the starred repositories for the authenticated user. -// -// GitHub API docs: https://developer.github.com/v3/activity/starring/#list-repositories-being-starred -func (s *ActivityService) ListStarred(ctx context.Context, user string, opt *ActivityListStarredOptions) ([]*StarredRepository, *Response, error) { - var u string - if user != "" { - u = fmt.Sprintf("users/%v/starred", user) - } else { - u = "user/starred" - } - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when APIs fully launch - acceptHeaders := []string{mediaTypeStarringPreview, mediaTypeTopicsPreview} - req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - - var repos []*StarredRepository - resp, err := s.client.Do(ctx, req, &repos) - if err != nil { - return nil, resp, err - } - - return repos, resp, nil -} - -// IsStarred checks if a repository is starred by authenticated user. -// -// GitHub API docs: https://developer.github.com/v3/activity/starring/#check-if-you-are-starring-a-repository -func (s *ActivityService) IsStarred(ctx context.Context, owner, repo string) (bool, *Response, error) { - u := fmt.Sprintf("user/starred/%v/%v", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return false, nil, err - } - resp, err := s.client.Do(ctx, req, nil) - starred, err := parseBoolResponse(err) - return starred, resp, err -} - -// Star a repository as the authenticated user. -// -// GitHub API docs: https://developer.github.com/v3/activity/starring/#star-a-repository -func (s *ActivityService) Star(ctx context.Context, owner, repo string) (*Response, error) { - u := fmt.Sprintf("user/starred/%v/%v", owner, repo) - req, err := s.client.NewRequest("PUT", u, nil) - if err != nil { - return nil, err - } - return s.client.Do(ctx, req, nil) -} - -// Unstar a repository as the authenticated user. -// -// GitHub API docs: https://developer.github.com/v3/activity/starring/#unstar-a-repository -func (s *ActivityService) Unstar(ctx context.Context, owner, repo string) (*Response, error) { - u := fmt.Sprintf("user/starred/%v/%v", owner, repo) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - return s.client.Do(ctx, req, nil) -} diff --git a/vendor/github.com/google/go-github/v27/github/activity_watching.go b/vendor/github.com/google/go-github/v27/github/activity_watching.go deleted file mode 100644 index c749ca86e7c2..000000000000 --- a/vendor/github.com/google/go-github/v27/github/activity_watching.go +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright 2014 The go-github 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 - -import ( - "context" - "fmt" -) - -// Subscription identifies a repository or thread subscription. -type Subscription struct { - Subscribed *bool `json:"subscribed,omitempty"` - Ignored *bool `json:"ignored,omitempty"` - Reason *string `json:"reason,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - URL *string `json:"url,omitempty"` - - // only populated for repository subscriptions - RepositoryURL *string `json:"repository_url,omitempty"` - - // only populated for thread subscriptions - ThreadURL *string `json:"thread_url,omitempty"` -} - -// ListWatchers lists watchers of a particular repo. -// -// GitHub API docs: https://developer.github.com/v3/activity/watching/#list-watchers -func (s *ActivityService) ListWatchers(ctx context.Context, owner, repo string, opt *ListOptions) ([]*User, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/subscribers", owner, repo) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var watchers []*User - resp, err := s.client.Do(ctx, req, &watchers) - if err != nil { - return nil, resp, err - } - - return watchers, resp, nil -} - -// ListWatched lists the repositories the specified user is watching. Passing -// the empty string will fetch watched repos for the authenticated user. -// -// GitHub API docs: https://developer.github.com/v3/activity/watching/#list-repositories-being-watched -func (s *ActivityService) ListWatched(ctx context.Context, user string, opt *ListOptions) ([]*Repository, *Response, error) { - var u string - if user != "" { - u = fmt.Sprintf("users/%v/subscriptions", user) - } else { - u = "user/subscriptions" - } - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var watched []*Repository - resp, err := s.client.Do(ctx, req, &watched) - if err != nil { - return nil, resp, err - } - - return watched, resp, nil -} - -// GetRepositorySubscription returns the subscription for the specified -// repository for the authenticated user. If the authenticated user is not -// watching the repository, a nil Subscription is returned. -// -// GitHub API docs: https://developer.github.com/v3/activity/watching/#get-a-repository-subscription -func (s *ActivityService) GetRepositorySubscription(ctx context.Context, owner, repo string) (*Subscription, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/subscription", owner, repo) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - sub := new(Subscription) - resp, err := s.client.Do(ctx, req, sub) - if err != nil { - // if it's just a 404, don't return that as an error - _, err = parseBoolResponse(err) - return nil, resp, err - } - - return sub, resp, nil -} - -// SetRepositorySubscription sets the subscription for the specified repository -// for the authenticated user. -// -// To watch a repository, set subscription.Subscribed to true. -// To ignore notifications made within a repository, set subscription.Ignored to true. -// To stop watching a repository, use DeleteRepositorySubscription. -// -// GitHub API docs: https://developer.github.com/v3/activity/watching/#set-a-repository-subscription -func (s *ActivityService) SetRepositorySubscription(ctx context.Context, owner, repo string, subscription *Subscription) (*Subscription, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/subscription", owner, repo) - - req, err := s.client.NewRequest("PUT", u, subscription) - if err != nil { - return nil, nil, err - } - - sub := new(Subscription) - resp, err := s.client.Do(ctx, req, sub) - if err != nil { - return nil, resp, err - } - - return sub, resp, nil -} - -// DeleteRepositorySubscription deletes the subscription for the specified -// repository for the authenticated user. -// -// This is used to stop watching a repository. To control whether or not to -// receive notifications from a repository, use SetRepositorySubscription. -// -// GitHub API docs: https://developer.github.com/v3/activity/watching/#delete-a-repository-subscription -func (s *ActivityService) DeleteRepositorySubscription(ctx context.Context, owner, repo string) (*Response, error) { - u := fmt.Sprintf("repos/%s/%s/subscription", owner, repo) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} diff --git a/vendor/github.com/google/go-github/v27/github/admin.go b/vendor/github.com/google/go-github/v27/github/admin.go deleted file mode 100644 index 2d96733a1c7c..000000000000 --- a/vendor/github.com/google/go-github/v27/github/admin.go +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright 2016 The go-github 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 - -import ( - "context" - "fmt" -) - -// AdminService handles communication with the admin related methods of the -// GitHub API. These API routes are normally only accessible for GitHub -// Enterprise installations. -// -// GitHub API docs: https://developer.github.com/v3/enterprise/ -type AdminService service - -// TeamLDAPMapping represents the mapping between a GitHub team and an LDAP group. -type TeamLDAPMapping struct { - ID *int64 `json:"id,omitempty"` - LDAPDN *string `json:"ldap_dn,omitempty"` - URL *string `json:"url,omitempty"` - Name *string `json:"name,omitempty"` - Slug *string `json:"slug,omitempty"` - Description *string `json:"description,omitempty"` - Privacy *string `json:"privacy,omitempty"` - Permission *string `json:"permission,omitempty"` - - MembersURL *string `json:"members_url,omitempty"` - RepositoriesURL *string `json:"repositories_url,omitempty"` -} - -func (m TeamLDAPMapping) String() string { - return Stringify(m) -} - -// UserLDAPMapping represents the mapping between a GitHub user and an LDAP user. -type UserLDAPMapping struct { - ID *int64 `json:"id,omitempty"` - LDAPDN *string `json:"ldap_dn,omitempty"` - Login *string `json:"login,omitempty"` - AvatarURL *string `json:"avatar_url,omitempty"` - GravatarID *string `json:"gravatar_id,omitempty"` - Type *string `json:"type,omitempty"` - SiteAdmin *bool `json:"site_admin,omitempty"` - - URL *string `json:"url,omitempty"` - EventsURL *string `json:"events_url,omitempty"` - FollowingURL *string `json:"following_url,omitempty"` - FollowersURL *string `json:"followers_url,omitempty"` - GistsURL *string `json:"gists_url,omitempty"` - OrganizationsURL *string `json:"organizations_url,omitempty"` - ReceivedEventsURL *string `json:"received_events_url,omitempty"` - ReposURL *string `json:"repos_url,omitempty"` - StarredURL *string `json:"starred_url,omitempty"` - SubscriptionsURL *string `json:"subscriptions_url,omitempty"` -} - -func (m UserLDAPMapping) String() string { - return Stringify(m) -} - -// UpdateUserLDAPMapping updates the mapping between a GitHub user and an LDAP user. -// -// GitHub API docs: https://developer.github.com/v3/enterprise/ldap/#update-ldap-mapping-for-a-user -func (s *AdminService) UpdateUserLDAPMapping(ctx context.Context, user string, mapping *UserLDAPMapping) (*UserLDAPMapping, *Response, error) { - u := fmt.Sprintf("admin/ldap/users/%v/mapping", user) - req, err := s.client.NewRequest("PATCH", u, mapping) - if err != nil { - return nil, nil, err - } - - m := new(UserLDAPMapping) - resp, err := s.client.Do(ctx, req, m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// UpdateTeamLDAPMapping updates the mapping between a GitHub team and an LDAP group. -// -// GitHub API docs: https://developer.github.com/v3/enterprise/ldap/#update-ldap-mapping-for-a-team -func (s *AdminService) UpdateTeamLDAPMapping(ctx context.Context, team int64, mapping *TeamLDAPMapping) (*TeamLDAPMapping, *Response, error) { - u := fmt.Sprintf("admin/ldap/teams/%v/mapping", team) - req, err := s.client.NewRequest("PATCH", u, mapping) - if err != nil { - return nil, nil, err - } - - m := new(TeamLDAPMapping) - resp, err := s.client.Do(ctx, req, m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} diff --git a/vendor/github.com/google/go-github/v27/github/admin_orgs.go b/vendor/github.com/google/go-github/v27/github/admin_orgs.go deleted file mode 100644 index f063831085bd..000000000000 --- a/vendor/github.com/google/go-github/v27/github/admin_orgs.go +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2019 The go-github 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 - -import "context" - -// createOrgRequest is a subset of Organization and is used internally -// by CreateOrg to pass only the known fields for the endpoint. -type createOrgRequest struct { - Login *string `json:"login,omitempty"` - Admin *string `json:"admin,omitempty"` -} - -// CreateOrg creates a new organization in GitHub Enterprise. -// -// Note that only a subset of the org fields are used and org must -// not be nil. -// -// GitHub Enterprise API docs: https://developer.github.com/enterprise/v3/enterprise-admin/orgs/#create-an-organization -func (s *AdminService) CreateOrg(ctx context.Context, org *Organization, admin string) (*Organization, *Response, error) { - u := "admin/organizations" - - orgReq := &createOrgRequest{ - Login: org.Login, - Admin: &admin, - } - - req, err := s.client.NewRequest("POST", u, orgReq) - if err != nil { - return nil, nil, err - } - - o := new(Organization) - resp, err := s.client.Do(ctx, req, o) - if err != nil { - return nil, resp, err - } - - return o, resp, nil -} diff --git a/vendor/github.com/google/go-github/v27/github/admin_stats.go b/vendor/github.com/google/go-github/v27/github/admin_stats.go deleted file mode 100644 index dabefde3e7b4..000000000000 --- a/vendor/github.com/google/go-github/v27/github/admin_stats.go +++ /dev/null @@ -1,171 +0,0 @@ -// Copyright 2017 The go-github 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 - -import ( - "context" - "fmt" -) - -// AdminStats represents a variety of stats of a GitHub Enterprise -// installation. -type AdminStats struct { - Issues *IssueStats `json:"issues,omitempty"` - Hooks *HookStats `json:"hooks,omitempty"` - Milestones *MilestoneStats `json:"milestones,omitempty"` - Orgs *OrgStats `json:"orgs,omitempty"` - Comments *CommentStats `json:"comments,omitempty"` - Pages *PageStats `json:"pages,omitempty"` - Users *UserStats `json:"users,omitempty"` - Gists *GistStats `json:"gists,omitempty"` - Pulls *PullStats `json:"pulls,omitempty"` - Repos *RepoStats `json:"repos,omitempty"` -} - -func (s AdminStats) String() string { - return Stringify(s) -} - -// IssueStats represents the number of total, open and closed issues. -type IssueStats struct { - TotalIssues *int `json:"total_issues,omitempty"` - OpenIssues *int `json:"open_issues,omitempty"` - ClosedIssues *int `json:"closed_issues,omitempty"` -} - -func (s IssueStats) String() string { - return Stringify(s) -} - -// HookStats represents the number of total, active and inactive hooks. -type HookStats struct { - TotalHooks *int `json:"total_hooks,omitempty"` - ActiveHooks *int `json:"active_hooks,omitempty"` - InactiveHooks *int `json:"inactive_hooks,omitempty"` -} - -func (s HookStats) String() string { - return Stringify(s) -} - -// MilestoneStats represents the number of total, open and close milestones. -type MilestoneStats struct { - TotalMilestones *int `json:"total_milestones,omitempty"` - OpenMilestones *int `json:"open_milestones,omitempty"` - ClosedMilestones *int `json:"closed_milestones,omitempty"` -} - -func (s MilestoneStats) String() string { - return Stringify(s) -} - -// OrgStats represents the number of total, disabled organizations and the team -// and team member count. -type OrgStats struct { - TotalOrgs *int `json:"total_orgs,omitempty"` - DisabledOrgs *int `json:"disabled_orgs,omitempty"` - TotalTeams *int `json:"total_teams,omitempty"` - TotalTeamMembers *int `json:"total_team_members,omitempty"` -} - -func (s OrgStats) String() string { - return Stringify(s) -} - -// CommentStats represents the number of total comments on commits, gists, issues -// and pull requests. -type CommentStats struct { - TotalCommitComments *int `json:"total_commit_comments,omitempty"` - TotalGistComments *int `json:"total_gist_comments,omitempty"` - TotalIssueComments *int `json:"total_issue_comments,omitempty"` - TotalPullRequestComments *int `json:"total_pull_request_comments,omitempty"` -} - -func (s CommentStats) String() string { - return Stringify(s) -} - -// PageStats represents the total number of github pages. -type PageStats struct { - TotalPages *int `json:"total_pages,omitempty"` -} - -func (s PageStats) String() string { - return Stringify(s) -} - -// UserStats represents the number of total, admin and suspended users. -type UserStats struct { - TotalUsers *int `json:"total_users,omitempty"` - AdminUsers *int `json:"admin_users,omitempty"` - SuspendedUsers *int `json:"suspended_users,omitempty"` -} - -func (s UserStats) String() string { - return Stringify(s) -} - -// GistStats represents the number of total, private and public gists. -type GistStats struct { - TotalGists *int `json:"total_gists,omitempty"` - PrivateGists *int `json:"private_gists,omitempty"` - PublicGists *int `json:"public_gists,omitempty"` -} - -func (s GistStats) String() string { - return Stringify(s) -} - -// PullStats represents the number of total, merged, mergable and unmergeable -// pull-requests. -type PullStats struct { - TotalPulls *int `json:"total_pulls,omitempty"` - MergedPulls *int `json:"merged_pulls,omitempty"` - MergablePulls *int `json:"mergeable_pulls,omitempty"` - UnmergablePulls *int `json:"unmergeable_pulls,omitempty"` -} - -func (s PullStats) String() string { - return Stringify(s) -} - -// RepoStats represents the number of total, root, fork, organization repositories -// together with the total number of pushes and wikis. -type RepoStats struct { - TotalRepos *int `json:"total_repos,omitempty"` - RootRepos *int `json:"root_repos,omitempty"` - ForkRepos *int `json:"fork_repos,omitempty"` - OrgRepos *int `json:"org_repos,omitempty"` - TotalPushes *int `json:"total_pushes,omitempty"` - TotalWikis *int `json:"total_wikis,omitempty"` -} - -func (s RepoStats) String() string { - return Stringify(s) -} - -// GetAdminStats returns a variety of metrics about a GitHub Enterprise -// installation. -// -// Please note that this is only available to site administrators, -// otherwise it will error with a 404 not found (instead of 401 or 403). -// -// GitHub API docs: https://developer.github.com/v3/enterprise-admin/admin_stats/ -func (s *AdminService) GetAdminStats(ctx context.Context) (*AdminStats, *Response, error) { - u := fmt.Sprintf("enterprise/stats/all") - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - m := new(AdminStats) - resp, err := s.client.Do(ctx, req, m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} diff --git a/vendor/github.com/google/go-github/v27/github/admin_users.go b/vendor/github.com/google/go-github/v27/github/admin_users.go deleted file mode 100644 index ea7a47d31cef..000000000000 --- a/vendor/github.com/google/go-github/v27/github/admin_users.go +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2019 The go-github 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 - -import ( - "context" -) - -// createUserRequest is a subset of User and is used internally -// by CreateUser to pass only the known fields for the endpoint. -type createUserRequest struct { - Login *string `json:"login,omitempty"` - Email *string `json:"email,omitempty"` -} - -// CreateUser creates a new user in GitHub Enterprise. -// -// GitHub Enterprise API docs: https://developer.github.com/enterprise/v3/enterprise-admin/users/#create-a-new-user -func (s *AdminService) CreateUser(ctx context.Context, login, email string) (*User, *Response, error) { - u := "admin/users" - - userReq := &createUserRequest{ - Login: &login, - Email: &email, - } - - req, err := s.client.NewRequest("POST", u, userReq) - if err != nil { - return nil, nil, err - } - - var user User - resp, err := s.client.Do(ctx, req, &user) - if err != nil { - return nil, resp, err - } - - return &user, resp, nil -} - -// DeleteUser deletes a user in GitHub Enterprise. -// -// GitHub Enterprise API docs: https://developer.github.com/enterprise/v3/enterprise-admin/users/#delete-a-user -func (s *AdminService) DeleteUser(ctx context.Context, username string) (*Response, error) { - u := "admin/users/" + username - - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - resp, err := s.client.Do(ctx, req, nil) - if err != nil { - return resp, err - } - - return resp, nil -} diff --git a/vendor/github.com/google/go-github/v27/github/apps.go b/vendor/github.com/google/go-github/v27/github/apps.go deleted file mode 100644 index f675a9abd183..000000000000 --- a/vendor/github.com/google/go-github/v27/github/apps.go +++ /dev/null @@ -1,284 +0,0 @@ -// Copyright 2016 The go-github 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 - -import ( - "context" - "fmt" - "time" -) - -// AppsService provides access to the installation related functions -// in the GitHub API. -// -// GitHub API docs: https://developer.github.com/v3/apps/ -type AppsService service - -// App represents a GitHub App. -type App struct { - ID *int64 `json:"id,omitempty"` - NodeID *string `json:"node_id,omitempty"` - Owner *User `json:"owner,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - ExternalURL *string `json:"external_url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` -} - -// InstallationToken represents an installation token. -type InstallationToken struct { - Token *string `json:"token,omitempty"` - ExpiresAt *time.Time `json:"expires_at,omitempty"` -} - -// InstallationPermissions lists the repository and organization permissions for an installation. -// -// Permission names taken from: -// https://developer.github.com/v3/apps/permissions/ -// https://developer.github.com/enterprise/v3/apps/permissions/ -type InstallationPermissions struct { - Administration *string `json:"administration,omitempty"` - Checks *string `json:"checks,omitempty"` - Contents *string `json:"contents,omitempty"` - ContentReferences *string `json:"content_references,omitempty"` - Deployments *string `json:"deployments,omitempty"` - Issues *string `json:"issues,omitempty"` - Metadata *string `json:"metadata,omitempty"` - Members *string `json:"members,omitempty"` - OrganizationAdministration *string `json:"organization_administration,omitempty"` - OrganizationHooks *string `json:"organization_hooks,omitempty"` - OrganizationPlan *string `json:"organization_plan,omitempty"` - OrganizationPreReceiveHooks *string `json:"organization_pre_receive_hooks,omitempty"` - OrganizationProjects *string `json:"organization_projects,omitempty"` - OrganizationUserBlocking *string `json:"organization_user_blocking,omitempty"` - Packages *string `json:"packages,omitempty"` - Pages *string `json:"pages,omitempty"` - PullRequests *string `json:"pull_requests,omitempty"` - RepositoryHooks *string `json:"repository_hooks,omitempty"` - RepositoryProjects *string `json:"repository_projects,omitempty"` - RepositoryPreReceiveHooks *string `json:"repository_pre_receive_hooks,omitempty"` - SingleFile *string `json:"single_file,omitempty"` - Statuses *string `json:"statuses,omitempty"` - TeamDiscussions *string `json:"team_discussions,omitempty"` - VulnerabilityAlerts *string `json:"vulnerability_alerts,omitempty"` -} - -// Installation represents a GitHub Apps installation. -type Installation struct { - ID *int64 `json:"id,omitempty"` - AppID *int64 `json:"app_id,omitempty"` - TargetID *int64 `json:"target_id,omitempty"` - Account *User `json:"account,omitempty"` - AccessTokensURL *string `json:"access_tokens_url,omitempty"` - RepositoriesURL *string `json:"repositories_url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - TargetType *string `json:"target_type,omitempty"` - SingleFileName *string `json:"single_file_name,omitempty"` - RepositorySelection *string `json:"repository_selection,omitempty"` - Events []string `json:"events,omitempty"` - Permissions *InstallationPermissions `json:"permissions,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` -} - -// Attachment represents a GitHub Apps attachment. -type Attachment struct { - ID *int64 `json:"id,omitempty"` - Title *string `json:"title,omitempty"` - Body *string `json:"body,omitempty"` -} - -func (i Installation) String() string { - return Stringify(i) -} - -// Get a single GitHub App. Passing the empty string will get -// the authenticated GitHub App. -// -// Note: appSlug is just the URL-friendly name of your GitHub App. -// You can find this on the settings page for your GitHub App -// (e.g., https://github.com/settings/apps/:app_slug). -// -// GitHub API docs: https://developer.github.com/v3/apps/#get-a-single-github-app -func (s *AppsService) Get(ctx context.Context, appSlug string) (*App, *Response, error) { - var u string - if appSlug != "" { - u = fmt.Sprintf("apps/%v", appSlug) - } else { - u = "app" - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeIntegrationPreview) - - app := new(App) - resp, err := s.client.Do(ctx, req, app) - if err != nil { - return nil, resp, err - } - - return app, resp, nil -} - -// ListInstallations lists the installations that the current GitHub App has. -// -// GitHub API docs: https://developer.github.com/v3/apps/#find-installations -func (s *AppsService) ListInstallations(ctx context.Context, opt *ListOptions) ([]*Installation, *Response, error) { - u, err := addOptions("app/installations", opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeIntegrationPreview) - - var i []*Installation - resp, err := s.client.Do(ctx, req, &i) - if err != nil { - return nil, resp, err - } - - return i, resp, nil -} - -// GetInstallation returns the specified installation. -// -// GitHub API docs: https://developer.github.com/v3/apps/#get-a-single-installation -func (s *AppsService) GetInstallation(ctx context.Context, id int64) (*Installation, *Response, error) { - return s.getInstallation(ctx, fmt.Sprintf("app/installations/%v", id)) -} - -// ListUserInstallations lists installations that are accessible to the authenticated user. -// -// GitHub API docs: https://developer.github.com/v3/apps/#list-installations-for-user -func (s *AppsService) ListUserInstallations(ctx context.Context, opt *ListOptions) ([]*Installation, *Response, error) { - u, err := addOptions("user/installations", opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeIntegrationPreview) - - var i struct { - Installations []*Installation `json:"installations"` - } - resp, err := s.client.Do(ctx, req, &i) - if err != nil { - return nil, resp, err - } - - return i.Installations, resp, nil -} - -// CreateInstallationToken creates a new installation token. -// -// GitHub API docs: https://developer.github.com/v3/apps/#create-a-new-installation-token -func (s *AppsService) CreateInstallationToken(ctx context.Context, id int64) (*InstallationToken, *Response, error) { - u := fmt.Sprintf("app/installations/%v/access_tokens", id) - - req, err := s.client.NewRequest("POST", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeIntegrationPreview) - - t := new(InstallationToken) - resp, err := s.client.Do(ctx, req, t) - if err != nil { - return nil, resp, err - } - - return t, resp, nil -} - -// Create a new attachment on user comment containing a url. -// -// GitHub API docs: https://developer.github.com/v3/apps/#create-a-content-attachment -func (s *AppsService) CreateAttachment(ctx context.Context, contentReferenceID int64, title, body string) (*Attachment, *Response, error) { - u := fmt.Sprintf("content_references/%v/attachments", contentReferenceID) - payload := &Attachment{Title: String(title), Body: String(body)} - req, err := s.client.NewRequest("POST", u, payload) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeReactionsPreview) - - m := &Attachment{} - resp, err := s.client.Do(ctx, req, m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// FindOrganizationInstallation finds the organization's installation information. -// -// GitHub API docs: https://developer.github.com/v3/apps/#find-organization-installation -func (s *AppsService) FindOrganizationInstallation(ctx context.Context, org string) (*Installation, *Response, error) { - return s.getInstallation(ctx, fmt.Sprintf("orgs/%v/installation", org)) -} - -// FindRepositoryInstallation finds the repository's installation information. -// -// GitHub API docs: https://developer.github.com/v3/apps/#find-repository-installation -func (s *AppsService) FindRepositoryInstallation(ctx context.Context, owner, repo string) (*Installation, *Response, error) { - return s.getInstallation(ctx, fmt.Sprintf("repos/%v/%v/installation", owner, repo)) -} - -// FindRepositoryInstallationByID finds the repository's installation information. -// -// Note: FindRepositoryInstallationByID uses the undocumented GitHub API endpoint /repositories/:id/installation. -func (s *AppsService) FindRepositoryInstallationByID(ctx context.Context, id int64) (*Installation, *Response, error) { - return s.getInstallation(ctx, fmt.Sprintf("repositories/%d/installation", id)) -} - -// FindUserInstallation finds the user's installation information. -// -// GitHub API docs: https://developer.github.com/v3/apps/#find-repository-installation -func (s *AppsService) FindUserInstallation(ctx context.Context, user string) (*Installation, *Response, error) { - return s.getInstallation(ctx, fmt.Sprintf("users/%v/installation", user)) -} - -func (s *AppsService) getInstallation(ctx context.Context, url string) (*Installation, *Response, error) { - req, err := s.client.NewRequest("GET", url, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeIntegrationPreview) - - i := new(Installation) - resp, err := s.client.Do(ctx, req, i) - if err != nil { - return nil, resp, err - } - - return i, resp, nil -} diff --git a/vendor/github.com/google/go-github/v27/github/apps_installation.go b/vendor/github.com/google/go-github/v27/github/apps_installation.go deleted file mode 100644 index 09d4043fe646..000000000000 --- a/vendor/github.com/google/go-github/v27/github/apps_installation.go +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright 2016 The go-github 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 - -import ( - "context" - "fmt" -) - -// ListRepos lists the repositories that are accessible to the authenticated installation. -// -// GitHub API docs: https://developer.github.com/v3/apps/installations/#list-repositories -func (s *AppsService) ListRepos(ctx context.Context, opt *ListOptions) ([]*Repository, *Response, error) { - u, err := addOptions("installation/repositories", opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeIntegrationPreview) - - var r struct { - Repositories []*Repository `json:"repositories"` - } - resp, err := s.client.Do(ctx, req, &r) - if err != nil { - return nil, resp, err - } - - return r.Repositories, resp, nil -} - -// ListUserRepos lists repositories that are accessible -// to the authenticated user for an installation. -// -// GitHub API docs: https://developer.github.com/v3/apps/installations/#list-repositories-accessible-to-the-user-for-an-installation -func (s *AppsService) ListUserRepos(ctx context.Context, id int64, opt *ListOptions) ([]*Repository, *Response, error) { - u := fmt.Sprintf("user/installations/%v/repositories", id) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeIntegrationPreview) - - var r struct { - Repositories []*Repository `json:"repositories"` - } - resp, err := s.client.Do(ctx, req, &r) - if err != nil { - return nil, resp, err - } - - return r.Repositories, resp, nil -} - -// AddRepository adds a single repository to an installation. -// -// GitHub API docs: https://developer.github.com/v3/apps/installations/#add-repository-to-installation -func (s *AppsService) AddRepository(ctx context.Context, instID, repoID int64) (*Repository, *Response, error) { - u := fmt.Sprintf("user/installations/%v/repositories/%v", instID, repoID) - req, err := s.client.NewRequest("PUT", u, nil) - if err != nil { - return nil, nil, err - } - req.Header.Set("Accept", mediaTypeIntegrationPreview) - - r := new(Repository) - resp, err := s.client.Do(ctx, req, r) - if err != nil { - return nil, resp, err - } - - return r, resp, nil -} - -// RemoveRepository removes a single repository from an installation. -// -// GitHub docs: https://developer.github.com/v3/apps/installations/#remove-repository-from-installation -func (s *AppsService) RemoveRepository(ctx context.Context, instID, repoID int64) (*Response, error) { - u := fmt.Sprintf("user/installations/%v/repositories/%v", instID, repoID) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - req.Header.Set("Accept", mediaTypeIntegrationPreview) - - return s.client.Do(ctx, req, nil) -} diff --git a/vendor/github.com/google/go-github/v27/github/apps_marketplace.go b/vendor/github.com/google/go-github/v27/github/apps_marketplace.go deleted file mode 100644 index 863ba934cbcb..000000000000 --- a/vendor/github.com/google/go-github/v27/github/apps_marketplace.go +++ /dev/null @@ -1,184 +0,0 @@ -// Copyright 2017 The go-github 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 - -import ( - "context" - "fmt" -) - -// MarketplaceService handles communication with the marketplace related -// methods of the GitHub API. -// -// GitHub API docs: https://developer.github.com/v3/apps/marketplace/ -type MarketplaceService struct { - client *Client - // Stubbed controls whether endpoints that return stubbed data are used - // instead of production endpoints. Stubbed data is fake data that's useful - // for testing your GitHub Apps. Stubbed data is hard-coded and will not - // change based on actual subscriptions. - // - // GitHub API docs: https://developer.github.com/v3/apps/marketplace/ - Stubbed bool -} - -// MarketplacePlan represents a GitHub Apps Marketplace Listing Plan. -type MarketplacePlan struct { - URL *string `json:"url,omitempty"` - AccountsURL *string `json:"accounts_url,omitempty"` - ID *int64 `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - MonthlyPriceInCents *int `json:"monthly_price_in_cents,omitempty"` - YearlyPriceInCents *int `json:"yearly_price_in_cents,omitempty"` - // The pricing model for this listing. Can be one of "flat-rate", "per-unit", or "free". - PriceModel *string `json:"price_model,omitempty"` - UnitName *string `json:"unit_name,omitempty"` - Bullets *[]string `json:"bullets,omitempty"` - // State can be one of the values "draft" or "published". - State *string `json:"state,omitempty"` - HasFreeTrial *bool `json:"has_free_trial,omitempty"` -} - -// MarketplacePurchase represents a GitHub Apps Marketplace Purchase. -type MarketplacePurchase struct { - // BillingCycle can be one of the values "yearly", "monthly" or nil. - BillingCycle *string `json:"billing_cycle,omitempty"` - NextBillingDate *Timestamp `json:"next_billing_date,omitempty"` - UnitCount *int `json:"unit_count,omitempty"` - Plan *MarketplacePlan `json:"plan,omitempty"` - Account *MarketplacePlanAccount `json:"account,omitempty"` - OnFreeTrial *bool `json:"on_free_trial,omitempty"` - FreeTrialEndsOn *Timestamp `json:"free_trial_ends_on,omitempty"` -} - -// MarketplacePendingChange represents a pending change to a GitHub Apps Marketplace Plan. -type MarketplacePendingChange struct { - EffectiveDate *Timestamp `json:"effective_date,omitempty"` - UnitCount *int `json:"unit_count,omitempty"` - ID *int64 `json:"id,omitempty"` - Plan *MarketplacePlan `json:"plan,omitempty"` -} - -// MarketplacePlanAccount represents a GitHub Account (user or organization) on a specific plan. -type MarketplacePlanAccount struct { - URL *string `json:"url,omitempty"` - Type *string `json:"type,omitempty"` - ID *int64 `json:"id,omitempty"` - NodeID *string `json:"node_id,omitempty"` - Login *string `json:"login,omitempty"` - Email *string `json:"email,omitempty"` - OrganizationBillingEmail *string `json:"organization_billing_email,omitempty"` - MarketplacePurchase *MarketplacePurchase `json:"marketplace_purchase,omitempty"` - MarketplacePendingChange *MarketplacePendingChange `json:"marketplace_pending_change,omitempty"` -} - -// ListPlans lists all plans for your Marketplace listing. -// -// GitHub API docs: https://developer.github.com/v3/apps/marketplace/#list-all-plans-for-your-marketplace-listing -func (s *MarketplaceService) ListPlans(ctx context.Context, opt *ListOptions) ([]*MarketplacePlan, *Response, error) { - uri := s.marketplaceURI("plans") - u, err := addOptions(uri, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var plans []*MarketplacePlan - resp, err := s.client.Do(ctx, req, &plans) - if err != nil { - return nil, resp, err - } - - return plans, resp, nil -} - -// ListPlanAccountsForPlan lists all GitHub accounts (user or organization) on a specific plan. -// -// GitHub API docs: https://developer.github.com/v3/apps/marketplace/#list-all-github-accounts-user-or-organization-on-a-specific-plan -func (s *MarketplaceService) ListPlanAccountsForPlan(ctx context.Context, planID int64, opt *ListOptions) ([]*MarketplacePlanAccount, *Response, error) { - uri := s.marketplaceURI(fmt.Sprintf("plans/%v/accounts", planID)) - u, err := addOptions(uri, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var accounts []*MarketplacePlanAccount - resp, err := s.client.Do(ctx, req, &accounts) - if err != nil { - return nil, resp, err - } - - return accounts, resp, nil -} - -// ListPlanAccountsForAccount lists all GitHub accounts (user or organization) associated with an account. -// -// GitHub API docs: https://developer.github.com/v3/apps/marketplace/#check-if-a-github-account-is-associated-with-any-marketplace-listing -func (s *MarketplaceService) ListPlanAccountsForAccount(ctx context.Context, accountID int64, opt *ListOptions) ([]*MarketplacePlanAccount, *Response, error) { - uri := s.marketplaceURI(fmt.Sprintf("accounts/%v", accountID)) - u, err := addOptions(uri, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var accounts []*MarketplacePlanAccount - resp, err := s.client.Do(ctx, req, &accounts) - if err != nil { - return nil, resp, err - } - - return accounts, resp, nil -} - -// ListMarketplacePurchasesForUser lists all GitHub marketplace purchases made by a user. -// -// GitHub API docs: https://developer.github.com/v3/apps/marketplace/#get-a-users-marketplace-purchases -func (s *MarketplaceService) ListMarketplacePurchasesForUser(ctx context.Context, opt *ListOptions) ([]*MarketplacePurchase, *Response, error) { - uri := "user/marketplace_purchases" - if s.Stubbed { - uri = "user/marketplace_purchases/stubbed" - } - - u, err := addOptions(uri, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var purchases []*MarketplacePurchase - resp, err := s.client.Do(ctx, req, &purchases) - if err != nil { - return nil, resp, err - } - return purchases, resp, nil -} - -func (s *MarketplaceService) marketplaceURI(endpoint string) string { - url := "marketplace_listing" - if s.Stubbed { - url = "marketplace_listing/stubbed" - } - return url + "/" + endpoint -} diff --git a/vendor/github.com/google/go-github/v27/github/authorizations.go b/vendor/github.com/google/go-github/v27/github/authorizations.go deleted file mode 100644 index 8ad14328e94b..000000000000 --- a/vendor/github.com/google/go-github/v27/github/authorizations.go +++ /dev/null @@ -1,435 +0,0 @@ -// Copyright 2015 The go-github 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 - -import ( - "context" - "fmt" -) - -// Scope models a GitHub authorization scope. -// -// GitHub API docs: https://developer.github.com/v3/oauth/#scopes -type Scope string - -// This is the set of scopes for GitHub API V3 -const ( - ScopeNone Scope = "(no scope)" // REVISIT: is this actually returned, or just a documentation artifact? - ScopeUser Scope = "user" - ScopeUserEmail Scope = "user:email" - ScopeUserFollow Scope = "user:follow" - ScopePublicRepo Scope = "public_repo" - ScopeRepo Scope = "repo" - ScopeRepoDeployment Scope = "repo_deployment" - ScopeRepoStatus Scope = "repo:status" - ScopeDeleteRepo Scope = "delete_repo" - ScopeNotifications Scope = "notifications" - ScopeGist Scope = "gist" - ScopeReadRepoHook Scope = "read:repo_hook" - ScopeWriteRepoHook Scope = "write:repo_hook" - ScopeAdminRepoHook Scope = "admin:repo_hook" - ScopeAdminOrgHook Scope = "admin:org_hook" - ScopeReadOrg Scope = "read:org" - ScopeWriteOrg Scope = "write:org" - ScopeAdminOrg Scope = "admin:org" - ScopeReadPublicKey Scope = "read:public_key" - ScopeWritePublicKey Scope = "write:public_key" - ScopeAdminPublicKey Scope = "admin:public_key" - ScopeReadGPGKey Scope = "read:gpg_key" - ScopeWriteGPGKey Scope = "write:gpg_key" - ScopeAdminGPGKey Scope = "admin:gpg_key" -) - -// AuthorizationsService handles communication with the authorization related -// methods of the GitHub API. -// -// This service requires HTTP Basic Authentication; it cannot be accessed using -// an OAuth token. -// -// GitHub API docs: https://developer.github.com/v3/oauth_authorizations/ -type AuthorizationsService service - -// Authorization represents an individual GitHub authorization. -type Authorization struct { - ID *int64 `json:"id,omitempty"` - URL *string `json:"url,omitempty"` - Scopes []Scope `json:"scopes,omitempty"` - Token *string `json:"token,omitempty"` - TokenLastEight *string `json:"token_last_eight,omitempty"` - HashedToken *string `json:"hashed_token,omitempty"` - App *AuthorizationApp `json:"app,omitempty"` - Note *string `json:"note,omitempty"` - NoteURL *string `json:"note_url,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - Fingerprint *string `json:"fingerprint,omitempty"` - - // User is only populated by the Check and Reset methods. - User *User `json:"user,omitempty"` -} - -func (a Authorization) String() string { - return Stringify(a) -} - -// AuthorizationApp represents an individual GitHub app (in the context of authorization). -type AuthorizationApp struct { - URL *string `json:"url,omitempty"` - Name *string `json:"name,omitempty"` - ClientID *string `json:"client_id,omitempty"` -} - -func (a AuthorizationApp) String() string { - return Stringify(a) -} - -// Grant represents an OAuth application that has been granted access to an account. -type Grant struct { - ID *int64 `json:"id,omitempty"` - URL *string `json:"url,omitempty"` - App *AuthorizationApp `json:"app,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - Scopes []string `json:"scopes,omitempty"` -} - -func (g Grant) String() string { - return Stringify(g) -} - -// AuthorizationRequest represents a request to create an authorization. -type AuthorizationRequest struct { - Scopes []Scope `json:"scopes,omitempty"` - Note *string `json:"note,omitempty"` - NoteURL *string `json:"note_url,omitempty"` - ClientID *string `json:"client_id,omitempty"` - ClientSecret *string `json:"client_secret,omitempty"` - Fingerprint *string `json:"fingerprint,omitempty"` -} - -func (a AuthorizationRequest) String() string { - return Stringify(a) -} - -// AuthorizationUpdateRequest represents a request to update an authorization. -// -// Note that for any one update, you must only provide one of the "scopes" -// fields. That is, you may provide only one of "Scopes", or "AddScopes", or -// "RemoveScopes". -// -// GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#update-an-existing-authorization -type AuthorizationUpdateRequest struct { - Scopes []string `json:"scopes,omitempty"` - AddScopes []string `json:"add_scopes,omitempty"` - RemoveScopes []string `json:"remove_scopes,omitempty"` - Note *string `json:"note,omitempty"` - NoteURL *string `json:"note_url,omitempty"` - Fingerprint *string `json:"fingerprint,omitempty"` -} - -func (a AuthorizationUpdateRequest) String() string { - return Stringify(a) -} - -// List the authorizations for the authenticated user. -// -// GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#list-your-authorizations -func (s *AuthorizationsService) List(ctx context.Context, opt *ListOptions) ([]*Authorization, *Response, error) { - u := "authorizations" - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var auths []*Authorization - resp, err := s.client.Do(ctx, req, &auths) - if err != nil { - return nil, resp, err - } - return auths, resp, nil -} - -// Get a single authorization. -// -// GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#get-a-single-authorization -func (s *AuthorizationsService) Get(ctx context.Context, id int64) (*Authorization, *Response, error) { - u := fmt.Sprintf("authorizations/%d", id) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - a := new(Authorization) - resp, err := s.client.Do(ctx, req, a) - if err != nil { - return nil, resp, err - } - return a, resp, nil -} - -// Create a new authorization for the specified OAuth application. -// -// GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#create-a-new-authorization -func (s *AuthorizationsService) Create(ctx context.Context, auth *AuthorizationRequest) (*Authorization, *Response, error) { - u := "authorizations" - - req, err := s.client.NewRequest("POST", u, auth) - if err != nil { - return nil, nil, err - } - - a := new(Authorization) - resp, err := s.client.Do(ctx, req, a) - if err != nil { - return nil, resp, err - } - return a, resp, nil -} - -// GetOrCreateForApp creates a new authorization for the specified OAuth -// application, only if an authorization for that application doesn’t already -// exist for the user. -// -// If a new token is created, the HTTP status code will be "201 Created", and -// the returned Authorization.Token field will be populated. If an existing -// token is returned, the status code will be "200 OK" and the -// Authorization.Token field will be empty. -// -// clientID is the OAuth Client ID with which to create the token. -// -// GitHub API docs: -// https://developer.github.com/v3/oauth_authorizations/#get-or-create-an-authorization-for-a-specific-app -// https://developer.github.com/v3/oauth_authorizations/#get-or-create-an-authorization-for-a-specific-app-and-fingerprint -func (s *AuthorizationsService) GetOrCreateForApp(ctx context.Context, clientID string, auth *AuthorizationRequest) (*Authorization, *Response, error) { - var u string - if auth.Fingerprint == nil || *auth.Fingerprint == "" { - u = fmt.Sprintf("authorizations/clients/%v", clientID) - } else { - u = fmt.Sprintf("authorizations/clients/%v/%v", clientID, *auth.Fingerprint) - } - - req, err := s.client.NewRequest("PUT", u, auth) - if err != nil { - return nil, nil, err - } - - a := new(Authorization) - resp, err := s.client.Do(ctx, req, a) - if err != nil { - return nil, resp, err - } - - return a, resp, nil -} - -// Edit a single authorization. -// -// GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#update-an-existing-authorization -func (s *AuthorizationsService) Edit(ctx context.Context, id int64, auth *AuthorizationUpdateRequest) (*Authorization, *Response, error) { - u := fmt.Sprintf("authorizations/%d", id) - - req, err := s.client.NewRequest("PATCH", u, auth) - if err != nil { - return nil, nil, err - } - - a := new(Authorization) - resp, err := s.client.Do(ctx, req, a) - if err != nil { - return nil, resp, err - } - - return a, resp, nil -} - -// Delete a single authorization. -// -// GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#delete-an-authorization -func (s *AuthorizationsService) Delete(ctx context.Context, id int64) (*Response, error) { - u := fmt.Sprintf("authorizations/%d", id) - - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} - -// Check if an OAuth token is valid for a specific app. -// -// Note that this operation requires the use of BasicAuth, but where the -// username is the OAuth application clientID, and the password is its -// clientSecret. Invalid tokens will return a 404 Not Found. -// -// The returned Authorization.User field will be populated. -// -// GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#check-an-authorization -func (s *AuthorizationsService) Check(ctx context.Context, clientID string, token string) (*Authorization, *Response, error) { - u := fmt.Sprintf("applications/%v/tokens/%v", clientID, token) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - a := new(Authorization) - resp, err := s.client.Do(ctx, req, a) - if err != nil { - return nil, resp, err - } - - return a, resp, nil -} - -// Reset is used to reset a valid OAuth token without end user involvement. -// Applications must save the "token" property in the response, because changes -// take effect immediately. -// -// Note that this operation requires the use of BasicAuth, but where the -// username is the OAuth application clientID, and the password is its -// clientSecret. Invalid tokens will return a 404 Not Found. -// -// The returned Authorization.User field will be populated. -// -// GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#reset-an-authorization -func (s *AuthorizationsService) Reset(ctx context.Context, clientID string, token string) (*Authorization, *Response, error) { - u := fmt.Sprintf("applications/%v/tokens/%v", clientID, token) - - req, err := s.client.NewRequest("POST", u, nil) - if err != nil { - return nil, nil, err - } - - a := new(Authorization) - resp, err := s.client.Do(ctx, req, a) - if err != nil { - return nil, resp, err - } - - return a, resp, nil -} - -// Revoke an authorization for an application. -// -// Note that this operation requires the use of BasicAuth, but where the -// username is the OAuth application clientID, and the password is its -// clientSecret. Invalid tokens will return a 404 Not Found. -// -// GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#revoke-an-authorization-for-an-application -func (s *AuthorizationsService) Revoke(ctx context.Context, clientID string, token string) (*Response, error) { - u := fmt.Sprintf("applications/%v/tokens/%v", clientID, token) - - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} - -// ListGrants lists the set of OAuth applications that have been granted -// access to a user's account. This will return one entry for each application -// that has been granted access to the account, regardless of the number of -// tokens an application has generated for the user. -// -// GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#list-your-grants -func (s *AuthorizationsService) ListGrants(ctx context.Context, opt *ListOptions) ([]*Grant, *Response, error) { - u, err := addOptions("applications/grants", opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - grants := []*Grant{} - resp, err := s.client.Do(ctx, req, &grants) - if err != nil { - return nil, resp, err - } - - return grants, resp, nil -} - -// GetGrant gets a single OAuth application grant. -// -// GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#get-a-single-grant -func (s *AuthorizationsService) GetGrant(ctx context.Context, id int64) (*Grant, *Response, error) { - u := fmt.Sprintf("applications/grants/%d", id) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - grant := new(Grant) - resp, err := s.client.Do(ctx, req, grant) - if err != nil { - return nil, resp, err - } - - return grant, resp, nil -} - -// DeleteGrant deletes an OAuth application grant. Deleting an application's -// grant will also delete all OAuth tokens associated with the application for -// the user. -// -// GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#delete-a-grant -func (s *AuthorizationsService) DeleteGrant(ctx context.Context, id int64) (*Response, error) { - u := fmt.Sprintf("applications/grants/%d", id) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} - -// CreateImpersonation creates an impersonation OAuth token. -// -// This requires admin permissions. With the returned Authorization.Token -// you can e.g. create or delete a user's public SSH key. NOTE: creating a -// new token automatically revokes an existing one. -// -// GitHub API docs: https://developer.github.com/enterprise/v3/enterprise-admin/users/#create-an-impersonation-oauth-token -func (s *AuthorizationsService) CreateImpersonation(ctx context.Context, username string, authReq *AuthorizationRequest) (*Authorization, *Response, error) { - u := fmt.Sprintf("admin/users/%v/authorizations", username) - req, err := s.client.NewRequest("POST", u, authReq) - if err != nil { - return nil, nil, err - } - - a := new(Authorization) - resp, err := s.client.Do(ctx, req, a) - if err != nil { - return nil, resp, err - } - return a, resp, nil -} - -// DeleteImpersonation deletes an impersonation OAuth token. -// -// NOTE: there can be only one at a time. -// -// GitHub API docs: https://developer.github.com/enterprise/v3/enterprise-admin/users/#delete-an-impersonation-oauth-token -func (s *AuthorizationsService) DeleteImpersonation(ctx context.Context, username string) (*Response, error) { - u := fmt.Sprintf("admin/users/%v/authorizations", username) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} diff --git a/vendor/github.com/google/go-github/v27/github/checks.go b/vendor/github.com/google/go-github/v27/github/checks.go deleted file mode 100644 index 342915085e4e..000000000000 --- a/vendor/github.com/google/go-github/v27/github/checks.go +++ /dev/null @@ -1,435 +0,0 @@ -// Copyright 2018 The go-github 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 - -import ( - "context" - "fmt" - "net/url" -) - -// ChecksService provides access to the Checks API in the -// GitHub API. -// -// GitHub API docs: https://developer.github.com/v3/checks/ -type ChecksService service - -// CheckRun represents a GitHub check run on a repository associated with a GitHub app. -type CheckRun struct { - ID *int64 `json:"id,omitempty"` - NodeID *string `json:"node_id,omitempty"` - HeadSHA *string `json:"head_sha,omitempty"` - ExternalID *string `json:"external_id,omitempty"` - URL *string `json:"url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - DetailsURL *string `json:"details_url,omitempty"` - Status *string `json:"status,omitempty"` - Conclusion *string `json:"conclusion,omitempty"` - StartedAt *Timestamp `json:"started_at,omitempty"` - CompletedAt *Timestamp `json:"completed_at,omitempty"` - Output *CheckRunOutput `json:"output,omitempty"` - Name *string `json:"name,omitempty"` - CheckSuite *CheckSuite `json:"check_suite,omitempty"` - App *App `json:"app,omitempty"` - PullRequests []*PullRequest `json:"pull_requests,omitempty"` -} - -// CheckRunOutput represents the output of a CheckRun. -type CheckRunOutput struct { - Title *string `json:"title,omitempty"` - Summary *string `json:"summary,omitempty"` - Text *string `json:"text,omitempty"` - AnnotationsCount *int `json:"annotations_count,omitempty"` - AnnotationsURL *string `json:"annotations_url,omitempty"` - Annotations []*CheckRunAnnotation `json:"annotations,omitempty"` - Images []*CheckRunImage `json:"images,omitempty"` -} - -// CheckRunAnnotation represents an annotation object for a CheckRun output. -type CheckRunAnnotation struct { - Path *string `json:"path,omitempty"` - BlobHRef *string `json:"blob_href,omitempty"` - StartLine *int `json:"start_line,omitempty"` - EndLine *int `json:"end_line,omitempty"` - AnnotationLevel *string `json:"annotation_level,omitempty"` - Message *string `json:"message,omitempty"` - Title *string `json:"title,omitempty"` - RawDetails *string `json:"raw_details,omitempty"` -} - -// CheckRunImage represents an image object for a CheckRun output. -type CheckRunImage struct { - Alt *string `json:"alt,omitempty"` - ImageURL *string `json:"image_url,omitempty"` - Caption *string `json:"caption,omitempty"` -} - -// CheckSuite represents a suite of check runs. -type CheckSuite struct { - ID *int64 `json:"id,omitempty"` - NodeID *string `json:"node_id,omitempty"` - HeadBranch *string `json:"head_branch,omitempty"` - HeadSHA *string `json:"head_sha,omitempty"` - URL *string `json:"url,omitempty"` - BeforeSHA *string `json:"before,omitempty"` - AfterSHA *string `json:"after,omitempty"` - Status *string `json:"status,omitempty"` - Conclusion *string `json:"conclusion,omitempty"` - App *App `json:"app,omitempty"` - Repository *Repository `json:"repository,omitempty"` - PullRequests []*PullRequest `json:"pull_requests,omitempty"` - - // The following fields are only populated by Webhook events. - HeadCommit *Commit `json:"head_commit,omitempty"` -} - -func (c CheckRun) String() string { - return Stringify(c) -} - -func (c CheckSuite) String() string { - return Stringify(c) -} - -// GetCheckRun gets a check-run for a repository. -// -// GitHub API docs: https://developer.github.com/v3/checks/runs/#get-a-single-check-run -func (s *ChecksService) GetCheckRun(ctx context.Context, owner, repo string, checkRunID int64) (*CheckRun, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/check-runs/%v", owner, repo, checkRunID) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - req.Header.Set("Accept", mediaTypeCheckRunsPreview) - - checkRun := new(CheckRun) - resp, err := s.client.Do(ctx, req, checkRun) - if err != nil { - return nil, resp, err - } - - return checkRun, resp, nil -} - -// GetCheckSuite gets a single check suite. -// -// GitHub API docs: https://developer.github.com/v3/checks/suites/#get-a-single-check-suite -func (s *ChecksService) GetCheckSuite(ctx context.Context, owner, repo string, checkSuiteID int64) (*CheckSuite, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/check-suites/%v", owner, repo, checkSuiteID) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - req.Header.Set("Accept", mediaTypeCheckRunsPreview) - - checkSuite := new(CheckSuite) - resp, err := s.client.Do(ctx, req, checkSuite) - if err != nil { - return nil, resp, err - } - - return checkSuite, resp, nil -} - -// CreateCheckRunOptions sets up parameters needed to create a CheckRun. -type CreateCheckRunOptions struct { - Name string `json:"name"` // The name of the check (e.g., "code-coverage"). (Required.) - HeadBranch string `json:"head_branch"` // The name of the branch to perform a check against. (Required.) - HeadSHA string `json:"head_sha"` // The SHA of the commit. (Required.) - DetailsURL *string `json:"details_url,omitempty"` // The URL of the integrator's site that has the full details of the check. (Optional.) - ExternalID *string `json:"external_id,omitempty"` // A reference for the run on the integrator's system. (Optional.) - Status *string `json:"status,omitempty"` // The current status. Can be one of "queued", "in_progress", or "completed". Default: "queued". (Optional.) - Conclusion *string `json:"conclusion,omitempty"` // Can be one of "success", "failure", "neutral", "cancelled", "timed_out", or "action_required". (Optional. Required if you provide a status of "completed".) - StartedAt *Timestamp `json:"started_at,omitempty"` // The time that the check run began. (Optional.) - CompletedAt *Timestamp `json:"completed_at,omitempty"` // The time the check completed. (Optional. Required if you provide conclusion.) - Output *CheckRunOutput `json:"output,omitempty"` // Provide descriptive details about the run. (Optional) - Actions []*CheckRunAction `json:"actions,omitempty"` // Possible further actions the integrator can perform, which a user may trigger. (Optional.) -} - -// CheckRunAction exposes further actions the integrator can perform, which a user may trigger. -type CheckRunAction struct { - Label string `json:"label"` // The text to be displayed on a button in the web UI. The maximum size is 20 characters. (Required.) - Description string `json:"description"` // A short explanation of what this action would do. The maximum size is 40 characters. (Required.) - Identifier string `json:"identifier"` // A reference for the action on the integrator's system. The maximum size is 20 characters. (Required.) -} - -// CreateCheckRun creates a check run for repository. -// -// GitHub API docs: https://developer.github.com/v3/checks/runs/#create-a-check-run -func (s *ChecksService) CreateCheckRun(ctx context.Context, owner, repo string, opt CreateCheckRunOptions) (*CheckRun, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/check-runs", owner, repo) - req, err := s.client.NewRequest("POST", u, opt) - if err != nil { - return nil, nil, err - } - - req.Header.Set("Accept", mediaTypeCheckRunsPreview) - - checkRun := new(CheckRun) - resp, err := s.client.Do(ctx, req, checkRun) - if err != nil { - return nil, resp, err - } - - return checkRun, resp, nil -} - -// UpdateCheckRunOptions sets up parameters needed to update a CheckRun. -type UpdateCheckRunOptions struct { - Name string `json:"name"` // The name of the check (e.g., "code-coverage"). (Required.) - HeadBranch *string `json:"head_branch,omitempty"` // The name of the branch to perform a check against. (Optional.) - HeadSHA *string `json:"head_sha,omitempty"` // The SHA of the commit. (Optional.) - DetailsURL *string `json:"details_url,omitempty"` // The URL of the integrator's site that has the full details of the check. (Optional.) - ExternalID *string `json:"external_id,omitempty"` // A reference for the run on the integrator's system. (Optional.) - Status *string `json:"status,omitempty"` // The current status. Can be one of "queued", "in_progress", or "completed". Default: "queued". (Optional.) - Conclusion *string `json:"conclusion,omitempty"` // Can be one of "success", "failure", "neutral", "cancelled", "timed_out", or "action_required". (Optional. Required if you provide a status of "completed".) - CompletedAt *Timestamp `json:"completed_at,omitempty"` // The time the check completed. (Optional. Required if you provide conclusion.) - Output *CheckRunOutput `json:"output,omitempty"` // Provide descriptive details about the run. (Optional) - Actions []*CheckRunAction `json:"actions,omitempty"` // Possible further actions the integrator can perform, which a user may trigger. (Optional.) -} - -// UpdateCheckRun updates a check run for a specific commit in a repository. -// -// GitHub API docs: https://developer.github.com/v3/checks/runs/#update-a-check-run -func (s *ChecksService) UpdateCheckRun(ctx context.Context, owner, repo string, checkRunID int64, opt UpdateCheckRunOptions) (*CheckRun, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/check-runs/%v", owner, repo, checkRunID) - req, err := s.client.NewRequest("PATCH", u, opt) - if err != nil { - return nil, nil, err - } - - req.Header.Set("Accept", mediaTypeCheckRunsPreview) - - checkRun := new(CheckRun) - resp, err := s.client.Do(ctx, req, checkRun) - if err != nil { - return nil, resp, err - } - - return checkRun, resp, nil -} - -// ListCheckRunAnnotations lists the annotations for a check run. -// -// GitHub API docs: https://developer.github.com/v3/checks/runs/#list-annotations-for-a-check-run -func (s *ChecksService) ListCheckRunAnnotations(ctx context.Context, owner, repo string, checkRunID int64, opt *ListOptions) ([]*CheckRunAnnotation, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/check-runs/%v/annotations", owner, repo, checkRunID) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - req.Header.Set("Accept", mediaTypeCheckRunsPreview) - - var checkRunAnnotations []*CheckRunAnnotation - resp, err := s.client.Do(ctx, req, &checkRunAnnotations) - if err != nil { - return nil, resp, err - } - - return checkRunAnnotations, resp, nil -} - -// ListCheckRunsOptions represents parameters to list check runs. -type ListCheckRunsOptions struct { - CheckName *string `url:"check_name,omitempty"` // Returns check runs with the specified name. - Status *string `url:"status,omitempty"` // Returns check runs with the specified status. Can be one of "queued", "in_progress", or "completed". - Filter *string `url:"filter,omitempty"` // Filters check runs by their completed_at timestamp. Can be one of "latest" (returning the most recent check runs) or "all". Default: "latest" - - ListOptions -} - -// ListCheckRunsResults represents the result of a check run list. -type ListCheckRunsResults struct { - Total *int `json:"total_count,omitempty"` - CheckRuns []*CheckRun `json:"check_runs,omitempty"` -} - -// ListCheckRunsForRef lists check runs for a specific ref. -// -// GitHub API docs: https://developer.github.com/v3/checks/runs/#list-check-runs-for-a-specific-ref -func (s *ChecksService) ListCheckRunsForRef(ctx context.Context, owner, repo, ref string, opt *ListCheckRunsOptions) (*ListCheckRunsResults, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/commits/%v/check-runs", owner, repo, url.QueryEscape(ref)) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - req.Header.Set("Accept", mediaTypeCheckRunsPreview) - - var checkRunResults *ListCheckRunsResults - resp, err := s.client.Do(ctx, req, &checkRunResults) - if err != nil { - return nil, resp, err - } - - return checkRunResults, resp, nil -} - -// ListCheckRunsCheckSuite lists check runs for a check suite. -// -// GitHub API docs: https://developer.github.com/v3/checks/runs/#list-check-runs-in-a-check-suite -func (s *ChecksService) ListCheckRunsCheckSuite(ctx context.Context, owner, repo string, checkSuiteID int64, opt *ListCheckRunsOptions) (*ListCheckRunsResults, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/check-suites/%v/check-runs", owner, repo, checkSuiteID) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - req.Header.Set("Accept", mediaTypeCheckRunsPreview) - - var checkRunResults *ListCheckRunsResults - resp, err := s.client.Do(ctx, req, &checkRunResults) - if err != nil { - return nil, resp, err - } - - return checkRunResults, resp, nil -} - -// ListCheckSuiteOptions represents parameters to list check suites. -type ListCheckSuiteOptions struct { - CheckName *string `url:"check_name,omitempty"` // Filters checks suites by the name of the check run. - AppID *int `url:"app_id,omitempty"` // Filters check suites by GitHub App id. - - ListOptions -} - -// ListCheckSuiteResults represents the result of a check run list. -type ListCheckSuiteResults struct { - Total *int `json:"total_count,omitempty"` - CheckSuites []*CheckSuite `json:"check_suites,omitempty"` -} - -// ListCheckSuitesForRef lists check suite for a specific ref. -// -// GitHub API docs: https://developer.github.com/v3/checks/suites/#list-check-suites-for-a-specific-ref -func (s *ChecksService) ListCheckSuitesForRef(ctx context.Context, owner, repo, ref string, opt *ListCheckSuiteOptions) (*ListCheckSuiteResults, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/commits/%v/check-suites", owner, repo, url.QueryEscape(ref)) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - req.Header.Set("Accept", mediaTypeCheckRunsPreview) - - var checkSuiteResults *ListCheckSuiteResults - resp, err := s.client.Do(ctx, req, &checkSuiteResults) - if err != nil { - return nil, resp, err - } - - return checkSuiteResults, resp, nil -} - -// AutoTriggerCheck enables or disables automatic creation of CheckSuite events upon pushes to the repository. -type AutoTriggerCheck struct { - AppID *int64 `json:"app_id,omitempty"` // The id of the GitHub App. (Required.) - Setting *bool `json:"setting,omitempty"` // Set to "true" to enable automatic creation of CheckSuite events upon pushes to the repository, or "false" to disable them. Default: "true" (Required.) -} - -// CheckSuitePreferenceOptions set options for check suite preferences for a repository. -type CheckSuitePreferenceOptions struct { - AutoTriggerChecks []*AutoTriggerCheck `json:"auto_trigger_checks,omitempty"` // A slice of auto trigger checks that can be set for a check suite in a repository. -} - -// CheckSuitePreferenceResults represents the results of the preference set operation. -type CheckSuitePreferenceResults struct { - Preferences *PreferenceList `json:"preferences,omitempty"` - Repository *Repository `json:"repository,omitempty"` -} - -// PreferenceList represents a list of auto trigger checks for repository -type PreferenceList struct { - AutoTriggerChecks []*AutoTriggerCheck `json:"auto_trigger_checks,omitempty"` // A slice of auto trigger checks that can be set for a check suite in a repository. -} - -// SetCheckSuitePreferences changes the default automatic flow when creating check suites. -// -// GitHub API docs: https://developer.github.com/v3/checks/suites/#set-preferences-for-check-suites-on-a-repository -func (s *ChecksService) SetCheckSuitePreferences(ctx context.Context, owner, repo string, opt CheckSuitePreferenceOptions) (*CheckSuitePreferenceResults, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/check-suites/preferences", owner, repo) - req, err := s.client.NewRequest("PATCH", u, opt) - if err != nil { - return nil, nil, err - } - - req.Header.Set("Accept", mediaTypeCheckRunsPreview) - - var checkSuitePrefResults *CheckSuitePreferenceResults - resp, err := s.client.Do(ctx, req, &checkSuitePrefResults) - if err != nil { - return nil, resp, err - } - - return checkSuitePrefResults, resp, nil -} - -// CreateCheckSuiteOptions sets up parameters to manually create a check suites -type CreateCheckSuiteOptions struct { - HeadSHA string `json:"head_sha"` // The sha of the head commit. (Required.) - HeadBranch *string `json:"head_branch,omitempty"` // The name of the head branch where the code changes are implemented. -} - -// CreateCheckSuite manually creates a check suite for a repository. -// -// GitHub API docs: https://developer.github.com/v3/checks/suites/#create-a-check-suite -func (s *ChecksService) CreateCheckSuite(ctx context.Context, owner, repo string, opt CreateCheckSuiteOptions) (*CheckSuite, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/check-suites", owner, repo) - req, err := s.client.NewRequest("POST", u, opt) - if err != nil { - return nil, nil, err - } - - req.Header.Set("Accept", mediaTypeCheckRunsPreview) - - checkSuite := new(CheckSuite) - resp, err := s.client.Do(ctx, req, checkSuite) - if err != nil { - return nil, resp, err - } - - return checkSuite, resp, nil -} - -// ReRequestCheckSuite triggers GitHub to rerequest an existing check suite, without pushing new code to a repository. -// -// GitHub API docs: https://developer.github.com/v3/checks/suites/#rerequest-check-suite -func (s *ChecksService) ReRequestCheckSuite(ctx context.Context, owner, repo string, checkSuiteID int64) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/check-suites/%v/rerequest", owner, repo, checkSuiteID) - - req, err := s.client.NewRequest("POST", u, nil) - if err != nil { - return nil, err - } - - req.Header.Set("Accept", mediaTypeCheckRunsPreview) - - resp, err := s.client.Do(ctx, req, nil) - return resp, err -} diff --git a/vendor/github.com/google/go-github/v27/github/doc.go b/vendor/github.com/google/go-github/v27/github/doc.go deleted file mode 100644 index 1fc5634d6f22..000000000000 --- a/vendor/github.com/google/go-github/v27/github/doc.go +++ /dev/null @@ -1,188 +0,0 @@ -// Copyright 2013 The go-github 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 a client for using the GitHub API. - -Usage: - - import "github.com/google/go-github/v27/github" // with go modules enabled (GO111MODULE=on or outside GOPATH) - import "github.com/google/go-github/github" // with go modules disabled - -Construct a new GitHub client, then use the various services on the client to -access different parts of the GitHub API. For example: - - client := github.NewClient(nil) - - // list all organizations for user "willnorris" - orgs, _, err := client.Organizations.List(ctx, "willnorris", nil) - -Some API methods have optional parameters that can be passed. For example: - - client := github.NewClient(nil) - - // list public repositories for org "github" - opt := &github.RepositoryListByOrgOptions{Type: "public"} - repos, _, err := client.Repositories.ListByOrg(ctx, "github", opt) - -The services of a client divide the API into logical chunks and correspond to -the structure of the GitHub API documentation at -https://developer.github.com/v3/. - -NOTE: Using the https://godoc.org/context package, one can easily -pass cancelation signals and deadlines to various services of the client for -handling a request. In case there is no context available, then context.Background() -can be used as a starting point. - -For more sample code snippets, head over to the https://github.com/google/go-github/tree/master/example directory. - -Authentication - -The go-github library does not directly handle authentication. Instead, when -creating a new client, pass an http.Client that can handle authentication for -you. The easiest and recommended way to do this is using the golang.org/x/oauth2 -library, but you can always use any other library that provides an http.Client. -If you have an OAuth2 access token (for example, a personal API token), you can -use it with the oauth2 library using: - - import "golang.org/x/oauth2" - - func main() { - ctx := context.Background() - ts := oauth2.StaticTokenSource( - &oauth2.Token{AccessToken: "... your access token ..."}, - ) - tc := oauth2.NewClient(ctx, ts) - - client := github.NewClient(tc) - - // list all repositories for the authenticated user - repos, _, err := client.Repositories.List(ctx, "", nil) - } - -Note that when using an authenticated Client, all calls made by the client will -include the specified OAuth token. Therefore, authenticated clients should -almost never be shared between different users. - -See the oauth2 docs for complete instructions on using that library. - -For API methods that require HTTP Basic Authentication, use the -BasicAuthTransport. - -GitHub Apps authentication can be provided by the -https://github.com/bradleyfalzon/ghinstallation package. - - import "github.com/bradleyfalzon/ghinstallation" - - func main() { - // Wrap the shared transport for use with the integration ID 1 authenticating with installation ID 99. - itr, err := ghinstallation.NewKeyFromFile(http.DefaultTransport, 1, 99, "2016-10-19.private-key.pem") - if err != nil { - // Handle error. - } - - // Use installation transport with client - client := github.NewClient(&http.Client{Transport: itr}) - - // Use client... - } - -Rate Limiting - -GitHub imposes a rate limit on all API clients. Unauthenticated clients are -limited to 60 requests per hour, while authenticated clients can make up to -5,000 requests per hour. The Search API has a custom rate limit. Unauthenticated -clients are limited to 10 requests per minute, while authenticated clients -can make up to 30 requests per minute. To receive the higher rate limit when -making calls that are not issued on behalf of a user, -use UnauthenticatedRateLimitedTransport. - -The returned Response.Rate value contains the rate limit information -from the most recent API call. If a recent enough response isn't -available, you can use RateLimits to fetch the most up-to-date rate -limit data for the client. - -To detect an API rate limit error, you can check if its type is *github.RateLimitError: - - repos, _, err := client.Repositories.List(ctx, "", nil) - if _, ok := err.(*github.RateLimitError); ok { - log.Println("hit rate limit") - } - -Learn more about GitHub rate limiting at -https://developer.github.com/v3/#rate-limiting. - -Accepted Status - -Some endpoints may return a 202 Accepted status code, meaning that the -information required is not yet ready and was scheduled to be gathered on -the GitHub side. Methods known to behave like this are documented specifying -this behavior. - -To detect this condition of error, you can check if its type is -*github.AcceptedError: - - stats, _, err := client.Repositories.ListContributorsStats(ctx, org, repo) - if _, ok := err.(*github.AcceptedError); ok { - log.Println("scheduled on GitHub side") - } - -Conditional Requests - -The GitHub API has good support for conditional requests which will help -prevent you from burning through your rate limit, as well as help speed up your -application. go-github does not handle conditional requests directly, but is -instead designed to work with a caching http.Transport. We recommend using -https://github.com/gregjones/httpcache for that. - -Learn more about GitHub conditional requests at -https://developer.github.com/v3/#conditional-requests. - -Creating and Updating Resources - -All structs for GitHub resources use pointer values for all non-repeated fields. -This allows distinguishing between unset fields and those set to a zero-value. -Helper functions have been provided to easily create these pointers for string, -bool, and int values. For example: - - // create a new private repository named "foo" - repo := &github.Repository{ - Name: github.String("foo"), - Private: github.Bool(true), - } - client.Repositories.Create(ctx, "", repo) - -Users who have worked with protocol buffers should find this pattern familiar. - -Pagination - -All requests for resource collections (repos, pull requests, issues, etc.) -support pagination. Pagination options are described in the -github.ListOptions struct and passed to the list methods directly or as an -embedded type of a more specific list options struct (for example -github.PullRequestListOptions). Pages information is available via the -github.Response struct. - - client := github.NewClient(nil) - - opt := &github.RepositoryListByOrgOptions{ - ListOptions: github.ListOptions{PerPage: 10}, - } - // get all pages of results - var allRepos []*github.Repository - for { - repos, resp, err := client.Repositories.ListByOrg(ctx, "github", opt) - if err != nil { - return err - } - allRepos = append(allRepos, repos...) - if resp.NextPage == 0 { - break - } - opt.Page = resp.NextPage - } - -*/ -package github diff --git a/vendor/github.com/google/go-github/v27/github/event.go b/vendor/github.com/google/go-github/v27/github/event.go deleted file mode 100644 index 0ba8f46a1b03..000000000000 --- a/vendor/github.com/google/go-github/v27/github/event.go +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright 2018 The go-github 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 - -import ( - "encoding/json" - "time" -) - -// Event represents a GitHub event. -type Event struct { - Type *string `json:"type,omitempty"` - Public *bool `json:"public,omitempty"` - RawPayload *json.RawMessage `json:"payload,omitempty"` - Repo *Repository `json:"repo,omitempty"` - Actor *User `json:"actor,omitempty"` - Org *Organization `json:"org,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - ID *string `json:"id,omitempty"` -} - -func (e Event) String() string { - return Stringify(e) -} - -// ParsePayload parses the event payload. For recognized event types, -// a value of the corresponding struct type will be returned. -func (e *Event) ParsePayload() (payload interface{}, err error) { - switch *e.Type { - case "CheckRunEvent": - payload = &CheckRunEvent{} - case "CheckSuiteEvent": - payload = &CheckSuiteEvent{} - case "CommitCommentEvent": - payload = &CommitCommentEvent{} - case "CreateEvent": - payload = &CreateEvent{} - case "DeleteEvent": - payload = &DeleteEvent{} - case "DeployKeyEvent": - payload = &DeployKeyEvent{} - case "DeploymentEvent": - payload = &DeploymentEvent{} - case "DeploymentStatusEvent": - payload = &DeploymentStatusEvent{} - case "ForkEvent": - payload = &ForkEvent{} - case "GitHubAppAuthorizationEvent": - payload = &GitHubAppAuthorizationEvent{} - case "GollumEvent": - payload = &GollumEvent{} - case "InstallationEvent": - payload = &InstallationEvent{} - case "InstallationRepositoriesEvent": - payload = &InstallationRepositoriesEvent{} - case "IssueCommentEvent": - payload = &IssueCommentEvent{} - case "IssuesEvent": - payload = &IssuesEvent{} - case "LabelEvent": - payload = &LabelEvent{} - case "MarketplacePurchaseEvent": - payload = &MarketplacePurchaseEvent{} - case "MemberEvent": - payload = &MemberEvent{} - case "MembershipEvent": - payload = &MembershipEvent{} - case "MetaEvent": - payload = &MetaEvent{} - case "MilestoneEvent": - payload = &MilestoneEvent{} - case "OrganizationEvent": - payload = &OrganizationEvent{} - case "OrgBlockEvent": - payload = &OrgBlockEvent{} - case "PageBuildEvent": - payload = &PageBuildEvent{} - case "PingEvent": - payload = &PingEvent{} - case "ProjectEvent": - payload = &ProjectEvent{} - case "ProjectCardEvent": - payload = &ProjectCardEvent{} - case "ProjectColumnEvent": - payload = &ProjectColumnEvent{} - case "PublicEvent": - payload = &PublicEvent{} - case "PullRequestEvent": - payload = &PullRequestEvent{} - case "PullRequestReviewEvent": - payload = &PullRequestReviewEvent{} - case "PullRequestReviewCommentEvent": - payload = &PullRequestReviewCommentEvent{} - case "PushEvent": - payload = &PushEvent{} - case "ReleaseEvent": - payload = &ReleaseEvent{} - case "RepositoryEvent": - payload = &RepositoryEvent{} - case "RepositoryVulnerabilityAlertEvent": - payload = &RepositoryVulnerabilityAlertEvent{} - case "StarEvent": - payload = &StarEvent{} - case "StatusEvent": - payload = &StatusEvent{} - case "TeamEvent": - payload = &TeamEvent{} - case "TeamAddEvent": - payload = &TeamAddEvent{} - case "WatchEvent": - payload = &WatchEvent{} - } - err = json.Unmarshal(*e.RawPayload, &payload) - return payload, err -} - -// Payload returns the parsed event payload. For recognized event types, -// a value of the corresponding struct type will be returned. -// -// Deprecated: Use ParsePayload instead, which returns an error -// rather than panics if JSON unmarshaling raw payload fails. -func (e *Event) Payload() (payload interface{}) { - var err error - payload, err = e.ParsePayload() - if err != nil { - panic(err) - } - return payload -} diff --git a/vendor/github.com/google/go-github/v27/github/event_types.go b/vendor/github.com/google/go-github/v27/github/event_types.go deleted file mode 100644 index d3e2123547d6..000000000000 --- a/vendor/github.com/google/go-github/v27/github/event_types.go +++ /dev/null @@ -1,890 +0,0 @@ -// Copyright 2016 The go-github AUTHORS. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// These event types are shared between the Events API and used as Webhook payloads. - -package github - -// RequestedAction is included in a CheckRunEvent when a user has invoked an action, -// i.e. when the CheckRunEvent's Action field is "requested_action". -type RequestedAction struct { - Identifier string `json:"identifier"` // The integrator reference of the action requested by the user. -} - -// CheckRunEvent is triggered when a check run is "created", "updated", or "rerequested". -// The Webhook event name is "check_run". -// -// GitHub API docs: https://developer.github.com/v3/activity/events/types/#checkrunevent -type CheckRunEvent struct { - CheckRun *CheckRun `json:"check_run,omitempty"` - // The action performed. Possible values are: "created", "updated", "rerequested" or "requested_action". - Action *string `json:"action,omitempty"` - - // The following fields are only populated by Webhook events. - Repo *Repository `json:"repository,omitempty"` - Org *Organization `json:"organization,omitempty"` - Sender *User `json:"sender,omitempty"` - Installation *Installation `json:"installation,omitempty"` - - // The action requested by the user. Populated when the Action is "requested_action". - RequestedAction *RequestedAction `json:"requested_action,omitempty"` // -} - -// CheckSuiteEvent is triggered when a check suite is "completed", "requested", or "rerequested". -// The Webhook event name is "check_suite". -// -// GitHub API docs: https://developer.github.com/v3/activity/events/types/#checksuiteevent -type CheckSuiteEvent struct { - CheckSuite *CheckSuite `json:"check_suite,omitempty"` - // The action performed. Possible values are: "completed", "requested" or "rerequested". - Action *string `json:"action,omitempty"` - - // The following fields are only populated by Webhook events. - Repo *Repository `json:"repository,omitempty"` - Org *Organization `json:"organization,omitempty"` - Sender *User `json:"sender,omitempty"` - Installation *Installation `json:"installation,omitempty"` -} - -// CommitCommentEvent is triggered when a commit comment is created. -// The Webhook event name is "commit_comment". -// -// GitHub API docs: https://developer.github.com/v3/activity/events/types/#commitcommentevent -type CommitCommentEvent struct { - Comment *RepositoryComment `json:"comment,omitempty"` - - // The following fields are only populated by Webhook events. - Action *string `json:"action,omitempty"` - Repo *Repository `json:"repository,omitempty"` - Sender *User `json:"sender,omitempty"` - Installation *Installation `json:"installation,omitempty"` -} - -// CreateEvent represents a created repository, branch, or tag. -// The Webhook event name is "create". -// -// Note: webhooks will not receive this event for created repositories. -// Additionally, webhooks will not receive this event for tags if more -// than three tags are pushed at once. -// -// GitHub API docs: https://developer.github.com/v3/activity/events/types/#createevent -type CreateEvent struct { - Ref *string `json:"ref,omitempty"` - // RefType is the object that was created. Possible values are: "repository", "branch", "tag". - RefType *string `json:"ref_type,omitempty"` - MasterBranch *string `json:"master_branch,omitempty"` - Description *string `json:"description,omitempty"` - - // The following fields are only populated by Webhook events. - PusherType *string `json:"pusher_type,omitempty"` - Repo *Repository `json:"repository,omitempty"` - Sender *User `json:"sender,omitempty"` - Installation *Installation `json:"installation,omitempty"` -} - -// DeleteEvent represents a deleted branch or tag. -// The Webhook event name is "delete". -// -// Note: webhooks will not receive this event for tags if more than three tags -// are deleted at once. -// -// GitHub API docs: https://developer.github.com/v3/activity/events/types/#deleteevent -type DeleteEvent struct { - Ref *string `json:"ref,omitempty"` - // RefType is the object that was deleted. Possible values are: "branch", "tag". - RefType *string `json:"ref_type,omitempty"` - - // The following fields are only populated by Webhook events. - PusherType *string `json:"pusher_type,omitempty"` - Repo *Repository `json:"repository,omitempty"` - Sender *User `json:"sender,omitempty"` - Installation *Installation `json:"installation,omitempty"` -} - -// DeployKeyEvent is triggered when a deploy key is added or removed from a repository. -// The Webhook event name is "deploy_key". -// -// GitHub API docs: https://developer.github.com/v3/activity/events/types/#deploykeyevent -type DeployKeyEvent struct { - // Action is the action that was performed. Possible values are: - // "created" or "deleted". - Action *string `json:"action,omitempty"` - - // The deploy key resource. - Key *Key `json:"key,omitempty"` -} - -// DeploymentEvent represents a deployment. -// The Webhook event name is "deployment". -// -// Events of this type are not visible in timelines, they are only used to trigger hooks. -// -// GitHub API docs: https://developer.github.com/v3/activity/events/types/#deploymentevent -type DeploymentEvent struct { - Deployment *Deployment `json:"deployment,omitempty"` - Repo *Repository `json:"repository,omitempty"` - - // The following fields are only populated by Webhook events. - Sender *User `json:"sender,omitempty"` - Installation *Installation `json:"installation,omitempty"` -} - -// DeploymentStatusEvent represents a deployment status. -// The Webhook event name is "deployment_status". -// -// Events of this type are not visible in timelines, they are only used to trigger hooks. -// -// GitHub API docs: https://developer.github.com/v3/activity/events/types/#deploymentstatusevent -type DeploymentStatusEvent struct { - Deployment *Deployment `json:"deployment,omitempty"` - DeploymentStatus *DeploymentStatus `json:"deployment_status,omitempty"` - Repo *Repository `json:"repository,omitempty"` - - // The following fields are only populated by Webhook events. - Sender *User `json:"sender,omitempty"` - Installation *Installation `json:"installation,omitempty"` -} - -// ForkEvent is triggered when a user forks a repository. -// The Webhook event name is "fork". -// -// GitHub API docs: https://developer.github.com/v3/activity/events/types/#forkevent -type ForkEvent struct { - // Forkee is the created repository. - Forkee *Repository `json:"forkee,omitempty"` - - // The following fields are only populated by Webhook events. - Repo *Repository `json:"repository,omitempty"` - Sender *User `json:"sender,omitempty"` - Installation *Installation `json:"installation,omitempty"` -} - -// GitHubAppAuthorizationEvent is triggered when a user's authorization for a -// GitHub Application is revoked. -// -// GitHub API docs: https://developer.github.com/v3/activity/events/types/#githubappauthorizationevent -type GitHubAppAuthorizationEvent struct { - // The action performed. Possible value is: "revoked". - Action *string `json:"action,omitempty"` - - // The following fields are only populated by Webhook events. - Sender *User `json:"sender,omitempty"` -} - -// Page represents a single Wiki page. -type Page struct { - PageName *string `json:"page_name,omitempty"` - Title *string `json:"title,omitempty"` - Summary *string `json:"summary,omitempty"` - Action *string `json:"action,omitempty"` - SHA *string `json:"sha,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` -} - -// GollumEvent is triggered when a Wiki page is created or updated. -// The Webhook event name is "gollum". -// -// GitHub API docs: https://developer.github.com/v3/activity/events/types/#gollumevent -type GollumEvent struct { - Pages []*Page `json:"pages,omitempty"` - - // The following fields are only populated by Webhook events. - Repo *Repository `json:"repository,omitempty"` - Sender *User `json:"sender,omitempty"` - Installation *Installation `json:"installation,omitempty"` -} - -// EditChange represents the changes when an issue, pull request, or comment has -// been edited. -type EditChange struct { - Title *struct { - From *string `json:"from,omitempty"` - } `json:"title,omitempty"` - Body *struct { - From *string `json:"from,omitempty"` - } `json:"body,omitempty"` -} - -// ProjectChange represents the changes when a project has been edited. -type ProjectChange struct { - Name *struct { - From *string `json:"from,omitempty"` - } `json:"name,omitempty"` - Body *struct { - From *string `json:"from,omitempty"` - } `json:"body,omitempty"` -} - -// ProjectCardChange represents the changes when a project card has been edited. -type ProjectCardChange struct { - Note *struct { - From *string `json:"from,omitempty"` - } `json:"note,omitempty"` -} - -// ProjectColumnChange represents the changes when a project column has been edited. -type ProjectColumnChange struct { - Name *struct { - From *string `json:"from,omitempty"` - } `json:"name,omitempty"` -} - -// TeamChange represents the changes when a team has been edited. -type TeamChange struct { - Description *struct { - From *string `json:"from,omitempty"` - } `json:"description,omitempty"` - Name *struct { - From *string `json:"from,omitempty"` - } `json:"name,omitempty"` - Privacy *struct { - From *string `json:"from,omitempty"` - } `json:"privacy,omitempty"` - Repository *struct { - Permissions *struct { - From *struct { - Admin *bool `json:"admin,omitempty"` - Pull *bool `json:"pull,omitempty"` - Push *bool `json:"push,omitempty"` - } `json:"from,omitempty"` - } `json:"permissions,omitempty"` - } `json:"repository,omitempty"` -} - -// InstallationEvent is triggered when a GitHub App has been installed or uninstalled. -// The Webhook event name is "installation". -// -// GitHub API docs: https://developer.github.com/v3/activity/events/types/#installationevent -type InstallationEvent struct { - // The action that was performed. Can be either "created" or "deleted". - Action *string `json:"action,omitempty"` - Repositories []*Repository `json:"repositories,omitempty"` - Sender *User `json:"sender,omitempty"` - Installation *Installation `json:"installation,omitempty"` -} - -// InstallationRepositoriesEvent is triggered when a repository is added or -// removed from an installation. The Webhook event name is "installation_repositories". -// -// GitHub API docs: https://developer.github.com/v3/activity/events/types/#installationrepositoriesevent -type InstallationRepositoriesEvent struct { - // The action that was performed. Can be either "added" or "removed". - Action *string `json:"action,omitempty"` - RepositoriesAdded []*Repository `json:"repositories_added,omitempty"` - RepositoriesRemoved []*Repository `json:"repositories_removed,omitempty"` - RepositorySelection *string `json:"repository_selection,omitempty"` - Sender *User `json:"sender,omitempty"` - Installation *Installation `json:"installation,omitempty"` -} - -// IssueCommentEvent is triggered when an issue comment is created on an issue -// or pull request. -// The Webhook event name is "issue_comment". -// -// GitHub API docs: https://developer.github.com/v3/activity/events/types/#issuecommentevent -type IssueCommentEvent struct { - // Action is the action that was performed on the comment. - // Possible values are: "created", "edited", "deleted". - Action *string `json:"action,omitempty"` - Issue *Issue `json:"issue,omitempty"` - Comment *IssueComment `json:"comment,omitempty"` - - // The following fields are only populated by Webhook events. - Changes *EditChange `json:"changes,omitempty"` - Repo *Repository `json:"repository,omitempty"` - Sender *User `json:"sender,omitempty"` - Installation *Installation `json:"installation,omitempty"` -} - -// IssuesEvent is triggered when an issue is opened, edited, deleted, transferred, -// pinned, unpinned, closed, reopened, assigned, unassigned, labeled, unlabeled, -// locked, unlocked, milestoned, or demilestoned. -// The Webhook event name is "issues". -// -// GitHub API docs: https://developer.github.com/v3/activity/events/types/#issuesevent -type IssuesEvent struct { - // Action is the action that was performed. Possible values are: "opened", - // "edited", "deleted", "transferred", "pinned", "unpinned", "closed", "reopened", - // "assigned", "unassigned", "labeled", "unlabeled", "locked", "unlocked", - // "milestoned", or "demilestoned". - Action *string `json:"action,omitempty"` - Issue *Issue `json:"issue,omitempty"` - Assignee *User `json:"assignee,omitempty"` - Label *Label `json:"label,omitempty"` - - // The following fields are only populated by Webhook events. - Changes *EditChange `json:"changes,omitempty"` - Repo *Repository `json:"repository,omitempty"` - Sender *User `json:"sender,omitempty"` - Installation *Installation `json:"installation,omitempty"` -} - -// LabelEvent is triggered when a repository's label is created, edited, or deleted. -// The Webhook event name is "label" -// -// GitHub API docs: https://developer.github.com/v3/activity/events/types/#labelevent -type LabelEvent struct { - // Action is the action that was performed. Possible values are: - // "created", "edited", "deleted" - Action *string `json:"action,omitempty"` - Label *Label `json:"label,omitempty"` - - // The following fields are only populated by Webhook events. - Changes *EditChange `json:"changes,omitempty"` - Repo *Repository `json:"repository,omitempty"` - Org *Organization `json:"organization,omitempty"` - Installation *Installation `json:"installation,omitempty"` -} - -// MarketplacePurchaseEvent is triggered when a user purchases, cancels, or changes -// their GitHub Marketplace plan. -// Webhook event name "marketplace_purchase". -// -// Github API docs: https://developer.github.com/v3/activity/events/types/#marketplacepurchaseevent -type MarketplacePurchaseEvent struct { - // Action is the action that was performed. Possible values are: - // "purchased", "cancelled", "pending_change", "pending_change_cancelled", "changed". - Action *string `json:"action,omitempty"` - - // The following fields are only populated by Webhook events. - EffectiveDate *Timestamp `json:"effective_date,omitempty"` - MarketplacePurchase *MarketplacePurchase `json:"marketplace_purchase,omitempty"` - PreviousMarketplacePurchase *MarketplacePurchase `json:"previous_marketplace_purchase,omitempty"` - Sender *User `json:"sender,omitempty"` - Installation *Installation `json:"installation,omitempty"` -} - -// MemberEvent is triggered when a user is added as a collaborator to a repository. -// The Webhook event name is "member". -// -// GitHub API docs: https://developer.github.com/v3/activity/events/types/#memberevent -type MemberEvent struct { - // Action is the action that was performed. Possible value is: "added". - Action *string `json:"action,omitempty"` - Member *User `json:"member,omitempty"` - - // The following fields are only populated by Webhook events. - Repo *Repository `json:"repository,omitempty"` - Sender *User `json:"sender,omitempty"` - Installation *Installation `json:"installation,omitempty"` -} - -// MembershipEvent is triggered when a user is added or removed from a team. -// The Webhook event name is "membership". -// -// Events of this type are not visible in timelines, they are only used to -// trigger organization webhooks. -// -// GitHub API docs: https://developer.github.com/v3/activity/events/types/#membershipevent -type MembershipEvent struct { - // Action is the action that was performed. Possible values are: "added", "removed". - Action *string `json:"action,omitempty"` - // Scope is the scope of the membership. Possible value is: "team". - Scope *string `json:"scope,omitempty"` - Member *User `json:"member,omitempty"` - Team *Team `json:"team,omitempty"` - - // The following fields are only populated by Webhook events. - Org *Organization `json:"organization,omitempty"` - Sender *User `json:"sender,omitempty"` - Installation *Installation `json:"installation,omitempty"` -} - -// MetaEvent is triggered when the webhook that this event is configured on is deleted. -// This event will only listen for changes to the particular hook the event is installed on. -// Therefore, it must be selected for each hook that you'd like to receive meta events for. -// The Webhook event name is "meta". -// -// GitHub API docs: https://developer.github.com/v3/activity/events/types/#metaevent -type MetaEvent struct { - // Action is the action that was performed. Possible value is: "deleted". - Action *string `json:"action,omitempty"` - // The ID of the modified webhook. - HookID *int64 `json:"hook_id,omitempty"` - // The modified webhook. - // This will contain different keys based on the type of webhook it is: repository, - // organization, business, app, or GitHub Marketplace. - Hook *Hook `json:"hook,omitempty"` -} - -// MilestoneEvent is triggered when a milestone is created, closed, opened, edited, or deleted. -// The Webhook event name is "milestone". -// -// GitHub API docs: https://developer.github.com/v3/activity/events/types/#milestoneevent -type MilestoneEvent struct { - // Action is the action that was performed. Possible values are: - // "created", "closed", "opened", "edited", "deleted" - Action *string `json:"action,omitempty"` - Milestone *Milestone `json:"milestone,omitempty"` - - // The following fields are only populated by Webhook events. - Changes *EditChange `json:"changes,omitempty"` - Repo *Repository `json:"repository,omitempty"` - Sender *User `json:"sender,omitempty"` - Org *Organization `json:"organization,omitempty"` - Installation *Installation `json:"installation,omitempty"` -} - -// OrganizationEvent is triggered when an organization is deleted and renamed, and when a user is added, -// removed, or invited to an organization. -// Events of this type are not visible in timelines. These events are only used to trigger organization hooks. -// Webhook event name is "organization". -// -// GitHub API docs: https://developer.github.com/v3/activity/events/types/#organizationevent -type OrganizationEvent struct { - // Action is the action that was performed. - // Possible values are: "deleted", "renamed", "member_added", "member_removed", or "member_invited". - Action *string `json:"action,omitempty"` - - // Invitation is the invitation for the user or email if the action is "member_invited". - Invitation *Invitation `json:"invitation,omitempty"` - - // Membership is the membership between the user and the organization. - // Not present when the action is "member_invited". - Membership *Membership `json:"membership,omitempty"` - - Organization *Organization `json:"organization,omitempty"` - Sender *User `json:"sender,omitempty"` - Installation *Installation `json:"installation,omitempty"` -} - -// OrgBlockEvent is triggered when an organization blocks or unblocks a user. -// The Webhook event name is "org_block". -// -// GitHub API docs: https://developer.github.com/v3/activity/events/types/#orgblockevent -type OrgBlockEvent struct { - // Action is the action that was performed. - // Can be "blocked" or "unblocked". - Action *string `json:"action,omitempty"` - BlockedUser *User `json:"blocked_user,omitempty"` - Organization *Organization `json:"organization,omitempty"` - Sender *User `json:"sender,omitempty"` - - // The following fields are only populated by Webhook events. - Installation *Installation `json:"installation,omitempty"` -} - -// PageBuildEvent represents an attempted build of a GitHub Pages site, whether -// successful or not. -// The Webhook event name is "page_build". -// -// This event is triggered on push to a GitHub Pages enabled branch (gh-pages -// for project pages, master for user and organization pages). -// -// Events of this type are not visible in timelines, they are only used to trigger hooks. -// -// GitHub API docs: https://developer.github.com/v3/activity/events/types/#pagebuildevent -type PageBuildEvent struct { - Build *PagesBuild `json:"build,omitempty"` - - // The following fields are only populated by Webhook events. - ID *int64 `json:"id,omitempty"` - Repo *Repository `json:"repository,omitempty"` - Sender *User `json:"sender,omitempty"` - Installation *Installation `json:"installation,omitempty"` -} - -// PingEvent is triggered when a Webhook is added to GitHub. -// -// GitHub API docs: https://developer.github.com/webhooks/#ping-event -type PingEvent struct { - // Random string of GitHub zen. - Zen *string `json:"zen,omitempty"` - // The ID of the webhook that triggered the ping. - HookID *int64 `json:"hook_id,omitempty"` - // The webhook configuration. - Hook *Hook `json:"hook,omitempty"` - Installation *Installation `json:"installation,omitempty"` -} - -// ProjectEvent is triggered when project is created, modified or deleted. -// The webhook event name is "project". -// -// GitHub API docs: https://developer.github.com/v3/activity/events/types/#projectevent -type ProjectEvent struct { - Action *string `json:"action,omitempty"` - Changes *ProjectChange `json:"changes,omitempty"` - Project *Project `json:"project,omitempty"` - - // The following fields are only populated by Webhook events. - Repo *Repository `json:"repository,omitempty"` - Org *Organization `json:"organization,omitempty"` - Sender *User `json:"sender,omitempty"` - Installation *Installation `json:"installation,omitempty"` -} - -// ProjectCardEvent is triggered when a project card is created, updated, moved, converted to an issue, or deleted. -// The webhook event name is "project_card". -// -// GitHub API docs: https://developer.github.com/v3/activity/events/types/#projectcardevent -type ProjectCardEvent struct { - Action *string `json:"action,omitempty"` - Changes *ProjectCardChange `json:"changes,omitempty"` - AfterID *int64 `json:"after_id,omitempty"` - ProjectCard *ProjectCard `json:"project_card,omitempty"` - - // The following fields are only populated by Webhook events. - Repo *Repository `json:"repository,omitempty"` - Org *Organization `json:"organization,omitempty"` - Sender *User `json:"sender,omitempty"` - Installation *Installation `json:"installation,omitempty"` -} - -// ProjectColumnEvent is triggered when a project column is created, updated, moved, or deleted. -// The webhook event name is "project_column". -// -// GitHub API docs: https://developer.github.com/v3/activity/events/types/#projectcolumnevent -type ProjectColumnEvent struct { - Action *string `json:"action,omitempty"` - Changes *ProjectColumnChange `json:"changes,omitempty"` - AfterID *int64 `json:"after_id,omitempty"` - ProjectColumn *ProjectColumn `json:"project_column,omitempty"` - - // The following fields are only populated by Webhook events. - Repo *Repository `json:"repository,omitempty"` - Org *Organization `json:"organization,omitempty"` - Sender *User `json:"sender,omitempty"` - Installation *Installation `json:"installation,omitempty"` -} - -// PublicEvent is triggered when a private repository is open sourced. -// According to GitHub: "Without a doubt: the best GitHub event." -// The Webhook event name is "public". -// -// GitHub API docs: https://developer.github.com/v3/activity/events/types/#publicevent -type PublicEvent struct { - // The following fields are only populated by Webhook events. - Repo *Repository `json:"repository,omitempty"` - Sender *User `json:"sender,omitempty"` - Installation *Installation `json:"installation,omitempty"` -} - -// PullRequestEvent is triggered when a pull request is assigned, unassigned, labeled, -// unlabeled, opened, edited, closed, reopened, synchronize, ready_for_review, -// locked, unlocked, a pull request review is requested, or a review request is removed. -// The Webhook event name is "pull_request". -// -// GitHub API docs: https://developer.github.com/v3/activity/events/types/#pullrequestevent -type PullRequestEvent struct { - // Action is the action that was performed. Possible values are: - // "assigned", "unassigned", "review_requested", "review_request_removed", "labeled", "unlabeled", - // "opened", "edited", "closed", "ready_for_review", "locked", "unlocked", or "reopened". - // If the action is "closed" and the "merged" key is "false", the pull request was closed with unmerged commits. - // If the action is "closed" and the "merged" key is "true", the pull request was merged. - // While webhooks are also triggered when a pull request is synchronized, Events API timelines - // don't include pull request events with the "synchronize" action. - Action *string `json:"action,omitempty"` - Assignee *User `json:"assignee,omitempty"` - Number *int `json:"number,omitempty"` - PullRequest *PullRequest `json:"pull_request,omitempty"` - - // The following fields are only populated by Webhook events. - Changes *EditChange `json:"changes,omitempty"` - // RequestedReviewer is populated in "review_requested", "review_request_removed" event deliveries. - // A request affecting multiple reviewers at once is split into multiple - // such event deliveries, each with a single, different RequestedReviewer. - RequestedReviewer *User `json:"requested_reviewer,omitempty"` - // In the event that a team is requested instead of a user, "requested_team" gets sent in place of - // "requested_user" with the same delivery behavior. - RequestedTeam *Team `json:"requested_team,omitempty"` - Repo *Repository `json:"repository,omitempty"` - Sender *User `json:"sender,omitempty"` - Installation *Installation `json:"installation,omitempty"` - Label *Label `json:"label,omitempty"` // Populated in "labeled" event deliveries. - - // The following field is only present when the webhook is triggered on - // a repository belonging to an organization. - Organization *Organization `json:"organization,omitempty"` -} - -// PullRequestReviewEvent is triggered when a review is submitted on a pull -// request. -// The Webhook event name is "pull_request_review". -// -// GitHub API docs: https://developer.github.com/v3/activity/events/types/#pullrequestreviewevent -type PullRequestReviewEvent struct { - // Action is always "submitted". - Action *string `json:"action,omitempty"` - Review *PullRequestReview `json:"review,omitempty"` - PullRequest *PullRequest `json:"pull_request,omitempty"` - - // The following fields are only populated by Webhook events. - Repo *Repository `json:"repository,omitempty"` - Sender *User `json:"sender,omitempty"` - Installation *Installation `json:"installation,omitempty"` - - // The following field is only present when the webhook is triggered on - // a repository belonging to an organization. - Organization *Organization `json:"organization,omitempty"` -} - -// PullRequestReviewCommentEvent is triggered when a comment is created on a -// portion of the unified diff of a pull request. -// The Webhook event name is "pull_request_review_comment". -// -// GitHub API docs: https://developer.github.com/v3/activity/events/types/#pullrequestreviewcommentevent -type PullRequestReviewCommentEvent struct { - // Action is the action that was performed on the comment. - // Possible values are: "created", "edited", "deleted". - Action *string `json:"action,omitempty"` - PullRequest *PullRequest `json:"pull_request,omitempty"` - Comment *PullRequestComment `json:"comment,omitempty"` - - // The following fields are only populated by Webhook events. - Changes *EditChange `json:"changes,omitempty"` - Repo *Repository `json:"repository,omitempty"` - Sender *User `json:"sender,omitempty"` - Installation *Installation `json:"installation,omitempty"` -} - -// PushEvent represents a git push to a GitHub repository. -// -// GitHub API docs: https://developer.github.com/v3/activity/events/types/#pushevent -type PushEvent struct { - PushID *int64 `json:"push_id,omitempty"` - Head *string `json:"head,omitempty"` - Ref *string `json:"ref,omitempty"` - Size *int `json:"size,omitempty"` - Commits []PushEventCommit `json:"commits,omitempty"` - Before *string `json:"before,omitempty"` - DistinctSize *int `json:"distinct_size,omitempty"` - - // The following fields are only populated by Webhook events. - After *string `json:"after,omitempty"` - Created *bool `json:"created,omitempty"` - Deleted *bool `json:"deleted,omitempty"` - Forced *bool `json:"forced,omitempty"` - BaseRef *string `json:"base_ref,omitempty"` - Compare *string `json:"compare,omitempty"` - Repo *PushEventRepository `json:"repository,omitempty"` - HeadCommit *PushEventCommit `json:"head_commit,omitempty"` - Pusher *User `json:"pusher,omitempty"` - Sender *User `json:"sender,omitempty"` - Installation *Installation `json:"installation,omitempty"` -} - -func (p PushEvent) String() string { - return Stringify(p) -} - -// PushEventCommit represents a git commit in a GitHub PushEvent. -type PushEventCommit struct { - Message *string `json:"message,omitempty"` - Author *CommitAuthor `json:"author,omitempty"` - URL *string `json:"url,omitempty"` - Distinct *bool `json:"distinct,omitempty"` - - // The following fields are only populated by Events API. - SHA *string `json:"sha,omitempty"` - - // The following fields are only populated by Webhook events. - ID *string `json:"id,omitempty"` - TreeID *string `json:"tree_id,omitempty"` - Timestamp *Timestamp `json:"timestamp,omitempty"` - Committer *CommitAuthor `json:"committer,omitempty"` - Added []string `json:"added,omitempty"` - Removed []string `json:"removed,omitempty"` - Modified []string `json:"modified,omitempty"` -} - -func (p PushEventCommit) String() string { - return Stringify(p) -} - -// PushEventRepository represents the repo object in a PushEvent payload. -type PushEventRepository struct { - ID *int64 `json:"id,omitempty"` - NodeID *string `json:"node_id,omitempty"` - Name *string `json:"name,omitempty"` - FullName *string `json:"full_name,omitempty"` - Owner *User `json:"owner,omitempty"` - Private *bool `json:"private,omitempty"` - Description *string `json:"description,omitempty"` - Fork *bool `json:"fork,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - PushedAt *Timestamp `json:"pushed_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - Homepage *string `json:"homepage,omitempty"` - PullsURL *string `json:"pulls_url,omitempty"` - Size *int `json:"size,omitempty"` - StargazersCount *int `json:"stargazers_count,omitempty"` - WatchersCount *int `json:"watchers_count,omitempty"` - Language *string `json:"language,omitempty"` - HasIssues *bool `json:"has_issues,omitempty"` - HasDownloads *bool `json:"has_downloads,omitempty"` - HasWiki *bool `json:"has_wiki,omitempty"` - HasPages *bool `json:"has_pages,omitempty"` - ForksCount *int `json:"forks_count,omitempty"` - OpenIssuesCount *int `json:"open_issues_count,omitempty"` - DefaultBranch *string `json:"default_branch,omitempty"` - MasterBranch *string `json:"master_branch,omitempty"` - Organization *string `json:"organization,omitempty"` - URL *string `json:"url,omitempty"` - ArchiveURL *string `json:"archive_url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - StatusesURL *string `json:"statuses_url,omitempty"` - GitURL *string `json:"git_url,omitempty"` - SSHURL *string `json:"ssh_url,omitempty"` - CloneURL *string `json:"clone_url,omitempty"` - SVNURL *string `json:"svn_url,omitempty"` -} - -// PushEventRepoOwner is a basic representation of user/org in a PushEvent payload. -type PushEventRepoOwner struct { - Name *string `json:"name,omitempty"` - Email *string `json:"email,omitempty"` -} - -// ReleaseEvent is triggered when a release is published, unpublished, created, -// edited, deleted, or prerelased. -// The Webhook event name is "release". -// -// GitHub API docs: https://developer.github.com/v3/activity/events/types/#releaseevent -type ReleaseEvent struct { - // Action is the action that was performed. Possible values are: "published", "unpublished", - // "created", "edited", "deleted", or "prereleased". - Action *string `json:"action,omitempty"` - Release *RepositoryRelease `json:"release,omitempty"` - - // The following fields are only populated by Webhook events. - Repo *Repository `json:"repository,omitempty"` - Sender *User `json:"sender,omitempty"` - Installation *Installation `json:"installation,omitempty"` -} - -// RepositoryEvent is triggered when a repository is created, archived, unarchived, -// renamed, edited, transferred, made public, or made private. Organization hooks are -// also trigerred when a repository is deleted. -// The Webhook event name is "repository". -// -// Events of this type are not visible in timelines, they are only used to -// trigger organization webhooks. -// -// GitHub API docs: https://developer.github.com/v3/activity/events/types/#repositoryevent -type RepositoryEvent struct { - // Action is the action that was performed. Possible values are: "created", - // "deleted" (organization hooks only), "archived", "unarchived", "edited", "renamed", - // "transferred", "publicized", or "privatized". - Action *string `json:"action,omitempty"` - Repo *Repository `json:"repository,omitempty"` - - // The following fields are only populated by Webhook events. - Org *Organization `json:"organization,omitempty"` - Sender *User `json:"sender,omitempty"` - Installation *Installation `json:"installation,omitempty"` -} - -// RepositoryVulnerabilityAlertEvent is triggered when a security alert is created, dismissed, or resolved. -// -// GitHub API docs: https://developer.github.com/v3/activity/events/types/#repositoryvulnerabilityalertevent -type RepositoryVulnerabilityAlertEvent struct { - // Action is the action that was performed. Possible values are: "create", "dismiss", "resolve". - Action *string `json:"action,omitempty"` - - //The security alert of the vulnerable dependency. - Alert *struct { - ID *int64 `json:"id,omitempty"` - AffectedRange *string `json:"affected_range,omitempty"` - AffectedPackageName *string `json:"affected_package_name,omitempty"` - ExternalReference *string `json:"external_reference,omitempty"` - ExternalIdentifier *string `json:"external_identifier,omitempty"` - FixedIn *string `json:"fixed_in,omitempty"` - Dismisser *User `json:"dismisser,omitempty"` - DismissReason *string `json:"dismiss_reason,omitempty"` - DismissedAt *Timestamp `json:"dismissed_at,omitempty"` - } `json:"alert,omitempty"` -} - -// StarEvent is triggered when a star is added or removed from a repository. -// The Webhook event name is "star". -// -// GitHub API docs: https://developer.github.com/v3/activity/events/types/#starevent -type StarEvent struct { - // Action is the action that was performed. Possible values are: "created" or "deleted". - Action *string `json:"action,omitempty"` - - // StarredAt is the time the star was created. It will be null for the "deleted" action. - StarredAt *Timestamp `json:"starred_at,omitempty"` -} - -// StatusEvent is triggered when the status of a Git commit changes. -// The Webhook event name is "status". -// -// Events of this type are not visible in timelines, they are only used to -// trigger hooks. -// -// GitHub API docs: https://developer.github.com/v3/activity/events/types/#statusevent -type StatusEvent struct { - SHA *string `json:"sha,omitempty"` - // State is the new state. Possible values are: "pending", "success", "failure", "error". - State *string `json:"state,omitempty"` - Description *string `json:"description,omitempty"` - TargetURL *string `json:"target_url,omitempty"` - Branches []*Branch `json:"branches,omitempty"` - - // The following fields are only populated by Webhook events. - ID *int64 `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Context *string `json:"context,omitempty"` - Commit *RepositoryCommit `json:"commit,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - Repo *Repository `json:"repository,omitempty"` - Sender *User `json:"sender,omitempty"` - Installation *Installation `json:"installation,omitempty"` -} - -// TeamEvent is triggered when an organization's team is created, modified or deleted. -// The Webhook event name is "team". -// -// Events of this type are not visible in timelines. These events are only used -// to trigger hooks. -// -// GitHub API docs: https://developer.github.com/v3/activity/events/types/#teamevent -type TeamEvent struct { - Action *string `json:"action,omitempty"` - Team *Team `json:"team,omitempty"` - Changes *TeamChange `json:"changes,omitempty"` - Repo *Repository `json:"repository,omitempty"` - - // The following fields are only populated by Webhook events. - Org *Organization `json:"organization,omitempty"` - Sender *User `json:"sender,omitempty"` - Installation *Installation `json:"installation,omitempty"` -} - -// TeamAddEvent is triggered when a repository is added to a team. -// The Webhook event name is "team_add". -// -// Events of this type are not visible in timelines. These events are only used -// to trigger hooks. -// -// GitHub API docs: https://developer.github.com/v3/activity/events/types/#teamaddevent -type TeamAddEvent struct { - Team *Team `json:"team,omitempty"` - Repo *Repository `json:"repository,omitempty"` - - // The following fields are only populated by Webhook events. - Org *Organization `json:"organization,omitempty"` - Sender *User `json:"sender,omitempty"` - Installation *Installation `json:"installation,omitempty"` -} - -// WatchEvent is related to starring a repository, not watching. See this API -// blog post for an explanation: https://developer.github.com/changes/2012-09-05-watcher-api/ -// -// The event’s actor is the user who starred a repository, and the event’s -// repository is the repository that was starred. -// -// GitHub API docs: https://developer.github.com/v3/activity/events/types/#watchevent -type WatchEvent struct { - // Action is the action that was performed. Possible value is: "started". - Action *string `json:"action,omitempty"` - - // The following fields are only populated by Webhook events. - Repo *Repository `json:"repository,omitempty"` - Sender *User `json:"sender,omitempty"` - Installation *Installation `json:"installation,omitempty"` -} diff --git a/vendor/github.com/google/go-github/v27/github/gists.go b/vendor/github.com/google/go-github/v27/github/gists.go deleted file mode 100644 index 36d9361967cb..000000000000 --- a/vendor/github.com/google/go-github/v27/github/gists.go +++ /dev/null @@ -1,363 +0,0 @@ -// Copyright 2013 The go-github AUTHORS. All rights reserved. -// -// Use of this source code is governed by BSD-style -// license that can be found in the LICENSE file. - -package github - -import ( - "context" - "fmt" - "time" -) - -// GistsService handles communication with the Gist related -// methods of the GitHub API. -// -// GitHub API docs: https://developer.github.com/v3/gists/ -type GistsService service - -// Gist represents a GitHub's gist. -type Gist struct { - ID *string `json:"id,omitempty"` - Description *string `json:"description,omitempty"` - Public *bool `json:"public,omitempty"` - Owner *User `json:"owner,omitempty"` - Files map[GistFilename]GistFile `json:"files,omitempty"` - Comments *int `json:"comments,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - GitPullURL *string `json:"git_pull_url,omitempty"` - GitPushURL *string `json:"git_push_url,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` - NodeID *string `json:"node_id,omitempty"` -} - -func (g Gist) String() string { - return Stringify(g) -} - -// GistFilename represents filename on a gist. -type GistFilename string - -// GistFile represents a file on a gist. -type GistFile struct { - Size *int `json:"size,omitempty"` - Filename *string `json:"filename,omitempty"` - Language *string `json:"language,omitempty"` - Type *string `json:"type,omitempty"` - RawURL *string `json:"raw_url,omitempty"` - Content *string `json:"content,omitempty"` -} - -func (g GistFile) String() string { - return Stringify(g) -} - -// GistCommit represents a commit on a gist. -type GistCommit struct { - URL *string `json:"url,omitempty"` - Version *string `json:"version,omitempty"` - User *User `json:"user,omitempty"` - ChangeStatus *CommitStats `json:"change_status,omitempty"` - CommittedAt *Timestamp `json:"committed_at,omitempty"` - NodeID *string `json:"node_id,omitempty"` -} - -func (gc GistCommit) String() string { - return Stringify(gc) -} - -// GistFork represents a fork of a gist. -type GistFork struct { - URL *string `json:"url,omitempty"` - User *User `json:"user,omitempty"` - ID *string `json:"id,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - NodeID *string `json:"node_id,omitempty"` -} - -func (gf GistFork) String() string { - return Stringify(gf) -} - -// GistListOptions specifies the optional parameters to the -// GistsService.List, GistsService.ListAll, and GistsService.ListStarred methods. -type GistListOptions struct { - // Since filters Gists by time. - Since time.Time `url:"since,omitempty"` - - ListOptions -} - -// List gists for a user. Passing the empty string will list -// all public gists if called anonymously. However, if the call -// is authenticated, it will returns all gists for the authenticated -// user. -// -// GitHub API docs: https://developer.github.com/v3/gists/#list-gists -func (s *GistsService) List(ctx context.Context, user string, opt *GistListOptions) ([]*Gist, *Response, error) { - var u string - if user != "" { - u = fmt.Sprintf("users/%v/gists", user) - } else { - u = "gists" - } - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var gists []*Gist - resp, err := s.client.Do(ctx, req, &gists) - if err != nil { - return nil, resp, err - } - - return gists, resp, nil -} - -// ListAll lists all public gists. -// -// GitHub API docs: https://developer.github.com/v3/gists/#list-gists -func (s *GistsService) ListAll(ctx context.Context, opt *GistListOptions) ([]*Gist, *Response, error) { - u, err := addOptions("gists/public", opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var gists []*Gist - resp, err := s.client.Do(ctx, req, &gists) - if err != nil { - return nil, resp, err - } - - return gists, resp, nil -} - -// ListStarred lists starred gists of authenticated user. -// -// GitHub API docs: https://developer.github.com/v3/gists/#list-gists -func (s *GistsService) ListStarred(ctx context.Context, opt *GistListOptions) ([]*Gist, *Response, error) { - u, err := addOptions("gists/starred", opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var gists []*Gist - resp, err := s.client.Do(ctx, req, &gists) - if err != nil { - return nil, resp, err - } - - return gists, resp, nil -} - -// Get a single gist. -// -// GitHub API docs: https://developer.github.com/v3/gists/#get-a-single-gist -func (s *GistsService) Get(ctx context.Context, id string) (*Gist, *Response, error) { - u := fmt.Sprintf("gists/%v", id) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - gist := new(Gist) - resp, err := s.client.Do(ctx, req, gist) - if err != nil { - return nil, resp, err - } - - return gist, resp, nil -} - -// GetRevision gets a specific revision of a gist. -// -// GitHub API docs: https://developer.github.com/v3/gists/#get-a-specific-revision-of-a-gist -func (s *GistsService) GetRevision(ctx context.Context, id, sha string) (*Gist, *Response, error) { - u := fmt.Sprintf("gists/%v/%v", id, sha) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - gist := new(Gist) - resp, err := s.client.Do(ctx, req, gist) - if err != nil { - return nil, resp, err - } - - return gist, resp, nil -} - -// Create a gist for authenticated user. -// -// GitHub API docs: https://developer.github.com/v3/gists/#create-a-gist -func (s *GistsService) Create(ctx context.Context, gist *Gist) (*Gist, *Response, error) { - u := "gists" - req, err := s.client.NewRequest("POST", u, gist) - if err != nil { - return nil, nil, err - } - - g := new(Gist) - resp, err := s.client.Do(ctx, req, g) - if err != nil { - return nil, resp, err - } - - return g, resp, nil -} - -// Edit a gist. -// -// GitHub API docs: https://developer.github.com/v3/gists/#edit-a-gist -func (s *GistsService) Edit(ctx context.Context, id string, gist *Gist) (*Gist, *Response, error) { - u := fmt.Sprintf("gists/%v", id) - req, err := s.client.NewRequest("PATCH", u, gist) - if err != nil { - return nil, nil, err - } - - g := new(Gist) - resp, err := s.client.Do(ctx, req, g) - if err != nil { - return nil, resp, err - } - - return g, resp, nil -} - -// ListCommits lists commits of a gist. -// -// GitHub API docs: https://developer.github.com/v3/gists/#list-gist-commits -func (s *GistsService) ListCommits(ctx context.Context, id string, opt *ListOptions) ([]*GistCommit, *Response, error) { - u := fmt.Sprintf("gists/%v/commits", id) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var gistCommits []*GistCommit - resp, err := s.client.Do(ctx, req, &gistCommits) - if err != nil { - return nil, resp, err - } - - return gistCommits, resp, nil -} - -// Delete a gist. -// -// GitHub API docs: https://developer.github.com/v3/gists/#delete-a-gist -func (s *GistsService) Delete(ctx context.Context, id string) (*Response, error) { - u := fmt.Sprintf("gists/%v", id) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - return s.client.Do(ctx, req, nil) -} - -// Star a gist on behalf of authenticated user. -// -// GitHub API docs: https://developer.github.com/v3/gists/#star-a-gist -func (s *GistsService) Star(ctx context.Context, id string) (*Response, error) { - u := fmt.Sprintf("gists/%v/star", id) - req, err := s.client.NewRequest("PUT", u, nil) - if err != nil { - return nil, err - } - return s.client.Do(ctx, req, nil) -} - -// Unstar a gist on a behalf of authenticated user. -// -// GitHub API docs: https://developer.github.com/v3/gists/#unstar-a-gist -func (s *GistsService) Unstar(ctx context.Context, id string) (*Response, error) { - u := fmt.Sprintf("gists/%v/star", id) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - return s.client.Do(ctx, req, nil) -} - -// IsStarred checks if a gist is starred by authenticated user. -// -// GitHub API docs: https://developer.github.com/v3/gists/#check-if-a-gist-is-starred -func (s *GistsService) IsStarred(ctx context.Context, id string) (bool, *Response, error) { - u := fmt.Sprintf("gists/%v/star", id) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return false, nil, err - } - resp, err := s.client.Do(ctx, req, nil) - starred, err := parseBoolResponse(err) - return starred, resp, err -} - -// Fork a gist. -// -// GitHub API docs: https://developer.github.com/v3/gists/#fork-a-gist -func (s *GistsService) Fork(ctx context.Context, id string) (*Gist, *Response, error) { - u := fmt.Sprintf("gists/%v/forks", id) - req, err := s.client.NewRequest("POST", u, nil) - if err != nil { - return nil, nil, err - } - - g := new(Gist) - resp, err := s.client.Do(ctx, req, g) - if err != nil { - return nil, resp, err - } - - return g, resp, nil -} - -// ListForks lists forks of a gist. -// -// GitHub API docs: https://developer.github.com/v3/gists/#list-gist-forks -func (s *GistsService) ListForks(ctx context.Context, id string, opt *ListOptions) ([]*GistFork, *Response, error) { - u := fmt.Sprintf("gists/%v/forks", id) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var gistForks []*GistFork - resp, err := s.client.Do(ctx, req, &gistForks) - if err != nil { - return nil, resp, err - } - - return gistForks, resp, nil -} diff --git a/vendor/github.com/google/go-github/v27/github/gists_comments.go b/vendor/github.com/google/go-github/v27/github/gists_comments.go deleted file mode 100644 index d5322e3d852e..000000000000 --- a/vendor/github.com/google/go-github/v27/github/gists_comments.go +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright 2013 The go-github 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 - -import ( - "context" - "fmt" - "time" -) - -// GistComment represents a Gist comment. -type GistComment struct { - ID *int64 `json:"id,omitempty"` - URL *string `json:"url,omitempty"` - Body *string `json:"body,omitempty"` - User *User `json:"user,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` -} - -func (g GistComment) String() string { - return Stringify(g) -} - -// ListComments lists all comments for a gist. -// -// GitHub API docs: https://developer.github.com/v3/gists/comments/#list-comments-on-a-gist -func (s *GistsService) ListComments(ctx context.Context, gistID string, opt *ListOptions) ([]*GistComment, *Response, error) { - u := fmt.Sprintf("gists/%v/comments", gistID) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var comments []*GistComment - resp, err := s.client.Do(ctx, req, &comments) - if err != nil { - return nil, resp, err - } - - return comments, resp, nil -} - -// GetComment retrieves a single comment from a gist. -// -// GitHub API docs: https://developer.github.com/v3/gists/comments/#get-a-single-comment -func (s *GistsService) GetComment(ctx context.Context, gistID string, commentID int64) (*GistComment, *Response, error) { - u := fmt.Sprintf("gists/%v/comments/%v", gistID, commentID) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - c := new(GistComment) - resp, err := s.client.Do(ctx, req, c) - if err != nil { - return nil, resp, err - } - - return c, resp, nil -} - -// CreateComment creates a comment for a gist. -// -// GitHub API docs: https://developer.github.com/v3/gists/comments/#create-a-comment -func (s *GistsService) CreateComment(ctx context.Context, gistID string, comment *GistComment) (*GistComment, *Response, error) { - u := fmt.Sprintf("gists/%v/comments", gistID) - req, err := s.client.NewRequest("POST", u, comment) - if err != nil { - return nil, nil, err - } - - c := new(GistComment) - resp, err := s.client.Do(ctx, req, c) - if err != nil { - return nil, resp, err - } - - return c, resp, nil -} - -// EditComment edits an existing gist comment. -// -// GitHub API docs: https://developer.github.com/v3/gists/comments/#edit-a-comment -func (s *GistsService) EditComment(ctx context.Context, gistID string, commentID int64, comment *GistComment) (*GistComment, *Response, error) { - u := fmt.Sprintf("gists/%v/comments/%v", gistID, commentID) - req, err := s.client.NewRequest("PATCH", u, comment) - if err != nil { - return nil, nil, err - } - - c := new(GistComment) - resp, err := s.client.Do(ctx, req, c) - if err != nil { - return nil, resp, err - } - - return c, resp, nil -} - -// DeleteComment deletes a gist comment. -// -// GitHub API docs: https://developer.github.com/v3/gists/comments/#delete-a-comment -func (s *GistsService) DeleteComment(ctx context.Context, gistID string, commentID int64) (*Response, error) { - u := fmt.Sprintf("gists/%v/comments/%v", gistID, commentID) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} diff --git a/vendor/github.com/google/go-github/v27/github/git.go b/vendor/github.com/google/go-github/v27/github/git.go deleted file mode 100644 index 1ce47437bd31..000000000000 --- a/vendor/github.com/google/go-github/v27/github/git.go +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2013 The go-github 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 - -// GitService handles communication with the git data related -// methods of the GitHub API. -// -// GitHub API docs: https://developer.github.com/v3/git/ -type GitService service diff --git a/vendor/github.com/google/go-github/v27/github/git_blobs.go b/vendor/github.com/google/go-github/v27/github/git_blobs.go deleted file mode 100644 index 70aee14a7ae4..000000000000 --- a/vendor/github.com/google/go-github/v27/github/git_blobs.go +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2013 The go-github 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 - -import ( - "bytes" - "context" - "fmt" -) - -// Blob represents a blob object. -type Blob struct { - Content *string `json:"content,omitempty"` - Encoding *string `json:"encoding,omitempty"` - SHA *string `json:"sha,omitempty"` - Size *int `json:"size,omitempty"` - URL *string `json:"url,omitempty"` - NodeID *string `json:"node_id,omitempty"` -} - -// GetBlob fetches a blob from a repo given a SHA. -// -// GitHub API docs: https://developer.github.com/v3/git/blobs/#get-a-blob -func (s *GitService) GetBlob(ctx context.Context, owner string, repo string, sha string) (*Blob, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/git/blobs/%v", owner, repo, sha) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - blob := new(Blob) - resp, err := s.client.Do(ctx, req, blob) - return blob, resp, err -} - -// GetBlobRaw fetches a blob's contents from a repo. -// Unlike GetBlob, it returns the raw bytes rather than the base64-encoded data. -// -// GitHub API docs: https://developer.github.com/v3/git/blobs/#get-a-blob -func (s *GitService) GetBlobRaw(ctx context.Context, owner, repo, sha string) ([]byte, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/git/blobs/%v", owner, repo, sha) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - req.Header.Set("Accept", "application/vnd.github.v3.raw") - - var buf bytes.Buffer - resp, err := s.client.Do(ctx, req, &buf) - return buf.Bytes(), resp, err -} - -// CreateBlob creates a blob object. -// -// GitHub API docs: https://developer.github.com/v3/git/blobs/#create-a-blob -func (s *GitService) CreateBlob(ctx context.Context, owner string, repo string, blob *Blob) (*Blob, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/git/blobs", owner, repo) - req, err := s.client.NewRequest("POST", u, blob) - if err != nil { - return nil, nil, err - } - - t := new(Blob) - resp, err := s.client.Do(ctx, req, t) - return t, resp, err -} diff --git a/vendor/github.com/google/go-github/v27/github/git_commits.go b/vendor/github.com/google/go-github/v27/github/git_commits.go deleted file mode 100644 index 741961980a18..000000000000 --- a/vendor/github.com/google/go-github/v27/github/git_commits.go +++ /dev/null @@ -1,200 +0,0 @@ -// Copyright 2013 The go-github 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 - -import ( - "bytes" - "context" - "errors" - "fmt" - "strings" - "time" - - "golang.org/x/crypto/openpgp" -) - -// SignatureVerification represents GPG signature verification. -type SignatureVerification struct { - Verified *bool `json:"verified,omitempty"` - Reason *string `json:"reason,omitempty"` - Signature *string `json:"signature,omitempty"` - Payload *string `json:"payload,omitempty"` -} - -// Commit represents a GitHub commit. -type Commit struct { - SHA *string `json:"sha,omitempty"` - Author *CommitAuthor `json:"author,omitempty"` - Committer *CommitAuthor `json:"committer,omitempty"` - Message *string `json:"message,omitempty"` - Tree *Tree `json:"tree,omitempty"` - Parents []Commit `json:"parents,omitempty"` - Stats *CommitStats `json:"stats,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - URL *string `json:"url,omitempty"` - Verification *SignatureVerification `json:"verification,omitempty"` - NodeID *string `json:"node_id,omitempty"` - - // CommentCount is the number of GitHub comments on the commit. This - // is only populated for requests that fetch GitHub data like - // Pulls.ListCommits, Repositories.ListCommits, etc. - CommentCount *int `json:"comment_count,omitempty"` - - // SigningKey denotes a key to sign the commit with. If not nil this key will - // be used to sign the commit. The private key must be present and already - // decrypted. Ignored if Verification.Signature is defined. - SigningKey *openpgp.Entity `json:"-"` -} - -func (c Commit) String() string { - return Stringify(c) -} - -// CommitAuthor represents the author or committer of a commit. The commit -// author may not correspond to a GitHub User. -type CommitAuthor struct { - Date *time.Time `json:"date,omitempty"` - Name *string `json:"name,omitempty"` - Email *string `json:"email,omitempty"` - - // The following fields are only populated by Webhook events. - Login *string `json:"username,omitempty"` // Renamed for go-github consistency. -} - -func (c CommitAuthor) String() string { - return Stringify(c) -} - -// GetCommit fetches the Commit object for a given SHA. -// -// GitHub API docs: https://developer.github.com/v3/git/commits/#get-a-commit -func (s *GitService) GetCommit(ctx context.Context, owner string, repo string, sha string) (*Commit, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/git/commits/%v", owner, repo, sha) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - c := new(Commit) - resp, err := s.client.Do(ctx, req, c) - if err != nil { - return nil, resp, err - } - - return c, resp, nil -} - -// createCommit represents the body of a CreateCommit request. -type createCommit struct { - Author *CommitAuthor `json:"author,omitempty"` - Committer *CommitAuthor `json:"committer,omitempty"` - Message *string `json:"message,omitempty"` - Tree *string `json:"tree,omitempty"` - Parents []string `json:"parents,omitempty"` - Signature *string `json:"signature,omitempty"` -} - -// CreateCommit creates a new commit in a repository. -// commit must not be nil. -// -// The commit.Committer is optional and will be filled with the commit.Author -// data if omitted. If the commit.Author is omitted, it will be filled in with -// the authenticated user’s information and the current date. -// -// GitHub API docs: https://developer.github.com/v3/git/commits/#create-a-commit -func (s *GitService) CreateCommit(ctx context.Context, owner string, repo string, commit *Commit) (*Commit, *Response, error) { - if commit == nil { - return nil, nil, fmt.Errorf("commit must be provided") - } - - u := fmt.Sprintf("repos/%v/%v/git/commits", owner, repo) - - parents := make([]string, len(commit.Parents)) - for i, parent := range commit.Parents { - parents[i] = *parent.SHA - } - - body := &createCommit{ - Author: commit.Author, - Committer: commit.Committer, - Message: commit.Message, - Parents: parents, - } - if commit.Tree != nil { - body.Tree = commit.Tree.SHA - } - if commit.SigningKey != nil { - signature, err := createSignature(commit.SigningKey, body) - if err != nil { - return nil, nil, err - } - body.Signature = &signature - } - if commit.Verification != nil { - body.Signature = commit.Verification.Signature - } - - req, err := s.client.NewRequest("POST", u, body) - if err != nil { - return nil, nil, err - } - - c := new(Commit) - resp, err := s.client.Do(ctx, req, c) - if err != nil { - return nil, resp, err - } - - return c, resp, nil -} - -func createSignature(signingKey *openpgp.Entity, commit *createCommit) (string, error) { - if signingKey == nil || commit == nil { - return "", errors.New("createSignature: invalid parameters") - } - - message, err := createSignatureMessage(commit) - if err != nil { - return "", err - } - - writer := new(bytes.Buffer) - reader := bytes.NewReader([]byte(message)) - if err := openpgp.ArmoredDetachSign(writer, signingKey, reader, nil); err != nil { - return "", err - } - - return writer.String(), nil -} - -func createSignatureMessage(commit *createCommit) (string, error) { - if commit == nil || commit.Message == nil || *commit.Message == "" || commit.Author == nil { - return "", errors.New("createSignatureMessage: invalid parameters") - } - - var message []string - - if commit.Tree != nil { - message = append(message, fmt.Sprintf("tree %s", *commit.Tree)) - } - - for _, parent := range commit.Parents { - message = append(message, fmt.Sprintf("parent %s", parent)) - } - - message = append(message, fmt.Sprintf("author %s <%s> %d %s", commit.Author.GetName(), commit.Author.GetEmail(), commit.Author.GetDate().Unix(), commit.Author.GetDate().Format("-0700"))) - - committer := commit.Committer - if committer == nil { - committer = commit.Author - } - - // There needs to be a double newline after committer - message = append(message, fmt.Sprintf("committer %s <%s> %d %s\n", committer.GetName(), committer.GetEmail(), committer.GetDate().Unix(), committer.GetDate().Format("-0700"))) - message = append(message, *commit.Message) - - return strings.Join(message, "\n"), nil -} diff --git a/vendor/github.com/google/go-github/v27/github/git_refs.go b/vendor/github.com/google/go-github/v27/github/git_refs.go deleted file mode 100644 index fe16880e7b0e..000000000000 --- a/vendor/github.com/google/go-github/v27/github/git_refs.go +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright 2013 The go-github 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 - -import ( - "context" - "encoding/json" - "errors" - "fmt" - "net/url" - "strings" -) - -// Reference represents a GitHub reference. -type Reference struct { - Ref *string `json:"ref"` - URL *string `json:"url"` - Object *GitObject `json:"object"` - NodeID *string `json:"node_id,omitempty"` -} - -func (r Reference) String() string { - return Stringify(r) -} - -// GitObject represents a Git object. -type GitObject struct { - Type *string `json:"type"` - SHA *string `json:"sha"` - URL *string `json:"url"` -} - -func (o GitObject) String() string { - return Stringify(o) -} - -// createRefRequest represents the payload for creating a reference. -type createRefRequest struct { - Ref *string `json:"ref"` - SHA *string `json:"sha"` -} - -// updateRefRequest represents the payload for updating a reference. -type updateRefRequest struct { - SHA *string `json:"sha"` - Force *bool `json:"force"` -} - -// GetRef fetches a single Reference object for a given Git ref. -// If there is no exact match, GetRef will return an error. -// -// Note: The GitHub API can return multiple matches. -// If you wish to use this functionality please use the GetRefs() method. -// -// GitHub API docs: https://developer.github.com/v3/git/refs/#get-a-reference -func (s *GitService) GetRef(ctx context.Context, owner string, repo string, ref string) (*Reference, *Response, error) { - ref = strings.TrimPrefix(ref, "refs/") - u := fmt.Sprintf("repos/%v/%v/git/refs/%v", owner, repo, url.QueryEscape(ref)) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - r := new(Reference) - resp, err := s.client.Do(ctx, req, r) - if _, ok := err.(*json.UnmarshalTypeError); ok { - // Multiple refs, means there wasn't an exact match. - return nil, resp, errors.New("multiple matches found for this ref") - } else if resp.StatusCode == 404 { - // No ref, there was no match for the ref - return nil, resp, errors.New("no match found for this ref") - } else if err != nil { - return nil, resp, err - } - - return r, resp, nil -} - -// GetRefs fetches a slice of Reference objects for a given Git ref. -// If there is an exact match, only that ref is returned. -// If there is no exact match, GitHub returns all refs that start with ref. -// If returned error is nil, there will be at least 1 ref returned. -// For example: -// -// "heads/featureA" -> ["refs/heads/featureA"] // Exact match, single ref is returned. -// "heads/feature" -> ["refs/heads/featureA", "refs/heads/featureB"] // All refs that start with ref. -// "heads/notexist" -> [] // Returns an error. -// -// GitHub API docs: https://developer.github.com/v3/git/refs/#get-a-reference -func (s *GitService) GetRefs(ctx context.Context, owner string, repo string, ref string) ([]*Reference, *Response, error) { - ref = strings.TrimPrefix(ref, "refs/") - u := fmt.Sprintf("repos/%v/%v/git/refs/%v", owner, repo, url.QueryEscape(ref)) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var rawJSON json.RawMessage - resp, err := s.client.Do(ctx, req, &rawJSON) - if err != nil { - return nil, resp, err - } - - // Prioritize the most common case: a single returned ref. - r := new(Reference) - singleUnmarshalError := json.Unmarshal(rawJSON, r) - if singleUnmarshalError == nil { - return []*Reference{r}, resp, nil - } - - // Attempt to unmarshal multiple refs. - var rs []*Reference - multipleUnmarshalError := json.Unmarshal(rawJSON, &rs) - if multipleUnmarshalError == nil { - if len(rs) == 0 { - return nil, resp, fmt.Errorf("unexpected response from GitHub API: an array of refs with length 0") - } - return rs, resp, nil - } - - return nil, resp, fmt.Errorf("unmarshalling failed for both single and multiple refs: %s and %s", singleUnmarshalError, multipleUnmarshalError) -} - -// ReferenceListOptions specifies optional parameters to the -// GitService.ListRefs method. -type ReferenceListOptions struct { - Type string `url:"-"` - - ListOptions -} - -// ListRefs lists all refs in a repository. -// -// GitHub API docs: https://developer.github.com/v3/git/refs/#get-all-references -func (s *GitService) ListRefs(ctx context.Context, owner, repo string, opt *ReferenceListOptions) ([]*Reference, *Response, error) { - var u string - if opt != nil && opt.Type != "" { - u = fmt.Sprintf("repos/%v/%v/git/refs/%v", owner, repo, opt.Type) - } else { - u = fmt.Sprintf("repos/%v/%v/git/refs", owner, repo) - } - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var rs []*Reference - resp, err := s.client.Do(ctx, req, &rs) - if err != nil { - return nil, resp, err - } - - return rs, resp, nil -} - -// CreateRef creates a new ref in a repository. -// -// GitHub API docs: https://developer.github.com/v3/git/refs/#create-a-reference -func (s *GitService) CreateRef(ctx context.Context, owner string, repo string, ref *Reference) (*Reference, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/git/refs", owner, repo) - req, err := s.client.NewRequest("POST", u, &createRefRequest{ - // back-compat with previous behavior that didn't require 'refs/' prefix - Ref: String("refs/" + strings.TrimPrefix(*ref.Ref, "refs/")), - SHA: ref.Object.SHA, - }) - if err != nil { - return nil, nil, err - } - - r := new(Reference) - resp, err := s.client.Do(ctx, req, r) - if err != nil { - return nil, resp, err - } - - return r, resp, nil -} - -// UpdateRef updates an existing ref in a repository. -// -// GitHub API docs: https://developer.github.com/v3/git/refs/#update-a-reference -func (s *GitService) UpdateRef(ctx context.Context, owner string, repo string, ref *Reference, force bool) (*Reference, *Response, error) { - refPath := strings.TrimPrefix(*ref.Ref, "refs/") - u := fmt.Sprintf("repos/%v/%v/git/refs/%v", owner, repo, refPath) - req, err := s.client.NewRequest("PATCH", u, &updateRefRequest{ - SHA: ref.Object.SHA, - Force: &force, - }) - if err != nil { - return nil, nil, err - } - - r := new(Reference) - resp, err := s.client.Do(ctx, req, r) - if err != nil { - return nil, resp, err - } - - return r, resp, nil -} - -// DeleteRef deletes a ref from a repository. -// -// GitHub API docs: https://developer.github.com/v3/git/refs/#delete-a-reference -func (s *GitService) DeleteRef(ctx context.Context, owner string, repo string, ref string) (*Response, error) { - ref = strings.TrimPrefix(ref, "refs/") - u := fmt.Sprintf("repos/%v/%v/git/refs/%v", owner, repo, url.QueryEscape(ref)) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} diff --git a/vendor/github.com/google/go-github/v27/github/git_tags.go b/vendor/github.com/google/go-github/v27/github/git_tags.go deleted file mode 100644 index abdbde6821b0..000000000000 --- a/vendor/github.com/google/go-github/v27/github/git_tags.go +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2013 The go-github 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 - -import ( - "context" - "fmt" -) - -// Tag represents a tag object. -type Tag struct { - Tag *string `json:"tag,omitempty"` - SHA *string `json:"sha,omitempty"` - URL *string `json:"url,omitempty"` - Message *string `json:"message,omitempty"` - Tagger *CommitAuthor `json:"tagger,omitempty"` - Object *GitObject `json:"object,omitempty"` - Verification *SignatureVerification `json:"verification,omitempty"` - NodeID *string `json:"node_id,omitempty"` -} - -// createTagRequest represents the body of a CreateTag request. This is mostly -// identical to Tag with the exception that the object SHA and Type are -// top-level fields, rather than being nested inside a JSON object. -type createTagRequest struct { - Tag *string `json:"tag,omitempty"` - Message *string `json:"message,omitempty"` - Object *string `json:"object,omitempty"` - Type *string `json:"type,omitempty"` - Tagger *CommitAuthor `json:"tagger,omitempty"` -} - -// GetTag fetches a tag from a repo given a SHA. -// -// GitHub API docs: https://developer.github.com/v3/git/tags/#get-a-tag -func (s *GitService) GetTag(ctx context.Context, owner string, repo string, sha string) (*Tag, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/git/tags/%v", owner, repo, sha) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - tag := new(Tag) - resp, err := s.client.Do(ctx, req, tag) - return tag, resp, err -} - -// CreateTag creates a tag object. -// -// GitHub API docs: https://developer.github.com/v3/git/tags/#create-a-tag-object -func (s *GitService) CreateTag(ctx context.Context, owner string, repo string, tag *Tag) (*Tag, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/git/tags", owner, repo) - - // convert Tag into a createTagRequest - tagRequest := &createTagRequest{ - Tag: tag.Tag, - Message: tag.Message, - Tagger: tag.Tagger, - } - if tag.Object != nil { - tagRequest.Object = tag.Object.SHA - tagRequest.Type = tag.Object.Type - } - - req, err := s.client.NewRequest("POST", u, tagRequest) - if err != nil { - return nil, nil, err - } - - t := new(Tag) - resp, err := s.client.Do(ctx, req, t) - return t, resp, err -} diff --git a/vendor/github.com/google/go-github/v27/github/git_trees.go b/vendor/github.com/google/go-github/v27/github/git_trees.go deleted file mode 100644 index 4bc2913541ad..000000000000 --- a/vendor/github.com/google/go-github/v27/github/git_trees.go +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright 2013 The go-github 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 - -import ( - "context" - "fmt" -) - -// Tree represents a GitHub tree. -type Tree struct { - SHA *string `json:"sha,omitempty"` - Entries []TreeEntry `json:"tree,omitempty"` - - // Truncated is true if the number of items in the tree - // exceeded GitHub's maximum limit and the Entries were truncated - // in the response. Only populated for requests that fetch - // trees like Git.GetTree. - Truncated *bool `json:"truncated,omitempty"` -} - -func (t Tree) String() string { - return Stringify(t) -} - -// TreeEntry represents the contents of a tree structure. TreeEntry can -// represent either a blob, a commit (in the case of a submodule), or another -// tree. -type TreeEntry struct { - SHA *string `json:"sha,omitempty"` - Path *string `json:"path,omitempty"` - Mode *string `json:"mode,omitempty"` - Type *string `json:"type,omitempty"` - Size *int `json:"size,omitempty"` - Content *string `json:"content,omitempty"` - URL *string `json:"url,omitempty"` -} - -func (t TreeEntry) String() string { - return Stringify(t) -} - -// GetTree fetches the Tree object for a given sha hash from a repository. -// -// GitHub API docs: https://developer.github.com/v3/git/trees/#get-a-tree -func (s *GitService) GetTree(ctx context.Context, owner string, repo string, sha string, recursive bool) (*Tree, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/git/trees/%v", owner, repo, sha) - if recursive { - u += "?recursive=1" - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - t := new(Tree) - resp, err := s.client.Do(ctx, req, t) - if err != nil { - return nil, resp, err - } - - return t, resp, nil -} - -// createTree represents the body of a CreateTree request. -type createTree struct { - BaseTree string `json:"base_tree,omitempty"` - Entries []TreeEntry `json:"tree"` -} - -// CreateTree creates a new tree in a repository. If both a tree and a nested -// path modifying that tree are specified, it will overwrite the contents of -// that tree with the new path contents and write a new tree out. -// -// GitHub API docs: https://developer.github.com/v3/git/trees/#create-a-tree -func (s *GitService) CreateTree(ctx context.Context, owner string, repo string, baseTree string, entries []TreeEntry) (*Tree, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/git/trees", owner, repo) - - body := &createTree{ - BaseTree: baseTree, - Entries: entries, - } - req, err := s.client.NewRequest("POST", u, body) - if err != nil { - return nil, nil, err - } - - t := new(Tree) - resp, err := s.client.Do(ctx, req, t) - if err != nil { - return nil, resp, err - } - - return t, resp, nil -} diff --git a/vendor/github.com/google/go-github/v27/github/github-accessors.go b/vendor/github.com/google/go-github/v27/github/github-accessors.go deleted file mode 100644 index 434cc938c628..000000000000 --- a/vendor/github.com/google/go-github/v27/github/github-accessors.go +++ /dev/null @@ -1,12981 +0,0 @@ -// Copyright 2017 The go-github AUTHORS. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Code generated by gen-accessors; DO NOT EDIT. - -package github - -import ( - "encoding/json" - "time" -) - -// GetRetryAfter returns the RetryAfter field if it's non-nil, zero value otherwise. -func (a *AbuseRateLimitError) GetRetryAfter() time.Duration { - if a == nil || a.RetryAfter == nil { - return 0 - } - return *a.RetryAfter -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (a *AdminEnforcement) GetURL() string { - if a == nil || a.URL == nil { - return "" - } - return *a.URL -} - -// GetComments returns the Comments field. -func (a *AdminStats) GetComments() *CommentStats { - if a == nil { - return nil - } - return a.Comments -} - -// GetGists returns the Gists field. -func (a *AdminStats) GetGists() *GistStats { - if a == nil { - return nil - } - return a.Gists -} - -// GetHooks returns the Hooks field. -func (a *AdminStats) GetHooks() *HookStats { - if a == nil { - return nil - } - return a.Hooks -} - -// GetIssues returns the Issues field. -func (a *AdminStats) GetIssues() *IssueStats { - if a == nil { - return nil - } - return a.Issues -} - -// GetMilestones returns the Milestones field. -func (a *AdminStats) GetMilestones() *MilestoneStats { - if a == nil { - return nil - } - return a.Milestones -} - -// GetOrgs returns the Orgs field. -func (a *AdminStats) GetOrgs() *OrgStats { - if a == nil { - return nil - } - return a.Orgs -} - -// GetPages returns the Pages field. -func (a *AdminStats) GetPages() *PageStats { - if a == nil { - return nil - } - return a.Pages -} - -// GetPulls returns the Pulls field. -func (a *AdminStats) GetPulls() *PullStats { - if a == nil { - return nil - } - return a.Pulls -} - -// GetRepos returns the Repos field. -func (a *AdminStats) GetRepos() *RepoStats { - if a == nil { - return nil - } - return a.Repos -} - -// GetUsers returns the Users field. -func (a *AdminStats) GetUsers() *UserStats { - if a == nil { - return nil - } - return a.Users -} - -// GetVerifiablePasswordAuthentication returns the VerifiablePasswordAuthentication field if it's non-nil, zero value otherwise. -func (a *APIMeta) GetVerifiablePasswordAuthentication() bool { - if a == nil || a.VerifiablePasswordAuthentication == nil { - return false - } - return *a.VerifiablePasswordAuthentication -} - -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (a *App) GetCreatedAt() Timestamp { - if a == nil || a.CreatedAt == nil { - return Timestamp{} - } - return *a.CreatedAt -} - -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (a *App) GetDescription() string { - if a == nil || a.Description == nil { - return "" - } - return *a.Description -} - -// GetExternalURL returns the ExternalURL field if it's non-nil, zero value otherwise. -func (a *App) GetExternalURL() string { - if a == nil || a.ExternalURL == nil { - return "" - } - return *a.ExternalURL -} - -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (a *App) GetHTMLURL() string { - if a == nil || a.HTMLURL == nil { - return "" - } - return *a.HTMLURL -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (a *App) GetID() int64 { - if a == nil || a.ID == nil { - return 0 - } - return *a.ID -} - -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (a *App) GetName() string { - if a == nil || a.Name == nil { - return "" - } - return *a.Name -} - -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (a *App) GetNodeID() string { - if a == nil || a.NodeID == nil { - return "" - } - return *a.NodeID -} - -// GetOwner returns the Owner field. -func (a *App) GetOwner() *User { - if a == nil { - return nil - } - return a.Owner -} - -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (a *App) GetUpdatedAt() Timestamp { - if a == nil || a.UpdatedAt == nil { - return Timestamp{} - } - return *a.UpdatedAt -} - -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (a *Attachment) GetBody() string { - if a == nil || a.Body == nil { - return "" - } - return *a.Body -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (a *Attachment) GetID() int64 { - if a == nil || a.ID == nil { - return 0 - } - return *a.ID -} - -// GetTitle returns the Title field if it's non-nil, zero value otherwise. -func (a *Attachment) GetTitle() string { - if a == nil || a.Title == nil { - return "" - } - return *a.Title -} - -// GetApp returns the App field. -func (a *Authorization) GetApp() *AuthorizationApp { - if a == nil { - return nil - } - return a.App -} - -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (a *Authorization) GetCreatedAt() Timestamp { - if a == nil || a.CreatedAt == nil { - return Timestamp{} - } - return *a.CreatedAt -} - -// GetFingerprint returns the Fingerprint field if it's non-nil, zero value otherwise. -func (a *Authorization) GetFingerprint() string { - if a == nil || a.Fingerprint == nil { - return "" - } - return *a.Fingerprint -} - -// GetHashedToken returns the HashedToken field if it's non-nil, zero value otherwise. -func (a *Authorization) GetHashedToken() string { - if a == nil || a.HashedToken == nil { - return "" - } - return *a.HashedToken -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (a *Authorization) GetID() int64 { - if a == nil || a.ID == nil { - return 0 - } - return *a.ID -} - -// GetNote returns the Note field if it's non-nil, zero value otherwise. -func (a *Authorization) GetNote() string { - if a == nil || a.Note == nil { - return "" - } - return *a.Note -} - -// GetNoteURL returns the NoteURL field if it's non-nil, zero value otherwise. -func (a *Authorization) GetNoteURL() string { - if a == nil || a.NoteURL == nil { - return "" - } - return *a.NoteURL -} - -// GetToken returns the Token field if it's non-nil, zero value otherwise. -func (a *Authorization) GetToken() string { - if a == nil || a.Token == nil { - return "" - } - return *a.Token -} - -// GetTokenLastEight returns the TokenLastEight field if it's non-nil, zero value otherwise. -func (a *Authorization) GetTokenLastEight() string { - if a == nil || a.TokenLastEight == nil { - return "" - } - return *a.TokenLastEight -} - -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (a *Authorization) GetUpdatedAt() Timestamp { - if a == nil || a.UpdatedAt == nil { - return Timestamp{} - } - return *a.UpdatedAt -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (a *Authorization) GetURL() string { - if a == nil || a.URL == nil { - return "" - } - return *a.URL -} - -// GetUser returns the User field. -func (a *Authorization) GetUser() *User { - if a == nil { - return nil - } - return a.User -} - -// GetClientID returns the ClientID field if it's non-nil, zero value otherwise. -func (a *AuthorizationApp) GetClientID() string { - if a == nil || a.ClientID == nil { - return "" - } - return *a.ClientID -} - -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (a *AuthorizationApp) GetName() string { - if a == nil || a.Name == nil { - return "" - } - return *a.Name -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (a *AuthorizationApp) GetURL() string { - if a == nil || a.URL == nil { - return "" - } - return *a.URL -} - -// GetClientID returns the ClientID field if it's non-nil, zero value otherwise. -func (a *AuthorizationRequest) GetClientID() string { - if a == nil || a.ClientID == nil { - return "" - } - return *a.ClientID -} - -// GetClientSecret returns the ClientSecret field if it's non-nil, zero value otherwise. -func (a *AuthorizationRequest) GetClientSecret() string { - if a == nil || a.ClientSecret == nil { - return "" - } - return *a.ClientSecret -} - -// GetFingerprint returns the Fingerprint field if it's non-nil, zero value otherwise. -func (a *AuthorizationRequest) GetFingerprint() string { - if a == nil || a.Fingerprint == nil { - return "" - } - return *a.Fingerprint -} - -// GetNote returns the Note field if it's non-nil, zero value otherwise. -func (a *AuthorizationRequest) GetNote() string { - if a == nil || a.Note == nil { - return "" - } - return *a.Note -} - -// GetNoteURL returns the NoteURL field if it's non-nil, zero value otherwise. -func (a *AuthorizationRequest) GetNoteURL() string { - if a == nil || a.NoteURL == nil { - return "" - } - return *a.NoteURL -} - -// GetFingerprint returns the Fingerprint field if it's non-nil, zero value otherwise. -func (a *AuthorizationUpdateRequest) GetFingerprint() string { - if a == nil || a.Fingerprint == nil { - return "" - } - return *a.Fingerprint -} - -// GetNote returns the Note field if it's non-nil, zero value otherwise. -func (a *AuthorizationUpdateRequest) GetNote() string { - if a == nil || a.Note == nil { - return "" - } - return *a.Note -} - -// GetNoteURL returns the NoteURL field if it's non-nil, zero value otherwise. -func (a *AuthorizationUpdateRequest) GetNoteURL() string { - if a == nil || a.NoteURL == nil { - return "" - } - return *a.NoteURL -} - -// GetAppID returns the AppID field if it's non-nil, zero value otherwise. -func (a *AutoTriggerCheck) GetAppID() int64 { - if a == nil || a.AppID == nil { - return 0 - } - return *a.AppID -} - -// GetSetting returns the Setting field if it's non-nil, zero value otherwise. -func (a *AutoTriggerCheck) GetSetting() bool { - if a == nil || a.Setting == nil { - return false - } - return *a.Setting -} - -// GetContent returns the Content field if it's non-nil, zero value otherwise. -func (b *Blob) GetContent() string { - if b == nil || b.Content == nil { - return "" - } - return *b.Content -} - -// GetEncoding returns the Encoding field if it's non-nil, zero value otherwise. -func (b *Blob) GetEncoding() string { - if b == nil || b.Encoding == nil { - return "" - } - return *b.Encoding -} - -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (b *Blob) GetNodeID() string { - if b == nil || b.NodeID == nil { - return "" - } - return *b.NodeID -} - -// GetSHA returns the SHA field if it's non-nil, zero value otherwise. -func (b *Blob) GetSHA() string { - if b == nil || b.SHA == nil { - return "" - } - return *b.SHA -} - -// GetSize returns the Size field if it's non-nil, zero value otherwise. -func (b *Blob) GetSize() int { - if b == nil || b.Size == nil { - return 0 - } - return *b.Size -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (b *Blob) GetURL() string { - if b == nil || b.URL == nil { - return "" - } - return *b.URL -} - -// GetCommit returns the Commit field. -func (b *Branch) GetCommit() *RepositoryCommit { - if b == nil { - return nil - } - return b.Commit -} - -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (b *Branch) GetName() string { - if b == nil || b.Name == nil { - return "" - } - return *b.Name -} - -// GetProtected returns the Protected field if it's non-nil, zero value otherwise. -func (b *Branch) GetProtected() bool { - if b == nil || b.Protected == nil { - return false - } - return *b.Protected -} - -// GetCommit returns the Commit field. -func (b *BranchCommit) GetCommit() *Commit { - if b == nil { - return nil - } - return b.Commit -} - -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (b *BranchCommit) GetName() string { - if b == nil || b.Name == nil { - return "" - } - return *b.Name -} - -// GetProtected returns the Protected field if it's non-nil, zero value otherwise. -func (b *BranchCommit) GetProtected() string { - if b == nil || b.Protected == nil { - return "" - } - return *b.Protected -} - -// GetApp returns the App field. -func (c *CheckRun) GetApp() *App { - if c == nil { - return nil - } - return c.App -} - -// GetCheckSuite returns the CheckSuite field. -func (c *CheckRun) GetCheckSuite() *CheckSuite { - if c == nil { - return nil - } - return c.CheckSuite -} - -// GetCompletedAt returns the CompletedAt field if it's non-nil, zero value otherwise. -func (c *CheckRun) GetCompletedAt() Timestamp { - if c == nil || c.CompletedAt == nil { - return Timestamp{} - } - return *c.CompletedAt -} - -// GetConclusion returns the Conclusion field if it's non-nil, zero value otherwise. -func (c *CheckRun) GetConclusion() string { - if c == nil || c.Conclusion == nil { - return "" - } - return *c.Conclusion -} - -// GetDetailsURL returns the DetailsURL field if it's non-nil, zero value otherwise. -func (c *CheckRun) GetDetailsURL() string { - if c == nil || c.DetailsURL == nil { - return "" - } - return *c.DetailsURL -} - -// GetExternalID returns the ExternalID field if it's non-nil, zero value otherwise. -func (c *CheckRun) GetExternalID() string { - if c == nil || c.ExternalID == nil { - return "" - } - return *c.ExternalID -} - -// GetHeadSHA returns the HeadSHA field if it's non-nil, zero value otherwise. -func (c *CheckRun) GetHeadSHA() string { - if c == nil || c.HeadSHA == nil { - return "" - } - return *c.HeadSHA -} - -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (c *CheckRun) GetHTMLURL() string { - if c == nil || c.HTMLURL == nil { - return "" - } - return *c.HTMLURL -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (c *CheckRun) GetID() int64 { - if c == nil || c.ID == nil { - return 0 - } - return *c.ID -} - -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (c *CheckRun) GetName() string { - if c == nil || c.Name == nil { - return "" - } - return *c.Name -} - -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (c *CheckRun) GetNodeID() string { - if c == nil || c.NodeID == nil { - return "" - } - return *c.NodeID -} - -// GetOutput returns the Output field. -func (c *CheckRun) GetOutput() *CheckRunOutput { - if c == nil { - return nil - } - return c.Output -} - -// GetStartedAt returns the StartedAt field if it's non-nil, zero value otherwise. -func (c *CheckRun) GetStartedAt() Timestamp { - if c == nil || c.StartedAt == nil { - return Timestamp{} - } - return *c.StartedAt -} - -// GetStatus returns the Status field if it's non-nil, zero value otherwise. -func (c *CheckRun) GetStatus() string { - if c == nil || c.Status == nil { - return "" - } - return *c.Status -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (c *CheckRun) GetURL() string { - if c == nil || c.URL == nil { - return "" - } - return *c.URL -} - -// GetAnnotationLevel returns the AnnotationLevel field if it's non-nil, zero value otherwise. -func (c *CheckRunAnnotation) GetAnnotationLevel() string { - if c == nil || c.AnnotationLevel == nil { - return "" - } - return *c.AnnotationLevel -} - -// GetBlobHRef returns the BlobHRef field if it's non-nil, zero value otherwise. -func (c *CheckRunAnnotation) GetBlobHRef() string { - if c == nil || c.BlobHRef == nil { - return "" - } - return *c.BlobHRef -} - -// GetEndLine returns the EndLine field if it's non-nil, zero value otherwise. -func (c *CheckRunAnnotation) GetEndLine() int { - if c == nil || c.EndLine == nil { - return 0 - } - return *c.EndLine -} - -// GetMessage returns the Message field if it's non-nil, zero value otherwise. -func (c *CheckRunAnnotation) GetMessage() string { - if c == nil || c.Message == nil { - return "" - } - return *c.Message -} - -// GetPath returns the Path field if it's non-nil, zero value otherwise. -func (c *CheckRunAnnotation) GetPath() string { - if c == nil || c.Path == nil { - return "" - } - return *c.Path -} - -// GetRawDetails returns the RawDetails field if it's non-nil, zero value otherwise. -func (c *CheckRunAnnotation) GetRawDetails() string { - if c == nil || c.RawDetails == nil { - return "" - } - return *c.RawDetails -} - -// GetStartLine returns the StartLine field if it's non-nil, zero value otherwise. -func (c *CheckRunAnnotation) GetStartLine() int { - if c == nil || c.StartLine == nil { - return 0 - } - return *c.StartLine -} - -// GetTitle returns the Title field if it's non-nil, zero value otherwise. -func (c *CheckRunAnnotation) GetTitle() string { - if c == nil || c.Title == nil { - return "" - } - return *c.Title -} - -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (c *CheckRunEvent) GetAction() string { - if c == nil || c.Action == nil { - return "" - } - return *c.Action -} - -// GetCheckRun returns the CheckRun field. -func (c *CheckRunEvent) GetCheckRun() *CheckRun { - if c == nil { - return nil - } - return c.CheckRun -} - -// GetInstallation returns the Installation field. -func (c *CheckRunEvent) GetInstallation() *Installation { - if c == nil { - return nil - } - return c.Installation -} - -// GetOrg returns the Org field. -func (c *CheckRunEvent) GetOrg() *Organization { - if c == nil { - return nil - } - return c.Org -} - -// GetRepo returns the Repo field. -func (c *CheckRunEvent) GetRepo() *Repository { - if c == nil { - return nil - } - return c.Repo -} - -// GetRequestedAction returns the RequestedAction field. -func (c *CheckRunEvent) GetRequestedAction() *RequestedAction { - if c == nil { - return nil - } - return c.RequestedAction -} - -// GetSender returns the Sender field. -func (c *CheckRunEvent) GetSender() *User { - if c == nil { - return nil - } - return c.Sender -} - -// GetAlt returns the Alt field if it's non-nil, zero value otherwise. -func (c *CheckRunImage) GetAlt() string { - if c == nil || c.Alt == nil { - return "" - } - return *c.Alt -} - -// GetCaption returns the Caption field if it's non-nil, zero value otherwise. -func (c *CheckRunImage) GetCaption() string { - if c == nil || c.Caption == nil { - return "" - } - return *c.Caption -} - -// GetImageURL returns the ImageURL field if it's non-nil, zero value otherwise. -func (c *CheckRunImage) GetImageURL() string { - if c == nil || c.ImageURL == nil { - return "" - } - return *c.ImageURL -} - -// GetAnnotationsCount returns the AnnotationsCount field if it's non-nil, zero value otherwise. -func (c *CheckRunOutput) GetAnnotationsCount() int { - if c == nil || c.AnnotationsCount == nil { - return 0 - } - return *c.AnnotationsCount -} - -// GetAnnotationsURL returns the AnnotationsURL field if it's non-nil, zero value otherwise. -func (c *CheckRunOutput) GetAnnotationsURL() string { - if c == nil || c.AnnotationsURL == nil { - return "" - } - return *c.AnnotationsURL -} - -// GetSummary returns the Summary field if it's non-nil, zero value otherwise. -func (c *CheckRunOutput) GetSummary() string { - if c == nil || c.Summary == nil { - return "" - } - return *c.Summary -} - -// GetText returns the Text field if it's non-nil, zero value otherwise. -func (c *CheckRunOutput) GetText() string { - if c == nil || c.Text == nil { - return "" - } - return *c.Text -} - -// GetTitle returns the Title field if it's non-nil, zero value otherwise. -func (c *CheckRunOutput) GetTitle() string { - if c == nil || c.Title == nil { - return "" - } - return *c.Title -} - -// GetAfterSHA returns the AfterSHA field if it's non-nil, zero value otherwise. -func (c *CheckSuite) GetAfterSHA() string { - if c == nil || c.AfterSHA == nil { - return "" - } - return *c.AfterSHA -} - -// GetApp returns the App field. -func (c *CheckSuite) GetApp() *App { - if c == nil { - return nil - } - return c.App -} - -// GetBeforeSHA returns the BeforeSHA field if it's non-nil, zero value otherwise. -func (c *CheckSuite) GetBeforeSHA() string { - if c == nil || c.BeforeSHA == nil { - return "" - } - return *c.BeforeSHA -} - -// GetConclusion returns the Conclusion field if it's non-nil, zero value otherwise. -func (c *CheckSuite) GetConclusion() string { - if c == nil || c.Conclusion == nil { - return "" - } - return *c.Conclusion -} - -// GetHeadBranch returns the HeadBranch field if it's non-nil, zero value otherwise. -func (c *CheckSuite) GetHeadBranch() string { - if c == nil || c.HeadBranch == nil { - return "" - } - return *c.HeadBranch -} - -// GetHeadCommit returns the HeadCommit field. -func (c *CheckSuite) GetHeadCommit() *Commit { - if c == nil { - return nil - } - return c.HeadCommit -} - -// GetHeadSHA returns the HeadSHA field if it's non-nil, zero value otherwise. -func (c *CheckSuite) GetHeadSHA() string { - if c == nil || c.HeadSHA == nil { - return "" - } - return *c.HeadSHA -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (c *CheckSuite) GetID() int64 { - if c == nil || c.ID == nil { - return 0 - } - return *c.ID -} - -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (c *CheckSuite) GetNodeID() string { - if c == nil || c.NodeID == nil { - return "" - } - return *c.NodeID -} - -// GetRepository returns the Repository field. -func (c *CheckSuite) GetRepository() *Repository { - if c == nil { - return nil - } - return c.Repository -} - -// GetStatus returns the Status field if it's non-nil, zero value otherwise. -func (c *CheckSuite) GetStatus() string { - if c == nil || c.Status == nil { - return "" - } - return *c.Status -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (c *CheckSuite) GetURL() string { - if c == nil || c.URL == nil { - return "" - } - return *c.URL -} - -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (c *CheckSuiteEvent) GetAction() string { - if c == nil || c.Action == nil { - return "" - } - return *c.Action -} - -// GetCheckSuite returns the CheckSuite field. -func (c *CheckSuiteEvent) GetCheckSuite() *CheckSuite { - if c == nil { - return nil - } - return c.CheckSuite -} - -// GetInstallation returns the Installation field. -func (c *CheckSuiteEvent) GetInstallation() *Installation { - if c == nil { - return nil - } - return c.Installation -} - -// GetOrg returns the Org field. -func (c *CheckSuiteEvent) GetOrg() *Organization { - if c == nil { - return nil - } - return c.Org -} - -// GetRepo returns the Repo field. -func (c *CheckSuiteEvent) GetRepo() *Repository { - if c == nil { - return nil - } - return c.Repo -} - -// GetSender returns the Sender field. -func (c *CheckSuiteEvent) GetSender() *User { - if c == nil { - return nil - } - return c.Sender -} - -// GetPreferences returns the Preferences field. -func (c *CheckSuitePreferenceResults) GetPreferences() *PreferenceList { - if c == nil { - return nil - } - return c.Preferences -} - -// GetRepository returns the Repository field. -func (c *CheckSuitePreferenceResults) GetRepository() *Repository { - if c == nil { - return nil - } - return c.Repository -} - -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (c *CodeOfConduct) GetBody() string { - if c == nil || c.Body == nil { - return "" - } - return *c.Body -} - -// GetKey returns the Key field if it's non-nil, zero value otherwise. -func (c *CodeOfConduct) GetKey() string { - if c == nil || c.Key == nil { - return "" - } - return *c.Key -} - -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (c *CodeOfConduct) GetName() string { - if c == nil || c.Name == nil { - return "" - } - return *c.Name -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (c *CodeOfConduct) GetURL() string { - if c == nil || c.URL == nil { - return "" - } - return *c.URL -} - -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (c *CodeResult) GetHTMLURL() string { - if c == nil || c.HTMLURL == nil { - return "" - } - return *c.HTMLURL -} - -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (c *CodeResult) GetName() string { - if c == nil || c.Name == nil { - return "" - } - return *c.Name -} - -// GetPath returns the Path field if it's non-nil, zero value otherwise. -func (c *CodeResult) GetPath() string { - if c == nil || c.Path == nil { - return "" - } - return *c.Path -} - -// GetRepository returns the Repository field. -func (c *CodeResult) GetRepository() *Repository { - if c == nil { - return nil - } - return c.Repository -} - -// GetSHA returns the SHA field if it's non-nil, zero value otherwise. -func (c *CodeResult) GetSHA() string { - if c == nil || c.SHA == nil { - return "" - } - return *c.SHA -} - -// GetIncompleteResults returns the IncompleteResults field if it's non-nil, zero value otherwise. -func (c *CodeSearchResult) GetIncompleteResults() bool { - if c == nil || c.IncompleteResults == nil { - return false - } - return *c.IncompleteResults -} - -// GetTotal returns the Total field if it's non-nil, zero value otherwise. -func (c *CodeSearchResult) GetTotal() int { - if c == nil || c.Total == nil { - return 0 - } - return *c.Total -} - -// GetCommitURL returns the CommitURL field if it's non-nil, zero value otherwise. -func (c *CombinedStatus) GetCommitURL() string { - if c == nil || c.CommitURL == nil { - return "" - } - return *c.CommitURL -} - -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (c *CombinedStatus) GetName() string { - if c == nil || c.Name == nil { - return "" - } - return *c.Name -} - -// GetRepositoryURL returns the RepositoryURL field if it's non-nil, zero value otherwise. -func (c *CombinedStatus) GetRepositoryURL() string { - if c == nil || c.RepositoryURL == nil { - return "" - } - return *c.RepositoryURL -} - -// GetSHA returns the SHA field if it's non-nil, zero value otherwise. -func (c *CombinedStatus) GetSHA() string { - if c == nil || c.SHA == nil { - return "" - } - return *c.SHA -} - -// GetState returns the State field if it's non-nil, zero value otherwise. -func (c *CombinedStatus) GetState() string { - if c == nil || c.State == nil { - return "" - } - return *c.State -} - -// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. -func (c *CombinedStatus) GetTotalCount() int { - if c == nil || c.TotalCount == nil { - return 0 - } - return *c.TotalCount -} - -// GetTotalCommitComments returns the TotalCommitComments field if it's non-nil, zero value otherwise. -func (c *CommentStats) GetTotalCommitComments() int { - if c == nil || c.TotalCommitComments == nil { - return 0 - } - return *c.TotalCommitComments -} - -// GetTotalGistComments returns the TotalGistComments field if it's non-nil, zero value otherwise. -func (c *CommentStats) GetTotalGistComments() int { - if c == nil || c.TotalGistComments == nil { - return 0 - } - return *c.TotalGistComments -} - -// GetTotalIssueComments returns the TotalIssueComments field if it's non-nil, zero value otherwise. -func (c *CommentStats) GetTotalIssueComments() int { - if c == nil || c.TotalIssueComments == nil { - return 0 - } - return *c.TotalIssueComments -} - -// GetTotalPullRequestComments returns the TotalPullRequestComments field if it's non-nil, zero value otherwise. -func (c *CommentStats) GetTotalPullRequestComments() int { - if c == nil || c.TotalPullRequestComments == nil { - return 0 - } - return *c.TotalPullRequestComments -} - -// GetAuthor returns the Author field. -func (c *Commit) GetAuthor() *CommitAuthor { - if c == nil { - return nil - } - return c.Author -} - -// GetCommentCount returns the CommentCount field if it's non-nil, zero value otherwise. -func (c *Commit) GetCommentCount() int { - if c == nil || c.CommentCount == nil { - return 0 - } - return *c.CommentCount -} - -// GetCommitter returns the Committer field. -func (c *Commit) GetCommitter() *CommitAuthor { - if c == nil { - return nil - } - return c.Committer -} - -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (c *Commit) GetHTMLURL() string { - if c == nil || c.HTMLURL == nil { - return "" - } - return *c.HTMLURL -} - -// GetMessage returns the Message field if it's non-nil, zero value otherwise. -func (c *Commit) GetMessage() string { - if c == nil || c.Message == nil { - return "" - } - return *c.Message -} - -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (c *Commit) GetNodeID() string { - if c == nil || c.NodeID == nil { - return "" - } - return *c.NodeID -} - -// GetSHA returns the SHA field if it's non-nil, zero value otherwise. -func (c *Commit) GetSHA() string { - if c == nil || c.SHA == nil { - return "" - } - return *c.SHA -} - -// GetStats returns the Stats field. -func (c *Commit) GetStats() *CommitStats { - if c == nil { - return nil - } - return c.Stats -} - -// GetTree returns the Tree field. -func (c *Commit) GetTree() *Tree { - if c == nil { - return nil - } - return c.Tree -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (c *Commit) GetURL() string { - if c == nil || c.URL == nil { - return "" - } - return *c.URL -} - -// GetVerification returns the Verification field. -func (c *Commit) GetVerification() *SignatureVerification { - if c == nil { - return nil - } - return c.Verification -} - -// GetDate returns the Date field if it's non-nil, zero value otherwise. -func (c *CommitAuthor) GetDate() time.Time { - if c == nil || c.Date == nil { - return time.Time{} - } - return *c.Date -} - -// GetEmail returns the Email field if it's non-nil, zero value otherwise. -func (c *CommitAuthor) GetEmail() string { - if c == nil || c.Email == nil { - return "" - } - return *c.Email -} - -// GetLogin returns the Login field if it's non-nil, zero value otherwise. -func (c *CommitAuthor) GetLogin() string { - if c == nil || c.Login == nil { - return "" - } - return *c.Login -} - -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (c *CommitAuthor) GetName() string { - if c == nil || c.Name == nil { - return "" - } - return *c.Name -} - -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (c *CommitCommentEvent) GetAction() string { - if c == nil || c.Action == nil { - return "" - } - return *c.Action -} - -// GetComment returns the Comment field. -func (c *CommitCommentEvent) GetComment() *RepositoryComment { - if c == nil { - return nil - } - return c.Comment -} - -// GetInstallation returns the Installation field. -func (c *CommitCommentEvent) GetInstallation() *Installation { - if c == nil { - return nil - } - return c.Installation -} - -// GetRepo returns the Repo field. -func (c *CommitCommentEvent) GetRepo() *Repository { - if c == nil { - return nil - } - return c.Repo -} - -// GetSender returns the Sender field. -func (c *CommitCommentEvent) GetSender() *User { - if c == nil { - return nil - } - return c.Sender -} - -// GetAdditions returns the Additions field if it's non-nil, zero value otherwise. -func (c *CommitFile) GetAdditions() int { - if c == nil || c.Additions == nil { - return 0 - } - return *c.Additions -} - -// GetBlobURL returns the BlobURL field if it's non-nil, zero value otherwise. -func (c *CommitFile) GetBlobURL() string { - if c == nil || c.BlobURL == nil { - return "" - } - return *c.BlobURL -} - -// GetChanges returns the Changes field if it's non-nil, zero value otherwise. -func (c *CommitFile) GetChanges() int { - if c == nil || c.Changes == nil { - return 0 - } - return *c.Changes -} - -// GetContentsURL returns the ContentsURL field if it's non-nil, zero value otherwise. -func (c *CommitFile) GetContentsURL() string { - if c == nil || c.ContentsURL == nil { - return "" - } - return *c.ContentsURL -} - -// GetDeletions returns the Deletions field if it's non-nil, zero value otherwise. -func (c *CommitFile) GetDeletions() int { - if c == nil || c.Deletions == nil { - return 0 - } - return *c.Deletions -} - -// GetFilename returns the Filename field if it's non-nil, zero value otherwise. -func (c *CommitFile) GetFilename() string { - if c == nil || c.Filename == nil { - return "" - } - return *c.Filename -} - -// GetPatch returns the Patch field if it's non-nil, zero value otherwise. -func (c *CommitFile) GetPatch() string { - if c == nil || c.Patch == nil { - return "" - } - return *c.Patch -} - -// GetPreviousFilename returns the PreviousFilename field if it's non-nil, zero value otherwise. -func (c *CommitFile) GetPreviousFilename() string { - if c == nil || c.PreviousFilename == nil { - return "" - } - return *c.PreviousFilename -} - -// GetRawURL returns the RawURL field if it's non-nil, zero value otherwise. -func (c *CommitFile) GetRawURL() string { - if c == nil || c.RawURL == nil { - return "" - } - return *c.RawURL -} - -// GetSHA returns the SHA field if it's non-nil, zero value otherwise. -func (c *CommitFile) GetSHA() string { - if c == nil || c.SHA == nil { - return "" - } - return *c.SHA -} - -// GetStatus returns the Status field if it's non-nil, zero value otherwise. -func (c *CommitFile) GetStatus() string { - if c == nil || c.Status == nil { - return "" - } - return *c.Status -} - -// GetAuthor returns the Author field. -func (c *CommitResult) GetAuthor() *User { - if c == nil { - return nil - } - return c.Author -} - -// GetCommentsURL returns the CommentsURL field if it's non-nil, zero value otherwise. -func (c *CommitResult) GetCommentsURL() string { - if c == nil || c.CommentsURL == nil { - return "" - } - return *c.CommentsURL -} - -// GetCommit returns the Commit field. -func (c *CommitResult) GetCommit() *Commit { - if c == nil { - return nil - } - return c.Commit -} - -// GetCommitter returns the Committer field. -func (c *CommitResult) GetCommitter() *User { - if c == nil { - return nil - } - return c.Committer -} - -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (c *CommitResult) GetHTMLURL() string { - if c == nil || c.HTMLURL == nil { - return "" - } - return *c.HTMLURL -} - -// GetRepository returns the Repository field. -func (c *CommitResult) GetRepository() *Repository { - if c == nil { - return nil - } - return c.Repository -} - -// GetScore returns the Score field. -func (c *CommitResult) GetScore() *float64 { - if c == nil { - return nil - } - return c.Score -} - -// GetSHA returns the SHA field if it's non-nil, zero value otherwise. -func (c *CommitResult) GetSHA() string { - if c == nil || c.SHA == nil { - return "" - } - return *c.SHA -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (c *CommitResult) GetURL() string { - if c == nil || c.URL == nil { - return "" - } - return *c.URL -} - -// GetAheadBy returns the AheadBy field if it's non-nil, zero value otherwise. -func (c *CommitsComparison) GetAheadBy() int { - if c == nil || c.AheadBy == nil { - return 0 - } - return *c.AheadBy -} - -// GetBaseCommit returns the BaseCommit field. -func (c *CommitsComparison) GetBaseCommit() *RepositoryCommit { - if c == nil { - return nil - } - return c.BaseCommit -} - -// GetBehindBy returns the BehindBy field if it's non-nil, zero value otherwise. -func (c *CommitsComparison) GetBehindBy() int { - if c == nil || c.BehindBy == nil { - return 0 - } - return *c.BehindBy -} - -// GetDiffURL returns the DiffURL field if it's non-nil, zero value otherwise. -func (c *CommitsComparison) GetDiffURL() string { - if c == nil || c.DiffURL == nil { - return "" - } - return *c.DiffURL -} - -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (c *CommitsComparison) GetHTMLURL() string { - if c == nil || c.HTMLURL == nil { - return "" - } - return *c.HTMLURL -} - -// GetMergeBaseCommit returns the MergeBaseCommit field. -func (c *CommitsComparison) GetMergeBaseCommit() *RepositoryCommit { - if c == nil { - return nil - } - return c.MergeBaseCommit -} - -// GetPatchURL returns the PatchURL field if it's non-nil, zero value otherwise. -func (c *CommitsComparison) GetPatchURL() string { - if c == nil || c.PatchURL == nil { - return "" - } - return *c.PatchURL -} - -// GetPermalinkURL returns the PermalinkURL field if it's non-nil, zero value otherwise. -func (c *CommitsComparison) GetPermalinkURL() string { - if c == nil || c.PermalinkURL == nil { - return "" - } - return *c.PermalinkURL -} - -// GetStatus returns the Status field if it's non-nil, zero value otherwise. -func (c *CommitsComparison) GetStatus() string { - if c == nil || c.Status == nil { - return "" - } - return *c.Status -} - -// GetTotalCommits returns the TotalCommits field if it's non-nil, zero value otherwise. -func (c *CommitsComparison) GetTotalCommits() int { - if c == nil || c.TotalCommits == nil { - return 0 - } - return *c.TotalCommits -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (c *CommitsComparison) GetURL() string { - if c == nil || c.URL == nil { - return "" - } - return *c.URL -} - -// GetIncompleteResults returns the IncompleteResults field if it's non-nil, zero value otherwise. -func (c *CommitsSearchResult) GetIncompleteResults() bool { - if c == nil || c.IncompleteResults == nil { - return false - } - return *c.IncompleteResults -} - -// GetTotal returns the Total field if it's non-nil, zero value otherwise. -func (c *CommitsSearchResult) GetTotal() int { - if c == nil || c.Total == nil { - return 0 - } - return *c.Total -} - -// GetAdditions returns the Additions field if it's non-nil, zero value otherwise. -func (c *CommitStats) GetAdditions() int { - if c == nil || c.Additions == nil { - return 0 - } - return *c.Additions -} - -// GetDeletions returns the Deletions field if it's non-nil, zero value otherwise. -func (c *CommitStats) GetDeletions() int { - if c == nil || c.Deletions == nil { - return 0 - } - return *c.Deletions -} - -// GetTotal returns the Total field if it's non-nil, zero value otherwise. -func (c *CommitStats) GetTotal() int { - if c == nil || c.Total == nil { - return 0 - } - return *c.Total -} - -// GetCodeOfConduct returns the CodeOfConduct field. -func (c *CommunityHealthFiles) GetCodeOfConduct() *Metric { - if c == nil { - return nil - } - return c.CodeOfConduct -} - -// GetContributing returns the Contributing field. -func (c *CommunityHealthFiles) GetContributing() *Metric { - if c == nil { - return nil - } - return c.Contributing -} - -// GetIssueTemplate returns the IssueTemplate field. -func (c *CommunityHealthFiles) GetIssueTemplate() *Metric { - if c == nil { - return nil - } - return c.IssueTemplate -} - -// GetLicense returns the License field. -func (c *CommunityHealthFiles) GetLicense() *Metric { - if c == nil { - return nil - } - return c.License -} - -// GetPullRequestTemplate returns the PullRequestTemplate field. -func (c *CommunityHealthFiles) GetPullRequestTemplate() *Metric { - if c == nil { - return nil - } - return c.PullRequestTemplate -} - -// GetReadme returns the Readme field. -func (c *CommunityHealthFiles) GetReadme() *Metric { - if c == nil { - return nil - } - return c.Readme -} - -// GetFiles returns the Files field. -func (c *CommunityHealthMetrics) GetFiles() *CommunityHealthFiles { - if c == nil { - return nil - } - return c.Files -} - -// GetHealthPercentage returns the HealthPercentage field if it's non-nil, zero value otherwise. -func (c *CommunityHealthMetrics) GetHealthPercentage() int { - if c == nil || c.HealthPercentage == nil { - return 0 - } - return *c.HealthPercentage -} - -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (c *CommunityHealthMetrics) GetUpdatedAt() time.Time { - if c == nil || c.UpdatedAt == nil { - return time.Time{} - } - return *c.UpdatedAt -} - -// GetAvatarURL returns the AvatarURL field if it's non-nil, zero value otherwise. -func (c *Contributor) GetAvatarURL() string { - if c == nil || c.AvatarURL == nil { - return "" - } - return *c.AvatarURL -} - -// GetContributions returns the Contributions field if it's non-nil, zero value otherwise. -func (c *Contributor) GetContributions() int { - if c == nil || c.Contributions == nil { - return 0 - } - return *c.Contributions -} - -// GetEventsURL returns the EventsURL field if it's non-nil, zero value otherwise. -func (c *Contributor) GetEventsURL() string { - if c == nil || c.EventsURL == nil { - return "" - } - return *c.EventsURL -} - -// GetFollowersURL returns the FollowersURL field if it's non-nil, zero value otherwise. -func (c *Contributor) GetFollowersURL() string { - if c == nil || c.FollowersURL == nil { - return "" - } - return *c.FollowersURL -} - -// GetFollowingURL returns the FollowingURL field if it's non-nil, zero value otherwise. -func (c *Contributor) GetFollowingURL() string { - if c == nil || c.FollowingURL == nil { - return "" - } - return *c.FollowingURL -} - -// GetGistsURL returns the GistsURL field if it's non-nil, zero value otherwise. -func (c *Contributor) GetGistsURL() string { - if c == nil || c.GistsURL == nil { - return "" - } - return *c.GistsURL -} - -// GetGravatarID returns the GravatarID field if it's non-nil, zero value otherwise. -func (c *Contributor) GetGravatarID() string { - if c == nil || c.GravatarID == nil { - return "" - } - return *c.GravatarID -} - -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (c *Contributor) GetHTMLURL() string { - if c == nil || c.HTMLURL == nil { - return "" - } - return *c.HTMLURL -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (c *Contributor) GetID() int64 { - if c == nil || c.ID == nil { - return 0 - } - return *c.ID -} - -// GetLogin returns the Login field if it's non-nil, zero value otherwise. -func (c *Contributor) GetLogin() string { - if c == nil || c.Login == nil { - return "" - } - return *c.Login -} - -// GetOrganizationsURL returns the OrganizationsURL field if it's non-nil, zero value otherwise. -func (c *Contributor) GetOrganizationsURL() string { - if c == nil || c.OrganizationsURL == nil { - return "" - } - return *c.OrganizationsURL -} - -// GetReceivedEventsURL returns the ReceivedEventsURL field if it's non-nil, zero value otherwise. -func (c *Contributor) GetReceivedEventsURL() string { - if c == nil || c.ReceivedEventsURL == nil { - return "" - } - return *c.ReceivedEventsURL -} - -// GetReposURL returns the ReposURL field if it's non-nil, zero value otherwise. -func (c *Contributor) GetReposURL() string { - if c == nil || c.ReposURL == nil { - return "" - } - return *c.ReposURL -} - -// GetSiteAdmin returns the SiteAdmin field if it's non-nil, zero value otherwise. -func (c *Contributor) GetSiteAdmin() bool { - if c == nil || c.SiteAdmin == nil { - return false - } - return *c.SiteAdmin -} - -// GetStarredURL returns the StarredURL field if it's non-nil, zero value otherwise. -func (c *Contributor) GetStarredURL() string { - if c == nil || c.StarredURL == nil { - return "" - } - return *c.StarredURL -} - -// GetSubscriptionsURL returns the SubscriptionsURL field if it's non-nil, zero value otherwise. -func (c *Contributor) GetSubscriptionsURL() string { - if c == nil || c.SubscriptionsURL == nil { - return "" - } - return *c.SubscriptionsURL -} - -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (c *Contributor) GetType() string { - if c == nil || c.Type == nil { - return "" - } - return *c.Type -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (c *Contributor) GetURL() string { - if c == nil || c.URL == nil { - return "" - } - return *c.URL -} - -// GetAuthor returns the Author field. -func (c *ContributorStats) GetAuthor() *Contributor { - if c == nil { - return nil - } - return c.Author -} - -// GetTotal returns the Total field if it's non-nil, zero value otherwise. -func (c *ContributorStats) GetTotal() int { - if c == nil || c.Total == nil { - return 0 - } - return *c.Total -} - -// GetCompletedAt returns the CompletedAt field if it's non-nil, zero value otherwise. -func (c *CreateCheckRunOptions) GetCompletedAt() Timestamp { - if c == nil || c.CompletedAt == nil { - return Timestamp{} - } - return *c.CompletedAt -} - -// GetConclusion returns the Conclusion field if it's non-nil, zero value otherwise. -func (c *CreateCheckRunOptions) GetConclusion() string { - if c == nil || c.Conclusion == nil { - return "" - } - return *c.Conclusion -} - -// GetDetailsURL returns the DetailsURL field if it's non-nil, zero value otherwise. -func (c *CreateCheckRunOptions) GetDetailsURL() string { - if c == nil || c.DetailsURL == nil { - return "" - } - return *c.DetailsURL -} - -// GetExternalID returns the ExternalID field if it's non-nil, zero value otherwise. -func (c *CreateCheckRunOptions) GetExternalID() string { - if c == nil || c.ExternalID == nil { - return "" - } - return *c.ExternalID -} - -// GetOutput returns the Output field. -func (c *CreateCheckRunOptions) GetOutput() *CheckRunOutput { - if c == nil { - return nil - } - return c.Output -} - -// GetStartedAt returns the StartedAt field if it's non-nil, zero value otherwise. -func (c *CreateCheckRunOptions) GetStartedAt() Timestamp { - if c == nil || c.StartedAt == nil { - return Timestamp{} - } - return *c.StartedAt -} - -// GetStatus returns the Status field if it's non-nil, zero value otherwise. -func (c *CreateCheckRunOptions) GetStatus() string { - if c == nil || c.Status == nil { - return "" - } - return *c.Status -} - -// GetHeadBranch returns the HeadBranch field if it's non-nil, zero value otherwise. -func (c *CreateCheckSuiteOptions) GetHeadBranch() string { - if c == nil || c.HeadBranch == nil { - return "" - } - return *c.HeadBranch -} - -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (c *CreateEvent) GetDescription() string { - if c == nil || c.Description == nil { - return "" - } - return *c.Description -} - -// GetInstallation returns the Installation field. -func (c *CreateEvent) GetInstallation() *Installation { - if c == nil { - return nil - } - return c.Installation -} - -// GetMasterBranch returns the MasterBranch field if it's non-nil, zero value otherwise. -func (c *CreateEvent) GetMasterBranch() string { - if c == nil || c.MasterBranch == nil { - return "" - } - return *c.MasterBranch -} - -// GetPusherType returns the PusherType field if it's non-nil, zero value otherwise. -func (c *CreateEvent) GetPusherType() string { - if c == nil || c.PusherType == nil { - return "" - } - return *c.PusherType -} - -// GetRef returns the Ref field if it's non-nil, zero value otherwise. -func (c *CreateEvent) GetRef() string { - if c == nil || c.Ref == nil { - return "" - } - return *c.Ref -} - -// GetRefType returns the RefType field if it's non-nil, zero value otherwise. -func (c *CreateEvent) GetRefType() string { - if c == nil || c.RefType == nil { - return "" - } - return *c.RefType -} - -// GetRepo returns the Repo field. -func (c *CreateEvent) GetRepo() *Repository { - if c == nil { - return nil - } - return c.Repo -} - -// GetSender returns the Sender field. -func (c *CreateEvent) GetSender() *User { - if c == nil { - return nil - } - return c.Sender -} - -// GetEmail returns the Email field if it's non-nil, zero value otherwise. -func (c *CreateOrgInvitationOptions) GetEmail() string { - if c == nil || c.Email == nil { - return "" - } - return *c.Email -} - -// GetInviteeID returns the InviteeID field if it's non-nil, zero value otherwise. -func (c *CreateOrgInvitationOptions) GetInviteeID() int64 { - if c == nil || c.InviteeID == nil { - return 0 - } - return *c.InviteeID -} - -// GetRole returns the Role field if it's non-nil, zero value otherwise. -func (c *CreateOrgInvitationOptions) GetRole() string { - if c == nil || c.Role == nil { - return "" - } - return *c.Role -} - -// GetInstallation returns the Installation field. -func (d *DeleteEvent) GetInstallation() *Installation { - if d == nil { - return nil - } - return d.Installation -} - -// GetPusherType returns the PusherType field if it's non-nil, zero value otherwise. -func (d *DeleteEvent) GetPusherType() string { - if d == nil || d.PusherType == nil { - return "" - } - return *d.PusherType -} - -// GetRef returns the Ref field if it's non-nil, zero value otherwise. -func (d *DeleteEvent) GetRef() string { - if d == nil || d.Ref == nil { - return "" - } - return *d.Ref -} - -// GetRefType returns the RefType field if it's non-nil, zero value otherwise. -func (d *DeleteEvent) GetRefType() string { - if d == nil || d.RefType == nil { - return "" - } - return *d.RefType -} - -// GetRepo returns the Repo field. -func (d *DeleteEvent) GetRepo() *Repository { - if d == nil { - return nil - } - return d.Repo -} - -// GetSender returns the Sender field. -func (d *DeleteEvent) GetSender() *User { - if d == nil { - return nil - } - return d.Sender -} - -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (d *DeployKeyEvent) GetAction() string { - if d == nil || d.Action == nil { - return "" - } - return *d.Action -} - -// GetKey returns the Key field. -func (d *DeployKeyEvent) GetKey() *Key { - if d == nil { - return nil - } - return d.Key -} - -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (d *Deployment) GetCreatedAt() Timestamp { - if d == nil || d.CreatedAt == nil { - return Timestamp{} - } - return *d.CreatedAt -} - -// GetCreator returns the Creator field. -func (d *Deployment) GetCreator() *User { - if d == nil { - return nil - } - return d.Creator -} - -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (d *Deployment) GetDescription() string { - if d == nil || d.Description == nil { - return "" - } - return *d.Description -} - -// GetEnvironment returns the Environment field if it's non-nil, zero value otherwise. -func (d *Deployment) GetEnvironment() string { - if d == nil || d.Environment == nil { - return "" - } - return *d.Environment -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (d *Deployment) GetID() int64 { - if d == nil || d.ID == nil { - return 0 - } - return *d.ID -} - -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (d *Deployment) GetNodeID() string { - if d == nil || d.NodeID == nil { - return "" - } - return *d.NodeID -} - -// GetRef returns the Ref field if it's non-nil, zero value otherwise. -func (d *Deployment) GetRef() string { - if d == nil || d.Ref == nil { - return "" - } - return *d.Ref -} - -// GetRepositoryURL returns the RepositoryURL field if it's non-nil, zero value otherwise. -func (d *Deployment) GetRepositoryURL() string { - if d == nil || d.RepositoryURL == nil { - return "" - } - return *d.RepositoryURL -} - -// GetSHA returns the SHA field if it's non-nil, zero value otherwise. -func (d *Deployment) GetSHA() string { - if d == nil || d.SHA == nil { - return "" - } - return *d.SHA -} - -// GetStatusesURL returns the StatusesURL field if it's non-nil, zero value otherwise. -func (d *Deployment) GetStatusesURL() string { - if d == nil || d.StatusesURL == nil { - return "" - } - return *d.StatusesURL -} - -// GetTask returns the Task field if it's non-nil, zero value otherwise. -func (d *Deployment) GetTask() string { - if d == nil || d.Task == nil { - return "" - } - return *d.Task -} - -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (d *Deployment) GetUpdatedAt() Timestamp { - if d == nil || d.UpdatedAt == nil { - return Timestamp{} - } - return *d.UpdatedAt -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (d *Deployment) GetURL() string { - if d == nil || d.URL == nil { - return "" - } - return *d.URL -} - -// GetDeployment returns the Deployment field. -func (d *DeploymentEvent) GetDeployment() *Deployment { - if d == nil { - return nil - } - return d.Deployment -} - -// GetInstallation returns the Installation field. -func (d *DeploymentEvent) GetInstallation() *Installation { - if d == nil { - return nil - } - return d.Installation -} - -// GetRepo returns the Repo field. -func (d *DeploymentEvent) GetRepo() *Repository { - if d == nil { - return nil - } - return d.Repo -} - -// GetSender returns the Sender field. -func (d *DeploymentEvent) GetSender() *User { - if d == nil { - return nil - } - return d.Sender -} - -// GetAutoMerge returns the AutoMerge field if it's non-nil, zero value otherwise. -func (d *DeploymentRequest) GetAutoMerge() bool { - if d == nil || d.AutoMerge == nil { - return false - } - return *d.AutoMerge -} - -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (d *DeploymentRequest) GetDescription() string { - if d == nil || d.Description == nil { - return "" - } - return *d.Description -} - -// GetEnvironment returns the Environment field if it's non-nil, zero value otherwise. -func (d *DeploymentRequest) GetEnvironment() string { - if d == nil || d.Environment == nil { - return "" - } - return *d.Environment -} - -// GetPayload returns the Payload field if it's non-nil, zero value otherwise. -func (d *DeploymentRequest) GetPayload() string { - if d == nil || d.Payload == nil { - return "" - } - return *d.Payload -} - -// GetProductionEnvironment returns the ProductionEnvironment field if it's non-nil, zero value otherwise. -func (d *DeploymentRequest) GetProductionEnvironment() bool { - if d == nil || d.ProductionEnvironment == nil { - return false - } - return *d.ProductionEnvironment -} - -// GetRef returns the Ref field if it's non-nil, zero value otherwise. -func (d *DeploymentRequest) GetRef() string { - if d == nil || d.Ref == nil { - return "" - } - return *d.Ref -} - -// GetRequiredContexts returns the RequiredContexts field if it's non-nil, zero value otherwise. -func (d *DeploymentRequest) GetRequiredContexts() []string { - if d == nil || d.RequiredContexts == nil { - return nil - } - return *d.RequiredContexts -} - -// GetTask returns the Task field if it's non-nil, zero value otherwise. -func (d *DeploymentRequest) GetTask() string { - if d == nil || d.Task == nil { - return "" - } - return *d.Task -} - -// GetTransientEnvironment returns the TransientEnvironment field if it's non-nil, zero value otherwise. -func (d *DeploymentRequest) GetTransientEnvironment() bool { - if d == nil || d.TransientEnvironment == nil { - return false - } - return *d.TransientEnvironment -} - -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (d *DeploymentStatus) GetCreatedAt() Timestamp { - if d == nil || d.CreatedAt == nil { - return Timestamp{} - } - return *d.CreatedAt -} - -// GetCreator returns the Creator field. -func (d *DeploymentStatus) GetCreator() *User { - if d == nil { - return nil - } - return d.Creator -} - -// GetDeploymentURL returns the DeploymentURL field if it's non-nil, zero value otherwise. -func (d *DeploymentStatus) GetDeploymentURL() string { - if d == nil || d.DeploymentURL == nil { - return "" - } - return *d.DeploymentURL -} - -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (d *DeploymentStatus) GetDescription() string { - if d == nil || d.Description == nil { - return "" - } - return *d.Description -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (d *DeploymentStatus) GetID() int64 { - if d == nil || d.ID == nil { - return 0 - } - return *d.ID -} - -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (d *DeploymentStatus) GetNodeID() string { - if d == nil || d.NodeID == nil { - return "" - } - return *d.NodeID -} - -// GetRepositoryURL returns the RepositoryURL field if it's non-nil, zero value otherwise. -func (d *DeploymentStatus) GetRepositoryURL() string { - if d == nil || d.RepositoryURL == nil { - return "" - } - return *d.RepositoryURL -} - -// GetState returns the State field if it's non-nil, zero value otherwise. -func (d *DeploymentStatus) GetState() string { - if d == nil || d.State == nil { - return "" - } - return *d.State -} - -// GetTargetURL returns the TargetURL field if it's non-nil, zero value otherwise. -func (d *DeploymentStatus) GetTargetURL() string { - if d == nil || d.TargetURL == nil { - return "" - } - return *d.TargetURL -} - -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (d *DeploymentStatus) GetUpdatedAt() Timestamp { - if d == nil || d.UpdatedAt == nil { - return Timestamp{} - } - return *d.UpdatedAt -} - -// GetDeployment returns the Deployment field. -func (d *DeploymentStatusEvent) GetDeployment() *Deployment { - if d == nil { - return nil - } - return d.Deployment -} - -// GetDeploymentStatus returns the DeploymentStatus field. -func (d *DeploymentStatusEvent) GetDeploymentStatus() *DeploymentStatus { - if d == nil { - return nil - } - return d.DeploymentStatus -} - -// GetInstallation returns the Installation field. -func (d *DeploymentStatusEvent) GetInstallation() *Installation { - if d == nil { - return nil - } - return d.Installation -} - -// GetRepo returns the Repo field. -func (d *DeploymentStatusEvent) GetRepo() *Repository { - if d == nil { - return nil - } - return d.Repo -} - -// GetSender returns the Sender field. -func (d *DeploymentStatusEvent) GetSender() *User { - if d == nil { - return nil - } - return d.Sender -} - -// GetAutoInactive returns the AutoInactive field if it's non-nil, zero value otherwise. -func (d *DeploymentStatusRequest) GetAutoInactive() bool { - if d == nil || d.AutoInactive == nil { - return false - } - return *d.AutoInactive -} - -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (d *DeploymentStatusRequest) GetDescription() string { - if d == nil || d.Description == nil { - return "" - } - return *d.Description -} - -// GetEnvironment returns the Environment field if it's non-nil, zero value otherwise. -func (d *DeploymentStatusRequest) GetEnvironment() string { - if d == nil || d.Environment == nil { - return "" - } - return *d.Environment -} - -// GetEnvironmentURL returns the EnvironmentURL field if it's non-nil, zero value otherwise. -func (d *DeploymentStatusRequest) GetEnvironmentURL() string { - if d == nil || d.EnvironmentURL == nil { - return "" - } - return *d.EnvironmentURL -} - -// GetLogURL returns the LogURL field if it's non-nil, zero value otherwise. -func (d *DeploymentStatusRequest) GetLogURL() string { - if d == nil || d.LogURL == nil { - return "" - } - return *d.LogURL -} - -// GetState returns the State field if it's non-nil, zero value otherwise. -func (d *DeploymentStatusRequest) GetState() string { - if d == nil || d.State == nil { - return "" - } - return *d.State -} - -// GetAuthor returns the Author field. -func (d *DiscussionComment) GetAuthor() *User { - if d == nil { - return nil - } - return d.Author -} - -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (d *DiscussionComment) GetBody() string { - if d == nil || d.Body == nil { - return "" - } - return *d.Body -} - -// GetBodyHTML returns the BodyHTML field if it's non-nil, zero value otherwise. -func (d *DiscussionComment) GetBodyHTML() string { - if d == nil || d.BodyHTML == nil { - return "" - } - return *d.BodyHTML -} - -// GetBodyVersion returns the BodyVersion field if it's non-nil, zero value otherwise. -func (d *DiscussionComment) GetBodyVersion() string { - if d == nil || d.BodyVersion == nil { - return "" - } - return *d.BodyVersion -} - -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (d *DiscussionComment) GetCreatedAt() Timestamp { - if d == nil || d.CreatedAt == nil { - return Timestamp{} - } - return *d.CreatedAt -} - -// GetDiscussionURL returns the DiscussionURL field if it's non-nil, zero value otherwise. -func (d *DiscussionComment) GetDiscussionURL() string { - if d == nil || d.DiscussionURL == nil { - return "" - } - return *d.DiscussionURL -} - -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (d *DiscussionComment) GetHTMLURL() string { - if d == nil || d.HTMLURL == nil { - return "" - } - return *d.HTMLURL -} - -// GetLastEditedAt returns the LastEditedAt field if it's non-nil, zero value otherwise. -func (d *DiscussionComment) GetLastEditedAt() Timestamp { - if d == nil || d.LastEditedAt == nil { - return Timestamp{} - } - return *d.LastEditedAt -} - -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (d *DiscussionComment) GetNodeID() string { - if d == nil || d.NodeID == nil { - return "" - } - return *d.NodeID -} - -// GetNumber returns the Number field if it's non-nil, zero value otherwise. -func (d *DiscussionComment) GetNumber() int { - if d == nil || d.Number == nil { - return 0 - } - return *d.Number -} - -// GetReactions returns the Reactions field. -func (d *DiscussionComment) GetReactions() *Reactions { - if d == nil { - return nil - } - return d.Reactions -} - -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (d *DiscussionComment) GetUpdatedAt() Timestamp { - if d == nil || d.UpdatedAt == nil { - return Timestamp{} - } - return *d.UpdatedAt -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (d *DiscussionComment) GetURL() string { - if d == nil || d.URL == nil { - return "" - } - return *d.URL -} - -// GetTeams returns the Teams field if it's non-nil, zero value otherwise. -func (d *DismissalRestrictionsRequest) GetTeams() []string { - if d == nil || d.Teams == nil { - return nil - } - return *d.Teams -} - -// GetUsers returns the Users field if it's non-nil, zero value otherwise. -func (d *DismissalRestrictionsRequest) GetUsers() []string { - if d == nil || d.Users == nil { - return nil - } - return *d.Users -} - -// GetDismissalCommitID returns the DismissalCommitID field if it's non-nil, zero value otherwise. -func (d *DismissedReview) GetDismissalCommitID() string { - if d == nil || d.DismissalCommitID == nil { - return "" - } - return *d.DismissalCommitID -} - -// GetDismissalMessage returns the DismissalMessage field if it's non-nil, zero value otherwise. -func (d *DismissedReview) GetDismissalMessage() string { - if d == nil || d.DismissalMessage == nil { - return "" - } - return *d.DismissalMessage -} - -// GetReviewID returns the ReviewID field if it's non-nil, zero value otherwise. -func (d *DismissedReview) GetReviewID() int64 { - if d == nil || d.ReviewID == nil { - return 0 - } - return *d.ReviewID -} - -// GetState returns the State field if it's non-nil, zero value otherwise. -func (d *DismissedReview) GetState() string { - if d == nil || d.State == nil { - return "" - } - return *d.State -} - -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (d *DraftReviewComment) GetBody() string { - if d == nil || d.Body == nil { - return "" - } - return *d.Body -} - -// GetPath returns the Path field if it's non-nil, zero value otherwise. -func (d *DraftReviewComment) GetPath() string { - if d == nil || d.Path == nil { - return "" - } - return *d.Path -} - -// GetPosition returns the Position field if it's non-nil, zero value otherwise. -func (d *DraftReviewComment) GetPosition() int { - if d == nil || d.Position == nil { - return 0 - } - return *d.Position -} - -// GetActor returns the Actor field. -func (e *Event) GetActor() *User { - if e == nil { - return nil - } - return e.Actor -} - -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (e *Event) GetCreatedAt() time.Time { - if e == nil || e.CreatedAt == nil { - return time.Time{} - } - return *e.CreatedAt -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (e *Event) GetID() string { - if e == nil || e.ID == nil { - return "" - } - return *e.ID -} - -// GetOrg returns the Org field. -func (e *Event) GetOrg() *Organization { - if e == nil { - return nil - } - return e.Org -} - -// GetPublic returns the Public field if it's non-nil, zero value otherwise. -func (e *Event) GetPublic() bool { - if e == nil || e.Public == nil { - return false - } - return *e.Public -} - -// GetRawPayload returns the RawPayload field if it's non-nil, zero value otherwise. -func (e *Event) GetRawPayload() json.RawMessage { - if e == nil || e.RawPayload == nil { - return json.RawMessage{} - } - return *e.RawPayload -} - -// GetRepo returns the Repo field. -func (e *Event) GetRepo() *Repository { - if e == nil { - return nil - } - return e.Repo -} - -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (e *Event) GetType() string { - if e == nil || e.Type == nil { - return "" - } - return *e.Type -} - -// GetHRef returns the HRef field if it's non-nil, zero value otherwise. -func (f *FeedLink) GetHRef() string { - if f == nil || f.HRef == nil { - return "" - } - return *f.HRef -} - -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (f *FeedLink) GetType() string { - if f == nil || f.Type == nil { - return "" - } - return *f.Type -} - -// GetCurrentUserActorURL returns the CurrentUserActorURL field if it's non-nil, zero value otherwise. -func (f *Feeds) GetCurrentUserActorURL() string { - if f == nil || f.CurrentUserActorURL == nil { - return "" - } - return *f.CurrentUserActorURL -} - -// GetCurrentUserOrganizationURL returns the CurrentUserOrganizationURL field if it's non-nil, zero value otherwise. -func (f *Feeds) GetCurrentUserOrganizationURL() string { - if f == nil || f.CurrentUserOrganizationURL == nil { - return "" - } - return *f.CurrentUserOrganizationURL -} - -// GetCurrentUserPublicURL returns the CurrentUserPublicURL field if it's non-nil, zero value otherwise. -func (f *Feeds) GetCurrentUserPublicURL() string { - if f == nil || f.CurrentUserPublicURL == nil { - return "" - } - return *f.CurrentUserPublicURL -} - -// GetCurrentUserURL returns the CurrentUserURL field if it's non-nil, zero value otherwise. -func (f *Feeds) GetCurrentUserURL() string { - if f == nil || f.CurrentUserURL == nil { - return "" - } - return *f.CurrentUserURL -} - -// GetTimelineURL returns the TimelineURL field if it's non-nil, zero value otherwise. -func (f *Feeds) GetTimelineURL() string { - if f == nil || f.TimelineURL == nil { - return "" - } - return *f.TimelineURL -} - -// GetUserURL returns the UserURL field if it's non-nil, zero value otherwise. -func (f *Feeds) GetUserURL() string { - if f == nil || f.UserURL == nil { - return "" - } - return *f.UserURL -} - -// GetForkee returns the Forkee field. -func (f *ForkEvent) GetForkee() *Repository { - if f == nil { - return nil - } - return f.Forkee -} - -// GetInstallation returns the Installation field. -func (f *ForkEvent) GetInstallation() *Installation { - if f == nil { - return nil - } - return f.Installation -} - -// GetRepo returns the Repo field. -func (f *ForkEvent) GetRepo() *Repository { - if f == nil { - return nil - } - return f.Repo -} - -// GetSender returns the Sender field. -func (f *ForkEvent) GetSender() *User { - if f == nil { - return nil - } - return f.Sender -} - -// GetComments returns the Comments field if it's non-nil, zero value otherwise. -func (g *Gist) GetComments() int { - if g == nil || g.Comments == nil { - return 0 - } - return *g.Comments -} - -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (g *Gist) GetCreatedAt() time.Time { - if g == nil || g.CreatedAt == nil { - return time.Time{} - } - return *g.CreatedAt -} - -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (g *Gist) GetDescription() string { - if g == nil || g.Description == nil { - return "" - } - return *g.Description -} - -// GetGitPullURL returns the GitPullURL field if it's non-nil, zero value otherwise. -func (g *Gist) GetGitPullURL() string { - if g == nil || g.GitPullURL == nil { - return "" - } - return *g.GitPullURL -} - -// GetGitPushURL returns the GitPushURL field if it's non-nil, zero value otherwise. -func (g *Gist) GetGitPushURL() string { - if g == nil || g.GitPushURL == nil { - return "" - } - return *g.GitPushURL -} - -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (g *Gist) GetHTMLURL() string { - if g == nil || g.HTMLURL == nil { - return "" - } - return *g.HTMLURL -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (g *Gist) GetID() string { - if g == nil || g.ID == nil { - return "" - } - return *g.ID -} - -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (g *Gist) GetNodeID() string { - if g == nil || g.NodeID == nil { - return "" - } - return *g.NodeID -} - -// GetOwner returns the Owner field. -func (g *Gist) GetOwner() *User { - if g == nil { - return nil - } - return g.Owner -} - -// GetPublic returns the Public field if it's non-nil, zero value otherwise. -func (g *Gist) GetPublic() bool { - if g == nil || g.Public == nil { - return false - } - return *g.Public -} - -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (g *Gist) GetUpdatedAt() time.Time { - if g == nil || g.UpdatedAt == nil { - return time.Time{} - } - return *g.UpdatedAt -} - -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (g *GistComment) GetBody() string { - if g == nil || g.Body == nil { - return "" - } - return *g.Body -} - -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (g *GistComment) GetCreatedAt() time.Time { - if g == nil || g.CreatedAt == nil { - return time.Time{} - } - return *g.CreatedAt -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (g *GistComment) GetID() int64 { - if g == nil || g.ID == nil { - return 0 - } - return *g.ID -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (g *GistComment) GetURL() string { - if g == nil || g.URL == nil { - return "" - } - return *g.URL -} - -// GetUser returns the User field. -func (g *GistComment) GetUser() *User { - if g == nil { - return nil - } - return g.User -} - -// GetChangeStatus returns the ChangeStatus field. -func (g *GistCommit) GetChangeStatus() *CommitStats { - if g == nil { - return nil - } - return g.ChangeStatus -} - -// GetCommittedAt returns the CommittedAt field if it's non-nil, zero value otherwise. -func (g *GistCommit) GetCommittedAt() Timestamp { - if g == nil || g.CommittedAt == nil { - return Timestamp{} - } - return *g.CommittedAt -} - -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (g *GistCommit) GetNodeID() string { - if g == nil || g.NodeID == nil { - return "" - } - return *g.NodeID -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (g *GistCommit) GetURL() string { - if g == nil || g.URL == nil { - return "" - } - return *g.URL -} - -// GetUser returns the User field. -func (g *GistCommit) GetUser() *User { - if g == nil { - return nil - } - return g.User -} - -// GetVersion returns the Version field if it's non-nil, zero value otherwise. -func (g *GistCommit) GetVersion() string { - if g == nil || g.Version == nil { - return "" - } - return *g.Version -} - -// GetContent returns the Content field if it's non-nil, zero value otherwise. -func (g *GistFile) GetContent() string { - if g == nil || g.Content == nil { - return "" - } - return *g.Content -} - -// GetFilename returns the Filename field if it's non-nil, zero value otherwise. -func (g *GistFile) GetFilename() string { - if g == nil || g.Filename == nil { - return "" - } - return *g.Filename -} - -// GetLanguage returns the Language field if it's non-nil, zero value otherwise. -func (g *GistFile) GetLanguage() string { - if g == nil || g.Language == nil { - return "" - } - return *g.Language -} - -// GetRawURL returns the RawURL field if it's non-nil, zero value otherwise. -func (g *GistFile) GetRawURL() string { - if g == nil || g.RawURL == nil { - return "" - } - return *g.RawURL -} - -// GetSize returns the Size field if it's non-nil, zero value otherwise. -func (g *GistFile) GetSize() int { - if g == nil || g.Size == nil { - return 0 - } - return *g.Size -} - -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (g *GistFile) GetType() string { - if g == nil || g.Type == nil { - return "" - } - return *g.Type -} - -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (g *GistFork) GetCreatedAt() Timestamp { - if g == nil || g.CreatedAt == nil { - return Timestamp{} - } - return *g.CreatedAt -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (g *GistFork) GetID() string { - if g == nil || g.ID == nil { - return "" - } - return *g.ID -} - -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (g *GistFork) GetNodeID() string { - if g == nil || g.NodeID == nil { - return "" - } - return *g.NodeID -} - -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (g *GistFork) GetUpdatedAt() Timestamp { - if g == nil || g.UpdatedAt == nil { - return Timestamp{} - } - return *g.UpdatedAt -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (g *GistFork) GetURL() string { - if g == nil || g.URL == nil { - return "" - } - return *g.URL -} - -// GetUser returns the User field. -func (g *GistFork) GetUser() *User { - if g == nil { - return nil - } - return g.User -} - -// GetPrivateGists returns the PrivateGists field if it's non-nil, zero value otherwise. -func (g *GistStats) GetPrivateGists() int { - if g == nil || g.PrivateGists == nil { - return 0 - } - return *g.PrivateGists -} - -// GetPublicGists returns the PublicGists field if it's non-nil, zero value otherwise. -func (g *GistStats) GetPublicGists() int { - if g == nil || g.PublicGists == nil { - return 0 - } - return *g.PublicGists -} - -// GetTotalGists returns the TotalGists field if it's non-nil, zero value otherwise. -func (g *GistStats) GetTotalGists() int { - if g == nil || g.TotalGists == nil { - return 0 - } - return *g.TotalGists -} - -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (g *GitHubAppAuthorizationEvent) GetAction() string { - if g == nil || g.Action == nil { - return "" - } - return *g.Action -} - -// GetSender returns the Sender field. -func (g *GitHubAppAuthorizationEvent) GetSender() *User { - if g == nil { - return nil - } - return g.Sender -} - -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (g *Gitignore) GetName() string { - if g == nil || g.Name == nil { - return "" - } - return *g.Name -} - -// GetSource returns the Source field if it's non-nil, zero value otherwise. -func (g *Gitignore) GetSource() string { - if g == nil || g.Source == nil { - return "" - } - return *g.Source -} - -// GetSHA returns the SHA field if it's non-nil, zero value otherwise. -func (g *GitObject) GetSHA() string { - if g == nil || g.SHA == nil { - return "" - } - return *g.SHA -} - -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (g *GitObject) GetType() string { - if g == nil || g.Type == nil { - return "" - } - return *g.Type -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (g *GitObject) GetURL() string { - if g == nil || g.URL == nil { - return "" - } - return *g.URL -} - -// GetInstallation returns the Installation field. -func (g *GollumEvent) GetInstallation() *Installation { - if g == nil { - return nil - } - return g.Installation -} - -// GetRepo returns the Repo field. -func (g *GollumEvent) GetRepo() *Repository { - if g == nil { - return nil - } - return g.Repo -} - -// GetSender returns the Sender field. -func (g *GollumEvent) GetSender() *User { - if g == nil { - return nil - } - return g.Sender -} - -// GetEmail returns the Email field if it's non-nil, zero value otherwise. -func (g *GPGEmail) GetEmail() string { - if g == nil || g.Email == nil { - return "" - } - return *g.Email -} - -// GetVerified returns the Verified field if it's non-nil, zero value otherwise. -func (g *GPGEmail) GetVerified() bool { - if g == nil || g.Verified == nil { - return false - } - return *g.Verified -} - -// GetCanCertify returns the CanCertify field if it's non-nil, zero value otherwise. -func (g *GPGKey) GetCanCertify() bool { - if g == nil || g.CanCertify == nil { - return false - } - return *g.CanCertify -} - -// GetCanEncryptComms returns the CanEncryptComms field if it's non-nil, zero value otherwise. -func (g *GPGKey) GetCanEncryptComms() bool { - if g == nil || g.CanEncryptComms == nil { - return false - } - return *g.CanEncryptComms -} - -// GetCanEncryptStorage returns the CanEncryptStorage field if it's non-nil, zero value otherwise. -func (g *GPGKey) GetCanEncryptStorage() bool { - if g == nil || g.CanEncryptStorage == nil { - return false - } - return *g.CanEncryptStorage -} - -// GetCanSign returns the CanSign field if it's non-nil, zero value otherwise. -func (g *GPGKey) GetCanSign() bool { - if g == nil || g.CanSign == nil { - return false - } - return *g.CanSign -} - -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (g *GPGKey) GetCreatedAt() time.Time { - if g == nil || g.CreatedAt == nil { - return time.Time{} - } - return *g.CreatedAt -} - -// GetExpiresAt returns the ExpiresAt field if it's non-nil, zero value otherwise. -func (g *GPGKey) GetExpiresAt() time.Time { - if g == nil || g.ExpiresAt == nil { - return time.Time{} - } - return *g.ExpiresAt -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (g *GPGKey) GetID() int64 { - if g == nil || g.ID == nil { - return 0 - } - return *g.ID -} - -// GetKeyID returns the KeyID field if it's non-nil, zero value otherwise. -func (g *GPGKey) GetKeyID() string { - if g == nil || g.KeyID == nil { - return "" - } - return *g.KeyID -} - -// GetPrimaryKeyID returns the PrimaryKeyID field if it's non-nil, zero value otherwise. -func (g *GPGKey) GetPrimaryKeyID() int64 { - if g == nil || g.PrimaryKeyID == nil { - return 0 - } - return *g.PrimaryKeyID -} - -// GetPublicKey returns the PublicKey field if it's non-nil, zero value otherwise. -func (g *GPGKey) GetPublicKey() string { - if g == nil || g.PublicKey == nil { - return "" - } - return *g.PublicKey -} - -// GetApp returns the App field. -func (g *Grant) GetApp() *AuthorizationApp { - if g == nil { - return nil - } - return g.App -} - -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (g *Grant) GetCreatedAt() Timestamp { - if g == nil || g.CreatedAt == nil { - return Timestamp{} - } - return *g.CreatedAt -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (g *Grant) GetID() int64 { - if g == nil || g.ID == nil { - return 0 - } - return *g.ID -} - -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (g *Grant) GetUpdatedAt() Timestamp { - if g == nil || g.UpdatedAt == nil { - return Timestamp{} - } - return *g.UpdatedAt -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (g *Grant) GetURL() string { - if g == nil || g.URL == nil { - return "" - } - return *g.URL -} - -// GetActive returns the Active field if it's non-nil, zero value otherwise. -func (h *Hook) GetActive() bool { - if h == nil || h.Active == nil { - return false - } - return *h.Active -} - -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (h *Hook) GetCreatedAt() time.Time { - if h == nil || h.CreatedAt == nil { - return time.Time{} - } - return *h.CreatedAt -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (h *Hook) GetID() int64 { - if h == nil || h.ID == nil { - return 0 - } - return *h.ID -} - -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (h *Hook) GetUpdatedAt() time.Time { - if h == nil || h.UpdatedAt == nil { - return time.Time{} - } - return *h.UpdatedAt -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (h *Hook) GetURL() string { - if h == nil || h.URL == nil { - return "" - } - return *h.URL -} - -// GetActiveHooks returns the ActiveHooks field if it's non-nil, zero value otherwise. -func (h *HookStats) GetActiveHooks() int { - if h == nil || h.ActiveHooks == nil { - return 0 - } - return *h.ActiveHooks -} - -// GetInactiveHooks returns the InactiveHooks field if it's non-nil, zero value otherwise. -func (h *HookStats) GetInactiveHooks() int { - if h == nil || h.InactiveHooks == nil { - return 0 - } - return *h.InactiveHooks -} - -// GetTotalHooks returns the TotalHooks field if it's non-nil, zero value otherwise. -func (h *HookStats) GetTotalHooks() int { - if h == nil || h.TotalHooks == nil { - return 0 - } - return *h.TotalHooks -} - -// GetGroupDescription returns the GroupDescription field if it's non-nil, zero value otherwise. -func (i *IDPGroup) GetGroupDescription() string { - if i == nil || i.GroupDescription == nil { - return "" - } - return *i.GroupDescription -} - -// GetGroupID returns the GroupID field if it's non-nil, zero value otherwise. -func (i *IDPGroup) GetGroupID() string { - if i == nil || i.GroupID == nil { - return "" - } - return *i.GroupID -} - -// GetGroupName returns the GroupName field if it's non-nil, zero value otherwise. -func (i *IDPGroup) GetGroupName() string { - if i == nil || i.GroupName == nil { - return "" - } - return *i.GroupName -} - -// GetAuthorsCount returns the AuthorsCount field if it's non-nil, zero value otherwise. -func (i *Import) GetAuthorsCount() int { - if i == nil || i.AuthorsCount == nil { - return 0 - } - return *i.AuthorsCount -} - -// GetAuthorsURL returns the AuthorsURL field if it's non-nil, zero value otherwise. -func (i *Import) GetAuthorsURL() string { - if i == nil || i.AuthorsURL == nil { - return "" - } - return *i.AuthorsURL -} - -// GetCommitCount returns the CommitCount field if it's non-nil, zero value otherwise. -func (i *Import) GetCommitCount() int { - if i == nil || i.CommitCount == nil { - return 0 - } - return *i.CommitCount -} - -// GetFailedStep returns the FailedStep field if it's non-nil, zero value otherwise. -func (i *Import) GetFailedStep() string { - if i == nil || i.FailedStep == nil { - return "" - } - return *i.FailedStep -} - -// GetHasLargeFiles returns the HasLargeFiles field if it's non-nil, zero value otherwise. -func (i *Import) GetHasLargeFiles() bool { - if i == nil || i.HasLargeFiles == nil { - return false - } - return *i.HasLargeFiles -} - -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (i *Import) GetHTMLURL() string { - if i == nil || i.HTMLURL == nil { - return "" - } - return *i.HTMLURL -} - -// GetHumanName returns the HumanName field if it's non-nil, zero value otherwise. -func (i *Import) GetHumanName() string { - if i == nil || i.HumanName == nil { - return "" - } - return *i.HumanName -} - -// GetLargeFilesCount returns the LargeFilesCount field if it's non-nil, zero value otherwise. -func (i *Import) GetLargeFilesCount() int { - if i == nil || i.LargeFilesCount == nil { - return 0 - } - return *i.LargeFilesCount -} - -// GetLargeFilesSize returns the LargeFilesSize field if it's non-nil, zero value otherwise. -func (i *Import) GetLargeFilesSize() int { - if i == nil || i.LargeFilesSize == nil { - return 0 - } - return *i.LargeFilesSize -} - -// GetMessage returns the Message field if it's non-nil, zero value otherwise. -func (i *Import) GetMessage() string { - if i == nil || i.Message == nil { - return "" - } - return *i.Message -} - -// GetPercent returns the Percent field if it's non-nil, zero value otherwise. -func (i *Import) GetPercent() int { - if i == nil || i.Percent == nil { - return 0 - } - return *i.Percent -} - -// GetPushPercent returns the PushPercent field if it's non-nil, zero value otherwise. -func (i *Import) GetPushPercent() int { - if i == nil || i.PushPercent == nil { - return 0 - } - return *i.PushPercent -} - -// GetRepositoryURL returns the RepositoryURL field if it's non-nil, zero value otherwise. -func (i *Import) GetRepositoryURL() string { - if i == nil || i.RepositoryURL == nil { - return "" - } - return *i.RepositoryURL -} - -// GetStatus returns the Status field if it's non-nil, zero value otherwise. -func (i *Import) GetStatus() string { - if i == nil || i.Status == nil { - return "" - } - return *i.Status -} - -// GetStatusText returns the StatusText field if it's non-nil, zero value otherwise. -func (i *Import) GetStatusText() string { - if i == nil || i.StatusText == nil { - return "" - } - return *i.StatusText -} - -// GetTFVCProject returns the TFVCProject field if it's non-nil, zero value otherwise. -func (i *Import) GetTFVCProject() string { - if i == nil || i.TFVCProject == nil { - return "" - } - return *i.TFVCProject -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (i *Import) GetURL() string { - if i == nil || i.URL == nil { - return "" - } - return *i.URL -} - -// GetUseLFS returns the UseLFS field if it's non-nil, zero value otherwise. -func (i *Import) GetUseLFS() string { - if i == nil || i.UseLFS == nil { - return "" - } - return *i.UseLFS -} - -// GetVCS returns the VCS field if it's non-nil, zero value otherwise. -func (i *Import) GetVCS() string { - if i == nil || i.VCS == nil { - return "" - } - return *i.VCS -} - -// GetVCSPassword returns the VCSPassword field if it's non-nil, zero value otherwise. -func (i *Import) GetVCSPassword() string { - if i == nil || i.VCSPassword == nil { - return "" - } - return *i.VCSPassword -} - -// GetVCSURL returns the VCSURL field if it's non-nil, zero value otherwise. -func (i *Import) GetVCSURL() string { - if i == nil || i.VCSURL == nil { - return "" - } - return *i.VCSURL -} - -// GetVCSUsername returns the VCSUsername field if it's non-nil, zero value otherwise. -func (i *Import) GetVCSUsername() string { - if i == nil || i.VCSUsername == nil { - return "" - } - return *i.VCSUsername -} - -// GetAccessTokensURL returns the AccessTokensURL field if it's non-nil, zero value otherwise. -func (i *Installation) GetAccessTokensURL() string { - if i == nil || i.AccessTokensURL == nil { - return "" - } - return *i.AccessTokensURL -} - -// GetAccount returns the Account field. -func (i *Installation) GetAccount() *User { - if i == nil { - return nil - } - return i.Account -} - -// GetAppID returns the AppID field if it's non-nil, zero value otherwise. -func (i *Installation) GetAppID() int64 { - if i == nil || i.AppID == nil { - return 0 - } - return *i.AppID -} - -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (i *Installation) GetCreatedAt() Timestamp { - if i == nil || i.CreatedAt == nil { - return Timestamp{} - } - return *i.CreatedAt -} - -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (i *Installation) GetHTMLURL() string { - if i == nil || i.HTMLURL == nil { - return "" - } - return *i.HTMLURL -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (i *Installation) GetID() int64 { - if i == nil || i.ID == nil { - return 0 - } - return *i.ID -} - -// GetPermissions returns the Permissions field. -func (i *Installation) GetPermissions() *InstallationPermissions { - if i == nil { - return nil - } - return i.Permissions -} - -// GetRepositoriesURL returns the RepositoriesURL field if it's non-nil, zero value otherwise. -func (i *Installation) GetRepositoriesURL() string { - if i == nil || i.RepositoriesURL == nil { - return "" - } - return *i.RepositoriesURL -} - -// GetRepositorySelection returns the RepositorySelection field if it's non-nil, zero value otherwise. -func (i *Installation) GetRepositorySelection() string { - if i == nil || i.RepositorySelection == nil { - return "" - } - return *i.RepositorySelection -} - -// GetSingleFileName returns the SingleFileName field if it's non-nil, zero value otherwise. -func (i *Installation) GetSingleFileName() string { - if i == nil || i.SingleFileName == nil { - return "" - } - return *i.SingleFileName -} - -// GetTargetID returns the TargetID field if it's non-nil, zero value otherwise. -func (i *Installation) GetTargetID() int64 { - if i == nil || i.TargetID == nil { - return 0 - } - return *i.TargetID -} - -// GetTargetType returns the TargetType field if it's non-nil, zero value otherwise. -func (i *Installation) GetTargetType() string { - if i == nil || i.TargetType == nil { - return "" - } - return *i.TargetType -} - -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (i *Installation) GetUpdatedAt() Timestamp { - if i == nil || i.UpdatedAt == nil { - return Timestamp{} - } - return *i.UpdatedAt -} - -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (i *InstallationEvent) GetAction() string { - if i == nil || i.Action == nil { - return "" - } - return *i.Action -} - -// GetInstallation returns the Installation field. -func (i *InstallationEvent) GetInstallation() *Installation { - if i == nil { - return nil - } - return i.Installation -} - -// GetSender returns the Sender field. -func (i *InstallationEvent) GetSender() *User { - if i == nil { - return nil - } - return i.Sender -} - -// GetAdministration returns the Administration field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetAdministration() string { - if i == nil || i.Administration == nil { - return "" - } - return *i.Administration -} - -// GetChecks returns the Checks field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetChecks() string { - if i == nil || i.Checks == nil { - return "" - } - return *i.Checks -} - -// GetContentReferences returns the ContentReferences field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetContentReferences() string { - if i == nil || i.ContentReferences == nil { - return "" - } - return *i.ContentReferences -} - -// GetContents returns the Contents field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetContents() string { - if i == nil || i.Contents == nil { - return "" - } - return *i.Contents -} - -// GetDeployments returns the Deployments field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetDeployments() string { - if i == nil || i.Deployments == nil { - return "" - } - return *i.Deployments -} - -// GetIssues returns the Issues field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetIssues() string { - if i == nil || i.Issues == nil { - return "" - } - return *i.Issues -} - -// GetMembers returns the Members field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetMembers() string { - if i == nil || i.Members == nil { - return "" - } - return *i.Members -} - -// GetMetadata returns the Metadata field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetMetadata() string { - if i == nil || i.Metadata == nil { - return "" - } - return *i.Metadata -} - -// GetOrganizationAdministration returns the OrganizationAdministration field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetOrganizationAdministration() string { - if i == nil || i.OrganizationAdministration == nil { - return "" - } - return *i.OrganizationAdministration -} - -// GetOrganizationHooks returns the OrganizationHooks field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetOrganizationHooks() string { - if i == nil || i.OrganizationHooks == nil { - return "" - } - return *i.OrganizationHooks -} - -// GetOrganizationPlan returns the OrganizationPlan field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetOrganizationPlan() string { - if i == nil || i.OrganizationPlan == nil { - return "" - } - return *i.OrganizationPlan -} - -// GetOrganizationPreReceiveHooks returns the OrganizationPreReceiveHooks field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetOrganizationPreReceiveHooks() string { - if i == nil || i.OrganizationPreReceiveHooks == nil { - return "" - } - return *i.OrganizationPreReceiveHooks -} - -// GetOrganizationProjects returns the OrganizationProjects field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetOrganizationProjects() string { - if i == nil || i.OrganizationProjects == nil { - return "" - } - return *i.OrganizationProjects -} - -// GetOrganizationUserBlocking returns the OrganizationUserBlocking field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetOrganizationUserBlocking() string { - if i == nil || i.OrganizationUserBlocking == nil { - return "" - } - return *i.OrganizationUserBlocking -} - -// GetPackages returns the Packages field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetPackages() string { - if i == nil || i.Packages == nil { - return "" - } - return *i.Packages -} - -// GetPages returns the Pages field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetPages() string { - if i == nil || i.Pages == nil { - return "" - } - return *i.Pages -} - -// GetPullRequests returns the PullRequests field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetPullRequests() string { - if i == nil || i.PullRequests == nil { - return "" - } - return *i.PullRequests -} - -// GetRepositoryHooks returns the RepositoryHooks field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetRepositoryHooks() string { - if i == nil || i.RepositoryHooks == nil { - return "" - } - return *i.RepositoryHooks -} - -// GetRepositoryPreReceiveHooks returns the RepositoryPreReceiveHooks field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetRepositoryPreReceiveHooks() string { - if i == nil || i.RepositoryPreReceiveHooks == nil { - return "" - } - return *i.RepositoryPreReceiveHooks -} - -// GetRepositoryProjects returns the RepositoryProjects field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetRepositoryProjects() string { - if i == nil || i.RepositoryProjects == nil { - return "" - } - return *i.RepositoryProjects -} - -// GetSingleFile returns the SingleFile field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetSingleFile() string { - if i == nil || i.SingleFile == nil { - return "" - } - return *i.SingleFile -} - -// GetStatuses returns the Statuses field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetStatuses() string { - if i == nil || i.Statuses == nil { - return "" - } - return *i.Statuses -} - -// GetTeamDiscussions returns the TeamDiscussions field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetTeamDiscussions() string { - if i == nil || i.TeamDiscussions == nil { - return "" - } - return *i.TeamDiscussions -} - -// GetVulnerabilityAlerts returns the VulnerabilityAlerts field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetVulnerabilityAlerts() string { - if i == nil || i.VulnerabilityAlerts == nil { - return "" - } - return *i.VulnerabilityAlerts -} - -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (i *InstallationRepositoriesEvent) GetAction() string { - if i == nil || i.Action == nil { - return "" - } - return *i.Action -} - -// GetInstallation returns the Installation field. -func (i *InstallationRepositoriesEvent) GetInstallation() *Installation { - if i == nil { - return nil - } - return i.Installation -} - -// GetRepositorySelection returns the RepositorySelection field if it's non-nil, zero value otherwise. -func (i *InstallationRepositoriesEvent) GetRepositorySelection() string { - if i == nil || i.RepositorySelection == nil { - return "" - } - return *i.RepositorySelection -} - -// GetSender returns the Sender field. -func (i *InstallationRepositoriesEvent) GetSender() *User { - if i == nil { - return nil - } - return i.Sender -} - -// GetExpiresAt returns the ExpiresAt field if it's non-nil, zero value otherwise. -func (i *InstallationToken) GetExpiresAt() time.Time { - if i == nil || i.ExpiresAt == nil { - return time.Time{} - } - return *i.ExpiresAt -} - -// GetToken returns the Token field if it's non-nil, zero value otherwise. -func (i *InstallationToken) GetToken() string { - if i == nil || i.Token == nil { - return "" - } - return *i.Token -} - -// GetExpiresAt returns the ExpiresAt field if it's non-nil, zero value otherwise. -func (i *InteractionRestriction) GetExpiresAt() Timestamp { - if i == nil || i.ExpiresAt == nil { - return Timestamp{} - } - return *i.ExpiresAt -} - -// GetLimit returns the Limit field if it's non-nil, zero value otherwise. -func (i *InteractionRestriction) GetLimit() string { - if i == nil || i.Limit == nil { - return "" - } - return *i.Limit -} - -// GetOrigin returns the Origin field if it's non-nil, zero value otherwise. -func (i *InteractionRestriction) GetOrigin() string { - if i == nil || i.Origin == nil { - return "" - } - return *i.Origin -} - -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (i *Invitation) GetCreatedAt() time.Time { - if i == nil || i.CreatedAt == nil { - return time.Time{} - } - return *i.CreatedAt -} - -// GetEmail returns the Email field if it's non-nil, zero value otherwise. -func (i *Invitation) GetEmail() string { - if i == nil || i.Email == nil { - return "" - } - return *i.Email -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (i *Invitation) GetID() int64 { - if i == nil || i.ID == nil { - return 0 - } - return *i.ID -} - -// GetInvitationTeamURL returns the InvitationTeamURL field if it's non-nil, zero value otherwise. -func (i *Invitation) GetInvitationTeamURL() string { - if i == nil || i.InvitationTeamURL == nil { - return "" - } - return *i.InvitationTeamURL -} - -// GetInviter returns the Inviter field. -func (i *Invitation) GetInviter() *User { - if i == nil { - return nil - } - return i.Inviter -} - -// GetLogin returns the Login field if it's non-nil, zero value otherwise. -func (i *Invitation) GetLogin() string { - if i == nil || i.Login == nil { - return "" - } - return *i.Login -} - -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (i *Invitation) GetNodeID() string { - if i == nil || i.NodeID == nil { - return "" - } - return *i.NodeID -} - -// GetRole returns the Role field if it's non-nil, zero value otherwise. -func (i *Invitation) GetRole() string { - if i == nil || i.Role == nil { - return "" - } - return *i.Role -} - -// GetTeamCount returns the TeamCount field if it's non-nil, zero value otherwise. -func (i *Invitation) GetTeamCount() int { - if i == nil || i.TeamCount == nil { - return 0 - } - return *i.TeamCount -} - -// GetActiveLockReason returns the ActiveLockReason field if it's non-nil, zero value otherwise. -func (i *Issue) GetActiveLockReason() string { - if i == nil || i.ActiveLockReason == nil { - return "" - } - return *i.ActiveLockReason -} - -// GetAssignee returns the Assignee field. -func (i *Issue) GetAssignee() *User { - if i == nil { - return nil - } - return i.Assignee -} - -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (i *Issue) GetBody() string { - if i == nil || i.Body == nil { - return "" - } - return *i.Body -} - -// GetClosedAt returns the ClosedAt field if it's non-nil, zero value otherwise. -func (i *Issue) GetClosedAt() time.Time { - if i == nil || i.ClosedAt == nil { - return time.Time{} - } - return *i.ClosedAt -} - -// GetClosedBy returns the ClosedBy field. -func (i *Issue) GetClosedBy() *User { - if i == nil { - return nil - } - return i.ClosedBy -} - -// GetComments returns the Comments field if it's non-nil, zero value otherwise. -func (i *Issue) GetComments() int { - if i == nil || i.Comments == nil { - return 0 - } - return *i.Comments -} - -// GetCommentsURL returns the CommentsURL field if it's non-nil, zero value otherwise. -func (i *Issue) GetCommentsURL() string { - if i == nil || i.CommentsURL == nil { - return "" - } - return *i.CommentsURL -} - -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (i *Issue) GetCreatedAt() time.Time { - if i == nil || i.CreatedAt == nil { - return time.Time{} - } - return *i.CreatedAt -} - -// GetEventsURL returns the EventsURL field if it's non-nil, zero value otherwise. -func (i *Issue) GetEventsURL() string { - if i == nil || i.EventsURL == nil { - return "" - } - return *i.EventsURL -} - -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (i *Issue) GetHTMLURL() string { - if i == nil || i.HTMLURL == nil { - return "" - } - return *i.HTMLURL -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (i *Issue) GetID() int64 { - if i == nil || i.ID == nil { - return 0 - } - return *i.ID -} - -// GetLabelsURL returns the LabelsURL field if it's non-nil, zero value otherwise. -func (i *Issue) GetLabelsURL() string { - if i == nil || i.LabelsURL == nil { - return "" - } - return *i.LabelsURL -} - -// GetLocked returns the Locked field if it's non-nil, zero value otherwise. -func (i *Issue) GetLocked() bool { - if i == nil || i.Locked == nil { - return false - } - return *i.Locked -} - -// GetMilestone returns the Milestone field. -func (i *Issue) GetMilestone() *Milestone { - if i == nil { - return nil - } - return i.Milestone -} - -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (i *Issue) GetNodeID() string { - if i == nil || i.NodeID == nil { - return "" - } - return *i.NodeID -} - -// GetNumber returns the Number field if it's non-nil, zero value otherwise. -func (i *Issue) GetNumber() int { - if i == nil || i.Number == nil { - return 0 - } - return *i.Number -} - -// GetPullRequestLinks returns the PullRequestLinks field. -func (i *Issue) GetPullRequestLinks() *PullRequestLinks { - if i == nil { - return nil - } - return i.PullRequestLinks -} - -// GetReactions returns the Reactions field. -func (i *Issue) GetReactions() *Reactions { - if i == nil { - return nil - } - return i.Reactions -} - -// GetRepository returns the Repository field. -func (i *Issue) GetRepository() *Repository { - if i == nil { - return nil - } - return i.Repository -} - -// GetRepositoryURL returns the RepositoryURL field if it's non-nil, zero value otherwise. -func (i *Issue) GetRepositoryURL() string { - if i == nil || i.RepositoryURL == nil { - return "" - } - return *i.RepositoryURL -} - -// GetState returns the State field if it's non-nil, zero value otherwise. -func (i *Issue) GetState() string { - if i == nil || i.State == nil { - return "" - } - return *i.State -} - -// GetTitle returns the Title field if it's non-nil, zero value otherwise. -func (i *Issue) GetTitle() string { - if i == nil || i.Title == nil { - return "" - } - return *i.Title -} - -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (i *Issue) GetUpdatedAt() time.Time { - if i == nil || i.UpdatedAt == nil { - return time.Time{} - } - return *i.UpdatedAt -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (i *Issue) GetURL() string { - if i == nil || i.URL == nil { - return "" - } - return *i.URL -} - -// GetUser returns the User field. -func (i *Issue) GetUser() *User { - if i == nil { - return nil - } - return i.User -} - -// GetAuthorAssociation returns the AuthorAssociation field if it's non-nil, zero value otherwise. -func (i *IssueComment) GetAuthorAssociation() string { - if i == nil || i.AuthorAssociation == nil { - return "" - } - return *i.AuthorAssociation -} - -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (i *IssueComment) GetBody() string { - if i == nil || i.Body == nil { - return "" - } - return *i.Body -} - -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (i *IssueComment) GetCreatedAt() time.Time { - if i == nil || i.CreatedAt == nil { - return time.Time{} - } - return *i.CreatedAt -} - -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (i *IssueComment) GetHTMLURL() string { - if i == nil || i.HTMLURL == nil { - return "" - } - return *i.HTMLURL -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (i *IssueComment) GetID() int64 { - if i == nil || i.ID == nil { - return 0 - } - return *i.ID -} - -// GetIssueURL returns the IssueURL field if it's non-nil, zero value otherwise. -func (i *IssueComment) GetIssueURL() string { - if i == nil || i.IssueURL == nil { - return "" - } - return *i.IssueURL -} - -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (i *IssueComment) GetNodeID() string { - if i == nil || i.NodeID == nil { - return "" - } - return *i.NodeID -} - -// GetReactions returns the Reactions field. -func (i *IssueComment) GetReactions() *Reactions { - if i == nil { - return nil - } - return i.Reactions -} - -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (i *IssueComment) GetUpdatedAt() time.Time { - if i == nil || i.UpdatedAt == nil { - return time.Time{} - } - return *i.UpdatedAt -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (i *IssueComment) GetURL() string { - if i == nil || i.URL == nil { - return "" - } - return *i.URL -} - -// GetUser returns the User field. -func (i *IssueComment) GetUser() *User { - if i == nil { - return nil - } - return i.User -} - -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (i *IssueCommentEvent) GetAction() string { - if i == nil || i.Action == nil { - return "" - } - return *i.Action -} - -// GetChanges returns the Changes field. -func (i *IssueCommentEvent) GetChanges() *EditChange { - if i == nil { - return nil - } - return i.Changes -} - -// GetComment returns the Comment field. -func (i *IssueCommentEvent) GetComment() *IssueComment { - if i == nil { - return nil - } - return i.Comment -} - -// GetInstallation returns the Installation field. -func (i *IssueCommentEvent) GetInstallation() *Installation { - if i == nil { - return nil - } - return i.Installation -} - -// GetIssue returns the Issue field. -func (i *IssueCommentEvent) GetIssue() *Issue { - if i == nil { - return nil - } - return i.Issue -} - -// GetRepo returns the Repo field. -func (i *IssueCommentEvent) GetRepo() *Repository { - if i == nil { - return nil - } - return i.Repo -} - -// GetSender returns the Sender field. -func (i *IssueCommentEvent) GetSender() *User { - if i == nil { - return nil - } - return i.Sender -} - -// GetActor returns the Actor field. -func (i *IssueEvent) GetActor() *User { - if i == nil { - return nil - } - return i.Actor -} - -// GetAssignee returns the Assignee field. -func (i *IssueEvent) GetAssignee() *User { - if i == nil { - return nil - } - return i.Assignee -} - -// GetAssigner returns the Assigner field. -func (i *IssueEvent) GetAssigner() *User { - if i == nil { - return nil - } - return i.Assigner -} - -// GetCommitID returns the CommitID field if it's non-nil, zero value otherwise. -func (i *IssueEvent) GetCommitID() string { - if i == nil || i.CommitID == nil { - return "" - } - return *i.CommitID -} - -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (i *IssueEvent) GetCreatedAt() time.Time { - if i == nil || i.CreatedAt == nil { - return time.Time{} - } - return *i.CreatedAt -} - -// GetDismissedReview returns the DismissedReview field. -func (i *IssueEvent) GetDismissedReview() *DismissedReview { - if i == nil { - return nil - } - return i.DismissedReview -} - -// GetEvent returns the Event field if it's non-nil, zero value otherwise. -func (i *IssueEvent) GetEvent() string { - if i == nil || i.Event == nil { - return "" - } - return *i.Event -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (i *IssueEvent) GetID() int64 { - if i == nil || i.ID == nil { - return 0 - } - return *i.ID -} - -// GetIssue returns the Issue field. -func (i *IssueEvent) GetIssue() *Issue { - if i == nil { - return nil - } - return i.Issue -} - -// GetLabel returns the Label field. -func (i *IssueEvent) GetLabel() *Label { - if i == nil { - return nil - } - return i.Label -} - -// GetLockReason returns the LockReason field if it's non-nil, zero value otherwise. -func (i *IssueEvent) GetLockReason() string { - if i == nil || i.LockReason == nil { - return "" - } - return *i.LockReason -} - -// GetMilestone returns the Milestone field. -func (i *IssueEvent) GetMilestone() *Milestone { - if i == nil { - return nil - } - return i.Milestone -} - -// GetProjectCard returns the ProjectCard field. -func (i *IssueEvent) GetProjectCard() *ProjectCard { - if i == nil { - return nil - } - return i.ProjectCard -} - -// GetRename returns the Rename field. -func (i *IssueEvent) GetRename() *Rename { - if i == nil { - return nil - } - return i.Rename -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (i *IssueEvent) GetURL() string { - if i == nil || i.URL == nil { - return "" - } - return *i.URL -} - -// GetAssignee returns the Assignee field if it's non-nil, zero value otherwise. -func (i *IssueRequest) GetAssignee() string { - if i == nil || i.Assignee == nil { - return "" - } - return *i.Assignee -} - -// GetAssignees returns the Assignees field if it's non-nil, zero value otherwise. -func (i *IssueRequest) GetAssignees() []string { - if i == nil || i.Assignees == nil { - return nil - } - return *i.Assignees -} - -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (i *IssueRequest) GetBody() string { - if i == nil || i.Body == nil { - return "" - } - return *i.Body -} - -// GetLabels returns the Labels field if it's non-nil, zero value otherwise. -func (i *IssueRequest) GetLabels() []string { - if i == nil || i.Labels == nil { - return nil - } - return *i.Labels -} - -// GetMilestone returns the Milestone field if it's non-nil, zero value otherwise. -func (i *IssueRequest) GetMilestone() int { - if i == nil || i.Milestone == nil { - return 0 - } - return *i.Milestone -} - -// GetState returns the State field if it's non-nil, zero value otherwise. -func (i *IssueRequest) GetState() string { - if i == nil || i.State == nil { - return "" - } - return *i.State -} - -// GetTitle returns the Title field if it's non-nil, zero value otherwise. -func (i *IssueRequest) GetTitle() string { - if i == nil || i.Title == nil { - return "" - } - return *i.Title -} - -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (i *IssuesEvent) GetAction() string { - if i == nil || i.Action == nil { - return "" - } - return *i.Action -} - -// GetAssignee returns the Assignee field. -func (i *IssuesEvent) GetAssignee() *User { - if i == nil { - return nil - } - return i.Assignee -} - -// GetChanges returns the Changes field. -func (i *IssuesEvent) GetChanges() *EditChange { - if i == nil { - return nil - } - return i.Changes -} - -// GetInstallation returns the Installation field. -func (i *IssuesEvent) GetInstallation() *Installation { - if i == nil { - return nil - } - return i.Installation -} - -// GetIssue returns the Issue field. -func (i *IssuesEvent) GetIssue() *Issue { - if i == nil { - return nil - } - return i.Issue -} - -// GetLabel returns the Label field. -func (i *IssuesEvent) GetLabel() *Label { - if i == nil { - return nil - } - return i.Label -} - -// GetRepo returns the Repo field. -func (i *IssuesEvent) GetRepo() *Repository { - if i == nil { - return nil - } - return i.Repo -} - -// GetSender returns the Sender field. -func (i *IssuesEvent) GetSender() *User { - if i == nil { - return nil - } - return i.Sender -} - -// GetIncompleteResults returns the IncompleteResults field if it's non-nil, zero value otherwise. -func (i *IssuesSearchResult) GetIncompleteResults() bool { - if i == nil || i.IncompleteResults == nil { - return false - } - return *i.IncompleteResults -} - -// GetTotal returns the Total field if it's non-nil, zero value otherwise. -func (i *IssuesSearchResult) GetTotal() int { - if i == nil || i.Total == nil { - return 0 - } - return *i.Total -} - -// GetClosedIssues returns the ClosedIssues field if it's non-nil, zero value otherwise. -func (i *IssueStats) GetClosedIssues() int { - if i == nil || i.ClosedIssues == nil { - return 0 - } - return *i.ClosedIssues -} - -// GetOpenIssues returns the OpenIssues field if it's non-nil, zero value otherwise. -func (i *IssueStats) GetOpenIssues() int { - if i == nil || i.OpenIssues == nil { - return 0 - } - return *i.OpenIssues -} - -// GetTotalIssues returns the TotalIssues field if it's non-nil, zero value otherwise. -func (i *IssueStats) GetTotalIssues() int { - if i == nil || i.TotalIssues == nil { - return 0 - } - return *i.TotalIssues -} - -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (k *Key) GetCreatedAt() Timestamp { - if k == nil || k.CreatedAt == nil { - return Timestamp{} - } - return *k.CreatedAt -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (k *Key) GetID() int64 { - if k == nil || k.ID == nil { - return 0 - } - return *k.ID -} - -// GetKey returns the Key field if it's non-nil, zero value otherwise. -func (k *Key) GetKey() string { - if k == nil || k.Key == nil { - return "" - } - return *k.Key -} - -// GetReadOnly returns the ReadOnly field if it's non-nil, zero value otherwise. -func (k *Key) GetReadOnly() bool { - if k == nil || k.ReadOnly == nil { - return false - } - return *k.ReadOnly -} - -// GetTitle returns the Title field if it's non-nil, zero value otherwise. -func (k *Key) GetTitle() string { - if k == nil || k.Title == nil { - return "" - } - return *k.Title -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (k *Key) GetURL() string { - if k == nil || k.URL == nil { - return "" - } - return *k.URL -} - -// GetColor returns the Color field if it's non-nil, zero value otherwise. -func (l *Label) GetColor() string { - if l == nil || l.Color == nil { - return "" - } - return *l.Color -} - -// GetDefault returns the Default field if it's non-nil, zero value otherwise. -func (l *Label) GetDefault() bool { - if l == nil || l.Default == nil { - return false - } - return *l.Default -} - -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (l *Label) GetDescription() string { - if l == nil || l.Description == nil { - return "" - } - return *l.Description -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (l *Label) GetID() int64 { - if l == nil || l.ID == nil { - return 0 - } - return *l.ID -} - -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (l *Label) GetName() string { - if l == nil || l.Name == nil { - return "" - } - return *l.Name -} - -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (l *Label) GetNodeID() string { - if l == nil || l.NodeID == nil { - return "" - } - return *l.NodeID -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (l *Label) GetURL() string { - if l == nil || l.URL == nil { - return "" - } - return *l.URL -} - -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (l *LabelEvent) GetAction() string { - if l == nil || l.Action == nil { - return "" - } - return *l.Action -} - -// GetChanges returns the Changes field. -func (l *LabelEvent) GetChanges() *EditChange { - if l == nil { - return nil - } - return l.Changes -} - -// GetInstallation returns the Installation field. -func (l *LabelEvent) GetInstallation() *Installation { - if l == nil { - return nil - } - return l.Installation -} - -// GetLabel returns the Label field. -func (l *LabelEvent) GetLabel() *Label { - if l == nil { - return nil - } - return l.Label -} - -// GetOrg returns the Org field. -func (l *LabelEvent) GetOrg() *Organization { - if l == nil { - return nil - } - return l.Org -} - -// GetRepo returns the Repo field. -func (l *LabelEvent) GetRepo() *Repository { - if l == nil { - return nil - } - return l.Repo -} - -// GetColor returns the Color field if it's non-nil, zero value otherwise. -func (l *LabelResult) GetColor() string { - if l == nil || l.Color == nil { - return "" - } - return *l.Color -} - -// GetDefault returns the Default field if it's non-nil, zero value otherwise. -func (l *LabelResult) GetDefault() bool { - if l == nil || l.Default == nil { - return false - } - return *l.Default -} - -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (l *LabelResult) GetDescription() string { - if l == nil || l.Description == nil { - return "" - } - return *l.Description -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (l *LabelResult) GetID() int64 { - if l == nil || l.ID == nil { - return 0 - } - return *l.ID -} - -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (l *LabelResult) GetName() string { - if l == nil || l.Name == nil { - return "" - } - return *l.Name -} - -// GetScore returns the Score field. -func (l *LabelResult) GetScore() *float64 { - if l == nil { - return nil - } - return l.Score -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (l *LabelResult) GetURL() string { - if l == nil || l.URL == nil { - return "" - } - return *l.URL -} - -// GetIncompleteResults returns the IncompleteResults field if it's non-nil, zero value otherwise. -func (l *LabelsSearchResult) GetIncompleteResults() bool { - if l == nil || l.IncompleteResults == nil { - return false - } - return *l.IncompleteResults -} - -// GetTotal returns the Total field if it's non-nil, zero value otherwise. -func (l *LabelsSearchResult) GetTotal() int { - if l == nil || l.Total == nil { - return 0 - } - return *l.Total -} - -// GetOID returns the OID field if it's non-nil, zero value otherwise. -func (l *LargeFile) GetOID() string { - if l == nil || l.OID == nil { - return "" - } - return *l.OID -} - -// GetPath returns the Path field if it's non-nil, zero value otherwise. -func (l *LargeFile) GetPath() string { - if l == nil || l.Path == nil { - return "" - } - return *l.Path -} - -// GetRefName returns the RefName field if it's non-nil, zero value otherwise. -func (l *LargeFile) GetRefName() string { - if l == nil || l.RefName == nil { - return "" - } - return *l.RefName -} - -// GetSize returns the Size field if it's non-nil, zero value otherwise. -func (l *LargeFile) GetSize() int { - if l == nil || l.Size == nil { - return 0 - } - return *l.Size -} - -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (l *License) GetBody() string { - if l == nil || l.Body == nil { - return "" - } - return *l.Body -} - -// GetConditions returns the Conditions field if it's non-nil, zero value otherwise. -func (l *License) GetConditions() []string { - if l == nil || l.Conditions == nil { - return nil - } - return *l.Conditions -} - -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (l *License) GetDescription() string { - if l == nil || l.Description == nil { - return "" - } - return *l.Description -} - -// GetFeatured returns the Featured field if it's non-nil, zero value otherwise. -func (l *License) GetFeatured() bool { - if l == nil || l.Featured == nil { - return false - } - return *l.Featured -} - -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (l *License) GetHTMLURL() string { - if l == nil || l.HTMLURL == nil { - return "" - } - return *l.HTMLURL -} - -// GetImplementation returns the Implementation field if it's non-nil, zero value otherwise. -func (l *License) GetImplementation() string { - if l == nil || l.Implementation == nil { - return "" - } - return *l.Implementation -} - -// GetKey returns the Key field if it's non-nil, zero value otherwise. -func (l *License) GetKey() string { - if l == nil || l.Key == nil { - return "" - } - return *l.Key -} - -// GetLimitations returns the Limitations field if it's non-nil, zero value otherwise. -func (l *License) GetLimitations() []string { - if l == nil || l.Limitations == nil { - return nil - } - return *l.Limitations -} - -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (l *License) GetName() string { - if l == nil || l.Name == nil { - return "" - } - return *l.Name -} - -// GetPermissions returns the Permissions field if it's non-nil, zero value otherwise. -func (l *License) GetPermissions() []string { - if l == nil || l.Permissions == nil { - return nil - } - return *l.Permissions -} - -// GetSPDXID returns the SPDXID field if it's non-nil, zero value otherwise. -func (l *License) GetSPDXID() string { - if l == nil || l.SPDXID == nil { - return "" - } - return *l.SPDXID -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (l *License) GetURL() string { - if l == nil || l.URL == nil { - return "" - } - return *l.URL -} - -// GetCheckName returns the CheckName field if it's non-nil, zero value otherwise. -func (l *ListCheckRunsOptions) GetCheckName() string { - if l == nil || l.CheckName == nil { - return "" - } - return *l.CheckName -} - -// GetFilter returns the Filter field if it's non-nil, zero value otherwise. -func (l *ListCheckRunsOptions) GetFilter() string { - if l == nil || l.Filter == nil { - return "" - } - return *l.Filter -} - -// GetStatus returns the Status field if it's non-nil, zero value otherwise. -func (l *ListCheckRunsOptions) GetStatus() string { - if l == nil || l.Status == nil { - return "" - } - return *l.Status -} - -// GetTotal returns the Total field if it's non-nil, zero value otherwise. -func (l *ListCheckRunsResults) GetTotal() int { - if l == nil || l.Total == nil { - return 0 - } - return *l.Total -} - -// GetAppID returns the AppID field if it's non-nil, zero value otherwise. -func (l *ListCheckSuiteOptions) GetAppID() int { - if l == nil || l.AppID == nil { - return 0 - } - return *l.AppID -} - -// GetCheckName returns the CheckName field if it's non-nil, zero value otherwise. -func (l *ListCheckSuiteOptions) GetCheckName() string { - if l == nil || l.CheckName == nil { - return "" - } - return *l.CheckName -} - -// GetTotal returns the Total field if it's non-nil, zero value otherwise. -func (l *ListCheckSuiteResults) GetTotal() int { - if l == nil || l.Total == nil { - return 0 - } - return *l.Total -} - -// GetAffiliation returns the Affiliation field if it's non-nil, zero value otherwise. -func (l *ListCollaboratorOptions) GetAffiliation() string { - if l == nil || l.Affiliation == nil { - return "" - } - return *l.Affiliation -} - -// GetEffectiveDate returns the EffectiveDate field if it's non-nil, zero value otherwise. -func (m *MarketplacePendingChange) GetEffectiveDate() Timestamp { - if m == nil || m.EffectiveDate == nil { - return Timestamp{} - } - return *m.EffectiveDate -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (m *MarketplacePendingChange) GetID() int64 { - if m == nil || m.ID == nil { - return 0 - } - return *m.ID -} - -// GetPlan returns the Plan field. -func (m *MarketplacePendingChange) GetPlan() *MarketplacePlan { - if m == nil { - return nil - } - return m.Plan -} - -// GetUnitCount returns the UnitCount field if it's non-nil, zero value otherwise. -func (m *MarketplacePendingChange) GetUnitCount() int { - if m == nil || m.UnitCount == nil { - return 0 - } - return *m.UnitCount -} - -// GetAccountsURL returns the AccountsURL field if it's non-nil, zero value otherwise. -func (m *MarketplacePlan) GetAccountsURL() string { - if m == nil || m.AccountsURL == nil { - return "" - } - return *m.AccountsURL -} - -// GetBullets returns the Bullets field if it's non-nil, zero value otherwise. -func (m *MarketplacePlan) GetBullets() []string { - if m == nil || m.Bullets == nil { - return nil - } - return *m.Bullets -} - -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (m *MarketplacePlan) GetDescription() string { - if m == nil || m.Description == nil { - return "" - } - return *m.Description -} - -// GetHasFreeTrial returns the HasFreeTrial field if it's non-nil, zero value otherwise. -func (m *MarketplacePlan) GetHasFreeTrial() bool { - if m == nil || m.HasFreeTrial == nil { - return false - } - return *m.HasFreeTrial -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (m *MarketplacePlan) GetID() int64 { - if m == nil || m.ID == nil { - return 0 - } - return *m.ID -} - -// GetMonthlyPriceInCents returns the MonthlyPriceInCents field if it's non-nil, zero value otherwise. -func (m *MarketplacePlan) GetMonthlyPriceInCents() int { - if m == nil || m.MonthlyPriceInCents == nil { - return 0 - } - return *m.MonthlyPriceInCents -} - -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (m *MarketplacePlan) GetName() string { - if m == nil || m.Name == nil { - return "" - } - return *m.Name -} - -// GetPriceModel returns the PriceModel field if it's non-nil, zero value otherwise. -func (m *MarketplacePlan) GetPriceModel() string { - if m == nil || m.PriceModel == nil { - return "" - } - return *m.PriceModel -} - -// GetState returns the State field if it's non-nil, zero value otherwise. -func (m *MarketplacePlan) GetState() string { - if m == nil || m.State == nil { - return "" - } - return *m.State -} - -// GetUnitName returns the UnitName field if it's non-nil, zero value otherwise. -func (m *MarketplacePlan) GetUnitName() string { - if m == nil || m.UnitName == nil { - return "" - } - return *m.UnitName -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (m *MarketplacePlan) GetURL() string { - if m == nil || m.URL == nil { - return "" - } - return *m.URL -} - -// GetYearlyPriceInCents returns the YearlyPriceInCents field if it's non-nil, zero value otherwise. -func (m *MarketplacePlan) GetYearlyPriceInCents() int { - if m == nil || m.YearlyPriceInCents == nil { - return 0 - } - return *m.YearlyPriceInCents -} - -// GetEmail returns the Email field if it's non-nil, zero value otherwise. -func (m *MarketplacePlanAccount) GetEmail() string { - if m == nil || m.Email == nil { - return "" - } - return *m.Email -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (m *MarketplacePlanAccount) GetID() int64 { - if m == nil || m.ID == nil { - return 0 - } - return *m.ID -} - -// GetLogin returns the Login field if it's non-nil, zero value otherwise. -func (m *MarketplacePlanAccount) GetLogin() string { - if m == nil || m.Login == nil { - return "" - } - return *m.Login -} - -// GetMarketplacePendingChange returns the MarketplacePendingChange field. -func (m *MarketplacePlanAccount) GetMarketplacePendingChange() *MarketplacePendingChange { - if m == nil { - return nil - } - return m.MarketplacePendingChange -} - -// GetMarketplacePurchase returns the MarketplacePurchase field. -func (m *MarketplacePlanAccount) GetMarketplacePurchase() *MarketplacePurchase { - if m == nil { - return nil - } - return m.MarketplacePurchase -} - -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (m *MarketplacePlanAccount) GetNodeID() string { - if m == nil || m.NodeID == nil { - return "" - } - return *m.NodeID -} - -// GetOrganizationBillingEmail returns the OrganizationBillingEmail field if it's non-nil, zero value otherwise. -func (m *MarketplacePlanAccount) GetOrganizationBillingEmail() string { - if m == nil || m.OrganizationBillingEmail == nil { - return "" - } - return *m.OrganizationBillingEmail -} - -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (m *MarketplacePlanAccount) GetType() string { - if m == nil || m.Type == nil { - return "" - } - return *m.Type -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (m *MarketplacePlanAccount) GetURL() string { - if m == nil || m.URL == nil { - return "" - } - return *m.URL -} - -// GetAccount returns the Account field. -func (m *MarketplacePurchase) GetAccount() *MarketplacePlanAccount { - if m == nil { - return nil - } - return m.Account -} - -// GetBillingCycle returns the BillingCycle field if it's non-nil, zero value otherwise. -func (m *MarketplacePurchase) GetBillingCycle() string { - if m == nil || m.BillingCycle == nil { - return "" - } - return *m.BillingCycle -} - -// GetFreeTrialEndsOn returns the FreeTrialEndsOn field if it's non-nil, zero value otherwise. -func (m *MarketplacePurchase) GetFreeTrialEndsOn() Timestamp { - if m == nil || m.FreeTrialEndsOn == nil { - return Timestamp{} - } - return *m.FreeTrialEndsOn -} - -// GetNextBillingDate returns the NextBillingDate field if it's non-nil, zero value otherwise. -func (m *MarketplacePurchase) GetNextBillingDate() Timestamp { - if m == nil || m.NextBillingDate == nil { - return Timestamp{} - } - return *m.NextBillingDate -} - -// GetOnFreeTrial returns the OnFreeTrial field if it's non-nil, zero value otherwise. -func (m *MarketplacePurchase) GetOnFreeTrial() bool { - if m == nil || m.OnFreeTrial == nil { - return false - } - return *m.OnFreeTrial -} - -// GetPlan returns the Plan field. -func (m *MarketplacePurchase) GetPlan() *MarketplacePlan { - if m == nil { - return nil - } - return m.Plan -} - -// GetUnitCount returns the UnitCount field if it's non-nil, zero value otherwise. -func (m *MarketplacePurchase) GetUnitCount() int { - if m == nil || m.UnitCount == nil { - return 0 - } - return *m.UnitCount -} - -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (m *MarketplacePurchaseEvent) GetAction() string { - if m == nil || m.Action == nil { - return "" - } - return *m.Action -} - -// GetEffectiveDate returns the EffectiveDate field if it's non-nil, zero value otherwise. -func (m *MarketplacePurchaseEvent) GetEffectiveDate() Timestamp { - if m == nil || m.EffectiveDate == nil { - return Timestamp{} - } - return *m.EffectiveDate -} - -// GetInstallation returns the Installation field. -func (m *MarketplacePurchaseEvent) GetInstallation() *Installation { - if m == nil { - return nil - } - return m.Installation -} - -// GetMarketplacePurchase returns the MarketplacePurchase field. -func (m *MarketplacePurchaseEvent) GetMarketplacePurchase() *MarketplacePurchase { - if m == nil { - return nil - } - return m.MarketplacePurchase -} - -// GetPreviousMarketplacePurchase returns the PreviousMarketplacePurchase field. -func (m *MarketplacePurchaseEvent) GetPreviousMarketplacePurchase() *MarketplacePurchase { - if m == nil { - return nil - } - return m.PreviousMarketplacePurchase -} - -// GetSender returns the Sender field. -func (m *MarketplacePurchaseEvent) GetSender() *User { - if m == nil { - return nil - } - return m.Sender -} - -// GetText returns the Text field if it's non-nil, zero value otherwise. -func (m *Match) GetText() string { - if m == nil || m.Text == nil { - return "" - } - return *m.Text -} - -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (m *MemberEvent) GetAction() string { - if m == nil || m.Action == nil { - return "" - } - return *m.Action -} - -// GetInstallation returns the Installation field. -func (m *MemberEvent) GetInstallation() *Installation { - if m == nil { - return nil - } - return m.Installation -} - -// GetMember returns the Member field. -func (m *MemberEvent) GetMember() *User { - if m == nil { - return nil - } - return m.Member -} - -// GetRepo returns the Repo field. -func (m *MemberEvent) GetRepo() *Repository { - if m == nil { - return nil - } - return m.Repo -} - -// GetSender returns the Sender field. -func (m *MemberEvent) GetSender() *User { - if m == nil { - return nil - } - return m.Sender -} - -// GetOrganization returns the Organization field. -func (m *Membership) GetOrganization() *Organization { - if m == nil { - return nil - } - return m.Organization -} - -// GetOrganizationURL returns the OrganizationURL field if it's non-nil, zero value otherwise. -func (m *Membership) GetOrganizationURL() string { - if m == nil || m.OrganizationURL == nil { - return "" - } - return *m.OrganizationURL -} - -// GetRole returns the Role field if it's non-nil, zero value otherwise. -func (m *Membership) GetRole() string { - if m == nil || m.Role == nil { - return "" - } - return *m.Role -} - -// GetState returns the State field if it's non-nil, zero value otherwise. -func (m *Membership) GetState() string { - if m == nil || m.State == nil { - return "" - } - return *m.State -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (m *Membership) GetURL() string { - if m == nil || m.URL == nil { - return "" - } - return *m.URL -} - -// GetUser returns the User field. -func (m *Membership) GetUser() *User { - if m == nil { - return nil - } - return m.User -} - -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (m *MembershipEvent) GetAction() string { - if m == nil || m.Action == nil { - return "" - } - return *m.Action -} - -// GetInstallation returns the Installation field. -func (m *MembershipEvent) GetInstallation() *Installation { - if m == nil { - return nil - } - return m.Installation -} - -// GetMember returns the Member field. -func (m *MembershipEvent) GetMember() *User { - if m == nil { - return nil - } - return m.Member -} - -// GetOrg returns the Org field. -func (m *MembershipEvent) GetOrg() *Organization { - if m == nil { - return nil - } - return m.Org -} - -// GetScope returns the Scope field if it's non-nil, zero value otherwise. -func (m *MembershipEvent) GetScope() string { - if m == nil || m.Scope == nil { - return "" - } - return *m.Scope -} - -// GetSender returns the Sender field. -func (m *MembershipEvent) GetSender() *User { - if m == nil { - return nil - } - return m.Sender -} - -// GetTeam returns the Team field. -func (m *MembershipEvent) GetTeam() *Team { - if m == nil { - return nil - } - return m.Team -} - -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (m *MetaEvent) GetAction() string { - if m == nil || m.Action == nil { - return "" - } - return *m.Action -} - -// GetHook returns the Hook field. -func (m *MetaEvent) GetHook() *Hook { - if m == nil { - return nil - } - return m.Hook -} - -// GetHookID returns the HookID field if it's non-nil, zero value otherwise. -func (m *MetaEvent) GetHookID() int64 { - if m == nil || m.HookID == nil { - return 0 - } - return *m.HookID -} - -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (m *Metric) GetHTMLURL() string { - if m == nil || m.HTMLURL == nil { - return "" - } - return *m.HTMLURL -} - -// GetKey returns the Key field if it's non-nil, zero value otherwise. -func (m *Metric) GetKey() string { - if m == nil || m.Key == nil { - return "" - } - return *m.Key -} - -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (m *Metric) GetName() string { - if m == nil || m.Name == nil { - return "" - } - return *m.Name -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (m *Metric) GetURL() string { - if m == nil || m.URL == nil { - return "" - } - return *m.URL -} - -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (m *Migration) GetCreatedAt() string { - if m == nil || m.CreatedAt == nil { - return "" - } - return *m.CreatedAt -} - -// GetExcludeAttachments returns the ExcludeAttachments field if it's non-nil, zero value otherwise. -func (m *Migration) GetExcludeAttachments() bool { - if m == nil || m.ExcludeAttachments == nil { - return false - } - return *m.ExcludeAttachments -} - -// GetGUID returns the GUID field if it's non-nil, zero value otherwise. -func (m *Migration) GetGUID() string { - if m == nil || m.GUID == nil { - return "" - } - return *m.GUID -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (m *Migration) GetID() int64 { - if m == nil || m.ID == nil { - return 0 - } - return *m.ID -} - -// GetLockRepositories returns the LockRepositories field if it's non-nil, zero value otherwise. -func (m *Migration) GetLockRepositories() bool { - if m == nil || m.LockRepositories == nil { - return false - } - return *m.LockRepositories -} - -// GetState returns the State field if it's non-nil, zero value otherwise. -func (m *Migration) GetState() string { - if m == nil || m.State == nil { - return "" - } - return *m.State -} - -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (m *Migration) GetUpdatedAt() string { - if m == nil || m.UpdatedAt == nil { - return "" - } - return *m.UpdatedAt -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (m *Migration) GetURL() string { - if m == nil || m.URL == nil { - return "" - } - return *m.URL -} - -// GetClosedAt returns the ClosedAt field if it's non-nil, zero value otherwise. -func (m *Milestone) GetClosedAt() time.Time { - if m == nil || m.ClosedAt == nil { - return time.Time{} - } - return *m.ClosedAt -} - -// GetClosedIssues returns the ClosedIssues field if it's non-nil, zero value otherwise. -func (m *Milestone) GetClosedIssues() int { - if m == nil || m.ClosedIssues == nil { - return 0 - } - return *m.ClosedIssues -} - -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (m *Milestone) GetCreatedAt() time.Time { - if m == nil || m.CreatedAt == nil { - return time.Time{} - } - return *m.CreatedAt -} - -// GetCreator returns the Creator field. -func (m *Milestone) GetCreator() *User { - if m == nil { - return nil - } - return m.Creator -} - -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (m *Milestone) GetDescription() string { - if m == nil || m.Description == nil { - return "" - } - return *m.Description -} - -// GetDueOn returns the DueOn field if it's non-nil, zero value otherwise. -func (m *Milestone) GetDueOn() time.Time { - if m == nil || m.DueOn == nil { - return time.Time{} - } - return *m.DueOn -} - -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (m *Milestone) GetHTMLURL() string { - if m == nil || m.HTMLURL == nil { - return "" - } - return *m.HTMLURL -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (m *Milestone) GetID() int64 { - if m == nil || m.ID == nil { - return 0 - } - return *m.ID -} - -// GetLabelsURL returns the LabelsURL field if it's non-nil, zero value otherwise. -func (m *Milestone) GetLabelsURL() string { - if m == nil || m.LabelsURL == nil { - return "" - } - return *m.LabelsURL -} - -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (m *Milestone) GetNodeID() string { - if m == nil || m.NodeID == nil { - return "" - } - return *m.NodeID -} - -// GetNumber returns the Number field if it's non-nil, zero value otherwise. -func (m *Milestone) GetNumber() int { - if m == nil || m.Number == nil { - return 0 - } - return *m.Number -} - -// GetOpenIssues returns the OpenIssues field if it's non-nil, zero value otherwise. -func (m *Milestone) GetOpenIssues() int { - if m == nil || m.OpenIssues == nil { - return 0 - } - return *m.OpenIssues -} - -// GetState returns the State field if it's non-nil, zero value otherwise. -func (m *Milestone) GetState() string { - if m == nil || m.State == nil { - return "" - } - return *m.State -} - -// GetTitle returns the Title field if it's non-nil, zero value otherwise. -func (m *Milestone) GetTitle() string { - if m == nil || m.Title == nil { - return "" - } - return *m.Title -} - -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (m *Milestone) GetUpdatedAt() time.Time { - if m == nil || m.UpdatedAt == nil { - return time.Time{} - } - return *m.UpdatedAt -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (m *Milestone) GetURL() string { - if m == nil || m.URL == nil { - return "" - } - return *m.URL -} - -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (m *MilestoneEvent) GetAction() string { - if m == nil || m.Action == nil { - return "" - } - return *m.Action -} - -// GetChanges returns the Changes field. -func (m *MilestoneEvent) GetChanges() *EditChange { - if m == nil { - return nil - } - return m.Changes -} - -// GetInstallation returns the Installation field. -func (m *MilestoneEvent) GetInstallation() *Installation { - if m == nil { - return nil - } - return m.Installation -} - -// GetMilestone returns the Milestone field. -func (m *MilestoneEvent) GetMilestone() *Milestone { - if m == nil { - return nil - } - return m.Milestone -} - -// GetOrg returns the Org field. -func (m *MilestoneEvent) GetOrg() *Organization { - if m == nil { - return nil - } - return m.Org -} - -// GetRepo returns the Repo field. -func (m *MilestoneEvent) GetRepo() *Repository { - if m == nil { - return nil - } - return m.Repo -} - -// GetSender returns the Sender field. -func (m *MilestoneEvent) GetSender() *User { - if m == nil { - return nil - } - return m.Sender -} - -// GetClosedMilestones returns the ClosedMilestones field if it's non-nil, zero value otherwise. -func (m *MilestoneStats) GetClosedMilestones() int { - if m == nil || m.ClosedMilestones == nil { - return 0 - } - return *m.ClosedMilestones -} - -// GetOpenMilestones returns the OpenMilestones field if it's non-nil, zero value otherwise. -func (m *MilestoneStats) GetOpenMilestones() int { - if m == nil || m.OpenMilestones == nil { - return 0 - } - return *m.OpenMilestones -} - -// GetTotalMilestones returns the TotalMilestones field if it's non-nil, zero value otherwise. -func (m *MilestoneStats) GetTotalMilestones() int { - if m == nil || m.TotalMilestones == nil { - return 0 - } - return *m.TotalMilestones -} - -// GetBase returns the Base field if it's non-nil, zero value otherwise. -func (n *NewPullRequest) GetBase() string { - if n == nil || n.Base == nil { - return "" - } - return *n.Base -} - -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (n *NewPullRequest) GetBody() string { - if n == nil || n.Body == nil { - return "" - } - return *n.Body -} - -// GetDraft returns the Draft field if it's non-nil, zero value otherwise. -func (n *NewPullRequest) GetDraft() bool { - if n == nil || n.Draft == nil { - return false - } - return *n.Draft -} - -// GetHead returns the Head field if it's non-nil, zero value otherwise. -func (n *NewPullRequest) GetHead() string { - if n == nil || n.Head == nil { - return "" - } - return *n.Head -} - -// GetIssue returns the Issue field if it's non-nil, zero value otherwise. -func (n *NewPullRequest) GetIssue() int { - if n == nil || n.Issue == nil { - return 0 - } - return *n.Issue -} - -// GetMaintainerCanModify returns the MaintainerCanModify field if it's non-nil, zero value otherwise. -func (n *NewPullRequest) GetMaintainerCanModify() bool { - if n == nil || n.MaintainerCanModify == nil { - return false - } - return *n.MaintainerCanModify -} - -// GetTitle returns the Title field if it's non-nil, zero value otherwise. -func (n *NewPullRequest) GetTitle() string { - if n == nil || n.Title == nil { - return "" - } - return *n.Title -} - -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (n *NewTeam) GetDescription() string { - if n == nil || n.Description == nil { - return "" - } - return *n.Description -} - -// GetLDAPDN returns the LDAPDN field if it's non-nil, zero value otherwise. -func (n *NewTeam) GetLDAPDN() string { - if n == nil || n.LDAPDN == nil { - return "" - } - return *n.LDAPDN -} - -// GetParentTeamID returns the ParentTeamID field if it's non-nil, zero value otherwise. -func (n *NewTeam) GetParentTeamID() int64 { - if n == nil || n.ParentTeamID == nil { - return 0 - } - return *n.ParentTeamID -} - -// GetPermission returns the Permission field if it's non-nil, zero value otherwise. -func (n *NewTeam) GetPermission() string { - if n == nil || n.Permission == nil { - return "" - } - return *n.Permission -} - -// GetPrivacy returns the Privacy field if it's non-nil, zero value otherwise. -func (n *NewTeam) GetPrivacy() string { - if n == nil || n.Privacy == nil { - return "" - } - return *n.Privacy -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (n *Notification) GetID() string { - if n == nil || n.ID == nil { - return "" - } - return *n.ID -} - -// GetLastReadAt returns the LastReadAt field if it's non-nil, zero value otherwise. -func (n *Notification) GetLastReadAt() time.Time { - if n == nil || n.LastReadAt == nil { - return time.Time{} - } - return *n.LastReadAt -} - -// GetReason returns the Reason field if it's non-nil, zero value otherwise. -func (n *Notification) GetReason() string { - if n == nil || n.Reason == nil { - return "" - } - return *n.Reason -} - -// GetRepository returns the Repository field. -func (n *Notification) GetRepository() *Repository { - if n == nil { - return nil - } - return n.Repository -} - -// GetSubject returns the Subject field. -func (n *Notification) GetSubject() *NotificationSubject { - if n == nil { - return nil - } - return n.Subject -} - -// GetUnread returns the Unread field if it's non-nil, zero value otherwise. -func (n *Notification) GetUnread() bool { - if n == nil || n.Unread == nil { - return false - } - return *n.Unread -} - -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (n *Notification) GetUpdatedAt() time.Time { - if n == nil || n.UpdatedAt == nil { - return time.Time{} - } - return *n.UpdatedAt -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (n *Notification) GetURL() string { - if n == nil || n.URL == nil { - return "" - } - return *n.URL -} - -// GetLatestCommentURL returns the LatestCommentURL field if it's non-nil, zero value otherwise. -func (n *NotificationSubject) GetLatestCommentURL() string { - if n == nil || n.LatestCommentURL == nil { - return "" - } - return *n.LatestCommentURL -} - -// GetTitle returns the Title field if it's non-nil, zero value otherwise. -func (n *NotificationSubject) GetTitle() string { - if n == nil || n.Title == nil { - return "" - } - return *n.Title -} - -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (n *NotificationSubject) GetType() string { - if n == nil || n.Type == nil { - return "" - } - return *n.Type -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (n *NotificationSubject) GetURL() string { - if n == nil || n.URL == nil { - return "" - } - return *n.URL -} - -// GetAvatarURL returns the AvatarURL field if it's non-nil, zero value otherwise. -func (o *Organization) GetAvatarURL() string { - if o == nil || o.AvatarURL == nil { - return "" - } - return *o.AvatarURL -} - -// GetBillingEmail returns the BillingEmail field if it's non-nil, zero value otherwise. -func (o *Organization) GetBillingEmail() string { - if o == nil || o.BillingEmail == nil { - return "" - } - return *o.BillingEmail -} - -// GetBlog returns the Blog field if it's non-nil, zero value otherwise. -func (o *Organization) GetBlog() string { - if o == nil || o.Blog == nil { - return "" - } - return *o.Blog -} - -// GetCollaborators returns the Collaborators field if it's non-nil, zero value otherwise. -func (o *Organization) GetCollaborators() int { - if o == nil || o.Collaborators == nil { - return 0 - } - return *o.Collaborators -} - -// GetCompany returns the Company field if it's non-nil, zero value otherwise. -func (o *Organization) GetCompany() string { - if o == nil || o.Company == nil { - return "" - } - return *o.Company -} - -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (o *Organization) GetCreatedAt() time.Time { - if o == nil || o.CreatedAt == nil { - return time.Time{} - } - return *o.CreatedAt -} - -// GetDefaultRepoPermission returns the DefaultRepoPermission field if it's non-nil, zero value otherwise. -func (o *Organization) GetDefaultRepoPermission() string { - if o == nil || o.DefaultRepoPermission == nil { - return "" - } - return *o.DefaultRepoPermission -} - -// GetDefaultRepoSettings returns the DefaultRepoSettings field if it's non-nil, zero value otherwise. -func (o *Organization) GetDefaultRepoSettings() string { - if o == nil || o.DefaultRepoSettings == nil { - return "" - } - return *o.DefaultRepoSettings -} - -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (o *Organization) GetDescription() string { - if o == nil || o.Description == nil { - return "" - } - return *o.Description -} - -// GetDiskUsage returns the DiskUsage field if it's non-nil, zero value otherwise. -func (o *Organization) GetDiskUsage() int { - if o == nil || o.DiskUsage == nil { - return 0 - } - return *o.DiskUsage -} - -// GetEmail returns the Email field if it's non-nil, zero value otherwise. -func (o *Organization) GetEmail() string { - if o == nil || o.Email == nil { - return "" - } - return *o.Email -} - -// GetEventsURL returns the EventsURL field if it's non-nil, zero value otherwise. -func (o *Organization) GetEventsURL() string { - if o == nil || o.EventsURL == nil { - return "" - } - return *o.EventsURL -} - -// GetFollowers returns the Followers field if it's non-nil, zero value otherwise. -func (o *Organization) GetFollowers() int { - if o == nil || o.Followers == nil { - return 0 - } - return *o.Followers -} - -// GetFollowing returns the Following field if it's non-nil, zero value otherwise. -func (o *Organization) GetFollowing() int { - if o == nil || o.Following == nil { - return 0 - } - return *o.Following -} - -// GetHooksURL returns the HooksURL field if it's non-nil, zero value otherwise. -func (o *Organization) GetHooksURL() string { - if o == nil || o.HooksURL == nil { - return "" - } - return *o.HooksURL -} - -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (o *Organization) GetHTMLURL() string { - if o == nil || o.HTMLURL == nil { - return "" - } - return *o.HTMLURL -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (o *Organization) GetID() int64 { - if o == nil || o.ID == nil { - return 0 - } - return *o.ID -} - -// GetIssuesURL returns the IssuesURL field if it's non-nil, zero value otherwise. -func (o *Organization) GetIssuesURL() string { - if o == nil || o.IssuesURL == nil { - return "" - } - return *o.IssuesURL -} - -// GetLocation returns the Location field if it's non-nil, zero value otherwise. -func (o *Organization) GetLocation() string { - if o == nil || o.Location == nil { - return "" - } - return *o.Location -} - -// GetLogin returns the Login field if it's non-nil, zero value otherwise. -func (o *Organization) GetLogin() string { - if o == nil || o.Login == nil { - return "" - } - return *o.Login -} - -// GetMembersAllowedRepositoryCreationType returns the MembersAllowedRepositoryCreationType field if it's non-nil, zero value otherwise. -func (o *Organization) GetMembersAllowedRepositoryCreationType() string { - if o == nil || o.MembersAllowedRepositoryCreationType == nil { - return "" - } - return *o.MembersAllowedRepositoryCreationType -} - -// GetMembersCanCreateRepos returns the MembersCanCreateRepos field if it's non-nil, zero value otherwise. -func (o *Organization) GetMembersCanCreateRepos() bool { - if o == nil || o.MembersCanCreateRepos == nil { - return false - } - return *o.MembersCanCreateRepos -} - -// GetMembersURL returns the MembersURL field if it's non-nil, zero value otherwise. -func (o *Organization) GetMembersURL() string { - if o == nil || o.MembersURL == nil { - return "" - } - return *o.MembersURL -} - -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (o *Organization) GetName() string { - if o == nil || o.Name == nil { - return "" - } - return *o.Name -} - -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (o *Organization) GetNodeID() string { - if o == nil || o.NodeID == nil { - return "" - } - return *o.NodeID -} - -// GetOwnedPrivateRepos returns the OwnedPrivateRepos field if it's non-nil, zero value otherwise. -func (o *Organization) GetOwnedPrivateRepos() int { - if o == nil || o.OwnedPrivateRepos == nil { - return 0 - } - return *o.OwnedPrivateRepos -} - -// GetPlan returns the Plan field. -func (o *Organization) GetPlan() *Plan { - if o == nil { - return nil - } - return o.Plan -} - -// GetPrivateGists returns the PrivateGists field if it's non-nil, zero value otherwise. -func (o *Organization) GetPrivateGists() int { - if o == nil || o.PrivateGists == nil { - return 0 - } - return *o.PrivateGists -} - -// GetPublicGists returns the PublicGists field if it's non-nil, zero value otherwise. -func (o *Organization) GetPublicGists() int { - if o == nil || o.PublicGists == nil { - return 0 - } - return *o.PublicGists -} - -// GetPublicMembersURL returns the PublicMembersURL field if it's non-nil, zero value otherwise. -func (o *Organization) GetPublicMembersURL() string { - if o == nil || o.PublicMembersURL == nil { - return "" - } - return *o.PublicMembersURL -} - -// GetPublicRepos returns the PublicRepos field if it's non-nil, zero value otherwise. -func (o *Organization) GetPublicRepos() int { - if o == nil || o.PublicRepos == nil { - return 0 - } - return *o.PublicRepos -} - -// GetReposURL returns the ReposURL field if it's non-nil, zero value otherwise. -func (o *Organization) GetReposURL() string { - if o == nil || o.ReposURL == nil { - return "" - } - return *o.ReposURL -} - -// GetTotalPrivateRepos returns the TotalPrivateRepos field if it's non-nil, zero value otherwise. -func (o *Organization) GetTotalPrivateRepos() int { - if o == nil || o.TotalPrivateRepos == nil { - return 0 - } - return *o.TotalPrivateRepos -} - -// GetTwoFactorRequirementEnabled returns the TwoFactorRequirementEnabled field if it's non-nil, zero value otherwise. -func (o *Organization) GetTwoFactorRequirementEnabled() bool { - if o == nil || o.TwoFactorRequirementEnabled == nil { - return false - } - return *o.TwoFactorRequirementEnabled -} - -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (o *Organization) GetType() string { - if o == nil || o.Type == nil { - return "" - } - return *o.Type -} - -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (o *Organization) GetUpdatedAt() time.Time { - if o == nil || o.UpdatedAt == nil { - return time.Time{} - } - return *o.UpdatedAt -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (o *Organization) GetURL() string { - if o == nil || o.URL == nil { - return "" - } - return *o.URL -} - -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (o *OrganizationEvent) GetAction() string { - if o == nil || o.Action == nil { - return "" - } - return *o.Action -} - -// GetInstallation returns the Installation field. -func (o *OrganizationEvent) GetInstallation() *Installation { - if o == nil { - return nil - } - return o.Installation -} - -// GetInvitation returns the Invitation field. -func (o *OrganizationEvent) GetInvitation() *Invitation { - if o == nil { - return nil - } - return o.Invitation -} - -// GetMembership returns the Membership field. -func (o *OrganizationEvent) GetMembership() *Membership { - if o == nil { - return nil - } - return o.Membership -} - -// GetOrganization returns the Organization field. -func (o *OrganizationEvent) GetOrganization() *Organization { - if o == nil { - return nil - } - return o.Organization -} - -// GetSender returns the Sender field. -func (o *OrganizationEvent) GetSender() *User { - if o == nil { - return nil - } - return o.Sender -} - -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (o *OrgBlockEvent) GetAction() string { - if o == nil || o.Action == nil { - return "" - } - return *o.Action -} - -// GetBlockedUser returns the BlockedUser field. -func (o *OrgBlockEvent) GetBlockedUser() *User { - if o == nil { - return nil - } - return o.BlockedUser -} - -// GetInstallation returns the Installation field. -func (o *OrgBlockEvent) GetInstallation() *Installation { - if o == nil { - return nil - } - return o.Installation -} - -// GetOrganization returns the Organization field. -func (o *OrgBlockEvent) GetOrganization() *Organization { - if o == nil { - return nil - } - return o.Organization -} - -// GetSender returns the Sender field. -func (o *OrgBlockEvent) GetSender() *User { - if o == nil { - return nil - } - return o.Sender -} - -// GetDisabledOrgs returns the DisabledOrgs field if it's non-nil, zero value otherwise. -func (o *OrgStats) GetDisabledOrgs() int { - if o == nil || o.DisabledOrgs == nil { - return 0 - } - return *o.DisabledOrgs -} - -// GetTotalOrgs returns the TotalOrgs field if it's non-nil, zero value otherwise. -func (o *OrgStats) GetTotalOrgs() int { - if o == nil || o.TotalOrgs == nil { - return 0 - } - return *o.TotalOrgs -} - -// GetTotalTeamMembers returns the TotalTeamMembers field if it's non-nil, zero value otherwise. -func (o *OrgStats) GetTotalTeamMembers() int { - if o == nil || o.TotalTeamMembers == nil { - return 0 - } - return *o.TotalTeamMembers -} - -// GetTotalTeams returns the TotalTeams field if it's non-nil, zero value otherwise. -func (o *OrgStats) GetTotalTeams() int { - if o == nil || o.TotalTeams == nil { - return 0 - } - return *o.TotalTeams -} - -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (p *Page) GetAction() string { - if p == nil || p.Action == nil { - return "" - } - return *p.Action -} - -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (p *Page) GetHTMLURL() string { - if p == nil || p.HTMLURL == nil { - return "" - } - return *p.HTMLURL -} - -// GetPageName returns the PageName field if it's non-nil, zero value otherwise. -func (p *Page) GetPageName() string { - if p == nil || p.PageName == nil { - return "" - } - return *p.PageName -} - -// GetSHA returns the SHA field if it's non-nil, zero value otherwise. -func (p *Page) GetSHA() string { - if p == nil || p.SHA == nil { - return "" - } - return *p.SHA -} - -// GetSummary returns the Summary field if it's non-nil, zero value otherwise. -func (p *Page) GetSummary() string { - if p == nil || p.Summary == nil { - return "" - } - return *p.Summary -} - -// GetTitle returns the Title field if it's non-nil, zero value otherwise. -func (p *Page) GetTitle() string { - if p == nil || p.Title == nil { - return "" - } - return *p.Title -} - -// GetBuild returns the Build field. -func (p *PageBuildEvent) GetBuild() *PagesBuild { - if p == nil { - return nil - } - return p.Build -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (p *PageBuildEvent) GetID() int64 { - if p == nil || p.ID == nil { - return 0 - } - return *p.ID -} - -// GetInstallation returns the Installation field. -func (p *PageBuildEvent) GetInstallation() *Installation { - if p == nil { - return nil - } - return p.Installation -} - -// GetRepo returns the Repo field. -func (p *PageBuildEvent) GetRepo() *Repository { - if p == nil { - return nil - } - return p.Repo -} - -// GetSender returns the Sender field. -func (p *PageBuildEvent) GetSender() *User { - if p == nil { - return nil - } - return p.Sender -} - -// GetCNAME returns the CNAME field if it's non-nil, zero value otherwise. -func (p *Pages) GetCNAME() string { - if p == nil || p.CNAME == nil { - return "" - } - return *p.CNAME -} - -// GetCustom404 returns the Custom404 field if it's non-nil, zero value otherwise. -func (p *Pages) GetCustom404() bool { - if p == nil || p.Custom404 == nil { - return false - } - return *p.Custom404 -} - -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (p *Pages) GetHTMLURL() string { - if p == nil || p.HTMLURL == nil { - return "" - } - return *p.HTMLURL -} - -// GetSource returns the Source field. -func (p *Pages) GetSource() *PagesSource { - if p == nil { - return nil - } - return p.Source -} - -// GetStatus returns the Status field if it's non-nil, zero value otherwise. -func (p *Pages) GetStatus() string { - if p == nil || p.Status == nil { - return "" - } - return *p.Status -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (p *Pages) GetURL() string { - if p == nil || p.URL == nil { - return "" - } - return *p.URL -} - -// GetCommit returns the Commit field if it's non-nil, zero value otherwise. -func (p *PagesBuild) GetCommit() string { - if p == nil || p.Commit == nil { - return "" - } - return *p.Commit -} - -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (p *PagesBuild) GetCreatedAt() Timestamp { - if p == nil || p.CreatedAt == nil { - return Timestamp{} - } - return *p.CreatedAt -} - -// GetDuration returns the Duration field if it's non-nil, zero value otherwise. -func (p *PagesBuild) GetDuration() int { - if p == nil || p.Duration == nil { - return 0 - } - return *p.Duration -} - -// GetError returns the Error field. -func (p *PagesBuild) GetError() *PagesError { - if p == nil { - return nil - } - return p.Error -} - -// GetPusher returns the Pusher field. -func (p *PagesBuild) GetPusher() *User { - if p == nil { - return nil - } - return p.Pusher -} - -// GetStatus returns the Status field if it's non-nil, zero value otherwise. -func (p *PagesBuild) GetStatus() string { - if p == nil || p.Status == nil { - return "" - } - return *p.Status -} - -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (p *PagesBuild) GetUpdatedAt() Timestamp { - if p == nil || p.UpdatedAt == nil { - return Timestamp{} - } - return *p.UpdatedAt -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (p *PagesBuild) GetURL() string { - if p == nil || p.URL == nil { - return "" - } - return *p.URL -} - -// GetMessage returns the Message field if it's non-nil, zero value otherwise. -func (p *PagesError) GetMessage() string { - if p == nil || p.Message == nil { - return "" - } - return *p.Message -} - -// GetBranch returns the Branch field if it's non-nil, zero value otherwise. -func (p *PagesSource) GetBranch() string { - if p == nil || p.Branch == nil { - return "" - } - return *p.Branch -} - -// GetPath returns the Path field if it's non-nil, zero value otherwise. -func (p *PagesSource) GetPath() string { - if p == nil || p.Path == nil { - return "" - } - return *p.Path -} - -// GetTotalPages returns the TotalPages field if it's non-nil, zero value otherwise. -func (p *PageStats) GetTotalPages() int { - if p == nil || p.TotalPages == nil { - return 0 - } - return *p.TotalPages -} - -// GetHook returns the Hook field. -func (p *PingEvent) GetHook() *Hook { - if p == nil { - return nil - } - return p.Hook -} - -// GetHookID returns the HookID field if it's non-nil, zero value otherwise. -func (p *PingEvent) GetHookID() int64 { - if p == nil || p.HookID == nil { - return 0 - } - return *p.HookID -} - -// GetInstallation returns the Installation field. -func (p *PingEvent) GetInstallation() *Installation { - if p == nil { - return nil - } - return p.Installation -} - -// GetZen returns the Zen field if it's non-nil, zero value otherwise. -func (p *PingEvent) GetZen() string { - if p == nil || p.Zen == nil { - return "" - } - return *p.Zen -} - -// GetCollaborators returns the Collaborators field if it's non-nil, zero value otherwise. -func (p *Plan) GetCollaborators() int { - if p == nil || p.Collaborators == nil { - return 0 - } - return *p.Collaborators -} - -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (p *Plan) GetName() string { - if p == nil || p.Name == nil { - return "" - } - return *p.Name -} - -// GetPrivateRepos returns the PrivateRepos field if it's non-nil, zero value otherwise. -func (p *Plan) GetPrivateRepos() int { - if p == nil || p.PrivateRepos == nil { - return 0 - } - return *p.PrivateRepos -} - -// GetSpace returns the Space field if it's non-nil, zero value otherwise. -func (p *Plan) GetSpace() int { - if p == nil || p.Space == nil { - return 0 - } - return *p.Space -} - -// GetConfigURL returns the ConfigURL field if it's non-nil, zero value otherwise. -func (p *PreReceiveHook) GetConfigURL() string { - if p == nil || p.ConfigURL == nil { - return "" - } - return *p.ConfigURL -} - -// GetEnforcement returns the Enforcement field if it's non-nil, zero value otherwise. -func (p *PreReceiveHook) GetEnforcement() string { - if p == nil || p.Enforcement == nil { - return "" - } - return *p.Enforcement -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (p *PreReceiveHook) GetID() int64 { - if p == nil || p.ID == nil { - return 0 - } - return *p.ID -} - -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (p *PreReceiveHook) GetName() string { - if p == nil || p.Name == nil { - return "" - } - return *p.Name -} - -// GetHRef returns the HRef field if it's non-nil, zero value otherwise. -func (p *PRLink) GetHRef() string { - if p == nil || p.HRef == nil { - return "" - } - return *p.HRef -} - -// GetComments returns the Comments field. -func (p *PRLinks) GetComments() *PRLink { - if p == nil { - return nil - } - return p.Comments -} - -// GetCommits returns the Commits field. -func (p *PRLinks) GetCommits() *PRLink { - if p == nil { - return nil - } - return p.Commits -} - -// GetHTML returns the HTML field. -func (p *PRLinks) GetHTML() *PRLink { - if p == nil { - return nil - } - return p.HTML -} - -// GetIssue returns the Issue field. -func (p *PRLinks) GetIssue() *PRLink { - if p == nil { - return nil - } - return p.Issue -} - -// GetReviewComment returns the ReviewComment field. -func (p *PRLinks) GetReviewComment() *PRLink { - if p == nil { - return nil - } - return p.ReviewComment -} - -// GetReviewComments returns the ReviewComments field. -func (p *PRLinks) GetReviewComments() *PRLink { - if p == nil { - return nil - } - return p.ReviewComments -} - -// GetSelf returns the Self field. -func (p *PRLinks) GetSelf() *PRLink { - if p == nil { - return nil - } - return p.Self -} - -// GetStatuses returns the Statuses field. -func (p *PRLinks) GetStatuses() *PRLink { - if p == nil { - return nil - } - return p.Statuses -} - -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (p *Project) GetBody() string { - if p == nil || p.Body == nil { - return "" - } - return *p.Body -} - -// GetColumnsURL returns the ColumnsURL field if it's non-nil, zero value otherwise. -func (p *Project) GetColumnsURL() string { - if p == nil || p.ColumnsURL == nil { - return "" - } - return *p.ColumnsURL -} - -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (p *Project) GetCreatedAt() Timestamp { - if p == nil || p.CreatedAt == nil { - return Timestamp{} - } - return *p.CreatedAt -} - -// GetCreator returns the Creator field. -func (p *Project) GetCreator() *User { - if p == nil { - return nil - } - return p.Creator -} - -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (p *Project) GetHTMLURL() string { - if p == nil || p.HTMLURL == nil { - return "" - } - return *p.HTMLURL -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (p *Project) GetID() int64 { - if p == nil || p.ID == nil { - return 0 - } - return *p.ID -} - -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (p *Project) GetName() string { - if p == nil || p.Name == nil { - return "" - } - return *p.Name -} - -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (p *Project) GetNodeID() string { - if p == nil || p.NodeID == nil { - return "" - } - return *p.NodeID -} - -// GetNumber returns the Number field if it's non-nil, zero value otherwise. -func (p *Project) GetNumber() int { - if p == nil || p.Number == nil { - return 0 - } - return *p.Number -} - -// GetOwnerURL returns the OwnerURL field if it's non-nil, zero value otherwise. -func (p *Project) GetOwnerURL() string { - if p == nil || p.OwnerURL == nil { - return "" - } - return *p.OwnerURL -} - -// GetState returns the State field if it's non-nil, zero value otherwise. -func (p *Project) GetState() string { - if p == nil || p.State == nil { - return "" - } - return *p.State -} - -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (p *Project) GetUpdatedAt() Timestamp { - if p == nil || p.UpdatedAt == nil { - return Timestamp{} - } - return *p.UpdatedAt -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (p *Project) GetURL() string { - if p == nil || p.URL == nil { - return "" - } - return *p.URL -} - -// GetArchived returns the Archived field if it's non-nil, zero value otherwise. -func (p *ProjectCard) GetArchived() bool { - if p == nil || p.Archived == nil { - return false - } - return *p.Archived -} - -// GetColumnID returns the ColumnID field if it's non-nil, zero value otherwise. -func (p *ProjectCard) GetColumnID() int64 { - if p == nil || p.ColumnID == nil { - return 0 - } - return *p.ColumnID -} - -// GetColumnName returns the ColumnName field if it's non-nil, zero value otherwise. -func (p *ProjectCard) GetColumnName() string { - if p == nil || p.ColumnName == nil { - return "" - } - return *p.ColumnName -} - -// GetColumnURL returns the ColumnURL field if it's non-nil, zero value otherwise. -func (p *ProjectCard) GetColumnURL() string { - if p == nil || p.ColumnURL == nil { - return "" - } - return *p.ColumnURL -} - -// GetContentURL returns the ContentURL field if it's non-nil, zero value otherwise. -func (p *ProjectCard) GetContentURL() string { - if p == nil || p.ContentURL == nil { - return "" - } - return *p.ContentURL -} - -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (p *ProjectCard) GetCreatedAt() Timestamp { - if p == nil || p.CreatedAt == nil { - return Timestamp{} - } - return *p.CreatedAt -} - -// GetCreator returns the Creator field. -func (p *ProjectCard) GetCreator() *User { - if p == nil { - return nil - } - return p.Creator -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (p *ProjectCard) GetID() int64 { - if p == nil || p.ID == nil { - return 0 - } - return *p.ID -} - -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (p *ProjectCard) GetNodeID() string { - if p == nil || p.NodeID == nil { - return "" - } - return *p.NodeID -} - -// GetNote returns the Note field if it's non-nil, zero value otherwise. -func (p *ProjectCard) GetNote() string { - if p == nil || p.Note == nil { - return "" - } - return *p.Note -} - -// GetPreviousColumnName returns the PreviousColumnName field if it's non-nil, zero value otherwise. -func (p *ProjectCard) GetPreviousColumnName() string { - if p == nil || p.PreviousColumnName == nil { - return "" - } - return *p.PreviousColumnName -} - -// GetProjectID returns the ProjectID field if it's non-nil, zero value otherwise. -func (p *ProjectCard) GetProjectID() int64 { - if p == nil || p.ProjectID == nil { - return 0 - } - return *p.ProjectID -} - -// GetProjectURL returns the ProjectURL field if it's non-nil, zero value otherwise. -func (p *ProjectCard) GetProjectURL() string { - if p == nil || p.ProjectURL == nil { - return "" - } - return *p.ProjectURL -} - -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (p *ProjectCard) GetUpdatedAt() Timestamp { - if p == nil || p.UpdatedAt == nil { - return Timestamp{} - } - return *p.UpdatedAt -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (p *ProjectCard) GetURL() string { - if p == nil || p.URL == nil { - return "" - } - return *p.URL -} - -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (p *ProjectCardEvent) GetAction() string { - if p == nil || p.Action == nil { - return "" - } - return *p.Action -} - -// GetAfterID returns the AfterID field if it's non-nil, zero value otherwise. -func (p *ProjectCardEvent) GetAfterID() int64 { - if p == nil || p.AfterID == nil { - return 0 - } - return *p.AfterID -} - -// GetChanges returns the Changes field. -func (p *ProjectCardEvent) GetChanges() *ProjectCardChange { - if p == nil { - return nil - } - return p.Changes -} - -// GetInstallation returns the Installation field. -func (p *ProjectCardEvent) GetInstallation() *Installation { - if p == nil { - return nil - } - return p.Installation -} - -// GetOrg returns the Org field. -func (p *ProjectCardEvent) GetOrg() *Organization { - if p == nil { - return nil - } - return p.Org -} - -// GetProjectCard returns the ProjectCard field. -func (p *ProjectCardEvent) GetProjectCard() *ProjectCard { - if p == nil { - return nil - } - return p.ProjectCard -} - -// GetRepo returns the Repo field. -func (p *ProjectCardEvent) GetRepo() *Repository { - if p == nil { - return nil - } - return p.Repo -} - -// GetSender returns the Sender field. -func (p *ProjectCardEvent) GetSender() *User { - if p == nil { - return nil - } - return p.Sender -} - -// GetArchivedState returns the ArchivedState field if it's non-nil, zero value otherwise. -func (p *ProjectCardListOptions) GetArchivedState() string { - if p == nil || p.ArchivedState == nil { - return "" - } - return *p.ArchivedState -} - -// GetArchived returns the Archived field if it's non-nil, zero value otherwise. -func (p *ProjectCardOptions) GetArchived() bool { - if p == nil || p.Archived == nil { - return false - } - return *p.Archived -} - -// GetPermission returns the Permission field if it's non-nil, zero value otherwise. -func (p *ProjectCollaboratorOptions) GetPermission() string { - if p == nil || p.Permission == nil { - return "" - } - return *p.Permission -} - -// GetCardsURL returns the CardsURL field if it's non-nil, zero value otherwise. -func (p *ProjectColumn) GetCardsURL() string { - if p == nil || p.CardsURL == nil { - return "" - } - return *p.CardsURL -} - -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (p *ProjectColumn) GetCreatedAt() Timestamp { - if p == nil || p.CreatedAt == nil { - return Timestamp{} - } - return *p.CreatedAt -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (p *ProjectColumn) GetID() int64 { - if p == nil || p.ID == nil { - return 0 - } - return *p.ID -} - -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (p *ProjectColumn) GetName() string { - if p == nil || p.Name == nil { - return "" - } - return *p.Name -} - -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (p *ProjectColumn) GetNodeID() string { - if p == nil || p.NodeID == nil { - return "" - } - return *p.NodeID -} - -// GetProjectURL returns the ProjectURL field if it's non-nil, zero value otherwise. -func (p *ProjectColumn) GetProjectURL() string { - if p == nil || p.ProjectURL == nil { - return "" - } - return *p.ProjectURL -} - -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (p *ProjectColumn) GetUpdatedAt() Timestamp { - if p == nil || p.UpdatedAt == nil { - return Timestamp{} - } - return *p.UpdatedAt -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (p *ProjectColumn) GetURL() string { - if p == nil || p.URL == nil { - return "" - } - return *p.URL -} - -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (p *ProjectColumnEvent) GetAction() string { - if p == nil || p.Action == nil { - return "" - } - return *p.Action -} - -// GetAfterID returns the AfterID field if it's non-nil, zero value otherwise. -func (p *ProjectColumnEvent) GetAfterID() int64 { - if p == nil || p.AfterID == nil { - return 0 - } - return *p.AfterID -} - -// GetChanges returns the Changes field. -func (p *ProjectColumnEvent) GetChanges() *ProjectColumnChange { - if p == nil { - return nil - } - return p.Changes -} - -// GetInstallation returns the Installation field. -func (p *ProjectColumnEvent) GetInstallation() *Installation { - if p == nil { - return nil - } - return p.Installation -} - -// GetOrg returns the Org field. -func (p *ProjectColumnEvent) GetOrg() *Organization { - if p == nil { - return nil - } - return p.Org -} - -// GetProjectColumn returns the ProjectColumn field. -func (p *ProjectColumnEvent) GetProjectColumn() *ProjectColumn { - if p == nil { - return nil - } - return p.ProjectColumn -} - -// GetRepo returns the Repo field. -func (p *ProjectColumnEvent) GetRepo() *Repository { - if p == nil { - return nil - } - return p.Repo -} - -// GetSender returns the Sender field. -func (p *ProjectColumnEvent) GetSender() *User { - if p == nil { - return nil - } - return p.Sender -} - -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (p *ProjectEvent) GetAction() string { - if p == nil || p.Action == nil { - return "" - } - return *p.Action -} - -// GetChanges returns the Changes field. -func (p *ProjectEvent) GetChanges() *ProjectChange { - if p == nil { - return nil - } - return p.Changes -} - -// GetInstallation returns the Installation field. -func (p *ProjectEvent) GetInstallation() *Installation { - if p == nil { - return nil - } - return p.Installation -} - -// GetOrg returns the Org field. -func (p *ProjectEvent) GetOrg() *Organization { - if p == nil { - return nil - } - return p.Org -} - -// GetProject returns the Project field. -func (p *ProjectEvent) GetProject() *Project { - if p == nil { - return nil - } - return p.Project -} - -// GetRepo returns the Repo field. -func (p *ProjectEvent) GetRepo() *Repository { - if p == nil { - return nil - } - return p.Repo -} - -// GetSender returns the Sender field. -func (p *ProjectEvent) GetSender() *User { - if p == nil { - return nil - } - return p.Sender -} - -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (p *ProjectOptions) GetBody() string { - if p == nil || p.Body == nil { - return "" - } - return *p.Body -} - -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (p *ProjectOptions) GetName() string { - if p == nil || p.Name == nil { - return "" - } - return *p.Name -} - -// GetOrganizationPermission returns the OrganizationPermission field if it's non-nil, zero value otherwise. -func (p *ProjectOptions) GetOrganizationPermission() string { - if p == nil || p.OrganizationPermission == nil { - return "" - } - return *p.OrganizationPermission -} - -// GetPublic returns the Public field if it's non-nil, zero value otherwise. -func (p *ProjectOptions) GetPublic() bool { - if p == nil || p.Public == nil { - return false - } - return *p.Public -} - -// GetState returns the State field if it's non-nil, zero value otherwise. -func (p *ProjectOptions) GetState() string { - if p == nil || p.State == nil { - return "" - } - return *p.State -} - -// GetPermission returns the Permission field if it's non-nil, zero value otherwise. -func (p *ProjectPermissionLevel) GetPermission() string { - if p == nil || p.Permission == nil { - return "" - } - return *p.Permission -} - -// GetUser returns the User field. -func (p *ProjectPermissionLevel) GetUser() *User { - if p == nil { - return nil - } - return p.User -} - -// GetEnforceAdmins returns the EnforceAdmins field. -func (p *Protection) GetEnforceAdmins() *AdminEnforcement { - if p == nil { - return nil - } - return p.EnforceAdmins -} - -// GetRequiredPullRequestReviews returns the RequiredPullRequestReviews field. -func (p *Protection) GetRequiredPullRequestReviews() *PullRequestReviewsEnforcement { - if p == nil { - return nil - } - return p.RequiredPullRequestReviews -} - -// GetRequiredStatusChecks returns the RequiredStatusChecks field. -func (p *Protection) GetRequiredStatusChecks() *RequiredStatusChecks { - if p == nil { - return nil - } - return p.RequiredStatusChecks -} - -// GetRestrictions returns the Restrictions field. -func (p *Protection) GetRestrictions() *BranchRestrictions { - if p == nil { - return nil - } - return p.Restrictions -} - -// GetRequiredPullRequestReviews returns the RequiredPullRequestReviews field. -func (p *ProtectionRequest) GetRequiredPullRequestReviews() *PullRequestReviewsEnforcementRequest { - if p == nil { - return nil - } - return p.RequiredPullRequestReviews -} - -// GetRequiredStatusChecks returns the RequiredStatusChecks field. -func (p *ProtectionRequest) GetRequiredStatusChecks() *RequiredStatusChecks { - if p == nil { - return nil - } - return p.RequiredStatusChecks -} - -// GetRestrictions returns the Restrictions field. -func (p *ProtectionRequest) GetRestrictions() *BranchRestrictionsRequest { - if p == nil { - return nil - } - return p.Restrictions -} - -// GetInstallation returns the Installation field. -func (p *PublicEvent) GetInstallation() *Installation { - if p == nil { - return nil - } - return p.Installation -} - -// GetRepo returns the Repo field. -func (p *PublicEvent) GetRepo() *Repository { - if p == nil { - return nil - } - return p.Repo -} - -// GetSender returns the Sender field. -func (p *PublicEvent) GetSender() *User { - if p == nil { - return nil - } - return p.Sender -} - -// GetExpectedHeadSHA returns the ExpectedHeadSHA field if it's non-nil, zero value otherwise. -func (p *PullReqestBranchUpdateOptions) GetExpectedHeadSHA() string { - if p == nil || p.ExpectedHeadSHA == nil { - return "" - } - return *p.ExpectedHeadSHA -} - -// GetActiveLockReason returns the ActiveLockReason field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetActiveLockReason() string { - if p == nil || p.ActiveLockReason == nil { - return "" - } - return *p.ActiveLockReason -} - -// GetAdditions returns the Additions field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetAdditions() int { - if p == nil || p.Additions == nil { - return 0 - } - return *p.Additions -} - -// GetAssignee returns the Assignee field. -func (p *PullRequest) GetAssignee() *User { - if p == nil { - return nil - } - return p.Assignee -} - -// GetAuthorAssociation returns the AuthorAssociation field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetAuthorAssociation() string { - if p == nil || p.AuthorAssociation == nil { - return "" - } - return *p.AuthorAssociation -} - -// GetBase returns the Base field. -func (p *PullRequest) GetBase() *PullRequestBranch { - if p == nil { - return nil - } - return p.Base -} - -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetBody() string { - if p == nil || p.Body == nil { - return "" - } - return *p.Body -} - -// GetChangedFiles returns the ChangedFiles field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetChangedFiles() int { - if p == nil || p.ChangedFiles == nil { - return 0 - } - return *p.ChangedFiles -} - -// GetClosedAt returns the ClosedAt field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetClosedAt() time.Time { - if p == nil || p.ClosedAt == nil { - return time.Time{} - } - return *p.ClosedAt -} - -// GetComments returns the Comments field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetComments() int { - if p == nil || p.Comments == nil { - return 0 - } - return *p.Comments -} - -// GetCommentsURL returns the CommentsURL field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetCommentsURL() string { - if p == nil || p.CommentsURL == nil { - return "" - } - return *p.CommentsURL -} - -// GetCommits returns the Commits field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetCommits() int { - if p == nil || p.Commits == nil { - return 0 - } - return *p.Commits -} - -// GetCommitsURL returns the CommitsURL field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetCommitsURL() string { - if p == nil || p.CommitsURL == nil { - return "" - } - return *p.CommitsURL -} - -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetCreatedAt() time.Time { - if p == nil || p.CreatedAt == nil { - return time.Time{} - } - return *p.CreatedAt -} - -// GetDeletions returns the Deletions field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetDeletions() int { - if p == nil || p.Deletions == nil { - return 0 - } - return *p.Deletions -} - -// GetDiffURL returns the DiffURL field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetDiffURL() string { - if p == nil || p.DiffURL == nil { - return "" - } - return *p.DiffURL -} - -// GetDraft returns the Draft field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetDraft() bool { - if p == nil || p.Draft == nil { - return false - } - return *p.Draft -} - -// GetHead returns the Head field. -func (p *PullRequest) GetHead() *PullRequestBranch { - if p == nil { - return nil - } - return p.Head -} - -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetHTMLURL() string { - if p == nil || p.HTMLURL == nil { - return "" - } - return *p.HTMLURL -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetID() int64 { - if p == nil || p.ID == nil { - return 0 - } - return *p.ID -} - -// GetIssueURL returns the IssueURL field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetIssueURL() string { - if p == nil || p.IssueURL == nil { - return "" - } - return *p.IssueURL -} - -// GetLinks returns the Links field. -func (p *PullRequest) GetLinks() *PRLinks { - if p == nil { - return nil - } - return p.Links -} - -// GetMaintainerCanModify returns the MaintainerCanModify field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetMaintainerCanModify() bool { - if p == nil || p.MaintainerCanModify == nil { - return false - } - return *p.MaintainerCanModify -} - -// GetMergeable returns the Mergeable field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetMergeable() bool { - if p == nil || p.Mergeable == nil { - return false - } - return *p.Mergeable -} - -// GetMergeableState returns the MergeableState field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetMergeableState() string { - if p == nil || p.MergeableState == nil { - return "" - } - return *p.MergeableState -} - -// GetMergeCommitSHA returns the MergeCommitSHA field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetMergeCommitSHA() string { - if p == nil || p.MergeCommitSHA == nil { - return "" - } - return *p.MergeCommitSHA -} - -// GetMerged returns the Merged field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetMerged() bool { - if p == nil || p.Merged == nil { - return false - } - return *p.Merged -} - -// GetMergedAt returns the MergedAt field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetMergedAt() time.Time { - if p == nil || p.MergedAt == nil { - return time.Time{} - } - return *p.MergedAt -} - -// GetMergedBy returns the MergedBy field. -func (p *PullRequest) GetMergedBy() *User { - if p == nil { - return nil - } - return p.MergedBy -} - -// GetMilestone returns the Milestone field. -func (p *PullRequest) GetMilestone() *Milestone { - if p == nil { - return nil - } - return p.Milestone -} - -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetNodeID() string { - if p == nil || p.NodeID == nil { - return "" - } - return *p.NodeID -} - -// GetNumber returns the Number field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetNumber() int { - if p == nil || p.Number == nil { - return 0 - } - return *p.Number -} - -// GetPatchURL returns the PatchURL field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetPatchURL() string { - if p == nil || p.PatchURL == nil { - return "" - } - return *p.PatchURL -} - -// GetReviewComments returns the ReviewComments field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetReviewComments() int { - if p == nil || p.ReviewComments == nil { - return 0 - } - return *p.ReviewComments -} - -// GetReviewCommentsURL returns the ReviewCommentsURL field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetReviewCommentsURL() string { - if p == nil || p.ReviewCommentsURL == nil { - return "" - } - return *p.ReviewCommentsURL -} - -// GetReviewCommentURL returns the ReviewCommentURL field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetReviewCommentURL() string { - if p == nil || p.ReviewCommentURL == nil { - return "" - } - return *p.ReviewCommentURL -} - -// GetState returns the State field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetState() string { - if p == nil || p.State == nil { - return "" - } - return *p.State -} - -// GetStatusesURL returns the StatusesURL field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetStatusesURL() string { - if p == nil || p.StatusesURL == nil { - return "" - } - return *p.StatusesURL -} - -// GetTitle returns the Title field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetTitle() string { - if p == nil || p.Title == nil { - return "" - } - return *p.Title -} - -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetUpdatedAt() time.Time { - if p == nil || p.UpdatedAt == nil { - return time.Time{} - } - return *p.UpdatedAt -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetURL() string { - if p == nil || p.URL == nil { - return "" - } - return *p.URL -} - -// GetUser returns the User field. -func (p *PullRequest) GetUser() *User { - if p == nil { - return nil - } - return p.User -} - -// GetLabel returns the Label field if it's non-nil, zero value otherwise. -func (p *PullRequestBranch) GetLabel() string { - if p == nil || p.Label == nil { - return "" - } - return *p.Label -} - -// GetRef returns the Ref field if it's non-nil, zero value otherwise. -func (p *PullRequestBranch) GetRef() string { - if p == nil || p.Ref == nil { - return "" - } - return *p.Ref -} - -// GetRepo returns the Repo field. -func (p *PullRequestBranch) GetRepo() *Repository { - if p == nil { - return nil - } - return p.Repo -} - -// GetSHA returns the SHA field if it's non-nil, zero value otherwise. -func (p *PullRequestBranch) GetSHA() string { - if p == nil || p.SHA == nil { - return "" - } - return *p.SHA -} - -// GetUser returns the User field. -func (p *PullRequestBranch) GetUser() *User { - if p == nil { - return nil - } - return p.User -} - -// GetMessage returns the Message field if it's non-nil, zero value otherwise. -func (p *PullRequestBranchUpdateResponse) GetMessage() string { - if p == nil || p.Message == nil { - return "" - } - return *p.Message -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (p *PullRequestBranchUpdateResponse) GetURL() string { - if p == nil || p.URL == nil { - return "" - } - return *p.URL -} - -// GetAuthorAssociation returns the AuthorAssociation field if it's non-nil, zero value otherwise. -func (p *PullRequestComment) GetAuthorAssociation() string { - if p == nil || p.AuthorAssociation == nil { - return "" - } - return *p.AuthorAssociation -} - -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (p *PullRequestComment) GetBody() string { - if p == nil || p.Body == nil { - return "" - } - return *p.Body -} - -// GetCommitID returns the CommitID field if it's non-nil, zero value otherwise. -func (p *PullRequestComment) GetCommitID() string { - if p == nil || p.CommitID == nil { - return "" - } - return *p.CommitID -} - -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (p *PullRequestComment) GetCreatedAt() time.Time { - if p == nil || p.CreatedAt == nil { - return time.Time{} - } - return *p.CreatedAt -} - -// GetDiffHunk returns the DiffHunk field if it's non-nil, zero value otherwise. -func (p *PullRequestComment) GetDiffHunk() string { - if p == nil || p.DiffHunk == nil { - return "" - } - return *p.DiffHunk -} - -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (p *PullRequestComment) GetHTMLURL() string { - if p == nil || p.HTMLURL == nil { - return "" - } - return *p.HTMLURL -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (p *PullRequestComment) GetID() int64 { - if p == nil || p.ID == nil { - return 0 - } - return *p.ID -} - -// GetInReplyTo returns the InReplyTo field if it's non-nil, zero value otherwise. -func (p *PullRequestComment) GetInReplyTo() int64 { - if p == nil || p.InReplyTo == nil { - return 0 - } - return *p.InReplyTo -} - -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (p *PullRequestComment) GetNodeID() string { - if p == nil || p.NodeID == nil { - return "" - } - return *p.NodeID -} - -// GetOriginalCommitID returns the OriginalCommitID field if it's non-nil, zero value otherwise. -func (p *PullRequestComment) GetOriginalCommitID() string { - if p == nil || p.OriginalCommitID == nil { - return "" - } - return *p.OriginalCommitID -} - -// GetOriginalPosition returns the OriginalPosition field if it's non-nil, zero value otherwise. -func (p *PullRequestComment) GetOriginalPosition() int { - if p == nil || p.OriginalPosition == nil { - return 0 - } - return *p.OriginalPosition -} - -// GetPath returns the Path field if it's non-nil, zero value otherwise. -func (p *PullRequestComment) GetPath() string { - if p == nil || p.Path == nil { - return "" - } - return *p.Path -} - -// GetPosition returns the Position field if it's non-nil, zero value otherwise. -func (p *PullRequestComment) GetPosition() int { - if p == nil || p.Position == nil { - return 0 - } - return *p.Position -} - -// GetPullRequestReviewID returns the PullRequestReviewID field if it's non-nil, zero value otherwise. -func (p *PullRequestComment) GetPullRequestReviewID() int64 { - if p == nil || p.PullRequestReviewID == nil { - return 0 - } - return *p.PullRequestReviewID -} - -// GetPullRequestURL returns the PullRequestURL field if it's non-nil, zero value otherwise. -func (p *PullRequestComment) GetPullRequestURL() string { - if p == nil || p.PullRequestURL == nil { - return "" - } - return *p.PullRequestURL -} - -// GetReactions returns the Reactions field. -func (p *PullRequestComment) GetReactions() *Reactions { - if p == nil { - return nil - } - return p.Reactions -} - -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (p *PullRequestComment) GetUpdatedAt() time.Time { - if p == nil || p.UpdatedAt == nil { - return time.Time{} - } - return *p.UpdatedAt -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (p *PullRequestComment) GetURL() string { - if p == nil || p.URL == nil { - return "" - } - return *p.URL -} - -// GetUser returns the User field. -func (p *PullRequestComment) GetUser() *User { - if p == nil { - return nil - } - return p.User -} - -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (p *PullRequestEvent) GetAction() string { - if p == nil || p.Action == nil { - return "" - } - return *p.Action -} - -// GetAssignee returns the Assignee field. -func (p *PullRequestEvent) GetAssignee() *User { - if p == nil { - return nil - } - return p.Assignee -} - -// GetChanges returns the Changes field. -func (p *PullRequestEvent) GetChanges() *EditChange { - if p == nil { - return nil - } - return p.Changes -} - -// GetInstallation returns the Installation field. -func (p *PullRequestEvent) GetInstallation() *Installation { - if p == nil { - return nil - } - return p.Installation -} - -// GetLabel returns the Label field. -func (p *PullRequestEvent) GetLabel() *Label { - if p == nil { - return nil - } - return p.Label -} - -// GetNumber returns the Number field if it's non-nil, zero value otherwise. -func (p *PullRequestEvent) GetNumber() int { - if p == nil || p.Number == nil { - return 0 - } - return *p.Number -} - -// GetOrganization returns the Organization field. -func (p *PullRequestEvent) GetOrganization() *Organization { - if p == nil { - return nil - } - return p.Organization -} - -// GetPullRequest returns the PullRequest field. -func (p *PullRequestEvent) GetPullRequest() *PullRequest { - if p == nil { - return nil - } - return p.PullRequest -} - -// GetRepo returns the Repo field. -func (p *PullRequestEvent) GetRepo() *Repository { - if p == nil { - return nil - } - return p.Repo -} - -// GetRequestedReviewer returns the RequestedReviewer field. -func (p *PullRequestEvent) GetRequestedReviewer() *User { - if p == nil { - return nil - } - return p.RequestedReviewer -} - -// GetRequestedTeam returns the RequestedTeam field. -func (p *PullRequestEvent) GetRequestedTeam() *Team { - if p == nil { - return nil - } - return p.RequestedTeam -} - -// GetSender returns the Sender field. -func (p *PullRequestEvent) GetSender() *User { - if p == nil { - return nil - } - return p.Sender -} - -// GetDiffURL returns the DiffURL field if it's non-nil, zero value otherwise. -func (p *PullRequestLinks) GetDiffURL() string { - if p == nil || p.DiffURL == nil { - return "" - } - return *p.DiffURL -} - -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (p *PullRequestLinks) GetHTMLURL() string { - if p == nil || p.HTMLURL == nil { - return "" - } - return *p.HTMLURL -} - -// GetPatchURL returns the PatchURL field if it's non-nil, zero value otherwise. -func (p *PullRequestLinks) GetPatchURL() string { - if p == nil || p.PatchURL == nil { - return "" - } - return *p.PatchURL -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (p *PullRequestLinks) GetURL() string { - if p == nil || p.URL == nil { - return "" - } - return *p.URL -} - -// GetMerged returns the Merged field if it's non-nil, zero value otherwise. -func (p *PullRequestMergeResult) GetMerged() bool { - if p == nil || p.Merged == nil { - return false - } - return *p.Merged -} - -// GetMessage returns the Message field if it's non-nil, zero value otherwise. -func (p *PullRequestMergeResult) GetMessage() string { - if p == nil || p.Message == nil { - return "" - } - return *p.Message -} - -// GetSHA returns the SHA field if it's non-nil, zero value otherwise. -func (p *PullRequestMergeResult) GetSHA() string { - if p == nil || p.SHA == nil { - return "" - } - return *p.SHA -} - -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (p *PullRequestReview) GetBody() string { - if p == nil || p.Body == nil { - return "" - } - return *p.Body -} - -// GetCommitID returns the CommitID field if it's non-nil, zero value otherwise. -func (p *PullRequestReview) GetCommitID() string { - if p == nil || p.CommitID == nil { - return "" - } - return *p.CommitID -} - -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (p *PullRequestReview) GetHTMLURL() string { - if p == nil || p.HTMLURL == nil { - return "" - } - return *p.HTMLURL -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (p *PullRequestReview) GetID() int64 { - if p == nil || p.ID == nil { - return 0 - } - return *p.ID -} - -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (p *PullRequestReview) GetNodeID() string { - if p == nil || p.NodeID == nil { - return "" - } - return *p.NodeID -} - -// GetPullRequestURL returns the PullRequestURL field if it's non-nil, zero value otherwise. -func (p *PullRequestReview) GetPullRequestURL() string { - if p == nil || p.PullRequestURL == nil { - return "" - } - return *p.PullRequestURL -} - -// GetState returns the State field if it's non-nil, zero value otherwise. -func (p *PullRequestReview) GetState() string { - if p == nil || p.State == nil { - return "" - } - return *p.State -} - -// GetSubmittedAt returns the SubmittedAt field if it's non-nil, zero value otherwise. -func (p *PullRequestReview) GetSubmittedAt() time.Time { - if p == nil || p.SubmittedAt == nil { - return time.Time{} - } - return *p.SubmittedAt -} - -// GetUser returns the User field. -func (p *PullRequestReview) GetUser() *User { - if p == nil { - return nil - } - return p.User -} - -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (p *PullRequestReviewCommentEvent) GetAction() string { - if p == nil || p.Action == nil { - return "" - } - return *p.Action -} - -// GetChanges returns the Changes field. -func (p *PullRequestReviewCommentEvent) GetChanges() *EditChange { - if p == nil { - return nil - } - return p.Changes -} - -// GetComment returns the Comment field. -func (p *PullRequestReviewCommentEvent) GetComment() *PullRequestComment { - if p == nil { - return nil - } - return p.Comment -} - -// GetInstallation returns the Installation field. -func (p *PullRequestReviewCommentEvent) GetInstallation() *Installation { - if p == nil { - return nil - } - return p.Installation -} - -// GetPullRequest returns the PullRequest field. -func (p *PullRequestReviewCommentEvent) GetPullRequest() *PullRequest { - if p == nil { - return nil - } - return p.PullRequest -} - -// GetRepo returns the Repo field. -func (p *PullRequestReviewCommentEvent) GetRepo() *Repository { - if p == nil { - return nil - } - return p.Repo -} - -// GetSender returns the Sender field. -func (p *PullRequestReviewCommentEvent) GetSender() *User { - if p == nil { - return nil - } - return p.Sender -} - -// GetMessage returns the Message field if it's non-nil, zero value otherwise. -func (p *PullRequestReviewDismissalRequest) GetMessage() string { - if p == nil || p.Message == nil { - return "" - } - return *p.Message -} - -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (p *PullRequestReviewEvent) GetAction() string { - if p == nil || p.Action == nil { - return "" - } - return *p.Action -} - -// GetInstallation returns the Installation field. -func (p *PullRequestReviewEvent) GetInstallation() *Installation { - if p == nil { - return nil - } - return p.Installation -} - -// GetOrganization returns the Organization field. -func (p *PullRequestReviewEvent) GetOrganization() *Organization { - if p == nil { - return nil - } - return p.Organization -} - -// GetPullRequest returns the PullRequest field. -func (p *PullRequestReviewEvent) GetPullRequest() *PullRequest { - if p == nil { - return nil - } - return p.PullRequest -} - -// GetRepo returns the Repo field. -func (p *PullRequestReviewEvent) GetRepo() *Repository { - if p == nil { - return nil - } - return p.Repo -} - -// GetReview returns the Review field. -func (p *PullRequestReviewEvent) GetReview() *PullRequestReview { - if p == nil { - return nil - } - return p.Review -} - -// GetSender returns the Sender field. -func (p *PullRequestReviewEvent) GetSender() *User { - if p == nil { - return nil - } - return p.Sender -} - -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (p *PullRequestReviewRequest) GetBody() string { - if p == nil || p.Body == nil { - return "" - } - return *p.Body -} - -// GetCommitID returns the CommitID field if it's non-nil, zero value otherwise. -func (p *PullRequestReviewRequest) GetCommitID() string { - if p == nil || p.CommitID == nil { - return "" - } - return *p.CommitID -} - -// GetEvent returns the Event field if it's non-nil, zero value otherwise. -func (p *PullRequestReviewRequest) GetEvent() string { - if p == nil || p.Event == nil { - return "" - } - return *p.Event -} - -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (p *PullRequestReviewRequest) GetNodeID() string { - if p == nil || p.NodeID == nil { - return "" - } - return *p.NodeID -} - -// GetDismissalRestrictionsRequest returns the DismissalRestrictionsRequest field. -func (p *PullRequestReviewsEnforcementRequest) GetDismissalRestrictionsRequest() *DismissalRestrictionsRequest { - if p == nil { - return nil - } - return p.DismissalRestrictionsRequest -} - -// GetDismissalRestrictionsRequest returns the DismissalRestrictionsRequest field. -func (p *PullRequestReviewsEnforcementUpdate) GetDismissalRestrictionsRequest() *DismissalRestrictionsRequest { - if p == nil { - return nil - } - return p.DismissalRestrictionsRequest -} - -// GetDismissStaleReviews returns the DismissStaleReviews field if it's non-nil, zero value otherwise. -func (p *PullRequestReviewsEnforcementUpdate) GetDismissStaleReviews() bool { - if p == nil || p.DismissStaleReviews == nil { - return false - } - return *p.DismissStaleReviews -} - -// GetMergablePulls returns the MergablePulls field if it's non-nil, zero value otherwise. -func (p *PullStats) GetMergablePulls() int { - if p == nil || p.MergablePulls == nil { - return 0 - } - return *p.MergablePulls -} - -// GetMergedPulls returns the MergedPulls field if it's non-nil, zero value otherwise. -func (p *PullStats) GetMergedPulls() int { - if p == nil || p.MergedPulls == nil { - return 0 - } - return *p.MergedPulls -} - -// GetTotalPulls returns the TotalPulls field if it's non-nil, zero value otherwise. -func (p *PullStats) GetTotalPulls() int { - if p == nil || p.TotalPulls == nil { - return 0 - } - return *p.TotalPulls -} - -// GetUnmergablePulls returns the UnmergablePulls field if it's non-nil, zero value otherwise. -func (p *PullStats) GetUnmergablePulls() int { - if p == nil || p.UnmergablePulls == nil { - return 0 - } - return *p.UnmergablePulls -} - -// GetCommits returns the Commits field if it's non-nil, zero value otherwise. -func (p *PunchCard) GetCommits() int { - if p == nil || p.Commits == nil { - return 0 - } - return *p.Commits -} - -// GetDay returns the Day field if it's non-nil, zero value otherwise. -func (p *PunchCard) GetDay() int { - if p == nil || p.Day == nil { - return 0 - } - return *p.Day -} - -// GetHour returns the Hour field if it's non-nil, zero value otherwise. -func (p *PunchCard) GetHour() int { - if p == nil || p.Hour == nil { - return 0 - } - return *p.Hour -} - -// GetAfter returns the After field if it's non-nil, zero value otherwise. -func (p *PushEvent) GetAfter() string { - if p == nil || p.After == nil { - return "" - } - return *p.After -} - -// GetBaseRef returns the BaseRef field if it's non-nil, zero value otherwise. -func (p *PushEvent) GetBaseRef() string { - if p == nil || p.BaseRef == nil { - return "" - } - return *p.BaseRef -} - -// GetBefore returns the Before field if it's non-nil, zero value otherwise. -func (p *PushEvent) GetBefore() string { - if p == nil || p.Before == nil { - return "" - } - return *p.Before -} - -// GetCompare returns the Compare field if it's non-nil, zero value otherwise. -func (p *PushEvent) GetCompare() string { - if p == nil || p.Compare == nil { - return "" - } - return *p.Compare -} - -// GetCreated returns the Created field if it's non-nil, zero value otherwise. -func (p *PushEvent) GetCreated() bool { - if p == nil || p.Created == nil { - return false - } - return *p.Created -} - -// GetDeleted returns the Deleted field if it's non-nil, zero value otherwise. -func (p *PushEvent) GetDeleted() bool { - if p == nil || p.Deleted == nil { - return false - } - return *p.Deleted -} - -// GetDistinctSize returns the DistinctSize field if it's non-nil, zero value otherwise. -func (p *PushEvent) GetDistinctSize() int { - if p == nil || p.DistinctSize == nil { - return 0 - } - return *p.DistinctSize -} - -// GetForced returns the Forced field if it's non-nil, zero value otherwise. -func (p *PushEvent) GetForced() bool { - if p == nil || p.Forced == nil { - return false - } - return *p.Forced -} - -// GetHead returns the Head field if it's non-nil, zero value otherwise. -func (p *PushEvent) GetHead() string { - if p == nil || p.Head == nil { - return "" - } - return *p.Head -} - -// GetHeadCommit returns the HeadCommit field. -func (p *PushEvent) GetHeadCommit() *PushEventCommit { - if p == nil { - return nil - } - return p.HeadCommit -} - -// GetInstallation returns the Installation field. -func (p *PushEvent) GetInstallation() *Installation { - if p == nil { - return nil - } - return p.Installation -} - -// GetPusher returns the Pusher field. -func (p *PushEvent) GetPusher() *User { - if p == nil { - return nil - } - return p.Pusher -} - -// GetPushID returns the PushID field if it's non-nil, zero value otherwise. -func (p *PushEvent) GetPushID() int64 { - if p == nil || p.PushID == nil { - return 0 - } - return *p.PushID -} - -// GetRef returns the Ref field if it's non-nil, zero value otherwise. -func (p *PushEvent) GetRef() string { - if p == nil || p.Ref == nil { - return "" - } - return *p.Ref -} - -// GetRepo returns the Repo field. -func (p *PushEvent) GetRepo() *PushEventRepository { - if p == nil { - return nil - } - return p.Repo -} - -// GetSender returns the Sender field. -func (p *PushEvent) GetSender() *User { - if p == nil { - return nil - } - return p.Sender -} - -// GetSize returns the Size field if it's non-nil, zero value otherwise. -func (p *PushEvent) GetSize() int { - if p == nil || p.Size == nil { - return 0 - } - return *p.Size -} - -// GetAuthor returns the Author field. -func (p *PushEventCommit) GetAuthor() *CommitAuthor { - if p == nil { - return nil - } - return p.Author -} - -// GetCommitter returns the Committer field. -func (p *PushEventCommit) GetCommitter() *CommitAuthor { - if p == nil { - return nil - } - return p.Committer -} - -// GetDistinct returns the Distinct field if it's non-nil, zero value otherwise. -func (p *PushEventCommit) GetDistinct() bool { - if p == nil || p.Distinct == nil { - return false - } - return *p.Distinct -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (p *PushEventCommit) GetID() string { - if p == nil || p.ID == nil { - return "" - } - return *p.ID -} - -// GetMessage returns the Message field if it's non-nil, zero value otherwise. -func (p *PushEventCommit) GetMessage() string { - if p == nil || p.Message == nil { - return "" - } - return *p.Message -} - -// GetSHA returns the SHA field if it's non-nil, zero value otherwise. -func (p *PushEventCommit) GetSHA() string { - if p == nil || p.SHA == nil { - return "" - } - return *p.SHA -} - -// GetTimestamp returns the Timestamp field if it's non-nil, zero value otherwise. -func (p *PushEventCommit) GetTimestamp() Timestamp { - if p == nil || p.Timestamp == nil { - return Timestamp{} - } - return *p.Timestamp -} - -// GetTreeID returns the TreeID field if it's non-nil, zero value otherwise. -func (p *PushEventCommit) GetTreeID() string { - if p == nil || p.TreeID == nil { - return "" - } - return *p.TreeID -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (p *PushEventCommit) GetURL() string { - if p == nil || p.URL == nil { - return "" - } - return *p.URL -} - -// GetEmail returns the Email field if it's non-nil, zero value otherwise. -func (p *PushEventRepoOwner) GetEmail() string { - if p == nil || p.Email == nil { - return "" - } - return *p.Email -} - -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (p *PushEventRepoOwner) GetName() string { - if p == nil || p.Name == nil { - return "" - } - return *p.Name -} - -// GetArchiveURL returns the ArchiveURL field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetArchiveURL() string { - if p == nil || p.ArchiveURL == nil { - return "" - } - return *p.ArchiveURL -} - -// GetCloneURL returns the CloneURL field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetCloneURL() string { - if p == nil || p.CloneURL == nil { - return "" - } - return *p.CloneURL -} - -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetCreatedAt() Timestamp { - if p == nil || p.CreatedAt == nil { - return Timestamp{} - } - return *p.CreatedAt -} - -// GetDefaultBranch returns the DefaultBranch field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetDefaultBranch() string { - if p == nil || p.DefaultBranch == nil { - return "" - } - return *p.DefaultBranch -} - -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetDescription() string { - if p == nil || p.Description == nil { - return "" - } - return *p.Description -} - -// GetFork returns the Fork field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetFork() bool { - if p == nil || p.Fork == nil { - return false - } - return *p.Fork -} - -// GetForksCount returns the ForksCount field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetForksCount() int { - if p == nil || p.ForksCount == nil { - return 0 - } - return *p.ForksCount -} - -// GetFullName returns the FullName field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetFullName() string { - if p == nil || p.FullName == nil { - return "" - } - return *p.FullName -} - -// GetGitURL returns the GitURL field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetGitURL() string { - if p == nil || p.GitURL == nil { - return "" - } - return *p.GitURL -} - -// GetHasDownloads returns the HasDownloads field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetHasDownloads() bool { - if p == nil || p.HasDownloads == nil { - return false - } - return *p.HasDownloads -} - -// GetHasIssues returns the HasIssues field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetHasIssues() bool { - if p == nil || p.HasIssues == nil { - return false - } - return *p.HasIssues -} - -// GetHasPages returns the HasPages field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetHasPages() bool { - if p == nil || p.HasPages == nil { - return false - } - return *p.HasPages -} - -// GetHasWiki returns the HasWiki field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetHasWiki() bool { - if p == nil || p.HasWiki == nil { - return false - } - return *p.HasWiki -} - -// GetHomepage returns the Homepage field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetHomepage() string { - if p == nil || p.Homepage == nil { - return "" - } - return *p.Homepage -} - -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetHTMLURL() string { - if p == nil || p.HTMLURL == nil { - return "" - } - return *p.HTMLURL -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetID() int64 { - if p == nil || p.ID == nil { - return 0 - } - return *p.ID -} - -// GetLanguage returns the Language field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetLanguage() string { - if p == nil || p.Language == nil { - return "" - } - return *p.Language -} - -// GetMasterBranch returns the MasterBranch field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetMasterBranch() string { - if p == nil || p.MasterBranch == nil { - return "" - } - return *p.MasterBranch -} - -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetName() string { - if p == nil || p.Name == nil { - return "" - } - return *p.Name -} - -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetNodeID() string { - if p == nil || p.NodeID == nil { - return "" - } - return *p.NodeID -} - -// GetOpenIssuesCount returns the OpenIssuesCount field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetOpenIssuesCount() int { - if p == nil || p.OpenIssuesCount == nil { - return 0 - } - return *p.OpenIssuesCount -} - -// GetOrganization returns the Organization field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetOrganization() string { - if p == nil || p.Organization == nil { - return "" - } - return *p.Organization -} - -// GetOwner returns the Owner field. -func (p *PushEventRepository) GetOwner() *User { - if p == nil { - return nil - } - return p.Owner -} - -// GetPrivate returns the Private field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetPrivate() bool { - if p == nil || p.Private == nil { - return false - } - return *p.Private -} - -// GetPullsURL returns the PullsURL field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetPullsURL() string { - if p == nil || p.PullsURL == nil { - return "" - } - return *p.PullsURL -} - -// GetPushedAt returns the PushedAt field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetPushedAt() Timestamp { - if p == nil || p.PushedAt == nil { - return Timestamp{} - } - return *p.PushedAt -} - -// GetSize returns the Size field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetSize() int { - if p == nil || p.Size == nil { - return 0 - } - return *p.Size -} - -// GetSSHURL returns the SSHURL field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetSSHURL() string { - if p == nil || p.SSHURL == nil { - return "" - } - return *p.SSHURL -} - -// GetStargazersCount returns the StargazersCount field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetStargazersCount() int { - if p == nil || p.StargazersCount == nil { - return 0 - } - return *p.StargazersCount -} - -// GetStatusesURL returns the StatusesURL field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetStatusesURL() string { - if p == nil || p.StatusesURL == nil { - return "" - } - return *p.StatusesURL -} - -// GetSVNURL returns the SVNURL field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetSVNURL() string { - if p == nil || p.SVNURL == nil { - return "" - } - return *p.SVNURL -} - -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetUpdatedAt() Timestamp { - if p == nil || p.UpdatedAt == nil { - return Timestamp{} - } - return *p.UpdatedAt -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetURL() string { - if p == nil || p.URL == nil { - return "" - } - return *p.URL -} - -// GetWatchersCount returns the WatchersCount field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetWatchersCount() int { - if p == nil || p.WatchersCount == nil { - return 0 - } - return *p.WatchersCount -} - -// GetCore returns the Core field. -func (r *RateLimits) GetCore() *Rate { - if r == nil { - return nil - } - return r.Core -} - -// GetSearch returns the Search field. -func (r *RateLimits) GetSearch() *Rate { - if r == nil { - return nil - } - return r.Search -} - -// GetContent returns the Content field if it's non-nil, zero value otherwise. -func (r *Reaction) GetContent() string { - if r == nil || r.Content == nil { - return "" - } - return *r.Content -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (r *Reaction) GetID() int64 { - if r == nil || r.ID == nil { - return 0 - } - return *r.ID -} - -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (r *Reaction) GetNodeID() string { - if r == nil || r.NodeID == nil { - return "" - } - return *r.NodeID -} - -// GetUser returns the User field. -func (r *Reaction) GetUser() *User { - if r == nil { - return nil - } - return r.User -} - -// GetConfused returns the Confused field if it's non-nil, zero value otherwise. -func (r *Reactions) GetConfused() int { - if r == nil || r.Confused == nil { - return 0 - } - return *r.Confused -} - -// GetHeart returns the Heart field if it's non-nil, zero value otherwise. -func (r *Reactions) GetHeart() int { - if r == nil || r.Heart == nil { - return 0 - } - return *r.Heart -} - -// GetHooray returns the Hooray field if it's non-nil, zero value otherwise. -func (r *Reactions) GetHooray() int { - if r == nil || r.Hooray == nil { - return 0 - } - return *r.Hooray -} - -// GetLaugh returns the Laugh field if it's non-nil, zero value otherwise. -func (r *Reactions) GetLaugh() int { - if r == nil || r.Laugh == nil { - return 0 - } - return *r.Laugh -} - -// GetMinusOne returns the MinusOne field if it's non-nil, zero value otherwise. -func (r *Reactions) GetMinusOne() int { - if r == nil || r.MinusOne == nil { - return 0 - } - return *r.MinusOne -} - -// GetPlusOne returns the PlusOne field if it's non-nil, zero value otherwise. -func (r *Reactions) GetPlusOne() int { - if r == nil || r.PlusOne == nil { - return 0 - } - return *r.PlusOne -} - -// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. -func (r *Reactions) GetTotalCount() int { - if r == nil || r.TotalCount == nil { - return 0 - } - return *r.TotalCount -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (r *Reactions) GetURL() string { - if r == nil || r.URL == nil { - return "" - } - return *r.URL -} - -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (r *Reference) GetNodeID() string { - if r == nil || r.NodeID == nil { - return "" - } - return *r.NodeID -} - -// GetObject returns the Object field. -func (r *Reference) GetObject() *GitObject { - if r == nil { - return nil - } - return r.Object -} - -// GetRef returns the Ref field if it's non-nil, zero value otherwise. -func (r *Reference) GetRef() string { - if r == nil || r.Ref == nil { - return "" - } - return *r.Ref -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (r *Reference) GetURL() string { - if r == nil || r.URL == nil { - return "" - } - return *r.URL -} - -// GetBrowserDownloadURL returns the BrowserDownloadURL field if it's non-nil, zero value otherwise. -func (r *ReleaseAsset) GetBrowserDownloadURL() string { - if r == nil || r.BrowserDownloadURL == nil { - return "" - } - return *r.BrowserDownloadURL -} - -// GetContentType returns the ContentType field if it's non-nil, zero value otherwise. -func (r *ReleaseAsset) GetContentType() string { - if r == nil || r.ContentType == nil { - return "" - } - return *r.ContentType -} - -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (r *ReleaseAsset) GetCreatedAt() Timestamp { - if r == nil || r.CreatedAt == nil { - return Timestamp{} - } - return *r.CreatedAt -} - -// GetDownloadCount returns the DownloadCount field if it's non-nil, zero value otherwise. -func (r *ReleaseAsset) GetDownloadCount() int { - if r == nil || r.DownloadCount == nil { - return 0 - } - return *r.DownloadCount -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (r *ReleaseAsset) GetID() int64 { - if r == nil || r.ID == nil { - return 0 - } - return *r.ID -} - -// GetLabel returns the Label field if it's non-nil, zero value otherwise. -func (r *ReleaseAsset) GetLabel() string { - if r == nil || r.Label == nil { - return "" - } - return *r.Label -} - -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (r *ReleaseAsset) GetName() string { - if r == nil || r.Name == nil { - return "" - } - return *r.Name -} - -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (r *ReleaseAsset) GetNodeID() string { - if r == nil || r.NodeID == nil { - return "" - } - return *r.NodeID -} - -// GetSize returns the Size field if it's non-nil, zero value otherwise. -func (r *ReleaseAsset) GetSize() int { - if r == nil || r.Size == nil { - return 0 - } - return *r.Size -} - -// GetState returns the State field if it's non-nil, zero value otherwise. -func (r *ReleaseAsset) GetState() string { - if r == nil || r.State == nil { - return "" - } - return *r.State -} - -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (r *ReleaseAsset) GetUpdatedAt() Timestamp { - if r == nil || r.UpdatedAt == nil { - return Timestamp{} - } - return *r.UpdatedAt -} - -// GetUploader returns the Uploader field. -func (r *ReleaseAsset) GetUploader() *User { - if r == nil { - return nil - } - return r.Uploader -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (r *ReleaseAsset) GetURL() string { - if r == nil || r.URL == nil { - return "" - } - return *r.URL -} - -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (r *ReleaseEvent) GetAction() string { - if r == nil || r.Action == nil { - return "" - } - return *r.Action -} - -// GetInstallation returns the Installation field. -func (r *ReleaseEvent) GetInstallation() *Installation { - if r == nil { - return nil - } - return r.Installation -} - -// GetRelease returns the Release field. -func (r *ReleaseEvent) GetRelease() *RepositoryRelease { - if r == nil { - return nil - } - return r.Release -} - -// GetRepo returns the Repo field. -func (r *ReleaseEvent) GetRepo() *Repository { - if r == nil { - return nil - } - return r.Repo -} - -// GetSender returns the Sender field. -func (r *ReleaseEvent) GetSender() *User { - if r == nil { - return nil - } - return r.Sender -} - -// GetFrom returns the From field if it's non-nil, zero value otherwise. -func (r *Rename) GetFrom() string { - if r == nil || r.From == nil { - return "" - } - return *r.From -} - -// GetTo returns the To field if it's non-nil, zero value otherwise. -func (r *Rename) GetTo() string { - if r == nil || r.To == nil { - return "" - } - return *r.To -} - -// GetIncompleteResults returns the IncompleteResults field if it's non-nil, zero value otherwise. -func (r *RepositoriesSearchResult) GetIncompleteResults() bool { - if r == nil || r.IncompleteResults == nil { - return false - } - return *r.IncompleteResults -} - -// GetTotal returns the Total field if it's non-nil, zero value otherwise. -func (r *RepositoriesSearchResult) GetTotal() int { - if r == nil || r.Total == nil { - return 0 - } - return *r.Total -} - -// GetAllowMergeCommit returns the AllowMergeCommit field if it's non-nil, zero value otherwise. -func (r *Repository) GetAllowMergeCommit() bool { - if r == nil || r.AllowMergeCommit == nil { - return false - } - return *r.AllowMergeCommit -} - -// GetAllowRebaseMerge returns the AllowRebaseMerge field if it's non-nil, zero value otherwise. -func (r *Repository) GetAllowRebaseMerge() bool { - if r == nil || r.AllowRebaseMerge == nil { - return false - } - return *r.AllowRebaseMerge -} - -// GetAllowSquashMerge returns the AllowSquashMerge field if it's non-nil, zero value otherwise. -func (r *Repository) GetAllowSquashMerge() bool { - if r == nil || r.AllowSquashMerge == nil { - return false - } - return *r.AllowSquashMerge -} - -// GetArchived returns the Archived field if it's non-nil, zero value otherwise. -func (r *Repository) GetArchived() bool { - if r == nil || r.Archived == nil { - return false - } - return *r.Archived -} - -// GetArchiveURL returns the ArchiveURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetArchiveURL() string { - if r == nil || r.ArchiveURL == nil { - return "" - } - return *r.ArchiveURL -} - -// GetAssigneesURL returns the AssigneesURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetAssigneesURL() string { - if r == nil || r.AssigneesURL == nil { - return "" - } - return *r.AssigneesURL -} - -// GetAutoInit returns the AutoInit field if it's non-nil, zero value otherwise. -func (r *Repository) GetAutoInit() bool { - if r == nil || r.AutoInit == nil { - return false - } - return *r.AutoInit -} - -// GetBlobsURL returns the BlobsURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetBlobsURL() string { - if r == nil || r.BlobsURL == nil { - return "" - } - return *r.BlobsURL -} - -// GetBranchesURL returns the BranchesURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetBranchesURL() string { - if r == nil || r.BranchesURL == nil { - return "" - } - return *r.BranchesURL -} - -// GetCloneURL returns the CloneURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetCloneURL() string { - if r == nil || r.CloneURL == nil { - return "" - } - return *r.CloneURL -} - -// GetCodeOfConduct returns the CodeOfConduct field. -func (r *Repository) GetCodeOfConduct() *CodeOfConduct { - if r == nil { - return nil - } - return r.CodeOfConduct -} - -// GetCollaboratorsURL returns the CollaboratorsURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetCollaboratorsURL() string { - if r == nil || r.CollaboratorsURL == nil { - return "" - } - return *r.CollaboratorsURL -} - -// GetCommentsURL returns the CommentsURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetCommentsURL() string { - if r == nil || r.CommentsURL == nil { - return "" - } - return *r.CommentsURL -} - -// GetCommitsURL returns the CommitsURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetCommitsURL() string { - if r == nil || r.CommitsURL == nil { - return "" - } - return *r.CommitsURL -} - -// GetCompareURL returns the CompareURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetCompareURL() string { - if r == nil || r.CompareURL == nil { - return "" - } - return *r.CompareURL -} - -// GetContentsURL returns the ContentsURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetContentsURL() string { - if r == nil || r.ContentsURL == nil { - return "" - } - return *r.ContentsURL -} - -// GetContributorsURL returns the ContributorsURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetContributorsURL() string { - if r == nil || r.ContributorsURL == nil { - return "" - } - return *r.ContributorsURL -} - -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (r *Repository) GetCreatedAt() Timestamp { - if r == nil || r.CreatedAt == nil { - return Timestamp{} - } - return *r.CreatedAt -} - -// GetDefaultBranch returns the DefaultBranch field if it's non-nil, zero value otherwise. -func (r *Repository) GetDefaultBranch() string { - if r == nil || r.DefaultBranch == nil { - return "" - } - return *r.DefaultBranch -} - -// GetDeploymentsURL returns the DeploymentsURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetDeploymentsURL() string { - if r == nil || r.DeploymentsURL == nil { - return "" - } - return *r.DeploymentsURL -} - -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (r *Repository) GetDescription() string { - if r == nil || r.Description == nil { - return "" - } - return *r.Description -} - -// GetDisabled returns the Disabled field if it's non-nil, zero value otherwise. -func (r *Repository) GetDisabled() bool { - if r == nil || r.Disabled == nil { - return false - } - return *r.Disabled -} - -// GetDownloadsURL returns the DownloadsURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetDownloadsURL() string { - if r == nil || r.DownloadsURL == nil { - return "" - } - return *r.DownloadsURL -} - -// GetEventsURL returns the EventsURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetEventsURL() string { - if r == nil || r.EventsURL == nil { - return "" - } - return *r.EventsURL -} - -// GetFork returns the Fork field if it's non-nil, zero value otherwise. -func (r *Repository) GetFork() bool { - if r == nil || r.Fork == nil { - return false - } - return *r.Fork -} - -// GetForksCount returns the ForksCount field if it's non-nil, zero value otherwise. -func (r *Repository) GetForksCount() int { - if r == nil || r.ForksCount == nil { - return 0 - } - return *r.ForksCount -} - -// GetForksURL returns the ForksURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetForksURL() string { - if r == nil || r.ForksURL == nil { - return "" - } - return *r.ForksURL -} - -// GetFullName returns the FullName field if it's non-nil, zero value otherwise. -func (r *Repository) GetFullName() string { - if r == nil || r.FullName == nil { - return "" - } - return *r.FullName -} - -// GetGitCommitsURL returns the GitCommitsURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetGitCommitsURL() string { - if r == nil || r.GitCommitsURL == nil { - return "" - } - return *r.GitCommitsURL -} - -// GetGitignoreTemplate returns the GitignoreTemplate field if it's non-nil, zero value otherwise. -func (r *Repository) GetGitignoreTemplate() string { - if r == nil || r.GitignoreTemplate == nil { - return "" - } - return *r.GitignoreTemplate -} - -// GetGitRefsURL returns the GitRefsURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetGitRefsURL() string { - if r == nil || r.GitRefsURL == nil { - return "" - } - return *r.GitRefsURL -} - -// GetGitTagsURL returns the GitTagsURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetGitTagsURL() string { - if r == nil || r.GitTagsURL == nil { - return "" - } - return *r.GitTagsURL -} - -// GetGitURL returns the GitURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetGitURL() string { - if r == nil || r.GitURL == nil { - return "" - } - return *r.GitURL -} - -// GetHasDownloads returns the HasDownloads field if it's non-nil, zero value otherwise. -func (r *Repository) GetHasDownloads() bool { - if r == nil || r.HasDownloads == nil { - return false - } - return *r.HasDownloads -} - -// GetHasIssues returns the HasIssues field if it's non-nil, zero value otherwise. -func (r *Repository) GetHasIssues() bool { - if r == nil || r.HasIssues == nil { - return false - } - return *r.HasIssues -} - -// GetHasPages returns the HasPages field if it's non-nil, zero value otherwise. -func (r *Repository) GetHasPages() bool { - if r == nil || r.HasPages == nil { - return false - } - return *r.HasPages -} - -// GetHasProjects returns the HasProjects field if it's non-nil, zero value otherwise. -func (r *Repository) GetHasProjects() bool { - if r == nil || r.HasProjects == nil { - return false - } - return *r.HasProjects -} - -// GetHasWiki returns the HasWiki field if it's non-nil, zero value otherwise. -func (r *Repository) GetHasWiki() bool { - if r == nil || r.HasWiki == nil { - return false - } - return *r.HasWiki -} - -// GetHomepage returns the Homepage field if it's non-nil, zero value otherwise. -func (r *Repository) GetHomepage() string { - if r == nil || r.Homepage == nil { - return "" - } - return *r.Homepage -} - -// GetHooksURL returns the HooksURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetHooksURL() string { - if r == nil || r.HooksURL == nil { - return "" - } - return *r.HooksURL -} - -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetHTMLURL() string { - if r == nil || r.HTMLURL == nil { - return "" - } - return *r.HTMLURL -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (r *Repository) GetID() int64 { - if r == nil || r.ID == nil { - return 0 - } - return *r.ID -} - -// GetIssueCommentURL returns the IssueCommentURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetIssueCommentURL() string { - if r == nil || r.IssueCommentURL == nil { - return "" - } - return *r.IssueCommentURL -} - -// GetIssueEventsURL returns the IssueEventsURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetIssueEventsURL() string { - if r == nil || r.IssueEventsURL == nil { - return "" - } - return *r.IssueEventsURL -} - -// GetIssuesURL returns the IssuesURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetIssuesURL() string { - if r == nil || r.IssuesURL == nil { - return "" - } - return *r.IssuesURL -} - -// GetIsTemplate returns the IsTemplate field if it's non-nil, zero value otherwise. -func (r *Repository) GetIsTemplate() bool { - if r == nil || r.IsTemplate == nil { - return false - } - return *r.IsTemplate -} - -// GetKeysURL returns the KeysURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetKeysURL() string { - if r == nil || r.KeysURL == nil { - return "" - } - return *r.KeysURL -} - -// GetLabelsURL returns the LabelsURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetLabelsURL() string { - if r == nil || r.LabelsURL == nil { - return "" - } - return *r.LabelsURL -} - -// GetLanguage returns the Language field if it's non-nil, zero value otherwise. -func (r *Repository) GetLanguage() string { - if r == nil || r.Language == nil { - return "" - } - return *r.Language -} - -// GetLanguagesURL returns the LanguagesURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetLanguagesURL() string { - if r == nil || r.LanguagesURL == nil { - return "" - } - return *r.LanguagesURL -} - -// GetLicense returns the License field. -func (r *Repository) GetLicense() *License { - if r == nil { - return nil - } - return r.License -} - -// GetLicenseTemplate returns the LicenseTemplate field if it's non-nil, zero value otherwise. -func (r *Repository) GetLicenseTemplate() string { - if r == nil || r.LicenseTemplate == nil { - return "" - } - return *r.LicenseTemplate -} - -// GetMasterBranch returns the MasterBranch field if it's non-nil, zero value otherwise. -func (r *Repository) GetMasterBranch() string { - if r == nil || r.MasterBranch == nil { - return "" - } - return *r.MasterBranch -} - -// GetMergesURL returns the MergesURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetMergesURL() string { - if r == nil || r.MergesURL == nil { - return "" - } - return *r.MergesURL -} - -// GetMilestonesURL returns the MilestonesURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetMilestonesURL() string { - if r == nil || r.MilestonesURL == nil { - return "" - } - return *r.MilestonesURL -} - -// GetMirrorURL returns the MirrorURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetMirrorURL() string { - if r == nil || r.MirrorURL == nil { - return "" - } - return *r.MirrorURL -} - -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (r *Repository) GetName() string { - if r == nil || r.Name == nil { - return "" - } - return *r.Name -} - -// GetNetworkCount returns the NetworkCount field if it's non-nil, zero value otherwise. -func (r *Repository) GetNetworkCount() int { - if r == nil || r.NetworkCount == nil { - return 0 - } - return *r.NetworkCount -} - -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (r *Repository) GetNodeID() string { - if r == nil || r.NodeID == nil { - return "" - } - return *r.NodeID -} - -// GetNotificationsURL returns the NotificationsURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetNotificationsURL() string { - if r == nil || r.NotificationsURL == nil { - return "" - } - return *r.NotificationsURL -} - -// GetOpenIssuesCount returns the OpenIssuesCount field if it's non-nil, zero value otherwise. -func (r *Repository) GetOpenIssuesCount() int { - if r == nil || r.OpenIssuesCount == nil { - return 0 - } - return *r.OpenIssuesCount -} - -// GetOrganization returns the Organization field. -func (r *Repository) GetOrganization() *Organization { - if r == nil { - return nil - } - return r.Organization -} - -// GetOwner returns the Owner field. -func (r *Repository) GetOwner() *User { - if r == nil { - return nil - } - return r.Owner -} - -// GetParent returns the Parent field. -func (r *Repository) GetParent() *Repository { - if r == nil { - return nil - } - return r.Parent -} - -// GetPermissions returns the Permissions field if it's non-nil, zero value otherwise. -func (r *Repository) GetPermissions() map[string]bool { - if r == nil || r.Permissions == nil { - return map[string]bool{} - } - return *r.Permissions -} - -// GetPrivate returns the Private field if it's non-nil, zero value otherwise. -func (r *Repository) GetPrivate() bool { - if r == nil || r.Private == nil { - return false - } - return *r.Private -} - -// GetPullsURL returns the PullsURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetPullsURL() string { - if r == nil || r.PullsURL == nil { - return "" - } - return *r.PullsURL -} - -// GetPushedAt returns the PushedAt field if it's non-nil, zero value otherwise. -func (r *Repository) GetPushedAt() Timestamp { - if r == nil || r.PushedAt == nil { - return Timestamp{} - } - return *r.PushedAt -} - -// GetReleasesURL returns the ReleasesURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetReleasesURL() string { - if r == nil || r.ReleasesURL == nil { - return "" - } - return *r.ReleasesURL -} - -// GetSize returns the Size field if it's non-nil, zero value otherwise. -func (r *Repository) GetSize() int { - if r == nil || r.Size == nil { - return 0 - } - return *r.Size -} - -// GetSource returns the Source field. -func (r *Repository) GetSource() *Repository { - if r == nil { - return nil - } - return r.Source -} - -// GetSSHURL returns the SSHURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetSSHURL() string { - if r == nil || r.SSHURL == nil { - return "" - } - return *r.SSHURL -} - -// GetStargazersCount returns the StargazersCount field if it's non-nil, zero value otherwise. -func (r *Repository) GetStargazersCount() int { - if r == nil || r.StargazersCount == nil { - return 0 - } - return *r.StargazersCount -} - -// GetStargazersURL returns the StargazersURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetStargazersURL() string { - if r == nil || r.StargazersURL == nil { - return "" - } - return *r.StargazersURL -} - -// GetStatusesURL returns the StatusesURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetStatusesURL() string { - if r == nil || r.StatusesURL == nil { - return "" - } - return *r.StatusesURL -} - -// GetSubscribersCount returns the SubscribersCount field if it's non-nil, zero value otherwise. -func (r *Repository) GetSubscribersCount() int { - if r == nil || r.SubscribersCount == nil { - return 0 - } - return *r.SubscribersCount -} - -// GetSubscribersURL returns the SubscribersURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetSubscribersURL() string { - if r == nil || r.SubscribersURL == nil { - return "" - } - return *r.SubscribersURL -} - -// GetSubscriptionURL returns the SubscriptionURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetSubscriptionURL() string { - if r == nil || r.SubscriptionURL == nil { - return "" - } - return *r.SubscriptionURL -} - -// GetSVNURL returns the SVNURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetSVNURL() string { - if r == nil || r.SVNURL == nil { - return "" - } - return *r.SVNURL -} - -// GetTagsURL returns the TagsURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetTagsURL() string { - if r == nil || r.TagsURL == nil { - return "" - } - return *r.TagsURL -} - -// GetTeamID returns the TeamID field if it's non-nil, zero value otherwise. -func (r *Repository) GetTeamID() int64 { - if r == nil || r.TeamID == nil { - return 0 - } - return *r.TeamID -} - -// GetTeamsURL returns the TeamsURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetTeamsURL() string { - if r == nil || r.TeamsURL == nil { - return "" - } - return *r.TeamsURL -} - -// GetTemplateRepository returns the TemplateRepository field. -func (r *Repository) GetTemplateRepository() *Repository { - if r == nil { - return nil - } - return r.TemplateRepository -} - -// GetTreesURL returns the TreesURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetTreesURL() string { - if r == nil || r.TreesURL == nil { - return "" - } - return *r.TreesURL -} - -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (r *Repository) GetUpdatedAt() Timestamp { - if r == nil || r.UpdatedAt == nil { - return Timestamp{} - } - return *r.UpdatedAt -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (r *Repository) GetURL() string { - if r == nil || r.URL == nil { - return "" - } - return *r.URL -} - -// GetWatchersCount returns the WatchersCount field if it's non-nil, zero value otherwise. -func (r *Repository) GetWatchersCount() int { - if r == nil || r.WatchersCount == nil { - return 0 - } - return *r.WatchersCount -} - -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (r *RepositoryComment) GetBody() string { - if r == nil || r.Body == nil { - return "" - } - return *r.Body -} - -// GetCommitID returns the CommitID field if it's non-nil, zero value otherwise. -func (r *RepositoryComment) GetCommitID() string { - if r == nil || r.CommitID == nil { - return "" - } - return *r.CommitID -} - -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (r *RepositoryComment) GetCreatedAt() time.Time { - if r == nil || r.CreatedAt == nil { - return time.Time{} - } - return *r.CreatedAt -} - -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (r *RepositoryComment) GetHTMLURL() string { - if r == nil || r.HTMLURL == nil { - return "" - } - return *r.HTMLURL -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (r *RepositoryComment) GetID() int64 { - if r == nil || r.ID == nil { - return 0 - } - return *r.ID -} - -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (r *RepositoryComment) GetNodeID() string { - if r == nil || r.NodeID == nil { - return "" - } - return *r.NodeID -} - -// GetPath returns the Path field if it's non-nil, zero value otherwise. -func (r *RepositoryComment) GetPath() string { - if r == nil || r.Path == nil { - return "" - } - return *r.Path -} - -// GetPosition returns the Position field if it's non-nil, zero value otherwise. -func (r *RepositoryComment) GetPosition() int { - if r == nil || r.Position == nil { - return 0 - } - return *r.Position -} - -// GetReactions returns the Reactions field. -func (r *RepositoryComment) GetReactions() *Reactions { - if r == nil { - return nil - } - return r.Reactions -} - -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (r *RepositoryComment) GetUpdatedAt() time.Time { - if r == nil || r.UpdatedAt == nil { - return time.Time{} - } - return *r.UpdatedAt -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (r *RepositoryComment) GetURL() string { - if r == nil || r.URL == nil { - return "" - } - return *r.URL -} - -// GetUser returns the User field. -func (r *RepositoryComment) GetUser() *User { - if r == nil { - return nil - } - return r.User -} - -// GetAuthor returns the Author field. -func (r *RepositoryCommit) GetAuthor() *User { - if r == nil { - return nil - } - return r.Author -} - -// GetCommentsURL returns the CommentsURL field if it's non-nil, zero value otherwise. -func (r *RepositoryCommit) GetCommentsURL() string { - if r == nil || r.CommentsURL == nil { - return "" - } - return *r.CommentsURL -} - -// GetCommit returns the Commit field. -func (r *RepositoryCommit) GetCommit() *Commit { - if r == nil { - return nil - } - return r.Commit -} - -// GetCommitter returns the Committer field. -func (r *RepositoryCommit) GetCommitter() *User { - if r == nil { - return nil - } - return r.Committer -} - -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (r *RepositoryCommit) GetHTMLURL() string { - if r == nil || r.HTMLURL == nil { - return "" - } - return *r.HTMLURL -} - -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (r *RepositoryCommit) GetNodeID() string { - if r == nil || r.NodeID == nil { - return "" - } - return *r.NodeID -} - -// GetSHA returns the SHA field if it's non-nil, zero value otherwise. -func (r *RepositoryCommit) GetSHA() string { - if r == nil || r.SHA == nil { - return "" - } - return *r.SHA -} - -// GetStats returns the Stats field. -func (r *RepositoryCommit) GetStats() *CommitStats { - if r == nil { - return nil - } - return r.Stats -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (r *RepositoryCommit) GetURL() string { - if r == nil || r.URL == nil { - return "" - } - return *r.URL -} - -// GetDownloadURL returns the DownloadURL field if it's non-nil, zero value otherwise. -func (r *RepositoryContent) GetDownloadURL() string { - if r == nil || r.DownloadURL == nil { - return "" - } - return *r.DownloadURL -} - -// GetEncoding returns the Encoding field if it's non-nil, zero value otherwise. -func (r *RepositoryContent) GetEncoding() string { - if r == nil || r.Encoding == nil { - return "" - } - return *r.Encoding -} - -// GetGitURL returns the GitURL field if it's non-nil, zero value otherwise. -func (r *RepositoryContent) GetGitURL() string { - if r == nil || r.GitURL == nil { - return "" - } - return *r.GitURL -} - -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (r *RepositoryContent) GetHTMLURL() string { - if r == nil || r.HTMLURL == nil { - return "" - } - return *r.HTMLURL -} - -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (r *RepositoryContent) GetName() string { - if r == nil || r.Name == nil { - return "" - } - return *r.Name -} - -// GetPath returns the Path field if it's non-nil, zero value otherwise. -func (r *RepositoryContent) GetPath() string { - if r == nil || r.Path == nil { - return "" - } - return *r.Path -} - -// GetSHA returns the SHA field if it's non-nil, zero value otherwise. -func (r *RepositoryContent) GetSHA() string { - if r == nil || r.SHA == nil { - return "" - } - return *r.SHA -} - -// GetSize returns the Size field if it's non-nil, zero value otherwise. -func (r *RepositoryContent) GetSize() int { - if r == nil || r.Size == nil { - return 0 - } - return *r.Size -} - -// GetTarget returns the Target field if it's non-nil, zero value otherwise. -func (r *RepositoryContent) GetTarget() string { - if r == nil || r.Target == nil { - return "" - } - return *r.Target -} - -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (r *RepositoryContent) GetType() string { - if r == nil || r.Type == nil { - return "" - } - return *r.Type -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (r *RepositoryContent) GetURL() string { - if r == nil || r.URL == nil { - return "" - } - return *r.URL -} - -// GetAuthor returns the Author field. -func (r *RepositoryContentFileOptions) GetAuthor() *CommitAuthor { - if r == nil { - return nil - } - return r.Author -} - -// GetBranch returns the Branch field if it's non-nil, zero value otherwise. -func (r *RepositoryContentFileOptions) GetBranch() string { - if r == nil || r.Branch == nil { - return "" - } - return *r.Branch -} - -// GetCommitter returns the Committer field. -func (r *RepositoryContentFileOptions) GetCommitter() *CommitAuthor { - if r == nil { - return nil - } - return r.Committer -} - -// GetMessage returns the Message field if it's non-nil, zero value otherwise. -func (r *RepositoryContentFileOptions) GetMessage() string { - if r == nil || r.Message == nil { - return "" - } - return *r.Message -} - -// GetSHA returns the SHA field if it's non-nil, zero value otherwise. -func (r *RepositoryContentFileOptions) GetSHA() string { - if r == nil || r.SHA == nil { - return "" - } - return *r.SHA -} - -// GetContent returns the Content field. -func (r *RepositoryContentResponse) GetContent() *RepositoryContent { - if r == nil { - return nil - } - return r.Content -} - -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (r *RepositoryEvent) GetAction() string { - if r == nil || r.Action == nil { - return "" - } - return *r.Action -} - -// GetInstallation returns the Installation field. -func (r *RepositoryEvent) GetInstallation() *Installation { - if r == nil { - return nil - } - return r.Installation -} - -// GetOrg returns the Org field. -func (r *RepositoryEvent) GetOrg() *Organization { - if r == nil { - return nil - } - return r.Org -} - -// GetRepo returns the Repo field. -func (r *RepositoryEvent) GetRepo() *Repository { - if r == nil { - return nil - } - return r.Repo -} - -// GetSender returns the Sender field. -func (r *RepositoryEvent) GetSender() *User { - if r == nil { - return nil - } - return r.Sender -} - -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (r *RepositoryInvitation) GetCreatedAt() Timestamp { - if r == nil || r.CreatedAt == nil { - return Timestamp{} - } - return *r.CreatedAt -} - -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (r *RepositoryInvitation) GetHTMLURL() string { - if r == nil || r.HTMLURL == nil { - return "" - } - return *r.HTMLURL -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (r *RepositoryInvitation) GetID() int64 { - if r == nil || r.ID == nil { - return 0 - } - return *r.ID -} - -// GetInvitee returns the Invitee field. -func (r *RepositoryInvitation) GetInvitee() *User { - if r == nil { - return nil - } - return r.Invitee -} - -// GetInviter returns the Inviter field. -func (r *RepositoryInvitation) GetInviter() *User { - if r == nil { - return nil - } - return r.Inviter -} - -// GetPermissions returns the Permissions field if it's non-nil, zero value otherwise. -func (r *RepositoryInvitation) GetPermissions() string { - if r == nil || r.Permissions == nil { - return "" - } - return *r.Permissions -} - -// GetRepo returns the Repo field. -func (r *RepositoryInvitation) GetRepo() *Repository { - if r == nil { - return nil - } - return r.Repo -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (r *RepositoryInvitation) GetURL() string { - if r == nil || r.URL == nil { - return "" - } - return *r.URL -} - -// GetContent returns the Content field if it's non-nil, zero value otherwise. -func (r *RepositoryLicense) GetContent() string { - if r == nil || r.Content == nil { - return "" - } - return *r.Content -} - -// GetDownloadURL returns the DownloadURL field if it's non-nil, zero value otherwise. -func (r *RepositoryLicense) GetDownloadURL() string { - if r == nil || r.DownloadURL == nil { - return "" - } - return *r.DownloadURL -} - -// GetEncoding returns the Encoding field if it's non-nil, zero value otherwise. -func (r *RepositoryLicense) GetEncoding() string { - if r == nil || r.Encoding == nil { - return "" - } - return *r.Encoding -} - -// GetGitURL returns the GitURL field if it's non-nil, zero value otherwise. -func (r *RepositoryLicense) GetGitURL() string { - if r == nil || r.GitURL == nil { - return "" - } - return *r.GitURL -} - -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (r *RepositoryLicense) GetHTMLURL() string { - if r == nil || r.HTMLURL == nil { - return "" - } - return *r.HTMLURL -} - -// GetLicense returns the License field. -func (r *RepositoryLicense) GetLicense() *License { - if r == nil { - return nil - } - return r.License -} - -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (r *RepositoryLicense) GetName() string { - if r == nil || r.Name == nil { - return "" - } - return *r.Name -} - -// GetPath returns the Path field if it's non-nil, zero value otherwise. -func (r *RepositoryLicense) GetPath() string { - if r == nil || r.Path == nil { - return "" - } - return *r.Path -} - -// GetSHA returns the SHA field if it's non-nil, zero value otherwise. -func (r *RepositoryLicense) GetSHA() string { - if r == nil || r.SHA == nil { - return "" - } - return *r.SHA -} - -// GetSize returns the Size field if it's non-nil, zero value otherwise. -func (r *RepositoryLicense) GetSize() int { - if r == nil || r.Size == nil { - return 0 - } - return *r.Size -} - -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (r *RepositoryLicense) GetType() string { - if r == nil || r.Type == nil { - return "" - } - return *r.Type -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (r *RepositoryLicense) GetURL() string { - if r == nil || r.URL == nil { - return "" - } - return *r.URL -} - -// GetBase returns the Base field if it's non-nil, zero value otherwise. -func (r *RepositoryMergeRequest) GetBase() string { - if r == nil || r.Base == nil { - return "" - } - return *r.Base -} - -// GetCommitMessage returns the CommitMessage field if it's non-nil, zero value otherwise. -func (r *RepositoryMergeRequest) GetCommitMessage() string { - if r == nil || r.CommitMessage == nil { - return "" - } - return *r.CommitMessage -} - -// GetHead returns the Head field if it's non-nil, zero value otherwise. -func (r *RepositoryMergeRequest) GetHead() string { - if r == nil || r.Head == nil { - return "" - } - return *r.Head -} - -// GetPermission returns the Permission field if it's non-nil, zero value otherwise. -func (r *RepositoryPermissionLevel) GetPermission() string { - if r == nil || r.Permission == nil { - return "" - } - return *r.Permission -} - -// GetUser returns the User field. -func (r *RepositoryPermissionLevel) GetUser() *User { - if r == nil { - return nil - } - return r.User -} - -// GetAssetsURL returns the AssetsURL field if it's non-nil, zero value otherwise. -func (r *RepositoryRelease) GetAssetsURL() string { - if r == nil || r.AssetsURL == nil { - return "" - } - return *r.AssetsURL -} - -// GetAuthor returns the Author field. -func (r *RepositoryRelease) GetAuthor() *User { - if r == nil { - return nil - } - return r.Author -} - -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (r *RepositoryRelease) GetBody() string { - if r == nil || r.Body == nil { - return "" - } - return *r.Body -} - -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (r *RepositoryRelease) GetCreatedAt() Timestamp { - if r == nil || r.CreatedAt == nil { - return Timestamp{} - } - return *r.CreatedAt -} - -// GetDraft returns the Draft field if it's non-nil, zero value otherwise. -func (r *RepositoryRelease) GetDraft() bool { - if r == nil || r.Draft == nil { - return false - } - return *r.Draft -} - -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (r *RepositoryRelease) GetHTMLURL() string { - if r == nil || r.HTMLURL == nil { - return "" - } - return *r.HTMLURL -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (r *RepositoryRelease) GetID() int64 { - if r == nil || r.ID == nil { - return 0 - } - return *r.ID -} - -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (r *RepositoryRelease) GetName() string { - if r == nil || r.Name == nil { - return "" - } - return *r.Name -} - -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (r *RepositoryRelease) GetNodeID() string { - if r == nil || r.NodeID == nil { - return "" - } - return *r.NodeID -} - -// GetPrerelease returns the Prerelease field if it's non-nil, zero value otherwise. -func (r *RepositoryRelease) GetPrerelease() bool { - if r == nil || r.Prerelease == nil { - return false - } - return *r.Prerelease -} - -// GetPublishedAt returns the PublishedAt field if it's non-nil, zero value otherwise. -func (r *RepositoryRelease) GetPublishedAt() Timestamp { - if r == nil || r.PublishedAt == nil { - return Timestamp{} - } - return *r.PublishedAt -} - -// GetTagName returns the TagName field if it's non-nil, zero value otherwise. -func (r *RepositoryRelease) GetTagName() string { - if r == nil || r.TagName == nil { - return "" - } - return *r.TagName -} - -// GetTarballURL returns the TarballURL field if it's non-nil, zero value otherwise. -func (r *RepositoryRelease) GetTarballURL() string { - if r == nil || r.TarballURL == nil { - return "" - } - return *r.TarballURL -} - -// GetTargetCommitish returns the TargetCommitish field if it's non-nil, zero value otherwise. -func (r *RepositoryRelease) GetTargetCommitish() string { - if r == nil || r.TargetCommitish == nil { - return "" - } - return *r.TargetCommitish -} - -// GetUploadURL returns the UploadURL field if it's non-nil, zero value otherwise. -func (r *RepositoryRelease) GetUploadURL() string { - if r == nil || r.UploadURL == nil { - return "" - } - return *r.UploadURL -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (r *RepositoryRelease) GetURL() string { - if r == nil || r.URL == nil { - return "" - } - return *r.URL -} - -// GetZipballURL returns the ZipballURL field if it's non-nil, zero value otherwise. -func (r *RepositoryRelease) GetZipballURL() string { - if r == nil || r.ZipballURL == nil { - return "" - } - return *r.ZipballURL -} - -// GetCommit returns the Commit field. -func (r *RepositoryTag) GetCommit() *Commit { - if r == nil { - return nil - } - return r.Commit -} - -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (r *RepositoryTag) GetName() string { - if r == nil || r.Name == nil { - return "" - } - return *r.Name -} - -// GetTarballURL returns the TarballURL field if it's non-nil, zero value otherwise. -func (r *RepositoryTag) GetTarballURL() string { - if r == nil || r.TarballURL == nil { - return "" - } - return *r.TarballURL -} - -// GetZipballURL returns the ZipballURL field if it's non-nil, zero value otherwise. -func (r *RepositoryTag) GetZipballURL() string { - if r == nil || r.ZipballURL == nil { - return "" - } - return *r.ZipballURL -} - -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (r *RepositoryVulnerabilityAlertEvent) GetAction() string { - if r == nil || r.Action == nil { - return "" - } - return *r.Action -} - -// GetForkRepos returns the ForkRepos field if it's non-nil, zero value otherwise. -func (r *RepoStats) GetForkRepos() int { - if r == nil || r.ForkRepos == nil { - return 0 - } - return *r.ForkRepos -} - -// GetOrgRepos returns the OrgRepos field if it's non-nil, zero value otherwise. -func (r *RepoStats) GetOrgRepos() int { - if r == nil || r.OrgRepos == nil { - return 0 - } - return *r.OrgRepos -} - -// GetRootRepos returns the RootRepos field if it's non-nil, zero value otherwise. -func (r *RepoStats) GetRootRepos() int { - if r == nil || r.RootRepos == nil { - return 0 - } - return *r.RootRepos -} - -// GetTotalPushes returns the TotalPushes field if it's non-nil, zero value otherwise. -func (r *RepoStats) GetTotalPushes() int { - if r == nil || r.TotalPushes == nil { - return 0 - } - return *r.TotalPushes -} - -// GetTotalRepos returns the TotalRepos field if it's non-nil, zero value otherwise. -func (r *RepoStats) GetTotalRepos() int { - if r == nil || r.TotalRepos == nil { - return 0 - } - return *r.TotalRepos -} - -// GetTotalWikis returns the TotalWikis field if it's non-nil, zero value otherwise. -func (r *RepoStats) GetTotalWikis() int { - if r == nil || r.TotalWikis == nil { - return 0 - } - return *r.TotalWikis -} - -// GetContext returns the Context field if it's non-nil, zero value otherwise. -func (r *RepoStatus) GetContext() string { - if r == nil || r.Context == nil { - return "" - } - return *r.Context -} - -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (r *RepoStatus) GetCreatedAt() time.Time { - if r == nil || r.CreatedAt == nil { - return time.Time{} - } - return *r.CreatedAt -} - -// GetCreator returns the Creator field. -func (r *RepoStatus) GetCreator() *User { - if r == nil { - return nil - } - return r.Creator -} - -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (r *RepoStatus) GetDescription() string { - if r == nil || r.Description == nil { - return "" - } - return *r.Description -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (r *RepoStatus) GetID() int64 { - if r == nil || r.ID == nil { - return 0 - } - return *r.ID -} - -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (r *RepoStatus) GetNodeID() string { - if r == nil || r.NodeID == nil { - return "" - } - return *r.NodeID -} - -// GetState returns the State field if it's non-nil, zero value otherwise. -func (r *RepoStatus) GetState() string { - if r == nil || r.State == nil { - return "" - } - return *r.State -} - -// GetTargetURL returns the TargetURL field if it's non-nil, zero value otherwise. -func (r *RepoStatus) GetTargetURL() string { - if r == nil || r.TargetURL == nil { - return "" - } - return *r.TargetURL -} - -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (r *RepoStatus) GetUpdatedAt() time.Time { - if r == nil || r.UpdatedAt == nil { - return time.Time{} - } - return *r.UpdatedAt -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (r *RepoStatus) GetURL() string { - if r == nil || r.URL == nil { - return "" - } - return *r.URL -} - -// GetStrict returns the Strict field if it's non-nil, zero value otherwise. -func (r *RequiredStatusChecksRequest) GetStrict() bool { - if r == nil || r.Strict == nil { - return false - } - return *r.Strict -} - -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (r *ReviewersRequest) GetNodeID() string { - if r == nil || r.NodeID == nil { - return "" - } - return *r.NodeID -} - -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (s *ServiceHook) GetName() string { - if s == nil || s.Name == nil { - return "" - } - return *s.Name -} - -// GetEnabled returns the Enabled field if it's non-nil, zero value otherwise. -func (s *SignaturesProtectedBranch) GetEnabled() bool { - if s == nil || s.Enabled == nil { - return false - } - return *s.Enabled -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (s *SignaturesProtectedBranch) GetURL() string { - if s == nil || s.URL == nil { - return "" - } - return *s.URL -} - -// GetPayload returns the Payload field if it's non-nil, zero value otherwise. -func (s *SignatureVerification) GetPayload() string { - if s == nil || s.Payload == nil { - return "" - } - return *s.Payload -} - -// GetReason returns the Reason field if it's non-nil, zero value otherwise. -func (s *SignatureVerification) GetReason() string { - if s == nil || s.Reason == nil { - return "" - } - return *s.Reason -} - -// GetSignature returns the Signature field if it's non-nil, zero value otherwise. -func (s *SignatureVerification) GetSignature() string { - if s == nil || s.Signature == nil { - return "" - } - return *s.Signature -} - -// GetVerified returns the Verified field if it's non-nil, zero value otherwise. -func (s *SignatureVerification) GetVerified() bool { - if s == nil || s.Verified == nil { - return false - } - return *s.Verified -} - -// GetActor returns the Actor field. -func (s *Source) GetActor() *User { - if s == nil { - return nil - } - return s.Actor -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (s *Source) GetID() int64 { - if s == nil || s.ID == nil { - return 0 - } - return *s.ID -} - -// GetIssue returns the Issue field. -func (s *Source) GetIssue() *Issue { - if s == nil { - return nil - } - return s.Issue -} - -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (s *Source) GetType() string { - if s == nil || s.Type == nil { - return "" - } - return *s.Type -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (s *Source) GetURL() string { - if s == nil || s.URL == nil { - return "" - } - return *s.URL -} - -// GetEmail returns the Email field if it's non-nil, zero value otherwise. -func (s *SourceImportAuthor) GetEmail() string { - if s == nil || s.Email == nil { - return "" - } - return *s.Email -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (s *SourceImportAuthor) GetID() int64 { - if s == nil || s.ID == nil { - return 0 - } - return *s.ID -} - -// GetImportURL returns the ImportURL field if it's non-nil, zero value otherwise. -func (s *SourceImportAuthor) GetImportURL() string { - if s == nil || s.ImportURL == nil { - return "" - } - return *s.ImportURL -} - -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (s *SourceImportAuthor) GetName() string { - if s == nil || s.Name == nil { - return "" - } - return *s.Name -} - -// GetRemoteID returns the RemoteID field if it's non-nil, zero value otherwise. -func (s *SourceImportAuthor) GetRemoteID() string { - if s == nil || s.RemoteID == nil { - return "" - } - return *s.RemoteID -} - -// GetRemoteName returns the RemoteName field if it's non-nil, zero value otherwise. -func (s *SourceImportAuthor) GetRemoteName() string { - if s == nil || s.RemoteName == nil { - return "" - } - return *s.RemoteName -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (s *SourceImportAuthor) GetURL() string { - if s == nil || s.URL == nil { - return "" - } - return *s.URL -} - -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (s *StarEvent) GetAction() string { - if s == nil || s.Action == nil { - return "" - } - return *s.Action -} - -// GetStarredAt returns the StarredAt field if it's non-nil, zero value otherwise. -func (s *StarEvent) GetStarredAt() Timestamp { - if s == nil || s.StarredAt == nil { - return Timestamp{} - } - return *s.StarredAt -} - -// GetStarredAt returns the StarredAt field if it's non-nil, zero value otherwise. -func (s *Stargazer) GetStarredAt() Timestamp { - if s == nil || s.StarredAt == nil { - return Timestamp{} - } - return *s.StarredAt -} - -// GetUser returns the User field. -func (s *Stargazer) GetUser() *User { - if s == nil { - return nil - } - return s.User -} - -// GetRepository returns the Repository field. -func (s *StarredRepository) GetRepository() *Repository { - if s == nil { - return nil - } - return s.Repository -} - -// GetStarredAt returns the StarredAt field if it's non-nil, zero value otherwise. -func (s *StarredRepository) GetStarredAt() Timestamp { - if s == nil || s.StarredAt == nil { - return Timestamp{} - } - return *s.StarredAt -} - -// GetCommit returns the Commit field. -func (s *StatusEvent) GetCommit() *RepositoryCommit { - if s == nil { - return nil - } - return s.Commit -} - -// GetContext returns the Context field if it's non-nil, zero value otherwise. -func (s *StatusEvent) GetContext() string { - if s == nil || s.Context == nil { - return "" - } - return *s.Context -} - -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (s *StatusEvent) GetCreatedAt() Timestamp { - if s == nil || s.CreatedAt == nil { - return Timestamp{} - } - return *s.CreatedAt -} - -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (s *StatusEvent) GetDescription() string { - if s == nil || s.Description == nil { - return "" - } - return *s.Description -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (s *StatusEvent) GetID() int64 { - if s == nil || s.ID == nil { - return 0 - } - return *s.ID -} - -// GetInstallation returns the Installation field. -func (s *StatusEvent) GetInstallation() *Installation { - if s == nil { - return nil - } - return s.Installation -} - -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (s *StatusEvent) GetName() string { - if s == nil || s.Name == nil { - return "" - } - return *s.Name -} - -// GetRepo returns the Repo field. -func (s *StatusEvent) GetRepo() *Repository { - if s == nil { - return nil - } - return s.Repo -} - -// GetSender returns the Sender field. -func (s *StatusEvent) GetSender() *User { - if s == nil { - return nil - } - return s.Sender -} - -// GetSHA returns the SHA field if it's non-nil, zero value otherwise. -func (s *StatusEvent) GetSHA() string { - if s == nil || s.SHA == nil { - return "" - } - return *s.SHA -} - -// GetState returns the State field if it's non-nil, zero value otherwise. -func (s *StatusEvent) GetState() string { - if s == nil || s.State == nil { - return "" - } - return *s.State -} - -// GetTargetURL returns the TargetURL field if it's non-nil, zero value otherwise. -func (s *StatusEvent) GetTargetURL() string { - if s == nil || s.TargetURL == nil { - return "" - } - return *s.TargetURL -} - -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (s *StatusEvent) GetUpdatedAt() Timestamp { - if s == nil || s.UpdatedAt == nil { - return Timestamp{} - } - return *s.UpdatedAt -} - -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (s *Subscription) GetCreatedAt() Timestamp { - if s == nil || s.CreatedAt == nil { - return Timestamp{} - } - return *s.CreatedAt -} - -// GetIgnored returns the Ignored field if it's non-nil, zero value otherwise. -func (s *Subscription) GetIgnored() bool { - if s == nil || s.Ignored == nil { - return false - } - return *s.Ignored -} - -// GetReason returns the Reason field if it's non-nil, zero value otherwise. -func (s *Subscription) GetReason() string { - if s == nil || s.Reason == nil { - return "" - } - return *s.Reason -} - -// GetRepositoryURL returns the RepositoryURL field if it's non-nil, zero value otherwise. -func (s *Subscription) GetRepositoryURL() string { - if s == nil || s.RepositoryURL == nil { - return "" - } - return *s.RepositoryURL -} - -// GetSubscribed returns the Subscribed field if it's non-nil, zero value otherwise. -func (s *Subscription) GetSubscribed() bool { - if s == nil || s.Subscribed == nil { - return false - } - return *s.Subscribed -} - -// GetThreadURL returns the ThreadURL field if it's non-nil, zero value otherwise. -func (s *Subscription) GetThreadURL() string { - if s == nil || s.ThreadURL == nil { - return "" - } - return *s.ThreadURL -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (s *Subscription) GetURL() string { - if s == nil || s.URL == nil { - return "" - } - return *s.URL -} - -// GetMessage returns the Message field if it's non-nil, zero value otherwise. -func (t *Tag) GetMessage() string { - if t == nil || t.Message == nil { - return "" - } - return *t.Message -} - -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (t *Tag) GetNodeID() string { - if t == nil || t.NodeID == nil { - return "" - } - return *t.NodeID -} - -// GetObject returns the Object field. -func (t *Tag) GetObject() *GitObject { - if t == nil { - return nil - } - return t.Object -} - -// GetSHA returns the SHA field if it's non-nil, zero value otherwise. -func (t *Tag) GetSHA() string { - if t == nil || t.SHA == nil { - return "" - } - return *t.SHA -} - -// GetTag returns the Tag field if it's non-nil, zero value otherwise. -func (t *Tag) GetTag() string { - if t == nil || t.Tag == nil { - return "" - } - return *t.Tag -} - -// GetTagger returns the Tagger field. -func (t *Tag) GetTagger() *CommitAuthor { - if t == nil { - return nil - } - return t.Tagger -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (t *Tag) GetURL() string { - if t == nil || t.URL == nil { - return "" - } - return *t.URL -} - -// GetVerification returns the Verification field. -func (t *Tag) GetVerification() *SignatureVerification { - if t == nil { - return nil - } - return t.Verification -} - -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (t *Team) GetDescription() string { - if t == nil || t.Description == nil { - return "" - } - return *t.Description -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (t *Team) GetID() int64 { - if t == nil || t.ID == nil { - return 0 - } - return *t.ID -} - -// GetLDAPDN returns the LDAPDN field if it's non-nil, zero value otherwise. -func (t *Team) GetLDAPDN() string { - if t == nil || t.LDAPDN == nil { - return "" - } - return *t.LDAPDN -} - -// GetMembersCount returns the MembersCount field if it's non-nil, zero value otherwise. -func (t *Team) GetMembersCount() int { - if t == nil || t.MembersCount == nil { - return 0 - } - return *t.MembersCount -} - -// GetMembersURL returns the MembersURL field if it's non-nil, zero value otherwise. -func (t *Team) GetMembersURL() string { - if t == nil || t.MembersURL == nil { - return "" - } - return *t.MembersURL -} - -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (t *Team) GetName() string { - if t == nil || t.Name == nil { - return "" - } - return *t.Name -} - -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (t *Team) GetNodeID() string { - if t == nil || t.NodeID == nil { - return "" - } - return *t.NodeID -} - -// GetOrganization returns the Organization field. -func (t *Team) GetOrganization() *Organization { - if t == nil { - return nil - } - return t.Organization -} - -// GetParent returns the Parent field. -func (t *Team) GetParent() *Team { - if t == nil { - return nil - } - return t.Parent -} - -// GetPermission returns the Permission field if it's non-nil, zero value otherwise. -func (t *Team) GetPermission() string { - if t == nil || t.Permission == nil { - return "" - } - return *t.Permission -} - -// GetPrivacy returns the Privacy field if it's non-nil, zero value otherwise. -func (t *Team) GetPrivacy() string { - if t == nil || t.Privacy == nil { - return "" - } - return *t.Privacy -} - -// GetReposCount returns the ReposCount field if it's non-nil, zero value otherwise. -func (t *Team) GetReposCount() int { - if t == nil || t.ReposCount == nil { - return 0 - } - return *t.ReposCount -} - -// GetRepositoriesURL returns the RepositoriesURL field if it's non-nil, zero value otherwise. -func (t *Team) GetRepositoriesURL() string { - if t == nil || t.RepositoriesURL == nil { - return "" - } - return *t.RepositoriesURL -} - -// GetSlug returns the Slug field if it's non-nil, zero value otherwise. -func (t *Team) GetSlug() string { - if t == nil || t.Slug == nil { - return "" - } - return *t.Slug -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (t *Team) GetURL() string { - if t == nil || t.URL == nil { - return "" - } - return *t.URL -} - -// GetInstallation returns the Installation field. -func (t *TeamAddEvent) GetInstallation() *Installation { - if t == nil { - return nil - } - return t.Installation -} - -// GetOrg returns the Org field. -func (t *TeamAddEvent) GetOrg() *Organization { - if t == nil { - return nil - } - return t.Org -} - -// GetRepo returns the Repo field. -func (t *TeamAddEvent) GetRepo() *Repository { - if t == nil { - return nil - } - return t.Repo -} - -// GetSender returns the Sender field. -func (t *TeamAddEvent) GetSender() *User { - if t == nil { - return nil - } - return t.Sender -} - -// GetTeam returns the Team field. -func (t *TeamAddEvent) GetTeam() *Team { - if t == nil { - return nil - } - return t.Team -} - -// GetAuthor returns the Author field. -func (t *TeamDiscussion) GetAuthor() *User { - if t == nil { - return nil - } - return t.Author -} - -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (t *TeamDiscussion) GetBody() string { - if t == nil || t.Body == nil { - return "" - } - return *t.Body -} - -// GetBodyHTML returns the BodyHTML field if it's non-nil, zero value otherwise. -func (t *TeamDiscussion) GetBodyHTML() string { - if t == nil || t.BodyHTML == nil { - return "" - } - return *t.BodyHTML -} - -// GetBodyVersion returns the BodyVersion field if it's non-nil, zero value otherwise. -func (t *TeamDiscussion) GetBodyVersion() string { - if t == nil || t.BodyVersion == nil { - return "" - } - return *t.BodyVersion -} - -// GetCommentsCount returns the CommentsCount field if it's non-nil, zero value otherwise. -func (t *TeamDiscussion) GetCommentsCount() int { - if t == nil || t.CommentsCount == nil { - return 0 - } - return *t.CommentsCount -} - -// GetCommentsURL returns the CommentsURL field if it's non-nil, zero value otherwise. -func (t *TeamDiscussion) GetCommentsURL() string { - if t == nil || t.CommentsURL == nil { - return "" - } - return *t.CommentsURL -} - -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (t *TeamDiscussion) GetCreatedAt() Timestamp { - if t == nil || t.CreatedAt == nil { - return Timestamp{} - } - return *t.CreatedAt -} - -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (t *TeamDiscussion) GetHTMLURL() string { - if t == nil || t.HTMLURL == nil { - return "" - } - return *t.HTMLURL -} - -// GetLastEditedAt returns the LastEditedAt field if it's non-nil, zero value otherwise. -func (t *TeamDiscussion) GetLastEditedAt() Timestamp { - if t == nil || t.LastEditedAt == nil { - return Timestamp{} - } - return *t.LastEditedAt -} - -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (t *TeamDiscussion) GetNodeID() string { - if t == nil || t.NodeID == nil { - return "" - } - return *t.NodeID -} - -// GetNumber returns the Number field if it's non-nil, zero value otherwise. -func (t *TeamDiscussion) GetNumber() int { - if t == nil || t.Number == nil { - return 0 - } - return *t.Number -} - -// GetPinned returns the Pinned field if it's non-nil, zero value otherwise. -func (t *TeamDiscussion) GetPinned() bool { - if t == nil || t.Pinned == nil { - return false - } - return *t.Pinned -} - -// GetPrivate returns the Private field if it's non-nil, zero value otherwise. -func (t *TeamDiscussion) GetPrivate() bool { - if t == nil || t.Private == nil { - return false - } - return *t.Private -} - -// GetReactions returns the Reactions field. -func (t *TeamDiscussion) GetReactions() *Reactions { - if t == nil { - return nil - } - return t.Reactions -} - -// GetTeamURL returns the TeamURL field if it's non-nil, zero value otherwise. -func (t *TeamDiscussion) GetTeamURL() string { - if t == nil || t.TeamURL == nil { - return "" - } - return *t.TeamURL -} - -// GetTitle returns the Title field if it's non-nil, zero value otherwise. -func (t *TeamDiscussion) GetTitle() string { - if t == nil || t.Title == nil { - return "" - } - return *t.Title -} - -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (t *TeamDiscussion) GetUpdatedAt() Timestamp { - if t == nil || t.UpdatedAt == nil { - return Timestamp{} - } - return *t.UpdatedAt -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (t *TeamDiscussion) GetURL() string { - if t == nil || t.URL == nil { - return "" - } - return *t.URL -} - -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (t *TeamEvent) GetAction() string { - if t == nil || t.Action == nil { - return "" - } - return *t.Action -} - -// GetChanges returns the Changes field. -func (t *TeamEvent) GetChanges() *TeamChange { - if t == nil { - return nil - } - return t.Changes -} - -// GetInstallation returns the Installation field. -func (t *TeamEvent) GetInstallation() *Installation { - if t == nil { - return nil - } - return t.Installation -} - -// GetOrg returns the Org field. -func (t *TeamEvent) GetOrg() *Organization { - if t == nil { - return nil - } - return t.Org -} - -// GetRepo returns the Repo field. -func (t *TeamEvent) GetRepo() *Repository { - if t == nil { - return nil - } - return t.Repo -} - -// GetSender returns the Sender field. -func (t *TeamEvent) GetSender() *User { - if t == nil { - return nil - } - return t.Sender -} - -// GetTeam returns the Team field. -func (t *TeamEvent) GetTeam() *Team { - if t == nil { - return nil - } - return t.Team -} - -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (t *TeamLDAPMapping) GetDescription() string { - if t == nil || t.Description == nil { - return "" - } - return *t.Description -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (t *TeamLDAPMapping) GetID() int64 { - if t == nil || t.ID == nil { - return 0 - } - return *t.ID -} - -// GetLDAPDN returns the LDAPDN field if it's non-nil, zero value otherwise. -func (t *TeamLDAPMapping) GetLDAPDN() string { - if t == nil || t.LDAPDN == nil { - return "" - } - return *t.LDAPDN -} - -// GetMembersURL returns the MembersURL field if it's non-nil, zero value otherwise. -func (t *TeamLDAPMapping) GetMembersURL() string { - if t == nil || t.MembersURL == nil { - return "" - } - return *t.MembersURL -} - -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (t *TeamLDAPMapping) GetName() string { - if t == nil || t.Name == nil { - return "" - } - return *t.Name -} - -// GetPermission returns the Permission field if it's non-nil, zero value otherwise. -func (t *TeamLDAPMapping) GetPermission() string { - if t == nil || t.Permission == nil { - return "" - } - return *t.Permission -} - -// GetPrivacy returns the Privacy field if it's non-nil, zero value otherwise. -func (t *TeamLDAPMapping) GetPrivacy() string { - if t == nil || t.Privacy == nil { - return "" - } - return *t.Privacy -} - -// GetRepositoriesURL returns the RepositoriesURL field if it's non-nil, zero value otherwise. -func (t *TeamLDAPMapping) GetRepositoriesURL() string { - if t == nil || t.RepositoriesURL == nil { - return "" - } - return *t.RepositoriesURL -} - -// GetSlug returns the Slug field if it's non-nil, zero value otherwise. -func (t *TeamLDAPMapping) GetSlug() string { - if t == nil || t.Slug == nil { - return "" - } - return *t.Slug -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (t *TeamLDAPMapping) GetURL() string { - if t == nil || t.URL == nil { - return "" - } - return *t.URL -} - -// GetPermission returns the Permission field if it's non-nil, zero value otherwise. -func (t *TeamProjectOptions) GetPermission() string { - if t == nil || t.Permission == nil { - return "" - } - return *t.Permission -} - -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (t *TemplateRepoRequest) GetDescription() string { - if t == nil || t.Description == nil { - return "" - } - return *t.Description -} - -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (t *TemplateRepoRequest) GetName() string { - if t == nil || t.Name == nil { - return "" - } - return *t.Name -} - -// GetOwner returns the Owner field if it's non-nil, zero value otherwise. -func (t *TemplateRepoRequest) GetOwner() string { - if t == nil || t.Owner == nil { - return "" - } - return *t.Owner -} - -// GetPrivate returns the Private field if it's non-nil, zero value otherwise. -func (t *TemplateRepoRequest) GetPrivate() bool { - if t == nil || t.Private == nil { - return false - } - return *t.Private -} - -// GetFragment returns the Fragment field if it's non-nil, zero value otherwise. -func (t *TextMatch) GetFragment() string { - if t == nil || t.Fragment == nil { - return "" - } - return *t.Fragment -} - -// GetObjectType returns the ObjectType field if it's non-nil, zero value otherwise. -func (t *TextMatch) GetObjectType() string { - if t == nil || t.ObjectType == nil { - return "" - } - return *t.ObjectType -} - -// GetObjectURL returns the ObjectURL field if it's non-nil, zero value otherwise. -func (t *TextMatch) GetObjectURL() string { - if t == nil || t.ObjectURL == nil { - return "" - } - return *t.ObjectURL -} - -// GetProperty returns the Property field if it's non-nil, zero value otherwise. -func (t *TextMatch) GetProperty() string { - if t == nil || t.Property == nil { - return "" - } - return *t.Property -} - -// GetActor returns the Actor field. -func (t *Timeline) GetActor() *User { - if t == nil { - return nil - } - return t.Actor -} - -// GetAssignee returns the Assignee field. -func (t *Timeline) GetAssignee() *User { - if t == nil { - return nil - } - return t.Assignee -} - -// GetCommitID returns the CommitID field if it's non-nil, zero value otherwise. -func (t *Timeline) GetCommitID() string { - if t == nil || t.CommitID == nil { - return "" - } - return *t.CommitID -} - -// GetCommitURL returns the CommitURL field if it's non-nil, zero value otherwise. -func (t *Timeline) GetCommitURL() string { - if t == nil || t.CommitURL == nil { - return "" - } - return *t.CommitURL -} - -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (t *Timeline) GetCreatedAt() time.Time { - if t == nil || t.CreatedAt == nil { - return time.Time{} - } - return *t.CreatedAt -} - -// GetEvent returns the Event field if it's non-nil, zero value otherwise. -func (t *Timeline) GetEvent() string { - if t == nil || t.Event == nil { - return "" - } - return *t.Event -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (t *Timeline) GetID() int64 { - if t == nil || t.ID == nil { - return 0 - } - return *t.ID -} - -// GetLabel returns the Label field. -func (t *Timeline) GetLabel() *Label { - if t == nil { - return nil - } - return t.Label -} - -// GetMilestone returns the Milestone field. -func (t *Timeline) GetMilestone() *Milestone { - if t == nil { - return nil - } - return t.Milestone -} - -// GetProjectCard returns the ProjectCard field. -func (t *Timeline) GetProjectCard() *ProjectCard { - if t == nil { - return nil - } - return t.ProjectCard -} - -// GetRename returns the Rename field. -func (t *Timeline) GetRename() *Rename { - if t == nil { - return nil - } - return t.Rename -} - -// GetSource returns the Source field. -func (t *Timeline) GetSource() *Source { - if t == nil { - return nil - } - return t.Source -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (t *Timeline) GetURL() string { - if t == nil || t.URL == nil { - return "" - } - return *t.URL -} - -// GetCount returns the Count field if it's non-nil, zero value otherwise. -func (t *TrafficClones) GetCount() int { - if t == nil || t.Count == nil { - return 0 - } - return *t.Count -} - -// GetUniques returns the Uniques field if it's non-nil, zero value otherwise. -func (t *TrafficClones) GetUniques() int { - if t == nil || t.Uniques == nil { - return 0 - } - return *t.Uniques -} - -// GetCount returns the Count field if it's non-nil, zero value otherwise. -func (t *TrafficData) GetCount() int { - if t == nil || t.Count == nil { - return 0 - } - return *t.Count -} - -// GetTimestamp returns the Timestamp field if it's non-nil, zero value otherwise. -func (t *TrafficData) GetTimestamp() Timestamp { - if t == nil || t.Timestamp == nil { - return Timestamp{} - } - return *t.Timestamp -} - -// GetUniques returns the Uniques field if it's non-nil, zero value otherwise. -func (t *TrafficData) GetUniques() int { - if t == nil || t.Uniques == nil { - return 0 - } - return *t.Uniques -} - -// GetCount returns the Count field if it's non-nil, zero value otherwise. -func (t *TrafficPath) GetCount() int { - if t == nil || t.Count == nil { - return 0 - } - return *t.Count -} - -// GetPath returns the Path field if it's non-nil, zero value otherwise. -func (t *TrafficPath) GetPath() string { - if t == nil || t.Path == nil { - return "" - } - return *t.Path -} - -// GetTitle returns the Title field if it's non-nil, zero value otherwise. -func (t *TrafficPath) GetTitle() string { - if t == nil || t.Title == nil { - return "" - } - return *t.Title -} - -// GetUniques returns the Uniques field if it's non-nil, zero value otherwise. -func (t *TrafficPath) GetUniques() int { - if t == nil || t.Uniques == nil { - return 0 - } - return *t.Uniques -} - -// GetCount returns the Count field if it's non-nil, zero value otherwise. -func (t *TrafficReferrer) GetCount() int { - if t == nil || t.Count == nil { - return 0 - } - return *t.Count -} - -// GetReferrer returns the Referrer field if it's non-nil, zero value otherwise. -func (t *TrafficReferrer) GetReferrer() string { - if t == nil || t.Referrer == nil { - return "" - } - return *t.Referrer -} - -// GetUniques returns the Uniques field if it's non-nil, zero value otherwise. -func (t *TrafficReferrer) GetUniques() int { - if t == nil || t.Uniques == nil { - return 0 - } - return *t.Uniques -} - -// GetCount returns the Count field if it's non-nil, zero value otherwise. -func (t *TrafficViews) GetCount() int { - if t == nil || t.Count == nil { - return 0 - } - return *t.Count -} - -// GetUniques returns the Uniques field if it's non-nil, zero value otherwise. -func (t *TrafficViews) GetUniques() int { - if t == nil || t.Uniques == nil { - return 0 - } - return *t.Uniques -} - -// GetSHA returns the SHA field if it's non-nil, zero value otherwise. -func (t *Tree) GetSHA() string { - if t == nil || t.SHA == nil { - return "" - } - return *t.SHA -} - -// GetTruncated returns the Truncated field if it's non-nil, zero value otherwise. -func (t *Tree) GetTruncated() bool { - if t == nil || t.Truncated == nil { - return false - } - return *t.Truncated -} - -// GetContent returns the Content field if it's non-nil, zero value otherwise. -func (t *TreeEntry) GetContent() string { - if t == nil || t.Content == nil { - return "" - } - return *t.Content -} - -// GetMode returns the Mode field if it's non-nil, zero value otherwise. -func (t *TreeEntry) GetMode() string { - if t == nil || t.Mode == nil { - return "" - } - return *t.Mode -} - -// GetPath returns the Path field if it's non-nil, zero value otherwise. -func (t *TreeEntry) GetPath() string { - if t == nil || t.Path == nil { - return "" - } - return *t.Path -} - -// GetSHA returns the SHA field if it's non-nil, zero value otherwise. -func (t *TreeEntry) GetSHA() string { - if t == nil || t.SHA == nil { - return "" - } - return *t.SHA -} - -// GetSize returns the Size field if it's non-nil, zero value otherwise. -func (t *TreeEntry) GetSize() int { - if t == nil || t.Size == nil { - return 0 - } - return *t.Size -} - -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (t *TreeEntry) GetType() string { - if t == nil || t.Type == nil { - return "" - } - return *t.Type -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (t *TreeEntry) GetURL() string { - if t == nil || t.URL == nil { - return "" - } - return *t.URL -} - -// GetCompletedAt returns the CompletedAt field if it's non-nil, zero value otherwise. -func (u *UpdateCheckRunOptions) GetCompletedAt() Timestamp { - if u == nil || u.CompletedAt == nil { - return Timestamp{} - } - return *u.CompletedAt -} - -// GetConclusion returns the Conclusion field if it's non-nil, zero value otherwise. -func (u *UpdateCheckRunOptions) GetConclusion() string { - if u == nil || u.Conclusion == nil { - return "" - } - return *u.Conclusion -} - -// GetDetailsURL returns the DetailsURL field if it's non-nil, zero value otherwise. -func (u *UpdateCheckRunOptions) GetDetailsURL() string { - if u == nil || u.DetailsURL == nil { - return "" - } - return *u.DetailsURL -} - -// GetExternalID returns the ExternalID field if it's non-nil, zero value otherwise. -func (u *UpdateCheckRunOptions) GetExternalID() string { - if u == nil || u.ExternalID == nil { - return "" - } - return *u.ExternalID -} - -// GetHeadBranch returns the HeadBranch field if it's non-nil, zero value otherwise. -func (u *UpdateCheckRunOptions) GetHeadBranch() string { - if u == nil || u.HeadBranch == nil { - return "" - } - return *u.HeadBranch -} - -// GetHeadSHA returns the HeadSHA field if it's non-nil, zero value otherwise. -func (u *UpdateCheckRunOptions) GetHeadSHA() string { - if u == nil || u.HeadSHA == nil { - return "" - } - return *u.HeadSHA -} - -// GetOutput returns the Output field. -func (u *UpdateCheckRunOptions) GetOutput() *CheckRunOutput { - if u == nil { - return nil - } - return u.Output -} - -// GetStatus returns the Status field if it's non-nil, zero value otherwise. -func (u *UpdateCheckRunOptions) GetStatus() string { - if u == nil || u.Status == nil { - return "" - } - return *u.Status -} - -// GetAvatarURL returns the AvatarURL field if it's non-nil, zero value otherwise. -func (u *User) GetAvatarURL() string { - if u == nil || u.AvatarURL == nil { - return "" - } - return *u.AvatarURL -} - -// GetBio returns the Bio field if it's non-nil, zero value otherwise. -func (u *User) GetBio() string { - if u == nil || u.Bio == nil { - return "" - } - return *u.Bio -} - -// GetBlog returns the Blog field if it's non-nil, zero value otherwise. -func (u *User) GetBlog() string { - if u == nil || u.Blog == nil { - return "" - } - return *u.Blog -} - -// GetCollaborators returns the Collaborators field if it's non-nil, zero value otherwise. -func (u *User) GetCollaborators() int { - if u == nil || u.Collaborators == nil { - return 0 - } - return *u.Collaborators -} - -// GetCompany returns the Company field if it's non-nil, zero value otherwise. -func (u *User) GetCompany() string { - if u == nil || u.Company == nil { - return "" - } - return *u.Company -} - -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (u *User) GetCreatedAt() Timestamp { - if u == nil || u.CreatedAt == nil { - return Timestamp{} - } - return *u.CreatedAt -} - -// GetDiskUsage returns the DiskUsage field if it's non-nil, zero value otherwise. -func (u *User) GetDiskUsage() int { - if u == nil || u.DiskUsage == nil { - return 0 - } - return *u.DiskUsage -} - -// GetEmail returns the Email field if it's non-nil, zero value otherwise. -func (u *User) GetEmail() string { - if u == nil || u.Email == nil { - return "" - } - return *u.Email -} - -// GetEventsURL returns the EventsURL field if it's non-nil, zero value otherwise. -func (u *User) GetEventsURL() string { - if u == nil || u.EventsURL == nil { - return "" - } - return *u.EventsURL -} - -// GetFollowers returns the Followers field if it's non-nil, zero value otherwise. -func (u *User) GetFollowers() int { - if u == nil || u.Followers == nil { - return 0 - } - return *u.Followers -} - -// GetFollowersURL returns the FollowersURL field if it's non-nil, zero value otherwise. -func (u *User) GetFollowersURL() string { - if u == nil || u.FollowersURL == nil { - return "" - } - return *u.FollowersURL -} - -// GetFollowing returns the Following field if it's non-nil, zero value otherwise. -func (u *User) GetFollowing() int { - if u == nil || u.Following == nil { - return 0 - } - return *u.Following -} - -// GetFollowingURL returns the FollowingURL field if it's non-nil, zero value otherwise. -func (u *User) GetFollowingURL() string { - if u == nil || u.FollowingURL == nil { - return "" - } - return *u.FollowingURL -} - -// GetGistsURL returns the GistsURL field if it's non-nil, zero value otherwise. -func (u *User) GetGistsURL() string { - if u == nil || u.GistsURL == nil { - return "" - } - return *u.GistsURL -} - -// GetGravatarID returns the GravatarID field if it's non-nil, zero value otherwise. -func (u *User) GetGravatarID() string { - if u == nil || u.GravatarID == nil { - return "" - } - return *u.GravatarID -} - -// GetHireable returns the Hireable field if it's non-nil, zero value otherwise. -func (u *User) GetHireable() bool { - if u == nil || u.Hireable == nil { - return false - } - return *u.Hireable -} - -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (u *User) GetHTMLURL() string { - if u == nil || u.HTMLURL == nil { - return "" - } - return *u.HTMLURL -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (u *User) GetID() int64 { - if u == nil || u.ID == nil { - return 0 - } - return *u.ID -} - -// GetLdapDn returns the LdapDn field if it's non-nil, zero value otherwise. -func (u *User) GetLdapDn() string { - if u == nil || u.LdapDn == nil { - return "" - } - return *u.LdapDn -} - -// GetLocation returns the Location field if it's non-nil, zero value otherwise. -func (u *User) GetLocation() string { - if u == nil || u.Location == nil { - return "" - } - return *u.Location -} - -// GetLogin returns the Login field if it's non-nil, zero value otherwise. -func (u *User) GetLogin() string { - if u == nil || u.Login == nil { - return "" - } - return *u.Login -} - -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (u *User) GetName() string { - if u == nil || u.Name == nil { - return "" - } - return *u.Name -} - -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (u *User) GetNodeID() string { - if u == nil || u.NodeID == nil { - return "" - } - return *u.NodeID -} - -// GetOrganizationsURL returns the OrganizationsURL field if it's non-nil, zero value otherwise. -func (u *User) GetOrganizationsURL() string { - if u == nil || u.OrganizationsURL == nil { - return "" - } - return *u.OrganizationsURL -} - -// GetOwnedPrivateRepos returns the OwnedPrivateRepos field if it's non-nil, zero value otherwise. -func (u *User) GetOwnedPrivateRepos() int { - if u == nil || u.OwnedPrivateRepos == nil { - return 0 - } - return *u.OwnedPrivateRepos -} - -// GetPermissions returns the Permissions field if it's non-nil, zero value otherwise. -func (u *User) GetPermissions() map[string]bool { - if u == nil || u.Permissions == nil { - return map[string]bool{} - } - return *u.Permissions -} - -// GetPlan returns the Plan field. -func (u *User) GetPlan() *Plan { - if u == nil { - return nil - } - return u.Plan -} - -// GetPrivateGists returns the PrivateGists field if it's non-nil, zero value otherwise. -func (u *User) GetPrivateGists() int { - if u == nil || u.PrivateGists == nil { - return 0 - } - return *u.PrivateGists -} - -// GetPublicGists returns the PublicGists field if it's non-nil, zero value otherwise. -func (u *User) GetPublicGists() int { - if u == nil || u.PublicGists == nil { - return 0 - } - return *u.PublicGists -} - -// GetPublicRepos returns the PublicRepos field if it's non-nil, zero value otherwise. -func (u *User) GetPublicRepos() int { - if u == nil || u.PublicRepos == nil { - return 0 - } - return *u.PublicRepos -} - -// GetReceivedEventsURL returns the ReceivedEventsURL field if it's non-nil, zero value otherwise. -func (u *User) GetReceivedEventsURL() string { - if u == nil || u.ReceivedEventsURL == nil { - return "" - } - return *u.ReceivedEventsURL -} - -// GetReposURL returns the ReposURL field if it's non-nil, zero value otherwise. -func (u *User) GetReposURL() string { - if u == nil || u.ReposURL == nil { - return "" - } - return *u.ReposURL -} - -// GetSiteAdmin returns the SiteAdmin field if it's non-nil, zero value otherwise. -func (u *User) GetSiteAdmin() bool { - if u == nil || u.SiteAdmin == nil { - return false - } - return *u.SiteAdmin -} - -// GetStarredURL returns the StarredURL field if it's non-nil, zero value otherwise. -func (u *User) GetStarredURL() string { - if u == nil || u.StarredURL == nil { - return "" - } - return *u.StarredURL -} - -// GetSubscriptionsURL returns the SubscriptionsURL field if it's non-nil, zero value otherwise. -func (u *User) GetSubscriptionsURL() string { - if u == nil || u.SubscriptionsURL == nil { - return "" - } - return *u.SubscriptionsURL -} - -// GetSuspendedAt returns the SuspendedAt field if it's non-nil, zero value otherwise. -func (u *User) GetSuspendedAt() Timestamp { - if u == nil || u.SuspendedAt == nil { - return Timestamp{} - } - return *u.SuspendedAt -} - -// GetTotalPrivateRepos returns the TotalPrivateRepos field if it's non-nil, zero value otherwise. -func (u *User) GetTotalPrivateRepos() int { - if u == nil || u.TotalPrivateRepos == nil { - return 0 - } - return *u.TotalPrivateRepos -} - -// GetTwoFactorAuthentication returns the TwoFactorAuthentication field if it's non-nil, zero value otherwise. -func (u *User) GetTwoFactorAuthentication() bool { - if u == nil || u.TwoFactorAuthentication == nil { - return false - } - return *u.TwoFactorAuthentication -} - -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (u *User) GetType() string { - if u == nil || u.Type == nil { - return "" - } - return *u.Type -} - -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (u *User) GetUpdatedAt() Timestamp { - if u == nil || u.UpdatedAt == nil { - return Timestamp{} - } - return *u.UpdatedAt -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (u *User) GetURL() string { - if u == nil || u.URL == nil { - return "" - } - return *u.URL -} - -// GetMessage returns the Message field if it's non-nil, zero value otherwise. -func (u *UserContext) GetMessage() string { - if u == nil || u.Message == nil { - return "" - } - return *u.Message -} - -// GetOcticon returns the Octicon field if it's non-nil, zero value otherwise. -func (u *UserContext) GetOcticon() string { - if u == nil || u.Octicon == nil { - return "" - } - return *u.Octicon -} - -// GetEmail returns the Email field if it's non-nil, zero value otherwise. -func (u *UserEmail) GetEmail() string { - if u == nil || u.Email == nil { - return "" - } - return *u.Email -} - -// GetPrimary returns the Primary field if it's non-nil, zero value otherwise. -func (u *UserEmail) GetPrimary() bool { - if u == nil || u.Primary == nil { - return false - } - return *u.Primary -} - -// GetVerified returns the Verified field if it's non-nil, zero value otherwise. -func (u *UserEmail) GetVerified() bool { - if u == nil || u.Verified == nil { - return false - } - return *u.Verified -} - -// GetVisibility returns the Visibility field if it's non-nil, zero value otherwise. -func (u *UserEmail) GetVisibility() string { - if u == nil || u.Visibility == nil { - return "" - } - return *u.Visibility -} - -// GetAvatarURL returns the AvatarURL field if it's non-nil, zero value otherwise. -func (u *UserLDAPMapping) GetAvatarURL() string { - if u == nil || u.AvatarURL == nil { - return "" - } - return *u.AvatarURL -} - -// GetEventsURL returns the EventsURL field if it's non-nil, zero value otherwise. -func (u *UserLDAPMapping) GetEventsURL() string { - if u == nil || u.EventsURL == nil { - return "" - } - return *u.EventsURL -} - -// GetFollowersURL returns the FollowersURL field if it's non-nil, zero value otherwise. -func (u *UserLDAPMapping) GetFollowersURL() string { - if u == nil || u.FollowersURL == nil { - return "" - } - return *u.FollowersURL -} - -// GetFollowingURL returns the FollowingURL field if it's non-nil, zero value otherwise. -func (u *UserLDAPMapping) GetFollowingURL() string { - if u == nil || u.FollowingURL == nil { - return "" - } - return *u.FollowingURL -} - -// GetGistsURL returns the GistsURL field if it's non-nil, zero value otherwise. -func (u *UserLDAPMapping) GetGistsURL() string { - if u == nil || u.GistsURL == nil { - return "" - } - return *u.GistsURL -} - -// GetGravatarID returns the GravatarID field if it's non-nil, zero value otherwise. -func (u *UserLDAPMapping) GetGravatarID() string { - if u == nil || u.GravatarID == nil { - return "" - } - return *u.GravatarID -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (u *UserLDAPMapping) GetID() int64 { - if u == nil || u.ID == nil { - return 0 - } - return *u.ID -} - -// GetLDAPDN returns the LDAPDN field if it's non-nil, zero value otherwise. -func (u *UserLDAPMapping) GetLDAPDN() string { - if u == nil || u.LDAPDN == nil { - return "" - } - return *u.LDAPDN -} - -// GetLogin returns the Login field if it's non-nil, zero value otherwise. -func (u *UserLDAPMapping) GetLogin() string { - if u == nil || u.Login == nil { - return "" - } - return *u.Login -} - -// GetOrganizationsURL returns the OrganizationsURL field if it's non-nil, zero value otherwise. -func (u *UserLDAPMapping) GetOrganizationsURL() string { - if u == nil || u.OrganizationsURL == nil { - return "" - } - return *u.OrganizationsURL -} - -// GetReceivedEventsURL returns the ReceivedEventsURL field if it's non-nil, zero value otherwise. -func (u *UserLDAPMapping) GetReceivedEventsURL() string { - if u == nil || u.ReceivedEventsURL == nil { - return "" - } - return *u.ReceivedEventsURL -} - -// GetReposURL returns the ReposURL field if it's non-nil, zero value otherwise. -func (u *UserLDAPMapping) GetReposURL() string { - if u == nil || u.ReposURL == nil { - return "" - } - return *u.ReposURL -} - -// GetSiteAdmin returns the SiteAdmin field if it's non-nil, zero value otherwise. -func (u *UserLDAPMapping) GetSiteAdmin() bool { - if u == nil || u.SiteAdmin == nil { - return false - } - return *u.SiteAdmin -} - -// GetStarredURL returns the StarredURL field if it's non-nil, zero value otherwise. -func (u *UserLDAPMapping) GetStarredURL() string { - if u == nil || u.StarredURL == nil { - return "" - } - return *u.StarredURL -} - -// GetSubscriptionsURL returns the SubscriptionsURL field if it's non-nil, zero value otherwise. -func (u *UserLDAPMapping) GetSubscriptionsURL() string { - if u == nil || u.SubscriptionsURL == nil { - return "" - } - return *u.SubscriptionsURL -} - -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (u *UserLDAPMapping) GetType() string { - if u == nil || u.Type == nil { - return "" - } - return *u.Type -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (u *UserLDAPMapping) GetURL() string { - if u == nil || u.URL == nil { - return "" - } - return *u.URL -} - -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (u *UserMigration) GetCreatedAt() string { - if u == nil || u.CreatedAt == nil { - return "" - } - return *u.CreatedAt -} - -// GetExcludeAttachments returns the ExcludeAttachments field if it's non-nil, zero value otherwise. -func (u *UserMigration) GetExcludeAttachments() bool { - if u == nil || u.ExcludeAttachments == nil { - return false - } - return *u.ExcludeAttachments -} - -// GetGUID returns the GUID field if it's non-nil, zero value otherwise. -func (u *UserMigration) GetGUID() string { - if u == nil || u.GUID == nil { - return "" - } - return *u.GUID -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (u *UserMigration) GetID() int64 { - if u == nil || u.ID == nil { - return 0 - } - return *u.ID -} - -// GetLockRepositories returns the LockRepositories field if it's non-nil, zero value otherwise. -func (u *UserMigration) GetLockRepositories() bool { - if u == nil || u.LockRepositories == nil { - return false - } - return *u.LockRepositories -} - -// GetState returns the State field if it's non-nil, zero value otherwise. -func (u *UserMigration) GetState() string { - if u == nil || u.State == nil { - return "" - } - return *u.State -} - -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (u *UserMigration) GetUpdatedAt() string { - if u == nil || u.UpdatedAt == nil { - return "" - } - return *u.UpdatedAt -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (u *UserMigration) GetURL() string { - if u == nil || u.URL == nil { - return "" - } - return *u.URL -} - -// GetIncompleteResults returns the IncompleteResults field if it's non-nil, zero value otherwise. -func (u *UsersSearchResult) GetIncompleteResults() bool { - if u == nil || u.IncompleteResults == nil { - return false - } - return *u.IncompleteResults -} - -// GetTotal returns the Total field if it's non-nil, zero value otherwise. -func (u *UsersSearchResult) GetTotal() int { - if u == nil || u.Total == nil { - return 0 - } - return *u.Total -} - -// GetAdminUsers returns the AdminUsers field if it's non-nil, zero value otherwise. -func (u *UserStats) GetAdminUsers() int { - if u == nil || u.AdminUsers == nil { - return 0 - } - return *u.AdminUsers -} - -// GetSuspendedUsers returns the SuspendedUsers field if it's non-nil, zero value otherwise. -func (u *UserStats) GetSuspendedUsers() int { - if u == nil || u.SuspendedUsers == nil { - return 0 - } - return *u.SuspendedUsers -} - -// GetTotalUsers returns the TotalUsers field if it's non-nil, zero value otherwise. -func (u *UserStats) GetTotalUsers() int { - if u == nil || u.TotalUsers == nil { - return 0 - } - return *u.TotalUsers -} - -// GetReason returns the Reason field if it's non-nil, zero value otherwise. -func (u *UserSuspendOptions) GetReason() string { - if u == nil || u.Reason == nil { - return "" - } - return *u.Reason -} - -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (w *WatchEvent) GetAction() string { - if w == nil || w.Action == nil { - return "" - } - return *w.Action -} - -// GetInstallation returns the Installation field. -func (w *WatchEvent) GetInstallation() *Installation { - if w == nil { - return nil - } - return w.Installation -} - -// GetRepo returns the Repo field. -func (w *WatchEvent) GetRepo() *Repository { - if w == nil { - return nil - } - return w.Repo -} - -// GetSender returns the Sender field. -func (w *WatchEvent) GetSender() *User { - if w == nil { - return nil - } - return w.Sender -} - -// GetEmail returns the Email field if it's non-nil, zero value otherwise. -func (w *WebHookAuthor) GetEmail() string { - if w == nil || w.Email == nil { - return "" - } - return *w.Email -} - -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (w *WebHookAuthor) GetName() string { - if w == nil || w.Name == nil { - return "" - } - return *w.Name -} - -// GetUsername returns the Username field if it's non-nil, zero value otherwise. -func (w *WebHookAuthor) GetUsername() string { - if w == nil || w.Username == nil { - return "" - } - return *w.Username -} - -// GetAuthor returns the Author field. -func (w *WebHookCommit) GetAuthor() *WebHookAuthor { - if w == nil { - return nil - } - return w.Author -} - -// GetCommitter returns the Committer field. -func (w *WebHookCommit) GetCommitter() *WebHookAuthor { - if w == nil { - return nil - } - return w.Committer -} - -// GetDistinct returns the Distinct field if it's non-nil, zero value otherwise. -func (w *WebHookCommit) GetDistinct() bool { - if w == nil || w.Distinct == nil { - return false - } - return *w.Distinct -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (w *WebHookCommit) GetID() string { - if w == nil || w.ID == nil { - return "" - } - return *w.ID -} - -// GetMessage returns the Message field if it's non-nil, zero value otherwise. -func (w *WebHookCommit) GetMessage() string { - if w == nil || w.Message == nil { - return "" - } - return *w.Message -} - -// GetTimestamp returns the Timestamp field if it's non-nil, zero value otherwise. -func (w *WebHookCommit) GetTimestamp() time.Time { - if w == nil || w.Timestamp == nil { - return time.Time{} - } - return *w.Timestamp -} - -// GetAfter returns the After field if it's non-nil, zero value otherwise. -func (w *WebHookPayload) GetAfter() string { - if w == nil || w.After == nil { - return "" - } - return *w.After -} - -// GetBefore returns the Before field if it's non-nil, zero value otherwise. -func (w *WebHookPayload) GetBefore() string { - if w == nil || w.Before == nil { - return "" - } - return *w.Before -} - -// GetCompare returns the Compare field if it's non-nil, zero value otherwise. -func (w *WebHookPayload) GetCompare() string { - if w == nil || w.Compare == nil { - return "" - } - return *w.Compare -} - -// GetCreated returns the Created field if it's non-nil, zero value otherwise. -func (w *WebHookPayload) GetCreated() bool { - if w == nil || w.Created == nil { - return false - } - return *w.Created -} - -// GetDeleted returns the Deleted field if it's non-nil, zero value otherwise. -func (w *WebHookPayload) GetDeleted() bool { - if w == nil || w.Deleted == nil { - return false - } - return *w.Deleted -} - -// GetForced returns the Forced field if it's non-nil, zero value otherwise. -func (w *WebHookPayload) GetForced() bool { - if w == nil || w.Forced == nil { - return false - } - return *w.Forced -} - -// GetHeadCommit returns the HeadCommit field. -func (w *WebHookPayload) GetHeadCommit() *WebHookCommit { - if w == nil { - return nil - } - return w.HeadCommit -} - -// GetPusher returns the Pusher field. -func (w *WebHookPayload) GetPusher() *User { - if w == nil { - return nil - } - return w.Pusher -} - -// GetRef returns the Ref field if it's non-nil, zero value otherwise. -func (w *WebHookPayload) GetRef() string { - if w == nil || w.Ref == nil { - return "" - } - return *w.Ref -} - -// GetRepo returns the Repo field. -func (w *WebHookPayload) GetRepo() *Repository { - if w == nil { - return nil - } - return w.Repo -} - -// GetSender returns the Sender field. -func (w *WebHookPayload) GetSender() *User { - if w == nil { - return nil - } - return w.Sender -} - -// GetTotal returns the Total field if it's non-nil, zero value otherwise. -func (w *WeeklyCommitActivity) GetTotal() int { - if w == nil || w.Total == nil { - return 0 - } - return *w.Total -} - -// GetWeek returns the Week field if it's non-nil, zero value otherwise. -func (w *WeeklyCommitActivity) GetWeek() Timestamp { - if w == nil || w.Week == nil { - return Timestamp{} - } - return *w.Week -} - -// GetAdditions returns the Additions field if it's non-nil, zero value otherwise. -func (w *WeeklyStats) GetAdditions() int { - if w == nil || w.Additions == nil { - return 0 - } - return *w.Additions -} - -// GetCommits returns the Commits field if it's non-nil, zero value otherwise. -func (w *WeeklyStats) GetCommits() int { - if w == nil || w.Commits == nil { - return 0 - } - return *w.Commits -} - -// GetDeletions returns the Deletions field if it's non-nil, zero value otherwise. -func (w *WeeklyStats) GetDeletions() int { - if w == nil || w.Deletions == nil { - return 0 - } - return *w.Deletions -} - -// GetWeek returns the Week field if it's non-nil, zero value otherwise. -func (w *WeeklyStats) GetWeek() Timestamp { - if w == nil || w.Week == nil { - return Timestamp{} - } - return *w.Week -} diff --git a/vendor/github.com/google/go-github/v27/github/github.go b/vendor/github.com/google/go-github/v27/github/github.go deleted file mode 100644 index 6ab801f22841..000000000000 --- a/vendor/github.com/google/go-github/v27/github/github.go +++ /dev/null @@ -1,1047 +0,0 @@ -// Copyright 2013 The go-github AUTHORS. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:generate go run gen-accessors.go -//go:generate go run gen-stringify-test.go - -package github - -import ( - "bytes" - "context" - "encoding/json" - "errors" - "fmt" - "io" - "io/ioutil" - "net/http" - "net/url" - "reflect" - "strconv" - "strings" - "sync" - "time" - - "github.com/google/go-querystring/query" -) - -const ( - defaultBaseURL = "https://api.github.com/" - uploadBaseURL = "https://uploads.github.com/" - userAgent = "go-github" - - headerRateLimit = "X-RateLimit-Limit" - headerRateRemaining = "X-RateLimit-Remaining" - headerRateReset = "X-RateLimit-Reset" - headerOTP = "X-GitHub-OTP" - - mediaTypeV3 = "application/vnd.github.v3+json" - defaultMediaType = "application/octet-stream" - mediaTypeV3SHA = "application/vnd.github.v3.sha" - mediaTypeV3Diff = "application/vnd.github.v3.diff" - mediaTypeV3Patch = "application/vnd.github.v3.patch" - mediaTypeOrgPermissionRepo = "application/vnd.github.v3.repository+json" - - // Media Type values to access preview APIs - - // https://developer.github.com/changes/2014-12-09-new-attributes-for-stars-api/ - mediaTypeStarringPreview = "application/vnd.github.v3.star+json" - - // https://help.github.com/enterprise/2.4/admin/guides/migrations/exporting-the-github-com-organization-s-repositories/ - mediaTypeMigrationsPreview = "application/vnd.github.wyandotte-preview+json" - - // https://developer.github.com/changes/2016-04-06-deployment-and-deployment-status-enhancements/ - mediaTypeDeploymentStatusPreview = "application/vnd.github.ant-man-preview+json" - - // https://developer.github.com/changes/2018-10-16-deployments-environments-states-and-auto-inactive-updates/ - mediaTypeExpandDeploymentStatusPreview = "application/vnd.github.flash-preview+json" - - // https://developer.github.com/changes/2016-02-19-source-import-preview-api/ - mediaTypeImportPreview = "application/vnd.github.barred-rock-preview" - - // https://developer.github.com/changes/2016-05-12-reactions-api-preview/ - mediaTypeReactionsPreview = "application/vnd.github.squirrel-girl-preview" - - // https://developer.github.com/changes/2016-05-23-timeline-preview-api/ - mediaTypeTimelinePreview = "application/vnd.github.mockingbird-preview+json" - - // https://developer.github.com/changes/2016-07-06-github-pages-preiew-api/ - mediaTypePagesPreview = "application/vnd.github.mister-fantastic-preview+json" - - // https://developer.github.com/changes/2016-09-14-projects-api/ - mediaTypeProjectsPreview = "application/vnd.github.inertia-preview+json" - - // https://developer.github.com/changes/2016-09-14-Integrations-Early-Access/ - mediaTypeIntegrationPreview = "application/vnd.github.machine-man-preview+json" - - // https://developer.github.com/changes/2017-01-05-commit-search-api/ - mediaTypeCommitSearchPreview = "application/vnd.github.cloak-preview+json" - - // https://developer.github.com/changes/2017-02-28-user-blocking-apis-and-webhook/ - mediaTypeBlockUsersPreview = "application/vnd.github.giant-sentry-fist-preview+json" - - // https://developer.github.com/changes/2017-02-09-community-health/ - mediaTypeRepositoryCommunityHealthMetricsPreview = "application/vnd.github.black-panther-preview+json" - - // https://developer.github.com/changes/2017-05-23-coc-api/ - mediaTypeCodesOfConductPreview = "application/vnd.github.scarlet-witch-preview+json" - - // https://developer.github.com/changes/2017-07-17-update-topics-on-repositories/ - mediaTypeTopicsPreview = "application/vnd.github.mercy-preview+json" - - // https://developer.github.com/changes/2017-08-30-preview-nested-teams/ - mediaTypeNestedTeamsPreview = "application/vnd.github.hellcat-preview+json" - - // https://developer.github.com/changes/2017-11-09-repository-transfer-api-preview/ - mediaTypeRepositoryTransferPreview = "application/vnd.github.nightshade-preview+json" - - // https://developer.github.com/changes/2018-01-25-organization-invitation-api-preview/ - mediaTypeOrganizationInvitationPreview = "application/vnd.github.dazzler-preview+json" - - // https://developer.github.com/changes/2018-03-16-protected-branches-required-approving-reviews/ - mediaTypeRequiredApprovingReviewsPreview = "application/vnd.github.luke-cage-preview+json" - - // https://developer.github.com/changes/2018-02-22-label-description-search-preview/ - mediaTypeLabelDescriptionSearchPreview = "application/vnd.github.symmetra-preview+json" - - // https://developer.github.com/changes/2018-02-07-team-discussions-api/ - mediaTypeTeamDiscussionsPreview = "application/vnd.github.echo-preview+json" - - // https://developer.github.com/changes/2018-03-21-hovercard-api-preview/ - mediaTypeHovercardPreview = "application/vnd.github.hagar-preview+json" - - // https://developer.github.com/changes/2018-01-10-lock-reason-api-preview/ - mediaTypeLockReasonPreview = "application/vnd.github.sailor-v-preview+json" - - // https://developer.github.com/changes/2018-05-07-new-checks-api-public-beta/ - mediaTypeCheckRunsPreview = "application/vnd.github.antiope-preview+json" - - // https://developer.github.com/enterprise/2.13/v3/repos/pre_receive_hooks/ - mediaTypePreReceiveHooksPreview = "application/vnd.github.eye-scream-preview" - - // https://developer.github.com/changes/2018-02-22-protected-branches-required-signatures/ - mediaTypeSignaturePreview = "application/vnd.github.zzzax-preview+json" - - // https://developer.github.com/changes/2018-09-05-project-card-events/ - mediaTypeProjectCardDetailsPreview = "application/vnd.github.starfox-preview+json" - - // https://developer.github.com/changes/2018-12-18-interactions-preview/ - mediaTypeInteractionRestrictionsPreview = "application/vnd.github.sombra-preview+json" - - // https://developer.github.com/changes/2019-02-14-draft-pull-requests/ - mediaTypeDraftPreview = "application/vnd.github.shadow-cat-preview+json" - - // https://developer.github.com/changes/2019-03-14-enabling-disabling-pages/ - mediaTypeEnablePagesAPIPreview = "application/vnd.github.switcheroo-preview+json" - - // https://developer.github.com/changes/2019-04-24-vulnerability-alerts/ - mediaTypeRequiredVulnerabilityAlertsPreview = "application/vnd.github.dorian-preview+json" - - // https://developer.github.com/changes/2019-06-04-automated-security-fixes/ - mediaTypeRequiredAutomatedSecurityFixesPreview = "application/vnd.github.london-preview+json" - - // https://developer.github.com/changes/2019-05-29-update-branch-api/ - mediaTypeUpdatePullRequestBranchPreview = "application/vnd.github.lydian-preview+json" - - // https://developer.github.com/changes/2019-04-11-pulls-branches-for-commit/ - mediaTypeListPullsOrBranchesForCommitPreview = "application/vnd.github.groot-preview+json" - - // https://developer.github.com/changes/2019-06-12-team-sync/ - mediaTypeTeamSyncPreview = "application/vnd.github.team-sync-preview+json" - - // https://developer.github.com/v3/previews/#repository-creation-permissions - mediaTypeMemberAllowedRepoCreationTypePreview = "application/vnd.github.surtur-preview+json" - - // https://developer.github.com/v3/previews/#create-and-use-repository-templates - mediaTypeRepositoryTemplatePreview = "application/vnd.github.baptiste-preview+json" -) - -// A Client manages communication with the GitHub API. -type Client struct { - clientMu sync.Mutex // clientMu protects the client during calls that modify the CheckRedirect func. - client *http.Client // HTTP client used to communicate with the API. - - // Base URL for API requests. Defaults to the public GitHub API, but can be - // set to a domain endpoint to use with GitHub Enterprise. BaseURL should - // always be specified with a trailing slash. - BaseURL *url.URL - - // Base URL for uploading files. - UploadURL *url.URL - - // User agent used when communicating with the GitHub API. - UserAgent string - - rateMu sync.Mutex - rateLimits [categories]Rate // Rate limits for the client as determined by the most recent API calls. - - common service // Reuse a single struct instead of allocating one for each service on the heap. - - // Services used for talking to different parts of the GitHub API. - Activity *ActivityService - Admin *AdminService - Apps *AppsService - Authorizations *AuthorizationsService - Checks *ChecksService - Gists *GistsService - Git *GitService - Gitignores *GitignoresService - Interactions *InteractionsService - Issues *IssuesService - Licenses *LicensesService - Marketplace *MarketplaceService - Migrations *MigrationService - Organizations *OrganizationsService - Projects *ProjectsService - PullRequests *PullRequestsService - Reactions *ReactionsService - Repositories *RepositoriesService - Search *SearchService - Teams *TeamsService - Users *UsersService -} - -type service struct { - client *Client -} - -// ListOptions specifies the optional parameters to various List methods that -// support pagination. -type ListOptions struct { - // For paginated result sets, page of results to retrieve. - Page int `url:"page,omitempty"` - - // For paginated result sets, the number of results to include per page. - PerPage int `url:"per_page,omitempty"` -} - -// UploadOptions specifies the parameters to methods that support uploads. -type UploadOptions struct { - Name string `url:"name,omitempty"` - Label string `url:"label,omitempty"` - MediaType string `url:"-"` -} - -// RawType represents type of raw format of a request instead of JSON. -type RawType uint8 - -const ( - // Diff format. - Diff RawType = 1 + iota - // Patch format. - Patch -) - -// RawOptions specifies parameters when user wants to get raw format of -// a response instead of JSON. -type RawOptions struct { - Type RawType -} - -// addOptions adds the parameters in opt as URL query parameters to s. opt -// must be a struct whose fields may contain "url" tags. -func addOptions(s string, opt interface{}) (string, error) { - v := reflect.ValueOf(opt) - if v.Kind() == reflect.Ptr && v.IsNil() { - return s, nil - } - - u, err := url.Parse(s) - if err != nil { - return s, err - } - - qs, err := query.Values(opt) - if err != nil { - return s, err - } - - u.RawQuery = qs.Encode() - return u.String(), nil -} - -// NewClient returns a new GitHub API client. If a nil httpClient is -// provided, a new http.Client will be used. To use API methods which require -// authentication, provide an http.Client that will perform the authentication -// for you (such as that provided by the golang.org/x/oauth2 library). -func NewClient(httpClient *http.Client) *Client { - if httpClient == nil { - httpClient = &http.Client{} - } - baseURL, _ := url.Parse(defaultBaseURL) - uploadURL, _ := url.Parse(uploadBaseURL) - - c := &Client{client: httpClient, BaseURL: baseURL, UserAgent: userAgent, UploadURL: uploadURL} - c.common.client = c - c.Activity = (*ActivityService)(&c.common) - c.Admin = (*AdminService)(&c.common) - c.Apps = (*AppsService)(&c.common) - c.Authorizations = (*AuthorizationsService)(&c.common) - c.Checks = (*ChecksService)(&c.common) - c.Gists = (*GistsService)(&c.common) - c.Git = (*GitService)(&c.common) - c.Gitignores = (*GitignoresService)(&c.common) - c.Interactions = (*InteractionsService)(&c.common) - c.Issues = (*IssuesService)(&c.common) - c.Licenses = (*LicensesService)(&c.common) - c.Marketplace = &MarketplaceService{client: c} - c.Migrations = (*MigrationService)(&c.common) - c.Organizations = (*OrganizationsService)(&c.common) - c.Projects = (*ProjectsService)(&c.common) - c.PullRequests = (*PullRequestsService)(&c.common) - c.Reactions = (*ReactionsService)(&c.common) - c.Repositories = (*RepositoriesService)(&c.common) - c.Search = (*SearchService)(&c.common) - c.Teams = (*TeamsService)(&c.common) - c.Users = (*UsersService)(&c.common) - return c -} - -// NewEnterpriseClient returns a new GitHub API client with provided -// base URL and upload URL (often the same URL). -// If either URL does not have a trailing slash, one is added automatically. -// If a nil httpClient is provided, a new http.Client will be used. -// -// Note that NewEnterpriseClient is a convenience helper only; -// its behavior is equivalent to using NewClient, followed by setting -// the BaseURL and UploadURL fields. -func NewEnterpriseClient(baseURL, uploadURL string, httpClient *http.Client) (*Client, error) { - baseEndpoint, err := url.Parse(baseURL) - if err != nil { - return nil, err - } - if !strings.HasSuffix(baseEndpoint.Path, "/") { - baseEndpoint.Path += "/" - } - - uploadEndpoint, err := url.Parse(uploadURL) - if err != nil { - return nil, err - } - if !strings.HasSuffix(uploadEndpoint.Path, "/") { - uploadEndpoint.Path += "/" - } - - c := NewClient(httpClient) - c.BaseURL = baseEndpoint - c.UploadURL = uploadEndpoint - return c, nil -} - -// NewRequest creates an API request. A relative URL can be provided in urlStr, -// in which case it is resolved relative to the BaseURL of the Client. -// Relative URLs should always be specified without a preceding slash. If -// specified, the value pointed to by body is JSON encoded and included as the -// request body. -func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error) { - if !strings.HasSuffix(c.BaseURL.Path, "/") { - return nil, fmt.Errorf("BaseURL must have a trailing slash, but %q does not", c.BaseURL) - } - u, err := c.BaseURL.Parse(urlStr) - if err != nil { - return nil, err - } - - var buf io.ReadWriter - if body != nil { - buf = new(bytes.Buffer) - enc := json.NewEncoder(buf) - enc.SetEscapeHTML(false) - err := enc.Encode(body) - if err != nil { - return nil, err - } - } - - req, err := http.NewRequest(method, u.String(), buf) - if err != nil { - return nil, err - } - - if body != nil { - req.Header.Set("Content-Type", "application/json") - } - req.Header.Set("Accept", mediaTypeV3) - if c.UserAgent != "" { - req.Header.Set("User-Agent", c.UserAgent) - } - return req, nil -} - -// NewUploadRequest creates an upload request. A relative URL can be provided in -// urlStr, in which case it is resolved relative to the UploadURL of the Client. -// Relative URLs should always be specified without a preceding slash. -func (c *Client) NewUploadRequest(urlStr string, reader io.Reader, size int64, mediaType string) (*http.Request, error) { - if !strings.HasSuffix(c.UploadURL.Path, "/") { - return nil, fmt.Errorf("UploadURL must have a trailing slash, but %q does not", c.UploadURL) - } - u, err := c.UploadURL.Parse(urlStr) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", u.String(), reader) - if err != nil { - return nil, err - } - req.ContentLength = size - - if mediaType == "" { - mediaType = defaultMediaType - } - req.Header.Set("Content-Type", mediaType) - req.Header.Set("Accept", mediaTypeV3) - req.Header.Set("User-Agent", c.UserAgent) - return req, nil -} - -// Response is a GitHub API response. This wraps the standard http.Response -// returned from GitHub and provides convenient access to things like -// pagination links. -type Response struct { - *http.Response - - // These fields provide the page values for paginating through a set of - // results. Any or all of these may be set to the zero value for - // responses that are not part of a paginated set, or for which there - // are no additional pages. - - NextPage int - PrevPage int - FirstPage int - LastPage int - - // Explicitly specify the Rate type so Rate's String() receiver doesn't - // propagate to Response. - Rate Rate -} - -// newResponse creates a new Response for the provided http.Response. -// r must not be nil. -func newResponse(r *http.Response) *Response { - response := &Response{Response: r} - response.populatePageValues() - response.Rate = parseRate(r) - return response -} - -// populatePageValues parses the HTTP Link response headers and populates the -// various pagination link values in the Response. -func (r *Response) populatePageValues() { - if links, ok := r.Response.Header["Link"]; ok && len(links) > 0 { - for _, link := range strings.Split(links[0], ",") { - segments := strings.Split(strings.TrimSpace(link), ";") - - // link must at least have href and rel - if len(segments) < 2 { - continue - } - - // ensure href is properly formatted - if !strings.HasPrefix(segments[0], "<") || !strings.HasSuffix(segments[0], ">") { - continue - } - - // try to pull out page parameter - url, err := url.Parse(segments[0][1 : len(segments[0])-1]) - if err != nil { - continue - } - page := url.Query().Get("page") - if page == "" { - continue - } - - for _, segment := range segments[1:] { - switch strings.TrimSpace(segment) { - case `rel="next"`: - r.NextPage, _ = strconv.Atoi(page) - case `rel="prev"`: - r.PrevPage, _ = strconv.Atoi(page) - case `rel="first"`: - r.FirstPage, _ = strconv.Atoi(page) - case `rel="last"`: - r.LastPage, _ = strconv.Atoi(page) - } - - } - } - } -} - -// parseRate parses the rate related headers. -func parseRate(r *http.Response) Rate { - var rate Rate - if limit := r.Header.Get(headerRateLimit); limit != "" { - rate.Limit, _ = strconv.Atoi(limit) - } - if remaining := r.Header.Get(headerRateRemaining); remaining != "" { - rate.Remaining, _ = strconv.Atoi(remaining) - } - if reset := r.Header.Get(headerRateReset); reset != "" { - if v, _ := strconv.ParseInt(reset, 10, 64); v != 0 { - rate.Reset = Timestamp{time.Unix(v, 0)} - } - } - return rate -} - -// Do sends an API request and returns the API response. The API response is -// JSON decoded and stored in the value pointed to by v, or returned as an -// error if an API error has occurred. If v implements the io.Writer -// interface, the raw response body will be written to v, without attempting to -// first decode it. If rate limit is exceeded and reset time is in the future, -// Do returns *RateLimitError immediately without making a network API call. -// -// The provided ctx must be non-nil. If it is canceled or times out, -// ctx.Err() will be returned. -func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*Response, error) { - req = withContext(ctx, req) - - rateLimitCategory := category(req.URL.Path) - - // If we've hit rate limit, don't make further requests before Reset time. - if err := c.checkRateLimitBeforeDo(req, rateLimitCategory); err != nil { - return &Response{ - Response: err.Response, - Rate: err.Rate, - }, err - } - - resp, err := c.client.Do(req) - if err != nil { - // If we got an error, and the context has been canceled, - // the context's error is probably more useful. - select { - case <-ctx.Done(): - return nil, ctx.Err() - default: - } - - // If the error type is *url.Error, sanitize its URL before returning. - if e, ok := err.(*url.Error); ok { - if url, err := url.Parse(e.URL); err == nil { - e.URL = sanitizeURL(url).String() - return nil, e - } - } - - return nil, err - } - defer resp.Body.Close() - - response := newResponse(resp) - - c.rateMu.Lock() - c.rateLimits[rateLimitCategory] = response.Rate - c.rateMu.Unlock() - - err = CheckResponse(resp) - if err != nil { - // Special case for AcceptedErrors. If an AcceptedError - // has been encountered, the response's payload will be - // added to the AcceptedError and returned. - // - // Issue #1022 - aerr, ok := err.(*AcceptedError) - if ok { - b, readErr := ioutil.ReadAll(resp.Body) - if readErr != nil { - return response, readErr - } - - aerr.Raw = b - return response, aerr - } - - return response, err - } - - if v != nil { - if w, ok := v.(io.Writer); ok { - io.Copy(w, resp.Body) - } else { - decErr := json.NewDecoder(resp.Body).Decode(v) - if decErr == io.EOF { - decErr = nil // ignore EOF errors caused by empty response body - } - if decErr != nil { - err = decErr - } - } - } - - return response, err -} - -// checkRateLimitBeforeDo does not make any network calls, but uses existing knowledge from -// current client state in order to quickly check if *RateLimitError can be immediately returned -// from Client.Do, and if so, returns it so that Client.Do can skip making a network API call unnecessarily. -// Otherwise it returns nil, and Client.Do should proceed normally. -func (c *Client) checkRateLimitBeforeDo(req *http.Request, rateLimitCategory rateLimitCategory) *RateLimitError { - c.rateMu.Lock() - rate := c.rateLimits[rateLimitCategory] - c.rateMu.Unlock() - if !rate.Reset.Time.IsZero() && rate.Remaining == 0 && time.Now().Before(rate.Reset.Time) { - // Create a fake response. - resp := &http.Response{ - Status: http.StatusText(http.StatusForbidden), - StatusCode: http.StatusForbidden, - Request: req, - Header: make(http.Header), - Body: ioutil.NopCloser(strings.NewReader("")), - } - return &RateLimitError{ - Rate: rate, - Response: resp, - Message: fmt.Sprintf("API rate limit of %v still exceeded until %v, not making remote request.", rate.Limit, rate.Reset.Time), - } - } - - return nil -} - -/* -An ErrorResponse reports one or more errors caused by an API request. - -GitHub API docs: https://developer.github.com/v3/#client-errors -*/ -type ErrorResponse struct { - Response *http.Response // HTTP response that caused this error - Message string `json:"message"` // error message - Errors []Error `json:"errors"` // more detail on individual errors - // Block is only populated on certain types of errors such as code 451. - // See https://developer.github.com/changes/2016-03-17-the-451-status-code-is-now-supported/ - // for more information. - Block *struct { - Reason string `json:"reason,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - } `json:"block,omitempty"` - // Most errors will also include a documentation_url field pointing - // to some content that might help you resolve the error, see - // https://developer.github.com/v3/#client-errors - DocumentationURL string `json:"documentation_url,omitempty"` -} - -func (r *ErrorResponse) Error() string { - return fmt.Sprintf("%v %v: %d %v %+v", - r.Response.Request.Method, sanitizeURL(r.Response.Request.URL), - r.Response.StatusCode, r.Message, r.Errors) -} - -// TwoFactorAuthError occurs when using HTTP Basic Authentication for a user -// that has two-factor authentication enabled. The request can be reattempted -// by providing a one-time password in the request. -type TwoFactorAuthError ErrorResponse - -func (r *TwoFactorAuthError) Error() string { return (*ErrorResponse)(r).Error() } - -// RateLimitError occurs when GitHub returns 403 Forbidden response with a rate limit -// remaining value of 0, and error message starts with "API rate limit exceeded for ". -type RateLimitError struct { - Rate Rate // Rate specifies last known rate limit for the client - Response *http.Response // HTTP response that caused this error - Message string `json:"message"` // error message -} - -func (r *RateLimitError) Error() string { - return fmt.Sprintf("%v %v: %d %v %v", - r.Response.Request.Method, sanitizeURL(r.Response.Request.URL), - r.Response.StatusCode, r.Message, formatRateReset(time.Until(r.Rate.Reset.Time))) -} - -// AcceptedError occurs when GitHub returns 202 Accepted response with an -// empty body, which means a job was scheduled on the GitHub side to process -// the information needed and cache it. -// Technically, 202 Accepted is not a real error, it's just used to -// indicate that results are not ready yet, but should be available soon. -// The request can be repeated after some time. -type AcceptedError struct { - // Raw contains the response body. - Raw []byte -} - -func (*AcceptedError) Error() string { - return "job scheduled on GitHub side; try again later" -} - -// AbuseRateLimitError occurs when GitHub returns 403 Forbidden response with the -// "documentation_url" field value equal to "https://developer.github.com/v3/#abuse-rate-limits". -type AbuseRateLimitError struct { - Response *http.Response // HTTP response that caused this error - Message string `json:"message"` // error message - - // RetryAfter is provided with some abuse rate limit errors. If present, - // it is the amount of time that the client should wait before retrying. - // Otherwise, the client should try again later (after an unspecified amount of time). - RetryAfter *time.Duration -} - -func (r *AbuseRateLimitError) Error() string { - return fmt.Sprintf("%v %v: %d %v", - r.Response.Request.Method, sanitizeURL(r.Response.Request.URL), - r.Response.StatusCode, r.Message) -} - -// sanitizeURL redacts the client_secret parameter from the URL which may be -// exposed to the user. -func sanitizeURL(uri *url.URL) *url.URL { - if uri == nil { - return nil - } - params := uri.Query() - if len(params.Get("client_secret")) > 0 { - params.Set("client_secret", "REDACTED") - uri.RawQuery = params.Encode() - } - return uri -} - -/* -An Error reports more details on an individual error in an ErrorResponse. -These are the possible validation error codes: - - missing: - resource does not exist - missing_field: - a required field on a resource has not been set - invalid: - the formatting of a field is invalid - already_exists: - another resource has the same valid as this field - custom: - some resources return this (e.g. github.User.CreateKey()), additional - information is set in the Message field of the Error - -GitHub API docs: https://developer.github.com/v3/#client-errors -*/ -type Error struct { - Resource string `json:"resource"` // resource on which the error occurred - Field string `json:"field"` // field on which the error occurred - Code string `json:"code"` // validation error code - Message string `json:"message"` // Message describing the error. Errors with Code == "custom" will always have this set. -} - -func (e *Error) Error() string { - return fmt.Sprintf("%v error caused by %v field on %v resource", - e.Code, e.Field, e.Resource) -} - -// CheckResponse checks the API response for errors, and returns them if -// present. A response is considered an error if it has a status code outside -// the 200 range or equal to 202 Accepted. -// API error responses are expected to have either no response -// body, or a JSON response body that maps to ErrorResponse. Any other -// response body will be silently ignored. -// -// The error type will be *RateLimitError for rate limit exceeded errors, -// *AcceptedError for 202 Accepted status codes, -// and *TwoFactorAuthError for two-factor authentication errors. -func CheckResponse(r *http.Response) error { - if r.StatusCode == http.StatusAccepted { - return &AcceptedError{} - } - if c := r.StatusCode; 200 <= c && c <= 299 { - return nil - } - errorResponse := &ErrorResponse{Response: r} - data, err := ioutil.ReadAll(r.Body) - if err == nil && data != nil { - json.Unmarshal(data, errorResponse) - } - switch { - case r.StatusCode == http.StatusUnauthorized && strings.HasPrefix(r.Header.Get(headerOTP), "required"): - return (*TwoFactorAuthError)(errorResponse) - case r.StatusCode == http.StatusForbidden && r.Header.Get(headerRateRemaining) == "0" && strings.HasPrefix(errorResponse.Message, "API rate limit exceeded for "): - return &RateLimitError{ - Rate: parseRate(r), - Response: errorResponse.Response, - Message: errorResponse.Message, - } - case r.StatusCode == http.StatusForbidden && strings.HasSuffix(errorResponse.DocumentationURL, "/v3/#abuse-rate-limits"): - abuseRateLimitError := &AbuseRateLimitError{ - Response: errorResponse.Response, - Message: errorResponse.Message, - } - if v := r.Header["Retry-After"]; len(v) > 0 { - // According to GitHub support, the "Retry-After" header value will be - // an integer which represents the number of seconds that one should - // wait before resuming making requests. - retryAfterSeconds, _ := strconv.ParseInt(v[0], 10, 64) // Error handling is noop. - retryAfter := time.Duration(retryAfterSeconds) * time.Second - abuseRateLimitError.RetryAfter = &retryAfter - } - return abuseRateLimitError - default: - return errorResponse - } -} - -// parseBoolResponse determines the boolean result from a GitHub API response. -// Several GitHub API methods return boolean responses indicated by the HTTP -// status code in the response (true indicated by a 204, false indicated by a -// 404). This helper function will determine that result and hide the 404 -// error if present. Any other error will be returned through as-is. -func parseBoolResponse(err error) (bool, error) { - if err == nil { - return true, nil - } - - if err, ok := err.(*ErrorResponse); ok && err.Response.StatusCode == http.StatusNotFound { - // Simply false. In this one case, we do not pass the error through. - return false, nil - } - - // some other real error occurred - return false, err -} - -// Rate represents the rate limit for the current client. -type Rate struct { - // The number of requests per hour the client is currently limited to. - Limit int `json:"limit"` - - // The number of remaining requests the client can make this hour. - Remaining int `json:"remaining"` - - // The time at which the current rate limit will reset. - Reset Timestamp `json:"reset"` -} - -func (r Rate) String() string { - return Stringify(r) -} - -// RateLimits represents the rate limits for the current client. -type RateLimits struct { - // The rate limit for non-search API requests. Unauthenticated - // requests are limited to 60 per hour. Authenticated requests are - // limited to 5,000 per hour. - // - // GitHub API docs: https://developer.github.com/v3/#rate-limiting - Core *Rate `json:"core"` - - // The rate limit for search API requests. Unauthenticated requests - // are limited to 10 requests per minutes. Authenticated requests are - // limited to 30 per minute. - // - // GitHub API docs: https://developer.github.com/v3/search/#rate-limit - Search *Rate `json:"search"` -} - -func (r RateLimits) String() string { - return Stringify(r) -} - -type rateLimitCategory uint8 - -const ( - coreCategory rateLimitCategory = iota - searchCategory - - categories // An array of this length will be able to contain all rate limit categories. -) - -// category returns the rate limit category of the endpoint, determined by Request.URL.Path. -func category(path string) rateLimitCategory { - switch { - default: - return coreCategory - case strings.HasPrefix(path, "/search/"): - return searchCategory - } -} - -// RateLimits returns the rate limits for the current client. -func (c *Client) RateLimits(ctx context.Context) (*RateLimits, *Response, error) { - req, err := c.NewRequest("GET", "rate_limit", nil) - if err != nil { - return nil, nil, err - } - - response := new(struct { - Resources *RateLimits `json:"resources"` - }) - resp, err := c.Do(ctx, req, response) - if err != nil { - return nil, nil, err - } - - if response.Resources != nil { - c.rateMu.Lock() - if response.Resources.Core != nil { - c.rateLimits[coreCategory] = *response.Resources.Core - } - if response.Resources.Search != nil { - c.rateLimits[searchCategory] = *response.Resources.Search - } - c.rateMu.Unlock() - } - - return response.Resources, resp, nil -} - -/* -UnauthenticatedRateLimitedTransport allows you to make unauthenticated calls -that need to use a higher rate limit associated with your OAuth application. - - t := &github.UnauthenticatedRateLimitedTransport{ - ClientID: "your app's client ID", - ClientSecret: "your app's client secret", - } - client := github.NewClient(t.Client()) - -This will append the querystring params client_id=xxx&client_secret=yyy to all -requests. - -See https://developer.github.com/v3/#unauthenticated-rate-limited-requests for -more information. -*/ -type UnauthenticatedRateLimitedTransport struct { - // ClientID is the GitHub OAuth client ID of the current application, which - // can be found by selecting its entry in the list at - // https://github.com/settings/applications. - ClientID string - - // ClientSecret is the GitHub OAuth client secret of the current - // application. - ClientSecret string - - // Transport is the underlying HTTP transport to use when making requests. - // It will default to http.DefaultTransport if nil. - Transport http.RoundTripper -} - -// RoundTrip implements the RoundTripper interface. -func (t *UnauthenticatedRateLimitedTransport) RoundTrip(req *http.Request) (*http.Response, error) { - if t.ClientID == "" { - return nil, errors.New("t.ClientID is empty") - } - if t.ClientSecret == "" { - return nil, errors.New("t.ClientSecret is empty") - } - - // To set extra querystring params, we must make a copy of the Request so - // that we don't modify the Request we were given. This is required by the - // specification of http.RoundTripper. - // - // Since we are going to modify only req.URL here, we only need a deep copy - // of req.URL. - req2 := new(http.Request) - *req2 = *req - req2.URL = new(url.URL) - *req2.URL = *req.URL - - q := req2.URL.Query() - q.Set("client_id", t.ClientID) - q.Set("client_secret", t.ClientSecret) - req2.URL.RawQuery = q.Encode() - - // Make the HTTP request. - return t.transport().RoundTrip(req2) -} - -// Client returns an *http.Client that makes requests which are subject to the -// rate limit of your OAuth application. -func (t *UnauthenticatedRateLimitedTransport) Client() *http.Client { - return &http.Client{Transport: t} -} - -func (t *UnauthenticatedRateLimitedTransport) transport() http.RoundTripper { - if t.Transport != nil { - return t.Transport - } - return http.DefaultTransport -} - -// BasicAuthTransport is an http.RoundTripper that authenticates all requests -// using HTTP Basic Authentication with the provided username and password. It -// additionally supports users who have two-factor authentication enabled on -// their GitHub account. -type BasicAuthTransport struct { - Username string // GitHub username - Password string // GitHub password - OTP string // one-time password for users with two-factor auth enabled - - // Transport is the underlying HTTP transport to use when making requests. - // It will default to http.DefaultTransport if nil. - Transport http.RoundTripper -} - -// RoundTrip implements the RoundTripper interface. -func (t *BasicAuthTransport) RoundTrip(req *http.Request) (*http.Response, error) { - // To set extra headers, we must make a copy of the Request so - // that we don't modify the Request we were given. This is required by the - // specification of http.RoundTripper. - // - // Since we are going to modify only req.Header here, we only need a deep copy - // of req.Header. - req2 := new(http.Request) - *req2 = *req - req2.Header = make(http.Header, len(req.Header)) - for k, s := range req.Header { - req2.Header[k] = append([]string(nil), s...) - } - - req2.SetBasicAuth(t.Username, t.Password) - if t.OTP != "" { - req2.Header.Set(headerOTP, t.OTP) - } - return t.transport().RoundTrip(req2) -} - -// Client returns an *http.Client that makes requests that are authenticated -// using HTTP Basic Authentication. -func (t *BasicAuthTransport) Client() *http.Client { - return &http.Client{Transport: t} -} - -func (t *BasicAuthTransport) transport() http.RoundTripper { - if t.Transport != nil { - return t.Transport - } - return http.DefaultTransport -} - -// formatRateReset formats d to look like "[rate reset in 2s]" or -// "[rate reset in 87m02s]" for the positive durations. And like "[rate limit was reset 87m02s ago]" -// for the negative cases. -func formatRateReset(d time.Duration) string { - isNegative := d < 0 - if isNegative { - d *= -1 - } - secondsTotal := int(0.5 + d.Seconds()) - minutes := secondsTotal / 60 - seconds := secondsTotal - minutes*60 - - var timeString string - if minutes > 0 { - timeString = fmt.Sprintf("%dm%02ds", minutes, seconds) - } else { - timeString = fmt.Sprintf("%ds", seconds) - } - - if isNegative { - return fmt.Sprintf("[rate limit was reset %v ago]", timeString) - } - return fmt.Sprintf("[rate reset in %v]", timeString) -} - -// Bool is a helper routine that allocates a new bool value -// to store v and returns a pointer to it. -func Bool(v bool) *bool { return &v } - -// Int is a helper routine that allocates a new int value -// to store v and returns a pointer to it. -func Int(v int) *int { return &v } - -// Int64 is a helper routine that allocates a new int64 value -// to store v and returns a pointer to it. -func Int64(v int64) *int64 { return &v } - -// String is a helper routine that allocates a new string value -// to store v and returns a pointer to it. -func String(v string) *string { return &v } diff --git a/vendor/github.com/google/go-github/v27/github/gitignore.go b/vendor/github.com/google/go-github/v27/github/gitignore.go deleted file mode 100644 index 2f691bc323e5..000000000000 --- a/vendor/github.com/google/go-github/v27/github/gitignore.go +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2013 The go-github 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 - -import ( - "context" - "fmt" -) - -// GitignoresService provides access to the gitignore related functions in the -// GitHub API. -// -// GitHub API docs: https://developer.github.com/v3/gitignore/ -type GitignoresService service - -// Gitignore represents a .gitignore file as returned by the GitHub API. -type Gitignore struct { - Name *string `json:"name,omitempty"` - Source *string `json:"source,omitempty"` -} - -func (g Gitignore) String() string { - return Stringify(g) -} - -// List all available Gitignore templates. -// -// GitHub API docs: https://developer.github.com/v3/gitignore/#listing-available-templates -func (s GitignoresService) List(ctx context.Context) ([]string, *Response, error) { - req, err := s.client.NewRequest("GET", "gitignore/templates", nil) - if err != nil { - return nil, nil, err - } - - var availableTemplates []string - resp, err := s.client.Do(ctx, req, &availableTemplates) - if err != nil { - return nil, resp, err - } - - return availableTemplates, resp, nil -} - -// Get a Gitignore by name. -// -// GitHub API docs: https://developer.github.com/v3/gitignore/#get-a-single-template -func (s GitignoresService) Get(ctx context.Context, name string) (*Gitignore, *Response, error) { - u := fmt.Sprintf("gitignore/templates/%v", name) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - gitignore := new(Gitignore) - resp, err := s.client.Do(ctx, req, gitignore) - if err != nil { - return nil, resp, err - } - - return gitignore, resp, nil -} diff --git a/vendor/github.com/google/go-github/v27/github/interactions.go b/vendor/github.com/google/go-github/v27/github/interactions.go deleted file mode 100644 index b9965491db5b..000000000000 --- a/vendor/github.com/google/go-github/v27/github/interactions.go +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2018 The go-github 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 - -// InteractionsService handles communication with the repository and organization related -// methods of the GitHub API. -// -// GitHub API docs: https://developer.github.com/v3/interactions/ -type InteractionsService service - -// InteractionRestriction represents the interaction restrictions for repository and organization. -type InteractionRestriction struct { - // Specifies the group of GitHub users who can - // comment, open issues, or create pull requests for the given repository. - // Possible values are: "existing_users", "contributors_only" and "collaborators_only". - Limit *string `json:"limit,omitempty"` - - // Origin specifies the type of the resource to interact with. - // Possible values are: "repository" and "organization". - Origin *string `json:"origin,omitempty"` - - // ExpiresAt specifies the time after which the interaction restrictions expire. - // The default expiry time is 24 hours from the time restriction is created. - ExpiresAt *Timestamp `json:"expires_at,omitempty"` -} diff --git a/vendor/github.com/google/go-github/v27/github/interactions_orgs.go b/vendor/github.com/google/go-github/v27/github/interactions_orgs.go deleted file mode 100644 index af25f6567db1..000000000000 --- a/vendor/github.com/google/go-github/v27/github/interactions_orgs.go +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2019 The go-github 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 - -import ( - "context" - "fmt" -) - -// GetRestrictionsForOrg fetches the interaction restrictions for an organization. -// -// GitHub API docs: https://developer.github.com/v3/interactions/orgs/#get-interaction-restrictions-for-an-organization -func (s *InteractionsService) GetRestrictionsForOrg(ctx context.Context, organization string) (*InteractionRestriction, *Response, error) { - u := fmt.Sprintf("orgs/%v/interaction-limits", organization) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeInteractionRestrictionsPreview) - - organizationInteractions := new(InteractionRestriction) - - resp, err := s.client.Do(ctx, req, organizationInteractions) - if err != nil { - return nil, resp, err - } - - return organizationInteractions, resp, nil -} - -// UpdateRestrictionsForOrg adds or updates the interaction restrictions for an organization. -// -// limit specifies the group of GitHub users who can comment, open issues, or create pull requests -// in public repositories for the given organization. -// Possible values are: "existing_users", "contributors_only", "collaborators_only". -// -// GitHub API docs: https://developer.github.com/v3/interactions/orgs/#add-or-update-interaction-restrictions-for-an-organization -func (s *InteractionsService) UpdateRestrictionsForOrg(ctx context.Context, organization, limit string) (*InteractionRestriction, *Response, error) { - u := fmt.Sprintf("orgs/%v/interaction-limits", organization) - - interaction := &InteractionRestriction{Limit: String(limit)} - - req, err := s.client.NewRequest("PUT", u, interaction) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeInteractionRestrictionsPreview) - - organizationInteractions := new(InteractionRestriction) - - resp, err := s.client.Do(ctx, req, organizationInteractions) - if err != nil { - return nil, resp, err - } - - return organizationInteractions, resp, nil -} - -// RemoveRestrictionsFromOrg removes the interaction restrictions for an organization. -// -// GitHub API docs: https://developer.github.com/v3/interactions/orgs/#remove-interaction-restrictions-for-an-organization -func (s *InteractionsService) RemoveRestrictionsFromOrg(ctx context.Context, organization string) (*Response, error) { - u := fmt.Sprintf("orgs/%v/interaction-limits", organization) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeInteractionRestrictionsPreview) - - return s.client.Do(ctx, req, nil) -} diff --git a/vendor/github.com/google/go-github/v27/github/interactions_repos.go b/vendor/github.com/google/go-github/v27/github/interactions_repos.go deleted file mode 100644 index 58234822fdd9..000000000000 --- a/vendor/github.com/google/go-github/v27/github/interactions_repos.go +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2018 The go-github 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 - -import ( - "context" - "fmt" -) - -// GetRestrictionsForRepo fetches the interaction restrictions for a repository. -// -// GitHub API docs: https://developer.github.com/v3/interactions/repos/#get-interaction-restrictions-for-a-repository -func (s *InteractionsService) GetRestrictionsForRepo(ctx context.Context, owner, repo string) (*InteractionRestriction, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/interaction-limits", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeInteractionRestrictionsPreview) - - repositoryInteractions := new(InteractionRestriction) - - resp, err := s.client.Do(ctx, req, repositoryInteractions) - if err != nil { - return nil, resp, err - } - - return repositoryInteractions, resp, nil -} - -// UpdateRestrictionsForRepo adds or updates the interaction restrictions for a repository. -// -// limit specifies the group of GitHub users who can comment, open issues, or create pull requests -// for the given repository. -// Possible values are: "existing_users", "contributors_only", "collaborators_only". -// -// GitHub API docs: https://developer.github.com/v3/interactions/repos/#add-or-update-interaction-restrictions-for-a-repository -func (s *InteractionsService) UpdateRestrictionsForRepo(ctx context.Context, owner, repo, limit string) (*InteractionRestriction, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/interaction-limits", owner, repo) - - interaction := &InteractionRestriction{Limit: String(limit)} - - req, err := s.client.NewRequest("PUT", u, interaction) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeInteractionRestrictionsPreview) - - repositoryInteractions := new(InteractionRestriction) - - resp, err := s.client.Do(ctx, req, repositoryInteractions) - if err != nil { - return nil, resp, err - } - - return repositoryInteractions, resp, nil -} - -// RemoveRestrictionsFromRepo removes the interaction restrictions for a repository. -// -// GitHub API docs: https://developer.github.com/v3/interactions/repos/#remove-interaction-restrictions-for-a-repository -func (s *InteractionsService) RemoveRestrictionsFromRepo(ctx context.Context, owner, repo string) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/interaction-limits", owner, repo) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeInteractionRestrictionsPreview) - - return s.client.Do(ctx, req, nil) -} diff --git a/vendor/github.com/google/go-github/v27/github/issues.go b/vendor/github.com/google/go-github/v27/github/issues.go deleted file mode 100644 index 1e0991ce4ff6..000000000000 --- a/vendor/github.com/google/go-github/v27/github/issues.go +++ /dev/null @@ -1,347 +0,0 @@ -// Copyright 2013 The go-github 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 - -import ( - "context" - "fmt" - "strings" - "time" -) - -// IssuesService handles communication with the issue related -// methods of the GitHub API. -// -// GitHub API docs: https://developer.github.com/v3/issues/ -type IssuesService service - -// Issue represents a GitHub issue on a repository. -// -// Note: As far as the GitHub API is concerned, every pull request is an issue, -// but not every issue is a pull request. Some endpoints, events, and webhooks -// may also return pull requests via this struct. If PullRequestLinks is nil, -// this is an issue, and if PullRequestLinks is not nil, this is a pull request. -// The IsPullRequest helper method can be used to check that. -type Issue struct { - ID *int64 `json:"id,omitempty"` - Number *int `json:"number,omitempty"` - State *string `json:"state,omitempty"` - Locked *bool `json:"locked,omitempty"` - Title *string `json:"title,omitempty"` - Body *string `json:"body,omitempty"` - User *User `json:"user,omitempty"` - Labels []Label `json:"labels,omitempty"` - Assignee *User `json:"assignee,omitempty"` - Comments *int `json:"comments,omitempty"` - ClosedAt *time.Time `json:"closed_at,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` - ClosedBy *User `json:"closed_by,omitempty"` - URL *string `json:"url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - CommentsURL *string `json:"comments_url,omitempty"` - EventsURL *string `json:"events_url,omitempty"` - LabelsURL *string `json:"labels_url,omitempty"` - RepositoryURL *string `json:"repository_url,omitempty"` - Milestone *Milestone `json:"milestone,omitempty"` - PullRequestLinks *PullRequestLinks `json:"pull_request,omitempty"` - Repository *Repository `json:"repository,omitempty"` - Reactions *Reactions `json:"reactions,omitempty"` - Assignees []*User `json:"assignees,omitempty"` - NodeID *string `json:"node_id,omitempty"` - - // TextMatches is only populated from search results that request text matches - // See: search.go and https://developer.github.com/v3/search/#text-match-metadata - TextMatches []TextMatch `json:"text_matches,omitempty"` - - // ActiveLockReason is populated only when LockReason is provided while locking the issue. - // Possible values are: "off-topic", "too heated", "resolved", and "spam". - ActiveLockReason *string `json:"active_lock_reason,omitempty"` -} - -func (i Issue) String() string { - return Stringify(i) -} - -// IsPullRequest reports whether the issue is also a pull request. It uses the -// method recommended by GitHub's API documentation, which is to check whether -// PullRequestLinks is non-nil. -func (i Issue) IsPullRequest() bool { - return i.PullRequestLinks != nil -} - -// IssueRequest represents a request to create/edit an issue. -// It is separate from Issue above because otherwise Labels -// and Assignee fail to serialize to the correct JSON. -type IssueRequest struct { - Title *string `json:"title,omitempty"` - Body *string `json:"body,omitempty"` - Labels *[]string `json:"labels,omitempty"` - Assignee *string `json:"assignee,omitempty"` - State *string `json:"state,omitempty"` - Milestone *int `json:"milestone,omitempty"` - Assignees *[]string `json:"assignees,omitempty"` -} - -// IssueListOptions specifies the optional parameters to the IssuesService.List -// and IssuesService.ListByOrg methods. -type IssueListOptions struct { - // Filter specifies which issues to list. Possible values are: assigned, - // created, mentioned, subscribed, all. Default is "assigned". - Filter string `url:"filter,omitempty"` - - // State filters issues based on their state. Possible values are: open, - // closed, all. Default is "open". - State string `url:"state,omitempty"` - - // Labels filters issues based on their label. - Labels []string `url:"labels,comma,omitempty"` - - // Sort specifies how to sort issues. Possible values are: created, updated, - // and comments. Default value is "created". - Sort string `url:"sort,omitempty"` - - // Direction in which to sort issues. Possible values are: asc, desc. - // Default is "desc". - Direction string `url:"direction,omitempty"` - - // Since filters issues by time. - Since time.Time `url:"since,omitempty"` - - ListOptions -} - -// PullRequestLinks object is added to the Issue object when it's an issue included -// in the IssueCommentEvent webhook payload, if the webhook is fired by a comment on a PR. -type PullRequestLinks struct { - URL *string `json:"url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - DiffURL *string `json:"diff_url,omitempty"` - PatchURL *string `json:"patch_url,omitempty"` -} - -// List the issues for the authenticated user. If all is true, list issues -// across all the user's visible repositories including owned, member, and -// organization repositories; if false, list only owned and member -// repositories. -// -// GitHub API docs: https://developer.github.com/v3/issues/#list-issues -func (s *IssuesService) List(ctx context.Context, all bool, opt *IssueListOptions) ([]*Issue, *Response, error) { - var u string - if all { - u = "issues" - } else { - u = "user/issues" - } - return s.listIssues(ctx, u, opt) -} - -// ListByOrg fetches the issues in the specified organization for the -// authenticated user. -// -// GitHub API docs: https://developer.github.com/v3/issues/#list-issues -func (s *IssuesService) ListByOrg(ctx context.Context, org string, opt *IssueListOptions) ([]*Issue, *Response, error) { - u := fmt.Sprintf("orgs/%v/issues", org) - return s.listIssues(ctx, u, opt) -} - -func (s *IssuesService) listIssues(ctx context.Context, u string, opt *IssueListOptions) ([]*Issue, *Response, error) { - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - acceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeLabelDescriptionSearchPreview, mediaTypeLockReasonPreview} - req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - - var issues []*Issue - resp, err := s.client.Do(ctx, req, &issues) - if err != nil { - return nil, resp, err - } - - return issues, resp, nil -} - -// IssueListByRepoOptions specifies the optional parameters to the -// IssuesService.ListByRepo method. -type IssueListByRepoOptions struct { - // Milestone limits issues for the specified milestone. Possible values are - // a milestone number, "none" for issues with no milestone, "*" for issues - // with any milestone. - Milestone string `url:"milestone,omitempty"` - - // State filters issues based on their state. Possible values are: open, - // closed, all. Default is "open". - State string `url:"state,omitempty"` - - // Assignee filters issues based on their assignee. Possible values are a - // user name, "none" for issues that are not assigned, "*" for issues with - // any assigned user. - Assignee string `url:"assignee,omitempty"` - - // Creator filters issues based on their creator. - Creator string `url:"creator,omitempty"` - - // Mentioned filters issues to those mentioned a specific user. - Mentioned string `url:"mentioned,omitempty"` - - // Labels filters issues based on their label. - Labels []string `url:"labels,omitempty,comma"` - - // Sort specifies how to sort issues. Possible values are: created, updated, - // and comments. Default value is "created". - Sort string `url:"sort,omitempty"` - - // Direction in which to sort issues. Possible values are: asc, desc. - // Default is "desc". - Direction string `url:"direction,omitempty"` - - // Since filters issues by time. - Since time.Time `url:"since,omitempty"` - - ListOptions -} - -// ListByRepo lists the issues for the specified repository. -// -// GitHub API docs: https://developer.github.com/v3/issues/#list-issues-for-a-repository -func (s *IssuesService) ListByRepo(ctx context.Context, owner string, repo string, opt *IssueListByRepoOptions) ([]*Issue, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues", owner, repo) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - acceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeLabelDescriptionSearchPreview, mediaTypeIntegrationPreview} - req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - - var issues []*Issue - resp, err := s.client.Do(ctx, req, &issues) - if err != nil { - return nil, resp, err - } - - return issues, resp, nil -} - -// Get a single issue. -// -// GitHub API docs: https://developer.github.com/v3/issues/#get-a-single-issue -func (s *IssuesService) Get(ctx context.Context, owner string, repo string, number int) (*Issue, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%d", owner, repo, number) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - acceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeLabelDescriptionSearchPreview, mediaTypeLockReasonPreview} - req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - - issue := new(Issue) - resp, err := s.client.Do(ctx, req, issue) - if err != nil { - return nil, resp, err - } - - return issue, resp, nil -} - -// Create a new issue on the specified repository. -// -// GitHub API docs: https://developer.github.com/v3/issues/#create-an-issue -func (s *IssuesService) Create(ctx context.Context, owner string, repo string, issue *IssueRequest) (*Issue, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues", owner, repo) - req, err := s.client.NewRequest("POST", u, issue) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeLabelDescriptionSearchPreview) - - i := new(Issue) - resp, err := s.client.Do(ctx, req, i) - if err != nil { - return nil, resp, err - } - - return i, resp, nil -} - -// Edit an issue. -// -// GitHub API docs: https://developer.github.com/v3/issues/#edit-an-issue -func (s *IssuesService) Edit(ctx context.Context, owner string, repo string, number int, issue *IssueRequest) (*Issue, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%d", owner, repo, number) - req, err := s.client.NewRequest("PATCH", u, issue) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeLabelDescriptionSearchPreview) - - i := new(Issue) - resp, err := s.client.Do(ctx, req, i) - if err != nil { - return nil, resp, err - } - - return i, resp, nil -} - -// LockIssueOptions specifies the optional parameters to the -// IssuesService.Lock method. -type LockIssueOptions struct { - // LockReason specifies the reason to lock this issue. - // Providing a lock reason can help make it clearer to contributors why an issue - // was locked. Possible values are: "off-topic", "too heated", "resolved", and "spam". - LockReason string `json:"lock_reason,omitempty"` -} - -// Lock an issue's conversation. -// -// GitHub API docs: https://developer.github.com/v3/issues/#lock-an-issue -func (s *IssuesService) Lock(ctx context.Context, owner string, repo string, number int, opt *LockIssueOptions) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%d/lock", owner, repo, number) - req, err := s.client.NewRequest("PUT", u, opt) - if err != nil { - return nil, err - } - - if opt != nil { - req.Header.Set("Accept", mediaTypeLockReasonPreview) - } - - return s.client.Do(ctx, req, nil) -} - -// Unlock an issue's conversation. -// -// GitHub API docs: https://developer.github.com/v3/issues/#unlock-an-issue -func (s *IssuesService) Unlock(ctx context.Context, owner string, repo string, number int) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%d/lock", owner, repo, number) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} diff --git a/vendor/github.com/google/go-github/v27/github/issues_assignees.go b/vendor/github.com/google/go-github/v27/github/issues_assignees.go deleted file mode 100644 index 9cb366f50a32..000000000000 --- a/vendor/github.com/google/go-github/v27/github/issues_assignees.go +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2013 The go-github 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 - -import ( - "context" - "fmt" -) - -// ListAssignees fetches all available assignees (owners and collaborators) to -// which issues may be assigned. -// -// GitHub API docs: https://developer.github.com/v3/issues/assignees/#list-assignees -func (s *IssuesService) ListAssignees(ctx context.Context, owner, repo string, opt *ListOptions) ([]*User, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/assignees", owner, repo) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - var assignees []*User - resp, err := s.client.Do(ctx, req, &assignees) - if err != nil { - return nil, resp, err - } - - return assignees, resp, nil -} - -// IsAssignee checks if a user is an assignee for the specified repository. -// -// GitHub API docs: https://developer.github.com/v3/issues/assignees/#check-assignee -func (s *IssuesService) IsAssignee(ctx context.Context, owner, repo, user string) (bool, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/assignees/%v", owner, repo, user) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return false, nil, err - } - resp, err := s.client.Do(ctx, req, nil) - assignee, err := parseBoolResponse(err) - return assignee, resp, err -} - -// AddAssignees adds the provided GitHub users as assignees to the issue. -// -// GitHub API docs: https://developer.github.com/v3/issues/assignees/#add-assignees-to-an-issue -func (s *IssuesService) AddAssignees(ctx context.Context, owner, repo string, number int, assignees []string) (*Issue, *Response, error) { - users := &struct { - Assignees []string `json:"assignees,omitempty"` - }{Assignees: assignees} - u := fmt.Sprintf("repos/%v/%v/issues/%v/assignees", owner, repo, number) - req, err := s.client.NewRequest("POST", u, users) - if err != nil { - return nil, nil, err - } - - issue := &Issue{} - resp, err := s.client.Do(ctx, req, issue) - return issue, resp, err -} - -// RemoveAssignees removes the provided GitHub users as assignees from the issue. -// -// GitHub API docs: https://developer.github.com/v3/issues/assignees/#remove-assignees-from-an-issue -func (s *IssuesService) RemoveAssignees(ctx context.Context, owner, repo string, number int, assignees []string) (*Issue, *Response, error) { - users := &struct { - Assignees []string `json:"assignees,omitempty"` - }{Assignees: assignees} - u := fmt.Sprintf("repos/%v/%v/issues/%v/assignees", owner, repo, number) - req, err := s.client.NewRequest("DELETE", u, users) - if err != nil { - return nil, nil, err - } - - issue := &Issue{} - resp, err := s.client.Do(ctx, req, issue) - return issue, resp, err -} diff --git a/vendor/github.com/google/go-github/v27/github/issues_comments.go b/vendor/github.com/google/go-github/v27/github/issues_comments.go deleted file mode 100644 index ab68afe2fa47..000000000000 --- a/vendor/github.com/google/go-github/v27/github/issues_comments.go +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright 2013 The go-github 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 - -import ( - "context" - "fmt" - "time" -) - -// IssueComment represents a comment left on an issue. -type IssueComment struct { - ID *int64 `json:"id,omitempty"` - NodeID *string `json:"node_id,omitempty"` - Body *string `json:"body,omitempty"` - User *User `json:"user,omitempty"` - Reactions *Reactions `json:"reactions,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` - // AuthorAssociation is the comment author's relationship to the issue's repository. - // Possible values are "COLLABORATOR", "CONTRIBUTOR", "FIRST_TIMER", "FIRST_TIME_CONTRIBUTOR", "MEMBER", "OWNER", or "NONE". - AuthorAssociation *string `json:"author_association,omitempty"` - URL *string `json:"url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - IssueURL *string `json:"issue_url,omitempty"` -} - -func (i IssueComment) String() string { - return Stringify(i) -} - -// IssueListCommentsOptions specifies the optional parameters to the -// IssuesService.ListComments method. -type IssueListCommentsOptions struct { - // Sort specifies how to sort comments. Possible values are: created, updated. - Sort string `url:"sort,omitempty"` - - // Direction in which to sort comments. Possible values are: asc, desc. - Direction string `url:"direction,omitempty"` - - // Since filters comments by time. - Since time.Time `url:"since,omitempty"` - - ListOptions -} - -// ListComments lists all comments on the specified issue. Specifying an issue -// number of 0 will return all comments on all issues for the repository. -// -// GitHub API docs: https://developer.github.com/v3/issues/comments/#list-comments-on-an-issue -func (s *IssuesService) ListComments(ctx context.Context, owner string, repo string, number int, opt *IssueListCommentsOptions) ([]*IssueComment, *Response, error) { - var u string - if number == 0 { - u = fmt.Sprintf("repos/%v/%v/issues/comments", owner, repo) - } else { - u = fmt.Sprintf("repos/%v/%v/issues/%d/comments", owner, repo, number) - } - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeReactionsPreview) - - var comments []*IssueComment - resp, err := s.client.Do(ctx, req, &comments) - if err != nil { - return nil, resp, err - } - - return comments, resp, nil -} - -// GetComment fetches the specified issue comment. -// -// GitHub API docs: https://developer.github.com/v3/issues/comments/#get-a-single-comment -func (s *IssuesService) GetComment(ctx context.Context, owner string, repo string, commentID int64) (*IssueComment, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/comments/%d", owner, repo, commentID) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeReactionsPreview) - - comment := new(IssueComment) - resp, err := s.client.Do(ctx, req, comment) - if err != nil { - return nil, resp, err - } - - return comment, resp, nil -} - -// CreateComment creates a new comment on the specified issue. -// -// GitHub API docs: https://developer.github.com/v3/issues/comments/#create-a-comment -func (s *IssuesService) CreateComment(ctx context.Context, owner string, repo string, number int, comment *IssueComment) (*IssueComment, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%d/comments", owner, repo, number) - req, err := s.client.NewRequest("POST", u, comment) - if err != nil { - return nil, nil, err - } - c := new(IssueComment) - resp, err := s.client.Do(ctx, req, c) - if err != nil { - return nil, resp, err - } - - return c, resp, nil -} - -// EditComment updates an issue comment. -// A non-nil comment.Body must be provided. Other comment fields should be left nil. -// -// GitHub API docs: https://developer.github.com/v3/issues/comments/#edit-a-comment -func (s *IssuesService) EditComment(ctx context.Context, owner string, repo string, commentID int64, comment *IssueComment) (*IssueComment, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/comments/%d", owner, repo, commentID) - req, err := s.client.NewRequest("PATCH", u, comment) - if err != nil { - return nil, nil, err - } - c := new(IssueComment) - resp, err := s.client.Do(ctx, req, c) - if err != nil { - return nil, resp, err - } - - return c, resp, nil -} - -// DeleteComment deletes an issue comment. -// -// GitHub API docs: https://developer.github.com/v3/issues/comments/#delete-a-comment -func (s *IssuesService) DeleteComment(ctx context.Context, owner string, repo string, commentID int64) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/comments/%d", owner, repo, commentID) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - return s.client.Do(ctx, req, nil) -} diff --git a/vendor/github.com/google/go-github/v27/github/issues_events.go b/vendor/github.com/google/go-github/v27/github/issues_events.go deleted file mode 100644 index 4456d67e5c3c..000000000000 --- a/vendor/github.com/google/go-github/v27/github/issues_events.go +++ /dev/null @@ -1,175 +0,0 @@ -// Copyright 2014 The go-github 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 - -import ( - "context" - "fmt" - "strings" - "time" -) - -// IssueEvent represents an event that occurred around an Issue or Pull Request. -type IssueEvent struct { - ID *int64 `json:"id,omitempty"` - URL *string `json:"url,omitempty"` - - // The User that generated this event. - Actor *User `json:"actor,omitempty"` - - // Event identifies the actual type of Event that occurred. Possible - // values are: - // - // closed - // The Actor closed the issue. - // If the issue was closed by commit message, CommitID holds the SHA1 hash of the commit. - // - // merged - // The Actor merged into master a branch containing a commit mentioning the issue. - // CommitID holds the SHA1 of the merge commit. - // - // referenced - // The Actor committed to master a commit mentioning the issue in its commit message. - // CommitID holds the SHA1 of the commit. - // - // reopened, unlocked - // The Actor did that to the issue. - // - // locked - // The Actor locked the issue. - // LockReason holds the reason of locking the issue (if provided while locking). - // - // renamed - // The Actor changed the issue title from Rename.From to Rename.To. - // - // mentioned - // Someone unspecified @mentioned the Actor [sic] in an issue comment body. - // - // assigned, unassigned - // The Assigner assigned the issue to or removed the assignment from the Assignee. - // - // labeled, unlabeled - // The Actor added or removed the Label from the issue. - // - // milestoned, demilestoned - // The Actor added or removed the issue from the Milestone. - // - // subscribed, unsubscribed - // The Actor subscribed to or unsubscribed from notifications for an issue. - // - // head_ref_deleted, head_ref_restored - // The pull request’s branch was deleted or restored. - // - // review_dismissed - // The review was dismissed and `DismissedReview` will be populated below. - // - Event *string `json:"event,omitempty"` - - CreatedAt *time.Time `json:"created_at,omitempty"` - Issue *Issue `json:"issue,omitempty"` - - // Only present on certain events; see above. - Assignee *User `json:"assignee,omitempty"` - Assigner *User `json:"assigner,omitempty"` - CommitID *string `json:"commit_id,omitempty"` - Milestone *Milestone `json:"milestone,omitempty"` - Label *Label `json:"label,omitempty"` - Rename *Rename `json:"rename,omitempty"` - LockReason *string `json:"lock_reason,omitempty"` - ProjectCard *ProjectCard `json:"project_card,omitempty"` - DismissedReview *DismissedReview `json:"dismissed_review,omitempty"` -} - -// DismissedReview represents details for 'dismissed_review' events. -type DismissedReview struct { - // State represents the state of the dismissed review. - // Possible values are: "commented", "approved", and "changes_requested". - State *string `json:"state,omitempty"` - ReviewID *int64 `json:"review_id,omitempty"` - DismissalMessage *string `json:"dismissal_message,omitempty"` - DismissalCommitID *string `json:"dismissal_commit_id,omitempty"` -} - -// ListIssueEvents lists events for the specified issue. -// -// GitHub API docs: https://developer.github.com/v3/issues/events/#list-events-for-an-issue -func (s *IssuesService) ListIssueEvents(ctx context.Context, owner, repo string, number int, opt *ListOptions) ([]*IssueEvent, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%v/events", owner, repo, number) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - acceptHeaders := []string{mediaTypeLockReasonPreview, mediaTypeProjectCardDetailsPreview} - req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - - var events []*IssueEvent - resp, err := s.client.Do(ctx, req, &events) - if err != nil { - return nil, resp, err - } - - return events, resp, nil -} - -// ListRepositoryEvents lists events for the specified repository. -// -// GitHub API docs: https://developer.github.com/v3/issues/events/#list-events-for-a-repository -func (s *IssuesService) ListRepositoryEvents(ctx context.Context, owner, repo string, opt *ListOptions) ([]*IssueEvent, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/events", owner, repo) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var events []*IssueEvent - resp, err := s.client.Do(ctx, req, &events) - if err != nil { - return nil, resp, err - } - - return events, resp, nil -} - -// GetEvent returns the specified issue event. -// -// GitHub API docs: https://developer.github.com/v3/issues/events/#get-a-single-event -func (s *IssuesService) GetEvent(ctx context.Context, owner, repo string, id int64) (*IssueEvent, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/events/%v", owner, repo, id) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - event := new(IssueEvent) - resp, err := s.client.Do(ctx, req, event) - if err != nil { - return nil, resp, err - } - - return event, resp, nil -} - -// Rename contains details for 'renamed' events. -type Rename struct { - From *string `json:"from,omitempty"` - To *string `json:"to,omitempty"` -} - -func (r Rename) String() string { - return Stringify(r) -} diff --git a/vendor/github.com/google/go-github/v27/github/issues_labels.go b/vendor/github.com/google/go-github/v27/github/issues_labels.go deleted file mode 100644 index adcbe06834a5..000000000000 --- a/vendor/github.com/google/go-github/v27/github/issues_labels.go +++ /dev/null @@ -1,261 +0,0 @@ -// Copyright 2013 The go-github 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 - -import ( - "context" - "fmt" -) - -// Label represents a GitHub label on an Issue -type Label struct { - ID *int64 `json:"id,omitempty"` - URL *string `json:"url,omitempty"` - Name *string `json:"name,omitempty"` - Color *string `json:"color,omitempty"` - Description *string `json:"description,omitempty"` - Default *bool `json:"default,omitempty"` - NodeID *string `json:"node_id,omitempty"` -} - -func (l Label) String() string { - return Stringify(l) -} - -// ListLabels lists all labels for a repository. -// -// GitHub API docs: https://developer.github.com/v3/issues/labels/#list-all-labels-for-this-repository -func (s *IssuesService) ListLabels(ctx context.Context, owner string, repo string, opt *ListOptions) ([]*Label, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/labels", owner, repo) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeLabelDescriptionSearchPreview) - - var labels []*Label - resp, err := s.client.Do(ctx, req, &labels) - if err != nil { - return nil, resp, err - } - - return labels, resp, nil -} - -// GetLabel gets a single label. -// -// GitHub API docs: https://developer.github.com/v3/issues/labels/#get-a-single-label -func (s *IssuesService) GetLabel(ctx context.Context, owner string, repo string, name string) (*Label, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/labels/%v", owner, repo, name) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeLabelDescriptionSearchPreview) - - label := new(Label) - resp, err := s.client.Do(ctx, req, label) - if err != nil { - return nil, resp, err - } - - return label, resp, nil -} - -// CreateLabel creates a new label on the specified repository. -// -// GitHub API docs: https://developer.github.com/v3/issues/labels/#create-a-label -func (s *IssuesService) CreateLabel(ctx context.Context, owner string, repo string, label *Label) (*Label, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/labels", owner, repo) - req, err := s.client.NewRequest("POST", u, label) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeLabelDescriptionSearchPreview) - - l := new(Label) - resp, err := s.client.Do(ctx, req, l) - if err != nil { - return nil, resp, err - } - - return l, resp, nil -} - -// EditLabel edits a label. -// -// GitHub API docs: https://developer.github.com/v3/issues/labels/#update-a-label -func (s *IssuesService) EditLabel(ctx context.Context, owner string, repo string, name string, label *Label) (*Label, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/labels/%v", owner, repo, name) - req, err := s.client.NewRequest("PATCH", u, label) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeLabelDescriptionSearchPreview) - - l := new(Label) - resp, err := s.client.Do(ctx, req, l) - if err != nil { - return nil, resp, err - } - - return l, resp, nil -} - -// DeleteLabel deletes a label. -// -// GitHub API docs: https://developer.github.com/v3/issues/labels/#delete-a-label -func (s *IssuesService) DeleteLabel(ctx context.Context, owner string, repo string, name string) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/labels/%v", owner, repo, name) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - return s.client.Do(ctx, req, nil) -} - -// ListLabelsByIssue lists all labels for an issue. -// -// GitHub API docs: https://developer.github.com/v3/issues/labels/#list-labels-on-an-issue -func (s *IssuesService) ListLabelsByIssue(ctx context.Context, owner string, repo string, number int, opt *ListOptions) ([]*Label, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", owner, repo, number) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeLabelDescriptionSearchPreview) - - var labels []*Label - resp, err := s.client.Do(ctx, req, &labels) - if err != nil { - return nil, resp, err - } - - return labels, resp, nil -} - -// AddLabelsToIssue adds labels to an issue. -// -// GitHub API docs: https://developer.github.com/v3/issues/labels/#add-labels-to-an-issue -func (s *IssuesService) AddLabelsToIssue(ctx context.Context, owner string, repo string, number int, labels []string) ([]*Label, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", owner, repo, number) - req, err := s.client.NewRequest("POST", u, labels) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeLabelDescriptionSearchPreview) - - var l []*Label - resp, err := s.client.Do(ctx, req, &l) - if err != nil { - return nil, resp, err - } - - return l, resp, nil -} - -// RemoveLabelForIssue removes a label for an issue. -// -// GitHub API docs: https://developer.github.com/v3/issues/labels/#remove-a-label-from-an-issue -func (s *IssuesService) RemoveLabelForIssue(ctx context.Context, owner string, repo string, number int, label string) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%d/labels/%v", owner, repo, number, label) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeLabelDescriptionSearchPreview) - - return s.client.Do(ctx, req, nil) -} - -// ReplaceLabelsForIssue replaces all labels for an issue. -// -// GitHub API docs: https://developer.github.com/v3/issues/labels/#replace-all-labels-for-an-issue -func (s *IssuesService) ReplaceLabelsForIssue(ctx context.Context, owner string, repo string, number int, labels []string) ([]*Label, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", owner, repo, number) - req, err := s.client.NewRequest("PUT", u, labels) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeLabelDescriptionSearchPreview) - - var l []*Label - resp, err := s.client.Do(ctx, req, &l) - if err != nil { - return nil, resp, err - } - - return l, resp, nil -} - -// RemoveLabelsForIssue removes all labels for an issue. -// -// GitHub API docs: https://developer.github.com/v3/issues/labels/#remove-all-labels-from-an-issue -func (s *IssuesService) RemoveLabelsForIssue(ctx context.Context, owner string, repo string, number int) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", owner, repo, number) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeLabelDescriptionSearchPreview) - - return s.client.Do(ctx, req, nil) -} - -// ListLabelsForMilestone lists labels for every issue in a milestone. -// -// GitHub API docs: https://developer.github.com/v3/issues/labels/#get-labels-for-every-issue-in-a-milestone -func (s *IssuesService) ListLabelsForMilestone(ctx context.Context, owner string, repo string, number int, opt *ListOptions) ([]*Label, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/milestones/%d/labels", owner, repo, number) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeLabelDescriptionSearchPreview) - - var labels []*Label - resp, err := s.client.Do(ctx, req, &labels) - if err != nil { - return nil, resp, err - } - - return labels, resp, nil -} diff --git a/vendor/github.com/google/go-github/v27/github/issues_milestones.go b/vendor/github.com/google/go-github/v27/github/issues_milestones.go deleted file mode 100644 index ffe9aae14ca5..000000000000 --- a/vendor/github.com/google/go-github/v27/github/issues_milestones.go +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright 2014 The go-github 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 - -import ( - "context" - "fmt" - "time" -) - -// Milestone represents a GitHub repository milestone. -type Milestone struct { - URL *string `json:"url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - LabelsURL *string `json:"labels_url,omitempty"` - ID *int64 `json:"id,omitempty"` - Number *int `json:"number,omitempty"` - State *string `json:"state,omitempty"` - Title *string `json:"title,omitempty"` - Description *string `json:"description,omitempty"` - Creator *User `json:"creator,omitempty"` - OpenIssues *int `json:"open_issues,omitempty"` - ClosedIssues *int `json:"closed_issues,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` - ClosedAt *time.Time `json:"closed_at,omitempty"` - DueOn *time.Time `json:"due_on,omitempty"` - NodeID *string `json:"node_id,omitempty"` -} - -func (m Milestone) String() string { - return Stringify(m) -} - -// MilestoneListOptions specifies the optional parameters to the -// IssuesService.ListMilestones method. -type MilestoneListOptions struct { - // State filters milestones based on their state. Possible values are: - // open, closed, all. Default is "open". - State string `url:"state,omitempty"` - - // Sort specifies how to sort milestones. Possible values are: due_on, completeness. - // Default value is "due_on". - Sort string `url:"sort,omitempty"` - - // Direction in which to sort milestones. Possible values are: asc, desc. - // Default is "asc". - Direction string `url:"direction,omitempty"` - - ListOptions -} - -// ListMilestones lists all milestones for a repository. -// -// GitHub API docs: https://developer.github.com/v3/issues/milestones/#list-milestones-for-a-repository -func (s *IssuesService) ListMilestones(ctx context.Context, owner string, repo string, opt *MilestoneListOptions) ([]*Milestone, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/milestones", owner, repo) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var milestones []*Milestone - resp, err := s.client.Do(ctx, req, &milestones) - if err != nil { - return nil, resp, err - } - - return milestones, resp, nil -} - -// GetMilestone gets a single milestone. -// -// GitHub API docs: https://developer.github.com/v3/issues/milestones/#get-a-single-milestone -func (s *IssuesService) GetMilestone(ctx context.Context, owner string, repo string, number int) (*Milestone, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/milestones/%d", owner, repo, number) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - milestone := new(Milestone) - resp, err := s.client.Do(ctx, req, milestone) - if err != nil { - return nil, resp, err - } - - return milestone, resp, nil -} - -// CreateMilestone creates a new milestone on the specified repository. -// -// GitHub API docs: https://developer.github.com/v3/issues/milestones/#create-a-milestone -func (s *IssuesService) CreateMilestone(ctx context.Context, owner string, repo string, milestone *Milestone) (*Milestone, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/milestones", owner, repo) - req, err := s.client.NewRequest("POST", u, milestone) - if err != nil { - return nil, nil, err - } - - m := new(Milestone) - resp, err := s.client.Do(ctx, req, m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// EditMilestone edits a milestone. -// -// GitHub API docs: https://developer.github.com/v3/issues/milestones/#update-a-milestone -func (s *IssuesService) EditMilestone(ctx context.Context, owner string, repo string, number int, milestone *Milestone) (*Milestone, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/milestones/%d", owner, repo, number) - req, err := s.client.NewRequest("PATCH", u, milestone) - if err != nil { - return nil, nil, err - } - - m := new(Milestone) - resp, err := s.client.Do(ctx, req, m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// DeleteMilestone deletes a milestone. -// -// GitHub API docs: https://developer.github.com/v3/issues/milestones/#delete-a-milestone -func (s *IssuesService) DeleteMilestone(ctx context.Context, owner string, repo string, number int) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/milestones/%d", owner, repo, number) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} diff --git a/vendor/github.com/google/go-github/v27/github/issues_timeline.go b/vendor/github.com/google/go-github/v27/github/issues_timeline.go deleted file mode 100644 index d0e4a3a94287..000000000000 --- a/vendor/github.com/google/go-github/v27/github/issues_timeline.go +++ /dev/null @@ -1,154 +0,0 @@ -// Copyright 2016 The go-github 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 - -import ( - "context" - "fmt" - "strings" - "time" -) - -// Timeline represents an event that occurred around an Issue or Pull Request. -// -// It is similar to an IssueEvent but may contain more information. -// GitHub API docs: https://developer.github.com/v3/issues/timeline/ -type Timeline struct { - ID *int64 `json:"id,omitempty"` - URL *string `json:"url,omitempty"` - CommitURL *string `json:"commit_url,omitempty"` - - // The User object that generated the event. - Actor *User `json:"actor,omitempty"` - - // Event identifies the actual type of Event that occurred. Possible values - // are: - // - // assigned - // The issue was assigned to the assignee. - // - // closed - // The issue was closed by the actor. When the commit_id is present, it - // identifies the commit that closed the issue using "closes / fixes #NN" - // syntax. - // - // commented - // A comment was added to the issue. - // - // committed - // A commit was added to the pull request's 'HEAD' branch. Only provided - // for pull requests. - // - // cross-referenced - // The issue was referenced from another issue. The 'source' attribute - // contains the 'id', 'actor', and 'url' of the reference's source. - // - // demilestoned - // The issue was removed from a milestone. - // - // head_ref_deleted - // The pull request's branch was deleted. - // - // head_ref_restored - // The pull request's branch was restored. - // - // labeled - // A label was added to the issue. - // - // locked - // The issue was locked by the actor. - // - // mentioned - // The actor was @mentioned in an issue body. - // - // merged - // The issue was merged by the actor. The 'commit_id' attribute is the - // SHA1 of the HEAD commit that was merged. - // - // milestoned - // The issue was added to a milestone. - // - // referenced - // The issue was referenced from a commit message. The 'commit_id' - // attribute is the commit SHA1 of where that happened. - // - // renamed - // The issue title was changed. - // - // reopened - // The issue was reopened by the actor. - // - // subscribed - // The actor subscribed to receive notifications for an issue. - // - // unassigned - // The assignee was unassigned from the issue. - // - // unlabeled - // A label was removed from the issue. - // - // unlocked - // The issue was unlocked by the actor. - // - // unsubscribed - // The actor unsubscribed to stop receiving notifications for an issue. - // - Event *string `json:"event,omitempty"` - - // The string SHA of a commit that referenced this Issue or Pull Request. - CommitID *string `json:"commit_id,omitempty"` - // The timestamp indicating when the event occurred. - CreatedAt *time.Time `json:"created_at,omitempty"` - // The Label object including `name` and `color` attributes. Only provided for - // 'labeled' and 'unlabeled' events. - Label *Label `json:"label,omitempty"` - // The User object which was assigned to (or unassigned from) this Issue or - // Pull Request. Only provided for 'assigned' and 'unassigned' events. - Assignee *User `json:"assignee,omitempty"` - // The Milestone object including a 'title' attribute. - // Only provided for 'milestoned' and 'demilestoned' events. - Milestone *Milestone `json:"milestone,omitempty"` - // The 'id', 'actor', and 'url' for the source of a reference from another issue. - // Only provided for 'cross-referenced' events. - Source *Source `json:"source,omitempty"` - // An object containing rename details including 'from' and 'to' attributes. - // Only provided for 'renamed' events. - Rename *Rename `json:"rename,omitempty"` - ProjectCard *ProjectCard `json:"project_card,omitempty"` -} - -// Source represents a reference's source. -type Source struct { - ID *int64 `json:"id,omitempty"` - URL *string `json:"url,omitempty"` - Actor *User `json:"actor,omitempty"` - Type *string `json:"type,omitempty"` - Issue *Issue `json:"issue,omitempty"` -} - -// ListIssueTimeline lists events for the specified issue. -// -// GitHub API docs: https://developer.github.com/v3/issues/timeline/#list-events-for-an-issue -func (s *IssuesService) ListIssueTimeline(ctx context.Context, owner, repo string, number int, opt *ListOptions) ([]*Timeline, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%v/timeline", owner, repo, number) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - acceptHeaders := []string{mediaTypeTimelinePreview, mediaTypeProjectCardDetailsPreview} - req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - - var events []*Timeline - resp, err := s.client.Do(ctx, req, &events) - return events, resp, err -} diff --git a/vendor/github.com/google/go-github/v27/github/licenses.go b/vendor/github.com/google/go-github/v27/github/licenses.go deleted file mode 100644 index 1176d3a8bf7b..000000000000 --- a/vendor/github.com/google/go-github/v27/github/licenses.go +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright 2013 The go-github 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 - -import ( - "context" - "fmt" -) - -// LicensesService handles communication with the license related -// methods of the GitHub API. -// -// GitHub API docs: https://developer.github.com/v3/licenses/ -type LicensesService service - -// RepositoryLicense represents the license for a repository. -type RepositoryLicense struct { - Name *string `json:"name,omitempty"` - Path *string `json:"path,omitempty"` - - SHA *string `json:"sha,omitempty"` - Size *int `json:"size,omitempty"` - URL *string `json:"url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - GitURL *string `json:"git_url,omitempty"` - DownloadURL *string `json:"download_url,omitempty"` - Type *string `json:"type,omitempty"` - Content *string `json:"content,omitempty"` - Encoding *string `json:"encoding,omitempty"` - License *License `json:"license,omitempty"` -} - -func (l RepositoryLicense) String() string { - return Stringify(l) -} - -// License represents an open source license. -type License struct { - Key *string `json:"key,omitempty"` - Name *string `json:"name,omitempty"` - URL *string `json:"url,omitempty"` - - SPDXID *string `json:"spdx_id,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - Featured *bool `json:"featured,omitempty"` - Description *string `json:"description,omitempty"` - Implementation *string `json:"implementation,omitempty"` - Permissions *[]string `json:"permissions,omitempty"` - Conditions *[]string `json:"conditions,omitempty"` - Limitations *[]string `json:"limitations,omitempty"` - Body *string `json:"body,omitempty"` -} - -func (l License) String() string { - return Stringify(l) -} - -// List popular open source licenses. -// -// GitHub API docs: https://developer.github.com/v3/licenses/#list-all-licenses -func (s *LicensesService) List(ctx context.Context) ([]*License, *Response, error) { - req, err := s.client.NewRequest("GET", "licenses", nil) - if err != nil { - return nil, nil, err - } - - var licenses []*License - resp, err := s.client.Do(ctx, req, &licenses) - if err != nil { - return nil, resp, err - } - - return licenses, resp, nil -} - -// Get extended metadata for one license. -// -// GitHub API docs: https://developer.github.com/v3/licenses/#get-an-individual-license -func (s *LicensesService) Get(ctx context.Context, licenseName string) (*License, *Response, error) { - u := fmt.Sprintf("licenses/%s", licenseName) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - license := new(License) - resp, err := s.client.Do(ctx, req, license) - if err != nil { - return nil, resp, err - } - - return license, resp, nil -} diff --git a/vendor/github.com/google/go-github/v27/github/messages.go b/vendor/github.com/google/go-github/v27/github/messages.go deleted file mode 100644 index ac7c17f3ca81..000000000000 --- a/vendor/github.com/google/go-github/v27/github/messages.go +++ /dev/null @@ -1,258 +0,0 @@ -// Copyright 2016 The go-github AUTHORS. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// This file provides functions for validating payloads from GitHub Webhooks. -// GitHub API docs: https://developer.github.com/webhooks/securing/#validating-payloads-from-github - -package github - -import ( - "crypto/hmac" - "crypto/sha1" - "crypto/sha256" - "crypto/sha512" - "encoding/hex" - "encoding/json" - "errors" - "fmt" - "hash" - "io/ioutil" - "net/http" - "net/url" - "strings" -) - -const ( - // sha1Prefix is the prefix used by GitHub before the HMAC hexdigest. - sha1Prefix = "sha1" - // sha256Prefix and sha512Prefix are provided for future compatibility. - sha256Prefix = "sha256" - sha512Prefix = "sha512" - // signatureHeader is the GitHub header key used to pass the HMAC hexdigest. - signatureHeader = "X-Hub-Signature" - // eventTypeHeader is the GitHub header key used to pass the event type. - eventTypeHeader = "X-Github-Event" - // deliveryIDHeader is the GitHub header key used to pass the unique ID for the webhook event. - deliveryIDHeader = "X-Github-Delivery" -) - -var ( - // eventTypeMapping maps webhooks types to their corresponding go-github struct types. - eventTypeMapping = map[string]string{ - "check_run": "CheckRunEvent", - "check_suite": "CheckSuiteEvent", - "commit_comment": "CommitCommentEvent", - "create": "CreateEvent", - "delete": "DeleteEvent", - "deploy_key": "DeployKeyEvent", - "deployment": "DeploymentEvent", - "deployment_status": "DeploymentStatusEvent", - "fork": "ForkEvent", - "gollum": "GollumEvent", - "installation": "InstallationEvent", - "installation_repositories": "InstallationRepositoriesEvent", - "issue_comment": "IssueCommentEvent", - "issues": "IssuesEvent", - "label": "LabelEvent", - "marketplace_purchase": "MarketplacePurchaseEvent", - "member": "MemberEvent", - "membership": "MembershipEvent", - "meta": "MetaEvent", - "milestone": "MilestoneEvent", - "organization": "OrganizationEvent", - "org_block": "OrgBlockEvent", - "page_build": "PageBuildEvent", - "ping": "PingEvent", - "project": "ProjectEvent", - "project_card": "ProjectCardEvent", - "project_column": "ProjectColumnEvent", - "public": "PublicEvent", - "pull_request_review": "PullRequestReviewEvent", - "pull_request_review_comment": "PullRequestReviewCommentEvent", - "pull_request": "PullRequestEvent", - "push": "PushEvent", - "repository": "RepositoryEvent", - "repository_vulnerability_alert": "RepositoryVulnerabilityAlertEvent", - "release": "ReleaseEvent", - "star": "StarEvent", - "status": "StatusEvent", - "team": "TeamEvent", - "team_add": "TeamAddEvent", - "watch": "WatchEvent", - } -) - -// genMAC generates the HMAC signature for a message provided the secret key -// and hashFunc. -func genMAC(message, key []byte, hashFunc func() hash.Hash) []byte { - mac := hmac.New(hashFunc, key) - mac.Write(message) - return mac.Sum(nil) -} - -// checkMAC reports whether messageMAC is a valid HMAC tag for message. -func checkMAC(message, messageMAC, key []byte, hashFunc func() hash.Hash) bool { - expectedMAC := genMAC(message, key, hashFunc) - return hmac.Equal(messageMAC, expectedMAC) -} - -// messageMAC returns the hex-decoded HMAC tag from the signature and its -// corresponding hash function. -func messageMAC(signature string) ([]byte, func() hash.Hash, error) { - if signature == "" { - return nil, nil, errors.New("missing signature") - } - sigParts := strings.SplitN(signature, "=", 2) - if len(sigParts) != 2 { - return nil, nil, fmt.Errorf("error parsing signature %q", signature) - } - - var hashFunc func() hash.Hash - switch sigParts[0] { - case sha1Prefix: - hashFunc = sha1.New - case sha256Prefix: - hashFunc = sha256.New - case sha512Prefix: - hashFunc = sha512.New - default: - return nil, nil, fmt.Errorf("unknown hash type prefix: %q", sigParts[0]) - } - - buf, err := hex.DecodeString(sigParts[1]) - if err != nil { - return nil, nil, fmt.Errorf("error decoding signature %q: %v", signature, err) - } - return buf, hashFunc, nil -} - -// ValidatePayload validates an incoming GitHub Webhook event request -// and returns the (JSON) payload. -// The Content-Type header of the payload can be "application/json" or "application/x-www-form-urlencoded". -// If the Content-Type is neither then an error is returned. -// secretToken is the GitHub Webhook secret token. -// If your webhook does not contain a secret token, you can pass nil or an empty slice. -// This is intended for local development purposes only and all webhooks should ideally set up a secret token. -// -// Example usage: -// -// func (s *GitHubEventMonitor) ServeHTTP(w http.ResponseWriter, r *http.Request) { -// payload, err := github.ValidatePayload(r, s.webhookSecretKey) -// if err != nil { ... } -// // Process payload... -// } -// -func ValidatePayload(r *http.Request, secretToken []byte) (payload []byte, err error) { - var body []byte // Raw body that GitHub uses to calculate the signature. - - switch ct := r.Header.Get("Content-Type"); ct { - case "application/json": - var err error - if body, err = ioutil.ReadAll(r.Body); err != nil { - return nil, err - } - - // If the content type is application/json, - // the JSON payload is just the original body. - payload = body - - case "application/x-www-form-urlencoded": - // payloadFormParam is the name of the form parameter that the JSON payload - // will be in if a webhook has its content type set to application/x-www-form-urlencoded. - const payloadFormParam = "payload" - - var err error - if body, err = ioutil.ReadAll(r.Body); err != nil { - return nil, err - } - - // If the content type is application/x-www-form-urlencoded, - // the JSON payload will be under the "payload" form param. - form, err := url.ParseQuery(string(body)) - if err != nil { - return nil, err - } - payload = []byte(form.Get(payloadFormParam)) - - default: - return nil, fmt.Errorf("Webhook request has unsupported Content-Type %q", ct) - } - - // Only validate the signature if a secret token exists. This is intended for - // local development only and all webhooks should ideally set up a secret token. - if len(secretToken) > 0 { - sig := r.Header.Get(signatureHeader) - if err := ValidateSignature(sig, body, secretToken); err != nil { - return nil, err - } - } - - return payload, nil -} - -// ValidateSignature validates the signature for the given payload. -// signature is the GitHub hash signature delivered in the X-Hub-Signature header. -// payload is the JSON payload sent by GitHub Webhooks. -// secretToken is the GitHub Webhook secret token. -// -// GitHub API docs: https://developer.github.com/webhooks/securing/#validating-payloads-from-github -func ValidateSignature(signature string, payload, secretToken []byte) error { - messageMAC, hashFunc, err := messageMAC(signature) - if err != nil { - return err - } - if !checkMAC(payload, messageMAC, secretToken, hashFunc) { - return errors.New("payload signature check failed") - } - return nil -} - -// WebHookType returns the event type of webhook request r. -// -// GitHub API docs: https://developer.github.com/v3/repos/hooks/#webhook-headers -func WebHookType(r *http.Request) string { - return r.Header.Get(eventTypeHeader) -} - -// DeliveryID returns the unique delivery ID of webhook request r. -// -// GitHub API docs: https://developer.github.com/v3/repos/hooks/#webhook-headers -func DeliveryID(r *http.Request) string { - return r.Header.Get(deliveryIDHeader) -} - -// ParseWebHook parses the event payload. For recognized event types, a -// value of the corresponding struct type will be returned (as returned -// by Event.ParsePayload()). An error will be returned for unrecognized event -// types. -// -// Example usage: -// -// func (s *GitHubEventMonitor) ServeHTTP(w http.ResponseWriter, r *http.Request) { -// payload, err := github.ValidatePayload(r, s.webhookSecretKey) -// if err != nil { ... } -// event, err := github.ParseWebHook(github.WebHookType(r), payload) -// if err != nil { ... } -// switch event := event.(type) { -// case *github.CommitCommentEvent: -// processCommitCommentEvent(event) -// case *github.CreateEvent: -// processCreateEvent(event) -// ... -// } -// } -// -func ParseWebHook(messageType string, payload []byte) (interface{}, error) { - eventType, ok := eventTypeMapping[messageType] - if !ok { - return nil, fmt.Errorf("unknown X-Github-Event in message: %v", messageType) - } - - event := Event{ - Type: &eventType, - RawPayload: (*json.RawMessage)(&payload), - } - return event.ParsePayload() -} diff --git a/vendor/github.com/google/go-github/v27/github/migrations.go b/vendor/github.com/google/go-github/v27/github/migrations.go deleted file mode 100644 index 90cc1fae85f0..000000000000 --- a/vendor/github.com/google/go-github/v27/github/migrations.go +++ /dev/null @@ -1,224 +0,0 @@ -// Copyright 2016 The go-github 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 - -import ( - "context" - "errors" - "fmt" - "net/http" - "strings" -) - -// MigrationService provides access to the migration related functions -// in the GitHub API. -// -// GitHub API docs: https://developer.github.com/v3/migration/ -type MigrationService service - -// Migration represents a GitHub migration (archival). -type Migration struct { - ID *int64 `json:"id,omitempty"` - GUID *string `json:"guid,omitempty"` - // State is the current state of a migration. - // Possible values are: - // "pending" which means the migration hasn't started yet, - // "exporting" which means the migration is in progress, - // "exported" which means the migration finished successfully, or - // "failed" which means the migration failed. - State *string `json:"state,omitempty"` - // LockRepositories indicates whether repositories are locked (to prevent - // manipulation) while migrating data. - LockRepositories *bool `json:"lock_repositories,omitempty"` - // ExcludeAttachments indicates whether attachments should be excluded from - // the migration (to reduce migration archive file size). - ExcludeAttachments *bool `json:"exclude_attachments,omitempty"` - URL *string `json:"url,omitempty"` - CreatedAt *string `json:"created_at,omitempty"` - UpdatedAt *string `json:"updated_at,omitempty"` - Repositories []*Repository `json:"repositories,omitempty"` -} - -func (m Migration) String() string { - return Stringify(m) -} - -// MigrationOptions specifies the optional parameters to Migration methods. -type MigrationOptions struct { - // LockRepositories indicates whether repositories should be locked (to prevent - // manipulation) while migrating data. - LockRepositories bool - - // ExcludeAttachments indicates whether attachments should be excluded from - // the migration (to reduce migration archive file size). - ExcludeAttachments bool -} - -// startMigration represents the body of a StartMigration request. -type startMigration struct { - // Repositories is a slice of repository names to migrate. - Repositories []string `json:"repositories,omitempty"` - - // LockRepositories indicates whether repositories should be locked (to prevent - // manipulation) while migrating data. - LockRepositories *bool `json:"lock_repositories,omitempty"` - - // ExcludeAttachments indicates whether attachments should be excluded from - // the migration (to reduce migration archive file size). - ExcludeAttachments *bool `json:"exclude_attachments,omitempty"` -} - -// StartMigration starts the generation of a migration archive. -// repos is a slice of repository names to migrate. -// -// GitHub API docs: https://developer.github.com/v3/migration/migrations/#start-a-migration -func (s *MigrationService) StartMigration(ctx context.Context, org string, repos []string, opt *MigrationOptions) (*Migration, *Response, error) { - u := fmt.Sprintf("orgs/%v/migrations", org) - - body := &startMigration{Repositories: repos} - if opt != nil { - body.LockRepositories = Bool(opt.LockRepositories) - body.ExcludeAttachments = Bool(opt.ExcludeAttachments) - } - - req, err := s.client.NewRequest("POST", u, body) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeMigrationsPreview) - - m := &Migration{} - resp, err := s.client.Do(ctx, req, m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// ListMigrations lists the most recent migrations. -// -// GitHub API docs: https://developer.github.com/v3/migration/migrations/#get-a-list-of-migrations -func (s *MigrationService) ListMigrations(ctx context.Context, org string) ([]*Migration, *Response, error) { - u := fmt.Sprintf("orgs/%v/migrations", org) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeMigrationsPreview) - - var m []*Migration - resp, err := s.client.Do(ctx, req, &m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// MigrationStatus gets the status of a specific migration archive. -// id is the migration ID. -// -// GitHub API docs: https://developer.github.com/v3/migration/migrations/#get-the-status-of-a-migration -func (s *MigrationService) MigrationStatus(ctx context.Context, org string, id int64) (*Migration, *Response, error) { - u := fmt.Sprintf("orgs/%v/migrations/%v", org, id) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeMigrationsPreview) - - m := &Migration{} - resp, err := s.client.Do(ctx, req, m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// MigrationArchiveURL fetches a migration archive URL. -// id is the migration ID. -// -// GitHub API docs: https://developer.github.com/v3/migration/migrations/#download-a-migration-archive -func (s *MigrationService) MigrationArchiveURL(ctx context.Context, org string, id int64) (url string, err error) { - u := fmt.Sprintf("orgs/%v/migrations/%v/archive", org, id) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return "", err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeMigrationsPreview) - - s.client.clientMu.Lock() - defer s.client.clientMu.Unlock() - - // Disable the redirect mechanism because AWS fails if the GitHub auth token is provided. - var loc string - saveRedirect := s.client.client.CheckRedirect - s.client.client.CheckRedirect = func(req *http.Request, via []*http.Request) error { - loc = req.URL.String() - return errors.New("disable redirect") - } - defer func() { s.client.client.CheckRedirect = saveRedirect }() - - _, err = s.client.Do(ctx, req, nil) // expect error from disable redirect - if err == nil { - return "", errors.New("expected redirect, none provided") - } - if !strings.Contains(err.Error(), "disable redirect") { - return "", err - } - return loc, nil -} - -// DeleteMigration deletes a previous migration archive. -// id is the migration ID. -// -// GitHub API docs: https://developer.github.com/v3/migration/migrations/#delete-a-migration-archive -func (s *MigrationService) DeleteMigration(ctx context.Context, org string, id int64) (*Response, error) { - u := fmt.Sprintf("orgs/%v/migrations/%v/archive", org, id) - - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeMigrationsPreview) - - return s.client.Do(ctx, req, nil) -} - -// UnlockRepo unlocks a repository that was locked for migration. -// id is the migration ID. -// You should unlock each migrated repository and delete them when the migration -// is complete and you no longer need the source data. -// -// GitHub API docs: https://developer.github.com/v3/migration/migrations/#unlock-a-repository -func (s *MigrationService) UnlockRepo(ctx context.Context, org string, id int64, repo string) (*Response, error) { - u := fmt.Sprintf("orgs/%v/migrations/%v/repos/%v/lock", org, id, repo) - - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeMigrationsPreview) - - return s.client.Do(ctx, req, nil) -} diff --git a/vendor/github.com/google/go-github/v27/github/migrations_source_import.go b/vendor/github.com/google/go-github/v27/github/migrations_source_import.go deleted file mode 100644 index fd45e780065a..000000000000 --- a/vendor/github.com/google/go-github/v27/github/migrations_source_import.go +++ /dev/null @@ -1,329 +0,0 @@ -// Copyright 2016 The go-github 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 - -import ( - "context" - "fmt" -) - -// Import represents a repository import request. -type Import struct { - // The URL of the originating repository. - VCSURL *string `json:"vcs_url,omitempty"` - // The originating VCS type. Can be one of 'subversion', 'git', - // 'mercurial', or 'tfvc'. Without this parameter, the import job will - // take additional time to detect the VCS type before beginning the - // import. This detection step will be reflected in the response. - VCS *string `json:"vcs,omitempty"` - // VCSUsername and VCSPassword are only used for StartImport calls that - // are importing a password-protected repository. - VCSUsername *string `json:"vcs_username,omitempty"` - VCSPassword *string `json:"vcs_password,omitempty"` - // For a tfvc import, the name of the project that is being imported. - TFVCProject *string `json:"tfvc_project,omitempty"` - - // LFS related fields that may be preset in the Import Progress response - - // Describes whether the import has been opted in or out of using Git - // LFS. The value can be 'opt_in', 'opt_out', or 'undecided' if no - // action has been taken. - UseLFS *string `json:"use_lfs,omitempty"` - // Describes whether files larger than 100MB were found during the - // importing step. - HasLargeFiles *bool `json:"has_large_files,omitempty"` - // The total size in gigabytes of files larger than 100MB found in the - // originating repository. - LargeFilesSize *int `json:"large_files_size,omitempty"` - // The total number of files larger than 100MB found in the originating - // repository. To see a list of these files, call LargeFiles. - LargeFilesCount *int `json:"large_files_count,omitempty"` - - // Identifies the current status of an import. An import that does not - // have errors will progress through these steps: - // - // detecting - the "detection" step of the import is in progress - // because the request did not include a VCS parameter. The - // import is identifying the type of source control present at - // the URL. - // importing - the "raw" step of the import is in progress. This is - // where commit data is fetched from the original repository. - // The import progress response will include CommitCount (the - // total number of raw commits that will be imported) and - // Percent (0 - 100, the current progress through the import). - // mapping - the "rewrite" step of the import is in progress. This - // is where SVN branches are converted to Git branches, and - // where author updates are applied. The import progress - // response does not include progress information. - // pushing - the "push" step of the import is in progress. This is - // where the importer updates the repository on GitHub. The - // import progress response will include PushPercent, which is - // the percent value reported by git push when it is "Writing - // objects". - // complete - the import is complete, and the repository is ready - // on GitHub. - // - // If there are problems, you will see one of these in the status field: - // - // auth_failed - the import requires authentication in order to - // connect to the original repository. Make an UpdateImport - // request, and include VCSUsername and VCSPassword. - // error - the import encountered an error. The import progress - // response will include the FailedStep and an error message. - // Contact GitHub support for more information. - // detection_needs_auth - the importer requires authentication for - // the originating repository to continue detection. Make an - // UpdatImport request, and include VCSUsername and - // VCSPassword. - // detection_found_nothing - the importer didn't recognize any - // source control at the URL. - // detection_found_multiple - the importer found several projects - // or repositories at the provided URL. When this is the case, - // the Import Progress response will also include a - // ProjectChoices field with the possible project choices as - // values. Make an UpdateImport request, and include VCS and - // (if applicable) TFVCProject. - Status *string `json:"status,omitempty"` - CommitCount *int `json:"commit_count,omitempty"` - StatusText *string `json:"status_text,omitempty"` - AuthorsCount *int `json:"authors_count,omitempty"` - Percent *int `json:"percent,omitempty"` - PushPercent *int `json:"push_percent,omitempty"` - URL *string `json:"url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - AuthorsURL *string `json:"authors_url,omitempty"` - RepositoryURL *string `json:"repository_url,omitempty"` - Message *string `json:"message,omitempty"` - FailedStep *string `json:"failed_step,omitempty"` - - // Human readable display name, provided when the Import appears as - // part of ProjectChoices. - HumanName *string `json:"human_name,omitempty"` - - // When the importer finds several projects or repositories at the - // provided URLs, this will identify the available choices. Call - // UpdateImport with the selected Import value. - ProjectChoices []Import `json:"project_choices,omitempty"` -} - -func (i Import) String() string { - return Stringify(i) -} - -// SourceImportAuthor identifies an author imported from a source repository. -// -// GitHub API docs: https://developer.github.com/v3/migration/source_imports/#get-commit-authors -type SourceImportAuthor struct { - ID *int64 `json:"id,omitempty"` - RemoteID *string `json:"remote_id,omitempty"` - RemoteName *string `json:"remote_name,omitempty"` - Email *string `json:"email,omitempty"` - Name *string `json:"name,omitempty"` - URL *string `json:"url,omitempty"` - ImportURL *string `json:"import_url,omitempty"` -} - -func (a SourceImportAuthor) String() string { - return Stringify(a) -} - -// LargeFile identifies a file larger than 100MB found during a repository import. -// -// GitHub API docs: https://developer.github.com/v3/migration/source_imports/#get-large-files -type LargeFile struct { - RefName *string `json:"ref_name,omitempty"` - Path *string `json:"path,omitempty"` - OID *string `json:"oid,omitempty"` - Size *int `json:"size,omitempty"` -} - -func (f LargeFile) String() string { - return Stringify(f) -} - -// StartImport initiates a repository import. -// -// GitHub API docs: https://developer.github.com/v3/migration/source_imports/#start-an-import -func (s *MigrationService) StartImport(ctx context.Context, owner, repo string, in *Import) (*Import, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/import", owner, repo) - req, err := s.client.NewRequest("PUT", u, in) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches - req.Header.Set("Accept", mediaTypeImportPreview) - - out := new(Import) - resp, err := s.client.Do(ctx, req, out) - if err != nil { - return nil, resp, err - } - - return out, resp, nil -} - -// ImportProgress queries for the status and progress of an ongoing repository import. -// -// GitHub API docs: https://developer.github.com/v3/migration/source_imports/#get-import-progress -func (s *MigrationService) ImportProgress(ctx context.Context, owner, repo string) (*Import, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/import", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches - req.Header.Set("Accept", mediaTypeImportPreview) - - out := new(Import) - resp, err := s.client.Do(ctx, req, out) - if err != nil { - return nil, resp, err - } - - return out, resp, nil -} - -// UpdateImport initiates a repository import. -// -// GitHub API docs: https://developer.github.com/v3/migration/source_imports/#update-existing-import -func (s *MigrationService) UpdateImport(ctx context.Context, owner, repo string, in *Import) (*Import, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/import", owner, repo) - req, err := s.client.NewRequest("PATCH", u, in) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches - req.Header.Set("Accept", mediaTypeImportPreview) - - out := new(Import) - resp, err := s.client.Do(ctx, req, out) - if err != nil { - return nil, resp, err - } - - return out, resp, nil -} - -// CommitAuthors gets the authors mapped from the original repository. -// -// Each type of source control system represents authors in a different way. -// For example, a Git commit author has a display name and an email address, -// but a Subversion commit author just has a username. The GitHub Importer will -// make the author information valid, but the author might not be correct. For -// example, it will change the bare Subversion username "hubot" into something -// like "hubot ". -// -// This method and MapCommitAuthor allow you to provide correct Git author -// information. -// -// GitHub API docs: https://developer.github.com/v3/migration/source_imports/#get-commit-authors -func (s *MigrationService) CommitAuthors(ctx context.Context, owner, repo string) ([]*SourceImportAuthor, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/import/authors", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches - req.Header.Set("Accept", mediaTypeImportPreview) - - var authors []*SourceImportAuthor - resp, err := s.client.Do(ctx, req, &authors) - if err != nil { - return nil, resp, err - } - - return authors, resp, nil -} - -// MapCommitAuthor updates an author's identity for the import. Your -// application can continue updating authors any time before you push new -// commits to the repository. -// -// GitHub API docs: https://developer.github.com/v3/migration/source_imports/#map-a-commit-author -func (s *MigrationService) MapCommitAuthor(ctx context.Context, owner, repo string, id int64, author *SourceImportAuthor) (*SourceImportAuthor, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/import/authors/%v", owner, repo, id) - req, err := s.client.NewRequest("PATCH", u, author) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches - req.Header.Set("Accept", mediaTypeImportPreview) - - out := new(SourceImportAuthor) - resp, err := s.client.Do(ctx, req, out) - if err != nil { - return nil, resp, err - } - - return out, resp, nil -} - -// SetLFSPreference sets whether imported repositories should use Git LFS for -// files larger than 100MB. Only the UseLFS field on the provided Import is -// used. -// -// GitHub API docs: https://developer.github.com/v3/migration/source_imports/#set-git-lfs-preference -func (s *MigrationService) SetLFSPreference(ctx context.Context, owner, repo string, in *Import) (*Import, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/import/lfs", owner, repo) - req, err := s.client.NewRequest("PATCH", u, in) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches - req.Header.Set("Accept", mediaTypeImportPreview) - - out := new(Import) - resp, err := s.client.Do(ctx, req, out) - if err != nil { - return nil, resp, err - } - - return out, resp, nil -} - -// LargeFiles lists files larger than 100MB found during the import. -// -// GitHub API docs: https://developer.github.com/v3/migration/source_imports/#get-large-files -func (s *MigrationService) LargeFiles(ctx context.Context, owner, repo string) ([]*LargeFile, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/import/large_files", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches - req.Header.Set("Accept", mediaTypeImportPreview) - - var files []*LargeFile - resp, err := s.client.Do(ctx, req, &files) - if err != nil { - return nil, resp, err - } - - return files, resp, nil -} - -// CancelImport stops an import for a repository. -// -// GitHub API docs: https://developer.github.com/v3/migration/source_imports/#cancel-an-import -func (s *MigrationService) CancelImport(ctx context.Context, owner, repo string) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/import", owner, repo) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - // TODO: remove custom Accept header when this API fully launches - req.Header.Set("Accept", mediaTypeImportPreview) - - return s.client.Do(ctx, req, nil) -} diff --git a/vendor/github.com/google/go-github/v27/github/migrations_user.go b/vendor/github.com/google/go-github/v27/github/migrations_user.go deleted file mode 100644 index d45555f216b7..000000000000 --- a/vendor/github.com/google/go-github/v27/github/migrations_user.go +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright 2018 The go-github 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 - -import ( - "context" - "errors" - "fmt" - "net/http" -) - -// UserMigration represents a GitHub migration (archival). -type UserMigration struct { - ID *int64 `json:"id,omitempty"` - GUID *string `json:"guid,omitempty"` - // State is the current state of a migration. - // Possible values are: - // "pending" which means the migration hasn't started yet, - // "exporting" which means the migration is in progress, - // "exported" which means the migration finished successfully, or - // "failed" which means the migration failed. - State *string `json:"state,omitempty"` - // LockRepositories indicates whether repositories are locked (to prevent - // manipulation) while migrating data. - LockRepositories *bool `json:"lock_repositories,omitempty"` - // ExcludeAttachments indicates whether attachments should be excluded from - // the migration (to reduce migration archive file size). - ExcludeAttachments *bool `json:"exclude_attachments,omitempty"` - URL *string `json:"url,omitempty"` - CreatedAt *string `json:"created_at,omitempty"` - UpdatedAt *string `json:"updated_at,omitempty"` - Repositories []*Repository `json:"repositories,omitempty"` -} - -func (m UserMigration) String() string { - return Stringify(m) -} - -// UserMigrationOptions specifies the optional parameters to Migration methods. -type UserMigrationOptions struct { - // LockRepositories indicates whether repositories should be locked (to prevent - // manipulation) while migrating data. - LockRepositories bool - - // ExcludeAttachments indicates whether attachments should be excluded from - // the migration (to reduce migration archive file size). - ExcludeAttachments bool -} - -// startUserMigration represents the body of a StartMigration request. -type startUserMigration struct { - // Repositories is a slice of repository names to migrate. - Repositories []string `json:"repositories,omitempty"` - - // LockRepositories indicates whether repositories should be locked (to prevent - // manipulation) while migrating data. - LockRepositories *bool `json:"lock_repositories,omitempty"` - - // ExcludeAttachments indicates whether attachments should be excluded from - // the migration (to reduce migration archive file size). - ExcludeAttachments *bool `json:"exclude_attachments,omitempty"` -} - -// StartUserMigration starts the generation of a migration archive. -// repos is a slice of repository names to migrate. -// -// GitHub API docs: https://developer.github.com/v3/migrations/users/#start-a-user-migration -func (s *MigrationService) StartUserMigration(ctx context.Context, repos []string, opt *UserMigrationOptions) (*UserMigration, *Response, error) { - u := "user/migrations" - - body := &startUserMigration{Repositories: repos} - if opt != nil { - body.LockRepositories = Bool(opt.LockRepositories) - body.ExcludeAttachments = Bool(opt.ExcludeAttachments) - } - - req, err := s.client.NewRequest("POST", u, body) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeMigrationsPreview) - - m := &UserMigration{} - resp, err := s.client.Do(ctx, req, m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// ListUserMigrations lists the most recent migrations. -// -// GitHub API docs: https://developer.github.com/v3/migrations/users/#get-a-list-of-user-migrations -func (s *MigrationService) ListUserMigrations(ctx context.Context) ([]*UserMigration, *Response, error) { - u := "user/migrations" - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeMigrationsPreview) - - var m []*UserMigration - resp, err := s.client.Do(ctx, req, &m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// UserMigrationStatus gets the status of a specific migration archive. -// id is the migration ID. -// -// GitHub API docs: https://developer.github.com/v3/migrations/users/#get-the-status-of-a-user-migration -func (s *MigrationService) UserMigrationStatus(ctx context.Context, id int64) (*UserMigration, *Response, error) { - u := fmt.Sprintf("user/migrations/%v", id) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeMigrationsPreview) - - m := &UserMigration{} - resp, err := s.client.Do(ctx, req, m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// UserMigrationArchiveURL gets the URL for a specific migration archive. -// id is the migration ID. -// -// GitHub API docs: https://developer.github.com/v3/migrations/users/#download-a-user-migration-archive -func (s *MigrationService) UserMigrationArchiveURL(ctx context.Context, id int64) (string, error) { - url := fmt.Sprintf("user/migrations/%v/archive", id) - - req, err := s.client.NewRequest("GET", url, nil) - if err != nil { - return "", err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeMigrationsPreview) - - m := &UserMigration{} - - var loc string - originalRedirect := s.client.client.CheckRedirect - s.client.client.CheckRedirect = func(req *http.Request, via []*http.Request) error { - loc = req.URL.String() - return http.ErrUseLastResponse - } - defer func() { - s.client.client.CheckRedirect = originalRedirect - }() - resp, err := s.client.Do(ctx, req, m) - if err == nil { - return "", errors.New("expected redirect, none provided") - } - loc = resp.Header.Get("Location") - return loc, nil -} - -// DeleteUserMigration will delete a previous migration archive. -// id is the migration ID. -// -// GitHub API docs: https://developer.github.com/v3/migrations/users/#delete-a-user-migration-archive -func (s *MigrationService) DeleteUserMigration(ctx context.Context, id int64) (*Response, error) { - url := fmt.Sprintf("user/migrations/%v/archive", id) - - req, err := s.client.NewRequest("DELETE", url, nil) - if err != nil { - return nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeMigrationsPreview) - - return s.client.Do(ctx, req, nil) -} - -// UnlockUserRepo will unlock a repo that was locked for migration. -// id is migration ID. -// You should unlock each migrated repository and delete them when the migration -// is complete and you no longer need the source data. -// -// GitHub API docs: https://developer.github.com/v3/migrations/users/#unlock-a-user-repository -func (s *MigrationService) UnlockUserRepo(ctx context.Context, id int64, repo string) (*Response, error) { - url := fmt.Sprintf("user/migrations/%v/repos/%v/lock", id, repo) - - req, err := s.client.NewRequest("DELETE", url, nil) - if err != nil { - return nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeMigrationsPreview) - - return s.client.Do(ctx, req, nil) -} diff --git a/vendor/github.com/google/go-github/v27/github/misc.go b/vendor/github.com/google/go-github/v27/github/misc.go deleted file mode 100644 index e9b0ea22a62d..000000000000 --- a/vendor/github.com/google/go-github/v27/github/misc.go +++ /dev/null @@ -1,257 +0,0 @@ -// Copyright 2014 The go-github 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 - -import ( - "bytes" - "context" - "fmt" - "net/url" -) - -// MarkdownOptions specifies optional parameters to the Markdown method. -type MarkdownOptions struct { - // Mode identifies the rendering mode. Possible values are: - // markdown - render a document as plain Markdown, just like - // README files are rendered. - // - // gfm - to render a document as user-content, e.g. like user - // comments or issues are rendered. In GFM mode, hard line breaks are - // always taken into account, and issue and user mentions are linked - // accordingly. - // - // Default is "markdown". - Mode string - - // Context identifies the repository context. Only taken into account - // when rendering as "gfm". - Context string -} - -type markdownRequest struct { - Text *string `json:"text,omitempty"` - Mode *string `json:"mode,omitempty"` - Context *string `json:"context,omitempty"` -} - -// Markdown renders an arbitrary Markdown document. -// -// GitHub API docs: https://developer.github.com/v3/markdown/ -func (c *Client) Markdown(ctx context.Context, text string, opt *MarkdownOptions) (string, *Response, error) { - request := &markdownRequest{Text: String(text)} - if opt != nil { - if opt.Mode != "" { - request.Mode = String(opt.Mode) - } - if opt.Context != "" { - request.Context = String(opt.Context) - } - } - - req, err := c.NewRequest("POST", "markdown", request) - if err != nil { - return "", nil, err - } - - buf := new(bytes.Buffer) - resp, err := c.Do(ctx, req, buf) - if err != nil { - return "", resp, err - } - - return buf.String(), resp, nil -} - -// ListEmojis returns the emojis available to use on GitHub. -// -// GitHub API docs: https://developer.github.com/v3/emojis/ -func (c *Client) ListEmojis(ctx context.Context) (map[string]string, *Response, error) { - req, err := c.NewRequest("GET", "emojis", nil) - if err != nil { - return nil, nil, err - } - - var emoji map[string]string - resp, err := c.Do(ctx, req, &emoji) - if err != nil { - return nil, resp, err - } - - return emoji, resp, nil -} - -// CodeOfConduct represents a code of conduct. -type CodeOfConduct struct { - Name *string `json:"name,omitempty"` - Key *string `json:"key,omitempty"` - URL *string `json:"url,omitempty"` - Body *string `json:"body,omitempty"` -} - -func (c *CodeOfConduct) String() string { - return Stringify(c) -} - -// ListCodesOfConduct returns all codes of conduct. -// -// GitHub API docs: https://developer.github.com/v3/codes_of_conduct/#list-all-codes-of-conduct -func (c *Client) ListCodesOfConduct(ctx context.Context) ([]*CodeOfConduct, *Response, error) { - req, err := c.NewRequest("GET", "codes_of_conduct", nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeCodesOfConductPreview) - - var cs []*CodeOfConduct - resp, err := c.Do(ctx, req, &cs) - if err != nil { - return nil, resp, err - } - - return cs, resp, nil -} - -// GetCodeOfConduct returns an individual code of conduct. -// -// https://developer.github.com/v3/codes_of_conduct/#get-an-individual-code-of-conduct -func (c *Client) GetCodeOfConduct(ctx context.Context, key string) (*CodeOfConduct, *Response, error) { - u := fmt.Sprintf("codes_of_conduct/%s", key) - req, err := c.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeCodesOfConductPreview) - - coc := new(CodeOfConduct) - resp, err := c.Do(ctx, req, coc) - if err != nil { - return nil, resp, err - } - - return coc, resp, nil -} - -// APIMeta represents metadata about the GitHub API. -type APIMeta struct { - // An Array of IP addresses in CIDR format specifying the addresses - // that incoming service hooks will originate from on GitHub.com. - Hooks []string `json:"hooks,omitempty"` - - // An Array of IP addresses in CIDR format specifying the Git servers - // for GitHub.com. - Git []string `json:"git,omitempty"` - - // Whether authentication with username and password is supported. - // (GitHub Enterprise instances using CAS or OAuth for authentication - // will return false. Features like Basic Authentication with a - // username and password, sudo mode, and two-factor authentication are - // not supported on these servers.) - VerifiablePasswordAuthentication *bool `json:"verifiable_password_authentication,omitempty"` - - // An array of IP addresses in CIDR format specifying the addresses - // which serve GitHub Pages websites. - Pages []string `json:"pages,omitempty"` - - // An Array of IP addresses specifying the addresses that source imports - // will originate from on GitHub.com. - Importer []string `json:"importer,omitempty"` -} - -// APIMeta returns information about GitHub.com, the service. Or, if you access -// this endpoint on your organization’s GitHub Enterprise installation, this -// endpoint provides information about that installation. -// -// GitHub API docs: https://developer.github.com/v3/meta/ -func (c *Client) APIMeta(ctx context.Context) (*APIMeta, *Response, error) { - req, err := c.NewRequest("GET", "meta", nil) - if err != nil { - return nil, nil, err - } - - meta := new(APIMeta) - resp, err := c.Do(ctx, req, meta) - if err != nil { - return nil, resp, err - } - - return meta, resp, nil -} - -// Octocat returns an ASCII art octocat with the specified message in a speech -// bubble. If message is empty, a random zen phrase is used. -func (c *Client) Octocat(ctx context.Context, message string) (string, *Response, error) { - u := "octocat" - if message != "" { - u = fmt.Sprintf("%s?s=%s", u, url.QueryEscape(message)) - } - - req, err := c.NewRequest("GET", u, nil) - if err != nil { - return "", nil, err - } - - buf := new(bytes.Buffer) - resp, err := c.Do(ctx, req, buf) - if err != nil { - return "", resp, err - } - - return buf.String(), resp, nil -} - -// Zen returns a random line from The Zen of GitHub. -// -// see also: http://warpspire.com/posts/taste/ -func (c *Client) Zen(ctx context.Context) (string, *Response, error) { - req, err := c.NewRequest("GET", "zen", nil) - if err != nil { - return "", nil, err - } - - buf := new(bytes.Buffer) - resp, err := c.Do(ctx, req, buf) - if err != nil { - return "", resp, err - } - - return buf.String(), resp, nil -} - -// ServiceHook represents a hook that has configuration settings, a list of -// available events, and default events. -type ServiceHook struct { - Name *string `json:"name,omitempty"` - Events []string `json:"events,omitempty"` - SupportedEvents []string `json:"supported_events,omitempty"` - Schema [][]string `json:"schema,omitempty"` -} - -func (s *ServiceHook) String() string { - return Stringify(s) -} - -// ListServiceHooks lists all of the available service hooks. -// -// GitHub API docs: https://developer.github.com/webhooks/#services -func (c *Client) ListServiceHooks(ctx context.Context) ([]*ServiceHook, *Response, error) { - u := "hooks" - req, err := c.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var hooks []*ServiceHook - resp, err := c.Do(ctx, req, &hooks) - if err != nil { - return nil, resp, err - } - - return hooks, resp, nil -} diff --git a/vendor/github.com/google/go-github/v27/github/orgs.go b/vendor/github.com/google/go-github/v27/github/orgs.go deleted file mode 100644 index e1aa20db0b1b..000000000000 --- a/vendor/github.com/google/go-github/v27/github/orgs.go +++ /dev/null @@ -1,215 +0,0 @@ -// Copyright 2013 The go-github 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 - -import ( - "context" - "fmt" - "time" -) - -// OrganizationsService provides access to the organization related functions -// in the GitHub API. -// -// GitHub API docs: https://developer.github.com/v3/orgs/ -type OrganizationsService service - -// Organization represents a GitHub organization account. -type Organization struct { - Login *string `json:"login,omitempty"` - ID *int64 `json:"id,omitempty"` - NodeID *string `json:"node_id,omitempty"` - AvatarURL *string `json:"avatar_url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - Name *string `json:"name,omitempty"` - Company *string `json:"company,omitempty"` - Blog *string `json:"blog,omitempty"` - Location *string `json:"location,omitempty"` - Email *string `json:"email,omitempty"` - Description *string `json:"description,omitempty"` - PublicRepos *int `json:"public_repos,omitempty"` - PublicGists *int `json:"public_gists,omitempty"` - Followers *int `json:"followers,omitempty"` - Following *int `json:"following,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` - TotalPrivateRepos *int `json:"total_private_repos,omitempty"` - OwnedPrivateRepos *int `json:"owned_private_repos,omitempty"` - PrivateGists *int `json:"private_gists,omitempty"` - DiskUsage *int `json:"disk_usage,omitempty"` - Collaborators *int `json:"collaborators,omitempty"` - BillingEmail *string `json:"billing_email,omitempty"` - Type *string `json:"type,omitempty"` - Plan *Plan `json:"plan,omitempty"` - TwoFactorRequirementEnabled *bool `json:"two_factor_requirement_enabled,omitempty"` - - // DefaultRepoPermission can be one of: "read", "write", "admin", or "none". (Default: "read"). - // It is only used in OrganizationsService.Edit. - DefaultRepoPermission *string `json:"default_repository_permission,omitempty"` - // DefaultRepoSettings can be one of: "read", "write", "admin", or "none". (Default: "read"). - // It is only used in OrganizationsService.Get. - DefaultRepoSettings *string `json:"default_repository_settings,omitempty"` - - // MembersCanCreateRepos default value is true and is only used in Organizations.Edit. - MembersCanCreateRepos *bool `json:"members_can_create_repositories,omitempty"` - - // MembersAllowedRepositoryCreationType denotes if organization members can create repositories - // and the type of repositories they can create. Possible values are: "all", "private", or "none". - MembersAllowedRepositoryCreationType *string `json:"members_allowed_repository_creation_type,omitempty"` - - // API URLs - URL *string `json:"url,omitempty"` - EventsURL *string `json:"events_url,omitempty"` - HooksURL *string `json:"hooks_url,omitempty"` - IssuesURL *string `json:"issues_url,omitempty"` - MembersURL *string `json:"members_url,omitempty"` - PublicMembersURL *string `json:"public_members_url,omitempty"` - ReposURL *string `json:"repos_url,omitempty"` -} - -func (o Organization) String() string { - return Stringify(o) -} - -// Plan represents the payment plan for an account. See plans at https://github.com/plans. -type Plan struct { - Name *string `json:"name,omitempty"` - Space *int `json:"space,omitempty"` - Collaborators *int `json:"collaborators,omitempty"` - PrivateRepos *int `json:"private_repos,omitempty"` -} - -func (p Plan) String() string { - return Stringify(p) -} - -// OrganizationsListOptions specifies the optional parameters to the -// OrganizationsService.ListAll method. -type OrganizationsListOptions struct { - // Since filters Organizations by ID. - Since int64 `url:"since,omitempty"` - - // Note: Pagination is powered exclusively by the Since parameter, - // ListOptions.Page has no effect. - // ListOptions.PerPage controls an undocumented GitHub API parameter. - ListOptions -} - -// ListAll lists all organizations, in the order that they were created on GitHub. -// -// Note: Pagination is powered exclusively by the since parameter. To continue -// listing the next set of organizations, use the ID of the last-returned organization -// as the opts.Since parameter for the next call. -// -// GitHub API docs: https://developer.github.com/v3/orgs/#list-all-organizations -func (s *OrganizationsService) ListAll(ctx context.Context, opt *OrganizationsListOptions) ([]*Organization, *Response, error) { - u, err := addOptions("organizations", opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - orgs := []*Organization{} - resp, err := s.client.Do(ctx, req, &orgs) - if err != nil { - return nil, resp, err - } - return orgs, resp, nil -} - -// List the organizations for a user. Passing the empty string will list -// organizations for the authenticated user. -// -// GitHub API docs: https://developer.github.com/v3/orgs/#list-user-organizations -func (s *OrganizationsService) List(ctx context.Context, user string, opt *ListOptions) ([]*Organization, *Response, error) { - var u string - if user != "" { - u = fmt.Sprintf("users/%v/orgs", user) - } else { - u = "user/orgs" - } - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var orgs []*Organization - resp, err := s.client.Do(ctx, req, &orgs) - if err != nil { - return nil, resp, err - } - - return orgs, resp, nil -} - -// Get fetches an organization by name. -// -// GitHub API docs: https://developer.github.com/v3/orgs/#get-an-organization -func (s *OrganizationsService) Get(ctx context.Context, org string) (*Organization, *Response, error) { - u := fmt.Sprintf("orgs/%v", org) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeMemberAllowedRepoCreationTypePreview) - - organization := new(Organization) - resp, err := s.client.Do(ctx, req, organization) - if err != nil { - return nil, resp, err - } - - return organization, resp, nil -} - -// GetByID fetches an organization. -// -// Note: GetByID uses the undocumented GitHub API endpoint /organizations/:id. -func (s *OrganizationsService) GetByID(ctx context.Context, id int64) (*Organization, *Response, error) { - u := fmt.Sprintf("organizations/%d", id) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - organization := new(Organization) - resp, err := s.client.Do(ctx, req, organization) - if err != nil { - return nil, resp, err - } - - return organization, resp, nil -} - -// Edit an organization. -// -// GitHub API docs: https://developer.github.com/v3/orgs/#edit-an-organization -func (s *OrganizationsService) Edit(ctx context.Context, name string, org *Organization) (*Organization, *Response, error) { - u := fmt.Sprintf("orgs/%v", name) - req, err := s.client.NewRequest("PATCH", u, org) - if err != nil { - return nil, nil, err - } - - o := new(Organization) - resp, err := s.client.Do(ctx, req, o) - if err != nil { - return nil, resp, err - } - - return o, resp, nil -} diff --git a/vendor/github.com/google/go-github/v27/github/orgs_hooks.go b/vendor/github.com/google/go-github/v27/github/orgs_hooks.go deleted file mode 100644 index 5357eb878408..000000000000 --- a/vendor/github.com/google/go-github/v27/github/orgs_hooks.go +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright 2015 The go-github 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 - -import ( - "context" - "fmt" -) - -// ListHooks lists all Hooks for the specified organization. -// -// GitHub API docs: https://developer.github.com/v3/orgs/hooks/#list-hooks -func (s *OrganizationsService) ListHooks(ctx context.Context, org string, opt *ListOptions) ([]*Hook, *Response, error) { - u := fmt.Sprintf("orgs/%v/hooks", org) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var hooks []*Hook - resp, err := s.client.Do(ctx, req, &hooks) - if err != nil { - return nil, resp, err - } - - return hooks, resp, nil -} - -// GetHook returns a single specified Hook. -// -// GitHub API docs: https://developer.github.com/v3/orgs/hooks/#get-single-hook -func (s *OrganizationsService) GetHook(ctx context.Context, org string, id int64) (*Hook, *Response, error) { - u := fmt.Sprintf("orgs/%v/hooks/%d", org, id) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - hook := new(Hook) - resp, err := s.client.Do(ctx, req, hook) - return hook, resp, err -} - -// CreateHook creates a Hook for the specified org. -// Config is a required field. -// -// Note that only a subset of the hook fields are used and hook must -// not be nil. -// -// GitHub API docs: https://developer.github.com/v3/orgs/hooks/#create-a-hook -func (s *OrganizationsService) CreateHook(ctx context.Context, org string, hook *Hook) (*Hook, *Response, error) { - u := fmt.Sprintf("orgs/%v/hooks", org) - - hookReq := &createHookRequest{ - Name: "web", - Events: hook.Events, - Active: hook.Active, - Config: hook.Config, - } - - req, err := s.client.NewRequest("POST", u, hookReq) - if err != nil { - return nil, nil, err - } - - h := new(Hook) - resp, err := s.client.Do(ctx, req, h) - if err != nil { - return nil, resp, err - } - - return h, resp, nil -} - -// EditHook updates a specified Hook. -// -// GitHub API docs: https://developer.github.com/v3/orgs/hooks/#edit-a-hook -func (s *OrganizationsService) EditHook(ctx context.Context, org string, id int64, hook *Hook) (*Hook, *Response, error) { - u := fmt.Sprintf("orgs/%v/hooks/%d", org, id) - req, err := s.client.NewRequest("PATCH", u, hook) - if err != nil { - return nil, nil, err - } - h := new(Hook) - resp, err := s.client.Do(ctx, req, h) - return h, resp, err -} - -// PingHook triggers a 'ping' event to be sent to the Hook. -// -// GitHub API docs: https://developer.github.com/v3/orgs/hooks/#ping-a-hook -func (s *OrganizationsService) PingHook(ctx context.Context, org string, id int64) (*Response, error) { - u := fmt.Sprintf("orgs/%v/hooks/%d/pings", org, id) - req, err := s.client.NewRequest("POST", u, nil) - if err != nil { - return nil, err - } - return s.client.Do(ctx, req, nil) -} - -// DeleteHook deletes a specified Hook. -// -// GitHub API docs: https://developer.github.com/v3/orgs/hooks/#delete-a-hook -func (s *OrganizationsService) DeleteHook(ctx context.Context, org string, id int64) (*Response, error) { - u := fmt.Sprintf("orgs/%v/hooks/%d", org, id) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - return s.client.Do(ctx, req, nil) -} diff --git a/vendor/github.com/google/go-github/v27/github/orgs_members.go b/vendor/github.com/google/go-github/v27/github/orgs_members.go deleted file mode 100644 index d18435999c96..000000000000 --- a/vendor/github.com/google/go-github/v27/github/orgs_members.go +++ /dev/null @@ -1,370 +0,0 @@ -// Copyright 2013 The go-github 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 - -import ( - "context" - "fmt" -) - -// Membership represents the status of a user's membership in an organization or team. -type Membership struct { - URL *string `json:"url,omitempty"` - - // State is the user's status within the organization or team. - // Possible values are: "active", "pending" - State *string `json:"state,omitempty"` - - // Role identifies the user's role within the organization or team. - // Possible values for organization membership: - // member - non-owner organization member - // admin - organization owner - // - // Possible values for team membership are: - // member - a normal member of the team - // maintainer - a team maintainer. Able to add/remove other team - // members, promote other team members to team - // maintainer, and edit the team’s name and description - Role *string `json:"role,omitempty"` - - // For organization membership, the API URL of the organization. - OrganizationURL *string `json:"organization_url,omitempty"` - - // For organization membership, the organization the membership is for. - Organization *Organization `json:"organization,omitempty"` - - // For organization membership, the user the membership is for. - User *User `json:"user,omitempty"` -} - -func (m Membership) String() string { - return Stringify(m) -} - -// ListMembersOptions specifies optional parameters to the -// OrganizationsService.ListMembers method. -type ListMembersOptions struct { - // If true (or if the authenticated user is not an owner of the - // organization), list only publicly visible members. - PublicOnly bool `url:"-"` - - // Filter members returned in the list. Possible values are: - // 2fa_disabled, all. Default is "all". - Filter string `url:"filter,omitempty"` - - // Role filters members returned by their role in the organization. - // Possible values are: - // all - all members of the organization, regardless of role - // admin - organization owners - // member - non-owner organization members - // - // Default is "all". - Role string `url:"role,omitempty"` - - ListOptions -} - -// ListMembers lists the members for an organization. If the authenticated -// user is an owner of the organization, this will return both concealed and -// public members, otherwise it will only return public members. -// -// GitHub API docs: https://developer.github.com/v3/orgs/members/#members-list -func (s *OrganizationsService) ListMembers(ctx context.Context, org string, opt *ListMembersOptions) ([]*User, *Response, error) { - var u string - if opt != nil && opt.PublicOnly { - u = fmt.Sprintf("orgs/%v/public_members", org) - } else { - u = fmt.Sprintf("orgs/%v/members", org) - } - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var members []*User - resp, err := s.client.Do(ctx, req, &members) - if err != nil { - return nil, resp, err - } - - return members, resp, nil -} - -// IsMember checks if a user is a member of an organization. -// -// GitHub API docs: https://developer.github.com/v3/orgs/members/#check-membership -func (s *OrganizationsService) IsMember(ctx context.Context, org, user string) (bool, *Response, error) { - u := fmt.Sprintf("orgs/%v/members/%v", org, user) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return false, nil, err - } - - resp, err := s.client.Do(ctx, req, nil) - member, err := parseBoolResponse(err) - return member, resp, err -} - -// IsPublicMember checks if a user is a public member of an organization. -// -// GitHub API docs: https://developer.github.com/v3/orgs/members/#check-public-membership -func (s *OrganizationsService) IsPublicMember(ctx context.Context, org, user string) (bool, *Response, error) { - u := fmt.Sprintf("orgs/%v/public_members/%v", org, user) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return false, nil, err - } - - resp, err := s.client.Do(ctx, req, nil) - member, err := parseBoolResponse(err) - return member, resp, err -} - -// RemoveMember removes a user from all teams of an organization. -// -// GitHub API docs: https://developer.github.com/v3/orgs/members/#remove-a-member -func (s *OrganizationsService) RemoveMember(ctx context.Context, org, user string) (*Response, error) { - u := fmt.Sprintf("orgs/%v/members/%v", org, user) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} - -// PublicizeMembership publicizes a user's membership in an organization. (A -// user cannot publicize the membership for another user.) -// -// GitHub API docs: https://developer.github.com/v3/orgs/members/#publicize-a-users-membership -func (s *OrganizationsService) PublicizeMembership(ctx context.Context, org, user string) (*Response, error) { - u := fmt.Sprintf("orgs/%v/public_members/%v", org, user) - req, err := s.client.NewRequest("PUT", u, nil) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} - -// ConcealMembership conceals a user's membership in an organization. -// -// GitHub API docs: https://developer.github.com/v3/orgs/members/#conceal-a-users-membership -func (s *OrganizationsService) ConcealMembership(ctx context.Context, org, user string) (*Response, error) { - u := fmt.Sprintf("orgs/%v/public_members/%v", org, user) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} - -// ListOrgMembershipsOptions specifies optional parameters to the -// OrganizationsService.ListOrgMemberships method. -type ListOrgMembershipsOptions struct { - // Filter memberships to include only those with the specified state. - // Possible values are: "active", "pending". - State string `url:"state,omitempty"` - - ListOptions -} - -// ListOrgMemberships lists the organization memberships for the authenticated user. -// -// GitHub API docs: https://developer.github.com/v3/orgs/members/#list-your-organization-memberships -func (s *OrganizationsService) ListOrgMemberships(ctx context.Context, opt *ListOrgMembershipsOptions) ([]*Membership, *Response, error) { - u := "user/memberships/orgs" - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var memberships []*Membership - resp, err := s.client.Do(ctx, req, &memberships) - if err != nil { - return nil, resp, err - } - - return memberships, resp, nil -} - -// GetOrgMembership gets the membership for a user in a specified organization. -// Passing an empty string for user will get the membership for the -// authenticated user. -// -// GitHub API docs: -// https://developer.github.com/v3/orgs/members/#get-organization-membership -// https://developer.github.com/v3/orgs/members/#get-your-organization-membership -func (s *OrganizationsService) GetOrgMembership(ctx context.Context, user, org string) (*Membership, *Response, error) { - var u string - if user != "" { - u = fmt.Sprintf("orgs/%v/memberships/%v", org, user) - } else { - u = fmt.Sprintf("user/memberships/orgs/%v", org) - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - membership := new(Membership) - resp, err := s.client.Do(ctx, req, membership) - if err != nil { - return nil, resp, err - } - - return membership, resp, nil -} - -// EditOrgMembership edits the membership for user in specified organization. -// Passing an empty string for user will edit the membership for the -// authenticated user. -// -// GitHub API docs: https://developer.github.com/v3/orgs/members/#add-or-update-organization-membership -// GitHub API docs: https://developer.github.com/v3/orgs/members/#edit-your-organization-membership -func (s *OrganizationsService) EditOrgMembership(ctx context.Context, user, org string, membership *Membership) (*Membership, *Response, error) { - var u, method string - if user != "" { - u = fmt.Sprintf("orgs/%v/memberships/%v", org, user) - method = "PUT" - } else { - u = fmt.Sprintf("user/memberships/orgs/%v", org) - method = "PATCH" - } - - req, err := s.client.NewRequest(method, u, membership) - if err != nil { - return nil, nil, err - } - - m := new(Membership) - resp, err := s.client.Do(ctx, req, m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// RemoveOrgMembership removes user from the specified organization. If the -// user has been invited to the organization, this will cancel their invitation. -// -// GitHub API docs: https://developer.github.com/v3/orgs/members/#remove-organization-membership -func (s *OrganizationsService) RemoveOrgMembership(ctx context.Context, user, org string) (*Response, error) { - u := fmt.Sprintf("orgs/%v/memberships/%v", org, user) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} - -// ListPendingOrgInvitations returns a list of pending invitations. -// -// GitHub API docs: https://developer.github.com/v3/orgs/members/#list-pending-organization-invitations -func (s *OrganizationsService) ListPendingOrgInvitations(ctx context.Context, org string, opt *ListOptions) ([]*Invitation, *Response, error) { - u := fmt.Sprintf("orgs/%v/invitations", org) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var pendingInvitations []*Invitation - resp, err := s.client.Do(ctx, req, &pendingInvitations) - if err != nil { - return nil, resp, err - } - return pendingInvitations, resp, nil -} - -// CreateOrgInvitationOptions specifies the parameters to the OrganizationService.Invite -// method. -type CreateOrgInvitationOptions struct { - // GitHub user ID for the person you are inviting. Not required if you provide Email. - InviteeID *int64 `json:"invitee_id,omitempty"` - // Email address of the person you are inviting, which can be an existing GitHub user. - // Not required if you provide InviteeID - Email *string `json:"email,omitempty"` - // Specify role for new member. Can be one of: - // * admin - Organization owners with full administrative rights to the - // organization and complete access to all repositories and teams. - // * direct_member - Non-owner organization members with ability to see - // other members and join teams by invitation. - // * billing_manager - Non-owner organization members with ability to - // manage the billing settings of your organization. - // Default is "direct_member". - Role *string `json:"role"` - TeamID []int64 `json:"team_ids"` -} - -// CreateOrgInvitation invites people to an organization by using their GitHub user ID or their email address. -// In order to create invitations in an organization, -// the authenticated user must be an organization owner. -// -// https://developer.github.com/v3/orgs/members/#create-organization-invitation -func (s *OrganizationsService) CreateOrgInvitation(ctx context.Context, org string, opt *CreateOrgInvitationOptions) (*Invitation, *Response, error) { - u := fmt.Sprintf("orgs/%v/invitations", org) - - req, err := s.client.NewRequest("POST", u, opt) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeOrganizationInvitationPreview) - - var invitation *Invitation - resp, err := s.client.Do(ctx, req, &invitation) - if err != nil { - return nil, resp, err - } - return invitation, resp, nil -} - -// ListOrgInvitationTeams lists all teams associated with an invitation. In order to see invitations in an organization, -// the authenticated user must be an organization owner. -// -// GitHub API docs: https://developer.github.com/v3/orgs/members/#list-organization-invitation-teams -func (s *OrganizationsService) ListOrgInvitationTeams(ctx context.Context, org, invitationID string, opt *ListOptions) ([]*Team, *Response, error) { - u := fmt.Sprintf("orgs/%v/invitations/%v/teams", org, invitationID) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeOrganizationInvitationPreview) - - var orgInvitationTeams []*Team - resp, err := s.client.Do(ctx, req, &orgInvitationTeams) - if err != nil { - return nil, resp, err - } - return orgInvitationTeams, resp, nil -} diff --git a/vendor/github.com/google/go-github/v27/github/orgs_outside_collaborators.go b/vendor/github.com/google/go-github/v27/github/orgs_outside_collaborators.go deleted file mode 100644 index 85ffd05f61aa..000000000000 --- a/vendor/github.com/google/go-github/v27/github/orgs_outside_collaborators.go +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2017 The go-github 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 - -import ( - "context" - "fmt" -) - -// ListOutsideCollaboratorsOptions specifies optional parameters to the -// OrganizationsService.ListOutsideCollaborators method. -type ListOutsideCollaboratorsOptions struct { - // Filter outside collaborators returned in the list. Possible values are: - // 2fa_disabled, all. Default is "all". - Filter string `url:"filter,omitempty"` - - ListOptions -} - -// ListOutsideCollaborators lists outside collaborators of organization's repositories. -// This will only work if the authenticated -// user is an owner of the organization. -// -// Warning: The API may change without advance notice during the preview period. -// Preview features are not supported for production use. -// -// GitHub API docs: https://developer.github.com/v3/orgs/outside_collaborators/#list-outside-collaborators -func (s *OrganizationsService) ListOutsideCollaborators(ctx context.Context, org string, opt *ListOutsideCollaboratorsOptions) ([]*User, *Response, error) { - u := fmt.Sprintf("orgs/%v/outside_collaborators", org) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var members []*User - resp, err := s.client.Do(ctx, req, &members) - if err != nil { - return nil, resp, err - } - - return members, resp, nil -} - -// RemoveOutsideCollaborator removes a user from the list of outside collaborators; -// consequently, removing them from all the organization's repositories. -// -// GitHub API docs: https://developer.github.com/v3/orgs/outside_collaborators/#remove-outside-collaborator -func (s *OrganizationsService) RemoveOutsideCollaborator(ctx context.Context, org string, user string) (*Response, error) { - u := fmt.Sprintf("orgs/%v/outside_collaborators/%v", org, user) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} - -// ConvertMemberToOutsideCollaborator reduces the permission level of a member of the -// organization to that of an outside collaborator. Therefore, they will only -// have access to the repositories that their current team membership allows. -// Responses for converting a non-member or the last owner to an outside collaborator -// are listed in GitHub API docs. -// -// GitHub API docs: https://developer.github.com/v3/orgs/outside_collaborators/#convert-member-to-outside-collaborator -func (s *OrganizationsService) ConvertMemberToOutsideCollaborator(ctx context.Context, org string, user string) (*Response, error) { - u := fmt.Sprintf("orgs/%v/outside_collaborators/%v", org, user) - req, err := s.client.NewRequest("PUT", u, nil) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} diff --git a/vendor/github.com/google/go-github/v27/github/orgs_projects.go b/vendor/github.com/google/go-github/v27/github/orgs_projects.go deleted file mode 100644 index e57cba97829e..000000000000 --- a/vendor/github.com/google/go-github/v27/github/orgs_projects.go +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2017 The go-github 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 - -import ( - "context" - "fmt" -) - -// ListProjects lists the projects for an organization. -// -// GitHub API docs: https://developer.github.com/v3/projects/#list-organization-projects -func (s *OrganizationsService) ListProjects(ctx context.Context, org string, opt *ProjectListOptions) ([]*Project, *Response, error) { - u := fmt.Sprintf("orgs/%v/projects", org) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeProjectsPreview) - - var projects []*Project - resp, err := s.client.Do(ctx, req, &projects) - if err != nil { - return nil, resp, err - } - - return projects, resp, nil -} - -// CreateProject creates a GitHub Project for the specified organization. -// -// GitHub API docs: https://developer.github.com/v3/projects/#create-an-organization-project -func (s *OrganizationsService) CreateProject(ctx context.Context, org string, opt *ProjectOptions) (*Project, *Response, error) { - u := fmt.Sprintf("orgs/%v/projects", org) - req, err := s.client.NewRequest("POST", u, opt) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeProjectsPreview) - - project := &Project{} - resp, err := s.client.Do(ctx, req, project) - if err != nil { - return nil, resp, err - } - - return project, resp, nil -} diff --git a/vendor/github.com/google/go-github/v27/github/orgs_users_blocking.go b/vendor/github.com/google/go-github/v27/github/orgs_users_blocking.go deleted file mode 100644 index b1aecf44532c..000000000000 --- a/vendor/github.com/google/go-github/v27/github/orgs_users_blocking.go +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright 2017 The go-github 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 - -import ( - "context" - "fmt" -) - -// ListBlockedUsers lists all the users blocked by an organization. -// -// GitHub API docs: https://developer.github.com/v3/orgs/blocking/#list-blocked-users -func (s *OrganizationsService) ListBlockedUsers(ctx context.Context, org string, opt *ListOptions) ([]*User, *Response, error) { - u := fmt.Sprintf("orgs/%v/blocks", org) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeBlockUsersPreview) - - var blockedUsers []*User - resp, err := s.client.Do(ctx, req, &blockedUsers) - if err != nil { - return nil, resp, err - } - - return blockedUsers, resp, nil -} - -// IsBlocked reports whether specified user is blocked from an organization. -// -// GitHub API docs: https://developer.github.com/v3/orgs/blocking/#check-whether-a-user-is-blocked-from-an-organization -func (s *OrganizationsService) IsBlocked(ctx context.Context, org string, user string) (bool, *Response, error) { - u := fmt.Sprintf("orgs/%v/blocks/%v", org, user) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return false, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeBlockUsersPreview) - - resp, err := s.client.Do(ctx, req, nil) - isBlocked, err := parseBoolResponse(err) - return isBlocked, resp, err -} - -// BlockUser blocks specified user from an organization. -// -// GitHub API docs: https://developer.github.com/v3/orgs/blocking/#block-a-user -func (s *OrganizationsService) BlockUser(ctx context.Context, org string, user string) (*Response, error) { - u := fmt.Sprintf("orgs/%v/blocks/%v", org, user) - - req, err := s.client.NewRequest("PUT", u, nil) - if err != nil { - return nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeBlockUsersPreview) - - return s.client.Do(ctx, req, nil) -} - -// UnblockUser unblocks specified user from an organization. -// -// GitHub API docs: https://developer.github.com/v3/orgs/blocking/#unblock-a-user -func (s *OrganizationsService) UnblockUser(ctx context.Context, org string, user string) (*Response, error) { - u := fmt.Sprintf("orgs/%v/blocks/%v", org, user) - - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeBlockUsersPreview) - - return s.client.Do(ctx, req, nil) -} diff --git a/vendor/github.com/google/go-github/v27/github/projects.go b/vendor/github.com/google/go-github/v27/github/projects.go deleted file mode 100644 index 1e9620dfd9fd..000000000000 --- a/vendor/github.com/google/go-github/v27/github/projects.go +++ /dev/null @@ -1,594 +0,0 @@ -// Copyright 2016 The go-github 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 - -import ( - "context" - "fmt" -) - -// ProjectsService provides access to the projects functions in the -// GitHub API. -// -// GitHub API docs: https://developer.github.com/v3/projects/ -type ProjectsService service - -// Project represents a GitHub Project. -type Project struct { - ID *int64 `json:"id,omitempty"` - URL *string `json:"url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - ColumnsURL *string `json:"columns_url,omitempty"` - OwnerURL *string `json:"owner_url,omitempty"` - Name *string `json:"name,omitempty"` - Body *string `json:"body,omitempty"` - Number *int `json:"number,omitempty"` - State *string `json:"state,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - NodeID *string `json:"node_id,omitempty"` - - // The User object that generated the project. - Creator *User `json:"creator,omitempty"` -} - -func (p Project) String() string { - return Stringify(p) -} - -// GetProject gets a GitHub Project for a repo. -// -// GitHub API docs: https://developer.github.com/v3/projects/#get-a-project -func (s *ProjectsService) GetProject(ctx context.Context, id int64) (*Project, *Response, error) { - u := fmt.Sprintf("projects/%v", id) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeProjectsPreview) - - project := &Project{} - resp, err := s.client.Do(ctx, req, project) - if err != nil { - return nil, resp, err - } - - return project, resp, nil -} - -// ProjectOptions specifies the parameters to the -// RepositoriesService.CreateProject and -// ProjectsService.UpdateProject methods. -type ProjectOptions struct { - // The name of the project. (Required for creation; optional for update.) - Name *string `json:"name,omitempty"` - // The body of the project. (Optional.) - Body *string `json:"body,omitempty"` - - // The following field(s) are only applicable for update. - // They should be left with zero values for creation. - - // State of the project. Either "open" or "closed". (Optional.) - State *string `json:"state,omitempty"` - // The permission level that all members of the project's organization - // will have on this project. - // Setting the organization permission is only available - // for organization projects. (Optional.) - OrganizationPermission *string `json:"organization_permission,omitempty"` - // Sets visibility of the project within the organization. - // Setting visibility is only available - // for organization projects.(Optional.) - Public *bool `json:"public,omitempty"` -} - -// UpdateProject updates a repository project. -// -// GitHub API docs: https://developer.github.com/v3/projects/#update-a-project -func (s *ProjectsService) UpdateProject(ctx context.Context, id int64, opt *ProjectOptions) (*Project, *Response, error) { - u := fmt.Sprintf("projects/%v", id) - req, err := s.client.NewRequest("PATCH", u, opt) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeProjectsPreview) - - project := &Project{} - resp, err := s.client.Do(ctx, req, project) - if err != nil { - return nil, resp, err - } - - return project, resp, nil -} - -// DeleteProject deletes a GitHub Project from a repository. -// -// GitHub API docs: https://developer.github.com/v3/projects/#delete-a-project -func (s *ProjectsService) DeleteProject(ctx context.Context, id int64) (*Response, error) { - u := fmt.Sprintf("projects/%v", id) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeProjectsPreview) - - return s.client.Do(ctx, req, nil) -} - -// ProjectColumn represents a column of a GitHub Project. -// -// GitHub API docs: https://developer.github.com/v3/repos/projects/ -type ProjectColumn struct { - ID *int64 `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - URL *string `json:"url,omitempty"` - ProjectURL *string `json:"project_url,omitempty"` - CardsURL *string `json:"cards_url,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - NodeID *string `json:"node_id,omitempty"` -} - -// ListProjectColumns lists the columns of a GitHub Project for a repo. -// -// GitHub API docs: https://developer.github.com/v3/projects/columns/#list-project-columns -func (s *ProjectsService) ListProjectColumns(ctx context.Context, projectID int64, opt *ListOptions) ([]*ProjectColumn, *Response, error) { - u := fmt.Sprintf("projects/%v/columns", projectID) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeProjectsPreview) - - columns := []*ProjectColumn{} - resp, err := s.client.Do(ctx, req, &columns) - if err != nil { - return nil, resp, err - } - - return columns, resp, nil -} - -// GetProjectColumn gets a column of a GitHub Project for a repo. -// -// GitHub API docs: https://developer.github.com/v3/projects/columns/#get-a-project-column -func (s *ProjectsService) GetProjectColumn(ctx context.Context, id int64) (*ProjectColumn, *Response, error) { - u := fmt.Sprintf("projects/columns/%v", id) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeProjectsPreview) - - column := &ProjectColumn{} - resp, err := s.client.Do(ctx, req, column) - if err != nil { - return nil, resp, err - } - - return column, resp, nil -} - -// ProjectColumnOptions specifies the parameters to the -// ProjectsService.CreateProjectColumn and -// ProjectsService.UpdateProjectColumn methods. -type ProjectColumnOptions struct { - // The name of the project column. (Required for creation and update.) - Name string `json:"name"` -} - -// CreateProjectColumn creates a column for the specified (by number) project. -// -// GitHub API docs: https://developer.github.com/v3/projects/columns/#create-a-project-column -func (s *ProjectsService) CreateProjectColumn(ctx context.Context, projectID int64, opt *ProjectColumnOptions) (*ProjectColumn, *Response, error) { - u := fmt.Sprintf("projects/%v/columns", projectID) - req, err := s.client.NewRequest("POST", u, opt) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeProjectsPreview) - - column := &ProjectColumn{} - resp, err := s.client.Do(ctx, req, column) - if err != nil { - return nil, resp, err - } - - return column, resp, nil -} - -// UpdateProjectColumn updates a column of a GitHub Project. -// -// GitHub API docs: https://developer.github.com/v3/projects/columns/#update-a-project-column -func (s *ProjectsService) UpdateProjectColumn(ctx context.Context, columnID int64, opt *ProjectColumnOptions) (*ProjectColumn, *Response, error) { - u := fmt.Sprintf("projects/columns/%v", columnID) - req, err := s.client.NewRequest("PATCH", u, opt) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeProjectsPreview) - - column := &ProjectColumn{} - resp, err := s.client.Do(ctx, req, column) - if err != nil { - return nil, resp, err - } - - return column, resp, nil -} - -// DeleteProjectColumn deletes a column from a GitHub Project. -// -// GitHub API docs: https://developer.github.com/v3/projects/columns/#delete-a-project-column -func (s *ProjectsService) DeleteProjectColumn(ctx context.Context, columnID int64) (*Response, error) { - u := fmt.Sprintf("projects/columns/%v", columnID) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeProjectsPreview) - - return s.client.Do(ctx, req, nil) -} - -// ProjectColumnMoveOptions specifies the parameters to the -// ProjectsService.MoveProjectColumn method. -type ProjectColumnMoveOptions struct { - // Position can be one of "first", "last", or "after:", where - // is the ID of a column in the same project. (Required.) - Position string `json:"position"` -} - -// MoveProjectColumn moves a column within a GitHub Project. -// -// GitHub API docs: https://developer.github.com/v3/projects/columns/#move-a-project-column -func (s *ProjectsService) MoveProjectColumn(ctx context.Context, columnID int64, opt *ProjectColumnMoveOptions) (*Response, error) { - u := fmt.Sprintf("projects/columns/%v/moves", columnID) - req, err := s.client.NewRequest("POST", u, opt) - if err != nil { - return nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeProjectsPreview) - - return s.client.Do(ctx, req, nil) -} - -// ProjectCard represents a card in a column of a GitHub Project. -// -// GitHub API docs: https://developer.github.com/v3/projects/cards/#get-a-project-card -type ProjectCard struct { - URL *string `json:"url,omitempty"` - ColumnURL *string `json:"column_url,omitempty"` - ContentURL *string `json:"content_url,omitempty"` - ID *int64 `json:"id,omitempty"` - Note *string `json:"note,omitempty"` - Creator *User `json:"creator,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - NodeID *string `json:"node_id,omitempty"` - Archived *bool `json:"archived,omitempty"` - - // The following fields are only populated by Webhook events. - ColumnID *int64 `json:"column_id,omitempty"` - - // The following fields are only populated by Events API. - ProjectID *int64 `json:"project_id,omitempty"` - ProjectURL *string `json:"project_url,omitempty"` - ColumnName *string `json:"column_name,omitempty"` - PreviousColumnName *string `json:"previous_column_name,omitempty"` // Populated in "moved_columns_in_project" event deliveries. -} - -// ProjectCardListOptions specifies the optional parameters to the -// ProjectsService.ListProjectCards method. -type ProjectCardListOptions struct { - // ArchivedState is used to list all, archived, or not_archived project cards. - // Defaults to not_archived when you omit this parameter. - ArchivedState *string `url:"archived_state,omitempty"` - - ListOptions -} - -// ListProjectCards lists the cards in a column of a GitHub Project. -// -// GitHub API docs: https://developer.github.com/v3/projects/cards/#list-project-cards -func (s *ProjectsService) ListProjectCards(ctx context.Context, columnID int64, opt *ProjectCardListOptions) ([]*ProjectCard, *Response, error) { - u := fmt.Sprintf("projects/columns/%v/cards", columnID) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeProjectsPreview) - - cards := []*ProjectCard{} - resp, err := s.client.Do(ctx, req, &cards) - if err != nil { - return nil, resp, err - } - - return cards, resp, nil -} - -// GetProjectCard gets a card in a column of a GitHub Project. -// -// GitHub API docs: https://developer.github.com/v3/projects/cards/#get-a-project-card -func (s *ProjectsService) GetProjectCard(ctx context.Context, cardID int64) (*ProjectCard, *Response, error) { - u := fmt.Sprintf("projects/columns/cards/%v", cardID) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeProjectsPreview) - - card := &ProjectCard{} - resp, err := s.client.Do(ctx, req, card) - if err != nil { - return nil, resp, err - } - - return card, resp, nil -} - -// ProjectCardOptions specifies the parameters to the -// ProjectsService.CreateProjectCard and -// ProjectsService.UpdateProjectCard methods. -type ProjectCardOptions struct { - // The note of the card. Note and ContentID are mutually exclusive. - Note string `json:"note,omitempty"` - // The ID (not Number) of the Issue to associate with this card. - // Note and ContentID are mutually exclusive. - ContentID int64 `json:"content_id,omitempty"` - // The type of content to associate with this card. Possible values are: "Issue" and "PullRequest". - ContentType string `json:"content_type,omitempty"` - // Use true to archive a project card. - // Specify false if you need to restore a previously archived project card. - Archived *bool `json:"archived,omitempty"` -} - -// CreateProjectCard creates a card in the specified column of a GitHub Project. -// -// GitHub API docs: https://developer.github.com/v3/projects/cards/#create-a-project-card -func (s *ProjectsService) CreateProjectCard(ctx context.Context, columnID int64, opt *ProjectCardOptions) (*ProjectCard, *Response, error) { - u := fmt.Sprintf("projects/columns/%v/cards", columnID) - req, err := s.client.NewRequest("POST", u, opt) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeProjectsPreview) - - card := &ProjectCard{} - resp, err := s.client.Do(ctx, req, card) - if err != nil { - return nil, resp, err - } - - return card, resp, nil -} - -// UpdateProjectCard updates a card of a GitHub Project. -// -// GitHub API docs: https://developer.github.com/v3/projects/cards/#update-a-project-card -func (s *ProjectsService) UpdateProjectCard(ctx context.Context, cardID int64, opt *ProjectCardOptions) (*ProjectCard, *Response, error) { - u := fmt.Sprintf("projects/columns/cards/%v", cardID) - req, err := s.client.NewRequest("PATCH", u, opt) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeProjectsPreview) - - card := &ProjectCard{} - resp, err := s.client.Do(ctx, req, card) - if err != nil { - return nil, resp, err - } - - return card, resp, nil -} - -// DeleteProjectCard deletes a card from a GitHub Project. -// -// GitHub API docs: https://developer.github.com/v3/projects/cards/#delete-a-project-card -func (s *ProjectsService) DeleteProjectCard(ctx context.Context, cardID int64) (*Response, error) { - u := fmt.Sprintf("projects/columns/cards/%v", cardID) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeProjectsPreview) - - return s.client.Do(ctx, req, nil) -} - -// ProjectCardMoveOptions specifies the parameters to the -// ProjectsService.MoveProjectCard method. -type ProjectCardMoveOptions struct { - // Position can be one of "top", "bottom", or "after:", where - // is the ID of a card in the same project. - Position string `json:"position"` - // ColumnID is the ID of a column in the same project. Note that ColumnID - // is required when using Position "after:" when that card is in - // another column; otherwise it is optional. - ColumnID int64 `json:"column_id,omitempty"` -} - -// MoveProjectCard moves a card within a GitHub Project. -// -// GitHub API docs: https://developer.github.com/v3/projects/cards/#move-a-project-card -func (s *ProjectsService) MoveProjectCard(ctx context.Context, cardID int64, opt *ProjectCardMoveOptions) (*Response, error) { - u := fmt.Sprintf("projects/columns/cards/%v/moves", cardID) - req, err := s.client.NewRequest("POST", u, opt) - if err != nil { - return nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeProjectsPreview) - - return s.client.Do(ctx, req, nil) -} - -// ProjectCollaboratorOptions specifies the optional parameters to the -// ProjectsService.AddProjectCollaborator method. -type ProjectCollaboratorOptions struct { - // Permission specifies the permission to grant to the collaborator. - // Possible values are: - // "read" - can read, but not write to or administer this project. - // "write" - can read and write, but not administer this project. - // "admin" - can read, write and administer this project. - // - // Default value is "write" - Permission *string `json:"permission,omitempty"` -} - -// AddProjectCollaborator adds a collaborator to an organization project and sets -// their permission level. You must be an organization owner or a project admin to add a collaborator. -// -// GitHub API docs: https://developer.github.com/v3/projects/collaborators/#add-user-as-a-collaborator -func (s *ProjectsService) AddProjectCollaborator(ctx context.Context, id int64, username string, opt *ProjectCollaboratorOptions) (*Response, error) { - u := fmt.Sprintf("projects/%v/collaborators/%v", id, username) - req, err := s.client.NewRequest("PUT", u, opt) - if err != nil { - return nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeProjectsPreview) - - return s.client.Do(ctx, req, nil) -} - -// RemoveProjectCollaborator removes a collaborator from an organization project. -// You must be an organization owner or a project admin to remove a collaborator. -// -// GitHub API docs: https://developer.github.com/v3/projects/collaborators/#remove-user-as-a-collaborator -func (s *ProjectsService) RemoveProjectCollaborator(ctx context.Context, id int64, username string) (*Response, error) { - u := fmt.Sprintf("projects/%v/collaborators/%v", id, username) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeProjectsPreview) - - return s.client.Do(ctx, req, nil) -} - -// ListCollaboratorOptions specifies the optional parameters to the -// ProjectsService.ListProjectCollaborators method. -type ListCollaboratorOptions struct { - // Affiliation specifies how collaborators should be filtered by their affiliation. - // Possible values are: - // "outside" - All outside collaborators of an organization-owned repository - // "direct" - All collaborators with permissions to an organization-owned repository, - // regardless of organization membership status - // "all" - All collaborators the authenticated user can see - // - // Default value is "all". - Affiliation *string `url:"affiliation,omitempty"` - - ListOptions -} - -// ListProjectCollaborators lists the collaborators for an organization project. For a project, -// the list of collaborators includes outside collaborators, organization members that are direct -// collaborators, organization members with access through team memberships, organization members -// with access through default organization permissions, and organization owners. You must be an -// organization owner or a project admin to list collaborators. -// -// GitHub API docs: https://developer.github.com/v3/projects/collaborators/#list-collaborators -func (s *ProjectsService) ListProjectCollaborators(ctx context.Context, id int64, opt *ListCollaboratorOptions) ([]*User, *Response, error) { - u := fmt.Sprintf("projects/%v/collaborators", id) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeProjectsPreview) - - var users []*User - resp, err := s.client.Do(ctx, req, &users) - if err != nil { - return nil, resp, err - } - - return users, resp, nil -} - -// ProjectPermissionLevel represents the permission level an organization -// member has for a given project. -type ProjectPermissionLevel struct { - // Possible values: "admin", "write", "read", "none" - Permission *string `json:"permission,omitempty"` - - User *User `json:"user,omitempty"` -} - -// ReviewProjectCollaboratorPermission returns the collaborator's permission level for an organization -// project. Possible values for the permission key: "admin", "write", "read", "none". -// You must be an organization owner or a project admin to review a user's permission level. -// -// GitHub API docs: https://developer.github.com/v3/projects/collaborators/#review-a-users-permission-level -func (s *ProjectsService) ReviewProjectCollaboratorPermission(ctx context.Context, id int64, username string) (*ProjectPermissionLevel, *Response, error) { - u := fmt.Sprintf("projects/%v/collaborators/%v/permission", id, username) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeProjectsPreview) - - ppl := new(ProjectPermissionLevel) - resp, err := s.client.Do(ctx, req, ppl) - if err != nil { - return nil, resp, err - } - return ppl, resp, nil -} diff --git a/vendor/github.com/google/go-github/v27/github/pulls.go b/vendor/github.com/google/go-github/v27/github/pulls.go deleted file mode 100644 index a06f97bcfd69..000000000000 --- a/vendor/github.com/google/go-github/v27/github/pulls.go +++ /dev/null @@ -1,478 +0,0 @@ -// Copyright 2013 The go-github 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 - -import ( - "bytes" - "context" - "fmt" - "strings" - "time" -) - -// PullRequestsService handles communication with the pull request related -// methods of the GitHub API. -// -// GitHub API docs: https://developer.github.com/v3/pulls/ -type PullRequestsService service - -// PullRequest represents a GitHub pull request on a repository. -type PullRequest struct { - ID *int64 `json:"id,omitempty"` - Number *int `json:"number,omitempty"` - State *string `json:"state,omitempty"` - Title *string `json:"title,omitempty"` - Body *string `json:"body,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` - ClosedAt *time.Time `json:"closed_at,omitempty"` - MergedAt *time.Time `json:"merged_at,omitempty"` - Labels []*Label `json:"labels,omitempty"` - User *User `json:"user,omitempty"` - Draft *bool `json:"draft,omitempty"` - Merged *bool `json:"merged,omitempty"` - Mergeable *bool `json:"mergeable,omitempty"` - MergeableState *string `json:"mergeable_state,omitempty"` - MergedBy *User `json:"merged_by,omitempty"` - MergeCommitSHA *string `json:"merge_commit_sha,omitempty"` - Comments *int `json:"comments,omitempty"` - Commits *int `json:"commits,omitempty"` - Additions *int `json:"additions,omitempty"` - Deletions *int `json:"deletions,omitempty"` - ChangedFiles *int `json:"changed_files,omitempty"` - URL *string `json:"url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - IssueURL *string `json:"issue_url,omitempty"` - StatusesURL *string `json:"statuses_url,omitempty"` - DiffURL *string `json:"diff_url,omitempty"` - PatchURL *string `json:"patch_url,omitempty"` - CommitsURL *string `json:"commits_url,omitempty"` - CommentsURL *string `json:"comments_url,omitempty"` - ReviewCommentsURL *string `json:"review_comments_url,omitempty"` - ReviewCommentURL *string `json:"review_comment_url,omitempty"` - ReviewComments *int `json:"review_comments,omitempty"` - Assignee *User `json:"assignee,omitempty"` - Assignees []*User `json:"assignees,omitempty"` - Milestone *Milestone `json:"milestone,omitempty"` - MaintainerCanModify *bool `json:"maintainer_can_modify,omitempty"` - AuthorAssociation *string `json:"author_association,omitempty"` - NodeID *string `json:"node_id,omitempty"` - RequestedReviewers []*User `json:"requested_reviewers,omitempty"` - - // RequestedTeams is populated as part of the PullRequestEvent. - // See, https://developer.github.com/v3/activity/events/types/#pullrequestevent for an example. - RequestedTeams []*Team `json:"requested_teams,omitempty"` - - Links *PRLinks `json:"_links,omitempty"` - Head *PullRequestBranch `json:"head,omitempty"` - Base *PullRequestBranch `json:"base,omitempty"` - - // ActiveLockReason is populated only when LockReason is provided while locking the pull request. - // Possible values are: "off-topic", "too heated", "resolved", and "spam". - ActiveLockReason *string `json:"active_lock_reason,omitempty"` -} - -func (p PullRequest) String() string { - return Stringify(p) -} - -// PRLink represents a single link object from Github pull request _links. -type PRLink struct { - HRef *string `json:"href,omitempty"` -} - -// PRLinks represents the "_links" object in a Github pull request. -type PRLinks struct { - Self *PRLink `json:"self,omitempty"` - HTML *PRLink `json:"html,omitempty"` - Issue *PRLink `json:"issue,omitempty"` - Comments *PRLink `json:"comments,omitempty"` - ReviewComments *PRLink `json:"review_comments,omitempty"` - ReviewComment *PRLink `json:"review_comment,omitempty"` - Commits *PRLink `json:"commits,omitempty"` - Statuses *PRLink `json:"statuses,omitempty"` -} - -// PullRequestBranch represents a base or head branch in a GitHub pull request. -type PullRequestBranch struct { - Label *string `json:"label,omitempty"` - Ref *string `json:"ref,omitempty"` - SHA *string `json:"sha,omitempty"` - Repo *Repository `json:"repo,omitempty"` - User *User `json:"user,omitempty"` -} - -// PullRequestListOptions specifies the optional parameters to the -// PullRequestsService.List method. -type PullRequestListOptions struct { - // State filters pull requests based on their state. Possible values are: - // open, closed, all. Default is "open". - State string `url:"state,omitempty"` - - // Head filters pull requests by head user and branch name in the format of: - // "user:ref-name". - Head string `url:"head,omitempty"` - - // Base filters pull requests by base branch name. - Base string `url:"base,omitempty"` - - // Sort specifies how to sort pull requests. Possible values are: created, - // updated, popularity, long-running. Default is "created". - Sort string `url:"sort,omitempty"` - - // Direction in which to sort pull requests. Possible values are: asc, desc. - // If Sort is "created" or not specified, Default is "desc", otherwise Default - // is "asc" - Direction string `url:"direction,omitempty"` - - ListOptions -} - -// List the pull requests for the specified repository. -// -// GitHub API docs: https://developer.github.com/v3/pulls/#list-pull-requests -func (s *PullRequestsService) List(ctx context.Context, owner string, repo string, opt *PullRequestListOptions) ([]*PullRequest, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls", owner, repo) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - acceptHeaders := []string{mediaTypeLabelDescriptionSearchPreview, mediaTypeLockReasonPreview, mediaTypeDraftPreview} - req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - - var pulls []*PullRequest - resp, err := s.client.Do(ctx, req, &pulls) - if err != nil { - return nil, resp, err - } - - return pulls, resp, nil -} - -// ListPullRequestsWithCommit returns pull requests associated with a commit SHA. -// -// The results will include open and closed pull requests. -// -// GitHub API docs: https://developer.github.com/v3/repos/commits/#list-pull-requests-associated-with-commit -func (s *PullRequestsService) ListPullRequestsWithCommit(ctx context.Context, owner, repo, sha string, opt *PullRequestListOptions) ([]*PullRequest, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/commits/%v/pulls", owner, repo, sha) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - acceptHeaders := []string{mediaTypeListPullsOrBranchesForCommitPreview, mediaTypeDraftPreview, mediaTypeLabelDescriptionSearchPreview, mediaTypeLockReasonPreview} - req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - var pulls []*PullRequest - resp, err := s.client.Do(ctx, req, &pulls) - if err != nil { - return nil, resp, err - } - - return pulls, resp, nil -} - -// Get a single pull request. -// -// GitHub API docs: https://developer.github.com/v3/pulls/#get-a-single-pull-request -func (s *PullRequestsService) Get(ctx context.Context, owner string, repo string, number int) (*PullRequest, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d", owner, repo, number) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - acceptHeaders := []string{mediaTypeLabelDescriptionSearchPreview, mediaTypeLockReasonPreview, mediaTypeDraftPreview} - req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - - pull := new(PullRequest) - resp, err := s.client.Do(ctx, req, pull) - if err != nil { - return nil, resp, err - } - - return pull, resp, nil -} - -// GetRaw gets a single pull request in raw (diff or patch) format. -func (s *PullRequestsService) GetRaw(ctx context.Context, owner string, repo string, number int, opt RawOptions) (string, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d", owner, repo, number) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return "", nil, err - } - - switch opt.Type { - case Diff: - req.Header.Set("Accept", mediaTypeV3Diff) - case Patch: - req.Header.Set("Accept", mediaTypeV3Patch) - default: - return "", nil, fmt.Errorf("unsupported raw type %d", opt.Type) - } - - var buf bytes.Buffer - resp, err := s.client.Do(ctx, req, &buf) - if err != nil { - return "", resp, err - } - - return buf.String(), resp, nil -} - -// NewPullRequest represents a new pull request to be created. -type NewPullRequest struct { - Title *string `json:"title,omitempty"` - Head *string `json:"head,omitempty"` - Base *string `json:"base,omitempty"` - Body *string `json:"body,omitempty"` - Issue *int `json:"issue,omitempty"` - MaintainerCanModify *bool `json:"maintainer_can_modify,omitempty"` - Draft *bool `json:"draft,omitempty"` -} - -// Create a new pull request on the specified repository. -// -// GitHub API docs: https://developer.github.com/v3/pulls/#create-a-pull-request -func (s *PullRequestsService) Create(ctx context.Context, owner string, repo string, pull *NewPullRequest) (*PullRequest, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls", owner, repo) - req, err := s.client.NewRequest("POST", u, pull) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - acceptHeaders := []string{mediaTypeLabelDescriptionSearchPreview, mediaTypeDraftPreview} - req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - - p := new(PullRequest) - resp, err := s.client.Do(ctx, req, p) - if err != nil { - return nil, resp, err - } - - return p, resp, nil -} - -// PullReqestBranchUpdateOptions specifies the optional parameters to the -// PullRequestsService.UpdateBranch method. -type PullReqestBranchUpdateOptions struct { - // ExpectedHeadSHA specifies the most recent commit on the pull request's branch. - // Default value is the SHA of the pull request's current HEAD ref. - ExpectedHeadSHA *string `json:"expected_head_sha,omitempty"` -} - -// PullRequestBranchUpdateResponse specifies the response of pull request branch update. -type PullRequestBranchUpdateResponse struct { - Message *string `json:"message,omitempty"` - URL *string `json:"url,omitempty"` -} - -// UpdateBranch updates the pull request branch with latest upstream changes. -// -// This method might return an AcceptedError and a status code of -// 202. This is because this is the status that GitHub returns to signify that -// it has now scheduled the update of the pull request branch in a background task. -// A follow up request, after a delay of a second or so, should result -// in a successful request. -// -// GitHub API docs: https://developer.github.com/v3/pulls/#update-a-pull-request-branch -func (s *PullRequestsService) UpdateBranch(ctx context.Context, owner, repo string, number int, opts *PullReqestBranchUpdateOptions) (*PullRequestBranchUpdateResponse, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/update-branch", owner, repo, number) - - req, err := s.client.NewRequest("PUT", u, opts) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeUpdatePullRequestBranchPreview) - - p := new(PullRequestBranchUpdateResponse) - resp, err := s.client.Do(ctx, req, p) - if err != nil { - return nil, resp, err - } - - return p, resp, nil -} - -type pullRequestUpdate struct { - Title *string `json:"title,omitempty"` - Body *string `json:"body,omitempty"` - State *string `json:"state,omitempty"` - Base *string `json:"base,omitempty"` - MaintainerCanModify *bool `json:"maintainer_can_modify,omitempty"` -} - -// Edit a pull request. -// pull must not be nil. -// -// The following fields are editable: Title, Body, State, Base.Ref and MaintainerCanModify. -// Base.Ref updates the base branch of the pull request. -// -// GitHub API docs: https://developer.github.com/v3/pulls/#update-a-pull-request -func (s *PullRequestsService) Edit(ctx context.Context, owner string, repo string, number int, pull *PullRequest) (*PullRequest, *Response, error) { - if pull == nil { - return nil, nil, fmt.Errorf("pull must be provided") - } - - u := fmt.Sprintf("repos/%v/%v/pulls/%d", owner, repo, number) - - update := &pullRequestUpdate{ - Title: pull.Title, - Body: pull.Body, - State: pull.State, - MaintainerCanModify: pull.MaintainerCanModify, - } - if pull.Base != nil { - update.Base = pull.Base.Ref - } - - req, err := s.client.NewRequest("PATCH", u, update) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - acceptHeaders := []string{mediaTypeLabelDescriptionSearchPreview, mediaTypeLockReasonPreview} - req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - - p := new(PullRequest) - resp, err := s.client.Do(ctx, req, p) - if err != nil { - return nil, resp, err - } - - return p, resp, nil -} - -// ListCommits lists the commits in a pull request. -// -// GitHub API docs: https://developer.github.com/v3/pulls/#list-commits-on-a-pull-request -func (s *PullRequestsService) ListCommits(ctx context.Context, owner string, repo string, number int, opt *ListOptions) ([]*RepositoryCommit, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/commits", owner, repo, number) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var commits []*RepositoryCommit - resp, err := s.client.Do(ctx, req, &commits) - if err != nil { - return nil, resp, err - } - - return commits, resp, nil -} - -// ListFiles lists the files in a pull request. -// -// GitHub API docs: https://developer.github.com/v3/pulls/#list-pull-requests-files -func (s *PullRequestsService) ListFiles(ctx context.Context, owner string, repo string, number int, opt *ListOptions) ([]*CommitFile, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/files", owner, repo, number) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var commitFiles []*CommitFile - resp, err := s.client.Do(ctx, req, &commitFiles) - if err != nil { - return nil, resp, err - } - - return commitFiles, resp, nil -} - -// IsMerged checks if a pull request has been merged. -// -// GitHub API docs: https://developer.github.com/v3/pulls/#get-if-a-pull-request-has-been-merged -func (s *PullRequestsService) IsMerged(ctx context.Context, owner string, repo string, number int) (bool, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/merge", owner, repo, number) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return false, nil, err - } - - resp, err := s.client.Do(ctx, req, nil) - merged, err := parseBoolResponse(err) - return merged, resp, err -} - -// PullRequestMergeResult represents the result of merging a pull request. -type PullRequestMergeResult struct { - SHA *string `json:"sha,omitempty"` - Merged *bool `json:"merged,omitempty"` - Message *string `json:"message,omitempty"` -} - -// PullRequestOptions lets you define how a pull request will be merged. -type PullRequestOptions struct { - CommitTitle string // Extra detail to append to automatic commit message. (Optional.) - SHA string // SHA that pull request head must match to allow merge. (Optional.) - - // The merge method to use. Possible values include: "merge", "squash", and "rebase" with the default being merge. (Optional.) - MergeMethod string -} - -type pullRequestMergeRequest struct { - CommitMessage string `json:"commit_message"` - CommitTitle string `json:"commit_title,omitempty"` - MergeMethod string `json:"merge_method,omitempty"` - SHA string `json:"sha,omitempty"` -} - -// Merge a pull request (Merge Button™). -// commitMessage is the title for the automatic commit message. -// -// GitHub API docs: https://developer.github.com/v3/pulls/#merge-a-pull-request-merge-buttontrade -func (s *PullRequestsService) Merge(ctx context.Context, owner string, repo string, number int, commitMessage string, options *PullRequestOptions) (*PullRequestMergeResult, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/merge", owner, repo, number) - - pullRequestBody := &pullRequestMergeRequest{CommitMessage: commitMessage} - if options != nil { - pullRequestBody.CommitTitle = options.CommitTitle - pullRequestBody.MergeMethod = options.MergeMethod - pullRequestBody.SHA = options.SHA - } - req, err := s.client.NewRequest("PUT", u, pullRequestBody) - if err != nil { - return nil, nil, err - } - - mergeResult := new(PullRequestMergeResult) - resp, err := s.client.Do(ctx, req, mergeResult) - if err != nil { - return nil, resp, err - } - - return mergeResult, resp, nil -} diff --git a/vendor/github.com/google/go-github/v27/github/pulls_comments.go b/vendor/github.com/google/go-github/v27/github/pulls_comments.go deleted file mode 100644 index 8886c9d124d3..000000000000 --- a/vendor/github.com/google/go-github/v27/github/pulls_comments.go +++ /dev/null @@ -1,189 +0,0 @@ -// Copyright 2013 The go-github 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 - -import ( - "context" - "fmt" - "time" -) - -// PullRequestComment represents a comment left on a pull request. -type PullRequestComment struct { - ID *int64 `json:"id,omitempty"` - NodeID *string `json:"node_id,omitempty"` - InReplyTo *int64 `json:"in_reply_to_id,omitempty"` - Body *string `json:"body,omitempty"` - Path *string `json:"path,omitempty"` - DiffHunk *string `json:"diff_hunk,omitempty"` - PullRequestReviewID *int64 `json:"pull_request_review_id,omitempty"` - Position *int `json:"position,omitempty"` - OriginalPosition *int `json:"original_position,omitempty"` - CommitID *string `json:"commit_id,omitempty"` - OriginalCommitID *string `json:"original_commit_id,omitempty"` - User *User `json:"user,omitempty"` - Reactions *Reactions `json:"reactions,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` - // AuthorAssociation is the comment author's relationship to the pull request's repository. - // Possible values are "COLLABORATOR", "CONTRIBUTOR", "FIRST_TIMER", "FIRST_TIME_CONTRIBUTOR", "MEMBER", "OWNER", or "NONE". - AuthorAssociation *string `json:"author_association,omitempty"` - URL *string `json:"url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - PullRequestURL *string `json:"pull_request_url,omitempty"` -} - -func (p PullRequestComment) String() string { - return Stringify(p) -} - -// PullRequestListCommentsOptions specifies the optional parameters to the -// PullRequestsService.ListComments method. -type PullRequestListCommentsOptions struct { - // Sort specifies how to sort comments. Possible values are: created, updated. - Sort string `url:"sort,omitempty"` - - // Direction in which to sort comments. Possible values are: asc, desc. - Direction string `url:"direction,omitempty"` - - // Since filters comments by time. - Since time.Time `url:"since,omitempty"` - - ListOptions -} - -// ListComments lists all comments on the specified pull request. Specifying a -// pull request number of 0 will return all comments on all pull requests for -// the repository. -// -// GitHub API docs: https://developer.github.com/v3/pulls/comments/#list-comments-on-a-pull-request -func (s *PullRequestsService) ListComments(ctx context.Context, owner string, repo string, number int, opt *PullRequestListCommentsOptions) ([]*PullRequestComment, *Response, error) { - var u string - if number == 0 { - u = fmt.Sprintf("repos/%v/%v/pulls/comments", owner, repo) - } else { - u = fmt.Sprintf("repos/%v/%v/pulls/%d/comments", owner, repo, number) - } - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeReactionsPreview) - - var comments []*PullRequestComment - resp, err := s.client.Do(ctx, req, &comments) - if err != nil { - return nil, resp, err - } - - return comments, resp, nil -} - -// GetComment fetches the specified pull request comment. -// -// GitHub API docs: https://developer.github.com/v3/pulls/comments/#get-a-single-comment -func (s *PullRequestsService) GetComment(ctx context.Context, owner string, repo string, commentID int64) (*PullRequestComment, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/comments/%d", owner, repo, commentID) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeReactionsPreview) - - comment := new(PullRequestComment) - resp, err := s.client.Do(ctx, req, comment) - if err != nil { - return nil, resp, err - } - - return comment, resp, nil -} - -// CreateComment creates a new comment on the specified pull request. -// -// GitHub API docs: https://developer.github.com/v3/pulls/comments/#create-a-comment -func (s *PullRequestsService) CreateComment(ctx context.Context, owner string, repo string, number int, comment *PullRequestComment) (*PullRequestComment, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/comments", owner, repo, number) - req, err := s.client.NewRequest("POST", u, comment) - if err != nil { - return nil, nil, err - } - - c := new(PullRequestComment) - resp, err := s.client.Do(ctx, req, c) - if err != nil { - return nil, resp, err - } - - return c, resp, nil -} - -// CreateCommentInReplyTo creates a new comment as a reply to an existing pull request comment. -// -// GitHub API docs: https://developer.github.com/v3/pulls/comments/#alternative-input -func (s *PullRequestsService) CreateCommentInReplyTo(ctx context.Context, owner string, repo string, number int, body string, commentID int64) (*PullRequestComment, *Response, error) { - comment := &struct { - Body string `json:"body,omitempty"` - InReplyTo int64 `json:"in_reply_to,omitempty"` - }{ - Body: body, - InReplyTo: commentID, - } - u := fmt.Sprintf("repos/%v/%v/pulls/%d/comments", owner, repo, number) - req, err := s.client.NewRequest("POST", u, comment) - if err != nil { - return nil, nil, err - } - - c := new(PullRequestComment) - resp, err := s.client.Do(ctx, req, c) - if err != nil { - return nil, resp, err - } - - return c, resp, nil -} - -// EditComment updates a pull request comment. -// A non-nil comment.Body must be provided. Other comment fields should be left nil. -// -// GitHub API docs: https://developer.github.com/v3/pulls/comments/#edit-a-comment -func (s *PullRequestsService) EditComment(ctx context.Context, owner string, repo string, commentID int64, comment *PullRequestComment) (*PullRequestComment, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/comments/%d", owner, repo, commentID) - req, err := s.client.NewRequest("PATCH", u, comment) - if err != nil { - return nil, nil, err - } - - c := new(PullRequestComment) - resp, err := s.client.Do(ctx, req, c) - if err != nil { - return nil, resp, err - } - - return c, resp, nil -} - -// DeleteComment deletes a pull request comment. -// -// GitHub API docs: https://developer.github.com/v3/pulls/comments/#delete-a-comment -func (s *PullRequestsService) DeleteComment(ctx context.Context, owner string, repo string, commentID int64) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/comments/%d", owner, repo, commentID) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - return s.client.Do(ctx, req, nil) -} diff --git a/vendor/github.com/google/go-github/v27/github/pulls_reviewers.go b/vendor/github.com/google/go-github/v27/github/pulls_reviewers.go deleted file mode 100644 index beae953c4c92..000000000000 --- a/vendor/github.com/google/go-github/v27/github/pulls_reviewers.go +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2017 The go-github 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 - -import ( - "context" - "fmt" -) - -// ReviewersRequest specifies users and teams for a pull request review request. -type ReviewersRequest struct { - NodeID *string `json:"node_id,omitempty"` - Reviewers []string `json:"reviewers,omitempty"` - TeamReviewers []string `json:"team_reviewers,omitempty"` -} - -// Reviewers represents reviewers of a pull request. -type Reviewers struct { - Users []*User `json:"users,omitempty"` - Teams []*Team `json:"teams,omitempty"` -} - -// RequestReviewers creates a review request for the provided reviewers for the specified pull request. -// -// GitHub API docs: https://developer.github.com/v3/pulls/review_requests/#create-a-review-request -func (s *PullRequestsService) RequestReviewers(ctx context.Context, owner, repo string, number int, reviewers ReviewersRequest) (*PullRequest, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/pulls/%d/requested_reviewers", owner, repo, number) - req, err := s.client.NewRequest("POST", u, &reviewers) - if err != nil { - return nil, nil, err - } - - r := new(PullRequest) - resp, err := s.client.Do(ctx, req, r) - if err != nil { - return nil, resp, err - } - - return r, resp, nil -} - -// ListReviewers lists reviewers whose reviews have been requested on the specified pull request. -// -// GitHub API docs: https://developer.github.com/v3/pulls/review_requests/#list-review-requests -func (s *PullRequestsService) ListReviewers(ctx context.Context, owner, repo string, number int, opt *ListOptions) (*Reviewers, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/requested_reviewers", owner, repo, number) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - reviewers := new(Reviewers) - resp, err := s.client.Do(ctx, req, reviewers) - if err != nil { - return nil, resp, err - } - - return reviewers, resp, nil -} - -// RemoveReviewers removes the review request for the provided reviewers for the specified pull request. -// -// GitHub API docs: https://developer.github.com/v3/pulls/review_requests/#delete-a-review-request -func (s *PullRequestsService) RemoveReviewers(ctx context.Context, owner, repo string, number int, reviewers ReviewersRequest) (*Response, error) { - u := fmt.Sprintf("repos/%s/%s/pulls/%d/requested_reviewers", owner, repo, number) - req, err := s.client.NewRequest("DELETE", u, &reviewers) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} diff --git a/vendor/github.com/google/go-github/v27/github/pulls_reviews.go b/vendor/github.com/google/go-github/v27/github/pulls_reviews.go deleted file mode 100644 index 88b82982f6d5..000000000000 --- a/vendor/github.com/google/go-github/v27/github/pulls_reviews.go +++ /dev/null @@ -1,261 +0,0 @@ -// Copyright 2016 The go-github 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 - -import ( - "context" - "fmt" - "time" -) - -// PullRequestReview represents a review of a pull request. -type PullRequestReview struct { - ID *int64 `json:"id,omitempty"` - NodeID *string `json:"node_id,omitempty"` - User *User `json:"user,omitempty"` - Body *string `json:"body,omitempty"` - SubmittedAt *time.Time `json:"submitted_at,omitempty"` - CommitID *string `json:"commit_id,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - PullRequestURL *string `json:"pull_request_url,omitempty"` - State *string `json:"state,omitempty"` -} - -func (p PullRequestReview) String() string { - return Stringify(p) -} - -// DraftReviewComment represents a comment part of the review. -type DraftReviewComment struct { - Path *string `json:"path,omitempty"` - Position *int `json:"position,omitempty"` - Body *string `json:"body,omitempty"` -} - -func (c DraftReviewComment) String() string { - return Stringify(c) -} - -// PullRequestReviewRequest represents a request to create a review. -type PullRequestReviewRequest struct { - NodeID *string `json:"node_id,omitempty"` - CommitID *string `json:"commit_id,omitempty"` - Body *string `json:"body,omitempty"` - Event *string `json:"event,omitempty"` - Comments []*DraftReviewComment `json:"comments,omitempty"` -} - -func (r PullRequestReviewRequest) String() string { - return Stringify(r) -} - -// PullRequestReviewDismissalRequest represents a request to dismiss a review. -type PullRequestReviewDismissalRequest struct { - Message *string `json:"message,omitempty"` -} - -func (r PullRequestReviewDismissalRequest) String() string { - return Stringify(r) -} - -// ListReviews lists all reviews on the specified pull request. -// -// TODO: Follow up with GitHub support about an issue with this method's -// returned error format and remove this comment once it's fixed. -// Read more about it here - https://github.com/google/go-github/issues/540 -// -// GitHub API docs: https://developer.github.com/v3/pulls/reviews/#list-reviews-on-a-pull-request -func (s *PullRequestsService) ListReviews(ctx context.Context, owner, repo string, number int, opt *ListOptions) ([]*PullRequestReview, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews", owner, repo, number) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var reviews []*PullRequestReview - resp, err := s.client.Do(ctx, req, &reviews) - if err != nil { - return nil, resp, err - } - - return reviews, resp, nil -} - -// GetReview fetches the specified pull request review. -// -// TODO: Follow up with GitHub support about an issue with this method's -// returned error format and remove this comment once it's fixed. -// Read more about it here - https://github.com/google/go-github/issues/540 -// -// GitHub API docs: https://developer.github.com/v3/pulls/reviews/#get-a-single-review -func (s *PullRequestsService) GetReview(ctx context.Context, owner, repo string, number int, reviewID int64) (*PullRequestReview, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d", owner, repo, number, reviewID) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - review := new(PullRequestReview) - resp, err := s.client.Do(ctx, req, review) - if err != nil { - return nil, resp, err - } - - return review, resp, nil -} - -// DeletePendingReview deletes the specified pull request pending review. -// -// TODO: Follow up with GitHub support about an issue with this method's -// returned error format and remove this comment once it's fixed. -// Read more about it here - https://github.com/google/go-github/issues/540 -// -// GitHub API docs: https://developer.github.com/v3/pulls/reviews/#delete-a-pending-review -func (s *PullRequestsService) DeletePendingReview(ctx context.Context, owner, repo string, number int, reviewID int64) (*PullRequestReview, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d", owner, repo, number, reviewID) - - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, nil, err - } - - review := new(PullRequestReview) - resp, err := s.client.Do(ctx, req, review) - if err != nil { - return nil, resp, err - } - - return review, resp, nil -} - -// ListReviewComments lists all the comments for the specified review. -// -// TODO: Follow up with GitHub support about an issue with this method's -// returned error format and remove this comment once it's fixed. -// Read more about it here - https://github.com/google/go-github/issues/540 -// -// GitHub API docs: https://developer.github.com/v3/pulls/reviews/#get-comments-for-a-single-review -func (s *PullRequestsService) ListReviewComments(ctx context.Context, owner, repo string, number int, reviewID int64, opt *ListOptions) ([]*PullRequestComment, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d/comments", owner, repo, number, reviewID) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var comments []*PullRequestComment - resp, err := s.client.Do(ctx, req, &comments) - if err != nil { - return nil, resp, err - } - - return comments, resp, nil -} - -// CreateReview creates a new review on the specified pull request. -// -// TODO: Follow up with GitHub support about an issue with this method's -// returned error format and remove this comment once it's fixed. -// Read more about it here - https://github.com/google/go-github/issues/540 -// -// GitHub API docs: https://developer.github.com/v3/pulls/reviews/#create-a-pull-request-review -func (s *PullRequestsService) CreateReview(ctx context.Context, owner, repo string, number int, review *PullRequestReviewRequest) (*PullRequestReview, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews", owner, repo, number) - - req, err := s.client.NewRequest("POST", u, review) - if err != nil { - return nil, nil, err - } - - r := new(PullRequestReview) - resp, err := s.client.Do(ctx, req, r) - if err != nil { - return nil, resp, err - } - - return r, resp, nil -} - -// UpdateReview updates the review summary on the specified pull request. -// -// GitHub API docs: https://developer.github.com/v3/pulls/reviews/#update-a-pull-request-review -func (s *PullRequestsService) UpdateReview(ctx context.Context, owner, repo string, number int, reviewID int64, body string) (*PullRequestReview, *Response, error) { - opts := &struct { - Body string `json:"body"` - }{Body: body} - u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d", owner, repo, number, reviewID) - - req, err := s.client.NewRequest("PUT", u, opts) - if err != nil { - return nil, nil, err - } - - review := &PullRequestReview{} - resp, err := s.client.Do(ctx, req, review) - if err != nil { - return nil, resp, err - } - - return review, resp, nil -} - -// SubmitReview submits a specified review on the specified pull request. -// -// TODO: Follow up with GitHub support about an issue with this method's -// returned error format and remove this comment once it's fixed. -// Read more about it here - https://github.com/google/go-github/issues/540 -// -// GitHub API docs: https://developer.github.com/v3/pulls/reviews/#submit-a-pull-request-review -func (s *PullRequestsService) SubmitReview(ctx context.Context, owner, repo string, number int, reviewID int64, review *PullRequestReviewRequest) (*PullRequestReview, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d/events", owner, repo, number, reviewID) - - req, err := s.client.NewRequest("POST", u, review) - if err != nil { - return nil, nil, err - } - - r := new(PullRequestReview) - resp, err := s.client.Do(ctx, req, r) - if err != nil { - return nil, resp, err - } - - return r, resp, nil -} - -// DismissReview dismisses a specified review on the specified pull request. -// -// TODO: Follow up with GitHub support about an issue with this method's -// returned error format and remove this comment once it's fixed. -// Read more about it here - https://github.com/google/go-github/issues/540 -// -// GitHub API docs: https://developer.github.com/v3/pulls/reviews/#dismiss-a-pull-request-review -func (s *PullRequestsService) DismissReview(ctx context.Context, owner, repo string, number int, reviewID int64, review *PullRequestReviewDismissalRequest) (*PullRequestReview, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d/dismissals", owner, repo, number, reviewID) - - req, err := s.client.NewRequest("PUT", u, review) - if err != nil { - return nil, nil, err - } - - r := new(PullRequestReview) - resp, err := s.client.Do(ctx, req, r) - if err != nil { - return nil, resp, err - } - - return r, resp, nil -} diff --git a/vendor/github.com/google/go-github/v27/github/reactions.go b/vendor/github.com/google/go-github/v27/github/reactions.go deleted file mode 100644 index 0865f8cdca44..000000000000 --- a/vendor/github.com/google/go-github/v27/github/reactions.go +++ /dev/null @@ -1,377 +0,0 @@ -// Copyright 2016 The go-github 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 - -import ( - "context" - "fmt" -) - -// ReactionsService provides access to the reactions-related functions in the -// GitHub API. -// -// GitHub API docs: https://developer.github.com/v3/reactions/ -type ReactionsService service - -// Reaction represents a GitHub reaction. -type Reaction struct { - // ID is the Reaction ID. - ID *int64 `json:"id,omitempty"` - User *User `json:"user,omitempty"` - NodeID *string `json:"node_id,omitempty"` - // Content is the type of reaction. - // Possible values are: - // "+1", "-1", "laugh", "confused", "heart", "hooray". - Content *string `json:"content,omitempty"` -} - -// Reactions represents a summary of GitHub reactions. -type Reactions struct { - TotalCount *int `json:"total_count,omitempty"` - PlusOne *int `json:"+1,omitempty"` - MinusOne *int `json:"-1,omitempty"` - Laugh *int `json:"laugh,omitempty"` - Confused *int `json:"confused,omitempty"` - Heart *int `json:"heart,omitempty"` - Hooray *int `json:"hooray,omitempty"` - URL *string `json:"url,omitempty"` -} - -func (r Reaction) String() string { - return Stringify(r) -} - -// ListCommentReactions lists the reactions for a commit comment. -// -// GitHub API docs: https://developer.github.com/v3/reactions/#list-reactions-for-a-commit-comment -func (s *ReactionsService) ListCommentReactions(ctx context.Context, owner, repo string, id int64, opt *ListOptions) ([]*Reaction, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/comments/%v/reactions", owner, repo, id) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeReactionsPreview) - - var m []*Reaction - resp, err := s.client.Do(ctx, req, &m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// CreateCommentReaction creates a reaction for a commit comment. -// Note that if you have already created a reaction of type content, the -// previously created reaction will be returned with Status: 200 OK. -// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray". -// -// GitHub API docs: https://developer.github.com/v3/reactions/#create-reaction-for-a-commit-comment -func (s ReactionsService) CreateCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/comments/%v/reactions", owner, repo, id) - - body := &Reaction{Content: String(content)} - req, err := s.client.NewRequest("POST", u, body) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeReactionsPreview) - - m := &Reaction{} - resp, err := s.client.Do(ctx, req, m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// ListIssueReactions lists the reactions for an issue. -// -// GitHub API docs: https://developer.github.com/v3/reactions/#list-reactions-for-an-issue -func (s *ReactionsService) ListIssueReactions(ctx context.Context, owner, repo string, number int, opt *ListOptions) ([]*Reaction, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%v/reactions", owner, repo, number) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeReactionsPreview) - - var m []*Reaction - resp, err := s.client.Do(ctx, req, &m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// CreateIssueReaction creates a reaction for an issue. -// Note that if you have already created a reaction of type content, the -// previously created reaction will be returned with Status: 200 OK. -// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray". -// -// GitHub API docs: https://developer.github.com/v3/reactions/#create-reaction-for-an-issue -func (s ReactionsService) CreateIssueReaction(ctx context.Context, owner, repo string, number int, content string) (*Reaction, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%v/reactions", owner, repo, number) - - body := &Reaction{Content: String(content)} - req, err := s.client.NewRequest("POST", u, body) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeReactionsPreview) - - m := &Reaction{} - resp, err := s.client.Do(ctx, req, m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// ListIssueCommentReactions lists the reactions for an issue comment. -// -// GitHub API docs: https://developer.github.com/v3/reactions/#list-reactions-for-an-issue-comment -func (s *ReactionsService) ListIssueCommentReactions(ctx context.Context, owner, repo string, id int64, opt *ListOptions) ([]*Reaction, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/comments/%v/reactions", owner, repo, id) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeReactionsPreview) - - var m []*Reaction - resp, err := s.client.Do(ctx, req, &m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// CreateIssueCommentReaction creates a reaction for an issue comment. -// Note that if you have already created a reaction of type content, the -// previously created reaction will be returned with Status: 200 OK. -// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray". -// -// GitHub API docs: https://developer.github.com/v3/reactions/#create-reaction-for-an-issue-comment -func (s ReactionsService) CreateIssueCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/comments/%v/reactions", owner, repo, id) - - body := &Reaction{Content: String(content)} - req, err := s.client.NewRequest("POST", u, body) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeReactionsPreview) - - m := &Reaction{} - resp, err := s.client.Do(ctx, req, m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// ListPullRequestCommentReactions lists the reactions for a pull request review comment. -// -// GitHub API docs: https://developer.github.com/v3/reactions/#list-reactions-for-an-issue-comment -func (s *ReactionsService) ListPullRequestCommentReactions(ctx context.Context, owner, repo string, id int64, opt *ListOptions) ([]*Reaction, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/comments/%v/reactions", owner, repo, id) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeReactionsPreview) - - var m []*Reaction - resp, err := s.client.Do(ctx, req, &m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// CreatePullRequestCommentReaction creates a reaction for a pull request review comment. -// Note that if you have already created a reaction of type content, the -// previously created reaction will be returned with Status: 200 OK. -// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray". -// -// GitHub API docs: https://developer.github.com/v3/reactions/#create-reaction-for-an-issue-comment -func (s ReactionsService) CreatePullRequestCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/comments/%v/reactions", owner, repo, id) - - body := &Reaction{Content: String(content)} - req, err := s.client.NewRequest("POST", u, body) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeReactionsPreview) - - m := &Reaction{} - resp, err := s.client.Do(ctx, req, m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// ListTeamDiscussionReactions lists the reactions for a team discussion. -// -// GitHub API docs: https://developer.github.com/v3/reactions/#list-reactions-for-a-team-discussion -func (s *ReactionsService) ListTeamDiscussionReactions(ctx context.Context, teamID int64, discussionNumber int, opt *ListOptions) ([]*Reaction, *Response, error) { - u := fmt.Sprintf("teams/%v/discussions/%v/reactions", teamID, discussionNumber) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - req.Header.Set("Accept", mediaTypeReactionsPreview) - - var m []*Reaction - resp, err := s.client.Do(ctx, req, &m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// CreateTeamDiscussionReaction creates a reaction for a team discussion. -// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray". -// -// GitHub API docs: https://developer.github.com/v3/reactions/#create-reaction-for-a-team-discussion -func (s *ReactionsService) CreateTeamDiscussionReaction(ctx context.Context, teamID int64, discussionNumber int, content string) (*Reaction, *Response, error) { - u := fmt.Sprintf("teams/%v/discussions/%v/reactions", teamID, discussionNumber) - - body := &Reaction{Content: String(content)} - req, err := s.client.NewRequest("POST", u, body) - if err != nil { - return nil, nil, err - } - - req.Header.Set("Accept", mediaTypeReactionsPreview) - - m := &Reaction{} - resp, err := s.client.Do(ctx, req, m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// ListTeamDiscussionCommentReactions lists the reactions for a team discussion comment. -// -// GitHub API docs: https://developer.github.com/v3/reactions/#list-reactions-for-a-team-discussion-comment -func (s *ReactionsService) ListTeamDiscussionCommentReactions(ctx context.Context, teamID int64, discussionNumber, commentNumber int, opt *ListOptions) ([]*Reaction, *Response, error) { - u := fmt.Sprintf("teams/%v/discussions/%v/comments/%v/reactions", teamID, discussionNumber, commentNumber) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - req.Header.Set("Accept", mediaTypeReactionsPreview) - - var m []*Reaction - resp, err := s.client.Do(ctx, req, &m) - if err != nil { - return nil, nil, err - } - return m, resp, nil -} - -// CreateTeamDiscussionCommentReaction creates a reaction for a team discussion comment. -// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray". -// -// GitHub API docs: https://developer.github.com/v3/reactions/#create-reaction-for-a-team-discussion-comment -func (s *ReactionsService) CreateTeamDiscussionCommentReaction(ctx context.Context, teamID int64, discussionNumber, commentNumber int, content string) (*Reaction, *Response, error) { - u := fmt.Sprintf("teams/%v/discussions/%v/comments/%v/reactions", teamID, discussionNumber, commentNumber) - - body := &Reaction{Content: String(content)} - req, err := s.client.NewRequest("POST", u, body) - if err != nil { - return nil, nil, err - } - - req.Header.Set("Accept", mediaTypeReactionsPreview) - - m := &Reaction{} - resp, err := s.client.Do(ctx, req, m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// DeleteReaction deletes a reaction. -// -// GitHub API docs: https://developer.github.com/v3/reaction/reactions/#delete-a-reaction-archive -func (s *ReactionsService) DeleteReaction(ctx context.Context, id int64) (*Response, error) { - u := fmt.Sprintf("reactions/%v", id) - - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeReactionsPreview) - - return s.client.Do(ctx, req, nil) -} diff --git a/vendor/github.com/google/go-github/v27/github/repos.go b/vendor/github.com/google/go-github/v27/github/repos.go deleted file mode 100644 index a380f3028cde..000000000000 --- a/vendor/github.com/google/go-github/v27/github/repos.go +++ /dev/null @@ -1,1303 +0,0 @@ -// Copyright 2013 The go-github 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 - -import ( - "context" - "fmt" - "strings" -) - -// RepositoriesService handles communication with the repository related -// methods of the GitHub API. -// -// GitHub API docs: https://developer.github.com/v3/repos/ -type RepositoriesService service - -// Repository represents a GitHub repository. -type Repository struct { - ID *int64 `json:"id,omitempty"` - NodeID *string `json:"node_id,omitempty"` - Owner *User `json:"owner,omitempty"` - Name *string `json:"name,omitempty"` - FullName *string `json:"full_name,omitempty"` - Description *string `json:"description,omitempty"` - Homepage *string `json:"homepage,omitempty"` - CodeOfConduct *CodeOfConduct `json:"code_of_conduct,omitempty"` - DefaultBranch *string `json:"default_branch,omitempty"` - MasterBranch *string `json:"master_branch,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - PushedAt *Timestamp `json:"pushed_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - CloneURL *string `json:"clone_url,omitempty"` - GitURL *string `json:"git_url,omitempty"` - MirrorURL *string `json:"mirror_url,omitempty"` - SSHURL *string `json:"ssh_url,omitempty"` - SVNURL *string `json:"svn_url,omitempty"` - Language *string `json:"language,omitempty"` - Fork *bool `json:"fork,omitempty"` - ForksCount *int `json:"forks_count,omitempty"` - NetworkCount *int `json:"network_count,omitempty"` - OpenIssuesCount *int `json:"open_issues_count,omitempty"` - StargazersCount *int `json:"stargazers_count,omitempty"` - SubscribersCount *int `json:"subscribers_count,omitempty"` - WatchersCount *int `json:"watchers_count,omitempty"` - Size *int `json:"size,omitempty"` - AutoInit *bool `json:"auto_init,omitempty"` - Parent *Repository `json:"parent,omitempty"` - Source *Repository `json:"source,omitempty"` - TemplateRepository *Repository `json:"template_repository,omitempty"` - Organization *Organization `json:"organization,omitempty"` - Permissions *map[string]bool `json:"permissions,omitempty"` - AllowRebaseMerge *bool `json:"allow_rebase_merge,omitempty"` - AllowSquashMerge *bool `json:"allow_squash_merge,omitempty"` - AllowMergeCommit *bool `json:"allow_merge_commit,omitempty"` - Topics []string `json:"topics,omitempty"` - Archived *bool `json:"archived,omitempty"` - Disabled *bool `json:"disabled,omitempty"` - - // Only provided when using RepositoriesService.Get while in preview - License *License `json:"license,omitempty"` - - // Additional mutable fields when creating and editing a repository - Private *bool `json:"private,omitempty"` - HasIssues *bool `json:"has_issues,omitempty"` - HasWiki *bool `json:"has_wiki,omitempty"` - HasPages *bool `json:"has_pages,omitempty"` - HasProjects *bool `json:"has_projects,omitempty"` - HasDownloads *bool `json:"has_downloads,omitempty"` - IsTemplate *bool `json:"is_template,omitempty"` - LicenseTemplate *string `json:"license_template,omitempty"` - GitignoreTemplate *string `json:"gitignore_template,omitempty"` - - // Creating an organization repository. Required for non-owners. - TeamID *int64 `json:"team_id,omitempty"` - - // API URLs - URL *string `json:"url,omitempty"` - ArchiveURL *string `json:"archive_url,omitempty"` - AssigneesURL *string `json:"assignees_url,omitempty"` - BlobsURL *string `json:"blobs_url,omitempty"` - BranchesURL *string `json:"branches_url,omitempty"` - CollaboratorsURL *string `json:"collaborators_url,omitempty"` - CommentsURL *string `json:"comments_url,omitempty"` - CommitsURL *string `json:"commits_url,omitempty"` - CompareURL *string `json:"compare_url,omitempty"` - ContentsURL *string `json:"contents_url,omitempty"` - ContributorsURL *string `json:"contributors_url,omitempty"` - DeploymentsURL *string `json:"deployments_url,omitempty"` - DownloadsURL *string `json:"downloads_url,omitempty"` - EventsURL *string `json:"events_url,omitempty"` - ForksURL *string `json:"forks_url,omitempty"` - GitCommitsURL *string `json:"git_commits_url,omitempty"` - GitRefsURL *string `json:"git_refs_url,omitempty"` - GitTagsURL *string `json:"git_tags_url,omitempty"` - HooksURL *string `json:"hooks_url,omitempty"` - IssueCommentURL *string `json:"issue_comment_url,omitempty"` - IssueEventsURL *string `json:"issue_events_url,omitempty"` - IssuesURL *string `json:"issues_url,omitempty"` - KeysURL *string `json:"keys_url,omitempty"` - LabelsURL *string `json:"labels_url,omitempty"` - LanguagesURL *string `json:"languages_url,omitempty"` - MergesURL *string `json:"merges_url,omitempty"` - MilestonesURL *string `json:"milestones_url,omitempty"` - NotificationsURL *string `json:"notifications_url,omitempty"` - PullsURL *string `json:"pulls_url,omitempty"` - ReleasesURL *string `json:"releases_url,omitempty"` - StargazersURL *string `json:"stargazers_url,omitempty"` - StatusesURL *string `json:"statuses_url,omitempty"` - SubscribersURL *string `json:"subscribers_url,omitempty"` - SubscriptionURL *string `json:"subscription_url,omitempty"` - TagsURL *string `json:"tags_url,omitempty"` - TreesURL *string `json:"trees_url,omitempty"` - TeamsURL *string `json:"teams_url,omitempty"` - - // TextMatches is only populated from search results that request text matches - // See: search.go and https://developer.github.com/v3/search/#text-match-metadata - TextMatches []TextMatch `json:"text_matches,omitempty"` -} - -func (r Repository) String() string { - return Stringify(r) -} - -// RepositoryListOptions specifies the optional parameters to the -// RepositoriesService.List method. -type RepositoryListOptions struct { - // Visibility of repositories to list. Can be one of all, public, or private. - // Default: all - Visibility string `url:"visibility,omitempty"` - - // List repos of given affiliation[s]. - // Comma-separated list of values. Can include: - // * owner: Repositories that are owned by the authenticated user. - // * collaborator: Repositories that the user has been added to as a - // collaborator. - // * organization_member: Repositories that the user has access to through - // being a member of an organization. This includes every repository on - // every team that the user is on. - // Default: owner,collaborator,organization_member - Affiliation string `url:"affiliation,omitempty"` - - // Type of repositories to list. - // Can be one of all, owner, public, private, member. Default: all - // Will cause a 422 error if used in the same request as visibility or - // affiliation. - Type string `url:"type,omitempty"` - - // How to sort the repository list. Can be one of created, updated, pushed, - // full_name. Default: full_name - Sort string `url:"sort,omitempty"` - - // Direction in which to sort repositories. Can be one of asc or desc. - // Default: when using full_name: asc; otherwise desc - Direction string `url:"direction,omitempty"` - - ListOptions -} - -// List the repositories for a user. Passing the empty string will list -// repositories for the authenticated user. -// -// GitHub API docs: https://developer.github.com/v3/repos/#list-user-repositories -func (s *RepositoriesService) List(ctx context.Context, user string, opt *RepositoryListOptions) ([]*Repository, *Response, error) { - var u string - if user != "" { - u = fmt.Sprintf("users/%v/repos", user) - } else { - u = "user/repos" - } - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - acceptHeaders := []string{mediaTypeTopicsPreview} - req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - - var repos []*Repository - resp, err := s.client.Do(ctx, req, &repos) - if err != nil { - return nil, resp, err - } - - return repos, resp, nil -} - -// RepositoryListByOrgOptions specifies the optional parameters to the -// RepositoriesService.ListByOrg method. -type RepositoryListByOrgOptions struct { - // Type of repositories to list. Possible values are: all, public, private, - // forks, sources, member. Default is "all". - Type string `url:"type,omitempty"` - - ListOptions -} - -// ListByOrg lists the repositories for an organization. -// -// GitHub API docs: https://developer.github.com/v3/repos/#list-organization-repositories -func (s *RepositoriesService) ListByOrg(ctx context.Context, org string, opt *RepositoryListByOrgOptions) ([]*Repository, *Response, error) { - u := fmt.Sprintf("orgs/%v/repos", org) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - acceptHeaders := []string{mediaTypeTopicsPreview} - req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - - var repos []*Repository - resp, err := s.client.Do(ctx, req, &repos) - if err != nil { - return nil, resp, err - } - - return repos, resp, nil -} - -// RepositoryListAllOptions specifies the optional parameters to the -// RepositoriesService.ListAll method. -type RepositoryListAllOptions struct { - // ID of the last repository seen - Since int64 `url:"since,omitempty"` -} - -// ListAll lists all GitHub repositories in the order that they were created. -// -// GitHub API docs: https://developer.github.com/v3/repos/#list-all-public-repositories -func (s *RepositoriesService) ListAll(ctx context.Context, opt *RepositoryListAllOptions) ([]*Repository, *Response, error) { - u, err := addOptions("repositories", opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var repos []*Repository - resp, err := s.client.Do(ctx, req, &repos) - if err != nil { - return nil, resp, err - } - - return repos, resp, nil -} - -// createRepoRequest is a subset of Repository and is used internally -// by Create to pass only the known fields for the endpoint. -// -// See https://github.com/google/go-github/issues/1014 for more -// information. -type createRepoRequest struct { - // Name is required when creating a repo. - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - Homepage *string `json:"homepage,omitempty"` - - Private *bool `json:"private,omitempty"` - HasIssues *bool `json:"has_issues,omitempty"` - HasProjects *bool `json:"has_projects,omitempty"` - HasWiki *bool `json:"has_wiki,omitempty"` - IsTemplate *bool `json:"is_template,omitempty"` - - // Creating an organization repository. Required for non-owners. - TeamID *int64 `json:"team_id,omitempty"` - - AutoInit *bool `json:"auto_init,omitempty"` - GitignoreTemplate *string `json:"gitignore_template,omitempty"` - LicenseTemplate *string `json:"license_template,omitempty"` - AllowSquashMerge *bool `json:"allow_squash_merge,omitempty"` - AllowMergeCommit *bool `json:"allow_merge_commit,omitempty"` - AllowRebaseMerge *bool `json:"allow_rebase_merge,omitempty"` -} - -// Create a new repository. If an organization is specified, the new -// repository will be created under that org. If the empty string is -// specified, it will be created for the authenticated user. -// -// Note that only a subset of the repo fields are used and repo must -// not be nil. -// -// GitHub API docs: https://developer.github.com/v3/repos/#create -func (s *RepositoriesService) Create(ctx context.Context, org string, repo *Repository) (*Repository, *Response, error) { - var u string - if org != "" { - u = fmt.Sprintf("orgs/%v/repos", org) - } else { - u = "user/repos" - } - - repoReq := &createRepoRequest{ - Name: repo.Name, - Description: repo.Description, - Homepage: repo.Homepage, - Private: repo.Private, - HasIssues: repo.HasIssues, - HasProjects: repo.HasProjects, - HasWiki: repo.HasWiki, - IsTemplate: repo.IsTemplate, - TeamID: repo.TeamID, - AutoInit: repo.AutoInit, - GitignoreTemplate: repo.GitignoreTemplate, - LicenseTemplate: repo.LicenseTemplate, - AllowSquashMerge: repo.AllowSquashMerge, - AllowMergeCommit: repo.AllowMergeCommit, - AllowRebaseMerge: repo.AllowRebaseMerge, - } - - req, err := s.client.NewRequest("POST", u, repoReq) - if err != nil { - return nil, nil, err - } - - req.Header.Set("Accept", mediaTypeRepositoryTemplatePreview) - r := new(Repository) - resp, err := s.client.Do(ctx, req, r) - if err != nil { - return nil, resp, err - } - - return r, resp, nil -} - -// TemplateRepoRequest represents a request to create a repository from a template. -type TemplateRepoRequest struct { - // Name is required when creating a repo. - Name *string `json:"name,omitempty"` - Owner *string `json:"owner,omitempty"` - Description *string `json:"description,omitempty"` - - Private *bool `json:"private,omitempty"` -} - -// CreateFromTemplate generates a repository from a template. -// -// GitHub API docs: https://developer.github.com/v3/repos/#create-repository-using-a-repository-template -func (s *RepositoriesService) CreateFromTemplate(ctx context.Context, templateOwner, templateRepo string, templateRepoReq *TemplateRepoRequest) (*Repository, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/generate", templateOwner, templateRepo) - - req, err := s.client.NewRequest("POST", u, templateRepoReq) - if err != nil { - return nil, nil, err - } - - req.Header.Set("Accept", mediaTypeRepositoryTemplatePreview) - r := new(Repository) - resp, err := s.client.Do(ctx, req, r) - if err != nil { - return nil, resp, err - } - - return r, resp, nil -} - -// Get fetches a repository. -// -// GitHub API docs: https://developer.github.com/v3/repos/#get -func (s *RepositoriesService) Get(ctx context.Context, owner, repo string) (*Repository, *Response, error) { - u := fmt.Sprintf("repos/%v/%v", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when the license support fully launches - // https://developer.github.com/v3/licenses/#get-a-repositorys-license - acceptHeaders := []string{mediaTypeCodesOfConductPreview, mediaTypeTopicsPreview, mediaTypeRepositoryTemplatePreview} - req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - - repository := new(Repository) - resp, err := s.client.Do(ctx, req, repository) - if err != nil { - return nil, resp, err - } - - return repository, resp, nil -} - -// GetCodeOfConduct gets the contents of a repository's code of conduct. -// -// GitHub API docs: https://developer.github.com/v3/codes_of_conduct/#get-the-contents-of-a-repositorys-code-of-conduct -func (s *RepositoriesService) GetCodeOfConduct(ctx context.Context, owner, repo string) (*CodeOfConduct, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/community/code_of_conduct", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeCodesOfConductPreview) - - coc := new(CodeOfConduct) - resp, err := s.client.Do(ctx, req, coc) - if err != nil { - return nil, resp, err - } - - return coc, resp, nil -} - -// GetByID fetches a repository. -// -// Note: GetByID uses the undocumented GitHub API endpoint /repositories/:id. -func (s *RepositoriesService) GetByID(ctx context.Context, id int64) (*Repository, *Response, error) { - u := fmt.Sprintf("repositories/%d", id) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - repository := new(Repository) - resp, err := s.client.Do(ctx, req, repository) - if err != nil { - return nil, resp, err - } - - return repository, resp, nil -} - -// Edit updates a repository. -// -// GitHub API docs: https://developer.github.com/v3/repos/#edit -func (s *RepositoriesService) Edit(ctx context.Context, owner, repo string, repository *Repository) (*Repository, *Response, error) { - u := fmt.Sprintf("repos/%v/%v", owner, repo) - req, err := s.client.NewRequest("PATCH", u, repository) - if err != nil { - return nil, nil, err - } - - req.Header.Set("Accept", mediaTypeRepositoryTemplatePreview) - r := new(Repository) - resp, err := s.client.Do(ctx, req, r) - if err != nil { - return nil, resp, err - } - - return r, resp, nil -} - -// Delete a repository. -// -// GitHub API docs: https://developer.github.com/v3/repos/#delete-a-repository -func (s *RepositoriesService) Delete(ctx context.Context, owner, repo string) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v", owner, repo) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} - -// Contributor represents a repository contributor -type Contributor struct { - Login *string `json:"login,omitempty"` - ID *int64 `json:"id,omitempty"` - AvatarURL *string `json:"avatar_url,omitempty"` - GravatarID *string `json:"gravatar_id,omitempty"` - URL *string `json:"url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - FollowersURL *string `json:"followers_url,omitempty"` - FollowingURL *string `json:"following_url,omitempty"` - GistsURL *string `json:"gists_url,omitempty"` - StarredURL *string `json:"starred_url,omitempty"` - SubscriptionsURL *string `json:"subscriptions_url,omitempty"` - OrganizationsURL *string `json:"organizations_url,omitempty"` - ReposURL *string `json:"repos_url,omitempty"` - EventsURL *string `json:"events_url,omitempty"` - ReceivedEventsURL *string `json:"received_events_url,omitempty"` - Type *string `json:"type,omitempty"` - SiteAdmin *bool `json:"site_admin,omitempty"` - Contributions *int `json:"contributions,omitempty"` -} - -// ListContributorsOptions specifies the optional parameters to the -// RepositoriesService.ListContributors method. -type ListContributorsOptions struct { - // Include anonymous contributors in results or not - Anon string `url:"anon,omitempty"` - - ListOptions -} - -// EnableVulnerabilityAlerts enables vulnerability alerts and the dependency graph for a repository. -// -// GitHub API docs: https://developer.github.com/v3/repos/#enable-vulnerability-alerts -func (s *RepositoriesService) EnableVulnerabilityAlerts(ctx context.Context, owner, repository string) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/vulnerability-alerts", owner, repository) - - req, err := s.client.NewRequest("PUT", u, nil) - if err != nil { - return nil, err - } - - // TODO: remove custom Accept header when this API fully launches - req.Header.Set("Accept", mediaTypeRequiredVulnerabilityAlertsPreview) - - return s.client.Do(ctx, req, nil) -} - -// DisableVulnerabilityAlerts disables vulnerability alerts and the dependency graph for a repository. -// -// GitHub API docs: https://developer.github.com/v3/repos/#disable-vulnerability-alerts -func (s *RepositoriesService) DisableVulnerabilityAlerts(ctx context.Context, owner, repository string) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/vulnerability-alerts", owner, repository) - - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - // TODO: remove custom Accept header when this API fully launches - req.Header.Set("Accept", mediaTypeRequiredVulnerabilityAlertsPreview) - - return s.client.Do(ctx, req, nil) -} - -// EnableAutomatedSecurityFixes enables the automated security fixes for a repository. -// -// GitHub API docs: https://developer.github.com/v3/repos/#enable-automated-security-fixes -func (s *RepositoriesService) EnableAutomatedSecurityFixes(ctx context.Context, owner, repository string) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/automated-security-fixes", owner, repository) - - req, err := s.client.NewRequest("PUT", u, nil) - if err != nil { - return nil, err - } - - // TODO: remove custom Accept header when this API fully launches - req.Header.Set("Accept", mediaTypeRequiredAutomatedSecurityFixesPreview) - - return s.client.Do(ctx, req, nil) -} - -// DisableAutomatedSecurityFixes disables vulnerability alerts and the dependency graph for a repository. -// -// GitHub API docs: https://developer.github.com/v3/repos/#disable-automated-security-fixes -func (s *RepositoriesService) DisableAutomatedSecurityFixes(ctx context.Context, owner, repository string) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/automated-security-fixes", owner, repository) - - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - // TODO: remove custom Accept header when this API fully launches - req.Header.Set("Accept", mediaTypeRequiredAutomatedSecurityFixesPreview) - - return s.client.Do(ctx, req, nil) -} - -// ListContributors lists contributors for a repository. -// -// GitHub API docs: https://developer.github.com/v3/repos/#list-contributors -func (s *RepositoriesService) ListContributors(ctx context.Context, owner string, repository string, opt *ListContributorsOptions) ([]*Contributor, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/contributors", owner, repository) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var contributor []*Contributor - resp, err := s.client.Do(ctx, req, &contributor) - if err != nil { - return nil, nil, err - } - - return contributor, resp, nil -} - -// ListLanguages lists languages for the specified repository. The returned map -// specifies the languages and the number of bytes of code written in that -// language. For example: -// -// { -// "C": 78769, -// "Python": 7769 -// } -// -// GitHub API docs: https://developer.github.com/v3/repos/#list-languages -func (s *RepositoriesService) ListLanguages(ctx context.Context, owner string, repo string) (map[string]int, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/languages", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - languages := make(map[string]int) - resp, err := s.client.Do(ctx, req, &languages) - if err != nil { - return nil, resp, err - } - - return languages, resp, nil -} - -// ListTeams lists the teams for the specified repository. -// -// GitHub API docs: https://developer.github.com/v3/repos/#list-teams -func (s *RepositoriesService) ListTeams(ctx context.Context, owner string, repo string, opt *ListOptions) ([]*Team, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/teams", owner, repo) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - req.Header.Set("Accept", mediaTypeNestedTeamsPreview) - - var teams []*Team - resp, err := s.client.Do(ctx, req, &teams) - if err != nil { - return nil, resp, err - } - - return teams, resp, nil -} - -// RepositoryTag represents a repository tag. -type RepositoryTag struct { - Name *string `json:"name,omitempty"` - Commit *Commit `json:"commit,omitempty"` - ZipballURL *string `json:"zipball_url,omitempty"` - TarballURL *string `json:"tarball_url,omitempty"` -} - -// ListTags lists tags for the specified repository. -// -// GitHub API docs: https://developer.github.com/v3/repos/#list-tags -func (s *RepositoriesService) ListTags(ctx context.Context, owner string, repo string, opt *ListOptions) ([]*RepositoryTag, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/tags", owner, repo) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var tags []*RepositoryTag - resp, err := s.client.Do(ctx, req, &tags) - if err != nil { - return nil, resp, err - } - - return tags, resp, nil -} - -// Branch represents a repository branch -type Branch struct { - Name *string `json:"name,omitempty"` - Commit *RepositoryCommit `json:"commit,omitempty"` - Protected *bool `json:"protected,omitempty"` -} - -// Protection represents a repository branch's protection. -type Protection struct { - RequiredStatusChecks *RequiredStatusChecks `json:"required_status_checks"` - RequiredPullRequestReviews *PullRequestReviewsEnforcement `json:"required_pull_request_reviews"` - EnforceAdmins *AdminEnforcement `json:"enforce_admins"` - Restrictions *BranchRestrictions `json:"restrictions"` -} - -// ProtectionRequest represents a request to create/edit a branch's protection. -type ProtectionRequest struct { - RequiredStatusChecks *RequiredStatusChecks `json:"required_status_checks"` - RequiredPullRequestReviews *PullRequestReviewsEnforcementRequest `json:"required_pull_request_reviews"` - EnforceAdmins bool `json:"enforce_admins"` - Restrictions *BranchRestrictionsRequest `json:"restrictions"` -} - -// RequiredStatusChecks represents the protection status of a individual branch. -type RequiredStatusChecks struct { - // Require branches to be up to date before merging. (Required.) - Strict bool `json:"strict"` - // The list of status checks to require in order to merge into this - // branch. (Required; use []string{} instead of nil for empty list.) - Contexts []string `json:"contexts"` -} - -// RequiredStatusChecksRequest represents a request to edit a protected branch's status checks. -type RequiredStatusChecksRequest struct { - Strict *bool `json:"strict,omitempty"` - Contexts []string `json:"contexts,omitempty"` -} - -// PullRequestReviewsEnforcement represents the pull request reviews enforcement of a protected branch. -type PullRequestReviewsEnforcement struct { - // Specifies which users and teams can dismiss pull request reviews. - DismissalRestrictions DismissalRestrictions `json:"dismissal_restrictions"` - // Specifies if approved reviews are dismissed automatically, when a new commit is pushed. - DismissStaleReviews bool `json:"dismiss_stale_reviews"` - // RequireCodeOwnerReviews specifies if an approved review is required in pull requests including files with a designated code owner. - RequireCodeOwnerReviews bool `json:"require_code_owner_reviews"` - // RequiredApprovingReviewCount specifies the number of approvals required before the pull request can be merged. - // Valid values are 1-6. - RequiredApprovingReviewCount int `json:"required_approving_review_count"` -} - -// PullRequestReviewsEnforcementRequest represents request to set the pull request review -// enforcement of a protected branch. It is separate from PullRequestReviewsEnforcement above -// because the request structure is different from the response structure. -type PullRequestReviewsEnforcementRequest struct { - // Specifies which users and teams should be allowed to dismiss pull request reviews. - // User and team dismissal restrictions are only available for - // organization-owned repositories. Must be nil for personal repositories. - DismissalRestrictionsRequest *DismissalRestrictionsRequest `json:"dismissal_restrictions,omitempty"` - // Specifies if approved reviews can be dismissed automatically, when a new commit is pushed. (Required) - DismissStaleReviews bool `json:"dismiss_stale_reviews"` - // RequireCodeOwnerReviews specifies if an approved review is required in pull requests including files with a designated code owner. - RequireCodeOwnerReviews bool `json:"require_code_owner_reviews"` - // RequiredApprovingReviewCount specifies the number of approvals required before the pull request can be merged. - // Valid values are 1-6. - RequiredApprovingReviewCount int `json:"required_approving_review_count"` -} - -// PullRequestReviewsEnforcementUpdate represents request to patch the pull request review -// enforcement of a protected branch. It is separate from PullRequestReviewsEnforcementRequest above -// because the patch request does not require all fields to be initialized. -type PullRequestReviewsEnforcementUpdate struct { - // Specifies which users and teams can dismiss pull request reviews. Can be omitted. - DismissalRestrictionsRequest *DismissalRestrictionsRequest `json:"dismissal_restrictions,omitempty"` - // Specifies if approved reviews can be dismissed automatically, when a new commit is pushed. Can be omitted. - DismissStaleReviews *bool `json:"dismiss_stale_reviews,omitempty"` - // RequireCodeOwnerReviews specifies if an approved review is required in pull requests including files with a designated code owner. - RequireCodeOwnerReviews bool `json:"require_code_owner_reviews,omitempty"` - // RequiredApprovingReviewCount specifies the number of approvals required before the pull request can be merged. - // Valid values are 1 - 6. - RequiredApprovingReviewCount int `json:"required_approving_review_count"` -} - -// AdminEnforcement represents the configuration to enforce required status checks for repository administrators. -type AdminEnforcement struct { - URL *string `json:"url,omitempty"` - Enabled bool `json:"enabled"` -} - -// BranchRestrictions represents the restriction that only certain users or -// teams may push to a branch. -type BranchRestrictions struct { - // The list of user logins with push access. - Users []*User `json:"users"` - // The list of team slugs with push access. - Teams []*Team `json:"teams"` -} - -// BranchRestrictionsRequest represents the request to create/edit the -// restriction that only certain users or teams may push to a branch. It is -// separate from BranchRestrictions above because the request structure is -// different from the response structure. -type BranchRestrictionsRequest struct { - // The list of user logins with push access. (Required; use []string{} instead of nil for empty list.) - Users []string `json:"users"` - // The list of team slugs with push access. (Required; use []string{} instead of nil for empty list.) - Teams []string `json:"teams"` -} - -// DismissalRestrictions specifies which users and teams can dismiss pull request reviews. -type DismissalRestrictions struct { - // The list of users who can dimiss pull request reviews. - Users []*User `json:"users"` - // The list of teams which can dismiss pull request reviews. - Teams []*Team `json:"teams"` -} - -// DismissalRestrictionsRequest represents the request to create/edit the -// restriction to allows only specific users or teams to dimiss pull request reviews. It is -// separate from DismissalRestrictions above because the request structure is -// different from the response structure. -// Note: Both Users and Teams must be nil, or both must be non-nil. -type DismissalRestrictionsRequest struct { - // The list of user logins who can dismiss pull request reviews. (Required; use nil to disable dismissal_restrictions or &[]string{} otherwise.) - Users *[]string `json:"users,omitempty"` - // The list of team slugs which can dismiss pull request reviews. (Required; use nil to disable dismissal_restrictions or &[]string{} otherwise.) - Teams *[]string `json:"teams,omitempty"` -} - -// SignaturesProtectedBranch represents the protection status of an individual branch. -type SignaturesProtectedBranch struct { - URL *string `json:"url,omitempty"` - // Commits pushed to matching branches must have verified signatures. - Enabled *bool `json:"enabled,omitempty"` -} - -// ListBranches lists branches for the specified repository. -// -// GitHub API docs: https://developer.github.com/v3/repos/#list-branches -func (s *RepositoriesService) ListBranches(ctx context.Context, owner string, repo string, opt *ListOptions) ([]*Branch, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/branches", owner, repo) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches - req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) - - var branches []*Branch - resp, err := s.client.Do(ctx, req, &branches) - if err != nil { - return nil, resp, err - } - - return branches, resp, nil -} - -// GetBranch gets the specified branch for a repository. -// -// GitHub API docs: https://developer.github.com/v3/repos/#get-branch -func (s *RepositoriesService) GetBranch(ctx context.Context, owner, repo, branch string) (*Branch, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v", owner, repo, branch) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches - req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) - - b := new(Branch) - resp, err := s.client.Do(ctx, req, b) - if err != nil { - return nil, resp, err - } - - return b, resp, nil -} - -// GetBranchProtection gets the protection of a given branch. -// -// GitHub API docs: https://developer.github.com/v3/repos/branches/#get-branch-protection -func (s *RepositoriesService) GetBranchProtection(ctx context.Context, owner, repo, branch string) (*Protection, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v/protection", owner, repo, branch) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches - req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) - - p := new(Protection) - resp, err := s.client.Do(ctx, req, p) - if err != nil { - return nil, resp, err - } - - return p, resp, nil -} - -// GetRequiredStatusChecks gets the required status checks for a given protected branch. -// -// GitHub API docs: https://developer.github.com/v3/repos/branches/#get-required-status-checks-of-protected-branch -func (s *RepositoriesService) GetRequiredStatusChecks(ctx context.Context, owner, repo, branch string) (*RequiredStatusChecks, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_status_checks", owner, repo, branch) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches - req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) - - p := new(RequiredStatusChecks) - resp, err := s.client.Do(ctx, req, p) - if err != nil { - return nil, resp, err - } - - return p, resp, nil -} - -// ListRequiredStatusChecksContexts lists the required status checks contexts for a given protected branch. -// -// GitHub API docs: https://developer.github.com/v3/repos/branches/#list-required-status-checks-contexts-of-protected-branch -func (s *RepositoriesService) ListRequiredStatusChecksContexts(ctx context.Context, owner, repo, branch string) (contexts []string, resp *Response, err error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_status_checks/contexts", owner, repo, branch) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches - req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) - - resp, err = s.client.Do(ctx, req, &contexts) - if err != nil { - return nil, resp, err - } - - return contexts, resp, nil -} - -// UpdateBranchProtection updates the protection of a given branch. -// -// GitHub API docs: https://developer.github.com/v3/repos/branches/#update-branch-protection -func (s *RepositoriesService) UpdateBranchProtection(ctx context.Context, owner, repo, branch string, preq *ProtectionRequest) (*Protection, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v/protection", owner, repo, branch) - req, err := s.client.NewRequest("PUT", u, preq) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches - req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) - - p := new(Protection) - resp, err := s.client.Do(ctx, req, p) - if err != nil { - return nil, resp, err - } - - return p, resp, nil -} - -// RemoveBranchProtection removes the protection of a given branch. -// -// GitHub API docs: https://developer.github.com/v3/repos/branches/#remove-branch-protection -func (s *RepositoriesService) RemoveBranchProtection(ctx context.Context, owner, repo, branch string) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v/protection", owner, repo, branch) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - // TODO: remove custom Accept header when this API fully launches - req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) - - return s.client.Do(ctx, req, nil) -} - -// GetSignaturesProtectedBranch gets required signatures of protected branch. -// -// GitHub API docs: https://developer.github.com/v3/repos/branches/#get-required-signatures-of-protected-branch -func (s *RepositoriesService) GetSignaturesProtectedBranch(ctx context.Context, owner, repo, branch string) (*SignaturesProtectedBranch, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_signatures", owner, repo, branch) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches - req.Header.Set("Accept", mediaTypeSignaturePreview) - - p := new(SignaturesProtectedBranch) - resp, err := s.client.Do(ctx, req, p) - if err != nil { - return nil, resp, err - } - - return p, resp, nil -} - -// RequireSignaturesOnProtectedBranch makes signed commits required on a protected branch. -// It requires admin access and branch protection to be enabled. -// -// GitHub API docs: https://developer.github.com/v3/repos/branches/#add-required-signatures-of-protected-branch -func (s *RepositoriesService) RequireSignaturesOnProtectedBranch(ctx context.Context, owner, repo, branch string) (*SignaturesProtectedBranch, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_signatures", owner, repo, branch) - req, err := s.client.NewRequest("POST", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches - req.Header.Set("Accept", mediaTypeSignaturePreview) - - r := new(SignaturesProtectedBranch) - resp, err := s.client.Do(ctx, req, r) - if err != nil { - return nil, resp, err - } - - return r, resp, err -} - -// OptionalSignaturesOnProtectedBranch removes required signed commits on a given branch. -// -// GitHub API docs: https://developer.github.com/v3/repos/branches/#remove-required-signatures-of-protected-branch -func (s *RepositoriesService) OptionalSignaturesOnProtectedBranch(ctx context.Context, owner, repo, branch string) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_signatures", owner, repo, branch) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - // TODO: remove custom Accept header when this API fully launches - req.Header.Set("Accept", mediaTypeSignaturePreview) - - return s.client.Do(ctx, req, nil) -} - -// UpdateRequiredStatusChecks updates the required status checks for a given protected branch. -// -// GitHub API docs: https://developer.github.com/v3/repos/branches/#update-required-status-checks-of-protected-branch -func (s *RepositoriesService) UpdateRequiredStatusChecks(ctx context.Context, owner, repo, branch string, sreq *RequiredStatusChecksRequest) (*RequiredStatusChecks, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_status_checks", owner, repo, branch) - req, err := s.client.NewRequest("PATCH", u, sreq) - if err != nil { - return nil, nil, err - } - - sc := new(RequiredStatusChecks) - resp, err := s.client.Do(ctx, req, sc) - if err != nil { - return nil, resp, err - } - - return sc, resp, nil -} - -// License gets the contents of a repository's license if one is detected. -// -// GitHub API docs: https://developer.github.com/v3/licenses/#get-the-contents-of-a-repositorys-license -func (s *RepositoriesService) License(ctx context.Context, owner, repo string) (*RepositoryLicense, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/license", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - r := &RepositoryLicense{} - resp, err := s.client.Do(ctx, req, r) - if err != nil { - return nil, resp, err - } - - return r, resp, nil -} - -// GetPullRequestReviewEnforcement gets pull request review enforcement of a protected branch. -// -// GitHub API docs: https://developer.github.com/v3/repos/branches/#get-pull-request-review-enforcement-of-protected-branch -func (s *RepositoriesService) GetPullRequestReviewEnforcement(ctx context.Context, owner, repo, branch string) (*PullRequestReviewsEnforcement, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_pull_request_reviews", owner, repo, branch) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches - req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) - - r := new(PullRequestReviewsEnforcement) - resp, err := s.client.Do(ctx, req, r) - if err != nil { - return nil, resp, err - } - - return r, resp, nil -} - -// UpdatePullRequestReviewEnforcement patches pull request review enforcement of a protected branch. -// It requires admin access and branch protection to be enabled. -// -// GitHub API docs: https://developer.github.com/v3/repos/branches/#update-pull-request-review-enforcement-of-protected-branch -func (s *RepositoriesService) UpdatePullRequestReviewEnforcement(ctx context.Context, owner, repo, branch string, patch *PullRequestReviewsEnforcementUpdate) (*PullRequestReviewsEnforcement, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_pull_request_reviews", owner, repo, branch) - req, err := s.client.NewRequest("PATCH", u, patch) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches - req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) - - r := new(PullRequestReviewsEnforcement) - resp, err := s.client.Do(ctx, req, r) - if err != nil { - return nil, resp, err - } - - return r, resp, err -} - -// DisableDismissalRestrictions disables dismissal restrictions of a protected branch. -// It requires admin access and branch protection to be enabled. -// -// GitHub API docs: https://developer.github.com/v3/repos/branches/#update-pull-request-review-enforcement-of-protected-branch -func (s *RepositoriesService) DisableDismissalRestrictions(ctx context.Context, owner, repo, branch string) (*PullRequestReviewsEnforcement, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_pull_request_reviews", owner, repo, branch) - - data := struct { - R []interface{} `json:"dismissal_restrictions"` - }{[]interface{}{}} - - req, err := s.client.NewRequest("PATCH", u, data) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches - req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) - - r := new(PullRequestReviewsEnforcement) - resp, err := s.client.Do(ctx, req, r) - if err != nil { - return nil, resp, err - } - - return r, resp, err -} - -// RemovePullRequestReviewEnforcement removes pull request enforcement of a protected branch. -// -// GitHub API docs: https://developer.github.com/v3/repos/branches/#remove-pull-request-review-enforcement-of-protected-branch -func (s *RepositoriesService) RemovePullRequestReviewEnforcement(ctx context.Context, owner, repo, branch string) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_pull_request_reviews", owner, repo, branch) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - // TODO: remove custom Accept header when this API fully launches - req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) - - return s.client.Do(ctx, req, nil) -} - -// GetAdminEnforcement gets admin enforcement information of a protected branch. -// -// GitHub API docs: https://developer.github.com/v3/repos/branches/#get-admin-enforcement-of-protected-branch -func (s *RepositoriesService) GetAdminEnforcement(ctx context.Context, owner, repo, branch string) (*AdminEnforcement, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/enforce_admins", owner, repo, branch) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches - req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) - - r := new(AdminEnforcement) - resp, err := s.client.Do(ctx, req, r) - if err != nil { - return nil, resp, err - } - - return r, resp, nil -} - -// AddAdminEnforcement adds admin enforcement to a protected branch. -// It requires admin access and branch protection to be enabled. -// -// GitHub API docs: https://developer.github.com/v3/repos/branches/#add-admin-enforcement-of-protected-branch -func (s *RepositoriesService) AddAdminEnforcement(ctx context.Context, owner, repo, branch string) (*AdminEnforcement, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/enforce_admins", owner, repo, branch) - req, err := s.client.NewRequest("POST", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches - req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) - - r := new(AdminEnforcement) - resp, err := s.client.Do(ctx, req, r) - if err != nil { - return nil, resp, err - } - - return r, resp, err -} - -// RemoveAdminEnforcement removes admin enforcement from a protected branch. -// -// GitHub API docs: https://developer.github.com/v3/repos/branches/#remove-admin-enforcement-of-protected-branch -func (s *RepositoriesService) RemoveAdminEnforcement(ctx context.Context, owner, repo, branch string) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/enforce_admins", owner, repo, branch) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - // TODO: remove custom Accept header when this API fully launches - req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) - - return s.client.Do(ctx, req, nil) -} - -// repositoryTopics represents a collection of repository topics. -type repositoryTopics struct { - Names []string `json:"names"` -} - -// ListAllTopics lists topics for a repository. -// -// GitHub API docs: https://developer.github.com/v3/repos/#list-all-topics-for-a-repository -func (s *RepositoriesService) ListAllTopics(ctx context.Context, owner, repo string) ([]string, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/topics", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeTopicsPreview) - - topics := new(repositoryTopics) - resp, err := s.client.Do(ctx, req, topics) - if err != nil { - return nil, resp, err - } - - return topics.Names, resp, nil -} - -// ReplaceAllTopics replaces topics for a repository. -// -// GitHub API docs: https://developer.github.com/v3/repos/#replace-all-topics-for-a-repository -func (s *RepositoriesService) ReplaceAllTopics(ctx context.Context, owner, repo string, topics []string) ([]string, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/topics", owner, repo) - t := &repositoryTopics{ - Names: topics, - } - if t.Names == nil { - t.Names = []string{} - } - req, err := s.client.NewRequest("PUT", u, t) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeTopicsPreview) - - t = new(repositoryTopics) - resp, err := s.client.Do(ctx, req, t) - if err != nil { - return nil, resp, err - } - - return t.Names, resp, nil -} - -// TransferRequest represents a request to transfer a repository. -type TransferRequest struct { - NewOwner string `json:"new_owner"` - TeamID []int64 `json:"team_ids,omitempty"` -} - -// Transfer transfers a repository from one account or organization to another. -// -// This method might return an *AcceptedError and a status code of -// 202. This is because this is the status that GitHub returns to signify that -// it has now scheduled the transfer of the repository in a background task. -// A follow up request, after a delay of a second or so, should result -// in a successful request. -// -// GitHub API docs: https://developer.github.com/v3/repos/#transfer-a-repository -func (s *RepositoriesService) Transfer(ctx context.Context, owner, repo string, transfer TransferRequest) (*Repository, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/transfer", owner, repo) - - req, err := s.client.NewRequest("POST", u, &transfer) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeRepositoryTransferPreview) - - r := new(Repository) - resp, err := s.client.Do(ctx, req, r) - if err != nil { - return nil, resp, err - } - - return r, resp, nil -} diff --git a/vendor/github.com/google/go-github/v27/github/repos_collaborators.go b/vendor/github.com/google/go-github/v27/github/repos_collaborators.go deleted file mode 100644 index 757e9f39e44b..000000000000 --- a/vendor/github.com/google/go-github/v27/github/repos_collaborators.go +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright 2013 The go-github 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 - -import ( - "context" - "fmt" -) - -// ListCollaboratorsOptions specifies the optional parameters to the -// RepositoriesService.ListCollaborators method. -type ListCollaboratorsOptions struct { - // Affiliation specifies how collaborators should be filtered by their affiliation. - // Possible values are: - // outside - All outside collaborators of an organization-owned repository - // direct - All collaborators with permissions to an organization-owned repository, - // regardless of organization membership status - // all - All collaborators the authenticated user can see - // - // Default value is "all". - Affiliation string `url:"affiliation,omitempty"` - - ListOptions -} - -// ListCollaborators lists the GitHub users that have access to the repository. -// -// GitHub API docs: https://developer.github.com/v3/repos/collaborators/#list-collaborators -func (s *RepositoriesService) ListCollaborators(ctx context.Context, owner, repo string, opt *ListCollaboratorsOptions) ([]*User, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/collaborators", owner, repo) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - req.Header.Set("Accept", mediaTypeNestedTeamsPreview) - - var users []*User - resp, err := s.client.Do(ctx, req, &users) - if err != nil { - return nil, resp, err - } - - return users, resp, nil -} - -// IsCollaborator checks whether the specified GitHub user has collaborator -// access to the given repo. -// Note: This will return false if the user is not a collaborator OR the user -// is not a GitHub user. -// -// GitHub API docs: https://developer.github.com/v3/repos/collaborators/#get -func (s *RepositoriesService) IsCollaborator(ctx context.Context, owner, repo, user string) (bool, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/collaborators/%v", owner, repo, user) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return false, nil, err - } - - resp, err := s.client.Do(ctx, req, nil) - isCollab, err := parseBoolResponse(err) - return isCollab, resp, err -} - -// RepositoryPermissionLevel represents the permission level an organization -// member has for a given repository. -type RepositoryPermissionLevel struct { - // Possible values: "admin", "write", "read", "none" - Permission *string `json:"permission,omitempty"` - - User *User `json:"user,omitempty"` -} - -// GetPermissionLevel retrieves the specific permission level a collaborator has for a given repository. -// GitHub API docs: https://developer.github.com/v3/repos/collaborators/#review-a-users-permission-level -func (s *RepositoriesService) GetPermissionLevel(ctx context.Context, owner, repo, user string) (*RepositoryPermissionLevel, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/collaborators/%v/permission", owner, repo, user) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - rpl := new(RepositoryPermissionLevel) - resp, err := s.client.Do(ctx, req, rpl) - if err != nil { - return nil, resp, err - } - return rpl, resp, nil -} - -// RepositoryAddCollaboratorOptions specifies the optional parameters to the -// RepositoriesService.AddCollaborator method. -type RepositoryAddCollaboratorOptions struct { - // Permission specifies the permission to grant the user on this repository. - // Possible values are: - // pull - team members can pull, but not push to or administer this repository - // push - team members can pull and push, but not administer this repository - // admin - team members can pull, push and administer this repository - // - // Default value is "push". This option is only valid for organization-owned repositories. - Permission string `json:"permission,omitempty"` -} - -// AddCollaborator sends an invitation to the specified GitHub user -// to become a collaborator to the given repo. -// -// GitHub API docs: https://developer.github.com/v3/repos/collaborators/#add-user-as-a-collaborator -func (s *RepositoriesService) AddCollaborator(ctx context.Context, owner, repo, user string, opt *RepositoryAddCollaboratorOptions) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/collaborators/%v", owner, repo, user) - req, err := s.client.NewRequest("PUT", u, opt) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} - -// RemoveCollaborator removes the specified GitHub user as collaborator from the given repo. -// Note: Does not return error if a valid user that is not a collaborator is removed. -// -// GitHub API docs: https://developer.github.com/v3/repos/collaborators/#remove-collaborator -func (s *RepositoriesService) RemoveCollaborator(ctx context.Context, owner, repo, user string) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/collaborators/%v", owner, repo, user) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - return s.client.Do(ctx, req, nil) -} diff --git a/vendor/github.com/google/go-github/v27/github/repos_comments.go b/vendor/github.com/google/go-github/v27/github/repos_comments.go deleted file mode 100644 index 380ca3d3b432..000000000000 --- a/vendor/github.com/google/go-github/v27/github/repos_comments.go +++ /dev/null @@ -1,162 +0,0 @@ -// Copyright 2013 The go-github 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 - -import ( - "context" - "fmt" - "time" -) - -// RepositoryComment represents a comment for a commit, file, or line in a repository. -type RepositoryComment struct { - HTMLURL *string `json:"html_url,omitempty"` - URL *string `json:"url,omitempty"` - ID *int64 `json:"id,omitempty"` - NodeID *string `json:"node_id,omitempty"` - CommitID *string `json:"commit_id,omitempty"` - User *User `json:"user,omitempty"` - Reactions *Reactions `json:"reactions,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` - - // User-mutable fields - Body *string `json:"body"` - // User-initialized fields - Path *string `json:"path,omitempty"` - Position *int `json:"position,omitempty"` -} - -func (r RepositoryComment) String() string { - return Stringify(r) -} - -// ListComments lists all the comments for the repository. -// -// GitHub API docs: https://developer.github.com/v3/repos/comments/#list-commit-comments-for-a-repository -func (s *RepositoriesService) ListComments(ctx context.Context, owner, repo string, opt *ListOptions) ([]*RepositoryComment, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/comments", owner, repo) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeReactionsPreview) - - var comments []*RepositoryComment - resp, err := s.client.Do(ctx, req, &comments) - if err != nil { - return nil, resp, err - } - - return comments, resp, nil -} - -// ListCommitComments lists all the comments for a given commit SHA. -// -// GitHub API docs: https://developer.github.com/v3/repos/comments/#list-comments-for-a-single-commit -func (s *RepositoriesService) ListCommitComments(ctx context.Context, owner, repo, sha string, opt *ListOptions) ([]*RepositoryComment, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/commits/%v/comments", owner, repo, sha) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeReactionsPreview) - - var comments []*RepositoryComment - resp, err := s.client.Do(ctx, req, &comments) - if err != nil { - return nil, resp, err - } - - return comments, resp, nil -} - -// CreateComment creates a comment for the given commit. -// Note: GitHub allows for comments to be created for non-existing files and positions. -// -// GitHub API docs: https://developer.github.com/v3/repos/comments/#create-a-commit-comment -func (s *RepositoriesService) CreateComment(ctx context.Context, owner, repo, sha string, comment *RepositoryComment) (*RepositoryComment, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/commits/%v/comments", owner, repo, sha) - req, err := s.client.NewRequest("POST", u, comment) - if err != nil { - return nil, nil, err - } - - c := new(RepositoryComment) - resp, err := s.client.Do(ctx, req, c) - if err != nil { - return nil, resp, err - } - - return c, resp, nil -} - -// GetComment gets a single comment from a repository. -// -// GitHub API docs: https://developer.github.com/v3/repos/comments/#get-a-single-commit-comment -func (s *RepositoriesService) GetComment(ctx context.Context, owner, repo string, id int64) (*RepositoryComment, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/comments/%v", owner, repo, id) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeReactionsPreview) - - c := new(RepositoryComment) - resp, err := s.client.Do(ctx, req, c) - if err != nil { - return nil, resp, err - } - - return c, resp, nil -} - -// UpdateComment updates the body of a single comment. -// -// GitHub API docs: https://developer.github.com/v3/repos/comments/#update-a-commit-comment -func (s *RepositoriesService) UpdateComment(ctx context.Context, owner, repo string, id int64, comment *RepositoryComment) (*RepositoryComment, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/comments/%v", owner, repo, id) - req, err := s.client.NewRequest("PATCH", u, comment) - if err != nil { - return nil, nil, err - } - - c := new(RepositoryComment) - resp, err := s.client.Do(ctx, req, c) - if err != nil { - return nil, resp, err - } - - return c, resp, nil -} - -// DeleteComment deletes a single comment from a repository. -// -// GitHub API docs: https://developer.github.com/v3/repos/comments/#delete-a-commit-comment -func (s *RepositoriesService) DeleteComment(ctx context.Context, owner, repo string, id int64) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/comments/%v", owner, repo, id) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - return s.client.Do(ctx, req, nil) -} diff --git a/vendor/github.com/google/go-github/v27/github/repos_commits.go b/vendor/github.com/google/go-github/v27/github/repos_commits.go deleted file mode 100644 index 95096923432d..000000000000 --- a/vendor/github.com/google/go-github/v27/github/repos_commits.go +++ /dev/null @@ -1,264 +0,0 @@ -// Copyright 2013 The go-github 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 - -import ( - "bytes" - "context" - "fmt" - "net/url" - "time" -) - -// RepositoryCommit represents a commit in a repo. -// Note that it's wrapping a Commit, so author/committer information is in two places, -// but contain different details about them: in RepositoryCommit "github details", in Commit - "git details". -type RepositoryCommit struct { - NodeID *string `json:"node_id,omitempty"` - SHA *string `json:"sha,omitempty"` - Commit *Commit `json:"commit,omitempty"` - Author *User `json:"author,omitempty"` - Committer *User `json:"committer,omitempty"` - Parents []Commit `json:"parents,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - URL *string `json:"url,omitempty"` - CommentsURL *string `json:"comments_url,omitempty"` - - // Details about how many changes were made in this commit. Only filled in during GetCommit! - Stats *CommitStats `json:"stats,omitempty"` - // Details about which files, and how this commit touched. Only filled in during GetCommit! - Files []CommitFile `json:"files,omitempty"` -} - -func (r RepositoryCommit) String() string { - return Stringify(r) -} - -// CommitStats represents the number of additions / deletions from a file in a given RepositoryCommit or GistCommit. -type CommitStats struct { - Additions *int `json:"additions,omitempty"` - Deletions *int `json:"deletions,omitempty"` - Total *int `json:"total,omitempty"` -} - -func (c CommitStats) String() string { - return Stringify(c) -} - -// CommitFile represents a file modified in a commit. -type CommitFile struct { - SHA *string `json:"sha,omitempty"` - Filename *string `json:"filename,omitempty"` - Additions *int `json:"additions,omitempty"` - Deletions *int `json:"deletions,omitempty"` - Changes *int `json:"changes,omitempty"` - Status *string `json:"status,omitempty"` - Patch *string `json:"patch,omitempty"` - BlobURL *string `json:"blob_url,omitempty"` - RawURL *string `json:"raw_url,omitempty"` - ContentsURL *string `json:"contents_url,omitempty"` - PreviousFilename *string `json:"previous_filename,omitempty"` -} - -func (c CommitFile) String() string { - return Stringify(c) -} - -// CommitsComparison is the result of comparing two commits. -// See CompareCommits() for details. -type CommitsComparison struct { - BaseCommit *RepositoryCommit `json:"base_commit,omitempty"` - MergeBaseCommit *RepositoryCommit `json:"merge_base_commit,omitempty"` - - // Head can be 'behind' or 'ahead' - Status *string `json:"status,omitempty"` - AheadBy *int `json:"ahead_by,omitempty"` - BehindBy *int `json:"behind_by,omitempty"` - TotalCommits *int `json:"total_commits,omitempty"` - - Commits []RepositoryCommit `json:"commits,omitempty"` - - Files []CommitFile `json:"files,omitempty"` - - HTMLURL *string `json:"html_url,omitempty"` - PermalinkURL *string `json:"permalink_url,omitempty"` - DiffURL *string `json:"diff_url,omitempty"` - PatchURL *string `json:"patch_url,omitempty"` - URL *string `json:"url,omitempty"` // API URL. -} - -func (c CommitsComparison) String() string { - return Stringify(c) -} - -// CommitsListOptions specifies the optional parameters to the -// RepositoriesService.ListCommits method. -type CommitsListOptions struct { - // SHA or branch to start listing Commits from. - SHA string `url:"sha,omitempty"` - - // Path that should be touched by the returned Commits. - Path string `url:"path,omitempty"` - - // Author of by which to filter Commits. - Author string `url:"author,omitempty"` - - // Since when should Commits be included in the response. - Since time.Time `url:"since,omitempty"` - - // Until when should Commits be included in the response. - Until time.Time `url:"until,omitempty"` - - ListOptions -} - -// BranchCommit is the result of listing branches with commit SHA. -type BranchCommit struct { - Name *string `json:"name,omitempty"` - Commit *Commit `json:"commit,omitempty"` - Protected *string `json:"protected,omitempty"` -} - -// ListCommits lists the commits of a repository. -// -// GitHub API docs: https://developer.github.com/v3/repos/commits/#list -func (s *RepositoriesService) ListCommits(ctx context.Context, owner, repo string, opt *CommitsListOptions) ([]*RepositoryCommit, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/commits", owner, repo) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var commits []*RepositoryCommit - resp, err := s.client.Do(ctx, req, &commits) - if err != nil { - return nil, resp, err - } - - return commits, resp, nil -} - -// GetCommit fetches the specified commit, including all details about it. -// -// GitHub API docs: https://developer.github.com/v3/repos/commits/#get-a-single-commit -// See also: https://developer.github.com/v3/git/commits/#get-a-single-commit provides the same functionality -func (s *RepositoriesService) GetCommit(ctx context.Context, owner, repo, sha string) (*RepositoryCommit, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/commits/%v", owner, repo, sha) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - commit := new(RepositoryCommit) - resp, err := s.client.Do(ctx, req, commit) - if err != nil { - return nil, resp, err - } - - return commit, resp, nil -} - -// GetCommitRaw fetches the specified commit in raw (diff or patch) format. -func (s *RepositoriesService) GetCommitRaw(ctx context.Context, owner string, repo string, sha string, opt RawOptions) (string, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/commits/%v", owner, repo, sha) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return "", nil, err - } - - switch opt.Type { - case Diff: - req.Header.Set("Accept", mediaTypeV3Diff) - case Patch: - req.Header.Set("Accept", mediaTypeV3Patch) - default: - return "", nil, fmt.Errorf("unsupported raw type %d", opt.Type) - } - - var buf bytes.Buffer - resp, err := s.client.Do(ctx, req, &buf) - if err != nil { - return "", resp, err - } - - return buf.String(), resp, nil -} - -// GetCommitSHA1 gets the SHA-1 of a commit reference. If a last-known SHA1 is -// supplied and no new commits have occurred, a 304 Unmodified response is returned. -// -// GitHub API docs: https://developer.github.com/v3/repos/commits/#get-the-sha-1-of-a-commit-reference -func (s *RepositoriesService) GetCommitSHA1(ctx context.Context, owner, repo, ref, lastSHA string) (string, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/commits/%v", owner, repo, url.QueryEscape(ref)) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return "", nil, err - } - if lastSHA != "" { - req.Header.Set("If-None-Match", `"`+lastSHA+`"`) - } - - req.Header.Set("Accept", mediaTypeV3SHA) - - var buf bytes.Buffer - resp, err := s.client.Do(ctx, req, &buf) - if err != nil { - return "", resp, err - } - - return buf.String(), resp, nil -} - -// CompareCommits compares a range of commits with each other. -// todo: support media formats - https://github.com/google/go-github/issues/6 -// -// GitHub API docs: https://developer.github.com/v3/repos/commits/#compare-two-commits -func (s *RepositoriesService) CompareCommits(ctx context.Context, owner, repo string, base, head string) (*CommitsComparison, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/compare/%v...%v", owner, repo, base, head) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - comp := new(CommitsComparison) - resp, err := s.client.Do(ctx, req, comp) - if err != nil { - return nil, resp, err - } - - return comp, resp, nil -} - -// ListBranchesHeadCommit gets all branches where the given commit SHA is the HEAD, -// or latest commit for the branch. -// -// GitHub API docs: https://developer.github.com/v3/repos/commits/#list-branches-for-head-commit -func (s *RepositoriesService) ListBranchesHeadCommit(ctx context.Context, owner, repo, sha string) ([]*BranchCommit, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/commits/%v/branches-where-head", owner, repo, sha) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeListPullsOrBranchesForCommitPreview) - var branchCommits []*BranchCommit - resp, err := s.client.Do(ctx, req, &branchCommits) - if err != nil { - return nil, resp, err - } - - return branchCommits, resp, nil -} diff --git a/vendor/github.com/google/go-github/v27/github/repos_community_health.go b/vendor/github.com/google/go-github/v27/github/repos_community_health.go deleted file mode 100644 index 73d1d573bfff..000000000000 --- a/vendor/github.com/google/go-github/v27/github/repos_community_health.go +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2017 The go-github 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 - -import ( - "context" - "fmt" - "time" -) - -// Metric represents the different fields for one file in community health files. -type Metric struct { - Name *string `json:"name"` - Key *string `json:"key"` - URL *string `json:"url"` - HTMLURL *string `json:"html_url"` -} - -// CommunityHealthFiles represents the different files in the community health metrics response. -type CommunityHealthFiles struct { - CodeOfConduct *Metric `json:"code_of_conduct"` - Contributing *Metric `json:"contributing"` - IssueTemplate *Metric `json:"issue_template"` - PullRequestTemplate *Metric `json:"pull_request_template"` - License *Metric `json:"license"` - Readme *Metric `json:"readme"` -} - -// CommunityHealthMetrics represents a response containing the community metrics of a repository. -type CommunityHealthMetrics struct { - HealthPercentage *int `json:"health_percentage"` - Files *CommunityHealthFiles `json:"files"` - UpdatedAt *time.Time `json:"updated_at"` -} - -// GetCommunityHealthMetrics retrieves all the community health metrics for a repository. -// -// GitHub API docs: https://developer.github.com/v3/repos/community/#retrieve-community-health-metrics -func (s *RepositoriesService) GetCommunityHealthMetrics(ctx context.Context, owner, repo string) (*CommunityHealthMetrics, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/community/profile", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeRepositoryCommunityHealthMetricsPreview) - - metrics := &CommunityHealthMetrics{} - resp, err := s.client.Do(ctx, req, metrics) - if err != nil { - return nil, resp, err - } - - return metrics, resp, nil -} diff --git a/vendor/github.com/google/go-github/v27/github/repos_contents.go b/vendor/github.com/google/go-github/v27/github/repos_contents.go deleted file mode 100644 index bf6cabc5c0b1..000000000000 --- a/vendor/github.com/google/go-github/v27/github/repos_contents.go +++ /dev/null @@ -1,269 +0,0 @@ -// Copyright 2013 The go-github AUTHORS. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Repository contents API methods. -// GitHub API docs: https://developer.github.com/v3/repos/contents/ - -package github - -import ( - "context" - "encoding/base64" - "encoding/json" - "fmt" - "io" - "net/http" - "net/url" - "path" -) - -// RepositoryContent represents a file or directory in a github repository. -type RepositoryContent struct { - Type *string `json:"type,omitempty"` - // Target is only set if the type is "symlink" and the target is not a normal file. - // If Target is set, Path will be the symlink path. - Target *string `json:"target,omitempty"` - Encoding *string `json:"encoding,omitempty"` - Size *int `json:"size,omitempty"` - Name *string `json:"name,omitempty"` - Path *string `json:"path,omitempty"` - // Content contains the actual file content, which may be encoded. - // Callers should call GetContent which will decode the content if - // necessary. - Content *string `json:"content,omitempty"` - SHA *string `json:"sha,omitempty"` - URL *string `json:"url,omitempty"` - GitURL *string `json:"git_url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - DownloadURL *string `json:"download_url,omitempty"` -} - -// RepositoryContentResponse holds the parsed response from CreateFile, UpdateFile, and DeleteFile. -type RepositoryContentResponse struct { - Content *RepositoryContent `json:"content,omitempty"` - Commit `json:"commit,omitempty"` -} - -// RepositoryContentFileOptions specifies optional parameters for CreateFile, UpdateFile, and DeleteFile. -type RepositoryContentFileOptions struct { - Message *string `json:"message,omitempty"` - Content []byte `json:"content,omitempty"` // unencoded - SHA *string `json:"sha,omitempty"` - Branch *string `json:"branch,omitempty"` - Author *CommitAuthor `json:"author,omitempty"` - Committer *CommitAuthor `json:"committer,omitempty"` -} - -// RepositoryContentGetOptions represents an optional ref parameter, which can be a SHA, -// branch, or tag -type RepositoryContentGetOptions struct { - Ref string `url:"ref,omitempty"` -} - -// String converts RepositoryContent to a string. It's primarily for testing. -func (r RepositoryContent) String() string { - return Stringify(r) -} - -// GetContent returns the content of r, decoding it if necessary. -func (r *RepositoryContent) GetContent() (string, error) { - var encoding string - if r.Encoding != nil { - encoding = *r.Encoding - } - - switch encoding { - case "base64": - c, err := base64.StdEncoding.DecodeString(*r.Content) - return string(c), err - case "": - if r.Content == nil { - return "", nil - } - return *r.Content, nil - default: - return "", fmt.Errorf("unsupported content encoding: %v", encoding) - } -} - -// GetReadme gets the Readme file for the repository. -// -// GitHub API docs: https://developer.github.com/v3/repos/contents/#get-the-readme -func (s *RepositoriesService) GetReadme(ctx context.Context, owner, repo string, opt *RepositoryContentGetOptions) (*RepositoryContent, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/readme", owner, repo) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - readme := new(RepositoryContent) - resp, err := s.client.Do(ctx, req, readme) - if err != nil { - return nil, resp, err - } - return readme, resp, nil -} - -// DownloadContents returns an io.ReadCloser that reads the contents of the -// specified file. This function will work with files of any size, as opposed -// to GetContents which is limited to 1 Mb files. It is the caller's -// responsibility to close the ReadCloser. -func (s *RepositoriesService) DownloadContents(ctx context.Context, owner, repo, filepath string, opt *RepositoryContentGetOptions) (io.ReadCloser, error) { - dir := path.Dir(filepath) - filename := path.Base(filepath) - _, dirContents, _, err := s.GetContents(ctx, owner, repo, dir, opt) - if err != nil { - return nil, err - } - for _, contents := range dirContents { - if *contents.Name == filename { - if contents.DownloadURL == nil || *contents.DownloadURL == "" { - return nil, fmt.Errorf("No download link found for %s", filepath) - } - resp, err := s.client.client.Get(*contents.DownloadURL) - if err != nil { - return nil, err - } - return resp.Body, nil - } - } - return nil, fmt.Errorf("No file named %s found in %s", filename, dir) -} - -// GetContents can return either the metadata and content of a single file -// (when path references a file) or the metadata of all the files and/or -// subdirectories of a directory (when path references a directory). To make it -// easy to distinguish between both result types and to mimic the API as much -// as possible, both result types will be returned but only one will contain a -// value and the other will be nil. -// -// GitHub API docs: https://developer.github.com/v3/repos/contents/#get-contents -func (s *RepositoriesService) GetContents(ctx context.Context, owner, repo, path string, opt *RepositoryContentGetOptions) (fileContent *RepositoryContent, directoryContent []*RepositoryContent, resp *Response, err error) { - escapedPath := (&url.URL{Path: path}).String() - u := fmt.Sprintf("repos/%s/%s/contents/%s", owner, repo, escapedPath) - u, err = addOptions(u, opt) - if err != nil { - return nil, nil, nil, err - } - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, nil, err - } - var rawJSON json.RawMessage - resp, err = s.client.Do(ctx, req, &rawJSON) - if err != nil { - return nil, nil, resp, err - } - fileUnmarshalError := json.Unmarshal(rawJSON, &fileContent) - if fileUnmarshalError == nil { - return fileContent, nil, resp, nil - } - directoryUnmarshalError := json.Unmarshal(rawJSON, &directoryContent) - if directoryUnmarshalError == nil { - return nil, directoryContent, resp, nil - } - return nil, nil, resp, fmt.Errorf("unmarshalling failed for both file and directory content: %s and %s", fileUnmarshalError, directoryUnmarshalError) -} - -// CreateFile creates a new file in a repository at the given path and returns -// the commit and file metadata. -// -// GitHub API docs: https://developer.github.com/v3/repos/contents/#create-a-file -func (s *RepositoriesService) CreateFile(ctx context.Context, owner, repo, path string, opt *RepositoryContentFileOptions) (*RepositoryContentResponse, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/contents/%s", owner, repo, path) - req, err := s.client.NewRequest("PUT", u, opt) - if err != nil { - return nil, nil, err - } - createResponse := new(RepositoryContentResponse) - resp, err := s.client.Do(ctx, req, createResponse) - if err != nil { - return nil, resp, err - } - return createResponse, resp, nil -} - -// UpdateFile updates a file in a repository at the given path and returns the -// commit and file metadata. Requires the blob SHA of the file being updated. -// -// GitHub API docs: https://developer.github.com/v3/repos/contents/#update-a-file -func (s *RepositoriesService) UpdateFile(ctx context.Context, owner, repo, path string, opt *RepositoryContentFileOptions) (*RepositoryContentResponse, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/contents/%s", owner, repo, path) - req, err := s.client.NewRequest("PUT", u, opt) - if err != nil { - return nil, nil, err - } - updateResponse := new(RepositoryContentResponse) - resp, err := s.client.Do(ctx, req, updateResponse) - if err != nil { - return nil, resp, err - } - return updateResponse, resp, nil -} - -// DeleteFile deletes a file from a repository and returns the commit. -// Requires the blob SHA of the file to be deleted. -// -// GitHub API docs: https://developer.github.com/v3/repos/contents/#delete-a-file -func (s *RepositoriesService) DeleteFile(ctx context.Context, owner, repo, path string, opt *RepositoryContentFileOptions) (*RepositoryContentResponse, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/contents/%s", owner, repo, path) - req, err := s.client.NewRequest("DELETE", u, opt) - if err != nil { - return nil, nil, err - } - deleteResponse := new(RepositoryContentResponse) - resp, err := s.client.Do(ctx, req, deleteResponse) - if err != nil { - return nil, resp, err - } - return deleteResponse, resp, nil -} - -// archiveFormat is used to define the archive type when calling GetArchiveLink. -type archiveFormat string - -const ( - // Tarball specifies an archive in gzipped tar format. - Tarball archiveFormat = "tarball" - - // Zipball specifies an archive in zip format. - Zipball archiveFormat = "zipball" -) - -// GetArchiveLink returns an URL to download a tarball or zipball archive for a -// repository. The archiveFormat can be specified by either the github.Tarball -// or github.Zipball constant. -// -// GitHub API docs: https://developer.github.com/v3/repos/contents/#get-archive-link -func (s *RepositoriesService) GetArchiveLink(ctx context.Context, owner, repo string, archiveformat archiveFormat, opt *RepositoryContentGetOptions) (*url.URL, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/%s", owner, repo, archiveformat) - if opt != nil && opt.Ref != "" { - u += fmt.Sprintf("/%s", opt.Ref) - } - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - var resp *http.Response - // Use http.DefaultTransport if no custom Transport is configured - req = withContext(ctx, req) - if s.client.client.Transport == nil { - resp, err = http.DefaultTransport.RoundTrip(req) - } else { - resp, err = s.client.client.Transport.RoundTrip(req) - } - if err != nil { - return nil, nil, err - } - resp.Body.Close() - if resp.StatusCode != http.StatusFound { - return nil, newResponse(resp), fmt.Errorf("unexpected status code: %s", resp.Status) - } - parsedURL, err := url.Parse(resp.Header.Get("Location")) - return parsedURL, newResponse(resp), err -} diff --git a/vendor/github.com/google/go-github/v27/github/repos_deployments.go b/vendor/github.com/google/go-github/v27/github/repos_deployments.go deleted file mode 100644 index 604632e91b66..000000000000 --- a/vendor/github.com/google/go-github/v27/github/repos_deployments.go +++ /dev/null @@ -1,229 +0,0 @@ -// Copyright 2014 The go-github 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 - -import ( - "context" - "encoding/json" - "fmt" - "strings" -) - -// Deployment represents a deployment in a repo -type Deployment struct { - URL *string `json:"url,omitempty"` - ID *int64 `json:"id,omitempty"` - SHA *string `json:"sha,omitempty"` - Ref *string `json:"ref,omitempty"` - Task *string `json:"task,omitempty"` - Payload json.RawMessage `json:"payload,omitempty"` - Environment *string `json:"environment,omitempty"` - Description *string `json:"description,omitempty"` - Creator *User `json:"creator,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - StatusesURL *string `json:"statuses_url,omitempty"` - RepositoryURL *string `json:"repository_url,omitempty"` - NodeID *string `json:"node_id,omitempty"` -} - -// DeploymentRequest represents a deployment request -type DeploymentRequest struct { - Ref *string `json:"ref,omitempty"` - Task *string `json:"task,omitempty"` - AutoMerge *bool `json:"auto_merge,omitempty"` - RequiredContexts *[]string `json:"required_contexts,omitempty"` - Payload *string `json:"payload,omitempty"` - Environment *string `json:"environment,omitempty"` - Description *string `json:"description,omitempty"` - TransientEnvironment *bool `json:"transient_environment,omitempty"` - ProductionEnvironment *bool `json:"production_environment,omitempty"` -} - -// DeploymentsListOptions specifies the optional parameters to the -// RepositoriesService.ListDeployments method. -type DeploymentsListOptions struct { - // SHA of the Deployment. - SHA string `url:"sha,omitempty"` - - // List deployments for a given ref. - Ref string `url:"ref,omitempty"` - - // List deployments for a given task. - Task string `url:"task,omitempty"` - - // List deployments for a given environment. - Environment string `url:"environment,omitempty"` - - ListOptions -} - -// ListDeployments lists the deployments of a repository. -// -// GitHub API docs: https://developer.github.com/v3/repos/deployments/#list-deployments -func (s *RepositoriesService) ListDeployments(ctx context.Context, owner, repo string, opt *DeploymentsListOptions) ([]*Deployment, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/deployments", owner, repo) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var deployments []*Deployment - resp, err := s.client.Do(ctx, req, &deployments) - if err != nil { - return nil, resp, err - } - - return deployments, resp, nil -} - -// GetDeployment returns a single deployment of a repository. -// -// GitHub API docs: https://developer.github.com/v3/repos/deployments/#get-a-single-deployment -func (s *RepositoriesService) GetDeployment(ctx context.Context, owner, repo string, deploymentID int64) (*Deployment, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/deployments/%v", owner, repo, deploymentID) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - deployment := new(Deployment) - resp, err := s.client.Do(ctx, req, deployment) - if err != nil { - return nil, resp, err - } - - return deployment, resp, nil -} - -// CreateDeployment creates a new deployment for a repository. -// -// GitHub API docs: https://developer.github.com/v3/repos/deployments/#create-a-deployment -func (s *RepositoriesService) CreateDeployment(ctx context.Context, owner, repo string, request *DeploymentRequest) (*Deployment, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/deployments", owner, repo) - - req, err := s.client.NewRequest("POST", u, request) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - acceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeExpandDeploymentStatusPreview} - req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - - d := new(Deployment) - resp, err := s.client.Do(ctx, req, d) - if err != nil { - return nil, resp, err - } - - return d, resp, nil -} - -// DeploymentStatus represents the status of a -// particular deployment. -type DeploymentStatus struct { - ID *int64 `json:"id,omitempty"` - // State is the deployment state. - // Possible values are: "pending", "success", "failure", "error", "inactive". - State *string `json:"state,omitempty"` - Creator *User `json:"creator,omitempty"` - Description *string `json:"description,omitempty"` - TargetURL *string `json:"target_url,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - DeploymentURL *string `json:"deployment_url,omitempty"` - RepositoryURL *string `json:"repository_url,omitempty"` - NodeID *string `json:"node_id,omitempty"` -} - -// DeploymentStatusRequest represents a deployment request -type DeploymentStatusRequest struct { - State *string `json:"state,omitempty"` - LogURL *string `json:"log_url,omitempty"` - Description *string `json:"description,omitempty"` - Environment *string `json:"environment,omitempty"` - EnvironmentURL *string `json:"environment_url,omitempty"` - AutoInactive *bool `json:"auto_inactive,omitempty"` -} - -// ListDeploymentStatuses lists the statuses of a given deployment of a repository. -// -// GitHub API docs: https://developer.github.com/v3/repos/deployments/#list-deployment-statuses -func (s *RepositoriesService) ListDeploymentStatuses(ctx context.Context, owner, repo string, deployment int64, opt *ListOptions) ([]*DeploymentStatus, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/deployments/%v/statuses", owner, repo, deployment) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var statuses []*DeploymentStatus - resp, err := s.client.Do(ctx, req, &statuses) - if err != nil { - return nil, resp, err - } - - return statuses, resp, nil -} - -// GetDeploymentStatus returns a single deployment status of a repository. -// -// GitHub API docs: https://developer.github.com/v3/repos/deployments/#get-a-single-deployment-status -func (s *RepositoriesService) GetDeploymentStatus(ctx context.Context, owner, repo string, deploymentID, deploymentStatusID int64) (*DeploymentStatus, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/deployments/%v/statuses/%v", owner, repo, deploymentID, deploymentStatusID) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - acceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeExpandDeploymentStatusPreview} - req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - - d := new(DeploymentStatus) - resp, err := s.client.Do(ctx, req, d) - if err != nil { - return nil, resp, err - } - - return d, resp, nil -} - -// CreateDeploymentStatus creates a new status for a deployment. -// -// GitHub API docs: https://developer.github.com/v3/repos/deployments/#create-a-deployment-status -func (s *RepositoriesService) CreateDeploymentStatus(ctx context.Context, owner, repo string, deployment int64, request *DeploymentStatusRequest) (*DeploymentStatus, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/deployments/%v/statuses", owner, repo, deployment) - - req, err := s.client.NewRequest("POST", u, request) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - acceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeExpandDeploymentStatusPreview} - req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - - d := new(DeploymentStatus) - resp, err := s.client.Do(ctx, req, d) - if err != nil { - return nil, resp, err - } - - return d, resp, nil -} diff --git a/vendor/github.com/google/go-github/v27/github/repos_forks.go b/vendor/github.com/google/go-github/v27/github/repos_forks.go deleted file mode 100644 index bfff27bb9512..000000000000 --- a/vendor/github.com/google/go-github/v27/github/repos_forks.go +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright 2013 The go-github 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 - -import ( - "context" - "fmt" - - "encoding/json" -) - -// RepositoryListForksOptions specifies the optional parameters to the -// RepositoriesService.ListForks method. -type RepositoryListForksOptions struct { - // How to sort the forks list. Possible values are: newest, oldest, - // watchers. Default is "newest". - Sort string `url:"sort,omitempty"` - - ListOptions -} - -// ListForks lists the forks of the specified repository. -// -// GitHub API docs: https://developer.github.com/v3/repos/forks/#list-forks -func (s *RepositoriesService) ListForks(ctx context.Context, owner, repo string, opt *RepositoryListForksOptions) ([]*Repository, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/forks", owner, repo) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when topics API fully launches. - req.Header.Set("Accept", mediaTypeTopicsPreview) - - var repos []*Repository - resp, err := s.client.Do(ctx, req, &repos) - if err != nil { - return nil, resp, err - } - - return repos, resp, nil -} - -// RepositoryCreateForkOptions specifies the optional parameters to the -// RepositoriesService.CreateFork method. -type RepositoryCreateForkOptions struct { - // The organization to fork the repository into. - Organization string `url:"organization,omitempty"` -} - -// CreateFork creates a fork of the specified repository. -// -// This method might return an *AcceptedError and a status code of -// 202. This is because this is the status that GitHub returns to signify that -// it is now computing creating the fork in a background task. In this event, -// the Repository value will be returned, which includes the details about the pending fork. -// A follow up request, after a delay of a second or so, should result -// in a successful request. -// -// GitHub API docs: https://developer.github.com/v3/repos/forks/#create-a-fork -func (s *RepositoriesService) CreateFork(ctx context.Context, owner, repo string, opt *RepositoryCreateForkOptions) (*Repository, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/forks", owner, repo) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("POST", u, nil) - if err != nil { - return nil, nil, err - } - - fork := new(Repository) - resp, err := s.client.Do(ctx, req, fork) - if err != nil { - // Persist AcceptedError's metadata to the Repository object. - if aerr, ok := err.(*AcceptedError); ok { - if err := json.Unmarshal(aerr.Raw, fork); err != nil { - return fork, resp, err - } - - return fork, resp, err - } - return nil, resp, err - } - - return fork, resp, nil -} diff --git a/vendor/github.com/google/go-github/v27/github/repos_hooks.go b/vendor/github.com/google/go-github/v27/github/repos_hooks.go deleted file mode 100644 index 7674947df323..000000000000 --- a/vendor/github.com/google/go-github/v27/github/repos_hooks.go +++ /dev/null @@ -1,226 +0,0 @@ -// Copyright 2013 The go-github 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 - -import ( - "context" - "fmt" - "time" -) - -// WebHookPayload represents the data that is received from GitHub when a push -// event hook is triggered. The format of these payloads pre-date most of the -// GitHub v3 API, so there are lots of minor incompatibilities with the types -// defined in the rest of the API. Therefore, several types are duplicated -// here to account for these differences. -// -// GitHub API docs: https://help.github.com/articles/post-receive-hooks -type WebHookPayload struct { - After *string `json:"after,omitempty"` - Before *string `json:"before,omitempty"` - Commits []WebHookCommit `json:"commits,omitempty"` - Compare *string `json:"compare,omitempty"` - Created *bool `json:"created,omitempty"` - Deleted *bool `json:"deleted,omitempty"` - Forced *bool `json:"forced,omitempty"` - HeadCommit *WebHookCommit `json:"head_commit,omitempty"` - Pusher *User `json:"pusher,omitempty"` - Ref *string `json:"ref,omitempty"` - Repo *Repository `json:"repository,omitempty"` - Sender *User `json:"sender,omitempty"` -} - -func (w WebHookPayload) String() string { - return Stringify(w) -} - -// WebHookCommit represents the commit variant we receive from GitHub in a -// WebHookPayload. -type WebHookCommit struct { - Added []string `json:"added,omitempty"` - Author *WebHookAuthor `json:"author,omitempty"` - Committer *WebHookAuthor `json:"committer,omitempty"` - Distinct *bool `json:"distinct,omitempty"` - ID *string `json:"id,omitempty"` - Message *string `json:"message,omitempty"` - Modified []string `json:"modified,omitempty"` - Removed []string `json:"removed,omitempty"` - Timestamp *time.Time `json:"timestamp,omitempty"` -} - -func (w WebHookCommit) String() string { - return Stringify(w) -} - -// WebHookAuthor represents the author or committer of a commit, as specified -// in a WebHookCommit. The commit author may not correspond to a GitHub User. -type WebHookAuthor struct { - Email *string `json:"email,omitempty"` - Name *string `json:"name,omitempty"` - Username *string `json:"username,omitempty"` -} - -func (w WebHookAuthor) String() string { - return Stringify(w) -} - -// Hook represents a GitHub (web and service) hook for a repository. -type Hook struct { - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` - URL *string `json:"url,omitempty"` - ID *int64 `json:"id,omitempty"` - - // Only the following fields are used when creating a hook. - // Config is required. - Config map[string]interface{} `json:"config,omitempty"` - Events []string `json:"events,omitempty"` - Active *bool `json:"active,omitempty"` -} - -func (h Hook) String() string { - return Stringify(h) -} - -// createHookRequest is a subset of Hook and is used internally -// by CreateHook to pass only the known fields for the endpoint. -// -// See https://github.com/google/go-github/issues/1015 for more -// information. -type createHookRequest struct { - // Config is required. - Name string `json:"name"` - Config map[string]interface{} `json:"config,omitempty"` - Events []string `json:"events,omitempty"` - Active *bool `json:"active,omitempty"` -} - -// CreateHook creates a Hook for the specified repository. -// Config is a required field. -// -// Note that only a subset of the hook fields are used and hook must -// not be nil. -// -// GitHub API docs: https://developer.github.com/v3/repos/hooks/#create-a-hook -func (s *RepositoriesService) CreateHook(ctx context.Context, owner, repo string, hook *Hook) (*Hook, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/hooks", owner, repo) - - hookReq := &createHookRequest{ - Name: "web", - Events: hook.Events, - Active: hook.Active, - Config: hook.Config, - } - - req, err := s.client.NewRequest("POST", u, hookReq) - if err != nil { - return nil, nil, err - } - - h := new(Hook) - resp, err := s.client.Do(ctx, req, h) - if err != nil { - return nil, resp, err - } - - return h, resp, nil -} - -// ListHooks lists all Hooks for the specified repository. -// -// GitHub API docs: https://developer.github.com/v3/repos/hooks/#list -func (s *RepositoriesService) ListHooks(ctx context.Context, owner, repo string, opt *ListOptions) ([]*Hook, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/hooks", owner, repo) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var hooks []*Hook - resp, err := s.client.Do(ctx, req, &hooks) - if err != nil { - return nil, resp, err - } - - return hooks, resp, nil -} - -// GetHook returns a single specified Hook. -// -// GitHub API docs: https://developer.github.com/v3/repos/hooks/#get-single-hook -func (s *RepositoriesService) GetHook(ctx context.Context, owner, repo string, id int64) (*Hook, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/hooks/%d", owner, repo, id) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - h := new(Hook) - resp, err := s.client.Do(ctx, req, h) - if err != nil { - return nil, resp, err - } - - return h, resp, nil -} - -// EditHook updates a specified Hook. -// -// GitHub API docs: https://developer.github.com/v3/repos/hooks/#edit-a-hook -func (s *RepositoriesService) EditHook(ctx context.Context, owner, repo string, id int64, hook *Hook) (*Hook, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/hooks/%d", owner, repo, id) - req, err := s.client.NewRequest("PATCH", u, hook) - if err != nil { - return nil, nil, err - } - h := new(Hook) - resp, err := s.client.Do(ctx, req, h) - if err != nil { - return nil, resp, err - } - - return h, resp, nil -} - -// DeleteHook deletes a specified Hook. -// -// GitHub API docs: https://developer.github.com/v3/repos/hooks/#delete-a-hook -func (s *RepositoriesService) DeleteHook(ctx context.Context, owner, repo string, id int64) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/hooks/%d", owner, repo, id) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - return s.client.Do(ctx, req, nil) -} - -// PingHook triggers a 'ping' event to be sent to the Hook. -// -// GitHub API docs: https://developer.github.com/v3/repos/hooks/#ping-a-hook -func (s *RepositoriesService) PingHook(ctx context.Context, owner, repo string, id int64) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/hooks/%d/pings", owner, repo, id) - req, err := s.client.NewRequest("POST", u, nil) - if err != nil { - return nil, err - } - return s.client.Do(ctx, req, nil) -} - -// TestHook triggers a test Hook by github. -// -// GitHub API docs: https://developer.github.com/v3/repos/hooks/#test-a-push-hook -func (s *RepositoriesService) TestHook(ctx context.Context, owner, repo string, id int64) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/hooks/%d/tests", owner, repo, id) - req, err := s.client.NewRequest("POST", u, nil) - if err != nil { - return nil, err - } - return s.client.Do(ctx, req, nil) -} diff --git a/vendor/github.com/google/go-github/v27/github/repos_invitations.go b/vendor/github.com/google/go-github/v27/github/repos_invitations.go deleted file mode 100644 index b88e9359f3ee..000000000000 --- a/vendor/github.com/google/go-github/v27/github/repos_invitations.go +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright 2016 The go-github 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 - -import ( - "context" - "fmt" -) - -// RepositoryInvitation represents an invitation to collaborate on a repo. -type RepositoryInvitation struct { - ID *int64 `json:"id,omitempty"` - Repo *Repository `json:"repository,omitempty"` - Invitee *User `json:"invitee,omitempty"` - Inviter *User `json:"inviter,omitempty"` - - // Permissions represents the permissions that the associated user will have - // on the repository. Possible values are: "read", "write", "admin". - Permissions *string `json:"permissions,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - URL *string `json:"url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` -} - -// ListInvitations lists all currently-open repository invitations. -// -// GitHub API docs: https://developer.github.com/v3/repos/invitations/#list-invitations-for-a-repository -func (s *RepositoriesService) ListInvitations(ctx context.Context, owner, repo string, opt *ListOptions) ([]*RepositoryInvitation, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/invitations", owner, repo) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - invites := []*RepositoryInvitation{} - resp, err := s.client.Do(ctx, req, &invites) - if err != nil { - return nil, resp, err - } - - return invites, resp, nil -} - -// DeleteInvitation deletes a repository invitation. -// -// GitHub API docs: https://developer.github.com/v3/repos/invitations/#delete-a-repository-invitation -func (s *RepositoriesService) DeleteInvitation(ctx context.Context, owner, repo string, invitationID int64) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/invitations/%v", owner, repo, invitationID) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} - -// UpdateInvitation updates the permissions associated with a repository -// invitation. -// -// permissions represents the permissions that the associated user will have -// on the repository. Possible values are: "read", "write", "admin". -// -// GitHub API docs: https://developer.github.com/v3/repos/invitations/#update-a-repository-invitation -func (s *RepositoriesService) UpdateInvitation(ctx context.Context, owner, repo string, invitationID int64, permissions string) (*RepositoryInvitation, *Response, error) { - opts := &struct { - Permissions string `json:"permissions"` - }{Permissions: permissions} - u := fmt.Sprintf("repos/%v/%v/invitations/%v", owner, repo, invitationID) - req, err := s.client.NewRequest("PATCH", u, opts) - if err != nil { - return nil, nil, err - } - - invite := &RepositoryInvitation{} - resp, err := s.client.Do(ctx, req, invite) - if err != nil { - return nil, resp, err - } - - return invite, resp, nil -} diff --git a/vendor/github.com/google/go-github/v27/github/repos_keys.go b/vendor/github.com/google/go-github/v27/github/repos_keys.go deleted file mode 100644 index b484f8444632..000000000000 --- a/vendor/github.com/google/go-github/v27/github/repos_keys.go +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright 2013 The go-github 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 - -import ( - "context" - "fmt" -) - -// The Key type is defined in users_keys.go - -// ListKeys lists the deploy keys for a repository. -// -// GitHub API docs: https://developer.github.com/v3/repos/keys/#list -func (s *RepositoriesService) ListKeys(ctx context.Context, owner string, repo string, opt *ListOptions) ([]*Key, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/keys", owner, repo) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var keys []*Key - resp, err := s.client.Do(ctx, req, &keys) - if err != nil { - return nil, resp, err - } - - return keys, resp, nil -} - -// GetKey fetches a single deploy key. -// -// GitHub API docs: https://developer.github.com/v3/repos/keys/#get -func (s *RepositoriesService) GetKey(ctx context.Context, owner string, repo string, id int64) (*Key, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/keys/%v", owner, repo, id) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - key := new(Key) - resp, err := s.client.Do(ctx, req, key) - if err != nil { - return nil, resp, err - } - - return key, resp, nil -} - -// CreateKey adds a deploy key for a repository. -// -// GitHub API docs: https://developer.github.com/v3/repos/keys/#create -func (s *RepositoriesService) CreateKey(ctx context.Context, owner string, repo string, key *Key) (*Key, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/keys", owner, repo) - - req, err := s.client.NewRequest("POST", u, key) - if err != nil { - return nil, nil, err - } - - k := new(Key) - resp, err := s.client.Do(ctx, req, k) - if err != nil { - return nil, resp, err - } - - return k, resp, nil -} - -// EditKey edits a deploy key. -// -// GitHub API docs: https://developer.github.com/v3/repos/keys/#edit -func (s *RepositoriesService) EditKey(ctx context.Context, owner string, repo string, id int64, key *Key) (*Key, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/keys/%v", owner, repo, id) - - req, err := s.client.NewRequest("PATCH", u, key) - if err != nil { - return nil, nil, err - } - - k := new(Key) - resp, err := s.client.Do(ctx, req, k) - if err != nil { - return nil, resp, err - } - - return k, resp, nil -} - -// DeleteKey deletes a deploy key. -// -// GitHub API docs: https://developer.github.com/v3/repos/keys/#delete -func (s *RepositoriesService) DeleteKey(ctx context.Context, owner string, repo string, id int64) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/keys/%v", owner, repo, id) - - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} diff --git a/vendor/github.com/google/go-github/v27/github/repos_merging.go b/vendor/github.com/google/go-github/v27/github/repos_merging.go deleted file mode 100644 index 04383c1ae32c..000000000000 --- a/vendor/github.com/google/go-github/v27/github/repos_merging.go +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2014 The go-github 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 - -import ( - "context" - "fmt" -) - -// RepositoryMergeRequest represents a request to merge a branch in a -// repository. -type RepositoryMergeRequest struct { - Base *string `json:"base,omitempty"` - Head *string `json:"head,omitempty"` - CommitMessage *string `json:"commit_message,omitempty"` -} - -// Merge a branch in the specified repository. -// -// GitHub API docs: https://developer.github.com/v3/repos/merging/#perform-a-merge -func (s *RepositoriesService) Merge(ctx context.Context, owner, repo string, request *RepositoryMergeRequest) (*RepositoryCommit, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/merges", owner, repo) - req, err := s.client.NewRequest("POST", u, request) - if err != nil { - return nil, nil, err - } - - commit := new(RepositoryCommit) - resp, err := s.client.Do(ctx, req, commit) - if err != nil { - return nil, resp, err - } - - return commit, resp, nil -} diff --git a/vendor/github.com/google/go-github/v27/github/repos_pages.go b/vendor/github.com/google/go-github/v27/github/repos_pages.go deleted file mode 100644 index 28674130d6a9..000000000000 --- a/vendor/github.com/google/go-github/v27/github/repos_pages.go +++ /dev/null @@ -1,190 +0,0 @@ -// Copyright 2014 The go-github 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 - -import ( - "context" - "fmt" - "strings" -) - -// Pages represents a GitHub Pages site configuration. -type Pages struct { - URL *string `json:"url,omitempty"` - Status *string `json:"status,omitempty"` - CNAME *string `json:"cname,omitempty"` - Custom404 *bool `json:"custom_404,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - Source *PagesSource `json:"source,omitempty"` -} - -// PagesSource represents a GitHub page's source. -type PagesSource struct { - Branch *string `json:"branch,omitempty"` - Path *string `json:"path,omitempty"` -} - -// PagesError represents a build error for a GitHub Pages site. -type PagesError struct { - Message *string `json:"message,omitempty"` -} - -// PagesBuild represents the build information for a GitHub Pages site. -type PagesBuild struct { - URL *string `json:"url,omitempty"` - Status *string `json:"status,omitempty"` - Error *PagesError `json:"error,omitempty"` - Pusher *User `json:"pusher,omitempty"` - Commit *string `json:"commit,omitempty"` - Duration *int `json:"duration,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` -} - -// EnablePages enables GitHub Pages for the named repo. -// -// GitHub API docs: https://developer.github.com/v3/repos/pages/#enable-a-pages-site -func (s *RepositoriesService) EnablePages(ctx context.Context, owner, repo string) (*Pages, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pages", owner, repo) - req, err := s.client.NewRequest("POST", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - acceptHeaders := []string{mediaTypeEnablePagesAPIPreview, mediaTypePagesPreview} - req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - - enable := new(Pages) - resp, err := s.client.Do(ctx, req, enable) - if err != nil { - return nil, resp, err - } - - return enable, resp, nil -} - -// DisablePages disables GitHub Pages for the named repo. -// -// GitHub API docs: https://developer.github.com/v3/repos/pages/#disable-a-pages-site -func (s *RepositoriesService) DisablePages(ctx context.Context, owner, repo string) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/pages", owner, repo) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeEnablePagesAPIPreview) - - return s.client.Do(ctx, req, nil) -} - -// GetPagesInfo fetches information about a GitHub Pages site. -// -// GitHub API docs: https://developer.github.com/v3/repos/pages/#get-information-about-a-pages-site -func (s *RepositoriesService) GetPagesInfo(ctx context.Context, owner, repo string) (*Pages, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pages", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypePagesPreview) - - site := new(Pages) - resp, err := s.client.Do(ctx, req, site) - if err != nil { - return nil, resp, err - } - - return site, resp, nil -} - -// ListPagesBuilds lists the builds for a GitHub Pages site. -// -// GitHub API docs: https://developer.github.com/v3/repos/pages/#list-pages-builds -func (s *RepositoriesService) ListPagesBuilds(ctx context.Context, owner, repo string, opt *ListOptions) ([]*PagesBuild, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pages/builds", owner, repo) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var pages []*PagesBuild - resp, err := s.client.Do(ctx, req, &pages) - if err != nil { - return nil, resp, err - } - - return pages, resp, nil -} - -// GetLatestPagesBuild fetches the latest build information for a GitHub pages site. -// -// GitHub API docs: https://developer.github.com/v3/repos/pages/#list-latest-pages-build -func (s *RepositoriesService) GetLatestPagesBuild(ctx context.Context, owner, repo string) (*PagesBuild, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pages/builds/latest", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - build := new(PagesBuild) - resp, err := s.client.Do(ctx, req, build) - if err != nil { - return nil, resp, err - } - - return build, resp, nil -} - -// GetPageBuild fetches the specific build information for a GitHub pages site. -// -// GitHub API docs: https://developer.github.com/v3/repos/pages/#list-a-specific-pages-build -func (s *RepositoriesService) GetPageBuild(ctx context.Context, owner, repo string, id int64) (*PagesBuild, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pages/builds/%v", owner, repo, id) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - build := new(PagesBuild) - resp, err := s.client.Do(ctx, req, build) - if err != nil { - return nil, resp, err - } - - return build, resp, nil -} - -// RequestPageBuild requests a build of a GitHub Pages site without needing to push new commit. -// -// GitHub API docs: https://developer.github.com/v3/repos/pages/#request-a-page-build -func (s *RepositoriesService) RequestPageBuild(ctx context.Context, owner, repo string) (*PagesBuild, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pages/builds", owner, repo) - req, err := s.client.NewRequest("POST", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypePagesPreview) - - build := new(PagesBuild) - resp, err := s.client.Do(ctx, req, build) - if err != nil { - return nil, resp, err - } - - return build, resp, nil -} diff --git a/vendor/github.com/google/go-github/v27/github/repos_prereceive_hooks.go b/vendor/github.com/google/go-github/v27/github/repos_prereceive_hooks.go deleted file mode 100644 index cab09f74791c..000000000000 --- a/vendor/github.com/google/go-github/v27/github/repos_prereceive_hooks.go +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright 2018 The go-github 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 - -import ( - "context" - "fmt" -) - -// PreReceiveHook represents a GitHub pre-receive hook for a repository. -type PreReceiveHook struct { - ID *int64 `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Enforcement *string `json:"enforcement,omitempty"` - ConfigURL *string `json:"configuration_url,omitempty"` -} - -func (p PreReceiveHook) String() string { - return Stringify(p) -} - -// ListPreReceiveHooks lists all pre-receive hooks for the specified repository. -// -// GitHub API docs: https://developer.github.com/enterprise/2.13/v3/repos/pre_receive_hooks/#list-pre-receive-hooks -func (s *RepositoriesService) ListPreReceiveHooks(ctx context.Context, owner, repo string, opt *ListOptions) ([]*PreReceiveHook, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pre-receive-hooks", owner, repo) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypePreReceiveHooksPreview) - - var hooks []*PreReceiveHook - resp, err := s.client.Do(ctx, req, &hooks) - if err != nil { - return nil, resp, err - } - - return hooks, resp, nil -} - -// GetPreReceiveHook returns a single specified pre-receive hook. -// -// GitHub API docs: https://developer.github.com/enterprise/2.13/v3/repos/pre_receive_hooks/#get-a-single-pre-receive-hook -func (s *RepositoriesService) GetPreReceiveHook(ctx context.Context, owner, repo string, id int64) (*PreReceiveHook, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pre-receive-hooks/%d", owner, repo, id) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypePreReceiveHooksPreview) - - h := new(PreReceiveHook) - resp, err := s.client.Do(ctx, req, h) - if err != nil { - return nil, resp, err - } - - return h, resp, nil -} - -// UpdatePreReceiveHook updates a specified pre-receive hook. -// -// GitHub API docs: https://developer.github.com/enterprise/2.13/v3/repos/pre_receive_hooks/#update-pre-receive-hook-enforcement -func (s *RepositoriesService) UpdatePreReceiveHook(ctx context.Context, owner, repo string, id int64, hook *PreReceiveHook) (*PreReceiveHook, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pre-receive-hooks/%d", owner, repo, id) - req, err := s.client.NewRequest("PATCH", u, hook) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypePreReceiveHooksPreview) - - h := new(PreReceiveHook) - resp, err := s.client.Do(ctx, req, h) - if err != nil { - return nil, resp, err - } - - return h, resp, nil -} - -// DeletePreReceiveHook deletes a specified pre-receive hook. -// -// GitHub API docs: https://developer.github.com/enterprise/2.13/v3/repos/pre_receive_hooks/#remove-enforcement-overrides-for-a-pre-receive-hook -func (s *RepositoriesService) DeletePreReceiveHook(ctx context.Context, owner, repo string, id int64) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/pre-receive-hooks/%d", owner, repo, id) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypePreReceiveHooksPreview) - - return s.client.Do(ctx, req, nil) -} diff --git a/vendor/github.com/google/go-github/v27/github/repos_projects.go b/vendor/github.com/google/go-github/v27/github/repos_projects.go deleted file mode 100644 index d6486d293c81..000000000000 --- a/vendor/github.com/google/go-github/v27/github/repos_projects.go +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2017 The go-github 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 - -import ( - "context" - "fmt" -) - -// ProjectListOptions specifies the optional parameters to the -// OrganizationsService.ListProjects and RepositoriesService.ListProjects methods. -type ProjectListOptions struct { - // Indicates the state of the projects to return. Can be either open, closed, or all. Default: open - State string `url:"state,omitempty"` - - ListOptions -} - -// ListProjects lists the projects for a repo. -// -// GitHub API docs: https://developer.github.com/v3/projects/#list-repository-projects -func (s *RepositoriesService) ListProjects(ctx context.Context, owner, repo string, opt *ProjectListOptions) ([]*Project, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/projects", owner, repo) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeProjectsPreview) - - var projects []*Project - resp, err := s.client.Do(ctx, req, &projects) - if err != nil { - return nil, resp, err - } - - return projects, resp, nil -} - -// CreateProject creates a GitHub Project for the specified repository. -// -// GitHub API docs: https://developer.github.com/v3/projects/#create-a-repository-project -func (s *RepositoriesService) CreateProject(ctx context.Context, owner, repo string, opt *ProjectOptions) (*Project, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/projects", owner, repo) - req, err := s.client.NewRequest("POST", u, opt) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeProjectsPreview) - - project := &Project{} - resp, err := s.client.Do(ctx, req, project) - if err != nil { - return nil, resp, err - } - - return project, resp, nil -} diff --git a/vendor/github.com/google/go-github/v27/github/repos_releases.go b/vendor/github.com/google/go-github/v27/github/repos_releases.go deleted file mode 100644 index 5c0a1cea84f9..000000000000 --- a/vendor/github.com/google/go-github/v27/github/repos_releases.go +++ /dev/null @@ -1,374 +0,0 @@ -// Copyright 2013 The go-github 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 - -import ( - "context" - "errors" - "fmt" - "io" - "mime" - "net/http" - "os" - "path/filepath" - "strings" -) - -// RepositoryRelease represents a GitHub release in a repository. -type RepositoryRelease struct { - TagName *string `json:"tag_name,omitempty"` - TargetCommitish *string `json:"target_commitish,omitempty"` - Name *string `json:"name,omitempty"` - Body *string `json:"body,omitempty"` - Draft *bool `json:"draft,omitempty"` - Prerelease *bool `json:"prerelease,omitempty"` - - // The following fields are not used in CreateRelease or EditRelease: - ID *int64 `json:"id,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - PublishedAt *Timestamp `json:"published_at,omitempty"` - URL *string `json:"url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - AssetsURL *string `json:"assets_url,omitempty"` - Assets []ReleaseAsset `json:"assets,omitempty"` - UploadURL *string `json:"upload_url,omitempty"` - ZipballURL *string `json:"zipball_url,omitempty"` - TarballURL *string `json:"tarball_url,omitempty"` - Author *User `json:"author,omitempty"` - NodeID *string `json:"node_id,omitempty"` -} - -func (r RepositoryRelease) String() string { - return Stringify(r) -} - -// ReleaseAsset represents a GitHub release asset in a repository. -type ReleaseAsset struct { - ID *int64 `json:"id,omitempty"` - URL *string `json:"url,omitempty"` - Name *string `json:"name,omitempty"` - Label *string `json:"label,omitempty"` - State *string `json:"state,omitempty"` - ContentType *string `json:"content_type,omitempty"` - Size *int `json:"size,omitempty"` - DownloadCount *int `json:"download_count,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - BrowserDownloadURL *string `json:"browser_download_url,omitempty"` - Uploader *User `json:"uploader,omitempty"` - NodeID *string `json:"node_id,omitempty"` -} - -func (r ReleaseAsset) String() string { - return Stringify(r) -} - -// ListReleases lists the releases for a repository. -// -// GitHub API docs: https://developer.github.com/v3/repos/releases/#list-releases-for-a-repository -func (s *RepositoriesService) ListReleases(ctx context.Context, owner, repo string, opt *ListOptions) ([]*RepositoryRelease, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases", owner, repo) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var releases []*RepositoryRelease - resp, err := s.client.Do(ctx, req, &releases) - if err != nil { - return nil, resp, err - } - return releases, resp, nil -} - -// GetRelease fetches a single release. -// -// GitHub API docs: https://developer.github.com/v3/repos/releases/#get-a-single-release -func (s *RepositoriesService) GetRelease(ctx context.Context, owner, repo string, id int64) (*RepositoryRelease, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases/%d", owner, repo, id) - return s.getSingleRelease(ctx, u) -} - -// GetLatestRelease fetches the latest published release for the repository. -// -// GitHub API docs: https://developer.github.com/v3/repos/releases/#get-the-latest-release -func (s *RepositoriesService) GetLatestRelease(ctx context.Context, owner, repo string) (*RepositoryRelease, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases/latest", owner, repo) - return s.getSingleRelease(ctx, u) -} - -// GetReleaseByTag fetches a release with the specified tag. -// -// GitHub API docs: https://developer.github.com/v3/repos/releases/#get-a-release-by-tag-name -func (s *RepositoriesService) GetReleaseByTag(ctx context.Context, owner, repo, tag string) (*RepositoryRelease, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases/tags/%s", owner, repo, tag) - return s.getSingleRelease(ctx, u) -} - -func (s *RepositoriesService) getSingleRelease(ctx context.Context, url string) (*RepositoryRelease, *Response, error) { - req, err := s.client.NewRequest("GET", url, nil) - if err != nil { - return nil, nil, err - } - - release := new(RepositoryRelease) - resp, err := s.client.Do(ctx, req, release) - if err != nil { - return nil, resp, err - } - return release, resp, nil -} - -// repositoryReleaseRequest is a subset of RepositoryRelease and -// is used internally by CreateRelease and EditRelease to pass -// only the known fields for these endpoints. -// -// See https://github.com/google/go-github/issues/992 for more -// information. -type repositoryReleaseRequest struct { - TagName *string `json:"tag_name,omitempty"` - TargetCommitish *string `json:"target_commitish,omitempty"` - Name *string `json:"name,omitempty"` - Body *string `json:"body,omitempty"` - Draft *bool `json:"draft,omitempty"` - Prerelease *bool `json:"prerelease,omitempty"` -} - -// CreateRelease adds a new release for a repository. -// -// Note that only a subset of the release fields are used. -// See RepositoryRelease for more information. -// -// GitHub API docs: https://developer.github.com/v3/repos/releases/#create-a-release -func (s *RepositoriesService) CreateRelease(ctx context.Context, owner, repo string, release *RepositoryRelease) (*RepositoryRelease, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases", owner, repo) - - releaseReq := &repositoryReleaseRequest{ - TagName: release.TagName, - TargetCommitish: release.TargetCommitish, - Name: release.Name, - Body: release.Body, - Draft: release.Draft, - Prerelease: release.Prerelease, - } - - req, err := s.client.NewRequest("POST", u, releaseReq) - if err != nil { - return nil, nil, err - } - - r := new(RepositoryRelease) - resp, err := s.client.Do(ctx, req, r) - if err != nil { - return nil, resp, err - } - return r, resp, nil -} - -// EditRelease edits a repository release. -// -// Note that only a subset of the release fields are used. -// See RepositoryRelease for more information. -// -// GitHub API docs: https://developer.github.com/v3/repos/releases/#edit-a-release -func (s *RepositoriesService) EditRelease(ctx context.Context, owner, repo string, id int64, release *RepositoryRelease) (*RepositoryRelease, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases/%d", owner, repo, id) - - releaseReq := &repositoryReleaseRequest{ - TagName: release.TagName, - TargetCommitish: release.TargetCommitish, - Name: release.Name, - Body: release.Body, - Draft: release.Draft, - Prerelease: release.Prerelease, - } - - req, err := s.client.NewRequest("PATCH", u, releaseReq) - if err != nil { - return nil, nil, err - } - - r := new(RepositoryRelease) - resp, err := s.client.Do(ctx, req, r) - if err != nil { - return nil, resp, err - } - return r, resp, nil -} - -// DeleteRelease delete a single release from a repository. -// -// GitHub API docs: https://developer.github.com/v3/repos/releases/#delete-a-release -func (s *RepositoriesService) DeleteRelease(ctx context.Context, owner, repo string, id int64) (*Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases/%d", owner, repo, id) - - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - return s.client.Do(ctx, req, nil) -} - -// ListReleaseAssets lists the release's assets. -// -// GitHub API docs: https://developer.github.com/v3/repos/releases/#list-assets-for-a-release -func (s *RepositoriesService) ListReleaseAssets(ctx context.Context, owner, repo string, id int64, opt *ListOptions) ([]*ReleaseAsset, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases/%d/assets", owner, repo, id) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var assets []*ReleaseAsset - resp, err := s.client.Do(ctx, req, &assets) - if err != nil { - return nil, resp, err - } - return assets, resp, nil -} - -// GetReleaseAsset fetches a single release asset. -// -// GitHub API docs: https://developer.github.com/v3/repos/releases/#get-a-single-release-asset -func (s *RepositoriesService) GetReleaseAsset(ctx context.Context, owner, repo string, id int64) (*ReleaseAsset, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases/assets/%d", owner, repo, id) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - asset := new(ReleaseAsset) - resp, err := s.client.Do(ctx, req, asset) - if err != nil { - return nil, resp, err - } - return asset, resp, nil -} - -// DownloadReleaseAsset downloads a release asset or returns a redirect URL. -// -// DownloadReleaseAsset returns an io.ReadCloser that reads the contents of the -// specified release asset. It is the caller's responsibility to close the ReadCloser. -// If a redirect is returned, the redirect URL will be returned as a string instead -// of the io.ReadCloser. Exactly one of rc and redirectURL will be zero. -// -// GitHub API docs: https://developer.github.com/v3/repos/releases/#get-a-single-release-asset -func (s *RepositoriesService) DownloadReleaseAsset(ctx context.Context, owner, repo string, id int64) (rc io.ReadCloser, redirectURL string, err error) { - u := fmt.Sprintf("repos/%s/%s/releases/assets/%d", owner, repo, id) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, "", err - } - req.Header.Set("Accept", defaultMediaType) - - s.client.clientMu.Lock() - defer s.client.clientMu.Unlock() - - var loc string - saveRedirect := s.client.client.CheckRedirect - s.client.client.CheckRedirect = func(req *http.Request, via []*http.Request) error { - loc = req.URL.String() - return errors.New("disable redirect") - } - defer func() { s.client.client.CheckRedirect = saveRedirect }() - - req = withContext(ctx, req) - resp, err := s.client.client.Do(req) - if err != nil { - if !strings.Contains(err.Error(), "disable redirect") { - return nil, "", err - } - return nil, loc, nil // Intentionally return no error with valid redirect URL. - } - - if err := CheckResponse(resp); err != nil { - resp.Body.Close() - return nil, "", err - } - - return resp.Body, "", nil -} - -// EditReleaseAsset edits a repository release asset. -// -// GitHub API docs: https://developer.github.com/v3/repos/releases/#edit-a-release-asset -func (s *RepositoriesService) EditReleaseAsset(ctx context.Context, owner, repo string, id int64, release *ReleaseAsset) (*ReleaseAsset, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases/assets/%d", owner, repo, id) - - req, err := s.client.NewRequest("PATCH", u, release) - if err != nil { - return nil, nil, err - } - - asset := new(ReleaseAsset) - resp, err := s.client.Do(ctx, req, asset) - if err != nil { - return nil, resp, err - } - return asset, resp, nil -} - -// DeleteReleaseAsset delete a single release asset from a repository. -// -// GitHub API docs: https://developer.github.com/v3/repos/releases/#delete-a-release-asset -func (s *RepositoriesService) DeleteReleaseAsset(ctx context.Context, owner, repo string, id int64) (*Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases/assets/%d", owner, repo, id) - - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - return s.client.Do(ctx, req, nil) -} - -// UploadReleaseAsset creates an asset by uploading a file into a release repository. -// To upload assets that cannot be represented by an os.File, call NewUploadRequest directly. -// -// GitHub API docs: https://developer.github.com/v3/repos/releases/#upload-a-release-asset -func (s *RepositoriesService) UploadReleaseAsset(ctx context.Context, owner, repo string, id int64, opt *UploadOptions, file *os.File) (*ReleaseAsset, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases/%d/assets", owner, repo, id) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - stat, err := file.Stat() - if err != nil { - return nil, nil, err - } - if stat.IsDir() { - return nil, nil, errors.New("the asset to upload can't be a directory") - } - - mediaType := mime.TypeByExtension(filepath.Ext(file.Name())) - if opt.MediaType != "" { - mediaType = opt.MediaType - } - - req, err := s.client.NewUploadRequest(u, file, stat.Size(), mediaType) - if err != nil { - return nil, nil, err - } - - asset := new(ReleaseAsset) - resp, err := s.client.Do(ctx, req, asset) - if err != nil { - return nil, resp, err - } - return asset, resp, nil -} diff --git a/vendor/github.com/google/go-github/v27/github/repos_stats.go b/vendor/github.com/google/go-github/v27/github/repos_stats.go deleted file mode 100644 index bb355aeadd3a..000000000000 --- a/vendor/github.com/google/go-github/v27/github/repos_stats.go +++ /dev/null @@ -1,226 +0,0 @@ -// Copyright 2014 The go-github 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 - -import ( - "context" - "fmt" - "time" -) - -// ContributorStats represents a contributor to a repository and their -// weekly contributions to a given repo. -type ContributorStats struct { - Author *Contributor `json:"author,omitempty"` - Total *int `json:"total,omitempty"` - Weeks []WeeklyStats `json:"weeks,omitempty"` -} - -func (c ContributorStats) String() string { - return Stringify(c) -} - -// WeeklyStats represents the number of additions, deletions and commits -// a Contributor made in a given week. -type WeeklyStats struct { - Week *Timestamp `json:"w,omitempty"` - Additions *int `json:"a,omitempty"` - Deletions *int `json:"d,omitempty"` - Commits *int `json:"c,omitempty"` -} - -func (w WeeklyStats) String() string { - return Stringify(w) -} - -// ListContributorsStats gets a repo's contributor list with additions, -// deletions and commit counts. -// -// If this is the first time these statistics are requested for the given -// repository, this method will return an *AcceptedError and a status code of -// 202. This is because this is the status that GitHub returns to signify that -// it is now computing the requested statistics. A follow up request, after a -// delay of a second or so, should result in a successful request. -// -// GitHub API docs: https://developer.github.com/v3/repos/statistics/#contributors -func (s *RepositoriesService) ListContributorsStats(ctx context.Context, owner, repo string) ([]*ContributorStats, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/stats/contributors", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var contributorStats []*ContributorStats - resp, err := s.client.Do(ctx, req, &contributorStats) - if err != nil { - return nil, resp, err - } - - return contributorStats, resp, nil -} - -// WeeklyCommitActivity represents the weekly commit activity for a repository. -// The days array is a group of commits per day, starting on Sunday. -type WeeklyCommitActivity struct { - Days []int `json:"days,omitempty"` - Total *int `json:"total,omitempty"` - Week *Timestamp `json:"week,omitempty"` -} - -func (w WeeklyCommitActivity) String() string { - return Stringify(w) -} - -// ListCommitActivity returns the last year of commit activity -// grouped by week. The days array is a group of commits per day, -// starting on Sunday. -// -// If this is the first time these statistics are requested for the given -// repository, this method will return an *AcceptedError and a status code of -// 202. This is because this is the status that GitHub returns to signify that -// it is now computing the requested statistics. A follow up request, after a -// delay of a second or so, should result in a successful request. -// -// GitHub API docs: https://developer.github.com/v3/repos/statistics/#commit-activity -func (s *RepositoriesService) ListCommitActivity(ctx context.Context, owner, repo string) ([]*WeeklyCommitActivity, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/stats/commit_activity", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var weeklyCommitActivity []*WeeklyCommitActivity - resp, err := s.client.Do(ctx, req, &weeklyCommitActivity) - if err != nil { - return nil, resp, err - } - - return weeklyCommitActivity, resp, nil -} - -// ListCodeFrequency returns a weekly aggregate of the number of additions and -// deletions pushed to a repository. Returned WeeklyStats will contain -// additions and deletions, but not total commits. -// -// If this is the first time these statistics are requested for the given -// repository, this method will return an *AcceptedError and a status code of -// 202. This is because this is the status that GitHub returns to signify that -// it is now computing the requested statistics. A follow up request, after a -// delay of a second or so, should result in a successful request. -// -// GitHub API docs: https://developer.github.com/v3/repos/statistics/#code-frequency -func (s *RepositoriesService) ListCodeFrequency(ctx context.Context, owner, repo string) ([]*WeeklyStats, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/stats/code_frequency", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var weeks [][]int - resp, err := s.client.Do(ctx, req, &weeks) - - // convert int slices into WeeklyStats - var stats []*WeeklyStats - for _, week := range weeks { - if len(week) != 3 { - continue - } - stat := &WeeklyStats{ - Week: &Timestamp{time.Unix(int64(week[0]), 0)}, - Additions: Int(week[1]), - Deletions: Int(week[2]), - } - stats = append(stats, stat) - } - - return stats, resp, err -} - -// RepositoryParticipation is the number of commits by everyone -// who has contributed to the repository (including the owner) -// as well as the number of commits by the owner themself. -type RepositoryParticipation struct { - All []int `json:"all,omitempty"` - Owner []int `json:"owner,omitempty"` -} - -func (r RepositoryParticipation) String() string { - return Stringify(r) -} - -// ListParticipation returns the total commit counts for the 'owner' -// and total commit counts in 'all'. 'all' is everyone combined, -// including the 'owner' in the last 52 weeks. If you’d like to get -// the commit counts for non-owners, you can subtract 'all' from 'owner'. -// -// The array order is oldest week (index 0) to most recent week. -// -// If this is the first time these statistics are requested for the given -// repository, this method will return an *AcceptedError and a status code of -// 202. This is because this is the status that GitHub returns to signify that -// it is now computing the requested statistics. A follow up request, after a -// delay of a second or so, should result in a successful request. -// -// GitHub API docs: https://developer.github.com/v3/repos/statistics/#participation -func (s *RepositoriesService) ListParticipation(ctx context.Context, owner, repo string) (*RepositoryParticipation, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/stats/participation", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - participation := new(RepositoryParticipation) - resp, err := s.client.Do(ctx, req, participation) - if err != nil { - return nil, resp, err - } - - return participation, resp, nil -} - -// PunchCard represents the number of commits made during a given hour of a -// day of the week. -type PunchCard struct { - Day *int // Day of the week (0-6: =Sunday - Saturday). - Hour *int // Hour of day (0-23). - Commits *int // Number of commits. -} - -// ListPunchCard returns the number of commits per hour in each day. -// -// If this is the first time these statistics are requested for the given -// repository, this method will return an *AcceptedError and a status code of -// 202. This is because this is the status that GitHub returns to signify that -// it is now computing the requested statistics. A follow up request, after a -// delay of a second or so, should result in a successful request. -// -// GitHub API docs: https://developer.github.com/v3/repos/statistics/#punch-card -func (s *RepositoriesService) ListPunchCard(ctx context.Context, owner, repo string) ([]*PunchCard, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/stats/punch_card", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var results [][]int - resp, err := s.client.Do(ctx, req, &results) - - // convert int slices into Punchcards - var cards []*PunchCard - for _, result := range results { - if len(result) != 3 { - continue - } - card := &PunchCard{ - Day: Int(result[0]), - Hour: Int(result[1]), - Commits: Int(result[2]), - } - cards = append(cards, card) - } - - return cards, resp, err -} diff --git a/vendor/github.com/google/go-github/v27/github/repos_statuses.go b/vendor/github.com/google/go-github/v27/github/repos_statuses.go deleted file mode 100644 index 6d6a0d2fe4e5..000000000000 --- a/vendor/github.com/google/go-github/v27/github/repos_statuses.go +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright 2013 The go-github 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 - -import ( - "context" - "fmt" - "net/url" - "time" -) - -// RepoStatus represents the status of a repository at a particular reference. -type RepoStatus struct { - ID *int64 `json:"id,omitempty"` - NodeID *string `json:"node_id,omitempty"` - URL *string `json:"url,omitempty"` - - // State is the current state of the repository. Possible values are: - // pending, success, error, or failure. - State *string `json:"state,omitempty"` - - // TargetURL is the URL of the page representing this status. It will be - // linked from the GitHub UI to allow users to see the source of the status. - TargetURL *string `json:"target_url,omitempty"` - - // Description is a short high level summary of the status. - Description *string `json:"description,omitempty"` - - // A string label to differentiate this status from the statuses of other systems. - Context *string `json:"context,omitempty"` - - Creator *User `json:"creator,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` -} - -func (r RepoStatus) String() string { - return Stringify(r) -} - -// ListStatuses lists the statuses of a repository at the specified -// reference. ref can be a SHA, a branch name, or a tag name. -// -// GitHub API docs: https://developer.github.com/v3/repos/statuses/#list-statuses-for-a-specific-ref -func (s *RepositoriesService) ListStatuses(ctx context.Context, owner, repo, ref string, opt *ListOptions) ([]*RepoStatus, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/commits/%v/statuses", owner, repo, url.QueryEscape(ref)) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var statuses []*RepoStatus - resp, err := s.client.Do(ctx, req, &statuses) - if err != nil { - return nil, resp, err - } - - return statuses, resp, nil -} - -// CreateStatus creates a new status for a repository at the specified -// reference. Ref can be a SHA, a branch name, or a tag name. -// -// GitHub API docs: https://developer.github.com/v3/repos/statuses/#create-a-status -func (s *RepositoriesService) CreateStatus(ctx context.Context, owner, repo, ref string, status *RepoStatus) (*RepoStatus, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/statuses/%v", owner, repo, url.QueryEscape(ref)) - req, err := s.client.NewRequest("POST", u, status) - if err != nil { - return nil, nil, err - } - - repoStatus := new(RepoStatus) - resp, err := s.client.Do(ctx, req, repoStatus) - if err != nil { - return nil, resp, err - } - - return repoStatus, resp, nil -} - -// CombinedStatus represents the combined status of a repository at a particular reference. -type CombinedStatus struct { - // State is the combined state of the repository. Possible values are: - // failure, pending, or success. - State *string `json:"state,omitempty"` - - Name *string `json:"name,omitempty"` - SHA *string `json:"sha,omitempty"` - TotalCount *int `json:"total_count,omitempty"` - Statuses []RepoStatus `json:"statuses,omitempty"` - - CommitURL *string `json:"commit_url,omitempty"` - RepositoryURL *string `json:"repository_url,omitempty"` -} - -func (s CombinedStatus) String() string { - return Stringify(s) -} - -// GetCombinedStatus returns the combined status of a repository at the specified -// reference. ref can be a SHA, a branch name, or a tag name. -// -// GitHub API docs: https://developer.github.com/v3/repos/statuses/#get-the-combined-status-for-a-specific-ref -func (s *RepositoriesService) GetCombinedStatus(ctx context.Context, owner, repo, ref string, opt *ListOptions) (*CombinedStatus, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/commits/%v/status", owner, repo, url.QueryEscape(ref)) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - status := new(CombinedStatus) - resp, err := s.client.Do(ctx, req, status) - if err != nil { - return nil, resp, err - } - - return status, resp, nil -} diff --git a/vendor/github.com/google/go-github/v27/github/repos_traffic.go b/vendor/github.com/google/go-github/v27/github/repos_traffic.go deleted file mode 100644 index fb1c97648a7b..000000000000 --- a/vendor/github.com/google/go-github/v27/github/repos_traffic.go +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright 2016 The go-github 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 - -import ( - "context" - "fmt" -) - -// TrafficReferrer represent information about traffic from a referrer . -type TrafficReferrer struct { - Referrer *string `json:"referrer,omitempty"` - Count *int `json:"count,omitempty"` - Uniques *int `json:"uniques,omitempty"` -} - -// TrafficPath represent information about the traffic on a path of the repo. -type TrafficPath struct { - Path *string `json:"path,omitempty"` - Title *string `json:"title,omitempty"` - Count *int `json:"count,omitempty"` - Uniques *int `json:"uniques,omitempty"` -} - -// TrafficData represent information about a specific timestamp in views or clones list. -type TrafficData struct { - Timestamp *Timestamp `json:"timestamp,omitempty"` - Count *int `json:"count,omitempty"` - Uniques *int `json:"uniques,omitempty"` -} - -// TrafficViews represent information about the number of views in the last 14 days. -type TrafficViews struct { - Views []*TrafficData `json:"views,omitempty"` - Count *int `json:"count,omitempty"` - Uniques *int `json:"uniques,omitempty"` -} - -// TrafficClones represent information about the number of clones in the last 14 days. -type TrafficClones struct { - Clones []*TrafficData `json:"clones,omitempty"` - Count *int `json:"count,omitempty"` - Uniques *int `json:"uniques,omitempty"` -} - -// TrafficBreakdownOptions specifies the parameters to methods that support breakdown per day or week. -// Can be one of: day, week. Default: day. -type TrafficBreakdownOptions struct { - Per string `url:"per,omitempty"` -} - -// ListTrafficReferrers list the top 10 referrers over the last 14 days. -// -// GitHub API docs: https://developer.github.com/v3/repos/traffic/#list-referrers -func (s *RepositoriesService) ListTrafficReferrers(ctx context.Context, owner, repo string) ([]*TrafficReferrer, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/traffic/popular/referrers", owner, repo) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var trafficReferrers []*TrafficReferrer - resp, err := s.client.Do(ctx, req, &trafficReferrers) - if err != nil { - return nil, resp, err - } - - return trafficReferrers, resp, nil -} - -// ListTrafficPaths list the top 10 popular content over the last 14 days. -// -// GitHub API docs: https://developer.github.com/v3/repos/traffic/#list-paths -func (s *RepositoriesService) ListTrafficPaths(ctx context.Context, owner, repo string) ([]*TrafficPath, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/traffic/popular/paths", owner, repo) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var paths []*TrafficPath - resp, err := s.client.Do(ctx, req, &paths) - if err != nil { - return nil, resp, err - } - - return paths, resp, nil -} - -// ListTrafficViews get total number of views for the last 14 days and breaks it down either per day or week. -// -// GitHub API docs: https://developer.github.com/v3/repos/traffic/#views -func (s *RepositoriesService) ListTrafficViews(ctx context.Context, owner, repo string, opt *TrafficBreakdownOptions) (*TrafficViews, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/traffic/views", owner, repo) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - trafficViews := new(TrafficViews) - resp, err := s.client.Do(ctx, req, &trafficViews) - if err != nil { - return nil, resp, err - } - - return trafficViews, resp, nil -} - -// ListTrafficClones get total number of clones for the last 14 days and breaks it down either per day or week for the last 14 days. -// -// GitHub API docs: https://developer.github.com/v3/repos/traffic/#views -func (s *RepositoriesService) ListTrafficClones(ctx context.Context, owner, repo string, opt *TrafficBreakdownOptions) (*TrafficClones, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/traffic/clones", owner, repo) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - trafficClones := new(TrafficClones) - resp, err := s.client.Do(ctx, req, &trafficClones) - if err != nil { - return nil, resp, err - } - - return trafficClones, resp, nil -} diff --git a/vendor/github.com/google/go-github/v27/github/search.go b/vendor/github.com/google/go-github/v27/github/search.go deleted file mode 100644 index 24156f318313..000000000000 --- a/vendor/github.com/google/go-github/v27/github/search.go +++ /dev/null @@ -1,258 +0,0 @@ -// Copyright 2013 The go-github 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 - -import ( - "context" - "fmt" - "strconv" - - qs "github.com/google/go-querystring/query" -) - -// SearchService provides access to the search related functions -// in the GitHub API. -// -// Each method takes a query string defining the search keywords and any search qualifiers. -// For example, when searching issues, the query "gopher is:issue language:go" will search -// for issues containing the word "gopher" in Go repositories. The method call -// opts := &github.SearchOptions{Sort: "created", Order: "asc"} -// cl.Search.Issues(ctx, "gopher is:issue language:go", opts) -// will search for such issues, sorting by creation date in ascending order -// (i.e., oldest first). -// -// GitHub API docs: https://developer.github.com/v3/search/ -type SearchService service - -// SearchOptions specifies optional parameters to the SearchService methods. -type SearchOptions struct { - // How to sort the search results. Possible values are: - // - for repositories: stars, fork, updated - // - for commits: author-date, committer-date - // - for code: indexed - // - for issues: comments, created, updated - // - for users: followers, repositories, joined - // - // Default is to sort by best match. - Sort string `url:"sort,omitempty"` - - // Sort order if sort parameter is provided. Possible values are: asc, - // desc. Default is desc. - Order string `url:"order,omitempty"` - - // Whether to retrieve text match metadata with a query - TextMatch bool `url:"-"` - - ListOptions -} - -// Common search parameters. -type searchParameters struct { - Query string - RepositoryID *int64 // Sent if non-nil. -} - -// RepositoriesSearchResult represents the result of a repositories search. -type RepositoriesSearchResult struct { - Total *int `json:"total_count,omitempty"` - IncompleteResults *bool `json:"incomplete_results,omitempty"` - Repositories []Repository `json:"items,omitempty"` -} - -// Repositories searches repositories via various criteria. -// -// GitHub API docs: https://developer.github.com/v3/search/#search-repositories -func (s *SearchService) Repositories(ctx context.Context, query string, opt *SearchOptions) (*RepositoriesSearchResult, *Response, error) { - result := new(RepositoriesSearchResult) - resp, err := s.search(ctx, "repositories", &searchParameters{Query: query}, opt, result) - return result, resp, err -} - -// CommitsSearchResult represents the result of a commits search. -type CommitsSearchResult struct { - Total *int `json:"total_count,omitempty"` - IncompleteResults *bool `json:"incomplete_results,omitempty"` - Commits []*CommitResult `json:"items,omitempty"` -} - -// CommitResult represents a commit object as returned in commit search endpoint response. -type CommitResult struct { - SHA *string `json:"sha,omitempty"` - Commit *Commit `json:"commit,omitempty"` - Author *User `json:"author,omitempty"` - Committer *User `json:"committer,omitempty"` - Parents []*Commit `json:"parents,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - URL *string `json:"url,omitempty"` - CommentsURL *string `json:"comments_url,omitempty"` - - Repository *Repository `json:"repository,omitempty"` - Score *float64 `json:"score,omitempty"` -} - -// Commits searches commits via various criteria. -// -// GitHub API docs: https://developer.github.com/v3/search/#search-commits -func (s *SearchService) Commits(ctx context.Context, query string, opt *SearchOptions) (*CommitsSearchResult, *Response, error) { - result := new(CommitsSearchResult) - resp, err := s.search(ctx, "commits", &searchParameters{Query: query}, opt, result) - return result, resp, err -} - -// IssuesSearchResult represents the result of an issues search. -type IssuesSearchResult struct { - Total *int `json:"total_count,omitempty"` - IncompleteResults *bool `json:"incomplete_results,omitempty"` - Issues []Issue `json:"items,omitempty"` -} - -// Issues searches issues via various criteria. -// -// GitHub API docs: https://developer.github.com/v3/search/#search-issues -func (s *SearchService) Issues(ctx context.Context, query string, opt *SearchOptions) (*IssuesSearchResult, *Response, error) { - result := new(IssuesSearchResult) - resp, err := s.search(ctx, "issues", &searchParameters{Query: query}, opt, result) - return result, resp, err -} - -// UsersSearchResult represents the result of a users search. -type UsersSearchResult struct { - Total *int `json:"total_count,omitempty"` - IncompleteResults *bool `json:"incomplete_results,omitempty"` - Users []User `json:"items,omitempty"` -} - -// Users searches users via various criteria. -// -// GitHub API docs: https://developer.github.com/v3/search/#search-users -func (s *SearchService) Users(ctx context.Context, query string, opt *SearchOptions) (*UsersSearchResult, *Response, error) { - result := new(UsersSearchResult) - resp, err := s.search(ctx, "users", &searchParameters{Query: query}, opt, result) - return result, resp, err -} - -// Match represents a single text match. -type Match struct { - Text *string `json:"text,omitempty"` - Indices []int `json:"indices,omitempty"` -} - -// TextMatch represents a text match for a SearchResult -type TextMatch struct { - ObjectURL *string `json:"object_url,omitempty"` - ObjectType *string `json:"object_type,omitempty"` - Property *string `json:"property,omitempty"` - Fragment *string `json:"fragment,omitempty"` - Matches []Match `json:"matches,omitempty"` -} - -func (tm TextMatch) String() string { - return Stringify(tm) -} - -// CodeSearchResult represents the result of a code search. -type CodeSearchResult struct { - Total *int `json:"total_count,omitempty"` - IncompleteResults *bool `json:"incomplete_results,omitempty"` - CodeResults []CodeResult `json:"items,omitempty"` -} - -// CodeResult represents a single search result. -type CodeResult struct { - Name *string `json:"name,omitempty"` - Path *string `json:"path,omitempty"` - SHA *string `json:"sha,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - Repository *Repository `json:"repository,omitempty"` - TextMatches []TextMatch `json:"text_matches,omitempty"` -} - -func (c CodeResult) String() string { - return Stringify(c) -} - -// Code searches code via various criteria. -// -// GitHub API docs: https://developer.github.com/v3/search/#search-code -func (s *SearchService) Code(ctx context.Context, query string, opt *SearchOptions) (*CodeSearchResult, *Response, error) { - result := new(CodeSearchResult) - resp, err := s.search(ctx, "code", &searchParameters{Query: query}, opt, result) - return result, resp, err -} - -// LabelsSearchResult represents the result of a code search. -type LabelsSearchResult struct { - Total *int `json:"total_count,omitempty"` - IncompleteResults *bool `json:"incomplete_results,omitempty"` - Labels []*LabelResult `json:"items,omitempty"` -} - -// LabelResult represents a single search result. -type LabelResult struct { - ID *int64 `json:"id,omitempty"` - URL *string `json:"url,omitempty"` - Name *string `json:"name,omitempty"` - Color *string `json:"color,omitempty"` - Default *bool `json:"default,omitempty"` - Description *string `json:"description,omitempty"` - Score *float64 `json:"score,omitempty"` -} - -func (l LabelResult) String() string { - return Stringify(l) -} - -// Labels searches labels in the repository with ID repoID via various criteria. -// -// GitHub API docs: https://developer.github.com/v3/search/#search-labels -func (s *SearchService) Labels(ctx context.Context, repoID int64, query string, opt *SearchOptions) (*LabelsSearchResult, *Response, error) { - result := new(LabelsSearchResult) - resp, err := s.search(ctx, "labels", &searchParameters{RepositoryID: &repoID, Query: query}, opt, result) - return result, resp, err -} - -// Helper function that executes search queries against different -// GitHub search types (repositories, commits, code, issues, users, labels) -// -// If searchParameters.Query includes multiple condition, it MUST NOT include "+" as condition separator. -// For example, querying with "language:c++" and "leveldb", then searchParameters.Query should be "language:c++ leveldb" but not "language:c+++leveldb". -func (s *SearchService) search(ctx context.Context, searchType string, parameters *searchParameters, opt *SearchOptions, result interface{}) (*Response, error) { - params, err := qs.Values(opt) - if err != nil { - return nil, err - } - if parameters.RepositoryID != nil { - params.Set("repository_id", strconv.FormatInt(*parameters.RepositoryID, 10)) - } - params.Set("q", parameters.Query) - u := fmt.Sprintf("search/%s?%s", searchType, params.Encode()) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, err - } - - switch { - case searchType == "commits": - // Accept header for search commits preview endpoint - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeCommitSearchPreview) - case searchType == "repositories": - // Accept header for search repositories based on topics preview endpoint - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeTopicsPreview) - case searchType == "labels": - // Accept header for search labels based on label description preview endpoint. - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeLabelDescriptionSearchPreview) - case opt != nil && opt.TextMatch: - // Accept header defaults to "application/vnd.github.v3+json" - // We change it here to fetch back text-match metadata - req.Header.Set("Accept", "application/vnd.github.v3.text-match+json") - } - - return s.client.Do(ctx, req, result) -} diff --git a/vendor/github.com/google/go-github/v27/github/strings.go b/vendor/github.com/google/go-github/v27/github/strings.go deleted file mode 100644 index 431e1cc6c1d3..000000000000 --- a/vendor/github.com/google/go-github/v27/github/strings.go +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright 2013 The go-github 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 - -import ( - "bytes" - "fmt" - "io" - - "reflect" -) - -var timestampType = reflect.TypeOf(Timestamp{}) - -// Stringify attempts to create a reasonable string representation of types in -// the GitHub library. It does things like resolve pointers to their values -// and omits struct fields with nil values. -func Stringify(message interface{}) string { - var buf bytes.Buffer - v := reflect.ValueOf(message) - stringifyValue(&buf, v) - return buf.String() -} - -// stringifyValue was heavily inspired by the goprotobuf library. - -func stringifyValue(w io.Writer, val reflect.Value) { - if val.Kind() == reflect.Ptr && val.IsNil() { - w.Write([]byte("")) - return - } - - v := reflect.Indirect(val) - - switch v.Kind() { - case reflect.String: - fmt.Fprintf(w, `"%s"`, v) - case reflect.Slice: - w.Write([]byte{'['}) - for i := 0; i < v.Len(); i++ { - if i > 0 { - w.Write([]byte{' '}) - } - - stringifyValue(w, v.Index(i)) - } - - w.Write([]byte{']'}) - return - case reflect.Struct: - if v.Type().Name() != "" { - w.Write([]byte(v.Type().String())) - } - - // special handling of Timestamp values - if v.Type() == timestampType { - fmt.Fprintf(w, "{%s}", v.Interface()) - return - } - - w.Write([]byte{'{'}) - - var sep bool - for i := 0; i < v.NumField(); i++ { - fv := v.Field(i) - if fv.Kind() == reflect.Ptr && fv.IsNil() { - continue - } - if fv.Kind() == reflect.Slice && fv.IsNil() { - continue - } - - if sep { - w.Write([]byte(", ")) - } else { - sep = true - } - - w.Write([]byte(v.Type().Field(i).Name)) - w.Write([]byte{':'}) - stringifyValue(w, fv) - } - - w.Write([]byte{'}'}) - default: - if v.CanInterface() { - fmt.Fprint(w, v.Interface()) - } - } -} diff --git a/vendor/github.com/google/go-github/v27/github/teams.go b/vendor/github.com/google/go-github/v27/github/teams.go deleted file mode 100644 index b4953e638711..000000000000 --- a/vendor/github.com/google/go-github/v27/github/teams.go +++ /dev/null @@ -1,562 +0,0 @@ -// Copyright 2018 The go-github 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 - -import ( - "context" - "fmt" - "strings" - "time" -) - -// TeamsService provides access to the team-related functions -// in the GitHub API. -// -// GitHub API docs: https://developer.github.com/v3/teams/ -type TeamsService service - -// Team represents a team within a GitHub organization. Teams are used to -// manage access to an organization's repositories. -type Team struct { - ID *int64 `json:"id,omitempty"` - NodeID *string `json:"node_id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - URL *string `json:"url,omitempty"` - Slug *string `json:"slug,omitempty"` - - // Permission specifies the default permission for repositories owned by the team. - Permission *string `json:"permission,omitempty"` - - // Privacy identifies the level of privacy this team should have. - // Possible values are: - // secret - only visible to organization owners and members of this team - // closed - visible to all members of this organization - // Default is "secret". - Privacy *string `json:"privacy,omitempty"` - - MembersCount *int `json:"members_count,omitempty"` - ReposCount *int `json:"repos_count,omitempty"` - Organization *Organization `json:"organization,omitempty"` - MembersURL *string `json:"members_url,omitempty"` - RepositoriesURL *string `json:"repositories_url,omitempty"` - Parent *Team `json:"parent,omitempty"` - - // LDAPDN is only available in GitHub Enterprise and when the team - // membership is synchronized with LDAP. - LDAPDN *string `json:"ldap_dn,omitempty"` -} - -func (t Team) String() string { - return Stringify(t) -} - -// Invitation represents a team member's invitation status. -type Invitation struct { - ID *int64 `json:"id,omitempty"` - NodeID *string `json:"node_id,omitempty"` - Login *string `json:"login,omitempty"` - Email *string `json:"email,omitempty"` - // Role can be one of the values - 'direct_member', 'admin', 'billing_manager', 'hiring_manager', or 'reinstate'. - Role *string `json:"role,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - Inviter *User `json:"inviter,omitempty"` - TeamCount *int `json:"team_count,omitempty"` - InvitationTeamURL *string `json:"invitation_team_url,omitempty"` -} - -func (i Invitation) String() string { - return Stringify(i) -} - -// ListTeams lists all of the teams for an organization. -// -// GitHub API docs: https://developer.github.com/v3/teams/#list-teams -func (s *TeamsService) ListTeams(ctx context.Context, org string, opt *ListOptions) ([]*Team, *Response, error) { - u := fmt.Sprintf("orgs/%v/teams", org) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeNestedTeamsPreview) - - var teams []*Team - resp, err := s.client.Do(ctx, req, &teams) - if err != nil { - return nil, resp, err - } - - return teams, resp, nil -} - -// GetTeam fetches a team by ID. -// -// GitHub API docs: https://developer.github.com/v3/teams/#get-team -func (s *TeamsService) GetTeam(ctx context.Context, team int64) (*Team, *Response, error) { - u := fmt.Sprintf("teams/%v", team) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeNestedTeamsPreview) - - t := new(Team) - resp, err := s.client.Do(ctx, req, t) - if err != nil { - return nil, resp, err - } - - return t, resp, nil -} - -// GetTeamBySlug fetches a team by slug. -// -// GitHub API docs: https://developer.github.com/v3/teams/#get-team-by-name -func (s *TeamsService) GetTeamBySlug(ctx context.Context, org, slug string) (*Team, *Response, error) { - u := fmt.Sprintf("orgs/%v/teams/%v", org, slug) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - t := new(Team) - resp, err := s.client.Do(ctx, req, t) - if err != nil { - return nil, resp, err - } - - return t, resp, nil -} - -// NewTeam represents a team to be created or modified. -type NewTeam struct { - Name string `json:"name"` // Name of the team. (Required.) - Description *string `json:"description,omitempty"` - Maintainers []string `json:"maintainers,omitempty"` - RepoNames []string `json:"repo_names,omitempty"` - ParentTeamID *int64 `json:"parent_team_id,omitempty"` - - // Deprecated: Permission is deprecated when creating or editing a team in an org - // using the new GitHub permission model. It no longer identifies the - // permission a team has on its repos, but only specifies the default - // permission a repo is initially added with. Avoid confusion by - // specifying a permission value when calling AddTeamRepo. - Permission *string `json:"permission,omitempty"` - - // Privacy identifies the level of privacy this team should have. - // Possible values are: - // secret - only visible to organization owners and members of this team - // closed - visible to all members of this organization - // Default is "secret". - Privacy *string `json:"privacy,omitempty"` - - // LDAPDN may be used in GitHub Enterprise when the team membership - // is synchronized with LDAP. - LDAPDN *string `json:"ldap_dn,omitempty"` -} - -func (s NewTeam) String() string { - return Stringify(s) -} - -// CreateTeam creates a new team within an organization. -// -// GitHub API docs: https://developer.github.com/v3/teams/#create-team -func (s *TeamsService) CreateTeam(ctx context.Context, org string, team NewTeam) (*Team, *Response, error) { - u := fmt.Sprintf("orgs/%v/teams", org) - req, err := s.client.NewRequest("POST", u, team) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeNestedTeamsPreview) - - t := new(Team) - resp, err := s.client.Do(ctx, req, t) - if err != nil { - return nil, resp, err - } - - return t, resp, nil -} - -// EditTeam edits a team. -// -// GitHub API docs: https://developer.github.com/v3/teams/#edit-team -func (s *TeamsService) EditTeam(ctx context.Context, id int64, team NewTeam) (*Team, *Response, error) { - u := fmt.Sprintf("teams/%v", id) - req, err := s.client.NewRequest("PATCH", u, team) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeNestedTeamsPreview) - - t := new(Team) - resp, err := s.client.Do(ctx, req, t) - if err != nil { - return nil, resp, err - } - - return t, resp, nil -} - -// DeleteTeam deletes a team. -// -// GitHub API docs: https://developer.github.com/v3/teams/#delete-team -func (s *TeamsService) DeleteTeam(ctx context.Context, team int64) (*Response, error) { - u := fmt.Sprintf("teams/%v", team) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - req.Header.Set("Accept", mediaTypeNestedTeamsPreview) - - return s.client.Do(ctx, req, nil) -} - -// ListChildTeams lists child teams for a team. -// -// GitHub API docs: https://developer.github.com/v3/teams/#list-child-teams -func (s *TeamsService) ListChildTeams(ctx context.Context, teamID int64, opt *ListOptions) ([]*Team, *Response, error) { - u := fmt.Sprintf("teams/%v/teams", teamID) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - req.Header.Set("Accept", mediaTypeNestedTeamsPreview) - - var teams []*Team - resp, err := s.client.Do(ctx, req, &teams) - if err != nil { - return nil, resp, err - } - - return teams, resp, nil -} - -// ListTeamRepos lists the repositories that the specified team has access to. -// -// GitHub API docs: https://developer.github.com/v3/teams/#list-team-repos -func (s *TeamsService) ListTeamRepos(ctx context.Context, team int64, opt *ListOptions) ([]*Repository, *Response, error) { - u := fmt.Sprintf("teams/%v/repos", team) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when topics API fully launches. - headers := []string{mediaTypeTopicsPreview, mediaTypeNestedTeamsPreview} - req.Header.Set("Accept", strings.Join(headers, ", ")) - - var repos []*Repository - resp, err := s.client.Do(ctx, req, &repos) - if err != nil { - return nil, resp, err - } - - return repos, resp, nil -} - -// IsTeamRepo checks if a team manages the specified repository. If the -// repository is managed by team, a Repository is returned which includes the -// permissions team has for that repo. -// -// GitHub API docs: https://developer.github.com/v3/teams/#check-if-a-team-manages-a-repository -func (s *TeamsService) IsTeamRepo(ctx context.Context, team int64, owner string, repo string) (*Repository, *Response, error) { - u := fmt.Sprintf("teams/%v/repos/%v/%v", team, owner, repo) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - headers := []string{mediaTypeOrgPermissionRepo, mediaTypeNestedTeamsPreview} - req.Header.Set("Accept", strings.Join(headers, ", ")) - - repository := new(Repository) - resp, err := s.client.Do(ctx, req, repository) - if err != nil { - return nil, resp, err - } - - return repository, resp, nil -} - -// TeamAddTeamRepoOptions specifies the optional parameters to the -// TeamsService.AddTeamRepo method. -type TeamAddTeamRepoOptions struct { - // Permission specifies the permission to grant the team on this repository. - // Possible values are: - // pull - team members can pull, but not push to or administer this repository - // push - team members can pull and push, but not administer this repository - // admin - team members can pull, push and administer this repository - // - // If not specified, the team's permission attribute will be used. - Permission string `json:"permission,omitempty"` -} - -// AddTeamRepo adds a repository to be managed by the specified team. The -// specified repository must be owned by the organization to which the team -// belongs, or a direct fork of a repository owned by the organization. -// -// GitHub API docs: https://developer.github.com/v3/teams/#add-team-repo -func (s *TeamsService) AddTeamRepo(ctx context.Context, team int64, owner string, repo string, opt *TeamAddTeamRepoOptions) (*Response, error) { - u := fmt.Sprintf("teams/%v/repos/%v/%v", team, owner, repo) - req, err := s.client.NewRequest("PUT", u, opt) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} - -// RemoveTeamRepo removes a repository from being managed by the specified -// team. Note that this does not delete the repository, it just removes it -// from the team. -// -// GitHub API docs: https://developer.github.com/v3/teams/#remove-team-repo -func (s *TeamsService) RemoveTeamRepo(ctx context.Context, team int64, owner string, repo string) (*Response, error) { - u := fmt.Sprintf("teams/%v/repos/%v/%v", team, owner, repo) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} - -// ListUserTeams lists a user's teams -// GitHub API docs: https://developer.github.com/v3/teams/#list-user-teams -func (s *TeamsService) ListUserTeams(ctx context.Context, opt *ListOptions) ([]*Team, *Response, error) { - u := "user/teams" - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeNestedTeamsPreview) - - var teams []*Team - resp, err := s.client.Do(ctx, req, &teams) - if err != nil { - return nil, resp, err - } - - return teams, resp, nil -} - -// ListTeamProjects lists the organization projects for a team. -// -// GitHub API docs: https://developer.github.com/v3/teams/#list-team-projects -func (s *TeamsService) ListTeamProjects(ctx context.Context, teamID int64) ([]*Project, *Response, error) { - u := fmt.Sprintf("teams/%v/projects", teamID) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - acceptHeaders := []string{mediaTypeNestedTeamsPreview, mediaTypeProjectsPreview} - req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - - var projects []*Project - resp, err := s.client.Do(ctx, req, &projects) - if err != nil { - return nil, resp, err - } - - return projects, resp, nil -} - -// ReviewTeamProjects checks whether a team has read, write, or admin -// permissions for an organization project. -// -// GitHub API docs: https://developer.github.com/v3/teams/#review-a-team-project -func (s *TeamsService) ReviewTeamProjects(ctx context.Context, teamID, projectID int64) (*Project, *Response, error) { - u := fmt.Sprintf("teams/%v/projects/%v", teamID, projectID) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - acceptHeaders := []string{mediaTypeNestedTeamsPreview, mediaTypeProjectsPreview} - req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - - projects := &Project{} - resp, err := s.client.Do(ctx, req, &projects) - if err != nil { - return nil, resp, err - } - - return projects, resp, nil -} - -// TeamProjectOptions specifies the optional parameters to the -// TeamsService.AddTeamProject method. -type TeamProjectOptions struct { - // Permission specifies the permission to grant to the team for this project. - // Possible values are: - // "read" - team members can read, but not write to or administer this project. - // "write" - team members can read and write, but not administer this project. - // "admin" - team members can read, write and administer this project. - // - Permission *string `json:"permission,omitempty"` -} - -// AddTeamProject adds an organization project to a team. To add a project to a team or -// update the team's permission on a project, the authenticated user must have admin -// permissions for the project. -// -// GitHub API docs: https://developer.github.com/v3/teams/#add-or-update-team-project -func (s *TeamsService) AddTeamProject(ctx context.Context, teamID, projectID int64, opt *TeamProjectOptions) (*Response, error) { - u := fmt.Sprintf("teams/%v/projects/%v", teamID, projectID) - req, err := s.client.NewRequest("PUT", u, opt) - if err != nil { - return nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - acceptHeaders := []string{mediaTypeNestedTeamsPreview, mediaTypeProjectsPreview} - req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - - return s.client.Do(ctx, req, nil) -} - -// RemoveTeamProject removes an organization project from a team. An organization owner or -// a team maintainer can remove any project from the team. To remove a project from a team -// as an organization member, the authenticated user must have "read" access to both the team -// and project, or "admin" access to the team or project. -// Note: This endpoint removes the project from the team, but does not delete it. -// -// GitHub API docs: https://developer.github.com/v3/teams/#remove-team-project -func (s *TeamsService) RemoveTeamProject(ctx context.Context, teamID int64, projectID int64) (*Response, error) { - u := fmt.Sprintf("teams/%v/projects/%v", teamID, projectID) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - acceptHeaders := []string{mediaTypeNestedTeamsPreview, mediaTypeProjectsPreview} - req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - - return s.client.Do(ctx, req, nil) -} - -// IDPGroupList represents a list of external identity provider (IDP) groups. -type IDPGroupList struct { - Groups []*IDPGroup `json:"groups,omitempty"` -} - -// IDPGroup represents an external identity provider (IDP) group. -type IDPGroup struct { - GroupID *string `json:"group_id,omitempty"` - GroupName *string `json:"group_name,omitempty"` - GroupDescription *string `json:"group_description,omitempty"` -} - -// ListIDPGroupsInOrganization lists IDP groups available in an organization. -// -// GitHub API docs: https://developer.github.com/v3/teams/team_sync/#list-idp-groups-in-an-organization -func (s *TeamsService) ListIDPGroupsInOrganization(ctx context.Context, org string, opt *ListOptions) (*IDPGroupList, *Response, error) { - u := fmt.Sprintf("orgs/%v/team-sync/groups", org) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeTeamSyncPreview) - - groups := new(IDPGroupList) - resp, err := s.client.Do(ctx, req, groups) - if err != nil { - return nil, resp, err - } - return groups, resp, nil -} - -// ListIDPGroupsForTeam lists IDP groups connected to a team on GitHub. -// -// GitHub API docs: https://developer.github.com/v3/teams/team_sync/#list-idp-groups-for-a-team -func (s *TeamsService) ListIDPGroupsForTeam(ctx context.Context, teamID string) (*IDPGroupList, *Response, error) { - u := fmt.Sprintf("teams/%v/team-sync/group-mappings", teamID) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeTeamSyncPreview) - - groups := new(IDPGroupList) - resp, err := s.client.Do(ctx, req, groups) - if err != nil { - return nil, resp, err - } - return groups, resp, err -} - -// CreateOrUpdateIDPGroupConnections creates, updates, or removes a connection between a team -// and an IDP group. -// -// GitHub API docs: https://developer.github.com/v3/teams/team_sync/#create-or-update-idp-group-connections -func (s *TeamsService) CreateOrUpdateIDPGroupConnections(ctx context.Context, teamID string, opt IDPGroupList) (*IDPGroupList, *Response, error) { - u := fmt.Sprintf("teams/%v/team-sync/group-mappings", teamID) - - req, err := s.client.NewRequest("PATCH", u, opt) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeTeamSyncPreview) - - groups := new(IDPGroupList) - resp, err := s.client.Do(ctx, req, groups) - if err != nil { - return nil, resp, err - } - - return groups, resp, nil -} diff --git a/vendor/github.com/google/go-github/v27/github/teams_discussion_comments.go b/vendor/github.com/google/go-github/v27/github/teams_discussion_comments.go deleted file mode 100644 index a0206b9c92be..000000000000 --- a/vendor/github.com/google/go-github/v27/github/teams_discussion_comments.go +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright 2018 The go-github 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 - -import ( - "context" - "fmt" -) - -// DiscussionComment represents a GitHub dicussion in a team. -type DiscussionComment struct { - Author *User `json:"author,omitempty"` - Body *string `json:"body,omitempty"` - BodyHTML *string `json:"body_html,omitempty"` - BodyVersion *string `json:"body_version,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - LastEditedAt *Timestamp `json:"last_edited_at,omitempty"` - DiscussionURL *string `json:"discussion_url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - NodeID *string `json:"node_id,omitempty"` - Number *int `json:"number,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - URL *string `json:"url,omitempty"` - Reactions *Reactions `json:"reactions,omitempty"` -} - -func (c DiscussionComment) String() string { - return Stringify(c) -} - -// DiscussionCommentListOptions specifies optional parameters to the -// TeamServices.ListComments method. -type DiscussionCommentListOptions struct { - // Sorts the discussion comments by the date they were created. - // Accepted values are asc and desc. Default is desc. - Direction string `url:"direction,omitempty"` -} - -// ListComments lists all comments on a team discussion. -// Authenticated user must grant read:discussion scope. -// -// GitHub API docs: https://developer.github.com/v3/teams/discussion_comments/#list-comments -func (s *TeamsService) ListComments(ctx context.Context, teamID int64, discussionNumber int, options *DiscussionCommentListOptions) ([]*DiscussionComment, *Response, error) { - u := fmt.Sprintf("teams/%v/discussions/%v/comments", teamID, discussionNumber) - u, err := addOptions(u, options) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeTeamDiscussionsPreview) - - var comments []*DiscussionComment - resp, err := s.client.Do(ctx, req, &comments) - if err != nil { - return nil, resp, err - } - - return comments, resp, nil -} - -// GetComment gets a specific comment on a team discussion. -// Authenticated user must grant read:discussion scope. -// -// GitHub API docs: https://developer.github.com/v3/teams/discussion_comments/#get-a-single-comment -func (s *TeamsService) GetComment(ctx context.Context, teamID int64, discussionNumber, commentNumber int) (*DiscussionComment, *Response, error) { - u := fmt.Sprintf("teams/%v/discussions/%v/comments/%v", teamID, discussionNumber, commentNumber) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeTeamDiscussionsPreview) - - discussionComment := &DiscussionComment{} - resp, err := s.client.Do(ctx, req, discussionComment) - if err != nil { - return nil, resp, err - } - - return discussionComment, resp, nil -} - -// CreateComment creates a new discussion post on a team discussion. -// Authenticated user must grant write:discussion scope. -// -// GitHub API docs: https://developer.github.com/v3/teams/discussion_comments/#create-a-comment -func (s *TeamsService) CreateComment(ctx context.Context, teamID int64, discsusionNumber int, comment DiscussionComment) (*DiscussionComment, *Response, error) { - u := fmt.Sprintf("teams/%v/discussions/%v/comments", teamID, discsusionNumber) - req, err := s.client.NewRequest("POST", u, comment) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeTeamDiscussionsPreview) - - discussionComment := &DiscussionComment{} - resp, err := s.client.Do(ctx, req, discussionComment) - if err != nil { - return nil, resp, err - } - - return discussionComment, resp, nil -} - -// EditComment edits the body text of a discussion comment. -// Authenticated user must grant write:discussion scope. -// User is allowed to edit body of a comment only. -// -// GitHub API docs: https://developer.github.com/v3/teams/discussion_comments/#edit-a-comment -func (s *TeamsService) EditComment(ctx context.Context, teamID int64, discussionNumber, commentNumber int, comment DiscussionComment) (*DiscussionComment, *Response, error) { - u := fmt.Sprintf("teams/%v/discussions/%v/comments/%v", teamID, discussionNumber, commentNumber) - req, err := s.client.NewRequest("PATCH", u, comment) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeTeamDiscussionsPreview) - - discussionComment := &DiscussionComment{} - resp, err := s.client.Do(ctx, req, discussionComment) - if err != nil { - return nil, resp, err - } - - return discussionComment, resp, nil -} - -// DeleteComment deletes a comment on a team discussion. -// Authenticated user must grant write:discussion scope. -// -// GitHub API docs: https://developer.github.com/v3/teams/discussion_comments/#delete-a-comment -func (s *TeamsService) DeleteComment(ctx context.Context, teamID int64, discussionNumber, commentNumber int) (*Response, error) { - u := fmt.Sprintf("teams/%v/discussions/%v/comments/%v", teamID, discussionNumber, commentNumber) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeTeamDiscussionsPreview) - - return s.client.Do(ctx, req, nil) -} diff --git a/vendor/github.com/google/go-github/v27/github/teams_discussions.go b/vendor/github.com/google/go-github/v27/github/teams_discussions.go deleted file mode 100644 index f491c9d1d6e9..000000000000 --- a/vendor/github.com/google/go-github/v27/github/teams_discussions.go +++ /dev/null @@ -1,160 +0,0 @@ -// Copyright 2018 The go-github 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 - -import ( - "context" - "fmt" -) - -// TeamDiscussion represents a GitHub dicussion in a team. -type TeamDiscussion struct { - Author *User `json:"author,omitempty"` - Body *string `json:"body,omitempty"` - BodyHTML *string `json:"body_html,omitempty"` - BodyVersion *string `json:"body_version,omitempty"` - CommentsCount *int `json:"comments_count,omitempty"` - CommentsURL *string `json:"comments_url,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - LastEditedAt *Timestamp `json:"last_edited_at,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - NodeID *string `json:"node_id,omitempty"` - Number *int `json:"number,omitempty"` - Pinned *bool `json:"pinned,omitempty"` - Private *bool `json:"private,omitempty"` - TeamURL *string `json:"team_url,omitempty"` - Title *string `json:"title,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - URL *string `json:"url,omitempty"` - Reactions *Reactions `json:"reactions,omitempty"` -} - -func (d TeamDiscussion) String() string { - return Stringify(d) -} - -// DiscussionListOptions specifies optional parameters to the -// TeamServices.ListDiscussions method. -type DiscussionListOptions struct { - // Sorts the discussion by the date they were created. - // Accepted values are asc and desc. Default is desc. - Direction string `url:"direction,omitempty"` -} - -// ListDiscussions lists all discussions on team's page. -// Authenticated user must grant read:discussion scope. -// -// GitHub API docs: https://developer.github.com/v3/teams/discussions/#list-discussions -func (s *TeamsService) ListDiscussions(ctx context.Context, teamID int64, options *DiscussionListOptions) ([]*TeamDiscussion, *Response, error) { - u := fmt.Sprintf("teams/%v/discussions", teamID) - u, err := addOptions(u, options) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeTeamDiscussionsPreview) - - var teamDiscussions []*TeamDiscussion - resp, err := s.client.Do(ctx, req, &teamDiscussions) - if err != nil { - return nil, resp, err - } - - return teamDiscussions, resp, nil -} - -// GetDiscussion gets a specific discussion on a team's page. -// Authenticated user must grant read:discussion scope. -// -// GitHub API docs: https://developer.github.com/v3/teams/discussions/#get-a-single-discussion -func (s *TeamsService) GetDiscussion(ctx context.Context, teamID int64, discussionNumber int) (*TeamDiscussion, *Response, error) { - u := fmt.Sprintf("teams/%v/discussions/%v", teamID, discussionNumber) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeTeamDiscussionsPreview) - - teamDiscussion := &TeamDiscussion{} - resp, err := s.client.Do(ctx, req, teamDiscussion) - if err != nil { - return nil, resp, err - } - - return teamDiscussion, resp, nil -} - -// CreateDiscussion creates a new discussion post on a team's page. -// Authenticated user must grant write:discussion scope. -// -// GitHub API docs: https://developer.github.com/v3/teams/discussions/#create-a-discussion -func (s *TeamsService) CreateDiscussion(ctx context.Context, teamID int64, discussion TeamDiscussion) (*TeamDiscussion, *Response, error) { - u := fmt.Sprintf("teams/%v/discussions", teamID) - req, err := s.client.NewRequest("POST", u, discussion) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeTeamDiscussionsPreview) - - teamDiscussion := &TeamDiscussion{} - resp, err := s.client.Do(ctx, req, teamDiscussion) - if err != nil { - return nil, resp, err - } - - return teamDiscussion, resp, nil -} - -// EditDiscussion edits the title and body text of a discussion post. -// Authenticated user must grant write:discussion scope. -// User is allowed to change Title and Body of a discussion only. -// -// GitHub API docs: https://developer.github.com/v3/teams/discussions/#edit-a-discussion -func (s *TeamsService) EditDiscussion(ctx context.Context, teamID int64, discussionNumber int, discussion TeamDiscussion) (*TeamDiscussion, *Response, error) { - u := fmt.Sprintf("teams/%v/discussions/%v", teamID, discussionNumber) - req, err := s.client.NewRequest("PATCH", u, discussion) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeTeamDiscussionsPreview) - - teamDiscussion := &TeamDiscussion{} - resp, err := s.client.Do(ctx, req, teamDiscussion) - if err != nil { - return nil, resp, err - } - - return teamDiscussion, resp, nil -} - -// DeleteDiscussion deletes a discussion from team's page. -// Authenticated user must grant write:discussion scope. -// -// GitHub API docs: https://developer.github.com/v3/teams/discussions/#delete-a-discussion -func (s *TeamsService) DeleteDiscussion(ctx context.Context, teamID int64, discussionNumber int) (*Response, error) { - u := fmt.Sprintf("teams/%v/discussions/%v", teamID, discussionNumber) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeTeamDiscussionsPreview) - - return s.client.Do(ctx, req, nil) -} diff --git a/vendor/github.com/google/go-github/v27/github/teams_members.go b/vendor/github.com/google/go-github/v27/github/teams_members.go deleted file mode 100644 index d5cfa0dc7dd5..000000000000 --- a/vendor/github.com/google/go-github/v27/github/teams_members.go +++ /dev/null @@ -1,174 +0,0 @@ -// Copyright 2018 The go-github 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 - -import ( - "context" - "fmt" -) - -// TeamListTeamMembersOptions specifies the optional parameters to the -// TeamsService.ListTeamMembers method. -type TeamListTeamMembersOptions struct { - // Role filters members returned by their role in the team. Possible - // values are "all", "member", "maintainer". Default is "all". - Role string `url:"role,omitempty"` - - ListOptions -} - -// ListTeamMembers lists all of the users who are members of the specified -// team. -// -// GitHub API docs: https://developer.github.com/v3/teams/members/#list-team-members -func (s *TeamsService) ListTeamMembers(ctx context.Context, team int64, opt *TeamListTeamMembersOptions) ([]*User, *Response, error) { - u := fmt.Sprintf("teams/%v/members", team) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - req.Header.Set("Accept", mediaTypeNestedTeamsPreview) - - var members []*User - resp, err := s.client.Do(ctx, req, &members) - if err != nil { - return nil, resp, err - } - - return members, resp, nil -} - -// IsTeamMember checks if a user is a member of the specified team. -// -// GitHub API docs: https://developer.github.com/v3/teams/members/#get-team-member -// -// Deprecated: This API has been marked as deprecated in the Github API docs, -// TeamsService.GetTeamMembership method should be used instead. -func (s *TeamsService) IsTeamMember(ctx context.Context, team int64, user string) (bool, *Response, error) { - u := fmt.Sprintf("teams/%v/members/%v", team, user) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return false, nil, err - } - - resp, err := s.client.Do(ctx, req, nil) - member, err := parseBoolResponse(err) - return member, resp, err -} - -// GetTeamMembership returns the membership status for a user in a team. -// -// GitHub API docs: https://developer.github.com/v3/teams/members/#get-team-membership -func (s *TeamsService) GetTeamMembership(ctx context.Context, team int64, user string) (*Membership, *Response, error) { - u := fmt.Sprintf("teams/%v/memberships/%v", team, user) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - req.Header.Set("Accept", mediaTypeNestedTeamsPreview) - - t := new(Membership) - resp, err := s.client.Do(ctx, req, t) - if err != nil { - return nil, resp, err - } - - return t, resp, nil -} - -// TeamAddTeamMembershipOptions specifies the optional -// parameters to the TeamsService.AddTeamMembership method. -type TeamAddTeamMembershipOptions struct { - // Role specifies the role the user should have in the team. Possible - // values are: - // member - a normal member of the team - // maintainer - a team maintainer. Able to add/remove other team - // members, promote other team members to team - // maintainer, and edit the team’s name and description - // - // Default value is "member". - Role string `json:"role,omitempty"` -} - -// AddTeamMembership adds or invites a user to a team. -// -// In order to add a membership between a user and a team, the authenticated -// user must have 'admin' permissions to the team or be an owner of the -// organization that the team is associated with. -// -// If the user is already a part of the team's organization (meaning they're on -// at least one other team in the organization), this endpoint will add the -// user to the team. -// -// If the user is completely unaffiliated with the team's organization (meaning -// they're on none of the organization's teams), this endpoint will send an -// invitation to the user via email. This newly-created membership will be in -// the "pending" state until the user accepts the invitation, at which point -// the membership will transition to the "active" state and the user will be -// added as a member of the team. -// -// GitHub API docs: https://developer.github.com/v3/teams/members/#add-or-update-team-membership -func (s *TeamsService) AddTeamMembership(ctx context.Context, team int64, user string, opt *TeamAddTeamMembershipOptions) (*Membership, *Response, error) { - u := fmt.Sprintf("teams/%v/memberships/%v", team, user) - req, err := s.client.NewRequest("PUT", u, opt) - if err != nil { - return nil, nil, err - } - - t := new(Membership) - resp, err := s.client.Do(ctx, req, t) - if err != nil { - return nil, resp, err - } - - return t, resp, nil -} - -// RemoveTeamMembership removes a user from a team. -// -// GitHub API docs: https://developer.github.com/v3/teams/members/#remove-team-membership -func (s *TeamsService) RemoveTeamMembership(ctx context.Context, team int64, user string) (*Response, error) { - u := fmt.Sprintf("teams/%v/memberships/%v", team, user) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} - -// ListPendingTeamInvitations get pending invitaion list in team. -// Warning: The API may change without advance notice during the preview period. -// Preview features are not supported for production use. -// -// GitHub API docs: https://developer.github.com/v3/teams/members/#list-pending-team-invitations -func (s *TeamsService) ListPendingTeamInvitations(ctx context.Context, team int64, opt *ListOptions) ([]*Invitation, *Response, error) { - u := fmt.Sprintf("teams/%v/invitations", team) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var pendingInvitations []*Invitation - resp, err := s.client.Do(ctx, req, &pendingInvitations) - if err != nil { - return nil, resp, err - } - - return pendingInvitations, resp, nil -} diff --git a/vendor/github.com/google/go-github/v27/github/timestamp.go b/vendor/github.com/google/go-github/v27/github/timestamp.go deleted file mode 100644 index 90929d5757d6..000000000000 --- a/vendor/github.com/google/go-github/v27/github/timestamp.go +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2013 The go-github 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 - -import ( - "strconv" - "time" -) - -// Timestamp represents a time that can be unmarshalled from a JSON string -// formatted as either an RFC3339 or Unix timestamp. This is necessary for some -// fields since the GitHub API is inconsistent in how it represents times. All -// exported methods of time.Time can be called on Timestamp. -type Timestamp struct { - time.Time -} - -func (t Timestamp) String() string { - return t.Time.String() -} - -// UnmarshalJSON implements the json.Unmarshaler interface. -// Time is expected in RFC3339 or Unix format. -func (t *Timestamp) UnmarshalJSON(data []byte) (err error) { - str := string(data) - i, err := strconv.ParseInt(str, 10, 64) - if err == nil { - t.Time = time.Unix(i, 0) - } else { - t.Time, err = time.Parse(`"`+time.RFC3339+`"`, str) - } - return -} - -// Equal reports whether t and u are equal based on time.Equal -func (t Timestamp) Equal(u Timestamp) bool { - return t.Time.Equal(u.Time) -} diff --git a/vendor/github.com/google/go-github/v27/github/users.go b/vendor/github.com/google/go-github/v27/github/users.go deleted file mode 100644 index 2592aea0f4f7..000000000000 --- a/vendor/github.com/google/go-github/v27/github/users.go +++ /dev/null @@ -1,278 +0,0 @@ -// Copyright 2013 The go-github 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 - -import ( - "context" - "fmt" -) - -// UsersService handles communication with the user related -// methods of the GitHub API. -// -// GitHub API docs: https://developer.github.com/v3/users/ -type UsersService service - -// User represents a GitHub user. -type User struct { - Login *string `json:"login,omitempty"` - ID *int64 `json:"id,omitempty"` - NodeID *string `json:"node_id,omitempty"` - AvatarURL *string `json:"avatar_url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - GravatarID *string `json:"gravatar_id,omitempty"` - Name *string `json:"name,omitempty"` - Company *string `json:"company,omitempty"` - Blog *string `json:"blog,omitempty"` - Location *string `json:"location,omitempty"` - Email *string `json:"email,omitempty"` - Hireable *bool `json:"hireable,omitempty"` - Bio *string `json:"bio,omitempty"` - PublicRepos *int `json:"public_repos,omitempty"` - PublicGists *int `json:"public_gists,omitempty"` - Followers *int `json:"followers,omitempty"` - Following *int `json:"following,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - SuspendedAt *Timestamp `json:"suspended_at,omitempty"` - Type *string `json:"type,omitempty"` - SiteAdmin *bool `json:"site_admin,omitempty"` - TotalPrivateRepos *int `json:"total_private_repos,omitempty"` - OwnedPrivateRepos *int `json:"owned_private_repos,omitempty"` - PrivateGists *int `json:"private_gists,omitempty"` - DiskUsage *int `json:"disk_usage,omitempty"` - Collaborators *int `json:"collaborators,omitempty"` - TwoFactorAuthentication *bool `json:"two_factor_authentication,omitempty"` - Plan *Plan `json:"plan,omitempty"` - LdapDn *string `json:"ldap_dn,omitempty"` - - // API URLs - URL *string `json:"url,omitempty"` - EventsURL *string `json:"events_url,omitempty"` - FollowingURL *string `json:"following_url,omitempty"` - FollowersURL *string `json:"followers_url,omitempty"` - GistsURL *string `json:"gists_url,omitempty"` - OrganizationsURL *string `json:"organizations_url,omitempty"` - ReceivedEventsURL *string `json:"received_events_url,omitempty"` - ReposURL *string `json:"repos_url,omitempty"` - StarredURL *string `json:"starred_url,omitempty"` - SubscriptionsURL *string `json:"subscriptions_url,omitempty"` - - // TextMatches is only populated from search results that request text matches - // See: search.go and https://developer.github.com/v3/search/#text-match-metadata - TextMatches []TextMatch `json:"text_matches,omitempty"` - - // Permissions identifies the permissions that a user has on a given - // repository. This is only populated when calling Repositories.ListCollaborators. - Permissions *map[string]bool `json:"permissions,omitempty"` -} - -func (u User) String() string { - return Stringify(u) -} - -// Get fetches a user. Passing the empty string will fetch the authenticated -// user. -// -// GitHub API docs: https://developer.github.com/v3/users/#get-a-single-user -// and: https://developer.github.com/v3/users/#get-the-authenticated-user -func (s *UsersService) Get(ctx context.Context, user string) (*User, *Response, error) { - var u string - if user != "" { - u = fmt.Sprintf("users/%v", user) - } else { - u = "user" - } - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - uResp := new(User) - resp, err := s.client.Do(ctx, req, uResp) - if err != nil { - return nil, resp, err - } - - return uResp, resp, nil -} - -// GetByID fetches a user. -// -// Note: GetByID uses the undocumented GitHub API endpoint /user/:id. -func (s *UsersService) GetByID(ctx context.Context, id int64) (*User, *Response, error) { - u := fmt.Sprintf("user/%d", id) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - user := new(User) - resp, err := s.client.Do(ctx, req, user) - if err != nil { - return nil, resp, err - } - - return user, resp, nil -} - -// Edit the authenticated user. -// -// GitHub API docs: https://developer.github.com/v3/users/#update-the-authenticated-user -func (s *UsersService) Edit(ctx context.Context, user *User) (*User, *Response, error) { - u := "user" - req, err := s.client.NewRequest("PATCH", u, user) - if err != nil { - return nil, nil, err - } - - uResp := new(User) - resp, err := s.client.Do(ctx, req, uResp) - if err != nil { - return nil, resp, err - } - - return uResp, resp, nil -} - -// HovercardOptions specifies optional parameters to the UsersService.GetHovercard -// method. -type HovercardOptions struct { - // SubjectType specifies the additional information to be received about the hovercard. - // Possible values are: organization, repository, issue, pull_request. (Required when using subject_id.) - SubjectType string `url:"subject_type"` - - // SubjectID specifies the ID for the SubjectType. (Required when using subject_type.) - SubjectID string `url:"subject_id"` -} - -// Hovercard represents hovercard information about a user. -type Hovercard struct { - Contexts []*UserContext `json:"contexts,omitempty"` -} - -// UserContext represents the contextual information about user. -type UserContext struct { - Message *string `json:"message,omitempty"` - Octicon *string `json:"octicon,omitempty"` -} - -// GetHovercard fetches contextual information about user. It requires authentication -// via Basic Auth or via OAuth with the repo scope. -// -// GitHub API docs: https://developer.github.com/v3/users/#get-contextual-information-about-a-user -func (s *UsersService) GetHovercard(ctx context.Context, user string, opt *HovercardOptions) (*Hovercard, *Response, error) { - u := fmt.Sprintf("users/%v/hovercard", user) - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeHovercardPreview) - - hc := new(Hovercard) - resp, err := s.client.Do(ctx, req, hc) - if err != nil { - return nil, resp, err - } - - return hc, resp, nil -} - -// UserListOptions specifies optional parameters to the UsersService.ListAll -// method. -type UserListOptions struct { - // ID of the last user seen - Since int64 `url:"since,omitempty"` - - // Note: Pagination is powered exclusively by the Since parameter, - // ListOptions.Page has no effect. - // ListOptions.PerPage controls an undocumented GitHub API parameter. - ListOptions -} - -// ListAll lists all GitHub users. -// -// To paginate through all users, populate 'Since' with the ID of the last user. -// -// GitHub API docs: https://developer.github.com/v3/users/#get-all-users -func (s *UsersService) ListAll(ctx context.Context, opt *UserListOptions) ([]*User, *Response, error) { - u, err := addOptions("users", opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var users []*User - resp, err := s.client.Do(ctx, req, &users) - if err != nil { - return nil, resp, err - } - - return users, resp, nil -} - -// ListInvitations lists all currently-open repository invitations for the -// authenticated user. -// -// GitHub API docs: https://developer.github.com/v3/repos/invitations/#list-a-users-repository-invitations -func (s *UsersService) ListInvitations(ctx context.Context, opt *ListOptions) ([]*RepositoryInvitation, *Response, error) { - u, err := addOptions("user/repository_invitations", opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - invites := []*RepositoryInvitation{} - resp, err := s.client.Do(ctx, req, &invites) - if err != nil { - return nil, resp, err - } - - return invites, resp, nil -} - -// AcceptInvitation accepts the currently-open repository invitation for the -// authenticated user. -// -// GitHub API docs: https://developer.github.com/v3/repos/invitations/#accept-a-repository-invitation -func (s *UsersService) AcceptInvitation(ctx context.Context, invitationID int64) (*Response, error) { - u := fmt.Sprintf("user/repository_invitations/%v", invitationID) - req, err := s.client.NewRequest("PATCH", u, nil) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} - -// DeclineInvitation declines the currently-open repository invitation for the -// authenticated user. -// -// GitHub API docs: https://developer.github.com/v3/repos/invitations/#decline-a-repository-invitation -func (s *UsersService) DeclineInvitation(ctx context.Context, invitationID int64) (*Response, error) { - u := fmt.Sprintf("user/repository_invitations/%v", invitationID) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} diff --git a/vendor/github.com/google/go-github/v27/github/users_administration.go b/vendor/github.com/google/go-github/v27/github/users_administration.go deleted file mode 100644 index 1c483a7b17a6..000000000000 --- a/vendor/github.com/google/go-github/v27/github/users_administration.go +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2014 The go-github 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 - -import ( - "context" - "fmt" -) - -// PromoteSiteAdmin promotes a user to a site administrator of a GitHub Enterprise instance. -// -// GitHub API docs: https://developer.github.com/enterprise/v3/enterprise-admin/users/#promote-an-ordinary-user-to-a-site-administrator -func (s *UsersService) PromoteSiteAdmin(ctx context.Context, user string) (*Response, error) { - u := fmt.Sprintf("users/%v/site_admin", user) - - req, err := s.client.NewRequest("PUT", u, nil) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} - -// DemoteSiteAdmin demotes a user from site administrator of a GitHub Enterprise instance. -// -// GitHub API docs: https://developer.github.com/enterprise/v3/enterprise-admin/users/#demote-a-site-administrator-to-an-ordinary-user -func (s *UsersService) DemoteSiteAdmin(ctx context.Context, user string) (*Response, error) { - u := fmt.Sprintf("users/%v/site_admin", user) - - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} - -// UserSuspendOptions represents the reason a user is being suspended. -type UserSuspendOptions struct { - Reason *string `json:"reason,omitempty"` -} - -// Suspend a user on a GitHub Enterprise instance. -// -// GitHub API docs: https://developer.github.com/enterprise/v3/enterprise-admin/users/#suspend-a-user -func (s *UsersService) Suspend(ctx context.Context, user string, opt *UserSuspendOptions) (*Response, error) { - u := fmt.Sprintf("users/%v/suspended", user) - - req, err := s.client.NewRequest("PUT", u, opt) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} - -// Unsuspend a user on a GitHub Enterprise instance. -// -// GitHub API docs: https://developer.github.com/enterprise/v3/enterprise-admin/users/#unsuspend-a-user -func (s *UsersService) Unsuspend(ctx context.Context, user string) (*Response, error) { - u := fmt.Sprintf("users/%v/suspended", user) - - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} diff --git a/vendor/github.com/google/go-github/v27/github/users_blocking.go b/vendor/github.com/google/go-github/v27/github/users_blocking.go deleted file mode 100644 index 39e45601cc1e..000000000000 --- a/vendor/github.com/google/go-github/v27/github/users_blocking.go +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright 2017 The go-github 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 - -import ( - "context" - "fmt" -) - -// ListBlockedUsers lists all the blocked users by the authenticated user. -// -// GitHub API docs: https://developer.github.com/v3/users/blocking/#list-blocked-users -func (s *UsersService) ListBlockedUsers(ctx context.Context, opt *ListOptions) ([]*User, *Response, error) { - u := "user/blocks" - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeBlockUsersPreview) - - var blockedUsers []*User - resp, err := s.client.Do(ctx, req, &blockedUsers) - if err != nil { - return nil, resp, err - } - - return blockedUsers, resp, nil -} - -// IsBlocked reports whether specified user is blocked by the authenticated user. -// -// GitHub API docs: https://developer.github.com/v3/users/blocking/#check-whether-youve-blocked-a-user -func (s *UsersService) IsBlocked(ctx context.Context, user string) (bool, *Response, error) { - u := fmt.Sprintf("user/blocks/%v", user) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return false, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeBlockUsersPreview) - - resp, err := s.client.Do(ctx, req, nil) - isBlocked, err := parseBoolResponse(err) - return isBlocked, resp, err -} - -// BlockUser blocks specified user for the authenticated user. -// -// GitHub API docs: https://developer.github.com/v3/users/blocking/#block-a-user -func (s *UsersService) BlockUser(ctx context.Context, user string) (*Response, error) { - u := fmt.Sprintf("user/blocks/%v", user) - - req, err := s.client.NewRequest("PUT", u, nil) - if err != nil { - return nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeBlockUsersPreview) - - return s.client.Do(ctx, req, nil) -} - -// UnblockUser unblocks specified user for the authenticated user. -// -// GitHub API docs: https://developer.github.com/v3/users/blocking/#unblock-a-user -func (s *UsersService) UnblockUser(ctx context.Context, user string) (*Response, error) { - u := fmt.Sprintf("user/blocks/%v", user) - - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeBlockUsersPreview) - - return s.client.Do(ctx, req, nil) -} diff --git a/vendor/github.com/google/go-github/v27/github/users_emails.go b/vendor/github.com/google/go-github/v27/github/users_emails.go deleted file mode 100644 index 78d21491191b..000000000000 --- a/vendor/github.com/google/go-github/v27/github/users_emails.go +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2013 The go-github 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 - -import "context" - -// UserEmail represents user's email address -type UserEmail struct { - Email *string `json:"email,omitempty"` - Primary *bool `json:"primary,omitempty"` - Verified *bool `json:"verified,omitempty"` - Visibility *string `json:"visibility,omitempty"` -} - -// ListEmails lists all email addresses for the authenticated user. -// -// GitHub API docs: https://developer.github.com/v3/users/emails/#list-email-addresses-for-a-user -func (s *UsersService) ListEmails(ctx context.Context, opt *ListOptions) ([]*UserEmail, *Response, error) { - u := "user/emails" - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var emails []*UserEmail - resp, err := s.client.Do(ctx, req, &emails) - if err != nil { - return nil, resp, err - } - - return emails, resp, nil -} - -// AddEmails adds email addresses of the authenticated user. -// -// GitHub API docs: https://developer.github.com/v3/users/emails/#add-email-addresses -func (s *UsersService) AddEmails(ctx context.Context, emails []string) ([]*UserEmail, *Response, error) { - u := "user/emails" - req, err := s.client.NewRequest("POST", u, emails) - if err != nil { - return nil, nil, err - } - - var e []*UserEmail - resp, err := s.client.Do(ctx, req, &e) - if err != nil { - return nil, resp, err - } - - return e, resp, nil -} - -// DeleteEmails deletes email addresses from authenticated user. -// -// GitHub API docs: https://developer.github.com/v3/users/emails/#delete-email-addresses -func (s *UsersService) DeleteEmails(ctx context.Context, emails []string) (*Response, error) { - u := "user/emails" - req, err := s.client.NewRequest("DELETE", u, emails) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} diff --git a/vendor/github.com/google/go-github/v27/github/users_followers.go b/vendor/github.com/google/go-github/v27/github/users_followers.go deleted file mode 100644 index c2224096a623..000000000000 --- a/vendor/github.com/google/go-github/v27/github/users_followers.go +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright 2013 The go-github 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 - -import ( - "context" - "fmt" -) - -// ListFollowers lists the followers for a user. Passing the empty string will -// fetch followers for the authenticated user. -// -// GitHub API docs: https://developer.github.com/v3/users/followers/#list-followers-of-a-user -func (s *UsersService) ListFollowers(ctx context.Context, user string, opt *ListOptions) ([]*User, *Response, error) { - var u string - if user != "" { - u = fmt.Sprintf("users/%v/followers", user) - } else { - u = "user/followers" - } - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var users []*User - resp, err := s.client.Do(ctx, req, &users) - if err != nil { - return nil, resp, err - } - - return users, resp, nil -} - -// ListFollowing lists the people that a user is following. Passing the empty -// string will list people the authenticated user is following. -// -// GitHub API docs: https://developer.github.com/v3/users/followers/#list-users-followed-by-another-user -func (s *UsersService) ListFollowing(ctx context.Context, user string, opt *ListOptions) ([]*User, *Response, error) { - var u string - if user != "" { - u = fmt.Sprintf("users/%v/following", user) - } else { - u = "user/following" - } - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var users []*User - resp, err := s.client.Do(ctx, req, &users) - if err != nil { - return nil, resp, err - } - - return users, resp, nil -} - -// IsFollowing checks if "user" is following "target". Passing the empty -// string for "user" will check if the authenticated user is following "target". -// -// GitHub API docs: https://developer.github.com/v3/users/followers/#check-if-you-are-following-a-user -func (s *UsersService) IsFollowing(ctx context.Context, user, target string) (bool, *Response, error) { - var u string - if user != "" { - u = fmt.Sprintf("users/%v/following/%v", user, target) - } else { - u = fmt.Sprintf("user/following/%v", target) - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return false, nil, err - } - - resp, err := s.client.Do(ctx, req, nil) - following, err := parseBoolResponse(err) - return following, resp, err -} - -// Follow will cause the authenticated user to follow the specified user. -// -// GitHub API docs: https://developer.github.com/v3/users/followers/#follow-a-user -func (s *UsersService) Follow(ctx context.Context, user string) (*Response, error) { - u := fmt.Sprintf("user/following/%v", user) - req, err := s.client.NewRequest("PUT", u, nil) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} - -// Unfollow will cause the authenticated user to unfollow the specified user. -// -// GitHub API docs: https://developer.github.com/v3/users/followers/#unfollow-a-user -func (s *UsersService) Unfollow(ctx context.Context, user string) (*Response, error) { - u := fmt.Sprintf("user/following/%v", user) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} diff --git a/vendor/github.com/google/go-github/v27/github/users_gpg_keys.go b/vendor/github.com/google/go-github/v27/github/users_gpg_keys.go deleted file mode 100644 index 07ed38dcbef5..000000000000 --- a/vendor/github.com/google/go-github/v27/github/users_gpg_keys.go +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright 2016 The go-github 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 - -import ( - "context" - "fmt" - "time" -) - -// GPGKey represents a GitHub user's public GPG key used to verify GPG signed commits and tags. -// -// https://developer.github.com/changes/2016-04-04-git-signing-api-preview/ -type GPGKey struct { - ID *int64 `json:"id,omitempty"` - PrimaryKeyID *int64 `json:"primary_key_id,omitempty"` - KeyID *string `json:"key_id,omitempty"` - PublicKey *string `json:"public_key,omitempty"` - Emails []GPGEmail `json:"emails,omitempty"` - Subkeys []GPGKey `json:"subkeys,omitempty"` - CanSign *bool `json:"can_sign,omitempty"` - CanEncryptComms *bool `json:"can_encrypt_comms,omitempty"` - CanEncryptStorage *bool `json:"can_encrypt_storage,omitempty"` - CanCertify *bool `json:"can_certify,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - ExpiresAt *time.Time `json:"expires_at,omitempty"` -} - -// String stringifies a GPGKey. -func (k GPGKey) String() string { - return Stringify(k) -} - -// GPGEmail represents an email address associated to a GPG key. -type GPGEmail struct { - Email *string `json:"email,omitempty"` - Verified *bool `json:"verified,omitempty"` -} - -// ListGPGKeys lists the public GPG keys for a user. Passing the empty -// string will fetch keys for the authenticated user. It requires authentication -// via Basic Auth or via OAuth with at least read:gpg_key scope. -// -// GitHub API docs: https://developer.github.com/v3/users/gpg_keys/#list-gpg-keys-for-a-user -func (s *UsersService) ListGPGKeys(ctx context.Context, user string, opt *ListOptions) ([]*GPGKey, *Response, error) { - var u string - if user != "" { - u = fmt.Sprintf("users/%v/gpg_keys", user) - } else { - u = "user/gpg_keys" - } - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var keys []*GPGKey - resp, err := s.client.Do(ctx, req, &keys) - if err != nil { - return nil, resp, err - } - - return keys, resp, nil -} - -// GetGPGKey gets extended details for a single GPG key. It requires authentication -// via Basic Auth or via OAuth with at least read:gpg_key scope. -// -// GitHub API docs: https://developer.github.com/v3/users/gpg_keys/#get-a-single-gpg-key -func (s *UsersService) GetGPGKey(ctx context.Context, id int64) (*GPGKey, *Response, error) { - u := fmt.Sprintf("user/gpg_keys/%v", id) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - key := &GPGKey{} - resp, err := s.client.Do(ctx, req, key) - if err != nil { - return nil, resp, err - } - - return key, resp, nil -} - -// CreateGPGKey creates a GPG key. It requires authenticatation via Basic Auth -// or OAuth with at least write:gpg_key scope. -// -// GitHub API docs: https://developer.github.com/v3/users/gpg_keys/#create-a-gpg-key -func (s *UsersService) CreateGPGKey(ctx context.Context, armoredPublicKey string) (*GPGKey, *Response, error) { - gpgKey := &struct { - ArmoredPublicKey string `json:"armored_public_key"` - }{ArmoredPublicKey: armoredPublicKey} - req, err := s.client.NewRequest("POST", "user/gpg_keys", gpgKey) - if err != nil { - return nil, nil, err - } - - key := &GPGKey{} - resp, err := s.client.Do(ctx, req, key) - if err != nil { - return nil, resp, err - } - - return key, resp, nil -} - -// DeleteGPGKey deletes a GPG key. It requires authentication via Basic Auth or -// via OAuth with at least admin:gpg_key scope. -// -// GitHub API docs: https://developer.github.com/v3/users/gpg_keys/#delete-a-gpg-key -func (s *UsersService) DeleteGPGKey(ctx context.Context, id int64) (*Response, error) { - u := fmt.Sprintf("user/gpg_keys/%v", id) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} diff --git a/vendor/github.com/google/go-github/v27/github/users_keys.go b/vendor/github.com/google/go-github/v27/github/users_keys.go deleted file mode 100644 index 39a4f54d6c29..000000000000 --- a/vendor/github.com/google/go-github/v27/github/users_keys.go +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright 2013 The go-github 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 - -import ( - "context" - "fmt" -) - -// Key represents a public SSH key used to authenticate a user or deploy script. -type Key struct { - ID *int64 `json:"id,omitempty"` - Key *string `json:"key,omitempty"` - URL *string `json:"url,omitempty"` - Title *string `json:"title,omitempty"` - ReadOnly *bool `json:"read_only,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` -} - -func (k Key) String() string { - return Stringify(k) -} - -// ListKeys lists the verified public keys for a user. Passing the empty -// string will fetch keys for the authenticated user. -// -// GitHub API docs: https://developer.github.com/v3/users/keys/#list-public-keys-for-a-user -func (s *UsersService) ListKeys(ctx context.Context, user string, opt *ListOptions) ([]*Key, *Response, error) { - var u string - if user != "" { - u = fmt.Sprintf("users/%v/keys", user) - } else { - u = "user/keys" - } - u, err := addOptions(u, opt) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var keys []*Key - resp, err := s.client.Do(ctx, req, &keys) - if err != nil { - return nil, resp, err - } - - return keys, resp, nil -} - -// GetKey fetches a single public key. -// -// GitHub API docs: https://developer.github.com/v3/users/keys/#get-a-single-public-key -func (s *UsersService) GetKey(ctx context.Context, id int64) (*Key, *Response, error) { - u := fmt.Sprintf("user/keys/%v", id) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - key := new(Key) - resp, err := s.client.Do(ctx, req, key) - if err != nil { - return nil, resp, err - } - - return key, resp, nil -} - -// CreateKey adds a public key for the authenticated user. -// -// GitHub API docs: https://developer.github.com/v3/users/keys/#create-a-public-key -func (s *UsersService) CreateKey(ctx context.Context, key *Key) (*Key, *Response, error) { - u := "user/keys" - - req, err := s.client.NewRequest("POST", u, key) - if err != nil { - return nil, nil, err - } - - k := new(Key) - resp, err := s.client.Do(ctx, req, k) - if err != nil { - return nil, resp, err - } - - return k, resp, nil -} - -// DeleteKey deletes a public key. -// -// GitHub API docs: https://developer.github.com/v3/users/keys/#delete-a-public-key -func (s *UsersService) DeleteKey(ctx context.Context, id int64) (*Response, error) { - u := fmt.Sprintf("user/keys/%v", id) - - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} diff --git a/vendor/github.com/google/go-github/v27/github/with_appengine.go b/vendor/github.com/google/go-github/v27/github/with_appengine.go deleted file mode 100644 index 59ce26b2ea37..000000000000 --- a/vendor/github.com/google/go-github/v27/github/with_appengine.go +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2017 The go-github 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 provides glue for making github work on App Engine. - -package github - -import ( - "context" - "net/http" -) - -func withContext(ctx context.Context, req *http.Request) *http.Request { - // No-op because App Engine adds context to a request differently. - return req -} diff --git a/vendor/github.com/google/go-github/v27/github/without_appengine.go b/vendor/github.com/google/go-github/v27/github/without_appengine.go deleted file mode 100644 index 6f8fdac56030..000000000000 --- a/vendor/github.com/google/go-github/v27/github/without_appengine.go +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2017 The go-github 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 provides glue for making github work without App Engine. - -package github - -import ( - "context" - "net/http" -) - -func withContext(ctx context.Context, req *http.Request) *http.Request { - return req.WithContext(ctx) -} diff --git a/vendor/github.com/google/go-querystring/LICENSE b/vendor/github.com/google/go-querystring/LICENSE deleted file mode 100644 index ae121a1e46df..000000000000 --- a/vendor/github.com/google/go-querystring/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2013 Google. 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/go-querystring/query/encode.go b/vendor/github.com/google/go-querystring/query/encode.go deleted file mode 100644 index 37080b19b5d9..000000000000 --- a/vendor/github.com/google/go-querystring/query/encode.go +++ /dev/null @@ -1,320 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package query implements encoding of structs into URL query parameters. -// -// As a simple example: -// -// type Options struct { -// Query string `url:"q"` -// ShowAll bool `url:"all"` -// Page int `url:"page"` -// } -// -// opt := Options{ "foo", true, 2 } -// v, _ := query.Values(opt) -// fmt.Print(v.Encode()) // will output: "q=foo&all=true&page=2" -// -// The exact mapping between Go values and url.Values is described in the -// documentation for the Values() function. -package query - -import ( - "bytes" - "fmt" - "net/url" - "reflect" - "strconv" - "strings" - "time" -) - -var timeType = reflect.TypeOf(time.Time{}) - -var encoderType = reflect.TypeOf(new(Encoder)).Elem() - -// Encoder is an interface implemented by any type that wishes to encode -// itself into URL values in a non-standard way. -type Encoder interface { - EncodeValues(key string, v *url.Values) error -} - -// Values returns the url.Values encoding of v. -// -// Values expects to be passed a struct, and traverses it recursively using the -// following encoding rules. -// -// Each exported struct field is encoded as a URL parameter unless -// -// - the field's tag is "-", or -// - the field is empty and its tag specifies the "omitempty" option -// -// The empty values are false, 0, any nil pointer or interface value, any array -// slice, map, or string of length zero, and any time.Time that returns true -// for IsZero(). -// -// The URL parameter name defaults to the struct field name but can be -// specified in the struct field's tag value. The "url" key in the struct -// field's tag value is the key name, followed by an optional comma and -// options. For example: -// -// // Field is ignored by this package. -// Field int `url:"-"` -// -// // Field appears as URL parameter "myName". -// Field int `url:"myName"` -// -// // Field appears as URL parameter "myName" and the field is omitted if -// // its value is empty -// Field int `url:"myName,omitempty"` -// -// // Field appears as URL parameter "Field" (the default), but the field -// // is skipped if empty. Note the leading comma. -// Field int `url:",omitempty"` -// -// For encoding individual field values, the following type-dependent rules -// apply: -// -// Boolean values default to encoding as the strings "true" or "false". -// Including the "int" option signals that the field should be encoded as the -// strings "1" or "0". -// -// time.Time values default to encoding as RFC3339 timestamps. Including the -// "unix" option signals that the field should be encoded as a Unix time (see -// time.Unix()) -// -// Slice and Array values default to encoding as multiple URL values of the -// same name. Including the "comma" option signals that the field should be -// encoded as a single comma-delimited value. Including the "space" option -// similarly encodes the value as a single space-delimited string. Including -// the "semicolon" option will encode the value as a semicolon-delimited string. -// Including the "brackets" option signals that the multiple URL values should -// have "[]" appended to the value name. "numbered" will append a number to -// the end of each incidence of the value name, example: -// name0=value0&name1=value1, etc. -// -// Anonymous struct fields are usually encoded as if their inner exported -// fields were fields in the outer struct, subject to the standard Go -// visibility rules. An anonymous struct field with a name given in its URL -// tag is treated as having that name, rather than being anonymous. -// -// Non-nil pointer values are encoded as the value pointed to. -// -// Nested structs are encoded including parent fields in value names for -// scoping. e.g: -// -// "user[name]=acme&user[addr][postcode]=1234&user[addr][city]=SFO" -// -// All other values are encoded using their default string representation. -// -// Multiple fields that encode to the same URL parameter name will be included -// as multiple URL values of the same name. -func Values(v interface{}) (url.Values, error) { - values := make(url.Values) - val := reflect.ValueOf(v) - for val.Kind() == reflect.Ptr { - if val.IsNil() { - return values, nil - } - val = val.Elem() - } - - if v == nil { - return values, nil - } - - if val.Kind() != reflect.Struct { - return nil, fmt.Errorf("query: Values() expects struct input. Got %v", val.Kind()) - } - - err := reflectValue(values, val, "") - return values, err -} - -// reflectValue populates the values parameter from the struct fields in val. -// Embedded structs are followed recursively (using the rules defined in the -// Values function documentation) breadth-first. -func reflectValue(values url.Values, val reflect.Value, scope string) error { - var embedded []reflect.Value - - typ := val.Type() - for i := 0; i < typ.NumField(); i++ { - sf := typ.Field(i) - if sf.PkgPath != "" && !sf.Anonymous { // unexported - continue - } - - sv := val.Field(i) - tag := sf.Tag.Get("url") - if tag == "-" { - continue - } - name, opts := parseTag(tag) - if name == "" { - if sf.Anonymous && sv.Kind() == reflect.Struct { - // save embedded struct for later processing - embedded = append(embedded, sv) - continue - } - - name = sf.Name - } - - if scope != "" { - name = scope + "[" + name + "]" - } - - if opts.Contains("omitempty") && isEmptyValue(sv) { - continue - } - - if sv.Type().Implements(encoderType) { - if !reflect.Indirect(sv).IsValid() { - sv = reflect.New(sv.Type().Elem()) - } - - m := sv.Interface().(Encoder) - if err := m.EncodeValues(name, &values); err != nil { - return err - } - continue - } - - if sv.Kind() == reflect.Slice || sv.Kind() == reflect.Array { - var del byte - if opts.Contains("comma") { - del = ',' - } else if opts.Contains("space") { - del = ' ' - } else if opts.Contains("semicolon") { - del = ';' - } else if opts.Contains("brackets") { - name = name + "[]" - } - - if del != 0 { - s := new(bytes.Buffer) - first := true - for i := 0; i < sv.Len(); i++ { - if first { - first = false - } else { - s.WriteByte(del) - } - s.WriteString(valueString(sv.Index(i), opts)) - } - values.Add(name, s.String()) - } else { - for i := 0; i < sv.Len(); i++ { - k := name - if opts.Contains("numbered") { - k = fmt.Sprintf("%s%d", name, i) - } - values.Add(k, valueString(sv.Index(i), opts)) - } - } - continue - } - - for sv.Kind() == reflect.Ptr { - if sv.IsNil() { - break - } - sv = sv.Elem() - } - - if sv.Type() == timeType { - values.Add(name, valueString(sv, opts)) - continue - } - - if sv.Kind() == reflect.Struct { - reflectValue(values, sv, name) - continue - } - - values.Add(name, valueString(sv, opts)) - } - - for _, f := range embedded { - if err := reflectValue(values, f, scope); err != nil { - return err - } - } - - return nil -} - -// valueString returns the string representation of a value. -func valueString(v reflect.Value, opts tagOptions) string { - for v.Kind() == reflect.Ptr { - if v.IsNil() { - return "" - } - v = v.Elem() - } - - if v.Kind() == reflect.Bool && opts.Contains("int") { - if v.Bool() { - return "1" - } - return "0" - } - - if v.Type() == timeType { - t := v.Interface().(time.Time) - if opts.Contains("unix") { - return strconv.FormatInt(t.Unix(), 10) - } - return t.Format(time.RFC3339) - } - - return fmt.Sprint(v.Interface()) -} - -// isEmptyValue checks if a value should be considered empty for the purposes -// of omitting fields with the "omitempty" option. -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() == timeType { - return v.Interface().(time.Time).IsZero() - } - - return false -} - -// tagOptions is the string following a comma in a struct field's "url" tag, or -// the empty string. It does not include the leading comma. -type tagOptions []string - -// parseTag splits a struct field's url tag into its name and comma-separated -// options. -func parseTag(tag string) (string, tagOptions) { - s := strings.Split(tag, ",") - return s[0], s[1:] -} - -// Contains checks whether the tagOptions contains the specified option. -func (o tagOptions) Contains(option string) bool { - for _, s := range o { - if s == option { - return true - } - } - return false -} diff --git a/vendor/github.com/google/mako/LICENSE b/vendor/github.com/google/mako/LICENSE deleted file mode 100644 index fef7d967815b..000000000000 --- a/vendor/github.com/google/mako/LICENSE +++ /dev/null @@ -1,204 +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. - - \ No newline at end of file diff --git a/vendor/github.com/google/mako/clients/proto/analyzers/threshold_analyzer_go_proto/threshold_analyzer.pb.go b/vendor/github.com/google/mako/clients/proto/analyzers/threshold_analyzer_go_proto/threshold_analyzer.pb.go deleted file mode 100644 index 7f9845410ab6..000000000000 --- a/vendor/github.com/google/mako/clients/proto/analyzers/threshold_analyzer_go_proto/threshold_analyzer.pb.go +++ /dev/null @@ -1,420 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: clients/proto/analyzers/threshold_analyzer.proto - -package mako_analyzers_threshold_analyzer - -import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - mako_go_proto "github.com/google/mako/spec/proto/mako_go_proto" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type ThresholdConfig struct { - Min *float64 `protobuf:"fixed64,1,opt,name=min" json:"min,omitempty"` - Max *float64 `protobuf:"fixed64,2,opt,name=max" json:"max,omitempty"` - OutlierPercentMax *float64 `protobuf:"fixed64,3,opt,name=outlier_percent_max,json=outlierPercentMax" json:"outlier_percent_max,omitempty"` - DataFilter *mako_go_proto.DataFilter `protobuf:"bytes,4,opt,name=data_filter,json=dataFilter" json:"data_filter,omitempty"` - ConfigName *string `protobuf:"bytes,5,opt,name=config_name,json=configName" json:"config_name,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ThresholdConfig) Reset() { *m = ThresholdConfig{} } -func (m *ThresholdConfig) String() string { return proto.CompactTextString(m) } -func (*ThresholdConfig) ProtoMessage() {} -func (*ThresholdConfig) Descriptor() ([]byte, []int) { - return fileDescriptor_efc166777e6a25c0, []int{0} -} - -func (m *ThresholdConfig) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ThresholdConfig.Unmarshal(m, b) -} -func (m *ThresholdConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ThresholdConfig.Marshal(b, m, deterministic) -} -func (m *ThresholdConfig) XXX_Merge(src proto.Message) { - xxx_messageInfo_ThresholdConfig.Merge(m, src) -} -func (m *ThresholdConfig) XXX_Size() int { - return xxx_messageInfo_ThresholdConfig.Size(m) -} -func (m *ThresholdConfig) XXX_DiscardUnknown() { - xxx_messageInfo_ThresholdConfig.DiscardUnknown(m) -} - -var xxx_messageInfo_ThresholdConfig proto.InternalMessageInfo - -func (m *ThresholdConfig) GetMin() float64 { - if m != nil && m.Min != nil { - return *m.Min - } - return 0 -} - -func (m *ThresholdConfig) GetMax() float64 { - if m != nil && m.Max != nil { - return *m.Max - } - return 0 -} - -func (m *ThresholdConfig) GetOutlierPercentMax() float64 { - if m != nil && m.OutlierPercentMax != nil { - return *m.OutlierPercentMax - } - return 0 -} - -func (m *ThresholdConfig) GetDataFilter() *mako_go_proto.DataFilter { - if m != nil { - return m.DataFilter - } - return nil -} - -func (m *ThresholdConfig) GetConfigName() string { - if m != nil && m.ConfigName != nil { - return *m.ConfigName - } - return "" -} - -type CrossRunConfig struct { - RunInfoQueryList []*mako_go_proto.RunInfoQuery `protobuf:"bytes,1,rep,name=run_info_query_list,json=runInfoQueryList" json:"run_info_query_list,omitempty"` - MinRunCount *int32 `protobuf:"varint,3,opt,name=min_run_count,json=minRunCount" json:"min_run_count,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CrossRunConfig) Reset() { *m = CrossRunConfig{} } -func (m *CrossRunConfig) String() string { return proto.CompactTextString(m) } -func (*CrossRunConfig) ProtoMessage() {} -func (*CrossRunConfig) Descriptor() ([]byte, []int) { - return fileDescriptor_efc166777e6a25c0, []int{1} -} - -func (m *CrossRunConfig) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CrossRunConfig.Unmarshal(m, b) -} -func (m *CrossRunConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CrossRunConfig.Marshal(b, m, deterministic) -} -func (m *CrossRunConfig) XXX_Merge(src proto.Message) { - xxx_messageInfo_CrossRunConfig.Merge(m, src) -} -func (m *CrossRunConfig) XXX_Size() int { - return xxx_messageInfo_CrossRunConfig.Size(m) -} -func (m *CrossRunConfig) XXX_DiscardUnknown() { - xxx_messageInfo_CrossRunConfig.DiscardUnknown(m) -} - -var xxx_messageInfo_CrossRunConfig proto.InternalMessageInfo - -func (m *CrossRunConfig) GetRunInfoQueryList() []*mako_go_proto.RunInfoQuery { - if m != nil { - return m.RunInfoQueryList - } - return nil -} - -func (m *CrossRunConfig) GetMinRunCount() int32 { - if m != nil && m.MinRunCount != nil { - return *m.MinRunCount - } - return 0 -} - -type ThresholdAnalyzerInput struct { - Configs []*ThresholdConfig `protobuf:"bytes,1,rep,name=configs" json:"configs,omitempty"` - Name *string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"` - HistoricalContextTags []string `protobuf:"bytes,3,rep,name=historical_context_tags,json=historicalContextTags" json:"historical_context_tags,omitempty"` - CrossRunConfig *CrossRunConfig `protobuf:"bytes,4,opt,name=cross_run_config,json=crossRunConfig" json:"cross_run_config,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ThresholdAnalyzerInput) Reset() { *m = ThresholdAnalyzerInput{} } -func (m *ThresholdAnalyzerInput) String() string { return proto.CompactTextString(m) } -func (*ThresholdAnalyzerInput) ProtoMessage() {} -func (*ThresholdAnalyzerInput) Descriptor() ([]byte, []int) { - return fileDescriptor_efc166777e6a25c0, []int{2} -} - -func (m *ThresholdAnalyzerInput) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ThresholdAnalyzerInput.Unmarshal(m, b) -} -func (m *ThresholdAnalyzerInput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ThresholdAnalyzerInput.Marshal(b, m, deterministic) -} -func (m *ThresholdAnalyzerInput) XXX_Merge(src proto.Message) { - xxx_messageInfo_ThresholdAnalyzerInput.Merge(m, src) -} -func (m *ThresholdAnalyzerInput) XXX_Size() int { - return xxx_messageInfo_ThresholdAnalyzerInput.Size(m) -} -func (m *ThresholdAnalyzerInput) XXX_DiscardUnknown() { - xxx_messageInfo_ThresholdAnalyzerInput.DiscardUnknown(m) -} - -var xxx_messageInfo_ThresholdAnalyzerInput proto.InternalMessageInfo - -func (m *ThresholdAnalyzerInput) GetConfigs() []*ThresholdConfig { - if m != nil { - return m.Configs - } - return nil -} - -func (m *ThresholdAnalyzerInput) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *ThresholdAnalyzerInput) GetHistoricalContextTags() []string { - if m != nil { - return m.HistoricalContextTags - } - return nil -} - -func (m *ThresholdAnalyzerInput) GetCrossRunConfig() *CrossRunConfig { - if m != nil { - return m.CrossRunConfig - } - return nil -} - -type ThresholdAnalyzerOutput struct { - ConfigResults []*ThresholdConfigResult `protobuf:"bytes,1,rep,name=config_results,json=configResults" json:"config_results,omitempty"` - MinTimestampMs *float64 `protobuf:"fixed64,2,opt,name=min_timestamp_ms,json=minTimestampMs" json:"min_timestamp_ms,omitempty"` - MaxTimestampMs *float64 `protobuf:"fixed64,3,opt,name=max_timestamp_ms,json=maxTimestampMs" json:"max_timestamp_ms,omitempty"` - MinBuildId *float64 `protobuf:"fixed64,4,opt,name=min_build_id,json=minBuildId" json:"min_build_id,omitempty"` - MaxBuildId *float64 `protobuf:"fixed64,5,opt,name=max_build_id,json=maxBuildId" json:"max_build_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ThresholdAnalyzerOutput) Reset() { *m = ThresholdAnalyzerOutput{} } -func (m *ThresholdAnalyzerOutput) String() string { return proto.CompactTextString(m) } -func (*ThresholdAnalyzerOutput) ProtoMessage() {} -func (*ThresholdAnalyzerOutput) Descriptor() ([]byte, []int) { - return fileDescriptor_efc166777e6a25c0, []int{3} -} - -func (m *ThresholdAnalyzerOutput) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ThresholdAnalyzerOutput.Unmarshal(m, b) -} -func (m *ThresholdAnalyzerOutput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ThresholdAnalyzerOutput.Marshal(b, m, deterministic) -} -func (m *ThresholdAnalyzerOutput) XXX_Merge(src proto.Message) { - xxx_messageInfo_ThresholdAnalyzerOutput.Merge(m, src) -} -func (m *ThresholdAnalyzerOutput) XXX_Size() int { - return xxx_messageInfo_ThresholdAnalyzerOutput.Size(m) -} -func (m *ThresholdAnalyzerOutput) XXX_DiscardUnknown() { - xxx_messageInfo_ThresholdAnalyzerOutput.DiscardUnknown(m) -} - -var xxx_messageInfo_ThresholdAnalyzerOutput proto.InternalMessageInfo - -func (m *ThresholdAnalyzerOutput) GetConfigResults() []*ThresholdConfigResult { - if m != nil { - return m.ConfigResults - } - return nil -} - -func (m *ThresholdAnalyzerOutput) GetMinTimestampMs() float64 { - if m != nil && m.MinTimestampMs != nil { - return *m.MinTimestampMs - } - return 0 -} - -func (m *ThresholdAnalyzerOutput) GetMaxTimestampMs() float64 { - if m != nil && m.MaxTimestampMs != nil { - return *m.MaxTimestampMs - } - return 0 -} - -func (m *ThresholdAnalyzerOutput) GetMinBuildId() float64 { - if m != nil && m.MinBuildId != nil { - return *m.MinBuildId - } - return 0 -} - -func (m *ThresholdAnalyzerOutput) GetMaxBuildId() float64 { - if m != nil && m.MaxBuildId != nil { - return *m.MaxBuildId - } - return 0 -} - -type ThresholdConfigResult struct { - PercentAboveMax *float64 `protobuf:"fixed64,1,opt,name=percent_above_max,json=percentAboveMax" json:"percent_above_max,omitempty"` - PercentBelowMin *float64 `protobuf:"fixed64,2,opt,name=percent_below_min,json=percentBelowMin" json:"percent_below_min,omitempty"` - ValueOutsideThreshold *float64 `protobuf:"fixed64,3,opt,name=value_outside_threshold,json=valueOutsideThreshold" json:"value_outside_threshold,omitempty"` - MetricLabel *string `protobuf:"bytes,4,opt,name=metric_label,json=metricLabel" json:"metric_label,omitempty"` - Config *ThresholdConfig `protobuf:"bytes,5,opt,name=config" json:"config,omitempty"` - Regression *bool `protobuf:"varint,6,opt,name=regression" json:"regression,omitempty"` - CrossRunConfigExercised *bool `protobuf:"varint,7,opt,name=cross_run_config_exercised,json=crossRunConfigExercised,def=0" json:"cross_run_config_exercised,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ThresholdConfigResult) Reset() { *m = ThresholdConfigResult{} } -func (m *ThresholdConfigResult) String() string { return proto.CompactTextString(m) } -func (*ThresholdConfigResult) ProtoMessage() {} -func (*ThresholdConfigResult) Descriptor() ([]byte, []int) { - return fileDescriptor_efc166777e6a25c0, []int{4} -} - -func (m *ThresholdConfigResult) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ThresholdConfigResult.Unmarshal(m, b) -} -func (m *ThresholdConfigResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ThresholdConfigResult.Marshal(b, m, deterministic) -} -func (m *ThresholdConfigResult) XXX_Merge(src proto.Message) { - xxx_messageInfo_ThresholdConfigResult.Merge(m, src) -} -func (m *ThresholdConfigResult) XXX_Size() int { - return xxx_messageInfo_ThresholdConfigResult.Size(m) -} -func (m *ThresholdConfigResult) XXX_DiscardUnknown() { - xxx_messageInfo_ThresholdConfigResult.DiscardUnknown(m) -} - -var xxx_messageInfo_ThresholdConfigResult proto.InternalMessageInfo - -const Default_ThresholdConfigResult_CrossRunConfigExercised bool = false - -func (m *ThresholdConfigResult) GetPercentAboveMax() float64 { - if m != nil && m.PercentAboveMax != nil { - return *m.PercentAboveMax - } - return 0 -} - -func (m *ThresholdConfigResult) GetPercentBelowMin() float64 { - if m != nil && m.PercentBelowMin != nil { - return *m.PercentBelowMin - } - return 0 -} - -func (m *ThresholdConfigResult) GetValueOutsideThreshold() float64 { - if m != nil && m.ValueOutsideThreshold != nil { - return *m.ValueOutsideThreshold - } - return 0 -} - -func (m *ThresholdConfigResult) GetMetricLabel() string { - if m != nil && m.MetricLabel != nil { - return *m.MetricLabel - } - return "" -} - -func (m *ThresholdConfigResult) GetConfig() *ThresholdConfig { - if m != nil { - return m.Config - } - return nil -} - -func (m *ThresholdConfigResult) GetRegression() bool { - if m != nil && m.Regression != nil { - return *m.Regression - } - return false -} - -func (m *ThresholdConfigResult) GetCrossRunConfigExercised() bool { - if m != nil && m.CrossRunConfigExercised != nil { - return *m.CrossRunConfigExercised - } - return Default_ThresholdConfigResult_CrossRunConfigExercised -} - -func init() { - proto.RegisterType((*ThresholdConfig)(nil), "mako.analyzers.threshold_analyzer.ThresholdConfig") - proto.RegisterType((*CrossRunConfig)(nil), "mako.analyzers.threshold_analyzer.CrossRunConfig") - proto.RegisterType((*ThresholdAnalyzerInput)(nil), "mako.analyzers.threshold_analyzer.ThresholdAnalyzerInput") - proto.RegisterType((*ThresholdAnalyzerOutput)(nil), "mako.analyzers.threshold_analyzer.ThresholdAnalyzerOutput") - proto.RegisterType((*ThresholdConfigResult)(nil), "mako.analyzers.threshold_analyzer.ThresholdConfigResult") -} - -func init() { - proto.RegisterFile("clients/proto/analyzers/threshold_analyzer.proto", fileDescriptor_efc166777e6a25c0) -} - -var fileDescriptor_efc166777e6a25c0 = []byte{ - // 654 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x93, 0xcf, 0x4e, 0x1b, 0x31, - 0x10, 0xc6, 0xb5, 0x09, 0xe1, 0xcf, 0x04, 0x42, 0x30, 0x4a, 0x59, 0x71, 0x68, 0x43, 0x4e, 0x51, - 0x0f, 0x4b, 0xe1, 0x50, 0x55, 0xbd, 0x01, 0x6d, 0x25, 0x10, 0x94, 0xd6, 0xe2, 0xd6, 0x83, 0xe5, - 0xec, 0x3a, 0xc1, 0xaa, 0xd7, 0x4e, 0x6d, 0x2f, 0x5d, 0x2a, 0xf5, 0x19, 0x2a, 0xf5, 0x6d, 0xfa, - 0x6a, 0x3d, 0x55, 0xf6, 0x7a, 0x43, 0x02, 0x95, 0x5a, 0x71, 0xb3, 0xbf, 0xf9, 0x69, 0x3c, 0xfe, - 0x66, 0x06, 0x5e, 0xa4, 0x82, 0x33, 0x69, 0xcd, 0xfe, 0x54, 0x2b, 0xab, 0xf6, 0xa9, 0xa4, 0xe2, - 0xf6, 0x1b, 0xd3, 0x66, 0xdf, 0x5e, 0x6b, 0x66, 0xae, 0x95, 0xc8, 0x48, 0xad, 0x25, 0x1e, 0x41, - 0x7b, 0x39, 0xfd, 0xac, 0x92, 0x19, 0x98, 0x3c, 0x04, 0x77, 0x7b, 0x66, 0xca, 0xd2, 0x90, 0xd1, - 0xd3, 0xfe, 0x38, 0xf8, 0x15, 0xc1, 0xe6, 0x55, 0x4d, 0x9f, 0x28, 0x39, 0xe6, 0x13, 0xd4, 0x85, - 0x66, 0xce, 0x65, 0x1c, 0xf5, 0xa3, 0x61, 0x84, 0xdd, 0xd1, 0x2b, 0xb4, 0x8c, 0x1b, 0x41, 0xa1, - 0x25, 0x4a, 0x60, 0x5b, 0x15, 0x56, 0x70, 0xa6, 0xc9, 0x94, 0xe9, 0x94, 0x49, 0x4b, 0x1c, 0xd1, - 0xf4, 0xc4, 0x56, 0x08, 0x7d, 0xa8, 0x22, 0x17, 0xb4, 0x44, 0x07, 0xd0, 0xce, 0xa8, 0xa5, 0x64, - 0xcc, 0x85, 0x65, 0x3a, 0x5e, 0xea, 0x47, 0xc3, 0xf6, 0x61, 0x37, 0xf1, 0x95, 0xbc, 0xa1, 0x96, - 0xbe, 0xf3, 0x3a, 0x86, 0x6c, 0x76, 0x46, 0xcf, 0xa0, 0x9d, 0xfa, 0x82, 0x88, 0xa4, 0x39, 0x8b, - 0x5b, 0xfd, 0x68, 0xb8, 0x86, 0xa1, 0x92, 0xde, 0xd3, 0x9c, 0x0d, 0xbe, 0x43, 0xe7, 0x44, 0x2b, - 0x63, 0x70, 0x21, 0x43, 0xe5, 0x47, 0xb0, 0xad, 0x0b, 0x49, 0xb8, 0x1c, 0x2b, 0xf2, 0xa5, 0x60, - 0xfa, 0x96, 0x08, 0x6e, 0x6c, 0x1c, 0xf5, 0x9b, 0xc3, 0xf6, 0x21, 0xaa, 0x5e, 0xc3, 0x85, 0x3c, - 0x95, 0x63, 0xf5, 0xd1, 0x85, 0x71, 0x57, 0xcf, 0xdd, 0xce, 0xb9, 0xb1, 0x68, 0x00, 0x1b, 0x39, - 0x97, 0xc4, 0xa5, 0x49, 0x55, 0x21, 0xad, 0xff, 0x52, 0x0b, 0xb7, 0x73, 0x2e, 0xfd, 0x3b, 0x85, - 0xb4, 0x67, 0x4b, 0xab, 0x8d, 0x6e, 0x73, 0xf0, 0xa3, 0x01, 0x4f, 0x66, 0xd6, 0x1d, 0x05, 0x9f, - 0x4f, 0xe5, 0xb4, 0xb0, 0xe8, 0x1c, 0x56, 0xaa, 0x3a, 0x4d, 0x78, 0xfb, 0x30, 0xf9, 0x67, 0x87, - 0x92, 0x7b, 0x6d, 0xc0, 0x75, 0x0a, 0x84, 0x60, 0xc9, 0x3b, 0xd0, 0xf0, 0x0e, 0xf8, 0x33, 0x7a, - 0x09, 0x3b, 0xd7, 0xdc, 0x58, 0xa5, 0x79, 0x4a, 0x05, 0x49, 0x95, 0xb4, 0xac, 0xb4, 0xc4, 0xd2, - 0x89, 0x89, 0x9b, 0xfd, 0xe6, 0x70, 0x0d, 0xf7, 0xee, 0xc2, 0x27, 0x55, 0xf4, 0x8a, 0x4e, 0x0c, - 0xfa, 0x04, 0xdd, 0xd4, 0x79, 0x16, 0x3e, 0xe8, 0x1e, 0x08, 0xcd, 0x38, 0xf8, 0x8f, 0x12, 0x17, - 0xed, 0xc6, 0x9d, 0x74, 0xe1, 0x3e, 0xf8, 0xd9, 0x80, 0x9d, 0x07, 0x8e, 0x5c, 0x16, 0xd6, 0x59, - 0x42, 0xa0, 0x13, 0xba, 0xa9, 0x99, 0x29, 0x84, 0xad, 0x9d, 0x79, 0xf5, 0x08, 0x67, 0x7c, 0x02, - 0xbc, 0x91, 0xce, 0xdd, 0x0c, 0x1a, 0x42, 0xd7, 0x35, 0xce, 0xf2, 0x9c, 0x19, 0x4b, 0xf3, 0x29, - 0xc9, 0x4d, 0x18, 0xd8, 0x4e, 0xce, 0xe5, 0x55, 0x2d, 0x5f, 0x54, 0x24, 0x2d, 0x17, 0xc9, 0x66, - 0x20, 0x69, 0x39, 0x4f, 0xf6, 0x61, 0xdd, 0xe5, 0x1c, 0x15, 0x5c, 0x64, 0x84, 0x67, 0xde, 0xa9, - 0x08, 0x43, 0xce, 0xe5, 0xb1, 0x93, 0x4e, 0x33, 0x4f, 0xd0, 0xf2, 0x8e, 0x68, 0x05, 0x82, 0x96, - 0x81, 0x18, 0xfc, 0x6e, 0x40, 0xef, 0xaf, 0x1f, 0x40, 0xcf, 0x61, 0xab, 0xde, 0x1d, 0x3a, 0x52, - 0x37, 0xcc, 0x6f, 0x50, 0xb5, 0x75, 0x9b, 0x21, 0x70, 0xe4, 0x74, 0xb7, 0x3f, 0x73, 0xec, 0x88, - 0x09, 0xf5, 0x95, 0xb8, 0x0d, 0x6d, 0x2c, 0xb0, 0xc7, 0x4e, 0xbf, 0xe0, 0xd2, 0xcd, 0xc6, 0x0d, - 0x15, 0x05, 0x23, 0xaa, 0xb0, 0x86, 0x67, 0x8c, 0xcc, 0x2c, 0x0d, 0xdf, 0xec, 0xf9, 0xf0, 0x65, - 0x15, 0x9d, 0xd5, 0x86, 0xf6, 0x60, 0x3d, 0x67, 0x56, 0xf3, 0x94, 0x08, 0x3a, 0x62, 0xc2, 0xff, - 0x76, 0x0d, 0xb7, 0x2b, 0xed, 0xdc, 0x49, 0xe8, 0x0c, 0x96, 0xc3, 0xd0, 0xb4, 0xfc, 0xd0, 0x3c, - 0x66, 0xae, 0x43, 0x06, 0xf4, 0x14, 0x40, 0xb3, 0x89, 0x66, 0xc6, 0x70, 0x25, 0xe3, 0xe5, 0x7e, - 0x34, 0x5c, 0xc5, 0x73, 0x0a, 0x3a, 0x86, 0xdd, 0xfb, 0xa3, 0x4a, 0x58, 0xc9, 0x74, 0xca, 0x0d, - 0xcb, 0xe2, 0x15, 0xc7, 0xbf, 0x6e, 0x8d, 0xa9, 0x30, 0x0c, 0xef, 0x2c, 0x0e, 0xe2, 0xdb, 0x9a, - 0xfa, 0x13, 0x00, 0x00, 0xff, 0xff, 0xda, 0x96, 0x85, 0xd7, 0x4b, 0x05, 0x00, 0x00, -} diff --git a/vendor/github.com/google/mako/clients/proto/analyzers/utest_analyzer_go_proto/utest_analyzer.pb.go b/vendor/github.com/google/mako/clients/proto/analyzers/utest_analyzer_go_proto/utest_analyzer.pb.go deleted file mode 100644 index 4c8d437dd6e5..000000000000 --- a/vendor/github.com/google/mako/clients/proto/analyzers/utest_analyzer_go_proto/utest_analyzer.pb.go +++ /dev/null @@ -1,495 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: clients/proto/analyzers/utest_analyzer.proto - -package mako_utest_analyzer - -import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - mako_go_proto "github.com/google/mako/spec/proto/mako_go_proto" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type UTestConfig_DirectionBias int32 - -const ( - UTestConfig_NO_BIAS UTestConfig_DirectionBias = 0 - UTestConfig_IGNORE_INCREASE UTestConfig_DirectionBias = 1 - UTestConfig_IGNORE_DECREASE UTestConfig_DirectionBias = 2 -) - -var UTestConfig_DirectionBias_name = map[int32]string{ - 0: "NO_BIAS", - 1: "IGNORE_INCREASE", - 2: "IGNORE_DECREASE", -} - -var UTestConfig_DirectionBias_value = map[string]int32{ - "NO_BIAS": 0, - "IGNORE_INCREASE": 1, - "IGNORE_DECREASE": 2, -} - -func (x UTestConfig_DirectionBias) Enum() *UTestConfig_DirectionBias { - p := new(UTestConfig_DirectionBias) - *p = x - return p -} - -func (x UTestConfig_DirectionBias) String() string { - return proto.EnumName(UTestConfig_DirectionBias_name, int32(x)) -} - -func (x *UTestConfig_DirectionBias) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(UTestConfig_DirectionBias_value, data, "UTestConfig_DirectionBias") - if err != nil { - return err - } - *x = UTestConfig_DirectionBias(value) - return nil -} - -func (UTestConfig_DirectionBias) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_e2b697cdbf0773fa, []int{1, 0} -} - -type UTestAnalyzerInput struct { - ASample *UTestSample `protobuf:"bytes,1,opt,name=a_sample,json=aSample" json:"a_sample,omitempty"` - BSample *UTestSample `protobuf:"bytes,2,opt,name=b_sample,json=bSample" json:"b_sample,omitempty"` - ConfigList []*UTestConfig `protobuf:"bytes,3,rep,name=config_list,json=configList" json:"config_list,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 *UTestAnalyzerInput) Reset() { *m = UTestAnalyzerInput{} } -func (m *UTestAnalyzerInput) String() string { return proto.CompactTextString(m) } -func (*UTestAnalyzerInput) ProtoMessage() {} -func (*UTestAnalyzerInput) Descriptor() ([]byte, []int) { - return fileDescriptor_e2b697cdbf0773fa, []int{0} -} - -func (m *UTestAnalyzerInput) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_UTestAnalyzerInput.Unmarshal(m, b) -} -func (m *UTestAnalyzerInput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_UTestAnalyzerInput.Marshal(b, m, deterministic) -} -func (m *UTestAnalyzerInput) XXX_Merge(src proto.Message) { - xxx_messageInfo_UTestAnalyzerInput.Merge(m, src) -} -func (m *UTestAnalyzerInput) XXX_Size() int { - return xxx_messageInfo_UTestAnalyzerInput.Size(m) -} -func (m *UTestAnalyzerInput) XXX_DiscardUnknown() { - xxx_messageInfo_UTestAnalyzerInput.DiscardUnknown(m) -} - -var xxx_messageInfo_UTestAnalyzerInput proto.InternalMessageInfo - -func (m *UTestAnalyzerInput) GetASample() *UTestSample { - if m != nil { - return m.ASample - } - return nil -} - -func (m *UTestAnalyzerInput) GetBSample() *UTestSample { - if m != nil { - return m.BSample - } - return nil -} - -func (m *UTestAnalyzerInput) GetConfigList() []*UTestConfig { - if m != nil { - return m.ConfigList - } - return nil -} - -func (m *UTestAnalyzerInput) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -type UTestConfig struct { - AMetricKey *string `protobuf:"bytes,1,opt,name=a_metric_key,json=aMetricKey" json:"a_metric_key,omitempty"` - ADataFilter *mako_go_proto.DataFilter `protobuf:"bytes,8,opt,name=a_data_filter,json=aDataFilter" json:"a_data_filter,omitempty"` - BMetricKey *string `protobuf:"bytes,2,opt,name=b_metric_key,json=bMetricKey" json:"b_metric_key,omitempty"` - BDataFilter *mako_go_proto.DataFilter `protobuf:"bytes,9,opt,name=b_data_filter,json=bDataFilter" json:"b_data_filter,omitempty"` - ShiftValue *float64 `protobuf:"fixed64,3,opt,name=shift_value,json=shiftValue" json:"shift_value,omitempty"` - RelativeShiftValue *float64 `protobuf:"fixed64,7,opt,name=relative_shift_value,json=relativeShiftValue" json:"relative_shift_value,omitempty"` - DirectionBias *UTestConfig_DirectionBias `protobuf:"varint,4,opt,name=direction_bias,json=directionBias,enum=mako.utest_analyzer.UTestConfig_DirectionBias,def=0" json:"direction_bias,omitempty"` - SignificanceLevel *float64 `protobuf:"fixed64,5,opt,name=significance_level,json=significanceLevel" json:"significance_level,omitempty"` - ConfigName *string `protobuf:"bytes,6,opt,name=config_name,json=configName" json:"config_name,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *UTestConfig) Reset() { *m = UTestConfig{} } -func (m *UTestConfig) String() string { return proto.CompactTextString(m) } -func (*UTestConfig) ProtoMessage() {} -func (*UTestConfig) Descriptor() ([]byte, []int) { - return fileDescriptor_e2b697cdbf0773fa, []int{1} -} - -func (m *UTestConfig) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_UTestConfig.Unmarshal(m, b) -} -func (m *UTestConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_UTestConfig.Marshal(b, m, deterministic) -} -func (m *UTestConfig) XXX_Merge(src proto.Message) { - xxx_messageInfo_UTestConfig.Merge(m, src) -} -func (m *UTestConfig) XXX_Size() int { - return xxx_messageInfo_UTestConfig.Size(m) -} -func (m *UTestConfig) XXX_DiscardUnknown() { - xxx_messageInfo_UTestConfig.DiscardUnknown(m) -} - -var xxx_messageInfo_UTestConfig proto.InternalMessageInfo - -const Default_UTestConfig_DirectionBias UTestConfig_DirectionBias = UTestConfig_NO_BIAS - -func (m *UTestConfig) GetAMetricKey() string { - if m != nil && m.AMetricKey != nil { - return *m.AMetricKey - } - return "" -} - -func (m *UTestConfig) GetADataFilter() *mako_go_proto.DataFilter { - if m != nil { - return m.ADataFilter - } - return nil -} - -func (m *UTestConfig) GetBMetricKey() string { - if m != nil && m.BMetricKey != nil { - return *m.BMetricKey - } - return "" -} - -func (m *UTestConfig) GetBDataFilter() *mako_go_proto.DataFilter { - if m != nil { - return m.BDataFilter - } - return nil -} - -func (m *UTestConfig) GetShiftValue() float64 { - if m != nil && m.ShiftValue != nil { - return *m.ShiftValue - } - return 0 -} - -func (m *UTestConfig) GetRelativeShiftValue() float64 { - if m != nil && m.RelativeShiftValue != nil { - return *m.RelativeShiftValue - } - return 0 -} - -func (m *UTestConfig) GetDirectionBias() UTestConfig_DirectionBias { - if m != nil && m.DirectionBias != nil { - return *m.DirectionBias - } - return Default_UTestConfig_DirectionBias -} - -func (m *UTestConfig) GetSignificanceLevel() float64 { - if m != nil && m.SignificanceLevel != nil { - return *m.SignificanceLevel - } - return 0 -} - -func (m *UTestConfig) GetConfigName() string { - if m != nil && m.ConfigName != nil { - return *m.ConfigName - } - return "" -} - -type UTestSample struct { - RunQueryList []*mako_go_proto.RunInfoQuery `protobuf:"bytes,1,rep,name=run_query_list,json=runQueryList" json:"run_query_list,omitempty"` - IncludeCurrentRun *bool `protobuf:"varint,2,opt,name=include_current_run,json=includeCurrentRun,def=0" json:"include_current_run,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *UTestSample) Reset() { *m = UTestSample{} } -func (m *UTestSample) String() string { return proto.CompactTextString(m) } -func (*UTestSample) ProtoMessage() {} -func (*UTestSample) Descriptor() ([]byte, []int) { - return fileDescriptor_e2b697cdbf0773fa, []int{2} -} - -func (m *UTestSample) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_UTestSample.Unmarshal(m, b) -} -func (m *UTestSample) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_UTestSample.Marshal(b, m, deterministic) -} -func (m *UTestSample) XXX_Merge(src proto.Message) { - xxx_messageInfo_UTestSample.Merge(m, src) -} -func (m *UTestSample) XXX_Size() int { - return xxx_messageInfo_UTestSample.Size(m) -} -func (m *UTestSample) XXX_DiscardUnknown() { - xxx_messageInfo_UTestSample.DiscardUnknown(m) -} - -var xxx_messageInfo_UTestSample proto.InternalMessageInfo - -const Default_UTestSample_IncludeCurrentRun bool = false - -func (m *UTestSample) GetRunQueryList() []*mako_go_proto.RunInfoQuery { - if m != nil { - return m.RunQueryList - } - return nil -} - -func (m *UTestSample) GetIncludeCurrentRun() bool { - if m != nil && m.IncludeCurrentRun != nil { - return *m.IncludeCurrentRun - } - return Default_UTestSample_IncludeCurrentRun -} - -type UTestAnalyzerOutput struct { - Summary *string `protobuf:"bytes,1,opt,name=summary" json:"summary,omitempty"` - ConfigResultList []*UTestConfigResult `protobuf:"bytes,2,rep,name=config_result_list,json=configResultList" json:"config_result_list,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *UTestAnalyzerOutput) Reset() { *m = UTestAnalyzerOutput{} } -func (m *UTestAnalyzerOutput) String() string { return proto.CompactTextString(m) } -func (*UTestAnalyzerOutput) ProtoMessage() {} -func (*UTestAnalyzerOutput) Descriptor() ([]byte, []int) { - return fileDescriptor_e2b697cdbf0773fa, []int{3} -} - -func (m *UTestAnalyzerOutput) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_UTestAnalyzerOutput.Unmarshal(m, b) -} -func (m *UTestAnalyzerOutput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_UTestAnalyzerOutput.Marshal(b, m, deterministic) -} -func (m *UTestAnalyzerOutput) XXX_Merge(src proto.Message) { - xxx_messageInfo_UTestAnalyzerOutput.Merge(m, src) -} -func (m *UTestAnalyzerOutput) XXX_Size() int { - return xxx_messageInfo_UTestAnalyzerOutput.Size(m) -} -func (m *UTestAnalyzerOutput) XXX_DiscardUnknown() { - xxx_messageInfo_UTestAnalyzerOutput.DiscardUnknown(m) -} - -var xxx_messageInfo_UTestAnalyzerOutput proto.InternalMessageInfo - -func (m *UTestAnalyzerOutput) GetSummary() string { - if m != nil && m.Summary != nil { - return *m.Summary - } - return "" -} - -func (m *UTestAnalyzerOutput) GetConfigResultList() []*UTestConfigResult { - if m != nil { - return m.ConfigResultList - } - return nil -} - -type UTestConfigResult struct { - Config *UTestConfig `protobuf:"bytes,5,opt,name=config" json:"config,omitempty"` - AMetricLabel *string `protobuf:"bytes,6,opt,name=a_metric_label,json=aMetricLabel" json:"a_metric_label,omitempty"` - BMetricLabel *string `protobuf:"bytes,7,opt,name=b_metric_label,json=bMetricLabel" json:"b_metric_label,omitempty"` - AMedian *float64 `protobuf:"fixed64,8,opt,name=a_median,json=aMedian" json:"a_median,omitempty"` - BMedian *float64 `protobuf:"fixed64,9,opt,name=b_median,json=bMedian" json:"b_median,omitempty"` - ZStatistic *float64 `protobuf:"fixed64,1,opt,name=z_statistic,json=zStatistic" json:"z_statistic,omitempty"` - PValue *float64 `protobuf:"fixed64,2,opt,name=p_value,json=pValue" json:"p_value,omitempty"` - RegressionFound *bool `protobuf:"varint,3,opt,name=regression_found,json=regressionFound" json:"regression_found,omitempty"` - ConfigName *string `protobuf:"bytes,4,opt,name=config_name,json=configName" json:"config_name,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *UTestConfigResult) Reset() { *m = UTestConfigResult{} } -func (m *UTestConfigResult) String() string { return proto.CompactTextString(m) } -func (*UTestConfigResult) ProtoMessage() {} -func (*UTestConfigResult) Descriptor() ([]byte, []int) { - return fileDescriptor_e2b697cdbf0773fa, []int{4} -} - -func (m *UTestConfigResult) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_UTestConfigResult.Unmarshal(m, b) -} -func (m *UTestConfigResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_UTestConfigResult.Marshal(b, m, deterministic) -} -func (m *UTestConfigResult) XXX_Merge(src proto.Message) { - xxx_messageInfo_UTestConfigResult.Merge(m, src) -} -func (m *UTestConfigResult) XXX_Size() int { - return xxx_messageInfo_UTestConfigResult.Size(m) -} -func (m *UTestConfigResult) XXX_DiscardUnknown() { - xxx_messageInfo_UTestConfigResult.DiscardUnknown(m) -} - -var xxx_messageInfo_UTestConfigResult proto.InternalMessageInfo - -func (m *UTestConfigResult) GetConfig() *UTestConfig { - if m != nil { - return m.Config - } - return nil -} - -func (m *UTestConfigResult) GetAMetricLabel() string { - if m != nil && m.AMetricLabel != nil { - return *m.AMetricLabel - } - return "" -} - -func (m *UTestConfigResult) GetBMetricLabel() string { - if m != nil && m.BMetricLabel != nil { - return *m.BMetricLabel - } - return "" -} - -func (m *UTestConfigResult) GetAMedian() float64 { - if m != nil && m.AMedian != nil { - return *m.AMedian - } - return 0 -} - -func (m *UTestConfigResult) GetBMedian() float64 { - if m != nil && m.BMedian != nil { - return *m.BMedian - } - return 0 -} - -func (m *UTestConfigResult) GetZStatistic() float64 { - if m != nil && m.ZStatistic != nil { - return *m.ZStatistic - } - return 0 -} - -func (m *UTestConfigResult) GetPValue() float64 { - if m != nil && m.PValue != nil { - return *m.PValue - } - return 0 -} - -func (m *UTestConfigResult) GetRegressionFound() bool { - if m != nil && m.RegressionFound != nil { - return *m.RegressionFound - } - return false -} - -func (m *UTestConfigResult) GetConfigName() string { - if m != nil && m.ConfigName != nil { - return *m.ConfigName - } - return "" -} - -func init() { - proto.RegisterEnum("mako.utest_analyzer.UTestConfig_DirectionBias", UTestConfig_DirectionBias_name, UTestConfig_DirectionBias_value) - proto.RegisterType((*UTestAnalyzerInput)(nil), "mako.utest_analyzer.UTestAnalyzerInput") - proto.RegisterType((*UTestConfig)(nil), "mako.utest_analyzer.UTestConfig") - proto.RegisterType((*UTestSample)(nil), "mako.utest_analyzer.UTestSample") - proto.RegisterType((*UTestAnalyzerOutput)(nil), "mako.utest_analyzer.UTestAnalyzerOutput") - proto.RegisterType((*UTestConfigResult)(nil), "mako.utest_analyzer.UTestConfigResult") -} - -func init() { - proto.RegisterFile("clients/proto/analyzers/utest_analyzer.proto", fileDescriptor_e2b697cdbf0773fa) -} - -var fileDescriptor_e2b697cdbf0773fa = []byte{ - // 728 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xdd, 0x4e, 0xdb, 0x30, - 0x14, 0x5e, 0x4a, 0xa1, 0xed, 0x29, 0x94, 0xe2, 0x6e, 0x5a, 0xb7, 0x1b, 0xaa, 0x6a, 0x9a, 0x98, - 0xb4, 0x85, 0x09, 0x0d, 0x09, 0xb1, 0xab, 0x16, 0xca, 0x54, 0x01, 0x65, 0x73, 0xd9, 0x2e, 0x67, - 0x39, 0xa9, 0xd3, 0x59, 0x24, 0x4e, 0x67, 0x3b, 0x48, 0xe5, 0x62, 0x77, 0x93, 0xf6, 0x82, 0x7b, - 0x84, 0xbd, 0xc7, 0x64, 0x27, 0x81, 0x94, 0xfd, 0xc0, 0x9d, 0xfd, 0xfd, 0x9c, 0x38, 0xc7, 0xe7, - 0x33, 0xbc, 0xf4, 0x43, 0xce, 0x84, 0x56, 0xdb, 0x33, 0x19, 0xeb, 0x78, 0x9b, 0x0a, 0x1a, 0xce, - 0xaf, 0x98, 0x54, 0xdb, 0x89, 0x66, 0x4a, 0x93, 0x7c, 0xef, 0x5a, 0x1a, 0xb5, 0x22, 0x7a, 0x11, - 0xbb, 0x8b, 0xd4, 0xd3, 0x47, 0x6a, 0xc6, 0xfc, 0xcc, 0x6f, 0x79, 0xbb, 0xec, 0xfe, 0x72, 0x00, - 0x7d, 0x3c, 0x67, 0x4a, 0xf7, 0x32, 0xe1, 0x50, 0xcc, 0x12, 0x8d, 0xde, 0x42, 0x95, 0x12, 0x45, - 0xa3, 0x59, 0xc8, 0xda, 0x4e, 0xc7, 0xd9, 0xaa, 0xef, 0x74, 0xdc, 0xbf, 0x54, 0x75, 0xad, 0x75, - 0x6c, 0x75, 0xb8, 0x42, 0xd3, 0x85, 0x31, 0x7b, 0xb9, 0xb9, 0x74, 0x5f, 0xb3, 0x97, 0x99, 0x7b, - 0x50, 0xf7, 0x63, 0x11, 0xf0, 0x29, 0x09, 0xb9, 0xd2, 0xed, 0xa5, 0xce, 0xd2, 0xff, 0xfd, 0x07, - 0x56, 0x8c, 0x21, 0x35, 0x9d, 0x70, 0xa5, 0x11, 0x82, 0xb2, 0xa0, 0x11, 0x6b, 0x97, 0x3b, 0xce, - 0x56, 0x0d, 0xdb, 0x75, 0xf7, 0x47, 0x19, 0xea, 0x05, 0x3d, 0xea, 0xc0, 0x2a, 0x25, 0x11, 0xd3, - 0x92, 0xfb, 0xe4, 0x82, 0xcd, 0xed, 0x4f, 0xd6, 0x30, 0xd0, 0x53, 0x0b, 0x1d, 0xb3, 0x39, 0x7a, - 0x03, 0x6b, 0x94, 0x4c, 0xa8, 0xa6, 0x24, 0xe0, 0xa1, 0x66, 0xb2, 0x5d, 0xb5, 0xbf, 0xd2, 0x4c, - 0x8f, 0x72, 0x48, 0x35, 0x3d, 0xb2, 0x38, 0xae, 0xd3, 0x9b, 0x8d, 0xa9, 0xeb, 0x15, 0xeb, 0x96, - 0xd2, 0xba, 0xde, 0x42, 0x5d, 0x6f, 0xa1, 0x6e, 0xed, 0x5f, 0x75, 0xbd, 0x42, 0xdd, 0x4d, 0xa8, - 0xab, 0x2f, 0x3c, 0xd0, 0xe4, 0x92, 0x86, 0x09, 0x6b, 0x2f, 0x75, 0x9c, 0x2d, 0x07, 0x83, 0x85, - 0x3e, 0x19, 0x04, 0xbd, 0x86, 0x87, 0x92, 0x85, 0x54, 0xf3, 0x4b, 0x46, 0x8a, 0xca, 0x8a, 0x55, - 0xa2, 0x9c, 0x1b, 0xdf, 0x38, 0x3e, 0x43, 0x63, 0xc2, 0x25, 0xf3, 0x35, 0x8f, 0x05, 0xf1, 0x38, - 0x55, 0xb6, 0x61, 0x8d, 0x1d, 0xf7, 0xae, 0x66, 0xbb, 0x87, 0xb9, 0xad, 0xcf, 0xa9, 0xda, 0xaf, - 0x8c, 0xce, 0x48, 0x7f, 0xd8, 0x1b, 0xe3, 0xb5, 0x49, 0x11, 0x47, 0xaf, 0x00, 0x29, 0x3e, 0x15, - 0x3c, 0xe0, 0x3e, 0x15, 0x3e, 0x23, 0x21, 0xbb, 0x64, 0x61, 0x7b, 0xd9, 0x9e, 0x67, 0xa3, 0xc8, - 0x9c, 0x18, 0xc2, 0xfc, 0x61, 0x76, 0xf1, 0xf6, 0xf2, 0x56, 0xd2, 0xc6, 0xa5, 0xd0, 0xc8, 0x5c, - 0xe1, 0x11, 0xac, 0x2d, 0x7c, 0x18, 0xd5, 0x21, 0xff, 0x74, 0xf3, 0x01, 0x6a, 0xc1, 0xfa, 0xf0, - 0xdd, 0xe8, 0x0c, 0x0f, 0xc8, 0x70, 0x74, 0x80, 0x07, 0xbd, 0xf1, 0xa0, 0xe9, 0x14, 0xc0, 0xc3, - 0x41, 0x06, 0x96, 0xba, 0xdf, 0xb2, 0x49, 0xc8, 0x06, 0x6e, 0x0f, 0x1a, 0x32, 0x11, 0xe4, 0x6b, - 0xc2, 0xe4, 0x3c, 0x9d, 0x39, 0xc7, 0xce, 0x1c, 0x4a, 0xdb, 0x80, 0x13, 0x31, 0x14, 0x41, 0xfc, - 0xc1, 0xd0, 0x78, 0x55, 0x26, 0xc2, 0xae, 0xec, 0x9c, 0xed, 0x42, 0x8b, 0x0b, 0x3f, 0x4c, 0x26, - 0x8c, 0xf8, 0x89, 0x94, 0x4c, 0x68, 0x22, 0x13, 0x61, 0xaf, 0xbc, 0xba, 0xbf, 0x1c, 0xd0, 0x50, - 0x31, 0xbc, 0x91, 0x29, 0x0e, 0x52, 0x01, 0x4e, 0x44, 0xf7, 0xbb, 0x03, 0xad, 0x85, 0xc8, 0x9d, - 0x25, 0xda, 0x64, 0xae, 0x0d, 0x15, 0x95, 0x44, 0x11, 0x95, 0xf9, 0x34, 0xe6, 0x5b, 0x74, 0x0e, - 0x28, 0x6b, 0x8d, 0x64, 0x2a, 0x09, 0x75, 0x7a, 0xcc, 0x92, 0x3d, 0xe6, 0xf3, 0x3b, 0xa3, 0x61, - 0x2d, 0xb8, 0xe9, 0x17, 0x76, 0xe6, 0xf8, 0xdd, 0x9f, 0x25, 0xd8, 0xf8, 0x43, 0x87, 0xf6, 0x60, - 0x25, 0x55, 0xda, 0x9b, 0xba, 0x4f, 0xf4, 0x32, 0x3d, 0x7a, 0x06, 0x8d, 0xeb, 0x48, 0x85, 0xd4, - 0x63, 0x61, 0x76, 0x87, 0xab, 0x59, 0xa8, 0x4e, 0x0c, 0x66, 0x54, 0xde, 0xa2, 0xaa, 0x92, 0xaa, - 0xbc, 0xa2, 0xea, 0x89, 0x79, 0x7f, 0x22, 0x36, 0xe1, 0x54, 0xd8, 0xdc, 0x39, 0xb8, 0x42, 0x4f, - 0xed, 0xd6, 0x50, 0x5e, 0x4e, 0xd5, 0x52, 0xca, 0xcb, 0xa8, 0x4d, 0xa8, 0x5f, 0x11, 0xa5, 0xa9, - 0xe6, 0x4a, 0x73, 0xdf, 0x76, 0xd1, 0xc1, 0x70, 0x35, 0xce, 0x11, 0xf4, 0x18, 0x2a, 0xb3, 0x2c, - 0x17, 0x25, 0x4b, 0xae, 0xcc, 0xd2, 0x2c, 0xbc, 0x80, 0xa6, 0x64, 0x53, 0xc9, 0x94, 0x32, 0x61, - 0x08, 0xe2, 0x44, 0x4c, 0x6c, 0xc6, 0xaa, 0x78, 0xfd, 0x06, 0x3f, 0x32, 0xf0, 0xed, 0x39, 0x2d, - 0xdf, 0x9e, 0xd3, 0xfe, 0x31, 0xec, 0xfa, 0x71, 0xe4, 0x4e, 0xe3, 0x78, 0x1a, 0x32, 0xd7, 0xf4, - 0x8d, 0x8b, 0xa9, 0x3b, 0x63, 0x32, 0x88, 0x65, 0x64, 0xe6, 0x3d, 0xed, 0x68, 0xf6, 0xa4, 0xbb, - 0xd7, 0x8f, 0x79, 0x7f, 0xf1, 0x21, 0x7e, 0x6f, 0xde, 0xe7, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, - 0xf0, 0xc0, 0xec, 0x97, 0xfa, 0x05, 0x00, 0x00, -} diff --git a/vendor/github.com/google/mako/clients/proto/analyzers/window_deviation_go_proto/window_deviation.pb.go b/vendor/github.com/google/mako/clients/proto/analyzers/window_deviation_go_proto/window_deviation.pb.go deleted file mode 100644 index 5fe8856b59f1..000000000000 --- a/vendor/github.com/google/mako/clients/proto/analyzers/window_deviation_go_proto/window_deviation.pb.go +++ /dev/null @@ -1,855 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: clients/proto/analyzers/window_deviation.proto - -package mako_window_deviation - -import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - mako_go_proto "github.com/google/mako/spec/proto/mako_go_proto" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type ToleranceCheck_DirectionBias int32 - -const ( - ToleranceCheck_NO_BIAS ToleranceCheck_DirectionBias = 0 - ToleranceCheck_IGNORE_INCREASE ToleranceCheck_DirectionBias = 1 - ToleranceCheck_IGNORE_DECREASE ToleranceCheck_DirectionBias = 2 -) - -var ToleranceCheck_DirectionBias_name = map[int32]string{ - 0: "NO_BIAS", - 1: "IGNORE_INCREASE", - 2: "IGNORE_DECREASE", -} - -var ToleranceCheck_DirectionBias_value = map[string]int32{ - "NO_BIAS": 0, - "IGNORE_INCREASE": 1, - "IGNORE_DECREASE": 2, -} - -func (x ToleranceCheck_DirectionBias) Enum() *ToleranceCheck_DirectionBias { - p := new(ToleranceCheck_DirectionBias) - *p = x - return p -} - -func (x ToleranceCheck_DirectionBias) String() string { - return proto.EnumName(ToleranceCheck_DirectionBias_name, int32(x)) -} - -func (x *ToleranceCheck_DirectionBias) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(ToleranceCheck_DirectionBias_value, data, "ToleranceCheck_DirectionBias") - if err != nil { - return err - } - *x = ToleranceCheck_DirectionBias(value) - return nil -} - -func (ToleranceCheck_DirectionBias) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_b20e6734acd2d200, []int{1, 0} -} - -type WindowDeviationOutput_ToleranceCheckOutput_CheckResult int32 - -const ( - WindowDeviationOutput_ToleranceCheckOutput_UNDEFINED WindowDeviationOutput_ToleranceCheckOutput_CheckResult = 0 - WindowDeviationOutput_ToleranceCheckOutput_REGRESSED WindowDeviationOutput_ToleranceCheckOutput_CheckResult = 1 - WindowDeviationOutput_ToleranceCheckOutput_SKIPPED WindowDeviationOutput_ToleranceCheckOutput_CheckResult = 2 - WindowDeviationOutput_ToleranceCheckOutput_PASSED WindowDeviationOutput_ToleranceCheckOutput_CheckResult = 3 -) - -var WindowDeviationOutput_ToleranceCheckOutput_CheckResult_name = map[int32]string{ - 0: "UNDEFINED", - 1: "REGRESSED", - 2: "SKIPPED", - 3: "PASSED", -} - -var WindowDeviationOutput_ToleranceCheckOutput_CheckResult_value = map[string]int32{ - "UNDEFINED": 0, - "REGRESSED": 1, - "SKIPPED": 2, - "PASSED": 3, -} - -func (x WindowDeviationOutput_ToleranceCheckOutput_CheckResult) Enum() *WindowDeviationOutput_ToleranceCheckOutput_CheckResult { - p := new(WindowDeviationOutput_ToleranceCheckOutput_CheckResult) - *p = x - return p -} - -func (x WindowDeviationOutput_ToleranceCheckOutput_CheckResult) String() string { - return proto.EnumName(WindowDeviationOutput_ToleranceCheckOutput_CheckResult_name, int32(x)) -} - -func (x *WindowDeviationOutput_ToleranceCheckOutput_CheckResult) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(WindowDeviationOutput_ToleranceCheckOutput_CheckResult_value, data, "WindowDeviationOutput_ToleranceCheckOutput_CheckResult") - if err != nil { - return err - } - *x = WindowDeviationOutput_ToleranceCheckOutput_CheckResult(value) - return nil -} - -func (WindowDeviationOutput_ToleranceCheckOutput_CheckResult) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_b20e6734acd2d200, []int{4, 0, 0} -} - -type WindowDeviationInput struct { - RunInfoQueryList []*mako_go_proto.RunInfoQuery `protobuf:"bytes,1,rep,name=run_info_query_list,json=runInfoQueryList" json:"run_info_query_list,omitempty"` - ToleranceCheckList []*ToleranceCheck `protobuf:"bytes,2,rep,name=tolerance_check_list,json=toleranceCheckList" json:"tolerance_check_list,omitempty"` - Name *string `protobuf:"bytes,3,opt,name=name" json:"name,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *WindowDeviationInput) Reset() { *m = WindowDeviationInput{} } -func (m *WindowDeviationInput) String() string { return proto.CompactTextString(m) } -func (*WindowDeviationInput) ProtoMessage() {} -func (*WindowDeviationInput) Descriptor() ([]byte, []int) { - return fileDescriptor_b20e6734acd2d200, []int{0} -} - -func (m *WindowDeviationInput) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_WindowDeviationInput.Unmarshal(m, b) -} -func (m *WindowDeviationInput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_WindowDeviationInput.Marshal(b, m, deterministic) -} -func (m *WindowDeviationInput) XXX_Merge(src proto.Message) { - xxx_messageInfo_WindowDeviationInput.Merge(m, src) -} -func (m *WindowDeviationInput) XXX_Size() int { - return xxx_messageInfo_WindowDeviationInput.Size(m) -} -func (m *WindowDeviationInput) XXX_DiscardUnknown() { - xxx_messageInfo_WindowDeviationInput.DiscardUnknown(m) -} - -var xxx_messageInfo_WindowDeviationInput proto.InternalMessageInfo - -func (m *WindowDeviationInput) GetRunInfoQueryList() []*mako_go_proto.RunInfoQuery { - if m != nil { - return m.RunInfoQueryList - } - return nil -} - -func (m *WindowDeviationInput) GetToleranceCheckList() []*ToleranceCheck { - if m != nil { - return m.ToleranceCheckList - } - return nil -} - -func (m *WindowDeviationInput) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -type ToleranceCheck struct { - DataFilter *mako_go_proto.DataFilter `protobuf:"bytes,1,opt,name=data_filter,json=dataFilter" json:"data_filter,omitempty"` - RecentWindowSize *int32 `protobuf:"varint,2,opt,name=recent_window_size,json=recentWindowSize,def=1" json:"recent_window_size,omitempty"` - MinimumHistoricalWindowSize *int32 `protobuf:"varint,6,opt,name=minimum_historical_window_size,json=minimumHistoricalWindowSize,def=3" json:"minimum_historical_window_size,omitempty"` - DirectionBias *ToleranceCheck_DirectionBias `protobuf:"varint,3,opt,name=direction_bias,json=directionBias,enum=mako.window_deviation.ToleranceCheck_DirectionBias,def=0" json:"direction_bias,omitempty"` - MeanToleranceParamsList []*MeanToleranceParams `protobuf:"bytes,4,rep,name=mean_tolerance_params_list,json=meanToleranceParamsList" json:"mean_tolerance_params_list,omitempty"` - MedianToleranceParamsList []*MedianToleranceParams `protobuf:"bytes,5,rep,name=median_tolerance_params_list,json=medianToleranceParamsList" json:"median_tolerance_params_list,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ToleranceCheck) Reset() { *m = ToleranceCheck{} } -func (m *ToleranceCheck) String() string { return proto.CompactTextString(m) } -func (*ToleranceCheck) ProtoMessage() {} -func (*ToleranceCheck) Descriptor() ([]byte, []int) { - return fileDescriptor_b20e6734acd2d200, []int{1} -} - -func (m *ToleranceCheck) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ToleranceCheck.Unmarshal(m, b) -} -func (m *ToleranceCheck) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ToleranceCheck.Marshal(b, m, deterministic) -} -func (m *ToleranceCheck) XXX_Merge(src proto.Message) { - xxx_messageInfo_ToleranceCheck.Merge(m, src) -} -func (m *ToleranceCheck) XXX_Size() int { - return xxx_messageInfo_ToleranceCheck.Size(m) -} -func (m *ToleranceCheck) XXX_DiscardUnknown() { - xxx_messageInfo_ToleranceCheck.DiscardUnknown(m) -} - -var xxx_messageInfo_ToleranceCheck proto.InternalMessageInfo - -const Default_ToleranceCheck_RecentWindowSize int32 = 1 -const Default_ToleranceCheck_MinimumHistoricalWindowSize int32 = 3 -const Default_ToleranceCheck_DirectionBias ToleranceCheck_DirectionBias = ToleranceCheck_NO_BIAS - -func (m *ToleranceCheck) GetDataFilter() *mako_go_proto.DataFilter { - if m != nil { - return m.DataFilter - } - return nil -} - -func (m *ToleranceCheck) GetRecentWindowSize() int32 { - if m != nil && m.RecentWindowSize != nil { - return *m.RecentWindowSize - } - return Default_ToleranceCheck_RecentWindowSize -} - -func (m *ToleranceCheck) GetMinimumHistoricalWindowSize() int32 { - if m != nil && m.MinimumHistoricalWindowSize != nil { - return *m.MinimumHistoricalWindowSize - } - return Default_ToleranceCheck_MinimumHistoricalWindowSize -} - -func (m *ToleranceCheck) GetDirectionBias() ToleranceCheck_DirectionBias { - if m != nil && m.DirectionBias != nil { - return *m.DirectionBias - } - return Default_ToleranceCheck_DirectionBias -} - -func (m *ToleranceCheck) GetMeanToleranceParamsList() []*MeanToleranceParams { - if m != nil { - return m.MeanToleranceParamsList - } - return nil -} - -func (m *ToleranceCheck) GetMedianToleranceParamsList() []*MedianToleranceParams { - if m != nil { - return m.MedianToleranceParamsList - } - return nil -} - -type MeanToleranceParams struct { - ConstTerm *float64 `protobuf:"fixed64,1,opt,name=const_term,json=constTerm,def=0" json:"const_term,omitempty"` - MeanCoeff *float64 `protobuf:"fixed64,2,opt,name=mean_coeff,json=meanCoeff,def=0" json:"mean_coeff,omitempty"` - StddevCoeff *float64 `protobuf:"fixed64,3,opt,name=stddev_coeff,json=stddevCoeff,def=0" json:"stddev_coeff,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MeanToleranceParams) Reset() { *m = MeanToleranceParams{} } -func (m *MeanToleranceParams) String() string { return proto.CompactTextString(m) } -func (*MeanToleranceParams) ProtoMessage() {} -func (*MeanToleranceParams) Descriptor() ([]byte, []int) { - return fileDescriptor_b20e6734acd2d200, []int{2} -} - -func (m *MeanToleranceParams) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MeanToleranceParams.Unmarshal(m, b) -} -func (m *MeanToleranceParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MeanToleranceParams.Marshal(b, m, deterministic) -} -func (m *MeanToleranceParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_MeanToleranceParams.Merge(m, src) -} -func (m *MeanToleranceParams) XXX_Size() int { - return xxx_messageInfo_MeanToleranceParams.Size(m) -} -func (m *MeanToleranceParams) XXX_DiscardUnknown() { - xxx_messageInfo_MeanToleranceParams.DiscardUnknown(m) -} - -var xxx_messageInfo_MeanToleranceParams proto.InternalMessageInfo - -const Default_MeanToleranceParams_ConstTerm float64 = 0 -const Default_MeanToleranceParams_MeanCoeff float64 = 0 -const Default_MeanToleranceParams_StddevCoeff float64 = 0 - -func (m *MeanToleranceParams) GetConstTerm() float64 { - if m != nil && m.ConstTerm != nil { - return *m.ConstTerm - } - return Default_MeanToleranceParams_ConstTerm -} - -func (m *MeanToleranceParams) GetMeanCoeff() float64 { - if m != nil && m.MeanCoeff != nil { - return *m.MeanCoeff - } - return Default_MeanToleranceParams_MeanCoeff -} - -func (m *MeanToleranceParams) GetStddevCoeff() float64 { - if m != nil && m.StddevCoeff != nil { - return *m.StddevCoeff - } - return Default_MeanToleranceParams_StddevCoeff -} - -type MedianToleranceParams struct { - ConstTerm *float64 `protobuf:"fixed64,1,opt,name=const_term,json=constTerm,def=0" json:"const_term,omitempty"` - MedianCoeff *float64 `protobuf:"fixed64,2,opt,name=median_coeff,json=medianCoeff,def=0" json:"median_coeff,omitempty"` - MadCoeff *float64 `protobuf:"fixed64,3,opt,name=mad_coeff,json=madCoeff,def=0" json:"mad_coeff,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MedianToleranceParams) Reset() { *m = MedianToleranceParams{} } -func (m *MedianToleranceParams) String() string { return proto.CompactTextString(m) } -func (*MedianToleranceParams) ProtoMessage() {} -func (*MedianToleranceParams) Descriptor() ([]byte, []int) { - return fileDescriptor_b20e6734acd2d200, []int{3} -} - -func (m *MedianToleranceParams) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MedianToleranceParams.Unmarshal(m, b) -} -func (m *MedianToleranceParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MedianToleranceParams.Marshal(b, m, deterministic) -} -func (m *MedianToleranceParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_MedianToleranceParams.Merge(m, src) -} -func (m *MedianToleranceParams) XXX_Size() int { - return xxx_messageInfo_MedianToleranceParams.Size(m) -} -func (m *MedianToleranceParams) XXX_DiscardUnknown() { - xxx_messageInfo_MedianToleranceParams.DiscardUnknown(m) -} - -var xxx_messageInfo_MedianToleranceParams proto.InternalMessageInfo - -const Default_MedianToleranceParams_ConstTerm float64 = 0 -const Default_MedianToleranceParams_MedianCoeff float64 = 0 -const Default_MedianToleranceParams_MadCoeff float64 = 0 - -func (m *MedianToleranceParams) GetConstTerm() float64 { - if m != nil && m.ConstTerm != nil { - return *m.ConstTerm - } - return Default_MedianToleranceParams_ConstTerm -} - -func (m *MedianToleranceParams) GetMedianCoeff() float64 { - if m != nil && m.MedianCoeff != nil { - return *m.MedianCoeff - } - return Default_MedianToleranceParams_MedianCoeff -} - -func (m *MedianToleranceParams) GetMadCoeff() float64 { - if m != nil && m.MadCoeff != nil { - return *m.MadCoeff - } - return Default_MedianToleranceParams_MadCoeff -} - -type WindowDeviationOutput struct { - OutputMessage *string `protobuf:"bytes,1,opt,name=output_message,json=outputMessage" json:"output_message,omitempty"` - Checks []*WindowDeviationOutput_ToleranceCheckOutput `protobuf:"bytes,3,rep,name=checks" json:"checks,omitempty"` - ChecksSkippedForMissingData []*ToleranceCheck `protobuf:"bytes,2,rep,name=checks_skipped_for_missing_data,json=checksSkippedForMissingData" json:"checks_skipped_for_missing_data,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *WindowDeviationOutput) Reset() { *m = WindowDeviationOutput{} } -func (m *WindowDeviationOutput) String() string { return proto.CompactTextString(m) } -func (*WindowDeviationOutput) ProtoMessage() {} -func (*WindowDeviationOutput) Descriptor() ([]byte, []int) { - return fileDescriptor_b20e6734acd2d200, []int{4} -} - -func (m *WindowDeviationOutput) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_WindowDeviationOutput.Unmarshal(m, b) -} -func (m *WindowDeviationOutput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_WindowDeviationOutput.Marshal(b, m, deterministic) -} -func (m *WindowDeviationOutput) XXX_Merge(src proto.Message) { - xxx_messageInfo_WindowDeviationOutput.Merge(m, src) -} -func (m *WindowDeviationOutput) XXX_Size() int { - return xxx_messageInfo_WindowDeviationOutput.Size(m) -} -func (m *WindowDeviationOutput) XXX_DiscardUnknown() { - xxx_messageInfo_WindowDeviationOutput.DiscardUnknown(m) -} - -var xxx_messageInfo_WindowDeviationOutput proto.InternalMessageInfo - -func (m *WindowDeviationOutput) GetOutputMessage() string { - if m != nil && m.OutputMessage != nil { - return *m.OutputMessage - } - return "" -} - -func (m *WindowDeviationOutput) GetChecks() []*WindowDeviationOutput_ToleranceCheckOutput { - if m != nil { - return m.Checks - } - return nil -} - -func (m *WindowDeviationOutput) GetChecksSkippedForMissingData() []*ToleranceCheck { - if m != nil { - return m.ChecksSkippedForMissingData - } - return nil -} - -type WindowDeviationOutput_ToleranceCheckOutput struct { - ToleranceCheck *ToleranceCheck `protobuf:"bytes,1,opt,name=tolerance_check,json=toleranceCheck" json:"tolerance_check,omitempty"` - Result *WindowDeviationOutput_ToleranceCheckOutput_CheckResult `protobuf:"varint,2,opt,name=result,enum=mako.window_deviation.WindowDeviationOutput_ToleranceCheckOutput_CheckResult,def=0" json:"result,omitempty"` - MetricLabel *string `protobuf:"bytes,3,opt,name=metric_label,json=metricLabel" json:"metric_label,omitempty"` - Stats *ToleranceCheckStats `protobuf:"bytes,4,opt,name=stats" json:"stats,omitempty"` - HistoricalWindowMinTimestampMs *float64 `protobuf:"fixed64,5,opt,name=historical_window_min_timestamp_ms,json=historicalWindowMinTimestampMs" json:"historical_window_min_timestamp_ms,omitempty"` - HistoricalWindowMaxTimestampMs *float64 `protobuf:"fixed64,6,opt,name=historical_window_max_timestamp_ms,json=historicalWindowMaxTimestampMs" json:"historical_window_max_timestamp_ms,omitempty"` - HistoricalWindowMinBuildId *float64 `protobuf:"fixed64,7,opt,name=historical_window_min_build_id,json=historicalWindowMinBuildId" json:"historical_window_min_build_id,omitempty"` - HistoricalWindowMaxBuildId *float64 `protobuf:"fixed64,8,opt,name=historical_window_max_build_id,json=historicalWindowMaxBuildId" json:"historical_window_max_build_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *WindowDeviationOutput_ToleranceCheckOutput) Reset() { - *m = WindowDeviationOutput_ToleranceCheckOutput{} -} -func (m *WindowDeviationOutput_ToleranceCheckOutput) String() string { - return proto.CompactTextString(m) -} -func (*WindowDeviationOutput_ToleranceCheckOutput) ProtoMessage() {} -func (*WindowDeviationOutput_ToleranceCheckOutput) Descriptor() ([]byte, []int) { - return fileDescriptor_b20e6734acd2d200, []int{4, 0} -} - -func (m *WindowDeviationOutput_ToleranceCheckOutput) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_WindowDeviationOutput_ToleranceCheckOutput.Unmarshal(m, b) -} -func (m *WindowDeviationOutput_ToleranceCheckOutput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_WindowDeviationOutput_ToleranceCheckOutput.Marshal(b, m, deterministic) -} -func (m *WindowDeviationOutput_ToleranceCheckOutput) XXX_Merge(src proto.Message) { - xxx_messageInfo_WindowDeviationOutput_ToleranceCheckOutput.Merge(m, src) -} -func (m *WindowDeviationOutput_ToleranceCheckOutput) XXX_Size() int { - return xxx_messageInfo_WindowDeviationOutput_ToleranceCheckOutput.Size(m) -} -func (m *WindowDeviationOutput_ToleranceCheckOutput) XXX_DiscardUnknown() { - xxx_messageInfo_WindowDeviationOutput_ToleranceCheckOutput.DiscardUnknown(m) -} - -var xxx_messageInfo_WindowDeviationOutput_ToleranceCheckOutput proto.InternalMessageInfo - -const Default_WindowDeviationOutput_ToleranceCheckOutput_Result WindowDeviationOutput_ToleranceCheckOutput_CheckResult = WindowDeviationOutput_ToleranceCheckOutput_UNDEFINED - -func (m *WindowDeviationOutput_ToleranceCheckOutput) GetToleranceCheck() *ToleranceCheck { - if m != nil { - return m.ToleranceCheck - } - return nil -} - -func (m *WindowDeviationOutput_ToleranceCheckOutput) GetResult() WindowDeviationOutput_ToleranceCheckOutput_CheckResult { - if m != nil && m.Result != nil { - return *m.Result - } - return Default_WindowDeviationOutput_ToleranceCheckOutput_Result -} - -func (m *WindowDeviationOutput_ToleranceCheckOutput) GetMetricLabel() string { - if m != nil && m.MetricLabel != nil { - return *m.MetricLabel - } - return "" -} - -func (m *WindowDeviationOutput_ToleranceCheckOutput) GetStats() *ToleranceCheckStats { - if m != nil { - return m.Stats - } - return nil -} - -func (m *WindowDeviationOutput_ToleranceCheckOutput) GetHistoricalWindowMinTimestampMs() float64 { - if m != nil && m.HistoricalWindowMinTimestampMs != nil { - return *m.HistoricalWindowMinTimestampMs - } - return 0 -} - -func (m *WindowDeviationOutput_ToleranceCheckOutput) GetHistoricalWindowMaxTimestampMs() float64 { - if m != nil && m.HistoricalWindowMaxTimestampMs != nil { - return *m.HistoricalWindowMaxTimestampMs - } - return 0 -} - -func (m *WindowDeviationOutput_ToleranceCheckOutput) GetHistoricalWindowMinBuildId() float64 { - if m != nil && m.HistoricalWindowMinBuildId != nil { - return *m.HistoricalWindowMinBuildId - } - return 0 -} - -func (m *WindowDeviationOutput_ToleranceCheckOutput) GetHistoricalWindowMaxBuildId() float64 { - if m != nil && m.HistoricalWindowMaxBuildId != nil { - return *m.HistoricalWindowMaxBuildId - } - return 0 -} - -type ToleranceCheckStats struct { - HistoricDataLength *int32 `protobuf:"varint,1,opt,name=historic_data_length,json=historicDataLength" json:"historic_data_length,omitempty"` - RecentDataLength *int32 `protobuf:"varint,2,opt,name=recent_data_length,json=recentDataLength" json:"recent_data_length,omitempty"` - HistoricMean *float64 `protobuf:"fixed64,3,opt,name=historic_mean,json=historicMean" json:"historic_mean,omitempty"` - HistoricMedian *float64 `protobuf:"fixed64,4,opt,name=historic_median,json=historicMedian" json:"historic_median,omitempty"` - HistoricStddev *float64 `protobuf:"fixed64,5,opt,name=historic_stddev,json=historicStddev" json:"historic_stddev,omitempty"` - HistoricMad *float64 `protobuf:"fixed64,6,opt,name=historic_mad,json=historicMad" json:"historic_mad,omitempty"` - RecentMean *float64 `protobuf:"fixed64,7,opt,name=recent_mean,json=recentMean" json:"recent_mean,omitempty"` - RecentMedian *float64 `protobuf:"fixed64,8,opt,name=recent_median,json=recentMedian" json:"recent_median,omitempty"` - DeltaMean *float64 `protobuf:"fixed64,9,opt,name=delta_mean,json=deltaMean" json:"delta_mean,omitempty"` - DeltaMedian *float64 `protobuf:"fixed64,10,opt,name=delta_median,json=deltaMedian" json:"delta_median,omitempty"` - MeanToleranceCheckResult []*MeanToleranceCheckResult `protobuf:"bytes,11,rep,name=mean_tolerance_check_result,json=meanToleranceCheckResult" json:"mean_tolerance_check_result,omitempty"` - MedianToleranceCheckResult []*MedianToleranceCheckResult `protobuf:"bytes,12,rep,name=median_tolerance_check_result,json=medianToleranceCheckResult" json:"median_tolerance_check_result,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ToleranceCheckStats) Reset() { *m = ToleranceCheckStats{} } -func (m *ToleranceCheckStats) String() string { return proto.CompactTextString(m) } -func (*ToleranceCheckStats) ProtoMessage() {} -func (*ToleranceCheckStats) Descriptor() ([]byte, []int) { - return fileDescriptor_b20e6734acd2d200, []int{5} -} - -func (m *ToleranceCheckStats) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ToleranceCheckStats.Unmarshal(m, b) -} -func (m *ToleranceCheckStats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ToleranceCheckStats.Marshal(b, m, deterministic) -} -func (m *ToleranceCheckStats) XXX_Merge(src proto.Message) { - xxx_messageInfo_ToleranceCheckStats.Merge(m, src) -} -func (m *ToleranceCheckStats) XXX_Size() int { - return xxx_messageInfo_ToleranceCheckStats.Size(m) -} -func (m *ToleranceCheckStats) XXX_DiscardUnknown() { - xxx_messageInfo_ToleranceCheckStats.DiscardUnknown(m) -} - -var xxx_messageInfo_ToleranceCheckStats proto.InternalMessageInfo - -func (m *ToleranceCheckStats) GetHistoricDataLength() int32 { - if m != nil && m.HistoricDataLength != nil { - return *m.HistoricDataLength - } - return 0 -} - -func (m *ToleranceCheckStats) GetRecentDataLength() int32 { - if m != nil && m.RecentDataLength != nil { - return *m.RecentDataLength - } - return 0 -} - -func (m *ToleranceCheckStats) GetHistoricMean() float64 { - if m != nil && m.HistoricMean != nil { - return *m.HistoricMean - } - return 0 -} - -func (m *ToleranceCheckStats) GetHistoricMedian() float64 { - if m != nil && m.HistoricMedian != nil { - return *m.HistoricMedian - } - return 0 -} - -func (m *ToleranceCheckStats) GetHistoricStddev() float64 { - if m != nil && m.HistoricStddev != nil { - return *m.HistoricStddev - } - return 0 -} - -func (m *ToleranceCheckStats) GetHistoricMad() float64 { - if m != nil && m.HistoricMad != nil { - return *m.HistoricMad - } - return 0 -} - -func (m *ToleranceCheckStats) GetRecentMean() float64 { - if m != nil && m.RecentMean != nil { - return *m.RecentMean - } - return 0 -} - -func (m *ToleranceCheckStats) GetRecentMedian() float64 { - if m != nil && m.RecentMedian != nil { - return *m.RecentMedian - } - return 0 -} - -func (m *ToleranceCheckStats) GetDeltaMean() float64 { - if m != nil && m.DeltaMean != nil { - return *m.DeltaMean - } - return 0 -} - -func (m *ToleranceCheckStats) GetDeltaMedian() float64 { - if m != nil && m.DeltaMedian != nil { - return *m.DeltaMedian - } - return 0 -} - -func (m *ToleranceCheckStats) GetMeanToleranceCheckResult() []*MeanToleranceCheckResult { - if m != nil { - return m.MeanToleranceCheckResult - } - return nil -} - -func (m *ToleranceCheckStats) GetMedianToleranceCheckResult() []*MedianToleranceCheckResult { - if m != nil { - return m.MedianToleranceCheckResult - } - return nil -} - -type MeanToleranceCheckResult struct { - Params *MeanToleranceParams `protobuf:"bytes,1,opt,name=params" json:"params,omitempty"` - Tolerance *float64 `protobuf:"fixed64,2,opt,name=tolerance" json:"tolerance,omitempty"` - IsRegressed *bool `protobuf:"varint,3,opt,name=is_regressed,json=isRegressed" json:"is_regressed,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MeanToleranceCheckResult) Reset() { *m = MeanToleranceCheckResult{} } -func (m *MeanToleranceCheckResult) String() string { return proto.CompactTextString(m) } -func (*MeanToleranceCheckResult) ProtoMessage() {} -func (*MeanToleranceCheckResult) Descriptor() ([]byte, []int) { - return fileDescriptor_b20e6734acd2d200, []int{6} -} - -func (m *MeanToleranceCheckResult) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MeanToleranceCheckResult.Unmarshal(m, b) -} -func (m *MeanToleranceCheckResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MeanToleranceCheckResult.Marshal(b, m, deterministic) -} -func (m *MeanToleranceCheckResult) XXX_Merge(src proto.Message) { - xxx_messageInfo_MeanToleranceCheckResult.Merge(m, src) -} -func (m *MeanToleranceCheckResult) XXX_Size() int { - return xxx_messageInfo_MeanToleranceCheckResult.Size(m) -} -func (m *MeanToleranceCheckResult) XXX_DiscardUnknown() { - xxx_messageInfo_MeanToleranceCheckResult.DiscardUnknown(m) -} - -var xxx_messageInfo_MeanToleranceCheckResult proto.InternalMessageInfo - -func (m *MeanToleranceCheckResult) GetParams() *MeanToleranceParams { - if m != nil { - return m.Params - } - return nil -} - -func (m *MeanToleranceCheckResult) GetTolerance() float64 { - if m != nil && m.Tolerance != nil { - return *m.Tolerance - } - return 0 -} - -func (m *MeanToleranceCheckResult) GetIsRegressed() bool { - if m != nil && m.IsRegressed != nil { - return *m.IsRegressed - } - return false -} - -type MedianToleranceCheckResult struct { - Params *MedianToleranceParams `protobuf:"bytes,1,opt,name=params" json:"params,omitempty"` - Tolerance *float64 `protobuf:"fixed64,2,opt,name=tolerance" json:"tolerance,omitempty"` - IsRegressed *bool `protobuf:"varint,3,opt,name=is_regressed,json=isRegressed" json:"is_regressed,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MedianToleranceCheckResult) Reset() { *m = MedianToleranceCheckResult{} } -func (m *MedianToleranceCheckResult) String() string { return proto.CompactTextString(m) } -func (*MedianToleranceCheckResult) ProtoMessage() {} -func (*MedianToleranceCheckResult) Descriptor() ([]byte, []int) { - return fileDescriptor_b20e6734acd2d200, []int{7} -} - -func (m *MedianToleranceCheckResult) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MedianToleranceCheckResult.Unmarshal(m, b) -} -func (m *MedianToleranceCheckResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MedianToleranceCheckResult.Marshal(b, m, deterministic) -} -func (m *MedianToleranceCheckResult) XXX_Merge(src proto.Message) { - xxx_messageInfo_MedianToleranceCheckResult.Merge(m, src) -} -func (m *MedianToleranceCheckResult) XXX_Size() int { - return xxx_messageInfo_MedianToleranceCheckResult.Size(m) -} -func (m *MedianToleranceCheckResult) XXX_DiscardUnknown() { - xxx_messageInfo_MedianToleranceCheckResult.DiscardUnknown(m) -} - -var xxx_messageInfo_MedianToleranceCheckResult proto.InternalMessageInfo - -func (m *MedianToleranceCheckResult) GetParams() *MedianToleranceParams { - if m != nil { - return m.Params - } - return nil -} - -func (m *MedianToleranceCheckResult) GetTolerance() float64 { - if m != nil && m.Tolerance != nil { - return *m.Tolerance - } - return 0 -} - -func (m *MedianToleranceCheckResult) GetIsRegressed() bool { - if m != nil && m.IsRegressed != nil { - return *m.IsRegressed - } - return false -} - -func init() { - proto.RegisterEnum("mako.window_deviation.ToleranceCheck_DirectionBias", ToleranceCheck_DirectionBias_name, ToleranceCheck_DirectionBias_value) - proto.RegisterEnum("mako.window_deviation.WindowDeviationOutput_ToleranceCheckOutput_CheckResult", WindowDeviationOutput_ToleranceCheckOutput_CheckResult_name, WindowDeviationOutput_ToleranceCheckOutput_CheckResult_value) - proto.RegisterType((*WindowDeviationInput)(nil), "mako.window_deviation.WindowDeviationInput") - proto.RegisterType((*ToleranceCheck)(nil), "mako.window_deviation.ToleranceCheck") - proto.RegisterType((*MeanToleranceParams)(nil), "mako.window_deviation.MeanToleranceParams") - proto.RegisterType((*MedianToleranceParams)(nil), "mako.window_deviation.MedianToleranceParams") - proto.RegisterType((*WindowDeviationOutput)(nil), "mako.window_deviation.WindowDeviationOutput") - proto.RegisterType((*WindowDeviationOutput_ToleranceCheckOutput)(nil), "mako.window_deviation.WindowDeviationOutput.ToleranceCheckOutput") - proto.RegisterType((*ToleranceCheckStats)(nil), "mako.window_deviation.ToleranceCheckStats") - proto.RegisterType((*MeanToleranceCheckResult)(nil), "mako.window_deviation.MeanToleranceCheckResult") - proto.RegisterType((*MedianToleranceCheckResult)(nil), "mako.window_deviation.MedianToleranceCheckResult") -} - -func init() { - proto.RegisterFile("clients/proto/analyzers/window_deviation.proto", fileDescriptor_b20e6734acd2d200) -} - -var fileDescriptor_b20e6734acd2d200 = []byte{ - // 1160 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0xcf, 0x6f, 0xdb, 0x36, - 0x14, 0xae, 0x92, 0xd8, 0xad, 0x9f, 0x6c, 0xd7, 0x60, 0x12, 0xcc, 0x73, 0xdb, 0x34, 0x75, 0x5b, - 0x2c, 0x28, 0x0a, 0xa5, 0x4d, 0xb1, 0x4b, 0x4e, 0x8b, 0x6b, 0xa7, 0xf3, 0x56, 0xbb, 0x19, 0xdd, - 0xa1, 0xd8, 0x89, 0x60, 0x25, 0xda, 0x21, 0x22, 0x4a, 0x9e, 0x48, 0xb7, 0x69, 0x2f, 0xfd, 0x53, - 0x76, 0xe8, 0x75, 0xff, 0xc4, 0x2e, 0xfb, 0xaf, 0x06, 0x0c, 0x24, 0x25, 0xff, 0x8a, 0x05, 0x38, - 0xd8, 0x6e, 0xf2, 0xc7, 0xef, 0x7d, 0xef, 0x23, 0xdf, 0xd3, 0xa3, 0x0c, 0x9e, 0x1f, 0x72, 0x16, - 0x29, 0x79, 0x38, 0x4e, 0x62, 0x15, 0x1f, 0xd2, 0x88, 0x86, 0x9f, 0x3e, 0xb3, 0x44, 0x1e, 0x7e, - 0xe4, 0x51, 0x10, 0x7f, 0x24, 0x01, 0xfb, 0xc0, 0xa9, 0xe2, 0x71, 0xe4, 0x19, 0x02, 0xda, 0x15, - 0xf4, 0x22, 0xf6, 0x96, 0x17, 0x1b, 0xbb, 0x72, 0xcc, 0xfc, 0x54, 0xc3, 0x30, 0xcc, 0x63, 0xf3, - 0x6f, 0x07, 0x76, 0xde, 0x19, 0x6e, 0x3b, 0xa3, 0x76, 0xa3, 0xf1, 0x44, 0xa1, 0x13, 0xd8, 0x4e, - 0x26, 0x11, 0xe1, 0xd1, 0x30, 0x26, 0xbf, 0x4f, 0x58, 0xf2, 0x89, 0x84, 0x5c, 0xaa, 0xba, 0xb3, - 0xbf, 0x79, 0xe0, 0x1e, 0x21, 0xcf, 0x48, 0xe0, 0x49, 0xd4, 0x8d, 0x86, 0xf1, 0x2f, 0x7a, 0x19, - 0xd7, 0x92, 0xb9, 0x5f, 0xaf, 0xb9, 0x54, 0xe8, 0x1d, 0xec, 0xa8, 0x38, 0x64, 0x09, 0x8d, 0x7c, - 0x46, 0xfc, 0x73, 0xe6, 0x5f, 0x58, 0x8d, 0x0d, 0xa3, 0xf1, 0xd8, 0x5b, 0x69, 0xd4, 0x7b, 0x9b, - 0x85, 0xbc, 0xd4, 0x11, 0x18, 0xa9, 0x85, 0xdf, 0x46, 0x18, 0xc1, 0x56, 0x44, 0x05, 0xab, 0x6f, - 0xee, 0x3b, 0x07, 0x25, 0x6c, 0x9e, 0x9b, 0x7f, 0x6d, 0x41, 0x75, 0x31, 0x14, 0x3d, 0x07, 0x37, - 0xa0, 0x8a, 0x92, 0x21, 0x0f, 0x15, 0x4b, 0xea, 0xce, 0xbe, 0x73, 0xe0, 0x1e, 0xd5, 0x6c, 0xda, - 0x36, 0x55, 0xf4, 0xd4, 0xe0, 0x18, 0x82, 0xe9, 0x33, 0x3a, 0x04, 0x94, 0x30, 0x9f, 0x45, 0x8a, - 0xa4, 0xbe, 0x24, 0xff, 0xcc, 0xea, 0x1b, 0xfb, 0xce, 0x41, 0xe1, 0xd8, 0x79, 0x8e, 0x6b, 0x76, - 0xd1, 0x1e, 0xd8, 0x80, 0x7f, 0x66, 0xe8, 0x14, 0xf6, 0x04, 0x8f, 0xb8, 0x98, 0x08, 0x72, 0xce, - 0xa5, 0x8a, 0x13, 0xee, 0xd3, 0x70, 0x21, 0xb8, 0x68, 0x83, 0x5f, 0xe0, 0x3b, 0x29, 0xf1, 0xc7, - 0x29, 0x6f, 0x4e, 0xc7, 0x87, 0x6a, 0xc0, 0x13, 0xe6, 0xeb, 0x23, 0x20, 0xef, 0x39, 0x95, 0x66, - 0x73, 0xd5, 0xa3, 0x17, 0x6b, 0x9d, 0x92, 0xd7, 0xce, 0x62, 0x5b, 0x9c, 0xca, 0xe3, 0x9b, 0xfd, - 0x37, 0xa4, 0xd5, 0x3d, 0x19, 0xe0, 0x4a, 0x30, 0x8f, 0xa3, 0x11, 0x34, 0x04, 0xa3, 0x11, 0x99, - 0x55, 0x65, 0x4c, 0x13, 0x2a, 0xa4, 0x2d, 0xcb, 0x96, 0x29, 0xcb, 0x93, 0x9c, 0x84, 0x3d, 0x46, - 0xa3, 0x69, 0xd2, 0x33, 0x13, 0x86, 0xbf, 0x11, 0x57, 0x41, 0x53, 0x20, 0x01, 0x77, 0x05, 0x0b, - 0x78, 0x6e, 0xaa, 0x82, 0x49, 0xf5, 0x34, 0x37, 0x95, 0x0e, 0x5d, 0x4e, 0xf6, 0xad, 0x58, 0x05, - 0xeb, 0x74, 0xcd, 0x53, 0xa8, 0x2c, 0x1c, 0x00, 0x72, 0x21, 0x3b, 0x82, 0xda, 0x0d, 0xb4, 0x0d, - 0xb7, 0xbb, 0xaf, 0xfa, 0x6f, 0x70, 0x87, 0x74, 0xfb, 0x2f, 0x71, 0xe7, 0x64, 0xd0, 0xa9, 0x39, - 0x73, 0x60, 0xbb, 0x93, 0x82, 0x1b, 0xcd, 0x2f, 0xb0, 0xbd, 0x62, 0x9b, 0x68, 0x1f, 0xc0, 0x8f, - 0x23, 0xa9, 0x88, 0x62, 0x89, 0x30, 0x6d, 0xe4, 0x1c, 0x3b, 0xcf, 0x70, 0xc9, 0x80, 0x6f, 0x59, - 0x22, 0x34, 0xc3, 0x1c, 0xac, 0x1f, 0xb3, 0xe1, 0xd0, 0xb4, 0x8b, 0x65, 0x68, 0xf0, 0xa5, 0xc6, - 0xd0, 0x23, 0x28, 0x4b, 0x15, 0x04, 0xec, 0x43, 0xca, 0xd9, 0xcc, 0x38, 0xae, 0x85, 0x0d, 0xab, - 0xf9, 0x05, 0x76, 0x57, 0x6e, 0x7e, 0x0d, 0x0b, 0x8f, 0xa0, 0x9c, 0x1e, 0xf9, 0x92, 0x09, 0xd7, - 0xc2, 0xd6, 0xc6, 0x1e, 0x94, 0x04, 0x0d, 0x96, 0x3d, 0xdc, 0x12, 0x34, 0xb0, 0x06, 0xfe, 0xbc, - 0x09, 0xbb, 0x4b, 0xe3, 0xe0, 0xcd, 0x44, 0xe9, 0x79, 0xf0, 0x18, 0xaa, 0xb1, 0x79, 0x22, 0x82, - 0x49, 0x49, 0x47, 0xcc, 0xb8, 0x28, 0xe1, 0x8a, 0x45, 0x7b, 0x16, 0x44, 0xbf, 0x41, 0xd1, 0xbc, - 0xe9, 0xba, 0x7f, 0x75, 0x8d, 0x4f, 0x72, 0x6a, 0xbc, 0x32, 0xc9, 0x52, 0x57, 0x5b, 0x10, 0xa7, - 0x82, 0xe8, 0x02, 0xee, 0xdb, 0x27, 0x22, 0x2f, 0xf8, 0x78, 0xcc, 0x02, 0x32, 0x8c, 0x13, 0x22, - 0xb8, 0x94, 0x3c, 0x1a, 0x11, 0xfd, 0x12, 0x5f, 0x6f, 0xb2, 0xdc, 0xb1, 0x6a, 0x03, 0x2b, 0x76, - 0x1a, 0x27, 0x3d, 0x2b, 0xa5, 0x47, 0x43, 0xe3, 0x6b, 0x01, 0x76, 0x56, 0xb9, 0x41, 0x7d, 0xb8, - 0xbd, 0x34, 0xd4, 0xd2, 0xc1, 0xb2, 0x66, 0xd6, 0xea, 0xe2, 0x3c, 0x43, 0x63, 0x28, 0x26, 0x4c, - 0x4e, 0x42, 0x65, 0x2a, 0x56, 0x3d, 0xea, 0xfd, 0xe7, 0x03, 0xf3, 0x6c, 0x22, 0x23, 0x7a, 0x5c, - 0xfa, 0xb5, 0xdf, 0xee, 0x9c, 0x76, 0xfb, 0x9d, 0x36, 0x4e, 0xf3, 0xa0, 0x07, 0xba, 0x53, 0x54, - 0xc2, 0x7d, 0x12, 0xd2, 0xf7, 0x2c, 0x4c, 0xa7, 0xa8, 0x6b, 0xb1, 0xd7, 0x1a, 0x42, 0x3f, 0x40, - 0x41, 0x2a, 0xaa, 0x64, 0x7d, 0xcb, 0x6c, 0xed, 0xc9, 0x5a, 0x5b, 0x1b, 0xe8, 0x08, 0x6c, 0x03, - 0xd1, 0x4f, 0xd0, 0xbc, 0x3a, 0x0f, 0x05, 0x8f, 0x88, 0xe2, 0x82, 0x49, 0x45, 0xc5, 0x98, 0x08, - 0x59, 0x2f, 0xe8, 0x0e, 0xc4, 0x7b, 0xe7, 0x4b, 0x13, 0xb1, 0xc7, 0xa3, 0xb7, 0x19, 0xad, 0x97, - 0xa7, 0x45, 0x2f, 0x17, 0xb5, 0x8a, 0x39, 0x5a, 0xf4, 0x72, 0x5e, 0xab, 0x05, 0x7b, 0xab, 0x7d, - 0xbd, 0x9f, 0xf0, 0x30, 0x20, 0x3c, 0xa8, 0xdf, 0x34, 0x3a, 0x8d, 0x15, 0x9e, 0x5a, 0x9a, 0xd2, - 0x0d, 0x72, 0x34, 0xe8, 0xe5, 0x4c, 0xe3, 0x56, 0x8e, 0x06, 0xbd, 0x4c, 0x35, 0x9a, 0x6d, 0x70, - 0xe7, 0xca, 0x84, 0x2a, 0x30, 0x2b, 0x54, 0xed, 0x86, 0xfe, 0x89, 0x3b, 0xaf, 0x70, 0x67, 0x30, - 0xe8, 0xb4, 0x6b, 0x8e, 0x1e, 0x67, 0x83, 0x9f, 0xbb, 0x67, 0x67, 0x9d, 0x76, 0x6d, 0x03, 0x01, - 0x14, 0xcf, 0x4e, 0xcc, 0xc2, 0x66, 0xf3, 0x9f, 0x2d, 0xd8, 0x5e, 0x51, 0x04, 0xf4, 0x0c, 0x76, - 0xb2, 0xdc, 0xe6, 0xc5, 0x20, 0x21, 0x8b, 0x46, 0xea, 0xdc, 0x74, 0x6a, 0x01, 0xa3, 0x6c, 0x4d, - 0x77, 0xfa, 0x6b, 0xb3, 0x82, 0x9e, 0x4e, 0x2f, 0xbe, 0x79, 0xbe, 0xb9, 0xf8, 0xb2, 0x5b, 0x6f, - 0x8e, 0xfd, 0x10, 0x2a, 0x53, 0x7d, 0x3d, 0xe3, 0xec, 0x28, 0xc1, 0xe5, 0x0c, 0xd4, 0x53, 0x14, - 0x7d, 0x07, 0xb7, 0xe7, 0x48, 0x7a, 0x06, 0x99, 0x76, 0x72, 0x70, 0x75, 0x46, 0xd3, 0xe8, 0x02, - 0xd1, 0x4e, 0xc3, 0xb4, 0x31, 0xa6, 0xc4, 0x81, 0x41, 0x75, 0xe7, 0xce, 0x14, 0x69, 0x90, 0x96, - 0xdc, 0x9d, 0xca, 0xd1, 0x00, 0xdd, 0x07, 0x37, 0xdd, 0x87, 0xf1, 0x65, 0x8b, 0x09, 0x16, 0x32, - 0xae, 0x1e, 0x42, 0x65, 0x4a, 0x30, 0x9e, 0x6c, 0xad, 0xca, 0x19, 0xc5, 0x38, 0xba, 0x07, 0x10, - 0xb0, 0x50, 0x51, 0x2b, 0x52, 0x32, 0x8c, 0x92, 0x41, 0x8c, 0xc6, 0x03, 0x28, 0x67, 0xcb, 0x46, - 0x02, 0xac, 0x8f, 0x94, 0x60, 0x14, 0x22, 0xb8, 0xb3, 0x74, 0xd5, 0xda, 0x0f, 0xa0, 0xf4, 0x5d, - 0x77, 0xcd, 0xa0, 0x3a, 0x5c, 0xe7, 0xae, 0x9d, 0x6b, 0x13, 0x5c, 0x17, 0x39, 0x2b, 0x48, 0xc1, - 0xbd, 0x2b, 0x37, 0xee, 0x42, 0xc6, 0xb2, 0xc9, 0xf8, 0x7c, 0xbd, 0x2b, 0x77, 0x3e, 0x67, 0x43, - 0xe4, 0xae, 0x35, 0xff, 0x70, 0xa0, 0x9e, 0x67, 0x16, 0xb5, 0xa0, 0x68, 0xef, 0xfc, 0x74, 0x40, - 0x5e, 0xe7, 0xcb, 0x22, 0x8d, 0x44, 0x77, 0xa1, 0x34, 0xdd, 0x8f, 0xbd, 0xd2, 0xf0, 0x0c, 0xd0, - 0x75, 0xe0, 0x92, 0x24, 0x6c, 0x94, 0x30, 0x29, 0x59, 0x60, 0xba, 0xf0, 0x16, 0x76, 0xb9, 0xc4, - 0x19, 0xd4, 0xfc, 0xea, 0x40, 0x23, 0x7f, 0x73, 0xa8, 0xbd, 0xe4, 0xf1, 0x7a, 0x9f, 0x24, 0xff, - 0x97, 0xcb, 0x56, 0x0f, 0xbe, 0xf7, 0x63, 0xe1, 0x8d, 0xe2, 0x78, 0x14, 0x32, 0x4f, 0x31, 0xa9, - 0x78, 0x34, 0xf2, 0xc6, 0x2c, 0x19, 0xc6, 0x89, 0xd0, 0x22, 0xd6, 0x56, 0xfa, 0x4f, 0xc0, 0x9b, - 0xfe, 0x07, 0x68, 0x2d, 0x7f, 0xbb, 0x9f, 0xe9, 0x8f, 0xfa, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, - 0x42, 0x5b, 0xd8, 0x0f, 0x33, 0x0c, 0x00, 0x00, -} diff --git a/vendor/github.com/google/mako/go/quickstore/quickstore.go b/vendor/github.com/google/mako/go/quickstore/quickstore.go deleted file mode 100644 index 08b75d99cd60..000000000000 --- a/vendor/github.com/google/mako/go/quickstore/quickstore.go +++ /dev/null @@ -1,301 +0,0 @@ -// Copyright 2019 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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 quickstore offers a way to utilize Mako storage, downsampling, -// aggregation and analyzers in a simple way. This is most helpful when you have -// a pre-existing benchmarking tool which exports data that you would like to -// save in Mako. -// -// To use: Understand and create a Mako benchmark to hold your data. See -// go/mako-help?tmpl=storage#bench for more information about benchmarks. -// Watch 'Chart' videos at go/mako-videos for demos of the Mako -// dashboard. -// -// Basic usage: -// // Store data, metric and run aggregates will be calculated automatically. -// q := quickstore.Quickstore{BenchmarkKey: myBenchmarkKey} -// for _, data := range []float64{4, 6, 40, 3.2} { -// q.AddSamplePoint(timestampMs, data) -// output, err = q.Store() -// if err != nil { -// if output.GetStatus() == qpb.QuickstoreOutput_ANALYSIS_FAIL { -// // handle analysis failure -// } else { -// // handle error -// } -// } -// -// See more examples inside https://github.com/google/mako/blob/master/go/quickstore/quickstore_example_test.go -// -// Struct is not concurrent safe -// -// More information about quickstore: go/mako-quickstore -package quickstore - -import ( - "context" - "errors" - - "flag" - "os" - - log "github.com/golang/glog" - "github.com/golang/protobuf/proto" - "google.golang.org/grpc" - - qspb "github.com/google/mako/internal/quickstore_microservice/proto/quickstore_go_proto" - qpb "github.com/google/mako/proto/quickstore/quickstore_go_proto" - pgpb "github.com/google/mako/spec/proto/mako_go_proto" - - _ "github.com/google/mako/internal/go/common" // b/111726961 -) - -// Quickstore allows saving of data passed via Add* methods to Mako. -// Zero struct is usable but before calling Store() you must populate: -// * BenchmarkKey to the Mako benchmark you'd like your data saved to. -// OR -// * Input (with Input.BenchmarkKey set) to define more information about the -// Mako run where you data will be stored. See QuickstoreInput for more -// information. -type Quickstore struct { - // BenchmarkKey to where your data will be stored to. - BenchmarkKey string - // Allows more information to be passed about the Mako Run that will be - // created. - Input qpb.QuickstoreInput - samplePoints []*pgpb.SamplePoint - sampleErrors []*pgpb.SampleError - runAggregates []*pgpb.KeyedValue - metricAggValueKeys []string - metricAggTypes []string - metricAggValues []float64 - saverImpl saver -} - -// NewAtAddress creates a new Quickstore that connects to a Quickstore microservice at the provided gRPC address. -// -// Along with the Quickstore instance, it returns a function that can be called to request -// the microsevice terminate itself. This function can be ignored in order to leave the microservice -// running. -func NewAtAddress(ctx context.Context, input *qpb.QuickstoreInput, address string) (*Quickstore, func(context.Context), error) { - conn, err := grpc.DialContext(ctx, address, grpc.WithInsecure(), grpc.WithBlock()) - if err != nil { - log.Fatalf("did not connect: %v", err) - } - - client := qspb.NewQuickstoreClient(conn) - return &Quickstore{ - Input: *input, - saverImpl: &grpcSaver{client}, - }, func(ctx context.Context) { - client.ShutdownMicroservice(ctx, &qspb.ShutdownInput{}) - }, nil -} - -// AddSamplePoint adds a sample at the specified x-value. -// -// How the x-value is interpreted depends on your benchmark configuration. See -// BenchmarkInfo.input_value_info for more information. -// -// The map represents a mapping from metric to value. -// It is more efficient for Mako to store multiple metrics collected at -// the same xval together, but it is optional. -// -// When adding data via this function, calling the Add*Aggregate() functions -// is optional, as the aggregates will get computed by this class. -// -// An error is returned if there was a problem adding data. -func (q *Quickstore) AddSamplePoint(xval float64, valueKeyToYVals map[string]float64) error { - s := pgpb.SamplePoint{InputValue: proto.Float64(xval)} - for valueKey, value := range valueKeyToYVals { - s.MetricValueList = append(s.MetricValueList, - &pgpb.KeyedValue{ - ValueKey: proto.String(valueKey), - Value: proto.Float64(value)}) - } - q.samplePoints = append(q.samplePoints, &s) - return nil -} - -// AddError add an error at the specified xval. -// -// When adding errors via this function, the aggregate error count will be set -// automatically. -// -// An error is returned if there was a problem adding data. -func (q *Quickstore) AddError(xval float64, errorMessage string) error { - q.sampleErrors = append(q.sampleErrors, &pgpb.SampleError{InputValue: proto.Float64(xval), - ErrorMessage: proto.String(errorMessage)}) - return nil -} - -// AddRunAggregate adds an aggregate value over the entire run. -// If value_key is: -// * "~ignore_sample_count" -// * "~usable_sample_count" -// * "~error_sample_count" -// * "~benchmark_score" -// The corresponding value will be overwritten inside -// https://github.com/google/mako/blob/master/spec/proto/mako.proto -// of these values are provided, they will be calculated automatically by the -// framework based on SamplePoints/Errors provided before Store() is called. -// -// Otherwise the value_key will be set to a custom aggregate (See -// https://github.com/google/mako/blob/master/spec/proto/mako.proto -// -// If no run aggregates are manully set with this method, values are -// automatically calculated. -// -// An error is returned if there was a problem adding data. -func (q *Quickstore) AddRunAggregate(valueKey string, value float64) error { - q.runAggregates = append(q.runAggregates, &pgpb.KeyedValue{ValueKey: proto.String(valueKey), - Value: proto.Float64(value)}) - return nil -} - -// AddMetricAggregate adds an aggregate for a specific metric. -// If value_key is: -// * "min" -// * "max" -// * "mean" -// * "median" -// * "standard_deviation" -// * "median_absolute_deviation" -// * "count" -// The corresponding value inside -// https://github.com/google/mako/blob/master/spec/proto/mako.proto -// be set. -// -// The value_key can also represent a percentile see -// https://github.com/google/mako/blob/master/spec/proto/mako.proto -// -// For example "p98000" would be interpreted as the 98th percentile. These -// need to correspond to the percentiles that your benchmark has set. -// It is an error to supply an percentile that is not part of your benchmark. -// If any percentiles are provided, the automatically calculated percentiles -// will be cleared to 0. -// -// If any aggregate_types (eg. "min") are set for a value_key it will -// overwrite the entire MetricAggregate for that value_key. If no -// aggregate_types are provided for a value_key metric aggregates (including -// percentiles) will be calculated automatically based on data provided via -// calls to AddSamplePoint. -// -// An error is returned if there was a problem adding data. -func (q *Quickstore) AddMetricAggregate(valueKey string, aggregateType string, value float64) error { - q.metricAggValueKeys = append(q.metricAggValueKeys, valueKey) - q.metricAggTypes = append(q.metricAggTypes, aggregateType) - q.metricAggValues = append(q.metricAggValues, value) - return nil -} - -// Store all the values that you have added. You cannot save if no Add*() -// functions have been called. -// -// Each call to Store() will create a new unique Mako Run and store all -// Aggregate and SamplePoint data registered using the Add* methods since the -// last call to Store() as a part of that new Run. -// -// Data can be added via Add* calls in any order. -// -// An error is returned if the Store call encountered an error. See the -// QuickstoreOutput proto buffer also returned for more information about the -// failure. -func (q *Quickstore) Store() (qpb.QuickstoreOutput, error) { - // Workaround for b/137108136 to make errors in Go logs about flags not being parsed go away. - if !flag.Parsed() { - // It's possible users are using some other flag library and/or are purposely not calling flag.Parse() for some other reason which would result in a call to flag.Parse() failing. - // Instead of exiting, set things up so that we can just log the error and continue. - flag.CommandLine.Init(os.Args[0], flag.ContinueOnError) - if err := flag.CommandLine.Parse(os.Args[1:]); err != nil { - log.Errorf("Error parsing flags: %v", err) - } - } - save := q.saverImpl - - if q.BenchmarkKey != "" { - q.Input.BenchmarkKey = proto.String(q.BenchmarkKey) - } - - log.Info("Attempting to store:") - log.Infof("%d SamplePoints", len(q.samplePoints)) - log.Infof("%d SampleErrors", len(q.sampleErrors)) - log.Infof("%d Run Aggregates", len(q.runAggregates)) - log.Infof("%d Metric Aggregates", len(q.metricAggTypes)) - - out, err := save.Save(&q.Input, q.samplePoints, q.sampleErrors, q.runAggregates, q.metricAggValueKeys, q.metricAggTypes, q.metricAggValues) - - // Reset state for next call - q.samplePoints = nil - q.sampleErrors = nil - q.runAggregates = nil - q.metricAggValueKeys = nil - q.metricAggTypes = nil - q.metricAggValues = nil - - // Turn anything not a successful status into an error - if err == nil && out.GetStatus() != qpb.QuickstoreOutput_SUCCESS { - err = errors.New(out.GetSummaryOutput()) - } - - return out, err -} - -// For dependency injection during unit tests. -type saver interface { - Save(*qpb.QuickstoreInput, - []*pgpb.SamplePoint, - []*pgpb.SampleError, - []*pgpb.KeyedValue, - // Metric aggregate value keys - []string, - // Metric aggregate types - []string, - // Metric aggregate values - []float64) (qpb.QuickstoreOutput, error) -} - -type grpcSaver struct { - client qspb.QuickstoreClient -} - -func (s *grpcSaver) Save(input *qpb.QuickstoreInput, - samplePoints []*pgpb.SamplePoint, - sampleErrors []*pgpb.SampleError, - runAggregates []*pgpb.KeyedValue, - metricAggValueKeys []string, - metricAggTypes []string, - metricAggValues []float64) (qpb.QuickstoreOutput, error) { - - response, err := s.client.Store(context.Background(), - &qspb.StoreInput{ - QuickstoreInput: input, - SamplePoints: samplePoints, - SampleErrors: sampleErrors, - RunAggregates: runAggregates, - AggregateValueKeys: metricAggValueKeys, - AggregateValueTypes: metricAggTypes, - AggregateValueValues: metricAggValues, - }) - - if err != nil { - return qpb.QuickstoreOutput{}, err - } - - if response.GetQuickstoreOutput() == nil { - return qpb.QuickstoreOutput{}, nil - } - - return *response.GetQuickstoreOutput(), nil -} diff --git a/vendor/github.com/google/mako/internal/go/common/common_deps.go b/vendor/github.com/google/mako/internal/go/common/common_deps.go deleted file mode 100644 index ad9ede17c9f9..000000000000 --- a/vendor/github.com/google/mako/internal/go/common/common_deps.go +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2019 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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 common pulls in dependencies that are needed (for their side effects) for all Mako binaries. -// -package common diff --git a/vendor/github.com/google/mako/internal/quickstore_microservice/proto/quickstore_go_proto/quickstore.pb.go b/vendor/github.com/google/mako/internal/quickstore_microservice/proto/quickstore_go_proto/quickstore.pb.go deleted file mode 100644 index 412e54b61b67..000000000000 --- a/vendor/github.com/google/mako/internal/quickstore_microservice/proto/quickstore_go_proto/quickstore.pb.go +++ /dev/null @@ -1,359 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: internal/quickstore_microservice/proto/quickstore.proto - -package mako_internal_quickstore_microservice - -import ( - context "context" - fmt "fmt" - proto "github.com/golang/protobuf/proto" - quickstore_go_proto "github.com/google/mako/proto/quickstore/quickstore_go_proto" - mako_go_proto "github.com/google/mako/spec/proto/mako_go_proto" - grpc "google.golang.org/grpc" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type StoreInput struct { - QuickstoreInput *quickstore_go_proto.QuickstoreInput `protobuf:"bytes,1,opt,name=quickstore_input,json=quickstoreInput" json:"quickstore_input,omitempty"` - SamplePoints []*mako_go_proto.SamplePoint `protobuf:"bytes,2,rep,name=sample_points,json=samplePoints" json:"sample_points,omitempty"` - SampleErrors []*mako_go_proto.SampleError `protobuf:"bytes,3,rep,name=sample_errors,json=sampleErrors" json:"sample_errors,omitempty"` - RunAggregates []*mako_go_proto.KeyedValue `protobuf:"bytes,4,rep,name=run_aggregates,json=runAggregates" json:"run_aggregates,omitempty"` - AggregateValueKeys []string `protobuf:"bytes,5,rep,name=aggregate_value_keys,json=aggregateValueKeys" json:"aggregate_value_keys,omitempty"` - AggregateValueTypes []string `protobuf:"bytes,6,rep,name=aggregate_value_types,json=aggregateValueTypes" json:"aggregate_value_types,omitempty"` - AggregateValueValues []float64 `protobuf:"fixed64,7,rep,name=aggregate_value_values,json=aggregateValueValues" json:"aggregate_value_values,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *StoreInput) Reset() { *m = StoreInput{} } -func (m *StoreInput) String() string { return proto.CompactTextString(m) } -func (*StoreInput) ProtoMessage() {} -func (*StoreInput) Descriptor() ([]byte, []int) { - return fileDescriptor_80613028ee3e5eb0, []int{0} -} - -func (m *StoreInput) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_StoreInput.Unmarshal(m, b) -} -func (m *StoreInput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_StoreInput.Marshal(b, m, deterministic) -} -func (m *StoreInput) XXX_Merge(src proto.Message) { - xxx_messageInfo_StoreInput.Merge(m, src) -} -func (m *StoreInput) XXX_Size() int { - return xxx_messageInfo_StoreInput.Size(m) -} -func (m *StoreInput) XXX_DiscardUnknown() { - xxx_messageInfo_StoreInput.DiscardUnknown(m) -} - -var xxx_messageInfo_StoreInput proto.InternalMessageInfo - -func (m *StoreInput) GetQuickstoreInput() *quickstore_go_proto.QuickstoreInput { - if m != nil { - return m.QuickstoreInput - } - return nil -} - -func (m *StoreInput) GetSamplePoints() []*mako_go_proto.SamplePoint { - if m != nil { - return m.SamplePoints - } - return nil -} - -func (m *StoreInput) GetSampleErrors() []*mako_go_proto.SampleError { - if m != nil { - return m.SampleErrors - } - return nil -} - -func (m *StoreInput) GetRunAggregates() []*mako_go_proto.KeyedValue { - if m != nil { - return m.RunAggregates - } - return nil -} - -func (m *StoreInput) GetAggregateValueKeys() []string { - if m != nil { - return m.AggregateValueKeys - } - return nil -} - -func (m *StoreInput) GetAggregateValueTypes() []string { - if m != nil { - return m.AggregateValueTypes - } - return nil -} - -func (m *StoreInput) GetAggregateValueValues() []float64 { - if m != nil { - return m.AggregateValueValues - } - return nil -} - -type StoreOutput struct { - QuickstoreOutput *quickstore_go_proto.QuickstoreOutput `protobuf:"bytes,1,opt,name=quickstore_output,json=quickstoreOutput" json:"quickstore_output,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *StoreOutput) Reset() { *m = StoreOutput{} } -func (m *StoreOutput) String() string { return proto.CompactTextString(m) } -func (*StoreOutput) ProtoMessage() {} -func (*StoreOutput) Descriptor() ([]byte, []int) { - return fileDescriptor_80613028ee3e5eb0, []int{1} -} - -func (m *StoreOutput) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_StoreOutput.Unmarshal(m, b) -} -func (m *StoreOutput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_StoreOutput.Marshal(b, m, deterministic) -} -func (m *StoreOutput) XXX_Merge(src proto.Message) { - xxx_messageInfo_StoreOutput.Merge(m, src) -} -func (m *StoreOutput) XXX_Size() int { - return xxx_messageInfo_StoreOutput.Size(m) -} -func (m *StoreOutput) XXX_DiscardUnknown() { - xxx_messageInfo_StoreOutput.DiscardUnknown(m) -} - -var xxx_messageInfo_StoreOutput proto.InternalMessageInfo - -func (m *StoreOutput) GetQuickstoreOutput() *quickstore_go_proto.QuickstoreOutput { - if m != nil { - return m.QuickstoreOutput - } - return nil -} - -type ShutdownInput struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ShutdownInput) Reset() { *m = ShutdownInput{} } -func (m *ShutdownInput) String() string { return proto.CompactTextString(m) } -func (*ShutdownInput) ProtoMessage() {} -func (*ShutdownInput) Descriptor() ([]byte, []int) { - return fileDescriptor_80613028ee3e5eb0, []int{2} -} - -func (m *ShutdownInput) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ShutdownInput.Unmarshal(m, b) -} -func (m *ShutdownInput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ShutdownInput.Marshal(b, m, deterministic) -} -func (m *ShutdownInput) XXX_Merge(src proto.Message) { - xxx_messageInfo_ShutdownInput.Merge(m, src) -} -func (m *ShutdownInput) XXX_Size() int { - return xxx_messageInfo_ShutdownInput.Size(m) -} -func (m *ShutdownInput) XXX_DiscardUnknown() { - xxx_messageInfo_ShutdownInput.DiscardUnknown(m) -} - -var xxx_messageInfo_ShutdownInput proto.InternalMessageInfo - -type ShutdownOutput struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ShutdownOutput) Reset() { *m = ShutdownOutput{} } -func (m *ShutdownOutput) String() string { return proto.CompactTextString(m) } -func (*ShutdownOutput) ProtoMessage() {} -func (*ShutdownOutput) Descriptor() ([]byte, []int) { - return fileDescriptor_80613028ee3e5eb0, []int{3} -} - -func (m *ShutdownOutput) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ShutdownOutput.Unmarshal(m, b) -} -func (m *ShutdownOutput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ShutdownOutput.Marshal(b, m, deterministic) -} -func (m *ShutdownOutput) XXX_Merge(src proto.Message) { - xxx_messageInfo_ShutdownOutput.Merge(m, src) -} -func (m *ShutdownOutput) XXX_Size() int { - return xxx_messageInfo_ShutdownOutput.Size(m) -} -func (m *ShutdownOutput) XXX_DiscardUnknown() { - xxx_messageInfo_ShutdownOutput.DiscardUnknown(m) -} - -var xxx_messageInfo_ShutdownOutput proto.InternalMessageInfo - -func init() { - proto.RegisterType((*StoreInput)(nil), "mako.internal.quickstore_microservice.StoreInput") - proto.RegisterType((*StoreOutput)(nil), "mako.internal.quickstore_microservice.StoreOutput") - proto.RegisterType((*ShutdownInput)(nil), "mako.internal.quickstore_microservice.ShutdownInput") - proto.RegisterType((*ShutdownOutput)(nil), "mako.internal.quickstore_microservice.ShutdownOutput") -} - -func init() { - proto.RegisterFile("internal/quickstore_microservice/proto/quickstore.proto", fileDescriptor_80613028ee3e5eb0) -} - -var fileDescriptor_80613028ee3e5eb0 = []byte{ - // 408 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0xcd, 0x8e, 0xda, 0x30, - 0x14, 0x85, 0x1b, 0x52, 0x5a, 0xf5, 0x52, 0xfe, 0x5c, 0xa8, 0xa2, 0xac, 0x42, 0xa4, 0x4a, 0x59, - 0x85, 0x36, 0xa2, 0x65, 0xdd, 0x45, 0x17, 0x15, 0xea, 0x5f, 0xa8, 0xba, 0xab, 0xa2, 0x28, 0x58, - 0x4c, 0x04, 0xc4, 0xc1, 0x76, 0x18, 0xe5, 0x01, 0x66, 0x1e, 0x63, 0x9e, 0x75, 0x94, 0x1b, 0x12, - 0x0c, 0x68, 0x46, 0xb0, 0xb1, 0xec, 0x7b, 0xee, 0x77, 0x7c, 0x93, 0x63, 0x98, 0xc6, 0x89, 0xa4, - 0x3c, 0x09, 0xd7, 0xe3, 0x6d, 0x16, 0x47, 0x2b, 0x21, 0x19, 0xa7, 0xc1, 0x26, 0x8e, 0x38, 0x13, - 0x94, 0xef, 0xe2, 0x88, 0x8e, 0x53, 0xce, 0x24, 0x53, 0x54, 0x17, 0x0b, 0xe4, 0xc3, 0x26, 0x5c, - 0x31, 0xb7, 0xa2, 0xdd, 0x27, 0x68, 0x73, 0x74, 0x8a, 0x9f, 0x39, 0x99, 0x43, 0x91, 0xd2, 0x68, - 0x7f, 0x0d, 0x9a, 0xe2, 0xd6, 0x7e, 0xd0, 0x01, 0xe6, 0x45, 0xdb, 0xf7, 0x24, 0xcd, 0x24, 0x99, - 0x41, 0x4f, 0xb9, 0x23, 0x2e, 0x6a, 0x86, 0x66, 0x69, 0x4e, 0xcb, 0xb3, 0x5c, 0xa4, 0x14, 0xdf, - 0x3f, 0xf5, 0x16, 0x59, 0xbf, 0xbb, 0x3d, 0x2e, 0x90, 0x2f, 0xd0, 0x16, 0xe1, 0x26, 0x5d, 0xd3, - 0x20, 0x65, 0x71, 0x22, 0x85, 0xd1, 0xb0, 0x74, 0xa7, 0xe5, 0xf5, 0x4b, 0xa7, 0x39, 0x4a, 0xbf, - 0x0b, 0xc5, 0x7f, 0x2b, 0x0e, 0x07, 0xa1, 0x70, 0x94, 0x73, 0xc6, 0x85, 0xa1, 0x9f, 0x73, 0xdf, - 0x0a, 0xa5, 0xe2, 0xf0, 0x20, 0xc8, 0x14, 0x3a, 0x3c, 0x4b, 0x82, 0x70, 0xb9, 0xe4, 0x74, 0x19, - 0x4a, 0x2a, 0x8c, 0x97, 0x08, 0xf6, 0x4a, 0x70, 0x46, 0x73, 0xba, 0xf8, 0x17, 0xae, 0x33, 0xea, - 0xb7, 0x79, 0x96, 0x7c, 0xad, 0xdb, 0xc8, 0x47, 0x18, 0xd4, 0x50, 0xb0, 0x2b, 0x3a, 0x82, 0x15, - 0xcd, 0x85, 0xd1, 0xb4, 0x74, 0xe7, 0x8d, 0x4f, 0x6a, 0x0d, 0xe1, 0x19, 0xcd, 0x05, 0xf1, 0x60, - 0x78, 0x4a, 0xc8, 0x3c, 0xa5, 0xc2, 0x78, 0x85, 0xc8, 0xbb, 0x63, 0xe4, 0x6f, 0x21, 0x91, 0x09, - 0xbc, 0x3f, 0x65, 0x70, 0x15, 0xc6, 0x6b, 0x4b, 0x77, 0x34, 0x7f, 0x70, 0x0c, 0xe1, 0x22, 0xec, - 0xff, 0xd0, 0xc2, 0x7c, 0x7e, 0x65, 0xb2, 0xf8, 0xa7, 0x3f, 0xa1, 0xaf, 0x04, 0xc4, 0xb0, 0xb8, - 0x4f, 0x68, 0xf4, 0x4c, 0x42, 0x25, 0xed, 0x2b, 0xe1, 0x96, 0x15, 0xbb, 0x0b, 0xed, 0xf9, 0x4d, - 0x26, 0x17, 0xec, 0x36, 0xc1, 0xd0, 0xec, 0x1e, 0x74, 0xaa, 0x42, 0xd9, 0xe2, 0xdd, 0x37, 0x00, - 0x0e, 0x4e, 0x24, 0x85, 0x26, 0x0e, 0x44, 0x3e, 0xb9, 0x17, 0x3d, 0x4e, 0xf7, 0xf0, 0xbc, 0x4c, - 0xef, 0x1a, 0x64, 0x3f, 0xe1, 0x0b, 0x72, 0xa7, 0xc1, 0xa0, 0x9a, 0xe9, 0x87, 0xd2, 0x46, 0x26, - 0x97, 0xda, 0xa9, 0x5f, 0x68, 0x7e, 0xbe, 0x92, 0xaa, 0xe6, 0x78, 0x0c, 0x00, 0x00, 0xff, 0xff, - 0xe2, 0xb4, 0xaf, 0x68, 0xc6, 0x03, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// QuickstoreClient is the client API for Quickstore service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type QuickstoreClient interface { - Store(ctx context.Context, in *StoreInput, opts ...grpc.CallOption) (*StoreOutput, error) - ShutdownMicroservice(ctx context.Context, in *ShutdownInput, opts ...grpc.CallOption) (*ShutdownOutput, error) -} - -type quickstoreClient struct { - cc *grpc.ClientConn -} - -func NewQuickstoreClient(cc *grpc.ClientConn) QuickstoreClient { - return &quickstoreClient{cc} -} - -func (c *quickstoreClient) Store(ctx context.Context, in *StoreInput, opts ...grpc.CallOption) (*StoreOutput, error) { - out := new(StoreOutput) - err := c.cc.Invoke(ctx, "/mako.internal.quickstore_microservice.Quickstore/Store", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *quickstoreClient) ShutdownMicroservice(ctx context.Context, in *ShutdownInput, opts ...grpc.CallOption) (*ShutdownOutput, error) { - out := new(ShutdownOutput) - err := c.cc.Invoke(ctx, "/mako.internal.quickstore_microservice.Quickstore/ShutdownMicroservice", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// QuickstoreServer is the server API for Quickstore service. -type QuickstoreServer interface { - Store(context.Context, *StoreInput) (*StoreOutput, error) - ShutdownMicroservice(context.Context, *ShutdownInput) (*ShutdownOutput, error) -} - -func RegisterQuickstoreServer(s *grpc.Server, srv QuickstoreServer) { - s.RegisterService(&_Quickstore_serviceDesc, srv) -} - -func _Quickstore_Store_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(StoreInput) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QuickstoreServer).Store(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/mako.internal.quickstore_microservice.Quickstore/Store", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QuickstoreServer).Store(ctx, req.(*StoreInput)) - } - return interceptor(ctx, in, info, handler) -} - -func _Quickstore_ShutdownMicroservice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ShutdownInput) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QuickstoreServer).ShutdownMicroservice(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/mako.internal.quickstore_microservice.Quickstore/ShutdownMicroservice", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QuickstoreServer).ShutdownMicroservice(ctx, req.(*ShutdownInput)) - } - return interceptor(ctx, in, info, handler) -} - -var _Quickstore_serviceDesc = grpc.ServiceDesc{ - ServiceName: "mako.internal.quickstore_microservice.Quickstore", - HandlerType: (*QuickstoreServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Store", - Handler: _Quickstore_Store_Handler, - }, - { - MethodName: "ShutdownMicroservice", - Handler: _Quickstore_ShutdownMicroservice_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "internal/quickstore_microservice/proto/quickstore.proto", -} diff --git a/vendor/github.com/google/mako/proto/quickstore/quickstore_go_proto/quickstore.pb.go b/vendor/github.com/google/mako/proto/quickstore/quickstore_go_proto/quickstore.pb.go deleted file mode 100644 index 0bf4b457d409..000000000000 --- a/vendor/github.com/google/mako/proto/quickstore/quickstore_go_proto/quickstore.pb.go +++ /dev/null @@ -1,439 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: proto/quickstore/quickstore.proto - -package mako_quickstore - -import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - threshold_analyzer_go_proto "github.com/google/mako/clients/proto/analyzers/threshold_analyzer_go_proto" - utest_analyzer_go_proto "github.com/google/mako/clients/proto/analyzers/utest_analyzer_go_proto" - window_deviation_go_proto "github.com/google/mako/clients/proto/analyzers/window_deviation_go_proto" - mako_go_proto "github.com/google/mako/spec/proto/mako_go_proto" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type QuickstoreOutput_Status int32 - -const ( - QuickstoreOutput_SUCCESS QuickstoreOutput_Status = 1 - QuickstoreOutput_ERROR QuickstoreOutput_Status = 2 - QuickstoreOutput_ANALYSIS_FAIL QuickstoreOutput_Status = 4 -) - -var QuickstoreOutput_Status_name = map[int32]string{ - 1: "SUCCESS", - 2: "ERROR", - 4: "ANALYSIS_FAIL", -} - -var QuickstoreOutput_Status_value = map[string]int32{ - "SUCCESS": 1, - "ERROR": 2, - "ANALYSIS_FAIL": 4, -} - -func (x QuickstoreOutput_Status) Enum() *QuickstoreOutput_Status { - p := new(QuickstoreOutput_Status) - *p = x - return p -} - -func (x QuickstoreOutput_Status) String() string { - return proto.EnumName(QuickstoreOutput_Status_name, int32(x)) -} - -func (x *QuickstoreOutput_Status) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(QuickstoreOutput_Status_value, data, "QuickstoreOutput_Status") - if err != nil { - return err - } - *x = QuickstoreOutput_Status(value) - return nil -} - -func (QuickstoreOutput_Status) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_1383215e6ee55b1f, []int{1, 0} -} - -type QuickstoreInput struct { - BenchmarkKey *string `protobuf:"bytes,1,opt,name=benchmark_key,json=benchmarkKey" json:"benchmark_key,omitempty"` - TimestampMs *float64 `protobuf:"fixed64,2,opt,name=timestamp_ms,json=timestampMs" json:"timestamp_ms,omitempty"` - BuildId *int64 `protobuf:"varint,20,opt,name=build_id,json=buildId" json:"build_id,omitempty"` - DurationTimeMs *float64 `protobuf:"fixed64,3,opt,name=duration_time_ms,json=durationTimeMs" json:"duration_time_ms,omitempty"` - Tags []string `protobuf:"bytes,4,rep,name=tags" json:"tags,omitempty"` - HoverText *string `protobuf:"bytes,14,opt,name=hover_text,json=hoverText" json:"hover_text,omitempty"` - Description *string `protobuf:"bytes,6,opt,name=description" json:"description,omitempty"` - TestPassId *string `protobuf:"bytes,18,opt,name=test_pass_id,json=testPassId" json:"test_pass_id,omitempty"` - AnnotationList []*mako_go_proto.RunAnnotation `protobuf:"bytes,7,rep,name=annotation_list,json=annotationList" json:"annotation_list,omitempty"` - HyperlinkList []*mako_go_proto.NamedData `protobuf:"bytes,8,rep,name=hyperlink_list,json=hyperlinkList" json:"hyperlink_list,omitempty"` - AuxData []*mako_go_proto.NamedData `protobuf:"bytes,17,rep,name=aux_data,json=auxData" json:"aux_data,omitempty"` - IgnoreRangeList []*mako_go_proto.LabeledRange `protobuf:"bytes,9,rep,name=ignore_range_list,json=ignoreRangeList" json:"ignore_range_list,omitempty"` - TempDir *string `protobuf:"bytes,21,opt,name=temp_dir,json=tempDir" json:"temp_dir,omitempty"` - DeleteSampleFiles *bool `protobuf:"varint,22,opt,name=delete_sample_files,json=deleteSampleFiles,def=1" json:"delete_sample_files,omitempty"` - AnalysisPass *QuickstoreInput_ConditionalFields `protobuf:"bytes,10,opt,name=analysis_pass,json=analysisPass" json:"analysis_pass,omitempty"` - AnalysisFail *QuickstoreInput_ConditionalFields `protobuf:"bytes,11,opt,name=analysis_fail,json=analysisFail" json:"analysis_fail,omitempty"` - ThresholdInputs []*threshold_analyzer_go_proto.ThresholdAnalyzerInput `protobuf:"bytes,12,rep,name=threshold_inputs,json=thresholdInputs" json:"threshold_inputs,omitempty"` - WdaInputs []*window_deviation_go_proto.WindowDeviationInput `protobuf:"bytes,13,rep,name=wda_inputs,json=wdaInputs" json:"wda_inputs,omitempty"` - UtestInputs []*utest_analyzer_go_proto.UTestAnalyzerInput `protobuf:"bytes,16,rep,name=utest_inputs,json=utestInputs" json:"utest_inputs,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *QuickstoreInput) Reset() { *m = QuickstoreInput{} } -func (m *QuickstoreInput) String() string { return proto.CompactTextString(m) } -func (*QuickstoreInput) ProtoMessage() {} -func (*QuickstoreInput) Descriptor() ([]byte, []int) { - return fileDescriptor_1383215e6ee55b1f, []int{0} -} - -func (m *QuickstoreInput) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_QuickstoreInput.Unmarshal(m, b) -} -func (m *QuickstoreInput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_QuickstoreInput.Marshal(b, m, deterministic) -} -func (m *QuickstoreInput) XXX_Merge(src proto.Message) { - xxx_messageInfo_QuickstoreInput.Merge(m, src) -} -func (m *QuickstoreInput) XXX_Size() int { - return xxx_messageInfo_QuickstoreInput.Size(m) -} -func (m *QuickstoreInput) XXX_DiscardUnknown() { - xxx_messageInfo_QuickstoreInput.DiscardUnknown(m) -} - -var xxx_messageInfo_QuickstoreInput proto.InternalMessageInfo - -const Default_QuickstoreInput_DeleteSampleFiles bool = true - -func (m *QuickstoreInput) GetBenchmarkKey() string { - if m != nil && m.BenchmarkKey != nil { - return *m.BenchmarkKey - } - return "" -} - -func (m *QuickstoreInput) GetTimestampMs() float64 { - if m != nil && m.TimestampMs != nil { - return *m.TimestampMs - } - return 0 -} - -func (m *QuickstoreInput) GetBuildId() int64 { - if m != nil && m.BuildId != nil { - return *m.BuildId - } - return 0 -} - -func (m *QuickstoreInput) GetDurationTimeMs() float64 { - if m != nil && m.DurationTimeMs != nil { - return *m.DurationTimeMs - } - return 0 -} - -func (m *QuickstoreInput) GetTags() []string { - if m != nil { - return m.Tags - } - return nil -} - -func (m *QuickstoreInput) GetHoverText() string { - if m != nil && m.HoverText != nil { - return *m.HoverText - } - return "" -} - -func (m *QuickstoreInput) GetDescription() string { - if m != nil && m.Description != nil { - return *m.Description - } - return "" -} - -func (m *QuickstoreInput) GetTestPassId() string { - if m != nil && m.TestPassId != nil { - return *m.TestPassId - } - return "" -} - -func (m *QuickstoreInput) GetAnnotationList() []*mako_go_proto.RunAnnotation { - if m != nil { - return m.AnnotationList - } - return nil -} - -func (m *QuickstoreInput) GetHyperlinkList() []*mako_go_proto.NamedData { - if m != nil { - return m.HyperlinkList - } - return nil -} - -func (m *QuickstoreInput) GetAuxData() []*mako_go_proto.NamedData { - if m != nil { - return m.AuxData - } - return nil -} - -func (m *QuickstoreInput) GetIgnoreRangeList() []*mako_go_proto.LabeledRange { - if m != nil { - return m.IgnoreRangeList - } - return nil -} - -func (m *QuickstoreInput) GetTempDir() string { - if m != nil && m.TempDir != nil { - return *m.TempDir - } - return "" -} - -func (m *QuickstoreInput) GetDeleteSampleFiles() bool { - if m != nil && m.DeleteSampleFiles != nil { - return *m.DeleteSampleFiles - } - return Default_QuickstoreInput_DeleteSampleFiles -} - -func (m *QuickstoreInput) GetAnalysisPass() *QuickstoreInput_ConditionalFields { - if m != nil { - return m.AnalysisPass - } - return nil -} - -func (m *QuickstoreInput) GetAnalysisFail() *QuickstoreInput_ConditionalFields { - if m != nil { - return m.AnalysisFail - } - return nil -} - -func (m *QuickstoreInput) GetThresholdInputs() []*threshold_analyzer_go_proto.ThresholdAnalyzerInput { - if m != nil { - return m.ThresholdInputs - } - return nil -} - -func (m *QuickstoreInput) GetWdaInputs() []*window_deviation_go_proto.WindowDeviationInput { - if m != nil { - return m.WdaInputs - } - return nil -} - -func (m *QuickstoreInput) GetUtestInputs() []*utest_analyzer_go_proto.UTestAnalyzerInput { - if m != nil { - return m.UtestInputs - } - return nil -} - -type QuickstoreInput_ConditionalFields struct { - Tags []string `protobuf:"bytes,1,rep,name=tags" json:"tags,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *QuickstoreInput_ConditionalFields) Reset() { *m = QuickstoreInput_ConditionalFields{} } -func (m *QuickstoreInput_ConditionalFields) String() string { return proto.CompactTextString(m) } -func (*QuickstoreInput_ConditionalFields) ProtoMessage() {} -func (*QuickstoreInput_ConditionalFields) Descriptor() ([]byte, []int) { - return fileDescriptor_1383215e6ee55b1f, []int{0, 0} -} - -func (m *QuickstoreInput_ConditionalFields) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_QuickstoreInput_ConditionalFields.Unmarshal(m, b) -} -func (m *QuickstoreInput_ConditionalFields) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_QuickstoreInput_ConditionalFields.Marshal(b, m, deterministic) -} -func (m *QuickstoreInput_ConditionalFields) XXX_Merge(src proto.Message) { - xxx_messageInfo_QuickstoreInput_ConditionalFields.Merge(m, src) -} -func (m *QuickstoreInput_ConditionalFields) XXX_Size() int { - return xxx_messageInfo_QuickstoreInput_ConditionalFields.Size(m) -} -func (m *QuickstoreInput_ConditionalFields) XXX_DiscardUnknown() { - xxx_messageInfo_QuickstoreInput_ConditionalFields.DiscardUnknown(m) -} - -var xxx_messageInfo_QuickstoreInput_ConditionalFields proto.InternalMessageInfo - -func (m *QuickstoreInput_ConditionalFields) GetTags() []string { - if m != nil { - return m.Tags - } - return nil -} - -type QuickstoreOutput struct { - Status *QuickstoreOutput_Status `protobuf:"varint,1,opt,name=status,enum=mako.quickstore.QuickstoreOutput_Status" json:"status,omitempty"` - AnalyzerOutputList []*mako_go_proto.AnalyzerOutput `protobuf:"bytes,2,rep,name=analyzer_output_list,json=analyzerOutputList" json:"analyzer_output_list,omitempty"` - SummaryOutput *string `protobuf:"bytes,3,opt,name=summary_output,json=summaryOutput" json:"summary_output,omitempty"` - RunChartLink *string `protobuf:"bytes,4,opt,name=run_chart_link,json=runChartLink" json:"run_chart_link,omitempty"` - RunKey *string `protobuf:"bytes,5,opt,name=run_key,json=runKey" json:"run_key,omitempty"` - GeneratedSampleFiles []string `protobuf:"bytes,6,rep,name=generated_sample_files,json=generatedSampleFiles" json:"generated_sample_files,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *QuickstoreOutput) Reset() { *m = QuickstoreOutput{} } -func (m *QuickstoreOutput) String() string { return proto.CompactTextString(m) } -func (*QuickstoreOutput) ProtoMessage() {} -func (*QuickstoreOutput) Descriptor() ([]byte, []int) { - return fileDescriptor_1383215e6ee55b1f, []int{1} -} - -func (m *QuickstoreOutput) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_QuickstoreOutput.Unmarshal(m, b) -} -func (m *QuickstoreOutput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_QuickstoreOutput.Marshal(b, m, deterministic) -} -func (m *QuickstoreOutput) XXX_Merge(src proto.Message) { - xxx_messageInfo_QuickstoreOutput.Merge(m, src) -} -func (m *QuickstoreOutput) XXX_Size() int { - return xxx_messageInfo_QuickstoreOutput.Size(m) -} -func (m *QuickstoreOutput) XXX_DiscardUnknown() { - xxx_messageInfo_QuickstoreOutput.DiscardUnknown(m) -} - -var xxx_messageInfo_QuickstoreOutput proto.InternalMessageInfo - -func (m *QuickstoreOutput) GetStatus() QuickstoreOutput_Status { - if m != nil && m.Status != nil { - return *m.Status - } - return QuickstoreOutput_SUCCESS -} - -func (m *QuickstoreOutput) GetAnalyzerOutputList() []*mako_go_proto.AnalyzerOutput { - if m != nil { - return m.AnalyzerOutputList - } - return nil -} - -func (m *QuickstoreOutput) GetSummaryOutput() string { - if m != nil && m.SummaryOutput != nil { - return *m.SummaryOutput - } - return "" -} - -func (m *QuickstoreOutput) GetRunChartLink() string { - if m != nil && m.RunChartLink != nil { - return *m.RunChartLink - } - return "" -} - -func (m *QuickstoreOutput) GetRunKey() string { - if m != nil && m.RunKey != nil { - return *m.RunKey - } - return "" -} - -func (m *QuickstoreOutput) GetGeneratedSampleFiles() []string { - if m != nil { - return m.GeneratedSampleFiles - } - return nil -} - -func init() { - proto.RegisterEnum("mako.quickstore.QuickstoreOutput_Status", QuickstoreOutput_Status_name, QuickstoreOutput_Status_value) - proto.RegisterType((*QuickstoreInput)(nil), "mako.quickstore.QuickstoreInput") - proto.RegisterType((*QuickstoreInput_ConditionalFields)(nil), "mako.quickstore.QuickstoreInput.ConditionalFields") - proto.RegisterType((*QuickstoreOutput)(nil), "mako.quickstore.QuickstoreOutput") -} - -func init() { proto.RegisterFile("proto/quickstore/quickstore.proto", fileDescriptor_1383215e6ee55b1f) } - -var fileDescriptor_1383215e6ee55b1f = []byte{ - // 871 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0x6d, 0x6f, 0xdb, 0x36, - 0x10, 0x86, 0x13, 0xd7, 0x2f, 0xf4, 0x9b, 0xcc, 0xb8, 0x9d, 0x1a, 0x60, 0x80, 0x9b, 0x6d, 0xa8, - 0xb0, 0x6e, 0xca, 0x90, 0x15, 0x03, 0x36, 0x0c, 0xc3, 0xbc, 0xa4, 0x06, 0x9c, 0xb9, 0xed, 0x26, - 0xa7, 0x28, 0xf6, 0x49, 0x60, 0xcc, 0x8b, 0x4d, 0x58, 0xa2, 0x34, 0x92, 0x6a, 0xe2, 0xfd, 0xad, - 0xfd, 0xae, 0xfd, 0x87, 0x81, 0x47, 0x5b, 0x4e, 0xd2, 0x76, 0x5f, 0xf6, 0x8d, 0x7c, 0xee, 0x79, - 0x1e, 0x1e, 0x8f, 0xbc, 0x23, 0x4f, 0x72, 0x95, 0x99, 0xec, 0xf8, 0xcf, 0x42, 0xcc, 0x57, 0xda, - 0x64, 0x0a, 0x6e, 0x2d, 0x43, 0x8c, 0xd1, 0x5e, 0xca, 0x56, 0x59, 0xb8, 0x83, 0x0f, 0xbf, 0x99, - 0x27, 0x02, 0xa4, 0xd1, 0xc7, 0x4e, 0xcb, 0x24, 0x4b, 0xd6, 0x7f, 0x81, 0xd2, 0xc7, 0x66, 0xa9, - 0x40, 0x2f, 0xb3, 0x84, 0xc7, 0x5b, 0xcc, 0x59, 0x1c, 0x7e, 0xf5, 0x31, 0x45, 0x61, 0x40, 0x9b, - 0xfb, 0xec, 0xf0, 0x63, 0xec, 0x6b, 0x21, 0x79, 0x76, 0x1d, 0x73, 0x78, 0x27, 0x98, 0x11, 0x99, - 0xdc, 0xf0, 0x1f, 0xea, 0x1c, 0xe6, 0x1b, 0x32, 0xe6, 0x8a, 0xcb, 0xa3, 0xbf, 0x1b, 0xa4, 0xf7, - 0x7b, 0x99, 0xf5, 0x44, 0xe6, 0x85, 0xa1, 0x9f, 0x91, 0xce, 0x25, 0xc8, 0xf9, 0x32, 0x65, 0x6a, - 0x15, 0xaf, 0x60, 0xed, 0x57, 0x86, 0x95, 0xa0, 0x19, 0xb5, 0x4b, 0xf0, 0x57, 0x58, 0xd3, 0x27, - 0xa4, 0x6d, 0x44, 0x0a, 0xda, 0xb0, 0x34, 0x8f, 0x53, 0xed, 0xef, 0x0d, 0x2b, 0x41, 0x25, 0x6a, - 0x95, 0xd8, 0x4b, 0x4d, 0x1f, 0x93, 0xc6, 0x65, 0x21, 0x12, 0x1e, 0x0b, 0xee, 0x0f, 0x86, 0x95, - 0x60, 0x3f, 0xaa, 0xe3, 0x7e, 0xc2, 0x69, 0x40, 0x3c, 0x5e, 0x28, 0xcc, 0x2f, 0xb6, 0x12, 0xeb, - 0xb0, 0x8f, 0x0e, 0xdd, 0x2d, 0x7e, 0x21, 0x52, 0x78, 0xa9, 0x29, 0x25, 0x55, 0xc3, 0x16, 0xda, - 0xaf, 0x0e, 0xf7, 0x83, 0x66, 0x84, 0x6b, 0xfa, 0x29, 0x21, 0xcb, 0xec, 0x1d, 0xa8, 0xd8, 0xc0, - 0x8d, 0xf1, 0xbb, 0x98, 0x5d, 0x13, 0x91, 0x0b, 0xb8, 0x31, 0x74, 0x48, 0x5a, 0x1c, 0xf4, 0x5c, - 0x89, 0xdc, 0xfa, 0xf8, 0x35, 0x8c, 0xdf, 0x86, 0xe8, 0x90, 0xb4, 0xb1, 0xa6, 0x39, 0xd3, 0xda, - 0x66, 0x47, 0x91, 0x42, 0x2c, 0xf6, 0x1b, 0xd3, 0x7a, 0xc2, 0xe9, 0x8f, 0xa4, 0xc7, 0xa4, 0xcc, - 0x8c, 0x4b, 0x31, 0x11, 0xda, 0xf8, 0xf5, 0xe1, 0x7e, 0xd0, 0x3a, 0x39, 0x08, 0xb1, 0x7a, 0x51, - 0x21, 0x47, 0x65, 0x3c, 0xea, 0xee, 0xb8, 0x53, 0xa1, 0x0d, 0xfd, 0x8e, 0x74, 0x97, 0xeb, 0x1c, - 0x54, 0x22, 0xe4, 0xca, 0x89, 0x1b, 0x28, 0xee, 0x39, 0xf1, 0x2b, 0x96, 0x02, 0x3f, 0x63, 0x86, - 0x45, 0x9d, 0x92, 0x86, 0xba, 0x2f, 0x49, 0x83, 0x15, 0x37, 0x31, 0x67, 0x86, 0xf9, 0xfd, 0x0f, - 0x2b, 0xea, 0xac, 0xb8, 0xb1, 0x0b, 0xfa, 0x13, 0xe9, 0x8b, 0x85, 0xcc, 0x14, 0xc4, 0x8a, 0xc9, - 0x05, 0xb8, 0x63, 0x9a, 0x28, 0xa2, 0x4e, 0x34, 0x65, 0x97, 0x90, 0x00, 0x8f, 0x6c, 0x38, 0xea, - 0x39, 0x32, 0x6e, 0xf0, 0xac, 0xc7, 0xa4, 0x61, 0x20, 0xcd, 0x63, 0x2e, 0x94, 0xff, 0x10, 0xef, - 0x5f, 0xb7, 0xfb, 0x33, 0xa1, 0xe8, 0x73, 0x72, 0xc0, 0x21, 0x01, 0x03, 0xb1, 0x66, 0x69, 0x9e, - 0x40, 0x7c, 0x25, 0x12, 0xd0, 0xfe, 0xa3, 0x61, 0x25, 0x68, 0xfc, 0x50, 0x35, 0xaa, 0x80, 0xa8, - 0xef, 0x08, 0x33, 0x8c, 0x8f, 0x6d, 0x98, 0xbe, 0x25, 0x1d, 0xfc, 0x85, 0x5a, 0x68, 0x2c, 0xac, - 0x4f, 0x86, 0x95, 0xa0, 0x75, 0x72, 0x12, 0xde, 0x6b, 0x8d, 0xf0, 0xde, 0x7f, 0x0b, 0x4f, 0x33, - 0xc9, 0x85, 0xad, 0x1d, 0x4b, 0xc6, 0x02, 0x12, 0xae, 0xa3, 0xf6, 0xd6, 0xc8, 0xbe, 0xc6, 0x1d, - 0xe3, 0x2b, 0x26, 0x12, 0xbf, 0xf5, 0xff, 0x8d, 0xc7, 0x4c, 0x24, 0x94, 0x13, 0x6f, 0xd7, 0x8d, - 0xc2, 0x4a, 0xb4, 0xdf, 0xc6, 0x0a, 0x7e, 0xef, 0xbc, 0xcb, 0xae, 0x0a, 0x3f, 0xd0, 0xb5, 0x17, - 0x5b, 0x68, 0xb4, 0x41, 0xf0, 0xd0, 0xa8, 0x57, 0x52, 0x71, 0xaf, 0xe9, 0x39, 0x21, 0xd7, 0x9c, - 0x6d, 0xfd, 0x3b, 0xe8, 0xff, 0xcc, 0xf9, 0xbf, 0xd7, 0xab, 0x6f, 0x11, 0x38, 0xdb, 0xee, 0x9d, - 0x63, 0xf3, 0x9a, 0xb3, 0xd2, 0xab, 0xed, 0xa6, 0xc1, 0xc6, 0xcd, 0x43, 0xb7, 0xa7, 0xce, 0xed, - 0xde, 0x9c, 0x78, 0x73, 0x01, 0xda, 0xdc, 0xcd, 0xad, 0x85, 0x14, 0xe7, 0x75, 0xf8, 0x94, 0xf4, - 0xdf, 0x2b, 0x50, 0xd9, 0x6e, 0x95, 0x5d, 0xbb, 0x9d, 0x57, 0x1b, 0x3d, 0xcf, 0x3b, 0xaf, 0x36, - 0x0e, 0xbc, 0xc1, 0x79, 0xb5, 0xf1, 0xc0, 0xab, 0x1d, 0xfd, 0xb3, 0x47, 0xbc, 0x5d, 0xb1, 0x5f, - 0x17, 0xc6, 0x8e, 0x8d, 0x9f, 0x49, 0x4d, 0x1b, 0x66, 0x0a, 0x8d, 0xf3, 0xa2, 0x7b, 0x12, 0xfc, - 0xc7, 0xfb, 0x38, 0x49, 0x38, 0x43, 0x7e, 0xb4, 0xd1, 0xd1, 0x31, 0x19, 0x6c, 0xb3, 0x8f, 0x33, - 0x64, 0xb8, 0x5f, 0xbd, 0x87, 0xb7, 0x1c, 0x38, 0xbf, 0xed, 0x8d, 0x9c, 0x45, 0x44, 0xd9, 0x9d, - 0x3d, 0x7e, 0xed, 0x2f, 0x48, 0x57, 0x17, 0x69, 0xca, 0xd4, 0x7a, 0x63, 0x83, 0xb3, 0xa5, 0x19, - 0x75, 0x36, 0xe8, 0x26, 0xe1, 0xcf, 0x49, 0x57, 0x15, 0x32, 0x9e, 0x2f, 0x99, 0xb2, 0x07, 0xc9, - 0x95, 0x5f, 0x75, 0x83, 0x4e, 0x15, 0xf2, 0xd4, 0x82, 0x53, 0x21, 0x57, 0xf4, 0x13, 0x52, 0xb7, - 0x2c, 0x3b, 0x07, 0x1f, 0x60, 0xb8, 0xa6, 0x0a, 0x69, 0x27, 0xe0, 0x73, 0xf2, 0x68, 0x01, 0x12, - 0x14, 0x33, 0xc0, 0xef, 0x36, 0x4a, 0x0d, 0x8b, 0x37, 0x28, 0xa3, 0xb7, 0xba, 0xe4, 0xe8, 0x5b, - 0x52, 0x73, 0xb7, 0xa6, 0x2d, 0x52, 0x9f, 0xbd, 0x39, 0x3d, 0x7d, 0x31, 0x9b, 0x79, 0x15, 0xda, - 0x24, 0x0f, 0x5e, 0x44, 0xd1, 0xeb, 0xc8, 0xdb, 0xa3, 0x7d, 0xd2, 0x19, 0xbd, 0x1a, 0x4d, 0xff, - 0x98, 0x4d, 0x66, 0xf1, 0x78, 0x34, 0x99, 0x7a, 0xd5, 0x5f, 0xbe, 0x26, 0xcf, 0xe6, 0x59, 0x1a, - 0x2e, 0xb2, 0x6c, 0x91, 0x40, 0x68, 0xdf, 0x50, 0xc8, 0x45, 0x98, 0x83, 0xba, 0xca, 0x54, 0xca, - 0xe4, 0x1c, 0x5c, 0x69, 0x96, 0x90, 0xe4, 0xa0, 0xf4, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x7a, - 0x4c, 0x30, 0x63, 0xb0, 0x06, 0x00, 0x00, -} diff --git a/vendor/github.com/google/mako/spec/proto/mako_go_proto/mako.pb.go b/vendor/github.com/google/mako/spec/proto/mako_go_proto/mako.pb.go deleted file mode 100644 index 0437f5e976e5..000000000000 --- a/vendor/github.com/google/mako/spec/proto/mako_go_proto/mako.pb.go +++ /dev/null @@ -1,4052 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: spec/proto/mako.proto - -package mako - -import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type RunOrder int32 - -const ( - RunOrder_UNSPECIFIED RunOrder = 0 - RunOrder_TIMESTAMP RunOrder = 1 - RunOrder_BUILD_ID RunOrder = 2 -) - -var RunOrder_name = map[int32]string{ - 0: "UNSPECIFIED", - 1: "TIMESTAMP", - 2: "BUILD_ID", -} - -var RunOrder_value = map[string]int32{ - "UNSPECIFIED": 0, - "TIMESTAMP": 1, - "BUILD_ID": 2, -} - -func (x RunOrder) Enum() *RunOrder { - p := new(RunOrder) - *p = x - return p -} - -func (x RunOrder) String() string { - return proto.EnumName(RunOrder_name, int32(x)) -} - -func (x *RunOrder) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(RunOrder_value, data, "RunOrder") - if err != nil { - return err - } - *x = RunOrder(value) - return nil -} - -func (RunOrder) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{0} -} - -type Status_Code int32 - -const ( - Status_SUCCESS Status_Code = 0 - Status_FAIL Status_Code = 1 -) - -var Status_Code_name = map[int32]string{ - 0: "SUCCESS", - 1: "FAIL", -} - -var Status_Code_value = map[string]int32{ - "SUCCESS": 0, - "FAIL": 1, -} - -func (x Status_Code) Enum() *Status_Code { - p := new(Status_Code) - *p = x - return p -} - -func (x Status_Code) String() string { - return proto.EnumName(Status_Code_name, int32(x)) -} - -func (x *Status_Code) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(Status_Code_value, data, "Status_Code") - if err != nil { - return err - } - *x = Status_Code(value) - return nil -} - -func (Status_Code) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{0, 0} -} - -type ValueInfo_Type int32 - -const ( - ValueInfo_NUMERIC ValueInfo_Type = 1 - ValueInfo_TIMESTAMP ValueInfo_Type = 2 -) - -var ValueInfo_Type_name = map[int32]string{ - 1: "NUMERIC", - 2: "TIMESTAMP", -} - -var ValueInfo_Type_value = map[string]int32{ - "NUMERIC": 1, - "TIMESTAMP": 2, -} - -func (x ValueInfo_Type) Enum() *ValueInfo_Type { - p := new(ValueInfo_Type) - *p = x - return p -} - -func (x ValueInfo_Type) String() string { - return proto.EnumName(ValueInfo_Type_name, int32(x)) -} - -func (x *ValueInfo_Type) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(ValueInfo_Type_value, data, "ValueInfo_Type") - if err != nil { - return err - } - *x = ValueInfo_Type(value) - return nil -} - -func (ValueInfo_Type) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{1, 0} -} - -type DataFilter_DataType int32 - -const ( - DataFilter_METRIC_AGGREGATE_COUNT DataFilter_DataType = 11 - DataFilter_METRIC_AGGREGATE_MIN DataFilter_DataType = 1 - DataFilter_METRIC_AGGREGATE_MAX DataFilter_DataType = 2 - DataFilter_METRIC_AGGREGATE_MEAN DataFilter_DataType = 3 - DataFilter_METRIC_AGGREGATE_MEDIAN DataFilter_DataType = 4 - DataFilter_METRIC_AGGREGATE_STDDEV DataFilter_DataType = 5 - DataFilter_METRIC_AGGREGATE_MAD DataFilter_DataType = 12 - DataFilter_METRIC_AGGREGATE_PERCENTILE DataFilter_DataType = 6 - DataFilter_CUSTOM_AGGREGATE DataFilter_DataType = 7 - DataFilter_METRIC_SAMPLEPOINTS DataFilter_DataType = 8 - DataFilter_BENCHMARK_SCORE DataFilter_DataType = 9 - DataFilter_ERROR_COUNT DataFilter_DataType = 10 -) - -var DataFilter_DataType_name = map[int32]string{ - 11: "METRIC_AGGREGATE_COUNT", - 1: "METRIC_AGGREGATE_MIN", - 2: "METRIC_AGGREGATE_MAX", - 3: "METRIC_AGGREGATE_MEAN", - 4: "METRIC_AGGREGATE_MEDIAN", - 5: "METRIC_AGGREGATE_STDDEV", - 12: "METRIC_AGGREGATE_MAD", - 6: "METRIC_AGGREGATE_PERCENTILE", - 7: "CUSTOM_AGGREGATE", - 8: "METRIC_SAMPLEPOINTS", - 9: "BENCHMARK_SCORE", - 10: "ERROR_COUNT", -} - -var DataFilter_DataType_value = map[string]int32{ - "METRIC_AGGREGATE_COUNT": 11, - "METRIC_AGGREGATE_MIN": 1, - "METRIC_AGGREGATE_MAX": 2, - "METRIC_AGGREGATE_MEAN": 3, - "METRIC_AGGREGATE_MEDIAN": 4, - "METRIC_AGGREGATE_STDDEV": 5, - "METRIC_AGGREGATE_MAD": 12, - "METRIC_AGGREGATE_PERCENTILE": 6, - "CUSTOM_AGGREGATE": 7, - "METRIC_SAMPLEPOINTS": 8, - "BENCHMARK_SCORE": 9, - "ERROR_COUNT": 10, -} - -func (x DataFilter_DataType) Enum() *DataFilter_DataType { - p := new(DataFilter_DataType) - *p = x - return p -} - -func (x DataFilter_DataType) String() string { - return proto.EnumName(DataFilter_DataType_name, int32(x)) -} - -func (x *DataFilter_DataType) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(DataFilter_DataType_value, data, "DataFilter_DataType") - if err != nil { - return err - } - *x = DataFilter_DataType(value) - return nil -} - -func (DataFilter_DataType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{6, 0} -} - -type AnalysisTriageInfo_AnalysisTriageType int32 - -const ( - AnalysisTriageInfo_NONE AnalysisTriageInfo_AnalysisTriageType = 0 - AnalysisTriageInfo_REGRESSION AnalysisTriageInfo_AnalysisTriageType = 1 - AnalysisTriageInfo_IGNORE AnalysisTriageInfo_AnalysisTriageType = 2 - AnalysisTriageInfo_FALSE_POSITIVE AnalysisTriageInfo_AnalysisTriageType = 3 - AnalysisTriageInfo_UNKNOWN AnalysisTriageInfo_AnalysisTriageType = 4 -) - -var AnalysisTriageInfo_AnalysisTriageType_name = map[int32]string{ - 0: "NONE", - 1: "REGRESSION", - 2: "IGNORE", - 3: "FALSE_POSITIVE", - 4: "UNKNOWN", -} - -var AnalysisTriageInfo_AnalysisTriageType_value = map[string]int32{ - "NONE": 0, - "REGRESSION": 1, - "IGNORE": 2, - "FALSE_POSITIVE": 3, - "UNKNOWN": 4, -} - -func (x AnalysisTriageInfo_AnalysisTriageType) Enum() *AnalysisTriageInfo_AnalysisTriageType { - p := new(AnalysisTriageInfo_AnalysisTriageType) - *p = x - return p -} - -func (x AnalysisTriageInfo_AnalysisTriageType) String() string { - return proto.EnumName(AnalysisTriageInfo_AnalysisTriageType_name, int32(x)) -} - -func (x *AnalysisTriageInfo_AnalysisTriageType) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(AnalysisTriageInfo_AnalysisTriageType_value, data, "AnalysisTriageInfo_AnalysisTriageType") - if err != nil { - return err - } - *x = AnalysisTriageInfo_AnalysisTriageType(value) - return nil -} - -func (AnalysisTriageInfo_AnalysisTriageType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{37, 0} -} - -type AnalysisTriageInfo_EnvironmentType int32 - -const ( - AnalysisTriageInfo_UNSPECIFIED AnalysisTriageInfo_EnvironmentType = 0 - AnalysisTriageInfo_PRESUBMIT AnalysisTriageInfo_EnvironmentType = 1 - AnalysisTriageInfo_POSTSUBMIT AnalysisTriageInfo_EnvironmentType = 2 - AnalysisTriageInfo_PRODUCTION AnalysisTriageInfo_EnvironmentType = 3 -) - -var AnalysisTriageInfo_EnvironmentType_name = map[int32]string{ - 0: "UNSPECIFIED", - 1: "PRESUBMIT", - 2: "POSTSUBMIT", - 3: "PRODUCTION", -} - -var AnalysisTriageInfo_EnvironmentType_value = map[string]int32{ - "UNSPECIFIED": 0, - "PRESUBMIT": 1, - "POSTSUBMIT": 2, - "PRODUCTION": 3, -} - -func (x AnalysisTriageInfo_EnvironmentType) Enum() *AnalysisTriageInfo_EnvironmentType { - p := new(AnalysisTriageInfo_EnvironmentType) - *p = x - return p -} - -func (x AnalysisTriageInfo_EnvironmentType) String() string { - return proto.EnumName(AnalysisTriageInfo_EnvironmentType_name, int32(x)) -} - -func (x *AnalysisTriageInfo_EnvironmentType) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(AnalysisTriageInfo_EnvironmentType_value, data, "AnalysisTriageInfo_EnvironmentType") - if err != nil { - return err - } - *x = AnalysisTriageInfo_EnvironmentType(value) - return nil -} - -func (AnalysisTriageInfo_EnvironmentType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{37, 1} -} - -type TestOutput_TestStatus int32 - -const ( - TestOutput_PASS TestOutput_TestStatus = 1 - TestOutput_RATE_FAIL TestOutput_TestStatus = 2 - TestOutput_FATAL_FAIL TestOutput_TestStatus = 3 - TestOutput_ANALYSIS_FAIL TestOutput_TestStatus = 4 - TestOutput_IN_PROGRESS TestOutput_TestStatus = 5 -) - -var TestOutput_TestStatus_name = map[int32]string{ - 1: "PASS", - 2: "RATE_FAIL", - 3: "FATAL_FAIL", - 4: "ANALYSIS_FAIL", - 5: "IN_PROGRESS", -} - -var TestOutput_TestStatus_value = map[string]int32{ - "PASS": 1, - "RATE_FAIL": 2, - "FATAL_FAIL": 3, - "ANALYSIS_FAIL": 4, - "IN_PROGRESS": 5, -} - -func (x TestOutput_TestStatus) Enum() *TestOutput_TestStatus { - p := new(TestOutput_TestStatus) - *p = x - return p -} - -func (x TestOutput_TestStatus) String() string { - return proto.EnumName(TestOutput_TestStatus_name, int32(x)) -} - -func (x *TestOutput_TestStatus) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(TestOutput_TestStatus_value, data, "TestOutput_TestStatus") - if err != nil { - return err - } - *x = TestOutput_TestStatus(value) - return nil -} - -func (TestOutput_TestStatus) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{45, 0} -} - -type TestOutput_RetryableFailureType int32 - -const ( - TestOutput_UNKNOWN_OR_UNSET_TYPE TestOutput_RetryableFailureType = 0 - TestOutput_MASTER_RESTART TestOutput_RetryableFailureType = 1 - TestOutput_JOB_MANAGER_RESTART TestOutput_RetryableFailureType = 2 - TestOutput_SAMPLER_RESTART TestOutput_RetryableFailureType = 3 -) - -var TestOutput_RetryableFailureType_name = map[int32]string{ - 0: "UNKNOWN_OR_UNSET_TYPE", - 1: "MASTER_RESTART", - 2: "JOB_MANAGER_RESTART", - 3: "SAMPLER_RESTART", -} - -var TestOutput_RetryableFailureType_value = map[string]int32{ - "UNKNOWN_OR_UNSET_TYPE": 0, - "MASTER_RESTART": 1, - "JOB_MANAGER_RESTART": 2, - "SAMPLER_RESTART": 3, -} - -func (x TestOutput_RetryableFailureType) Enum() *TestOutput_RetryableFailureType { - p := new(TestOutput_RetryableFailureType) - *p = x - return p -} - -func (x TestOutput_RetryableFailureType) String() string { - return proto.EnumName(TestOutput_RetryableFailureType_name, int32(x)) -} - -func (x *TestOutput_RetryableFailureType) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(TestOutput_RetryableFailureType_value, data, "TestOutput_RetryableFailureType") - if err != nil { - return err - } - *x = TestOutput_RetryableFailureType(value) - return nil -} - -func (TestOutput_RetryableFailureType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{45, 1} -} - -type Status struct { - Code *Status_Code `protobuf:"varint,1,opt,name=code,enum=mako.Status_Code" json:"code,omitempty"` - FailMessage *string `protobuf:"bytes,2,opt,name=fail_message,json=failMessage" json:"fail_message,omitempty"` - Retry *bool `protobuf:"varint,3,opt,name=retry,def=0" json:"retry,omitempty"` - WarningMessages []string `protobuf:"bytes,4,rep,name=warning_messages,json=warningMessages" json:"warning_messages,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Status) Reset() { *m = Status{} } -func (m *Status) String() string { return proto.CompactTextString(m) } -func (*Status) ProtoMessage() {} -func (*Status) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{0} -} - -func (m *Status) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Status.Unmarshal(m, b) -} -func (m *Status) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Status.Marshal(b, m, deterministic) -} -func (m *Status) XXX_Merge(src proto.Message) { - xxx_messageInfo_Status.Merge(m, src) -} -func (m *Status) XXX_Size() int { - return xxx_messageInfo_Status.Size(m) -} -func (m *Status) XXX_DiscardUnknown() { - xxx_messageInfo_Status.DiscardUnknown(m) -} - -var xxx_messageInfo_Status proto.InternalMessageInfo - -const Default_Status_Retry bool = false - -func (m *Status) GetCode() Status_Code { - if m != nil && m.Code != nil { - return *m.Code - } - return Status_SUCCESS -} - -func (m *Status) GetFailMessage() string { - if m != nil && m.FailMessage != nil { - return *m.FailMessage - } - return "" -} - -func (m *Status) GetRetry() bool { - if m != nil && m.Retry != nil { - return *m.Retry - } - return Default_Status_Retry -} - -func (m *Status) GetWarningMessages() []string { - if m != nil { - return m.WarningMessages - } - return nil -} - -type ValueInfo struct { - ValueKey *string `protobuf:"bytes,1,opt,name=value_key,json=valueKey" json:"value_key,omitempty"` - Label *string `protobuf:"bytes,2,opt,name=label" json:"label,omitempty"` - Type *ValueInfo_Type `protobuf:"varint,3,opt,name=type,enum=mako.ValueInfo_Type" json:"type,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ValueInfo) Reset() { *m = ValueInfo{} } -func (m *ValueInfo) String() string { return proto.CompactTextString(m) } -func (*ValueInfo) ProtoMessage() {} -func (*ValueInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{1} -} - -func (m *ValueInfo) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ValueInfo.Unmarshal(m, b) -} -func (m *ValueInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ValueInfo.Marshal(b, m, deterministic) -} -func (m *ValueInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_ValueInfo.Merge(m, src) -} -func (m *ValueInfo) XXX_Size() int { - return xxx_messageInfo_ValueInfo.Size(m) -} -func (m *ValueInfo) XXX_DiscardUnknown() { - xxx_messageInfo_ValueInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_ValueInfo proto.InternalMessageInfo - -func (m *ValueInfo) GetValueKey() string { - if m != nil && m.ValueKey != nil { - return *m.ValueKey - } - return "" -} - -func (m *ValueInfo) GetLabel() string { - if m != nil && m.Label != nil { - return *m.Label - } - return "" -} - -func (m *ValueInfo) GetType() ValueInfo_Type { - if m != nil && m.Type != nil { - return *m.Type - } - return ValueInfo_NUMERIC -} - -type KeyedValue struct { - ValueKey *string `protobuf:"bytes,1,opt,name=value_key,json=valueKey" json:"value_key,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 *KeyedValue) Reset() { *m = KeyedValue{} } -func (m *KeyedValue) String() string { return proto.CompactTextString(m) } -func (*KeyedValue) ProtoMessage() {} -func (*KeyedValue) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{2} -} - -func (m *KeyedValue) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_KeyedValue.Unmarshal(m, b) -} -func (m *KeyedValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_KeyedValue.Marshal(b, m, deterministic) -} -func (m *KeyedValue) XXX_Merge(src proto.Message) { - xxx_messageInfo_KeyedValue.Merge(m, src) -} -func (m *KeyedValue) XXX_Size() int { - return xxx_messageInfo_KeyedValue.Size(m) -} -func (m *KeyedValue) XXX_DiscardUnknown() { - xxx_messageInfo_KeyedValue.DiscardUnknown(m) -} - -var xxx_messageInfo_KeyedValue proto.InternalMessageInfo - -func (m *KeyedValue) GetValueKey() string { - if m != nil && m.ValueKey != nil { - return *m.ValueKey - } - return "" -} - -func (m *KeyedValue) GetValue() float64 { - if m != nil && m.Value != nil { - return *m.Value - } - return 0 -} - -type NamedData struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Data *string `protobuf:"bytes,2,opt,name=data" json:"data,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *NamedData) Reset() { *m = NamedData{} } -func (m *NamedData) String() string { return proto.CompactTextString(m) } -func (*NamedData) ProtoMessage() {} -func (*NamedData) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{3} -} - -func (m *NamedData) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_NamedData.Unmarshal(m, b) -} -func (m *NamedData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_NamedData.Marshal(b, m, deterministic) -} -func (m *NamedData) XXX_Merge(src proto.Message) { - xxx_messageInfo_NamedData.Merge(m, src) -} -func (m *NamedData) XXX_Size() int { - return xxx_messageInfo_NamedData.Size(m) -} -func (m *NamedData) XXX_DiscardUnknown() { - xxx_messageInfo_NamedData.DiscardUnknown(m) -} - -var xxx_messageInfo_NamedData proto.InternalMessageInfo - -func (m *NamedData) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *NamedData) GetData() string { - if m != nil && m.Data != nil { - return *m.Data - } - return "" -} - -type Range struct { - Start *float64 `protobuf:"fixed64,1,opt,name=start" json:"start,omitempty"` - End *float64 `protobuf:"fixed64,2,opt,name=end" json:"end,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Range) Reset() { *m = Range{} } -func (m *Range) String() string { return proto.CompactTextString(m) } -func (*Range) ProtoMessage() {} -func (*Range) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{4} -} - -func (m *Range) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Range.Unmarshal(m, b) -} -func (m *Range) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Range.Marshal(b, m, deterministic) -} -func (m *Range) XXX_Merge(src proto.Message) { - xxx_messageInfo_Range.Merge(m, src) -} -func (m *Range) XXX_Size() int { - return xxx_messageInfo_Range.Size(m) -} -func (m *Range) XXX_DiscardUnknown() { - xxx_messageInfo_Range.DiscardUnknown(m) -} - -var xxx_messageInfo_Range proto.InternalMessageInfo - -func (m *Range) GetStart() float64 { - if m != nil && m.Start != nil { - return *m.Start - } - return 0 -} - -func (m *Range) GetEnd() float64 { - if m != nil && m.End != nil { - return *m.End - } - return 0 -} - -type LabeledRange struct { - Label *string `protobuf:"bytes,1,opt,name=label" json:"label,omitempty"` - Range *Range `protobuf:"bytes,2,opt,name=range" json:"range,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *LabeledRange) Reset() { *m = LabeledRange{} } -func (m *LabeledRange) String() string { return proto.CompactTextString(m) } -func (*LabeledRange) ProtoMessage() {} -func (*LabeledRange) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{5} -} - -func (m *LabeledRange) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_LabeledRange.Unmarshal(m, b) -} -func (m *LabeledRange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_LabeledRange.Marshal(b, m, deterministic) -} -func (m *LabeledRange) XXX_Merge(src proto.Message) { - xxx_messageInfo_LabeledRange.Merge(m, src) -} -func (m *LabeledRange) XXX_Size() int { - return xxx_messageInfo_LabeledRange.Size(m) -} -func (m *LabeledRange) XXX_DiscardUnknown() { - xxx_messageInfo_LabeledRange.DiscardUnknown(m) -} - -var xxx_messageInfo_LabeledRange proto.InternalMessageInfo - -func (m *LabeledRange) GetLabel() string { - if m != nil && m.Label != nil { - return *m.Label - } - return "" -} - -func (m *LabeledRange) GetRange() *Range { - if m != nil { - return m.Range - } - return nil -} - -type DataFilter struct { - DataType *DataFilter_DataType `protobuf:"varint,1,opt,name=data_type,json=dataType,enum=mako.DataFilter_DataType" json:"data_type,omitempty"` - ValueKey *string `protobuf:"bytes,2,opt,name=value_key,json=valueKey" json:"value_key,omitempty"` - PercentileMilliRank *int32 `protobuf:"varint,3,opt,name=percentile_milli_rank,json=percentileMilliRank" json:"percentile_milli_rank,omitempty"` - IgnoreMissingData *bool `protobuf:"varint,4,opt,name=ignore_missing_data,json=ignoreMissingData,def=1" json:"ignore_missing_data,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DataFilter) Reset() { *m = DataFilter{} } -func (m *DataFilter) String() string { return proto.CompactTextString(m) } -func (*DataFilter) ProtoMessage() {} -func (*DataFilter) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{6} -} - -func (m *DataFilter) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DataFilter.Unmarshal(m, b) -} -func (m *DataFilter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DataFilter.Marshal(b, m, deterministic) -} -func (m *DataFilter) XXX_Merge(src proto.Message) { - xxx_messageInfo_DataFilter.Merge(m, src) -} -func (m *DataFilter) XXX_Size() int { - return xxx_messageInfo_DataFilter.Size(m) -} -func (m *DataFilter) XXX_DiscardUnknown() { - xxx_messageInfo_DataFilter.DiscardUnknown(m) -} - -var xxx_messageInfo_DataFilter proto.InternalMessageInfo - -const Default_DataFilter_IgnoreMissingData bool = true - -func (m *DataFilter) GetDataType() DataFilter_DataType { - if m != nil && m.DataType != nil { - return *m.DataType - } - return DataFilter_METRIC_AGGREGATE_COUNT -} - -func (m *DataFilter) GetValueKey() string { - if m != nil && m.ValueKey != nil { - return *m.ValueKey - } - return "" -} - -func (m *DataFilter) GetPercentileMilliRank() int32 { - if m != nil && m.PercentileMilliRank != nil { - return *m.PercentileMilliRank - } - return 0 -} - -func (m *DataFilter) GetIgnoreMissingData() bool { - if m != nil && m.IgnoreMissingData != nil { - return *m.IgnoreMissingData - } - return Default_DataFilter_IgnoreMissingData -} - -type RunBundle struct { - BenchmarkInfo *BenchmarkInfo `protobuf:"bytes,1,opt,name=benchmark_info,json=benchmarkInfo" json:"benchmark_info,omitempty"` - RunInfo *RunInfo `protobuf:"bytes,2,opt,name=run_info,json=runInfo" json:"run_info,omitempty"` - BatchList []*SampleBatch `protobuf:"bytes,3,rep,name=batch_list,json=batchList" json:"batch_list,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RunBundle) Reset() { *m = RunBundle{} } -func (m *RunBundle) String() string { return proto.CompactTextString(m) } -func (*RunBundle) ProtoMessage() {} -func (*RunBundle) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{7} -} - -func (m *RunBundle) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RunBundle.Unmarshal(m, b) -} -func (m *RunBundle) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RunBundle.Marshal(b, m, deterministic) -} -func (m *RunBundle) XXX_Merge(src proto.Message) { - xxx_messageInfo_RunBundle.Merge(m, src) -} -func (m *RunBundle) XXX_Size() int { - return xxx_messageInfo_RunBundle.Size(m) -} -func (m *RunBundle) XXX_DiscardUnknown() { - xxx_messageInfo_RunBundle.DiscardUnknown(m) -} - -var xxx_messageInfo_RunBundle proto.InternalMessageInfo - -func (m *RunBundle) GetBenchmarkInfo() *BenchmarkInfo { - if m != nil { - return m.BenchmarkInfo - } - return nil -} - -func (m *RunBundle) GetRunInfo() *RunInfo { - if m != nil { - return m.RunInfo - } - return nil -} - -func (m *RunBundle) GetBatchList() []*SampleBatch { - if m != nil { - return m.BatchList - } - return nil -} - -type BenchmarkInfo struct { - BenchmarkKey *string `protobuf:"bytes,1,opt,name=benchmark_key,json=benchmarkKey" json:"benchmark_key,omitempty"` - BenchmarkName *string `protobuf:"bytes,2,opt,name=benchmark_name,json=benchmarkName" json:"benchmark_name,omitempty"` - ProjectName *string `protobuf:"bytes,3,opt,name=project_name,json=projectName" json:"project_name,omitempty"` - OwnerList []string `protobuf:"bytes,4,rep,name=owner_list,json=ownerList" json:"owner_list,omitempty"` - InputValueInfo *ValueInfo `protobuf:"bytes,5,opt,name=input_value_info,json=inputValueInfo" json:"input_value_info,omitempty"` - MetricInfoList []*ValueInfo `protobuf:"bytes,6,rep,name=metric_info_list,json=metricInfoList" json:"metric_info_list,omitempty"` - CustomAggregationInfoList []*ValueInfo `protobuf:"bytes,7,rep,name=custom_aggregation_info_list,json=customAggregationInfoList" json:"custom_aggregation_info_list,omitempty"` - Description *string `protobuf:"bytes,8,opt,name=description" json:"description,omitempty"` - PercentileMilliRankList []int32 `protobuf:"varint,9,rep,name=percentile_milli_rank_list,json=percentileMilliRankList" json:"percentile_milli_rank_list,omitempty"` - AuxData []*NamedData `protobuf:"bytes,10,rep,name=aux_data,json=auxData" json:"aux_data,omitempty"` - RetainedRunTag *string `protobuf:"bytes,11,opt,name=retained_run_tag,json=retainedRunTag" json:"retained_run_tag,omitempty"` - BuildIdLabel *string `protobuf:"bytes,12,opt,name=build_id_label,json=buildIdLabel,def=Changelist" json:"build_id_label,omitempty"` - BuildIdUrlFormat *string `protobuf:"bytes,13,opt,name=build_id_url_format,json=buildIdUrlFormat,def=http://cl/%d" json:"build_id_url_format,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *BenchmarkInfo) Reset() { *m = BenchmarkInfo{} } -func (m *BenchmarkInfo) String() string { return proto.CompactTextString(m) } -func (*BenchmarkInfo) ProtoMessage() {} -func (*BenchmarkInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{8} -} - -func (m *BenchmarkInfo) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_BenchmarkInfo.Unmarshal(m, b) -} -func (m *BenchmarkInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_BenchmarkInfo.Marshal(b, m, deterministic) -} -func (m *BenchmarkInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_BenchmarkInfo.Merge(m, src) -} -func (m *BenchmarkInfo) XXX_Size() int { - return xxx_messageInfo_BenchmarkInfo.Size(m) -} -func (m *BenchmarkInfo) XXX_DiscardUnknown() { - xxx_messageInfo_BenchmarkInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_BenchmarkInfo proto.InternalMessageInfo - -const Default_BenchmarkInfo_BuildIdLabel string = "Changelist" -const Default_BenchmarkInfo_BuildIdUrlFormat string = "http://cl/%d" - -func (m *BenchmarkInfo) GetBenchmarkKey() string { - if m != nil && m.BenchmarkKey != nil { - return *m.BenchmarkKey - } - return "" -} - -func (m *BenchmarkInfo) GetBenchmarkName() string { - if m != nil && m.BenchmarkName != nil { - return *m.BenchmarkName - } - return "" -} - -func (m *BenchmarkInfo) GetProjectName() string { - if m != nil && m.ProjectName != nil { - return *m.ProjectName - } - return "" -} - -func (m *BenchmarkInfo) GetOwnerList() []string { - if m != nil { - return m.OwnerList - } - return nil -} - -func (m *BenchmarkInfo) GetInputValueInfo() *ValueInfo { - if m != nil { - return m.InputValueInfo - } - return nil -} - -func (m *BenchmarkInfo) GetMetricInfoList() []*ValueInfo { - if m != nil { - return m.MetricInfoList - } - return nil -} - -func (m *BenchmarkInfo) GetCustomAggregationInfoList() []*ValueInfo { - if m != nil { - return m.CustomAggregationInfoList - } - return nil -} - -func (m *BenchmarkInfo) GetDescription() string { - if m != nil && m.Description != nil { - return *m.Description - } - return "" -} - -func (m *BenchmarkInfo) GetPercentileMilliRankList() []int32 { - if m != nil { - return m.PercentileMilliRankList - } - return nil -} - -func (m *BenchmarkInfo) GetAuxData() []*NamedData { - if m != nil { - return m.AuxData - } - return nil -} - -func (m *BenchmarkInfo) GetRetainedRunTag() string { - if m != nil && m.RetainedRunTag != nil { - return *m.RetainedRunTag - } - return "" -} - -func (m *BenchmarkInfo) GetBuildIdLabel() string { - if m != nil && m.BuildIdLabel != nil { - return *m.BuildIdLabel - } - return Default_BenchmarkInfo_BuildIdLabel -} - -func (m *BenchmarkInfo) GetBuildIdUrlFormat() string { - if m != nil && m.BuildIdUrlFormat != nil { - return *m.BuildIdUrlFormat - } - return Default_BenchmarkInfo_BuildIdUrlFormat -} - -type RunAnnotation struct { - ValueKey *string `protobuf:"bytes,1,opt,name=value_key,json=valueKey" json:"value_key,omitempty"` - Label *string `protobuf:"bytes,2,opt,name=label" json:"label,omitempty"` - Description *string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RunAnnotation) Reset() { *m = RunAnnotation{} } -func (m *RunAnnotation) String() string { return proto.CompactTextString(m) } -func (*RunAnnotation) ProtoMessage() {} -func (*RunAnnotation) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{9} -} - -func (m *RunAnnotation) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RunAnnotation.Unmarshal(m, b) -} -func (m *RunAnnotation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RunAnnotation.Marshal(b, m, deterministic) -} -func (m *RunAnnotation) XXX_Merge(src proto.Message) { - xxx_messageInfo_RunAnnotation.Merge(m, src) -} -func (m *RunAnnotation) XXX_Size() int { - return xxx_messageInfo_RunAnnotation.Size(m) -} -func (m *RunAnnotation) XXX_DiscardUnknown() { - xxx_messageInfo_RunAnnotation.DiscardUnknown(m) -} - -var xxx_messageInfo_RunAnnotation proto.InternalMessageInfo - -func (m *RunAnnotation) GetValueKey() string { - if m != nil && m.ValueKey != nil { - return *m.ValueKey - } - return "" -} - -func (m *RunAnnotation) GetLabel() string { - if m != nil && m.Label != nil { - return *m.Label - } - return "" -} - -func (m *RunAnnotation) GetDescription() string { - if m != nil && m.Description != nil { - return *m.Description - } - return "" -} - -type RunInfo struct { - BenchmarkKey *string `protobuf:"bytes,1,opt,name=benchmark_key,json=benchmarkKey" json:"benchmark_key,omitempty"` - RunKey *string `protobuf:"bytes,2,opt,name=run_key,json=runKey" json:"run_key,omitempty"` - TimestampMs *float64 `protobuf:"fixed64,3,opt,name=timestamp_ms,json=timestampMs" json:"timestamp_ms,omitempty"` - BuildId *int64 `protobuf:"varint,18,opt,name=build_id,json=buildId" json:"build_id,omitempty"` - DurationTimeMs *float64 `protobuf:"fixed64,4,opt,name=duration_time_ms,json=durationTimeMs,def=0" json:"duration_time_ms,omitempty"` - Tags []string `protobuf:"bytes,5,rep,name=tags" json:"tags,omitempty"` - IgnoreRangeList []*LabeledRange `protobuf:"bytes,6,rep,name=ignore_range_list,json=ignoreRangeList" json:"ignore_range_list,omitempty"` - Aggregate *Aggregate `protobuf:"bytes,7,opt,name=aggregate" json:"aggregate,omitempty"` - BatchKeyList []string `protobuf:"bytes,8,rep,name=batch_key_list,json=batchKeyList" json:"batch_key_list,omitempty"` - Description *string `protobuf:"bytes,9,opt,name=description" json:"description,omitempty"` - AnnotationList []*RunAnnotation `protobuf:"bytes,10,rep,name=annotation_list,json=annotationList" json:"annotation_list,omitempty"` - HoverText *string `protobuf:"bytes,15,opt,name=hover_text,json=hoverText" json:"hover_text,omitempty"` - TestOutput *TestOutput `protobuf:"bytes,12,opt,name=test_output,json=testOutput" json:"test_output,omitempty"` - HyperlinkList []*NamedData `protobuf:"bytes,13,rep,name=hyperlink_list,json=hyperlinkList" json:"hyperlink_list,omitempty"` - AuxData []*NamedData `protobuf:"bytes,16,rep,name=aux_data,json=auxData" json:"aux_data,omitempty"` - TestPassId *string `protobuf:"bytes,17,opt,name=test_pass_id,json=testPassId" json:"test_pass_id,omitempty"` - TestOptionList []*TestOption `protobuf:"bytes,14,rep,name=test_option_list,json=testOptionList" json:"test_option_list,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RunInfo) Reset() { *m = RunInfo{} } -func (m *RunInfo) String() string { return proto.CompactTextString(m) } -func (*RunInfo) ProtoMessage() {} -func (*RunInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{10} -} - -func (m *RunInfo) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RunInfo.Unmarshal(m, b) -} -func (m *RunInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RunInfo.Marshal(b, m, deterministic) -} -func (m *RunInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_RunInfo.Merge(m, src) -} -func (m *RunInfo) XXX_Size() int { - return xxx_messageInfo_RunInfo.Size(m) -} -func (m *RunInfo) XXX_DiscardUnknown() { - xxx_messageInfo_RunInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_RunInfo proto.InternalMessageInfo - -const Default_RunInfo_DurationTimeMs float64 = 0 - -func (m *RunInfo) GetBenchmarkKey() string { - if m != nil && m.BenchmarkKey != nil { - return *m.BenchmarkKey - } - return "" -} - -func (m *RunInfo) GetRunKey() string { - if m != nil && m.RunKey != nil { - return *m.RunKey - } - return "" -} - -func (m *RunInfo) GetTimestampMs() float64 { - if m != nil && m.TimestampMs != nil { - return *m.TimestampMs - } - return 0 -} - -func (m *RunInfo) GetBuildId() int64 { - if m != nil && m.BuildId != nil { - return *m.BuildId - } - return 0 -} - -func (m *RunInfo) GetDurationTimeMs() float64 { - if m != nil && m.DurationTimeMs != nil { - return *m.DurationTimeMs - } - return Default_RunInfo_DurationTimeMs -} - -func (m *RunInfo) GetTags() []string { - if m != nil { - return m.Tags - } - return nil -} - -func (m *RunInfo) GetIgnoreRangeList() []*LabeledRange { - if m != nil { - return m.IgnoreRangeList - } - return nil -} - -func (m *RunInfo) GetAggregate() *Aggregate { - if m != nil { - return m.Aggregate - } - return nil -} - -func (m *RunInfo) GetBatchKeyList() []string { - if m != nil { - return m.BatchKeyList - } - return nil -} - -func (m *RunInfo) GetDescription() string { - if m != nil && m.Description != nil { - return *m.Description - } - return "" -} - -func (m *RunInfo) GetAnnotationList() []*RunAnnotation { - if m != nil { - return m.AnnotationList - } - return nil -} - -func (m *RunInfo) GetHoverText() string { - if m != nil && m.HoverText != nil { - return *m.HoverText - } - return "" -} - -func (m *RunInfo) GetTestOutput() *TestOutput { - if m != nil { - return m.TestOutput - } - return nil -} - -func (m *RunInfo) GetHyperlinkList() []*NamedData { - if m != nil { - return m.HyperlinkList - } - return nil -} - -func (m *RunInfo) GetAuxData() []*NamedData { - if m != nil { - return m.AuxData - } - return nil -} - -func (m *RunInfo) GetTestPassId() string { - if m != nil && m.TestPassId != nil { - return *m.TestPassId - } - return "" -} - -func (m *RunInfo) GetTestOptionList() []*TestOption { - if m != nil { - return m.TestOptionList - } - return nil -} - -type SamplePoint struct { - InputValue *float64 `protobuf:"fixed64,1,opt,name=input_value,json=inputValue" json:"input_value,omitempty"` - MetricValueList []*KeyedValue `protobuf:"bytes,2,rep,name=metric_value_list,json=metricValueList" json:"metric_value_list,omitempty"` - SampleAnnotationsList []*SampleAnnotation `protobuf:"bytes,3,rep,name=sample_annotations_list,json=sampleAnnotationsList" json:"sample_annotations_list,omitempty"` - AuxData map[string][]byte `protobuf:"bytes,4,rep,name=aux_data,json=auxData" json:"aux_data,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SamplePoint) Reset() { *m = SamplePoint{} } -func (m *SamplePoint) String() string { return proto.CompactTextString(m) } -func (*SamplePoint) ProtoMessage() {} -func (*SamplePoint) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{11} -} - -func (m *SamplePoint) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SamplePoint.Unmarshal(m, b) -} -func (m *SamplePoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SamplePoint.Marshal(b, m, deterministic) -} -func (m *SamplePoint) XXX_Merge(src proto.Message) { - xxx_messageInfo_SamplePoint.Merge(m, src) -} -func (m *SamplePoint) XXX_Size() int { - return xxx_messageInfo_SamplePoint.Size(m) -} -func (m *SamplePoint) XXX_DiscardUnknown() { - xxx_messageInfo_SamplePoint.DiscardUnknown(m) -} - -var xxx_messageInfo_SamplePoint proto.InternalMessageInfo - -func (m *SamplePoint) GetInputValue() float64 { - if m != nil && m.InputValue != nil { - return *m.InputValue - } - return 0 -} - -func (m *SamplePoint) GetMetricValueList() []*KeyedValue { - if m != nil { - return m.MetricValueList - } - return nil -} - -func (m *SamplePoint) GetSampleAnnotationsList() []*SampleAnnotation { - if m != nil { - return m.SampleAnnotationsList - } - return nil -} - -func (m *SamplePoint) GetAuxData() map[string][]byte { - if m != nil { - return m.AuxData - } - return nil -} - -type SampleAnnotation struct { - // Types that are valid to be assigned to Annotation: - // *SampleAnnotation_Text - // *SampleAnnotation_Hyperlink - Annotation isSampleAnnotation_Annotation `protobuf_oneof:"annotation"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SampleAnnotation) Reset() { *m = SampleAnnotation{} } -func (m *SampleAnnotation) String() string { return proto.CompactTextString(m) } -func (*SampleAnnotation) ProtoMessage() {} -func (*SampleAnnotation) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{12} -} - -func (m *SampleAnnotation) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SampleAnnotation.Unmarshal(m, b) -} -func (m *SampleAnnotation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SampleAnnotation.Marshal(b, m, deterministic) -} -func (m *SampleAnnotation) XXX_Merge(src proto.Message) { - xxx_messageInfo_SampleAnnotation.Merge(m, src) -} -func (m *SampleAnnotation) XXX_Size() int { - return xxx_messageInfo_SampleAnnotation.Size(m) -} -func (m *SampleAnnotation) XXX_DiscardUnknown() { - xxx_messageInfo_SampleAnnotation.DiscardUnknown(m) -} - -var xxx_messageInfo_SampleAnnotation proto.InternalMessageInfo - -type isSampleAnnotation_Annotation interface { - isSampleAnnotation_Annotation() -} - -type SampleAnnotation_Text struct { - Text string `protobuf:"bytes,1,opt,name=text,oneof"` -} - -type SampleAnnotation_Hyperlink struct { - Hyperlink *NamedData `protobuf:"bytes,2,opt,name=hyperlink,oneof"` -} - -func (*SampleAnnotation_Text) isSampleAnnotation_Annotation() {} - -func (*SampleAnnotation_Hyperlink) isSampleAnnotation_Annotation() {} - -func (m *SampleAnnotation) GetAnnotation() isSampleAnnotation_Annotation { - if m != nil { - return m.Annotation - } - return nil -} - -func (m *SampleAnnotation) GetText() string { - if x, ok := m.GetAnnotation().(*SampleAnnotation_Text); ok { - return x.Text - } - return "" -} - -func (m *SampleAnnotation) GetHyperlink() *NamedData { - if x, ok := m.GetAnnotation().(*SampleAnnotation_Hyperlink); ok { - return x.Hyperlink - } - return nil -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*SampleAnnotation) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*SampleAnnotation_Text)(nil), - (*SampleAnnotation_Hyperlink)(nil), - } -} - -type SampleError struct { - InputValue *float64 `protobuf:"fixed64,1,opt,name=input_value,json=inputValue" json:"input_value,omitempty"` - SamplerName *string `protobuf:"bytes,2,opt,name=sampler_name,json=samplerName" json:"sampler_name,omitempty"` - ErrorMessage *string `protobuf:"bytes,3,opt,name=error_message,json=errorMessage" json:"error_message,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SampleError) Reset() { *m = SampleError{} } -func (m *SampleError) String() string { return proto.CompactTextString(m) } -func (*SampleError) ProtoMessage() {} -func (*SampleError) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{13} -} - -func (m *SampleError) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SampleError.Unmarshal(m, b) -} -func (m *SampleError) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SampleError.Marshal(b, m, deterministic) -} -func (m *SampleError) XXX_Merge(src proto.Message) { - xxx_messageInfo_SampleError.Merge(m, src) -} -func (m *SampleError) XXX_Size() int { - return xxx_messageInfo_SampleError.Size(m) -} -func (m *SampleError) XXX_DiscardUnknown() { - xxx_messageInfo_SampleError.DiscardUnknown(m) -} - -var xxx_messageInfo_SampleError proto.InternalMessageInfo - -func (m *SampleError) GetInputValue() float64 { - if m != nil && m.InputValue != nil { - return *m.InputValue - } - return 0 -} - -func (m *SampleError) GetSamplerName() string { - if m != nil && m.SamplerName != nil { - return *m.SamplerName - } - return "" -} - -func (m *SampleError) GetErrorMessage() string { - if m != nil && m.ErrorMessage != nil { - return *m.ErrorMessage - } - return "" -} - -type SampleBatch struct { - BenchmarkKey *string `protobuf:"bytes,1,opt,name=benchmark_key,json=benchmarkKey" json:"benchmark_key,omitempty"` - RunKey *string `protobuf:"bytes,2,opt,name=run_key,json=runKey" json:"run_key,omitempty"` - BatchKey *string `protobuf:"bytes,3,opt,name=batch_key,json=batchKey" json:"batch_key,omitempty"` - SamplePointList []*SamplePoint `protobuf:"bytes,4,rep,name=sample_point_list,json=samplePointList" json:"sample_point_list,omitempty"` - SampleErrorList []*SampleError `protobuf:"bytes,5,rep,name=sample_error_list,json=sampleErrorList" json:"sample_error_list,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SampleBatch) Reset() { *m = SampleBatch{} } -func (m *SampleBatch) String() string { return proto.CompactTextString(m) } -func (*SampleBatch) ProtoMessage() {} -func (*SampleBatch) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{14} -} - -func (m *SampleBatch) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SampleBatch.Unmarshal(m, b) -} -func (m *SampleBatch) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SampleBatch.Marshal(b, m, deterministic) -} -func (m *SampleBatch) XXX_Merge(src proto.Message) { - xxx_messageInfo_SampleBatch.Merge(m, src) -} -func (m *SampleBatch) XXX_Size() int { - return xxx_messageInfo_SampleBatch.Size(m) -} -func (m *SampleBatch) XXX_DiscardUnknown() { - xxx_messageInfo_SampleBatch.DiscardUnknown(m) -} - -var xxx_messageInfo_SampleBatch proto.InternalMessageInfo - -func (m *SampleBatch) GetBenchmarkKey() string { - if m != nil && m.BenchmarkKey != nil { - return *m.BenchmarkKey - } - return "" -} - -func (m *SampleBatch) GetRunKey() string { - if m != nil && m.RunKey != nil { - return *m.RunKey - } - return "" -} - -func (m *SampleBatch) GetBatchKey() string { - if m != nil && m.BatchKey != nil { - return *m.BatchKey - } - return "" -} - -func (m *SampleBatch) GetSamplePointList() []*SamplePoint { - if m != nil { - return m.SamplePointList - } - return nil -} - -func (m *SampleBatch) GetSampleErrorList() []*SampleError { - if m != nil { - return m.SampleErrorList - } - return nil -} - -type MetricAggregate struct { - MetricKey *string `protobuf:"bytes,1,opt,name=metric_key,json=metricKey" json:"metric_key,omitempty"` - Min *float64 `protobuf:"fixed64,2,opt,name=min" json:"min,omitempty"` - Max *float64 `protobuf:"fixed64,3,opt,name=max" json:"max,omitempty"` - Mean *float64 `protobuf:"fixed64,4,opt,name=mean" json:"mean,omitempty"` - Median *float64 `protobuf:"fixed64,5,opt,name=median" json:"median,omitempty"` - StandardDeviation *float64 `protobuf:"fixed64,6,opt,name=standard_deviation,json=standardDeviation" json:"standard_deviation,omitempty"` - MedianAbsoluteDeviation *float64 `protobuf:"fixed64,9,opt,name=median_absolute_deviation,json=medianAbsoluteDeviation" json:"median_absolute_deviation,omitempty"` - PercentileList []float64 `protobuf:"fixed64,7,rep,name=percentile_list,json=percentileList" json:"percentile_list,omitempty"` - Count *int64 `protobuf:"varint,8,opt,name=count" json:"count,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MetricAggregate) Reset() { *m = MetricAggregate{} } -func (m *MetricAggregate) String() string { return proto.CompactTextString(m) } -func (*MetricAggregate) ProtoMessage() {} -func (*MetricAggregate) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{15} -} - -func (m *MetricAggregate) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MetricAggregate.Unmarshal(m, b) -} -func (m *MetricAggregate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MetricAggregate.Marshal(b, m, deterministic) -} -func (m *MetricAggregate) XXX_Merge(src proto.Message) { - xxx_messageInfo_MetricAggregate.Merge(m, src) -} -func (m *MetricAggregate) XXX_Size() int { - return xxx_messageInfo_MetricAggregate.Size(m) -} -func (m *MetricAggregate) XXX_DiscardUnknown() { - xxx_messageInfo_MetricAggregate.DiscardUnknown(m) -} - -var xxx_messageInfo_MetricAggregate proto.InternalMessageInfo - -func (m *MetricAggregate) GetMetricKey() string { - if m != nil && m.MetricKey != nil { - return *m.MetricKey - } - return "" -} - -func (m *MetricAggregate) GetMin() float64 { - if m != nil && m.Min != nil { - return *m.Min - } - return 0 -} - -func (m *MetricAggregate) GetMax() float64 { - if m != nil && m.Max != nil { - return *m.Max - } - return 0 -} - -func (m *MetricAggregate) GetMean() float64 { - if m != nil && m.Mean != nil { - return *m.Mean - } - return 0 -} - -func (m *MetricAggregate) GetMedian() float64 { - if m != nil && m.Median != nil { - return *m.Median - } - return 0 -} - -func (m *MetricAggregate) GetStandardDeviation() float64 { - if m != nil && m.StandardDeviation != nil { - return *m.StandardDeviation - } - return 0 -} - -func (m *MetricAggregate) GetMedianAbsoluteDeviation() float64 { - if m != nil && m.MedianAbsoluteDeviation != nil { - return *m.MedianAbsoluteDeviation - } - return 0 -} - -func (m *MetricAggregate) GetPercentileList() []float64 { - if m != nil { - return m.PercentileList - } - return nil -} - -func (m *MetricAggregate) GetCount() int64 { - if m != nil && m.Count != nil { - return *m.Count - } - return 0 -} - -type RunAggregate struct { - UsableSampleCount *int64 `protobuf:"varint,1,opt,name=usable_sample_count,json=usableSampleCount" json:"usable_sample_count,omitempty"` - IgnoreSampleCount *int64 `protobuf:"varint,2,opt,name=ignore_sample_count,json=ignoreSampleCount,def=0" json:"ignore_sample_count,omitempty"` - ErrorSampleCount *int64 `protobuf:"varint,3,opt,name=error_sample_count,json=errorSampleCount,def=0" json:"error_sample_count,omitempty"` - BenchmarkScore *int32 `protobuf:"varint,4,opt,name=benchmark_score,json=benchmarkScore,def=0" json:"benchmark_score,omitempty"` - CustomAggregateList []*KeyedValue `protobuf:"bytes,5,rep,name=custom_aggregate_list,json=customAggregateList" json:"custom_aggregate_list,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RunAggregate) Reset() { *m = RunAggregate{} } -func (m *RunAggregate) String() string { return proto.CompactTextString(m) } -func (*RunAggregate) ProtoMessage() {} -func (*RunAggregate) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{16} -} - -func (m *RunAggregate) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RunAggregate.Unmarshal(m, b) -} -func (m *RunAggregate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RunAggregate.Marshal(b, m, deterministic) -} -func (m *RunAggregate) XXX_Merge(src proto.Message) { - xxx_messageInfo_RunAggregate.Merge(m, src) -} -func (m *RunAggregate) XXX_Size() int { - return xxx_messageInfo_RunAggregate.Size(m) -} -func (m *RunAggregate) XXX_DiscardUnknown() { - xxx_messageInfo_RunAggregate.DiscardUnknown(m) -} - -var xxx_messageInfo_RunAggregate proto.InternalMessageInfo - -const Default_RunAggregate_IgnoreSampleCount int64 = 0 -const Default_RunAggregate_ErrorSampleCount int64 = 0 -const Default_RunAggregate_BenchmarkScore int32 = 0 - -func (m *RunAggregate) GetUsableSampleCount() int64 { - if m != nil && m.UsableSampleCount != nil { - return *m.UsableSampleCount - } - return 0 -} - -func (m *RunAggregate) GetIgnoreSampleCount() int64 { - if m != nil && m.IgnoreSampleCount != nil { - return *m.IgnoreSampleCount - } - return Default_RunAggregate_IgnoreSampleCount -} - -func (m *RunAggregate) GetErrorSampleCount() int64 { - if m != nil && m.ErrorSampleCount != nil { - return *m.ErrorSampleCount - } - return Default_RunAggregate_ErrorSampleCount -} - -func (m *RunAggregate) GetBenchmarkScore() int32 { - if m != nil && m.BenchmarkScore != nil { - return *m.BenchmarkScore - } - return Default_RunAggregate_BenchmarkScore -} - -func (m *RunAggregate) GetCustomAggregateList() []*KeyedValue { - if m != nil { - return m.CustomAggregateList - } - return nil -} - -type Aggregate struct { - MetricAggregateList []*MetricAggregate `protobuf:"bytes,1,rep,name=metric_aggregate_list,json=metricAggregateList" json:"metric_aggregate_list,omitempty"` - RunAggregate *RunAggregate `protobuf:"bytes,2,opt,name=run_aggregate,json=runAggregate" json:"run_aggregate,omitempty"` - PercentileMilliRankList []int32 `protobuf:"varint,3,rep,name=percentile_milli_rank_list,json=percentileMilliRankList" json:"percentile_milli_rank_list,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Aggregate) Reset() { *m = Aggregate{} } -func (m *Aggregate) String() string { return proto.CompactTextString(m) } -func (*Aggregate) ProtoMessage() {} -func (*Aggregate) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{17} -} - -func (m *Aggregate) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Aggregate.Unmarshal(m, b) -} -func (m *Aggregate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Aggregate.Marshal(b, m, deterministic) -} -func (m *Aggregate) XXX_Merge(src proto.Message) { - xxx_messageInfo_Aggregate.Merge(m, src) -} -func (m *Aggregate) XXX_Size() int { - return xxx_messageInfo_Aggregate.Size(m) -} -func (m *Aggregate) XXX_DiscardUnknown() { - xxx_messageInfo_Aggregate.DiscardUnknown(m) -} - -var xxx_messageInfo_Aggregate proto.InternalMessageInfo - -func (m *Aggregate) GetMetricAggregateList() []*MetricAggregate { - if m != nil { - return m.MetricAggregateList - } - return nil -} - -func (m *Aggregate) GetRunAggregate() *RunAggregate { - if m != nil { - return m.RunAggregate - } - return nil -} - -func (m *Aggregate) GetPercentileMilliRankList() []int32 { - if m != nil { - return m.PercentileMilliRankList - } - return nil -} - -type BenchmarkInfoQuery struct { - Cursor *string `protobuf:"bytes,1,opt,name=cursor" json:"cursor,omitempty"` - Limit *int32 `protobuf:"varint,2,opt,name=limit" json:"limit,omitempty"` - BenchmarkKey *string `protobuf:"bytes,3,opt,name=benchmark_key,json=benchmarkKey" json:"benchmark_key,omitempty"` - BenchmarkName *string `protobuf:"bytes,4,opt,name=benchmark_name,json=benchmarkName" json:"benchmark_name,omitempty"` - ProjectName *string `protobuf:"bytes,5,opt,name=project_name,json=projectName" json:"project_name,omitempty"` - Owner *string `protobuf:"bytes,6,opt,name=owner" json:"owner,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *BenchmarkInfoQuery) Reset() { *m = BenchmarkInfoQuery{} } -func (m *BenchmarkInfoQuery) String() string { return proto.CompactTextString(m) } -func (*BenchmarkInfoQuery) ProtoMessage() {} -func (*BenchmarkInfoQuery) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{18} -} - -func (m *BenchmarkInfoQuery) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_BenchmarkInfoQuery.Unmarshal(m, b) -} -func (m *BenchmarkInfoQuery) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_BenchmarkInfoQuery.Marshal(b, m, deterministic) -} -func (m *BenchmarkInfoQuery) XXX_Merge(src proto.Message) { - xxx_messageInfo_BenchmarkInfoQuery.Merge(m, src) -} -func (m *BenchmarkInfoQuery) XXX_Size() int { - return xxx_messageInfo_BenchmarkInfoQuery.Size(m) -} -func (m *BenchmarkInfoQuery) XXX_DiscardUnknown() { - xxx_messageInfo_BenchmarkInfoQuery.DiscardUnknown(m) -} - -var xxx_messageInfo_BenchmarkInfoQuery proto.InternalMessageInfo - -func (m *BenchmarkInfoQuery) GetCursor() string { - if m != nil && m.Cursor != nil { - return *m.Cursor - } - return "" -} - -func (m *BenchmarkInfoQuery) GetLimit() int32 { - if m != nil && m.Limit != nil { - return *m.Limit - } - return 0 -} - -func (m *BenchmarkInfoQuery) GetBenchmarkKey() string { - if m != nil && m.BenchmarkKey != nil { - return *m.BenchmarkKey - } - return "" -} - -func (m *BenchmarkInfoQuery) GetBenchmarkName() string { - if m != nil && m.BenchmarkName != nil { - return *m.BenchmarkName - } - return "" -} - -func (m *BenchmarkInfoQuery) GetProjectName() string { - if m != nil && m.ProjectName != nil { - return *m.ProjectName - } - return "" -} - -func (m *BenchmarkInfoQuery) GetOwner() string { - if m != nil && m.Owner != nil { - return *m.Owner - } - return "" -} - -type BenchmarkInfoQueryResponse struct { - Status *Status `protobuf:"bytes,1,opt,name=status" json:"status,omitempty"` - Cursor *string `protobuf:"bytes,2,opt,name=cursor" json:"cursor,omitempty"` - BenchmarkInfoList []*BenchmarkInfo `protobuf:"bytes,4,rep,name=benchmark_info_list,json=benchmarkInfoList" json:"benchmark_info_list,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *BenchmarkInfoQueryResponse) Reset() { *m = BenchmarkInfoQueryResponse{} } -func (m *BenchmarkInfoQueryResponse) String() string { return proto.CompactTextString(m) } -func (*BenchmarkInfoQueryResponse) ProtoMessage() {} -func (*BenchmarkInfoQueryResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{19} -} - -func (m *BenchmarkInfoQueryResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_BenchmarkInfoQueryResponse.Unmarshal(m, b) -} -func (m *BenchmarkInfoQueryResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_BenchmarkInfoQueryResponse.Marshal(b, m, deterministic) -} -func (m *BenchmarkInfoQueryResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_BenchmarkInfoQueryResponse.Merge(m, src) -} -func (m *BenchmarkInfoQueryResponse) XXX_Size() int { - return xxx_messageInfo_BenchmarkInfoQueryResponse.Size(m) -} -func (m *BenchmarkInfoQueryResponse) XXX_DiscardUnknown() { - xxx_messageInfo_BenchmarkInfoQueryResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_BenchmarkInfoQueryResponse proto.InternalMessageInfo - -func (m *BenchmarkInfoQueryResponse) GetStatus() *Status { - if m != nil { - return m.Status - } - return nil -} - -func (m *BenchmarkInfoQueryResponse) GetCursor() string { - if m != nil && m.Cursor != nil { - return *m.Cursor - } - return "" -} - -func (m *BenchmarkInfoQueryResponse) GetBenchmarkInfoList() []*BenchmarkInfo { - if m != nil { - return m.BenchmarkInfoList - } - return nil -} - -type RunInfoQuery struct { - Cursor *string `protobuf:"bytes,1,opt,name=cursor" json:"cursor,omitempty"` - Limit *int32 `protobuf:"varint,2,opt,name=limit" json:"limit,omitempty"` - BenchmarkKey *string `protobuf:"bytes,3,opt,name=benchmark_key,json=benchmarkKey" json:"benchmark_key,omitempty"` - RunKey *string `protobuf:"bytes,4,opt,name=run_key,json=runKey" json:"run_key,omitempty"` - TestPassId *string `protobuf:"bytes,11,opt,name=test_pass_id,json=testPassId" json:"test_pass_id,omitempty"` - RunOrder *RunOrder `protobuf:"varint,8,opt,name=run_order,json=runOrder,enum=mako.RunOrder,def=1" json:"run_order,omitempty"` - MinTimestampMs *float64 `protobuf:"fixed64,5,opt,name=min_timestamp_ms,json=minTimestampMs" json:"min_timestamp_ms,omitempty"` - MaxTimestampMs *float64 `protobuf:"fixed64,6,opt,name=max_timestamp_ms,json=maxTimestampMs" json:"max_timestamp_ms,omitempty"` - MinBuildId *int64 `protobuf:"varint,9,opt,name=min_build_id,json=minBuildId" json:"min_build_id,omitempty"` - MaxBuildId *int64 `protobuf:"varint,10,opt,name=max_build_id,json=maxBuildId" json:"max_build_id,omitempty"` - Tags []string `protobuf:"bytes,7,rep,name=tags" json:"tags,omitempty"` - Fields []string `protobuf:"bytes,12,rep,name=fields" json:"fields,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RunInfoQuery) Reset() { *m = RunInfoQuery{} } -func (m *RunInfoQuery) String() string { return proto.CompactTextString(m) } -func (*RunInfoQuery) ProtoMessage() {} -func (*RunInfoQuery) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{20} -} - -func (m *RunInfoQuery) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RunInfoQuery.Unmarshal(m, b) -} -func (m *RunInfoQuery) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RunInfoQuery.Marshal(b, m, deterministic) -} -func (m *RunInfoQuery) XXX_Merge(src proto.Message) { - xxx_messageInfo_RunInfoQuery.Merge(m, src) -} -func (m *RunInfoQuery) XXX_Size() int { - return xxx_messageInfo_RunInfoQuery.Size(m) -} -func (m *RunInfoQuery) XXX_DiscardUnknown() { - xxx_messageInfo_RunInfoQuery.DiscardUnknown(m) -} - -var xxx_messageInfo_RunInfoQuery proto.InternalMessageInfo - -const Default_RunInfoQuery_RunOrder RunOrder = RunOrder_TIMESTAMP - -func (m *RunInfoQuery) GetCursor() string { - if m != nil && m.Cursor != nil { - return *m.Cursor - } - return "" -} - -func (m *RunInfoQuery) GetLimit() int32 { - if m != nil && m.Limit != nil { - return *m.Limit - } - return 0 -} - -func (m *RunInfoQuery) GetBenchmarkKey() string { - if m != nil && m.BenchmarkKey != nil { - return *m.BenchmarkKey - } - return "" -} - -func (m *RunInfoQuery) GetRunKey() string { - if m != nil && m.RunKey != nil { - return *m.RunKey - } - return "" -} - -func (m *RunInfoQuery) GetTestPassId() string { - if m != nil && m.TestPassId != nil { - return *m.TestPassId - } - return "" -} - -func (m *RunInfoQuery) GetRunOrder() RunOrder { - if m != nil && m.RunOrder != nil { - return *m.RunOrder - } - return Default_RunInfoQuery_RunOrder -} - -func (m *RunInfoQuery) GetMinTimestampMs() float64 { - if m != nil && m.MinTimestampMs != nil { - return *m.MinTimestampMs - } - return 0 -} - -func (m *RunInfoQuery) GetMaxTimestampMs() float64 { - if m != nil && m.MaxTimestampMs != nil { - return *m.MaxTimestampMs - } - return 0 -} - -func (m *RunInfoQuery) GetMinBuildId() int64 { - if m != nil && m.MinBuildId != nil { - return *m.MinBuildId - } - return 0 -} - -func (m *RunInfoQuery) GetMaxBuildId() int64 { - if m != nil && m.MaxBuildId != nil { - return *m.MaxBuildId - } - return 0 -} - -func (m *RunInfoQuery) GetTags() []string { - if m != nil { - return m.Tags - } - return nil -} - -func (m *RunInfoQuery) GetFields() []string { - if m != nil { - return m.Fields - } - return nil -} - -type RunInfoQueryResponse struct { - Status *Status `protobuf:"bytes,1,opt,name=status" json:"status,omitempty"` - Cursor *string `protobuf:"bytes,2,opt,name=cursor" json:"cursor,omitempty"` - RunInfoList []*RunInfo `protobuf:"bytes,4,rep,name=run_info_list,json=runInfoList" json:"run_info_list,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RunInfoQueryResponse) Reset() { *m = RunInfoQueryResponse{} } -func (m *RunInfoQueryResponse) String() string { return proto.CompactTextString(m) } -func (*RunInfoQueryResponse) ProtoMessage() {} -func (*RunInfoQueryResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{21} -} - -func (m *RunInfoQueryResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RunInfoQueryResponse.Unmarshal(m, b) -} -func (m *RunInfoQueryResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RunInfoQueryResponse.Marshal(b, m, deterministic) -} -func (m *RunInfoQueryResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_RunInfoQueryResponse.Merge(m, src) -} -func (m *RunInfoQueryResponse) XXX_Size() int { - return xxx_messageInfo_RunInfoQueryResponse.Size(m) -} -func (m *RunInfoQueryResponse) XXX_DiscardUnknown() { - xxx_messageInfo_RunInfoQueryResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_RunInfoQueryResponse proto.InternalMessageInfo - -func (m *RunInfoQueryResponse) GetStatus() *Status { - if m != nil { - return m.Status - } - return nil -} - -func (m *RunInfoQueryResponse) GetCursor() string { - if m != nil && m.Cursor != nil { - return *m.Cursor - } - return "" -} - -func (m *RunInfoQueryResponse) GetRunInfoList() []*RunInfo { - if m != nil { - return m.RunInfoList - } - return nil -} - -type SampleBatchQuery struct { - Cursor *string `protobuf:"bytes,1,opt,name=cursor" json:"cursor,omitempty"` - Limit *int32 `protobuf:"varint,2,opt,name=limit" json:"limit,omitempty"` - BenchmarkKey *string `protobuf:"bytes,3,opt,name=benchmark_key,json=benchmarkKey" json:"benchmark_key,omitempty"` - RunKey *string `protobuf:"bytes,4,opt,name=run_key,json=runKey" json:"run_key,omitempty"` - BatchKey *string `protobuf:"bytes,5,opt,name=batch_key,json=batchKey" json:"batch_key,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SampleBatchQuery) Reset() { *m = SampleBatchQuery{} } -func (m *SampleBatchQuery) String() string { return proto.CompactTextString(m) } -func (*SampleBatchQuery) ProtoMessage() {} -func (*SampleBatchQuery) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{22} -} - -func (m *SampleBatchQuery) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SampleBatchQuery.Unmarshal(m, b) -} -func (m *SampleBatchQuery) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SampleBatchQuery.Marshal(b, m, deterministic) -} -func (m *SampleBatchQuery) XXX_Merge(src proto.Message) { - xxx_messageInfo_SampleBatchQuery.Merge(m, src) -} -func (m *SampleBatchQuery) XXX_Size() int { - return xxx_messageInfo_SampleBatchQuery.Size(m) -} -func (m *SampleBatchQuery) XXX_DiscardUnknown() { - xxx_messageInfo_SampleBatchQuery.DiscardUnknown(m) -} - -var xxx_messageInfo_SampleBatchQuery proto.InternalMessageInfo - -func (m *SampleBatchQuery) GetCursor() string { - if m != nil && m.Cursor != nil { - return *m.Cursor - } - return "" -} - -func (m *SampleBatchQuery) GetLimit() int32 { - if m != nil && m.Limit != nil { - return *m.Limit - } - return 0 -} - -func (m *SampleBatchQuery) GetBenchmarkKey() string { - if m != nil && m.BenchmarkKey != nil { - return *m.BenchmarkKey - } - return "" -} - -func (m *SampleBatchQuery) GetRunKey() string { - if m != nil && m.RunKey != nil { - return *m.RunKey - } - return "" -} - -func (m *SampleBatchQuery) GetBatchKey() string { - if m != nil && m.BatchKey != nil { - return *m.BatchKey - } - return "" -} - -type SampleBatchQueryResponse struct { - Status *Status `protobuf:"bytes,1,opt,name=status" json:"status,omitempty"` - Cursor *string `protobuf:"bytes,2,opt,name=cursor" json:"cursor,omitempty"` - SampleBatchList []*SampleBatch `protobuf:"bytes,4,rep,name=sample_batch_list,json=sampleBatchList" json:"sample_batch_list,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SampleBatchQueryResponse) Reset() { *m = SampleBatchQueryResponse{} } -func (m *SampleBatchQueryResponse) String() string { return proto.CompactTextString(m) } -func (*SampleBatchQueryResponse) ProtoMessage() {} -func (*SampleBatchQueryResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{23} -} - -func (m *SampleBatchQueryResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SampleBatchQueryResponse.Unmarshal(m, b) -} -func (m *SampleBatchQueryResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SampleBatchQueryResponse.Marshal(b, m, deterministic) -} -func (m *SampleBatchQueryResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_SampleBatchQueryResponse.Merge(m, src) -} -func (m *SampleBatchQueryResponse) XXX_Size() int { - return xxx_messageInfo_SampleBatchQueryResponse.Size(m) -} -func (m *SampleBatchQueryResponse) XXX_DiscardUnknown() { - xxx_messageInfo_SampleBatchQueryResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_SampleBatchQueryResponse proto.InternalMessageInfo - -func (m *SampleBatchQueryResponse) GetStatus() *Status { - if m != nil { - return m.Status - } - return nil -} - -func (m *SampleBatchQueryResponse) GetCursor() string { - if m != nil && m.Cursor != nil { - return *m.Cursor - } - return "" -} - -func (m *SampleBatchQueryResponse) GetSampleBatchList() []*SampleBatch { - if m != nil { - return m.SampleBatchList - } - return nil -} - -type CreationResponse struct { - Status *Status `protobuf:"bytes,1,opt,name=status" json:"status,omitempty"` - Key *string `protobuf:"bytes,2,opt,name=key" json:"key,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CreationResponse) Reset() { *m = CreationResponse{} } -func (m *CreationResponse) String() string { return proto.CompactTextString(m) } -func (*CreationResponse) ProtoMessage() {} -func (*CreationResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{24} -} - -func (m *CreationResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CreationResponse.Unmarshal(m, b) -} -func (m *CreationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CreationResponse.Marshal(b, m, deterministic) -} -func (m *CreationResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_CreationResponse.Merge(m, src) -} -func (m *CreationResponse) XXX_Size() int { - return xxx_messageInfo_CreationResponse.Size(m) -} -func (m *CreationResponse) XXX_DiscardUnknown() { - xxx_messageInfo_CreationResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_CreationResponse proto.InternalMessageInfo - -func (m *CreationResponse) GetStatus() *Status { - if m != nil { - return m.Status - } - return nil -} - -func (m *CreationResponse) GetKey() string { - if m != nil && m.Key != nil { - return *m.Key - } - return "" -} - -type ModificationResponse struct { - Status *Status `protobuf:"bytes,1,opt,name=status" json:"status,omitempty"` - Count *int64 `protobuf:"varint,2,opt,name=count" json:"count,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ModificationResponse) Reset() { *m = ModificationResponse{} } -func (m *ModificationResponse) String() string { return proto.CompactTextString(m) } -func (*ModificationResponse) ProtoMessage() {} -func (*ModificationResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{25} -} - -func (m *ModificationResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ModificationResponse.Unmarshal(m, b) -} -func (m *ModificationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ModificationResponse.Marshal(b, m, deterministic) -} -func (m *ModificationResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ModificationResponse.Merge(m, src) -} -func (m *ModificationResponse) XXX_Size() int { - return xxx_messageInfo_ModificationResponse.Size(m) -} -func (m *ModificationResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ModificationResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_ModificationResponse proto.InternalMessageInfo - -func (m *ModificationResponse) GetStatus() *Status { - if m != nil { - return m.Status - } - return nil -} - -func (m *ModificationResponse) GetCount() int64 { - if m != nil && m.Count != nil { - return *m.Count - } - return 0 -} - -type CountResponse struct { - Status *Status `protobuf:"bytes,1,opt,name=status" json:"status,omitempty"` - Count *int64 `protobuf:"varint,2,opt,name=count" json:"count,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CountResponse) Reset() { *m = CountResponse{} } -func (m *CountResponse) String() string { return proto.CompactTextString(m) } -func (*CountResponse) ProtoMessage() {} -func (*CountResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{26} -} - -func (m *CountResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CountResponse.Unmarshal(m, b) -} -func (m *CountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CountResponse.Marshal(b, m, deterministic) -} -func (m *CountResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_CountResponse.Merge(m, src) -} -func (m *CountResponse) XXX_Size() int { - return xxx_messageInfo_CountResponse.Size(m) -} -func (m *CountResponse) XXX_DiscardUnknown() { - xxx_messageInfo_CountResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_CountResponse proto.InternalMessageInfo - -func (m *CountResponse) GetStatus() *Status { - if m != nil { - return m.Status - } - return nil -} - -func (m *CountResponse) GetCount() int64 { - if m != nil && m.Count != nil { - return *m.Count - } - return 0 -} - -type SecondaryStorageWriteInput struct { - Bundle *RunBundle `protobuf:"bytes,1,opt,name=bundle" json:"bundle,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SecondaryStorageWriteInput) Reset() { *m = SecondaryStorageWriteInput{} } -func (m *SecondaryStorageWriteInput) String() string { return proto.CompactTextString(m) } -func (*SecondaryStorageWriteInput) ProtoMessage() {} -func (*SecondaryStorageWriteInput) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{27} -} - -func (m *SecondaryStorageWriteInput) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SecondaryStorageWriteInput.Unmarshal(m, b) -} -func (m *SecondaryStorageWriteInput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SecondaryStorageWriteInput.Marshal(b, m, deterministic) -} -func (m *SecondaryStorageWriteInput) XXX_Merge(src proto.Message) { - xxx_messageInfo_SecondaryStorageWriteInput.Merge(m, src) -} -func (m *SecondaryStorageWriteInput) XXX_Size() int { - return xxx_messageInfo_SecondaryStorageWriteInput.Size(m) -} -func (m *SecondaryStorageWriteInput) XXX_DiscardUnknown() { - xxx_messageInfo_SecondaryStorageWriteInput.DiscardUnknown(m) -} - -var xxx_messageInfo_SecondaryStorageWriteInput proto.InternalMessageInfo - -func (m *SecondaryStorageWriteInput) GetBundle() *RunBundle { - if m != nil { - return m.Bundle - } - return nil -} - -type SecondaryStorageWriteOutput struct { - Status *Status `protobuf:"bytes,1,opt,name=status" json:"status,omitempty"` - Links []*NamedData `protobuf:"bytes,2,rep,name=links" json:"links,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SecondaryStorageWriteOutput) Reset() { *m = SecondaryStorageWriteOutput{} } -func (m *SecondaryStorageWriteOutput) String() string { return proto.CompactTextString(m) } -func (*SecondaryStorageWriteOutput) ProtoMessage() {} -func (*SecondaryStorageWriteOutput) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{28} -} - -func (m *SecondaryStorageWriteOutput) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SecondaryStorageWriteOutput.Unmarshal(m, b) -} -func (m *SecondaryStorageWriteOutput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SecondaryStorageWriteOutput.Marshal(b, m, deterministic) -} -func (m *SecondaryStorageWriteOutput) XXX_Merge(src proto.Message) { - xxx_messageInfo_SecondaryStorageWriteOutput.Merge(m, src) -} -func (m *SecondaryStorageWriteOutput) XXX_Size() int { - return xxx_messageInfo_SecondaryStorageWriteOutput.Size(m) -} -func (m *SecondaryStorageWriteOutput) XXX_DiscardUnknown() { - xxx_messageInfo_SecondaryStorageWriteOutput.DiscardUnknown(m) -} - -var xxx_messageInfo_SecondaryStorageWriteOutput proto.InternalMessageInfo - -func (m *SecondaryStorageWriteOutput) GetStatus() *Status { - if m != nil { - return m.Status - } - return nil -} - -func (m *SecondaryStorageWriteOutput) GetLinks() []*NamedData { - if m != nil { - return m.Links - } - return nil -} - -type AggregatorInput struct { - BenchmarkInfo *BenchmarkInfo `protobuf:"bytes,1,opt,name=benchmark_info,json=benchmarkInfo" json:"benchmark_info,omitempty"` - RunInfo *RunInfo `protobuf:"bytes,2,opt,name=run_info,json=runInfo" json:"run_info,omitempty"` - SampleFileList []*SampleFile `protobuf:"bytes,3,rep,name=sample_file_list,json=sampleFileList" json:"sample_file_list,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *AggregatorInput) Reset() { *m = AggregatorInput{} } -func (m *AggregatorInput) String() string { return proto.CompactTextString(m) } -func (*AggregatorInput) ProtoMessage() {} -func (*AggregatorInput) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{29} -} - -func (m *AggregatorInput) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AggregatorInput.Unmarshal(m, b) -} -func (m *AggregatorInput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AggregatorInput.Marshal(b, m, deterministic) -} -func (m *AggregatorInput) XXX_Merge(src proto.Message) { - xxx_messageInfo_AggregatorInput.Merge(m, src) -} -func (m *AggregatorInput) XXX_Size() int { - return xxx_messageInfo_AggregatorInput.Size(m) -} -func (m *AggregatorInput) XXX_DiscardUnknown() { - xxx_messageInfo_AggregatorInput.DiscardUnknown(m) -} - -var xxx_messageInfo_AggregatorInput proto.InternalMessageInfo - -func (m *AggregatorInput) GetBenchmarkInfo() *BenchmarkInfo { - if m != nil { - return m.BenchmarkInfo - } - return nil -} - -func (m *AggregatorInput) GetRunInfo() *RunInfo { - if m != nil { - return m.RunInfo - } - return nil -} - -func (m *AggregatorInput) GetSampleFileList() []*SampleFile { - if m != nil { - return m.SampleFileList - } - return nil -} - -type AggregatorOutput struct { - Aggregate *Aggregate `protobuf:"bytes,1,opt,name=aggregate" json:"aggregate,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *AggregatorOutput) Reset() { *m = AggregatorOutput{} } -func (m *AggregatorOutput) String() string { return proto.CompactTextString(m) } -func (*AggregatorOutput) ProtoMessage() {} -func (*AggregatorOutput) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{30} -} - -func (m *AggregatorOutput) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AggregatorOutput.Unmarshal(m, b) -} -func (m *AggregatorOutput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AggregatorOutput.Marshal(b, m, deterministic) -} -func (m *AggregatorOutput) XXX_Merge(src proto.Message) { - xxx_messageInfo_AggregatorOutput.Merge(m, src) -} -func (m *AggregatorOutput) XXX_Size() int { - return xxx_messageInfo_AggregatorOutput.Size(m) -} -func (m *AggregatorOutput) XXX_DiscardUnknown() { - xxx_messageInfo_AggregatorOutput.DiscardUnknown(m) -} - -var xxx_messageInfo_AggregatorOutput proto.InternalMessageInfo - -func (m *AggregatorOutput) GetAggregate() *Aggregate { - if m != nil { - return m.Aggregate - } - return nil -} - -type DownsamplerInput struct { - RunInfo *RunInfo `protobuf:"bytes,1,opt,name=run_info,json=runInfo" json:"run_info,omitempty"` - SampleFileList []*SampleFile `protobuf:"bytes,2,rep,name=sample_file_list,json=sampleFileList" json:"sample_file_list,omitempty"` - MetricValueCountMax *int64 `protobuf:"varint,6,opt,name=metric_value_count_max,json=metricValueCountMax" json:"metric_value_count_max,omitempty"` - SampleErrorCountMax *int64 `protobuf:"varint,4,opt,name=sample_error_count_max,json=sampleErrorCountMax" json:"sample_error_count_max,omitempty"` - BatchSizeMax *int64 `protobuf:"varint,5,opt,name=batch_size_max,json=batchSizeMax" json:"batch_size_max,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DownsamplerInput) Reset() { *m = DownsamplerInput{} } -func (m *DownsamplerInput) String() string { return proto.CompactTextString(m) } -func (*DownsamplerInput) ProtoMessage() {} -func (*DownsamplerInput) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{31} -} - -func (m *DownsamplerInput) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DownsamplerInput.Unmarshal(m, b) -} -func (m *DownsamplerInput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DownsamplerInput.Marshal(b, m, deterministic) -} -func (m *DownsamplerInput) XXX_Merge(src proto.Message) { - xxx_messageInfo_DownsamplerInput.Merge(m, src) -} -func (m *DownsamplerInput) XXX_Size() int { - return xxx_messageInfo_DownsamplerInput.Size(m) -} -func (m *DownsamplerInput) XXX_DiscardUnknown() { - xxx_messageInfo_DownsamplerInput.DiscardUnknown(m) -} - -var xxx_messageInfo_DownsamplerInput proto.InternalMessageInfo - -func (m *DownsamplerInput) GetRunInfo() *RunInfo { - if m != nil { - return m.RunInfo - } - return nil -} - -func (m *DownsamplerInput) GetSampleFileList() []*SampleFile { - if m != nil { - return m.SampleFileList - } - return nil -} - -func (m *DownsamplerInput) GetMetricValueCountMax() int64 { - if m != nil && m.MetricValueCountMax != nil { - return *m.MetricValueCountMax - } - return 0 -} - -func (m *DownsamplerInput) GetSampleErrorCountMax() int64 { - if m != nil && m.SampleErrorCountMax != nil { - return *m.SampleErrorCountMax - } - return 0 -} - -func (m *DownsamplerInput) GetBatchSizeMax() int64 { - if m != nil && m.BatchSizeMax != nil { - return *m.BatchSizeMax - } - return 0 -} - -type DownsamplerOutput struct { - SampleBatchList []*SampleBatch `protobuf:"bytes,1,rep,name=sample_batch_list,json=sampleBatchList" json:"sample_batch_list,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DownsamplerOutput) Reset() { *m = DownsamplerOutput{} } -func (m *DownsamplerOutput) String() string { return proto.CompactTextString(m) } -func (*DownsamplerOutput) ProtoMessage() {} -func (*DownsamplerOutput) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{32} -} - -func (m *DownsamplerOutput) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DownsamplerOutput.Unmarshal(m, b) -} -func (m *DownsamplerOutput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DownsamplerOutput.Marshal(b, m, deterministic) -} -func (m *DownsamplerOutput) XXX_Merge(src proto.Message) { - xxx_messageInfo_DownsamplerOutput.Merge(m, src) -} -func (m *DownsamplerOutput) XXX_Size() int { - return xxx_messageInfo_DownsamplerOutput.Size(m) -} -func (m *DownsamplerOutput) XXX_DiscardUnknown() { - xxx_messageInfo_DownsamplerOutput.DiscardUnknown(m) -} - -var xxx_messageInfo_DownsamplerOutput proto.InternalMessageInfo - -func (m *DownsamplerOutput) GetSampleBatchList() []*SampleBatch { - if m != nil { - return m.SampleBatchList - } - return nil -} - -type AnalyzerHistoricQueryInput struct { - BenchmarkInfo *BenchmarkInfo `protobuf:"bytes,1,opt,name=benchmark_info,json=benchmarkInfo" json:"benchmark_info,omitempty"` - RunInfo *RunInfo `protobuf:"bytes,2,opt,name=run_info,json=runInfo" json:"run_info,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *AnalyzerHistoricQueryInput) Reset() { *m = AnalyzerHistoricQueryInput{} } -func (m *AnalyzerHistoricQueryInput) String() string { return proto.CompactTextString(m) } -func (*AnalyzerHistoricQueryInput) ProtoMessage() {} -func (*AnalyzerHistoricQueryInput) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{33} -} - -func (m *AnalyzerHistoricQueryInput) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AnalyzerHistoricQueryInput.Unmarshal(m, b) -} -func (m *AnalyzerHistoricQueryInput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AnalyzerHistoricQueryInput.Marshal(b, m, deterministic) -} -func (m *AnalyzerHistoricQueryInput) XXX_Merge(src proto.Message) { - xxx_messageInfo_AnalyzerHistoricQueryInput.Merge(m, src) -} -func (m *AnalyzerHistoricQueryInput) XXX_Size() int { - return xxx_messageInfo_AnalyzerHistoricQueryInput.Size(m) -} -func (m *AnalyzerHistoricQueryInput) XXX_DiscardUnknown() { - xxx_messageInfo_AnalyzerHistoricQueryInput.DiscardUnknown(m) -} - -var xxx_messageInfo_AnalyzerHistoricQueryInput proto.InternalMessageInfo - -func (m *AnalyzerHistoricQueryInput) GetBenchmarkInfo() *BenchmarkInfo { - if m != nil { - return m.BenchmarkInfo - } - return nil -} - -func (m *AnalyzerHistoricQueryInput) GetRunInfo() *RunInfo { - if m != nil { - return m.RunInfo - } - return nil -} - -type AnalyzerHistoricQueryOutput struct { - Status *Status `protobuf:"bytes,1,opt,name=status" json:"status,omitempty"` - RunInfoQueryList []*RunInfoQuery `protobuf:"bytes,2,rep,name=run_info_query_list,json=runInfoQueryList" json:"run_info_query_list,omitempty"` - GetBatches *bool `protobuf:"varint,3,opt,name=get_batches,json=getBatches,def=1" json:"get_batches,omitempty"` - RunInfoQueryMap map[string]*AnalyzerHistoricQueryOutput_RunInfoQueries `protobuf:"bytes,4,rep,name=run_info_query_map,json=runInfoQueryMap" json:"run_info_query_map,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *AnalyzerHistoricQueryOutput) Reset() { *m = AnalyzerHistoricQueryOutput{} } -func (m *AnalyzerHistoricQueryOutput) String() string { return proto.CompactTextString(m) } -func (*AnalyzerHistoricQueryOutput) ProtoMessage() {} -func (*AnalyzerHistoricQueryOutput) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{34} -} - -func (m *AnalyzerHistoricQueryOutput) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AnalyzerHistoricQueryOutput.Unmarshal(m, b) -} -func (m *AnalyzerHistoricQueryOutput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AnalyzerHistoricQueryOutput.Marshal(b, m, deterministic) -} -func (m *AnalyzerHistoricQueryOutput) XXX_Merge(src proto.Message) { - xxx_messageInfo_AnalyzerHistoricQueryOutput.Merge(m, src) -} -func (m *AnalyzerHistoricQueryOutput) XXX_Size() int { - return xxx_messageInfo_AnalyzerHistoricQueryOutput.Size(m) -} -func (m *AnalyzerHistoricQueryOutput) XXX_DiscardUnknown() { - xxx_messageInfo_AnalyzerHistoricQueryOutput.DiscardUnknown(m) -} - -var xxx_messageInfo_AnalyzerHistoricQueryOutput proto.InternalMessageInfo - -const Default_AnalyzerHistoricQueryOutput_GetBatches bool = true - -func (m *AnalyzerHistoricQueryOutput) GetStatus() *Status { - if m != nil { - return m.Status - } - return nil -} - -func (m *AnalyzerHistoricQueryOutput) GetRunInfoQueryList() []*RunInfoQuery { - if m != nil { - return m.RunInfoQueryList - } - return nil -} - -func (m *AnalyzerHistoricQueryOutput) GetGetBatches() bool { - if m != nil && m.GetBatches != nil { - return *m.GetBatches - } - return Default_AnalyzerHistoricQueryOutput_GetBatches -} - -func (m *AnalyzerHistoricQueryOutput) GetRunInfoQueryMap() map[string]*AnalyzerHistoricQueryOutput_RunInfoQueries { - if m != nil { - return m.RunInfoQueryMap - } - return nil -} - -type AnalyzerHistoricQueryOutput_RunInfoQueries struct { - RunInfoQueryList []*RunInfoQuery `protobuf:"bytes,1,rep,name=run_info_query_list,json=runInfoQueryList" json:"run_info_query_list,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *AnalyzerHistoricQueryOutput_RunInfoQueries) Reset() { - *m = AnalyzerHistoricQueryOutput_RunInfoQueries{} -} -func (m *AnalyzerHistoricQueryOutput_RunInfoQueries) String() string { - return proto.CompactTextString(m) -} -func (*AnalyzerHistoricQueryOutput_RunInfoQueries) ProtoMessage() {} -func (*AnalyzerHistoricQueryOutput_RunInfoQueries) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{34, 0} -} - -func (m *AnalyzerHistoricQueryOutput_RunInfoQueries) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AnalyzerHistoricQueryOutput_RunInfoQueries.Unmarshal(m, b) -} -func (m *AnalyzerHistoricQueryOutput_RunInfoQueries) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AnalyzerHistoricQueryOutput_RunInfoQueries.Marshal(b, m, deterministic) -} -func (m *AnalyzerHistoricQueryOutput_RunInfoQueries) XXX_Merge(src proto.Message) { - xxx_messageInfo_AnalyzerHistoricQueryOutput_RunInfoQueries.Merge(m, src) -} -func (m *AnalyzerHistoricQueryOutput_RunInfoQueries) XXX_Size() int { - return xxx_messageInfo_AnalyzerHistoricQueryOutput_RunInfoQueries.Size(m) -} -func (m *AnalyzerHistoricQueryOutput_RunInfoQueries) XXX_DiscardUnknown() { - xxx_messageInfo_AnalyzerHistoricQueryOutput_RunInfoQueries.DiscardUnknown(m) -} - -var xxx_messageInfo_AnalyzerHistoricQueryOutput_RunInfoQueries proto.InternalMessageInfo - -func (m *AnalyzerHistoricQueryOutput_RunInfoQueries) GetRunInfoQueryList() []*RunInfoQuery { - if m != nil { - return m.RunInfoQueryList - } - return nil -} - -type AnalyzerInput struct { - RunToBeAnalyzed *RunBundle `protobuf:"bytes,1,opt,name=run_to_be_analyzed,json=runToBeAnalyzed" json:"run_to_be_analyzed,omitempty"` - HistoricalRunList []*RunBundle `protobuf:"bytes,2,rep,name=historical_run_list,json=historicalRunList" json:"historical_run_list,omitempty"` - HistoricalRunMap map[string]*AnalyzerInput_RunBundles `protobuf:"bytes,3,rep,name=historical_run_map,json=historicalRunMap" json:"historical_run_map,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *AnalyzerInput) Reset() { *m = AnalyzerInput{} } -func (m *AnalyzerInput) String() string { return proto.CompactTextString(m) } -func (*AnalyzerInput) ProtoMessage() {} -func (*AnalyzerInput) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{35} -} - -func (m *AnalyzerInput) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AnalyzerInput.Unmarshal(m, b) -} -func (m *AnalyzerInput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AnalyzerInput.Marshal(b, m, deterministic) -} -func (m *AnalyzerInput) XXX_Merge(src proto.Message) { - xxx_messageInfo_AnalyzerInput.Merge(m, src) -} -func (m *AnalyzerInput) XXX_Size() int { - return xxx_messageInfo_AnalyzerInput.Size(m) -} -func (m *AnalyzerInput) XXX_DiscardUnknown() { - xxx_messageInfo_AnalyzerInput.DiscardUnknown(m) -} - -var xxx_messageInfo_AnalyzerInput proto.InternalMessageInfo - -func (m *AnalyzerInput) GetRunToBeAnalyzed() *RunBundle { - if m != nil { - return m.RunToBeAnalyzed - } - return nil -} - -func (m *AnalyzerInput) GetHistoricalRunList() []*RunBundle { - if m != nil { - return m.HistoricalRunList - } - return nil -} - -func (m *AnalyzerInput) GetHistoricalRunMap() map[string]*AnalyzerInput_RunBundles { - if m != nil { - return m.HistoricalRunMap - } - return nil -} - -type AnalyzerInput_RunBundles struct { - HistoricalRunList []*RunBundle `protobuf:"bytes,1,rep,name=historical_run_list,json=historicalRunList" json:"historical_run_list,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *AnalyzerInput_RunBundles) Reset() { *m = AnalyzerInput_RunBundles{} } -func (m *AnalyzerInput_RunBundles) String() string { return proto.CompactTextString(m) } -func (*AnalyzerInput_RunBundles) ProtoMessage() {} -func (*AnalyzerInput_RunBundles) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{35, 0} -} - -func (m *AnalyzerInput_RunBundles) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AnalyzerInput_RunBundles.Unmarshal(m, b) -} -func (m *AnalyzerInput_RunBundles) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AnalyzerInput_RunBundles.Marshal(b, m, deterministic) -} -func (m *AnalyzerInput_RunBundles) XXX_Merge(src proto.Message) { - xxx_messageInfo_AnalyzerInput_RunBundles.Merge(m, src) -} -func (m *AnalyzerInput_RunBundles) XXX_Size() int { - return xxx_messageInfo_AnalyzerInput_RunBundles.Size(m) -} -func (m *AnalyzerInput_RunBundles) XXX_DiscardUnknown() { - xxx_messageInfo_AnalyzerInput_RunBundles.DiscardUnknown(m) -} - -var xxx_messageInfo_AnalyzerInput_RunBundles proto.InternalMessageInfo - -func (m *AnalyzerInput_RunBundles) GetHistoricalRunList() []*RunBundle { - if m != nil { - return m.HistoricalRunList - } - return nil -} - -type AnalyzerOutput struct { - Status *Status `protobuf:"bytes,1,opt,name=status" json:"status,omitempty"` - Regression *bool `protobuf:"varint,2,opt,name=regression" json:"regression,omitempty"` - RunKey *string `protobuf:"bytes,7,opt,name=run_key,json=runKey" json:"run_key,omitempty"` - AnalysisKey *string `protobuf:"bytes,8,opt,name=analysis_key,json=analysisKey" json:"analysis_key,omitempty"` - AnalysisTriageInfo *AnalysisTriageInfo `protobuf:"bytes,10,opt,name=analysis_triage_info,json=analysisTriageInfo" json:"analysis_triage_info,omitempty"` - InputConfig *string `protobuf:"bytes,6,opt,name=input_config,json=inputConfig" json:"input_config,omitempty"` - SerializedInputConfig []byte `protobuf:"bytes,11,opt,name=serialized_input_config,json=serializedInputConfig" json:"serialized_input_config,omitempty"` - Output *string `protobuf:"bytes,3,opt,name=output" json:"output,omitempty"` - SerializedOutput []byte `protobuf:"bytes,12,opt,name=serialized_output,json=serializedOutput" json:"serialized_output,omitempty"` - AnalyzerType *string `protobuf:"bytes,4,opt,name=analyzer_type,json=analyzerType" json:"analyzer_type,omitempty"` - AnalyzerName *string `protobuf:"bytes,5,opt,name=analyzer_name,json=analyzerName" json:"analyzer_name,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *AnalyzerOutput) Reset() { *m = AnalyzerOutput{} } -func (m *AnalyzerOutput) String() string { return proto.CompactTextString(m) } -func (*AnalyzerOutput) ProtoMessage() {} -func (*AnalyzerOutput) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{36} -} - -func (m *AnalyzerOutput) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AnalyzerOutput.Unmarshal(m, b) -} -func (m *AnalyzerOutput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AnalyzerOutput.Marshal(b, m, deterministic) -} -func (m *AnalyzerOutput) XXX_Merge(src proto.Message) { - xxx_messageInfo_AnalyzerOutput.Merge(m, src) -} -func (m *AnalyzerOutput) XXX_Size() int { - return xxx_messageInfo_AnalyzerOutput.Size(m) -} -func (m *AnalyzerOutput) XXX_DiscardUnknown() { - xxx_messageInfo_AnalyzerOutput.DiscardUnknown(m) -} - -var xxx_messageInfo_AnalyzerOutput proto.InternalMessageInfo - -func (m *AnalyzerOutput) GetStatus() *Status { - if m != nil { - return m.Status - } - return nil -} - -func (m *AnalyzerOutput) GetRegression() bool { - if m != nil && m.Regression != nil { - return *m.Regression - } - return false -} - -func (m *AnalyzerOutput) GetRunKey() string { - if m != nil && m.RunKey != nil { - return *m.RunKey - } - return "" -} - -func (m *AnalyzerOutput) GetAnalysisKey() string { - if m != nil && m.AnalysisKey != nil { - return *m.AnalysisKey - } - return "" -} - -func (m *AnalyzerOutput) GetAnalysisTriageInfo() *AnalysisTriageInfo { - if m != nil { - return m.AnalysisTriageInfo - } - return nil -} - -func (m *AnalyzerOutput) GetInputConfig() string { - if m != nil && m.InputConfig != nil { - return *m.InputConfig - } - return "" -} - -func (m *AnalyzerOutput) GetSerializedInputConfig() []byte { - if m != nil { - return m.SerializedInputConfig - } - return nil -} - -func (m *AnalyzerOutput) GetOutput() string { - if m != nil && m.Output != nil { - return *m.Output - } - return "" -} - -func (m *AnalyzerOutput) GetSerializedOutput() []byte { - if m != nil { - return m.SerializedOutput - } - return nil -} - -func (m *AnalyzerOutput) GetAnalyzerType() string { - if m != nil && m.AnalyzerType != nil { - return *m.AnalyzerType - } - return "" -} - -func (m *AnalyzerOutput) GetAnalyzerName() string { - if m != nil && m.AnalyzerName != nil { - return *m.AnalyzerName - } - return "" -} - -type AnalysisTriageInfo struct { - AnalysisState *AnalysisTriageInfo_AnalysisTriageType `protobuf:"varint,1,opt,name=analysis_state,json=analysisState,enum=mako.AnalysisTriageInfo_AnalysisTriageType" json:"analysis_state,omitempty"` - Environment *AnalysisTriageInfo_EnvironmentType `protobuf:"varint,2,opt,name=environment,enum=mako.AnalysisTriageInfo_EnvironmentType" json:"environment,omitempty"` - Comment *string `protobuf:"bytes,3,opt,name=comment" json:"comment,omitempty"` - BuganizerId *string `protobuf:"bytes,4,opt,name=buganizer_id,json=buganizerId" json:"buganizer_id,omitempty"` - RunKey *string `protobuf:"bytes,5,opt,name=run_key,json=runKey" json:"run_key,omitempty"` - AnalysisKey *string `protobuf:"bytes,6,opt,name=analysis_key,json=analysisKey" json:"analysis_key,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *AnalysisTriageInfo) Reset() { *m = AnalysisTriageInfo{} } -func (m *AnalysisTriageInfo) String() string { return proto.CompactTextString(m) } -func (*AnalysisTriageInfo) ProtoMessage() {} -func (*AnalysisTriageInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{37} -} - -func (m *AnalysisTriageInfo) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AnalysisTriageInfo.Unmarshal(m, b) -} -func (m *AnalysisTriageInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AnalysisTriageInfo.Marshal(b, m, deterministic) -} -func (m *AnalysisTriageInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_AnalysisTriageInfo.Merge(m, src) -} -func (m *AnalysisTriageInfo) XXX_Size() int { - return xxx_messageInfo_AnalysisTriageInfo.Size(m) -} -func (m *AnalysisTriageInfo) XXX_DiscardUnknown() { - xxx_messageInfo_AnalysisTriageInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_AnalysisTriageInfo proto.InternalMessageInfo - -func (m *AnalysisTriageInfo) GetAnalysisState() AnalysisTriageInfo_AnalysisTriageType { - if m != nil && m.AnalysisState != nil { - return *m.AnalysisState - } - return AnalysisTriageInfo_NONE -} - -func (m *AnalysisTriageInfo) GetEnvironment() AnalysisTriageInfo_EnvironmentType { - if m != nil && m.Environment != nil { - return *m.Environment - } - return AnalysisTriageInfo_UNSPECIFIED -} - -func (m *AnalysisTriageInfo) GetComment() string { - if m != nil && m.Comment != nil { - return *m.Comment - } - return "" -} - -func (m *AnalysisTriageInfo) GetBuganizerId() string { - if m != nil && m.BuganizerId != nil { - return *m.BuganizerId - } - return "" -} - -func (m *AnalysisTriageInfo) GetRunKey() string { - if m != nil && m.RunKey != nil { - return *m.RunKey - } - return "" -} - -func (m *AnalysisTriageInfo) GetAnalysisKey() string { - if m != nil && m.AnalysisKey != nil { - return *m.AnalysisKey - } - return "" -} - -type DashboardAggregateChartInput struct { - BenchmarkKey *string `protobuf:"bytes,1,opt,name=benchmark_key,json=benchmarkKey" json:"benchmark_key,omitempty"` - ValueSelections []*DataFilter `protobuf:"bytes,2,rep,name=value_selections,json=valueSelections" json:"value_selections,omitempty"` - Tags []string `protobuf:"bytes,3,rep,name=tags" json:"tags,omitempty"` - RunOrder *RunOrder `protobuf:"varint,8,opt,name=run_order,json=runOrder,enum=mako.RunOrder,def=1" json:"run_order,omitempty"` - MinTimestampMs *float64 `protobuf:"fixed64,4,opt,name=min_timestamp_ms,json=minTimestampMs" json:"min_timestamp_ms,omitempty"` - MaxTimestampMs *float64 `protobuf:"fixed64,5,opt,name=max_timestamp_ms,json=maxTimestampMs" json:"max_timestamp_ms,omitempty"` - MinBuildId *int64 `protobuf:"varint,9,opt,name=min_build_id,json=minBuildId" json:"min_build_id,omitempty"` - MaxBuildId *int64 `protobuf:"varint,10,opt,name=max_build_id,json=maxBuildId" json:"max_build_id,omitempty"` - MaxRuns *int32 `protobuf:"varint,6,opt,name=max_runs,json=maxRuns" json:"max_runs,omitempty"` - HighlightSeriesOnHover *bool `protobuf:"varint,7,opt,name=highlight_series_on_hover,json=highlightSeriesOnHover" json:"highlight_series_on_hover,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DashboardAggregateChartInput) Reset() { *m = DashboardAggregateChartInput{} } -func (m *DashboardAggregateChartInput) String() string { return proto.CompactTextString(m) } -func (*DashboardAggregateChartInput) ProtoMessage() {} -func (*DashboardAggregateChartInput) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{38} -} - -func (m *DashboardAggregateChartInput) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DashboardAggregateChartInput.Unmarshal(m, b) -} -func (m *DashboardAggregateChartInput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DashboardAggregateChartInput.Marshal(b, m, deterministic) -} -func (m *DashboardAggregateChartInput) XXX_Merge(src proto.Message) { - xxx_messageInfo_DashboardAggregateChartInput.Merge(m, src) -} -func (m *DashboardAggregateChartInput) XXX_Size() int { - return xxx_messageInfo_DashboardAggregateChartInput.Size(m) -} -func (m *DashboardAggregateChartInput) XXX_DiscardUnknown() { - xxx_messageInfo_DashboardAggregateChartInput.DiscardUnknown(m) -} - -var xxx_messageInfo_DashboardAggregateChartInput proto.InternalMessageInfo - -const Default_DashboardAggregateChartInput_RunOrder RunOrder = RunOrder_TIMESTAMP - -func (m *DashboardAggregateChartInput) GetBenchmarkKey() string { - if m != nil && m.BenchmarkKey != nil { - return *m.BenchmarkKey - } - return "" -} - -func (m *DashboardAggregateChartInput) GetValueSelections() []*DataFilter { - if m != nil { - return m.ValueSelections - } - return nil -} - -func (m *DashboardAggregateChartInput) GetTags() []string { - if m != nil { - return m.Tags - } - return nil -} - -func (m *DashboardAggregateChartInput) GetRunOrder() RunOrder { - if m != nil && m.RunOrder != nil { - return *m.RunOrder - } - return Default_DashboardAggregateChartInput_RunOrder -} - -func (m *DashboardAggregateChartInput) GetMinTimestampMs() float64 { - if m != nil && m.MinTimestampMs != nil { - return *m.MinTimestampMs - } - return 0 -} - -func (m *DashboardAggregateChartInput) GetMaxTimestampMs() float64 { - if m != nil && m.MaxTimestampMs != nil { - return *m.MaxTimestampMs - } - return 0 -} - -func (m *DashboardAggregateChartInput) GetMinBuildId() int64 { - if m != nil && m.MinBuildId != nil { - return *m.MinBuildId - } - return 0 -} - -func (m *DashboardAggregateChartInput) GetMaxBuildId() int64 { - if m != nil && m.MaxBuildId != nil { - return *m.MaxBuildId - } - return 0 -} - -func (m *DashboardAggregateChartInput) GetMaxRuns() int32 { - if m != nil && m.MaxRuns != nil { - return *m.MaxRuns - } - return 0 -} - -func (m *DashboardAggregateChartInput) GetHighlightSeriesOnHover() bool { - if m != nil && m.HighlightSeriesOnHover != nil { - return *m.HighlightSeriesOnHover - } - return false -} - -type DashboardRunChartInput struct { - RunKey *string `protobuf:"bytes,1,opt,name=run_key,json=runKey" json:"run_key,omitempty"` - MetricKeys []string `protobuf:"bytes,2,rep,name=metric_keys,json=metricKeys" json:"metric_keys,omitempty"` - HighlightSeriesOnHover *bool `protobuf:"varint,3,opt,name=highlight_series_on_hover,json=highlightSeriesOnHover" json:"highlight_series_on_hover,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DashboardRunChartInput) Reset() { *m = DashboardRunChartInput{} } -func (m *DashboardRunChartInput) String() string { return proto.CompactTextString(m) } -func (*DashboardRunChartInput) ProtoMessage() {} -func (*DashboardRunChartInput) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{39} -} - -func (m *DashboardRunChartInput) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DashboardRunChartInput.Unmarshal(m, b) -} -func (m *DashboardRunChartInput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DashboardRunChartInput.Marshal(b, m, deterministic) -} -func (m *DashboardRunChartInput) XXX_Merge(src proto.Message) { - xxx_messageInfo_DashboardRunChartInput.Merge(m, src) -} -func (m *DashboardRunChartInput) XXX_Size() int { - return xxx_messageInfo_DashboardRunChartInput.Size(m) -} -func (m *DashboardRunChartInput) XXX_DiscardUnknown() { - xxx_messageInfo_DashboardRunChartInput.DiscardUnknown(m) -} - -var xxx_messageInfo_DashboardRunChartInput proto.InternalMessageInfo - -func (m *DashboardRunChartInput) GetRunKey() string { - if m != nil && m.RunKey != nil { - return *m.RunKey - } - return "" -} - -func (m *DashboardRunChartInput) GetMetricKeys() []string { - if m != nil { - return m.MetricKeys - } - return nil -} - -func (m *DashboardRunChartInput) GetHighlightSeriesOnHover() bool { - if m != nil && m.HighlightSeriesOnHover != nil { - return *m.HighlightSeriesOnHover - } - return false -} - -type DashboardCompareAggregateChartInput struct { - SeriesList []*DashboardCompareAggregateChartInput_Series `protobuf:"bytes,1,rep,name=series_list,json=seriesList" json:"series_list,omitempty"` - MinTimestampMs *float64 `protobuf:"fixed64,2,opt,name=min_timestamp_ms,json=minTimestampMs" json:"min_timestamp_ms,omitempty"` - MaxTimestampMs *float64 `protobuf:"fixed64,3,opt,name=max_timestamp_ms,json=maxTimestampMs" json:"max_timestamp_ms,omitempty"` - MaxRuns *int32 `protobuf:"varint,4,opt,name=max_runs,json=maxRuns" json:"max_runs,omitempty"` - HighlightSeriesOnHover *bool `protobuf:"varint,5,opt,name=highlight_series_on_hover,json=highlightSeriesOnHover" json:"highlight_series_on_hover,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DashboardCompareAggregateChartInput) Reset() { *m = DashboardCompareAggregateChartInput{} } -func (m *DashboardCompareAggregateChartInput) String() string { return proto.CompactTextString(m) } -func (*DashboardCompareAggregateChartInput) ProtoMessage() {} -func (*DashboardCompareAggregateChartInput) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{40} -} - -func (m *DashboardCompareAggregateChartInput) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DashboardCompareAggregateChartInput.Unmarshal(m, b) -} -func (m *DashboardCompareAggregateChartInput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DashboardCompareAggregateChartInput.Marshal(b, m, deterministic) -} -func (m *DashboardCompareAggregateChartInput) XXX_Merge(src proto.Message) { - xxx_messageInfo_DashboardCompareAggregateChartInput.Merge(m, src) -} -func (m *DashboardCompareAggregateChartInput) XXX_Size() int { - return xxx_messageInfo_DashboardCompareAggregateChartInput.Size(m) -} -func (m *DashboardCompareAggregateChartInput) XXX_DiscardUnknown() { - xxx_messageInfo_DashboardCompareAggregateChartInput.DiscardUnknown(m) -} - -var xxx_messageInfo_DashboardCompareAggregateChartInput proto.InternalMessageInfo - -func (m *DashboardCompareAggregateChartInput) GetSeriesList() []*DashboardCompareAggregateChartInput_Series { - if m != nil { - return m.SeriesList - } - return nil -} - -func (m *DashboardCompareAggregateChartInput) GetMinTimestampMs() float64 { - if m != nil && m.MinTimestampMs != nil { - return *m.MinTimestampMs - } - return 0 -} - -func (m *DashboardCompareAggregateChartInput) GetMaxTimestampMs() float64 { - if m != nil && m.MaxTimestampMs != nil { - return *m.MaxTimestampMs - } - return 0 -} - -func (m *DashboardCompareAggregateChartInput) GetMaxRuns() int32 { - if m != nil && m.MaxRuns != nil { - return *m.MaxRuns - } - return 0 -} - -func (m *DashboardCompareAggregateChartInput) GetHighlightSeriesOnHover() bool { - if m != nil && m.HighlightSeriesOnHover != nil { - return *m.HighlightSeriesOnHover - } - return false -} - -type DashboardCompareAggregateChartInput_Series struct { - SeriesLabel *string `protobuf:"bytes,1,opt,name=series_label,json=seriesLabel" json:"series_label,omitempty"` - BenchmarkKey *string `protobuf:"bytes,2,opt,name=benchmark_key,json=benchmarkKey" json:"benchmark_key,omitempty"` - ValueSelection *DataFilter `protobuf:"bytes,3,opt,name=value_selection,json=valueSelection" json:"value_selection,omitempty"` - Tags []string `protobuf:"bytes,4,rep,name=tags" json:"tags,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DashboardCompareAggregateChartInput_Series) Reset() { - *m = DashboardCompareAggregateChartInput_Series{} -} -func (m *DashboardCompareAggregateChartInput_Series) String() string { - return proto.CompactTextString(m) -} -func (*DashboardCompareAggregateChartInput_Series) ProtoMessage() {} -func (*DashboardCompareAggregateChartInput_Series) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{40, 0} -} - -func (m *DashboardCompareAggregateChartInput_Series) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DashboardCompareAggregateChartInput_Series.Unmarshal(m, b) -} -func (m *DashboardCompareAggregateChartInput_Series) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DashboardCompareAggregateChartInput_Series.Marshal(b, m, deterministic) -} -func (m *DashboardCompareAggregateChartInput_Series) XXX_Merge(src proto.Message) { - xxx_messageInfo_DashboardCompareAggregateChartInput_Series.Merge(m, src) -} -func (m *DashboardCompareAggregateChartInput_Series) XXX_Size() int { - return xxx_messageInfo_DashboardCompareAggregateChartInput_Series.Size(m) -} -func (m *DashboardCompareAggregateChartInput_Series) XXX_DiscardUnknown() { - xxx_messageInfo_DashboardCompareAggregateChartInput_Series.DiscardUnknown(m) -} - -var xxx_messageInfo_DashboardCompareAggregateChartInput_Series proto.InternalMessageInfo - -func (m *DashboardCompareAggregateChartInput_Series) GetSeriesLabel() string { - if m != nil && m.SeriesLabel != nil { - return *m.SeriesLabel - } - return "" -} - -func (m *DashboardCompareAggregateChartInput_Series) GetBenchmarkKey() string { - if m != nil && m.BenchmarkKey != nil { - return *m.BenchmarkKey - } - return "" -} - -func (m *DashboardCompareAggregateChartInput_Series) GetValueSelection() *DataFilter { - if m != nil { - return m.ValueSelection - } - return nil -} - -func (m *DashboardCompareAggregateChartInput_Series) GetTags() []string { - if m != nil { - return m.Tags - } - return nil -} - -type DashboardCompareRunChartInput struct { - RunKeys []string `protobuf:"bytes,1,rep,name=run_keys,json=runKeys" json:"run_keys,omitempty"` - MetricKeys []string `protobuf:"bytes,2,rep,name=metric_keys,json=metricKeys" json:"metric_keys,omitempty"` - HighlightSeriesOnHover *bool `protobuf:"varint,3,opt,name=highlight_series_on_hover,json=highlightSeriesOnHover" json:"highlight_series_on_hover,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DashboardCompareRunChartInput) Reset() { *m = DashboardCompareRunChartInput{} } -func (m *DashboardCompareRunChartInput) String() string { return proto.CompactTextString(m) } -func (*DashboardCompareRunChartInput) ProtoMessage() {} -func (*DashboardCompareRunChartInput) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{41} -} - -func (m *DashboardCompareRunChartInput) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DashboardCompareRunChartInput.Unmarshal(m, b) -} -func (m *DashboardCompareRunChartInput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DashboardCompareRunChartInput.Marshal(b, m, deterministic) -} -func (m *DashboardCompareRunChartInput) XXX_Merge(src proto.Message) { - xxx_messageInfo_DashboardCompareRunChartInput.Merge(m, src) -} -func (m *DashboardCompareRunChartInput) XXX_Size() int { - return xxx_messageInfo_DashboardCompareRunChartInput.Size(m) -} -func (m *DashboardCompareRunChartInput) XXX_DiscardUnknown() { - xxx_messageInfo_DashboardCompareRunChartInput.DiscardUnknown(m) -} - -var xxx_messageInfo_DashboardCompareRunChartInput proto.InternalMessageInfo - -func (m *DashboardCompareRunChartInput) GetRunKeys() []string { - if m != nil { - return m.RunKeys - } - return nil -} - -func (m *DashboardCompareRunChartInput) GetMetricKeys() []string { - if m != nil { - return m.MetricKeys - } - return nil -} - -func (m *DashboardCompareRunChartInput) GetHighlightSeriesOnHover() bool { - if m != nil && m.HighlightSeriesOnHover != nil { - return *m.HighlightSeriesOnHover - } - return false -} - -type DashboardVisualizeAnalysisInput struct { - RunKey *string `protobuf:"bytes,1,opt,name=run_key,json=runKey" json:"run_key,omitempty"` - AnalysisKey *string `protobuf:"bytes,2,opt,name=analysis_key,json=analysisKey" json:"analysis_key,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DashboardVisualizeAnalysisInput) Reset() { *m = DashboardVisualizeAnalysisInput{} } -func (m *DashboardVisualizeAnalysisInput) String() string { return proto.CompactTextString(m) } -func (*DashboardVisualizeAnalysisInput) ProtoMessage() {} -func (*DashboardVisualizeAnalysisInput) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{42} -} - -func (m *DashboardVisualizeAnalysisInput) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DashboardVisualizeAnalysisInput.Unmarshal(m, b) -} -func (m *DashboardVisualizeAnalysisInput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DashboardVisualizeAnalysisInput.Marshal(b, m, deterministic) -} -func (m *DashboardVisualizeAnalysisInput) XXX_Merge(src proto.Message) { - xxx_messageInfo_DashboardVisualizeAnalysisInput.Merge(m, src) -} -func (m *DashboardVisualizeAnalysisInput) XXX_Size() int { - return xxx_messageInfo_DashboardVisualizeAnalysisInput.Size(m) -} -func (m *DashboardVisualizeAnalysisInput) XXX_DiscardUnknown() { - xxx_messageInfo_DashboardVisualizeAnalysisInput.DiscardUnknown(m) -} - -var xxx_messageInfo_DashboardVisualizeAnalysisInput proto.InternalMessageInfo - -func (m *DashboardVisualizeAnalysisInput) GetRunKey() string { - if m != nil && m.RunKey != nil { - return *m.RunKey - } - return "" -} - -func (m *DashboardVisualizeAnalysisInput) GetAnalysisKey() string { - if m != nil && m.AnalysisKey != nil { - return *m.AnalysisKey - } - return "" -} - -type TestOption 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 *TestOption) Reset() { *m = TestOption{} } -func (m *TestOption) String() string { return proto.CompactTextString(m) } -func (*TestOption) ProtoMessage() {} -func (*TestOption) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{43} -} - -func (m *TestOption) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TestOption.Unmarshal(m, b) -} -func (m *TestOption) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TestOption.Marshal(b, m, deterministic) -} -func (m *TestOption) XXX_Merge(src proto.Message) { - xxx_messageInfo_TestOption.Merge(m, src) -} -func (m *TestOption) XXX_Size() int { - return xxx_messageInfo_TestOption.Size(m) -} -func (m *TestOption) XXX_DiscardUnknown() { - xxx_messageInfo_TestOption.DiscardUnknown(m) -} - -var xxx_messageInfo_TestOption proto.InternalMessageInfo - -func (m *TestOption) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *TestOption) GetValue() string { - if m != nil && m.Value != nil { - return *m.Value - } - return "" -} - -type TestInput struct { - BenchmarkKey *string `protobuf:"bytes,1,opt,name=benchmark_key,json=benchmarkKey" json:"benchmark_key,omitempty"` - TempDir *string `protobuf:"bytes,2,opt,name=temp_dir,json=tempDir" json:"temp_dir,omitempty"` - TimeoutSec *float64 `protobuf:"fixed64,3,opt,name=timeout_sec,json=timeoutSec" json:"timeout_sec,omitempty"` - TestOptionList []*TestOption `protobuf:"bytes,4,rep,name=test_option_list,json=testOptionList" json:"test_option_list,omitempty"` - Tags []string `protobuf:"bytes,6,rep,name=tags" json:"tags,omitempty"` - TestPassId *string `protobuf:"bytes,7,opt,name=test_pass_id,json=testPassId" json:"test_pass_id,omitempty"` - BuildId *int64 `protobuf:"varint,8,opt,name=build_id,json=buildId" json:"build_id,omitempty"` - InternalTestOptions map[string]string `protobuf:"bytes,10,rep,name=internal_test_options,json=internalTestOptions" json:"internal_test_options,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *TestInput) Reset() { *m = TestInput{} } -func (m *TestInput) String() string { return proto.CompactTextString(m) } -func (*TestInput) ProtoMessage() {} -func (*TestInput) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{44} -} - -func (m *TestInput) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TestInput.Unmarshal(m, b) -} -func (m *TestInput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TestInput.Marshal(b, m, deterministic) -} -func (m *TestInput) XXX_Merge(src proto.Message) { - xxx_messageInfo_TestInput.Merge(m, src) -} -func (m *TestInput) XXX_Size() int { - return xxx_messageInfo_TestInput.Size(m) -} -func (m *TestInput) XXX_DiscardUnknown() { - xxx_messageInfo_TestInput.DiscardUnknown(m) -} - -var xxx_messageInfo_TestInput proto.InternalMessageInfo - -func (m *TestInput) GetBenchmarkKey() string { - if m != nil && m.BenchmarkKey != nil { - return *m.BenchmarkKey - } - return "" -} - -func (m *TestInput) GetTempDir() string { - if m != nil && m.TempDir != nil { - return *m.TempDir - } - return "" -} - -func (m *TestInput) GetTimeoutSec() float64 { - if m != nil && m.TimeoutSec != nil { - return *m.TimeoutSec - } - return 0 -} - -func (m *TestInput) GetTestOptionList() []*TestOption { - if m != nil { - return m.TestOptionList - } - return nil -} - -func (m *TestInput) GetTags() []string { - if m != nil { - return m.Tags - } - return nil -} - -func (m *TestInput) GetTestPassId() string { - if m != nil && m.TestPassId != nil { - return *m.TestPassId - } - return "" -} - -func (m *TestInput) GetBuildId() int64 { - if m != nil && m.BuildId != nil { - return *m.BuildId - } - return 0 -} - -func (m *TestInput) GetInternalTestOptions() map[string]string { - if m != nil { - return m.InternalTestOptions - } - return nil -} - -type TestOutput struct { - TestStatus *TestOutput_TestStatus `protobuf:"varint,1,opt,name=test_status,json=testStatus,enum=mako.TestOutput_TestStatus" json:"test_status,omitempty"` - AnalyzerOutputList []*AnalyzerOutput `protobuf:"bytes,2,rep,name=analyzer_output_list,json=analyzerOutputList" json:"analyzer_output_list,omitempty"` - SummaryOutput *string `protobuf:"bytes,3,opt,name=summary_output,json=summaryOutput" json:"summary_output,omitempty"` - RunChartLink *string `protobuf:"bytes,4,opt,name=run_chart_link,json=runChartLink" json:"run_chart_link,omitempty"` - RunKey *string `protobuf:"bytes,5,opt,name=run_key,json=runKey" json:"run_key,omitempty"` - RetryableFailureType *TestOutput_RetryableFailureType `protobuf:"varint,6,opt,name=retryable_failure_type,json=retryableFailureType,enum=mako.TestOutput_RetryableFailureType" json:"retryable_failure_type,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *TestOutput) Reset() { *m = TestOutput{} } -func (m *TestOutput) String() string { return proto.CompactTextString(m) } -func (*TestOutput) ProtoMessage() {} -func (*TestOutput) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{45} -} - -func (m *TestOutput) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TestOutput.Unmarshal(m, b) -} -func (m *TestOutput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TestOutput.Marshal(b, m, deterministic) -} -func (m *TestOutput) XXX_Merge(src proto.Message) { - xxx_messageInfo_TestOutput.Merge(m, src) -} -func (m *TestOutput) XXX_Size() int { - return xxx_messageInfo_TestOutput.Size(m) -} -func (m *TestOutput) XXX_DiscardUnknown() { - xxx_messageInfo_TestOutput.DiscardUnknown(m) -} - -var xxx_messageInfo_TestOutput proto.InternalMessageInfo - -func (m *TestOutput) GetTestStatus() TestOutput_TestStatus { - if m != nil && m.TestStatus != nil { - return *m.TestStatus - } - return TestOutput_PASS -} - -func (m *TestOutput) GetAnalyzerOutputList() []*AnalyzerOutput { - if m != nil { - return m.AnalyzerOutputList - } - return nil -} - -func (m *TestOutput) GetSummaryOutput() string { - if m != nil && m.SummaryOutput != nil { - return *m.SummaryOutput - } - return "" -} - -func (m *TestOutput) GetRunChartLink() string { - if m != nil && m.RunChartLink != nil { - return *m.RunChartLink - } - return "" -} - -func (m *TestOutput) GetRunKey() string { - if m != nil && m.RunKey != nil { - return *m.RunKey - } - return "" -} - -func (m *TestOutput) GetRetryableFailureType() TestOutput_RetryableFailureType { - if m != nil && m.RetryableFailureType != nil { - return *m.RetryableFailureType - } - return TestOutput_UNKNOWN_OR_UNSET_TYPE -} - -type SampleRecord struct { - SamplePoint *SamplePoint `protobuf:"bytes,1,opt,name=sample_point,json=samplePoint" json:"sample_point,omitempty"` - SampleError *SampleError `protobuf:"bytes,2,opt,name=sample_error,json=sampleError" json:"sample_error,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SampleRecord) Reset() { *m = SampleRecord{} } -func (m *SampleRecord) String() string { return proto.CompactTextString(m) } -func (*SampleRecord) ProtoMessage() {} -func (*SampleRecord) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{46} -} - -func (m *SampleRecord) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SampleRecord.Unmarshal(m, b) -} -func (m *SampleRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SampleRecord.Marshal(b, m, deterministic) -} -func (m *SampleRecord) XXX_Merge(src proto.Message) { - xxx_messageInfo_SampleRecord.Merge(m, src) -} -func (m *SampleRecord) XXX_Size() int { - return xxx_messageInfo_SampleRecord.Size(m) -} -func (m *SampleRecord) XXX_DiscardUnknown() { - xxx_messageInfo_SampleRecord.DiscardUnknown(m) -} - -var xxx_messageInfo_SampleRecord proto.InternalMessageInfo - -func (m *SampleRecord) GetSamplePoint() *SamplePoint { - if m != nil { - return m.SamplePoint - } - return nil -} - -func (m *SampleRecord) GetSampleError() *SampleError { - if m != nil { - return m.SampleError - } - return nil -} - -type SampleFile struct { - SamplerName *string `protobuf:"bytes,1,opt,name=sampler_name,json=samplerName" json:"sampler_name,omitempty"` - FilePath *string `protobuf:"bytes,2,opt,name=file_path,json=filePath" json:"file_path,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SampleFile) Reset() { *m = SampleFile{} } -func (m *SampleFile) String() string { return proto.CompactTextString(m) } -func (*SampleFile) ProtoMessage() {} -func (*SampleFile) Descriptor() ([]byte, []int) { - return fileDescriptor_b174f87a83ddb952, []int{47} -} - -func (m *SampleFile) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SampleFile.Unmarshal(m, b) -} -func (m *SampleFile) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SampleFile.Marshal(b, m, deterministic) -} -func (m *SampleFile) XXX_Merge(src proto.Message) { - xxx_messageInfo_SampleFile.Merge(m, src) -} -func (m *SampleFile) XXX_Size() int { - return xxx_messageInfo_SampleFile.Size(m) -} -func (m *SampleFile) XXX_DiscardUnknown() { - xxx_messageInfo_SampleFile.DiscardUnknown(m) -} - -var xxx_messageInfo_SampleFile proto.InternalMessageInfo - -func (m *SampleFile) GetSamplerName() string { - if m != nil && m.SamplerName != nil { - return *m.SamplerName - } - return "" -} - -func (m *SampleFile) GetFilePath() string { - if m != nil && m.FilePath != nil { - return *m.FilePath - } - return "" -} - -func init() { - proto.RegisterEnum("mako.RunOrder", RunOrder_name, RunOrder_value) - proto.RegisterEnum("mako.Status_Code", Status_Code_name, Status_Code_value) - proto.RegisterEnum("mako.ValueInfo_Type", ValueInfo_Type_name, ValueInfo_Type_value) - proto.RegisterEnum("mako.DataFilter_DataType", DataFilter_DataType_name, DataFilter_DataType_value) - proto.RegisterEnum("mako.AnalysisTriageInfo_AnalysisTriageType", AnalysisTriageInfo_AnalysisTriageType_name, AnalysisTriageInfo_AnalysisTriageType_value) - proto.RegisterEnum("mako.AnalysisTriageInfo_EnvironmentType", AnalysisTriageInfo_EnvironmentType_name, AnalysisTriageInfo_EnvironmentType_value) - proto.RegisterEnum("mako.TestOutput_TestStatus", TestOutput_TestStatus_name, TestOutput_TestStatus_value) - proto.RegisterEnum("mako.TestOutput_RetryableFailureType", TestOutput_RetryableFailureType_name, TestOutput_RetryableFailureType_value) - proto.RegisterType((*Status)(nil), "mako.Status") - proto.RegisterType((*ValueInfo)(nil), "mako.ValueInfo") - proto.RegisterType((*KeyedValue)(nil), "mako.KeyedValue") - proto.RegisterType((*NamedData)(nil), "mako.NamedData") - proto.RegisterType((*Range)(nil), "mako.Range") - proto.RegisterType((*LabeledRange)(nil), "mako.LabeledRange") - proto.RegisterType((*DataFilter)(nil), "mako.DataFilter") - proto.RegisterType((*RunBundle)(nil), "mako.RunBundle") - proto.RegisterType((*BenchmarkInfo)(nil), "mako.BenchmarkInfo") - proto.RegisterType((*RunAnnotation)(nil), "mako.RunAnnotation") - proto.RegisterType((*RunInfo)(nil), "mako.RunInfo") - proto.RegisterType((*SamplePoint)(nil), "mako.SamplePoint") - proto.RegisterMapType((map[string][]byte)(nil), "mako.SamplePoint.AuxDataEntry") - proto.RegisterType((*SampleAnnotation)(nil), "mako.SampleAnnotation") - proto.RegisterType((*SampleError)(nil), "mako.SampleError") - proto.RegisterType((*SampleBatch)(nil), "mako.SampleBatch") - proto.RegisterType((*MetricAggregate)(nil), "mako.MetricAggregate") - proto.RegisterType((*RunAggregate)(nil), "mako.RunAggregate") - proto.RegisterType((*Aggregate)(nil), "mako.Aggregate") - proto.RegisterType((*BenchmarkInfoQuery)(nil), "mako.BenchmarkInfoQuery") - proto.RegisterType((*BenchmarkInfoQueryResponse)(nil), "mako.BenchmarkInfoQueryResponse") - proto.RegisterType((*RunInfoQuery)(nil), "mako.RunInfoQuery") - proto.RegisterType((*RunInfoQueryResponse)(nil), "mako.RunInfoQueryResponse") - proto.RegisterType((*SampleBatchQuery)(nil), "mako.SampleBatchQuery") - proto.RegisterType((*SampleBatchQueryResponse)(nil), "mako.SampleBatchQueryResponse") - proto.RegisterType((*CreationResponse)(nil), "mako.CreationResponse") - proto.RegisterType((*ModificationResponse)(nil), "mako.ModificationResponse") - proto.RegisterType((*CountResponse)(nil), "mako.CountResponse") - proto.RegisterType((*SecondaryStorageWriteInput)(nil), "mako.SecondaryStorageWriteInput") - proto.RegisterType((*SecondaryStorageWriteOutput)(nil), "mako.SecondaryStorageWriteOutput") - proto.RegisterType((*AggregatorInput)(nil), "mako.AggregatorInput") - proto.RegisterType((*AggregatorOutput)(nil), "mako.AggregatorOutput") - proto.RegisterType((*DownsamplerInput)(nil), "mako.DownsamplerInput") - proto.RegisterType((*DownsamplerOutput)(nil), "mako.DownsamplerOutput") - proto.RegisterType((*AnalyzerHistoricQueryInput)(nil), "mako.AnalyzerHistoricQueryInput") - proto.RegisterType((*AnalyzerHistoricQueryOutput)(nil), "mako.AnalyzerHistoricQueryOutput") - proto.RegisterMapType((map[string]*AnalyzerHistoricQueryOutput_RunInfoQueries)(nil), "mako.AnalyzerHistoricQueryOutput.RunInfoQueryMapEntry") - proto.RegisterType((*AnalyzerHistoricQueryOutput_RunInfoQueries)(nil), "mako.AnalyzerHistoricQueryOutput.RunInfoQueries") - proto.RegisterType((*AnalyzerInput)(nil), "mako.AnalyzerInput") - proto.RegisterMapType((map[string]*AnalyzerInput_RunBundles)(nil), "mako.AnalyzerInput.HistoricalRunMapEntry") - proto.RegisterType((*AnalyzerInput_RunBundles)(nil), "mako.AnalyzerInput.RunBundles") - proto.RegisterType((*AnalyzerOutput)(nil), "mako.AnalyzerOutput") - proto.RegisterType((*AnalysisTriageInfo)(nil), "mako.AnalysisTriageInfo") - proto.RegisterType((*DashboardAggregateChartInput)(nil), "mako.DashboardAggregateChartInput") - proto.RegisterType((*DashboardRunChartInput)(nil), "mako.DashboardRunChartInput") - proto.RegisterType((*DashboardCompareAggregateChartInput)(nil), "mako.DashboardCompareAggregateChartInput") - proto.RegisterType((*DashboardCompareAggregateChartInput_Series)(nil), "mako.DashboardCompareAggregateChartInput.Series") - proto.RegisterType((*DashboardCompareRunChartInput)(nil), "mako.DashboardCompareRunChartInput") - proto.RegisterType((*DashboardVisualizeAnalysisInput)(nil), "mako.DashboardVisualizeAnalysisInput") - proto.RegisterType((*TestOption)(nil), "mako.TestOption") - proto.RegisterType((*TestInput)(nil), "mako.TestInput") - proto.RegisterMapType((map[string]string)(nil), "mako.TestInput.InternalTestOptionsEntry") - proto.RegisterType((*TestOutput)(nil), "mako.TestOutput") - proto.RegisterType((*SampleRecord)(nil), "mako.SampleRecord") - proto.RegisterType((*SampleFile)(nil), "mako.SampleFile") -} - -func init() { proto.RegisterFile("spec/proto/mako.proto", fileDescriptor_b174f87a83ddb952) } - -var fileDescriptor_b174f87a83ddb952 = []byte{ - // 3822 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x3a, 0x5d, 0x6f, 0x23, 0x47, - 0x72, 0x3b, 0xfc, 0x12, 0x59, 0xa4, 0xc8, 0x51, 0x4b, 0xda, 0xa5, 0xa4, 0xb3, 0x2d, 0x8f, 0xb3, - 0x38, 0x9d, 0x8d, 0xdb, 0x5d, 0xeb, 0x8c, 0xcd, 0x59, 0x76, 0x72, 0xa0, 0x28, 0x6a, 0x97, 0xbb, - 0x22, 0x29, 0x37, 0x29, 0x3b, 0xc6, 0x25, 0x18, 0xb4, 0xc8, 0x16, 0x35, 0xb7, 0xe4, 0x0c, 0x33, - 0x33, 0x5c, 0x4b, 0xfb, 0x18, 0x04, 0x48, 0x02, 0xe4, 0xde, 0x82, 0x24, 0xc0, 0x3d, 0xdc, 0x43, - 0x90, 0x97, 0xbc, 0x1e, 0xf2, 0x90, 0xbc, 0xe4, 0x25, 0x40, 0x5e, 0xf2, 0x17, 0xf2, 0x16, 0xe4, - 0x77, 0x04, 0x5d, 0xdd, 0x33, 0xd3, 0xfc, 0xd0, 0xae, 0xd6, 0x67, 0xfb, 0x6d, 0xba, 0xba, 0xaa, - 0xba, 0xba, 0xaa, 0xba, 0xba, 0xaa, 0x7a, 0x60, 0x33, 0x98, 0xf0, 0xfe, 0xc3, 0x89, 0xef, 0x85, - 0xde, 0xc3, 0x31, 0x7b, 0xe1, 0x3d, 0xc0, 0x4f, 0x92, 0x11, 0xdf, 0xd6, 0xbf, 0x19, 0x90, 0xeb, - 0x86, 0x2c, 0x9c, 0x06, 0xe4, 0x3e, 0x64, 0xfa, 0xde, 0x80, 0x57, 0x8d, 0x5d, 0x63, 0xaf, 0xbc, - 0xbf, 0xf6, 0x00, 0x71, 0xe5, 0xdc, 0x83, 0xba, 0x37, 0xe0, 0x14, 0xa7, 0xc9, 0xfb, 0x50, 0xba, - 0x60, 0xce, 0xc8, 0x1e, 0xf3, 0x20, 0x60, 0x43, 0x5e, 0x4d, 0xed, 0x1a, 0x7b, 0x05, 0x5a, 0x14, - 0xb0, 0x96, 0x04, 0x91, 0x1d, 0xc8, 0xfa, 0x3c, 0xf4, 0xaf, 0xab, 0xe9, 0x5d, 0x63, 0x2f, 0x7f, - 0x90, 0xbd, 0x60, 0xa3, 0x80, 0x53, 0x09, 0x23, 0x3f, 0x01, 0xf3, 0x1b, 0xe6, 0xbb, 0x8e, 0x3b, - 0x8c, 0x58, 0x04, 0xd5, 0xcc, 0x6e, 0x7a, 0xaf, 0x40, 0x2b, 0x0a, 0xae, 0xd8, 0x04, 0xd6, 0x3b, - 0x90, 0x11, 0x0b, 0x93, 0x22, 0xac, 0x74, 0xcf, 0xea, 0xf5, 0x46, 0xb7, 0x6b, 0xde, 0x21, 0x79, - 0xc8, 0x1c, 0xd7, 0x9a, 0x27, 0xa6, 0x61, 0xfd, 0xad, 0x01, 0x85, 0x2f, 0xd9, 0x68, 0xca, 0x9b, - 0xee, 0x85, 0x47, 0x76, 0xa0, 0xf0, 0x52, 0x0c, 0xec, 0x17, 0xfc, 0x1a, 0xf7, 0x50, 0xa0, 0x79, - 0x04, 0x3c, 0xe7, 0xd7, 0x64, 0x03, 0xb2, 0x23, 0x76, 0xce, 0x47, 0x4a, 0x5a, 0x39, 0x20, 0x7b, - 0x90, 0x09, 0xaf, 0x27, 0x1c, 0xc5, 0x2c, 0xef, 0x6f, 0xc8, 0x1d, 0xc7, 0x1c, 0x1f, 0xf4, 0xae, - 0x27, 0x9c, 0x22, 0x86, 0x65, 0x41, 0x46, 0x8c, 0x84, 0x24, 0xed, 0xb3, 0x56, 0x83, 0x36, 0xeb, - 0xa6, 0x41, 0x56, 0xa1, 0xd0, 0x6b, 0xb6, 0x1a, 0xdd, 0x5e, 0xad, 0x75, 0x6a, 0xa6, 0xac, 0x5f, - 0x00, 0x3c, 0xe7, 0xd7, 0x7c, 0x80, 0x0c, 0xde, 0x28, 0x0e, 0x7e, 0xa3, 0x38, 0x06, 0x95, 0x03, - 0xeb, 0x67, 0x50, 0x68, 0xb3, 0x31, 0x1f, 0x1c, 0xb1, 0x90, 0x11, 0x02, 0x19, 0x97, 0x8d, 0xb9, - 0x22, 0xc5, 0x6f, 0x01, 0x1b, 0xb0, 0x90, 0xa9, 0x4d, 0xe0, 0xb7, 0xf5, 0x10, 0xb2, 0x94, 0xb9, - 0x43, 0x2e, 0x78, 0x06, 0x21, 0xf3, 0x43, 0xa4, 0x30, 0xa8, 0x1c, 0x10, 0x13, 0xd2, 0xdc, 0x1d, - 0xa8, 0x75, 0xc4, 0xa7, 0xf5, 0x04, 0x4a, 0x27, 0x62, 0xf7, 0x7c, 0x10, 0xd3, 0x49, 0xd5, 0x18, - 0xba, 0x6a, 0xde, 0x87, 0xac, 0x2f, 0xa6, 0x91, 0xb2, 0xb8, 0x5f, 0x94, 0xba, 0x41, 0x0a, 0x2a, - 0x67, 0xac, 0x5f, 0x67, 0x00, 0x84, 0xa8, 0xc7, 0xce, 0x28, 0xe4, 0x3e, 0x79, 0x0c, 0x05, 0x21, - 0x90, 0x8d, 0x1a, 0x95, 0x3e, 0xb4, 0x25, 0xa9, 0x12, 0x24, 0xfc, 0x44, 0xb5, 0xe6, 0x07, 0xea, - 0x6b, 0x56, 0x51, 0xa9, 0x39, 0x45, 0xed, 0xc3, 0xe6, 0x84, 0xfb, 0x7d, 0xee, 0x86, 0xce, 0x88, - 0xdb, 0x63, 0x67, 0x34, 0x72, 0x6c, 0x9f, 0xb9, 0x2f, 0xd0, 0x64, 0x59, 0xba, 0x9e, 0x4c, 0xb6, - 0xc4, 0x1c, 0x65, 0xee, 0x0b, 0xf2, 0x09, 0xac, 0x3b, 0x43, 0xd7, 0xf3, 0x05, 0x7e, 0x10, 0x08, - 0x3f, 0x43, 0xa5, 0x65, 0xd0, 0x17, 0x33, 0xa1, 0x3f, 0xe5, 0x74, 0x4d, 0x22, 0xb4, 0xe4, 0xbc, - 0x10, 0xca, 0xfa, 0x8f, 0x14, 0xe4, 0x23, 0xe9, 0xc8, 0x36, 0xdc, 0x6d, 0x35, 0x7a, 0xb4, 0x59, - 0xb7, 0x6b, 0x4f, 0x9e, 0xd0, 0xc6, 0x93, 0x5a, 0xaf, 0x61, 0xd7, 0x3b, 0x67, 0xed, 0x9e, 0x59, - 0x24, 0x55, 0xd8, 0x58, 0x98, 0x6b, 0x35, 0xdb, 0xa6, 0xb1, 0x7c, 0xa6, 0xf6, 0x27, 0x66, 0x8a, - 0x6c, 0xc1, 0xe6, 0xe2, 0x4c, 0xa3, 0xd6, 0x36, 0xd3, 0x64, 0x07, 0xee, 0x2d, 0x99, 0x3a, 0x6a, - 0xd6, 0xda, 0x66, 0x66, 0xe9, 0x64, 0xb7, 0x77, 0x74, 0xd4, 0xf8, 0xd2, 0xcc, 0xde, 0xb0, 0xdc, - 0x91, 0x59, 0x22, 0xef, 0xc1, 0xce, 0xc2, 0xcc, 0x69, 0x83, 0xd6, 0x1b, 0xed, 0x5e, 0xf3, 0xa4, - 0x61, 0xe6, 0xc8, 0x06, 0x98, 0xf5, 0xb3, 0x6e, 0xaf, 0xd3, 0x4a, 0x10, 0xcc, 0x15, 0x72, 0x0f, - 0xd6, 0x15, 0x59, 0xb7, 0xd6, 0x3a, 0x3d, 0x69, 0x9c, 0x76, 0x9a, 0xed, 0x5e, 0xd7, 0xcc, 0x93, - 0x75, 0xa8, 0x1c, 0x36, 0xda, 0xf5, 0xa7, 0xad, 0x1a, 0x7d, 0x6e, 0x77, 0xeb, 0x1d, 0xda, 0x30, - 0x0b, 0xa4, 0x02, 0xc5, 0x06, 0xa5, 0x1d, 0xaa, 0x14, 0x03, 0xd6, 0x3f, 0x19, 0x50, 0xa0, 0x53, - 0xf7, 0x70, 0xea, 0x0e, 0x46, 0x9c, 0x1c, 0x40, 0xf9, 0x9c, 0xbb, 0xfd, 0xcb, 0x31, 0xf3, 0x5f, - 0xd8, 0x8e, 0x7b, 0xe1, 0xa1, 0x4f, 0x14, 0xf7, 0xd7, 0xa5, 0x4f, 0x1c, 0x46, 0x73, 0xe2, 0xa4, - 0xd1, 0xd5, 0x73, 0x7d, 0x48, 0xf6, 0x20, 0xef, 0x4f, 0x5d, 0x49, 0x25, 0xfd, 0x6f, 0x55, 0xf9, - 0xdf, 0xd4, 0x45, 0xfc, 0x15, 0x5f, 0x7e, 0x90, 0x47, 0x00, 0xe7, 0x2c, 0xec, 0x5f, 0xda, 0x23, - 0x27, 0x08, 0xab, 0xe9, 0xdd, 0xf4, 0x5e, 0x31, 0x8e, 0x5c, 0x6c, 0x3c, 0x19, 0xf1, 0x43, 0x31, - 0x4b, 0x0b, 0x88, 0x74, 0xe2, 0x04, 0xa1, 0xf5, 0x37, 0x59, 0x58, 0x9d, 0x59, 0x9c, 0x7c, 0x00, - 0xc9, 0xf2, 0xda, 0x69, 0x2d, 0xc5, 0x40, 0xe1, 0x88, 0xf7, 0xf5, 0xed, 0xe0, 0xc1, 0x94, 0xae, - 0x9a, 0x90, 0x8a, 0xa3, 0x2b, 0x82, 0xe3, 0xc4, 0xf7, 0x7e, 0xc5, 0xfb, 0xa1, 0x44, 0x4a, 0xcb, - 0xe0, 0xa8, 0x60, 0x88, 0xf2, 0x0e, 0x80, 0xf7, 0x8d, 0xcb, 0x7d, 0x29, 0xb2, 0x8c, 0x7c, 0x05, - 0x84, 0x08, 0xf9, 0xc8, 0xa7, 0x60, 0x3a, 0xee, 0x64, 0x1a, 0xda, 0xf2, 0x50, 0xa0, 0x0e, 0xb2, - 0xa8, 0x83, 0xca, 0x5c, 0x7c, 0xa2, 0x65, 0x44, 0x4c, 0x22, 0xe0, 0xa7, 0x60, 0x8e, 0x79, 0xe8, - 0x3b, 0x7d, 0xa4, 0x92, 0xfc, 0x73, 0xa8, 0x92, 0x45, 0x52, 0x89, 0x28, 0xbe, 0x71, 0xd5, 0x53, - 0xf8, 0x51, 0x7f, 0x1a, 0x84, 0xde, 0xd8, 0x66, 0xc3, 0xa1, 0xcf, 0x87, 0x2c, 0x74, 0x3c, 0x57, - 0x63, 0xb3, 0xb2, 0x9c, 0xcd, 0x96, 0x24, 0xaa, 0x25, 0x34, 0x31, 0xc7, 0x5d, 0x28, 0x0e, 0x78, - 0xd0, 0xf7, 0x9d, 0x89, 0x00, 0x57, 0xf3, 0x52, 0x11, 0x1a, 0x88, 0x7c, 0x06, 0xdb, 0x4b, 0xcf, - 0xb6, 0x5c, 0xb1, 0xb0, 0x9b, 0xde, 0xcb, 0xd2, 0x7b, 0x4b, 0x0e, 0x38, 0xb2, 0xff, 0x10, 0xf2, - 0x6c, 0x7a, 0x25, 0x4f, 0x36, 0xe8, 0xc2, 0xc5, 0x11, 0x94, 0xae, 0xb0, 0xe9, 0x15, 0x86, 0xd2, - 0x3d, 0x30, 0x7d, 0x1e, 0x32, 0xc7, 0xe5, 0x03, 0x5b, 0xf8, 0x55, 0xc8, 0x86, 0xd5, 0x22, 0xca, - 0x53, 0x8e, 0xe0, 0x74, 0xea, 0xf6, 0xd8, 0x90, 0x3c, 0x82, 0xf2, 0xf9, 0xd4, 0x19, 0x0d, 0x6c, - 0x67, 0x60, 0xcb, 0xa0, 0x58, 0x12, 0x78, 0x07, 0x50, 0xbf, 0x14, 0x21, 0x4f, 0x08, 0x46, 0x4b, - 0x88, 0xd1, 0x1c, 0x60, 0x10, 0x25, 0x9f, 0xc1, 0x7a, 0x4c, 0x31, 0xf5, 0x47, 0xf6, 0x85, 0xe7, - 0x8f, 0x59, 0x58, 0x5d, 0x45, 0xb2, 0xd2, 0x65, 0x18, 0x4e, 0x0e, 0x1e, 0x3e, 0xec, 0x8f, 0x1e, - 0xde, 0x1f, 0x50, 0x53, 0x11, 0x9e, 0xf9, 0xa3, 0x63, 0xc4, 0xb2, 0x06, 0xb0, 0x4a, 0xa7, 0x6e, - 0xcd, 0x75, 0xbd, 0x10, 0x95, 0xf7, 0x6d, 0xee, 0xb0, 0x39, 0x3d, 0xa7, 0x17, 0xf4, 0x6c, 0xfd, - 0x65, 0x0e, 0x56, 0xd4, 0xc1, 0xb9, 0x9d, 0xaf, 0xdf, 0x03, 0x71, 0xbe, 0xb4, 0x78, 0x9c, 0xf3, - 0xa7, 0xae, 0x98, 0x78, 0x1f, 0x4a, 0xa1, 0x33, 0xe6, 0x41, 0xc8, 0xc6, 0x13, 0x7b, 0x1c, 0xe0, - 0x62, 0x06, 0x2d, 0xc6, 0xb0, 0x56, 0x40, 0xb6, 0x20, 0x1f, 0xe9, 0xa3, 0x4a, 0x76, 0x8d, 0xbd, - 0x34, 0x5d, 0x51, 0xdb, 0x26, 0x1f, 0x81, 0x39, 0x98, 0xfa, 0xd2, 0xb3, 0x04, 0x89, 0xe0, 0x20, - 0x82, 0xb2, 0x71, 0x60, 0x3c, 0xa2, 0xe5, 0x68, 0xaa, 0xe7, 0x8c, 0x79, 0x2b, 0x10, 0x57, 0x5d, - 0xc8, 0x86, 0x41, 0x35, 0x8b, 0xe7, 0x03, 0xbf, 0xc9, 0x1f, 0x83, 0x8a, 0xdb, 0x36, 0x5e, 0x40, - 0xba, 0x83, 0x13, 0x69, 0x7c, 0xfd, 0x62, 0xa3, 0x15, 0x89, 0x8c, 0x03, 0xf4, 0x99, 0x9f, 0x42, - 0x21, 0xf2, 0x6e, 0x5e, 0x5d, 0xd1, 0xcf, 0x54, 0xe4, 0xc0, 0x9c, 0x26, 0x18, 0xe4, 0x0f, 0xa0, - 0x2c, 0x63, 0xcb, 0x0b, 0x7e, 0x2d, 0xd7, 0xca, 0xa3, 0x30, 0x25, 0x84, 0x3e, 0xe7, 0xd7, 0xcb, - 0xfc, 0xbc, 0xb0, 0xe8, 0xe7, 0x9f, 0x43, 0x85, 0xc5, 0x26, 0x96, 0x8c, 0xa4, 0xc7, 0xae, 0xc7, - 0x41, 0x2d, 0x71, 0x01, 0x5a, 0x4e, 0x70, 0x91, 0xff, 0x3b, 0x00, 0x97, 0xde, 0x4b, 0xee, 0xdb, - 0x21, 0xbf, 0x0a, 0xab, 0x15, 0x64, 0x5f, 0x40, 0x48, 0x8f, 0x5f, 0x85, 0xe4, 0x63, 0x28, 0x86, - 0x3c, 0x08, 0x6d, 0x6f, 0x1a, 0x4e, 0xa6, 0x21, 0xba, 0x6b, 0x71, 0xdf, 0x94, 0x8c, 0x7b, 0x3c, - 0x08, 0x3b, 0x08, 0xa7, 0x10, 0xc6, 0xdf, 0xe4, 0x31, 0x94, 0x2f, 0xaf, 0x27, 0xdc, 0x1f, 0x39, - 0xd1, 0x59, 0x5b, 0x5d, 0x7e, 0x80, 0x56, 0x63, 0xb4, 0x85, 0x23, 0x67, 0xbe, 0xe1, 0xc8, 0xed, - 0x42, 0x09, 0xc5, 0x9a, 0xb0, 0x20, 0x10, 0xae, 0xb0, 0x86, 0x72, 0xa3, 0x14, 0xa7, 0x2c, 0x08, - 0x9a, 0x03, 0x72, 0x00, 0xa6, 0x14, 0x7c, 0x92, 0xa8, 0xa5, 0x8c, 0x5c, 0x75, 0xe9, 0x27, 0x52, - 0x27, 0x61, 0xfc, 0x2d, 0x24, 0x79, 0x96, 0xc9, 0x17, 0xcd, 0x12, 0xdd, 0x19, 0xf0, 0x89, 0xcf, - 0xfb, 0x2c, 0xe4, 0x03, 0x9b, 0xb9, 0x6c, 0x74, 0xfd, 0x8a, 0xfb, 0xb6, 0xcf, 0x83, 0xe9, 0x28, - 0x0c, 0xa8, 0x39, 0x0f, 0xb1, 0x7e, 0x97, 0x82, 0xa2, 0xbc, 0x13, 0x4e, 0x3d, 0xc7, 0x0d, 0xc9, - 0x7b, 0x50, 0xd4, 0x02, 0xad, 0xca, 0x9a, 0x20, 0x09, 0xa9, 0xe4, 0x73, 0x58, 0x53, 0xe1, 0x54, - 0x9e, 0x49, 0x14, 0x31, 0xa5, 0x8b, 0x98, 0xa4, 0x7b, 0xb4, 0x22, 0x51, 0x71, 0x80, 0xda, 0x6a, - 0xc3, 0xbd, 0x00, 0x57, 0xb3, 0x13, 0x83, 0x06, 0xfa, 0x35, 0x75, 0x57, 0xbf, 0xa6, 0x34, 0x07, - 0xd8, 0x0c, 0xe6, 0x20, 0x81, 0xba, 0x17, 0x12, 0xed, 0x67, 0x90, 0xc1, 0xbb, 0x3a, 0x03, 0xdc, - 0xd3, 0x83, 0x9a, 0x54, 0x7f, 0xc3, 0x0d, 0xfd, 0xeb, 0xd8, 0x18, 0xdb, 0x07, 0x50, 0xd2, 0x27, - 0x44, 0x4e, 0x98, 0x1c, 0x7d, 0xf1, 0x39, 0x9b, 0x8f, 0x96, 0x54, 0x3e, 0x7a, 0x90, 0xfa, 0xb9, - 0x61, 0x0d, 0xc1, 0x9c, 0x97, 0x90, 0x6c, 0x40, 0x06, 0x9d, 0x11, 0x19, 0x3c, 0xbd, 0x43, 0x71, - 0x44, 0x1e, 0x42, 0x21, 0xf6, 0x17, 0x75, 0x6b, 0xcf, 0xfb, 0xc7, 0xd3, 0x3b, 0x34, 0xc1, 0x39, - 0x2c, 0x01, 0x24, 0xaa, 0xb1, 0x5e, 0x46, 0xd6, 0x69, 0xf8, 0xbe, 0xe7, 0xbf, 0xd9, 0x3a, 0xef, - 0x43, 0x49, 0x2a, 0xca, 0xd7, 0xaf, 0xe3, 0xa2, 0x82, 0xe1, 0x4d, 0xfb, 0x01, 0xac, 0x72, 0xc1, - 0x2c, 0x2e, 0x55, 0x64, 0x70, 0x2c, 0x21, 0x50, 0x15, 0x19, 0xd6, 0xff, 0x19, 0xd1, 0xc2, 0x98, - 0x2a, 0xfc, 0x9e, 0x11, 0x72, 0x07, 0x0a, 0x71, 0xcc, 0x50, 0xcb, 0xe5, 0xa3, 0x70, 0x41, 0xfe, - 0x08, 0xd6, 0x94, 0x4b, 0x4c, 0x84, 0xb5, 0x92, 0x04, 0x60, 0x2e, 0x67, 0x41, 0x5b, 0xd2, 0x4a, - 0x90, 0x0c, 0xd0, 0x03, 0x12, 0x72, 0xb9, 0x2b, 0x24, 0xcf, 0x2e, 0x92, 0xa3, 0x02, 0x23, 0x72, - 0x1c, 0x60, 0xe2, 0xf3, 0x2f, 0x29, 0xa8, 0xb4, 0xd0, 0x49, 0xe3, 0x68, 0x27, 0x82, 0x8b, 0x72, - 0xf1, 0x64, 0xa7, 0x05, 0x09, 0x11, 0x02, 0x9b, 0x90, 0x1e, 0x3b, 0x6e, 0x54, 0x3c, 0x8c, 0x1d, - 0x17, 0x21, 0xec, 0x4a, 0x05, 0x7e, 0xf1, 0x29, 0x02, 0xf5, 0x98, 0x33, 0x57, 0x46, 0x72, 0x8a, - 0xdf, 0xe4, 0x2e, 0xe4, 0xc6, 0x7c, 0xe0, 0x30, 0x17, 0x33, 0x17, 0x83, 0xaa, 0x11, 0xf9, 0x29, - 0x90, 0x20, 0x64, 0xee, 0x80, 0xf9, 0x03, 0x7b, 0xc0, 0x5f, 0x3a, 0x68, 0xf9, 0x6a, 0x0e, 0x71, - 0xd6, 0xa2, 0x99, 0xa3, 0x68, 0x82, 0x1c, 0xc0, 0x96, 0x24, 0xb4, 0xd9, 0x79, 0xe0, 0x8d, 0xa6, - 0x21, 0xd7, 0xa8, 0x0a, 0x48, 0x75, 0x4f, 0x22, 0xd4, 0xd4, 0x7c, 0x42, 0xfb, 0x63, 0xa8, 0x68, - 0xc9, 0x45, 0x9c, 0xc3, 0x18, 0xb4, 0x9c, 0x80, 0x51, 0xab, 0x1b, 0x90, 0xed, 0x7b, 0x53, 0x37, - 0xc4, 0x0c, 0x25, 0x4d, 0xe5, 0xc0, 0xfa, 0xbb, 0x14, 0x94, 0x44, 0x5c, 0x8e, 0x35, 0xf5, 0x00, - 0xd6, 0xa7, 0x01, 0x3b, 0x1f, 0x71, 0x5b, 0xd9, 0x40, 0x12, 0x19, 0x48, 0xb4, 0x26, 0xa7, 0xa4, - 0xfa, 0xeb, 0x62, 0x82, 0x7c, 0x1c, 0x17, 0x21, 0x33, 0xf8, 0x42, 0x95, 0x69, 0x71, 0xdf, 0xa9, - 0x9b, 0x4c, 0x27, 0x79, 0x08, 0x44, 0x1a, 0x76, 0x86, 0x22, 0x1d, 0x51, 0x98, 0x38, 0xa9, 0x13, - 0x7c, 0x08, 0x95, 0xc4, 0x55, 0x83, 0xbe, 0xe7, 0x73, 0xb4, 0x42, 0x16, 0xef, 0xd3, 0x78, 0xa6, - 0x2b, 0x26, 0xc8, 0x11, 0x6c, 0xce, 0x25, 0x78, 0x5c, 0x77, 0xa0, 0xc5, 0x80, 0xb6, 0x3e, 0x9b, - 0xda, 0xa1, 0xb2, 0xac, 0xff, 0x36, 0xa0, 0x90, 0xe8, 0xa4, 0x09, 0x9b, 0xca, 0x7b, 0xe6, 0x78, - 0x1a, 0xc8, 0x73, 0x53, 0xf2, 0x9c, 0xf3, 0x39, 0xba, 0x3e, 0x9e, 0x05, 0xa0, 0x15, 0xfe, 0x10, - 0x56, 0xc5, 0x81, 0x4a, 0xae, 0x67, 0x19, 0x40, 0x48, 0x72, 0x43, 0xc6, 0xf4, 0x25, 0x5f, 0xb7, - 0xcb, 0xeb, 0x93, 0xc8, 0xf4, 0x6b, 0x93, 0x48, 0xeb, 0xbf, 0x0c, 0x20, 0x33, 0xb5, 0xc0, 0x17, - 0x53, 0xee, 0x5f, 0x0b, 0xf7, 0xed, 0x4f, 0xfd, 0xc0, 0xf3, 0xd5, 0x89, 0x50, 0x23, 0x4c, 0xc0, - 0x9c, 0xb1, 0x23, 0xad, 0x98, 0xa5, 0x72, 0xb0, 0x18, 0x30, 0xd2, 0xb7, 0x2a, 0x1f, 0x32, 0xb7, - 0x29, 0x1f, 0xb2, 0x8b, 0xe5, 0xc3, 0x06, 0x64, 0xb1, 0x58, 0xc0, 0x63, 0x53, 0xa0, 0x72, 0x60, - 0xfd, 0xd6, 0x80, 0xed, 0xc5, 0x9d, 0x50, 0x1e, 0x4c, 0x3c, 0x37, 0x10, 0xa9, 0x4c, 0x2e, 0xc0, - 0x46, 0x8e, 0x2a, 0xc2, 0x4a, 0x7a, 0x73, 0x87, 0xaa, 0x39, 0x6d, 0xdf, 0xa9, 0x99, 0x7d, 0xd7, - 0x61, 0x7d, 0xb6, 0x94, 0xd3, 0x23, 0xd7, 0xd2, 0x7a, 0x6e, 0x6d, 0xa6, 0x9e, 0x43, 0x5d, 0xff, - 0x63, 0x1a, 0x4f, 0xd4, 0xf7, 0xaa, 0x65, 0x2d, 0x2c, 0x67, 0x66, 0xc2, 0xf2, 0x7c, 0x3a, 0x52, - 0x5c, 0x48, 0x47, 0x1e, 0x43, 0x41, 0x90, 0x7a, 0xfe, 0x80, 0xfb, 0x18, 0x0a, 0xca, 0xfb, 0xe5, - 0xd8, 0xf9, 0x3a, 0x02, 0x7a, 0x90, 0x34, 0x7b, 0xa8, 0x28, 0x4f, 0x11, 0x28, 0x6a, 0x8b, 0xb1, - 0x23, 0xf3, 0xd9, 0x38, 0x2d, 0x96, 0x41, 0xaf, 0x3c, 0x76, 0x30, 0x99, 0x8d, 0x32, 0x63, 0x81, - 0xc9, 0xae, 0x66, 0x31, 0x73, 0x0a, 0x93, 0x5d, 0xe9, 0x98, 0xbb, 0x50, 0x12, 0x3c, 0xe3, 0x3c, - 0xba, 0x80, 0x41, 0x06, 0xc6, 0x8e, 0x7b, 0xa8, 0x52, 0x69, 0x81, 0xc1, 0xae, 0x12, 0x0c, 0x50, - 0x18, 0xec, 0x2a, 0xc2, 0x88, 0xf2, 0xe7, 0x15, 0x2d, 0x7f, 0xbe, 0x0b, 0xb9, 0x0b, 0x87, 0x8f, - 0x06, 0x41, 0xb5, 0x84, 0x50, 0x35, 0xb2, 0xfe, 0xca, 0x80, 0x0d, 0xdd, 0x34, 0xdf, 0x91, 0xdb, - 0x7c, 0x2c, 0xcf, 0xf4, 0xbc, 0xc3, 0xcc, 0x95, 0xf2, 0x45, 0x55, 0xca, 0xa3, 0x93, 0xfc, 0xc6, - 0x88, 0xd2, 0x0d, 0xbc, 0x8c, 0x7f, 0x78, 0x47, 0x99, 0xb9, 0xbf, 0xb3, 0xb3, 0xf7, 0xb7, 0xf5, - 0x0f, 0x06, 0x54, 0xe7, 0xa5, 0xfb, 0x8e, 0x74, 0x95, 0xdc, 0xed, 0x5a, 0x3b, 0x23, 0x73, 0x53, - 0x3b, 0x43, 0xdd, 0xed, 0x87, 0x71, 0x53, 0xe3, 0x19, 0x98, 0x75, 0x9f, 0xcb, 0xfc, 0xf1, 0xed, - 0x04, 0x52, 0xb9, 0x60, 0x2a, 0xce, 0x05, 0x2d, 0x0a, 0x1b, 0x2d, 0x6f, 0xe0, 0x5c, 0x38, 0xfd, - 0x6f, 0xc3, 0x2f, 0xbe, 0x4e, 0x53, 0xfa, 0x75, 0xfa, 0x1c, 0x56, 0xf1, 0xca, 0xfa, 0x4e, 0x98, - 0x35, 0x60, 0xbb, 0xcb, 0xfb, 0x9e, 0x48, 0x16, 0xae, 0xbb, 0xa1, 0xe7, 0xb3, 0x21, 0xff, 0xca, - 0x77, 0x42, 0xde, 0x14, 0xc9, 0x21, 0xf9, 0x31, 0xe4, 0xce, 0xb1, 0x03, 0xa5, 0x38, 0x57, 0x62, - 0x77, 0x93, 0x8d, 0x29, 0xaa, 0xa6, 0xad, 0x5f, 0xc1, 0xce, 0x52, 0x36, 0xaa, 0x4a, 0xba, 0x9d, - 0x84, 0xf7, 0x85, 0x0f, 0xba, 0x2f, 0x02, 0x55, 0x17, 0x2c, 0x14, 0x44, 0x72, 0xd6, 0xfa, 0x9d, - 0x01, 0x95, 0xe8, 0xce, 0xf2, 0x7c, 0x29, 0xe8, 0x0f, 0xd3, 0x20, 0x3b, 0x00, 0x53, 0x39, 0xd6, - 0x45, 0x9c, 0x08, 0xa5, 0xf5, 0x2b, 0x5f, 0xfa, 0xd5, 0xb1, 0x33, 0xe2, 0xb4, 0x1c, 0xc4, 0xdf, - 0xe8, 0x55, 0x35, 0x30, 0x13, 0xa1, 0x95, 0x5a, 0x66, 0x6a, 0x68, 0xe3, 0x4d, 0x35, 0xb4, 0xf5, - 0xd7, 0x29, 0x30, 0x8f, 0xbc, 0x6f, 0x5c, 0x95, 0x96, 0xcb, 0x9d, 0xeb, 0xd2, 0x1b, 0x6f, 0x2d, - 0x7d, 0xea, 0x76, 0xd2, 0x93, 0x9f, 0xc1, 0xdd, 0x99, 0xf2, 0x0d, 0x9d, 0xc7, 0x16, 0xd9, 0x6b, - 0x0e, 0xbd, 0x69, 0x5d, 0xab, 0xd8, 0xd0, 0x39, 0x5b, 0xec, 0x4a, 0x10, 0xcd, 0xe4, 0xd8, 0x09, - 0x51, 0x46, 0x12, 0x69, 0x59, 0x75, 0x4c, 0x14, 0x37, 0x0a, 0x02, 0xe7, 0x15, 0x47, 0xe4, 0x2c, - 0x22, 0xcb, 0x46, 0x41, 0xd7, 0x79, 0xc5, 0x5b, 0xec, 0xca, 0xa2, 0xb0, 0xa6, 0x69, 0x42, 0xa9, - 0x73, 0xe9, 0xb9, 0x37, 0x6e, 0x7d, 0xee, 0xff, 0xc2, 0x80, 0xed, 0x9a, 0x2a, 0x74, 0x9f, 0x3a, - 0x41, 0xe8, 0xf9, 0x4e, 0x1f, 0xc3, 0xd2, 0x0f, 0xe8, 0x62, 0xd6, 0xff, 0xa4, 0x61, 0x67, 0xa9, - 0x10, 0x6f, 0x75, 0x92, 0x6a, 0xb0, 0x1e, 0xdf, 0x16, 0x7f, 0x2e, 0xa8, 0x75, 0x6b, 0x93, 0x99, - 0xa5, 0x65, 0xe0, 0x35, 0x7d, 0x6d, 0x84, 0x16, 0xbf, 0x0f, 0xc5, 0x21, 0x0f, 0xa5, 0x26, 0x79, - 0xa0, 0x1e, 0x9f, 0x64, 0xc3, 0x1f, 0x86, 0x3c, 0x3c, 0x94, 0x70, 0xd2, 0x07, 0x32, 0xb7, 0xd2, - 0x98, 0x4d, 0x54, 0xb0, 0x7d, 0xac, 0x7c, 0xf9, 0xe6, 0xed, 0xcc, 0x08, 0xd1, 0x62, 0x13, 0x59, - 0x6b, 0x57, 0xfc, 0x59, 0xe8, 0x76, 0x17, 0xca, 0x1a, 0xa2, 0xc3, 0x6f, 0xdc, 0xa0, 0x71, 0xfb, - 0x0d, 0x6e, 0x87, 0xb3, 0xf7, 0x74, 0xb4, 0xfa, 0x92, 0x82, 0xfe, 0x58, 0x2f, 0xe8, 0x8b, 0xfb, - 0x8f, 0xde, 0x6a, 0x5b, 0x0e, 0x0f, 0xf4, 0x16, 0xc0, 0x6f, 0xd2, 0xb0, 0x1a, 0x51, 0x4a, 0xbf, - 0xfa, 0x5c, 0x6a, 0x30, 0xf4, 0xec, 0x73, 0x1e, 0xb5, 0x5e, 0x06, 0x37, 0xc5, 0x5b, 0xa1, 0x9a, - 0x9e, 0x77, 0xc8, 0x15, 0x8b, 0x01, 0xf9, 0x05, 0xac, 0x5f, 0x2a, 0x01, 0xd8, 0x08, 0x1b, 0xb2, - 0x9a, 0xa5, 0x17, 0xc8, 0xd7, 0x12, 0x5c, 0x3a, 0x95, 0x2d, 0xb1, 0xaf, 0x80, 0xcc, 0x31, 0x10, - 0x06, 0x94, 0x51, 0xed, 0x27, 0xb3, 0x3b, 0x45, 0x79, 0x1f, 0x3c, 0xd5, 0x59, 0xc4, 0x36, 0x33, - 0x2f, 0xe7, 0xc0, 0xdb, 0x2d, 0x80, 0x78, 0xe1, 0xe0, 0x26, 0x39, 0x8d, 0xdb, 0xca, 0xb9, 0xdd, - 0x87, 0xcd, 0xa5, 0x2b, 0x2f, 0xb1, 0xd7, 0x27, 0xb3, 0xf6, 0x7a, 0x77, 0xd9, 0x2e, 0x12, 0xd1, - 0x74, 0xeb, 0xfc, 0x6f, 0x1a, 0xca, 0x11, 0xde, 0x5b, 0x1d, 0xb8, 0x77, 0x01, 0x7c, 0x3e, 0xf4, - 0x79, 0x10, 0x88, 0x72, 0x5a, 0xac, 0x9b, 0xa7, 0x1a, 0x44, 0xcf, 0x91, 0x56, 0xe6, 0xbb, 0xc0, - 0x68, 0xf3, 0xc0, 0x09, 0x70, 0x56, 0xb5, 0xf6, 0x23, 0x98, 0x40, 0x79, 0x06, 0x1b, 0x31, 0x4a, - 0xe8, 0x3b, 0x6c, 0xa8, 0x1e, 0x32, 0x00, 0xe5, 0xa9, 0x6a, 0xbb, 0x0b, 0x9c, 0xa0, 0x87, 0x08, - 0x18, 0x53, 0x08, 0x5b, 0x80, 0x89, 0xe5, 0x64, 0x27, 0xa8, 0xef, 0xb9, 0x17, 0xce, 0x50, 0xd5, - 0x3d, 0xb2, 0x3b, 0x54, 0x47, 0x10, 0x79, 0x0c, 0xf7, 0x02, 0xee, 0x3b, 0x6c, 0xe4, 0xbc, 0xe2, - 0x03, 0x7b, 0x06, 0xbb, 0x88, 0x0d, 0xad, 0xcd, 0x64, 0xba, 0xa9, 0xd1, 0xdd, 0x85, 0x9c, 0xea, - 0x9b, 0xca, 0x24, 0x51, 0x8d, 0xc8, 0x47, 0xb0, 0xa6, 0xf1, 0xd3, 0x5a, 0xab, 0x25, 0x6a, 0x26, - 0x13, 0x4a, 0xdb, 0x1f, 0xc0, 0x6a, 0xdc, 0x6b, 0xc4, 0xb7, 0x4f, 0x99, 0x51, 0x96, 0x22, 0x20, - 0x3e, 0x28, 0xea, 0x48, 0x5a, 0x65, 0x17, 0x23, 0x89, 0x8c, 0xe1, 0x59, 0x26, 0x5f, 0x30, 0x81, - 0x6e, 0xf4, 0xf1, 0xad, 0x41, 0xb6, 0x88, 0x94, 0x05, 0x02, 0x11, 0x64, 0xc9, 0xa2, 0xc2, 0x08, - 0x85, 0x72, 0xac, 0x68, 0x61, 0xd7, 0xe8, 0xe5, 0xf5, 0xa3, 0x9b, 0x54, 0x3c, 0x07, 0xc2, 0xb7, - 0xd8, 0xd5, 0x88, 0x85, 0xf0, 0x10, 0x4e, 0x9e, 0x41, 0x91, 0xbb, 0x2f, 0x1d, 0xdf, 0x73, 0xc7, - 0x5c, 0xe5, 0x5e, 0xe5, 0xfd, 0xbd, 0x1b, 0x19, 0x36, 0x12, 0x5c, 0xe4, 0xa6, 0x13, 0x93, 0x2a, - 0xac, 0xf4, 0xbd, 0x31, 0xf2, 0x91, 0x2a, 0x8e, 0x86, 0xc2, 0xac, 0xe7, 0xd3, 0x21, 0x73, 0x1d, - 0xa1, 0x12, 0x67, 0xa0, 0xb4, 0x56, 0x8c, 0x61, 0xcd, 0x81, 0xee, 0x81, 0xd9, 0xd7, 0x7a, 0x60, - 0x6e, 0xc1, 0x03, 0xad, 0x5f, 0xce, 0xab, 0x0b, 0xcd, 0x90, 0x87, 0x4c, 0xbb, 0xd3, 0x6e, 0x98, - 0x77, 0x48, 0x19, 0x80, 0x36, 0x9e, 0xd0, 0x46, 0xb7, 0xdb, 0xec, 0xb4, 0x4d, 0x83, 0x00, 0xe4, - 0x9a, 0x4f, 0xda, 0x1d, 0xda, 0x30, 0x53, 0x84, 0x40, 0xf9, 0xb8, 0x76, 0xd2, 0x6d, 0xd8, 0xa7, - 0x9d, 0x6e, 0xb3, 0xd7, 0xfc, 0xb2, 0x61, 0xa6, 0x49, 0x11, 0x56, 0xce, 0xda, 0xcf, 0xdb, 0x9d, - 0xaf, 0xda, 0x66, 0xc6, 0xfa, 0x02, 0x2a, 0x73, 0xbb, 0x26, 0x15, 0x28, 0x9e, 0xb5, 0xbb, 0xa7, - 0x8d, 0x7a, 0xf3, 0xb8, 0xd9, 0x38, 0x32, 0xef, 0x90, 0x55, 0x28, 0x9c, 0xd2, 0x46, 0xf7, 0xec, - 0xb0, 0xd5, 0xec, 0x99, 0x86, 0x58, 0xef, 0xb4, 0xd3, 0xed, 0xa9, 0x71, 0x0a, 0xc7, 0xb4, 0x73, - 0x74, 0x56, 0xef, 0x89, 0xf5, 0xd3, 0xd6, 0xbf, 0xa7, 0xe1, 0x47, 0x47, 0x2c, 0xb8, 0x3c, 0xf7, - 0x98, 0x3f, 0x88, 0x53, 0xa9, 0xfa, 0x25, 0xf3, 0x43, 0x19, 0x73, 0x6f, 0xd5, 0x97, 0xfc, 0x0c, - 0x4c, 0x99, 0xec, 0x04, 0x7c, 0xc4, 0xfb, 0xd8, 0x3c, 0x9e, 0xcd, 0x97, 0x92, 0xa7, 0x78, 0x5a, - 0x41, 0xcc, 0x6e, 0x8c, 0x18, 0x97, 0x8c, 0x69, 0xad, 0x64, 0xfc, 0x2e, 0xcb, 0xe2, 0xcc, 0xad, - 0xcb, 0xe2, 0xec, 0xf7, 0x56, 0x16, 0x6f, 0x41, 0x5e, 0x60, 0xf8, 0x53, 0x57, 0x16, 0xdf, 0x59, - 0xba, 0x32, 0x66, 0x57, 0x74, 0xea, 0x06, 0xe4, 0x53, 0xd8, 0xba, 0x74, 0x86, 0x97, 0x23, 0x67, - 0x78, 0x19, 0xda, 0x01, 0xde, 0x82, 0xb6, 0xe7, 0xda, 0xf8, 0xd4, 0x82, 0x11, 0x30, 0x4f, 0xef, - 0xc6, 0x08, 0x5d, 0x9c, 0xef, 0xb8, 0x4f, 0xc5, 0xac, 0xf5, 0x6b, 0x03, 0xee, 0xc6, 0xc6, 0xa3, - 0x53, 0x57, 0x33, 0x9b, 0xe6, 0xc3, 0xc6, 0x8c, 0x0f, 0xbf, 0x07, 0xc5, 0xa4, 0xf5, 0x2a, 0xad, - 0x54, 0xa0, 0x10, 0xf7, 0x5e, 0xdf, 0x20, 0x4f, 0xfa, 0xb5, 0xf2, 0xfc, 0x67, 0x1a, 0x3e, 0x88, - 0xe5, 0xa9, 0x7b, 0xe3, 0x09, 0xf3, 0xf9, 0x32, 0x9f, 0xfa, 0x02, 0x8a, 0x8a, 0xb1, 0x76, 0xb3, - 0x3d, 0x8a, 0x3c, 0xe5, 0x8d, 0xf4, 0x0f, 0xe4, 0xaa, 0x14, 0x24, 0x13, 0xbc, 0x9b, 0x97, 0x19, - 0x3e, 0x75, 0x6b, 0xc3, 0xa7, 0x97, 0x1a, 0x5e, 0x37, 0x5a, 0xe6, 0x2d, 0x8c, 0x96, 0x7d, 0x9d, - 0x92, 0xb6, 0x7f, 0x6b, 0x40, 0x4e, 0x42, 0xf0, 0x2d, 0x41, 0xe9, 0x41, 0xfb, 0x13, 0x46, 0xe9, - 0x46, 0xbe, 0xf3, 0x2e, 0x1c, 0xbf, 0xd4, 0x92, 0xe3, 0xf7, 0x29, 0x54, 0xe6, 0x8e, 0x1f, 0xee, - 0x68, 0xd9, 0xe9, 0x2b, 0xcf, 0x9e, 0xbe, 0xf8, 0xf0, 0x65, 0x92, 0xc3, 0x67, 0xfd, 0xbd, 0x01, - 0xef, 0xcc, 0x9b, 0x61, 0xd6, 0xbb, 0xb6, 0x64, 0x92, 0x8e, 0x1e, 0x64, 0x20, 0xe5, 0x8a, 0x74, - 0xaf, 0xe0, 0x7b, 0xf5, 0xaf, 0x3f, 0x83, 0xf7, 0x62, 0xb9, 0xbe, 0x74, 0x82, 0x29, 0xde, 0x87, - 0x51, 0xb8, 0x7d, 0x83, 0xdf, 0xcf, 0xc7, 0xee, 0xd4, 0x62, 0xec, 0x7e, 0x0c, 0x90, 0x3c, 0xfe, - 0x2d, 0xfd, 0x11, 0x6a, 0xe6, 0xbd, 0xaa, 0x10, 0xfd, 0x3f, 0xf5, 0xaf, 0x69, 0x28, 0x08, 0xc2, - 0xb7, 0x08, 0x98, 0x5b, 0x90, 0x0f, 0xf9, 0x78, 0x62, 0x0f, 0x9c, 0xa8, 0x23, 0xb3, 0x22, 0xc6, - 0x47, 0x0e, 0xbe, 0x40, 0x09, 0xdf, 0xf4, 0xa6, 0x42, 0x3b, 0x7d, 0xe5, 0x9a, 0xa0, 0x40, 0x5d, - 0xde, 0x5f, 0xfa, 0x82, 0x99, 0xb9, 0xdd, 0x0b, 0x66, 0x6c, 0xee, 0x9c, 0x16, 0x6b, 0xe7, 0x9b, - 0x94, 0x2b, 0x0b, 0x4d, 0x4a, 0xfd, 0x71, 0x3d, 0x3f, 0xfb, 0xb8, 0xfe, 0xa7, 0xb0, 0xe9, 0xb8, - 0x21, 0xf7, 0x5d, 0x36, 0xb2, 0x35, 0xa9, 0x02, 0xf5, 0xd4, 0xbc, 0x97, 0x48, 0x24, 0x8f, 0x6e, - 0x53, 0x21, 0x27, 0x32, 0x06, 0x32, 0x2b, 0x5e, 0x77, 0x16, 0x67, 0xb6, 0x8f, 0xa1, 0x7a, 0x13, - 0xc1, 0x9b, 0x5e, 0x13, 0x0b, 0x5a, 0xb2, 0xfa, 0x2c, 0x93, 0xcf, 0x9a, 0x39, 0x5a, 0xc6, 0x5f, - 0xd3, 0xe4, 0x3f, 0x00, 0x01, 0xef, 0x5b, 0xff, 0x9c, 0x51, 0x06, 0x97, 0x09, 0xd5, 0xe7, 0xea, - 0x49, 0x5b, 0xcb, 0x61, 0xcb, 0xfb, 0x3b, 0xf3, 0x4f, 0xda, 0xf8, 0xa9, 0x52, 0x5a, 0xd4, 0x91, - 0xfa, 0x8b, 0xf1, 0x58, 0xa5, 0x9e, 0x22, 0xad, 0x90, 0x99, 0x9b, 0x5e, 0x5e, 0x6c, 0xcc, 0x26, - 0xd6, 0xea, 0x75, 0x9c, 0xb0, 0x99, 0xb1, 0x2a, 0x26, 0xcb, 0xc1, 0x74, 0x3c, 0x66, 0xfe, 0xb5, - 0x3d, 0x93, 0x23, 0xae, 0x2a, 0x68, 0x9c, 0x6b, 0x97, 0x85, 0x9f, 0xf7, 0xc5, 0x99, 0xb4, 0xf1, - 0xe9, 0x53, 0xa5, 0x7f, 0xbe, 0x3a, 0xa8, 0x27, 0x8e, 0xfb, 0xe2, 0xe6, 0x4c, 0xe6, 0x97, 0x70, - 0x17, 0xff, 0x8a, 0xc4, 0x97, 0xa5, 0x0b, 0xe6, 0x8c, 0xa6, 0x3e, 0x97, 0x59, 0x64, 0x0e, 0xb7, - 0x7d, 0x7f, 0x61, 0xdb, 0x34, 0x42, 0x3f, 0x96, 0xd8, 0x98, 0x73, 0x6d, 0xf8, 0x4b, 0xa0, 0xd6, - 0xd7, 0x52, 0xad, 0x4a, 0x31, 0x79, 0xc8, 0x9c, 0xd6, 0xba, 0x5d, 0xf9, 0xdf, 0x22, 0xad, 0xf5, - 0x1a, 0x36, 0xfe, 0x46, 0x89, 0xa9, 0xc8, 0x71, 0xad, 0x57, 0x3b, 0x91, 0xe3, 0x34, 0x59, 0x83, - 0xd5, 0x5a, 0xbb, 0x76, 0xf2, 0x75, 0xb7, 0xd9, 0x95, 0xa0, 0x8c, 0xc8, 0x6e, 0x9a, 0x6d, 0xfb, - 0x94, 0x76, 0x30, 0x63, 0x32, 0xb3, 0x56, 0x00, 0x1b, 0xcb, 0x04, 0x21, 0x5b, 0xb0, 0xa9, 0xd2, - 0x24, 0xbb, 0x43, 0xed, 0xb3, 0x76, 0xb7, 0xd1, 0xb3, 0x7b, 0x5f, 0x9f, 0x8a, 0x8c, 0x8b, 0x40, - 0xb9, 0x55, 0xeb, 0xf6, 0x1a, 0xd4, 0xa6, 0x22, 0x5d, 0xa0, 0x22, 0x2b, 0xba, 0x07, 0xeb, 0xcf, - 0x3a, 0x87, 0x76, 0xab, 0xd6, 0xae, 0x3d, 0xd1, 0x26, 0x52, 0x64, 0x1d, 0x2a, 0xf2, 0x1f, 0xb4, - 0x04, 0x98, 0xb6, 0x5e, 0x41, 0x49, 0x76, 0x43, 0x28, 0xef, 0x7b, 0xfe, 0x80, 0x7c, 0x12, 0x3d, - 0x01, 0xcb, 0xf7, 0x54, 0x55, 0xed, 0x2c, 0x79, 0x4a, 0x2d, 0x6a, 0x4f, 0xa9, 0x1a, 0x15, 0xb6, - 0x78, 0x54, 0xc5, 0xb5, 0xe4, 0x05, 0xb5, 0xa8, 0xf5, 0x7a, 0xac, 0x13, 0x80, 0xa4, 0xd7, 0xb4, - 0xf0, 0xf8, 0x6c, 0x2c, 0x3e, 0x3e, 0xef, 0x40, 0x01, 0x7b, 0x56, 0x13, 0x16, 0x5e, 0x46, 0xbf, - 0x35, 0x0a, 0xc0, 0x29, 0x0b, 0x2f, 0x3f, 0xfc, 0x39, 0xe4, 0xa3, 0xfc, 0x69, 0x69, 0xe6, 0x98, - 0xfc, 0x56, 0x6a, 0x90, 0x12, 0xe4, 0x0f, 0xcf, 0x9a, 0x27, 0x47, 0x76, 0xf3, 0xc8, 0x4c, 0xfd, - 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x58, 0x67, 0x9b, 0xb9, 0xcd, 0x2b, 0x00, 0x00, -} diff --git a/vendor/golang.org/x/crypto/cast5/cast5.go b/vendor/golang.org/x/crypto/cast5/cast5.go deleted file mode 100644 index 425e8eecb06b..000000000000 --- a/vendor/golang.org/x/crypto/cast5/cast5.go +++ /dev/null @@ -1,536 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package cast5 implements CAST5, as defined in RFC 2144. -// -// CAST5 is a legacy cipher and its short block size makes it vulnerable to -// birthday bound attacks (see https://sweet32.info). It should only be used -// where compatibility with legacy systems, not security, is the goal. -// -// Deprecated: any new system should use AES (from crypto/aes, if necessary in -// an AEAD mode like crypto/cipher.NewGCM) or XChaCha20-Poly1305 (from -// golang.org/x/crypto/chacha20poly1305). -package cast5 // import "golang.org/x/crypto/cast5" - -import ( - "errors" - "math/bits" -) - -const BlockSize = 8 -const KeySize = 16 - -type Cipher struct { - masking [16]uint32 - rotate [16]uint8 -} - -func NewCipher(key []byte) (c *Cipher, err error) { - if len(key) != KeySize { - return nil, errors.New("CAST5: keys must be 16 bytes") - } - - c = new(Cipher) - c.keySchedule(key) - return -} - -func (c *Cipher) BlockSize() int { - return BlockSize -} - -func (c *Cipher) Encrypt(dst, src []byte) { - l := uint32(src[0])<<24 | uint32(src[1])<<16 | uint32(src[2])<<8 | uint32(src[3]) - r := uint32(src[4])<<24 | uint32(src[5])<<16 | uint32(src[6])<<8 | uint32(src[7]) - - l, r = r, l^f1(r, c.masking[0], c.rotate[0]) - l, r = r, l^f2(r, c.masking[1], c.rotate[1]) - l, r = r, l^f3(r, c.masking[2], c.rotate[2]) - l, r = r, l^f1(r, c.masking[3], c.rotate[3]) - - l, r = r, l^f2(r, c.masking[4], c.rotate[4]) - l, r = r, l^f3(r, c.masking[5], c.rotate[5]) - l, r = r, l^f1(r, c.masking[6], c.rotate[6]) - l, r = r, l^f2(r, c.masking[7], c.rotate[7]) - - l, r = r, l^f3(r, c.masking[8], c.rotate[8]) - l, r = r, l^f1(r, c.masking[9], c.rotate[9]) - l, r = r, l^f2(r, c.masking[10], c.rotate[10]) - l, r = r, l^f3(r, c.masking[11], c.rotate[11]) - - l, r = r, l^f1(r, c.masking[12], c.rotate[12]) - l, r = r, l^f2(r, c.masking[13], c.rotate[13]) - l, r = r, l^f3(r, c.masking[14], c.rotate[14]) - l, r = r, l^f1(r, c.masking[15], c.rotate[15]) - - dst[0] = uint8(r >> 24) - dst[1] = uint8(r >> 16) - dst[2] = uint8(r >> 8) - dst[3] = uint8(r) - dst[4] = uint8(l >> 24) - dst[5] = uint8(l >> 16) - dst[6] = uint8(l >> 8) - dst[7] = uint8(l) -} - -func (c *Cipher) Decrypt(dst, src []byte) { - l := uint32(src[0])<<24 | uint32(src[1])<<16 | uint32(src[2])<<8 | uint32(src[3]) - r := uint32(src[4])<<24 | uint32(src[5])<<16 | uint32(src[6])<<8 | uint32(src[7]) - - l, r = r, l^f1(r, c.masking[15], c.rotate[15]) - l, r = r, l^f3(r, c.masking[14], c.rotate[14]) - l, r = r, l^f2(r, c.masking[13], c.rotate[13]) - l, r = r, l^f1(r, c.masking[12], c.rotate[12]) - - l, r = r, l^f3(r, c.masking[11], c.rotate[11]) - l, r = r, l^f2(r, c.masking[10], c.rotate[10]) - l, r = r, l^f1(r, c.masking[9], c.rotate[9]) - l, r = r, l^f3(r, c.masking[8], c.rotate[8]) - - l, r = r, l^f2(r, c.masking[7], c.rotate[7]) - l, r = r, l^f1(r, c.masking[6], c.rotate[6]) - l, r = r, l^f3(r, c.masking[5], c.rotate[5]) - l, r = r, l^f2(r, c.masking[4], c.rotate[4]) - - l, r = r, l^f1(r, c.masking[3], c.rotate[3]) - l, r = r, l^f3(r, c.masking[2], c.rotate[2]) - l, r = r, l^f2(r, c.masking[1], c.rotate[1]) - l, r = r, l^f1(r, c.masking[0], c.rotate[0]) - - dst[0] = uint8(r >> 24) - dst[1] = uint8(r >> 16) - dst[2] = uint8(r >> 8) - dst[3] = uint8(r) - dst[4] = uint8(l >> 24) - dst[5] = uint8(l >> 16) - dst[6] = uint8(l >> 8) - dst[7] = uint8(l) -} - -type keyScheduleA [4][7]uint8 -type keyScheduleB [4][5]uint8 - -// keyScheduleRound contains the magic values for a round of the key schedule. -// The keyScheduleA deals with the lines like: -// z0z1z2z3 = x0x1x2x3 ^ S5[xD] ^ S6[xF] ^ S7[xC] ^ S8[xE] ^ S7[x8] -// Conceptually, both x and z are in the same array, x first. The first -// element describes which word of this array gets written to and the -// second, which word gets read. So, for the line above, it's "4, 0", because -// it's writing to the first word of z, which, being after x, is word 4, and -// reading from the first word of x: word 0. -// -// Next are the indexes into the S-boxes. Now the array is treated as bytes. So -// "xD" is 0xd. The first byte of z is written as "16 + 0", just to be clear -// that it's z that we're indexing. -// -// keyScheduleB deals with lines like: -// K1 = S5[z8] ^ S6[z9] ^ S7[z7] ^ S8[z6] ^ S5[z2] -// "K1" is ignored because key words are always written in order. So the five -// elements are the S-box indexes. They use the same form as in keyScheduleA, -// above. - -type keyScheduleRound struct{} -type keySchedule []keyScheduleRound - -var schedule = []struct { - a keyScheduleA - b keyScheduleB -}{ - { - keyScheduleA{ - {4, 0, 0xd, 0xf, 0xc, 0xe, 0x8}, - {5, 2, 16 + 0, 16 + 2, 16 + 1, 16 + 3, 0xa}, - {6, 3, 16 + 7, 16 + 6, 16 + 5, 16 + 4, 9}, - {7, 1, 16 + 0xa, 16 + 9, 16 + 0xb, 16 + 8, 0xb}, - }, - keyScheduleB{ - {16 + 8, 16 + 9, 16 + 7, 16 + 6, 16 + 2}, - {16 + 0xa, 16 + 0xb, 16 + 5, 16 + 4, 16 + 6}, - {16 + 0xc, 16 + 0xd, 16 + 3, 16 + 2, 16 + 9}, - {16 + 0xe, 16 + 0xf, 16 + 1, 16 + 0, 16 + 0xc}, - }, - }, - { - keyScheduleA{ - {0, 6, 16 + 5, 16 + 7, 16 + 4, 16 + 6, 16 + 0}, - {1, 4, 0, 2, 1, 3, 16 + 2}, - {2, 5, 7, 6, 5, 4, 16 + 1}, - {3, 7, 0xa, 9, 0xb, 8, 16 + 3}, - }, - keyScheduleB{ - {3, 2, 0xc, 0xd, 8}, - {1, 0, 0xe, 0xf, 0xd}, - {7, 6, 8, 9, 3}, - {5, 4, 0xa, 0xb, 7}, - }, - }, - { - keyScheduleA{ - {4, 0, 0xd, 0xf, 0xc, 0xe, 8}, - {5, 2, 16 + 0, 16 + 2, 16 + 1, 16 + 3, 0xa}, - {6, 3, 16 + 7, 16 + 6, 16 + 5, 16 + 4, 9}, - {7, 1, 16 + 0xa, 16 + 9, 16 + 0xb, 16 + 8, 0xb}, - }, - keyScheduleB{ - {16 + 3, 16 + 2, 16 + 0xc, 16 + 0xd, 16 + 9}, - {16 + 1, 16 + 0, 16 + 0xe, 16 + 0xf, 16 + 0xc}, - {16 + 7, 16 + 6, 16 + 8, 16 + 9, 16 + 2}, - {16 + 5, 16 + 4, 16 + 0xa, 16 + 0xb, 16 + 6}, - }, - }, - { - keyScheduleA{ - {0, 6, 16 + 5, 16 + 7, 16 + 4, 16 + 6, 16 + 0}, - {1, 4, 0, 2, 1, 3, 16 + 2}, - {2, 5, 7, 6, 5, 4, 16 + 1}, - {3, 7, 0xa, 9, 0xb, 8, 16 + 3}, - }, - keyScheduleB{ - {8, 9, 7, 6, 3}, - {0xa, 0xb, 5, 4, 7}, - {0xc, 0xd, 3, 2, 8}, - {0xe, 0xf, 1, 0, 0xd}, - }, - }, -} - -func (c *Cipher) keySchedule(in []byte) { - var t [8]uint32 - var k [32]uint32 - - for i := 0; i < 4; i++ { - j := i * 4 - t[i] = uint32(in[j])<<24 | uint32(in[j+1])<<16 | uint32(in[j+2])<<8 | uint32(in[j+3]) - } - - x := []byte{6, 7, 4, 5} - ki := 0 - - for half := 0; half < 2; half++ { - for _, round := range schedule { - for j := 0; j < 4; j++ { - var a [7]uint8 - copy(a[:], round.a[j][:]) - w := t[a[1]] - w ^= sBox[4][(t[a[2]>>2]>>(24-8*(a[2]&3)))&0xff] - w ^= sBox[5][(t[a[3]>>2]>>(24-8*(a[3]&3)))&0xff] - w ^= sBox[6][(t[a[4]>>2]>>(24-8*(a[4]&3)))&0xff] - w ^= sBox[7][(t[a[5]>>2]>>(24-8*(a[5]&3)))&0xff] - w ^= sBox[x[j]][(t[a[6]>>2]>>(24-8*(a[6]&3)))&0xff] - t[a[0]] = w - } - - for j := 0; j < 4; j++ { - var b [5]uint8 - copy(b[:], round.b[j][:]) - w := sBox[4][(t[b[0]>>2]>>(24-8*(b[0]&3)))&0xff] - w ^= sBox[5][(t[b[1]>>2]>>(24-8*(b[1]&3)))&0xff] - w ^= sBox[6][(t[b[2]>>2]>>(24-8*(b[2]&3)))&0xff] - w ^= sBox[7][(t[b[3]>>2]>>(24-8*(b[3]&3)))&0xff] - w ^= sBox[4+j][(t[b[4]>>2]>>(24-8*(b[4]&3)))&0xff] - k[ki] = w - ki++ - } - } - } - - for i := 0; i < 16; i++ { - c.masking[i] = k[i] - c.rotate[i] = uint8(k[16+i] & 0x1f) - } -} - -// These are the three 'f' functions. See RFC 2144, section 2.2. -func f1(d, m uint32, r uint8) uint32 { - t := m + d - I := bits.RotateLeft32(t, int(r)) - return ((sBox[0][I>>24] ^ sBox[1][(I>>16)&0xff]) - sBox[2][(I>>8)&0xff]) + sBox[3][I&0xff] -} - -func f2(d, m uint32, r uint8) uint32 { - t := m ^ d - I := bits.RotateLeft32(t, int(r)) - return ((sBox[0][I>>24] - sBox[1][(I>>16)&0xff]) + sBox[2][(I>>8)&0xff]) ^ sBox[3][I&0xff] -} - -func f3(d, m uint32, r uint8) uint32 { - t := m - d - I := bits.RotateLeft32(t, int(r)) - return ((sBox[0][I>>24] + sBox[1][(I>>16)&0xff]) ^ sBox[2][(I>>8)&0xff]) - sBox[3][I&0xff] -} - -var sBox = [8][256]uint32{ - { - 0x30fb40d4, 0x9fa0ff0b, 0x6beccd2f, 0x3f258c7a, 0x1e213f2f, 0x9c004dd3, 0x6003e540, 0xcf9fc949, - 0xbfd4af27, 0x88bbbdb5, 0xe2034090, 0x98d09675, 0x6e63a0e0, 0x15c361d2, 0xc2e7661d, 0x22d4ff8e, - 0x28683b6f, 0xc07fd059, 0xff2379c8, 0x775f50e2, 0x43c340d3, 0xdf2f8656, 0x887ca41a, 0xa2d2bd2d, - 0xa1c9e0d6, 0x346c4819, 0x61b76d87, 0x22540f2f, 0x2abe32e1, 0xaa54166b, 0x22568e3a, 0xa2d341d0, - 0x66db40c8, 0xa784392f, 0x004dff2f, 0x2db9d2de, 0x97943fac, 0x4a97c1d8, 0x527644b7, 0xb5f437a7, - 0xb82cbaef, 0xd751d159, 0x6ff7f0ed, 0x5a097a1f, 0x827b68d0, 0x90ecf52e, 0x22b0c054, 0xbc8e5935, - 0x4b6d2f7f, 0x50bb64a2, 0xd2664910, 0xbee5812d, 0xb7332290, 0xe93b159f, 0xb48ee411, 0x4bff345d, - 0xfd45c240, 0xad31973f, 0xc4f6d02e, 0x55fc8165, 0xd5b1caad, 0xa1ac2dae, 0xa2d4b76d, 0xc19b0c50, - 0x882240f2, 0x0c6e4f38, 0xa4e4bfd7, 0x4f5ba272, 0x564c1d2f, 0xc59c5319, 0xb949e354, 0xb04669fe, - 0xb1b6ab8a, 0xc71358dd, 0x6385c545, 0x110f935d, 0x57538ad5, 0x6a390493, 0xe63d37e0, 0x2a54f6b3, - 0x3a787d5f, 0x6276a0b5, 0x19a6fcdf, 0x7a42206a, 0x29f9d4d5, 0xf61b1891, 0xbb72275e, 0xaa508167, - 0x38901091, 0xc6b505eb, 0x84c7cb8c, 0x2ad75a0f, 0x874a1427, 0xa2d1936b, 0x2ad286af, 0xaa56d291, - 0xd7894360, 0x425c750d, 0x93b39e26, 0x187184c9, 0x6c00b32d, 0x73e2bb14, 0xa0bebc3c, 0x54623779, - 0x64459eab, 0x3f328b82, 0x7718cf82, 0x59a2cea6, 0x04ee002e, 0x89fe78e6, 0x3fab0950, 0x325ff6c2, - 0x81383f05, 0x6963c5c8, 0x76cb5ad6, 0xd49974c9, 0xca180dcf, 0x380782d5, 0xc7fa5cf6, 0x8ac31511, - 0x35e79e13, 0x47da91d0, 0xf40f9086, 0xa7e2419e, 0x31366241, 0x051ef495, 0xaa573b04, 0x4a805d8d, - 0x548300d0, 0x00322a3c, 0xbf64cddf, 0xba57a68e, 0x75c6372b, 0x50afd341, 0xa7c13275, 0x915a0bf5, - 0x6b54bfab, 0x2b0b1426, 0xab4cc9d7, 0x449ccd82, 0xf7fbf265, 0xab85c5f3, 0x1b55db94, 0xaad4e324, - 0xcfa4bd3f, 0x2deaa3e2, 0x9e204d02, 0xc8bd25ac, 0xeadf55b3, 0xd5bd9e98, 0xe31231b2, 0x2ad5ad6c, - 0x954329de, 0xadbe4528, 0xd8710f69, 0xaa51c90f, 0xaa786bf6, 0x22513f1e, 0xaa51a79b, 0x2ad344cc, - 0x7b5a41f0, 0xd37cfbad, 0x1b069505, 0x41ece491, 0xb4c332e6, 0x032268d4, 0xc9600acc, 0xce387e6d, - 0xbf6bb16c, 0x6a70fb78, 0x0d03d9c9, 0xd4df39de, 0xe01063da, 0x4736f464, 0x5ad328d8, 0xb347cc96, - 0x75bb0fc3, 0x98511bfb, 0x4ffbcc35, 0xb58bcf6a, 0xe11f0abc, 0xbfc5fe4a, 0xa70aec10, 0xac39570a, - 0x3f04442f, 0x6188b153, 0xe0397a2e, 0x5727cb79, 0x9ceb418f, 0x1cacd68d, 0x2ad37c96, 0x0175cb9d, - 0xc69dff09, 0xc75b65f0, 0xd9db40d8, 0xec0e7779, 0x4744ead4, 0xb11c3274, 0xdd24cb9e, 0x7e1c54bd, - 0xf01144f9, 0xd2240eb1, 0x9675b3fd, 0xa3ac3755, 0xd47c27af, 0x51c85f4d, 0x56907596, 0xa5bb15e6, - 0x580304f0, 0xca042cf1, 0x011a37ea, 0x8dbfaadb, 0x35ba3e4a, 0x3526ffa0, 0xc37b4d09, 0xbc306ed9, - 0x98a52666, 0x5648f725, 0xff5e569d, 0x0ced63d0, 0x7c63b2cf, 0x700b45e1, 0xd5ea50f1, 0x85a92872, - 0xaf1fbda7, 0xd4234870, 0xa7870bf3, 0x2d3b4d79, 0x42e04198, 0x0cd0ede7, 0x26470db8, 0xf881814c, - 0x474d6ad7, 0x7c0c5e5c, 0xd1231959, 0x381b7298, 0xf5d2f4db, 0xab838653, 0x6e2f1e23, 0x83719c9e, - 0xbd91e046, 0x9a56456e, 0xdc39200c, 0x20c8c571, 0x962bda1c, 0xe1e696ff, 0xb141ab08, 0x7cca89b9, - 0x1a69e783, 0x02cc4843, 0xa2f7c579, 0x429ef47d, 0x427b169c, 0x5ac9f049, 0xdd8f0f00, 0x5c8165bf, - }, - { - 0x1f201094, 0xef0ba75b, 0x69e3cf7e, 0x393f4380, 0xfe61cf7a, 0xeec5207a, 0x55889c94, 0x72fc0651, - 0xada7ef79, 0x4e1d7235, 0xd55a63ce, 0xde0436ba, 0x99c430ef, 0x5f0c0794, 0x18dcdb7d, 0xa1d6eff3, - 0xa0b52f7b, 0x59e83605, 0xee15b094, 0xe9ffd909, 0xdc440086, 0xef944459, 0xba83ccb3, 0xe0c3cdfb, - 0xd1da4181, 0x3b092ab1, 0xf997f1c1, 0xa5e6cf7b, 0x01420ddb, 0xe4e7ef5b, 0x25a1ff41, 0xe180f806, - 0x1fc41080, 0x179bee7a, 0xd37ac6a9, 0xfe5830a4, 0x98de8b7f, 0x77e83f4e, 0x79929269, 0x24fa9f7b, - 0xe113c85b, 0xacc40083, 0xd7503525, 0xf7ea615f, 0x62143154, 0x0d554b63, 0x5d681121, 0xc866c359, - 0x3d63cf73, 0xcee234c0, 0xd4d87e87, 0x5c672b21, 0x071f6181, 0x39f7627f, 0x361e3084, 0xe4eb573b, - 0x602f64a4, 0xd63acd9c, 0x1bbc4635, 0x9e81032d, 0x2701f50c, 0x99847ab4, 0xa0e3df79, 0xba6cf38c, - 0x10843094, 0x2537a95e, 0xf46f6ffe, 0xa1ff3b1f, 0x208cfb6a, 0x8f458c74, 0xd9e0a227, 0x4ec73a34, - 0xfc884f69, 0x3e4de8df, 0xef0e0088, 0x3559648d, 0x8a45388c, 0x1d804366, 0x721d9bfd, 0xa58684bb, - 0xe8256333, 0x844e8212, 0x128d8098, 0xfed33fb4, 0xce280ae1, 0x27e19ba5, 0xd5a6c252, 0xe49754bd, - 0xc5d655dd, 0xeb667064, 0x77840b4d, 0xa1b6a801, 0x84db26a9, 0xe0b56714, 0x21f043b7, 0xe5d05860, - 0x54f03084, 0x066ff472, 0xa31aa153, 0xdadc4755, 0xb5625dbf, 0x68561be6, 0x83ca6b94, 0x2d6ed23b, - 0xeccf01db, 0xa6d3d0ba, 0xb6803d5c, 0xaf77a709, 0x33b4a34c, 0x397bc8d6, 0x5ee22b95, 0x5f0e5304, - 0x81ed6f61, 0x20e74364, 0xb45e1378, 0xde18639b, 0x881ca122, 0xb96726d1, 0x8049a7e8, 0x22b7da7b, - 0x5e552d25, 0x5272d237, 0x79d2951c, 0xc60d894c, 0x488cb402, 0x1ba4fe5b, 0xa4b09f6b, 0x1ca815cf, - 0xa20c3005, 0x8871df63, 0xb9de2fcb, 0x0cc6c9e9, 0x0beeff53, 0xe3214517, 0xb4542835, 0x9f63293c, - 0xee41e729, 0x6e1d2d7c, 0x50045286, 0x1e6685f3, 0xf33401c6, 0x30a22c95, 0x31a70850, 0x60930f13, - 0x73f98417, 0xa1269859, 0xec645c44, 0x52c877a9, 0xcdff33a6, 0xa02b1741, 0x7cbad9a2, 0x2180036f, - 0x50d99c08, 0xcb3f4861, 0xc26bd765, 0x64a3f6ab, 0x80342676, 0x25a75e7b, 0xe4e6d1fc, 0x20c710e6, - 0xcdf0b680, 0x17844d3b, 0x31eef84d, 0x7e0824e4, 0x2ccb49eb, 0x846a3bae, 0x8ff77888, 0xee5d60f6, - 0x7af75673, 0x2fdd5cdb, 0xa11631c1, 0x30f66f43, 0xb3faec54, 0x157fd7fa, 0xef8579cc, 0xd152de58, - 0xdb2ffd5e, 0x8f32ce19, 0x306af97a, 0x02f03ef8, 0x99319ad5, 0xc242fa0f, 0xa7e3ebb0, 0xc68e4906, - 0xb8da230c, 0x80823028, 0xdcdef3c8, 0xd35fb171, 0x088a1bc8, 0xbec0c560, 0x61a3c9e8, 0xbca8f54d, - 0xc72feffa, 0x22822e99, 0x82c570b4, 0xd8d94e89, 0x8b1c34bc, 0x301e16e6, 0x273be979, 0xb0ffeaa6, - 0x61d9b8c6, 0x00b24869, 0xb7ffce3f, 0x08dc283b, 0x43daf65a, 0xf7e19798, 0x7619b72f, 0x8f1c9ba4, - 0xdc8637a0, 0x16a7d3b1, 0x9fc393b7, 0xa7136eeb, 0xc6bcc63e, 0x1a513742, 0xef6828bc, 0x520365d6, - 0x2d6a77ab, 0x3527ed4b, 0x821fd216, 0x095c6e2e, 0xdb92f2fb, 0x5eea29cb, 0x145892f5, 0x91584f7f, - 0x5483697b, 0x2667a8cc, 0x85196048, 0x8c4bacea, 0x833860d4, 0x0d23e0f9, 0x6c387e8a, 0x0ae6d249, - 0xb284600c, 0xd835731d, 0xdcb1c647, 0xac4c56ea, 0x3ebd81b3, 0x230eabb0, 0x6438bc87, 0xf0b5b1fa, - 0x8f5ea2b3, 0xfc184642, 0x0a036b7a, 0x4fb089bd, 0x649da589, 0xa345415e, 0x5c038323, 0x3e5d3bb9, - 0x43d79572, 0x7e6dd07c, 0x06dfdf1e, 0x6c6cc4ef, 0x7160a539, 0x73bfbe70, 0x83877605, 0x4523ecf1, - }, - { - 0x8defc240, 0x25fa5d9f, 0xeb903dbf, 0xe810c907, 0x47607fff, 0x369fe44b, 0x8c1fc644, 0xaececa90, - 0xbeb1f9bf, 0xeefbcaea, 0xe8cf1950, 0x51df07ae, 0x920e8806, 0xf0ad0548, 0xe13c8d83, 0x927010d5, - 0x11107d9f, 0x07647db9, 0xb2e3e4d4, 0x3d4f285e, 0xb9afa820, 0xfade82e0, 0xa067268b, 0x8272792e, - 0x553fb2c0, 0x489ae22b, 0xd4ef9794, 0x125e3fbc, 0x21fffcee, 0x825b1bfd, 0x9255c5ed, 0x1257a240, - 0x4e1a8302, 0xbae07fff, 0x528246e7, 0x8e57140e, 0x3373f7bf, 0x8c9f8188, 0xa6fc4ee8, 0xc982b5a5, - 0xa8c01db7, 0x579fc264, 0x67094f31, 0xf2bd3f5f, 0x40fff7c1, 0x1fb78dfc, 0x8e6bd2c1, 0x437be59b, - 0x99b03dbf, 0xb5dbc64b, 0x638dc0e6, 0x55819d99, 0xa197c81c, 0x4a012d6e, 0xc5884a28, 0xccc36f71, - 0xb843c213, 0x6c0743f1, 0x8309893c, 0x0feddd5f, 0x2f7fe850, 0xd7c07f7e, 0x02507fbf, 0x5afb9a04, - 0xa747d2d0, 0x1651192e, 0xaf70bf3e, 0x58c31380, 0x5f98302e, 0x727cc3c4, 0x0a0fb402, 0x0f7fef82, - 0x8c96fdad, 0x5d2c2aae, 0x8ee99a49, 0x50da88b8, 0x8427f4a0, 0x1eac5790, 0x796fb449, 0x8252dc15, - 0xefbd7d9b, 0xa672597d, 0xada840d8, 0x45f54504, 0xfa5d7403, 0xe83ec305, 0x4f91751a, 0x925669c2, - 0x23efe941, 0xa903f12e, 0x60270df2, 0x0276e4b6, 0x94fd6574, 0x927985b2, 0x8276dbcb, 0x02778176, - 0xf8af918d, 0x4e48f79e, 0x8f616ddf, 0xe29d840e, 0x842f7d83, 0x340ce5c8, 0x96bbb682, 0x93b4b148, - 0xef303cab, 0x984faf28, 0x779faf9b, 0x92dc560d, 0x224d1e20, 0x8437aa88, 0x7d29dc96, 0x2756d3dc, - 0x8b907cee, 0xb51fd240, 0xe7c07ce3, 0xe566b4a1, 0xc3e9615e, 0x3cf8209d, 0x6094d1e3, 0xcd9ca341, - 0x5c76460e, 0x00ea983b, 0xd4d67881, 0xfd47572c, 0xf76cedd9, 0xbda8229c, 0x127dadaa, 0x438a074e, - 0x1f97c090, 0x081bdb8a, 0x93a07ebe, 0xb938ca15, 0x97b03cff, 0x3dc2c0f8, 0x8d1ab2ec, 0x64380e51, - 0x68cc7bfb, 0xd90f2788, 0x12490181, 0x5de5ffd4, 0xdd7ef86a, 0x76a2e214, 0xb9a40368, 0x925d958f, - 0x4b39fffa, 0xba39aee9, 0xa4ffd30b, 0xfaf7933b, 0x6d498623, 0x193cbcfa, 0x27627545, 0x825cf47a, - 0x61bd8ba0, 0xd11e42d1, 0xcead04f4, 0x127ea392, 0x10428db7, 0x8272a972, 0x9270c4a8, 0x127de50b, - 0x285ba1c8, 0x3c62f44f, 0x35c0eaa5, 0xe805d231, 0x428929fb, 0xb4fcdf82, 0x4fb66a53, 0x0e7dc15b, - 0x1f081fab, 0x108618ae, 0xfcfd086d, 0xf9ff2889, 0x694bcc11, 0x236a5cae, 0x12deca4d, 0x2c3f8cc5, - 0xd2d02dfe, 0xf8ef5896, 0xe4cf52da, 0x95155b67, 0x494a488c, 0xb9b6a80c, 0x5c8f82bc, 0x89d36b45, - 0x3a609437, 0xec00c9a9, 0x44715253, 0x0a874b49, 0xd773bc40, 0x7c34671c, 0x02717ef6, 0x4feb5536, - 0xa2d02fff, 0xd2bf60c4, 0xd43f03c0, 0x50b4ef6d, 0x07478cd1, 0x006e1888, 0xa2e53f55, 0xb9e6d4bc, - 0xa2048016, 0x97573833, 0xd7207d67, 0xde0f8f3d, 0x72f87b33, 0xabcc4f33, 0x7688c55d, 0x7b00a6b0, - 0x947b0001, 0x570075d2, 0xf9bb88f8, 0x8942019e, 0x4264a5ff, 0x856302e0, 0x72dbd92b, 0xee971b69, - 0x6ea22fde, 0x5f08ae2b, 0xaf7a616d, 0xe5c98767, 0xcf1febd2, 0x61efc8c2, 0xf1ac2571, 0xcc8239c2, - 0x67214cb8, 0xb1e583d1, 0xb7dc3e62, 0x7f10bdce, 0xf90a5c38, 0x0ff0443d, 0x606e6dc6, 0x60543a49, - 0x5727c148, 0x2be98a1d, 0x8ab41738, 0x20e1be24, 0xaf96da0f, 0x68458425, 0x99833be5, 0x600d457d, - 0x282f9350, 0x8334b362, 0xd91d1120, 0x2b6d8da0, 0x642b1e31, 0x9c305a00, 0x52bce688, 0x1b03588a, - 0xf7baefd5, 0x4142ed9c, 0xa4315c11, 0x83323ec5, 0xdfef4636, 0xa133c501, 0xe9d3531c, 0xee353783, - }, - { - 0x9db30420, 0x1fb6e9de, 0xa7be7bef, 0xd273a298, 0x4a4f7bdb, 0x64ad8c57, 0x85510443, 0xfa020ed1, - 0x7e287aff, 0xe60fb663, 0x095f35a1, 0x79ebf120, 0xfd059d43, 0x6497b7b1, 0xf3641f63, 0x241e4adf, - 0x28147f5f, 0x4fa2b8cd, 0xc9430040, 0x0cc32220, 0xfdd30b30, 0xc0a5374f, 0x1d2d00d9, 0x24147b15, - 0xee4d111a, 0x0fca5167, 0x71ff904c, 0x2d195ffe, 0x1a05645f, 0x0c13fefe, 0x081b08ca, 0x05170121, - 0x80530100, 0xe83e5efe, 0xac9af4f8, 0x7fe72701, 0xd2b8ee5f, 0x06df4261, 0xbb9e9b8a, 0x7293ea25, - 0xce84ffdf, 0xf5718801, 0x3dd64b04, 0xa26f263b, 0x7ed48400, 0x547eebe6, 0x446d4ca0, 0x6cf3d6f5, - 0x2649abdf, 0xaea0c7f5, 0x36338cc1, 0x503f7e93, 0xd3772061, 0x11b638e1, 0x72500e03, 0xf80eb2bb, - 0xabe0502e, 0xec8d77de, 0x57971e81, 0xe14f6746, 0xc9335400, 0x6920318f, 0x081dbb99, 0xffc304a5, - 0x4d351805, 0x7f3d5ce3, 0xa6c866c6, 0x5d5bcca9, 0xdaec6fea, 0x9f926f91, 0x9f46222f, 0x3991467d, - 0xa5bf6d8e, 0x1143c44f, 0x43958302, 0xd0214eeb, 0x022083b8, 0x3fb6180c, 0x18f8931e, 0x281658e6, - 0x26486e3e, 0x8bd78a70, 0x7477e4c1, 0xb506e07c, 0xf32d0a25, 0x79098b02, 0xe4eabb81, 0x28123b23, - 0x69dead38, 0x1574ca16, 0xdf871b62, 0x211c40b7, 0xa51a9ef9, 0x0014377b, 0x041e8ac8, 0x09114003, - 0xbd59e4d2, 0xe3d156d5, 0x4fe876d5, 0x2f91a340, 0x557be8de, 0x00eae4a7, 0x0ce5c2ec, 0x4db4bba6, - 0xe756bdff, 0xdd3369ac, 0xec17b035, 0x06572327, 0x99afc8b0, 0x56c8c391, 0x6b65811c, 0x5e146119, - 0x6e85cb75, 0xbe07c002, 0xc2325577, 0x893ff4ec, 0x5bbfc92d, 0xd0ec3b25, 0xb7801ab7, 0x8d6d3b24, - 0x20c763ef, 0xc366a5fc, 0x9c382880, 0x0ace3205, 0xaac9548a, 0xeca1d7c7, 0x041afa32, 0x1d16625a, - 0x6701902c, 0x9b757a54, 0x31d477f7, 0x9126b031, 0x36cc6fdb, 0xc70b8b46, 0xd9e66a48, 0x56e55a79, - 0x026a4ceb, 0x52437eff, 0x2f8f76b4, 0x0df980a5, 0x8674cde3, 0xedda04eb, 0x17a9be04, 0x2c18f4df, - 0xb7747f9d, 0xab2af7b4, 0xefc34d20, 0x2e096b7c, 0x1741a254, 0xe5b6a035, 0x213d42f6, 0x2c1c7c26, - 0x61c2f50f, 0x6552daf9, 0xd2c231f8, 0x25130f69, 0xd8167fa2, 0x0418f2c8, 0x001a96a6, 0x0d1526ab, - 0x63315c21, 0x5e0a72ec, 0x49bafefd, 0x187908d9, 0x8d0dbd86, 0x311170a7, 0x3e9b640c, 0xcc3e10d7, - 0xd5cad3b6, 0x0caec388, 0xf73001e1, 0x6c728aff, 0x71eae2a1, 0x1f9af36e, 0xcfcbd12f, 0xc1de8417, - 0xac07be6b, 0xcb44a1d8, 0x8b9b0f56, 0x013988c3, 0xb1c52fca, 0xb4be31cd, 0xd8782806, 0x12a3a4e2, - 0x6f7de532, 0x58fd7eb6, 0xd01ee900, 0x24adffc2, 0xf4990fc5, 0x9711aac5, 0x001d7b95, 0x82e5e7d2, - 0x109873f6, 0x00613096, 0xc32d9521, 0xada121ff, 0x29908415, 0x7fbb977f, 0xaf9eb3db, 0x29c9ed2a, - 0x5ce2a465, 0xa730f32c, 0xd0aa3fe8, 0x8a5cc091, 0xd49e2ce7, 0x0ce454a9, 0xd60acd86, 0x015f1919, - 0x77079103, 0xdea03af6, 0x78a8565e, 0xdee356df, 0x21f05cbe, 0x8b75e387, 0xb3c50651, 0xb8a5c3ef, - 0xd8eeb6d2, 0xe523be77, 0xc2154529, 0x2f69efdf, 0xafe67afb, 0xf470c4b2, 0xf3e0eb5b, 0xd6cc9876, - 0x39e4460c, 0x1fda8538, 0x1987832f, 0xca007367, 0xa99144f8, 0x296b299e, 0x492fc295, 0x9266beab, - 0xb5676e69, 0x9bd3ddda, 0xdf7e052f, 0xdb25701c, 0x1b5e51ee, 0xf65324e6, 0x6afce36c, 0x0316cc04, - 0x8644213e, 0xb7dc59d0, 0x7965291f, 0xccd6fd43, 0x41823979, 0x932bcdf6, 0xb657c34d, 0x4edfd282, - 0x7ae5290c, 0x3cb9536b, 0x851e20fe, 0x9833557e, 0x13ecf0b0, 0xd3ffb372, 0x3f85c5c1, 0x0aef7ed2, - }, - { - 0x7ec90c04, 0x2c6e74b9, 0x9b0e66df, 0xa6337911, 0xb86a7fff, 0x1dd358f5, 0x44dd9d44, 0x1731167f, - 0x08fbf1fa, 0xe7f511cc, 0xd2051b00, 0x735aba00, 0x2ab722d8, 0x386381cb, 0xacf6243a, 0x69befd7a, - 0xe6a2e77f, 0xf0c720cd, 0xc4494816, 0xccf5c180, 0x38851640, 0x15b0a848, 0xe68b18cb, 0x4caadeff, - 0x5f480a01, 0x0412b2aa, 0x259814fc, 0x41d0efe2, 0x4e40b48d, 0x248eb6fb, 0x8dba1cfe, 0x41a99b02, - 0x1a550a04, 0xba8f65cb, 0x7251f4e7, 0x95a51725, 0xc106ecd7, 0x97a5980a, 0xc539b9aa, 0x4d79fe6a, - 0xf2f3f763, 0x68af8040, 0xed0c9e56, 0x11b4958b, 0xe1eb5a88, 0x8709e6b0, 0xd7e07156, 0x4e29fea7, - 0x6366e52d, 0x02d1c000, 0xc4ac8e05, 0x9377f571, 0x0c05372a, 0x578535f2, 0x2261be02, 0xd642a0c9, - 0xdf13a280, 0x74b55bd2, 0x682199c0, 0xd421e5ec, 0x53fb3ce8, 0xc8adedb3, 0x28a87fc9, 0x3d959981, - 0x5c1ff900, 0xfe38d399, 0x0c4eff0b, 0x062407ea, 0xaa2f4fb1, 0x4fb96976, 0x90c79505, 0xb0a8a774, - 0xef55a1ff, 0xe59ca2c2, 0xa6b62d27, 0xe66a4263, 0xdf65001f, 0x0ec50966, 0xdfdd55bc, 0x29de0655, - 0x911e739a, 0x17af8975, 0x32c7911c, 0x89f89468, 0x0d01e980, 0x524755f4, 0x03b63cc9, 0x0cc844b2, - 0xbcf3f0aa, 0x87ac36e9, 0xe53a7426, 0x01b3d82b, 0x1a9e7449, 0x64ee2d7e, 0xcddbb1da, 0x01c94910, - 0xb868bf80, 0x0d26f3fd, 0x9342ede7, 0x04a5c284, 0x636737b6, 0x50f5b616, 0xf24766e3, 0x8eca36c1, - 0x136e05db, 0xfef18391, 0xfb887a37, 0xd6e7f7d4, 0xc7fb7dc9, 0x3063fcdf, 0xb6f589de, 0xec2941da, - 0x26e46695, 0xb7566419, 0xf654efc5, 0xd08d58b7, 0x48925401, 0xc1bacb7f, 0xe5ff550f, 0xb6083049, - 0x5bb5d0e8, 0x87d72e5a, 0xab6a6ee1, 0x223a66ce, 0xc62bf3cd, 0x9e0885f9, 0x68cb3e47, 0x086c010f, - 0xa21de820, 0xd18b69de, 0xf3f65777, 0xfa02c3f6, 0x407edac3, 0xcbb3d550, 0x1793084d, 0xb0d70eba, - 0x0ab378d5, 0xd951fb0c, 0xded7da56, 0x4124bbe4, 0x94ca0b56, 0x0f5755d1, 0xe0e1e56e, 0x6184b5be, - 0x580a249f, 0x94f74bc0, 0xe327888e, 0x9f7b5561, 0xc3dc0280, 0x05687715, 0x646c6bd7, 0x44904db3, - 0x66b4f0a3, 0xc0f1648a, 0x697ed5af, 0x49e92ff6, 0x309e374f, 0x2cb6356a, 0x85808573, 0x4991f840, - 0x76f0ae02, 0x083be84d, 0x28421c9a, 0x44489406, 0x736e4cb8, 0xc1092910, 0x8bc95fc6, 0x7d869cf4, - 0x134f616f, 0x2e77118d, 0xb31b2be1, 0xaa90b472, 0x3ca5d717, 0x7d161bba, 0x9cad9010, 0xaf462ba2, - 0x9fe459d2, 0x45d34559, 0xd9f2da13, 0xdbc65487, 0xf3e4f94e, 0x176d486f, 0x097c13ea, 0x631da5c7, - 0x445f7382, 0x175683f4, 0xcdc66a97, 0x70be0288, 0xb3cdcf72, 0x6e5dd2f3, 0x20936079, 0x459b80a5, - 0xbe60e2db, 0xa9c23101, 0xeba5315c, 0x224e42f2, 0x1c5c1572, 0xf6721b2c, 0x1ad2fff3, 0x8c25404e, - 0x324ed72f, 0x4067b7fd, 0x0523138e, 0x5ca3bc78, 0xdc0fd66e, 0x75922283, 0x784d6b17, 0x58ebb16e, - 0x44094f85, 0x3f481d87, 0xfcfeae7b, 0x77b5ff76, 0x8c2302bf, 0xaaf47556, 0x5f46b02a, 0x2b092801, - 0x3d38f5f7, 0x0ca81f36, 0x52af4a8a, 0x66d5e7c0, 0xdf3b0874, 0x95055110, 0x1b5ad7a8, 0xf61ed5ad, - 0x6cf6e479, 0x20758184, 0xd0cefa65, 0x88f7be58, 0x4a046826, 0x0ff6f8f3, 0xa09c7f70, 0x5346aba0, - 0x5ce96c28, 0xe176eda3, 0x6bac307f, 0x376829d2, 0x85360fa9, 0x17e3fe2a, 0x24b79767, 0xf5a96b20, - 0xd6cd2595, 0x68ff1ebf, 0x7555442c, 0xf19f06be, 0xf9e0659a, 0xeeb9491d, 0x34010718, 0xbb30cab8, - 0xe822fe15, 0x88570983, 0x750e6249, 0xda627e55, 0x5e76ffa8, 0xb1534546, 0x6d47de08, 0xefe9e7d4, - }, - { - 0xf6fa8f9d, 0x2cac6ce1, 0x4ca34867, 0xe2337f7c, 0x95db08e7, 0x016843b4, 0xeced5cbc, 0x325553ac, - 0xbf9f0960, 0xdfa1e2ed, 0x83f0579d, 0x63ed86b9, 0x1ab6a6b8, 0xde5ebe39, 0xf38ff732, 0x8989b138, - 0x33f14961, 0xc01937bd, 0xf506c6da, 0xe4625e7e, 0xa308ea99, 0x4e23e33c, 0x79cbd7cc, 0x48a14367, - 0xa3149619, 0xfec94bd5, 0xa114174a, 0xeaa01866, 0xa084db2d, 0x09a8486f, 0xa888614a, 0x2900af98, - 0x01665991, 0xe1992863, 0xc8f30c60, 0x2e78ef3c, 0xd0d51932, 0xcf0fec14, 0xf7ca07d2, 0xd0a82072, - 0xfd41197e, 0x9305a6b0, 0xe86be3da, 0x74bed3cd, 0x372da53c, 0x4c7f4448, 0xdab5d440, 0x6dba0ec3, - 0x083919a7, 0x9fbaeed9, 0x49dbcfb0, 0x4e670c53, 0x5c3d9c01, 0x64bdb941, 0x2c0e636a, 0xba7dd9cd, - 0xea6f7388, 0xe70bc762, 0x35f29adb, 0x5c4cdd8d, 0xf0d48d8c, 0xb88153e2, 0x08a19866, 0x1ae2eac8, - 0x284caf89, 0xaa928223, 0x9334be53, 0x3b3a21bf, 0x16434be3, 0x9aea3906, 0xefe8c36e, 0xf890cdd9, - 0x80226dae, 0xc340a4a3, 0xdf7e9c09, 0xa694a807, 0x5b7c5ecc, 0x221db3a6, 0x9a69a02f, 0x68818a54, - 0xceb2296f, 0x53c0843a, 0xfe893655, 0x25bfe68a, 0xb4628abc, 0xcf222ebf, 0x25ac6f48, 0xa9a99387, - 0x53bddb65, 0xe76ffbe7, 0xe967fd78, 0x0ba93563, 0x8e342bc1, 0xe8a11be9, 0x4980740d, 0xc8087dfc, - 0x8de4bf99, 0xa11101a0, 0x7fd37975, 0xda5a26c0, 0xe81f994f, 0x9528cd89, 0xfd339fed, 0xb87834bf, - 0x5f04456d, 0x22258698, 0xc9c4c83b, 0x2dc156be, 0x4f628daa, 0x57f55ec5, 0xe2220abe, 0xd2916ebf, - 0x4ec75b95, 0x24f2c3c0, 0x42d15d99, 0xcd0d7fa0, 0x7b6e27ff, 0xa8dc8af0, 0x7345c106, 0xf41e232f, - 0x35162386, 0xe6ea8926, 0x3333b094, 0x157ec6f2, 0x372b74af, 0x692573e4, 0xe9a9d848, 0xf3160289, - 0x3a62ef1d, 0xa787e238, 0xf3a5f676, 0x74364853, 0x20951063, 0x4576698d, 0xb6fad407, 0x592af950, - 0x36f73523, 0x4cfb6e87, 0x7da4cec0, 0x6c152daa, 0xcb0396a8, 0xc50dfe5d, 0xfcd707ab, 0x0921c42f, - 0x89dff0bb, 0x5fe2be78, 0x448f4f33, 0x754613c9, 0x2b05d08d, 0x48b9d585, 0xdc049441, 0xc8098f9b, - 0x7dede786, 0xc39a3373, 0x42410005, 0x6a091751, 0x0ef3c8a6, 0x890072d6, 0x28207682, 0xa9a9f7be, - 0xbf32679d, 0xd45b5b75, 0xb353fd00, 0xcbb0e358, 0x830f220a, 0x1f8fb214, 0xd372cf08, 0xcc3c4a13, - 0x8cf63166, 0x061c87be, 0x88c98f88, 0x6062e397, 0x47cf8e7a, 0xb6c85283, 0x3cc2acfb, 0x3fc06976, - 0x4e8f0252, 0x64d8314d, 0xda3870e3, 0x1e665459, 0xc10908f0, 0x513021a5, 0x6c5b68b7, 0x822f8aa0, - 0x3007cd3e, 0x74719eef, 0xdc872681, 0x073340d4, 0x7e432fd9, 0x0c5ec241, 0x8809286c, 0xf592d891, - 0x08a930f6, 0x957ef305, 0xb7fbffbd, 0xc266e96f, 0x6fe4ac98, 0xb173ecc0, 0xbc60b42a, 0x953498da, - 0xfba1ae12, 0x2d4bd736, 0x0f25faab, 0xa4f3fceb, 0xe2969123, 0x257f0c3d, 0x9348af49, 0x361400bc, - 0xe8816f4a, 0x3814f200, 0xa3f94043, 0x9c7a54c2, 0xbc704f57, 0xda41e7f9, 0xc25ad33a, 0x54f4a084, - 0xb17f5505, 0x59357cbe, 0xedbd15c8, 0x7f97c5ab, 0xba5ac7b5, 0xb6f6deaf, 0x3a479c3a, 0x5302da25, - 0x653d7e6a, 0x54268d49, 0x51a477ea, 0x5017d55b, 0xd7d25d88, 0x44136c76, 0x0404a8c8, 0xb8e5a121, - 0xb81a928a, 0x60ed5869, 0x97c55b96, 0xeaec991b, 0x29935913, 0x01fdb7f1, 0x088e8dfa, 0x9ab6f6f5, - 0x3b4cbf9f, 0x4a5de3ab, 0xe6051d35, 0xa0e1d855, 0xd36b4cf1, 0xf544edeb, 0xb0e93524, 0xbebb8fbd, - 0xa2d762cf, 0x49c92f54, 0x38b5f331, 0x7128a454, 0x48392905, 0xa65b1db8, 0x851c97bd, 0xd675cf2f, - }, - { - 0x85e04019, 0x332bf567, 0x662dbfff, 0xcfc65693, 0x2a8d7f6f, 0xab9bc912, 0xde6008a1, 0x2028da1f, - 0x0227bce7, 0x4d642916, 0x18fac300, 0x50f18b82, 0x2cb2cb11, 0xb232e75c, 0x4b3695f2, 0xb28707de, - 0xa05fbcf6, 0xcd4181e9, 0xe150210c, 0xe24ef1bd, 0xb168c381, 0xfde4e789, 0x5c79b0d8, 0x1e8bfd43, - 0x4d495001, 0x38be4341, 0x913cee1d, 0x92a79c3f, 0x089766be, 0xbaeeadf4, 0x1286becf, 0xb6eacb19, - 0x2660c200, 0x7565bde4, 0x64241f7a, 0x8248dca9, 0xc3b3ad66, 0x28136086, 0x0bd8dfa8, 0x356d1cf2, - 0x107789be, 0xb3b2e9ce, 0x0502aa8f, 0x0bc0351e, 0x166bf52a, 0xeb12ff82, 0xe3486911, 0xd34d7516, - 0x4e7b3aff, 0x5f43671b, 0x9cf6e037, 0x4981ac83, 0x334266ce, 0x8c9341b7, 0xd0d854c0, 0xcb3a6c88, - 0x47bc2829, 0x4725ba37, 0xa66ad22b, 0x7ad61f1e, 0x0c5cbafa, 0x4437f107, 0xb6e79962, 0x42d2d816, - 0x0a961288, 0xe1a5c06e, 0x13749e67, 0x72fc081a, 0xb1d139f7, 0xf9583745, 0xcf19df58, 0xbec3f756, - 0xc06eba30, 0x07211b24, 0x45c28829, 0xc95e317f, 0xbc8ec511, 0x38bc46e9, 0xc6e6fa14, 0xbae8584a, - 0xad4ebc46, 0x468f508b, 0x7829435f, 0xf124183b, 0x821dba9f, 0xaff60ff4, 0xea2c4e6d, 0x16e39264, - 0x92544a8b, 0x009b4fc3, 0xaba68ced, 0x9ac96f78, 0x06a5b79a, 0xb2856e6e, 0x1aec3ca9, 0xbe838688, - 0x0e0804e9, 0x55f1be56, 0xe7e5363b, 0xb3a1f25d, 0xf7debb85, 0x61fe033c, 0x16746233, 0x3c034c28, - 0xda6d0c74, 0x79aac56c, 0x3ce4e1ad, 0x51f0c802, 0x98f8f35a, 0x1626a49f, 0xeed82b29, 0x1d382fe3, - 0x0c4fb99a, 0xbb325778, 0x3ec6d97b, 0x6e77a6a9, 0xcb658b5c, 0xd45230c7, 0x2bd1408b, 0x60c03eb7, - 0xb9068d78, 0xa33754f4, 0xf430c87d, 0xc8a71302, 0xb96d8c32, 0xebd4e7be, 0xbe8b9d2d, 0x7979fb06, - 0xe7225308, 0x8b75cf77, 0x11ef8da4, 0xe083c858, 0x8d6b786f, 0x5a6317a6, 0xfa5cf7a0, 0x5dda0033, - 0xf28ebfb0, 0xf5b9c310, 0xa0eac280, 0x08b9767a, 0xa3d9d2b0, 0x79d34217, 0x021a718d, 0x9ac6336a, - 0x2711fd60, 0x438050e3, 0x069908a8, 0x3d7fedc4, 0x826d2bef, 0x4eeb8476, 0x488dcf25, 0x36c9d566, - 0x28e74e41, 0xc2610aca, 0x3d49a9cf, 0xbae3b9df, 0xb65f8de6, 0x92aeaf64, 0x3ac7d5e6, 0x9ea80509, - 0xf22b017d, 0xa4173f70, 0xdd1e16c3, 0x15e0d7f9, 0x50b1b887, 0x2b9f4fd5, 0x625aba82, 0x6a017962, - 0x2ec01b9c, 0x15488aa9, 0xd716e740, 0x40055a2c, 0x93d29a22, 0xe32dbf9a, 0x058745b9, 0x3453dc1e, - 0xd699296e, 0x496cff6f, 0x1c9f4986, 0xdfe2ed07, 0xb87242d1, 0x19de7eae, 0x053e561a, 0x15ad6f8c, - 0x66626c1c, 0x7154c24c, 0xea082b2a, 0x93eb2939, 0x17dcb0f0, 0x58d4f2ae, 0x9ea294fb, 0x52cf564c, - 0x9883fe66, 0x2ec40581, 0x763953c3, 0x01d6692e, 0xd3a0c108, 0xa1e7160e, 0xe4f2dfa6, 0x693ed285, - 0x74904698, 0x4c2b0edd, 0x4f757656, 0x5d393378, 0xa132234f, 0x3d321c5d, 0xc3f5e194, 0x4b269301, - 0xc79f022f, 0x3c997e7e, 0x5e4f9504, 0x3ffafbbd, 0x76f7ad0e, 0x296693f4, 0x3d1fce6f, 0xc61e45be, - 0xd3b5ab34, 0xf72bf9b7, 0x1b0434c0, 0x4e72b567, 0x5592a33d, 0xb5229301, 0xcfd2a87f, 0x60aeb767, - 0x1814386b, 0x30bcc33d, 0x38a0c07d, 0xfd1606f2, 0xc363519b, 0x589dd390, 0x5479f8e6, 0x1cb8d647, - 0x97fd61a9, 0xea7759f4, 0x2d57539d, 0x569a58cf, 0xe84e63ad, 0x462e1b78, 0x6580f87e, 0xf3817914, - 0x91da55f4, 0x40a230f3, 0xd1988f35, 0xb6e318d2, 0x3ffa50bc, 0x3d40f021, 0xc3c0bdae, 0x4958c24c, - 0x518f36b2, 0x84b1d370, 0x0fedce83, 0x878ddada, 0xf2a279c7, 0x94e01be8, 0x90716f4b, 0x954b8aa3, - }, - { - 0xe216300d, 0xbbddfffc, 0xa7ebdabd, 0x35648095, 0x7789f8b7, 0xe6c1121b, 0x0e241600, 0x052ce8b5, - 0x11a9cfb0, 0xe5952f11, 0xece7990a, 0x9386d174, 0x2a42931c, 0x76e38111, 0xb12def3a, 0x37ddddfc, - 0xde9adeb1, 0x0a0cc32c, 0xbe197029, 0x84a00940, 0xbb243a0f, 0xb4d137cf, 0xb44e79f0, 0x049eedfd, - 0x0b15a15d, 0x480d3168, 0x8bbbde5a, 0x669ded42, 0xc7ece831, 0x3f8f95e7, 0x72df191b, 0x7580330d, - 0x94074251, 0x5c7dcdfa, 0xabbe6d63, 0xaa402164, 0xb301d40a, 0x02e7d1ca, 0x53571dae, 0x7a3182a2, - 0x12a8ddec, 0xfdaa335d, 0x176f43e8, 0x71fb46d4, 0x38129022, 0xce949ad4, 0xb84769ad, 0x965bd862, - 0x82f3d055, 0x66fb9767, 0x15b80b4e, 0x1d5b47a0, 0x4cfde06f, 0xc28ec4b8, 0x57e8726e, 0x647a78fc, - 0x99865d44, 0x608bd593, 0x6c200e03, 0x39dc5ff6, 0x5d0b00a3, 0xae63aff2, 0x7e8bd632, 0x70108c0c, - 0xbbd35049, 0x2998df04, 0x980cf42a, 0x9b6df491, 0x9e7edd53, 0x06918548, 0x58cb7e07, 0x3b74ef2e, - 0x522fffb1, 0xd24708cc, 0x1c7e27cd, 0xa4eb215b, 0x3cf1d2e2, 0x19b47a38, 0x424f7618, 0x35856039, - 0x9d17dee7, 0x27eb35e6, 0xc9aff67b, 0x36baf5b8, 0x09c467cd, 0xc18910b1, 0xe11dbf7b, 0x06cd1af8, - 0x7170c608, 0x2d5e3354, 0xd4de495a, 0x64c6d006, 0xbcc0c62c, 0x3dd00db3, 0x708f8f34, 0x77d51b42, - 0x264f620f, 0x24b8d2bf, 0x15c1b79e, 0x46a52564, 0xf8d7e54e, 0x3e378160, 0x7895cda5, 0x859c15a5, - 0xe6459788, 0xc37bc75f, 0xdb07ba0c, 0x0676a3ab, 0x7f229b1e, 0x31842e7b, 0x24259fd7, 0xf8bef472, - 0x835ffcb8, 0x6df4c1f2, 0x96f5b195, 0xfd0af0fc, 0xb0fe134c, 0xe2506d3d, 0x4f9b12ea, 0xf215f225, - 0xa223736f, 0x9fb4c428, 0x25d04979, 0x34c713f8, 0xc4618187, 0xea7a6e98, 0x7cd16efc, 0x1436876c, - 0xf1544107, 0xbedeee14, 0x56e9af27, 0xa04aa441, 0x3cf7c899, 0x92ecbae6, 0xdd67016d, 0x151682eb, - 0xa842eedf, 0xfdba60b4, 0xf1907b75, 0x20e3030f, 0x24d8c29e, 0xe139673b, 0xefa63fb8, 0x71873054, - 0xb6f2cf3b, 0x9f326442, 0xcb15a4cc, 0xb01a4504, 0xf1e47d8d, 0x844a1be5, 0xbae7dfdc, 0x42cbda70, - 0xcd7dae0a, 0x57e85b7a, 0xd53f5af6, 0x20cf4d8c, 0xcea4d428, 0x79d130a4, 0x3486ebfb, 0x33d3cddc, - 0x77853b53, 0x37effcb5, 0xc5068778, 0xe580b3e6, 0x4e68b8f4, 0xc5c8b37e, 0x0d809ea2, 0x398feb7c, - 0x132a4f94, 0x43b7950e, 0x2fee7d1c, 0x223613bd, 0xdd06caa2, 0x37df932b, 0xc4248289, 0xacf3ebc3, - 0x5715f6b7, 0xef3478dd, 0xf267616f, 0xc148cbe4, 0x9052815e, 0x5e410fab, 0xb48a2465, 0x2eda7fa4, - 0xe87b40e4, 0xe98ea084, 0x5889e9e1, 0xefd390fc, 0xdd07d35b, 0xdb485694, 0x38d7e5b2, 0x57720101, - 0x730edebc, 0x5b643113, 0x94917e4f, 0x503c2fba, 0x646f1282, 0x7523d24a, 0xe0779695, 0xf9c17a8f, - 0x7a5b2121, 0xd187b896, 0x29263a4d, 0xba510cdf, 0x81f47c9f, 0xad1163ed, 0xea7b5965, 0x1a00726e, - 0x11403092, 0x00da6d77, 0x4a0cdd61, 0xad1f4603, 0x605bdfb0, 0x9eedc364, 0x22ebe6a8, 0xcee7d28a, - 0xa0e736a0, 0x5564a6b9, 0x10853209, 0xc7eb8f37, 0x2de705ca, 0x8951570f, 0xdf09822b, 0xbd691a6c, - 0xaa12e4f2, 0x87451c0f, 0xe0f6a27a, 0x3ada4819, 0x4cf1764f, 0x0d771c2b, 0x67cdb156, 0x350d8384, - 0x5938fa0f, 0x42399ef3, 0x36997b07, 0x0e84093d, 0x4aa93e61, 0x8360d87b, 0x1fa98b0c, 0x1149382c, - 0xe97625a5, 0x0614d1b7, 0x0e25244b, 0x0c768347, 0x589e8d82, 0x0d2059d1, 0xa466bb1e, 0xf8da0a82, - 0x04f19130, 0xba6e4ec0, 0x99265164, 0x1ee7230d, 0x50b2ad80, 0xeaee6801, 0x8db2a283, 0xea8bf59e, - }, -} diff --git a/vendor/golang.org/x/crypto/openpgp/armor/armor.go b/vendor/golang.org/x/crypto/openpgp/armor/armor.go deleted file mode 100644 index 8907183ec0ab..000000000000 --- a/vendor/golang.org/x/crypto/openpgp/armor/armor.go +++ /dev/null @@ -1,232 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package armor implements OpenPGP ASCII Armor, see RFC 4880. OpenPGP Armor is -// very similar to PEM except that it has an additional CRC checksum. -// -// Deprecated: this package is unmaintained except for security fixes. New -// applications should consider a more focused, modern alternative to OpenPGP -// for their specific task. If you are required to interoperate with OpenPGP -// systems and need a maintained package, consider a community fork. -// See https://golang.org/issue/44226. -package armor // import "golang.org/x/crypto/openpgp/armor" - -import ( - "bufio" - "bytes" - "encoding/base64" - "golang.org/x/crypto/openpgp/errors" - "io" -) - -// A Block represents an OpenPGP armored structure. -// -// The encoded form is: -// -// -----BEGIN Type----- -// Headers -// -// base64-encoded Bytes -// '=' base64 encoded checksum -// -----END Type----- -// -// where Headers is a possibly empty sequence of Key: Value lines. -// -// Since the armored data can be very large, this package presents a streaming -// interface. -type Block struct { - Type string // The type, taken from the preamble (i.e. "PGP SIGNATURE"). - Header map[string]string // Optional headers. - Body io.Reader // A Reader from which the contents can be read - lReader lineReader - oReader openpgpReader -} - -var ArmorCorrupt error = errors.StructuralError("armor invalid") - -const crc24Init = 0xb704ce -const crc24Poly = 0x1864cfb -const crc24Mask = 0xffffff - -// crc24 calculates the OpenPGP checksum as specified in RFC 4880, section 6.1 -func crc24(crc uint32, d []byte) uint32 { - for _, b := range d { - crc ^= uint32(b) << 16 - for i := 0; i < 8; i++ { - crc <<= 1 - if crc&0x1000000 != 0 { - crc ^= crc24Poly - } - } - } - return crc -} - -var armorStart = []byte("-----BEGIN ") -var armorEnd = []byte("-----END ") -var armorEndOfLine = []byte("-----") - -// lineReader wraps a line based reader. It watches for the end of an armor -// block and records the expected CRC value. -type lineReader struct { - in *bufio.Reader - buf []byte - eof bool - crc uint32 - crcSet bool -} - -func (l *lineReader) Read(p []byte) (n int, err error) { - if l.eof { - return 0, io.EOF - } - - if len(l.buf) > 0 { - n = copy(p, l.buf) - l.buf = l.buf[n:] - return - } - - line, isPrefix, err := l.in.ReadLine() - if err != nil { - return - } - if isPrefix { - return 0, ArmorCorrupt - } - - if bytes.HasPrefix(line, armorEnd) { - l.eof = true - return 0, io.EOF - } - - if len(line) == 5 && line[0] == '=' { - // This is the checksum line - var expectedBytes [3]byte - var m int - m, err = base64.StdEncoding.Decode(expectedBytes[0:], line[1:]) - if m != 3 || err != nil { - return - } - l.crc = uint32(expectedBytes[0])<<16 | - uint32(expectedBytes[1])<<8 | - uint32(expectedBytes[2]) - - line, _, err = l.in.ReadLine() - if err != nil && err != io.EOF { - return - } - if !bytes.HasPrefix(line, armorEnd) { - return 0, ArmorCorrupt - } - - l.eof = true - l.crcSet = true - return 0, io.EOF - } - - if len(line) > 96 { - return 0, ArmorCorrupt - } - - n = copy(p, line) - bytesToSave := len(line) - n - if bytesToSave > 0 { - if cap(l.buf) < bytesToSave { - l.buf = make([]byte, 0, bytesToSave) - } - l.buf = l.buf[0:bytesToSave] - copy(l.buf, line[n:]) - } - - return -} - -// openpgpReader passes Read calls to the underlying base64 decoder, but keeps -// a running CRC of the resulting data and checks the CRC against the value -// found by the lineReader at EOF. -type openpgpReader struct { - lReader *lineReader - b64Reader io.Reader - currentCRC uint32 -} - -func (r *openpgpReader) Read(p []byte) (n int, err error) { - n, err = r.b64Reader.Read(p) - r.currentCRC = crc24(r.currentCRC, p[:n]) - - if err == io.EOF && r.lReader.crcSet && r.lReader.crc != r.currentCRC&crc24Mask { - return 0, ArmorCorrupt - } - - return -} - -// Decode reads a PGP armored block from the given Reader. It will ignore -// leading garbage. If it doesn't find a block, it will return nil, io.EOF. The -// given Reader is not usable after calling this function: an arbitrary amount -// of data may have been read past the end of the block. -func Decode(in io.Reader) (p *Block, err error) { - r := bufio.NewReaderSize(in, 100) - var line []byte - ignoreNext := false - -TryNextBlock: - p = nil - - // Skip leading garbage - for { - ignoreThis := ignoreNext - line, ignoreNext, err = r.ReadLine() - if err != nil { - return - } - if ignoreNext || ignoreThis { - continue - } - line = bytes.TrimSpace(line) - if len(line) > len(armorStart)+len(armorEndOfLine) && bytes.HasPrefix(line, armorStart) { - break - } - } - - p = new(Block) - p.Type = string(line[len(armorStart) : len(line)-len(armorEndOfLine)]) - p.Header = make(map[string]string) - nextIsContinuation := false - var lastKey string - - // Read headers - for { - isContinuation := nextIsContinuation - line, nextIsContinuation, err = r.ReadLine() - if err != nil { - p = nil - return - } - if isContinuation { - p.Header[lastKey] += string(line) - continue - } - line = bytes.TrimSpace(line) - if len(line) == 0 { - break - } - - i := bytes.Index(line, []byte(": ")) - if i == -1 { - goto TryNextBlock - } - lastKey = string(line[:i]) - p.Header[lastKey] = string(line[i+2:]) - } - - p.lReader.in = r - p.oReader.currentCRC = crc24Init - p.oReader.lReader = &p.lReader - p.oReader.b64Reader = base64.NewDecoder(base64.StdEncoding, &p.lReader) - p.Body = &p.oReader - - return -} diff --git a/vendor/golang.org/x/crypto/openpgp/armor/encode.go b/vendor/golang.org/x/crypto/openpgp/armor/encode.go deleted file mode 100644 index 5b6e16c19d52..000000000000 --- a/vendor/golang.org/x/crypto/openpgp/armor/encode.go +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package armor - -import ( - "encoding/base64" - "io" -) - -var armorHeaderSep = []byte(": ") -var blockEnd = []byte("\n=") -var newline = []byte("\n") -var armorEndOfLineOut = []byte("-----\n") - -// writeSlices writes its arguments to the given Writer. -func writeSlices(out io.Writer, slices ...[]byte) (err error) { - for _, s := range slices { - _, err = out.Write(s) - if err != nil { - return err - } - } - return -} - -// lineBreaker breaks data across several lines, all of the same byte length -// (except possibly the last). Lines are broken with a single '\n'. -type lineBreaker struct { - lineLength int - line []byte - used int - out io.Writer - haveWritten bool -} - -func newLineBreaker(out io.Writer, lineLength int) *lineBreaker { - return &lineBreaker{ - lineLength: lineLength, - line: make([]byte, lineLength), - used: 0, - out: out, - } -} - -func (l *lineBreaker) Write(b []byte) (n int, err error) { - n = len(b) - - if n == 0 { - return - } - - if l.used == 0 && l.haveWritten { - _, err = l.out.Write([]byte{'\n'}) - if err != nil { - return - } - } - - if l.used+len(b) < l.lineLength { - l.used += copy(l.line[l.used:], b) - return - } - - l.haveWritten = true - _, err = l.out.Write(l.line[0:l.used]) - if err != nil { - return - } - excess := l.lineLength - l.used - l.used = 0 - - _, err = l.out.Write(b[0:excess]) - if err != nil { - return - } - - _, err = l.Write(b[excess:]) - return -} - -func (l *lineBreaker) Close() (err error) { - if l.used > 0 { - _, err = l.out.Write(l.line[0:l.used]) - if err != nil { - return - } - } - - return -} - -// encoding keeps track of a running CRC24 over the data which has been written -// to it and outputs a OpenPGP checksum when closed, followed by an armor -// trailer. -// -// It's built into a stack of io.Writers: -// -// encoding -> base64 encoder -> lineBreaker -> out -type encoding struct { - out io.Writer - breaker *lineBreaker - b64 io.WriteCloser - crc uint32 - blockType []byte -} - -func (e *encoding) Write(data []byte) (n int, err error) { - e.crc = crc24(e.crc, data) - return e.b64.Write(data) -} - -func (e *encoding) Close() (err error) { - err = e.b64.Close() - if err != nil { - return - } - e.breaker.Close() - - var checksumBytes [3]byte - checksumBytes[0] = byte(e.crc >> 16) - checksumBytes[1] = byte(e.crc >> 8) - checksumBytes[2] = byte(e.crc) - - var b64ChecksumBytes [4]byte - base64.StdEncoding.Encode(b64ChecksumBytes[:], checksumBytes[:]) - - return writeSlices(e.out, blockEnd, b64ChecksumBytes[:], newline, armorEnd, e.blockType, armorEndOfLine) -} - -// Encode returns a WriteCloser which will encode the data written to it in -// OpenPGP armor. -func Encode(out io.Writer, blockType string, headers map[string]string) (w io.WriteCloser, err error) { - bType := []byte(blockType) - err = writeSlices(out, armorStart, bType, armorEndOfLineOut) - if err != nil { - return - } - - for k, v := range headers { - err = writeSlices(out, []byte(k), armorHeaderSep, []byte(v), newline) - if err != nil { - return - } - } - - _, err = out.Write(newline) - if err != nil { - return - } - - e := &encoding{ - out: out, - breaker: newLineBreaker(out, 64), - crc: crc24Init, - blockType: bType, - } - e.b64 = base64.NewEncoder(base64.StdEncoding, e.breaker) - return e, nil -} diff --git a/vendor/golang.org/x/crypto/openpgp/canonical_text.go b/vendor/golang.org/x/crypto/openpgp/canonical_text.go deleted file mode 100644 index e601e389f129..000000000000 --- a/vendor/golang.org/x/crypto/openpgp/canonical_text.go +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package openpgp - -import "hash" - -// NewCanonicalTextHash reformats text written to it into the canonical -// form and then applies the hash h. See RFC 4880, section 5.2.1. -func NewCanonicalTextHash(h hash.Hash) hash.Hash { - return &canonicalTextHash{h, 0} -} - -type canonicalTextHash struct { - h hash.Hash - s int -} - -var newline = []byte{'\r', '\n'} - -func (cth *canonicalTextHash) Write(buf []byte) (int, error) { - start := 0 - - for i, c := range buf { - switch cth.s { - case 0: - if c == '\r' { - cth.s = 1 - } else if c == '\n' { - cth.h.Write(buf[start:i]) - cth.h.Write(newline) - start = i + 1 - } - case 1: - cth.s = 0 - } - } - - cth.h.Write(buf[start:]) - return len(buf), nil -} - -func (cth *canonicalTextHash) Sum(in []byte) []byte { - return cth.h.Sum(in) -} - -func (cth *canonicalTextHash) Reset() { - cth.h.Reset() - cth.s = 0 -} - -func (cth *canonicalTextHash) Size() int { - return cth.h.Size() -} - -func (cth *canonicalTextHash) BlockSize() int { - return cth.h.BlockSize() -} diff --git a/vendor/golang.org/x/crypto/openpgp/elgamal/elgamal.go b/vendor/golang.org/x/crypto/openpgp/elgamal/elgamal.go deleted file mode 100644 index 743b35a1204f..000000000000 --- a/vendor/golang.org/x/crypto/openpgp/elgamal/elgamal.go +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package elgamal implements ElGamal encryption, suitable for OpenPGP, -// as specified in "A Public-Key Cryptosystem and a Signature Scheme Based on -// Discrete Logarithms," IEEE Transactions on Information Theory, v. IT-31, -// n. 4, 1985, pp. 469-472. -// -// This form of ElGamal embeds PKCS#1 v1.5 padding, which may make it -// unsuitable for other protocols. RSA should be used in preference in any -// case. -// -// Deprecated: this package was only provided to support ElGamal encryption in -// OpenPGP. The golang.org/x/crypto/openpgp package is now deprecated (see -// https://golang.org/issue/44226), and ElGamal in the OpenPGP ecosystem has -// compatibility and security issues (see https://eprint.iacr.org/2021/923). -// Moreover, this package doesn't protect against side-channel attacks. -package elgamal // import "golang.org/x/crypto/openpgp/elgamal" - -import ( - "crypto/rand" - "crypto/subtle" - "errors" - "io" - "math/big" -) - -// PublicKey represents an ElGamal public key. -type PublicKey struct { - G, P, Y *big.Int -} - -// PrivateKey represents an ElGamal private key. -type PrivateKey struct { - PublicKey - X *big.Int -} - -// Encrypt encrypts the given message to the given public key. The result is a -// pair of integers. Errors can result from reading random, or because msg is -// too large to be encrypted to the public key. -func Encrypt(random io.Reader, pub *PublicKey, msg []byte) (c1, c2 *big.Int, err error) { - pLen := (pub.P.BitLen() + 7) / 8 - if len(msg) > pLen-11 { - err = errors.New("elgamal: message too long") - return - } - - // EM = 0x02 || PS || 0x00 || M - em := make([]byte, pLen-1) - em[0] = 2 - ps, mm := em[1:len(em)-len(msg)-1], em[len(em)-len(msg):] - err = nonZeroRandomBytes(ps, random) - if err != nil { - return - } - em[len(em)-len(msg)-1] = 0 - copy(mm, msg) - - m := new(big.Int).SetBytes(em) - - k, err := rand.Int(random, pub.P) - if err != nil { - return - } - - c1 = new(big.Int).Exp(pub.G, k, pub.P) - s := new(big.Int).Exp(pub.Y, k, pub.P) - c2 = s.Mul(s, m) - c2.Mod(c2, pub.P) - - return -} - -// Decrypt takes two integers, resulting from an ElGamal encryption, and -// returns the plaintext of the message. An error can result only if the -// ciphertext is invalid. Users should keep in mind that this is a padding -// oracle and thus, if exposed to an adaptive chosen ciphertext attack, can -// be used to break the cryptosystem. See “Chosen Ciphertext Attacks -// Against Protocols Based on the RSA Encryption Standard PKCS #1”, Daniel -// Bleichenbacher, Advances in Cryptology (Crypto '98), -func Decrypt(priv *PrivateKey, c1, c2 *big.Int) (msg []byte, err error) { - s := new(big.Int).Exp(c1, priv.X, priv.P) - if s.ModInverse(s, priv.P) == nil { - return nil, errors.New("elgamal: invalid private key") - } - s.Mul(s, c2) - s.Mod(s, priv.P) - em := s.Bytes() - - firstByteIsTwo := subtle.ConstantTimeByteEq(em[0], 2) - - // The remainder of the plaintext must be a string of non-zero random - // octets, followed by a 0, followed by the message. - // lookingForIndex: 1 iff we are still looking for the zero. - // index: the offset of the first zero byte. - var lookingForIndex, index int - lookingForIndex = 1 - - for i := 1; i < len(em); i++ { - equals0 := subtle.ConstantTimeByteEq(em[i], 0) - index = subtle.ConstantTimeSelect(lookingForIndex&equals0, i, index) - lookingForIndex = subtle.ConstantTimeSelect(equals0, 0, lookingForIndex) - } - - if firstByteIsTwo != 1 || lookingForIndex != 0 || index < 9 { - return nil, errors.New("elgamal: decryption error") - } - return em[index+1:], nil -} - -// nonZeroRandomBytes fills the given slice with non-zero random octets. -func nonZeroRandomBytes(s []byte, rand io.Reader) (err error) { - _, err = io.ReadFull(rand, s) - if err != nil { - return - } - - for i := 0; i < len(s); i++ { - for s[i] == 0 { - _, err = io.ReadFull(rand, s[i:i+1]) - if err != nil { - return - } - } - } - - return -} diff --git a/vendor/golang.org/x/crypto/openpgp/errors/errors.go b/vendor/golang.org/x/crypto/openpgp/errors/errors.go deleted file mode 100644 index 1d7a0ea05adf..000000000000 --- a/vendor/golang.org/x/crypto/openpgp/errors/errors.go +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package errors contains common error types for the OpenPGP packages. -// -// Deprecated: this package is unmaintained except for security fixes. New -// applications should consider a more focused, modern alternative to OpenPGP -// for their specific task. If you are required to interoperate with OpenPGP -// systems and need a maintained package, consider a community fork. -// See https://golang.org/issue/44226. -package errors // import "golang.org/x/crypto/openpgp/errors" - -import ( - "strconv" -) - -// A StructuralError is returned when OpenPGP data is found to be syntactically -// invalid. -type StructuralError string - -func (s StructuralError) Error() string { - return "openpgp: invalid data: " + string(s) -} - -// UnsupportedError indicates that, although the OpenPGP data is valid, it -// makes use of currently unimplemented features. -type UnsupportedError string - -func (s UnsupportedError) Error() string { - return "openpgp: unsupported feature: " + string(s) -} - -// InvalidArgumentError indicates that the caller is in error and passed an -// incorrect value. -type InvalidArgumentError string - -func (i InvalidArgumentError) Error() string { - return "openpgp: invalid argument: " + string(i) -} - -// SignatureError indicates that a syntactically valid signature failed to -// validate. -type SignatureError string - -func (b SignatureError) Error() string { - return "openpgp: invalid signature: " + string(b) -} - -type keyIncorrectError int - -func (ki keyIncorrectError) Error() string { - return "openpgp: incorrect key" -} - -var ErrKeyIncorrect error = keyIncorrectError(0) - -type unknownIssuerError int - -func (unknownIssuerError) Error() string { - return "openpgp: signature made by unknown entity" -} - -var ErrUnknownIssuer error = unknownIssuerError(0) - -type keyRevokedError int - -func (keyRevokedError) Error() string { - return "openpgp: signature made by revoked key" -} - -var ErrKeyRevoked error = keyRevokedError(0) - -type UnknownPacketTypeError uint8 - -func (upte UnknownPacketTypeError) Error() string { - return "openpgp: unknown packet type: " + strconv.Itoa(int(upte)) -} diff --git a/vendor/golang.org/x/crypto/openpgp/keys.go b/vendor/golang.org/x/crypto/openpgp/keys.go deleted file mode 100644 index d62f787e9d5a..000000000000 --- a/vendor/golang.org/x/crypto/openpgp/keys.go +++ /dev/null @@ -1,693 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package openpgp - -import ( - "crypto/rsa" - "io" - "time" - - "golang.org/x/crypto/openpgp/armor" - "golang.org/x/crypto/openpgp/errors" - "golang.org/x/crypto/openpgp/packet" -) - -// PublicKeyType is the armor type for a PGP public key. -var PublicKeyType = "PGP PUBLIC KEY BLOCK" - -// PrivateKeyType is the armor type for a PGP private key. -var PrivateKeyType = "PGP PRIVATE KEY BLOCK" - -// An Entity represents the components of an OpenPGP key: a primary public key -// (which must be a signing key), one or more identities claimed by that key, -// and zero or more subkeys, which may be encryption keys. -type Entity struct { - PrimaryKey *packet.PublicKey - PrivateKey *packet.PrivateKey - Identities map[string]*Identity // indexed by Identity.Name - Revocations []*packet.Signature - Subkeys []Subkey -} - -// An Identity represents an identity claimed by an Entity and zero or more -// assertions by other entities about that claim. -type Identity struct { - Name string // by convention, has the form "Full Name (comment) " - UserId *packet.UserId - SelfSignature *packet.Signature - Signatures []*packet.Signature -} - -// A Subkey is an additional public key in an Entity. Subkeys can be used for -// encryption. -type Subkey struct { - PublicKey *packet.PublicKey - PrivateKey *packet.PrivateKey - Sig *packet.Signature -} - -// A Key identifies a specific public key in an Entity. This is either the -// Entity's primary key or a subkey. -type Key struct { - Entity *Entity - PublicKey *packet.PublicKey - PrivateKey *packet.PrivateKey - SelfSignature *packet.Signature -} - -// A KeyRing provides access to public and private keys. -type KeyRing interface { - // KeysById returns the set of keys that have the given key id. - KeysById(id uint64) []Key - // KeysByIdUsage returns the set of keys with the given id - // that also meet the key usage given by requiredUsage. - // The requiredUsage is expressed as the bitwise-OR of - // packet.KeyFlag* values. - KeysByIdUsage(id uint64, requiredUsage byte) []Key - // DecryptionKeys returns all private keys that are valid for - // decryption. - DecryptionKeys() []Key -} - -// primaryIdentity returns the Identity marked as primary or the first identity -// if none are so marked. -func (e *Entity) primaryIdentity() *Identity { - var firstIdentity *Identity - for _, ident := range e.Identities { - if firstIdentity == nil { - firstIdentity = ident - } - if ident.SelfSignature.IsPrimaryId != nil && *ident.SelfSignature.IsPrimaryId { - return ident - } - } - return firstIdentity -} - -// encryptionKey returns the best candidate Key for encrypting a message to the -// given Entity. -func (e *Entity) encryptionKey(now time.Time) (Key, bool) { - candidateSubkey := -1 - - // Iterate the keys to find the newest key - var maxTime time.Time - for i, subkey := range e.Subkeys { - if subkey.Sig.FlagsValid && - subkey.Sig.FlagEncryptCommunications && - subkey.PublicKey.PubKeyAlgo.CanEncrypt() && - !subkey.Sig.KeyExpired(now) && - (maxTime.IsZero() || subkey.Sig.CreationTime.After(maxTime)) { - candidateSubkey = i - maxTime = subkey.Sig.CreationTime - } - } - - if candidateSubkey != -1 { - subkey := e.Subkeys[candidateSubkey] - return Key{e, subkey.PublicKey, subkey.PrivateKey, subkey.Sig}, true - } - - // If we don't have any candidate subkeys for encryption and - // the primary key doesn't have any usage metadata then we - // assume that the primary key is ok. Or, if the primary key is - // marked as ok to encrypt to, then we can obviously use it. - i := e.primaryIdentity() - if !i.SelfSignature.FlagsValid || i.SelfSignature.FlagEncryptCommunications && - e.PrimaryKey.PubKeyAlgo.CanEncrypt() && - !i.SelfSignature.KeyExpired(now) { - return Key{e, e.PrimaryKey, e.PrivateKey, i.SelfSignature}, true - } - - // This Entity appears to be signing only. - return Key{}, false -} - -// signingKey return the best candidate Key for signing a message with this -// Entity. -func (e *Entity) signingKey(now time.Time) (Key, bool) { - candidateSubkey := -1 - - for i, subkey := range e.Subkeys { - if subkey.Sig.FlagsValid && - subkey.Sig.FlagSign && - subkey.PublicKey.PubKeyAlgo.CanSign() && - !subkey.Sig.KeyExpired(now) { - candidateSubkey = i - break - } - } - - if candidateSubkey != -1 { - subkey := e.Subkeys[candidateSubkey] - return Key{e, subkey.PublicKey, subkey.PrivateKey, subkey.Sig}, true - } - - // If we have no candidate subkey then we assume that it's ok to sign - // with the primary key. - i := e.primaryIdentity() - if !i.SelfSignature.FlagsValid || i.SelfSignature.FlagSign && - !i.SelfSignature.KeyExpired(now) { - return Key{e, e.PrimaryKey, e.PrivateKey, i.SelfSignature}, true - } - - return Key{}, false -} - -// An EntityList contains one or more Entities. -type EntityList []*Entity - -// KeysById returns the set of keys that have the given key id. -func (el EntityList) KeysById(id uint64) (keys []Key) { - for _, e := range el { - if e.PrimaryKey.KeyId == id { - var selfSig *packet.Signature - for _, ident := range e.Identities { - if selfSig == nil { - selfSig = ident.SelfSignature - } else if ident.SelfSignature.IsPrimaryId != nil && *ident.SelfSignature.IsPrimaryId { - selfSig = ident.SelfSignature - break - } - } - keys = append(keys, Key{e, e.PrimaryKey, e.PrivateKey, selfSig}) - } - - for _, subKey := range e.Subkeys { - if subKey.PublicKey.KeyId == id { - keys = append(keys, Key{e, subKey.PublicKey, subKey.PrivateKey, subKey.Sig}) - } - } - } - return -} - -// KeysByIdUsage returns the set of keys with the given id that also meet -// the key usage given by requiredUsage. The requiredUsage is expressed as -// the bitwise-OR of packet.KeyFlag* values. -func (el EntityList) KeysByIdUsage(id uint64, requiredUsage byte) (keys []Key) { - for _, key := range el.KeysById(id) { - if len(key.Entity.Revocations) > 0 { - continue - } - - if key.SelfSignature.RevocationReason != nil { - continue - } - - if key.SelfSignature.FlagsValid && requiredUsage != 0 { - var usage byte - if key.SelfSignature.FlagCertify { - usage |= packet.KeyFlagCertify - } - if key.SelfSignature.FlagSign { - usage |= packet.KeyFlagSign - } - if key.SelfSignature.FlagEncryptCommunications { - usage |= packet.KeyFlagEncryptCommunications - } - if key.SelfSignature.FlagEncryptStorage { - usage |= packet.KeyFlagEncryptStorage - } - if usage&requiredUsage != requiredUsage { - continue - } - } - - keys = append(keys, key) - } - return -} - -// DecryptionKeys returns all private keys that are valid for decryption. -func (el EntityList) DecryptionKeys() (keys []Key) { - for _, e := range el { - for _, subKey := range e.Subkeys { - if subKey.PrivateKey != nil && (!subKey.Sig.FlagsValid || subKey.Sig.FlagEncryptStorage || subKey.Sig.FlagEncryptCommunications) { - keys = append(keys, Key{e, subKey.PublicKey, subKey.PrivateKey, subKey.Sig}) - } - } - } - return -} - -// ReadArmoredKeyRing reads one or more public/private keys from an armor keyring file. -func ReadArmoredKeyRing(r io.Reader) (EntityList, error) { - block, err := armor.Decode(r) - if err == io.EOF { - return nil, errors.InvalidArgumentError("no armored data found") - } - if err != nil { - return nil, err - } - if block.Type != PublicKeyType && block.Type != PrivateKeyType { - return nil, errors.InvalidArgumentError("expected public or private key block, got: " + block.Type) - } - - return ReadKeyRing(block.Body) -} - -// ReadKeyRing reads one or more public/private keys. Unsupported keys are -// ignored as long as at least a single valid key is found. -func ReadKeyRing(r io.Reader) (el EntityList, err error) { - packets := packet.NewReader(r) - var lastUnsupportedError error - - for { - var e *Entity - e, err = ReadEntity(packets) - if err != nil { - // TODO: warn about skipped unsupported/unreadable keys - if _, ok := err.(errors.UnsupportedError); ok { - lastUnsupportedError = err - err = readToNextPublicKey(packets) - } else if _, ok := err.(errors.StructuralError); ok { - // Skip unreadable, badly-formatted keys - lastUnsupportedError = err - err = readToNextPublicKey(packets) - } - if err == io.EOF { - err = nil - break - } - if err != nil { - el = nil - break - } - } else { - el = append(el, e) - } - } - - if len(el) == 0 && err == nil { - err = lastUnsupportedError - } - return -} - -// readToNextPublicKey reads packets until the start of the entity and leaves -// the first packet of the new entity in the Reader. -func readToNextPublicKey(packets *packet.Reader) (err error) { - var p packet.Packet - for { - p, err = packets.Next() - if err == io.EOF { - return - } else if err != nil { - if _, ok := err.(errors.UnsupportedError); ok { - err = nil - continue - } - return - } - - if pk, ok := p.(*packet.PublicKey); ok && !pk.IsSubkey { - packets.Unread(p) - return - } - } -} - -// ReadEntity reads an entity (public key, identities, subkeys etc) from the -// given Reader. -func ReadEntity(packets *packet.Reader) (*Entity, error) { - e := new(Entity) - e.Identities = make(map[string]*Identity) - - p, err := packets.Next() - if err != nil { - return nil, err - } - - var ok bool - if e.PrimaryKey, ok = p.(*packet.PublicKey); !ok { - if e.PrivateKey, ok = p.(*packet.PrivateKey); !ok { - packets.Unread(p) - return nil, errors.StructuralError("first packet was not a public/private key") - } - e.PrimaryKey = &e.PrivateKey.PublicKey - } - - if !e.PrimaryKey.PubKeyAlgo.CanSign() { - return nil, errors.StructuralError("primary key cannot be used for signatures") - } - - var revocations []*packet.Signature -EachPacket: - for { - p, err := packets.Next() - if err == io.EOF { - break - } else if err != nil { - return nil, err - } - - switch pkt := p.(type) { - case *packet.UserId: - if err := addUserID(e, packets, pkt); err != nil { - return nil, err - } - case *packet.Signature: - if pkt.SigType == packet.SigTypeKeyRevocation { - revocations = append(revocations, pkt) - } else if pkt.SigType == packet.SigTypeDirectSignature { - // TODO: RFC4880 5.2.1 permits signatures - // directly on keys (eg. to bind additional - // revocation keys). - } - // Else, ignoring the signature as it does not follow anything - // we would know to attach it to. - case *packet.PrivateKey: - if pkt.IsSubkey == false { - packets.Unread(p) - break EachPacket - } - err = addSubkey(e, packets, &pkt.PublicKey, pkt) - if err != nil { - return nil, err - } - case *packet.PublicKey: - if pkt.IsSubkey == false { - packets.Unread(p) - break EachPacket - } - err = addSubkey(e, packets, pkt, nil) - if err != nil { - return nil, err - } - default: - // we ignore unknown packets - } - } - - if len(e.Identities) == 0 { - return nil, errors.StructuralError("entity without any identities") - } - - for _, revocation := range revocations { - err = e.PrimaryKey.VerifyRevocationSignature(revocation) - if err == nil { - e.Revocations = append(e.Revocations, revocation) - } else { - // TODO: RFC 4880 5.2.3.15 defines revocation keys. - return nil, errors.StructuralError("revocation signature signed by alternate key") - } - } - - return e, nil -} - -func addUserID(e *Entity, packets *packet.Reader, pkt *packet.UserId) error { - // Make a new Identity object, that we might wind up throwing away. - // We'll only add it if we get a valid self-signature over this - // userID. - identity := new(Identity) - identity.Name = pkt.Id - identity.UserId = pkt - - for { - p, err := packets.Next() - if err == io.EOF { - break - } else if err != nil { - return err - } - - sig, ok := p.(*packet.Signature) - if !ok { - packets.Unread(p) - break - } - - if (sig.SigType == packet.SigTypePositiveCert || sig.SigType == packet.SigTypeGenericCert) && sig.IssuerKeyId != nil && *sig.IssuerKeyId == e.PrimaryKey.KeyId { - if err = e.PrimaryKey.VerifyUserIdSignature(pkt.Id, e.PrimaryKey, sig); err != nil { - return errors.StructuralError("user ID self-signature invalid: " + err.Error()) - } - identity.SelfSignature = sig - e.Identities[pkt.Id] = identity - } else { - identity.Signatures = append(identity.Signatures, sig) - } - } - - return nil -} - -func addSubkey(e *Entity, packets *packet.Reader, pub *packet.PublicKey, priv *packet.PrivateKey) error { - var subKey Subkey - subKey.PublicKey = pub - subKey.PrivateKey = priv - - for { - p, err := packets.Next() - if err == io.EOF { - break - } else if err != nil { - return errors.StructuralError("subkey signature invalid: " + err.Error()) - } - - sig, ok := p.(*packet.Signature) - if !ok { - packets.Unread(p) - break - } - - if sig.SigType != packet.SigTypeSubkeyBinding && sig.SigType != packet.SigTypeSubkeyRevocation { - return errors.StructuralError("subkey signature with wrong type") - } - - if err := e.PrimaryKey.VerifyKeySignature(subKey.PublicKey, sig); err != nil { - return errors.StructuralError("subkey signature invalid: " + err.Error()) - } - - switch sig.SigType { - case packet.SigTypeSubkeyRevocation: - subKey.Sig = sig - case packet.SigTypeSubkeyBinding: - - if shouldReplaceSubkeySig(subKey.Sig, sig) { - subKey.Sig = sig - } - } - } - - if subKey.Sig == nil { - return errors.StructuralError("subkey packet not followed by signature") - } - - e.Subkeys = append(e.Subkeys, subKey) - - return nil -} - -func shouldReplaceSubkeySig(existingSig, potentialNewSig *packet.Signature) bool { - if potentialNewSig == nil { - return false - } - - if existingSig == nil { - return true - } - - if existingSig.SigType == packet.SigTypeSubkeyRevocation { - return false // never override a revocation signature - } - - return potentialNewSig.CreationTime.After(existingSig.CreationTime) -} - -const defaultRSAKeyBits = 2048 - -// NewEntity returns an Entity that contains a fresh RSA/RSA keypair with a -// single identity composed of the given full name, comment and email, any of -// which may be empty but must not contain any of "()<>\x00". -// If config is nil, sensible defaults will be used. -func NewEntity(name, comment, email string, config *packet.Config) (*Entity, error) { - creationTime := config.Now() - - bits := defaultRSAKeyBits - if config != nil && config.RSABits != 0 { - bits = config.RSABits - } - - uid := packet.NewUserId(name, comment, email) - if uid == nil { - return nil, errors.InvalidArgumentError("user id field contained invalid characters") - } - signingPriv, err := rsa.GenerateKey(config.Random(), bits) - if err != nil { - return nil, err - } - encryptingPriv, err := rsa.GenerateKey(config.Random(), bits) - if err != nil { - return nil, err - } - - e := &Entity{ - PrimaryKey: packet.NewRSAPublicKey(creationTime, &signingPriv.PublicKey), - PrivateKey: packet.NewRSAPrivateKey(creationTime, signingPriv), - Identities: make(map[string]*Identity), - } - isPrimaryId := true - e.Identities[uid.Id] = &Identity{ - Name: uid.Id, - UserId: uid, - SelfSignature: &packet.Signature{ - CreationTime: creationTime, - SigType: packet.SigTypePositiveCert, - PubKeyAlgo: packet.PubKeyAlgoRSA, - Hash: config.Hash(), - IsPrimaryId: &isPrimaryId, - FlagsValid: true, - FlagSign: true, - FlagCertify: true, - IssuerKeyId: &e.PrimaryKey.KeyId, - }, - } - err = e.Identities[uid.Id].SelfSignature.SignUserId(uid.Id, e.PrimaryKey, e.PrivateKey, config) - if err != nil { - return nil, err - } - - // If the user passes in a DefaultHash via packet.Config, - // set the PreferredHash for the SelfSignature. - if config != nil && config.DefaultHash != 0 { - e.Identities[uid.Id].SelfSignature.PreferredHash = []uint8{hashToHashId(config.DefaultHash)} - } - - // Likewise for DefaultCipher. - if config != nil && config.DefaultCipher != 0 { - e.Identities[uid.Id].SelfSignature.PreferredSymmetric = []uint8{uint8(config.DefaultCipher)} - } - - e.Subkeys = make([]Subkey, 1) - e.Subkeys[0] = Subkey{ - PublicKey: packet.NewRSAPublicKey(creationTime, &encryptingPriv.PublicKey), - PrivateKey: packet.NewRSAPrivateKey(creationTime, encryptingPriv), - Sig: &packet.Signature{ - CreationTime: creationTime, - SigType: packet.SigTypeSubkeyBinding, - PubKeyAlgo: packet.PubKeyAlgoRSA, - Hash: config.Hash(), - FlagsValid: true, - FlagEncryptStorage: true, - FlagEncryptCommunications: true, - IssuerKeyId: &e.PrimaryKey.KeyId, - }, - } - e.Subkeys[0].PublicKey.IsSubkey = true - e.Subkeys[0].PrivateKey.IsSubkey = true - err = e.Subkeys[0].Sig.SignKey(e.Subkeys[0].PublicKey, e.PrivateKey, config) - if err != nil { - return nil, err - } - return e, nil -} - -// SerializePrivate serializes an Entity, including private key material, but -// excluding signatures from other entities, to the given Writer. -// Identities and subkeys are re-signed in case they changed since NewEntry. -// If config is nil, sensible defaults will be used. -func (e *Entity) SerializePrivate(w io.Writer, config *packet.Config) (err error) { - err = e.PrivateKey.Serialize(w) - if err != nil { - return - } - for _, ident := range e.Identities { - err = ident.UserId.Serialize(w) - if err != nil { - return - } - err = ident.SelfSignature.SignUserId(ident.UserId.Id, e.PrimaryKey, e.PrivateKey, config) - if err != nil { - return - } - err = ident.SelfSignature.Serialize(w) - if err != nil { - return - } - } - for _, subkey := range e.Subkeys { - err = subkey.PrivateKey.Serialize(w) - if err != nil { - return - } - err = subkey.Sig.SignKey(subkey.PublicKey, e.PrivateKey, config) - if err != nil { - return - } - err = subkey.Sig.Serialize(w) - if err != nil { - return - } - } - return nil -} - -// Serialize writes the public part of the given Entity to w, including -// signatures from other entities. No private key material will be output. -func (e *Entity) Serialize(w io.Writer) error { - err := e.PrimaryKey.Serialize(w) - if err != nil { - return err - } - for _, ident := range e.Identities { - err = ident.UserId.Serialize(w) - if err != nil { - return err - } - err = ident.SelfSignature.Serialize(w) - if err != nil { - return err - } - for _, sig := range ident.Signatures { - err = sig.Serialize(w) - if err != nil { - return err - } - } - } - for _, subkey := range e.Subkeys { - err = subkey.PublicKey.Serialize(w) - if err != nil { - return err - } - err = subkey.Sig.Serialize(w) - if err != nil { - return err - } - } - return nil -} - -// SignIdentity adds a signature to e, from signer, attesting that identity is -// associated with e. The provided identity must already be an element of -// e.Identities and the private key of signer must have been decrypted if -// necessary. -// If config is nil, sensible defaults will be used. -func (e *Entity) SignIdentity(identity string, signer *Entity, config *packet.Config) error { - if signer.PrivateKey == nil { - return errors.InvalidArgumentError("signing Entity must have a private key") - } - if signer.PrivateKey.Encrypted { - return errors.InvalidArgumentError("signing Entity's private key must be decrypted") - } - ident, ok := e.Identities[identity] - if !ok { - return errors.InvalidArgumentError("given identity string not found in Entity") - } - - sig := &packet.Signature{ - SigType: packet.SigTypeGenericCert, - PubKeyAlgo: signer.PrivateKey.PubKeyAlgo, - Hash: config.Hash(), - CreationTime: config.Now(), - IssuerKeyId: &signer.PrivateKey.KeyId, - } - if err := sig.SignUserId(identity, e.PrimaryKey, signer.PrivateKey, config); err != nil { - return err - } - ident.Signatures = append(ident.Signatures, sig) - return nil -} diff --git a/vendor/golang.org/x/crypto/openpgp/packet/compressed.go b/vendor/golang.org/x/crypto/openpgp/packet/compressed.go deleted file mode 100644 index 353f945247cf..000000000000 --- a/vendor/golang.org/x/crypto/openpgp/packet/compressed.go +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package packet - -import ( - "compress/bzip2" - "compress/flate" - "compress/zlib" - "golang.org/x/crypto/openpgp/errors" - "io" - "strconv" -) - -// Compressed represents a compressed OpenPGP packet. The decompressed contents -// will contain more OpenPGP packets. See RFC 4880, section 5.6. -type Compressed struct { - Body io.Reader -} - -const ( - NoCompression = flate.NoCompression - BestSpeed = flate.BestSpeed - BestCompression = flate.BestCompression - DefaultCompression = flate.DefaultCompression -) - -// CompressionConfig contains compressor configuration settings. -type CompressionConfig struct { - // Level is the compression level to use. It must be set to - // between -1 and 9, with -1 causing the compressor to use the - // default compression level, 0 causing the compressor to use - // no compression and 1 to 9 representing increasing (better, - // slower) compression levels. If Level is less than -1 or - // more then 9, a non-nil error will be returned during - // encryption. See the constants above for convenient common - // settings for Level. - Level int -} - -func (c *Compressed) parse(r io.Reader) error { - var buf [1]byte - _, err := readFull(r, buf[:]) - if err != nil { - return err - } - - switch buf[0] { - case 1: - c.Body = flate.NewReader(r) - case 2: - c.Body, err = zlib.NewReader(r) - case 3: - c.Body = bzip2.NewReader(r) - default: - err = errors.UnsupportedError("unknown compression algorithm: " + strconv.Itoa(int(buf[0]))) - } - - return err -} - -// compressedWriteCloser represents the serialized compression stream -// header and the compressor. Its Close() method ensures that both the -// compressor and serialized stream header are closed. Its Write() -// method writes to the compressor. -type compressedWriteCloser struct { - sh io.Closer // Stream Header - c io.WriteCloser // Compressor -} - -func (cwc compressedWriteCloser) Write(p []byte) (int, error) { - return cwc.c.Write(p) -} - -func (cwc compressedWriteCloser) Close() (err error) { - err = cwc.c.Close() - if err != nil { - return err - } - - return cwc.sh.Close() -} - -// SerializeCompressed serializes a compressed data packet to w and -// returns a WriteCloser to which the literal data packets themselves -// can be written and which MUST be closed on completion. If cc is -// nil, sensible defaults will be used to configure the compression -// algorithm. -func SerializeCompressed(w io.WriteCloser, algo CompressionAlgo, cc *CompressionConfig) (literaldata io.WriteCloser, err error) { - compressed, err := serializeStreamHeader(w, packetTypeCompressed) - if err != nil { - return - } - - _, err = compressed.Write([]byte{uint8(algo)}) - if err != nil { - return - } - - level := DefaultCompression - if cc != nil { - level = cc.Level - } - - var compressor io.WriteCloser - switch algo { - case CompressionZIP: - compressor, err = flate.NewWriter(compressed, level) - case CompressionZLIB: - compressor, err = zlib.NewWriterLevel(compressed, level) - default: - s := strconv.Itoa(int(algo)) - err = errors.UnsupportedError("Unsupported compression algorithm: " + s) - } - if err != nil { - return - } - - literaldata = compressedWriteCloser{compressed, compressor} - - return -} diff --git a/vendor/golang.org/x/crypto/openpgp/packet/config.go b/vendor/golang.org/x/crypto/openpgp/packet/config.go deleted file mode 100644 index c76eecc963ac..000000000000 --- a/vendor/golang.org/x/crypto/openpgp/packet/config.go +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package packet - -import ( - "crypto" - "crypto/rand" - "io" - "time" -) - -// Config collects a number of parameters along with sensible defaults. -// A nil *Config is valid and results in all default values. -type Config struct { - // Rand provides the source of entropy. - // If nil, the crypto/rand Reader is used. - Rand io.Reader - // DefaultHash is the default hash function to be used. - // If zero, SHA-256 is used. - DefaultHash crypto.Hash - // DefaultCipher is the cipher to be used. - // If zero, AES-128 is used. - DefaultCipher CipherFunction - // Time returns the current time as the number of seconds since the - // epoch. If Time is nil, time.Now is used. - Time func() time.Time - // DefaultCompressionAlgo is the compression algorithm to be - // applied to the plaintext before encryption. If zero, no - // compression is done. - DefaultCompressionAlgo CompressionAlgo - // CompressionConfig configures the compression settings. - CompressionConfig *CompressionConfig - // S2KCount is only used for symmetric encryption. It - // determines the strength of the passphrase stretching when - // the said passphrase is hashed to produce a key. S2KCount - // should be between 1024 and 65011712, inclusive. If Config - // is nil or S2KCount is 0, the value 65536 used. Not all - // values in the above range can be represented. S2KCount will - // be rounded up to the next representable value if it cannot - // be encoded exactly. When set, it is strongly encrouraged to - // use a value that is at least 65536. See RFC 4880 Section - // 3.7.1.3. - S2KCount int - // RSABits is the number of bits in new RSA keys made with NewEntity. - // If zero, then 2048 bit keys are created. - RSABits int -} - -func (c *Config) Random() io.Reader { - if c == nil || c.Rand == nil { - return rand.Reader - } - return c.Rand -} - -func (c *Config) Hash() crypto.Hash { - if c == nil || uint(c.DefaultHash) == 0 { - return crypto.SHA256 - } - return c.DefaultHash -} - -func (c *Config) Cipher() CipherFunction { - if c == nil || uint8(c.DefaultCipher) == 0 { - return CipherAES128 - } - return c.DefaultCipher -} - -func (c *Config) Now() time.Time { - if c == nil || c.Time == nil { - return time.Now() - } - return c.Time() -} - -func (c *Config) Compression() CompressionAlgo { - if c == nil { - return CompressionNone - } - return c.DefaultCompressionAlgo -} - -func (c *Config) PasswordHashIterations() int { - if c == nil || c.S2KCount == 0 { - return 0 - } - return c.S2KCount -} diff --git a/vendor/golang.org/x/crypto/openpgp/packet/encrypted_key.go b/vendor/golang.org/x/crypto/openpgp/packet/encrypted_key.go deleted file mode 100644 index 6d7639722c90..000000000000 --- a/vendor/golang.org/x/crypto/openpgp/packet/encrypted_key.go +++ /dev/null @@ -1,208 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package packet - -import ( - "crypto" - "crypto/rsa" - "encoding/binary" - "io" - "math/big" - "strconv" - - "golang.org/x/crypto/openpgp/elgamal" - "golang.org/x/crypto/openpgp/errors" -) - -const encryptedKeyVersion = 3 - -// EncryptedKey represents a public-key encrypted session key. See RFC 4880, -// section 5.1. -type EncryptedKey struct { - KeyId uint64 - Algo PublicKeyAlgorithm - CipherFunc CipherFunction // only valid after a successful Decrypt - Key []byte // only valid after a successful Decrypt - - encryptedMPI1, encryptedMPI2 parsedMPI -} - -func (e *EncryptedKey) parse(r io.Reader) (err error) { - var buf [10]byte - _, err = readFull(r, buf[:]) - if err != nil { - return - } - if buf[0] != encryptedKeyVersion { - return errors.UnsupportedError("unknown EncryptedKey version " + strconv.Itoa(int(buf[0]))) - } - e.KeyId = binary.BigEndian.Uint64(buf[1:9]) - e.Algo = PublicKeyAlgorithm(buf[9]) - switch e.Algo { - case PubKeyAlgoRSA, PubKeyAlgoRSAEncryptOnly: - e.encryptedMPI1.bytes, e.encryptedMPI1.bitLength, err = readMPI(r) - if err != nil { - return - } - case PubKeyAlgoElGamal: - e.encryptedMPI1.bytes, e.encryptedMPI1.bitLength, err = readMPI(r) - if err != nil { - return - } - e.encryptedMPI2.bytes, e.encryptedMPI2.bitLength, err = readMPI(r) - if err != nil { - return - } - } - _, err = consumeAll(r) - return -} - -func checksumKeyMaterial(key []byte) uint16 { - var checksum uint16 - for _, v := range key { - checksum += uint16(v) - } - return checksum -} - -// Decrypt decrypts an encrypted session key with the given private key. The -// private key must have been decrypted first. -// If config is nil, sensible defaults will be used. -func (e *EncryptedKey) Decrypt(priv *PrivateKey, config *Config) error { - var err error - var b []byte - - // TODO(agl): use session key decryption routines here to avoid - // padding oracle attacks. - switch priv.PubKeyAlgo { - case PubKeyAlgoRSA, PubKeyAlgoRSAEncryptOnly: - // Supports both *rsa.PrivateKey and crypto.Decrypter - k := priv.PrivateKey.(crypto.Decrypter) - b, err = k.Decrypt(config.Random(), padToKeySize(k.Public().(*rsa.PublicKey), e.encryptedMPI1.bytes), nil) - case PubKeyAlgoElGamal: - c1 := new(big.Int).SetBytes(e.encryptedMPI1.bytes) - c2 := new(big.Int).SetBytes(e.encryptedMPI2.bytes) - b, err = elgamal.Decrypt(priv.PrivateKey.(*elgamal.PrivateKey), c1, c2) - default: - err = errors.InvalidArgumentError("cannot decrypted encrypted session key with private key of type " + strconv.Itoa(int(priv.PubKeyAlgo))) - } - - if err != nil { - return err - } - - e.CipherFunc = CipherFunction(b[0]) - e.Key = b[1 : len(b)-2] - expectedChecksum := uint16(b[len(b)-2])<<8 | uint16(b[len(b)-1]) - checksum := checksumKeyMaterial(e.Key) - if checksum != expectedChecksum { - return errors.StructuralError("EncryptedKey checksum incorrect") - } - - return nil -} - -// Serialize writes the encrypted key packet, e, to w. -func (e *EncryptedKey) Serialize(w io.Writer) error { - var mpiLen int - switch e.Algo { - case PubKeyAlgoRSA, PubKeyAlgoRSAEncryptOnly: - mpiLen = 2 + len(e.encryptedMPI1.bytes) - case PubKeyAlgoElGamal: - mpiLen = 2 + len(e.encryptedMPI1.bytes) + 2 + len(e.encryptedMPI2.bytes) - default: - return errors.InvalidArgumentError("don't know how to serialize encrypted key type " + strconv.Itoa(int(e.Algo))) - } - - serializeHeader(w, packetTypeEncryptedKey, 1 /* version */ +8 /* key id */ +1 /* algo */ +mpiLen) - - w.Write([]byte{encryptedKeyVersion}) - binary.Write(w, binary.BigEndian, e.KeyId) - w.Write([]byte{byte(e.Algo)}) - - switch e.Algo { - case PubKeyAlgoRSA, PubKeyAlgoRSAEncryptOnly: - writeMPIs(w, e.encryptedMPI1) - case PubKeyAlgoElGamal: - writeMPIs(w, e.encryptedMPI1, e.encryptedMPI2) - default: - panic("internal error") - } - - return nil -} - -// SerializeEncryptedKey serializes an encrypted key packet to w that contains -// key, encrypted to pub. -// If config is nil, sensible defaults will be used. -func SerializeEncryptedKey(w io.Writer, pub *PublicKey, cipherFunc CipherFunction, key []byte, config *Config) error { - var buf [10]byte - buf[0] = encryptedKeyVersion - binary.BigEndian.PutUint64(buf[1:9], pub.KeyId) - buf[9] = byte(pub.PubKeyAlgo) - - keyBlock := make([]byte, 1 /* cipher type */ +len(key)+2 /* checksum */) - keyBlock[0] = byte(cipherFunc) - copy(keyBlock[1:], key) - checksum := checksumKeyMaterial(key) - keyBlock[1+len(key)] = byte(checksum >> 8) - keyBlock[1+len(key)+1] = byte(checksum) - - switch pub.PubKeyAlgo { - case PubKeyAlgoRSA, PubKeyAlgoRSAEncryptOnly: - return serializeEncryptedKeyRSA(w, config.Random(), buf, pub.PublicKey.(*rsa.PublicKey), keyBlock) - case PubKeyAlgoElGamal: - return serializeEncryptedKeyElGamal(w, config.Random(), buf, pub.PublicKey.(*elgamal.PublicKey), keyBlock) - case PubKeyAlgoDSA, PubKeyAlgoRSASignOnly: - return errors.InvalidArgumentError("cannot encrypt to public key of type " + strconv.Itoa(int(pub.PubKeyAlgo))) - } - - return errors.UnsupportedError("encrypting a key to public key of type " + strconv.Itoa(int(pub.PubKeyAlgo))) -} - -func serializeEncryptedKeyRSA(w io.Writer, rand io.Reader, header [10]byte, pub *rsa.PublicKey, keyBlock []byte) error { - cipherText, err := rsa.EncryptPKCS1v15(rand, pub, keyBlock) - if err != nil { - return errors.InvalidArgumentError("RSA encryption failed: " + err.Error()) - } - - packetLen := 10 /* header length */ + 2 /* mpi size */ + len(cipherText) - - err = serializeHeader(w, packetTypeEncryptedKey, packetLen) - if err != nil { - return err - } - _, err = w.Write(header[:]) - if err != nil { - return err - } - return writeMPI(w, 8*uint16(len(cipherText)), cipherText) -} - -func serializeEncryptedKeyElGamal(w io.Writer, rand io.Reader, header [10]byte, pub *elgamal.PublicKey, keyBlock []byte) error { - c1, c2, err := elgamal.Encrypt(rand, pub, keyBlock) - if err != nil { - return errors.InvalidArgumentError("ElGamal encryption failed: " + err.Error()) - } - - packetLen := 10 /* header length */ - packetLen += 2 /* mpi size */ + (c1.BitLen()+7)/8 - packetLen += 2 /* mpi size */ + (c2.BitLen()+7)/8 - - err = serializeHeader(w, packetTypeEncryptedKey, packetLen) - if err != nil { - return err - } - _, err = w.Write(header[:]) - if err != nil { - return err - } - err = writeBig(w, c1) - if err != nil { - return err - } - return writeBig(w, c2) -} diff --git a/vendor/golang.org/x/crypto/openpgp/packet/literal.go b/vendor/golang.org/x/crypto/openpgp/packet/literal.go deleted file mode 100644 index 1a9ec6e51e81..000000000000 --- a/vendor/golang.org/x/crypto/openpgp/packet/literal.go +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package packet - -import ( - "encoding/binary" - "io" -) - -// LiteralData represents an encrypted file. See RFC 4880, section 5.9. -type LiteralData struct { - IsBinary bool - FileName string - Time uint32 // Unix epoch time. Either creation time or modification time. 0 means undefined. - Body io.Reader -} - -// ForEyesOnly returns whether the contents of the LiteralData have been marked -// as especially sensitive. -func (l *LiteralData) ForEyesOnly() bool { - return l.FileName == "_CONSOLE" -} - -func (l *LiteralData) parse(r io.Reader) (err error) { - var buf [256]byte - - _, err = readFull(r, buf[:2]) - if err != nil { - return - } - - l.IsBinary = buf[0] == 'b' - fileNameLen := int(buf[1]) - - _, err = readFull(r, buf[:fileNameLen]) - if err != nil { - return - } - - l.FileName = string(buf[:fileNameLen]) - - _, err = readFull(r, buf[:4]) - if err != nil { - return - } - - l.Time = binary.BigEndian.Uint32(buf[:4]) - l.Body = r - return -} - -// SerializeLiteral serializes a literal data packet to w and returns a -// WriteCloser to which the data itself can be written and which MUST be closed -// on completion. The fileName is truncated to 255 bytes. -func SerializeLiteral(w io.WriteCloser, isBinary bool, fileName string, time uint32) (plaintext io.WriteCloser, err error) { - var buf [4]byte - buf[0] = 't' - if isBinary { - buf[0] = 'b' - } - if len(fileName) > 255 { - fileName = fileName[:255] - } - buf[1] = byte(len(fileName)) - - inner, err := serializeStreamHeader(w, packetTypeLiteralData) - if err != nil { - return - } - - _, err = inner.Write(buf[:2]) - if err != nil { - return - } - _, err = inner.Write([]byte(fileName)) - if err != nil { - return - } - binary.BigEndian.PutUint32(buf[:], time) - _, err = inner.Write(buf[:]) - if err != nil { - return - } - - plaintext = inner - return -} diff --git a/vendor/golang.org/x/crypto/openpgp/packet/ocfb.go b/vendor/golang.org/x/crypto/openpgp/packet/ocfb.go deleted file mode 100644 index ce2a33a547ce..000000000000 --- a/vendor/golang.org/x/crypto/openpgp/packet/ocfb.go +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// OpenPGP CFB Mode. http://tools.ietf.org/html/rfc4880#section-13.9 - -package packet - -import ( - "crypto/cipher" -) - -type ocfbEncrypter struct { - b cipher.Block - fre []byte - outUsed int -} - -// An OCFBResyncOption determines if the "resynchronization step" of OCFB is -// performed. -type OCFBResyncOption bool - -const ( - OCFBResync OCFBResyncOption = true - OCFBNoResync OCFBResyncOption = false -) - -// NewOCFBEncrypter returns a cipher.Stream which encrypts data with OpenPGP's -// cipher feedback mode using the given cipher.Block, and an initial amount of -// ciphertext. randData must be random bytes and be the same length as the -// cipher.Block's block size. Resync determines if the "resynchronization step" -// from RFC 4880, 13.9 step 7 is performed. Different parts of OpenPGP vary on -// this point. -func NewOCFBEncrypter(block cipher.Block, randData []byte, resync OCFBResyncOption) (cipher.Stream, []byte) { - blockSize := block.BlockSize() - if len(randData) != blockSize { - return nil, nil - } - - x := &ocfbEncrypter{ - b: block, - fre: make([]byte, blockSize), - outUsed: 0, - } - prefix := make([]byte, blockSize+2) - - block.Encrypt(x.fre, x.fre) - for i := 0; i < blockSize; i++ { - prefix[i] = randData[i] ^ x.fre[i] - } - - block.Encrypt(x.fre, prefix[:blockSize]) - prefix[blockSize] = x.fre[0] ^ randData[blockSize-2] - prefix[blockSize+1] = x.fre[1] ^ randData[blockSize-1] - - if resync { - block.Encrypt(x.fre, prefix[2:]) - } else { - x.fre[0] = prefix[blockSize] - x.fre[1] = prefix[blockSize+1] - x.outUsed = 2 - } - return x, prefix -} - -func (x *ocfbEncrypter) XORKeyStream(dst, src []byte) { - for i := 0; i < len(src); i++ { - if x.outUsed == len(x.fre) { - x.b.Encrypt(x.fre, x.fre) - x.outUsed = 0 - } - - x.fre[x.outUsed] ^= src[i] - dst[i] = x.fre[x.outUsed] - x.outUsed++ - } -} - -type ocfbDecrypter struct { - b cipher.Block - fre []byte - outUsed int -} - -// NewOCFBDecrypter returns a cipher.Stream which decrypts data with OpenPGP's -// cipher feedback mode using the given cipher.Block. Prefix must be the first -// blockSize + 2 bytes of the ciphertext, where blockSize is the cipher.Block's -// block size. If an incorrect key is detected then nil is returned. On -// successful exit, blockSize+2 bytes of decrypted data are written into -// prefix. Resync determines if the "resynchronization step" from RFC 4880, -// 13.9 step 7 is performed. Different parts of OpenPGP vary on this point. -func NewOCFBDecrypter(block cipher.Block, prefix []byte, resync OCFBResyncOption) cipher.Stream { - blockSize := block.BlockSize() - if len(prefix) != blockSize+2 { - return nil - } - - x := &ocfbDecrypter{ - b: block, - fre: make([]byte, blockSize), - outUsed: 0, - } - prefixCopy := make([]byte, len(prefix)) - copy(prefixCopy, prefix) - - block.Encrypt(x.fre, x.fre) - for i := 0; i < blockSize; i++ { - prefixCopy[i] ^= x.fre[i] - } - - block.Encrypt(x.fre, prefix[:blockSize]) - prefixCopy[blockSize] ^= x.fre[0] - prefixCopy[blockSize+1] ^= x.fre[1] - - if prefixCopy[blockSize-2] != prefixCopy[blockSize] || - prefixCopy[blockSize-1] != prefixCopy[blockSize+1] { - return nil - } - - if resync { - block.Encrypt(x.fre, prefix[2:]) - } else { - x.fre[0] = prefix[blockSize] - x.fre[1] = prefix[blockSize+1] - x.outUsed = 2 - } - copy(prefix, prefixCopy) - return x -} - -func (x *ocfbDecrypter) XORKeyStream(dst, src []byte) { - for i := 0; i < len(src); i++ { - if x.outUsed == len(x.fre) { - x.b.Encrypt(x.fre, x.fre) - x.outUsed = 0 - } - - c := src[i] - dst[i] = x.fre[x.outUsed] ^ src[i] - x.fre[x.outUsed] = c - x.outUsed++ - } -} diff --git a/vendor/golang.org/x/crypto/openpgp/packet/one_pass_signature.go b/vendor/golang.org/x/crypto/openpgp/packet/one_pass_signature.go deleted file mode 100644 index 1713503395e3..000000000000 --- a/vendor/golang.org/x/crypto/openpgp/packet/one_pass_signature.go +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package packet - -import ( - "crypto" - "encoding/binary" - "golang.org/x/crypto/openpgp/errors" - "golang.org/x/crypto/openpgp/s2k" - "io" - "strconv" -) - -// OnePassSignature represents a one-pass signature packet. See RFC 4880, -// section 5.4. -type OnePassSignature struct { - SigType SignatureType - Hash crypto.Hash - PubKeyAlgo PublicKeyAlgorithm - KeyId uint64 - IsLast bool -} - -const onePassSignatureVersion = 3 - -func (ops *OnePassSignature) parse(r io.Reader) (err error) { - var buf [13]byte - - _, err = readFull(r, buf[:]) - if err != nil { - return - } - if buf[0] != onePassSignatureVersion { - err = errors.UnsupportedError("one-pass-signature packet version " + strconv.Itoa(int(buf[0]))) - } - - var ok bool - ops.Hash, ok = s2k.HashIdToHash(buf[2]) - if !ok { - return errors.UnsupportedError("hash function: " + strconv.Itoa(int(buf[2]))) - } - - ops.SigType = SignatureType(buf[1]) - ops.PubKeyAlgo = PublicKeyAlgorithm(buf[3]) - ops.KeyId = binary.BigEndian.Uint64(buf[4:12]) - ops.IsLast = buf[12] != 0 - return -} - -// Serialize marshals the given OnePassSignature to w. -func (ops *OnePassSignature) Serialize(w io.Writer) error { - var buf [13]byte - buf[0] = onePassSignatureVersion - buf[1] = uint8(ops.SigType) - var ok bool - buf[2], ok = s2k.HashToHashId(ops.Hash) - if !ok { - return errors.UnsupportedError("hash type: " + strconv.Itoa(int(ops.Hash))) - } - buf[3] = uint8(ops.PubKeyAlgo) - binary.BigEndian.PutUint64(buf[4:12], ops.KeyId) - if ops.IsLast { - buf[12] = 1 - } - - if err := serializeHeader(w, packetTypeOnePassSignature, len(buf)); err != nil { - return err - } - _, err := w.Write(buf[:]) - return err -} diff --git a/vendor/golang.org/x/crypto/openpgp/packet/opaque.go b/vendor/golang.org/x/crypto/openpgp/packet/opaque.go deleted file mode 100644 index 3984477310fe..000000000000 --- a/vendor/golang.org/x/crypto/openpgp/packet/opaque.go +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package packet - -import ( - "bytes" - "io" - - "golang.org/x/crypto/openpgp/errors" -) - -// OpaquePacket represents an OpenPGP packet as raw, unparsed data. This is -// useful for splitting and storing the original packet contents separately, -// handling unsupported packet types or accessing parts of the packet not yet -// implemented by this package. -type OpaquePacket struct { - // Packet type - Tag uint8 - // Reason why the packet was parsed opaquely - Reason error - // Binary contents of the packet data - Contents []byte -} - -func (op *OpaquePacket) parse(r io.Reader) (err error) { - op.Contents, err = io.ReadAll(r) - return -} - -// Serialize marshals the packet to a writer in its original form, including -// the packet header. -func (op *OpaquePacket) Serialize(w io.Writer) (err error) { - err = serializeHeader(w, packetType(op.Tag), len(op.Contents)) - if err == nil { - _, err = w.Write(op.Contents) - } - return -} - -// Parse attempts to parse the opaque contents into a structure supported by -// this package. If the packet is not known then the result will be another -// OpaquePacket. -func (op *OpaquePacket) Parse() (p Packet, err error) { - hdr := bytes.NewBuffer(nil) - err = serializeHeader(hdr, packetType(op.Tag), len(op.Contents)) - if err != nil { - op.Reason = err - return op, err - } - p, err = Read(io.MultiReader(hdr, bytes.NewBuffer(op.Contents))) - if err != nil { - op.Reason = err - p = op - } - return -} - -// OpaqueReader reads OpaquePackets from an io.Reader. -type OpaqueReader struct { - r io.Reader -} - -func NewOpaqueReader(r io.Reader) *OpaqueReader { - return &OpaqueReader{r: r} -} - -// Read the next OpaquePacket. -func (or *OpaqueReader) Next() (op *OpaquePacket, err error) { - tag, _, contents, err := readHeader(or.r) - if err != nil { - return - } - op = &OpaquePacket{Tag: uint8(tag), Reason: err} - err = op.parse(contents) - if err != nil { - consumeAll(contents) - } - return -} - -// OpaqueSubpacket represents an unparsed OpenPGP subpacket, -// as found in signature and user attribute packets. -type OpaqueSubpacket struct { - SubType uint8 - Contents []byte -} - -// OpaqueSubpackets extracts opaque, unparsed OpenPGP subpackets from -// their byte representation. -func OpaqueSubpackets(contents []byte) (result []*OpaqueSubpacket, err error) { - var ( - subHeaderLen int - subPacket *OpaqueSubpacket - ) - for len(contents) > 0 { - subHeaderLen, subPacket, err = nextSubpacket(contents) - if err != nil { - break - } - result = append(result, subPacket) - contents = contents[subHeaderLen+len(subPacket.Contents):] - } - return -} - -func nextSubpacket(contents []byte) (subHeaderLen int, subPacket *OpaqueSubpacket, err error) { - // RFC 4880, section 5.2.3.1 - var subLen uint32 - if len(contents) < 1 { - goto Truncated - } - subPacket = &OpaqueSubpacket{} - switch { - case contents[0] < 192: - subHeaderLen = 2 // 1 length byte, 1 subtype byte - if len(contents) < subHeaderLen { - goto Truncated - } - subLen = uint32(contents[0]) - contents = contents[1:] - case contents[0] < 255: - subHeaderLen = 3 // 2 length bytes, 1 subtype - if len(contents) < subHeaderLen { - goto Truncated - } - subLen = uint32(contents[0]-192)<<8 + uint32(contents[1]) + 192 - contents = contents[2:] - default: - subHeaderLen = 6 // 5 length bytes, 1 subtype - if len(contents) < subHeaderLen { - goto Truncated - } - subLen = uint32(contents[1])<<24 | - uint32(contents[2])<<16 | - uint32(contents[3])<<8 | - uint32(contents[4]) - contents = contents[5:] - } - if subLen > uint32(len(contents)) || subLen == 0 { - goto Truncated - } - subPacket.SubType = contents[0] - subPacket.Contents = contents[1:subLen] - return -Truncated: - err = errors.StructuralError("subpacket truncated") - return -} - -func (osp *OpaqueSubpacket) Serialize(w io.Writer) (err error) { - buf := make([]byte, 6) - n := serializeSubpacketLength(buf, len(osp.Contents)+1) - buf[n] = osp.SubType - if _, err = w.Write(buf[:n+1]); err != nil { - return - } - _, err = w.Write(osp.Contents) - return -} diff --git a/vendor/golang.org/x/crypto/openpgp/packet/packet.go b/vendor/golang.org/x/crypto/openpgp/packet/packet.go deleted file mode 100644 index 0a19794a8e49..000000000000 --- a/vendor/golang.org/x/crypto/openpgp/packet/packet.go +++ /dev/null @@ -1,590 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package packet implements parsing and serialization of OpenPGP packets, as -// specified in RFC 4880. -// -// Deprecated: this package is unmaintained except for security fixes. New -// applications should consider a more focused, modern alternative to OpenPGP -// for their specific task. If you are required to interoperate with OpenPGP -// systems and need a maintained package, consider a community fork. -// See https://golang.org/issue/44226. -package packet // import "golang.org/x/crypto/openpgp/packet" - -import ( - "bufio" - "crypto/aes" - "crypto/cipher" - "crypto/des" - "crypto/rsa" - "io" - "math/big" - "math/bits" - - "golang.org/x/crypto/cast5" - "golang.org/x/crypto/openpgp/errors" -) - -// readFull is the same as io.ReadFull except that reading zero bytes returns -// ErrUnexpectedEOF rather than EOF. -func readFull(r io.Reader, buf []byte) (n int, err error) { - n, err = io.ReadFull(r, buf) - if err == io.EOF { - err = io.ErrUnexpectedEOF - } - return -} - -// readLength reads an OpenPGP length from r. See RFC 4880, section 4.2.2. -func readLength(r io.Reader) (length int64, isPartial bool, err error) { - var buf [4]byte - _, err = readFull(r, buf[:1]) - if err != nil { - return - } - switch { - case buf[0] < 192: - length = int64(buf[0]) - case buf[0] < 224: - length = int64(buf[0]-192) << 8 - _, err = readFull(r, buf[0:1]) - if err != nil { - return - } - length += int64(buf[0]) + 192 - case buf[0] < 255: - length = int64(1) << (buf[0] & 0x1f) - isPartial = true - default: - _, err = readFull(r, buf[0:4]) - if err != nil { - return - } - length = int64(buf[0])<<24 | - int64(buf[1])<<16 | - int64(buf[2])<<8 | - int64(buf[3]) - } - return -} - -// partialLengthReader wraps an io.Reader and handles OpenPGP partial lengths. -// The continuation lengths are parsed and removed from the stream and EOF is -// returned at the end of the packet. See RFC 4880, section 4.2.2.4. -type partialLengthReader struct { - r io.Reader - remaining int64 - isPartial bool -} - -func (r *partialLengthReader) Read(p []byte) (n int, err error) { - for r.remaining == 0 { - if !r.isPartial { - return 0, io.EOF - } - r.remaining, r.isPartial, err = readLength(r.r) - if err != nil { - return 0, err - } - } - - toRead := int64(len(p)) - if toRead > r.remaining { - toRead = r.remaining - } - - n, err = r.r.Read(p[:int(toRead)]) - r.remaining -= int64(n) - if n < int(toRead) && err == io.EOF { - err = io.ErrUnexpectedEOF - } - return -} - -// partialLengthWriter writes a stream of data using OpenPGP partial lengths. -// See RFC 4880, section 4.2.2.4. -type partialLengthWriter struct { - w io.WriteCloser - lengthByte [1]byte - sentFirst bool - buf []byte -} - -// RFC 4880 4.2.2.4: the first partial length MUST be at least 512 octets long. -const minFirstPartialWrite = 512 - -func (w *partialLengthWriter) Write(p []byte) (n int, err error) { - off := 0 - if !w.sentFirst { - if len(w.buf) > 0 || len(p) < minFirstPartialWrite { - off = len(w.buf) - w.buf = append(w.buf, p...) - if len(w.buf) < minFirstPartialWrite { - return len(p), nil - } - p = w.buf - w.buf = nil - } - w.sentFirst = true - } - - power := uint8(30) - for len(p) > 0 { - l := 1 << power - if len(p) < l { - power = uint8(bits.Len32(uint32(len(p)))) - 1 - l = 1 << power - } - w.lengthByte[0] = 224 + power - _, err = w.w.Write(w.lengthByte[:]) - if err == nil { - var m int - m, err = w.w.Write(p[:l]) - n += m - } - if err != nil { - if n < off { - return 0, err - } - return n - off, err - } - p = p[l:] - } - return n - off, nil -} - -func (w *partialLengthWriter) Close() error { - if len(w.buf) > 0 { - // In this case we can't send a 512 byte packet. - // Just send what we have. - p := w.buf - w.sentFirst = true - w.buf = nil - if _, err := w.Write(p); err != nil { - return err - } - } - - w.lengthByte[0] = 0 - _, err := w.w.Write(w.lengthByte[:]) - if err != nil { - return err - } - return w.w.Close() -} - -// A spanReader is an io.LimitReader, but it returns ErrUnexpectedEOF if the -// underlying Reader returns EOF before the limit has been reached. -type spanReader struct { - r io.Reader - n int64 -} - -func (l *spanReader) Read(p []byte) (n int, err error) { - if l.n <= 0 { - return 0, io.EOF - } - if int64(len(p)) > l.n { - p = p[0:l.n] - } - n, err = l.r.Read(p) - l.n -= int64(n) - if l.n > 0 && err == io.EOF { - err = io.ErrUnexpectedEOF - } - return -} - -// readHeader parses a packet header and returns an io.Reader which will return -// the contents of the packet. See RFC 4880, section 4.2. -func readHeader(r io.Reader) (tag packetType, length int64, contents io.Reader, err error) { - var buf [4]byte - _, err = io.ReadFull(r, buf[:1]) - if err != nil { - return - } - if buf[0]&0x80 == 0 { - err = errors.StructuralError("tag byte does not have MSB set") - return - } - if buf[0]&0x40 == 0 { - // Old format packet - tag = packetType((buf[0] & 0x3f) >> 2) - lengthType := buf[0] & 3 - if lengthType == 3 { - length = -1 - contents = r - return - } - lengthBytes := 1 << lengthType - _, err = readFull(r, buf[0:lengthBytes]) - if err != nil { - return - } - for i := 0; i < lengthBytes; i++ { - length <<= 8 - length |= int64(buf[i]) - } - contents = &spanReader{r, length} - return - } - - // New format packet - tag = packetType(buf[0] & 0x3f) - length, isPartial, err := readLength(r) - if err != nil { - return - } - if isPartial { - contents = &partialLengthReader{ - remaining: length, - isPartial: true, - r: r, - } - length = -1 - } else { - contents = &spanReader{r, length} - } - return -} - -// serializeHeader writes an OpenPGP packet header to w. See RFC 4880, section -// 4.2. -func serializeHeader(w io.Writer, ptype packetType, length int) (err error) { - var buf [6]byte - var n int - - buf[0] = 0x80 | 0x40 | byte(ptype) - if length < 192 { - buf[1] = byte(length) - n = 2 - } else if length < 8384 { - length -= 192 - buf[1] = 192 + byte(length>>8) - buf[2] = byte(length) - n = 3 - } else { - buf[1] = 255 - buf[2] = byte(length >> 24) - buf[3] = byte(length >> 16) - buf[4] = byte(length >> 8) - buf[5] = byte(length) - n = 6 - } - - _, err = w.Write(buf[:n]) - return -} - -// serializeStreamHeader writes an OpenPGP packet header to w where the -// length of the packet is unknown. It returns a io.WriteCloser which can be -// used to write the contents of the packet. See RFC 4880, section 4.2. -func serializeStreamHeader(w io.WriteCloser, ptype packetType) (out io.WriteCloser, err error) { - var buf [1]byte - buf[0] = 0x80 | 0x40 | byte(ptype) - _, err = w.Write(buf[:]) - if err != nil { - return - } - out = &partialLengthWriter{w: w} - return -} - -// Packet represents an OpenPGP packet. Users are expected to try casting -// instances of this interface to specific packet types. -type Packet interface { - parse(io.Reader) error -} - -// consumeAll reads from the given Reader until error, returning the number of -// bytes read. -func consumeAll(r io.Reader) (n int64, err error) { - var m int - var buf [1024]byte - - for { - m, err = r.Read(buf[:]) - n += int64(m) - if err == io.EOF { - err = nil - return - } - if err != nil { - return - } - } -} - -// packetType represents the numeric ids of the different OpenPGP packet types. See -// http://www.iana.org/assignments/pgp-parameters/pgp-parameters.xhtml#pgp-parameters-2 -type packetType uint8 - -const ( - packetTypeEncryptedKey packetType = 1 - packetTypeSignature packetType = 2 - packetTypeSymmetricKeyEncrypted packetType = 3 - packetTypeOnePassSignature packetType = 4 - packetTypePrivateKey packetType = 5 - packetTypePublicKey packetType = 6 - packetTypePrivateSubkey packetType = 7 - packetTypeCompressed packetType = 8 - packetTypeSymmetricallyEncrypted packetType = 9 - packetTypeLiteralData packetType = 11 - packetTypeUserId packetType = 13 - packetTypePublicSubkey packetType = 14 - packetTypeUserAttribute packetType = 17 - packetTypeSymmetricallyEncryptedMDC packetType = 18 -) - -// peekVersion detects the version of a public key packet about to -// be read. A bufio.Reader at the original position of the io.Reader -// is returned. -func peekVersion(r io.Reader) (bufr *bufio.Reader, ver byte, err error) { - bufr = bufio.NewReader(r) - var verBuf []byte - if verBuf, err = bufr.Peek(1); err != nil { - return - } - ver = verBuf[0] - return -} - -// Read reads a single OpenPGP packet from the given io.Reader. If there is an -// error parsing a packet, the whole packet is consumed from the input. -func Read(r io.Reader) (p Packet, err error) { - tag, _, contents, err := readHeader(r) - if err != nil { - return - } - - switch tag { - case packetTypeEncryptedKey: - p = new(EncryptedKey) - case packetTypeSignature: - var version byte - // Detect signature version - if contents, version, err = peekVersion(contents); err != nil { - return - } - if version < 4 { - p = new(SignatureV3) - } else { - p = new(Signature) - } - case packetTypeSymmetricKeyEncrypted: - p = new(SymmetricKeyEncrypted) - case packetTypeOnePassSignature: - p = new(OnePassSignature) - case packetTypePrivateKey, packetTypePrivateSubkey: - pk := new(PrivateKey) - if tag == packetTypePrivateSubkey { - pk.IsSubkey = true - } - p = pk - case packetTypePublicKey, packetTypePublicSubkey: - var version byte - if contents, version, err = peekVersion(contents); err != nil { - return - } - isSubkey := tag == packetTypePublicSubkey - if version < 4 { - p = &PublicKeyV3{IsSubkey: isSubkey} - } else { - p = &PublicKey{IsSubkey: isSubkey} - } - case packetTypeCompressed: - p = new(Compressed) - case packetTypeSymmetricallyEncrypted: - p = new(SymmetricallyEncrypted) - case packetTypeLiteralData: - p = new(LiteralData) - case packetTypeUserId: - p = new(UserId) - case packetTypeUserAttribute: - p = new(UserAttribute) - case packetTypeSymmetricallyEncryptedMDC: - se := new(SymmetricallyEncrypted) - se.MDC = true - p = se - default: - err = errors.UnknownPacketTypeError(tag) - } - if p != nil { - err = p.parse(contents) - } - if err != nil { - consumeAll(contents) - } - return -} - -// SignatureType represents the different semantic meanings of an OpenPGP -// signature. See RFC 4880, section 5.2.1. -type SignatureType uint8 - -const ( - SigTypeBinary SignatureType = 0 - SigTypeText = 1 - SigTypeGenericCert = 0x10 - SigTypePersonaCert = 0x11 - SigTypeCasualCert = 0x12 - SigTypePositiveCert = 0x13 - SigTypeSubkeyBinding = 0x18 - SigTypePrimaryKeyBinding = 0x19 - SigTypeDirectSignature = 0x1F - SigTypeKeyRevocation = 0x20 - SigTypeSubkeyRevocation = 0x28 -) - -// PublicKeyAlgorithm represents the different public key system specified for -// OpenPGP. See -// http://www.iana.org/assignments/pgp-parameters/pgp-parameters.xhtml#pgp-parameters-12 -type PublicKeyAlgorithm uint8 - -const ( - PubKeyAlgoRSA PublicKeyAlgorithm = 1 - PubKeyAlgoElGamal PublicKeyAlgorithm = 16 - PubKeyAlgoDSA PublicKeyAlgorithm = 17 - // RFC 6637, Section 5. - PubKeyAlgoECDH PublicKeyAlgorithm = 18 - PubKeyAlgoECDSA PublicKeyAlgorithm = 19 - - // Deprecated in RFC 4880, Section 13.5. Use key flags instead. - PubKeyAlgoRSAEncryptOnly PublicKeyAlgorithm = 2 - PubKeyAlgoRSASignOnly PublicKeyAlgorithm = 3 -) - -// CanEncrypt returns true if it's possible to encrypt a message to a public -// key of the given type. -func (pka PublicKeyAlgorithm) CanEncrypt() bool { - switch pka { - case PubKeyAlgoRSA, PubKeyAlgoRSAEncryptOnly, PubKeyAlgoElGamal: - return true - } - return false -} - -// CanSign returns true if it's possible for a public key of the given type to -// sign a message. -func (pka PublicKeyAlgorithm) CanSign() bool { - switch pka { - case PubKeyAlgoRSA, PubKeyAlgoRSASignOnly, PubKeyAlgoDSA, PubKeyAlgoECDSA: - return true - } - return false -} - -// CipherFunction represents the different block ciphers specified for OpenPGP. See -// http://www.iana.org/assignments/pgp-parameters/pgp-parameters.xhtml#pgp-parameters-13 -type CipherFunction uint8 - -const ( - Cipher3DES CipherFunction = 2 - CipherCAST5 CipherFunction = 3 - CipherAES128 CipherFunction = 7 - CipherAES192 CipherFunction = 8 - CipherAES256 CipherFunction = 9 -) - -// KeySize returns the key size, in bytes, of cipher. -func (cipher CipherFunction) KeySize() int { - switch cipher { - case Cipher3DES: - return 24 - case CipherCAST5: - return cast5.KeySize - case CipherAES128: - return 16 - case CipherAES192: - return 24 - case CipherAES256: - return 32 - } - return 0 -} - -// blockSize returns the block size, in bytes, of cipher. -func (cipher CipherFunction) blockSize() int { - switch cipher { - case Cipher3DES: - return des.BlockSize - case CipherCAST5: - return 8 - case CipherAES128, CipherAES192, CipherAES256: - return 16 - } - return 0 -} - -// new returns a fresh instance of the given cipher. -func (cipher CipherFunction) new(key []byte) (block cipher.Block) { - switch cipher { - case Cipher3DES: - block, _ = des.NewTripleDESCipher(key) - case CipherCAST5: - block, _ = cast5.NewCipher(key) - case CipherAES128, CipherAES192, CipherAES256: - block, _ = aes.NewCipher(key) - } - return -} - -// readMPI reads a big integer from r. The bit length returned is the bit -// length that was specified in r. This is preserved so that the integer can be -// reserialized exactly. -func readMPI(r io.Reader) (mpi []byte, bitLength uint16, err error) { - var buf [2]byte - _, err = readFull(r, buf[0:]) - if err != nil { - return - } - bitLength = uint16(buf[0])<<8 | uint16(buf[1]) - numBytes := (int(bitLength) + 7) / 8 - mpi = make([]byte, numBytes) - _, err = readFull(r, mpi) - // According to RFC 4880 3.2. we should check that the MPI has no leading - // zeroes (at least when not an encrypted MPI?), but this implementation - // does generate leading zeroes, so we keep accepting them. - return -} - -// writeMPI serializes a big integer to w. -func writeMPI(w io.Writer, bitLength uint16, mpiBytes []byte) (err error) { - // Note that we can produce leading zeroes, in violation of RFC 4880 3.2. - // Implementations seem to be tolerant of them, and stripping them would - // make it complex to guarantee matching re-serialization. - _, err = w.Write([]byte{byte(bitLength >> 8), byte(bitLength)}) - if err == nil { - _, err = w.Write(mpiBytes) - } - return -} - -// writeBig serializes a *big.Int to w. -func writeBig(w io.Writer, i *big.Int) error { - return writeMPI(w, uint16(i.BitLen()), i.Bytes()) -} - -// padToKeySize left-pads a MPI with zeroes to match the length of the -// specified RSA public. -func padToKeySize(pub *rsa.PublicKey, b []byte) []byte { - k := (pub.N.BitLen() + 7) / 8 - if len(b) >= k { - return b - } - bb := make([]byte, k) - copy(bb[len(bb)-len(b):], b) - return bb -} - -// CompressionAlgo Represents the different compression algorithms -// supported by OpenPGP (except for BZIP2, which is not currently -// supported). See Section 9.3 of RFC 4880. -type CompressionAlgo uint8 - -const ( - CompressionNone CompressionAlgo = 0 - CompressionZIP CompressionAlgo = 1 - CompressionZLIB CompressionAlgo = 2 -) diff --git a/vendor/golang.org/x/crypto/openpgp/packet/private_key.go b/vendor/golang.org/x/crypto/openpgp/packet/private_key.go deleted file mode 100644 index 192aac376d1a..000000000000 --- a/vendor/golang.org/x/crypto/openpgp/packet/private_key.go +++ /dev/null @@ -1,384 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package packet - -import ( - "bytes" - "crypto" - "crypto/cipher" - "crypto/dsa" - "crypto/ecdsa" - "crypto/rsa" - "crypto/sha1" - "io" - "math/big" - "strconv" - "time" - - "golang.org/x/crypto/openpgp/elgamal" - "golang.org/x/crypto/openpgp/errors" - "golang.org/x/crypto/openpgp/s2k" -) - -// PrivateKey represents a possibly encrypted private key. See RFC 4880, -// section 5.5.3. -type PrivateKey struct { - PublicKey - Encrypted bool // if true then the private key is unavailable until Decrypt has been called. - encryptedData []byte - cipher CipherFunction - s2k func(out, in []byte) - PrivateKey interface{} // An *{rsa|dsa|ecdsa}.PrivateKey or crypto.Signer/crypto.Decrypter (Decryptor RSA only). - sha1Checksum bool - iv []byte -} - -func NewRSAPrivateKey(creationTime time.Time, priv *rsa.PrivateKey) *PrivateKey { - pk := new(PrivateKey) - pk.PublicKey = *NewRSAPublicKey(creationTime, &priv.PublicKey) - pk.PrivateKey = priv - return pk -} - -func NewDSAPrivateKey(creationTime time.Time, priv *dsa.PrivateKey) *PrivateKey { - pk := new(PrivateKey) - pk.PublicKey = *NewDSAPublicKey(creationTime, &priv.PublicKey) - pk.PrivateKey = priv - return pk -} - -func NewElGamalPrivateKey(creationTime time.Time, priv *elgamal.PrivateKey) *PrivateKey { - pk := new(PrivateKey) - pk.PublicKey = *NewElGamalPublicKey(creationTime, &priv.PublicKey) - pk.PrivateKey = priv - return pk -} - -func NewECDSAPrivateKey(creationTime time.Time, priv *ecdsa.PrivateKey) *PrivateKey { - pk := new(PrivateKey) - pk.PublicKey = *NewECDSAPublicKey(creationTime, &priv.PublicKey) - pk.PrivateKey = priv - return pk -} - -// NewSignerPrivateKey creates a PrivateKey from a crypto.Signer that -// implements RSA or ECDSA. -func NewSignerPrivateKey(creationTime time.Time, signer crypto.Signer) *PrivateKey { - pk := new(PrivateKey) - // In general, the public Keys should be used as pointers. We still - // type-switch on the values, for backwards-compatibility. - switch pubkey := signer.Public().(type) { - case *rsa.PublicKey: - pk.PublicKey = *NewRSAPublicKey(creationTime, pubkey) - case rsa.PublicKey: - pk.PublicKey = *NewRSAPublicKey(creationTime, &pubkey) - case *ecdsa.PublicKey: - pk.PublicKey = *NewECDSAPublicKey(creationTime, pubkey) - case ecdsa.PublicKey: - pk.PublicKey = *NewECDSAPublicKey(creationTime, &pubkey) - default: - panic("openpgp: unknown crypto.Signer type in NewSignerPrivateKey") - } - pk.PrivateKey = signer - return pk -} - -func (pk *PrivateKey) parse(r io.Reader) (err error) { - err = (&pk.PublicKey).parse(r) - if err != nil { - return - } - var buf [1]byte - _, err = readFull(r, buf[:]) - if err != nil { - return - } - - s2kType := buf[0] - - switch s2kType { - case 0: - pk.s2k = nil - pk.Encrypted = false - case 254, 255: - _, err = readFull(r, buf[:]) - if err != nil { - return - } - pk.cipher = CipherFunction(buf[0]) - pk.Encrypted = true - pk.s2k, err = s2k.Parse(r) - if err != nil { - return - } - if s2kType == 254 { - pk.sha1Checksum = true - } - default: - return errors.UnsupportedError("deprecated s2k function in private key") - } - - if pk.Encrypted { - blockSize := pk.cipher.blockSize() - if blockSize == 0 { - return errors.UnsupportedError("unsupported cipher in private key: " + strconv.Itoa(int(pk.cipher))) - } - pk.iv = make([]byte, blockSize) - _, err = readFull(r, pk.iv) - if err != nil { - return - } - } - - pk.encryptedData, err = io.ReadAll(r) - if err != nil { - return - } - - if !pk.Encrypted { - return pk.parsePrivateKey(pk.encryptedData) - } - - return -} - -func mod64kHash(d []byte) uint16 { - var h uint16 - for _, b := range d { - h += uint16(b) - } - return h -} - -func (pk *PrivateKey) Serialize(w io.Writer) (err error) { - // TODO(agl): support encrypted private keys - buf := bytes.NewBuffer(nil) - err = pk.PublicKey.serializeWithoutHeaders(buf) - if err != nil { - return - } - buf.WriteByte(0 /* no encryption */) - - privateKeyBuf := bytes.NewBuffer(nil) - - switch priv := pk.PrivateKey.(type) { - case *rsa.PrivateKey: - err = serializeRSAPrivateKey(privateKeyBuf, priv) - case *dsa.PrivateKey: - err = serializeDSAPrivateKey(privateKeyBuf, priv) - case *elgamal.PrivateKey: - err = serializeElGamalPrivateKey(privateKeyBuf, priv) - case *ecdsa.PrivateKey: - err = serializeECDSAPrivateKey(privateKeyBuf, priv) - default: - err = errors.InvalidArgumentError("unknown private key type") - } - if err != nil { - return - } - - ptype := packetTypePrivateKey - contents := buf.Bytes() - privateKeyBytes := privateKeyBuf.Bytes() - if pk.IsSubkey { - ptype = packetTypePrivateSubkey - } - err = serializeHeader(w, ptype, len(contents)+len(privateKeyBytes)+2) - if err != nil { - return - } - _, err = w.Write(contents) - if err != nil { - return - } - _, err = w.Write(privateKeyBytes) - if err != nil { - return - } - - checksum := mod64kHash(privateKeyBytes) - var checksumBytes [2]byte - checksumBytes[0] = byte(checksum >> 8) - checksumBytes[1] = byte(checksum) - _, err = w.Write(checksumBytes[:]) - - return -} - -func serializeRSAPrivateKey(w io.Writer, priv *rsa.PrivateKey) error { - err := writeBig(w, priv.D) - if err != nil { - return err - } - err = writeBig(w, priv.Primes[1]) - if err != nil { - return err - } - err = writeBig(w, priv.Primes[0]) - if err != nil { - return err - } - return writeBig(w, priv.Precomputed.Qinv) -} - -func serializeDSAPrivateKey(w io.Writer, priv *dsa.PrivateKey) error { - return writeBig(w, priv.X) -} - -func serializeElGamalPrivateKey(w io.Writer, priv *elgamal.PrivateKey) error { - return writeBig(w, priv.X) -} - -func serializeECDSAPrivateKey(w io.Writer, priv *ecdsa.PrivateKey) error { - return writeBig(w, priv.D) -} - -// Decrypt decrypts an encrypted private key using a passphrase. -func (pk *PrivateKey) Decrypt(passphrase []byte) error { - if !pk.Encrypted { - return nil - } - - key := make([]byte, pk.cipher.KeySize()) - pk.s2k(key, passphrase) - block := pk.cipher.new(key) - cfb := cipher.NewCFBDecrypter(block, pk.iv) - - data := make([]byte, len(pk.encryptedData)) - cfb.XORKeyStream(data, pk.encryptedData) - - if pk.sha1Checksum { - if len(data) < sha1.Size { - return errors.StructuralError("truncated private key data") - } - h := sha1.New() - h.Write(data[:len(data)-sha1.Size]) - sum := h.Sum(nil) - if !bytes.Equal(sum, data[len(data)-sha1.Size:]) { - return errors.StructuralError("private key checksum failure") - } - data = data[:len(data)-sha1.Size] - } else { - if len(data) < 2 { - return errors.StructuralError("truncated private key data") - } - var sum uint16 - for i := 0; i < len(data)-2; i++ { - sum += uint16(data[i]) - } - if data[len(data)-2] != uint8(sum>>8) || - data[len(data)-1] != uint8(sum) { - return errors.StructuralError("private key checksum failure") - } - data = data[:len(data)-2] - } - - return pk.parsePrivateKey(data) -} - -func (pk *PrivateKey) parsePrivateKey(data []byte) (err error) { - switch pk.PublicKey.PubKeyAlgo { - case PubKeyAlgoRSA, PubKeyAlgoRSASignOnly, PubKeyAlgoRSAEncryptOnly: - return pk.parseRSAPrivateKey(data) - case PubKeyAlgoDSA: - return pk.parseDSAPrivateKey(data) - case PubKeyAlgoElGamal: - return pk.parseElGamalPrivateKey(data) - case PubKeyAlgoECDSA: - return pk.parseECDSAPrivateKey(data) - } - panic("impossible") -} - -func (pk *PrivateKey) parseRSAPrivateKey(data []byte) (err error) { - rsaPub := pk.PublicKey.PublicKey.(*rsa.PublicKey) - rsaPriv := new(rsa.PrivateKey) - rsaPriv.PublicKey = *rsaPub - - buf := bytes.NewBuffer(data) - d, _, err := readMPI(buf) - if err != nil { - return - } - p, _, err := readMPI(buf) - if err != nil { - return - } - q, _, err := readMPI(buf) - if err != nil { - return - } - - rsaPriv.D = new(big.Int).SetBytes(d) - rsaPriv.Primes = make([]*big.Int, 2) - rsaPriv.Primes[0] = new(big.Int).SetBytes(p) - rsaPriv.Primes[1] = new(big.Int).SetBytes(q) - if err := rsaPriv.Validate(); err != nil { - return err - } - rsaPriv.Precompute() - pk.PrivateKey = rsaPriv - pk.Encrypted = false - pk.encryptedData = nil - - return nil -} - -func (pk *PrivateKey) parseDSAPrivateKey(data []byte) (err error) { - dsaPub := pk.PublicKey.PublicKey.(*dsa.PublicKey) - dsaPriv := new(dsa.PrivateKey) - dsaPriv.PublicKey = *dsaPub - - buf := bytes.NewBuffer(data) - x, _, err := readMPI(buf) - if err != nil { - return - } - - dsaPriv.X = new(big.Int).SetBytes(x) - pk.PrivateKey = dsaPriv - pk.Encrypted = false - pk.encryptedData = nil - - return nil -} - -func (pk *PrivateKey) parseElGamalPrivateKey(data []byte) (err error) { - pub := pk.PublicKey.PublicKey.(*elgamal.PublicKey) - priv := new(elgamal.PrivateKey) - priv.PublicKey = *pub - - buf := bytes.NewBuffer(data) - x, _, err := readMPI(buf) - if err != nil { - return - } - - priv.X = new(big.Int).SetBytes(x) - pk.PrivateKey = priv - pk.Encrypted = false - pk.encryptedData = nil - - return nil -} - -func (pk *PrivateKey) parseECDSAPrivateKey(data []byte) (err error) { - ecdsaPub := pk.PublicKey.PublicKey.(*ecdsa.PublicKey) - - buf := bytes.NewBuffer(data) - d, _, err := readMPI(buf) - if err != nil { - return - } - - pk.PrivateKey = &ecdsa.PrivateKey{ - PublicKey: *ecdsaPub, - D: new(big.Int).SetBytes(d), - } - pk.Encrypted = false - pk.encryptedData = nil - - return nil -} diff --git a/vendor/golang.org/x/crypto/openpgp/packet/public_key.go b/vendor/golang.org/x/crypto/openpgp/packet/public_key.go deleted file mode 100644 index fcd5f5251963..000000000000 --- a/vendor/golang.org/x/crypto/openpgp/packet/public_key.go +++ /dev/null @@ -1,753 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package packet - -import ( - "bytes" - "crypto" - "crypto/dsa" - "crypto/ecdsa" - "crypto/elliptic" - "crypto/rsa" - "crypto/sha1" - _ "crypto/sha256" - _ "crypto/sha512" - "encoding/binary" - "fmt" - "hash" - "io" - "math/big" - "strconv" - "time" - - "golang.org/x/crypto/openpgp/elgamal" - "golang.org/x/crypto/openpgp/errors" -) - -var ( - // NIST curve P-256 - oidCurveP256 []byte = []byte{0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01, 0x07} - // NIST curve P-384 - oidCurveP384 []byte = []byte{0x2B, 0x81, 0x04, 0x00, 0x22} - // NIST curve P-521 - oidCurveP521 []byte = []byte{0x2B, 0x81, 0x04, 0x00, 0x23} -) - -const maxOIDLength = 8 - -// ecdsaKey stores the algorithm-specific fields for ECDSA keys. -// as defined in RFC 6637, Section 9. -type ecdsaKey struct { - // oid contains the OID byte sequence identifying the elliptic curve used - oid []byte - // p contains the elliptic curve point that represents the public key - p parsedMPI -} - -// parseOID reads the OID for the curve as defined in RFC 6637, Section 9. -func parseOID(r io.Reader) (oid []byte, err error) { - buf := make([]byte, maxOIDLength) - if _, err = readFull(r, buf[:1]); err != nil { - return - } - oidLen := buf[0] - if int(oidLen) > len(buf) { - err = errors.UnsupportedError("invalid oid length: " + strconv.Itoa(int(oidLen))) - return - } - oid = buf[:oidLen] - _, err = readFull(r, oid) - return -} - -func (f *ecdsaKey) parse(r io.Reader) (err error) { - if f.oid, err = parseOID(r); err != nil { - return err - } - f.p.bytes, f.p.bitLength, err = readMPI(r) - return -} - -func (f *ecdsaKey) serialize(w io.Writer) (err error) { - buf := make([]byte, maxOIDLength+1) - buf[0] = byte(len(f.oid)) - copy(buf[1:], f.oid) - if _, err = w.Write(buf[:len(f.oid)+1]); err != nil { - return - } - return writeMPIs(w, f.p) -} - -func (f *ecdsaKey) newECDSA() (*ecdsa.PublicKey, error) { - var c elliptic.Curve - if bytes.Equal(f.oid, oidCurveP256) { - c = elliptic.P256() - } else if bytes.Equal(f.oid, oidCurveP384) { - c = elliptic.P384() - } else if bytes.Equal(f.oid, oidCurveP521) { - c = elliptic.P521() - } else { - return nil, errors.UnsupportedError(fmt.Sprintf("unsupported oid: %x", f.oid)) - } - x, y := elliptic.Unmarshal(c, f.p.bytes) - if x == nil { - return nil, errors.UnsupportedError("failed to parse EC point") - } - return &ecdsa.PublicKey{Curve: c, X: x, Y: y}, nil -} - -func (f *ecdsaKey) byteLen() int { - return 1 + len(f.oid) + 2 + len(f.p.bytes) -} - -type kdfHashFunction byte -type kdfAlgorithm byte - -// ecdhKdf stores key derivation function parameters -// used for ECDH encryption. See RFC 6637, Section 9. -type ecdhKdf struct { - KdfHash kdfHashFunction - KdfAlgo kdfAlgorithm -} - -func (f *ecdhKdf) parse(r io.Reader) (err error) { - buf := make([]byte, 1) - if _, err = readFull(r, buf); err != nil { - return - } - kdfLen := int(buf[0]) - if kdfLen < 3 { - return errors.UnsupportedError("Unsupported ECDH KDF length: " + strconv.Itoa(kdfLen)) - } - buf = make([]byte, kdfLen) - if _, err = readFull(r, buf); err != nil { - return - } - reserved := int(buf[0]) - f.KdfHash = kdfHashFunction(buf[1]) - f.KdfAlgo = kdfAlgorithm(buf[2]) - if reserved != 0x01 { - return errors.UnsupportedError("Unsupported KDF reserved field: " + strconv.Itoa(reserved)) - } - return -} - -func (f *ecdhKdf) serialize(w io.Writer) (err error) { - buf := make([]byte, 4) - // See RFC 6637, Section 9, Algorithm-Specific Fields for ECDH keys. - buf[0] = byte(0x03) // Length of the following fields - buf[1] = byte(0x01) // Reserved for future extensions, must be 1 for now - buf[2] = byte(f.KdfHash) - buf[3] = byte(f.KdfAlgo) - _, err = w.Write(buf[:]) - return -} - -func (f *ecdhKdf) byteLen() int { - return 4 -} - -// PublicKey represents an OpenPGP public key. See RFC 4880, section 5.5.2. -type PublicKey struct { - CreationTime time.Time - PubKeyAlgo PublicKeyAlgorithm - PublicKey interface{} // *rsa.PublicKey, *dsa.PublicKey or *ecdsa.PublicKey - Fingerprint [20]byte - KeyId uint64 - IsSubkey bool - - n, e, p, q, g, y parsedMPI - - // RFC 6637 fields - ec *ecdsaKey - ecdh *ecdhKdf -} - -// signingKey provides a convenient abstraction over signature verification -// for v3 and v4 public keys. -type signingKey interface { - SerializeSignaturePrefix(io.Writer) - serializeWithoutHeaders(io.Writer) error -} - -func fromBig(n *big.Int) parsedMPI { - return parsedMPI{ - bytes: n.Bytes(), - bitLength: uint16(n.BitLen()), - } -} - -// NewRSAPublicKey returns a PublicKey that wraps the given rsa.PublicKey. -func NewRSAPublicKey(creationTime time.Time, pub *rsa.PublicKey) *PublicKey { - pk := &PublicKey{ - CreationTime: creationTime, - PubKeyAlgo: PubKeyAlgoRSA, - PublicKey: pub, - n: fromBig(pub.N), - e: fromBig(big.NewInt(int64(pub.E))), - } - - pk.setFingerPrintAndKeyId() - return pk -} - -// NewDSAPublicKey returns a PublicKey that wraps the given dsa.PublicKey. -func NewDSAPublicKey(creationTime time.Time, pub *dsa.PublicKey) *PublicKey { - pk := &PublicKey{ - CreationTime: creationTime, - PubKeyAlgo: PubKeyAlgoDSA, - PublicKey: pub, - p: fromBig(pub.P), - q: fromBig(pub.Q), - g: fromBig(pub.G), - y: fromBig(pub.Y), - } - - pk.setFingerPrintAndKeyId() - return pk -} - -// NewElGamalPublicKey returns a PublicKey that wraps the given elgamal.PublicKey. -func NewElGamalPublicKey(creationTime time.Time, pub *elgamal.PublicKey) *PublicKey { - pk := &PublicKey{ - CreationTime: creationTime, - PubKeyAlgo: PubKeyAlgoElGamal, - PublicKey: pub, - p: fromBig(pub.P), - g: fromBig(pub.G), - y: fromBig(pub.Y), - } - - pk.setFingerPrintAndKeyId() - return pk -} - -func NewECDSAPublicKey(creationTime time.Time, pub *ecdsa.PublicKey) *PublicKey { - pk := &PublicKey{ - CreationTime: creationTime, - PubKeyAlgo: PubKeyAlgoECDSA, - PublicKey: pub, - ec: new(ecdsaKey), - } - - switch pub.Curve { - case elliptic.P256(): - pk.ec.oid = oidCurveP256 - case elliptic.P384(): - pk.ec.oid = oidCurveP384 - case elliptic.P521(): - pk.ec.oid = oidCurveP521 - default: - panic("unknown elliptic curve") - } - - pk.ec.p.bytes = elliptic.Marshal(pub.Curve, pub.X, pub.Y) - - // The bit length is 3 (for the 0x04 specifying an uncompressed key) - // plus two field elements (for x and y), which are rounded up to the - // nearest byte. See https://tools.ietf.org/html/rfc6637#section-6 - fieldBytes := (pub.Curve.Params().BitSize + 7) & ^7 - pk.ec.p.bitLength = uint16(3 + fieldBytes + fieldBytes) - - pk.setFingerPrintAndKeyId() - return pk -} - -func (pk *PublicKey) parse(r io.Reader) (err error) { - // RFC 4880, section 5.5.2 - var buf [6]byte - _, err = readFull(r, buf[:]) - if err != nil { - return - } - if buf[0] != 4 { - return errors.UnsupportedError("public key version") - } - pk.CreationTime = time.Unix(int64(uint32(buf[1])<<24|uint32(buf[2])<<16|uint32(buf[3])<<8|uint32(buf[4])), 0) - pk.PubKeyAlgo = PublicKeyAlgorithm(buf[5]) - switch pk.PubKeyAlgo { - case PubKeyAlgoRSA, PubKeyAlgoRSAEncryptOnly, PubKeyAlgoRSASignOnly: - err = pk.parseRSA(r) - case PubKeyAlgoDSA: - err = pk.parseDSA(r) - case PubKeyAlgoElGamal: - err = pk.parseElGamal(r) - case PubKeyAlgoECDSA: - pk.ec = new(ecdsaKey) - if err = pk.ec.parse(r); err != nil { - return err - } - pk.PublicKey, err = pk.ec.newECDSA() - case PubKeyAlgoECDH: - pk.ec = new(ecdsaKey) - if err = pk.ec.parse(r); err != nil { - return - } - pk.ecdh = new(ecdhKdf) - if err = pk.ecdh.parse(r); err != nil { - return - } - // The ECDH key is stored in an ecdsa.PublicKey for convenience. - pk.PublicKey, err = pk.ec.newECDSA() - default: - err = errors.UnsupportedError("public key type: " + strconv.Itoa(int(pk.PubKeyAlgo))) - } - if err != nil { - return - } - - pk.setFingerPrintAndKeyId() - return -} - -func (pk *PublicKey) setFingerPrintAndKeyId() { - // RFC 4880, section 12.2 - fingerPrint := sha1.New() - pk.SerializeSignaturePrefix(fingerPrint) - pk.serializeWithoutHeaders(fingerPrint) - copy(pk.Fingerprint[:], fingerPrint.Sum(nil)) - pk.KeyId = binary.BigEndian.Uint64(pk.Fingerprint[12:20]) -} - -// parseRSA parses RSA public key material from the given Reader. See RFC 4880, -// section 5.5.2. -func (pk *PublicKey) parseRSA(r io.Reader) (err error) { - pk.n.bytes, pk.n.bitLength, err = readMPI(r) - if err != nil { - return - } - pk.e.bytes, pk.e.bitLength, err = readMPI(r) - if err != nil { - return - } - - if len(pk.e.bytes) > 3 { - err = errors.UnsupportedError("large public exponent") - return - } - rsa := &rsa.PublicKey{ - N: new(big.Int).SetBytes(pk.n.bytes), - E: 0, - } - for i := 0; i < len(pk.e.bytes); i++ { - rsa.E <<= 8 - rsa.E |= int(pk.e.bytes[i]) - } - pk.PublicKey = rsa - return -} - -// parseDSA parses DSA public key material from the given Reader. See RFC 4880, -// section 5.5.2. -func (pk *PublicKey) parseDSA(r io.Reader) (err error) { - pk.p.bytes, pk.p.bitLength, err = readMPI(r) - if err != nil { - return - } - pk.q.bytes, pk.q.bitLength, err = readMPI(r) - if err != nil { - return - } - pk.g.bytes, pk.g.bitLength, err = readMPI(r) - if err != nil { - return - } - pk.y.bytes, pk.y.bitLength, err = readMPI(r) - if err != nil { - return - } - - dsa := new(dsa.PublicKey) - dsa.P = new(big.Int).SetBytes(pk.p.bytes) - dsa.Q = new(big.Int).SetBytes(pk.q.bytes) - dsa.G = new(big.Int).SetBytes(pk.g.bytes) - dsa.Y = new(big.Int).SetBytes(pk.y.bytes) - pk.PublicKey = dsa - return -} - -// parseElGamal parses ElGamal public key material from the given Reader. See -// RFC 4880, section 5.5.2. -func (pk *PublicKey) parseElGamal(r io.Reader) (err error) { - pk.p.bytes, pk.p.bitLength, err = readMPI(r) - if err != nil { - return - } - pk.g.bytes, pk.g.bitLength, err = readMPI(r) - if err != nil { - return - } - pk.y.bytes, pk.y.bitLength, err = readMPI(r) - if err != nil { - return - } - - elgamal := new(elgamal.PublicKey) - elgamal.P = new(big.Int).SetBytes(pk.p.bytes) - elgamal.G = new(big.Int).SetBytes(pk.g.bytes) - elgamal.Y = new(big.Int).SetBytes(pk.y.bytes) - pk.PublicKey = elgamal - return -} - -// SerializeSignaturePrefix writes the prefix for this public key to the given Writer. -// The prefix is used when calculating a signature over this public key. See -// RFC 4880, section 5.2.4. -func (pk *PublicKey) SerializeSignaturePrefix(h io.Writer) { - var pLength uint16 - switch pk.PubKeyAlgo { - case PubKeyAlgoRSA, PubKeyAlgoRSAEncryptOnly, PubKeyAlgoRSASignOnly: - pLength += 2 + uint16(len(pk.n.bytes)) - pLength += 2 + uint16(len(pk.e.bytes)) - case PubKeyAlgoDSA: - pLength += 2 + uint16(len(pk.p.bytes)) - pLength += 2 + uint16(len(pk.q.bytes)) - pLength += 2 + uint16(len(pk.g.bytes)) - pLength += 2 + uint16(len(pk.y.bytes)) - case PubKeyAlgoElGamal: - pLength += 2 + uint16(len(pk.p.bytes)) - pLength += 2 + uint16(len(pk.g.bytes)) - pLength += 2 + uint16(len(pk.y.bytes)) - case PubKeyAlgoECDSA: - pLength += uint16(pk.ec.byteLen()) - case PubKeyAlgoECDH: - pLength += uint16(pk.ec.byteLen()) - pLength += uint16(pk.ecdh.byteLen()) - default: - panic("unknown public key algorithm") - } - pLength += 6 - h.Write([]byte{0x99, byte(pLength >> 8), byte(pLength)}) - return -} - -func (pk *PublicKey) Serialize(w io.Writer) (err error) { - length := 6 // 6 byte header - - switch pk.PubKeyAlgo { - case PubKeyAlgoRSA, PubKeyAlgoRSAEncryptOnly, PubKeyAlgoRSASignOnly: - length += 2 + len(pk.n.bytes) - length += 2 + len(pk.e.bytes) - case PubKeyAlgoDSA: - length += 2 + len(pk.p.bytes) - length += 2 + len(pk.q.bytes) - length += 2 + len(pk.g.bytes) - length += 2 + len(pk.y.bytes) - case PubKeyAlgoElGamal: - length += 2 + len(pk.p.bytes) - length += 2 + len(pk.g.bytes) - length += 2 + len(pk.y.bytes) - case PubKeyAlgoECDSA: - length += pk.ec.byteLen() - case PubKeyAlgoECDH: - length += pk.ec.byteLen() - length += pk.ecdh.byteLen() - default: - panic("unknown public key algorithm") - } - - packetType := packetTypePublicKey - if pk.IsSubkey { - packetType = packetTypePublicSubkey - } - err = serializeHeader(w, packetType, length) - if err != nil { - return - } - return pk.serializeWithoutHeaders(w) -} - -// serializeWithoutHeaders marshals the PublicKey to w in the form of an -// OpenPGP public key packet, not including the packet header. -func (pk *PublicKey) serializeWithoutHeaders(w io.Writer) (err error) { - var buf [6]byte - buf[0] = 4 - t := uint32(pk.CreationTime.Unix()) - buf[1] = byte(t >> 24) - buf[2] = byte(t >> 16) - buf[3] = byte(t >> 8) - buf[4] = byte(t) - buf[5] = byte(pk.PubKeyAlgo) - - _, err = w.Write(buf[:]) - if err != nil { - return - } - - switch pk.PubKeyAlgo { - case PubKeyAlgoRSA, PubKeyAlgoRSAEncryptOnly, PubKeyAlgoRSASignOnly: - return writeMPIs(w, pk.n, pk.e) - case PubKeyAlgoDSA: - return writeMPIs(w, pk.p, pk.q, pk.g, pk.y) - case PubKeyAlgoElGamal: - return writeMPIs(w, pk.p, pk.g, pk.y) - case PubKeyAlgoECDSA: - return pk.ec.serialize(w) - case PubKeyAlgoECDH: - if err = pk.ec.serialize(w); err != nil { - return - } - return pk.ecdh.serialize(w) - } - return errors.InvalidArgumentError("bad public-key algorithm") -} - -// CanSign returns true iff this public key can generate signatures -func (pk *PublicKey) CanSign() bool { - return pk.PubKeyAlgo != PubKeyAlgoRSAEncryptOnly && pk.PubKeyAlgo != PubKeyAlgoElGamal -} - -// VerifySignature returns nil iff sig is a valid signature, made by this -// public key, of the data hashed into signed. signed is mutated by this call. -func (pk *PublicKey) VerifySignature(signed hash.Hash, sig *Signature) (err error) { - if !pk.CanSign() { - return errors.InvalidArgumentError("public key cannot generate signatures") - } - - signed.Write(sig.HashSuffix) - hashBytes := signed.Sum(nil) - - if hashBytes[0] != sig.HashTag[0] || hashBytes[1] != sig.HashTag[1] { - return errors.SignatureError("hash tag doesn't match") - } - - if pk.PubKeyAlgo != sig.PubKeyAlgo { - return errors.InvalidArgumentError("public key and signature use different algorithms") - } - - switch pk.PubKeyAlgo { - case PubKeyAlgoRSA, PubKeyAlgoRSASignOnly: - rsaPublicKey, _ := pk.PublicKey.(*rsa.PublicKey) - err = rsa.VerifyPKCS1v15(rsaPublicKey, sig.Hash, hashBytes, padToKeySize(rsaPublicKey, sig.RSASignature.bytes)) - if err != nil { - return errors.SignatureError("RSA verification failure") - } - return nil - case PubKeyAlgoDSA: - dsaPublicKey, _ := pk.PublicKey.(*dsa.PublicKey) - // Need to truncate hashBytes to match FIPS 186-3 section 4.6. - subgroupSize := (dsaPublicKey.Q.BitLen() + 7) / 8 - if len(hashBytes) > subgroupSize { - hashBytes = hashBytes[:subgroupSize] - } - if !dsa.Verify(dsaPublicKey, hashBytes, new(big.Int).SetBytes(sig.DSASigR.bytes), new(big.Int).SetBytes(sig.DSASigS.bytes)) { - return errors.SignatureError("DSA verification failure") - } - return nil - case PubKeyAlgoECDSA: - ecdsaPublicKey := pk.PublicKey.(*ecdsa.PublicKey) - if !ecdsa.Verify(ecdsaPublicKey, hashBytes, new(big.Int).SetBytes(sig.ECDSASigR.bytes), new(big.Int).SetBytes(sig.ECDSASigS.bytes)) { - return errors.SignatureError("ECDSA verification failure") - } - return nil - default: - return errors.SignatureError("Unsupported public key algorithm used in signature") - } -} - -// VerifySignatureV3 returns nil iff sig is a valid signature, made by this -// public key, of the data hashed into signed. signed is mutated by this call. -func (pk *PublicKey) VerifySignatureV3(signed hash.Hash, sig *SignatureV3) (err error) { - if !pk.CanSign() { - return errors.InvalidArgumentError("public key cannot generate signatures") - } - - suffix := make([]byte, 5) - suffix[0] = byte(sig.SigType) - binary.BigEndian.PutUint32(suffix[1:], uint32(sig.CreationTime.Unix())) - signed.Write(suffix) - hashBytes := signed.Sum(nil) - - if hashBytes[0] != sig.HashTag[0] || hashBytes[1] != sig.HashTag[1] { - return errors.SignatureError("hash tag doesn't match") - } - - if pk.PubKeyAlgo != sig.PubKeyAlgo { - return errors.InvalidArgumentError("public key and signature use different algorithms") - } - - switch pk.PubKeyAlgo { - case PubKeyAlgoRSA, PubKeyAlgoRSASignOnly: - rsaPublicKey := pk.PublicKey.(*rsa.PublicKey) - if err = rsa.VerifyPKCS1v15(rsaPublicKey, sig.Hash, hashBytes, padToKeySize(rsaPublicKey, sig.RSASignature.bytes)); err != nil { - return errors.SignatureError("RSA verification failure") - } - return - case PubKeyAlgoDSA: - dsaPublicKey := pk.PublicKey.(*dsa.PublicKey) - // Need to truncate hashBytes to match FIPS 186-3 section 4.6. - subgroupSize := (dsaPublicKey.Q.BitLen() + 7) / 8 - if len(hashBytes) > subgroupSize { - hashBytes = hashBytes[:subgroupSize] - } - if !dsa.Verify(dsaPublicKey, hashBytes, new(big.Int).SetBytes(sig.DSASigR.bytes), new(big.Int).SetBytes(sig.DSASigS.bytes)) { - return errors.SignatureError("DSA verification failure") - } - return nil - default: - panic("shouldn't happen") - } -} - -// keySignatureHash returns a Hash of the message that needs to be signed for -// pk to assert a subkey relationship to signed. -func keySignatureHash(pk, signed signingKey, hashFunc crypto.Hash) (h hash.Hash, err error) { - if !hashFunc.Available() { - return nil, errors.UnsupportedError("hash function") - } - h = hashFunc.New() - - // RFC 4880, section 5.2.4 - pk.SerializeSignaturePrefix(h) - pk.serializeWithoutHeaders(h) - signed.SerializeSignaturePrefix(h) - signed.serializeWithoutHeaders(h) - return -} - -// VerifyKeySignature returns nil iff sig is a valid signature, made by this -// public key, of signed. -func (pk *PublicKey) VerifyKeySignature(signed *PublicKey, sig *Signature) error { - h, err := keySignatureHash(pk, signed, sig.Hash) - if err != nil { - return err - } - if err = pk.VerifySignature(h, sig); err != nil { - return err - } - - if sig.FlagSign { - // Signing subkeys must be cross-signed. See - // https://www.gnupg.org/faq/subkey-cross-certify.html. - if sig.EmbeddedSignature == nil { - return errors.StructuralError("signing subkey is missing cross-signature") - } - // Verify the cross-signature. This is calculated over the same - // data as the main signature, so we cannot just recursively - // call signed.VerifyKeySignature(...) - if h, err = keySignatureHash(pk, signed, sig.EmbeddedSignature.Hash); err != nil { - return errors.StructuralError("error while hashing for cross-signature: " + err.Error()) - } - if err := signed.VerifySignature(h, sig.EmbeddedSignature); err != nil { - return errors.StructuralError("error while verifying cross-signature: " + err.Error()) - } - } - - return nil -} - -func keyRevocationHash(pk signingKey, hashFunc crypto.Hash) (h hash.Hash, err error) { - if !hashFunc.Available() { - return nil, errors.UnsupportedError("hash function") - } - h = hashFunc.New() - - // RFC 4880, section 5.2.4 - pk.SerializeSignaturePrefix(h) - pk.serializeWithoutHeaders(h) - - return -} - -// VerifyRevocationSignature returns nil iff sig is a valid signature, made by this -// public key. -func (pk *PublicKey) VerifyRevocationSignature(sig *Signature) (err error) { - h, err := keyRevocationHash(pk, sig.Hash) - if err != nil { - return err - } - return pk.VerifySignature(h, sig) -} - -// userIdSignatureHash returns a Hash of the message that needs to be signed -// to assert that pk is a valid key for id. -func userIdSignatureHash(id string, pk *PublicKey, hashFunc crypto.Hash) (h hash.Hash, err error) { - if !hashFunc.Available() { - return nil, errors.UnsupportedError("hash function") - } - h = hashFunc.New() - - // RFC 4880, section 5.2.4 - pk.SerializeSignaturePrefix(h) - pk.serializeWithoutHeaders(h) - - var buf [5]byte - buf[0] = 0xb4 - buf[1] = byte(len(id) >> 24) - buf[2] = byte(len(id) >> 16) - buf[3] = byte(len(id) >> 8) - buf[4] = byte(len(id)) - h.Write(buf[:]) - h.Write([]byte(id)) - - return -} - -// VerifyUserIdSignature returns nil iff sig is a valid signature, made by this -// public key, that id is the identity of pub. -func (pk *PublicKey) VerifyUserIdSignature(id string, pub *PublicKey, sig *Signature) (err error) { - h, err := userIdSignatureHash(id, pub, sig.Hash) - if err != nil { - return err - } - return pk.VerifySignature(h, sig) -} - -// VerifyUserIdSignatureV3 returns nil iff sig is a valid signature, made by this -// public key, that id is the identity of pub. -func (pk *PublicKey) VerifyUserIdSignatureV3(id string, pub *PublicKey, sig *SignatureV3) (err error) { - h, err := userIdSignatureV3Hash(id, pub, sig.Hash) - if err != nil { - return err - } - return pk.VerifySignatureV3(h, sig) -} - -// KeyIdString returns the public key's fingerprint in capital hex -// (e.g. "6C7EE1B8621CC013"). -func (pk *PublicKey) KeyIdString() string { - return fmt.Sprintf("%X", pk.Fingerprint[12:20]) -} - -// KeyIdShortString returns the short form of public key's fingerprint -// in capital hex, as shown by gpg --list-keys (e.g. "621CC013"). -func (pk *PublicKey) KeyIdShortString() string { - return fmt.Sprintf("%X", pk.Fingerprint[16:20]) -} - -// A parsedMPI is used to store the contents of a big integer, along with the -// bit length that was specified in the original input. This allows the MPI to -// be reserialized exactly. -type parsedMPI struct { - bytes []byte - bitLength uint16 -} - -// writeMPIs is a utility function for serializing several big integers to the -// given Writer. -func writeMPIs(w io.Writer, mpis ...parsedMPI) (err error) { - for _, mpi := range mpis { - err = writeMPI(w, mpi.bitLength, mpi.bytes) - if err != nil { - return - } - } - return -} - -// BitLength returns the bit length for the given public key. -func (pk *PublicKey) BitLength() (bitLength uint16, err error) { - switch pk.PubKeyAlgo { - case PubKeyAlgoRSA, PubKeyAlgoRSAEncryptOnly, PubKeyAlgoRSASignOnly: - bitLength = pk.n.bitLength - case PubKeyAlgoDSA: - bitLength = pk.p.bitLength - case PubKeyAlgoElGamal: - bitLength = pk.p.bitLength - default: - err = errors.InvalidArgumentError("bad public-key algorithm") - } - return -} diff --git a/vendor/golang.org/x/crypto/openpgp/packet/public_key_v3.go b/vendor/golang.org/x/crypto/openpgp/packet/public_key_v3.go deleted file mode 100644 index 5daf7b6cfd4a..000000000000 --- a/vendor/golang.org/x/crypto/openpgp/packet/public_key_v3.go +++ /dev/null @@ -1,279 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package packet - -import ( - "crypto" - "crypto/md5" - "crypto/rsa" - "encoding/binary" - "fmt" - "hash" - "io" - "math/big" - "strconv" - "time" - - "golang.org/x/crypto/openpgp/errors" -) - -// PublicKeyV3 represents older, version 3 public keys. These keys are less secure and -// should not be used for signing or encrypting. They are supported here only for -// parsing version 3 key material and validating signatures. -// See RFC 4880, section 5.5.2. -type PublicKeyV3 struct { - CreationTime time.Time - DaysToExpire uint16 - PubKeyAlgo PublicKeyAlgorithm - PublicKey *rsa.PublicKey - Fingerprint [16]byte - KeyId uint64 - IsSubkey bool - - n, e parsedMPI -} - -// newRSAPublicKeyV3 returns a PublicKey that wraps the given rsa.PublicKey. -// Included here for testing purposes only. RFC 4880, section 5.5.2: -// "an implementation MUST NOT generate a V3 key, but MAY accept it." -func newRSAPublicKeyV3(creationTime time.Time, pub *rsa.PublicKey) *PublicKeyV3 { - pk := &PublicKeyV3{ - CreationTime: creationTime, - PublicKey: pub, - n: fromBig(pub.N), - e: fromBig(big.NewInt(int64(pub.E))), - } - - pk.setFingerPrintAndKeyId() - return pk -} - -func (pk *PublicKeyV3) parse(r io.Reader) (err error) { - // RFC 4880, section 5.5.2 - var buf [8]byte - if _, err = readFull(r, buf[:]); err != nil { - return - } - if buf[0] < 2 || buf[0] > 3 { - return errors.UnsupportedError("public key version") - } - pk.CreationTime = time.Unix(int64(uint32(buf[1])<<24|uint32(buf[2])<<16|uint32(buf[3])<<8|uint32(buf[4])), 0) - pk.DaysToExpire = binary.BigEndian.Uint16(buf[5:7]) - pk.PubKeyAlgo = PublicKeyAlgorithm(buf[7]) - switch pk.PubKeyAlgo { - case PubKeyAlgoRSA, PubKeyAlgoRSAEncryptOnly, PubKeyAlgoRSASignOnly: - err = pk.parseRSA(r) - default: - err = errors.UnsupportedError("public key type: " + strconv.Itoa(int(pk.PubKeyAlgo))) - } - if err != nil { - return - } - - pk.setFingerPrintAndKeyId() - return -} - -func (pk *PublicKeyV3) setFingerPrintAndKeyId() { - // RFC 4880, section 12.2 - fingerPrint := md5.New() - fingerPrint.Write(pk.n.bytes) - fingerPrint.Write(pk.e.bytes) - fingerPrint.Sum(pk.Fingerprint[:0]) - pk.KeyId = binary.BigEndian.Uint64(pk.n.bytes[len(pk.n.bytes)-8:]) -} - -// parseRSA parses RSA public key material from the given Reader. See RFC 4880, -// section 5.5.2. -func (pk *PublicKeyV3) parseRSA(r io.Reader) (err error) { - if pk.n.bytes, pk.n.bitLength, err = readMPI(r); err != nil { - return - } - if pk.e.bytes, pk.e.bitLength, err = readMPI(r); err != nil { - return - } - - // RFC 4880 Section 12.2 requires the low 8 bytes of the - // modulus to form the key id. - if len(pk.n.bytes) < 8 { - return errors.StructuralError("v3 public key modulus is too short") - } - if len(pk.e.bytes) > 3 { - err = errors.UnsupportedError("large public exponent") - return - } - rsa := &rsa.PublicKey{N: new(big.Int).SetBytes(pk.n.bytes)} - for i := 0; i < len(pk.e.bytes); i++ { - rsa.E <<= 8 - rsa.E |= int(pk.e.bytes[i]) - } - pk.PublicKey = rsa - return -} - -// SerializeSignaturePrefix writes the prefix for this public key to the given Writer. -// The prefix is used when calculating a signature over this public key. See -// RFC 4880, section 5.2.4. -func (pk *PublicKeyV3) SerializeSignaturePrefix(w io.Writer) { - var pLength uint16 - switch pk.PubKeyAlgo { - case PubKeyAlgoRSA, PubKeyAlgoRSAEncryptOnly, PubKeyAlgoRSASignOnly: - pLength += 2 + uint16(len(pk.n.bytes)) - pLength += 2 + uint16(len(pk.e.bytes)) - default: - panic("unknown public key algorithm") - } - pLength += 6 - w.Write([]byte{0x99, byte(pLength >> 8), byte(pLength)}) - return -} - -func (pk *PublicKeyV3) Serialize(w io.Writer) (err error) { - length := 8 // 8 byte header - - switch pk.PubKeyAlgo { - case PubKeyAlgoRSA, PubKeyAlgoRSAEncryptOnly, PubKeyAlgoRSASignOnly: - length += 2 + len(pk.n.bytes) - length += 2 + len(pk.e.bytes) - default: - panic("unknown public key algorithm") - } - - packetType := packetTypePublicKey - if pk.IsSubkey { - packetType = packetTypePublicSubkey - } - if err = serializeHeader(w, packetType, length); err != nil { - return - } - return pk.serializeWithoutHeaders(w) -} - -// serializeWithoutHeaders marshals the PublicKey to w in the form of an -// OpenPGP public key packet, not including the packet header. -func (pk *PublicKeyV3) serializeWithoutHeaders(w io.Writer) (err error) { - var buf [8]byte - // Version 3 - buf[0] = 3 - // Creation time - t := uint32(pk.CreationTime.Unix()) - buf[1] = byte(t >> 24) - buf[2] = byte(t >> 16) - buf[3] = byte(t >> 8) - buf[4] = byte(t) - // Days to expire - buf[5] = byte(pk.DaysToExpire >> 8) - buf[6] = byte(pk.DaysToExpire) - // Public key algorithm - buf[7] = byte(pk.PubKeyAlgo) - - if _, err = w.Write(buf[:]); err != nil { - return - } - - switch pk.PubKeyAlgo { - case PubKeyAlgoRSA, PubKeyAlgoRSAEncryptOnly, PubKeyAlgoRSASignOnly: - return writeMPIs(w, pk.n, pk.e) - } - return errors.InvalidArgumentError("bad public-key algorithm") -} - -// CanSign returns true iff this public key can generate signatures -func (pk *PublicKeyV3) CanSign() bool { - return pk.PubKeyAlgo != PubKeyAlgoRSAEncryptOnly -} - -// VerifySignatureV3 returns nil iff sig is a valid signature, made by this -// public key, of the data hashed into signed. signed is mutated by this call. -func (pk *PublicKeyV3) VerifySignatureV3(signed hash.Hash, sig *SignatureV3) (err error) { - if !pk.CanSign() { - return errors.InvalidArgumentError("public key cannot generate signatures") - } - - suffix := make([]byte, 5) - suffix[0] = byte(sig.SigType) - binary.BigEndian.PutUint32(suffix[1:], uint32(sig.CreationTime.Unix())) - signed.Write(suffix) - hashBytes := signed.Sum(nil) - - if hashBytes[0] != sig.HashTag[0] || hashBytes[1] != sig.HashTag[1] { - return errors.SignatureError("hash tag doesn't match") - } - - if pk.PubKeyAlgo != sig.PubKeyAlgo { - return errors.InvalidArgumentError("public key and signature use different algorithms") - } - - switch pk.PubKeyAlgo { - case PubKeyAlgoRSA, PubKeyAlgoRSASignOnly: - if err = rsa.VerifyPKCS1v15(pk.PublicKey, sig.Hash, hashBytes, sig.RSASignature.bytes); err != nil { - return errors.SignatureError("RSA verification failure") - } - return - default: - // V3 public keys only support RSA. - panic("shouldn't happen") - } -} - -// VerifyUserIdSignatureV3 returns nil iff sig is a valid signature, made by this -// public key, that id is the identity of pub. -func (pk *PublicKeyV3) VerifyUserIdSignatureV3(id string, pub *PublicKeyV3, sig *SignatureV3) (err error) { - h, err := userIdSignatureV3Hash(id, pk, sig.Hash) - if err != nil { - return err - } - return pk.VerifySignatureV3(h, sig) -} - -// VerifyKeySignatureV3 returns nil iff sig is a valid signature, made by this -// public key, of signed. -func (pk *PublicKeyV3) VerifyKeySignatureV3(signed *PublicKeyV3, sig *SignatureV3) (err error) { - h, err := keySignatureHash(pk, signed, sig.Hash) - if err != nil { - return err - } - return pk.VerifySignatureV3(h, sig) -} - -// userIdSignatureV3Hash returns a Hash of the message that needs to be signed -// to assert that pk is a valid key for id. -func userIdSignatureV3Hash(id string, pk signingKey, hfn crypto.Hash) (h hash.Hash, err error) { - if !hfn.Available() { - return nil, errors.UnsupportedError("hash function") - } - h = hfn.New() - - // RFC 4880, section 5.2.4 - pk.SerializeSignaturePrefix(h) - pk.serializeWithoutHeaders(h) - - h.Write([]byte(id)) - - return -} - -// KeyIdString returns the public key's fingerprint in capital hex -// (e.g. "6C7EE1B8621CC013"). -func (pk *PublicKeyV3) KeyIdString() string { - return fmt.Sprintf("%X", pk.KeyId) -} - -// KeyIdShortString returns the short form of public key's fingerprint -// in capital hex, as shown by gpg --list-keys (e.g. "621CC013"). -func (pk *PublicKeyV3) KeyIdShortString() string { - return fmt.Sprintf("%X", pk.KeyId&0xFFFFFFFF) -} - -// BitLength returns the bit length for the given public key. -func (pk *PublicKeyV3) BitLength() (bitLength uint16, err error) { - switch pk.PubKeyAlgo { - case PubKeyAlgoRSA, PubKeyAlgoRSAEncryptOnly, PubKeyAlgoRSASignOnly: - bitLength = pk.n.bitLength - default: - err = errors.InvalidArgumentError("bad public-key algorithm") - } - return -} diff --git a/vendor/golang.org/x/crypto/openpgp/packet/reader.go b/vendor/golang.org/x/crypto/openpgp/packet/reader.go deleted file mode 100644 index 34bc7c613e6e..000000000000 --- a/vendor/golang.org/x/crypto/openpgp/packet/reader.go +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package packet - -import ( - "golang.org/x/crypto/openpgp/errors" - "io" -) - -// Reader reads packets from an io.Reader and allows packets to be 'unread' so -// that they result from the next call to Next. -type Reader struct { - q []Packet - readers []io.Reader -} - -// New io.Readers are pushed when a compressed or encrypted packet is processed -// and recursively treated as a new source of packets. However, a carefully -// crafted packet can trigger an infinite recursive sequence of packets. See -// http://mumble.net/~campbell/misc/pgp-quine -// https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2013-4402 -// This constant limits the number of recursive packets that may be pushed. -const maxReaders = 32 - -// Next returns the most recently unread Packet, or reads another packet from -// the top-most io.Reader. Unknown packet types are skipped. -func (r *Reader) Next() (p Packet, err error) { - if len(r.q) > 0 { - p = r.q[len(r.q)-1] - r.q = r.q[:len(r.q)-1] - return - } - - for len(r.readers) > 0 { - p, err = Read(r.readers[len(r.readers)-1]) - if err == nil { - return - } - if err == io.EOF { - r.readers = r.readers[:len(r.readers)-1] - continue - } - if _, ok := err.(errors.UnknownPacketTypeError); !ok { - return nil, err - } - } - - return nil, io.EOF -} - -// Push causes the Reader to start reading from a new io.Reader. When an EOF -// error is seen from the new io.Reader, it is popped and the Reader continues -// to read from the next most recent io.Reader. Push returns a StructuralError -// if pushing the reader would exceed the maximum recursion level, otherwise it -// returns nil. -func (r *Reader) Push(reader io.Reader) (err error) { - if len(r.readers) >= maxReaders { - return errors.StructuralError("too many layers of packets") - } - r.readers = append(r.readers, reader) - return nil -} - -// Unread causes the given Packet to be returned from the next call to Next. -func (r *Reader) Unread(p Packet) { - r.q = append(r.q, p) -} - -func NewReader(r io.Reader) *Reader { - return &Reader{ - q: nil, - readers: []io.Reader{r}, - } -} diff --git a/vendor/golang.org/x/crypto/openpgp/packet/signature.go b/vendor/golang.org/x/crypto/openpgp/packet/signature.go deleted file mode 100644 index b2a24a532327..000000000000 --- a/vendor/golang.org/x/crypto/openpgp/packet/signature.go +++ /dev/null @@ -1,731 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package packet - -import ( - "bytes" - "crypto" - "crypto/dsa" - "crypto/ecdsa" - "encoding/asn1" - "encoding/binary" - "hash" - "io" - "math/big" - "strconv" - "time" - - "golang.org/x/crypto/openpgp/errors" - "golang.org/x/crypto/openpgp/s2k" -) - -const ( - // See RFC 4880, section 5.2.3.21 for details. - KeyFlagCertify = 1 << iota - KeyFlagSign - KeyFlagEncryptCommunications - KeyFlagEncryptStorage -) - -// Signature represents a signature. See RFC 4880, section 5.2. -type Signature struct { - SigType SignatureType - PubKeyAlgo PublicKeyAlgorithm - Hash crypto.Hash - - // HashSuffix is extra data that is hashed in after the signed data. - HashSuffix []byte - // HashTag contains the first two bytes of the hash for fast rejection - // of bad signed data. - HashTag [2]byte - CreationTime time.Time - - RSASignature parsedMPI - DSASigR, DSASigS parsedMPI - ECDSASigR, ECDSASigS parsedMPI - - // rawSubpackets contains the unparsed subpackets, in order. - rawSubpackets []outputSubpacket - - // The following are optional so are nil when not included in the - // signature. - - SigLifetimeSecs, KeyLifetimeSecs *uint32 - PreferredSymmetric, PreferredHash, PreferredCompression []uint8 - IssuerKeyId *uint64 - IsPrimaryId *bool - - // FlagsValid is set if any flags were given. See RFC 4880, section - // 5.2.3.21 for details. - FlagsValid bool - FlagCertify, FlagSign, FlagEncryptCommunications, FlagEncryptStorage bool - - // RevocationReason is set if this signature has been revoked. - // See RFC 4880, section 5.2.3.23 for details. - RevocationReason *uint8 - RevocationReasonText string - - // MDC is set if this signature has a feature packet that indicates - // support for MDC subpackets. - MDC bool - - // EmbeddedSignature, if non-nil, is a signature of the parent key, by - // this key. This prevents an attacker from claiming another's signing - // subkey as their own. - EmbeddedSignature *Signature - - outSubpackets []outputSubpacket -} - -func (sig *Signature) parse(r io.Reader) (err error) { - // RFC 4880, section 5.2.3 - var buf [5]byte - _, err = readFull(r, buf[:1]) - if err != nil { - return - } - if buf[0] != 4 { - err = errors.UnsupportedError("signature packet version " + strconv.Itoa(int(buf[0]))) - return - } - - _, err = readFull(r, buf[:5]) - if err != nil { - return - } - sig.SigType = SignatureType(buf[0]) - sig.PubKeyAlgo = PublicKeyAlgorithm(buf[1]) - switch sig.PubKeyAlgo { - case PubKeyAlgoRSA, PubKeyAlgoRSASignOnly, PubKeyAlgoDSA, PubKeyAlgoECDSA: - default: - err = errors.UnsupportedError("public key algorithm " + strconv.Itoa(int(sig.PubKeyAlgo))) - return - } - - var ok bool - sig.Hash, ok = s2k.HashIdToHash(buf[2]) - if !ok { - return errors.UnsupportedError("hash function " + strconv.Itoa(int(buf[2]))) - } - - hashedSubpacketsLength := int(buf[3])<<8 | int(buf[4]) - l := 6 + hashedSubpacketsLength - sig.HashSuffix = make([]byte, l+6) - sig.HashSuffix[0] = 4 - copy(sig.HashSuffix[1:], buf[:5]) - hashedSubpackets := sig.HashSuffix[6:l] - _, err = readFull(r, hashedSubpackets) - if err != nil { - return - } - // See RFC 4880, section 5.2.4 - trailer := sig.HashSuffix[l:] - trailer[0] = 4 - trailer[1] = 0xff - trailer[2] = uint8(l >> 24) - trailer[3] = uint8(l >> 16) - trailer[4] = uint8(l >> 8) - trailer[5] = uint8(l) - - err = parseSignatureSubpackets(sig, hashedSubpackets, true) - if err != nil { - return - } - - _, err = readFull(r, buf[:2]) - if err != nil { - return - } - unhashedSubpacketsLength := int(buf[0])<<8 | int(buf[1]) - unhashedSubpackets := make([]byte, unhashedSubpacketsLength) - _, err = readFull(r, unhashedSubpackets) - if err != nil { - return - } - err = parseSignatureSubpackets(sig, unhashedSubpackets, false) - if err != nil { - return - } - - _, err = readFull(r, sig.HashTag[:2]) - if err != nil { - return - } - - switch sig.PubKeyAlgo { - case PubKeyAlgoRSA, PubKeyAlgoRSASignOnly: - sig.RSASignature.bytes, sig.RSASignature.bitLength, err = readMPI(r) - case PubKeyAlgoDSA: - sig.DSASigR.bytes, sig.DSASigR.bitLength, err = readMPI(r) - if err == nil { - sig.DSASigS.bytes, sig.DSASigS.bitLength, err = readMPI(r) - } - case PubKeyAlgoECDSA: - sig.ECDSASigR.bytes, sig.ECDSASigR.bitLength, err = readMPI(r) - if err == nil { - sig.ECDSASigS.bytes, sig.ECDSASigS.bitLength, err = readMPI(r) - } - default: - panic("unreachable") - } - return -} - -// parseSignatureSubpackets parses subpackets of the main signature packet. See -// RFC 4880, section 5.2.3.1. -func parseSignatureSubpackets(sig *Signature, subpackets []byte, isHashed bool) (err error) { - for len(subpackets) > 0 { - subpackets, err = parseSignatureSubpacket(sig, subpackets, isHashed) - if err != nil { - return - } - } - - if sig.CreationTime.IsZero() { - err = errors.StructuralError("no creation time in signature") - } - - return -} - -type signatureSubpacketType uint8 - -const ( - creationTimeSubpacket signatureSubpacketType = 2 - signatureExpirationSubpacket signatureSubpacketType = 3 - keyExpirationSubpacket signatureSubpacketType = 9 - prefSymmetricAlgosSubpacket signatureSubpacketType = 11 - issuerSubpacket signatureSubpacketType = 16 - prefHashAlgosSubpacket signatureSubpacketType = 21 - prefCompressionSubpacket signatureSubpacketType = 22 - primaryUserIdSubpacket signatureSubpacketType = 25 - keyFlagsSubpacket signatureSubpacketType = 27 - reasonForRevocationSubpacket signatureSubpacketType = 29 - featuresSubpacket signatureSubpacketType = 30 - embeddedSignatureSubpacket signatureSubpacketType = 32 -) - -// parseSignatureSubpacket parses a single subpacket. len(subpacket) is >= 1. -func parseSignatureSubpacket(sig *Signature, subpacket []byte, isHashed bool) (rest []byte, err error) { - // RFC 4880, section 5.2.3.1 - var ( - length uint32 - packetType signatureSubpacketType - isCritical bool - ) - switch { - case subpacket[0] < 192: - length = uint32(subpacket[0]) - subpacket = subpacket[1:] - case subpacket[0] < 255: - if len(subpacket) < 2 { - goto Truncated - } - length = uint32(subpacket[0]-192)<<8 + uint32(subpacket[1]) + 192 - subpacket = subpacket[2:] - default: - if len(subpacket) < 5 { - goto Truncated - } - length = uint32(subpacket[1])<<24 | - uint32(subpacket[2])<<16 | - uint32(subpacket[3])<<8 | - uint32(subpacket[4]) - subpacket = subpacket[5:] - } - if length > uint32(len(subpacket)) { - goto Truncated - } - rest = subpacket[length:] - subpacket = subpacket[:length] - if len(subpacket) == 0 { - err = errors.StructuralError("zero length signature subpacket") - return - } - packetType = signatureSubpacketType(subpacket[0] & 0x7f) - isCritical = subpacket[0]&0x80 == 0x80 - subpacket = subpacket[1:] - sig.rawSubpackets = append(sig.rawSubpackets, outputSubpacket{isHashed, packetType, isCritical, subpacket}) - switch packetType { - case creationTimeSubpacket: - if !isHashed { - err = errors.StructuralError("signature creation time in non-hashed area") - return - } - if len(subpacket) != 4 { - err = errors.StructuralError("signature creation time not four bytes") - return - } - t := binary.BigEndian.Uint32(subpacket) - sig.CreationTime = time.Unix(int64(t), 0) - case signatureExpirationSubpacket: - // Signature expiration time, section 5.2.3.10 - if !isHashed { - return - } - if len(subpacket) != 4 { - err = errors.StructuralError("expiration subpacket with bad length") - return - } - sig.SigLifetimeSecs = new(uint32) - *sig.SigLifetimeSecs = binary.BigEndian.Uint32(subpacket) - case keyExpirationSubpacket: - // Key expiration time, section 5.2.3.6 - if !isHashed { - return - } - if len(subpacket) != 4 { - err = errors.StructuralError("key expiration subpacket with bad length") - return - } - sig.KeyLifetimeSecs = new(uint32) - *sig.KeyLifetimeSecs = binary.BigEndian.Uint32(subpacket) - case prefSymmetricAlgosSubpacket: - // Preferred symmetric algorithms, section 5.2.3.7 - if !isHashed { - return - } - sig.PreferredSymmetric = make([]byte, len(subpacket)) - copy(sig.PreferredSymmetric, subpacket) - case issuerSubpacket: - // Issuer, section 5.2.3.5 - if len(subpacket) != 8 { - err = errors.StructuralError("issuer subpacket with bad length") - return - } - sig.IssuerKeyId = new(uint64) - *sig.IssuerKeyId = binary.BigEndian.Uint64(subpacket) - case prefHashAlgosSubpacket: - // Preferred hash algorithms, section 5.2.3.8 - if !isHashed { - return - } - sig.PreferredHash = make([]byte, len(subpacket)) - copy(sig.PreferredHash, subpacket) - case prefCompressionSubpacket: - // Preferred compression algorithms, section 5.2.3.9 - if !isHashed { - return - } - sig.PreferredCompression = make([]byte, len(subpacket)) - copy(sig.PreferredCompression, subpacket) - case primaryUserIdSubpacket: - // Primary User ID, section 5.2.3.19 - if !isHashed { - return - } - if len(subpacket) != 1 { - err = errors.StructuralError("primary user id subpacket with bad length") - return - } - sig.IsPrimaryId = new(bool) - if subpacket[0] > 0 { - *sig.IsPrimaryId = true - } - case keyFlagsSubpacket: - // Key flags, section 5.2.3.21 - if !isHashed { - return - } - if len(subpacket) == 0 { - err = errors.StructuralError("empty key flags subpacket") - return - } - sig.FlagsValid = true - if subpacket[0]&KeyFlagCertify != 0 { - sig.FlagCertify = true - } - if subpacket[0]&KeyFlagSign != 0 { - sig.FlagSign = true - } - if subpacket[0]&KeyFlagEncryptCommunications != 0 { - sig.FlagEncryptCommunications = true - } - if subpacket[0]&KeyFlagEncryptStorage != 0 { - sig.FlagEncryptStorage = true - } - case reasonForRevocationSubpacket: - // Reason For Revocation, section 5.2.3.23 - if !isHashed { - return - } - if len(subpacket) == 0 { - err = errors.StructuralError("empty revocation reason subpacket") - return - } - sig.RevocationReason = new(uint8) - *sig.RevocationReason = subpacket[0] - sig.RevocationReasonText = string(subpacket[1:]) - case featuresSubpacket: - // Features subpacket, section 5.2.3.24 specifies a very general - // mechanism for OpenPGP implementations to signal support for new - // features. In practice, the subpacket is used exclusively to - // indicate support for MDC-protected encryption. - sig.MDC = len(subpacket) >= 1 && subpacket[0]&1 == 1 - case embeddedSignatureSubpacket: - // Only usage is in signatures that cross-certify - // signing subkeys. section 5.2.3.26 describes the - // format, with its usage described in section 11.1 - if sig.EmbeddedSignature != nil { - err = errors.StructuralError("Cannot have multiple embedded signatures") - return - } - sig.EmbeddedSignature = new(Signature) - // Embedded signatures are required to be v4 signatures see - // section 12.1. However, we only parse v4 signatures in this - // file anyway. - if err := sig.EmbeddedSignature.parse(bytes.NewBuffer(subpacket)); err != nil { - return nil, err - } - if sigType := sig.EmbeddedSignature.SigType; sigType != SigTypePrimaryKeyBinding { - return nil, errors.StructuralError("cross-signature has unexpected type " + strconv.Itoa(int(sigType))) - } - default: - if isCritical { - err = errors.UnsupportedError("unknown critical signature subpacket type " + strconv.Itoa(int(packetType))) - return - } - } - return - -Truncated: - err = errors.StructuralError("signature subpacket truncated") - return -} - -// subpacketLengthLength returns the length, in bytes, of an encoded length value. -func subpacketLengthLength(length int) int { - if length < 192 { - return 1 - } - if length < 16320 { - return 2 - } - return 5 -} - -// serializeSubpacketLength marshals the given length into to. -func serializeSubpacketLength(to []byte, length int) int { - // RFC 4880, Section 4.2.2. - if length < 192 { - to[0] = byte(length) - return 1 - } - if length < 16320 { - length -= 192 - to[0] = byte((length >> 8) + 192) - to[1] = byte(length) - return 2 - } - to[0] = 255 - to[1] = byte(length >> 24) - to[2] = byte(length >> 16) - to[3] = byte(length >> 8) - to[4] = byte(length) - return 5 -} - -// subpacketsLength returns the serialized length, in bytes, of the given -// subpackets. -func subpacketsLength(subpackets []outputSubpacket, hashed bool) (length int) { - for _, subpacket := range subpackets { - if subpacket.hashed == hashed { - length += subpacketLengthLength(len(subpacket.contents) + 1) - length += 1 // type byte - length += len(subpacket.contents) - } - } - return -} - -// serializeSubpackets marshals the given subpackets into to. -func serializeSubpackets(to []byte, subpackets []outputSubpacket, hashed bool) { - for _, subpacket := range subpackets { - if subpacket.hashed == hashed { - n := serializeSubpacketLength(to, len(subpacket.contents)+1) - to[n] = byte(subpacket.subpacketType) - to = to[1+n:] - n = copy(to, subpacket.contents) - to = to[n:] - } - } - return -} - -// KeyExpired returns whether sig is a self-signature of a key that has -// expired. -func (sig *Signature) KeyExpired(currentTime time.Time) bool { - if sig.KeyLifetimeSecs == nil { - return false - } - expiry := sig.CreationTime.Add(time.Duration(*sig.KeyLifetimeSecs) * time.Second) - return currentTime.After(expiry) -} - -// buildHashSuffix constructs the HashSuffix member of sig in preparation for signing. -func (sig *Signature) buildHashSuffix() (err error) { - hashedSubpacketsLen := subpacketsLength(sig.outSubpackets, true) - - var ok bool - l := 6 + hashedSubpacketsLen - sig.HashSuffix = make([]byte, l+6) - sig.HashSuffix[0] = 4 - sig.HashSuffix[1] = uint8(sig.SigType) - sig.HashSuffix[2] = uint8(sig.PubKeyAlgo) - sig.HashSuffix[3], ok = s2k.HashToHashId(sig.Hash) - if !ok { - sig.HashSuffix = nil - return errors.InvalidArgumentError("hash cannot be represented in OpenPGP: " + strconv.Itoa(int(sig.Hash))) - } - sig.HashSuffix[4] = byte(hashedSubpacketsLen >> 8) - sig.HashSuffix[5] = byte(hashedSubpacketsLen) - serializeSubpackets(sig.HashSuffix[6:l], sig.outSubpackets, true) - trailer := sig.HashSuffix[l:] - trailer[0] = 4 - trailer[1] = 0xff - trailer[2] = byte(l >> 24) - trailer[3] = byte(l >> 16) - trailer[4] = byte(l >> 8) - trailer[5] = byte(l) - return -} - -func (sig *Signature) signPrepareHash(h hash.Hash) (digest []byte, err error) { - err = sig.buildHashSuffix() - if err != nil { - return - } - - h.Write(sig.HashSuffix) - digest = h.Sum(nil) - copy(sig.HashTag[:], digest) - return -} - -// Sign signs a message with a private key. The hash, h, must contain -// the hash of the message to be signed and will be mutated by this function. -// On success, the signature is stored in sig. Call Serialize to write it out. -// If config is nil, sensible defaults will be used. -func (sig *Signature) Sign(h hash.Hash, priv *PrivateKey, config *Config) (err error) { - sig.outSubpackets = sig.buildSubpackets() - digest, err := sig.signPrepareHash(h) - if err != nil { - return - } - - switch priv.PubKeyAlgo { - case PubKeyAlgoRSA, PubKeyAlgoRSASignOnly: - // supports both *rsa.PrivateKey and crypto.Signer - sig.RSASignature.bytes, err = priv.PrivateKey.(crypto.Signer).Sign(config.Random(), digest, sig.Hash) - sig.RSASignature.bitLength = uint16(8 * len(sig.RSASignature.bytes)) - case PubKeyAlgoDSA: - dsaPriv := priv.PrivateKey.(*dsa.PrivateKey) - - // Need to truncate hashBytes to match FIPS 186-3 section 4.6. - subgroupSize := (dsaPriv.Q.BitLen() + 7) / 8 - if len(digest) > subgroupSize { - digest = digest[:subgroupSize] - } - r, s, err := dsa.Sign(config.Random(), dsaPriv, digest) - if err == nil { - sig.DSASigR.bytes = r.Bytes() - sig.DSASigR.bitLength = uint16(8 * len(sig.DSASigR.bytes)) - sig.DSASigS.bytes = s.Bytes() - sig.DSASigS.bitLength = uint16(8 * len(sig.DSASigS.bytes)) - } - case PubKeyAlgoECDSA: - var r, s *big.Int - if pk, ok := priv.PrivateKey.(*ecdsa.PrivateKey); ok { - // direct support, avoid asn1 wrapping/unwrapping - r, s, err = ecdsa.Sign(config.Random(), pk, digest) - } else { - var b []byte - b, err = priv.PrivateKey.(crypto.Signer).Sign(config.Random(), digest, sig.Hash) - if err == nil { - r, s, err = unwrapECDSASig(b) - } - } - if err == nil { - sig.ECDSASigR = fromBig(r) - sig.ECDSASigS = fromBig(s) - } - default: - err = errors.UnsupportedError("public key algorithm: " + strconv.Itoa(int(sig.PubKeyAlgo))) - } - - return -} - -// unwrapECDSASig parses the two integer components of an ASN.1-encoded ECDSA -// signature. -func unwrapECDSASig(b []byte) (r, s *big.Int, err error) { - var ecsdaSig struct { - R, S *big.Int - } - _, err = asn1.Unmarshal(b, &ecsdaSig) - if err != nil { - return - } - return ecsdaSig.R, ecsdaSig.S, nil -} - -// SignUserId computes a signature from priv, asserting that pub is a valid -// key for the identity id. On success, the signature is stored in sig. Call -// Serialize to write it out. -// If config is nil, sensible defaults will be used. -func (sig *Signature) SignUserId(id string, pub *PublicKey, priv *PrivateKey, config *Config) error { - h, err := userIdSignatureHash(id, pub, sig.Hash) - if err != nil { - return err - } - return sig.Sign(h, priv, config) -} - -// SignKey computes a signature from priv, asserting that pub is a subkey. On -// success, the signature is stored in sig. Call Serialize to write it out. -// If config is nil, sensible defaults will be used. -func (sig *Signature) SignKey(pub *PublicKey, priv *PrivateKey, config *Config) error { - h, err := keySignatureHash(&priv.PublicKey, pub, sig.Hash) - if err != nil { - return err - } - return sig.Sign(h, priv, config) -} - -// Serialize marshals sig to w. Sign, SignUserId or SignKey must have been -// called first. -func (sig *Signature) Serialize(w io.Writer) (err error) { - if len(sig.outSubpackets) == 0 { - sig.outSubpackets = sig.rawSubpackets - } - if sig.RSASignature.bytes == nil && sig.DSASigR.bytes == nil && sig.ECDSASigR.bytes == nil { - return errors.InvalidArgumentError("Signature: need to call Sign, SignUserId or SignKey before Serialize") - } - - sigLength := 0 - switch sig.PubKeyAlgo { - case PubKeyAlgoRSA, PubKeyAlgoRSASignOnly: - sigLength = 2 + len(sig.RSASignature.bytes) - case PubKeyAlgoDSA: - sigLength = 2 + len(sig.DSASigR.bytes) - sigLength += 2 + len(sig.DSASigS.bytes) - case PubKeyAlgoECDSA: - sigLength = 2 + len(sig.ECDSASigR.bytes) - sigLength += 2 + len(sig.ECDSASigS.bytes) - default: - panic("impossible") - } - - unhashedSubpacketsLen := subpacketsLength(sig.outSubpackets, false) - length := len(sig.HashSuffix) - 6 /* trailer not included */ + - 2 /* length of unhashed subpackets */ + unhashedSubpacketsLen + - 2 /* hash tag */ + sigLength - err = serializeHeader(w, packetTypeSignature, length) - if err != nil { - return - } - - _, err = w.Write(sig.HashSuffix[:len(sig.HashSuffix)-6]) - if err != nil { - return - } - - unhashedSubpackets := make([]byte, 2+unhashedSubpacketsLen) - unhashedSubpackets[0] = byte(unhashedSubpacketsLen >> 8) - unhashedSubpackets[1] = byte(unhashedSubpacketsLen) - serializeSubpackets(unhashedSubpackets[2:], sig.outSubpackets, false) - - _, err = w.Write(unhashedSubpackets) - if err != nil { - return - } - _, err = w.Write(sig.HashTag[:]) - if err != nil { - return - } - - switch sig.PubKeyAlgo { - case PubKeyAlgoRSA, PubKeyAlgoRSASignOnly: - err = writeMPIs(w, sig.RSASignature) - case PubKeyAlgoDSA: - err = writeMPIs(w, sig.DSASigR, sig.DSASigS) - case PubKeyAlgoECDSA: - err = writeMPIs(w, sig.ECDSASigR, sig.ECDSASigS) - default: - panic("impossible") - } - return -} - -// outputSubpacket represents a subpacket to be marshaled. -type outputSubpacket struct { - hashed bool // true if this subpacket is in the hashed area. - subpacketType signatureSubpacketType - isCritical bool - contents []byte -} - -func (sig *Signature) buildSubpackets() (subpackets []outputSubpacket) { - creationTime := make([]byte, 4) - binary.BigEndian.PutUint32(creationTime, uint32(sig.CreationTime.Unix())) - subpackets = append(subpackets, outputSubpacket{true, creationTimeSubpacket, false, creationTime}) - - if sig.IssuerKeyId != nil { - keyId := make([]byte, 8) - binary.BigEndian.PutUint64(keyId, *sig.IssuerKeyId) - subpackets = append(subpackets, outputSubpacket{true, issuerSubpacket, false, keyId}) - } - - if sig.SigLifetimeSecs != nil && *sig.SigLifetimeSecs != 0 { - sigLifetime := make([]byte, 4) - binary.BigEndian.PutUint32(sigLifetime, *sig.SigLifetimeSecs) - subpackets = append(subpackets, outputSubpacket{true, signatureExpirationSubpacket, true, sigLifetime}) - } - - // Key flags may only appear in self-signatures or certification signatures. - - if sig.FlagsValid { - var flags byte - if sig.FlagCertify { - flags |= KeyFlagCertify - } - if sig.FlagSign { - flags |= KeyFlagSign - } - if sig.FlagEncryptCommunications { - flags |= KeyFlagEncryptCommunications - } - if sig.FlagEncryptStorage { - flags |= KeyFlagEncryptStorage - } - subpackets = append(subpackets, outputSubpacket{true, keyFlagsSubpacket, false, []byte{flags}}) - } - - // The following subpackets may only appear in self-signatures - - if sig.KeyLifetimeSecs != nil && *sig.KeyLifetimeSecs != 0 { - keyLifetime := make([]byte, 4) - binary.BigEndian.PutUint32(keyLifetime, *sig.KeyLifetimeSecs) - subpackets = append(subpackets, outputSubpacket{true, keyExpirationSubpacket, true, keyLifetime}) - } - - if sig.IsPrimaryId != nil && *sig.IsPrimaryId { - subpackets = append(subpackets, outputSubpacket{true, primaryUserIdSubpacket, false, []byte{1}}) - } - - if len(sig.PreferredSymmetric) > 0 { - subpackets = append(subpackets, outputSubpacket{true, prefSymmetricAlgosSubpacket, false, sig.PreferredSymmetric}) - } - - if len(sig.PreferredHash) > 0 { - subpackets = append(subpackets, outputSubpacket{true, prefHashAlgosSubpacket, false, sig.PreferredHash}) - } - - if len(sig.PreferredCompression) > 0 { - subpackets = append(subpackets, outputSubpacket{true, prefCompressionSubpacket, false, sig.PreferredCompression}) - } - - return -} diff --git a/vendor/golang.org/x/crypto/openpgp/packet/signature_v3.go b/vendor/golang.org/x/crypto/openpgp/packet/signature_v3.go deleted file mode 100644 index 6edff889349b..000000000000 --- a/vendor/golang.org/x/crypto/openpgp/packet/signature_v3.go +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package packet - -import ( - "crypto" - "encoding/binary" - "fmt" - "io" - "strconv" - "time" - - "golang.org/x/crypto/openpgp/errors" - "golang.org/x/crypto/openpgp/s2k" -) - -// SignatureV3 represents older version 3 signatures. These signatures are less secure -// than version 4 and should not be used to create new signatures. They are included -// here for backwards compatibility to read and validate with older key material. -// See RFC 4880, section 5.2.2. -type SignatureV3 struct { - SigType SignatureType - CreationTime time.Time - IssuerKeyId uint64 - PubKeyAlgo PublicKeyAlgorithm - Hash crypto.Hash - HashTag [2]byte - - RSASignature parsedMPI - DSASigR, DSASigS parsedMPI -} - -func (sig *SignatureV3) parse(r io.Reader) (err error) { - // RFC 4880, section 5.2.2 - var buf [8]byte - if _, err = readFull(r, buf[:1]); err != nil { - return - } - if buf[0] < 2 || buf[0] > 3 { - err = errors.UnsupportedError("signature packet version " + strconv.Itoa(int(buf[0]))) - return - } - if _, err = readFull(r, buf[:1]); err != nil { - return - } - if buf[0] != 5 { - err = errors.UnsupportedError( - "invalid hashed material length " + strconv.Itoa(int(buf[0]))) - return - } - - // Read hashed material: signature type + creation time - if _, err = readFull(r, buf[:5]); err != nil { - return - } - sig.SigType = SignatureType(buf[0]) - t := binary.BigEndian.Uint32(buf[1:5]) - sig.CreationTime = time.Unix(int64(t), 0) - - // Eight-octet Key ID of signer. - if _, err = readFull(r, buf[:8]); err != nil { - return - } - sig.IssuerKeyId = binary.BigEndian.Uint64(buf[:]) - - // Public-key and hash algorithm - if _, err = readFull(r, buf[:2]); err != nil { - return - } - sig.PubKeyAlgo = PublicKeyAlgorithm(buf[0]) - switch sig.PubKeyAlgo { - case PubKeyAlgoRSA, PubKeyAlgoRSASignOnly, PubKeyAlgoDSA: - default: - err = errors.UnsupportedError("public key algorithm " + strconv.Itoa(int(sig.PubKeyAlgo))) - return - } - var ok bool - if sig.Hash, ok = s2k.HashIdToHash(buf[1]); !ok { - return errors.UnsupportedError("hash function " + strconv.Itoa(int(buf[2]))) - } - - // Two-octet field holding left 16 bits of signed hash value. - if _, err = readFull(r, sig.HashTag[:2]); err != nil { - return - } - - switch sig.PubKeyAlgo { - case PubKeyAlgoRSA, PubKeyAlgoRSASignOnly: - sig.RSASignature.bytes, sig.RSASignature.bitLength, err = readMPI(r) - case PubKeyAlgoDSA: - if sig.DSASigR.bytes, sig.DSASigR.bitLength, err = readMPI(r); err != nil { - return - } - sig.DSASigS.bytes, sig.DSASigS.bitLength, err = readMPI(r) - default: - panic("unreachable") - } - return -} - -// Serialize marshals sig to w. Sign, SignUserId or SignKey must have been -// called first. -func (sig *SignatureV3) Serialize(w io.Writer) (err error) { - buf := make([]byte, 8) - - // Write the sig type and creation time - buf[0] = byte(sig.SigType) - binary.BigEndian.PutUint32(buf[1:5], uint32(sig.CreationTime.Unix())) - if _, err = w.Write(buf[:5]); err != nil { - return - } - - // Write the issuer long key ID - binary.BigEndian.PutUint64(buf[:8], sig.IssuerKeyId) - if _, err = w.Write(buf[:8]); err != nil { - return - } - - // Write public key algorithm, hash ID, and hash value - buf[0] = byte(sig.PubKeyAlgo) - hashId, ok := s2k.HashToHashId(sig.Hash) - if !ok { - return errors.UnsupportedError(fmt.Sprintf("hash function %v", sig.Hash)) - } - buf[1] = hashId - copy(buf[2:4], sig.HashTag[:]) - if _, err = w.Write(buf[:4]); err != nil { - return - } - - if sig.RSASignature.bytes == nil && sig.DSASigR.bytes == nil { - return errors.InvalidArgumentError("Signature: need to call Sign, SignUserId or SignKey before Serialize") - } - - switch sig.PubKeyAlgo { - case PubKeyAlgoRSA, PubKeyAlgoRSASignOnly: - err = writeMPIs(w, sig.RSASignature) - case PubKeyAlgoDSA: - err = writeMPIs(w, sig.DSASigR, sig.DSASigS) - default: - panic("impossible") - } - return -} diff --git a/vendor/golang.org/x/crypto/openpgp/packet/symmetric_key_encrypted.go b/vendor/golang.org/x/crypto/openpgp/packet/symmetric_key_encrypted.go deleted file mode 100644 index 744c2d2c42dc..000000000000 --- a/vendor/golang.org/x/crypto/openpgp/packet/symmetric_key_encrypted.go +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package packet - -import ( - "bytes" - "crypto/cipher" - "io" - "strconv" - - "golang.org/x/crypto/openpgp/errors" - "golang.org/x/crypto/openpgp/s2k" -) - -// This is the largest session key that we'll support. Since no 512-bit cipher -// has even been seriously used, this is comfortably large. -const maxSessionKeySizeInBytes = 64 - -// SymmetricKeyEncrypted represents a passphrase protected session key. See RFC -// 4880, section 5.3. -type SymmetricKeyEncrypted struct { - CipherFunc CipherFunction - s2k func(out, in []byte) - encryptedKey []byte -} - -const symmetricKeyEncryptedVersion = 4 - -func (ske *SymmetricKeyEncrypted) parse(r io.Reader) error { - // RFC 4880, section 5.3. - var buf [2]byte - if _, err := readFull(r, buf[:]); err != nil { - return err - } - if buf[0] != symmetricKeyEncryptedVersion { - return errors.UnsupportedError("SymmetricKeyEncrypted version") - } - ske.CipherFunc = CipherFunction(buf[1]) - - if ske.CipherFunc.KeySize() == 0 { - return errors.UnsupportedError("unknown cipher: " + strconv.Itoa(int(buf[1]))) - } - - var err error - ske.s2k, err = s2k.Parse(r) - if err != nil { - return err - } - - encryptedKey := make([]byte, maxSessionKeySizeInBytes) - // The session key may follow. We just have to try and read to find - // out. If it exists then we limit it to maxSessionKeySizeInBytes. - n, err := readFull(r, encryptedKey) - if err != nil && err != io.ErrUnexpectedEOF { - return err - } - - if n != 0 { - if n == maxSessionKeySizeInBytes { - return errors.UnsupportedError("oversized encrypted session key") - } - ske.encryptedKey = encryptedKey[:n] - } - - return nil -} - -// Decrypt attempts to decrypt an encrypted session key and returns the key and -// the cipher to use when decrypting a subsequent Symmetrically Encrypted Data -// packet. -func (ske *SymmetricKeyEncrypted) Decrypt(passphrase []byte) ([]byte, CipherFunction, error) { - key := make([]byte, ske.CipherFunc.KeySize()) - ske.s2k(key, passphrase) - - if len(ske.encryptedKey) == 0 { - return key, ske.CipherFunc, nil - } - - // the IV is all zeros - iv := make([]byte, ske.CipherFunc.blockSize()) - c := cipher.NewCFBDecrypter(ske.CipherFunc.new(key), iv) - plaintextKey := make([]byte, len(ske.encryptedKey)) - c.XORKeyStream(plaintextKey, ske.encryptedKey) - cipherFunc := CipherFunction(plaintextKey[0]) - if cipherFunc.blockSize() == 0 { - return nil, ske.CipherFunc, errors.UnsupportedError("unknown cipher: " + strconv.Itoa(int(cipherFunc))) - } - plaintextKey = plaintextKey[1:] - if l, cipherKeySize := len(plaintextKey), cipherFunc.KeySize(); l != cipherFunc.KeySize() { - return nil, cipherFunc, errors.StructuralError("length of decrypted key (" + strconv.Itoa(l) + ") " + - "not equal to cipher keysize (" + strconv.Itoa(cipherKeySize) + ")") - } - return plaintextKey, cipherFunc, nil -} - -// SerializeSymmetricKeyEncrypted serializes a symmetric key packet to w. The -// packet contains a random session key, encrypted by a key derived from the -// given passphrase. The session key is returned and must be passed to -// SerializeSymmetricallyEncrypted. -// If config is nil, sensible defaults will be used. -func SerializeSymmetricKeyEncrypted(w io.Writer, passphrase []byte, config *Config) (key []byte, err error) { - cipherFunc := config.Cipher() - keySize := cipherFunc.KeySize() - if keySize == 0 { - return nil, errors.UnsupportedError("unknown cipher: " + strconv.Itoa(int(cipherFunc))) - } - - s2kBuf := new(bytes.Buffer) - keyEncryptingKey := make([]byte, keySize) - // s2k.Serialize salts and stretches the passphrase, and writes the - // resulting key to keyEncryptingKey and the s2k descriptor to s2kBuf. - err = s2k.Serialize(s2kBuf, keyEncryptingKey, config.Random(), passphrase, &s2k.Config{Hash: config.Hash(), S2KCount: config.PasswordHashIterations()}) - if err != nil { - return - } - s2kBytes := s2kBuf.Bytes() - - packetLength := 2 /* header */ + len(s2kBytes) + 1 /* cipher type */ + keySize - err = serializeHeader(w, packetTypeSymmetricKeyEncrypted, packetLength) - if err != nil { - return - } - - var buf [2]byte - buf[0] = symmetricKeyEncryptedVersion - buf[1] = byte(cipherFunc) - _, err = w.Write(buf[:]) - if err != nil { - return - } - _, err = w.Write(s2kBytes) - if err != nil { - return - } - - sessionKey := make([]byte, keySize) - _, err = io.ReadFull(config.Random(), sessionKey) - if err != nil { - return - } - iv := make([]byte, cipherFunc.blockSize()) - c := cipher.NewCFBEncrypter(cipherFunc.new(keyEncryptingKey), iv) - encryptedCipherAndKey := make([]byte, keySize+1) - c.XORKeyStream(encryptedCipherAndKey, buf[1:]) - c.XORKeyStream(encryptedCipherAndKey[1:], sessionKey) - _, err = w.Write(encryptedCipherAndKey) - if err != nil { - return - } - - key = sessionKey - return -} diff --git a/vendor/golang.org/x/crypto/openpgp/packet/symmetrically_encrypted.go b/vendor/golang.org/x/crypto/openpgp/packet/symmetrically_encrypted.go deleted file mode 100644 index 1a1a62964fc9..000000000000 --- a/vendor/golang.org/x/crypto/openpgp/packet/symmetrically_encrypted.go +++ /dev/null @@ -1,290 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package packet - -import ( - "crypto/cipher" - "crypto/sha1" - "crypto/subtle" - "golang.org/x/crypto/openpgp/errors" - "hash" - "io" - "strconv" -) - -// SymmetricallyEncrypted represents a symmetrically encrypted byte string. The -// encrypted contents will consist of more OpenPGP packets. See RFC 4880, -// sections 5.7 and 5.13. -type SymmetricallyEncrypted struct { - MDC bool // true iff this is a type 18 packet and thus has an embedded MAC. - contents io.Reader - prefix []byte -} - -const symmetricallyEncryptedVersion = 1 - -func (se *SymmetricallyEncrypted) parse(r io.Reader) error { - if se.MDC { - // See RFC 4880, section 5.13. - var buf [1]byte - _, err := readFull(r, buf[:]) - if err != nil { - return err - } - if buf[0] != symmetricallyEncryptedVersion { - return errors.UnsupportedError("unknown SymmetricallyEncrypted version") - } - } - se.contents = r - return nil -} - -// Decrypt returns a ReadCloser, from which the decrypted contents of the -// packet can be read. An incorrect key can, with high probability, be detected -// immediately and this will result in a KeyIncorrect error being returned. -func (se *SymmetricallyEncrypted) Decrypt(c CipherFunction, key []byte) (io.ReadCloser, error) { - keySize := c.KeySize() - if keySize == 0 { - return nil, errors.UnsupportedError("unknown cipher: " + strconv.Itoa(int(c))) - } - if len(key) != keySize { - return nil, errors.InvalidArgumentError("SymmetricallyEncrypted: incorrect key length") - } - - if se.prefix == nil { - se.prefix = make([]byte, c.blockSize()+2) - _, err := readFull(se.contents, se.prefix) - if err != nil { - return nil, err - } - } else if len(se.prefix) != c.blockSize()+2 { - return nil, errors.InvalidArgumentError("can't try ciphers with different block lengths") - } - - ocfbResync := OCFBResync - if se.MDC { - // MDC packets use a different form of OCFB mode. - ocfbResync = OCFBNoResync - } - - s := NewOCFBDecrypter(c.new(key), se.prefix, ocfbResync) - if s == nil { - return nil, errors.ErrKeyIncorrect - } - - plaintext := cipher.StreamReader{S: s, R: se.contents} - - if se.MDC { - // MDC packets have an embedded hash that we need to check. - h := sha1.New() - h.Write(se.prefix) - return &seMDCReader{in: plaintext, h: h}, nil - } - - // Otherwise, we just need to wrap plaintext so that it's a valid ReadCloser. - return seReader{plaintext}, nil -} - -// seReader wraps an io.Reader with a no-op Close method. -type seReader struct { - in io.Reader -} - -func (ser seReader) Read(buf []byte) (int, error) { - return ser.in.Read(buf) -} - -func (ser seReader) Close() error { - return nil -} - -const mdcTrailerSize = 1 /* tag byte */ + 1 /* length byte */ + sha1.Size - -// An seMDCReader wraps an io.Reader, maintains a running hash and keeps hold -// of the most recent 22 bytes (mdcTrailerSize). Upon EOF, those bytes form an -// MDC packet containing a hash of the previous contents which is checked -// against the running hash. See RFC 4880, section 5.13. -type seMDCReader struct { - in io.Reader - h hash.Hash - trailer [mdcTrailerSize]byte - scratch [mdcTrailerSize]byte - trailerUsed int - error bool - eof bool -} - -func (ser *seMDCReader) Read(buf []byte) (n int, err error) { - if ser.error { - err = io.ErrUnexpectedEOF - return - } - if ser.eof { - err = io.EOF - return - } - - // If we haven't yet filled the trailer buffer then we must do that - // first. - for ser.trailerUsed < mdcTrailerSize { - n, err = ser.in.Read(ser.trailer[ser.trailerUsed:]) - ser.trailerUsed += n - if err == io.EOF { - if ser.trailerUsed != mdcTrailerSize { - n = 0 - err = io.ErrUnexpectedEOF - ser.error = true - return - } - ser.eof = true - n = 0 - return - } - - if err != nil { - n = 0 - return - } - } - - // If it's a short read then we read into a temporary buffer and shift - // the data into the caller's buffer. - if len(buf) <= mdcTrailerSize { - n, err = readFull(ser.in, ser.scratch[:len(buf)]) - copy(buf, ser.trailer[:n]) - ser.h.Write(buf[:n]) - copy(ser.trailer[:], ser.trailer[n:]) - copy(ser.trailer[mdcTrailerSize-n:], ser.scratch[:]) - if n < len(buf) { - ser.eof = true - err = io.EOF - } - return - } - - n, err = ser.in.Read(buf[mdcTrailerSize:]) - copy(buf, ser.trailer[:]) - ser.h.Write(buf[:n]) - copy(ser.trailer[:], buf[n:]) - - if err == io.EOF { - ser.eof = true - } - return -} - -// This is a new-format packet tag byte for a type 19 (MDC) packet. -const mdcPacketTagByte = byte(0x80) | 0x40 | 19 - -func (ser *seMDCReader) Close() error { - if ser.error { - return errors.SignatureError("error during reading") - } - - for !ser.eof { - // We haven't seen EOF so we need to read to the end - var buf [1024]byte - _, err := ser.Read(buf[:]) - if err == io.EOF { - break - } - if err != nil { - return errors.SignatureError("error during reading") - } - } - - if ser.trailer[0] != mdcPacketTagByte || ser.trailer[1] != sha1.Size { - return errors.SignatureError("MDC packet not found") - } - ser.h.Write(ser.trailer[:2]) - - final := ser.h.Sum(nil) - if subtle.ConstantTimeCompare(final, ser.trailer[2:]) != 1 { - return errors.SignatureError("hash mismatch") - } - return nil -} - -// An seMDCWriter writes through to an io.WriteCloser while maintains a running -// hash of the data written. On close, it emits an MDC packet containing the -// running hash. -type seMDCWriter struct { - w io.WriteCloser - h hash.Hash -} - -func (w *seMDCWriter) Write(buf []byte) (n int, err error) { - w.h.Write(buf) - return w.w.Write(buf) -} - -func (w *seMDCWriter) Close() (err error) { - var buf [mdcTrailerSize]byte - - buf[0] = mdcPacketTagByte - buf[1] = sha1.Size - w.h.Write(buf[:2]) - digest := w.h.Sum(nil) - copy(buf[2:], digest) - - _, err = w.w.Write(buf[:]) - if err != nil { - return - } - return w.w.Close() -} - -// noOpCloser is like an io.NopCloser, but for an io.Writer. -type noOpCloser struct { - w io.Writer -} - -func (c noOpCloser) Write(data []byte) (n int, err error) { - return c.w.Write(data) -} - -func (c noOpCloser) Close() error { - return nil -} - -// SerializeSymmetricallyEncrypted serializes a symmetrically encrypted packet -// to w and returns a WriteCloser to which the to-be-encrypted packets can be -// written. -// If config is nil, sensible defaults will be used. -func SerializeSymmetricallyEncrypted(w io.Writer, c CipherFunction, key []byte, config *Config) (contents io.WriteCloser, err error) { - if c.KeySize() != len(key) { - return nil, errors.InvalidArgumentError("SymmetricallyEncrypted.Serialize: bad key length") - } - writeCloser := noOpCloser{w} - ciphertext, err := serializeStreamHeader(writeCloser, packetTypeSymmetricallyEncryptedMDC) - if err != nil { - return - } - - _, err = ciphertext.Write([]byte{symmetricallyEncryptedVersion}) - if err != nil { - return - } - - block := c.new(key) - blockSize := block.BlockSize() - iv := make([]byte, blockSize) - _, err = config.Random().Read(iv) - if err != nil { - return - } - s, prefix := NewOCFBEncrypter(block, iv, OCFBNoResync) - _, err = ciphertext.Write(prefix) - if err != nil { - return - } - plaintext := cipher.StreamWriter{S: s, W: ciphertext} - - h := sha1.New() - h.Write(iv) - h.Write(iv[blockSize-2:]) - contents = &seMDCWriter{w: plaintext, h: h} - return -} diff --git a/vendor/golang.org/x/crypto/openpgp/packet/userattribute.go b/vendor/golang.org/x/crypto/openpgp/packet/userattribute.go deleted file mode 100644 index ff7ef5307557..000000000000 --- a/vendor/golang.org/x/crypto/openpgp/packet/userattribute.go +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package packet - -import ( - "bytes" - "image" - "image/jpeg" - "io" -) - -const UserAttrImageSubpacket = 1 - -// UserAttribute is capable of storing other types of data about a user -// beyond name, email and a text comment. In practice, user attributes are typically used -// to store a signed thumbnail photo JPEG image of the user. -// See RFC 4880, section 5.12. -type UserAttribute struct { - Contents []*OpaqueSubpacket -} - -// NewUserAttributePhoto creates a user attribute packet -// containing the given images. -func NewUserAttributePhoto(photos ...image.Image) (uat *UserAttribute, err error) { - uat = new(UserAttribute) - for _, photo := range photos { - var buf bytes.Buffer - // RFC 4880, Section 5.12.1. - data := []byte{ - 0x10, 0x00, // Little-endian image header length (16 bytes) - 0x01, // Image header version 1 - 0x01, // JPEG - 0, 0, 0, 0, // 12 reserved octets, must be all zero. - 0, 0, 0, 0, - 0, 0, 0, 0} - if _, err = buf.Write(data); err != nil { - return - } - if err = jpeg.Encode(&buf, photo, nil); err != nil { - return - } - uat.Contents = append(uat.Contents, &OpaqueSubpacket{ - SubType: UserAttrImageSubpacket, - Contents: buf.Bytes()}) - } - return -} - -// NewUserAttribute creates a new user attribute packet containing the given subpackets. -func NewUserAttribute(contents ...*OpaqueSubpacket) *UserAttribute { - return &UserAttribute{Contents: contents} -} - -func (uat *UserAttribute) parse(r io.Reader) (err error) { - // RFC 4880, section 5.13 - b, err := io.ReadAll(r) - if err != nil { - return - } - uat.Contents, err = OpaqueSubpackets(b) - return -} - -// Serialize marshals the user attribute to w in the form of an OpenPGP packet, including -// header. -func (uat *UserAttribute) Serialize(w io.Writer) (err error) { - var buf bytes.Buffer - for _, sp := range uat.Contents { - sp.Serialize(&buf) - } - if err = serializeHeader(w, packetTypeUserAttribute, buf.Len()); err != nil { - return err - } - _, err = w.Write(buf.Bytes()) - return -} - -// ImageData returns zero or more byte slices, each containing -// JPEG File Interchange Format (JFIF), for each photo in the -// user attribute packet. -func (uat *UserAttribute) ImageData() (imageData [][]byte) { - for _, sp := range uat.Contents { - if sp.SubType == UserAttrImageSubpacket && len(sp.Contents) > 16 { - imageData = append(imageData, sp.Contents[16:]) - } - } - return -} diff --git a/vendor/golang.org/x/crypto/openpgp/packet/userid.go b/vendor/golang.org/x/crypto/openpgp/packet/userid.go deleted file mode 100644 index 359a462eb8ab..000000000000 --- a/vendor/golang.org/x/crypto/openpgp/packet/userid.go +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package packet - -import ( - "io" - "strings" -) - -// UserId contains text that is intended to represent the name and email -// address of the key holder. See RFC 4880, section 5.11. By convention, this -// takes the form "Full Name (Comment) " -type UserId struct { - Id string // By convention, this takes the form "Full Name (Comment) " which is split out in the fields below. - - Name, Comment, Email string -} - -func hasInvalidCharacters(s string) bool { - for _, c := range s { - switch c { - case '(', ')', '<', '>', 0: - return true - } - } - return false -} - -// NewUserId returns a UserId or nil if any of the arguments contain invalid -// characters. The invalid characters are '\x00', '(', ')', '<' and '>' -func NewUserId(name, comment, email string) *UserId { - // RFC 4880 doesn't deal with the structure of userid strings; the - // name, comment and email form is just a convention. However, there's - // no convention about escaping the metacharacters and GPG just refuses - // to create user ids where, say, the name contains a '('. We mirror - // this behaviour. - - if hasInvalidCharacters(name) || hasInvalidCharacters(comment) || hasInvalidCharacters(email) { - return nil - } - - uid := new(UserId) - uid.Name, uid.Comment, uid.Email = name, comment, email - uid.Id = name - if len(comment) > 0 { - if len(uid.Id) > 0 { - uid.Id += " " - } - uid.Id += "(" - uid.Id += comment - uid.Id += ")" - } - if len(email) > 0 { - if len(uid.Id) > 0 { - uid.Id += " " - } - uid.Id += "<" - uid.Id += email - uid.Id += ">" - } - return uid -} - -func (uid *UserId) parse(r io.Reader) (err error) { - // RFC 4880, section 5.11 - b, err := io.ReadAll(r) - if err != nil { - return - } - uid.Id = string(b) - uid.Name, uid.Comment, uid.Email = parseUserId(uid.Id) - return -} - -// Serialize marshals uid to w in the form of an OpenPGP packet, including -// header. -func (uid *UserId) Serialize(w io.Writer) error { - err := serializeHeader(w, packetTypeUserId, len(uid.Id)) - if err != nil { - return err - } - _, err = w.Write([]byte(uid.Id)) - return err -} - -// parseUserId extracts the name, comment and email from a user id string that -// is formatted as "Full Name (Comment) ". -func parseUserId(id string) (name, comment, email string) { - var n, c, e struct { - start, end int - } - var state int - - for offset, rune := range id { - switch state { - case 0: - // Entering name - n.start = offset - state = 1 - fallthrough - case 1: - // In name - if rune == '(' { - state = 2 - n.end = offset - } else if rune == '<' { - state = 5 - n.end = offset - } - case 2: - // Entering comment - c.start = offset - state = 3 - fallthrough - case 3: - // In comment - if rune == ')' { - state = 4 - c.end = offset - } - case 4: - // Between comment and email - if rune == '<' { - state = 5 - } - case 5: - // Entering email - e.start = offset - state = 6 - fallthrough - case 6: - // In email - if rune == '>' { - state = 7 - e.end = offset - } - default: - // After email - } - } - switch state { - case 1: - // ended in the name - n.end = len(id) - case 3: - // ended in comment - c.end = len(id) - case 6: - // ended in email - e.end = len(id) - } - - name = strings.TrimSpace(id[n.start:n.end]) - comment = strings.TrimSpace(id[c.start:c.end]) - email = strings.TrimSpace(id[e.start:e.end]) - return -} diff --git a/vendor/golang.org/x/crypto/openpgp/read.go b/vendor/golang.org/x/crypto/openpgp/read.go deleted file mode 100644 index 48a893146858..000000000000 --- a/vendor/golang.org/x/crypto/openpgp/read.go +++ /dev/null @@ -1,448 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package openpgp implements high level operations on OpenPGP messages. -// -// Deprecated: this package is unmaintained except for security fixes. New -// applications should consider a more focused, modern alternative to OpenPGP -// for their specific task. If you are required to interoperate with OpenPGP -// systems and need a maintained package, consider a community fork. -// See https://golang.org/issue/44226. -package openpgp // import "golang.org/x/crypto/openpgp" - -import ( - "crypto" - _ "crypto/sha256" - "hash" - "io" - "strconv" - - "golang.org/x/crypto/openpgp/armor" - "golang.org/x/crypto/openpgp/errors" - "golang.org/x/crypto/openpgp/packet" -) - -// SignatureType is the armor type for a PGP signature. -var SignatureType = "PGP SIGNATURE" - -// readArmored reads an armored block with the given type. -func readArmored(r io.Reader, expectedType string) (body io.Reader, err error) { - block, err := armor.Decode(r) - if err != nil { - return - } - - if block.Type != expectedType { - return nil, errors.InvalidArgumentError("expected '" + expectedType + "', got: " + block.Type) - } - - return block.Body, nil -} - -// MessageDetails contains the result of parsing an OpenPGP encrypted and/or -// signed message. -type MessageDetails struct { - IsEncrypted bool // true if the message was encrypted. - EncryptedToKeyIds []uint64 // the list of recipient key ids. - IsSymmetricallyEncrypted bool // true if a passphrase could have decrypted the message. - DecryptedWith Key // the private key used to decrypt the message, if any. - IsSigned bool // true if the message is signed. - SignedByKeyId uint64 // the key id of the signer, if any. - SignedBy *Key // the key of the signer, if available. - LiteralData *packet.LiteralData // the metadata of the contents - UnverifiedBody io.Reader // the contents of the message. - - // If IsSigned is true and SignedBy is non-zero then the signature will - // be verified as UnverifiedBody is read. The signature cannot be - // checked until the whole of UnverifiedBody is read so UnverifiedBody - // must be consumed until EOF before the data can be trusted. Even if a - // message isn't signed (or the signer is unknown) the data may contain - // an authentication code that is only checked once UnverifiedBody has - // been consumed. Once EOF has been seen, the following fields are - // valid. (An authentication code failure is reported as a - // SignatureError error when reading from UnverifiedBody.) - SignatureError error // nil if the signature is good. - Signature *packet.Signature // the signature packet itself, if v4 (default) - SignatureV3 *packet.SignatureV3 // the signature packet if it is a v2 or v3 signature - - decrypted io.ReadCloser -} - -// A PromptFunction is used as a callback by functions that may need to decrypt -// a private key, or prompt for a passphrase. It is called with a list of -// acceptable, encrypted private keys and a boolean that indicates whether a -// passphrase is usable. It should either decrypt a private key or return a -// passphrase to try. If the decrypted private key or given passphrase isn't -// correct, the function will be called again, forever. Any error returned will -// be passed up. -type PromptFunction func(keys []Key, symmetric bool) ([]byte, error) - -// A keyEnvelopePair is used to store a private key with the envelope that -// contains a symmetric key, encrypted with that key. -type keyEnvelopePair struct { - key Key - encryptedKey *packet.EncryptedKey -} - -// ReadMessage parses an OpenPGP message that may be signed and/or encrypted. -// The given KeyRing should contain both public keys (for signature -// verification) and, possibly encrypted, private keys for decrypting. -// If config is nil, sensible defaults will be used. -func ReadMessage(r io.Reader, keyring KeyRing, prompt PromptFunction, config *packet.Config) (md *MessageDetails, err error) { - var p packet.Packet - - var symKeys []*packet.SymmetricKeyEncrypted - var pubKeys []keyEnvelopePair - var se *packet.SymmetricallyEncrypted - - packets := packet.NewReader(r) - md = new(MessageDetails) - md.IsEncrypted = true - - // The message, if encrypted, starts with a number of packets - // containing an encrypted decryption key. The decryption key is either - // encrypted to a public key, or with a passphrase. This loop - // collects these packets. -ParsePackets: - for { - p, err = packets.Next() - if err != nil { - return nil, err - } - switch p := p.(type) { - case *packet.SymmetricKeyEncrypted: - // This packet contains the decryption key encrypted with a passphrase. - md.IsSymmetricallyEncrypted = true - symKeys = append(symKeys, p) - case *packet.EncryptedKey: - // This packet contains the decryption key encrypted to a public key. - md.EncryptedToKeyIds = append(md.EncryptedToKeyIds, p.KeyId) - switch p.Algo { - case packet.PubKeyAlgoRSA, packet.PubKeyAlgoRSAEncryptOnly, packet.PubKeyAlgoElGamal: - break - default: - continue - } - var keys []Key - if p.KeyId == 0 { - keys = keyring.DecryptionKeys() - } else { - keys = keyring.KeysById(p.KeyId) - } - for _, k := range keys { - pubKeys = append(pubKeys, keyEnvelopePair{k, p}) - } - case *packet.SymmetricallyEncrypted: - se = p - break ParsePackets - case *packet.Compressed, *packet.LiteralData, *packet.OnePassSignature: - // This message isn't encrypted. - if len(symKeys) != 0 || len(pubKeys) != 0 { - return nil, errors.StructuralError("key material not followed by encrypted message") - } - packets.Unread(p) - return readSignedMessage(packets, nil, keyring) - } - } - - var candidates []Key - var decrypted io.ReadCloser - - // Now that we have the list of encrypted keys we need to decrypt at - // least one of them or, if we cannot, we need to call the prompt - // function so that it can decrypt a key or give us a passphrase. -FindKey: - for { - // See if any of the keys already have a private key available - candidates = candidates[:0] - candidateFingerprints := make(map[string]bool) - - for _, pk := range pubKeys { - if pk.key.PrivateKey == nil { - continue - } - if !pk.key.PrivateKey.Encrypted { - if len(pk.encryptedKey.Key) == 0 { - pk.encryptedKey.Decrypt(pk.key.PrivateKey, config) - } - if len(pk.encryptedKey.Key) == 0 { - continue - } - decrypted, err = se.Decrypt(pk.encryptedKey.CipherFunc, pk.encryptedKey.Key) - if err != nil && err != errors.ErrKeyIncorrect { - return nil, err - } - if decrypted != nil { - md.DecryptedWith = pk.key - break FindKey - } - } else { - fpr := string(pk.key.PublicKey.Fingerprint[:]) - if v := candidateFingerprints[fpr]; v { - continue - } - candidates = append(candidates, pk.key) - candidateFingerprints[fpr] = true - } - } - - if len(candidates) == 0 && len(symKeys) == 0 { - return nil, errors.ErrKeyIncorrect - } - - if prompt == nil { - return nil, errors.ErrKeyIncorrect - } - - passphrase, err := prompt(candidates, len(symKeys) != 0) - if err != nil { - return nil, err - } - - // Try the symmetric passphrase first - if len(symKeys) != 0 && passphrase != nil { - for _, s := range symKeys { - key, cipherFunc, err := s.Decrypt(passphrase) - if err == nil { - decrypted, err = se.Decrypt(cipherFunc, key) - if err != nil && err != errors.ErrKeyIncorrect { - return nil, err - } - if decrypted != nil { - break FindKey - } - } - - } - } - } - - md.decrypted = decrypted - if err := packets.Push(decrypted); err != nil { - return nil, err - } - return readSignedMessage(packets, md, keyring) -} - -// readSignedMessage reads a possibly signed message if mdin is non-zero then -// that structure is updated and returned. Otherwise a fresh MessageDetails is -// used. -func readSignedMessage(packets *packet.Reader, mdin *MessageDetails, keyring KeyRing) (md *MessageDetails, err error) { - if mdin == nil { - mdin = new(MessageDetails) - } - md = mdin - - var p packet.Packet - var h hash.Hash - var wrappedHash hash.Hash -FindLiteralData: - for { - p, err = packets.Next() - if err != nil { - return nil, err - } - switch p := p.(type) { - case *packet.Compressed: - if err := packets.Push(p.Body); err != nil { - return nil, err - } - case *packet.OnePassSignature: - if !p.IsLast { - return nil, errors.UnsupportedError("nested signatures") - } - - h, wrappedHash, err = hashForSignature(p.Hash, p.SigType) - if err != nil { - md = nil - return - } - - md.IsSigned = true - md.SignedByKeyId = p.KeyId - keys := keyring.KeysByIdUsage(p.KeyId, packet.KeyFlagSign) - if len(keys) > 0 { - md.SignedBy = &keys[0] - } - case *packet.LiteralData: - md.LiteralData = p - break FindLiteralData - } - } - - if md.SignedBy != nil { - md.UnverifiedBody = &signatureCheckReader{packets, h, wrappedHash, md} - } else if md.decrypted != nil { - md.UnverifiedBody = checkReader{md} - } else { - md.UnverifiedBody = md.LiteralData.Body - } - - return md, nil -} - -// hashForSignature returns a pair of hashes that can be used to verify a -// signature. The signature may specify that the contents of the signed message -// should be preprocessed (i.e. to normalize line endings). Thus this function -// returns two hashes. The second should be used to hash the message itself and -// performs any needed preprocessing. -func hashForSignature(hashId crypto.Hash, sigType packet.SignatureType) (hash.Hash, hash.Hash, error) { - if !hashId.Available() { - return nil, nil, errors.UnsupportedError("hash not available: " + strconv.Itoa(int(hashId))) - } - h := hashId.New() - - switch sigType { - case packet.SigTypeBinary: - return h, h, nil - case packet.SigTypeText: - return h, NewCanonicalTextHash(h), nil - } - - return nil, nil, errors.UnsupportedError("unsupported signature type: " + strconv.Itoa(int(sigType))) -} - -// checkReader wraps an io.Reader from a LiteralData packet. When it sees EOF -// it closes the ReadCloser from any SymmetricallyEncrypted packet to trigger -// MDC checks. -type checkReader struct { - md *MessageDetails -} - -func (cr checkReader) Read(buf []byte) (n int, err error) { - n, err = cr.md.LiteralData.Body.Read(buf) - if err == io.EOF { - mdcErr := cr.md.decrypted.Close() - if mdcErr != nil { - err = mdcErr - } - } - return -} - -// signatureCheckReader wraps an io.Reader from a LiteralData packet and hashes -// the data as it is read. When it sees an EOF from the underlying io.Reader -// it parses and checks a trailing Signature packet and triggers any MDC checks. -type signatureCheckReader struct { - packets *packet.Reader - h, wrappedHash hash.Hash - md *MessageDetails -} - -func (scr *signatureCheckReader) Read(buf []byte) (n int, err error) { - n, err = scr.md.LiteralData.Body.Read(buf) - scr.wrappedHash.Write(buf[:n]) - if err == io.EOF { - var p packet.Packet - p, scr.md.SignatureError = scr.packets.Next() - if scr.md.SignatureError != nil { - return - } - - var ok bool - if scr.md.Signature, ok = p.(*packet.Signature); ok { - scr.md.SignatureError = scr.md.SignedBy.PublicKey.VerifySignature(scr.h, scr.md.Signature) - } else if scr.md.SignatureV3, ok = p.(*packet.SignatureV3); ok { - scr.md.SignatureError = scr.md.SignedBy.PublicKey.VerifySignatureV3(scr.h, scr.md.SignatureV3) - } else { - scr.md.SignatureError = errors.StructuralError("LiteralData not followed by Signature") - return - } - - // The SymmetricallyEncrypted packet, if any, might have an - // unsigned hash of its own. In order to check this we need to - // close that Reader. - if scr.md.decrypted != nil { - mdcErr := scr.md.decrypted.Close() - if mdcErr != nil { - err = mdcErr - } - } - } - return -} - -// CheckDetachedSignature takes a signed file and a detached signature and -// returns the signer if the signature is valid. If the signer isn't known, -// ErrUnknownIssuer is returned. -func CheckDetachedSignature(keyring KeyRing, signed, signature io.Reader) (signer *Entity, err error) { - var issuerKeyId uint64 - var hashFunc crypto.Hash - var sigType packet.SignatureType - var keys []Key - var p packet.Packet - - packets := packet.NewReader(signature) - for { - p, err = packets.Next() - if err == io.EOF { - return nil, errors.ErrUnknownIssuer - } - if err != nil { - return nil, err - } - - switch sig := p.(type) { - case *packet.Signature: - if sig.IssuerKeyId == nil { - return nil, errors.StructuralError("signature doesn't have an issuer") - } - issuerKeyId = *sig.IssuerKeyId - hashFunc = sig.Hash - sigType = sig.SigType - case *packet.SignatureV3: - issuerKeyId = sig.IssuerKeyId - hashFunc = sig.Hash - sigType = sig.SigType - default: - return nil, errors.StructuralError("non signature packet found") - } - - keys = keyring.KeysByIdUsage(issuerKeyId, packet.KeyFlagSign) - if len(keys) > 0 { - break - } - } - - if len(keys) == 0 { - panic("unreachable") - } - - h, wrappedHash, err := hashForSignature(hashFunc, sigType) - if err != nil { - return nil, err - } - - if _, err := io.Copy(wrappedHash, signed); err != nil && err != io.EOF { - return nil, err - } - - for _, key := range keys { - switch sig := p.(type) { - case *packet.Signature: - err = key.PublicKey.VerifySignature(h, sig) - case *packet.SignatureV3: - err = key.PublicKey.VerifySignatureV3(h, sig) - default: - panic("unreachable") - } - - if err == nil { - return key.Entity, nil - } - } - - return nil, err -} - -// CheckArmoredDetachedSignature performs the same actions as -// CheckDetachedSignature but expects the signature to be armored. -func CheckArmoredDetachedSignature(keyring KeyRing, signed, signature io.Reader) (signer *Entity, err error) { - body, err := readArmored(signature, SignatureType) - if err != nil { - return - } - - return CheckDetachedSignature(keyring, signed, body) -} diff --git a/vendor/golang.org/x/crypto/openpgp/s2k/s2k.go b/vendor/golang.org/x/crypto/openpgp/s2k/s2k.go deleted file mode 100644 index f53244a1c7b5..000000000000 --- a/vendor/golang.org/x/crypto/openpgp/s2k/s2k.go +++ /dev/null @@ -1,279 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package s2k implements the various OpenPGP string-to-key transforms as -// specified in RFC 4800 section 3.7.1. -// -// Deprecated: this package is unmaintained except for security fixes. New -// applications should consider a more focused, modern alternative to OpenPGP -// for their specific task. If you are required to interoperate with OpenPGP -// systems and need a maintained package, consider a community fork. -// See https://golang.org/issue/44226. -package s2k // import "golang.org/x/crypto/openpgp/s2k" - -import ( - "crypto" - "hash" - "io" - "strconv" - - "golang.org/x/crypto/openpgp/errors" -) - -// Config collects configuration parameters for s2k key-stretching -// transformatioms. A nil *Config is valid and results in all default -// values. Currently, Config is used only by the Serialize function in -// this package. -type Config struct { - // Hash is the default hash function to be used. If - // nil, SHA1 is used. - Hash crypto.Hash - // S2KCount is only used for symmetric encryption. It - // determines the strength of the passphrase stretching when - // the said passphrase is hashed to produce a key. S2KCount - // should be between 1024 and 65011712, inclusive. If Config - // is nil or S2KCount is 0, the value 65536 used. Not all - // values in the above range can be represented. S2KCount will - // be rounded up to the next representable value if it cannot - // be encoded exactly. When set, it is strongly encrouraged to - // use a value that is at least 65536. See RFC 4880 Section - // 3.7.1.3. - S2KCount int -} - -func (c *Config) hash() crypto.Hash { - if c == nil || uint(c.Hash) == 0 { - // SHA1 is the historical default in this package. - return crypto.SHA1 - } - - return c.Hash -} - -func (c *Config) encodedCount() uint8 { - if c == nil || c.S2KCount == 0 { - return 96 // The common case. Correspoding to 65536 - } - - i := c.S2KCount - switch { - // Behave like GPG. Should we make 65536 the lowest value used? - case i < 1024: - i = 1024 - case i > 65011712: - i = 65011712 - } - - return encodeCount(i) -} - -// encodeCount converts an iterative "count" in the range 1024 to -// 65011712, inclusive, to an encoded count. The return value is the -// octet that is actually stored in the GPG file. encodeCount panics -// if i is not in the above range (encodedCount above takes care to -// pass i in the correct range). See RFC 4880 Section 3.7.7.1. -func encodeCount(i int) uint8 { - if i < 1024 || i > 65011712 { - panic("count arg i outside the required range") - } - - for encoded := 0; encoded < 256; encoded++ { - count := decodeCount(uint8(encoded)) - if count >= i { - return uint8(encoded) - } - } - - return 255 -} - -// decodeCount returns the s2k mode 3 iterative "count" corresponding to -// the encoded octet c. -func decodeCount(c uint8) int { - return (16 + int(c&15)) << (uint32(c>>4) + 6) -} - -// Simple writes to out the result of computing the Simple S2K function (RFC -// 4880, section 3.7.1.1) using the given hash and input passphrase. -func Simple(out []byte, h hash.Hash, in []byte) { - Salted(out, h, in, nil) -} - -var zero [1]byte - -// Salted writes to out the result of computing the Salted S2K function (RFC -// 4880, section 3.7.1.2) using the given hash, input passphrase and salt. -func Salted(out []byte, h hash.Hash, in []byte, salt []byte) { - done := 0 - var digest []byte - - for i := 0; done < len(out); i++ { - h.Reset() - for j := 0; j < i; j++ { - h.Write(zero[:]) - } - h.Write(salt) - h.Write(in) - digest = h.Sum(digest[:0]) - n := copy(out[done:], digest) - done += n - } -} - -// Iterated writes to out the result of computing the Iterated and Salted S2K -// function (RFC 4880, section 3.7.1.3) using the given hash, input passphrase, -// salt and iteration count. -func Iterated(out []byte, h hash.Hash, in []byte, salt []byte, count int) { - combined := make([]byte, len(in)+len(salt)) - copy(combined, salt) - copy(combined[len(salt):], in) - - if count < len(combined) { - count = len(combined) - } - - done := 0 - var digest []byte - for i := 0; done < len(out); i++ { - h.Reset() - for j := 0; j < i; j++ { - h.Write(zero[:]) - } - written := 0 - for written < count { - if written+len(combined) > count { - todo := count - written - h.Write(combined[:todo]) - written = count - } else { - h.Write(combined) - written += len(combined) - } - } - digest = h.Sum(digest[:0]) - n := copy(out[done:], digest) - done += n - } -} - -// Parse reads a binary specification for a string-to-key transformation from r -// and returns a function which performs that transform. -func Parse(r io.Reader) (f func(out, in []byte), err error) { - var buf [9]byte - - _, err = io.ReadFull(r, buf[:2]) - if err != nil { - return - } - - hash, ok := HashIdToHash(buf[1]) - if !ok { - return nil, errors.UnsupportedError("hash for S2K function: " + strconv.Itoa(int(buf[1]))) - } - if !hash.Available() { - return nil, errors.UnsupportedError("hash not available: " + strconv.Itoa(int(hash))) - } - h := hash.New() - - switch buf[0] { - case 0: - f := func(out, in []byte) { - Simple(out, h, in) - } - return f, nil - case 1: - _, err = io.ReadFull(r, buf[:8]) - if err != nil { - return - } - f := func(out, in []byte) { - Salted(out, h, in, buf[:8]) - } - return f, nil - case 3: - _, err = io.ReadFull(r, buf[:9]) - if err != nil { - return - } - count := decodeCount(buf[8]) - f := func(out, in []byte) { - Iterated(out, h, in, buf[:8], count) - } - return f, nil - } - - return nil, errors.UnsupportedError("S2K function") -} - -// Serialize salts and stretches the given passphrase and writes the -// resulting key into key. It also serializes an S2K descriptor to -// w. The key stretching can be configured with c, which may be -// nil. In that case, sensible defaults will be used. -func Serialize(w io.Writer, key []byte, rand io.Reader, passphrase []byte, c *Config) error { - var buf [11]byte - buf[0] = 3 /* iterated and salted */ - buf[1], _ = HashToHashId(c.hash()) - salt := buf[2:10] - if _, err := io.ReadFull(rand, salt); err != nil { - return err - } - encodedCount := c.encodedCount() - count := decodeCount(encodedCount) - buf[10] = encodedCount - if _, err := w.Write(buf[:]); err != nil { - return err - } - - Iterated(key, c.hash().New(), passphrase, salt, count) - return nil -} - -// hashToHashIdMapping contains pairs relating OpenPGP's hash identifier with -// Go's crypto.Hash type. See RFC 4880, section 9.4. -var hashToHashIdMapping = []struct { - id byte - hash crypto.Hash - name string -}{ - {1, crypto.MD5, "MD5"}, - {2, crypto.SHA1, "SHA1"}, - {3, crypto.RIPEMD160, "RIPEMD160"}, - {8, crypto.SHA256, "SHA256"}, - {9, crypto.SHA384, "SHA384"}, - {10, crypto.SHA512, "SHA512"}, - {11, crypto.SHA224, "SHA224"}, -} - -// HashIdToHash returns a crypto.Hash which corresponds to the given OpenPGP -// hash id. -func HashIdToHash(id byte) (h crypto.Hash, ok bool) { - for _, m := range hashToHashIdMapping { - if m.id == id { - return m.hash, true - } - } - return 0, false -} - -// HashIdToString returns the name of the hash function corresponding to the -// given OpenPGP hash id. -func HashIdToString(id byte) (name string, ok bool) { - for _, m := range hashToHashIdMapping { - if m.id == id { - return m.name, true - } - } - - return "", false -} - -// HashToHashId returns an OpenPGP hash id which corresponds the given Hash. -func HashToHashId(h crypto.Hash) (id byte, ok bool) { - for _, m := range hashToHashIdMapping { - if m.hash == h { - return m.id, true - } - } - return 0, false -} diff --git a/vendor/golang.org/x/crypto/openpgp/write.go b/vendor/golang.org/x/crypto/openpgp/write.go deleted file mode 100644 index b89d48b81d73..000000000000 --- a/vendor/golang.org/x/crypto/openpgp/write.go +++ /dev/null @@ -1,418 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package openpgp - -import ( - "crypto" - "hash" - "io" - "strconv" - "time" - - "golang.org/x/crypto/openpgp/armor" - "golang.org/x/crypto/openpgp/errors" - "golang.org/x/crypto/openpgp/packet" - "golang.org/x/crypto/openpgp/s2k" -) - -// DetachSign signs message with the private key from signer (which must -// already have been decrypted) and writes the signature to w. -// If config is nil, sensible defaults will be used. -func DetachSign(w io.Writer, signer *Entity, message io.Reader, config *packet.Config) error { - return detachSign(w, signer, message, packet.SigTypeBinary, config) -} - -// ArmoredDetachSign signs message with the private key from signer (which -// must already have been decrypted) and writes an armored signature to w. -// If config is nil, sensible defaults will be used. -func ArmoredDetachSign(w io.Writer, signer *Entity, message io.Reader, config *packet.Config) (err error) { - return armoredDetachSign(w, signer, message, packet.SigTypeBinary, config) -} - -// DetachSignText signs message (after canonicalising the line endings) with -// the private key from signer (which must already have been decrypted) and -// writes the signature to w. -// If config is nil, sensible defaults will be used. -func DetachSignText(w io.Writer, signer *Entity, message io.Reader, config *packet.Config) error { - return detachSign(w, signer, message, packet.SigTypeText, config) -} - -// ArmoredDetachSignText signs message (after canonicalising the line endings) -// with the private key from signer (which must already have been decrypted) -// and writes an armored signature to w. -// If config is nil, sensible defaults will be used. -func ArmoredDetachSignText(w io.Writer, signer *Entity, message io.Reader, config *packet.Config) error { - return armoredDetachSign(w, signer, message, packet.SigTypeText, config) -} - -func armoredDetachSign(w io.Writer, signer *Entity, message io.Reader, sigType packet.SignatureType, config *packet.Config) (err error) { - out, err := armor.Encode(w, SignatureType, nil) - if err != nil { - return - } - err = detachSign(out, signer, message, sigType, config) - if err != nil { - return - } - return out.Close() -} - -func detachSign(w io.Writer, signer *Entity, message io.Reader, sigType packet.SignatureType, config *packet.Config) (err error) { - if signer.PrivateKey == nil { - return errors.InvalidArgumentError("signing key doesn't have a private key") - } - if signer.PrivateKey.Encrypted { - return errors.InvalidArgumentError("signing key is encrypted") - } - - sig := new(packet.Signature) - sig.SigType = sigType - sig.PubKeyAlgo = signer.PrivateKey.PubKeyAlgo - sig.Hash = config.Hash() - sig.CreationTime = config.Now() - sig.IssuerKeyId = &signer.PrivateKey.KeyId - - h, wrappedHash, err := hashForSignature(sig.Hash, sig.SigType) - if err != nil { - return - } - io.Copy(wrappedHash, message) - - err = sig.Sign(h, signer.PrivateKey, config) - if err != nil { - return - } - - return sig.Serialize(w) -} - -// FileHints contains metadata about encrypted files. This metadata is, itself, -// encrypted. -type FileHints struct { - // IsBinary can be set to hint that the contents are binary data. - IsBinary bool - // FileName hints at the name of the file that should be written. It's - // truncated to 255 bytes if longer. It may be empty to suggest that the - // file should not be written to disk. It may be equal to "_CONSOLE" to - // suggest the data should not be written to disk. - FileName string - // ModTime contains the modification time of the file, or the zero time if not applicable. - ModTime time.Time -} - -// SymmetricallyEncrypt acts like gpg -c: it encrypts a file with a passphrase. -// The resulting WriteCloser must be closed after the contents of the file have -// been written. -// If config is nil, sensible defaults will be used. -func SymmetricallyEncrypt(ciphertext io.Writer, passphrase []byte, hints *FileHints, config *packet.Config) (plaintext io.WriteCloser, err error) { - if hints == nil { - hints = &FileHints{} - } - - key, err := packet.SerializeSymmetricKeyEncrypted(ciphertext, passphrase, config) - if err != nil { - return - } - w, err := packet.SerializeSymmetricallyEncrypted(ciphertext, config.Cipher(), key, config) - if err != nil { - return - } - - literaldata := w - if algo := config.Compression(); algo != packet.CompressionNone { - var compConfig *packet.CompressionConfig - if config != nil { - compConfig = config.CompressionConfig - } - literaldata, err = packet.SerializeCompressed(w, algo, compConfig) - if err != nil { - return - } - } - - var epochSeconds uint32 - if !hints.ModTime.IsZero() { - epochSeconds = uint32(hints.ModTime.Unix()) - } - return packet.SerializeLiteral(literaldata, hints.IsBinary, hints.FileName, epochSeconds) -} - -// intersectPreferences mutates and returns a prefix of a that contains only -// the values in the intersection of a and b. The order of a is preserved. -func intersectPreferences(a []uint8, b []uint8) (intersection []uint8) { - var j int - for _, v := range a { - for _, v2 := range b { - if v == v2 { - a[j] = v - j++ - break - } - } - } - - return a[:j] -} - -func hashToHashId(h crypto.Hash) uint8 { - v, ok := s2k.HashToHashId(h) - if !ok { - panic("tried to convert unknown hash") - } - return v -} - -// writeAndSign writes the data as a payload package and, optionally, signs -// it. hints contains optional information, that is also encrypted, -// that aids the recipients in processing the message. The resulting -// WriteCloser must be closed after the contents of the file have been -// written. If config is nil, sensible defaults will be used. -func writeAndSign(payload io.WriteCloser, candidateHashes []uint8, signed *Entity, hints *FileHints, config *packet.Config) (plaintext io.WriteCloser, err error) { - var signer *packet.PrivateKey - if signed != nil { - signKey, ok := signed.signingKey(config.Now()) - if !ok { - return nil, errors.InvalidArgumentError("no valid signing keys") - } - signer = signKey.PrivateKey - if signer == nil { - return nil, errors.InvalidArgumentError("no private key in signing key") - } - if signer.Encrypted { - return nil, errors.InvalidArgumentError("signing key must be decrypted") - } - } - - var hash crypto.Hash - for _, hashId := range candidateHashes { - if h, ok := s2k.HashIdToHash(hashId); ok && h.Available() { - hash = h - break - } - } - - // If the hash specified by config is a candidate, we'll use that. - if configuredHash := config.Hash(); configuredHash.Available() { - for _, hashId := range candidateHashes { - if h, ok := s2k.HashIdToHash(hashId); ok && h == configuredHash { - hash = h - break - } - } - } - - if hash == 0 { - hashId := candidateHashes[0] - name, ok := s2k.HashIdToString(hashId) - if !ok { - name = "#" + strconv.Itoa(int(hashId)) - } - return nil, errors.InvalidArgumentError("cannot encrypt because no candidate hash functions are compiled in. (Wanted " + name + " in this case.)") - } - - if signer != nil { - ops := &packet.OnePassSignature{ - SigType: packet.SigTypeBinary, - Hash: hash, - PubKeyAlgo: signer.PubKeyAlgo, - KeyId: signer.KeyId, - IsLast: true, - } - if err := ops.Serialize(payload); err != nil { - return nil, err - } - } - - if hints == nil { - hints = &FileHints{} - } - - w := payload - if signer != nil { - // If we need to write a signature packet after the literal - // data then we need to stop literalData from closing - // encryptedData. - w = noOpCloser{w} - - } - var epochSeconds uint32 - if !hints.ModTime.IsZero() { - epochSeconds = uint32(hints.ModTime.Unix()) - } - literalData, err := packet.SerializeLiteral(w, hints.IsBinary, hints.FileName, epochSeconds) - if err != nil { - return nil, err - } - - if signer != nil { - return signatureWriter{payload, literalData, hash, hash.New(), signer, config}, nil - } - return literalData, nil -} - -// Encrypt encrypts a message to a number of recipients and, optionally, signs -// it. hints contains optional information, that is also encrypted, that aids -// the recipients in processing the message. The resulting WriteCloser must -// be closed after the contents of the file have been written. -// If config is nil, sensible defaults will be used. -func Encrypt(ciphertext io.Writer, to []*Entity, signed *Entity, hints *FileHints, config *packet.Config) (plaintext io.WriteCloser, err error) { - if len(to) == 0 { - return nil, errors.InvalidArgumentError("no encryption recipient provided") - } - - // These are the possible ciphers that we'll use for the message. - candidateCiphers := []uint8{ - uint8(packet.CipherAES128), - uint8(packet.CipherAES256), - uint8(packet.CipherCAST5), - } - // These are the possible hash functions that we'll use for the signature. - candidateHashes := []uint8{ - hashToHashId(crypto.SHA256), - hashToHashId(crypto.SHA384), - hashToHashId(crypto.SHA512), - hashToHashId(crypto.SHA1), - hashToHashId(crypto.RIPEMD160), - } - // In the event that a recipient doesn't specify any supported ciphers - // or hash functions, these are the ones that we assume that every - // implementation supports. - defaultCiphers := candidateCiphers[len(candidateCiphers)-1:] - defaultHashes := candidateHashes[len(candidateHashes)-1:] - - encryptKeys := make([]Key, len(to)) - for i := range to { - var ok bool - encryptKeys[i], ok = to[i].encryptionKey(config.Now()) - if !ok { - return nil, errors.InvalidArgumentError("cannot encrypt a message to key id " + strconv.FormatUint(to[i].PrimaryKey.KeyId, 16) + " because it has no encryption keys") - } - - sig := to[i].primaryIdentity().SelfSignature - - preferredSymmetric := sig.PreferredSymmetric - if len(preferredSymmetric) == 0 { - preferredSymmetric = defaultCiphers - } - preferredHashes := sig.PreferredHash - if len(preferredHashes) == 0 { - preferredHashes = defaultHashes - } - candidateCiphers = intersectPreferences(candidateCiphers, preferredSymmetric) - candidateHashes = intersectPreferences(candidateHashes, preferredHashes) - } - - if len(candidateCiphers) == 0 || len(candidateHashes) == 0 { - return nil, errors.InvalidArgumentError("cannot encrypt because recipient set shares no common algorithms") - } - - cipher := packet.CipherFunction(candidateCiphers[0]) - // If the cipher specified by config is a candidate, we'll use that. - configuredCipher := config.Cipher() - for _, c := range candidateCiphers { - cipherFunc := packet.CipherFunction(c) - if cipherFunc == configuredCipher { - cipher = cipherFunc - break - } - } - - symKey := make([]byte, cipher.KeySize()) - if _, err := io.ReadFull(config.Random(), symKey); err != nil { - return nil, err - } - - for _, key := range encryptKeys { - if err := packet.SerializeEncryptedKey(ciphertext, key.PublicKey, cipher, symKey, config); err != nil { - return nil, err - } - } - - payload, err := packet.SerializeSymmetricallyEncrypted(ciphertext, cipher, symKey, config) - if err != nil { - return - } - - return writeAndSign(payload, candidateHashes, signed, hints, config) -} - -// Sign signs a message. The resulting WriteCloser must be closed after the -// contents of the file have been written. hints contains optional information -// that aids the recipients in processing the message. -// If config is nil, sensible defaults will be used. -func Sign(output io.Writer, signed *Entity, hints *FileHints, config *packet.Config) (input io.WriteCloser, err error) { - if signed == nil { - return nil, errors.InvalidArgumentError("no signer provided") - } - - // These are the possible hash functions that we'll use for the signature. - candidateHashes := []uint8{ - hashToHashId(crypto.SHA256), - hashToHashId(crypto.SHA384), - hashToHashId(crypto.SHA512), - hashToHashId(crypto.SHA1), - hashToHashId(crypto.RIPEMD160), - } - defaultHashes := candidateHashes[len(candidateHashes)-1:] - preferredHashes := signed.primaryIdentity().SelfSignature.PreferredHash - if len(preferredHashes) == 0 { - preferredHashes = defaultHashes - } - candidateHashes = intersectPreferences(candidateHashes, preferredHashes) - return writeAndSign(noOpCloser{output}, candidateHashes, signed, hints, config) -} - -// signatureWriter hashes the contents of a message while passing it along to -// literalData. When closed, it closes literalData, writes a signature packet -// to encryptedData and then also closes encryptedData. -type signatureWriter struct { - encryptedData io.WriteCloser - literalData io.WriteCloser - hashType crypto.Hash - h hash.Hash - signer *packet.PrivateKey - config *packet.Config -} - -func (s signatureWriter) Write(data []byte) (int, error) { - s.h.Write(data) - return s.literalData.Write(data) -} - -func (s signatureWriter) Close() error { - sig := &packet.Signature{ - SigType: packet.SigTypeBinary, - PubKeyAlgo: s.signer.PubKeyAlgo, - Hash: s.hashType, - CreationTime: s.config.Now(), - IssuerKeyId: &s.signer.KeyId, - } - - if err := sig.Sign(s.h, s.signer, s.config); err != nil { - return err - } - if err := s.literalData.Close(); err != nil { - return err - } - if err := sig.Serialize(s.encryptedData); err != nil { - return err - } - return s.encryptedData.Close() -} - -// noOpCloser is like an io.NopCloser, but for an io.Writer. -// TODO: we have two of these in OpenPGP packages alone. This probably needs -// to be promoted somewhere more common. -type noOpCloser struct { - w io.Writer -} - -func (c noOpCloser) Write(data []byte) (n int, err error) { - return c.w.Write(data) -} - -func (c noOpCloser) Close() error { - return nil -} diff --git a/vendor/knative.dev/pkg/test/ghutil/client.go b/vendor/knative.dev/pkg/test/ghutil/client.go deleted file mode 100644 index 2dc162e0bc99..000000000000 --- a/vendor/knative.dev/pkg/test/ghutil/client.go +++ /dev/null @@ -1,159 +0,0 @@ -/* -Copyright 2019 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// client.go defines clients, and provide helpers overcome Github rate limit errors - -package ghutil - -import ( - "context" - "errors" - "fmt" - "log" - "os" - "strings" - "time" - - "github.com/google/go-github/v27/github" - "golang.org/x/oauth2" -) - -const ( - maxRetryCount = 5 - tokenReserve = 50 -) - -var ( - ctx = context.Background() -) - -// GithubOperations contains a set of functions for Github operations -type GithubOperations interface { - GetGithubUser() (*github.User, error) - ListRepos(org string) ([]string, error) - ListIssuesByRepo(org, repo string, labels []string) ([]*github.Issue, error) - CreateIssue(org, repo, title, body string) (*github.Issue, error) - CloseIssue(org, repo string, issueNumber int) error - ReopenIssue(org, repo string, issueNumber int) error - ListComments(org, repo string, issueNumber int) ([]*github.IssueComment, error) - GetComment(org, repo string, commentID int64) (*github.IssueComment, error) - CreateComment(org, repo string, issueNumber int, commentBody string) (*github.IssueComment, error) - EditComment(org, repo string, commentID int64, commentBody string) error - DeleteComment(org, repo string, commentID int64) error - AddLabelsToIssue(org, repo string, issueNumber int, labels []string) error - RemoveLabelForIssue(org, repo string, issueNumber int, label string) error - GetPullRequest(org, repo string, ID int) (*github.PullRequest, error) - GetPullRequestByCommitID(org, repo, commitID string) (*github.PullRequest, error) - EditPullRequest(org, repo string, ID int, title, body string) (*github.PullRequest, error) - ListPullRequests(org, repo, head, base string) ([]*github.PullRequest, error) - ListCommits(org, repo string, ID int) ([]*github.RepositoryCommit, error) - ListFiles(org, repo string, ID int) ([]*github.CommitFile, error) - CreatePullRequest(org, repo, head, base, title, body string) (*github.PullRequest, error) - ListBranches(org, repo string) ([]*github.Branch, error) -} - -// GithubClient provides methods to perform github operations -// It implements all functions in GithubOperations -type GithubClient struct { - Client *github.Client -} - -// NewGithubClient explicitly authenticates to github with giving token and returns a handle -func NewGithubClient(tokenFilePath string) (*GithubClient, error) { - b, err := os.ReadFile(tokenFilePath) - if err != nil { - return nil, err - } - ts := oauth2.StaticTokenSource( - &oauth2.Token{AccessToken: strings.TrimSpace(string(b))}, - ) - - return &GithubClient{github.NewClient(oauth2.NewClient(ctx, ts))}, nil -} - -// GetGithubUser gets current authenticated user -func (gc *GithubClient) GetGithubUser() (*github.User, error) { - var res *github.User - _, err := gc.retry( - "getting current user", - maxRetryCount, - func() (*github.Response, error) { - var resp *github.Response - var err error - res, resp, err = gc.Client.Users.Get(ctx, "") - return resp, err - }, - ) - return res, err -} - -func (gc *GithubClient) waitForRateReset(r *github.Rate) { - if r.Remaining <= tokenReserve { - sleepDuration := time.Until(r.Reset.Time) + (time.Second * 10) - if sleepDuration > 0 { - log.Printf("--Rate Limiting-- GitHub tokens reached minimum reserve %d. Sleeping %ds until reset.\n", tokenReserve, sleepDuration) - time.Sleep(sleepDuration) - } - } -} - -// Github API has a rate limit, retry waits until rate limit reset if request failed with RateLimitError, -// then retry maxRetries times until succeed -func (gc *GithubClient) retry(message string, maxRetries int, call func() (*github.Response, error)) (*github.Response, error) { - var err error - var resp *github.Response - - for retryCount := 0; retryCount <= maxRetries; retryCount++ { - if resp, err = call(); nil == err { - return resp, nil - } - - var errRateLimit *github.RateLimitError - if errors.As(err, &errRateLimit) { - gc.waitForRateReset(&errRateLimit.Rate) - } else { - return resp, err - } - log.Printf("error %s: %v. Will retry.\n", message, err) - } - return resp, err -} - -// depaginate adds depagination on top of the retry, in case list exceeds rate limit -func (gc *GithubClient) depaginate(message string, maxRetries int, options *github.ListOptions, call func() ([]interface{}, *github.Response, error)) ([]interface{}, error) { - var allItems []interface{} - wrapper := func() (*github.Response, error) { - items, resp, err := call() - if err == nil { - allItems = append(allItems, items...) - } - return resp, err - } - - options.Page = 1 - options.PerPage = 100 - lastPage := 1 - for ; options.Page <= lastPage; options.Page++ { - resp, err := gc.retry(message, maxRetries, wrapper) - if err != nil { - return allItems, fmt.Errorf("error while depaginating page %d/%d: %w", options.Page, lastPage, err) - } - if resp.LastPage > 0 { - lastPage = resp.LastPage - } - } - return allItems, nil -} diff --git a/vendor/knative.dev/pkg/test/ghutil/issue.go b/vendor/knative.dev/pkg/test/ghutil/issue.go deleted file mode 100644 index 29bca7196e6b..000000000000 --- a/vendor/knative.dev/pkg/test/ghutil/issue.go +++ /dev/null @@ -1,254 +0,0 @@ -/* -Copyright 2019 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// issue.go provides generic functions related to issues - -package ghutil - -import ( - "fmt" - - "github.com/google/go-github/v27/github" -) - -const ( - // IssueOpenState is the state of open github issue - IssueOpenState IssueStateEnum = "open" - // IssueCloseState is the state of closed github issue - IssueCloseState IssueStateEnum = "closed" - // IssueAllState is the state for all, useful when querying issues - IssueAllState IssueStateEnum = "all" -) - -// IssueStateEnum represents different states of Github Issues -type IssueStateEnum string - -// ListRepos lists repos under org -func (gc *GithubClient) ListRepos(org string) ([]string, error) { - repoListOptions := &github.RepositoryListOptions{} - genericList, err := gc.depaginate( - "listing repos", - maxRetryCount, - &repoListOptions.ListOptions, - func() ([]interface{}, *github.Response, error) { - page, resp, err := gc.Client.Repositories.List(ctx, org, repoListOptions) - var interfaceList []interface{} - if nil == err { - for _, repo := range page { - interfaceList = append(interfaceList, repo) - } - } - return interfaceList, resp, err - }, - ) - res := make([]string, len(genericList)) - for i, elem := range genericList { - res[i] = elem.(*github.Repository).GetName() - } - return res, err -} - -// ListIssuesByRepo lists issues within given repo, filters by labels if provided -func (gc *GithubClient) ListIssuesByRepo(org, repo string, labels []string) ([]*github.Issue, error) { - issueListOptions := &github.IssueListByRepoOptions{ - State: string(IssueAllState), - } - if len(labels) > 0 { - issueListOptions.Labels = labels - } - - genericList, err := gc.depaginate( - fmt.Sprintf("listing issues with label '%v'", labels), - maxRetryCount, - &issueListOptions.ListOptions, - func() ([]interface{}, *github.Response, error) { - page, resp, err := gc.Client.Issues.ListByRepo(ctx, org, repo, issueListOptions) - var interfaceList []interface{} - if nil == err { - for _, issue := range page { - interfaceList = append(interfaceList, issue) - } - } - return interfaceList, resp, err - }, - ) - res := make([]*github.Issue, len(genericList)) - for i, elem := range genericList { - res[i] = elem.(*github.Issue) - } - return res, err -} - -// CreateIssue creates issue -func (gc *GithubClient) CreateIssue(org, repo, title, body string) (*github.Issue, error) { - issue := &github.IssueRequest{ - Title: &title, - Body: &body, - } - - var res *github.Issue - _, err := gc.retry( - fmt.Sprintf("creating issue '%s %s' '%s'", org, repo, title), - maxRetryCount, - func() (*github.Response, error) { - var resp *github.Response - var err error - res, resp, err = gc.Client.Issues.Create(ctx, org, repo, issue) - return resp, err - }, - ) - return res, err -} - -// CloseIssue closes issue -func (gc *GithubClient) CloseIssue(org, repo string, issueNumber int) error { - return gc.updateIssueState(org, repo, IssueCloseState, issueNumber) -} - -// ReopenIssue reopen issue -func (gc *GithubClient) ReopenIssue(org, repo string, issueNumber int) error { - return gc.updateIssueState(org, repo, IssueOpenState, issueNumber) -} - -// ListComments gets all comments from issue -func (gc *GithubClient) ListComments(org, repo string, issueNumber int) ([]*github.IssueComment, error) { - commentListOptions := &github.IssueListCommentsOptions{} - genericList, err := gc.depaginate( - fmt.Sprintf("listing comment for issue '%s %s %d'", org, repo, issueNumber), - maxRetryCount, - &commentListOptions.ListOptions, - func() ([]interface{}, *github.Response, error) { - page, resp, err := gc.Client.Issues.ListComments(ctx, org, repo, issueNumber, commentListOptions) - var interfaceList []interface{} - if nil == err { - for _, issue := range page { - interfaceList = append(interfaceList, issue) - } - } - return interfaceList, resp, err - }, - ) - res := make([]*github.IssueComment, len(genericList)) - for i, elem := range genericList { - res[i] = elem.(*github.IssueComment) - } - return res, err -} - -// GetComment gets comment by comment ID -func (gc *GithubClient) GetComment(org, repo string, commentID int64) (*github.IssueComment, error) { - var res *github.IssueComment - _, err := gc.retry( - fmt.Sprintf("getting comment '%s %s %d'", org, repo, commentID), - maxRetryCount, - func() (*github.Response, error) { - var resp *github.Response - var err error - res, resp, err = gc.Client.Issues.GetComment(ctx, org, repo, commentID) - return resp, err - }, - ) - return res, err -} - -// CreateComment adds comment to issue -func (gc *GithubClient) CreateComment(org, repo string, issueNumber int, commentBody string) (*github.IssueComment, error) { - var res *github.IssueComment - comment := &github.IssueComment{ - Body: &commentBody, - } - _, err := gc.retry( - fmt.Sprintf("commenting issue '%s %s %d'", org, repo, issueNumber), - maxRetryCount, - func() (*github.Response, error) { - var resp *github.Response - var err error - res, resp, err = gc.Client.Issues.CreateComment(ctx, org, repo, issueNumber, comment) - return resp, err - }, - ) - return res, err -} - -// EditComment edits comment by replacing with provided comment -func (gc *GithubClient) EditComment(org, repo string, commentID int64, commentBody string) error { - comment := &github.IssueComment{ - Body: &commentBody, - } - _, err := gc.retry( - fmt.Sprintf("editing comment '%s %s %d'", org, repo, commentID), - maxRetryCount, - func() (*github.Response, error) { - _, resp, err := gc.Client.Issues.EditComment(ctx, org, repo, commentID, comment) - return resp, err - }, - ) - return err -} - -// DeleteComment deletes comment from issue -func (gc *GithubClient) DeleteComment(org, repo string, commentID int64) error { - _, err := gc.retry( - fmt.Sprintf("deleting comment '%s %s %d'", org, repo, commentID), - maxRetryCount, - func() (*github.Response, error) { - resp, err := gc.Client.Issues.DeleteComment(ctx, org, repo, commentID) - return resp, err - }, - ) - return err -} - -// AddLabelsToIssue adds label on issue -func (gc *GithubClient) AddLabelsToIssue(org, repo string, issueNumber int, labels []string) error { - _, err := gc.retry( - fmt.Sprintf("add labels '%v' to '%s %s %d'", labels, org, repo, issueNumber), - maxRetryCount, - func() (*github.Response, error) { - _, resp, err := gc.Client.Issues.AddLabelsToIssue(ctx, org, repo, issueNumber, labels) - return resp, err - }, - ) - return err -} - -// RemoveLabelForIssue removes given label for issue -func (gc *GithubClient) RemoveLabelForIssue(org, repo string, issueNumber int, label string) error { - _, err := gc.retry( - fmt.Sprintf("remove label '%s' from '%s %s %d'", label, org, repo, issueNumber), - maxRetryCount, - func() (*github.Response, error) { - return gc.Client.Issues.RemoveLabelForIssue(ctx, org, repo, issueNumber, label) - }, - ) - return err -} - -func (gc *GithubClient) updateIssueState(org, repo string, state IssueStateEnum, issueNumber int) error { - stateString := string(state) - issueRequest := &github.IssueRequest{ - State: &stateString, - } - _, err := gc.retry( - fmt.Sprintf("applying '%s' action on issue '%s %s %d'", stateString, org, repo, issueNumber), - maxRetryCount, - func() (*github.Response, error) { - _, resp, err := gc.Client.Issues.Edit(ctx, org, repo, issueNumber, issueRequest) - return resp, err - }, - ) - return err -} diff --git a/vendor/knative.dev/pkg/test/ghutil/pullrequest.go b/vendor/knative.dev/pkg/test/ghutil/pullrequest.go deleted file mode 100644 index 2a4303460f8b..000000000000 --- a/vendor/knative.dev/pkg/test/ghutil/pullrequest.go +++ /dev/null @@ -1,210 +0,0 @@ -/* -Copyright 2019 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// pullrequest.go provides generic functions related to PullRequest - -package ghutil - -import ( - "fmt" - - "github.com/google/go-github/v27/github" -) - -const ( - // PullRequestOpenState is the state of open PullRequest - PullRequestOpenState PullRequestState = "open" - // PullRequestCloseState is the state of closed PullRequest - PullRequestCloseState PullRequestState = "closed" - // PullRequestAllState is the state for all, useful when querying PullRequest - PullRequestAllState PullRequestState = "all" -) - -// PullRequestState represents different states of PullRequest -type PullRequestState string - -// ListPullRequests lists pull requests within given repo, filters by head user and branch name if -// provided as "user:ref-name", and by base name if provided, i.e. "release-0.19" -func (gc *GithubClient) ListPullRequests(org, repo, head, base string) ([]*github.PullRequest, error) { - PRsListOptions := github.PullRequestListOptions{ - State: string(PullRequestAllState), - Head: head, - Base: base, - } - - genericList, err := gc.depaginate( - fmt.Sprintf("listing Pull Requests with head '%s' and base '%s'", head, base), - maxRetryCount, - &PRsListOptions.ListOptions, - func() ([]interface{}, *github.Response, error) { - page, resp, err := gc.Client.PullRequests.List(ctx, org, repo, &PRsListOptions) - var interfaceList []interface{} - if nil == err { - for _, PR := range page { - interfaceList = append(interfaceList, PR) - } - } - return interfaceList, resp, err - }, - ) - res := make([]*github.PullRequest, len(genericList)) - for i, elem := range genericList { - res[i] = elem.(*github.PullRequest) - } - return res, err -} - -// ListCommits lists commits from a pull request -func (gc *GithubClient) ListCommits(org, repo string, ID int) ([]*github.RepositoryCommit, error) { - options := &github.ListOptions{} - genericList, err := gc.depaginate( - fmt.Sprintf("listing commits in Pull Requests '%d'", ID), - maxRetryCount, - options, - func() ([]interface{}, *github.Response, error) { - page, resp, err := gc.Client.PullRequests.ListCommits(ctx, org, repo, ID, options) - var interfaceList []interface{} - if nil == err { - for _, commit := range page { - interfaceList = append(interfaceList, commit) - } - } - return interfaceList, resp, err - }, - ) - res := make([]*github.RepositoryCommit, len(genericList)) - for i, elem := range genericList { - res[i] = elem.(*github.RepositoryCommit) - } - return res, err -} - -// ListFiles lists files from a pull request -func (gc *GithubClient) ListFiles(org, repo string, ID int) ([]*github.CommitFile, error) { - options := &github.ListOptions{} - genericList, err := gc.depaginate( - fmt.Sprintf("listing files in Pull Requests '%d'", ID), - maxRetryCount, - options, - func() ([]interface{}, *github.Response, error) { - page, resp, err := gc.Client.PullRequests.ListFiles(ctx, org, repo, ID, options) - var interfaceList []interface{} - if nil == err { - for _, f := range page { - interfaceList = append(interfaceList, f) - } - } - return interfaceList, resp, err - }, - ) - res := make([]*github.CommitFile, len(genericList)) - for i, elem := range genericList { - res[i] = elem.(*github.CommitFile) - } - return res, err -} - -// GetPullRequest gets PullRequest by ID -func (gc *GithubClient) GetPullRequest(org, repo string, ID int) (*github.PullRequest, error) { - var res *github.PullRequest - _, err := gc.retry( - fmt.Sprintf("Get PullRequest '%d'", ID), - maxRetryCount, - func() (*github.Response, error) { - var resp *github.Response - var err error - res, resp, err = gc.Client.PullRequests.Get(ctx, org, repo, ID) - return resp, err - }, - ) - return res, err -} - -// GetPullRequestByCommitID gets PullRequest by commit ID -func (gc *GithubClient) GetPullRequestByCommitID(org, repo, commitID string) (*github.PullRequest, error) { - var res []*github.PullRequest - if _, err := gc.retry( - fmt.Sprintf("Get PullRequest by commit ID '%s'", commitID), - maxRetryCount, - func() (*github.Response, error) { - var resp *github.Response - var err error - res, resp, err = gc.Client.PullRequests.ListPullRequestsWithCommit( - ctx, - org, - repo, - commitID, - &github.PullRequestListOptions{}, - ) - return resp, err - }, - ); err != nil { - return nil, err - } - - if len(res) != 1 { - return nil, fmt.Errorf("GetPullRequestByCommitID is expected to return 1 PullRequest, got %d", len(res)) - } - return res[0], nil -} - -// EditPullRequest updates PullRequest -func (gc *GithubClient) EditPullRequest(org, repo string, ID int, title, body string) (*github.PullRequest, error) { - PR, err := gc.GetPullRequest(org, repo, ID) - if nil != err || nil == PR { - return nil, err - } - - PR.Title = &title - PR.Body = &body - var res *github.PullRequest - _, err = gc.retry( - fmt.Sprintf("Update PullRequest '%d', title: '%s'. body: '%s'", ID, title, body), - maxRetryCount, - func() (*github.Response, error) { - var resp *github.Response - var err error - res, resp, err = gc.Client.PullRequests.Edit(ctx, org, repo, ID, PR) - return resp, err - }, - ) - return res, err -} - -// CreatePullRequest creates PullRequest, passing head user and branch name "user:ref-name", and base branch name like "release-0.19" -func (gc *GithubClient) CreatePullRequest(org, repo, head, base, title, body string) (*github.PullRequest, error) { - b := true - PR := &github.NewPullRequest{ - Title: &title, - Body: &body, - Head: &head, - Base: &base, - MaintainerCanModify: &b, - } - - var res *github.PullRequest - _, err := gc.retry( - fmt.Sprintf("creating PullRequest from '%s' to '%s', title: '%s'. body: '%s'", head, base, title, body), - maxRetryCount, - func() (*github.Response, error) { - var resp *github.Response - var err error - res, resp, err = gc.Client.PullRequests.Create(ctx, org, repo, PR) - return resp, err - }, - ) - return res, err -} diff --git a/vendor/knative.dev/pkg/test/ghutil/repo.go b/vendor/knative.dev/pkg/test/ghutil/repo.go deleted file mode 100644 index 1f645856e20a..000000000000 --- a/vendor/knative.dev/pkg/test/ghutil/repo.go +++ /dev/null @@ -1,49 +0,0 @@ -/* -Copyright 2020 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// repo.go provides generic functions related to Repo - -package ghutil - -import ( - "fmt" - - "github.com/google/go-github/v27/github" -) - -// ListBranches lists branchs for given repo -func (gc *GithubClient) ListBranches(org, repo string) ([]*github.Branch, error) { - genericList, err := gc.depaginate( - fmt.Sprintf("listing Pull request from org %q and base %q", org, repo), - maxRetryCount, - &github.ListOptions{}, - func() ([]interface{}, *github.Response, error) { - page, resp, err := gc.Client.Repositories.ListBranches(ctx, org, repo, nil) - var interfaceList []interface{} - if nil == err { - for _, PR := range page { - interfaceList = append(interfaceList, PR) - } - } - return interfaceList, resp, err - }, - ) - res := make([]*github.Branch, len(genericList)) - for i, elem := range genericList { - res[i] = elem.(*github.Branch) - } - return res, err -} diff --git a/vendor/knative.dev/pkg/test/mako/README.md b/vendor/knative.dev/pkg/test/mako/README.md deleted file mode 100644 index dbb48b56041c..000000000000 --- a/vendor/knative.dev/pkg/test/mako/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# Mako - -[Mako](https://github.com/google/mako) is an open source project for performance -testing in Knative. It offers capacities like data storage, charting, -statistical aggregation and automated regression analysis. - -This folder contains common code that can be used by all Knative projects, with -which we can follow the same process to set up Mako and collaborate. diff --git a/vendor/knative.dev/pkg/test/mako/alerter/alerter.go b/vendor/knative.dev/pkg/test/mako/alerter/alerter.go deleted file mode 100644 index 8bc1ee2e420b..000000000000 --- a/vendor/knative.dev/pkg/test/mako/alerter/alerter.go +++ /dev/null @@ -1,85 +0,0 @@ -/* -Copyright 2019 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package alerter - -import ( - "fmt" - "log" - - qpb "github.com/google/mako/proto/quickstore/quickstore_go_proto" - "knative.dev/pkg/test/helpers" - "knative.dev/pkg/test/mako/alerter/github" - "knative.dev/pkg/test/mako/alerter/slack" - "knative.dev/pkg/test/mako/config" -) - -// Alerter controls alert for performance regressions detected by Mako. -type Alerter struct { - githubIssueHandler *github.IssueHandler - slackMessageHandler *slack.MessageHandler -} - -// SetupGitHub will setup SetupGitHub for the alerter. -func (alerter *Alerter) SetupGitHub(org, repo, githubTokenPath string) { - issueHandler, err := github.Setup(org, repo, githubTokenPath, false) - if err != nil { - log.Printf("Error happens in setup '%v', Github alerter will not be enabled", err) - } - alerter.githubIssueHandler = issueHandler -} - -// SetupSlack will setup Slack for the alerter. -func (alerter *Alerter) SetupSlack(userName, readTokenPath, writeTokenPath string, channels []config.Channel) { - messageHandler, err := slack.Setup(userName, readTokenPath, writeTokenPath, channels, false) - if err != nil { - log.Printf("Error happens in setup '%v', Slack alerter will not be enabled", err) - } - alerter.slackMessageHandler = messageHandler -} - -// HandleBenchmarkResult will handle the benchmark result which returns from `q.Store()` -func (alerter *Alerter) HandleBenchmarkResult( - benchmarkKey, benchmarkName string, - output qpb.QuickstoreOutput, err error) error { - if err != nil { - if output.GetStatus() == qpb.QuickstoreOutput_ANALYSIS_FAIL { - var errs []error - summary := fmt.Sprintf("%s\n\nSee run chart at: %s\n\nSee aggregate chart at: %s", - output.GetSummaryOutput(), - output.GetRunChartLink(), - "https://mako.dev/benchmark?tseconds=604800&benchmark_key="+benchmarkKey, - ) - if alerter.githubIssueHandler != nil { - if err := alerter.githubIssueHandler.CreateIssueForTest(benchmarkName, summary); err != nil { - errs = append(errs, err) - } - } - if alerter.slackMessageHandler != nil { - if err := alerter.slackMessageHandler.SendAlert(benchmarkName, summary); err != nil { - errs = append(errs, err) - } - } - return helpers.CombineErrors(errs) - } - return err - } - if alerter.githubIssueHandler != nil { - return alerter.githubIssueHandler.CloseIssueForTest(benchmarkName) - } - - return nil -} diff --git a/vendor/knative.dev/pkg/test/mako/alerter/github/issue.go b/vendor/knative.dev/pkg/test/mako/alerter/github/issue.go deleted file mode 100644 index 245900850292..000000000000 --- a/vendor/knative.dev/pkg/test/mako/alerter/github/issue.go +++ /dev/null @@ -1,287 +0,0 @@ -/* -Copyright 2019 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package github - -import ( - "errors" - "fmt" - "time" - - "github.com/google/go-github/v27/github" - - "knative.dev/pkg/test/ghutil" - "knative.dev/pkg/test/helpers" -) - -const ( - // perfLabel is the Github issue label used for querying all auto-generated performance issues. - perfLabel = "auto:perf" - // number of days for an issue to be considered old - daysConsideredOld = 30 - - // number of days for an issue to be considered active - // To avoid frequent open/close actions, only automatically close an issue if there is no activity - // (update, comment, etc.) on it for a specified time - daysConsideredActive = 3 - - // issueTitleTemplate is a template for issue title - issueTitleTemplate = "[performance] %s" - - // issueBodyTemplate is a template for issue body - issueBodyTemplate = ` -### Auto-generated issue tracking performance regression -* **Repository name**: %s -* **Test name**: %s` - - // issueSummaryCommentTemplate is a template for the summary of an issue - issueSummaryCommentTemplate = ` -A new regression for this test has been detected: -%s` - - // reopenIssueComment is the comment of an issue when it is reopened - reopenIssueComment = ` -New regression has been detected, reopening this issue.` - - // closeIssueComment is the comment of an issue when it is closed - closeIssueComment = ` -The performance regression goes away for this test, closing this issue.` -) - -// IssueHandler handles methods for github issues -type IssueHandler struct { - client ghutil.GithubOperations - config config -} - -// config is the global config that can be used in Github operations -type config struct { - org string - repo string - dryrun bool -} - -// Setup creates the necessary setup to make calls to work with github issues -func Setup(org, repo, githubTokenPath string, dryrun bool) (*IssueHandler, error) { - if org == "" { - return nil, errors.New("org cannot be empty") - } - if repo == "" { - return nil, errors.New("repo cannot be empty") - } - ghc, err := ghutil.NewGithubClient(githubTokenPath) - if err != nil { - return nil, fmt.Errorf("cannot authenticate to github: %w", err) - } - conf := config{org: org, repo: repo, dryrun: dryrun} - return &IssueHandler{client: ghc, config: conf}, nil -} - -// createNewIssue will create a new issue, and add perfLabel for it. -func (gih *IssueHandler) createNewIssue(title, body string) (*github.Issue, error) { - var newIssue *github.Issue - if err := helpers.Run( - fmt.Sprintf("creating issue %q in %q", title, gih.config.repo), - func() error { - var err error - newIssue, err = gih.client.CreateIssue(gih.config.org, gih.config.repo, title, body) - return err - }, - gih.config.dryrun, - ); nil != err { - return nil, err - } - if err := helpers.Run( - fmt.Sprintf("adding perf label for issue %q in %q", title, gih.config.repo), - func() error { - return gih.client.AddLabelsToIssue(gih.config.org, gih.config.repo, *newIssue.Number, []string{perfLabel}) - }, - gih.config.dryrun, - ); nil != err { - return nil, err - } - return newIssue, nil -} - -// CreateIssueForTest will try to add an issue with the given testName and description. -// If there is already an issue related to the test, it will try to update that issue. -func (gih *IssueHandler) CreateIssueForTest(testName, desc string) error { - title := fmt.Sprintf(issueTitleTemplate, testName) - issue, err := gih.findIssue(title) - if err != nil { - return fmt.Errorf("failed to find issues for test %q: %w, skipped creating new issue", testName, err) - } - // If the issue hasn't been created, create one - if issue == nil { - commentBody := fmt.Sprintf(issueBodyTemplate, gih.config.repo, testName) - issue, err := gih.createNewIssue(title, commentBody) - if err != nil { - return fmt.Errorf("failed to create a new issue for test %q: %w", testName, err) - } - commentBody = fmt.Sprintf(issueSummaryCommentTemplate, desc) - if err := gih.addComment(*issue.Number, commentBody); err != nil { - return fmt.Errorf("failed to add comment for new issue %d: %w", *issue.Number, err) - } - return nil - } - - // If the issue has been created, edit it - issueNumber := *issue.Number - - // If the issue has been closed, reopen it - if *issue.State == string(ghutil.IssueCloseState) { - if err := gih.reopenIssue(issueNumber); err != nil { - return fmt.Errorf("failed to reopen issue %d: %w", issueNumber, err) - } - if err := gih.addComment(issueNumber, reopenIssueComment); err != nil { - return fmt.Errorf("failed to add comment for reopened issue %d: %w", issueNumber, err) - } - } - - // Edit the old comment - comments, err := gih.getComments(issueNumber) - if err != nil { - return fmt.Errorf("failed to get comments from issue %d: %w", issueNumber, err) - } - if len(comments) < 1 { - return fmt.Errorf("existing issue %d is malformed, cannot update", issueNumber) - } - commentBody := fmt.Sprintf(issueSummaryCommentTemplate, desc) - if err := gih.editComment(issueNumber, *comments[0].ID, commentBody); err != nil { - return fmt.Errorf("failed to edit the comment for issue %d: %w", issueNumber, err) - } - return nil -} - -// CloseIssueForTest will try to close the issue for the given testName. -// If there is no issue related to the test or the issue is already closed, the function will do nothing. -func (gih *IssueHandler) CloseIssueForTest(testName string) error { - title := fmt.Sprintf(issueTitleTemplate, testName) - issue, err := gih.findIssue(title) - // If no issue has been found, or the issue has already been closed, do nothing. - if issue == nil || err != nil || *issue.State == string(ghutil.IssueCloseState) { - return nil - } - // If the issue is still active, do not close it. - if time.Since(issue.GetUpdatedAt()) < daysConsideredActive*24*time.Hour { - return nil - } - - issueNumber := *issue.Number - if err := gih.addComment(issueNumber, closeIssueComment); err != nil { - return fmt.Errorf("failed to add comment for the issue %d to close: %w", issueNumber, err) - } - if err := gih.closeIssue(issueNumber); err != nil { - return fmt.Errorf("failed to close the issue %d: %w", issueNumber, err) - } - return nil -} - -// reopenIssue will reopen the given issue. -func (gih *IssueHandler) reopenIssue(issueNumber int) error { - return helpers.Run( - fmt.Sprintf("reopening issue %d in %q", issueNumber, gih.config.repo), - func() error { - return gih.client.ReopenIssue(gih.config.org, gih.config.repo, issueNumber) - }, - gih.config.dryrun, - ) -} - -// closeIssue will close the given issue. -func (gih *IssueHandler) closeIssue(issueNumber int) error { - return helpers.Run( - fmt.Sprintf("closing issue %d in %q", issueNumber, gih.config.repo), - func() error { - return gih.client.CloseIssue(gih.config.org, gih.config.repo, issueNumber) - }, - gih.config.dryrun, - ) -} - -// findIssue will return the issue in the given repo if it exists. -func (gih *IssueHandler) findIssue(title string) (*github.Issue, error) { - var issues []*github.Issue - if err := helpers.Run( - fmt.Sprintf("listing issues in %q", gih.config.repo), - func() error { - var err error - issues, err = gih.client.ListIssuesByRepo(gih.config.org, gih.config.repo, []string{perfLabel}) - return err - }, - gih.config.dryrun, - ); err != nil { - return nil, err - } - - var existingIssue *github.Issue - for _, issue := range issues { - if *issue.Title == title { - // If the issue has been closed a long time ago, ignore this issue. - if issue.GetState() == string(ghutil.IssueCloseState) && - time.Since(*issue.UpdatedAt) > daysConsideredOld*24*time.Hour { - continue - } - - // If there are multiple issues, return the one that was created most recently. - if existingIssue == nil || issue.CreatedAt.After(*existingIssue.CreatedAt) { - existingIssue = issue - } - } - } - - return existingIssue, nil -} - -// getComments will get comments for the given issue. -func (gih *IssueHandler) getComments(issueNumber int) ([]*github.IssueComment, error) { - var comments []*github.IssueComment - if err := helpers.Run( - fmt.Sprintf("getting comments for issue %d in %q", issueNumber, gih.config.repo), - func() error { - var err error - comments, err = gih.client.ListComments(gih.config.org, gih.config.repo, issueNumber) - return err - }, - gih.config.dryrun, - ); err != nil { - return comments, err - } - return comments, nil -} - -// addComment will add comment for the given issue. -func (gih *IssueHandler) addComment(issueNumber int, commentBody string) error { - return helpers.Run( - fmt.Sprintf("adding comment %q for issue %d in %q", commentBody, issueNumber, gih.config.repo), - func() error { - _, err := gih.client.CreateComment(gih.config.org, gih.config.repo, issueNumber, commentBody) - return err - }, - gih.config.dryrun, - ) -} - -// editComment will edit the comment to the new body. -func (gih *IssueHandler) editComment(issueNumber int, commentID int64, commentBody string) error { - return helpers.Run( - fmt.Sprintf("editing comment to %q for issue %d in %q", commentBody, issueNumber, gih.config.repo), - func() error { - return gih.client.EditComment(gih.config.org, gih.config.repo, commentID, commentBody) - }, - gih.config.dryrun, - ) -} diff --git a/vendor/knative.dev/pkg/test/mako/alerter/slack/message.go b/vendor/knative.dev/pkg/test/mako/alerter/slack/message.go deleted file mode 100644 index 45837042e563..000000000000 --- a/vendor/knative.dev/pkg/test/mako/alerter/slack/message.go +++ /dev/null @@ -1,129 +0,0 @@ -/* -Copyright 2019 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package slack - -import ( - "flag" - "fmt" - "strings" - "sync" - "time" - - "knative.dev/pkg/test/helpers" - "knative.dev/pkg/test/mako/config" - "knative.dev/pkg/test/slackutil" -) - -var minInterval = flag.Duration("min-alert-interval", 24*time.Hour, "The minimum interval of sending Slack alerts.") - -const ( - messageTemplate = ` -As of %s, there is a new performance regression detected from test automation for %s: -%s` -) - -// MessageHandler handles methods for slack messages -type MessageHandler struct { - readClient slackutil.ReadOperations - writeClient slackutil.WriteOperations - channels []config.Channel - dryrun bool -} - -// Setup creates the necessary setup to make calls to work with slack -func Setup(userName, readTokenPath, writeTokenPath string, channels []config.Channel, dryrun bool) (*MessageHandler, error) { - readClient, err := slackutil.NewReadClient(userName, readTokenPath) - if err != nil { - return nil, fmt.Errorf("cannot authenticate to slack read client: %w", err) - } - writeClient, err := slackutil.NewWriteClient(userName, writeTokenPath) - if err != nil { - return nil, fmt.Errorf("cannot authenticate to slack write client: %w", err) - } - return &MessageHandler{ - readClient: readClient, - writeClient: writeClient, - channels: channels, - dryrun: dryrun, - }, nil -} - -// SendAlert will send alert for performance regression to the slack channel(s) -func (smh *MessageHandler) SendAlert(testName, summary string) error { - dryrun := smh.dryrun - errCh := make(chan error) - var wg sync.WaitGroup - for i := range smh.channels { - channel := smh.channels[i] - wg.Add(1) - go func() { - defer wg.Done() - // get the recent message history in the channel for this user - startTime := time.Now().Add(-1 * *minInterval) - var messageHistory []string - if err := helpers.Run( - fmt.Sprintf("retrieving message history in channel %q", channel.Name), - func() error { - var err error - messageHistory, err = smh.readClient.MessageHistory(channel.Identity, startTime) - return err - }, - dryrun, - ); err != nil { - errCh <- fmt.Errorf("failed to retrieve message history in channel %q", channel.Name) - } - // decorate the test name for more accurate match - decoratedTestName := decoratedName(testName) - // do not send message again if alert for this test has been sent to - // the channel a short while ago - for _, message := range messageHistory { - if strings.Contains(message, decoratedTestName) { - return - } - } - - // send the alert message to the channel - message := fmt.Sprintf(messageTemplate, time.Now().UTC(), decoratedTestName, summary) - if err := helpers.Run( - fmt.Sprintf("sending message %q to channel %q", message, channel.Name), - func() error { - return smh.writeClient.Post(message, channel.Identity) - }, - dryrun, - ); err != nil { - errCh <- fmt.Errorf("failed to send message to channel %q", channel.Name) - } - }() - } - - go func() { - wg.Wait() - close(errCh) - }() - - errs := make([]error, 0) - for err := range errCh { - errs = append(errs, err) - } - - return helpers.CombineErrors(errs) -} - -// decoratedName returns a name with decoration for easy identification. -func decoratedName(name string) string { - return fmt.Sprintf("[%s]", name) -} diff --git a/vendor/knative.dev/pkg/test/mako/analyzer.go b/vendor/knative.dev/pkg/test/mako/analyzer.go deleted file mode 100644 index b945aa4e566c..000000000000 --- a/vendor/knative.dev/pkg/test/mako/analyzer.go +++ /dev/null @@ -1,35 +0,0 @@ -/* -Copyright 2019 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package mako - -import ( - tpb "github.com/google/mako/clients/proto/analyzers/threshold_analyzer_go_proto" - mpb "github.com/google/mako/spec/proto/mako_go_proto" - "google.golang.org/protobuf/proto" -) - -// NewCrossRunConfig returns a config that can be used in ThresholdAnalyzer. -// By using it, the Analyzer will only fail if there are xx continuous runs that cross the threshold. -func NewCrossRunConfig(runCount int32, tags ...string) *tpb.CrossRunConfig { - return &tpb.CrossRunConfig{ - RunInfoQueryList: []*mpb.RunInfoQuery{{ - Limit: proto.Int32(runCount), - Tags: tags, - }}, - MinRunCount: proto.Int32(runCount), - } -} diff --git a/vendor/knative.dev/pkg/test/mako/config/benchmark.go b/vendor/knative.dev/pkg/test/mako/config/benchmark.go deleted file mode 100644 index 64f1a812c1ff..000000000000 --- a/vendor/knative.dev/pkg/test/mako/config/benchmark.go +++ /dev/null @@ -1,75 +0,0 @@ -/* -Copyright 2019 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES 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 ( - "fmt" - "log" - "os" - "path/filepath" - - "github.com/golang/protobuf/proto" //nolint // apis incompatible with the new version - mpb "github.com/google/mako/spec/proto/mako_go_proto" -) - -const koDataPathEnvName = "KO_DATA_PATH" -const configMako = "/etc/config-mako" - -// MustGetBenchmark wraps getBenchmark in log.Fatalf -func MustGetBenchmark() *mpb.BenchmarkInfo { - bench, err := getBenchmark() - if err != nil { - log.Fatal("unable to determine benchmark info: ", err) - } - return bench -} - -// getBenchmark fetches the appropriate benchmark_key for this configured environment. -func getBenchmark() (*mpb.BenchmarkInfo, error) { - // Figure out what environment we're running in from the Mako configmap. - env, err := getEnvironment() - if err != nil { - return nil, err - } - // Read the Mako config file for this environment. - data, koerr := readFileFromKoData(env + ".config") - if koerr != nil { - data, err = os.ReadFile(filepath.Join(configMako, env+".config")) - if err != nil { - //nolint: errorlint // It's fine not to wrap here. - return nil, fmt.Errorf("cannot load both from kodata and from config mako config map: %s, %s", koerr.Error(), err.Error()) - } - } - // Parse the Mako config file. - bi := &mpb.BenchmarkInfo{} - if err := proto.UnmarshalText(string(data), bi); err != nil { - return nil, err - } - - // Return the benchmark_key from this environment's config file. - return bi, nil -} - -// readFileFromKoData reads the named file from kodata. -func readFileFromKoData(name string) ([]byte, error) { - koDataPath := os.Getenv(koDataPathEnvName) - if koDataPath == "" { - return nil, fmt.Errorf("%q does not exist or is empty", koDataPathEnvName) - } - fullFilename := filepath.Join(koDataPath, name) - return os.ReadFile(fullFilename) -} diff --git a/vendor/knative.dev/pkg/test/mako/config/configmap.go b/vendor/knative.dev/pkg/test/mako/config/configmap.go deleted file mode 100644 index 22d983cffca7..000000000000 --- a/vendor/knative.dev/pkg/test/mako/config/configmap.go +++ /dev/null @@ -1,93 +0,0 @@ -/* -Copyright 2019 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES 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 ( - "path/filepath" - "strings" - - corev1 "k8s.io/api/core/v1" - "knative.dev/pkg/configmap" -) - -const ( - // ConfigName is the name of the config map for mako options. - ConfigName = "config-mako" -) - -// Config defines the mako configuration options. -type Config struct { - // Organization holds the name of the organization for the current repository. - Organization string - - // Repository holds the name of the repository that runs the benchmarks. - Repository string - - // Environment holds the name of the environment, - // where the test runs, e.g. `dev`. - Environment string - - // List of additional tags to apply to the run. - AdditionalTags []string - - // SlackConfig holds the slack configurations for the benchmarks, - // it's used to determine which slack channels to alert on if there is performance regression. - SlackConfig string -} - -// NewConfigFromMap creates a Config from the supplied map -func NewConfigFromMap(data map[string]string) (*Config, error) { - lc := &Config{ - Environment: "dev", - AdditionalTags: []string{}, - } - - if raw, ok := data["organization"]; ok { - lc.Organization = raw - } - if raw, ok := data["repository"]; ok { - lc.Repository = raw - } - if raw, ok := data["environment"]; ok { - lc.Environment = raw - } - if raw, ok := data["additionalTags"]; ok && raw != "" { - lc.AdditionalTags = strings.Split(raw, ",") - } - if raw, ok := data["slackConfig"]; ok { - lc.SlackConfig = raw - } - - return lc, nil -} - -// NewConfigFromConfigMap creates a Config from the supplied ConfigMap -func NewConfigFromConfigMap(configMap *corev1.ConfigMap) (*Config, error) { - return NewConfigFromMap(configMap.Data) -} - -func loadConfig() (*Config, error) { - makoCM, err := configmap.Load(filepath.Join("/etc", ConfigName)) - if err != nil { - return nil, err - } - cfg, err := NewConfigFromMap(makoCM) - if err != nil { - return nil, err - } - return cfg, nil -} diff --git a/vendor/knative.dev/pkg/test/mako/config/environment.go b/vendor/knative.dev/pkg/test/mako/config/environment.go deleted file mode 100644 index 464d6030aacd..000000000000 --- a/vendor/knative.dev/pkg/test/mako/config/environment.go +++ /dev/null @@ -1,66 +0,0 @@ -/* -Copyright 2019 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES 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 ( - "log" -) - -// TODO: perhaps cache the loaded CM. - -const defaultOrg = "knative" - -// GetOrganization returns the organization from the configmap. -// It will return the defaultOrg if any error happens or it's empty. -func GetOrganization() string { - cfg, err := loadConfig() - if err != nil { - return defaultOrg - } - if cfg.Organization == "" { - return defaultOrg - } - return cfg.Organization -} - -// GetRepository returns the repository from the configmap. -// It will return an empty string if any error happens. -func GetRepository() string { - cfg, err := loadConfig() - if err != nil { - return "" - } - return cfg.Repository -} - -// MustGetTags returns the additional tags from the configmap, or dies. -func MustGetTags() []string { - cfg, err := loadConfig() - if err != nil { - log.Fatal("unable to load config from the configmap: ", err) - } - return cfg.AdditionalTags -} - -// getEnvironment fetches the Mako config environment to which this cluster should publish. -func getEnvironment() (string, error) { - cfg, err := loadConfig() - if err != nil { - return "", err - } - return cfg.Environment, nil -} diff --git a/vendor/knative.dev/pkg/test/mako/config/slack.go b/vendor/knative.dev/pkg/test/mako/config/slack.go deleted file mode 100644 index e79eb861de13..000000000000 --- a/vendor/knative.dev/pkg/test/mako/config/slack.go +++ /dev/null @@ -1,56 +0,0 @@ -/* -Copyright 2019 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES 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 ( - "sigs.k8s.io/yaml" -) - -var defaultChannel = Channel{Name: "performance", Identity: "CBDMABCTF"} - -// Channel contains Slack channel's info. -type Channel struct { - Name string `yaml:"name,omitempty"` - Identity string `yaml:"identity,omitempty"` -} - -// SlackConfig contains slack configuration for the benchmarks. -type SlackConfig struct { - BenchmarkChannels map[string][]Channel `yaml:"benchmarkChannels,omitempty"` -} - -// GetSlackChannels returns the slack channels to alert on for the given benchmark. -// If any error happens, or the config is not found, return the default channel. -func GetSlackChannels(benchmarkName string) []Channel { - cfg, err := loadConfig() - if err != nil { - return []Channel{defaultChannel} - } - return getSlackChannels(cfg.SlackConfig, benchmarkName) -} - -func getSlackChannels(configStr, benchmarkName string) []Channel { - slackConfig := &SlackConfig{} - if err := yaml.Unmarshal([]byte(configStr), slackConfig); err != nil { - return []Channel{defaultChannel} - } - if channels, ok := slackConfig.BenchmarkChannels[benchmarkName]; ok { - return channels - } - - return []Channel{defaultChannel} -} diff --git a/vendor/knative.dev/pkg/test/mako/sidecar.go b/vendor/knative.dev/pkg/test/mako/sidecar.go deleted file mode 100644 index 64b1d96ca29c..000000000000 --- a/vendor/knative.dev/pkg/test/mako/sidecar.go +++ /dev/null @@ -1,188 +0,0 @@ -/* -Copyright 2019 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package mako - -import ( - "context" - "log" - "path/filepath" - "runtime" - "strconv" - "strings" - - "cloud.google.com/go/compute/metadata" - kubeclient "knative.dev/pkg/client/injection/kube/client" - - "github.com/google/mako/go/quickstore" - qpb "github.com/google/mako/proto/quickstore/quickstore_go_proto" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/client-go/rest" - "knative.dev/pkg/changeset" - "knative.dev/pkg/controller" - "knative.dev/pkg/injection" - "knative.dev/pkg/test/mako/alerter" - "knative.dev/pkg/test/mako/config" -) - -const ( - // sidecarAddress is the address of the Mako sidecar to which we locally - // write results, and it authenticates and publishes them to Mako after - // assorted preprocessing. - sidecarAddress = "localhost:9813" - - // org is the organization name that is used by Github client - org = "knative" - - // slackUserName is the slack user name that is used by Slack client - slackUserName = "Knative Testgrid Robot" - - // These token settings are for alerter. - // If we want to enable the alerter for a benchmark, we need to mount the - // token to the pod, with the same name and path. - // See https://github.com/knative/serving/blob/main/test/performance/benchmarks/dataplane-probe/continuous/dataplane-probe.yaml - tokenFolder = "/var/secret" - githubToken = "github-token" - slackReadToken = "slack-read-token" - slackWriteToken = "slack-write-token" -) - -// Client is a wrapper that wraps all Mako related operations -type Client struct { - Quickstore *quickstore.Quickstore - Context context.Context - ShutDownFunc func(context.Context) - - benchmarkKey string - benchmarkName string - alerter *alerter.Alerter -} - -// StoreAndHandleResult stores the benchmarking data and handles the result. -func (c *Client) StoreAndHandleResult() error { - out, err := c.Quickstore.Store() - return c.alerter.HandleBenchmarkResult(c.benchmarkKey, c.benchmarkName, out, err) -} - -var tagEscaper = strings.NewReplacer("+", "-", "\t", "_", " ", "_") - -// EscapeTag replaces characters that Mako doesn't accept with ones it does. -func EscapeTag(tag string) string { - return tagEscaper.Replace(tag) -} - -// SetupHelper sets up the mako client for the provided benchmarkKey. -// It will add a few common tags and allow each benchmark to add custom tags as well. -// It returns the mako client handle to store metrics, a method to close the connection -// to mako server once done and error in case of failures. -func SetupHelper(ctx context.Context, benchmarkKey *string, benchmarkName *string, extraTags ...string) (*Client, error) { - tags := append(config.MustGetTags(), extraTags...) - // Get the commit of the benchmarks - commitID := changeset.Get() - if commitID == changeset.Unknown { - log.Println("Cannot find commit ID") - } - - // Setup a deployment informer, so that we can use the lister to track - // desired and available pod counts. - cfg, err := rest.InClusterConfig() - if err != nil { - return nil, err - } - ctx, informers := injection.Default.SetupInformers(ctx, cfg) - if err := controller.StartInformers(ctx.Done(), informers...); err != nil { - return nil, err - } - - // Get the Kubernetes version from the API server. - kc := kubeclient.Get(ctx) - version, err := kc.Discovery().ServerVersion() - if err != nil { - return nil, err - } - - // Determine the number of Kubernetes nodes through the kubernetes client. - nodes, err := kc.CoreV1().Nodes().List(ctx, metav1.ListOptions{}) - if err != nil { - return nil, err - } - tags = append(tags, "nodes="+strconv.Itoa(len(nodes.Items))) - - // Decorate GCP metadata as tags (when we're running on GCP). - if projectID, err := metadata.ProjectID(); err != nil { - log.Print("GCP project ID is not available: ", err) - } else { - tags = append(tags, "project-id="+EscapeTag(projectID)) - } - if zone, err := metadata.Zone(); err != nil { - log.Print("GCP zone is not available: ", err) - } else { - tags = append(tags, "zone="+EscapeTag(zone)) - } - if machineType, err := metadata.Get("instance/machine-type"); err != nil { - log.Print("GCP machine type is not available: ", err) - } else if parts := strings.Split(machineType, "/"); len(parts) != 4 { - tags = append(tags, "instanceType="+EscapeTag(parts[3])) - } - tags = append(tags, - "commit="+commitID, - "kubernetes="+EscapeTag(version.String()), - "goversion="+EscapeTag(runtime.Version()), - ) - log.Printf("The tags for this run are: %+v", tags) - // Create a new Quickstore that connects to the microservice - qs, qclose, err := quickstore.NewAtAddress(ctx, &qpb.QuickstoreInput{ - BenchmarkKey: benchmarkKey, - Tags: tags, - }, sidecarAddress) - if err != nil { - return nil, err - } - - // Create a new Alerter that alerts for performance regressions - alerter := &alerter.Alerter{} - alerter.SetupGitHub( - org, - config.GetRepository(), - tokenPath(githubToken), - ) - alerter.SetupSlack( - slackUserName, - tokenPath(slackReadToken), - tokenPath(slackWriteToken), - config.GetSlackChannels(*benchmarkName), - ) - - client := &Client{ - Quickstore: qs, - Context: ctx, - ShutDownFunc: qclose, - alerter: alerter, - benchmarkKey: *benchmarkKey, - benchmarkName: *benchmarkName, - } - - return client, nil -} - -func Setup(ctx context.Context, extraTags ...string) (*Client, error) { - bench := config.MustGetBenchmark() - return SetupHelper(ctx, bench.BenchmarkKey, bench.BenchmarkName, extraTags...) -} - -func tokenPath(token string) string { - return filepath.Join(tokenFolder, token) -} diff --git a/vendor/knative.dev/pkg/test/mako/stub-sidecar/main.go b/vendor/knative.dev/pkg/test/mako/stub-sidecar/main.go deleted file mode 100644 index e7deb17dbfa6..000000000000 --- a/vendor/knative.dev/pkg/test/mako/stub-sidecar/main.go +++ /dev/null @@ -1,169 +0,0 @@ -/* -Copyright 2019 The Knative Authors - -Licensed under the Apache License, Version 2.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 main - -import ( - "context" - "encoding/csv" - "errors" - "flag" - "fmt" - "net/http" - "strings" - - "github.com/golang/protobuf/jsonpb" //nolint // the newer package has different interface. - mako "github.com/google/mako/spec/proto/mako_go_proto" - - "log" - "net" - "sync" - - "google.golang.org/grpc" - - "knative.dev/pkg/test/mako/config" - qspb "knative.dev/pkg/third_party/mako/proto/quickstore_go_proto" -) - -const ( - port = ":9813" - defaultServerMaxReceiveMessageSize = 1024 * 1024 * 1024 -) - -type server struct { - info *mako.BenchmarkInfo - stopOnce sync.Once - stopCh chan struct{} - sb *strings.Builder -} - -func (s *server) Store(ctx context.Context, in *qspb.StoreInput) (*qspb.StoreOutput, error) { - m := jsonpb.Marshaler{} - qi, _ := m.MarshalToString(in.GetQuickstoreInput()) - fmt.Println("# Received input") - - fmt.Fprintln(s.sb, "#", qi) - writer := csv.NewWriter(s.sb) - - kv := calculateKeyIndexColumnsMap(s.info) - cols := make([]string, len(kv)) - for k, i := range kv { - cols[i] = k - } - fmt.Fprintln(s.sb, "#", strings.Join(cols, ",")) - - for _, sp := range in.GetSamplePoints() { - for _, mv := range sp.GetMetricValueList() { - vals := map[string]string{"inputValue": fmt.Sprint(sp.GetInputValue())} - vals[mv.GetValueKey()] = fmt.Sprint(mv.GetValue()) - writer.Write(makeRow(vals, kv)) - } - } - - for _, ra := range in.GetRunAggregates() { - vals := map[string]string{ra.GetValueKey(): fmt.Sprint(ra.GetValue())} - writer.Write(makeRow(vals, kv)) - } - - for _, sa := range in.GetSampleErrors() { - vals := map[string]string{"inputValue": fmt.Sprint(sa.GetInputValue()), "errorMessage": sa.GetErrorMessage()} - writer.Write(makeRow(vals, kv)) - } - - writer.Flush() - - fmt.Fprintln(s.sb, "# CSV end") - fmt.Println("# Input completed") - - return &qspb.StoreOutput{}, nil -} - -func makeRow(points map[string]string, kv map[string]int) []string { - row := make([]string, len(kv)) - for k, v := range points { - row[kv[k]] = v - } - return row -} - -func calculateKeyIndexColumnsMap(info *mako.BenchmarkInfo) map[string]int { - kv := make(map[string]int) - kv["inputValue"] = 0 - kv["errorMessage"] = 1 - for i, m := range info.MetricInfoList { - kv[*m.ValueKey] = i + 2 - } - return kv -} - -func (s *server) ShutdownMicroservice(ctx context.Context, in *qspb.ShutdownInput) (*qspb.ShutdownOutput, error) { - s.stopOnce.Do(func() { close(s.stopCh) }) - return &qspb.ShutdownOutput{}, nil -} - -var httpPort int - -func init() { - flag.IntVar(&httpPort, "p", 0, "Port to use for using stub in HTTP mode. 0 means print to logs and quit") -} - -func main() { - flag.Parse() - - lis, err := net.Listen("tcp", port) - if err != nil { - log.Fatal("Failed to listen:", err) - } - s := grpc.NewServer(grpc.MaxRecvMsgSize(defaultServerMaxReceiveMessageSize)) - stopCh := make(chan struct{}) - info := config.MustGetBenchmark() - var sb strings.Builder - - fmt.Fprintf(&sb, "# Benchmark %s - %s\n", *info.BenchmarkKey, *info.BenchmarkName) - - go func() { - qspb.RegisterQuickstoreServer(s, &server{info: info, stopCh: stopCh, sb: &sb}) - if err := s.Serve(lis); err != nil { - log.Fatal("Failed to serve:", err) - } - }() - <-stopCh - s.GracefulStop() - - results := sb.String() - - if httpPort != 0 { - m := http.NewServeMux() - s := http.Server{Addr: fmt.Sprintf(":%d", httpPort), Handler: m} - - m.HandleFunc("/results", func(w http.ResponseWriter, r *http.Request) { - w.Header().Set("content-type", "text/csv") - _, err := fmt.Fprint(w, results) - if err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) - } - }) - m.HandleFunc("/close", func(writer http.ResponseWriter, request *http.Request) { - s.Shutdown(context.Background()) - }) - if err := s.ListenAndServe(); err != nil && !errors.Is(err, http.ErrServerClosed) { - log.Fatal(err) - } - fmt.Println("Successfully served the results") - } else { - fmt.Println(sb.String()) - } -} diff --git a/vendor/knative.dev/pkg/test/mako/stub-sidecar/read_results.sh b/vendor/knative.dev/pkg/test/mako/stub-sidecar/read_results.sh deleted file mode 100644 index ca6efb0d7118..000000000000 --- a/vendor/knative.dev/pkg/test/mako/stub-sidecar/read_results.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/bash - -# Copyright 2019 The Knative Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 scripts helps to read results of mako-stub from http - -check_command_exists() { - CMD_NAME=$1 - command -v "$CMD_NAME" > /dev/null || { - echo "Command $CMD_NAME does not exist" - exit 1 - } -} - -check_command_exists kubectl -check_command_exists curl - -if [[ $# -lt 7 ]] -then - echo "Usage: $0 " - exit 1 -fi - -MAKO_STUB_POD_NAME="$1" -MAKO_STUB_NAMESPACE="$2" -MAKO_STUB_PORT="$3" -TIMEOUT="$4" -RETRIES="$5" -RETRIES_INTERVAL="$6" -OUTPUT_FILE="$7" - -# Find port ready to use - -port=10000 -isfree=$(netstat -tapln | grep $port) - -while [[ -n "$isfree" ]]; do - port=$((port + 1)) - isfree=$(netstat -tapln | grep $port) -done - -for i in $(seq $RETRIES); do - kubectl port-forward -n "$MAKO_STUB_NAMESPACE" "$MAKO_STUB_POD_NAME" $port:$MAKO_STUB_PORT & - PORT_FORWARD_PID=$! - - sleep 10 - - curl --connect-timeout $TIMEOUT "http://localhost:$port/results" > $OUTPUT_FILE - curl_exit_status=$? - - kill $PORT_FORWARD_PID - wait $PORT_FORWARD_PID 2>/dev/null - - if [ 0 -eq $curl_exit_status ]; then - exit 0 - else - sleep $RETRIES_INTERVAL - fi - -done - -exit 1 diff --git a/vendor/knative.dev/pkg/test/mako/time.go b/vendor/knative.dev/pkg/test/mako/time.go deleted file mode 100644 index 1a2f4cab0012..000000000000 --- a/vendor/knative.dev/pkg/test/mako/time.go +++ /dev/null @@ -1,26 +0,0 @@ -/* -Copyright 2019 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package mako - -import ( - "time" -) - -// XTime converts a time.Time into a Mako x-axis compatible timestamp. -func XTime(t time.Time) float64 { - return float64(t.UnixNano()) / (1000.0 * 1000.0) -} diff --git a/vendor/knative.dev/pkg/test/slackutil/http.go b/vendor/knative.dev/pkg/test/slackutil/http.go deleted file mode 100644 index 41577c9d34ee..000000000000 --- a/vendor/knative.dev/pkg/test/slackutil/http.go +++ /dev/null @@ -1,53 +0,0 @@ -/* -Copyright 2019 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// http.go includes functions to send HTTP requests. - -package slackutil - -import ( - "fmt" - "io" - "net/http" - "net/url" -) - -// post sends an HTTP post request -func post(url string, uv url.Values) ([]byte, error) { - resp, err := http.PostForm(url, uv) - if err != nil { - return nil, err - } - return handleResponse(resp) -} - -// get sends an HTTP get request -func get(url string) ([]byte, error) { - resp, err := http.Get(url) - if err != nil { - return nil, err - } - return handleResponse(resp) -} - -// handleResponse handles the HTTP response and returns the body content -func handleResponse(resp *http.Response) ([]byte, error) { - defer resp.Body.Close() - if resp.StatusCode != http.StatusOK { - return nil, fmt.Errorf("http response code is not StatusOK: '%v'", resp.StatusCode) - } - return io.ReadAll(resp.Body) -} diff --git a/vendor/knative.dev/pkg/test/slackutil/message_read.go b/vendor/knative.dev/pkg/test/slackutil/message_read.go deleted file mode 100644 index 6feeb52f8cad..000000000000 --- a/vendor/knative.dev/pkg/test/slackutil/message_read.go +++ /dev/null @@ -1,95 +0,0 @@ -/* -Copyright 2019 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// message_read.go includes functions to read messages from Slack. - -package slackutil - -import ( - "encoding/json" - "fmt" - "html" - "net/url" - "os" - "strconv" - "strings" - "time" -) - -const conversationHistoryURL = "https://slack.com/api/conversations.history" - -// ReadOperations defines the read operations that can be done to Slack -type ReadOperations interface { - MessageHistory(channel string, startTime time.Time) ([]string, error) -} - -// readClient contains Slack bot related information to perform read operations -type readClient struct { - userName string - tokenStr string -} - -// NewReadClient reads token file and stores it for later authentication -func NewReadClient(userName, tokenPath string) (ReadOperations, error) { - b, err := os.ReadFile(tokenPath) - if err != nil { - return nil, err - } - return &readClient{ - userName: userName, - tokenStr: strings.TrimSpace(string(b)), - }, nil -} - -// MessageHistory returns the list of messages sent by the user in the given -// channel since the given startTime. -func (c *readClient) MessageHistory(channel string, startTime time.Time) ([]string, error) { - u, _ := url.Parse(conversationHistoryURL) - q := u.Query() - q.Add("token", c.tokenStr) - q.Add("channel", channel) - q.Add("oldest", strconv.FormatInt(startTime.Unix(), 10)) - u.RawQuery = q.Encode() - - content, err := get(u.String()) - if err != nil { - return nil, err - } - - // response code could also be 200 if channel doesn't exist, parse response body to find out - type m struct { - Text string `json:"text"` - UserName string `json:"username"` - } - var r struct { - OK bool `json:"ok"` - Messages []m `json:"messages"` - } - if err = json.Unmarshal(content, &r); nil != err || !r.OK { - return nil, fmt.Errorf("response not ok '%s'", string(content)) - } - - res := make([]string, 0) - for _, message := range r.Messages { - if message.UserName == c.userName { - // the message text queried from Slack will be escaped, - // so we unescape it to restore to the original text - res = append(res, html.UnescapeString(message.Text)) - } - } - - return res, nil -} diff --git a/vendor/knative.dev/pkg/test/slackutil/message_write.go b/vendor/knative.dev/pkg/test/slackutil/message_write.go deleted file mode 100644 index eefd17d8bed0..000000000000 --- a/vendor/knative.dev/pkg/test/slackutil/message_write.go +++ /dev/null @@ -1,77 +0,0 @@ -/* -Copyright 2019 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// message_write.go includes functions to send messages to Slack. - -package slackutil - -import ( - "encoding/json" - "fmt" - "os" - "strings" - - "net/url" -) - -const postMessageURL = "https://slack.com/api/chat.postMessage" - -// WriteOperations defines the write operations that can be done to Slack -type WriteOperations interface { - Post(text, channel string) error -} - -// writeClient contains Slack bot related information to perform write operations -type writeClient struct { - userName string - tokenStr string -} - -// NewWriteClient reads token file and stores it for later authentication -func NewWriteClient(userName, tokenPath string) (WriteOperations, error) { - b, err := os.ReadFile(tokenPath) - if err != nil { - return nil, err - } - return &writeClient{ - userName: userName, - tokenStr: strings.TrimSpace(string(b)), - }, nil -} - -// Post posts the given text to channel -func (c *writeClient) Post(text, channel string) error { - uv := url.Values{} - uv.Add("username", c.userName) - uv.Add("token", c.tokenStr) - uv.Add("channel", channel) - uv.Add("text", text) - - content, err := post(postMessageURL, uv) - if err != nil { - return err - } - - // response code could also be 200 if channel doesn't exist, parse response body to find out - var b struct { - OK bool `json:"ok"` - } - if err = json.Unmarshal(content, &b); nil != err || !b.OK { - return fmt.Errorf("response not ok '%s'", string(content)) - } - - return nil -} diff --git a/vendor/knative.dev/pkg/third_party/mako/LICENSE b/vendor/knative.dev/pkg/third_party/mako/LICENSE deleted file mode 100644 index fef7d967815b..000000000000 --- a/vendor/knative.dev/pkg/third_party/mako/LICENSE +++ /dev/null @@ -1,204 +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. - - \ No newline at end of file diff --git a/vendor/knative.dev/pkg/third_party/mako/proto/quickstore_go_proto/quickstore.pb.go b/vendor/knative.dev/pkg/third_party/mako/proto/quickstore_go_proto/quickstore.pb.go deleted file mode 100644 index d0c0f9fcb9ff..000000000000 --- a/vendor/knative.dev/pkg/third_party/mako/proto/quickstore_go_proto/quickstore.pb.go +++ /dev/null @@ -1,374 +0,0 @@ -// Copyright 2019 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: internal/quickstore_microservice/proto/quickstore.proto - -package mako_internal_quickstore_microservice - -import ( - context "context" - fmt "fmt" - math "math" - - proto "github.com/golang/protobuf/proto" - quickstore_go_proto "github.com/google/mako/proto/quickstore/quickstore_go_proto" - mako_go_proto "github.com/google/mako/spec/proto/mako_go_proto" - 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.ProtoPackageIsVersion3 // please upgrade the proto package - -type StoreInput struct { - QuickstoreInput *quickstore_go_proto.QuickstoreInput `protobuf:"bytes,1,opt,name=quickstore_input,json=quickstoreInput" json:"quickstore_input,omitempty"` - SamplePoints []*mako_go_proto.SamplePoint `protobuf:"bytes,2,rep,name=sample_points,json=samplePoints" json:"sample_points,omitempty"` - SampleErrors []*mako_go_proto.SampleError `protobuf:"bytes,3,rep,name=sample_errors,json=sampleErrors" json:"sample_errors,omitempty"` - RunAggregates []*mako_go_proto.KeyedValue `protobuf:"bytes,4,rep,name=run_aggregates,json=runAggregates" json:"run_aggregates,omitempty"` - AggregateValueKeys []string `protobuf:"bytes,5,rep,name=aggregate_value_keys,json=aggregateValueKeys" json:"aggregate_value_keys,omitempty"` - AggregateValueTypes []string `protobuf:"bytes,6,rep,name=aggregate_value_types,json=aggregateValueTypes" json:"aggregate_value_types,omitempty"` - AggregateValueValues []float64 `protobuf:"fixed64,7,rep,name=aggregate_value_values,json=aggregateValueValues" json:"aggregate_value_values,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *StoreInput) Reset() { *m = StoreInput{} } -func (m *StoreInput) String() string { return proto.CompactTextString(m) } -func (*StoreInput) ProtoMessage() {} -func (*StoreInput) Descriptor() ([]byte, []int) { - return fileDescriptor_80613028ee3e5eb0, []int{0} -} - -func (m *StoreInput) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_StoreInput.Unmarshal(m, b) -} -func (m *StoreInput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_StoreInput.Marshal(b, m, deterministic) -} -func (m *StoreInput) XXX_Merge(src proto.Message) { - xxx_messageInfo_StoreInput.Merge(m, src) -} -func (m *StoreInput) XXX_Size() int { - return xxx_messageInfo_StoreInput.Size(m) -} -func (m *StoreInput) XXX_DiscardUnknown() { - xxx_messageInfo_StoreInput.DiscardUnknown(m) -} - -var xxx_messageInfo_StoreInput proto.InternalMessageInfo - -func (m *StoreInput) GetQuickstoreInput() *quickstore_go_proto.QuickstoreInput { - if m != nil { - return m.QuickstoreInput - } - return nil -} - -func (m *StoreInput) GetSamplePoints() []*mako_go_proto.SamplePoint { - if m != nil { - return m.SamplePoints - } - return nil -} - -func (m *StoreInput) GetSampleErrors() []*mako_go_proto.SampleError { - if m != nil { - return m.SampleErrors - } - return nil -} - -func (m *StoreInput) GetRunAggregates() []*mako_go_proto.KeyedValue { - if m != nil { - return m.RunAggregates - } - return nil -} - -func (m *StoreInput) GetAggregateValueKeys() []string { - if m != nil { - return m.AggregateValueKeys - } - return nil -} - -func (m *StoreInput) GetAggregateValueTypes() []string { - if m != nil { - return m.AggregateValueTypes - } - return nil -} - -func (m *StoreInput) GetAggregateValueValues() []float64 { - if m != nil { - return m.AggregateValueValues - } - return nil -} - -type StoreOutput struct { - QuickstoreOutput *quickstore_go_proto.QuickstoreOutput `protobuf:"bytes,1,opt,name=quickstore_output,json=quickstoreOutput" json:"quickstore_output,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *StoreOutput) Reset() { *m = StoreOutput{} } -func (m *StoreOutput) String() string { return proto.CompactTextString(m) } -func (*StoreOutput) ProtoMessage() {} -func (*StoreOutput) Descriptor() ([]byte, []int) { - return fileDescriptor_80613028ee3e5eb0, []int{1} -} - -func (m *StoreOutput) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_StoreOutput.Unmarshal(m, b) -} -func (m *StoreOutput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_StoreOutput.Marshal(b, m, deterministic) -} -func (m *StoreOutput) XXX_Merge(src proto.Message) { - xxx_messageInfo_StoreOutput.Merge(m, src) -} -func (m *StoreOutput) XXX_Size() int { - return xxx_messageInfo_StoreOutput.Size(m) -} -func (m *StoreOutput) XXX_DiscardUnknown() { - xxx_messageInfo_StoreOutput.DiscardUnknown(m) -} - -var xxx_messageInfo_StoreOutput proto.InternalMessageInfo - -func (m *StoreOutput) GetQuickstoreOutput() *quickstore_go_proto.QuickstoreOutput { - if m != nil { - return m.QuickstoreOutput - } - return nil -} - -type ShutdownInput struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ShutdownInput) Reset() { *m = ShutdownInput{} } -func (m *ShutdownInput) String() string { return proto.CompactTextString(m) } -func (*ShutdownInput) ProtoMessage() {} -func (*ShutdownInput) Descriptor() ([]byte, []int) { - return fileDescriptor_80613028ee3e5eb0, []int{2} -} - -func (m *ShutdownInput) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ShutdownInput.Unmarshal(m, b) -} -func (m *ShutdownInput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ShutdownInput.Marshal(b, m, deterministic) -} -func (m *ShutdownInput) XXX_Merge(src proto.Message) { - xxx_messageInfo_ShutdownInput.Merge(m, src) -} -func (m *ShutdownInput) XXX_Size() int { - return xxx_messageInfo_ShutdownInput.Size(m) -} -func (m *ShutdownInput) XXX_DiscardUnknown() { - xxx_messageInfo_ShutdownInput.DiscardUnknown(m) -} - -var xxx_messageInfo_ShutdownInput proto.InternalMessageInfo - -type ShutdownOutput struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ShutdownOutput) Reset() { *m = ShutdownOutput{} } -func (m *ShutdownOutput) String() string { return proto.CompactTextString(m) } -func (*ShutdownOutput) ProtoMessage() {} -func (*ShutdownOutput) Descriptor() ([]byte, []int) { - return fileDescriptor_80613028ee3e5eb0, []int{3} -} - -func (m *ShutdownOutput) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ShutdownOutput.Unmarshal(m, b) -} -func (m *ShutdownOutput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ShutdownOutput.Marshal(b, m, deterministic) -} -func (m *ShutdownOutput) XXX_Merge(src proto.Message) { - xxx_messageInfo_ShutdownOutput.Merge(m, src) -} -func (m *ShutdownOutput) XXX_Size() int { - return xxx_messageInfo_ShutdownOutput.Size(m) -} -func (m *ShutdownOutput) XXX_DiscardUnknown() { - xxx_messageInfo_ShutdownOutput.DiscardUnknown(m) -} - -var xxx_messageInfo_ShutdownOutput proto.InternalMessageInfo - -func init() { - proto.RegisterType((*StoreInput)(nil), "mako.internal.quickstore_microservice.StoreInput") - proto.RegisterType((*StoreOutput)(nil), "mako.internal.quickstore_microservice.StoreOutput") - proto.RegisterType((*ShutdownInput)(nil), "mako.internal.quickstore_microservice.ShutdownInput") - proto.RegisterType((*ShutdownOutput)(nil), "mako.internal.quickstore_microservice.ShutdownOutput") -} - -func init() { - proto.RegisterFile("internal/quickstore_microservice/proto/quickstore.proto", fileDescriptor_80613028ee3e5eb0) -} - -var fileDescriptor_80613028ee3e5eb0 = []byte{ - // 408 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0xcd, 0x8e, 0xda, 0x30, - 0x14, 0x85, 0x1b, 0x52, 0x5a, 0xf5, 0x52, 0xfe, 0x5c, 0xa8, 0xa2, 0xac, 0x42, 0xa4, 0x4a, 0x59, - 0x85, 0x36, 0xa2, 0x65, 0xdd, 0x45, 0x17, 0x15, 0xea, 0x5f, 0xa8, 0xba, 0xab, 0xa2, 0x28, 0x58, - 0x4c, 0x04, 0xc4, 0xc1, 0x76, 0x18, 0xe5, 0x01, 0x66, 0x1e, 0x63, 0x9e, 0x75, 0x94, 0x1b, 0x12, - 0x0c, 0x68, 0x46, 0xb0, 0xb1, 0xec, 0x7b, 0xee, 0x77, 0x7c, 0x93, 0x63, 0x98, 0xc6, 0x89, 0xa4, - 0x3c, 0x09, 0xd7, 0xe3, 0x6d, 0x16, 0x47, 0x2b, 0x21, 0x19, 0xa7, 0xc1, 0x26, 0x8e, 0x38, 0x13, - 0x94, 0xef, 0xe2, 0x88, 0x8e, 0x53, 0xce, 0x24, 0x53, 0x54, 0x17, 0x0b, 0xe4, 0xc3, 0x26, 0x5c, - 0x31, 0xb7, 0xa2, 0xdd, 0x27, 0x68, 0x73, 0x74, 0x8a, 0x9f, 0x39, 0x99, 0x43, 0x91, 0xd2, 0x68, - 0x7f, 0x0d, 0x9a, 0xe2, 0xd6, 0x7e, 0xd0, 0x01, 0xe6, 0x45, 0xdb, 0xf7, 0x24, 0xcd, 0x24, 0x99, - 0x41, 0x4f, 0xb9, 0x23, 0x2e, 0x6a, 0x86, 0x66, 0x69, 0x4e, 0xcb, 0xb3, 0x5c, 0xa4, 0x14, 0xdf, - 0x3f, 0xf5, 0x16, 0x59, 0xbf, 0xbb, 0x3d, 0x2e, 0x90, 0x2f, 0xd0, 0x16, 0xe1, 0x26, 0x5d, 0xd3, - 0x20, 0x65, 0x71, 0x22, 0x85, 0xd1, 0xb0, 0x74, 0xa7, 0xe5, 0xf5, 0x4b, 0xa7, 0x39, 0x4a, 0xbf, - 0x0b, 0xc5, 0x7f, 0x2b, 0x0e, 0x07, 0xa1, 0x70, 0x94, 0x73, 0xc6, 0x85, 0xa1, 0x9f, 0x73, 0xdf, - 0x0a, 0xa5, 0xe2, 0xf0, 0x20, 0xc8, 0x14, 0x3a, 0x3c, 0x4b, 0x82, 0x70, 0xb9, 0xe4, 0x74, 0x19, - 0x4a, 0x2a, 0x8c, 0x97, 0x08, 0xf6, 0x4a, 0x70, 0x46, 0x73, 0xba, 0xf8, 0x17, 0xae, 0x33, 0xea, - 0xb7, 0x79, 0x96, 0x7c, 0xad, 0xdb, 0xc8, 0x47, 0x18, 0xd4, 0x50, 0xb0, 0x2b, 0x3a, 0x82, 0x15, - 0xcd, 0x85, 0xd1, 0xb4, 0x74, 0xe7, 0x8d, 0x4f, 0x6a, 0x0d, 0xe1, 0x19, 0xcd, 0x05, 0xf1, 0x60, - 0x78, 0x4a, 0xc8, 0x3c, 0xa5, 0xc2, 0x78, 0x85, 0xc8, 0xbb, 0x63, 0xe4, 0x6f, 0x21, 0x91, 0x09, - 0xbc, 0x3f, 0x65, 0x70, 0x15, 0xc6, 0x6b, 0x4b, 0x77, 0x34, 0x7f, 0x70, 0x0c, 0xe1, 0x22, 0xec, - 0xff, 0xd0, 0xc2, 0x7c, 0x7e, 0x65, 0xb2, 0xf8, 0xa7, 0x3f, 0xa1, 0xaf, 0x04, 0xc4, 0xb0, 0xb8, - 0x4f, 0x68, 0xf4, 0x4c, 0x42, 0x25, 0xed, 0x2b, 0xe1, 0x96, 0x15, 0xbb, 0x0b, 0xed, 0xf9, 0x4d, - 0x26, 0x17, 0xec, 0x36, 0xc1, 0xd0, 0xec, 0x1e, 0x74, 0xaa, 0x42, 0xd9, 0xe2, 0xdd, 0x37, 0x00, - 0x0e, 0x4e, 0x24, 0x85, 0x26, 0x0e, 0x44, 0x3e, 0xb9, 0x17, 0x3d, 0x4e, 0xf7, 0xf0, 0xbc, 0x4c, - 0xef, 0x1a, 0x64, 0x3f, 0xe1, 0x0b, 0x72, 0xa7, 0xc1, 0xa0, 0x9a, 0xe9, 0x87, 0xd2, 0x46, 0x26, - 0x97, 0xda, 0xa9, 0x5f, 0x68, 0x7e, 0xbe, 0x92, 0xaa, 0xe6, 0x78, 0x0c, 0x00, 0x00, 0xff, 0xff, - 0xe2, 0xb4, 0xaf, 0x68, 0xc6, 0x03, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// QuickstoreClient is the client API for Quickstore service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type QuickstoreClient interface { - Store(ctx context.Context, in *StoreInput, opts ...grpc.CallOption) (*StoreOutput, error) - ShutdownMicroservice(ctx context.Context, in *ShutdownInput, opts ...grpc.CallOption) (*ShutdownOutput, error) -} - -type quickstoreClient struct { - cc *grpc.ClientConn -} - -func NewQuickstoreClient(cc *grpc.ClientConn) QuickstoreClient { - return &quickstoreClient{cc} -} - -func (c *quickstoreClient) Store(ctx context.Context, in *StoreInput, opts ...grpc.CallOption) (*StoreOutput, error) { - out := new(StoreOutput) - err := c.cc.Invoke(ctx, "/mako.internal.quickstore_microservice.Quickstore/Store", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *quickstoreClient) ShutdownMicroservice(ctx context.Context, in *ShutdownInput, opts ...grpc.CallOption) (*ShutdownOutput, error) { - out := new(ShutdownOutput) - err := c.cc.Invoke(ctx, "/mako.internal.quickstore_microservice.Quickstore/ShutdownMicroservice", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// QuickstoreServer is the server API for Quickstore service. -type QuickstoreServer interface { - Store(context.Context, *StoreInput) (*StoreOutput, error) - ShutdownMicroservice(context.Context, *ShutdownInput) (*ShutdownOutput, error) -} - -func RegisterQuickstoreServer(s *grpc.Server, srv QuickstoreServer) { - s.RegisterService(&_Quickstore_serviceDesc, srv) -} - -func _Quickstore_Store_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(StoreInput) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QuickstoreServer).Store(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/mako.internal.quickstore_microservice.Quickstore/Store", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QuickstoreServer).Store(ctx, req.(*StoreInput)) - } - return interceptor(ctx, in, info, handler) -} - -func _Quickstore_ShutdownMicroservice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ShutdownInput) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QuickstoreServer).ShutdownMicroservice(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/mako.internal.quickstore_microservice.Quickstore/ShutdownMicroservice", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QuickstoreServer).ShutdownMicroservice(ctx, req.(*ShutdownInput)) - } - return interceptor(ctx, in, info, handler) -} - -var _Quickstore_serviceDesc = grpc.ServiceDesc{ - ServiceName: "mako.internal.quickstore_microservice.Quickstore", - HandlerType: (*QuickstoreServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Store", - Handler: _Quickstore_Store_Handler, - }, - { - MethodName: "ShutdownMicroservice", - Handler: _Quickstore_ShutdownMicroservice_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "internal/quickstore_microservice/proto/quickstore.proto", -} diff --git a/vendor/modules.txt b/vendor/modules.txt index d9e074ba8984..a20b2191807b 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -247,11 +247,6 @@ github.com/gogo/protobuf/sortkeys # github.com/golang-jwt/jwt/v4 v4.4.2 ## explicit; go 1.16 github.com/golang-jwt/jwt/v4 -# github.com/golang/glog v1.1.0 -## explicit; go 1.18 -github.com/golang/glog -github.com/golang/glog/internal/logsink -github.com/golang/glog/internal/stackdump # github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da ## explicit github.com/golang/groupcache/lru @@ -311,26 +306,10 @@ github.com/google/go-containerregistry/pkg/authn/k8schain # github.com/google/go-containerregistry/pkg/authn/kubernetes v0.0.0-20230209165335-3624968304fd ## explicit; go 1.18 github.com/google/go-containerregistry/pkg/authn/kubernetes -# github.com/google/go-github/v27 v27.0.6 -## explicit -github.com/google/go-github/v27/github -# github.com/google/go-querystring v1.0.0 -## explicit -github.com/google/go-querystring/query # github.com/google/gofuzz v1.2.0 ## explicit; go 1.12 github.com/google/gofuzz github.com/google/gofuzz/bytesource -# github.com/google/mako v0.0.0-20190821191249-122f8dcef9e3 -## explicit; go 1.12 -github.com/google/mako/clients/proto/analyzers/threshold_analyzer_go_proto -github.com/google/mako/clients/proto/analyzers/utest_analyzer_go_proto -github.com/google/mako/clients/proto/analyzers/window_deviation_go_proto -github.com/google/mako/go/quickstore -github.com/google/mako/internal/go/common -github.com/google/mako/internal/quickstore_microservice/proto/quickstore_go_proto -github.com/google/mako/proto/quickstore/quickstore_go_proto -github.com/google/mako/spec/proto/mako_go_proto # github.com/google/s2a-go v0.1.4 ## explicit; go 1.16 github.com/google/s2a-go @@ -557,7 +536,6 @@ go.uber.org/zap/zapcore go.uber.org/zap/zaptest # golang.org/x/crypto v0.12.0 ## explicit; go 1.17 -golang.org/x/crypto/cast5 golang.org/x/crypto/chacha20 golang.org/x/crypto/chacha20poly1305 golang.org/x/crypto/cryptobyte @@ -565,12 +543,6 @@ golang.org/x/crypto/cryptobyte/asn1 golang.org/x/crypto/hkdf golang.org/x/crypto/internal/alias golang.org/x/crypto/internal/poly1305 -golang.org/x/crypto/openpgp -golang.org/x/crypto/openpgp/armor -golang.org/x/crypto/openpgp/elgamal -golang.org/x/crypto/openpgp/errors -golang.org/x/crypto/openpgp/packet -golang.org/x/crypto/openpgp/s2k golang.org/x/crypto/pkcs12 golang.org/x/crypto/pkcs12/internal/rc2 # golang.org/x/mod v0.12.0 @@ -1443,27 +1415,18 @@ knative.dev/pkg/system knative.dev/pkg/system/testing knative.dev/pkg/test knative.dev/pkg/test/environment -knative.dev/pkg/test/ghutil knative.dev/pkg/test/ha knative.dev/pkg/test/helpers knative.dev/pkg/test/ingress knative.dev/pkg/test/logging knative.dev/pkg/test/logstream knative.dev/pkg/test/logstream/v2 -knative.dev/pkg/test/mako -knative.dev/pkg/test/mako/alerter -knative.dev/pkg/test/mako/alerter/github -knative.dev/pkg/test/mako/alerter/slack -knative.dev/pkg/test/mako/config -knative.dev/pkg/test/mako/stub-sidecar knative.dev/pkg/test/migrate knative.dev/pkg/test/monitoring -knative.dev/pkg/test/slackutil knative.dev/pkg/test/spoof knative.dev/pkg/test/upgrade knative.dev/pkg/test/vegeta/pacers knative.dev/pkg/test/zipkin -knative.dev/pkg/third_party/mako/proto/quickstore_go_proto knative.dev/pkg/tracing knative.dev/pkg/tracing/config knative.dev/pkg/tracing/propagation