From d43af83c6fcd9035f9cc64f51c80d281f3bea279 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 May 2021 19:08:25 +1000 Subject: [PATCH] Bump github.com/go-openapi/validate from 0.19.8 to 0.20.2 (#2800) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Bump github.com/go-openapi/validate from 0.19.8 to 0.20.2 Bumps [github.com/go-openapi/validate](https://github.com/go-openapi/validate) from 0.19.8 to 0.20.2. - [Release notes](https://github.com/go-openapi/validate/releases) - [Commits](https://github.com/go-openapi/validate/compare/v0.19.8...v0.20.2) Signed-off-by: dependabot[bot] * Updated swagger-gen version and re-run generator Signed-off-by: Juraci Paixão Kröhling * Add swagger-gen to static check ignore list Signed-off-by: Juraci Paixão Kröhling * Fix error message in test Signed-off-by: Juraci Paixão Kröhling Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Juraci Paixão Kröhling --- Makefile | 5 +- cmd/collector/app/zipkin/http_handler_test.go | 2 +- go.mod | 26 +- go.sum | 107 +++-- swagger-gen/models/annotation.go | 18 +- swagger-gen/models/endpoint.go | 53 ++- swagger-gen/models/list_of_spans.go | 31 +- swagger-gen/models/span.go | 182 +++++--- swagger-gen/models/tags.go | 11 +- swagger-gen/restapi/configure_zipkin_api.go | 75 ++++ swagger-gen/restapi/doc.go | 39 +- swagger-gen/restapi/embedded_spec.go | 398 +++++++++++++++++- swagger-gen/restapi/operations/post_spans.go | 8 +- .../operations/post_spans_parameters.go | 30 +- .../operations/post_spans_responses.go | 3 + .../restapi/operations/zipkin_api_api.go | 302 +++++++++++++ 16 files changed, 1126 insertions(+), 164 deletions(-) create mode 100644 swagger-gen/restapi/configure_zipkin_api.go create mode 100644 swagger-gen/restapi/operations/zipkin_api_api.go diff --git a/Makefile b/Makefile index a7a8690763d..960fd298af8 100644 --- a/Makefile +++ b/Makefile @@ -55,8 +55,8 @@ THRIFT=docker run --rm -u ${shell id -u} -v "${PWD}:/data" $(THRIFT_IMG) thrift THRIFT_GO_ARGS=thrift_import="github.com/apache/thrift/lib/go/thrift" THRIFT_GEN_DIR=thrift-gen -SWAGGER_VER=0.12.0 -SWAGGER_IMAGE=quay.io/goswagger/swagger:$(SWAGGER_VER) +SWAGGER_VER=0.27.0 +SWAGGER_IMAGE=quay.io/goswagger/swagger:v$(SWAGGER_VER) SWAGGER=docker run --rm -it -u ${shell id -u} -v "${PWD}:/go/src/" -w /go/src/ $(SWAGGER_IMAGE) SWAGGER_GEN_DIR=swagger-gen @@ -173,6 +173,7 @@ lint-staticcheck: | grep -v \ -e model/model.pb.go \ -e thrift-gen/ \ + -e swagger-gen/ \ >> $(LINT_LOG) || true @[ ! -s "$(LINT_LOG)" ] || (echo "Detected staticcheck failures:" | cat - $(LINT_LOG) && false) diff --git a/cmd/collector/app/zipkin/http_handler_test.go b/cmd/collector/app/zipkin/http_handler_test.go index ec90a0e9cb0..f5331bfa329 100644 --- a/cmd/collector/app/zipkin/http_handler_test.go +++ b/cmd/collector/app/zipkin/http_handler_test.go @@ -264,7 +264,7 @@ func TestSaveSpansV2(t *testing.T) { {body: []byte("[]"), code: http.StatusBadRequest, headers: map[string]string{"Content-Encoding": "gzip"}, resBody: "Unable to process request body: unexpected EOF\n"}, {body: []byte("not good"), code: http.StatusBadRequest, resBody: "Unable to process request body: invalid character 'o' in literal null (expecting 'u')\n"}, {body: []byte("[{}]"), code: http.StatusBadRequest, resBody: "Unable to process request body: validation failure list:\nid in body is required\ntraceId in body is required\n"}, - {body: []byte(`[{"id":"1111111111111111", "traceId":"1111111111111111", "localEndpoint": {"ipv4": "A"}}]`), code: http.StatusBadRequest, resBody: "Unable to process request body: wrong ipv4\n"}, + {body: []byte(`[{"id":"1111111111111111", "traceId":"1111111111111111", "localEndpoint": {"ipv4": "A"}}]`), code: http.StatusBadRequest, resBody: "Unable to process request body: validation failure list:\nvalidation failure list:\nipv4 in body must be of type ipv4: \"A\"\n"}, } for _, test := range tests { h := createHeader("application/json") diff --git a/go.mod b/go.mod index e636dfa0f88..a1d2c7ae4cb 100644 --- a/go.mod +++ b/go.mod @@ -6,6 +6,7 @@ require ( github.com/HdrHistogram/hdrhistogram-go v0.9.0 // indirect github.com/Shopify/sarama v1.28.0 github.com/apache/thrift v0.14.1 + github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect github.com/bsm/sarama-cluster v2.1.13+incompatible github.com/crossdock/crossdock-go v0.0.0-20160816171116-049aabb0122b github.com/dgraph-io/badger v1.6.2 @@ -13,13 +14,14 @@ require ( github.com/fatih/color v1.9.0 // indirect github.com/fsnotify/fsnotify v1.4.9 github.com/go-kit/kit v0.10.0 // indirect - github.com/go-openapi/errors v0.19.4 - github.com/go-openapi/loads v0.19.5 - github.com/go-openapi/runtime v0.19.15 - github.com/go-openapi/spec v0.20.2 - github.com/go-openapi/strfmt v0.19.5 - github.com/go-openapi/swag v0.19.13 - github.com/go-openapi/validate v0.19.8 + github.com/go-openapi/analysis v0.20.1 // indirect + github.com/go-openapi/errors v0.20.0 + github.com/go-openapi/loads v0.20.2 + github.com/go-openapi/runtime v0.19.28 + github.com/go-openapi/spec v0.20.3 + github.com/go-openapi/strfmt v0.20.1 + github.com/go-openapi/swag v0.19.15 + github.com/go-openapi/validate v0.20.2 github.com/gocql/gocql v0.0.0-20200228163523-cd4b606dd2fb github.com/gogo/googleapis v1.4.0 github.com/gogo/protobuf v1.3.2 @@ -32,16 +34,14 @@ require ( github.com/hashicorp/go-plugin v1.4.0 github.com/hashicorp/yamux v0.0.0-20190923154419-df201c70410d // indirect github.com/kr/pretty v0.2.1 + github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-colorable v0.1.6 // indirect - github.com/mitchellh/mapstructure v1.2.2 // indirect github.com/mjibson/esc v0.2.0 github.com/oklog/run v1.1.0 // indirect github.com/olivere/elastic v6.2.35+incompatible github.com/opentracing-contrib/go-grpc v0.0.0-20191001143057-db30781987df github.com/opentracing-contrib/go-stdlib v0.0.0-20190519235532-cf7a6c988dc9 github.com/opentracing/opentracing-go v1.2.0 - github.com/pelletier/go-toml v1.6.0 // indirect - github.com/pkg/errors v0.9.1 // indirect github.com/prometheus/client_golang v1.5.1 github.com/prometheus/common v0.10.0 // indirect github.com/prometheus/procfs v0.1.3 // indirect @@ -60,13 +60,13 @@ require ( github.com/vektra/mockery v0.0.0-20181123154057-e78b021dcbb5 github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad github.com/xdg-go/scram v1.0.2 - go.mongodb.org/mongo-driver v1.3.2 // indirect + go.mongodb.org/mongo-driver v1.5.2 // indirect go.uber.org/atomic v1.7.0 go.uber.org/automaxprocs v1.4.0 go.uber.org/zap v1.16.0 golang.org/x/lint v0.0.0-20200302205851-738671d3881b - golang.org/x/net v0.0.0-20210119194325-5f4716e94777 - golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4 + golang.org/x/net v0.0.0-20210510120150-4163338589ed + golang.org/x/sys v0.0.0-20210423082822-04245dca01da google.golang.org/grpc v1.29.1 gopkg.in/ini.v1 v1.52.0 // indirect gopkg.in/yaml.v2 v2.4.0 diff --git a/go.sum b/go.sum index bcc15a1871a..e6bf03e7d76 100644 --- a/go.sum +++ b/go.sum @@ -51,10 +51,14 @@ github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= -github.com/asaskevich/govalidator v0.0.0-20200108200545-475eaeb16496 h1:zV3ejI06GQ59hwDQAvmK1qxOQGB3WuVTRoY0okPTAv0= github.com/asaskevich/govalidator v0.0.0-20200108200545-475eaeb16496/go.mod h1:oGkLhpf+kjZl6xBf758TQhh5XrAeiJv/7FRz/2spLIg= +github.com/asaskevich/govalidator v0.0.0-20200428143746-21a406dcc535/go.mod h1:oGkLhpf+kjZl6xBf758TQhh5XrAeiJv/7FRz/2spLIg= +github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= +github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d h1:Byv0BzEl3/e6D5CLfI0j/7hiIEtvGVFPCZ7Ei2oq8iQ= +github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/aws/aws-sdk-go v1.34.28/go.mod h1:H7NKnBqNVzoTJpGfLrQkkD+ytBA93eiDYi/+8rV9s48= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= @@ -162,14 +166,21 @@ github.com/go-openapi/analysis v0.18.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpR github.com/go-openapi/analysis v0.19.2/go.mod h1:3P1osvZa9jKjb8ed2TPng3f0i/UY9snX6gxi44djMjk= github.com/go-openapi/analysis v0.19.4/go.mod h1:3P1osvZa9jKjb8ed2TPng3f0i/UY9snX6gxi44djMjk= github.com/go-openapi/analysis v0.19.5/go.mod h1:hkEAkxagaIvIP7VTn8ygJNkd4kAYON2rCu0v0ObL0AU= -github.com/go-openapi/analysis v0.19.10 h1:5BHISBAXOc/aJK25irLZnx2D3s6WyYaY9D4gmuz9fdE= github.com/go-openapi/analysis v0.19.10/go.mod h1:qmhS3VNFxBlquFJ0RGoDtylO9y4pgTAUNE9AEEMdlJQ= +github.com/go-openapi/analysis v0.19.16/go.mod h1:GLInF007N83Ad3m8a/CbQ5TPzdnGT7workfHwuVjNVk= +github.com/go-openapi/analysis v0.20.0/go.mod h1:BMchjvaHDykmRMsK40iPtvyOfFdMMxlOmQr9FBZk+Og= +github.com/go-openapi/analysis v0.20.1 h1:zdVbw8yoD4SWZeq+cWdGgquaB0W4VrsJvDJHJND/Ktc= +github.com/go-openapi/analysis v0.20.1/go.mod h1:BMchjvaHDykmRMsK40iPtvyOfFdMMxlOmQr9FBZk+Og= github.com/go-openapi/errors v0.17.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0= github.com/go-openapi/errors v0.18.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0= github.com/go-openapi/errors v0.19.2/go.mod h1:qX0BLWsyaKfvhluLejVpVNwNRdXZhEbTA4kxxpKBC94= github.com/go-openapi/errors v0.19.3/go.mod h1:qX0BLWsyaKfvhluLejVpVNwNRdXZhEbTA4kxxpKBC94= -github.com/go-openapi/errors v0.19.4 h1:fSGwO1tSYHFu70NKaWJt5Qh0qoBRtCm/mXS1yhf+0W0= -github.com/go-openapi/errors v0.19.4/go.mod h1:qX0BLWsyaKfvhluLejVpVNwNRdXZhEbTA4kxxpKBC94= +github.com/go-openapi/errors v0.19.6/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= +github.com/go-openapi/errors v0.19.7/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= +github.com/go-openapi/errors v0.19.8/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= +github.com/go-openapi/errors v0.19.9/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= +github.com/go-openapi/errors v0.20.0 h1:Sxpo9PjEHDzhs3FbnGNonvDgWcMW2U7wGTcDDSFSceM= +github.com/go-openapi/errors v0.20.0/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= github.com/go-openapi/jsonpointer v0.17.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= github.com/go-openapi/jsonpointer v0.18.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= @@ -187,42 +198,64 @@ github.com/go-openapi/loads v0.18.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf github.com/go-openapi/loads v0.19.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= github.com/go-openapi/loads v0.19.2/go.mod h1:QAskZPMX5V0C2gvfkGZzJlINuP7Hx/4+ix5jWFxsNPs= github.com/go-openapi/loads v0.19.3/go.mod h1:YVfqhUCdahYwR3f3iiwQLhicVRvLlU/WO5WPaZvcvSI= -github.com/go-openapi/loads v0.19.4/go.mod h1:zZVHonKd8DXyxyw4yfnVjPzBjIQcLt0CCsn0N0ZrQsk= -github.com/go-openapi/loads v0.19.5 h1:jZVYWawIQiA1NBnHla28ktg6hrcfTHsCE+3QLVRBIls= github.com/go-openapi/loads v0.19.5/go.mod h1:dswLCAdonkRufe/gSUC3gN8nTSaB9uaS2es0x5/IbjY= +github.com/go-openapi/loads v0.19.6/go.mod h1:brCsvE6j8mnbmGBh103PT/QLHfbyDxA4hsKvYBNEGVc= +github.com/go-openapi/loads v0.19.7/go.mod h1:brCsvE6j8mnbmGBh103PT/QLHfbyDxA4hsKvYBNEGVc= +github.com/go-openapi/loads v0.20.0/go.mod h1:2LhKquiE513rN5xC6Aan6lYOSddlL8Mp20AW9kpviM4= +github.com/go-openapi/loads v0.20.2 h1:z5p5Xf5wujMxS1y8aP+vxwW5qYT2zdJBbXKmQUG3lcc= +github.com/go-openapi/loads v0.20.2/go.mod h1:hTVUotJ+UonAMMZsvakEgmWKgtulweO9vYP2bQYKA/o= github.com/go-openapi/runtime v0.0.0-20180920151709-4f900dc2ade9/go.mod h1:6v9a6LTXWQCdL8k1AO3cvqx5OtZY/Y9wKTgaoP6YRfA= github.com/go-openapi/runtime v0.19.0/go.mod h1:OwNfisksmmaZse4+gpV3Ne9AyMOlP1lt4sK4FXt0O64= github.com/go-openapi/runtime v0.19.4/go.mod h1:X277bwSUBxVlCYR3r7xgZZGKVvBd/29gLDlFGtJ8NL4= -github.com/go-openapi/runtime v0.19.15 h1:2GIefxs9Rx1vCDNghRtypRq+ig8KSLrjHbAYI/gCLCM= github.com/go-openapi/runtime v0.19.15/go.mod h1:dhGWCTKRXlAfGnQG0ONViOZpjfg0m2gUt9nTQPQZuoo= +github.com/go-openapi/runtime v0.19.16/go.mod h1:5P9104EJgYcizotuXhEuUrzVc+j1RiSjahULvYmlv98= +github.com/go-openapi/runtime v0.19.24/go.mod h1:Lm9YGCeecBnUUkFTxPC4s1+lwrkJ0pthx8YvyjCfkgk= +github.com/go-openapi/runtime v0.19.28 h1:9lYu6axek8LJrVkMVViVirRcpoaCxXX7+sSvmizGVnA= +github.com/go-openapi/runtime v0.19.28/go.mod h1:BvrQtn6iVb2QmiVXRsFAm6ZCAZBpbVKFfN6QWCp582M= github.com/go-openapi/spec v0.17.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI= github.com/go-openapi/spec v0.18.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI= github.com/go-openapi/spec v0.19.2/go.mod h1:sCxk3jxKgioEJikev4fgkNmwS+3kuYdJtcsZsD5zxMY= github.com/go-openapi/spec v0.19.3/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8Lj9mJglo= github.com/go-openapi/spec v0.19.6/go.mod h1:Hm2Jr4jv8G1ciIAo+frC/Ft+rR2kQDh8JHKHb3gWUSk= -github.com/go-openapi/spec v0.20.2 h1:pFPUZsiIbZ20kLUcuCGeuQWG735fPMxW7wHF9BWlnQU= -github.com/go-openapi/spec v0.20.2/go.mod h1:RW6Xcbs6LOyWLU/mXGdzn2Qc+3aj+ASfI7rvSZh1Vls= +github.com/go-openapi/spec v0.19.8/go.mod h1:Hm2Jr4jv8G1ciIAo+frC/Ft+rR2kQDh8JHKHb3gWUSk= +github.com/go-openapi/spec v0.19.15/go.mod h1:+81FIL1JwC5P3/Iuuozq3pPE9dXdIEGxFutcFKaVbmU= +github.com/go-openapi/spec v0.20.0/go.mod h1:+81FIL1JwC5P3/Iuuozq3pPE9dXdIEGxFutcFKaVbmU= +github.com/go-openapi/spec v0.20.1/go.mod h1:93x7oh+d+FQsmsieroS4cmR3u0p/ywH649a3qwC9OsQ= +github.com/go-openapi/spec v0.20.3 h1:uH9RQ6vdyPSs2pSy9fL8QPspDF2AMIMPtmK5coSSjtQ= +github.com/go-openapi/spec v0.20.3/go.mod h1:gG4F8wdEDN+YPBMVnzE85Rbhf+Th2DTvA9nFPQ5AYEg= github.com/go-openapi/strfmt v0.17.0/go.mod h1:P82hnJI0CXkErkXi8IKjPbNBM6lV6+5pLP5l494TcyU= github.com/go-openapi/strfmt v0.18.0/go.mod h1:P82hnJI0CXkErkXi8IKjPbNBM6lV6+5pLP5l494TcyU= github.com/go-openapi/strfmt v0.19.0/go.mod h1:+uW+93UVvGGq2qGaZxdDeJqSAqBqBdl+ZPMF/cC8nDY= github.com/go-openapi/strfmt v0.19.2/go.mod h1:0yX7dbo8mKIvc3XSKp7MNfxw4JytCfCD6+bY1AVL9LU= github.com/go-openapi/strfmt v0.19.3/go.mod h1:0yX7dbo8mKIvc3XSKp7MNfxw4JytCfCD6+bY1AVL9LU= github.com/go-openapi/strfmt v0.19.4/go.mod h1:eftuHTlB/dI8Uq8JJOyRlieZf+WkkxUuk0dgdHXr2Qk= -github.com/go-openapi/strfmt v0.19.5 h1:0utjKrw+BAh8s57XE9Xz8DUBsVvPmRUB6styvl9wWIM= github.com/go-openapi/strfmt v0.19.5/go.mod h1:eftuHTlB/dI8Uq8JJOyRlieZf+WkkxUuk0dgdHXr2Qk= +github.com/go-openapi/strfmt v0.19.11/go.mod h1:UukAYgTaQfqJuAFlNxxMWNvMYiwiXtLsF2VwmoFtbtc= +github.com/go-openapi/strfmt v0.20.0/go.mod h1:UukAYgTaQfqJuAFlNxxMWNvMYiwiXtLsF2VwmoFtbtc= +github.com/go-openapi/strfmt v0.20.1 h1:1VgxvehFne1mbChGeCmZ5pc0LxUf6yaACVSIYAR91Xc= +github.com/go-openapi/strfmt v0.20.1/go.mod h1:43urheQI9dNtE5lTZQfuFJvjYJKPrxicATpEfZwHUNk= github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg= github.com/go-openapi/swag v0.18.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg= github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-openapi/swag v0.19.7/go.mod h1:ao+8BpOPyKdpQz3AOJfbeEVpLmWAvlT1IfTe5McPyhY= -github.com/go-openapi/swag v0.19.13 h1:233UVgMy1DlmCYYfOiFpta6e2urloh+sEs5id6lyzog= +github.com/go-openapi/swag v0.19.9/go.mod h1:ao+8BpOPyKdpQz3AOJfbeEVpLmWAvlT1IfTe5McPyhY= +github.com/go-openapi/swag v0.19.12/go.mod h1:eFdyEBkTdoAf/9RXBvj4cr1nH7GD8Kzo5HTt47gr72M= github.com/go-openapi/swag v0.19.13/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= +github.com/go-openapi/swag v0.19.14/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= +github.com/go-openapi/swag v0.19.15 h1:D2NRCBzS9/pEY3gP9Nl8aDqGUcPFrwG2p+CNFrLyrCM= +github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= github.com/go-openapi/validate v0.18.0/go.mod h1:Uh4HdOzKt19xGIGm1qHf/ofbX1YQ4Y+MYsct2VUrAJ4= github.com/go-openapi/validate v0.19.2/go.mod h1:1tRCw7m3jtI8eNWEEliiAqUIcBztB2KDnRCRMUi7GTA= github.com/go-openapi/validate v0.19.3/go.mod h1:90Vh6jjkTn+OT1Eefm0ZixWNFjhtOH7vS9k0lo6zwJo= -github.com/go-openapi/validate v0.19.8 h1:YFzsdWIDfVuLvIOF+ZmKjVg1MbPJ1QgY9PihMwei1ys= -github.com/go-openapi/validate v0.19.8/go.mod h1:8DJv2CVJQ6kGNpFW6eV9N3JviE1C85nY1c2z52x1Gk4= +github.com/go-openapi/validate v0.19.10/go.mod h1:RKEZTUWDkxKQxN2jDT7ZnZi2bhZlbNMAuKvKB+IaGx8= +github.com/go-openapi/validate v0.19.12/go.mod h1:Rzou8hA/CBw8donlS6WNEUQupNvUZ0waH08tGe6kAQ4= +github.com/go-openapi/validate v0.19.15/go.mod h1:tbn/fdOwYHgrhPBzidZfJC2MIVvs9GA7monOmWBbeCI= +github.com/go-openapi/validate v0.20.1/go.mod h1:b60iJT+xNNLfaQJUqLI7946tYiFEOuE9E4k54HpKcJ0= +github.com/go-openapi/validate v0.20.2 h1:AhqDegYV3J3iQkMPJSXkvzymHKMTw0BST3RK3hTT4ts= +github.com/go-openapi/validate v0.20.2/go.mod h1:e7OJoKNgd0twXZwIn0A43tHbvIcr/rZIVCbJBpTUoY0= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= +github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gobuffalo/attrs v0.0.0-20190224210810-a9411de4debd/go.mod h1:4duuawTqi2wkkpB4ePgWMaai6/Kc6WEz83bhFwpHzj0= @@ -284,6 +317,7 @@ github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5a github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= @@ -377,6 +411,8 @@ github.com/jcmturner/rpc/v2 v2.0.3/go.mod h1:VUJYCIDm3PVOEHw8sgt091/20OJjskO/YJk github.com/jhump/protoreflect v1.6.0 h1:h5jfMVslIg6l29nsMs0D8Wj17RDVdNYti0vDN/PZZoE= github.com/jhump/protoreflect v1.6.0/go.mod h1:eaTn3RZAmMBcV0fifFvlm6VHNz3wSkYyXYWUh7ymB74= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= +github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= @@ -422,10 +458,10 @@ github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.7.0/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs= github.com/mailru/easyjson v0.7.1/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs= -github.com/mailru/easyjson v0.7.6 h1:8yTIVnZgCoiM1TgqoeTl+LfU5Jg6/xL3QhGQnimLYnA= github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE= github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= @@ -453,8 +489,11 @@ github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS4 github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.2.2 h1:dxe5oCinTXiTIcfgmZecdCzPmAJKd46KsCWc35r0TV4= -github.com/mitchellh/mapstructure v1.2.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.3.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.4.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag= +github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mjibson/esc v0.2.0 h1:k96hdaR9Z+nMcnDwNrOvhdBqtjyMrbVyxLpsRCdP2mA= github.com/mjibson/esc v0.2.0/go.mod h1:9Hw9gxxfHulMF5OJKCyhYD7PzlSdhzXyaGEBRPH1OPs= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -480,6 +519,7 @@ github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtb github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA= github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU= +github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/olivere/elastic v6.2.35+incompatible h1:MMklYDy2ySi01s123CB2WLBuDMzFX4qhFcA5tKWJPgM= @@ -512,8 +552,8 @@ github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FI github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.4.0/go.mod h1:PN7xzY2wHTK0K9p34ErDQMlFxa51Fk0OUruD3k1mMwo= -github.com/pelletier/go-toml v1.6.0 h1:aetoXYr0Tv7xRU/V4B4IZJ2QcbtMUFoNb3ORp7TzIK4= -github.com/pelletier/go-toml v1.6.0/go.mod h1:5N711Q9dKgbdkxHL+MEfF31hpT7l0S0s/t2kKREewys= +github.com/pelletier/go-toml v1.7.0 h1:7utD74fnzVc/cpcyy8sjrlFr5vYpypUixARcHIMIGuI= +github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= @@ -656,6 +696,7 @@ github.com/xdg/stringprep v0.0.0-20180714160509-73f8eece6fdc/go.mod h1:Jhud4/sHM github.com/xdg/stringprep v1.0.0/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= @@ -663,10 +704,14 @@ go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= go.mongodb.org/mongo-driver v1.0.3/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= go.mongodb.org/mongo-driver v1.1.1/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= -go.mongodb.org/mongo-driver v1.1.2/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= go.mongodb.org/mongo-driver v1.3.0/go.mod h1:MSWZXKOynuguX+JSvwP8i+58jYCXxbia8HS3gZBapIE= -go.mongodb.org/mongo-driver v1.3.2 h1:IYppNjEV/C+/3VPbhHVxQ4t04eVW0cLp0/pNdW++6Ug= -go.mongodb.org/mongo-driver v1.3.2/go.mod h1:MSWZXKOynuguX+JSvwP8i+58jYCXxbia8HS3gZBapIE= +go.mongodb.org/mongo-driver v1.3.4/go.mod h1:MSWZXKOynuguX+JSvwP8i+58jYCXxbia8HS3gZBapIE= +go.mongodb.org/mongo-driver v1.4.3/go.mod h1:WcMNYLx/IlOxLe6JRJiv2uXuCz6zBLndR4SoGjYphSc= +go.mongodb.org/mongo-driver v1.4.4/go.mod h1:WcMNYLx/IlOxLe6JRJiv2uXuCz6zBLndR4SoGjYphSc= +go.mongodb.org/mongo-driver v1.4.6/go.mod h1:WcMNYLx/IlOxLe6JRJiv2uXuCz6zBLndR4SoGjYphSc= +go.mongodb.org/mongo-driver v1.5.1/go.mod h1:gRXCHX4Jo7J0IJ1oDQyUxF7jfy19UfxniMS4xxMmUqw= +go.mongodb.org/mongo-driver v1.5.2 h1:AsxOLoJTgP6YNM0fXWw4OjdluYmWzQYp+lFJL7xu9fU= +go.mongodb.org/mongo-driver v1.5.2/go.mod h1:gRXCHX4Jo7J0IJ1oDQyUxF7jfy19UfxniMS4xxMmUqw= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= @@ -703,6 +748,7 @@ golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20190617133340-57b3e21c3d56/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201112155050-0c6587e931a9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad h1:DN0cp81fZ3njFcrLCytUHRSUkqBjfTo4Tx9RJTWs0EY= @@ -760,11 +806,17 @@ golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190921015927-1a5e07d1ff72/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200602114024-627f9648deb9/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210119194325-5f4716e94777 h1:003p0dJM77cxMSyCPFphvZf/Y5/NXf5fzg6ufd1/Oew= +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210510120150-4163338589ed h1:p9UgmWI9wKpfYmgaV/IZKGdXc5qEK45tDwwwDyjS26I= +golang.org/x/net v0.0.0-20210510120150-4163338589ed/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -817,8 +869,9 @@ golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4 h1:myAQVi0cGEoqQVR5POX+8RR2mrocKqNN1hmeMqhX27k= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da h1:b3NXsE2LusjYGGjL5bxEVZZORm/YEFFrWFjR8eFrw/c= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -826,8 +879,10 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= +golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -946,9 +1001,11 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/swagger-gen/models/annotation.go b/swagger-gen/models/annotation.go index 9fba5cb679b..a1d1ac0f44f 100644 --- a/swagger-gen/models/annotation.go +++ b/swagger-gen/models/annotation.go @@ -6,9 +6,9 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -20,8 +20,8 @@ import ( // Zipkin v1 core annotations such as "cs" and "sr" have been replaced with // Span.Kind, which interprets timestamp and duration. // +// // swagger:model Annotation - type Annotation struct { // Epoch **microseconds** of this event. @@ -42,17 +42,13 @@ type Annotation struct { Value string `json:"value,omitempty"` } -/* polymorph Annotation timestamp false */ - -/* polymorph Annotation value false */ - // Validate validates this annotation func (m *Annotation) Validate(formats strfmt.Registry) error { - var res []error + return nil +} - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } +// ContextValidate validates this annotation based on context it is used +func (m *Annotation) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } diff --git a/swagger-gen/models/endpoint.go b/swagger-gen/models/endpoint.go index 368f7ba4ff2..06ae40ae303 100644 --- a/swagger-gen/models/endpoint.go +++ b/swagger-gen/models/endpoint.go @@ -6,22 +6,25 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" + "github.com/go-openapi/validate" ) // Endpoint Endpoint // // The network context of a node in the service graph +// // swagger:model Endpoint - type Endpoint struct { // The text representation of the primary IPv4 address associated with this // a connection. Ex. 192.168.99.100 Absent if unknown. // + // Format: ipv4 IPV4 strfmt.IPv4 `json:"ipv4,omitempty"` // The text representation of the primary IPv6 address associated with this @@ -29,6 +32,7 @@ type Endpoint struct { // // Prefer using the ipv4 field for mapped addresses. // + // Format: ipv6 IPV6 strfmt.IPv6 `json:"ipv6,omitempty"` // Depending on context, this could be a listen port or the client-side of a @@ -45,24 +49,53 @@ type Endpoint struct { ServiceName string `json:"serviceName,omitempty"` } -/* polymorph Endpoint ipv4 false */ - -/* polymorph Endpoint ipv6 false */ - -/* polymorph Endpoint port false */ - -/* polymorph Endpoint serviceName false */ - // Validate validates this endpoint func (m *Endpoint) Validate(formats strfmt.Registry) error { var res []error + if err := m.validateIPV4(formats); err != nil { + res = append(res, err) + } + + if err := m.validateIPV6(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } +func (m *Endpoint) validateIPV4(formats strfmt.Registry) error { + if swag.IsZero(m.IPV4) { // not required + return nil + } + + if err := validate.FormatOf("ipv4", "body", "ipv4", m.IPV4.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *Endpoint) validateIPV6(formats strfmt.Registry) error { + if swag.IsZero(m.IPV6) { // not required + return nil + } + + if err := validate.FormatOf("ipv6", "body", "ipv6", m.IPV6.String(), formats); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this endpoint based on context it is used +func (m *Endpoint) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Endpoint) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagger-gen/models/list_of_spans.go b/swagger-gen/models/list_of_spans.go index 984a25d0851..1d407d4bf0c 100644 --- a/swagger-gen/models/list_of_spans.go +++ b/swagger-gen/models/list_of_spans.go @@ -6,19 +6,19 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // ListOfSpans ListOfSpans // // A list of spans with possibly different trace ids, in no particular order +// // swagger:model ListOfSpans - type ListOfSpans []*Span // Validate validates this list of spans @@ -26,13 +26,11 @@ func (m ListOfSpans) Validate(formats strfmt.Registry) error { var res []error for i := 0; i < len(m); i++ { - if swag.IsZero(m[i]) { // not required continue } if m[i] != nil { - if err := m[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName(strconv.Itoa(i)) @@ -48,3 +46,26 @@ func (m ListOfSpans) Validate(formats strfmt.Registry) error { } return nil } + +// ContextValidate validate this list of spans based on the context it is used +func (m ListOfSpans) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + for i := 0; i < len(m); i++ { + + if m[i] != nil { + if err := m[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(strconv.Itoa(i)) + } + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/swagger-gen/models/span.go b/swagger-gen/models/span.go index e88e367573f..a66f43a2032 100644 --- a/swagger-gen/models/span.go +++ b/swagger-gen/models/span.go @@ -6,19 +6,19 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // Span Span +// // swagger:model Span - type Span struct { // Associates events that explain latency with the time they happened. @@ -72,6 +72,7 @@ type Span struct { // * duration - When present represents delay consuming the message, such as from backlog. // * remoteEndpoint - Represents the broker. Leave serviceName absent if unknown. // + // Enum: [CLIENT SERVER PRODUCER CONSUMER] Kind string `json:"kind,omitempty"` // The host that recorded this span, primarily for query by service name. @@ -132,73 +133,43 @@ type Span struct { TraceID *string `json:"traceId"` } -/* polymorph Span annotations false */ - -/* polymorph Span debug false */ - -/* polymorph Span duration false */ - -/* polymorph Span id false */ - -/* polymorph Span kind false */ - -/* polymorph Span localEndpoint false */ - -/* polymorph Span name false */ - -/* polymorph Span parentId false */ - -/* polymorph Span remoteEndpoint false */ - -/* polymorph Span shared false */ - -/* polymorph Span tags false */ - -/* polymorph Span timestamp false */ - -/* polymorph Span traceId false */ - // Validate validates this span func (m *Span) Validate(formats strfmt.Registry) error { var res []error if err := m.validateAnnotations(formats); err != nil { - // prop res = append(res, err) } if err := m.validateDuration(formats); err != nil { - // prop res = append(res, err) } if err := m.validateID(formats); err != nil { - // prop res = append(res, err) } if err := m.validateKind(formats); err != nil { - // prop res = append(res, err) } if err := m.validateLocalEndpoint(formats); err != nil { - // prop res = append(res, err) } if err := m.validateParentID(formats); err != nil { - // prop res = append(res, err) } if err := m.validateRemoteEndpoint(formats); err != nil { - // prop + res = append(res, err) + } + + if err := m.validateTags(formats); err != nil { res = append(res, err) } if err := m.validateTraceID(formats); err != nil { - // prop res = append(res, err) } @@ -209,7 +180,6 @@ func (m *Span) Validate(formats strfmt.Registry) error { } func (m *Span) validateAnnotations(formats strfmt.Registry) error { - if swag.IsZero(m.Annotations) { // not required return nil } @@ -219,13 +189,11 @@ func (m *Span) validateAnnotations(formats strfmt.Registry) error { } for i := 0; i < len(m.Annotations); i++ { - if swag.IsZero(m.Annotations[i]) { // not required continue } if m.Annotations[i] != nil { - if err := m.Annotations[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("annotations" + "." + strconv.Itoa(i)) @@ -240,12 +208,11 @@ func (m *Span) validateAnnotations(formats strfmt.Registry) error { } func (m *Span) validateDuration(formats strfmt.Registry) error { - if swag.IsZero(m.Duration) { // not required return nil } - if err := validate.MinimumInt("duration", "body", int64(m.Duration), 1, false); err != nil { + if err := validate.MinimumInt("duration", "body", m.Duration, 1, false); err != nil { return err } @@ -258,15 +225,15 @@ func (m *Span) validateID(formats strfmt.Registry) error { return err } - if err := validate.MinLength("id", "body", string(*m.ID), 16); err != nil { + if err := validate.MinLength("id", "body", *m.ID, 16); err != nil { return err } - if err := validate.MaxLength("id", "body", string(*m.ID), 16); err != nil { + if err := validate.MaxLength("id", "body", *m.ID, 16); err != nil { return err } - if err := validate.Pattern("id", "body", string(*m.ID), `[a-z0-9]{16}`); err != nil { + if err := validate.Pattern("id", "body", *m.ID, `[a-z0-9]{16}`); err != nil { return err } @@ -286,26 +253,29 @@ func init() { } const ( + // SpanKindCLIENT captures enum value "CLIENT" SpanKindCLIENT string = "CLIENT" + // SpanKindSERVER captures enum value "SERVER" SpanKindSERVER string = "SERVER" + // SpanKindPRODUCER captures enum value "PRODUCER" SpanKindPRODUCER string = "PRODUCER" + // SpanKindCONSUMER captures enum value "CONSUMER" SpanKindCONSUMER string = "CONSUMER" ) // prop value enum func (m *Span) validateKindEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, spanTypeKindPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, spanTypeKindPropEnum, true); err != nil { return err } return nil } func (m *Span) validateKind(formats strfmt.Registry) error { - if swag.IsZero(m.Kind) { // not required return nil } @@ -319,13 +289,11 @@ func (m *Span) validateKind(formats strfmt.Registry) error { } func (m *Span) validateLocalEndpoint(formats strfmt.Registry) error { - if swag.IsZero(m.LocalEndpoint) { // not required return nil } if m.LocalEndpoint != nil { - if err := m.LocalEndpoint.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("localEndpoint") @@ -338,20 +306,19 @@ func (m *Span) validateLocalEndpoint(formats strfmt.Registry) error { } func (m *Span) validateParentID(formats strfmt.Registry) error { - if swag.IsZero(m.ParentID) { // not required return nil } - if err := validate.MinLength("parentId", "body", string(m.ParentID), 16); err != nil { + if err := validate.MinLength("parentId", "body", m.ParentID, 16); err != nil { return err } - if err := validate.MaxLength("parentId", "body", string(m.ParentID), 16); err != nil { + if err := validate.MaxLength("parentId", "body", m.ParentID, 16); err != nil { return err } - if err := validate.Pattern("parentId", "body", string(m.ParentID), `[a-z0-9]{16}`); err != nil { + if err := validate.Pattern("parentId", "body", m.ParentID, `[a-z0-9]{16}`); err != nil { return err } @@ -359,13 +326,11 @@ func (m *Span) validateParentID(formats strfmt.Registry) error { } func (m *Span) validateRemoteEndpoint(formats strfmt.Registry) error { - if swag.IsZero(m.RemoteEndpoint) { // not required return nil } if m.RemoteEndpoint != nil { - if err := m.RemoteEndpoint.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("remoteEndpoint") @@ -377,21 +342,122 @@ func (m *Span) validateRemoteEndpoint(formats strfmt.Registry) error { return nil } +func (m *Span) validateTags(formats strfmt.Registry) error { + if swag.IsZero(m.Tags) { // not required + return nil + } + + if m.Tags != nil { + if err := m.Tags.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tags") + } + return err + } + } + + return nil +} + func (m *Span) validateTraceID(formats strfmt.Registry) error { if err := validate.Required("traceId", "body", m.TraceID); err != nil { return err } - if err := validate.MinLength("traceId", "body", string(*m.TraceID), 16); err != nil { + if err := validate.MinLength("traceId", "body", *m.TraceID, 16); err != nil { return err } - if err := validate.MaxLength("traceId", "body", string(*m.TraceID), 32); err != nil { + if err := validate.MaxLength("traceId", "body", *m.TraceID, 32); err != nil { return err } - if err := validate.Pattern("traceId", "body", string(*m.TraceID), `[a-z0-9]{16,32}`); err != nil { + if err := validate.Pattern("traceId", "body", *m.TraceID, `[a-z0-9]{16,32}`); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this span based on the context it is used +func (m *Span) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAnnotations(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateLocalEndpoint(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRemoteEndpoint(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTags(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Span) contextValidateAnnotations(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Annotations); i++ { + + if m.Annotations[i] != nil { + if err := m.Annotations[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("annotations" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Span) contextValidateLocalEndpoint(ctx context.Context, formats strfmt.Registry) error { + + if m.LocalEndpoint != nil { + if err := m.LocalEndpoint.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("localEndpoint") + } + return err + } + } + + return nil +} + +func (m *Span) contextValidateRemoteEndpoint(ctx context.Context, formats strfmt.Registry) error { + + if m.RemoteEndpoint != nil { + if err := m.RemoteEndpoint.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("remoteEndpoint") + } + return err + } + } + + return nil +} + +func (m *Span) contextValidateTags(ctx context.Context, formats strfmt.Registry) error { + + if err := m.Tags.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tags") + } return err } diff --git a/swagger-gen/models/tags.go b/swagger-gen/models/tags.go index 2207166c335..2b4f300b2a2 100644 --- a/swagger-gen/models/tags.go +++ b/swagger-gen/models/tags.go @@ -6,7 +6,9 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + + "github.com/go-openapi/strfmt" ) // Tags Tags @@ -17,11 +19,16 @@ import ( // A tag "sql.query" isn't searchable, but it can help in debugging when viewing // a trace. // +// // swagger:model Tags - type Tags map[string]string // Validate validates this tags func (m Tags) Validate(formats strfmt.Registry) error { return nil } + +// ContextValidate validates this tags based on context it is used +func (m Tags) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/swagger-gen/restapi/configure_zipkin_api.go b/swagger-gen/restapi/configure_zipkin_api.go new file mode 100644 index 00000000000..60ede9e13a8 --- /dev/null +++ b/swagger-gen/restapi/configure_zipkin_api.go @@ -0,0 +1,75 @@ +// This file is safe to edit. Once it exists it will not be overwritten + +package restapi + +import ( + "crypto/tls" + "net/http" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/runtime/middleware" + + "github.com/jaegertracing/jaeger/swagger-gen/restapi/operations" +) + +//go:generate swagger generate server --target ../../swagger-gen --name ZipkinAPI --spec ../../idl/swagger/zipkin2-api.yaml --operation PostSpans --principal interface{} --exclude-main + +func configureFlags(api *operations.ZipkinAPIAPI) { + // api.CommandLineOptionsGroups = []swag.CommandLineOptionsGroup{ ... } +} + +func configureAPI(api *operations.ZipkinAPIAPI) http.Handler { + // configure the api here + api.ServeError = errors.ServeError + + // Set your custom logger if needed. Default one is log.Printf + // Expected interface func(string, ...interface{}) + // + // Example: + // api.Logger = log.Printf + + api.UseSwaggerUI() + // To continue using redoc as your UI, uncomment the following line + // api.UseRedoc() + + api.JSONConsumer = runtime.JSONConsumer() + + api.JSONProducer = runtime.JSONProducer() + + if api.PostSpansHandler == nil { + api.PostSpansHandler = operations.PostSpansHandlerFunc(func(params operations.PostSpansParams) middleware.Responder { + return middleware.NotImplemented("operation operations.PostSpans has not yet been implemented") + }) + } + + api.PreServerShutdown = func() {} + + api.ServerShutdown = func() {} + + return setupGlobalMiddleware(api.Serve(setupMiddlewares)) +} + +// The TLS configuration before HTTPS server starts. +func configureTLS(tlsConfig *tls.Config) { + // Make all necessary changes to the TLS configuration here. +} + +// As soon as server is initialized but not run yet, this function will be called. +// If you need to modify a config, store server instance to stop it individually later, this is the place. +// This function can be called multiple times, depending on the number of serving schemes. +// scheme value will be set accordingly: "http", "https" or "unix". +func configureServer(s *http.Server, scheme, addr string) { +} + +// The middleware configuration is for the handler executors. These do not apply to the swagger.json document. +// The middleware executes after routing but before authentication, binding and validation. +func setupMiddlewares(handler http.Handler) http.Handler { + return handler +} + +// The middleware configuration happens before anything, this middleware also applies to serving the swagger.json document. +// So this is a good place to plug in a panic handling middleware, logging and metrics. +func setupGlobalMiddleware(handler http.Handler) http.Handler { + return handler +} diff --git a/swagger-gen/restapi/doc.go b/swagger-gen/restapi/doc.go index ef19e6e999c..1a88cb632dd 100644 --- a/swagger-gen/restapi/doc.go +++ b/swagger-gen/restapi/doc.go @@ -1,24 +1,21 @@ // Code generated by go-swagger; DO NOT EDIT. -/* -Package restapi Zipkin API -Zipkin's v2 api currently includes a POST endpoint that can receive spans. - - - - Schemes: - http - https - Host: localhost:9411 - BasePath: /api/v2 - Version: 1.0.0 - - Consumes: - - application/json - - Produces: - - application/json - -swagger:meta -*/ +// Package restapi Zipkin API +// +// Zipkin's v2 api currently includes a POST endpoint that can receive spans. +// +// Schemes: +// http +// https +// Host: localhost:9411 +// BasePath: /api/v2 +// Version: 1.0.0 +// +// Consumes: +// - application/json +// +// Produces: +// - application/json +// +// swagger:meta package restapi diff --git a/swagger-gen/restapi/embedded_spec.go b/swagger-gen/restapi/embedded_spec.go index 225e121d617..047fa21281b 100644 --- a/swagger-gen/restapi/embedded_spec.go +++ b/swagger-gen/restapi/embedded_spec.go @@ -9,8 +9,12 @@ import ( "encoding/json" ) -// SwaggerJSON embedded version of the swagger document used at generation time -var SwaggerJSON json.RawMessage +var ( + // SwaggerJSON embedded version of the swagger document used at generation time + SwaggerJSON json.RawMessage + // FlatSwaggerJSON embedded flattened version of the swagger document used at generation time + FlatSwaggerJSON json.RawMessage +) func init() { SwaggerJSON = json.RawMessage([]byte(`{ @@ -402,5 +406,395 @@ func init() { } } } +}`)) + FlatSwaggerJSON = json.RawMessage([]byte(`{ + "consumes": [ + "application/json" + ], + "schemes": [ + "http", + "https" + ], + "swagger": "2.0", + "info": { + "description": "Zipkin's v2 api currently includes a POST endpoint that can receive spans.\n", + "title": "Zipkin API", + "version": "1.0.0" + }, + "host": "localhost:9411", + "basePath": "/api/v2", + "paths": { + "/dependencies": { + "get": { + "description": "Returns service links derived from spans.\n", + "parameters": [ + { + "type": "integer", + "format": "int64", + "description": "only return links from spans where ` + "`" + `Span.timestamp` + "`" + ` are at or before\nthis time in epoch milliseconds.\n", + "name": "endTs", + "in": "query", + "required": true + }, + { + "type": "integer", + "format": "int64", + "description": "only return links where all Span.timestamp are at or after\n(` + "`" + `endTs - * lookback` + "`" + `) in milliseconds. Defaults to ` + "`" + `endTs` + "`" + `, limited\nto a system parameter ` + "`" + `QUERY_LOOKBACK` + "`" + `\n", + "name": "lookback", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "title": "ListOfDependencyLinks", + "items": { + "$ref": "#/definitions/DependencyLink" + } + } + } + } + } + }, + "/services": { + "get": { + "description": "Returns a list of all service names associated with span endpoints.\n", + "responses": { + "200": { + "description": "Succes", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "400": { + "description": "Bad Request Error" + } + } + } + }, + "/spans": { + "get": { + "description": "Get all the span names recorded by a particular service", + "parameters": [ + { + "type": "string", + "description": "Ex favstar (required) - Lower-case label of a node in the service\ngraph. The /services endpoint enumerates possible input values.\n", + "name": "serviceName", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "400": { + "description": "Bad Request Error" + } + } + }, + "post": { + "description": "Uploads a list of spans encoded per content-type, for example json.\n", + "consumes": [ + "application/json" + ], + "parameters": [ + { + "description": "A list of spans that belong to any trace.", + "name": "spans", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/ListOfSpans" + } + } + ], + "responses": { + "202": { + "description": "Accepted" + } + } + } + }, + "/trace/{traceId}": { + "get": { + "parameters": [ + { + "maxLength": 32, + "minLength": 16, + "pattern": "[a-z0-9]{16,32}", + "type": "string", + "description": "Trace identifier, set on all spans within it.\n\nEncoded as 16 or 32 lowercase hex characters corresponding to 64 or 128 bits.\nFor example, a 128bit trace ID looks like 4e441824ec2b6a44ffdc9bb9a6453df3\n", + "name": "traceId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/Trace" + } + }, + "404": { + "description": "` + "`" + `traceId` + "`" + ` not found" + } + } + } + }, + "/traces": { + "get": { + "description": "Invoking this request retrieves traces matching the below filters.\n\nResults should be filtered against endTs, subject to limit and\nlookback. For example, if endTs is 10:20 today, limit is 10, and\nlookback is 7 days, traces returned should be those nearest to 10:20\ntoday, not 10:20 a week ago.\n\nTime units of endTs and lookback are milliseconds as opposed to\nmicroseconds, the grain of Span.timestamp. Milliseconds is a more\nfamiliar and supported granularity for query, index and windowing\nfunctions\n", + "parameters": [ + { + "type": "string", + "description": "Ex favstar (required) - Lower-case label of a node in the service\ngraph. The /services endpoint enumerates possible input values.\n", + "name": "serviceName", + "in": "query" + }, + { + "type": "string", + "description": "Ex get - name of a span in a trace.\nOnly return traces that contains spans with this name.\n", + "name": "spanName", + "in": "query" + }, + { + "type": "string", + "description": "Ex. ` + "`" + `http.uri=/foo and retried` + "`" + ` - If key/value (has an ` + "`" + `=` + "`" + `),\nconstrains against Span.tags entres. If just a word, constrains\nagainst Span.annotations[].value or Span.tags[].key. Any values are\nAND against eachother. This means a span in the trace must match\nall of these.\n", + "name": "annotationQuery", + "in": "query" + }, + { + "type": "integer", + "description": "Ex. 100000 (for 100ms). Only return traces whose ` + "`" + `Span.duration` + "`" + ` is\ngreater than or equal to minDuration microseconds.\n", + "name": "minDuration", + "in": "query" + }, + { + "type": "integer", + "description": "Only return traces whose Span.duration is less than or equal to\n` + "`" + `maxDuration` + "`" + ` microseconds. Only valid with minDuration.\n", + "name": "maxDuration", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "Only return traces where all Span.timestamp are at or before this\ntime in epoch milliseconds. Defaults to current time.\n", + "name": "endTs", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "Only return traces where all Span.timestamp are at or after (endTs\n- * lookback) in milliseconds. Defaults to endTs, limited to a\nsystem parameter QUERY_LOOKBACK\n", + "name": "lookback", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "Maximum number of traces to return. Defaults to 10\n", + "name": "limit", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/ListOfTraces" + } + } + } + } + } + }, + "definitions": { + "Annotation": { + "description": "Associates an event that explains latency with a timestamp.\nUnlike log statements, annotations are often codes. Ex. \"ws\" for WireSend\n\nZipkin v1 core annotations such as \"cs\" and \"sr\" have been replaced with\nSpan.Kind, which interprets timestamp and duration.\n", + "type": "object", + "title": "Annotation", + "properties": { + "timestamp": { + "description": "Epoch **microseconds** of this event.\n\nFor example, 1502787600000000 corresponds to 2017-08-15 09:00 UTC\n\nThis value should be set directly by instrumentation, using the most precise\nvalue possible. For example, gettimeofday or multiplying epoch millis by 1000.\n", + "type": "integer" + }, + "value": { + "description": "Usually a short tag indicating an event, like \"error\"\n\nWhile possible to add larger data, such as garbage collection details, low\ncardinality event names both keep the size of spans down and also are easy\nto search against.\n", + "type": "string" + } + } + }, + "DependencyLink": { + "type": "object", + "title": "DependencyLink", + "properties": { + "callCount": { + "type": "integer" + }, + "child": { + "type": "string" + }, + "errorCount": { + "type": "integer" + }, + "parent": { + "type": "string" + } + } + }, + "Endpoint": { + "description": "The network context of a node in the service graph", + "type": "object", + "title": "Endpoint", + "properties": { + "ipv4": { + "description": "The text representation of the primary IPv4 address associated with this\na connection. Ex. 192.168.99.100 Absent if unknown.\n", + "type": "string", + "format": "ipv4" + }, + "ipv6": { + "description": "The text representation of the primary IPv6 address associated with this\na connection. Ex. 2001:db8::c001 Absent if unknown.\n\nPrefer using the ipv4 field for mapped addresses.\n", + "type": "string", + "format": "ipv6" + }, + "port": { + "description": "Depending on context, this could be a listen port or the client-side of a\nsocket. Absent if unknown\n", + "type": "integer" + }, + "serviceName": { + "description": "Lower-case label of this node in the service graph, such as \"favstar\". Leave\nabsent if unknown.\n\nThis is a primary label for trace lookup and aggregation, so it should be\nintuitive and consistent. Many use a name from service discovery.\n", + "type": "string" + } + } + }, + "ListOfSpans": { + "description": "A list of spans with possibly different trace ids, in no particular order", + "type": "array", + "title": "ListOfSpans", + "items": { + "$ref": "#/definitions/Span" + } + }, + "ListOfTraces": { + "type": "array", + "title": "ListOfTraces", + "items": { + "$ref": "#/definitions/Trace" + } + }, + "Span": { + "type": "object", + "title": "Span", + "required": [ + "traceId", + "id" + ], + "properties": { + "annotations": { + "description": "Associates events that explain latency with the time they happened.", + "type": "array", + "uniqueItems": true, + "items": { + "$ref": "#/definitions/Annotation" + } + }, + "debug": { + "description": "True is a request to store this span even if it overrides sampling policy.\n\nThis is true when the ` + "`" + `X-B3-Flags` + "`" + ` header has a value of 1.\n", + "type": "boolean" + }, + "duration": { + "description": "Duration in **microseconds** of the critical path, if known. Durations of less\nthan one are rounded up. Duration of children can be longer than their parents\ndue to asynchronous operations.\n\nFor example 150 milliseconds is 150000 microseconds.\n", + "type": "integer", + "format": "int64", + "minimum": 1 + }, + "id": { + "description": "Unique 64bit identifier for this operation within the trace.\n\nEncoded as 16 lowercase hex characters. For example ffdc9bb9a6453df3\n", + "type": "string", + "maxLength": 16, + "minLength": 16, + "pattern": "[a-z0-9]{16}" + }, + "kind": { + "description": "When present, clarifies timestamp, duration and remoteEndpoint. When\nabsent, the span is local or incomplete. Unlike client and server,\nthere is no direct critical path latency relationship between producer\nand consumer spans.\n\n* ` + "`" + `CLIENT` + "`" + `\n * timestamp - The moment a request was sent (formerly \"cs\")\n * duration - When present indicates when a response was received (formerly \"cr\")\n * remoteEndpoint - Represents the server. Leave serviceName absent if unknown.\n* ` + "`" + `SERVER` + "`" + `\n * timestamp - The moment a request was received (formerly \"sr\")\n * duration - When present indicates when a response was sent (formerly \"ss\")\n * remoteEndpoint - Represents the client. Leave serviceName absent if unknown.\n* ` + "`" + `PRODUCER` + "`" + `\n * timestamp - The moment a message was sent to a destination (formerly \"ms\")\n * duration - When present represents delay sending the message, such as batching.\n * remoteEndpoint - Represents the broker. Leave serviceName absent if unknown.\n* ` + "`" + `CONSUMER` + "`" + `\n * timestamp - The moment a message was received from an origin (formerly \"mr\")\n * duration - When present represents delay consuming the message, such as from backlog.\n * remoteEndpoint - Represents the broker. Leave serviceName absent if unknown.\n", + "type": "string", + "enum": [ + "CLIENT", + "SERVER", + "PRODUCER", + "CONSUMER" + ] + }, + "localEndpoint": { + "description": "The host that recorded this span, primarily for query by service name.\n\nInstrumentation should always record this. Usually, absent implies late data.\nThe IP address corresponding to this is usually the site local or advertised\nservice address. When present, the port indicates the listen port.\n", + "$ref": "#/definitions/Endpoint" + }, + "name": { + "description": "The logical operation this span represents in lowercase (e.g. rpc method).\nLeave absent if unknown.\n\nAs these are lookup labels, take care to ensure names are low cardinality.\nFor example, do not embed variables into the name.\n", + "type": "string" + }, + "parentId": { + "description": "The parent span ID or absent if this the root span in a trace.", + "type": "string", + "maxLength": 16, + "minLength": 16, + "pattern": "[a-z0-9]{16}" + }, + "remoteEndpoint": { + "description": "When an RPC (or messaging) span, indicates the other side of the connection.\n", + "$ref": "#/definitions/Endpoint" + }, + "shared": { + "description": "True if we are contributing to a span started by another tracer (ex on a different host).", + "type": "boolean" + }, + "tags": { + "description": "Tags give your span context for search, viewing and analysis.", + "$ref": "#/definitions/Tags" + }, + "timestamp": { + "description": "Epoch **microseconds** of the start of this span, possibly absent if incomplete.\n\nFor example, 1502787600000000 corresponds to 2017-08-15 09:00 UTC\n\nThis value should be set directly by instrumentation, using the most precise\nvalue possible. For example, gettimeofday or multiplying epoch millis by 1000.\n\nThere are three known edge-cases where this could be reported absent.\n * A span was allocated but never started (ex not yet received a timestamp)\n * The span's start event was lost\n * Data about a completed span (ex tags) were sent after the fact\n", + "type": "integer", + "format": "int64" + }, + "traceId": { + "description": "Randomly generated, unique identifier for a trace, set on all spans within it.\n\nEncoded as 16 or 32 lowercase hex characters corresponding to 64 or 128 bits.\nFor example, a 128bit trace ID looks like 4e441824ec2b6a44ffdc9bb9a6453df3\n", + "type": "string", + "maxLength": 32, + "minLength": 16, + "pattern": "[a-z0-9]{16,32}" + } + } + }, + "Tags": { + "description": "Adds context to a span, for search, viewing and analysis.\n\nFor example, a key \"your_app.version\" would let you lookup traces by version.\nA tag \"sql.query\" isn't searchable, but it can help in debugging when viewing\na trace.\n", + "type": "object", + "title": "Tags", + "additionalProperties": { + "type": "string" + } + }, + "Trace": { + "description": "List of spans who have the same trace ID.", + "type": "array", + "title": "Trace", + "items": { + "$ref": "#/definitions/Span" + } + } + } }`)) } diff --git a/swagger-gen/restapi/operations/post_spans.go b/swagger-gen/restapi/operations/post_spans.go index d06fae08a8e..2ac22f4cb2f 100644 --- a/swagger-gen/restapi/operations/post_spans.go +++ b/swagger-gen/restapi/operations/post_spans.go @@ -8,7 +8,7 @@ package operations import ( "net/http" - middleware "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/runtime/middleware" ) // PostSpansHandlerFunc turns a function with the right signature into a post spans handler @@ -29,7 +29,7 @@ func NewPostSpans(ctx *middleware.Context, handler PostSpansHandler) *PostSpans return &PostSpans{Context: ctx, Handler: handler} } -/*PostSpans swagger:route POST /spans postSpans +/* PostSpans swagger:route POST /spans postSpans Uploads a list of spans encoded per content-type, for example json. @@ -43,17 +43,15 @@ type PostSpans struct { func (o *PostSpans) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewPostSpansParams() - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params o.Context.Respond(rw, r, route.Produces, route, err) return } res := o.Handler.Handle(Params) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/swagger-gen/restapi/operations/post_spans_parameters.go b/swagger-gen/restapi/operations/post_spans_parameters.go index cfae7c69553..5a10aa8e2bb 100644 --- a/swagger-gen/restapi/operations/post_spans_parameters.go +++ b/swagger-gen/restapi/operations/post_spans_parameters.go @@ -6,20 +6,23 @@ package operations // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "io" "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/validate" "github.com/jaegertracing/jaeger/swagger-gen/models" ) // NewPostSpansParams creates a new PostSpansParams object -// with the default values initialized. +// +// There are no default values defined in the spec. func NewPostSpansParams() PostSpansParams { - var () + return PostSpansParams{} } @@ -30,7 +33,7 @@ func NewPostSpansParams() PostSpansParams { type PostSpansParams struct { // HTTP Request Object - HTTPRequest *http.Request + HTTPRequest *http.Request `json:"-"` /*A list of spans that belong to any trace. Required: true @@ -40,9 +43,12 @@ type PostSpansParams struct { } // BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls +// for simple values it will use straight method calls. +// +// To ensure default values, the struct must have been initialized with NewPostSpansParams() beforehand. func (o *PostSpansParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error + o.HTTPRequest = r if runtime.HasBody(r) { @@ -50,22 +56,28 @@ func (o *PostSpansParams) BindRequest(r *http.Request, route *middleware.Matched var body models.ListOfSpans if err := route.Consumer.Consume(r.Body, &body); err != nil { if err == io.EOF { - res = append(res, errors.Required("spans", "body")) + res = append(res, errors.Required("spans", "body", "")) } else { res = append(res, errors.NewParseError("spans", "body", "", err)) } - } else { + // validate body object + if err := body.Validate(route.Formats); err != nil { + res = append(res, err) + } + + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } if len(res) == 0 { o.Spans = body } } - } else { - res = append(res, errors.Required("spans", "body")) + res = append(res, errors.Required("spans", "body", "")) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } diff --git a/swagger-gen/restapi/operations/post_spans_responses.go b/swagger-gen/restapi/operations/post_spans_responses.go index 924e7171a4f..71aa8ff4178 100644 --- a/swagger-gen/restapi/operations/post_spans_responses.go +++ b/swagger-gen/restapi/operations/post_spans_responses.go @@ -23,11 +23,14 @@ type PostSpansAccepted struct { // NewPostSpansAccepted creates PostSpansAccepted with default headers values func NewPostSpansAccepted() *PostSpansAccepted { + return &PostSpansAccepted{} } // WriteResponse to the client func (o *PostSpansAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses + rw.WriteHeader(202) } diff --git a/swagger-gen/restapi/operations/zipkin_api_api.go b/swagger-gen/restapi/operations/zipkin_api_api.go new file mode 100644 index 00000000000..17c6096d269 --- /dev/null +++ b/swagger-gen/restapi/operations/zipkin_api_api.go @@ -0,0 +1,302 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "net/http" + "strings" + + "github.com/go-openapi/errors" + "github.com/go-openapi/loads" + "github.com/go-openapi/runtime" + "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/runtime/security" + "github.com/go-openapi/spec" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NewZipkinAPIAPI creates a new ZipkinAPI instance +func NewZipkinAPIAPI(spec *loads.Document) *ZipkinAPIAPI { + return &ZipkinAPIAPI{ + handlers: make(map[string]map[string]http.Handler), + formats: strfmt.Default, + defaultConsumes: "application/json", + defaultProduces: "application/json", + customConsumers: make(map[string]runtime.Consumer), + customProducers: make(map[string]runtime.Producer), + PreServerShutdown: func() {}, + ServerShutdown: func() {}, + spec: spec, + useSwaggerUI: false, + ServeError: errors.ServeError, + BasicAuthenticator: security.BasicAuth, + APIKeyAuthenticator: security.APIKeyAuth, + BearerAuthenticator: security.BearerAuth, + + JSONConsumer: runtime.JSONConsumer(), + + JSONProducer: runtime.JSONProducer(), + + PostSpansHandler: PostSpansHandlerFunc(func(params PostSpansParams) middleware.Responder { + return middleware.NotImplemented("operation PostSpans has not yet been implemented") + }), + } +} + +/*ZipkinAPIAPI Zipkin's v2 api currently includes a POST endpoint that can receive spans. + */ +type ZipkinAPIAPI struct { + spec *loads.Document + context *middleware.Context + handlers map[string]map[string]http.Handler + formats strfmt.Registry + customConsumers map[string]runtime.Consumer + customProducers map[string]runtime.Producer + defaultConsumes string + defaultProduces string + Middleware func(middleware.Builder) http.Handler + useSwaggerUI bool + + // BasicAuthenticator generates a runtime.Authenticator from the supplied basic auth function. + // It has a default implementation in the security package, however you can replace it for your particular usage. + BasicAuthenticator func(security.UserPassAuthentication) runtime.Authenticator + + // APIKeyAuthenticator generates a runtime.Authenticator from the supplied token auth function. + // It has a default implementation in the security package, however you can replace it for your particular usage. + APIKeyAuthenticator func(string, string, security.TokenAuthentication) runtime.Authenticator + + // BearerAuthenticator generates a runtime.Authenticator from the supplied bearer token auth function. + // It has a default implementation in the security package, however you can replace it for your particular usage. + BearerAuthenticator func(string, security.ScopedTokenAuthentication) runtime.Authenticator + + // JSONConsumer registers a consumer for the following mime types: + // - application/json + JSONConsumer runtime.Consumer + + // JSONProducer registers a producer for the following mime types: + // - application/json + JSONProducer runtime.Producer + + // PostSpansHandler sets the operation handler for the post spans operation + PostSpansHandler PostSpansHandler + + // ServeError is called when an error is received, there is a default handler + // but you can set your own with this + ServeError func(http.ResponseWriter, *http.Request, error) + + // PreServerShutdown is called before the HTTP(S) server is shutdown + // This allows for custom functions to get executed before the HTTP(S) server stops accepting traffic + PreServerShutdown func() + + // ServerShutdown is called when the HTTP(S) server is shut down and done + // handling all active connections and does not accept connections any more + ServerShutdown func() + + // Custom command line argument groups with their descriptions + CommandLineOptionsGroups []swag.CommandLineOptionsGroup + + // User defined logger function. + Logger func(string, ...interface{}) +} + +// UseRedoc for documentation at /docs +func (o *ZipkinAPIAPI) UseRedoc() { + o.useSwaggerUI = false +} + +// UseSwaggerUI for documentation at /docs +func (o *ZipkinAPIAPI) UseSwaggerUI() { + o.useSwaggerUI = true +} + +// SetDefaultProduces sets the default produces media type +func (o *ZipkinAPIAPI) SetDefaultProduces(mediaType string) { + o.defaultProduces = mediaType +} + +// SetDefaultConsumes returns the default consumes media type +func (o *ZipkinAPIAPI) SetDefaultConsumes(mediaType string) { + o.defaultConsumes = mediaType +} + +// SetSpec sets a spec that will be served for the clients. +func (o *ZipkinAPIAPI) SetSpec(spec *loads.Document) { + o.spec = spec +} + +// DefaultProduces returns the default produces media type +func (o *ZipkinAPIAPI) DefaultProduces() string { + return o.defaultProduces +} + +// DefaultConsumes returns the default consumes media type +func (o *ZipkinAPIAPI) DefaultConsumes() string { + return o.defaultConsumes +} + +// Formats returns the registered string formats +func (o *ZipkinAPIAPI) Formats() strfmt.Registry { + return o.formats +} + +// RegisterFormat registers a custom format validator +func (o *ZipkinAPIAPI) RegisterFormat(name string, format strfmt.Format, validator strfmt.Validator) { + o.formats.Add(name, format, validator) +} + +// Validate validates the registrations in the ZipkinAPIAPI +func (o *ZipkinAPIAPI) Validate() error { + var unregistered []string + + if o.JSONConsumer == nil { + unregistered = append(unregistered, "JSONConsumer") + } + + if o.JSONProducer == nil { + unregistered = append(unregistered, "JSONProducer") + } + + if o.PostSpansHandler == nil { + unregistered = append(unregistered, "PostSpansHandler") + } + + if len(unregistered) > 0 { + return fmt.Errorf("missing registration: %s", strings.Join(unregistered, ", ")) + } + + return nil +} + +// ServeErrorFor gets a error handler for a given operation id +func (o *ZipkinAPIAPI) ServeErrorFor(operationID string) func(http.ResponseWriter, *http.Request, error) { + return o.ServeError +} + +// AuthenticatorsFor gets the authenticators for the specified security schemes +func (o *ZipkinAPIAPI) AuthenticatorsFor(schemes map[string]spec.SecurityScheme) map[string]runtime.Authenticator { + return nil +} + +// Authorizer returns the registered authorizer +func (o *ZipkinAPIAPI) Authorizer() runtime.Authorizer { + return nil +} + +// ConsumersFor gets the consumers for the specified media types. +// MIME type parameters are ignored here. +func (o *ZipkinAPIAPI) ConsumersFor(mediaTypes []string) map[string]runtime.Consumer { + result := make(map[string]runtime.Consumer, len(mediaTypes)) + for _, mt := range mediaTypes { + switch mt { + case "application/json": + result["application/json"] = o.JSONConsumer + } + + if c, ok := o.customConsumers[mt]; ok { + result[mt] = c + } + } + return result +} + +// ProducersFor gets the producers for the specified media types. +// MIME type parameters are ignored here. +func (o *ZipkinAPIAPI) ProducersFor(mediaTypes []string) map[string]runtime.Producer { + result := make(map[string]runtime.Producer, len(mediaTypes)) + for _, mt := range mediaTypes { + switch mt { + case "application/json": + result["application/json"] = o.JSONProducer + } + + if p, ok := o.customProducers[mt]; ok { + result[mt] = p + } + } + return result +} + +// HandlerFor gets a http.Handler for the provided operation method and path +func (o *ZipkinAPIAPI) HandlerFor(method, path string) (http.Handler, bool) { + if o.handlers == nil { + return nil, false + } + um := strings.ToUpper(method) + if _, ok := o.handlers[um]; !ok { + return nil, false + } + if path == "/" { + path = "" + } + h, ok := o.handlers[um][path] + return h, ok +} + +// Context returns the middleware context for the zipkin API API +func (o *ZipkinAPIAPI) Context() *middleware.Context { + if o.context == nil { + o.context = middleware.NewRoutableContext(o.spec, o, nil) + } + + return o.context +} + +func (o *ZipkinAPIAPI) initHandlerCache() { + o.Context() // don't care about the result, just that the initialization happened + if o.handlers == nil { + o.handlers = make(map[string]map[string]http.Handler) + } + + if o.handlers["POST"] == nil { + o.handlers["POST"] = make(map[string]http.Handler) + } + o.handlers["POST"]["/spans"] = NewPostSpans(o.context, o.PostSpansHandler) +} + +// Serve creates a http handler to serve the API over HTTP +// can be used directly in http.ListenAndServe(":8000", api.Serve(nil)) +func (o *ZipkinAPIAPI) Serve(builder middleware.Builder) http.Handler { + o.Init() + + if o.Middleware != nil { + return o.Middleware(builder) + } + if o.useSwaggerUI { + return o.context.APIHandlerSwaggerUI(builder) + } + return o.context.APIHandler(builder) +} + +// Init allows you to just initialize the handler cache, you can then recompose the middleware as you see fit +func (o *ZipkinAPIAPI) Init() { + if len(o.handlers) == 0 { + o.initHandlerCache() + } +} + +// RegisterConsumer allows you to add (or override) a consumer for a media type. +func (o *ZipkinAPIAPI) RegisterConsumer(mediaType string, consumer runtime.Consumer) { + o.customConsumers[mediaType] = consumer +} + +// RegisterProducer allows you to add (or override) a producer for a media type. +func (o *ZipkinAPIAPI) RegisterProducer(mediaType string, producer runtime.Producer) { + o.customProducers[mediaType] = producer +} + +// AddMiddlewareFor adds a http middleware to existing handler +func (o *ZipkinAPIAPI) AddMiddlewareFor(method, path string, builder middleware.Builder) { + um := strings.ToUpper(method) + if path == "/" { + path = "" + } + o.Init() + if h, ok := o.handlers[um][path]; ok { + o.handlers[method][path] = builder(h) + } +}