From b22a728098bc9aead21e0e68b231166f1dd351c6 Mon Sep 17 00:00:00 2001 From: PuneetPunamiya Date: Thu, 17 Mar 2022 09:55:12 +0530 Subject: [PATCH] Redirects `/resources` api to `/v1/resources` This adds a design for resource api where it defines the redirect path This patch also updates goa version to 3.4.0 Signed-off-by: Puneet Punamiya ppunamiy@redhat.com --- api/cmd/api/http.go | 12 +- api/cmd/api/main.go | 5 + api/design/api.go | 1 + api/design/resource.go | 37 + api/gen/admin/client.go | 2 +- api/gen/admin/endpoints.go | 2 +- api/gen/admin/service.go | 2 +- api/gen/catalog/client.go | 2 +- api/gen/catalog/endpoints.go | 2 +- api/gen/catalog/service.go | 2 +- api/gen/catalog/views/view.go | 2 +- api/gen/category/client.go | 2 +- api/gen/category/endpoints.go | 2 +- api/gen/category/service.go | 2 +- api/gen/http/admin/client/cli.go | 2 +- api/gen/http/admin/client/client.go | 2 +- api/gen/http/admin/client/encode_decode.go | 2 +- api/gen/http/admin/client/paths.go | 2 +- api/gen/http/admin/client/types.go | 2 +- api/gen/http/admin/server/encode_decode.go | 6 +- api/gen/http/admin/server/paths.go | 2 +- api/gen/http/admin/server/server.go | 2 +- api/gen/http/admin/server/types.go | 2 +- api/gen/http/catalog/client/cli.go | 2 +- api/gen/http/catalog/client/client.go | 2 +- api/gen/http/catalog/client/encode_decode.go | 2 +- api/gen/http/catalog/client/paths.go | 2 +- api/gen/http/catalog/client/types.go | 2 +- api/gen/http/catalog/server/encode_decode.go | 6 +- api/gen/http/catalog/server/paths.go | 2 +- api/gen/http/catalog/server/server.go | 2 +- api/gen/http/catalog/server/types.go | 2 +- api/gen/http/category/client/cli.go | 2 +- api/gen/http/category/client/client.go | 2 +- api/gen/http/category/client/encode_decode.go | 2 +- api/gen/http/category/client/paths.go | 2 +- api/gen/http/category/client/types.go | 2 +- api/gen/http/category/server/encode_decode.go | 4 +- api/gen/http/category/server/paths.go | 2 +- api/gen/http/category/server/server.go | 2 +- api/gen/http/category/server/types.go | 2 +- api/gen/http/cli/hub/cli.go | 62 +- api/gen/http/openapi.json | 2 +- api/gen/http/openapi.yaml | 606 ++++++++++- api/gen/http/openapi3.json | 2 +- api/gen/http/openapi3.yaml | 715 ++++++++++++- api/gen/http/rating/client/cli.go | 2 +- api/gen/http/rating/client/client.go | 2 +- api/gen/http/rating/client/encode_decode.go | 2 +- api/gen/http/rating/client/paths.go | 2 +- api/gen/http/rating/client/types.go | 2 +- api/gen/http/rating/server/encode_decode.go | 4 +- api/gen/http/rating/server/paths.go | 2 +- api/gen/http/rating/server/server.go | 2 +- api/gen/http/rating/server/types.go | 2 +- api/gen/http/resource/client/cli.go | 8 + api/gen/http/resource/client/client.go | 73 ++ api/gen/http/resource/client/encode_decode.go | 182 ++++ api/gen/http/resource/client/paths.go | 13 + api/gen/http/resource/client/types.go | 339 ++++++ api/gen/http/resource/server/encode_decode.go | 122 +++ api/gen/http/resource/server/paths.go | 13 + api/gen/http/resource/server/server.go | 158 +++ api/gen/http/resource/server/types.go | 121 +++ api/gen/http/status/client/cli.go | 2 +- api/gen/http/status/client/client.go | 2 +- api/gen/http/status/client/encode_decode.go | 2 +- api/gen/http/status/client/paths.go | 2 +- api/gen/http/status/client/types.go | 2 +- api/gen/http/status/server/encode_decode.go | 4 +- api/gen/http/status/server/paths.go | 2 +- api/gen/http/status/server/server.go | 2 +- api/gen/http/status/server/types.go | 2 +- api/gen/http/swagger/client/client.go | 2 +- api/gen/http/swagger/client/encode_decode.go | 2 +- api/gen/http/swagger/client/paths.go | 2 +- api/gen/http/swagger/client/types.go | 2 +- api/gen/http/swagger/server/paths.go | 2 +- api/gen/http/swagger/server/server.go | 18 +- api/gen/http/swagger/server/types.go | 2 +- api/gen/log/logger.go | 2 +- api/gen/rating/client.go | 2 +- api/gen/rating/endpoints.go | 2 +- api/gen/rating/service.go | 2 +- api/gen/resource/client.go | 36 + api/gen/resource/endpoints.go | 44 + api/gen/resource/service.go | 976 ++++++++++++++++++ api/gen/resource/views/view.go | 752 ++++++++++++++ api/gen/status/client.go | 2 +- api/gen/status/endpoints.go | 2 +- api/gen/status/service.go | 2 +- api/gen/swagger/client.go | 2 +- api/gen/swagger/endpoints.go | 2 +- api/gen/swagger/service.go | 2 +- go.mod | 2 +- go.sum | 3 + .../markbates/goth/providers/gitlab/gitlab.go | 1 + vendor/goa.design/goa/v3/dsl/grpc.go | 31 + vendor/goa.design/goa/v3/dsl/http_redirect.go | 49 + vendor/goa.design/goa/v3/dsl/result_type.go | 25 +- vendor/goa.design/goa/v3/dsl/service.go | 2 +- vendor/goa.design/goa/v3/dsl/user_type.go | 2 +- vendor/goa.design/goa/v3/expr/grpc_service.go | 2 + .../goa.design/goa/v3/expr/http_endpoint.go | 20 +- .../goa/v3/expr/http_file_server.go | 2 + .../goa.design/goa/v3/expr/http_redirect.go | 29 + .../goa/v3/grpc/codegen/example_cli.go | 2 +- .../goa/v3/grpc/codegen/example_server.go | 15 +- .../goa.design/goa/v3/grpc/codegen/proto.go | 19 +- .../goa/v3/grpc/codegen/protobuf_transform.go | 19 +- .../goa.design/goa/v3/grpc/codegen/server.go | 2 +- .../goa/v3/http/codegen/example_server.go | 4 +- .../goa/v3/http/codegen/openapi/v3/builder.go | 54 +- .../goa.design/goa/v3/http/codegen/server.go | 64 +- .../goa/v3/http/codegen/service_data.go | 34 + vendor/goa.design/goa/v3/http/encoding.go | 12 +- vendor/goa.design/goa/v3/http/server.go | 28 +- vendor/goa.design/goa/v3/pkg/version.go | 4 +- vendor/modules.txt | 2 +- 119 files changed, 4654 insertions(+), 226 deletions(-) create mode 100644 api/design/resource.go create mode 100644 api/gen/http/resource/client/cli.go create mode 100644 api/gen/http/resource/client/client.go create mode 100644 api/gen/http/resource/client/encode_decode.go create mode 100644 api/gen/http/resource/client/paths.go create mode 100644 api/gen/http/resource/client/types.go create mode 100644 api/gen/http/resource/server/encode_decode.go create mode 100644 api/gen/http/resource/server/paths.go create mode 100644 api/gen/http/resource/server/server.go create mode 100644 api/gen/http/resource/server/types.go create mode 100644 api/gen/resource/client.go create mode 100644 api/gen/resource/endpoints.go create mode 100644 api/gen/resource/service.go create mode 100644 api/gen/resource/views/view.go create mode 100644 vendor/goa.design/goa/v3/dsl/http_redirect.go create mode 100644 vendor/goa.design/goa/v3/expr/http_redirect.go diff --git a/api/cmd/api/http.go b/api/cmd/api/http.go index 20f5ff6193..f3d74d30fd 100644 --- a/api/cmd/api/http.go +++ b/api/cmd/api/http.go @@ -33,10 +33,12 @@ import ( catalogsvr "github.com/tektoncd/hub/api/gen/http/catalog/server" categorysvr "github.com/tektoncd/hub/api/gen/http/category/server" ratingsvr "github.com/tektoncd/hub/api/gen/http/rating/server" + resourcesvr "github.com/tektoncd/hub/api/gen/http/resource/server" statussvr "github.com/tektoncd/hub/api/gen/http/status/server" swaggersvr "github.com/tektoncd/hub/api/gen/http/swagger/server" "github.com/tektoncd/hub/api/gen/log" rating "github.com/tektoncd/hub/api/gen/rating" + resource "github.com/tektoncd/hub/api/gen/resource" status "github.com/tektoncd/hub/api/gen/status" v1catalog "github.com/tektoncd/hub/api/v1/gen/catalog" v1catalogsvr "github.com/tektoncd/hub/api/v1/gen/http/catalog/server" @@ -54,6 +56,7 @@ func handleHTTPServer( v1catalogEndpoints *v1catalog.Endpoints, categoryEndpoints *category.Endpoints, ratingEndpoints *rating.Endpoints, + resourceEndpoints *resource.Endpoints, v1resourceEndpoints *v1resource.Endpoints, statusEndpoints *status.Endpoints, wg *sync.WaitGroup, errc chan error, logger *log.Logger, debug bool) { @@ -92,6 +95,7 @@ func handleHTTPServer( v1catalogServer *v1catalogsvr.Server categoryServer *categorysvr.Server ratingServer *ratingsvr.Server + resourceServer *resourcesvr.Server v1resourceServer *v1resourcesvr.Server statusServer *statussvr.Server swaggerServer *swaggersvr.Server @@ -104,9 +108,10 @@ func handleHTTPServer( v1catalogServer = v1catalogsvr.New(v1catalogEndpoints, mux, dec, enc, eh, nil) categoryServer = categorysvr.New(categoryEndpoints, mux, dec, enc, eh, nil) ratingServer = ratingsvr.New(ratingEndpoints, mux, dec, enc, eh, nil) + resourceServer = resourcesvr.New(resourceEndpoints, mux, dec, enc, eh, nil) v1resourceServer = v1resourcesvr.New(v1resourceEndpoints, mux, dec, enc, eh, nil) statusServer = statussvr.New(statusEndpoints, mux, dec, enc, eh, nil) - swaggerServer = swaggersvr.New(nil, mux, dec, enc, eh, nil) + swaggerServer = swaggersvr.New(nil, mux, dec, enc, eh, nil, nil) v1swaggerServer = v1swaggersvr.New(nil, mux, dec, enc, eh, nil) if debug { @@ -116,6 +121,7 @@ func handleHTTPServer( v1catalogServer, categoryServer, ratingServer, + resourceServer, v1resourceServer, statusServer, swaggerServer, @@ -130,6 +136,7 @@ func handleHTTPServer( v1catalogsvr.Mount(mux, v1catalogServer) categorysvr.Mount(mux, categoryServer) ratingsvr.Mount(mux, ratingServer) + resourcesvr.Mount(mux, resourceServer) v1resourcesvr.Mount(mux, v1resourceServer) statussvr.Mount(mux, statusServer) swaggersvr.Mount(mux, swaggerServer) @@ -161,6 +168,9 @@ func handleHTTPServer( for _, m := range ratingServer.Mounts { logger.Infof("HTTP %q mounted on %s %s", m.Method, m.Verb, m.Pattern) } + for _, m := range resourceServer.Mounts { + logger.Infof("HTTP %q mounted on %s %s", m.Method, m.Verb, m.Pattern) + } for _, m := range v1resourceServer.Mounts { logger.Infof("HTTP %q mounted on %s %s", m.Method, m.Verb, m.Pattern) } diff --git a/api/cmd/api/main.go b/api/cmd/api/main.go index cda2528992..ace93c77f7 100644 --- a/api/cmd/api/main.go +++ b/api/cmd/api/main.go @@ -32,6 +32,7 @@ import ( category "github.com/tektoncd/hub/api/gen/category" "github.com/tektoncd/hub/api/gen/log" rating "github.com/tektoncd/hub/api/gen/rating" + resource "github.com/tektoncd/hub/api/gen/resource" status "github.com/tektoncd/hub/api/gen/status" "github.com/tektoncd/hub/api/pkg/app" auth "github.com/tektoncd/hub/api/pkg/auth" @@ -89,6 +90,7 @@ func main() { v1catalogSvc v1catalog.Service categorySvc category.Service ratingSvc rating.Service + resourceSvc resource.Service v1resourceSvc v1resource.Service statusSvc status.Service ) @@ -110,6 +112,7 @@ func main() { v1catalogEndpoints *v1catalog.Endpoints categoryEndpoints *category.Endpoints ratingEndpoints *rating.Endpoints + resourceEndpoints *resource.Endpoints v1resourceEndpoints *v1resource.Endpoints statusEndpoints *status.Endpoints ) @@ -119,6 +122,7 @@ func main() { v1catalogEndpoints = v1catalog.NewEndpoints(v1catalogSvc) categoryEndpoints = category.NewEndpoints(categorySvc) ratingEndpoints = rating.NewEndpoints(ratingSvc) + resourceEndpoints = resource.NewEndpoints(resourceSvc) v1resourceEndpoints = v1resource.NewEndpoints(v1resourceSvc) statusEndpoints = status.NewEndpoints(statusSvc) } @@ -167,6 +171,7 @@ func main() { v1catalogEndpoints, categoryEndpoints, ratingEndpoints, + resourceEndpoints, v1resourceEndpoints, statusEndpoints, &wg, errc, api.Logger("http"), *dbgF, diff --git a/api/design/api.go b/api/design/api.go index 9d79742a6c..75dad85be3 100644 --- a/api/design/api.go +++ b/api/design/api.go @@ -37,6 +37,7 @@ var _ = API("hub", func() { "catalog", "category", "rating", + "resource", "status", "swagger", ) diff --git a/api/design/resource.go b/api/design/resource.go new file mode 100644 index 0000000000..685f8b6ed4 --- /dev/null +++ b/api/design/resource.go @@ -0,0 +1,37 @@ +// Copyright © 2022 The Tekton Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package design + +import ( + "github.com/tektoncd/hub/api/design/types" + . "goa.design/goa/v3/dsl" +) + +// NOTE: APIs in the service are moved to v1. This APIs will be deprecated in the next release. + +var _ = Service("resource", func() { + Description("The resource service provides details about all kind of resources") + + Method("List", func() { + Description("List all resources sorted by rating and name") + Result(types.Resources) + + HTTP(func() { + GET("/resources") + Redirect("/v1/resources", StatusMovedPermanently) + }) + }) + +}) diff --git a/api/gen/admin/client.go b/api/gen/admin/client.go index 37e1b8074f..aa7b2608c1 100644 --- a/api/gen/admin/client.go +++ b/api/gen/admin/client.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // admin client // diff --git a/api/gen/admin/endpoints.go b/api/gen/admin/endpoints.go index 4772ebdbfe..59cbbe6eae 100644 --- a/api/gen/admin/endpoints.go +++ b/api/gen/admin/endpoints.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // admin endpoints // diff --git a/api/gen/admin/service.go b/api/gen/admin/service.go index 2ca491f036..6b2065a511 100644 --- a/api/gen/admin/service.go +++ b/api/gen/admin/service.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // admin service // diff --git a/api/gen/catalog/client.go b/api/gen/catalog/client.go index ade24e305c..2b0d5bbe80 100644 --- a/api/gen/catalog/client.go +++ b/api/gen/catalog/client.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // catalog client // diff --git a/api/gen/catalog/endpoints.go b/api/gen/catalog/endpoints.go index 8326dad293..2b3beded8f 100644 --- a/api/gen/catalog/endpoints.go +++ b/api/gen/catalog/endpoints.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // catalog endpoints // diff --git a/api/gen/catalog/service.go b/api/gen/catalog/service.go index 96c945208a..677d1c928a 100644 --- a/api/gen/catalog/service.go +++ b/api/gen/catalog/service.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // catalog service // diff --git a/api/gen/catalog/views/view.go b/api/gen/catalog/views/view.go index 0fa46e28b2..8b0155347c 100644 --- a/api/gen/catalog/views/view.go +++ b/api/gen/catalog/views/view.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // catalog views // diff --git a/api/gen/category/client.go b/api/gen/category/client.go index 4b05a2a353..cae8e2a3dd 100644 --- a/api/gen/category/client.go +++ b/api/gen/category/client.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // category client // diff --git a/api/gen/category/endpoints.go b/api/gen/category/endpoints.go index ac662d42c0..7515200679 100644 --- a/api/gen/category/endpoints.go +++ b/api/gen/category/endpoints.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // category endpoints // diff --git a/api/gen/category/service.go b/api/gen/category/service.go index 7742010413..49cd02de34 100644 --- a/api/gen/category/service.go +++ b/api/gen/category/service.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // category service // diff --git a/api/gen/http/admin/client/cli.go b/api/gen/http/admin/client/cli.go index 8f288aadaa..0cd88cab4e 100644 --- a/api/gen/http/admin/client/cli.go +++ b/api/gen/http/admin/client/cli.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // admin HTTP client CLI support package // diff --git a/api/gen/http/admin/client/client.go b/api/gen/http/admin/client/client.go index b18b3bff1a..71de4f38c4 100644 --- a/api/gen/http/admin/client/client.go +++ b/api/gen/http/admin/client/client.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // admin client HTTP transport // diff --git a/api/gen/http/admin/client/encode_decode.go b/api/gen/http/admin/client/encode_decode.go index a6d9277442..dff72553e6 100644 --- a/api/gen/http/admin/client/encode_decode.go +++ b/api/gen/http/admin/client/encode_decode.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // admin HTTP client encoders and decoders // diff --git a/api/gen/http/admin/client/paths.go b/api/gen/http/admin/client/paths.go index f1574963db..224283d24b 100644 --- a/api/gen/http/admin/client/paths.go +++ b/api/gen/http/admin/client/paths.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // HTTP request path constructors for the admin service. // diff --git a/api/gen/http/admin/client/types.go b/api/gen/http/admin/client/types.go index 3700572c15..ca28727a8f 100644 --- a/api/gen/http/admin/client/types.go +++ b/api/gen/http/admin/client/types.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // admin HTTP client types // diff --git a/api/gen/http/admin/server/encode_decode.go b/api/gen/http/admin/server/encode_decode.go index ce9fd17fbb..f9c7021ad9 100644 --- a/api/gen/http/admin/server/encode_decode.go +++ b/api/gen/http/admin/server/encode_decode.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // admin HTTP server encoders and decoders // @@ -22,7 +22,7 @@ import ( // admin UpdateAgent endpoint. func EncodeUpdateAgentResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error { return func(ctx context.Context, w http.ResponseWriter, v interface{}) error { - res := v.(*admin.UpdateAgentResult) + res, _ := v.(*admin.UpdateAgentResult) enc := encoder(ctx, w) body := NewUpdateAgentResponseBody(res) w.WriteHeader(http.StatusOK) @@ -139,7 +139,7 @@ func EncodeUpdateAgentError(encoder func(context.Context, http.ResponseWriter) g // admin RefreshConfig endpoint. func EncodeRefreshConfigResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error { return func(ctx context.Context, w http.ResponseWriter, v interface{}) error { - res := v.(*admin.RefreshConfigResult) + res, _ := v.(*admin.RefreshConfigResult) enc := encoder(ctx, w) body := NewRefreshConfigResponseBody(res) w.WriteHeader(http.StatusOK) diff --git a/api/gen/http/admin/server/paths.go b/api/gen/http/admin/server/paths.go index 89b3768370..3b511d7931 100644 --- a/api/gen/http/admin/server/paths.go +++ b/api/gen/http/admin/server/paths.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // HTTP request path constructors for the admin service. // diff --git a/api/gen/http/admin/server/server.go b/api/gen/http/admin/server/server.go index db37f5fec8..04862899d6 100644 --- a/api/gen/http/admin/server/server.go +++ b/api/gen/http/admin/server/server.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // admin HTTP server // diff --git a/api/gen/http/admin/server/types.go b/api/gen/http/admin/server/types.go index 845ef8425e..e78a664917 100644 --- a/api/gen/http/admin/server/types.go +++ b/api/gen/http/admin/server/types.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // admin HTTP server types // diff --git a/api/gen/http/catalog/client/cli.go b/api/gen/http/catalog/client/cli.go index f2d5303ece..d65061c63b 100644 --- a/api/gen/http/catalog/client/cli.go +++ b/api/gen/http/catalog/client/cli.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // catalog HTTP client CLI support package // diff --git a/api/gen/http/catalog/client/client.go b/api/gen/http/catalog/client/client.go index 9f664096b4..415a9286c5 100644 --- a/api/gen/http/catalog/client/client.go +++ b/api/gen/http/catalog/client/client.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // catalog client HTTP transport // diff --git a/api/gen/http/catalog/client/encode_decode.go b/api/gen/http/catalog/client/encode_decode.go index c629d2b40f..2e3836683f 100644 --- a/api/gen/http/catalog/client/encode_decode.go +++ b/api/gen/http/catalog/client/encode_decode.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // catalog HTTP client encoders and decoders // diff --git a/api/gen/http/catalog/client/paths.go b/api/gen/http/catalog/client/paths.go index 8573442593..b2b417fdfe 100644 --- a/api/gen/http/catalog/client/paths.go +++ b/api/gen/http/catalog/client/paths.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // HTTP request path constructors for the catalog service. // diff --git a/api/gen/http/catalog/client/types.go b/api/gen/http/catalog/client/types.go index 62fed68eb4..a29379e0fb 100644 --- a/api/gen/http/catalog/client/types.go +++ b/api/gen/http/catalog/client/types.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // catalog HTTP client types // diff --git a/api/gen/http/catalog/server/encode_decode.go b/api/gen/http/catalog/server/encode_decode.go index eff275480b..f1d8523396 100644 --- a/api/gen/http/catalog/server/encode_decode.go +++ b/api/gen/http/catalog/server/encode_decode.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // catalog HTTP server encoders and decoders // @@ -104,7 +104,7 @@ func EncodeRefreshError(encoder func(context.Context, http.ResponseWriter) goaht // catalog RefreshAll endpoint. func EncodeRefreshAllResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error { return func(ctx context.Context, w http.ResponseWriter, v interface{}) error { - res := v.([]*catalog.Job) + res, _ := v.([]*catalog.Job) enc := encoder(ctx, w) body := NewRefreshAllResponseBody(res) w.WriteHeader(http.StatusOK) @@ -170,7 +170,7 @@ func EncodeRefreshAllError(encoder func(context.Context, http.ResponseWriter) go // catalog CatalogError endpoint. func EncodeCatalogErrorResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error { return func(ctx context.Context, w http.ResponseWriter, v interface{}) error { - res := v.(*catalog.CatalogErrorResult) + res, _ := v.(*catalog.CatalogErrorResult) enc := encoder(ctx, w) body := NewCatalogErrorResponseBody(res) w.WriteHeader(http.StatusOK) diff --git a/api/gen/http/catalog/server/paths.go b/api/gen/http/catalog/server/paths.go index f739b5fc38..333b98acc6 100644 --- a/api/gen/http/catalog/server/paths.go +++ b/api/gen/http/catalog/server/paths.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // HTTP request path constructors for the catalog service. // diff --git a/api/gen/http/catalog/server/server.go b/api/gen/http/catalog/server/server.go index 0765b9b9ac..f472eeb090 100644 --- a/api/gen/http/catalog/server/server.go +++ b/api/gen/http/catalog/server/server.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // catalog HTTP server // diff --git a/api/gen/http/catalog/server/types.go b/api/gen/http/catalog/server/types.go index 81da817600..9eb0d3e9c4 100644 --- a/api/gen/http/catalog/server/types.go +++ b/api/gen/http/catalog/server/types.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // catalog HTTP server types // diff --git a/api/gen/http/category/client/cli.go b/api/gen/http/category/client/cli.go index 868f8c5fa6..c94dd1ec48 100644 --- a/api/gen/http/category/client/cli.go +++ b/api/gen/http/category/client/cli.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // category HTTP client CLI support package // diff --git a/api/gen/http/category/client/client.go b/api/gen/http/category/client/client.go index 0888a95e04..dcbdc2b76f 100644 --- a/api/gen/http/category/client/client.go +++ b/api/gen/http/category/client/client.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // category client HTTP transport // diff --git a/api/gen/http/category/client/encode_decode.go b/api/gen/http/category/client/encode_decode.go index 3d7247beff..cca0b1db3f 100644 --- a/api/gen/http/category/client/encode_decode.go +++ b/api/gen/http/category/client/encode_decode.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // category HTTP client encoders and decoders // diff --git a/api/gen/http/category/client/paths.go b/api/gen/http/category/client/paths.go index 28200ddf67..6dff1796da 100644 --- a/api/gen/http/category/client/paths.go +++ b/api/gen/http/category/client/paths.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // HTTP request path constructors for the category service. // diff --git a/api/gen/http/category/client/types.go b/api/gen/http/category/client/types.go index 9e5d3c6f13..977292ae1a 100644 --- a/api/gen/http/category/client/types.go +++ b/api/gen/http/category/client/types.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // category HTTP client types // diff --git a/api/gen/http/category/server/encode_decode.go b/api/gen/http/category/server/encode_decode.go index 463fd66eeb..9ac44ee750 100644 --- a/api/gen/http/category/server/encode_decode.go +++ b/api/gen/http/category/server/encode_decode.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // category HTTP server encoders and decoders // @@ -20,7 +20,7 @@ import ( // list endpoint. func EncodeListResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error { return func(ctx context.Context, w http.ResponseWriter, v interface{}) error { - res := v.(*category.ListResult) + res, _ := v.(*category.ListResult) enc := encoder(ctx, w) body := NewListResponseBody(res) w.WriteHeader(http.StatusOK) diff --git a/api/gen/http/category/server/paths.go b/api/gen/http/category/server/paths.go index fed3f3aed9..19a0506db3 100644 --- a/api/gen/http/category/server/paths.go +++ b/api/gen/http/category/server/paths.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // HTTP request path constructors for the category service. // diff --git a/api/gen/http/category/server/server.go b/api/gen/http/category/server/server.go index ac04cf1150..e149ee9bd3 100644 --- a/api/gen/http/category/server/server.go +++ b/api/gen/http/category/server/server.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // category HTTP server // diff --git a/api/gen/http/category/server/types.go b/api/gen/http/category/server/types.go index 4bdc9aa62e..4549675ef3 100644 --- a/api/gen/http/category/server/types.go +++ b/api/gen/http/category/server/types.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // category HTTP server types // diff --git a/api/gen/http/cli/hub/cli.go b/api/gen/http/cli/hub/cli.go index 17d02bde0e..1fad2a8eb3 100644 --- a/api/gen/http/cli/hub/cli.go +++ b/api/gen/http/cli/hub/cli.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // hub HTTP client CLI support package // @@ -17,6 +17,7 @@ import ( catalogc "github.com/tektoncd/hub/api/gen/http/catalog/client" categoryc "github.com/tektoncd/hub/api/gen/http/category/client" ratingc "github.com/tektoncd/hub/api/gen/http/rating/client" + resourcec "github.com/tektoncd/hub/api/gen/http/resource/client" statusc "github.com/tektoncd/hub/api/gen/http/status/client" goahttp "goa.design/goa/v3/http" goa "goa.design/goa/v3/pkg" @@ -31,6 +32,7 @@ func UsageCommands() string { catalog (refresh|refresh-all|catalog-error) category list rating (get|update) +resource list status status ` } @@ -44,10 +46,10 @@ func UsageExamples() string { "agent:create" ] }' --token "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1Nzc4ODAzMDAsImlhdCI6MTU3Nzg4MDAwMCwiaWQiOjExLCJpc3MiOiJUZWt0b24gSHViIiwic2NvcGVzIjpbInJhdGluZzpyZWFkIiwicmF0aW5nOndyaXRlIiwiYWdlbnQ6Y3JlYXRlIl0sInR5cGUiOiJhY2Nlc3MtdG9rZW4ifQ.6pDmziSKkoSqI1f0rc4-AqVdcfY0Q8wA-tSLzdTCLgM"` + "\n" + - os.Args[0] + ` catalog refresh --catalog-name "tekton" --token "Voluptate qui."` + "\n" + + os.Args[0] + ` catalog refresh --catalog-name "tekton" --token "Qui occaecati officia inventore adipisci molestiae quaerat."` + "\n" + os.Args[0] + ` category list` + "\n" + - os.Args[0] + ` rating get --id 1858365715749821454 --token "Harum placeat hic accusamus est deserunt vel."` + "\n" + - os.Args[0] + ` status status` + "\n" + + os.Args[0] + ` rating get --id 8747404606346667859 --token "Deserunt vel."` + "\n" + + os.Args[0] + ` resource list` + "\n" + "" } @@ -98,6 +100,10 @@ func ParseEndpoint( ratingUpdateIDFlag = ratingUpdateFlags.String("id", "REQUIRED", "ID of a resource") ratingUpdateTokenFlag = ratingUpdateFlags.String("token", "REQUIRED", "") + resourceFlags = flag.NewFlagSet("resource", flag.ContinueOnError) + + resourceListFlags = flag.NewFlagSet("list", flag.ExitOnError) + statusFlags = flag.NewFlagSet("status", flag.ContinueOnError) statusStatusFlags = flag.NewFlagSet("status", flag.ExitOnError) @@ -118,6 +124,9 @@ func ParseEndpoint( ratingGetFlags.Usage = ratingGetUsage ratingUpdateFlags.Usage = ratingUpdateUsage + resourceFlags.Usage = resourceUsage + resourceListFlags.Usage = resourceListUsage + statusFlags.Usage = statusUsage statusStatusFlags.Usage = statusStatusUsage @@ -144,6 +153,8 @@ func ParseEndpoint( svcf = categoryFlags case "rating": svcf = ratingFlags + case "resource": + svcf = resourceFlags case "status": svcf = statusFlags default: @@ -201,6 +212,13 @@ func ParseEndpoint( } + case "resource": + switch epn { + case "list": + epf = resourceListFlags + + } + case "status": switch epn { case "status": @@ -268,6 +286,13 @@ func ParseEndpoint( endpoint = c.Update() data, err = ratingc.BuildUpdatePayload(*ratingUpdateBodyFlag, *ratingUpdateIDFlag, *ratingUpdateTokenFlag) } + case "resource": + c := resourcec.NewClient(scheme, host, doer, enc, dec, restore) + switch epn { + case "list": + endpoint = c.List() + data = nil + } case "status": c := statusc.NewClient(scheme, host, doer, enc, dec, restore) switch epn { @@ -350,7 +375,7 @@ Refresh a Catalog by it's name -token STRING: Example: - `+os.Args[0]+` catalog refresh --catalog-name "tekton" --token "Voluptate qui." + `+os.Args[0]+` catalog refresh --catalog-name "tekton" --token "Qui occaecati officia inventore adipisci molestiae quaerat." `, os.Args[0]) } @@ -361,7 +386,7 @@ Refresh all catalogs -token STRING: Example: - `+os.Args[0]+` catalog refresh-all --token "Officia inventore adipisci molestiae quaerat." + `+os.Args[0]+` catalog refresh-all --token "Qui qui temporibus consequuntur." `, os.Args[0]) } @@ -422,7 +447,7 @@ Find user's rating for a resource -token STRING: Example: - `+os.Args[0]+` rating get --id 1858365715749821454 --token "Harum placeat hic accusamus est deserunt vel." + `+os.Args[0]+` rating get --id 8747404606346667859 --token "Deserunt vel." `, os.Args[0]) } @@ -441,6 +466,29 @@ Example: `, os.Args[0]) } +// resourceUsage displays the usage of the resource command and its subcommands. +func resourceUsage() { + fmt.Fprintf(os.Stderr, `The resource service provides details about all kind of resources +Usage: + %s [globalflags] resource COMMAND [flags] + +COMMAND: + list: List all resources sorted by rating and name + +Additional help: + %s resource COMMAND --help +`, os.Args[0], os.Args[0]) +} +func resourceListUsage() { + fmt.Fprintf(os.Stderr, `%s [flags] resource list + +List all resources sorted by rating and name + +Example: + `+os.Args[0]+` resource list +`, os.Args[0]) +} + // statusUsage displays the usage of the status command and its subcommands. func statusUsage() { fmt.Fprintf(os.Stderr, `Describes the status of each service diff --git a/api/gen/http/openapi.json b/api/gen/http/openapi.json index 52c4590f39..5561be02a8 100644 --- a/api/gen/http/openapi.json +++ b/api/gen/http/openapi.json @@ -1 +1 @@ -{"swagger":"2.0","info":{"title":"Tekton Hub","description":"HTTP services for managing Tekton Hub","version":"1.0"},"host":"api.hub.tekton.dev","consumes":["application/json","application/xml","application/gob"],"produces":["application/json","application/xml","application/gob"],"paths":{"/":{"get":{"tags":["status"],"summary":"Status status","description":"Return status of the services","operationId":"status#Status","responses":{"200":{"description":"OK response.","schema":{"$ref":"#/definitions/StatusStatusResponseBody"}}},"schemes":["https"]}},"/catalog/refresh":{"post":{"tags":["catalog"],"summary":"RefreshAll catalog","description":"Refresh all catalogs\n\n**Required security scopes for jwt**:\n * `catalog:refresh`","operationId":"catalog#RefreshAll","parameters":[{"name":"Authorization","in":"header","description":"JWT","required":true,"type":"string"}],"responses":{"200":{"description":"OK response.","schema":{"type":"array","items":{"$ref":"#/definitions/JobResponse"}}},"500":{"description":"Internal Server Error response.","schema":{"$ref":"#/definitions/CatalogRefreshAllInternalErrorResponseBody"}}},"schemes":["https"],"security":[{"jwt_header_Authorization":[]}]}},"/catalog/{catalogName}/error":{"get":{"tags":["catalog"],"summary":"CatalogError catalog","description":"List all errors occurred refreshing a catalog\n\n**Required security scopes for jwt**:\n * `catalog:refresh`","operationId":"catalog#CatalogError","parameters":[{"name":"catalogName","in":"path","description":"Name of catalog","required":true,"type":"string"},{"name":"Authorization","in":"header","description":"JWT","required":true,"type":"string"}],"responses":{"200":{"description":"OK response.","schema":{"$ref":"#/definitions/CatalogCatalogErrorResponseBody","required":["data"]}},"500":{"description":"Internal Server Error response.","schema":{"$ref":"#/definitions/CatalogCatalogErrorInternalErrorResponseBody"}}},"schemes":["https"],"security":[{"jwt_header_Authorization":[]}]}},"/catalog/{catalogName}/refresh":{"post":{"tags":["catalog"],"summary":"Refresh catalog","description":"Refresh a Catalog by it's name\n\n**Required security scopes for jwt**:\n * `catalog:refresh`","operationId":"catalog#Refresh","parameters":[{"name":"catalogName","in":"path","description":"Name of catalog","required":true,"type":"string"},{"name":"Authorization","in":"header","description":"JWT","required":true,"type":"string"}],"responses":{"200":{"description":"OK response.","schema":{"$ref":"#/definitions/CatalogRefreshResponseBody"}},"404":{"description":"Not Found response.","schema":{"$ref":"#/definitions/CatalogRefreshNotFoundResponseBody"}},"500":{"description":"Internal Server Error response.","schema":{"$ref":"#/definitions/CatalogRefreshInternalErrorResponseBody"}}},"schemes":["https"],"security":[{"jwt_header_Authorization":[]}]}},"/categories":{"get":{"tags":["category"],"summary":"list category","description":"List all categories along with their tags sorted by name","operationId":"category#list","responses":{"200":{"description":"OK response.","schema":{"$ref":"#/definitions/CategoryListResponseBody"}},"500":{"description":"Internal Server Error response.","schema":{"$ref":"#/definitions/CategoryListInternalErrorResponseBody"}}},"schemes":["https"]}},"/resource/{id}/rating":{"get":{"tags":["rating"],"summary":"Get rating","description":"Find user's rating for a resource\n\n**Required security scopes for jwt**:\n * `rating:read`","operationId":"rating#Get","parameters":[{"name":"id","in":"path","description":"ID of a resource","required":true,"type":"integer"},{"name":"Authorization","in":"header","description":"JWT","required":true,"type":"string"}],"responses":{"200":{"description":"OK response.","schema":{"$ref":"#/definitions/RatingGetResponseBody","required":["rating"]}},"401":{"description":"Unauthorized response.","schema":{"$ref":"#/definitions/RatingGetInvalidTokenResponseBody"}},"403":{"description":"Forbidden response.","schema":{"$ref":"#/definitions/RatingGetInvalidScopesResponseBody"}},"404":{"description":"Not Found response.","schema":{"$ref":"#/definitions/RatingGetNotFoundResponseBody"}},"500":{"description":"Internal Server Error response.","schema":{"$ref":"#/definitions/RatingGetInternalErrorResponseBody"}}},"schemes":["https"],"security":[{"jwt_header_Authorization":[]}]},"put":{"tags":["rating"],"summary":"Update rating","description":"Update user's rating for a resource\n\n**Required security scopes for jwt**:\n * `rating:write`","operationId":"rating#Update","parameters":[{"name":"id","in":"path","description":"ID of a resource","required":true,"type":"integer"},{"name":"Authorization","in":"header","description":"JWT","required":true,"type":"string"},{"name":"UpdateRequestBody","in":"body","required":true,"schema":{"$ref":"#/definitions/RatingUpdateRequestBody","required":["rating"]}}],"responses":{"200":{"description":"OK response."},"401":{"description":"Unauthorized response.","schema":{"$ref":"#/definitions/RatingUpdateInvalidTokenResponseBody"}},"403":{"description":"Forbidden response.","schema":{"$ref":"#/definitions/RatingUpdateInvalidScopesResponseBody"}},"404":{"description":"Not Found response.","schema":{"$ref":"#/definitions/RatingUpdateNotFoundResponseBody"}},"500":{"description":"Internal Server Error response.","schema":{"$ref":"#/definitions/RatingUpdateInternalErrorResponseBody"}}},"schemes":["https"],"security":[{"jwt_header_Authorization":[]}]}},"/schema/swagger.json":{"get":{"tags":["swagger"],"summary":"Download docs/openapi3.json","description":"JSON document containing the API swagger definition","operationId":"swagger#/schema/swagger.json","responses":{"200":{"description":"File downloaded","schema":{"type":"file"}}},"schemes":["https"]}},"/system/config/refresh":{"post":{"tags":["admin"],"summary":"RefreshConfig admin","description":"Refresh the changes in config file\n\n**Required security scopes for jwt**:\n * `config:refresh`","operationId":"admin#RefreshConfig","parameters":[{"name":"Authorization","in":"header","description":"User JWT","required":true,"type":"string"}],"responses":{"200":{"description":"OK response.","schema":{"$ref":"#/definitions/AdminRefreshConfigResponseBody","required":["checksum"]}},"401":{"description":"Unauthorized response.","schema":{"$ref":"#/definitions/AdminRefreshConfigInvalidTokenResponseBody"}},"403":{"description":"Forbidden response.","schema":{"$ref":"#/definitions/AdminRefreshConfigInvalidScopesResponseBody"}},"500":{"description":"Internal Server Error response.","schema":{"$ref":"#/definitions/AdminRefreshConfigInternalErrorResponseBody"}}},"schemes":["https"],"security":[{"jwt_header_Authorization":[]}]}},"/system/user/agent":{"put":{"tags":["admin"],"summary":"UpdateAgent admin","description":"Create or Update an agent user with required scopes\n\n**Required security scopes for jwt**:\n * `agent:create`","operationId":"admin#UpdateAgent","parameters":[{"name":"Authorization","in":"header","description":"User JWT","required":true,"type":"string"},{"name":"UpdateAgentRequestBody","in":"body","required":true,"schema":{"$ref":"#/definitions/AdminUpdateAgentRequestBody","required":["name","scopes"]}}],"responses":{"200":{"description":"OK response.","schema":{"$ref":"#/definitions/AdminUpdateAgentResponseBody","required":["token"]}},"400":{"description":"Bad Request response.","schema":{"$ref":"#/definitions/AdminUpdateAgentInvalidPayloadResponseBody"}},"401":{"description":"Unauthorized response.","schema":{"$ref":"#/definitions/AdminUpdateAgentInvalidTokenResponseBody"}},"403":{"description":"Forbidden response.","schema":{"$ref":"#/definitions/AdminUpdateAgentInvalidScopesResponseBody"}},"500":{"description":"Internal Server Error response.","schema":{"$ref":"#/definitions/AdminUpdateAgentInternalErrorResponseBody"}}},"schemes":["https"],"security":[{"jwt_header_Authorization":[]}]}},"/v1":{"get":{"tags":["status"],"summary":"Status status","description":"Return status of the services","operationId":"status#Status#1","responses":{"200":{"description":"OK response.","schema":{"$ref":"#/definitions/StatusStatusResponseBody"}}},"schemes":["https"]}},"/v1/categories":{"get":{"tags":["category"],"summary":"list category","description":"List all categories along with their tags sorted by name","operationId":"category#list#1","responses":{"200":{"description":"OK response.","schema":{"$ref":"#/definitions/CategoryListResponseBody"}},"500":{"description":"Internal Server Error response.","schema":{"$ref":"#/definitions/CategoryListInternalErrorResponseBody"}}},"schemes":["https"]}}},"definitions":{"AdminRefreshConfigInternalErrorResponseBody":{"title":"Mediatype identifier: application/vnd.goa.error; view=default","type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?","example":true},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"name":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"temporary":{"type":"boolean","description":"Is the error temporary?","example":false},"timeout":{"type":"boolean","description":"Is the error a timeout?","example":true}},"description":"Internal server error (default view)","example":{"fault":false,"id":"123abc","message":"parameter 'p' must be an integer","name":"bad_request","temporary":true,"timeout":true},"required":["name","id","message","temporary","timeout","fault"]},"AdminRefreshConfigInvalidScopesResponseBody":{"title":"Mediatype identifier: application/vnd.goa.error; view=default","type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?","example":true},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"name":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"temporary":{"type":"boolean","description":"Is the error temporary?","example":true},"timeout":{"type":"boolean","description":"Is the error a timeout?","example":true}},"description":"Invalid Token scopes (default view)","example":{"fault":true,"id":"123abc","message":"parameter 'p' must be an integer","name":"bad_request","temporary":false,"timeout":false},"required":["name","id","message","temporary","timeout","fault"]},"AdminRefreshConfigInvalidTokenResponseBody":{"title":"Mediatype identifier: application/vnd.goa.error; view=default","type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?","example":true},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"name":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"temporary":{"type":"boolean","description":"Is the error temporary?","example":true},"timeout":{"type":"boolean","description":"Is the error a timeout?","example":false}},"description":"Invalid User token (default view)","example":{"fault":true,"id":"123abc","message":"parameter 'p' must be an integer","name":"bad_request","temporary":true,"timeout":true},"required":["name","id","message","temporary","timeout","fault"]},"AdminRefreshConfigResponseBody":{"title":"AdminRefreshConfigResponseBody","type":"object","properties":{"checksum":{"type":"string","description":"Config file checksum","example":"41ba391c8baf1fcd3c62c11272b913dc6613f4cf3b1833cfbb32431dc4384c93"}},"example":{"checksum":"41ba391c8baf1fcd3c62c11272b913dc6613f4cf3b1833cfbb32431dc4384c93"},"required":["checksum"]},"AdminUpdateAgentInternalErrorResponseBody":{"title":"Mediatype identifier: application/vnd.goa.error; view=default","type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?","example":false},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"name":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"temporary":{"type":"boolean","description":"Is the error temporary?","example":false},"timeout":{"type":"boolean","description":"Is the error a timeout?","example":true}},"description":"Internal server error (default view)","example":{"fault":true,"id":"123abc","message":"parameter 'p' must be an integer","name":"bad_request","temporary":false,"timeout":true},"required":["name","id","message","temporary","timeout","fault"]},"AdminUpdateAgentInvalidPayloadResponseBody":{"title":"Mediatype identifier: application/vnd.goa.error; view=default","type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?","example":false},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"name":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"temporary":{"type":"boolean","description":"Is the error temporary?","example":false},"timeout":{"type":"boolean","description":"Is the error a timeout?","example":true}},"description":"Invalid request body (default view)","example":{"fault":false,"id":"123abc","message":"parameter 'p' must be an integer","name":"bad_request","temporary":true,"timeout":true},"required":["name","id","message","temporary","timeout","fault"]},"AdminUpdateAgentInvalidScopesResponseBody":{"title":"Mediatype identifier: application/vnd.goa.error; view=default","type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?","example":false},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"name":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"temporary":{"type":"boolean","description":"Is the error temporary?","example":false},"timeout":{"type":"boolean","description":"Is the error a timeout?","example":false}},"description":"Invalid Token scopes (default view)","example":{"fault":true,"id":"123abc","message":"parameter 'p' must be an integer","name":"bad_request","temporary":false,"timeout":false},"required":["name","id","message","temporary","timeout","fault"]},"AdminUpdateAgentInvalidTokenResponseBody":{"title":"Mediatype identifier: application/vnd.goa.error; view=default","type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?","example":true},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"name":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"temporary":{"type":"boolean","description":"Is the error temporary?","example":false},"timeout":{"type":"boolean","description":"Is the error a timeout?","example":false}},"description":"Invalid User token (default view)","example":{"fault":false,"id":"123abc","message":"parameter 'p' must be an integer","name":"bad_request","temporary":true,"timeout":false},"required":["name","id","message","temporary","timeout","fault"]},"AdminUpdateAgentRequestBody":{"title":"AdminUpdateAgentRequestBody","type":"object","properties":{"name":{"type":"string","description":"Name of Agent","example":"abc"},"scopes":{"type":"array","items":{"type":"string","example":"Nihil officia itaque non."},"description":"Scopes required for Agent","example":["catalog-refresh","agent:create"]}},"example":{"name":"abc","scopes":["catalog-refresh","agent:create"]},"required":["name","scopes"]},"AdminUpdateAgentResponseBody":{"title":"AdminUpdateAgentResponseBody","type":"object","properties":{"token":{"type":"string","description":"Agent JWT","example":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1Nzc4ODAzMDAsImlhdCI6MTU3Nzg4MDAwMCwiaWQiOjExLCJpc3MiOiJUZWt0b24gSHViIiwic2NvcGVzIjpbInJhdGluZzpyZWFkIiwicmF0aW5nOndyaXRlIiwiYWdlbnQ6Y3JlYXRlIl0sInR5cGUiOiJhY2Nlc3MtdG9rZW4ifQ.6pDmziSKkoSqI1f0rc4-AqVdcfY0Q8wA-tSLzdTCLgM"}},"example":{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1Nzc4ODAzMDAsImlhdCI6MTU3Nzg4MDAwMCwiaWQiOjExLCJpc3MiOiJUZWt0b24gSHViIiwic2NvcGVzIjpbInJhdGluZzpyZWFkIiwicmF0aW5nOndyaXRlIiwiYWdlbnQ6Y3JlYXRlIl0sInR5cGUiOiJhY2Nlc3MtdG9rZW4ifQ.6pDmziSKkoSqI1f0rc4-AqVdcfY0Q8wA-tSLzdTCLgM"},"required":["token"]},"CatalogCatalogErrorInternalErrorResponseBody":{"title":"Mediatype identifier: application/vnd.goa.error; view=default","type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?","example":true},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"name":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"temporary":{"type":"boolean","description":"Is the error temporary?","example":true},"timeout":{"type":"boolean","description":"Is the error a timeout?","example":true}},"description":"Internal Server Error (default view)","example":{"fault":false,"id":"123abc","message":"parameter 'p' must be an integer","name":"bad_request","temporary":true,"timeout":false},"required":["name","id","message","temporary","timeout","fault"]},"CatalogCatalogErrorResponseBody":{"title":"CatalogCatalogErrorResponseBody","type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/definitions/CatalogErrorsResponseBody"},"description":"Catalog errors","example":[{"errors":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"],"type":"warning"},{"errors":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"],"type":"warning"},{"errors":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"],"type":"warning"},{"errors":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"],"type":"warning"}]}},"example":{"data":[{"errors":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"],"type":"warning"},{"errors":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"],"type":"warning"},{"errors":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"],"type":"warning"},{"errors":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"],"type":"warning"}]},"required":["data"]},"CatalogErrorsResponseBody":{"title":"CatalogErrorsResponseBody","type":"object","properties":{"errors":{"type":"array","items":{"type":"string","example":"Ut aut quos distinctio ipsam eos."},"description":"Catalog Error message","example":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"]},"type":{"type":"string","description":"Catalog Errror type","example":"warning"}},"description":"CatalogErrors define the errors that occurred during catalog refresh","example":{"errors":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"],"type":"warning"},"required":["type","errors"]},"CatalogRefreshAllInternalErrorResponseBody":{"title":"Mediatype identifier: application/vnd.goa.error; view=default","type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?","example":true},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"name":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"temporary":{"type":"boolean","description":"Is the error temporary?","example":true},"timeout":{"type":"boolean","description":"Is the error a timeout?","example":false}},"description":"Internal Server Error (default view)","example":{"fault":true,"id":"123abc","message":"parameter 'p' must be an integer","name":"bad_request","temporary":true,"timeout":true},"required":["name","id","message","temporary","timeout","fault"]},"CatalogRefreshInternalErrorResponseBody":{"title":"Mediatype identifier: application/vnd.goa.error; view=default","type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?","example":true},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"name":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"temporary":{"type":"boolean","description":"Is the error temporary?","example":false},"timeout":{"type":"boolean","description":"Is the error a timeout?","example":true}},"description":"Internal Server Error (default view)","example":{"fault":true,"id":"123abc","message":"parameter 'p' must be an integer","name":"bad_request","temporary":false,"timeout":true},"required":["name","id","message","temporary","timeout","fault"]},"CatalogRefreshNotFoundResponseBody":{"title":"Mediatype identifier: application/vnd.goa.error; view=default","type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?","example":true},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"name":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"temporary":{"type":"boolean","description":"Is the error temporary?","example":false},"timeout":{"type":"boolean","description":"Is the error a timeout?","example":false}},"description":"Resource Not Found Error (default view)","example":{"fault":false,"id":"123abc","message":"parameter 'p' must be an integer","name":"bad_request","temporary":true,"timeout":false},"required":["name","id","message","temporary","timeout","fault"]},"CatalogRefreshResponseBody":{"title":"Mediatype identifier: application/vnd.hub.job; view=default","type":"object","properties":{"catalogName":{"type":"string","description":"Name of the catalog","example":"tekton"},"id":{"type":"integer","description":"id of the job","example":1,"format":"int64"},"status":{"type":"string","description":"status of the job","example":"queued"}},"description":"RefreshResponseBody result type (default view)","example":{"catalogName":"tekton","id":1,"status":"queued"},"required":["id","catalogName","status"]},"CategoryListInternalErrorResponseBody":{"title":"Mediatype identifier: application/vnd.goa.error; view=default","type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?","example":false},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"name":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"temporary":{"type":"boolean","description":"Is the error temporary?","example":false},"timeout":{"type":"boolean","description":"Is the error a timeout?","example":false}},"description":"Internal Server Error (default view)","example":{"fault":true,"id":"123abc","message":"parameter 'p' must be an integer","name":"bad_request","temporary":true,"timeout":true},"required":["name","id","message","temporary","timeout","fault"]},"CategoryListResponseBody":{"title":"CategoryListResponseBody","type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/definitions/CategoryResponseBody"},"example":[{"id":1,"name":"Image Builder"},{"id":1,"name":"Image Builder"},{"id":1,"name":"Image Builder"}]}},"example":{"data":[{"id":1,"name":"Image Builder"},{"id":1,"name":"Image Builder"},{"id":1,"name":"Image Builder"}]}},"CategoryResponseBody":{"title":"CategoryResponseBody","type":"object","properties":{"id":{"type":"integer","description":"ID is the unique id of the category","example":1,"format":"int64"},"name":{"type":"string","description":"Name of category","example":"Image Builder"}},"example":{"id":1,"name":"Image Builder"},"required":["id","name"]},"HubServiceResponseBody":{"title":"HubServiceResponseBody","type":"object","properties":{"error":{"type":"string","description":"Details of the error if any","example":"unable to reach db"},"name":{"type":"string","description":"Name of the service","example":"api"},"status":{"type":"string","description":"Status of the service","example":"ok","enum":["ok","error"]}},"description":"Describes the services and their status","example":{"error":"unable to reach db","name":"api","status":"ok"},"required":["name","status"]},"JobResponse":{"title":"Mediatype identifier: application/vnd.hub.job; view=default","type":"object","properties":{"catalogName":{"type":"string","description":"Name of the catalog","example":"tekton"},"id":{"type":"integer","description":"id of the job","example":1,"format":"int64"},"status":{"type":"string","description":"status of the job","example":"queued"}},"description":"The Job type describes a catalog refresh job that is run asynchronously (default view)","example":{"catalogName":"tekton","id":1,"status":"queued"},"required":["id","catalogName","status"]},"RatingGetInternalErrorResponseBody":{"title":"Mediatype identifier: application/vnd.goa.error; view=default","type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?","example":false},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"name":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"temporary":{"type":"boolean","description":"Is the error temporary?","example":true},"timeout":{"type":"boolean","description":"Is the error a timeout?","example":true}},"description":"Internal server error (default view)","example":{"fault":false,"id":"123abc","message":"parameter 'p' must be an integer","name":"bad_request","temporary":false,"timeout":true},"required":["name","id","message","temporary","timeout","fault"]},"RatingGetInvalidScopesResponseBody":{"title":"Mediatype identifier: application/vnd.goa.error; view=default","type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?","example":true},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"name":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"temporary":{"type":"boolean","description":"Is the error temporary?","example":false},"timeout":{"type":"boolean","description":"Is the error a timeout?","example":false}},"description":"Invalid User scope (default view)","example":{"fault":true,"id":"123abc","message":"parameter 'p' must be an integer","name":"bad_request","temporary":true,"timeout":false},"required":["name","id","message","temporary","timeout","fault"]},"RatingGetInvalidTokenResponseBody":{"title":"Mediatype identifier: application/vnd.goa.error; view=default","type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?","example":false},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"name":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"temporary":{"type":"boolean","description":"Is the error temporary?","example":false},"timeout":{"type":"boolean","description":"Is the error a timeout?","example":false}},"description":"Invalid User token (default view)","example":{"fault":true,"id":"123abc","message":"parameter 'p' must be an integer","name":"bad_request","temporary":false,"timeout":true},"required":["name","id","message","temporary","timeout","fault"]},"RatingGetNotFoundResponseBody":{"title":"Mediatype identifier: application/vnd.goa.error; view=default","type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?","example":true},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"name":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"temporary":{"type":"boolean","description":"Is the error temporary?","example":true},"timeout":{"type":"boolean","description":"Is the error a timeout?","example":false}},"description":"Resource Not Found Error (default view)","example":{"fault":true,"id":"123abc","message":"parameter 'p' must be an integer","name":"bad_request","temporary":true,"timeout":false},"required":["name","id","message","temporary","timeout","fault"]},"RatingGetResponseBody":{"title":"RatingGetResponseBody","type":"object","properties":{"rating":{"type":"integer","description":"User rating for resource","example":4,"format":"int64"}},"example":{"rating":4},"required":["rating"]},"RatingUpdateInternalErrorResponseBody":{"title":"Mediatype identifier: application/vnd.goa.error; view=default","type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?","example":false},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"name":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"temporary":{"type":"boolean","description":"Is the error temporary?","example":true},"timeout":{"type":"boolean","description":"Is the error a timeout?","example":false}},"description":"Internal server error (default view)","example":{"fault":false,"id":"123abc","message":"parameter 'p' must be an integer","name":"bad_request","temporary":false,"timeout":false},"required":["name","id","message","temporary","timeout","fault"]},"RatingUpdateInvalidScopesResponseBody":{"title":"Mediatype identifier: application/vnd.goa.error; view=default","type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?","example":true},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"name":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"temporary":{"type":"boolean","description":"Is the error temporary?","example":false},"timeout":{"type":"boolean","description":"Is the error a timeout?","example":false}},"description":"Invalid User scope (default view)","example":{"fault":false,"id":"123abc","message":"parameter 'p' must be an integer","name":"bad_request","temporary":true,"timeout":true},"required":["name","id","message","temporary","timeout","fault"]},"RatingUpdateInvalidTokenResponseBody":{"title":"Mediatype identifier: application/vnd.goa.error; view=default","type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?","example":false},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"name":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"temporary":{"type":"boolean","description":"Is the error temporary?","example":true},"timeout":{"type":"boolean","description":"Is the error a timeout?","example":true}},"description":"Invalid User token (default view)","example":{"fault":false,"id":"123abc","message":"parameter 'p' must be an integer","name":"bad_request","temporary":true,"timeout":false},"required":["name","id","message","temporary","timeout","fault"]},"RatingUpdateNotFoundResponseBody":{"title":"Mediatype identifier: application/vnd.goa.error; view=default","type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?","example":false},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"name":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"temporary":{"type":"boolean","description":"Is the error temporary?","example":false},"timeout":{"type":"boolean","description":"Is the error a timeout?","example":true}},"description":"Resource Not Found Error (default view)","example":{"fault":false,"id":"123abc","message":"parameter 'p' must be an integer","name":"bad_request","temporary":false,"timeout":false},"required":["name","id","message","temporary","timeout","fault"]},"RatingUpdateRequestBody":{"title":"RatingUpdateRequestBody","type":"object","properties":{"rating":{"type":"integer","description":"User rating for resource","example":3,"minimum":0,"maximum":5}},"example":{"rating":1},"required":["rating"]},"StatusStatusResponseBody":{"title":"StatusStatusResponseBody","type":"object","properties":{"services":{"type":"array","items":{"$ref":"#/definitions/HubServiceResponseBody"},"description":"List of services and their status","example":[{"error":"unable to reach db","name":"api","status":"ok"},{"error":"unable to reach db","name":"api","status":"ok"},{"error":"unable to reach db","name":"api","status":"ok"},{"error":"unable to reach db","name":"api","status":"ok"}]}},"example":{"services":[{"error":"unable to reach db","name":"api","status":"ok"},{"error":"unable to reach db","name":"api","status":"ok"},{"error":"unable to reach db","name":"api","status":"ok"}]}}},"securityDefinitions":{"jwt_header_Authorization":{"type":"apiKey","description":"Secures endpoint by requiring a valid JWT retrieved via the /auth/login endpoint.\n\n**Security Scopes**:\n * `rating:read`: Read-only access to rating\n * `rating:write`: Read and write access to rating\n * `agent:create`: Access to create or update an agent\n * `catalog:refresh`: Access to refresh catalog\n * `config:refresh`: Access to refresh config file\n * `refresh:token`: Access to refresh user access token","name":"Authorization","in":"header"}}} \ No newline at end of file +{"swagger":"2.0","info":{"title":"Tekton Hub","description":"HTTP services for managing Tekton Hub","version":"1.0"},"host":"api.hub.tekton.dev","consumes":["application/json","application/xml","application/gob"],"produces":["application/json","application/xml","application/gob"],"paths":{"/":{"get":{"tags":["status"],"summary":"Status status","description":"Return status of the services","operationId":"status#Status","responses":{"200":{"description":"OK response.","schema":{"$ref":"#/definitions/StatusStatusResponseBody"}}},"schemes":["https"]}},"/catalog/refresh":{"post":{"tags":["catalog"],"summary":"RefreshAll catalog","description":"Refresh all catalogs\n\n**Required security scopes for jwt**:\n * `catalog:refresh`","operationId":"catalog#RefreshAll","parameters":[{"name":"Authorization","in":"header","description":"JWT","required":true,"type":"string"}],"responses":{"200":{"description":"OK response.","schema":{"type":"array","items":{"$ref":"#/definitions/JobResponse"}}},"500":{"description":"Internal Server Error response.","schema":{"$ref":"#/definitions/CatalogRefreshAllInternalErrorResponseBody"}}},"schemes":["https"],"security":[{"jwt_header_Authorization":[]}]}},"/catalog/{catalogName}/error":{"get":{"tags":["catalog"],"summary":"CatalogError catalog","description":"List all errors occurred refreshing a catalog\n\n**Required security scopes for jwt**:\n * `catalog:refresh`","operationId":"catalog#CatalogError","parameters":[{"name":"catalogName","in":"path","description":"Name of catalog","required":true,"type":"string"},{"name":"Authorization","in":"header","description":"JWT","required":true,"type":"string"}],"responses":{"200":{"description":"OK response.","schema":{"$ref":"#/definitions/CatalogCatalogErrorResponseBody","required":["data"]}},"500":{"description":"Internal Server Error response.","schema":{"$ref":"#/definitions/CatalogCatalogErrorInternalErrorResponseBody"}}},"schemes":["https"],"security":[{"jwt_header_Authorization":[]}]}},"/catalog/{catalogName}/refresh":{"post":{"tags":["catalog"],"summary":"Refresh catalog","description":"Refresh a Catalog by it's name\n\n**Required security scopes for jwt**:\n * `catalog:refresh`","operationId":"catalog#Refresh","parameters":[{"name":"catalogName","in":"path","description":"Name of catalog","required":true,"type":"string"},{"name":"Authorization","in":"header","description":"JWT","required":true,"type":"string"}],"responses":{"200":{"description":"OK response.","schema":{"$ref":"#/definitions/CatalogRefreshResponseBody"}},"404":{"description":"Not Found response.","schema":{"$ref":"#/definitions/CatalogRefreshNotFoundResponseBody"}},"500":{"description":"Internal Server Error response.","schema":{"$ref":"#/definitions/CatalogRefreshInternalErrorResponseBody"}}},"schemes":["https"],"security":[{"jwt_header_Authorization":[]}]}},"/categories":{"get":{"tags":["category"],"summary":"list category","description":"List all categories along with their tags sorted by name","operationId":"category#list","responses":{"200":{"description":"OK response.","schema":{"$ref":"#/definitions/CategoryListResponseBody"}},"500":{"description":"Internal Server Error response.","schema":{"$ref":"#/definitions/CategoryListInternalErrorResponseBody"}}},"schemes":["https"]}},"/resource/{id}/rating":{"get":{"tags":["rating"],"summary":"Get rating","description":"Find user's rating for a resource\n\n**Required security scopes for jwt**:\n * `rating:read`","operationId":"rating#Get","parameters":[{"name":"id","in":"path","description":"ID of a resource","required":true,"type":"integer"},{"name":"Authorization","in":"header","description":"JWT","required":true,"type":"string"}],"responses":{"200":{"description":"OK response.","schema":{"$ref":"#/definitions/RatingGetResponseBody","required":["rating"]}},"401":{"description":"Unauthorized response.","schema":{"$ref":"#/definitions/RatingGetInvalidTokenResponseBody"}},"403":{"description":"Forbidden response.","schema":{"$ref":"#/definitions/RatingGetInvalidScopesResponseBody"}},"404":{"description":"Not Found response.","schema":{"$ref":"#/definitions/RatingGetNotFoundResponseBody"}},"500":{"description":"Internal Server Error response.","schema":{"$ref":"#/definitions/RatingGetInternalErrorResponseBody"}}},"schemes":["https"],"security":[{"jwt_header_Authorization":[]}]},"put":{"tags":["rating"],"summary":"Update rating","description":"Update user's rating for a resource\n\n**Required security scopes for jwt**:\n * `rating:write`","operationId":"rating#Update","parameters":[{"name":"id","in":"path","description":"ID of a resource","required":true,"type":"integer"},{"name":"Authorization","in":"header","description":"JWT","required":true,"type":"string"},{"name":"UpdateRequestBody","in":"body","required":true,"schema":{"$ref":"#/definitions/RatingUpdateRequestBody","required":["rating"]}}],"responses":{"200":{"description":"OK response."},"401":{"description":"Unauthorized response.","schema":{"$ref":"#/definitions/RatingUpdateInvalidTokenResponseBody"}},"403":{"description":"Forbidden response.","schema":{"$ref":"#/definitions/RatingUpdateInvalidScopesResponseBody"}},"404":{"description":"Not Found response.","schema":{"$ref":"#/definitions/RatingUpdateNotFoundResponseBody"}},"500":{"description":"Internal Server Error response.","schema":{"$ref":"#/definitions/RatingUpdateInternalErrorResponseBody"}}},"schemes":["https"],"security":[{"jwt_header_Authorization":[]}]}},"/resources":{"get":{"tags":["resource"],"summary":"List resource","description":"List all resources sorted by rating and name","operationId":"resource#List","responses":{"301":{"description":"Moved Permanently response.","schema":{"$ref":"#/definitions/ResourceListResponseBody"}}},"schemes":["https"]}},"/schema/swagger.json":{"get":{"tags":["swagger"],"summary":"Download docs/openapi3.json","description":"JSON document containing the API swagger definition","operationId":"swagger#/schema/swagger.json","responses":{"200":{"description":"File downloaded","schema":{"type":"file"}}},"schemes":["https"]}},"/system/config/refresh":{"post":{"tags":["admin"],"summary":"RefreshConfig admin","description":"Refresh the changes in config file\n\n**Required security scopes for jwt**:\n * `config:refresh`","operationId":"admin#RefreshConfig","parameters":[{"name":"Authorization","in":"header","description":"User JWT","required":true,"type":"string"}],"responses":{"200":{"description":"OK response.","schema":{"$ref":"#/definitions/AdminRefreshConfigResponseBody","required":["checksum"]}},"401":{"description":"Unauthorized response.","schema":{"$ref":"#/definitions/AdminRefreshConfigInvalidTokenResponseBody"}},"403":{"description":"Forbidden response.","schema":{"$ref":"#/definitions/AdminRefreshConfigInvalidScopesResponseBody"}},"500":{"description":"Internal Server Error response.","schema":{"$ref":"#/definitions/AdminRefreshConfigInternalErrorResponseBody"}}},"schemes":["https"],"security":[{"jwt_header_Authorization":[]}]}},"/system/user/agent":{"put":{"tags":["admin"],"summary":"UpdateAgent admin","description":"Create or Update an agent user with required scopes\n\n**Required security scopes for jwt**:\n * `agent:create`","operationId":"admin#UpdateAgent","parameters":[{"name":"Authorization","in":"header","description":"User JWT","required":true,"type":"string"},{"name":"UpdateAgentRequestBody","in":"body","required":true,"schema":{"$ref":"#/definitions/AdminUpdateAgentRequestBody","required":["name","scopes"]}}],"responses":{"200":{"description":"OK response.","schema":{"$ref":"#/definitions/AdminUpdateAgentResponseBody","required":["token"]}},"400":{"description":"Bad Request response.","schema":{"$ref":"#/definitions/AdminUpdateAgentInvalidPayloadResponseBody"}},"401":{"description":"Unauthorized response.","schema":{"$ref":"#/definitions/AdminUpdateAgentInvalidTokenResponseBody"}},"403":{"description":"Forbidden response.","schema":{"$ref":"#/definitions/AdminUpdateAgentInvalidScopesResponseBody"}},"500":{"description":"Internal Server Error response.","schema":{"$ref":"#/definitions/AdminUpdateAgentInternalErrorResponseBody"}}},"schemes":["https"],"security":[{"jwt_header_Authorization":[]}]}},"/v1":{"get":{"tags":["status"],"summary":"Status status","description":"Return status of the services","operationId":"status#Status#1","responses":{"200":{"description":"OK response.","schema":{"$ref":"#/definitions/StatusStatusResponseBody"}}},"schemes":["https"]}},"/v1/categories":{"get":{"tags":["category"],"summary":"list category","description":"List all categories along with their tags sorted by name","operationId":"category#list#1","responses":{"200":{"description":"OK response.","schema":{"$ref":"#/definitions/CategoryListResponseBody"}},"500":{"description":"Internal Server Error response.","schema":{"$ref":"#/definitions/CategoryListInternalErrorResponseBody"}}},"schemes":["https"]}}},"definitions":{"AdminRefreshConfigInternalErrorResponseBody":{"title":"Mediatype identifier: application/vnd.goa.error; view=default","type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?","example":true},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"name":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"temporary":{"type":"boolean","description":"Is the error temporary?","example":true},"timeout":{"type":"boolean","description":"Is the error a timeout?","example":true}},"description":"Internal server error (default view)","example":{"fault":false,"id":"123abc","message":"parameter 'p' must be an integer","name":"bad_request","temporary":false,"timeout":false},"required":["name","id","message","temporary","timeout","fault"]},"AdminRefreshConfigInvalidScopesResponseBody":{"title":"Mediatype identifier: application/vnd.goa.error; view=default","type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?","example":false},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"name":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"temporary":{"type":"boolean","description":"Is the error temporary?","example":true},"timeout":{"type":"boolean","description":"Is the error a timeout?","example":false}},"description":"Invalid Token scopes (default view)","example":{"fault":true,"id":"123abc","message":"parameter 'p' must be an integer","name":"bad_request","temporary":true,"timeout":false},"required":["name","id","message","temporary","timeout","fault"]},"AdminRefreshConfigInvalidTokenResponseBody":{"title":"Mediatype identifier: application/vnd.goa.error; view=default","type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?","example":true},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"name":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"temporary":{"type":"boolean","description":"Is the error temporary?","example":true},"timeout":{"type":"boolean","description":"Is the error a timeout?","example":true}},"description":"Invalid User token (default view)","example":{"fault":true,"id":"123abc","message":"parameter 'p' must be an integer","name":"bad_request","temporary":true,"timeout":true},"required":["name","id","message","temporary","timeout","fault"]},"AdminRefreshConfigResponseBody":{"title":"AdminRefreshConfigResponseBody","type":"object","properties":{"checksum":{"type":"string","description":"Config file checksum","example":"41ba391c8baf1fcd3c62c11272b913dc6613f4cf3b1833cfbb32431dc4384c93"}},"example":{"checksum":"41ba391c8baf1fcd3c62c11272b913dc6613f4cf3b1833cfbb32431dc4384c93"},"required":["checksum"]},"AdminUpdateAgentInternalErrorResponseBody":{"title":"Mediatype identifier: application/vnd.goa.error; view=default","type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?","example":false},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"name":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"temporary":{"type":"boolean","description":"Is the error temporary?","example":true},"timeout":{"type":"boolean","description":"Is the error a timeout?","example":false}},"description":"Internal server error (default view)","example":{"fault":false,"id":"123abc","message":"parameter 'p' must be an integer","name":"bad_request","temporary":true,"timeout":true},"required":["name","id","message","temporary","timeout","fault"]},"AdminUpdateAgentInvalidPayloadResponseBody":{"title":"Mediatype identifier: application/vnd.goa.error; view=default","type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?","example":true},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"name":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"temporary":{"type":"boolean","description":"Is the error temporary?","example":true},"timeout":{"type":"boolean","description":"Is the error a timeout?","example":false}},"description":"Invalid request body (default view)","example":{"fault":false,"id":"123abc","message":"parameter 'p' must be an integer","name":"bad_request","temporary":true,"timeout":false},"required":["name","id","message","temporary","timeout","fault"]},"AdminUpdateAgentInvalidScopesResponseBody":{"title":"Mediatype identifier: application/vnd.goa.error; view=default","type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?","example":false},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"name":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"temporary":{"type":"boolean","description":"Is the error temporary?","example":false},"timeout":{"type":"boolean","description":"Is the error a timeout?","example":false}},"description":"Invalid Token scopes (default view)","example":{"fault":false,"id":"123abc","message":"parameter 'p' must be an integer","name":"bad_request","temporary":false,"timeout":true},"required":["name","id","message","temporary","timeout","fault"]},"AdminUpdateAgentInvalidTokenResponseBody":{"title":"Mediatype identifier: application/vnd.goa.error; view=default","type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?","example":true},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"name":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"temporary":{"type":"boolean","description":"Is the error temporary?","example":false},"timeout":{"type":"boolean","description":"Is the error a timeout?","example":true}},"description":"Invalid User token (default view)","example":{"fault":false,"id":"123abc","message":"parameter 'p' must be an integer","name":"bad_request","temporary":false,"timeout":false},"required":["name","id","message","temporary","timeout","fault"]},"AdminUpdateAgentRequestBody":{"title":"AdminUpdateAgentRequestBody","type":"object","properties":{"name":{"type":"string","description":"Name of Agent","example":"abc"},"scopes":{"type":"array","items":{"type":"string","example":"Officia itaque non aut qui."},"description":"Scopes required for Agent","example":["catalog-refresh","agent:create"]}},"example":{"name":"abc","scopes":["catalog-refresh","agent:create"]},"required":["name","scopes"]},"AdminUpdateAgentResponseBody":{"title":"AdminUpdateAgentResponseBody","type":"object","properties":{"token":{"type":"string","description":"Agent JWT","example":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1Nzc4ODAzMDAsImlhdCI6MTU3Nzg4MDAwMCwiaWQiOjExLCJpc3MiOiJUZWt0b24gSHViIiwic2NvcGVzIjpbInJhdGluZzpyZWFkIiwicmF0aW5nOndyaXRlIiwiYWdlbnQ6Y3JlYXRlIl0sInR5cGUiOiJhY2Nlc3MtdG9rZW4ifQ.6pDmziSKkoSqI1f0rc4-AqVdcfY0Q8wA-tSLzdTCLgM"}},"example":{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1Nzc4ODAzMDAsImlhdCI6MTU3Nzg4MDAwMCwiaWQiOjExLCJpc3MiOiJUZWt0b24gSHViIiwic2NvcGVzIjpbInJhdGluZzpyZWFkIiwicmF0aW5nOndyaXRlIiwiYWdlbnQ6Y3JlYXRlIl0sInR5cGUiOiJhY2Nlc3MtdG9rZW4ifQ.6pDmziSKkoSqI1f0rc4-AqVdcfY0Q8wA-tSLzdTCLgM"},"required":["token"]},"CatalogCatalogErrorInternalErrorResponseBody":{"title":"Mediatype identifier: application/vnd.goa.error; view=default","type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?","example":true},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"name":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"temporary":{"type":"boolean","description":"Is the error temporary?","example":true},"timeout":{"type":"boolean","description":"Is the error a timeout?","example":true}},"description":"Internal Server Error (default view)","example":{"fault":false,"id":"123abc","message":"parameter 'p' must be an integer","name":"bad_request","temporary":true,"timeout":false},"required":["name","id","message","temporary","timeout","fault"]},"CatalogCatalogErrorResponseBody":{"title":"CatalogCatalogErrorResponseBody","type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/definitions/CatalogErrorsResponseBody"},"description":"Catalog errors","example":[{"errors":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"],"type":"warning"},{"errors":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"],"type":"warning"},{"errors":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"],"type":"warning"},{"errors":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"],"type":"warning"}]}},"example":{"data":[{"errors":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"],"type":"warning"},{"errors":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"],"type":"warning"},{"errors":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"],"type":"warning"},{"errors":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"],"type":"warning"}]},"required":["data"]},"CatalogErrorsResponseBody":{"title":"CatalogErrorsResponseBody","type":"object","properties":{"errors":{"type":"array","items":{"type":"string","example":"Quos distinctio ipsam eos."},"description":"Catalog Error message","example":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"]},"type":{"type":"string","description":"Catalog Errror type","example":"warning"}},"description":"CatalogErrors define the errors that occurred during catalog refresh","example":{"errors":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"],"type":"warning"},"required":["type","errors"]},"CatalogRefreshAllInternalErrorResponseBody":{"title":"Mediatype identifier: application/vnd.goa.error; view=default","type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?","example":true},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"name":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"temporary":{"type":"boolean","description":"Is the error temporary?","example":true},"timeout":{"type":"boolean","description":"Is the error a timeout?","example":true}},"description":"Internal Server Error (default view)","example":{"fault":false,"id":"123abc","message":"parameter 'p' must be an integer","name":"bad_request","temporary":true,"timeout":false},"required":["name","id","message","temporary","timeout","fault"]},"CatalogRefreshInternalErrorResponseBody":{"title":"Mediatype identifier: application/vnd.goa.error; view=default","type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?","example":true},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"name":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"temporary":{"type":"boolean","description":"Is the error temporary?","example":true},"timeout":{"type":"boolean","description":"Is the error a timeout?","example":false}},"description":"Internal Server Error (default view)","example":{"fault":false,"id":"123abc","message":"parameter 'p' must be an integer","name":"bad_request","temporary":true,"timeout":true},"required":["name","id","message","temporary","timeout","fault"]},"CatalogRefreshNotFoundResponseBody":{"title":"Mediatype identifier: application/vnd.goa.error; view=default","type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?","example":false},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"name":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"temporary":{"type":"boolean","description":"Is the error temporary?","example":true},"timeout":{"type":"boolean","description":"Is the error a timeout?","example":true}},"description":"Resource Not Found Error (default view)","example":{"fault":true,"id":"123abc","message":"parameter 'p' must be an integer","name":"bad_request","temporary":false,"timeout":false},"required":["name","id","message","temporary","timeout","fault"]},"CatalogRefreshResponseBody":{"title":"Mediatype identifier: application/vnd.hub.job; view=default","type":"object","properties":{"catalogName":{"type":"string","description":"Name of the catalog","example":"tekton"},"id":{"type":"integer","description":"id of the job","example":1,"format":"int64"},"status":{"type":"string","description":"status of the job","example":"queued"}},"description":"RefreshResponseBody result type (default view)","example":{"catalogName":"tekton","id":1,"status":"queued"},"required":["id","catalogName","status"]},"CatalogResponseBodyMin":{"title":"Mediatype identifier: application/vnd.hub.catalog; view=default","type":"object","properties":{"id":{"type":"integer","description":"ID is the unique id of the catalog","example":1,"format":"int64"},"name":{"type":"string","description":"Name of catalog","example":"Tekton"},"type":{"type":"string","description":"Type of catalog","example":"community","enum":["official","community"]}},"description":"CatalogResponseBodyMin result type (default view)","example":{"id":1,"name":"Tekton","type":"community"},"required":["id","name","type"]},"CategoryListInternalErrorResponseBody":{"title":"Mediatype identifier: application/vnd.goa.error; view=default","type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?","example":false},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"name":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"temporary":{"type":"boolean","description":"Is the error temporary?","example":false},"timeout":{"type":"boolean","description":"Is the error a timeout?","example":false}},"description":"Internal Server Error (default view)","example":{"fault":true,"id":"123abc","message":"parameter 'p' must be an integer","name":"bad_request","temporary":true,"timeout":true},"required":["name","id","message","temporary","timeout","fault"]},"CategoryListResponseBody":{"title":"CategoryListResponseBody","type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/definitions/CategoryResponseBody"},"example":[{"id":1,"name":"Image Builder"},{"id":1,"name":"Image Builder"},{"id":1,"name":"Image Builder"}]}},"example":{"data":[{"id":1,"name":"Image Builder"},{"id":1,"name":"Image Builder"},{"id":1,"name":"Image Builder"}]}},"CategoryResponseBody":{"title":"CategoryResponseBody","type":"object","properties":{"id":{"type":"integer","description":"ID is the unique id of the category","example":1,"format":"int64"},"name":{"type":"string","description":"Name of category","example":"Image Builder"}},"example":{"id":1,"name":"Image Builder"},"required":["id","name"]},"HubServiceResponseBody":{"title":"HubServiceResponseBody","type":"object","properties":{"error":{"type":"string","description":"Details of the error if any","example":"unable to reach db"},"name":{"type":"string","description":"Name of the service","example":"api"},"status":{"type":"string","description":"Status of the service","example":"ok","enum":["ok","error"]}},"description":"Describes the services and their status","example":{"error":"unable to reach db","name":"api","status":"ok"},"required":["name","status"]},"JobResponse":{"title":"Mediatype identifier: application/vnd.hub.job; view=default","type":"object","properties":{"catalogName":{"type":"string","description":"Name of the catalog","example":"tekton"},"id":{"type":"integer","description":"id of the job","example":1,"format":"int64"},"status":{"type":"string","description":"status of the job","example":"queued"}},"description":"The Job type describes a catalog refresh job that is run asynchronously (default view)","example":{"catalogName":"tekton","id":1,"status":"queued"},"required":["id","catalogName","status"]},"PlatformResponseBody":{"title":"PlatformResponseBody","type":"object","properties":{"id":{"type":"integer","description":"ID is the unique id of platform","example":1,"format":"int64"},"name":{"type":"string","description":"Name of platform","example":"linux/amd64"}},"example":{"id":1,"name":"linux/amd64"},"required":["id","name"]},"RatingGetInternalErrorResponseBody":{"title":"Mediatype identifier: application/vnd.goa.error; view=default","type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?","example":false},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"name":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"temporary":{"type":"boolean","description":"Is the error temporary?","example":true},"timeout":{"type":"boolean","description":"Is the error a timeout?","example":true}},"description":"Internal server error (default view)","example":{"fault":false,"id":"123abc","message":"parameter 'p' must be an integer","name":"bad_request","temporary":false,"timeout":true},"required":["name","id","message","temporary","timeout","fault"]},"RatingGetInvalidScopesResponseBody":{"title":"Mediatype identifier: application/vnd.goa.error; view=default","type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?","example":true},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"name":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"temporary":{"type":"boolean","description":"Is the error temporary?","example":false},"timeout":{"type":"boolean","description":"Is the error a timeout?","example":false}},"description":"Invalid User scope (default view)","example":{"fault":true,"id":"123abc","message":"parameter 'p' must be an integer","name":"bad_request","temporary":true,"timeout":false},"required":["name","id","message","temporary","timeout","fault"]},"RatingGetInvalidTokenResponseBody":{"title":"Mediatype identifier: application/vnd.goa.error; view=default","type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?","example":false},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"name":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"temporary":{"type":"boolean","description":"Is the error temporary?","example":false},"timeout":{"type":"boolean","description":"Is the error a timeout?","example":false}},"description":"Invalid User token (default view)","example":{"fault":true,"id":"123abc","message":"parameter 'p' must be an integer","name":"bad_request","temporary":false,"timeout":true},"required":["name","id","message","temporary","timeout","fault"]},"RatingGetNotFoundResponseBody":{"title":"Mediatype identifier: application/vnd.goa.error; view=default","type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?","example":true},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"name":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"temporary":{"type":"boolean","description":"Is the error temporary?","example":true},"timeout":{"type":"boolean","description":"Is the error a timeout?","example":false}},"description":"Resource Not Found Error (default view)","example":{"fault":true,"id":"123abc","message":"parameter 'p' must be an integer","name":"bad_request","temporary":true,"timeout":false},"required":["name","id","message","temporary","timeout","fault"]},"RatingGetResponseBody":{"title":"RatingGetResponseBody","type":"object","properties":{"rating":{"type":"integer","description":"User rating for resource","example":4,"format":"int64"}},"example":{"rating":4},"required":["rating"]},"RatingUpdateInternalErrorResponseBody":{"title":"Mediatype identifier: application/vnd.goa.error; view=default","type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?","example":false},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"name":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"temporary":{"type":"boolean","description":"Is the error temporary?","example":true},"timeout":{"type":"boolean","description":"Is the error a timeout?","example":false}},"description":"Internal server error (default view)","example":{"fault":false,"id":"123abc","message":"parameter 'p' must be an integer","name":"bad_request","temporary":false,"timeout":false},"required":["name","id","message","temporary","timeout","fault"]},"RatingUpdateInvalidScopesResponseBody":{"title":"Mediatype identifier: application/vnd.goa.error; view=default","type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?","example":true},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"name":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"temporary":{"type":"boolean","description":"Is the error temporary?","example":false},"timeout":{"type":"boolean","description":"Is the error a timeout?","example":false}},"description":"Invalid User scope (default view)","example":{"fault":false,"id":"123abc","message":"parameter 'p' must be an integer","name":"bad_request","temporary":true,"timeout":true},"required":["name","id","message","temporary","timeout","fault"]},"RatingUpdateInvalidTokenResponseBody":{"title":"Mediatype identifier: application/vnd.goa.error; view=default","type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?","example":false},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"name":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"temporary":{"type":"boolean","description":"Is the error temporary?","example":true},"timeout":{"type":"boolean","description":"Is the error a timeout?","example":true}},"description":"Invalid User token (default view)","example":{"fault":false,"id":"123abc","message":"parameter 'p' must be an integer","name":"bad_request","temporary":true,"timeout":false},"required":["name","id","message","temporary","timeout","fault"]},"RatingUpdateNotFoundResponseBody":{"title":"Mediatype identifier: application/vnd.goa.error; view=default","type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?","example":false},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"name":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"temporary":{"type":"boolean","description":"Is the error temporary?","example":false},"timeout":{"type":"boolean","description":"Is the error a timeout?","example":true}},"description":"Resource Not Found Error (default view)","example":{"fault":false,"id":"123abc","message":"parameter 'p' must be an integer","name":"bad_request","temporary":false,"timeout":false},"required":["name","id","message","temporary","timeout","fault"]},"RatingUpdateRequestBody":{"title":"RatingUpdateRequestBody","type":"object","properties":{"rating":{"type":"integer","description":"User rating for resource","example":3,"minimum":0,"maximum":5}},"example":{"rating":1},"required":["rating"]},"ResourceDataResponseBodyWithoutVersion":{"title":"Mediatype identifier: application/vnd.hub.resource.data; view=default","type":"object","properties":{"catalog":{"$ref":"#/definitions/CatalogResponseBodyMin"},"categories":{"type":"array","items":{"$ref":"#/definitions/CategoryResponseBody"},"description":"Categories related to resource","example":[{"id":1,"name":"image-build"}]},"hubURLPath":{"type":"string","description":"Url path of the resource in hub","example":"tekton/task/buildah"},"id":{"type":"integer","description":"ID is the unique id of the resource","example":1,"format":"int64"},"kind":{"type":"string","description":"Kind of resource","example":"task"},"latestVersion":{"$ref":"#/definitions/ResourceVersionDataResponseBodyWithoutResource"},"name":{"type":"string","description":"Name of resource","example":"buildah"},"platforms":{"type":"array","items":{"$ref":"#/definitions/PlatformResponseBody"},"description":"Platforms related to resource","example":[{"id":1,"name":"linux/amd64"}]},"rating":{"type":"number","description":"Rating of resource","example":4.3,"format":"double"},"tags":{"type":"array","items":{"$ref":"#/definitions/TagResponseBody"},"description":"Tags related to resource","example":[{"id":1,"name":"image-build"}]}},"description":"The resource type describes resource information. (withoutVersion view) (default view)","example":{"catalog":{"id":1,"name":"tekton","type":"community"},"categories":[{"id":1,"name":"image-build"}],"hubURLPath":"tekton/task/buildah","id":1,"kind":"task","latestVersion":{"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/amd64"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},"name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}]},"required":["id","name","catalog","categories","kind","hubURLPath","latestVersion","tags","platforms","rating"]},"ResourceDataResponseBodyWithoutVersionCollection":{"title":"Mediatype identifier: application/vnd.hub.resource.data; type=collection; view=default","type":"array","items":{"$ref":"#/definitions/ResourceDataResponseBodyWithoutVersion"},"description":"ResourceDataResponseBodyWithoutVersionCollection is the result type for an array of ResourceDataResponseBodyWithoutVersion (default view)","example":[{"catalog":{"id":1,"name":"tekton","type":"community"},"categories":[{"id":1,"name":"image-build"}],"hubURLPath":"tekton/task/buildah","id":1,"kind":"task","latestVersion":{"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/amd64"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},"name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}]},{"catalog":{"id":1,"name":"tekton","type":"community"},"categories":[{"id":1,"name":"image-build"}],"hubURLPath":"tekton/task/buildah","id":1,"kind":"task","latestVersion":{"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/amd64"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},"name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}]},{"catalog":{"id":1,"name":"tekton","type":"community"},"categories":[{"id":1,"name":"image-build"}],"hubURLPath":"tekton/task/buildah","id":1,"kind":"task","latestVersion":{"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/amd64"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},"name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}]},{"catalog":{"id":1,"name":"tekton","type":"community"},"categories":[{"id":1,"name":"image-build"}],"hubURLPath":"tekton/task/buildah","id":1,"kind":"task","latestVersion":{"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/amd64"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},"name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}]}]},"ResourceListResponseBody":{"title":"Mediatype identifier: application/vnd.hub.resources; view=default","type":"object","properties":{"data":{"$ref":"#/definitions/ResourceDataResponseBodyWithoutVersionCollection"}},"description":"ListResponseBody result type (default view)","example":{"data":[{"catalog":{"id":1,"name":"tekton","type":"community"},"categories":[{"id":1,"name":"image-build"}],"hubURLPath":"tekton/task/buildah","id":1,"kind":"task","latestVersion":{"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/amd64"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},"name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}]},{"catalog":{"id":1,"name":"tekton","type":"community"},"categories":[{"id":1,"name":"image-build"}],"hubURLPath":"tekton/task/buildah","id":1,"kind":"task","latestVersion":{"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/amd64"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},"name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}]},{"catalog":{"id":1,"name":"tekton","type":"community"},"categories":[{"id":1,"name":"image-build"}],"hubURLPath":"tekton/task/buildah","id":1,"kind":"task","latestVersion":{"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/amd64"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},"name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}]},{"catalog":{"id":1,"name":"tekton","type":"community"},"categories":[{"id":1,"name":"image-build"}],"hubURLPath":"tekton/task/buildah","id":1,"kind":"task","latestVersion":{"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/amd64"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},"name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}]}]},"required":["data"]},"ResourceVersionDataResponseBodyWithoutResource":{"title":"Mediatype identifier: application/vnd.hub.resource.version.data; view=default","type":"object","properties":{"deprecated":{"type":"boolean","description":"Deprecation status of a version","example":true},"description":{"type":"string","description":"Description of version","example":"Buildah task builds source into a container image and then pushes it to a container registry."},"displayName":{"type":"string","description":"Display name of version","example":"Buildah"},"hubURLPath":{"type":"string","description":"Url path of the resource in hub","example":"tekton/task/buildah"},"id":{"type":"integer","description":"ID is the unique id of resource's version","example":1,"format":"int64"},"minPipelinesVersion":{"type":"string","description":"Minimum pipelines version the resource's version is compatible with","example":"0.12.1"},"platforms":{"type":"array","items":{"$ref":"#/definitions/PlatformResponseBody"},"description":"Platforms related to resource version","example":[{"id":1,"name":"linux/s390x"}]},"rawURL":{"type":"string","description":"Raw URL of resource's yaml file of the version","example":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","format":"uri"},"updatedAt":{"type":"string","description":"Timestamp when version was last updated","example":"2020-01-01 12:00:00 +0000 UTC","format":"date-time"},"version":{"type":"string","description":"Version of resource","example":"0.1"},"webURL":{"type":"string","description":"Web URL of resource's yaml file of the version","example":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml","format":"uri"}},"description":"The Version result type describes resource's version information. (default view)","example":{"deprecated":true,"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","hubURLPath":"tekton/task/buildah","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/s390x"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},"required":["id","version","displayName","description","minPipelinesVersion","rawURL","webURL","updatedAt","platforms","hubURLPath"]},"StatusStatusResponseBody":{"title":"StatusStatusResponseBody","type":"object","properties":{"services":{"type":"array","items":{"$ref":"#/definitions/HubServiceResponseBody"},"description":"List of services and their status","example":[{"error":"unable to reach db","name":"api","status":"ok"},{"error":"unable to reach db","name":"api","status":"ok"},{"error":"unable to reach db","name":"api","status":"ok"}]}},"example":{"services":[{"error":"unable to reach db","name":"api","status":"ok"},{"error":"unable to reach db","name":"api","status":"ok"},{"error":"unable to reach db","name":"api","status":"ok"},{"error":"unable to reach db","name":"api","status":"ok"}]}},"TagResponseBody":{"title":"TagResponseBody","type":"object","properties":{"id":{"type":"integer","description":"ID is the unique id of tag","example":1,"format":"int64"},"name":{"type":"string","description":"Name of tag","example":"image-build"}},"example":{"id":1,"name":"image-build"},"required":["id","name"]}},"securityDefinitions":{"jwt_header_Authorization":{"type":"apiKey","description":"Secures endpoint by requiring a valid JWT retrieved via the /auth/login endpoint.\n\n**Security Scopes**:\n * `rating:read`: Read-only access to rating\n * `rating:write`: Read and write access to rating\n * `agent:create`: Access to create or update an agent\n * `catalog:refresh`: Access to refresh catalog\n * `config:refresh`: Access to refresh config file\n * `refresh:token`: Access to refresh user access token","name":"Authorization","in":"header"}}} \ No newline at end of file diff --git a/api/gen/http/openapi.yaml b/api/gen/http/openapi.yaml index be324c0257..22edd11687 100644 --- a/api/gen/http/openapi.yaml +++ b/api/gen/http/openapi.yaml @@ -253,6 +253,20 @@ paths: - https security: - jwt_header_Authorization: [] + /resources: + get: + tags: + - resource + summary: List resource + description: List all resources sorted by rating and name + operationId: resource#List + responses: + "301": + description: Moved Permanently response. + schema: + $ref: '#/definitions/ResourceListResponseBody' + schemes: + - https /schema/swagger.json: get: tags: @@ -417,7 +431,7 @@ definitions: temporary: type: boolean description: Is the error temporary? - example: false + example: true timeout: type: boolean description: Is the error a timeout? @@ -428,8 +442,8 @@ definitions: id: 123abc message: parameter 'p' must be an integer name: bad_request - temporary: true - timeout: true + temporary: false + timeout: false required: - name - id @@ -444,7 +458,7 @@ definitions: fault: type: boolean description: Is the error a server-side fault? - example: true + example: false id: type: string description: ID is a unique identifier for this particular occurrence of the @@ -466,14 +480,14 @@ definitions: timeout: type: boolean description: Is the error a timeout? - example: true + example: false description: Invalid Token scopes (default view) example: fault: true id: 123abc message: parameter 'p' must be an integer name: bad_request - temporary: false + temporary: true timeout: false required: - name @@ -511,7 +525,7 @@ definitions: timeout: type: boolean description: Is the error a timeout? - example: false + example: true description: Invalid User token (default view) example: fault: true @@ -564,18 +578,18 @@ definitions: temporary: type: boolean description: Is the error temporary? - example: false + example: true timeout: type: boolean description: Is the error a timeout? - example: true + example: false description: Internal server error (default view) example: - fault: true + fault: false id: 123abc message: parameter 'p' must be an integer name: bad_request - temporary: false + temporary: true timeout: true required: - name @@ -591,7 +605,7 @@ definitions: fault: type: boolean description: Is the error a server-side fault? - example: false + example: true id: type: string description: ID is a unique identifier for this particular occurrence of the @@ -609,11 +623,11 @@ definitions: temporary: type: boolean description: Is the error temporary? - example: false + example: true timeout: type: boolean description: Is the error a timeout? - example: true + example: false description: Invalid request body (default view) example: fault: false @@ -621,7 +635,7 @@ definitions: message: parameter 'p' must be an integer name: bad_request temporary: true - timeout: true + timeout: false required: - name - id @@ -661,12 +675,12 @@ definitions: example: false description: Invalid Token scopes (default view) example: - fault: true + fault: false id: 123abc message: parameter 'p' must be an integer name: bad_request temporary: false - timeout: false + timeout: true required: - name - id @@ -703,14 +717,14 @@ definitions: timeout: type: boolean description: Is the error a timeout? - example: false + example: true description: Invalid User token (default view) example: fault: false id: 123abc message: parameter 'p' must be an integer name: bad_request - temporary: true + temporary: false timeout: false required: - name @@ -731,7 +745,7 @@ definitions: type: array items: type: string - example: Nihil officia itaque non. + example: Officia itaque non aut qui. description: Scopes required for Agent example: - catalog-refresh @@ -855,7 +869,7 @@ definitions: type: array items: type: string - example: Ut aut quos distinctio ipsam eos. + example: Quos distinctio ipsam eos. description: Catalog Error message example: - Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name @@ -902,15 +916,15 @@ definitions: timeout: type: boolean description: Is the error a timeout? - example: false + example: true description: Internal Server Error (default view) example: - fault: true + fault: false id: 123abc message: parameter 'p' must be an integer name: bad_request temporary: true - timeout: true + timeout: false required: - name - id @@ -943,18 +957,18 @@ definitions: temporary: type: boolean description: Is the error temporary? - example: false + example: true timeout: type: boolean description: Is the error a timeout? - example: true + example: false description: Internal Server Error (default view) example: - fault: true + fault: false id: 123abc message: parameter 'p' must be an integer name: bad_request - temporary: false + temporary: true timeout: true required: - name @@ -970,7 +984,7 @@ definitions: fault: type: boolean description: Is the error a server-side fault? - example: true + example: false id: type: string description: ID is a unique identifier for this particular occurrence of the @@ -988,18 +1002,18 @@ definitions: temporary: type: boolean description: Is the error temporary? - example: false + example: true timeout: type: boolean description: Is the error a timeout? - example: false + example: true description: Resource Not Found Error (default view) example: - fault: false + fault: true id: 123abc message: parameter 'p' must be an integer name: bad_request - temporary: true + temporary: false timeout: false required: - name @@ -1034,6 +1048,35 @@ definitions: - id - catalogName - status + CatalogResponseBodyMin: + title: 'Mediatype identifier: application/vnd.hub.catalog; view=default' + type: object + properties: + id: + type: integer + description: ID is the unique id of the catalog + example: 1 + format: int64 + name: + type: string + description: Name of catalog + example: Tekton + type: + type: string + description: Type of catalog + example: community + enum: + - official + - community + description: CatalogResponseBodyMin result type (default view) + example: + id: 1 + name: Tekton + type: community + required: + - id + - name + - type CategoryListInternalErrorResponseBody: title: 'Mediatype identifier: application/vnd.goa.error; view=default' type: object @@ -1175,6 +1218,25 @@ definitions: - id - catalogName - status + PlatformResponseBody: + title: PlatformResponseBody + type: object + properties: + id: + type: integer + description: ID is the unique id of platform + example: 1 + format: int64 + name: + type: string + description: Name of platform + example: linux/amd64 + example: + id: 1 + name: linux/amd64 + required: + - id + - name RatingGetInternalErrorResponseBody: title: 'Mediatype identifier: application/vnd.goa.error; view=default' type: object @@ -1562,6 +1624,459 @@ definitions: rating: 1 required: - rating + ResourceDataResponseBodyWithoutVersion: + title: 'Mediatype identifier: application/vnd.hub.resource.data; view=default' + type: object + properties: + catalog: + $ref: '#/definitions/CatalogResponseBodyMin' + categories: + type: array + items: + $ref: '#/definitions/CategoryResponseBody' + description: Categories related to resource + example: + - id: 1 + name: image-build + hubURLPath: + type: string + description: Url path of the resource in hub + example: tekton/task/buildah + id: + type: integer + description: ID is the unique id of the resource + example: 1 + format: int64 + kind: + type: string + description: Kind of resource + example: task + latestVersion: + $ref: '#/definitions/ResourceVersionDataResponseBodyWithoutResource' + name: + type: string + description: Name of resource + example: buildah + platforms: + type: array + items: + $ref: '#/definitions/PlatformResponseBody' + description: Platforms related to resource + example: + - id: 1 + name: linux/amd64 + rating: + type: number + description: Rating of resource + example: 4.3 + format: double + tags: + type: array + items: + $ref: '#/definitions/TagResponseBody' + description: Tags related to resource + example: + - id: 1 + name: image-build + description: The resource type describes resource information. (withoutVersion + view) (default view) + example: + catalog: + id: 1 + name: tekton + type: community + categories: + - id: 1 + name: image-build + hubURLPath: tekton/task/buildah + id: 1 + kind: task + latestVersion: + description: Buildah task builds source into a container image and then pushes + it to a container registry. + displayName: Buildah + id: 1 + minPipelinesVersion: 0.12.1 + platforms: + - id: 1 + name: linux/amd64 + rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml + updatedAt: 2020-01-01 12:00:00 +0000 UTC + version: "0.1" + webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml + name: buildah + platforms: + - id: 1 + name: linux/amd64 + rating: 4.3 + tags: + - id: 1 + name: image-build + required: + - id + - name + - catalog + - categories + - kind + - hubURLPath + - latestVersion + - tags + - platforms + - rating + ResourceDataResponseBodyWithoutVersionCollection: + title: 'Mediatype identifier: application/vnd.hub.resource.data; type=collection; + view=default' + type: array + items: + $ref: '#/definitions/ResourceDataResponseBodyWithoutVersion' + description: ResourceDataResponseBodyWithoutVersionCollection is the result type + for an array of ResourceDataResponseBodyWithoutVersion (default view) + example: + - catalog: + id: 1 + name: tekton + type: community + categories: + - id: 1 + name: image-build + hubURLPath: tekton/task/buildah + id: 1 + kind: task + latestVersion: + description: Buildah task builds source into a container image and then pushes + it to a container registry. + displayName: Buildah + id: 1 + minPipelinesVersion: 0.12.1 + platforms: + - id: 1 + name: linux/amd64 + rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml + updatedAt: 2020-01-01 12:00:00 +0000 UTC + version: "0.1" + webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml + name: buildah + platforms: + - id: 1 + name: linux/amd64 + rating: 4.3 + tags: + - id: 1 + name: image-build + - catalog: + id: 1 + name: tekton + type: community + categories: + - id: 1 + name: image-build + hubURLPath: tekton/task/buildah + id: 1 + kind: task + latestVersion: + description: Buildah task builds source into a container image and then pushes + it to a container registry. + displayName: Buildah + id: 1 + minPipelinesVersion: 0.12.1 + platforms: + - id: 1 + name: linux/amd64 + rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml + updatedAt: 2020-01-01 12:00:00 +0000 UTC + version: "0.1" + webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml + name: buildah + platforms: + - id: 1 + name: linux/amd64 + rating: 4.3 + tags: + - id: 1 + name: image-build + - catalog: + id: 1 + name: tekton + type: community + categories: + - id: 1 + name: image-build + hubURLPath: tekton/task/buildah + id: 1 + kind: task + latestVersion: + description: Buildah task builds source into a container image and then pushes + it to a container registry. + displayName: Buildah + id: 1 + minPipelinesVersion: 0.12.1 + platforms: + - id: 1 + name: linux/amd64 + rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml + updatedAt: 2020-01-01 12:00:00 +0000 UTC + version: "0.1" + webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml + name: buildah + platforms: + - id: 1 + name: linux/amd64 + rating: 4.3 + tags: + - id: 1 + name: image-build + - catalog: + id: 1 + name: tekton + type: community + categories: + - id: 1 + name: image-build + hubURLPath: tekton/task/buildah + id: 1 + kind: task + latestVersion: + description: Buildah task builds source into a container image and then pushes + it to a container registry. + displayName: Buildah + id: 1 + minPipelinesVersion: 0.12.1 + platforms: + - id: 1 + name: linux/amd64 + rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml + updatedAt: 2020-01-01 12:00:00 +0000 UTC + version: "0.1" + webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml + name: buildah + platforms: + - id: 1 + name: linux/amd64 + rating: 4.3 + tags: + - id: 1 + name: image-build + ResourceListResponseBody: + title: 'Mediatype identifier: application/vnd.hub.resources; view=default' + type: object + properties: + data: + $ref: '#/definitions/ResourceDataResponseBodyWithoutVersionCollection' + description: ListResponseBody result type (default view) + example: + data: + - catalog: + id: 1 + name: tekton + type: community + categories: + - id: 1 + name: image-build + hubURLPath: tekton/task/buildah + id: 1 + kind: task + latestVersion: + description: Buildah task builds source into a container image and then + pushes it to a container registry. + displayName: Buildah + id: 1 + minPipelinesVersion: 0.12.1 + platforms: + - id: 1 + name: linux/amd64 + rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml + updatedAt: 2020-01-01 12:00:00 +0000 UTC + version: "0.1" + webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml + name: buildah + platforms: + - id: 1 + name: linux/amd64 + rating: 4.3 + tags: + - id: 1 + name: image-build + - catalog: + id: 1 + name: tekton + type: community + categories: + - id: 1 + name: image-build + hubURLPath: tekton/task/buildah + id: 1 + kind: task + latestVersion: + description: Buildah task builds source into a container image and then + pushes it to a container registry. + displayName: Buildah + id: 1 + minPipelinesVersion: 0.12.1 + platforms: + - id: 1 + name: linux/amd64 + rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml + updatedAt: 2020-01-01 12:00:00 +0000 UTC + version: "0.1" + webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml + name: buildah + platforms: + - id: 1 + name: linux/amd64 + rating: 4.3 + tags: + - id: 1 + name: image-build + - catalog: + id: 1 + name: tekton + type: community + categories: + - id: 1 + name: image-build + hubURLPath: tekton/task/buildah + id: 1 + kind: task + latestVersion: + description: Buildah task builds source into a container image and then + pushes it to a container registry. + displayName: Buildah + id: 1 + minPipelinesVersion: 0.12.1 + platforms: + - id: 1 + name: linux/amd64 + rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml + updatedAt: 2020-01-01 12:00:00 +0000 UTC + version: "0.1" + webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml + name: buildah + platforms: + - id: 1 + name: linux/amd64 + rating: 4.3 + tags: + - id: 1 + name: image-build + - catalog: + id: 1 + name: tekton + type: community + categories: + - id: 1 + name: image-build + hubURLPath: tekton/task/buildah + id: 1 + kind: task + latestVersion: + description: Buildah task builds source into a container image and then + pushes it to a container registry. + displayName: Buildah + id: 1 + minPipelinesVersion: 0.12.1 + platforms: + - id: 1 + name: linux/amd64 + rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml + updatedAt: 2020-01-01 12:00:00 +0000 UTC + version: "0.1" + webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml + name: buildah + platforms: + - id: 1 + name: linux/amd64 + rating: 4.3 + tags: + - id: 1 + name: image-build + required: + - data + ResourceVersionDataResponseBodyWithoutResource: + title: 'Mediatype identifier: application/vnd.hub.resource.version.data; view=default' + type: object + properties: + deprecated: + type: boolean + description: Deprecation status of a version + example: true + description: + type: string + description: Description of version + example: Buildah task builds source into a container image and then pushes + it to a container registry. + displayName: + type: string + description: Display name of version + example: Buildah + hubURLPath: + type: string + description: Url path of the resource in hub + example: tekton/task/buildah + id: + type: integer + description: ID is the unique id of resource's version + example: 1 + format: int64 + minPipelinesVersion: + type: string + description: Minimum pipelines version the resource's version is compatible + with + example: 0.12.1 + platforms: + type: array + items: + $ref: '#/definitions/PlatformResponseBody' + description: Platforms related to resource version + example: + - id: 1 + name: linux/s390x + rawURL: + type: string + description: Raw URL of resource's yaml file of the version + example: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml + format: uri + updatedAt: + type: string + description: Timestamp when version was last updated + example: 2020-01-01 12:00:00 +0000 UTC + format: date-time + version: + type: string + description: Version of resource + example: "0.1" + webURL: + type: string + description: Web URL of resource's yaml file of the version + example: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml + format: uri + description: The Version result type describes resource's version information. + (default view) + example: + deprecated: true + description: Buildah task builds source into a container image and then pushes + it to a container registry. + displayName: Buildah + hubURLPath: tekton/task/buildah + id: 1 + minPipelinesVersion: 0.12.1 + platforms: + - id: 1 + name: linux/s390x + rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml + updatedAt: 2020-01-01 12:00:00 +0000 UTC + version: "0.1" + webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml + required: + - id + - version + - displayName + - description + - minPipelinesVersion + - rawURL + - webURL + - updatedAt + - platforms + - hubURLPath StatusStatusResponseBody: title: StatusStatusResponseBody type: object @@ -1581,9 +2096,6 @@ definitions: - error: unable to reach db name: api status: ok - - error: unable to reach db - name: api - status: ok example: services: - error: unable to reach db @@ -1595,6 +2107,28 @@ definitions: - error: unable to reach db name: api status: ok + - error: unable to reach db + name: api + status: ok + TagResponseBody: + title: TagResponseBody + type: object + properties: + id: + type: integer + description: ID is the unique id of tag + example: 1 + format: int64 + name: + type: string + description: Name of tag + example: image-build + example: + id: 1 + name: image-build + required: + - id + - name securityDefinitions: jwt_header_Authorization: type: apiKey diff --git a/api/gen/http/openapi3.json b/api/gen/http/openapi3.json index 1532bc1e9b..d614d933c7 100644 --- a/api/gen/http/openapi3.json +++ b/api/gen/http/openapi3.json @@ -1 +1 @@ -{"openapi":"3.0.3","info":{"title":"Tekton Hub","description":"HTTP services for managing Tekton Hub","version":"1.0"},"servers":[{"url":"https://api.hub.tekton.dev"}],"paths":{"/":{"get":{"tags":["status"],"summary":"Status status","description":"Return status of the services","operationId":"status#Status","responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusResponseBody"},"example":{"services":[{"error":"unable to reach db","name":"api","status":"ok"},{"error":"unable to reach db","name":"api","status":"ok"},{"error":"unable to reach db","name":"api","status":"ok"},{"error":"unable to reach db","name":"api","status":"ok"}]}}}}}}},"/catalog/refresh":{"post":{"tags":["catalog"],"summary":"RefreshAll catalog","description":"Refresh all catalogs","operationId":"catalog#RefreshAll","responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Job"},"example":[{"catalogName":"tekton","id":1,"status":"queued"},{"catalogName":"tekton","id":1,"status":"queued"},{"catalogName":"tekton","id":1,"status":"queued"},{"catalogName":"tekton","id":1,"status":"queued"}]},"example":[{"catalogName":"tekton","id":1,"status":"queued"},{"catalogName":"tekton","id":1,"status":"queued"}]}}},"500":{"description":"Internal Server Error response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"id":"3F1FKVRR","message":"Value of ID must be an integer","name":"bad_request"}}}}},"security":[{"jwt_header_Authorization":["rating:read","rating:write","agent:create","catalog:refresh","config:refresh","refresh:token"]}]}},"/catalog/{catalogName}/error":{"get":{"tags":["catalog"],"summary":"CatalogError catalog","description":"List all errors occurred refreshing a catalog","operationId":"catalog#CatalogError","parameters":[{"name":"catalogName","in":"path","description":"Name of catalog","required":true,"schema":{"type":"string","description":"Name of catalog","example":"tekton"},"example":"tekton"}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogErrorResponseBody"},"example":{"data":[{"errors":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"],"type":"warning"},{"errors":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"],"type":"warning"}]}}}},"500":{"description":"Internal Server Error response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"id":"3F1FKVRR","message":"Value of ID must be an integer","name":"bad_request"}}}}},"security":[{"jwt_header_Authorization":["rating:read","rating:write","agent:create","catalog:refresh","config:refresh","refresh:token"]}]}},"/catalog/{catalogName}/refresh":{"post":{"tags":["catalog"],"summary":"Refresh catalog","description":"Refresh a Catalog by it's name","operationId":"catalog#Refresh","parameters":[{"name":"catalogName","in":"path","description":"Name of catalog","required":true,"schema":{"type":"string","description":"Name of catalog","example":"tekton"},"example":"tekton"}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"},"example":{"catalogName":"tekton","id":1,"status":"queued"}}}},"404":{"description":"Not Found response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"id":"3F1FKVRR","message":"Value of ID must be an integer","name":"bad_request"}}}},"500":{"description":"Internal Server Error response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"id":"3F1FKVRR","message":"Value of ID must be an integer","name":"bad_request"}}}}},"security":[{"jwt_header_Authorization":["rating:read","rating:write","agent:create","catalog:refresh","config:refresh","refresh:token"]}]}},"/categories":{"get":{"tags":["category"],"summary":"list category","description":"List all categories along with their tags sorted by name","operationId":"category#list","responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListResponseBody"},"example":{"data":[{"id":1,"name":"Image Builder"},{"id":1,"name":"Image Builder"},{"id":1,"name":"Image Builder"},{"id":1,"name":"Image Builder"}]}}}},"500":{"description":"Internal Server Error response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"id":"3F1FKVRR","message":"Value of ID must be an integer","name":"bad_request"}}}}}}},"/resource/{id}/rating":{"get":{"tags":["rating"],"summary":"Get rating","description":"Find user's rating for a resource","operationId":"rating#Get","parameters":[{"name":"id","in":"path","description":"ID of a resource","required":true,"schema":{"type":"integer","description":"ID of a resource","example":17081788299688252022},"example":11089527418313215274}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetResponseBody"},"example":{"rating":4}}}},"401":{"description":"Unauthorized response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"id":"3F1FKVRR","message":"Value of ID must be an integer","name":"bad_request"}}}},"403":{"description":"Forbidden response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"id":"3F1FKVRR","message":"Value of ID must be an integer","name":"bad_request"}}}},"404":{"description":"Not Found response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"id":"3F1FKVRR","message":"Value of ID must be an integer","name":"bad_request"}}}},"500":{"description":"Internal Server Error response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"id":"3F1FKVRR","message":"Value of ID must be an integer","name":"bad_request"}}}}},"security":[{"jwt_header_Authorization":["rating:read","rating:write","agent:create","catalog:refresh","config:refresh","refresh:token"]}]},"put":{"tags":["rating"],"summary":"Update rating","description":"Update user's rating for a resource","operationId":"rating#Update","parameters":[{"name":"id","in":"path","description":"ID of a resource","required":true,"schema":{"type":"integer","description":"ID of a resource","example":9739613307880178607},"example":2070151992422837927}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateRequestBody"},"example":{"rating":0}}}},"responses":{"200":{"description":"OK response."},"401":{"description":"Unauthorized response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"id":"3F1FKVRR","message":"Value of ID must be an integer","name":"bad_request"}}}},"403":{"description":"Forbidden response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"id":"3F1FKVRR","message":"Value of ID must be an integer","name":"bad_request"}}}},"404":{"description":"Not Found response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"id":"3F1FKVRR","message":"Value of ID must be an integer","name":"bad_request"}}}},"500":{"description":"Internal Server Error response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"id":"3F1FKVRR","message":"Value of ID must be an integer","name":"bad_request"}}}}},"security":[{"jwt_header_Authorization":["rating:read","rating:write","agent:create","catalog:refresh","config:refresh","refresh:token"]}]}},"/schema/swagger.json":{"get":{"tags":["swagger"],"summary":"Download docs/openapi3.json","description":"JSON document containing the API swagger definition","operationId":"swagger#/schema/swagger.json","responses":{"200":{"description":"File downloaded"}}}},"/system/config/refresh":{"post":{"tags":["admin"],"summary":"RefreshConfig admin","description":"Refresh the changes in config file","operationId":"admin#RefreshConfig","responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefreshConfigResponseBody"},"example":{"checksum":"41ba391c8baf1fcd3c62c11272b913dc6613f4cf3b1833cfbb32431dc4384c93"}}}},"401":{"description":"Unauthorized response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"id":"3F1FKVRR","message":"Value of ID must be an integer","name":"bad_request"}}}},"403":{"description":"Forbidden response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"id":"3F1FKVRR","message":"Value of ID must be an integer","name":"bad_request"}}}},"500":{"description":"Internal Server Error response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"id":"3F1FKVRR","message":"Value of ID must be an integer","name":"bad_request"}}}}},"security":[{"jwt_header_Authorization":["rating:read","rating:write","agent:create","catalog:refresh","config:refresh","refresh:token"]}]}},"/system/user/agent":{"put":{"tags":["admin"],"summary":"UpdateAgent admin","description":"Create or Update an agent user with required scopes","operationId":"admin#UpdateAgent","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAgentRequestBody"},"example":{"name":"abc","scopes":["catalog-refresh","agent:create"]}}}},"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAgentResponseBody"},"example":{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1Nzc4ODAzMDAsImlhdCI6MTU3Nzg4MDAwMCwiaWQiOjExLCJpc3MiOiJUZWt0b24gSHViIiwic2NvcGVzIjpbInJhdGluZzpyZWFkIiwicmF0aW5nOndyaXRlIiwiYWdlbnQ6Y3JlYXRlIl0sInR5cGUiOiJhY2Nlc3MtdG9rZW4ifQ.6pDmziSKkoSqI1f0rc4-AqVdcfY0Q8wA-tSLzdTCLgM"}}}},"400":{"description":"Bad Request response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"id":"3F1FKVRR","message":"Value of ID must be an integer","name":"bad_request"}}}},"401":{"description":"Unauthorized response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"id":"3F1FKVRR","message":"Value of ID must be an integer","name":"bad_request"}}}},"403":{"description":"Forbidden response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"id":"3F1FKVRR","message":"Value of ID must be an integer","name":"bad_request"}}}},"500":{"description":"Internal Server Error response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"id":"3F1FKVRR","message":"Value of ID must be an integer","name":"bad_request"}}}}},"security":[{"jwt_header_Authorization":["rating:read","rating:write","agent:create","catalog:refresh","config:refresh","refresh:token"]}]}},"/v1":{"get":{"tags":["status"],"summary":"Status status","description":"Return status of the services","operationId":"status#Status#1","responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusResponseBody"},"example":{"services":[{"error":"unable to reach db","name":"api","status":"ok"},{"error":"unable to reach db","name":"api","status":"ok"},{"error":"unable to reach db","name":"api","status":"ok"},{"error":"unable to reach db","name":"api","status":"ok"}]}}}}}}},"/v1/categories":{"get":{"tags":["category"],"summary":"list category","description":"List all categories along with their tags sorted by name","operationId":"category#list#1","responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListResponseBody"},"example":{"data":[{"id":1,"name":"Image Builder"},{"id":1,"name":"Image Builder"},{"id":1,"name":"Image Builder"},{"id":1,"name":"Image Builder"}]}}}},"500":{"description":"Internal Server Error response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"id":"3F1FKVRR","message":"Value of ID must be an integer","name":"bad_request"}}}}}}}},"components":{"schemas":{"CatalogErrorResponseBody":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CatalogErrors"},"description":"Catalog errors","example":[{"errors":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"],"type":"warning"},{"errors":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"],"type":"warning"},{"errors":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"],"type":"warning"},{"errors":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"],"type":"warning"}]}},"example":{"data":[{"errors":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"],"type":"warning"},{"errors":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"],"type":"warning"}]},"required":["data"]},"CatalogErrors":{"type":"object","properties":{"errors":{"type":"array","items":{"type":"string","example":"Et nihil aut."},"description":"Catalog Error message","example":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"]},"type":{"type":"string","description":"Catalog Errror type","example":"warning"}},"description":"CatalogErrors define the errors that occurred during catalog refresh","example":{"errors":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"],"type":"warning"},"required":["type","errors"]},"Category":{"type":"object","properties":{"id":{"type":"integer","description":"ID is the unique id of the category","example":1},"name":{"type":"string","description":"Name of category","example":"Image Builder"}},"example":{"id":1,"name":"Image Builder"},"required":["id","name"]},"Error":{"type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?","example":false},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"name":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"temporary":{"type":"boolean","description":"Is the error temporary?","example":false},"timeout":{"type":"boolean","description":"Is the error a timeout?","example":true}},"description":"Invalid request body","example":{"id":"3F1FKVRR","message":"Value of ID must be an integer","name":"bad_request"},"required":["name","id","message","temporary","timeout","fault"]},"GetResponseBody":{"type":"object","properties":{"rating":{"type":"integer","description":"User rating for resource","example":4,"format":"int64"}},"example":{"rating":4},"required":["rating"]},"HubService":{"type":"object","properties":{"error":{"type":"string","description":"Details of the error if any","example":"unable to reach db"},"name":{"type":"string","description":"Name of the service","example":"api"},"status":{"type":"string","description":"Status of the service","example":"ok","enum":["ok","error"]}},"description":"Describes the services and their status","example":{"error":"unable to reach db","name":"api","status":"ok"},"required":["name","status"]},"Job":{"type":"object","properties":{"catalogName":{"type":"string","description":"Name of the catalog","example":"tekton"},"id":{"type":"integer","description":"id of the job","example":1},"status":{"type":"string","description":"status of the job","example":"queued"}},"example":{"catalogName":"tekton","id":1,"status":"queued"},"required":["id","catalogName","status"]},"ListResponseBody":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Category"},"example":[{"id":1,"name":"Image Builder"},{"id":1,"name":"Image Builder"}]}},"example":{"data":[{"id":1,"name":"Image Builder"},{"id":1,"name":"Image Builder"},{"id":1,"name":"Image Builder"}]}},"RefreshConfigResponseBody":{"type":"object","properties":{"checksum":{"type":"string","description":"Config file checksum","example":"41ba391c8baf1fcd3c62c11272b913dc6613f4cf3b1833cfbb32431dc4384c93"}},"example":{"checksum":"41ba391c8baf1fcd3c62c11272b913dc6613f4cf3b1833cfbb32431dc4384c93"},"required":["checksum"]},"StatusResponseBody":{"type":"object","properties":{"services":{"type":"array","items":{"$ref":"#/components/schemas/HubService"},"description":"List of services and their status","example":[{"error":"unable to reach db","name":"api","status":"ok"},{"error":"unable to reach db","name":"api","status":"ok"}]}},"example":{"services":[{"error":"unable to reach db","name":"api","status":"ok"},{"error":"unable to reach db","name":"api","status":"ok"},{"error":"unable to reach db","name":"api","status":"ok"}]}},"UpdateAgentRequestBody":{"type":"object","properties":{"name":{"type":"string","description":"Name of Agent","example":"abc"},"scopes":{"type":"array","items":{"type":"string","example":"Voluptas beatae id qui."},"description":"Scopes required for Agent","example":["catalog-refresh","agent:create"]}},"example":{"name":"abc","scopes":["catalog-refresh","agent:create"]},"required":["name","scopes"]},"UpdateAgentResponseBody":{"type":"object","properties":{"token":{"type":"string","description":"Agent JWT","example":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1Nzc4ODAzMDAsImlhdCI6MTU3Nzg4MDAwMCwiaWQiOjExLCJpc3MiOiJUZWt0b24gSHViIiwic2NvcGVzIjpbInJhdGluZzpyZWFkIiwicmF0aW5nOndyaXRlIiwiYWdlbnQ6Y3JlYXRlIl0sInR5cGUiOiJhY2Nlc3MtdG9rZW4ifQ.6pDmziSKkoSqI1f0rc4-AqVdcfY0Q8wA-tSLzdTCLgM"}},"example":{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1Nzc4ODAzMDAsImlhdCI6MTU3Nzg4MDAwMCwiaWQiOjExLCJpc3MiOiJUZWt0b24gSHViIiwic2NvcGVzIjpbInJhdGluZzpyZWFkIiwicmF0aW5nOndyaXRlIiwiYWdlbnQ6Y3JlYXRlIl0sInR5cGUiOiJhY2Nlc3MtdG9rZW4ifQ.6pDmziSKkoSqI1f0rc4-AqVdcfY0Q8wA-tSLzdTCLgM"},"required":["token"]},"UpdateRequestBody":{"type":"object","properties":{"rating":{"type":"integer","description":"User rating for resource","example":2,"minimum":0,"maximum":5}},"example":{"rating":3},"required":["rating"]}},"securitySchemes":{"jwt_header_Authorization":{"type":"http","description":"Secures endpoint by requiring a valid JWT retrieved via the /auth/login endpoint.","scheme":"bearer"}}}} \ No newline at end of file +{"openapi":"3.0.3","info":{"title":"Tekton Hub","description":"HTTP services for managing Tekton Hub","version":"1.0"},"servers":[{"url":"https://api.hub.tekton.dev"}],"paths":{"/":{"get":{"tags":["status"],"summary":"Status status","description":"Return status of the services","operationId":"status#Status","responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusResponseBody"},"example":{"services":[{"error":"unable to reach db","name":"api","status":"ok"},{"error":"unable to reach db","name":"api","status":"ok"}]}}}}}}},"/catalog/refresh":{"post":{"tags":["catalog"],"summary":"RefreshAll catalog","description":"Refresh all catalogs","operationId":"catalog#RefreshAll","responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Job"},"example":[{"catalogName":"tekton","id":1,"status":"queued"},{"catalogName":"tekton","id":1,"status":"queued"},{"catalogName":"tekton","id":1,"status":"queued"}]},"example":[{"catalogName":"tekton","id":1,"status":"queued"},{"catalogName":"tekton","id":1,"status":"queued"},{"catalogName":"tekton","id":1,"status":"queued"},{"catalogName":"tekton","id":1,"status":"queued"}]}}},"500":{"description":"Internal Server Error response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"id":"3F1FKVRR","message":"Value of ID must be an integer","name":"bad_request"}}}}},"security":[{"jwt_header_Authorization":["rating:read","rating:write","agent:create","catalog:refresh","config:refresh","refresh:token"]}]}},"/catalog/{catalogName}/error":{"get":{"tags":["catalog"],"summary":"CatalogError catalog","description":"List all errors occurred refreshing a catalog","operationId":"catalog#CatalogError","parameters":[{"name":"catalogName","in":"path","description":"Name of catalog","required":true,"schema":{"type":"string","description":"Name of catalog","example":"tekton"},"example":"tekton"}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogErrorResponseBody"},"example":{"data":[{"errors":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"],"type":"warning"},{"errors":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"],"type":"warning"},{"errors":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"],"type":"warning"}]}}}},"500":{"description":"Internal Server Error response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"id":"3F1FKVRR","message":"Value of ID must be an integer","name":"bad_request"}}}}},"security":[{"jwt_header_Authorization":["rating:read","rating:write","agent:create","catalog:refresh","config:refresh","refresh:token"]}]}},"/catalog/{catalogName}/refresh":{"post":{"tags":["catalog"],"summary":"Refresh catalog","description":"Refresh a Catalog by it's name","operationId":"catalog#Refresh","parameters":[{"name":"catalogName","in":"path","description":"Name of catalog","required":true,"schema":{"type":"string","description":"Name of catalog","example":"tekton"},"example":"tekton"}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"},"example":{"catalogName":"tekton","id":1,"status":"queued"}}}},"404":{"description":"Not Found response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"id":"3F1FKVRR","message":"Value of ID must be an integer","name":"bad_request"}}}},"500":{"description":"Internal Server Error response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"id":"3F1FKVRR","message":"Value of ID must be an integer","name":"bad_request"}}}}},"security":[{"jwt_header_Authorization":["rating:read","rating:write","agent:create","catalog:refresh","config:refresh","refresh:token"]}]}},"/categories":{"get":{"tags":["category"],"summary":"list category","description":"List all categories along with their tags sorted by name","operationId":"category#list","responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListResponseBody"},"example":{"data":[{"id":1,"name":"Image Builder"},{"id":1,"name":"Image Builder"},{"id":1,"name":"Image Builder"}]}}}},"500":{"description":"Internal Server Error response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"id":"3F1FKVRR","message":"Value of ID must be an integer","name":"bad_request"}}}}}}},"/resource/{id}/rating":{"get":{"tags":["rating"],"summary":"Get rating","description":"Find user's rating for a resource","operationId":"rating#Get","parameters":[{"name":"id","in":"path","description":"ID of a resource","required":true,"schema":{"type":"integer","description":"ID of a resource","example":11641146429081913029},"example":5020310314104480935}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetResponseBody"},"example":{"rating":4}}}},"401":{"description":"Unauthorized response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"id":"3F1FKVRR","message":"Value of ID must be an integer","name":"bad_request"}}}},"403":{"description":"Forbidden response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"id":"3F1FKVRR","message":"Value of ID must be an integer","name":"bad_request"}}}},"404":{"description":"Not Found response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"id":"3F1FKVRR","message":"Value of ID must be an integer","name":"bad_request"}}}},"500":{"description":"Internal Server Error response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"id":"3F1FKVRR","message":"Value of ID must be an integer","name":"bad_request"}}}}},"security":[{"jwt_header_Authorization":["rating:read","rating:write","agent:create","catalog:refresh","config:refresh","refresh:token"]}]},"put":{"tags":["rating"],"summary":"Update rating","description":"Update user's rating for a resource","operationId":"rating#Update","parameters":[{"name":"id","in":"path","description":"ID of a resource","required":true,"schema":{"type":"integer","description":"ID of a resource","example":58321475046400437},"example":14996331923821697327}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateRequestBody"},"example":{"rating":0}}}},"responses":{"200":{"description":"OK response."},"401":{"description":"Unauthorized response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"id":"3F1FKVRR","message":"Value of ID must be an integer","name":"bad_request"}}}},"403":{"description":"Forbidden response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"id":"3F1FKVRR","message":"Value of ID must be an integer","name":"bad_request"}}}},"404":{"description":"Not Found response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"id":"3F1FKVRR","message":"Value of ID must be an integer","name":"bad_request"}}}},"500":{"description":"Internal Server Error response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"id":"3F1FKVRR","message":"Value of ID must be an integer","name":"bad_request"}}}}},"security":[{"jwt_header_Authorization":["rating:read","rating:write","agent:create","catalog:refresh","config:refresh","refresh:token"]}]}},"/resources":{"get":{"tags":["resource"],"summary":"List resource","description":"List all resources sorted by rating and name","operationId":"resource#List","responses":{"301":{"description":"Moved Permanently response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Resources"},"example":{"data":[{"catalog":{"id":1,"name":"tekton","type":"community"},"categories":[{"id":1,"name":"image-build"}],"hubURLPath":"tekton/task/buildah","id":1,"kind":"task","latestVersion":{"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/amd64"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},"name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}],"versions":[{"id":1,"version":"0.1"},{"id":2,"version":"0.2"}]},{"catalog":{"id":1,"name":"tekton","type":"community"},"categories":[{"id":1,"name":"image-build"}],"hubURLPath":"tekton/task/buildah","id":1,"kind":"task","latestVersion":{"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/amd64"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},"name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}],"versions":[{"id":1,"version":"0.1"},{"id":2,"version":"0.2"}]},{"catalog":{"id":1,"name":"tekton","type":"community"},"categories":[{"id":1,"name":"image-build"}],"hubURLPath":"tekton/task/buildah","id":1,"kind":"task","latestVersion":{"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/amd64"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},"name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}],"versions":[{"id":1,"version":"0.1"},{"id":2,"version":"0.2"}]},{"catalog":{"id":1,"name":"tekton","type":"community"},"categories":[{"id":1,"name":"image-build"}],"hubURLPath":"tekton/task/buildah","id":1,"kind":"task","latestVersion":{"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/amd64"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},"name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}],"versions":[{"id":1,"version":"0.1"},{"id":2,"version":"0.2"}]}]}}}}}}},"/schema/swagger.json":{"get":{"tags":["swagger"],"summary":"Download docs/openapi3.json","description":"JSON document containing the API swagger definition","operationId":"swagger#/schema/swagger.json","responses":{"200":{"description":"File downloaded"}}}},"/system/config/refresh":{"post":{"tags":["admin"],"summary":"RefreshConfig admin","description":"Refresh the changes in config file","operationId":"admin#RefreshConfig","responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefreshConfigResponseBody"},"example":{"checksum":"41ba391c8baf1fcd3c62c11272b913dc6613f4cf3b1833cfbb32431dc4384c93"}}}},"401":{"description":"Unauthorized response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"id":"3F1FKVRR","message":"Value of ID must be an integer","name":"bad_request"}}}},"403":{"description":"Forbidden response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"id":"3F1FKVRR","message":"Value of ID must be an integer","name":"bad_request"}}}},"500":{"description":"Internal Server Error response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"id":"3F1FKVRR","message":"Value of ID must be an integer","name":"bad_request"}}}}},"security":[{"jwt_header_Authorization":["rating:read","rating:write","agent:create","catalog:refresh","config:refresh","refresh:token"]}]}},"/system/user/agent":{"put":{"tags":["admin"],"summary":"UpdateAgent admin","description":"Create or Update an agent user with required scopes","operationId":"admin#UpdateAgent","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAgentRequestBody"},"example":{"name":"abc","scopes":["catalog-refresh","agent:create"]}}}},"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAgentResponseBody"},"example":{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1Nzc4ODAzMDAsImlhdCI6MTU3Nzg4MDAwMCwiaWQiOjExLCJpc3MiOiJUZWt0b24gSHViIiwic2NvcGVzIjpbInJhdGluZzpyZWFkIiwicmF0aW5nOndyaXRlIiwiYWdlbnQ6Y3JlYXRlIl0sInR5cGUiOiJhY2Nlc3MtdG9rZW4ifQ.6pDmziSKkoSqI1f0rc4-AqVdcfY0Q8wA-tSLzdTCLgM"}}}},"400":{"description":"Bad Request response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"id":"3F1FKVRR","message":"Value of ID must be an integer","name":"bad_request"}}}},"401":{"description":"Unauthorized response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"id":"3F1FKVRR","message":"Value of ID must be an integer","name":"bad_request"}}}},"403":{"description":"Forbidden response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"id":"3F1FKVRR","message":"Value of ID must be an integer","name":"bad_request"}}}},"500":{"description":"Internal Server Error response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"id":"3F1FKVRR","message":"Value of ID must be an integer","name":"bad_request"}}}}},"security":[{"jwt_header_Authorization":["rating:read","rating:write","agent:create","catalog:refresh","config:refresh","refresh:token"]}]}},"/v1":{"get":{"tags":["status"],"summary":"Status status","description":"Return status of the services","operationId":"status#Status#1","responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusResponseBody"},"example":{"services":[{"error":"unable to reach db","name":"api","status":"ok"},{"error":"unable to reach db","name":"api","status":"ok"}]}}}}}}},"/v1/categories":{"get":{"tags":["category"],"summary":"list category","description":"List all categories along with their tags sorted by name","operationId":"category#list#1","responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListResponseBody"},"example":{"data":[{"id":1,"name":"Image Builder"},{"id":1,"name":"Image Builder"},{"id":1,"name":"Image Builder"}]}}}},"500":{"description":"Internal Server Error response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"id":"3F1FKVRR","message":"Value of ID must be an integer","name":"bad_request"}}}}}}}},"components":{"schemas":{"Catalog":{"type":"object","properties":{"id":{"type":"integer","description":"ID is the unique id of the catalog","example":1},"name":{"type":"string","description":"Name of catalog","example":"Tekton"},"provider":{"type":"string","description":"Provider of catalog","example":"github"},"type":{"type":"string","description":"Type of catalog","example":"community","enum":["official","community"]},"url":{"type":"string","description":"URL of catalog","example":"https://github.com/tektoncd/hub"}},"example":{"id":1,"name":"Tekton","provider":"github","type":"community","url":"https://github.com/tektoncd/hub"},"required":["id","name","type","url","provider"]},"CatalogErrorResponseBody":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CatalogErrors"},"description":"Catalog errors","example":[{"errors":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"],"type":"warning"},{"errors":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"],"type":"warning"},{"errors":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"],"type":"warning"}]}},"example":{"data":[{"errors":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"],"type":"warning"},{"errors":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"],"type":"warning"}]},"required":["data"]},"CatalogErrors":{"type":"object","properties":{"errors":{"type":"array","items":{"type":"string","example":"Quidem magni."},"description":"Catalog Error message","example":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"]},"type":{"type":"string","description":"Catalog Errror type","example":"warning"}},"description":"CatalogErrors define the errors that occurred during catalog refresh","example":{"errors":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"],"type":"warning"},"required":["type","errors"]},"Category":{"type":"object","properties":{"id":{"type":"integer","description":"ID is the unique id of the category","example":1},"name":{"type":"string","description":"Name of category","example":"Image Builder"}},"example":{"id":1,"name":"Image Builder"},"required":["id","name"]},"Error":{"type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?","example":true},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"name":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"temporary":{"type":"boolean","description":"Is the error temporary?","example":true},"timeout":{"type":"boolean","description":"Is the error a timeout?","example":true}},"description":"Invalid request body","example":{"id":"3F1FKVRR","message":"Value of ID must be an integer","name":"bad_request"},"required":["name","id","message","temporary","timeout","fault"]},"GetResponseBody":{"type":"object","properties":{"rating":{"type":"integer","description":"User rating for resource","example":4,"format":"int64"}},"example":{"rating":4},"required":["rating"]},"HubService":{"type":"object","properties":{"error":{"type":"string","description":"Details of the error if any","example":"unable to reach db"},"name":{"type":"string","description":"Name of the service","example":"api"},"status":{"type":"string","description":"Status of the service","example":"ok","enum":["ok","error"]}},"description":"Describes the services and their status","example":{"error":"unable to reach db","name":"api","status":"ok"},"required":["name","status"]},"Job":{"type":"object","properties":{"catalogName":{"type":"string","description":"Name of the catalog","example":"tekton"},"id":{"type":"integer","description":"id of the job","example":1},"status":{"type":"string","description":"status of the job","example":"queued"}},"example":{"catalogName":"tekton","id":1,"status":"queued"},"required":["id","catalogName","status"]},"ListResponseBody":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Category"},"example":[{"id":1,"name":"Image Builder"},{"id":1,"name":"Image Builder"},{"id":1,"name":"Image Builder"}]}},"example":{"data":[{"id":1,"name":"Image Builder"},{"id":1,"name":"Image Builder"}]}},"RefreshConfigResponseBody":{"type":"object","properties":{"checksum":{"type":"string","description":"Config file checksum","example":"41ba391c8baf1fcd3c62c11272b913dc6613f4cf3b1833cfbb32431dc4384c93"}},"example":{"checksum":"41ba391c8baf1fcd3c62c11272b913dc6613f4cf3b1833cfbb32431dc4384c93"},"required":["checksum"]},"ResourceData":{"type":"object","properties":{"catalog":{"$ref":"#/components/schemas/Catalog"},"categories":{"type":"array","items":{"$ref":"#/components/schemas/Category"},"description":"Categories related to resource","example":[{"id":1,"name":"image-build"}]},"hubURLPath":{"type":"string","description":"Url path of the resource in hub","example":"tekton/task/buildah"},"id":{"type":"integer","description":"ID is the unique id of the resource","example":1},"kind":{"type":"string","description":"Kind of resource","example":"task"},"latestVersion":{"$ref":"#/components/schemas/ResourceVersionData"},"name":{"type":"string","description":"Name of resource","example":"buildah"},"platforms":{"type":"array","items":{"$ref":"#/components/schemas/Category"},"description":"Platforms related to resource","example":[{"id":1,"name":"linux/amd64"}]},"rating":{"type":"number","description":"Rating of resource","example":4.3,"format":"double"},"tags":{"type":"array","items":{"$ref":"#/components/schemas/Category"},"description":"Tags related to resource","example":[{"id":1,"name":"image-build"}]},"versions":{"type":"array","items":{"$ref":"#/components/schemas/ResourceVersionData"},"description":"List of all versions of a resource","example":[{"id":1,"version":"0.1"},{"id":2,"version":"0.2"}]}},"description":"The resource type describes resource information.","example":{"catalog":{"id":1,"name":"tekton","type":"community"},"categories":[{"id":1,"name":"image-build"}],"hubURLPath":"tekton/task/buildah","id":1,"kind":"task","latestVersion":{"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/amd64"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},"name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}],"versions":[{"id":1,"version":"0.1"},{"id":2,"version":"0.2"}]},"required":["id","name","catalog","categories","kind","hubURLPath","latestVersion","tags","platforms","rating","versions"]},"ResourceDataCollection":{"type":"array","items":{"$ref":"#/components/schemas/ResourceData"},"example":[{"catalog":{"id":1,"name":"tekton","type":"community"},"categories":[{"id":1,"name":"image-build"}],"hubURLPath":"tekton/task/buildah","id":1,"kind":"task","latestVersion":{"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/amd64"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},"name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}],"versions":[{"id":1,"version":"0.1"},{"id":2,"version":"0.2"}]},{"catalog":{"id":1,"name":"tekton","type":"community"},"categories":[{"id":1,"name":"image-build"}],"hubURLPath":"tekton/task/buildah","id":1,"kind":"task","latestVersion":{"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/amd64"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},"name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}],"versions":[{"id":1,"version":"0.1"},{"id":2,"version":"0.2"}]}]},"ResourceVersionData":{"type":"object","properties":{"deprecated":{"type":"boolean","description":"Deprecation status of a version","example":true},"description":{"type":"string","description":"Description of version","example":"Buildah task builds source into a container image and then pushes it to a container registry."},"displayName":{"type":"string","description":"Display name of version","example":"Buildah"},"hubURLPath":{"type":"string","description":"Url path of the resource in hub","example":"tekton/task/buildah"},"id":{"type":"integer","description":"ID is the unique id of resource's version","example":1},"minPipelinesVersion":{"type":"string","description":"Minimum pipelines version the resource's version is compatible with","example":"0.12.1"},"platforms":{"type":"array","items":{"$ref":"#/components/schemas/Category"},"description":"Platforms related to resource version","example":[{"id":1,"name":"linux/s390x"}]},"rawURL":{"type":"string","description":"Raw URL of resource's yaml file of the version","example":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","format":"uri"},"resource":{"$ref":"#/components/schemas/ResourceData"},"updatedAt":{"type":"string","description":"Timestamp when version was last updated","example":"2020-01-01 12:00:00 +0000 UTC","format":"date-time"},"version":{"type":"string","description":"Version of resource","example":"0.1"},"webURL":{"type":"string","description":"Web URL of resource's yaml file of the version","example":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml","format":"uri"}},"description":"The Version result type describes resource's version information.","example":{"deprecated":true,"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","hubURLPath":"tekton/task/buildah","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/s390x"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","resource":{"catalog":{"id":1,"type":"community"},"categories":[{"id":1,"name":"Build Tools"}],"id":1,"kind":"task","name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}]},"updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},"required":["id","version","displayName","description","minPipelinesVersion","rawURL","webURL","updatedAt","platforms","resource","hubURLPath"]},"Resources":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ResourceDataCollection"}},"example":{"data":[{"catalog":{"id":1,"name":"tekton","type":"community"},"categories":[{"id":1,"name":"image-build"}],"hubURLPath":"tekton/task/buildah","id":1,"kind":"task","latestVersion":{"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/amd64"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},"name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}],"versions":[{"id":1,"version":"0.1"},{"id":2,"version":"0.2"}]},{"catalog":{"id":1,"name":"tekton","type":"community"},"categories":[{"id":1,"name":"image-build"}],"hubURLPath":"tekton/task/buildah","id":1,"kind":"task","latestVersion":{"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/amd64"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},"name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}],"versions":[{"id":1,"version":"0.1"},{"id":2,"version":"0.2"}]},{"catalog":{"id":1,"name":"tekton","type":"community"},"categories":[{"id":1,"name":"image-build"}],"hubURLPath":"tekton/task/buildah","id":1,"kind":"task","latestVersion":{"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/amd64"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},"name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}],"versions":[{"id":1,"version":"0.1"},{"id":2,"version":"0.2"}]},{"catalog":{"id":1,"name":"tekton","type":"community"},"categories":[{"id":1,"name":"image-build"}],"hubURLPath":"tekton/task/buildah","id":1,"kind":"task","latestVersion":{"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/amd64"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},"name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}],"versions":[{"id":1,"version":"0.1"},{"id":2,"version":"0.2"}]}]},"required":["data"]},"StatusResponseBody":{"type":"object","properties":{"services":{"type":"array","items":{"$ref":"#/components/schemas/HubService"},"description":"List of services and their status","example":[{"error":"unable to reach db","name":"api","status":"ok"},{"error":"unable to reach db","name":"api","status":"ok"}]}},"example":{"services":[{"error":"unable to reach db","name":"api","status":"ok"},{"error":"unable to reach db","name":"api","status":"ok"},{"error":"unable to reach db","name":"api","status":"ok"}]}},"UpdateAgentRequestBody":{"type":"object","properties":{"name":{"type":"string","description":"Name of Agent","example":"abc"},"scopes":{"type":"array","items":{"type":"string","example":"Beatae id qui quia consequatur possimus tempora."},"description":"Scopes required for Agent","example":["catalog-refresh","agent:create"]}},"example":{"name":"abc","scopes":["catalog-refresh","agent:create"]},"required":["name","scopes"]},"UpdateAgentResponseBody":{"type":"object","properties":{"token":{"type":"string","description":"Agent JWT","example":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1Nzc4ODAzMDAsImlhdCI6MTU3Nzg4MDAwMCwiaWQiOjExLCJpc3MiOiJUZWt0b24gSHViIiwic2NvcGVzIjpbInJhdGluZzpyZWFkIiwicmF0aW5nOndyaXRlIiwiYWdlbnQ6Y3JlYXRlIl0sInR5cGUiOiJhY2Nlc3MtdG9rZW4ifQ.6pDmziSKkoSqI1f0rc4-AqVdcfY0Q8wA-tSLzdTCLgM"}},"example":{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1Nzc4ODAzMDAsImlhdCI6MTU3Nzg4MDAwMCwiaWQiOjExLCJpc3MiOiJUZWt0b24gSHViIiwic2NvcGVzIjpbInJhdGluZzpyZWFkIiwicmF0aW5nOndyaXRlIiwiYWdlbnQ6Y3JlYXRlIl0sInR5cGUiOiJhY2Nlc3MtdG9rZW4ifQ.6pDmziSKkoSqI1f0rc4-AqVdcfY0Q8wA-tSLzdTCLgM"},"required":["token"]},"UpdateRequestBody":{"type":"object","properties":{"rating":{"type":"integer","description":"User rating for resource","example":4,"minimum":0,"maximum":5}},"example":{"rating":3},"required":["rating"]}},"securitySchemes":{"jwt_header_Authorization":{"type":"http","description":"Secures endpoint by requiring a valid JWT retrieved via the /auth/login endpoint.","scheme":"bearer"}}},"tags":[{"name":"swagger","description":"The swagger service serves the API swagger definition."},{"name":"admin","description":"Admin service"},{"name":"catalog","description":"The Catalog Service exposes endpoints to interact with catalogs"},{"name":"category","description":"The category service provides details about category"},{"name":"rating","description":"The rating service exposes endpoints to read and write user's rating for resources"},{"name":"resource","description":"The resource service provides details about all kind of resources"},{"name":"status","description":"Describes the status of each service"}]} \ No newline at end of file diff --git a/api/gen/http/openapi3.yaml b/api/gen/http/openapi3.yaml index 50b3cfa71e..b892b85174 100644 --- a/api/gen/http/openapi3.yaml +++ b/api/gen/http/openapi3.yaml @@ -28,12 +28,6 @@ paths: - error: unable to reach db name: api status: ok - - error: unable to reach db - name: api - status: ok - - error: unable to reach db - name: api - status: ok /catalog/{catalogName}/error: get: tags: @@ -70,6 +64,11 @@ paths: name - Resource tekton.dev/v1beta1, Kind=task - curl has no display name type: warning + - errors: + - Resource tekton.dev/v1beta1, Kind=Task - buildah has no display + name + - Resource tekton.dev/v1beta1, Kind=task - curl has no display name + type: warning "500": description: Internal Server Error response. content: @@ -170,9 +169,6 @@ paths: - catalogName: tekton id: 1 status: queued - - catalogName: tekton - id: 1 - status: queued example: - catalogName: tekton id: 1 @@ -180,6 +176,12 @@ paths: - catalogName: tekton id: 1 status: queued + - catalogName: tekton + id: 1 + status: queued + - catalogName: tekton + id: 1 + status: queued "500": description: Internal Server Error response. content: @@ -220,8 +222,6 @@ paths: name: Image Builder - id: 1 name: Image Builder - - id: 1 - name: Image Builder "500": description: Internal Server Error response. content: @@ -247,8 +247,8 @@ paths: schema: type: integer description: ID of a resource - example: 17081788299688252022 - example: 11089527418313215274 + example: 11641146429081913029 + example: 5020310314104480935 responses: "200": description: OK response. @@ -320,8 +320,8 @@ paths: schema: type: integer description: ID of a resource - example: 9739613307880178607 - example: 2070151992422837927 + example: 58321475046400437 + example: 14996331923821697327 requestBody: required: true content: @@ -381,6 +381,166 @@ paths: - catalog:refresh - config:refresh - refresh:token + /resources: + get: + tags: + - resource + summary: List resource + description: List all resources sorted by rating and name + operationId: resource#List + responses: + "301": + description: Moved Permanently response. + content: + application/json: + schema: + $ref: '#/components/schemas/Resources' + example: + data: + - catalog: + id: 1 + name: tekton + type: community + categories: + - id: 1 + name: image-build + hubURLPath: tekton/task/buildah + id: 1 + kind: task + latestVersion: + description: Buildah task builds source into a container image + and then pushes it to a container registry. + displayName: Buildah + id: 1 + minPipelinesVersion: 0.12.1 + platforms: + - id: 1 + name: linux/amd64 + rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml + updatedAt: 2020-01-01 12:00:00 +0000 UTC + version: "0.1" + webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml + name: buildah + platforms: + - id: 1 + name: linux/amd64 + rating: 4.3 + tags: + - id: 1 + name: image-build + versions: + - id: 1 + version: "0.1" + - id: 2 + version: "0.2" + - catalog: + id: 1 + name: tekton + type: community + categories: + - id: 1 + name: image-build + hubURLPath: tekton/task/buildah + id: 1 + kind: task + latestVersion: + description: Buildah task builds source into a container image + and then pushes it to a container registry. + displayName: Buildah + id: 1 + minPipelinesVersion: 0.12.1 + platforms: + - id: 1 + name: linux/amd64 + rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml + updatedAt: 2020-01-01 12:00:00 +0000 UTC + version: "0.1" + webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml + name: buildah + platforms: + - id: 1 + name: linux/amd64 + rating: 4.3 + tags: + - id: 1 + name: image-build + versions: + - id: 1 + version: "0.1" + - id: 2 + version: "0.2" + - catalog: + id: 1 + name: tekton + type: community + categories: + - id: 1 + name: image-build + hubURLPath: tekton/task/buildah + id: 1 + kind: task + latestVersion: + description: Buildah task builds source into a container image + and then pushes it to a container registry. + displayName: Buildah + id: 1 + minPipelinesVersion: 0.12.1 + platforms: + - id: 1 + name: linux/amd64 + rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml + updatedAt: 2020-01-01 12:00:00 +0000 UTC + version: "0.1" + webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml + name: buildah + platforms: + - id: 1 + name: linux/amd64 + rating: 4.3 + tags: + - id: 1 + name: image-build + versions: + - id: 1 + version: "0.1" + - id: 2 + version: "0.2" + - catalog: + id: 1 + name: tekton + type: community + categories: + - id: 1 + name: image-build + hubURLPath: tekton/task/buildah + id: 1 + kind: task + latestVersion: + description: Buildah task builds source into a container image + and then pushes it to a container registry. + displayName: Buildah + id: 1 + minPipelinesVersion: 0.12.1 + platforms: + - id: 1 + name: linux/amd64 + rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml + updatedAt: 2020-01-01 12:00:00 +0000 UTC + version: "0.1" + webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml + name: buildah + platforms: + - id: 1 + name: linux/amd64 + rating: 4.3 + tags: + - id: 1 + name: image-build + versions: + - id: 1 + version: "0.1" + - id: 2 + version: "0.2" /schema/swagger.json: get: tags: @@ -542,12 +702,6 @@ paths: - error: unable to reach db name: api status: ok - - error: unable to reach db - name: api - status: ok - - error: unable to reach db - name: api - status: ok /v1/categories: get: tags: @@ -570,8 +724,6 @@ paths: name: Image Builder - id: 1 name: Image Builder - - id: 1 - name: Image Builder "500": description: Internal Server Error response. content: @@ -584,6 +736,44 @@ paths: name: bad_request components: schemas: + Catalog: + type: object + properties: + id: + type: integer + description: ID is the unique id of the catalog + example: 1 + name: + type: string + description: Name of catalog + example: Tekton + provider: + type: string + description: Provider of catalog + example: github + type: + type: string + description: Type of catalog + example: community + enum: + - official + - community + url: + type: string + description: URL of catalog + example: https://github.com/tektoncd/hub + example: + id: 1 + name: Tekton + provider: github + type: community + url: https://github.com/tektoncd/hub + required: + - id + - name + - type + - url + - provider CatalogErrorResponseBody: type: object properties: @@ -605,10 +795,6 @@ components: - Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name - Resource tekton.dev/v1beta1, Kind=task - curl has no display name type: warning - - errors: - - Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name - - Resource tekton.dev/v1beta1, Kind=task - curl has no display name - type: warning example: data: - errors: @@ -628,7 +814,7 @@ components: type: array items: type: string - example: Et nihil aut. + example: Quidem magni. description: Catalog Error message example: - Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name @@ -669,7 +855,7 @@ components: fault: type: boolean description: Is the error a server-side fault? - example: false + example: true id: type: string description: ID is a unique identifier for this particular occurrence of @@ -687,7 +873,7 @@ components: temporary: type: boolean description: Is the error temporary? - example: false + example: true timeout: type: boolean description: Is the error a timeout? @@ -777,14 +963,14 @@ components: name: Image Builder - id: 1 name: Image Builder + - id: 1 + name: Image Builder example: data: - id: 1 name: Image Builder - id: 1 name: Image Builder - - id: 1 - name: Image Builder RefreshConfigResponseBody: type: object properties: @@ -796,6 +982,451 @@ components: checksum: 41ba391c8baf1fcd3c62c11272b913dc6613f4cf3b1833cfbb32431dc4384c93 required: - checksum + ResourceData: + type: object + properties: + catalog: + $ref: '#/components/schemas/Catalog' + categories: + type: array + items: + $ref: '#/components/schemas/Category' + description: Categories related to resource + example: + - id: 1 + name: image-build + hubURLPath: + type: string + description: Url path of the resource in hub + example: tekton/task/buildah + id: + type: integer + description: ID is the unique id of the resource + example: 1 + kind: + type: string + description: Kind of resource + example: task + latestVersion: + $ref: '#/components/schemas/ResourceVersionData' + name: + type: string + description: Name of resource + example: buildah + platforms: + type: array + items: + $ref: '#/components/schemas/Category' + description: Platforms related to resource + example: + - id: 1 + name: linux/amd64 + rating: + type: number + description: Rating of resource + example: 4.3 + format: double + tags: + type: array + items: + $ref: '#/components/schemas/Category' + description: Tags related to resource + example: + - id: 1 + name: image-build + versions: + type: array + items: + $ref: '#/components/schemas/ResourceVersionData' + description: List of all versions of a resource + example: + - id: 1 + version: "0.1" + - id: 2 + version: "0.2" + description: The resource type describes resource information. + example: + catalog: + id: 1 + name: tekton + type: community + categories: + - id: 1 + name: image-build + hubURLPath: tekton/task/buildah + id: 1 + kind: task + latestVersion: + description: Buildah task builds source into a container image and then + pushes it to a container registry. + displayName: Buildah + id: 1 + minPipelinesVersion: 0.12.1 + platforms: + - id: 1 + name: linux/amd64 + rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml + updatedAt: 2020-01-01 12:00:00 +0000 UTC + version: "0.1" + webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml + name: buildah + platforms: + - id: 1 + name: linux/amd64 + rating: 4.3 + tags: + - id: 1 + name: image-build + versions: + - id: 1 + version: "0.1" + - id: 2 + version: "0.2" + required: + - id + - name + - catalog + - categories + - kind + - hubURLPath + - latestVersion + - tags + - platforms + - rating + - versions + ResourceDataCollection: + type: array + items: + $ref: '#/components/schemas/ResourceData' + example: + - catalog: + id: 1 + name: tekton + type: community + categories: + - id: 1 + name: image-build + hubURLPath: tekton/task/buildah + id: 1 + kind: task + latestVersion: + description: Buildah task builds source into a container image and then + pushes it to a container registry. + displayName: Buildah + id: 1 + minPipelinesVersion: 0.12.1 + platforms: + - id: 1 + name: linux/amd64 + rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml + updatedAt: 2020-01-01 12:00:00 +0000 UTC + version: "0.1" + webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml + name: buildah + platforms: + - id: 1 + name: linux/amd64 + rating: 4.3 + tags: + - id: 1 + name: image-build + versions: + - id: 1 + version: "0.1" + - id: 2 + version: "0.2" + - catalog: + id: 1 + name: tekton + type: community + categories: + - id: 1 + name: image-build + hubURLPath: tekton/task/buildah + id: 1 + kind: task + latestVersion: + description: Buildah task builds source into a container image and then + pushes it to a container registry. + displayName: Buildah + id: 1 + minPipelinesVersion: 0.12.1 + platforms: + - id: 1 + name: linux/amd64 + rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml + updatedAt: 2020-01-01 12:00:00 +0000 UTC + version: "0.1" + webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml + name: buildah + platforms: + - id: 1 + name: linux/amd64 + rating: 4.3 + tags: + - id: 1 + name: image-build + versions: + - id: 1 + version: "0.1" + - id: 2 + version: "0.2" + ResourceVersionData: + type: object + properties: + deprecated: + type: boolean + description: Deprecation status of a version + example: true + description: + type: string + description: Description of version + example: Buildah task builds source into a container image and then pushes + it to a container registry. + displayName: + type: string + description: Display name of version + example: Buildah + hubURLPath: + type: string + description: Url path of the resource in hub + example: tekton/task/buildah + id: + type: integer + description: ID is the unique id of resource's version + example: 1 + minPipelinesVersion: + type: string + description: Minimum pipelines version the resource's version is compatible + with + example: 0.12.1 + platforms: + type: array + items: + $ref: '#/components/schemas/Category' + description: Platforms related to resource version + example: + - id: 1 + name: linux/s390x + rawURL: + type: string + description: Raw URL of resource's yaml file of the version + example: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml + format: uri + resource: + $ref: '#/components/schemas/ResourceData' + updatedAt: + type: string + description: Timestamp when version was last updated + example: 2020-01-01 12:00:00 +0000 UTC + format: date-time + version: + type: string + description: Version of resource + example: "0.1" + webURL: + type: string + description: Web URL of resource's yaml file of the version + example: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml + format: uri + description: The Version result type describes resource's version information. + example: + deprecated: true + description: Buildah task builds source into a container image and then pushes + it to a container registry. + displayName: Buildah + hubURLPath: tekton/task/buildah + id: 1 + minPipelinesVersion: 0.12.1 + platforms: + - id: 1 + name: linux/s390x + rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml + resource: + catalog: + id: 1 + type: community + categories: + - id: 1 + name: Build Tools + id: 1 + kind: task + name: buildah + platforms: + - id: 1 + name: linux/amd64 + rating: 4.3 + tags: + - id: 1 + name: image-build + updatedAt: 2020-01-01 12:00:00 +0000 UTC + version: "0.1" + webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml + required: + - id + - version + - displayName + - description + - minPipelinesVersion + - rawURL + - webURL + - updatedAt + - platforms + - resource + - hubURLPath + Resources: + type: object + properties: + data: + $ref: '#/components/schemas/ResourceDataCollection' + example: + data: + - catalog: + id: 1 + name: tekton + type: community + categories: + - id: 1 + name: image-build + hubURLPath: tekton/task/buildah + id: 1 + kind: task + latestVersion: + description: Buildah task builds source into a container image and then + pushes it to a container registry. + displayName: Buildah + id: 1 + minPipelinesVersion: 0.12.1 + platforms: + - id: 1 + name: linux/amd64 + rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml + updatedAt: 2020-01-01 12:00:00 +0000 UTC + version: "0.1" + webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml + name: buildah + platforms: + - id: 1 + name: linux/amd64 + rating: 4.3 + tags: + - id: 1 + name: image-build + versions: + - id: 1 + version: "0.1" + - id: 2 + version: "0.2" + - catalog: + id: 1 + name: tekton + type: community + categories: + - id: 1 + name: image-build + hubURLPath: tekton/task/buildah + id: 1 + kind: task + latestVersion: + description: Buildah task builds source into a container image and then + pushes it to a container registry. + displayName: Buildah + id: 1 + minPipelinesVersion: 0.12.1 + platforms: + - id: 1 + name: linux/amd64 + rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml + updatedAt: 2020-01-01 12:00:00 +0000 UTC + version: "0.1" + webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml + name: buildah + platforms: + - id: 1 + name: linux/amd64 + rating: 4.3 + tags: + - id: 1 + name: image-build + versions: + - id: 1 + version: "0.1" + - id: 2 + version: "0.2" + - catalog: + id: 1 + name: tekton + type: community + categories: + - id: 1 + name: image-build + hubURLPath: tekton/task/buildah + id: 1 + kind: task + latestVersion: + description: Buildah task builds source into a container image and then + pushes it to a container registry. + displayName: Buildah + id: 1 + minPipelinesVersion: 0.12.1 + platforms: + - id: 1 + name: linux/amd64 + rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml + updatedAt: 2020-01-01 12:00:00 +0000 UTC + version: "0.1" + webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml + name: buildah + platforms: + - id: 1 + name: linux/amd64 + rating: 4.3 + tags: + - id: 1 + name: image-build + versions: + - id: 1 + version: "0.1" + - id: 2 + version: "0.2" + - catalog: + id: 1 + name: tekton + type: community + categories: + - id: 1 + name: image-build + hubURLPath: tekton/task/buildah + id: 1 + kind: task + latestVersion: + description: Buildah task builds source into a container image and then + pushes it to a container registry. + displayName: Buildah + id: 1 + minPipelinesVersion: 0.12.1 + platforms: + - id: 1 + name: linux/amd64 + rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml + updatedAt: 2020-01-01 12:00:00 +0000 UTC + version: "0.1" + webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml + name: buildah + platforms: + - id: 1 + name: linux/amd64 + rating: 4.3 + tags: + - id: 1 + name: image-build + versions: + - id: 1 + version: "0.1" + - id: 2 + version: "0.2" + required: + - data StatusResponseBody: type: object properties: @@ -833,7 +1464,7 @@ components: type: array items: type: string - example: Voluptas beatae id qui. + example: Beatae id qui quia consequatur possimus tempora. description: Scopes required for Agent example: - catalog-refresh @@ -863,7 +1494,7 @@ components: rating: type: integer description: User rating for resource - example: 2 + example: 4 minimum: 0 maximum: 5 example: @@ -876,3 +1507,19 @@ components: description: Secures endpoint by requiring a valid JWT retrieved via the /auth/login endpoint. scheme: bearer +tags: +- name: swagger + description: The swagger service serves the API swagger definition. +- name: admin + description: Admin service +- name: catalog + description: The Catalog Service exposes endpoints to interact with catalogs +- name: category + description: The category service provides details about category +- name: rating + description: The rating service exposes endpoints to read and write user's rating + for resources +- name: resource + description: The resource service provides details about all kind of resources +- name: status + description: Describes the status of each service diff --git a/api/gen/http/rating/client/cli.go b/api/gen/http/rating/client/cli.go index 60ca3cee6e..05ee7bf25c 100644 --- a/api/gen/http/rating/client/cli.go +++ b/api/gen/http/rating/client/cli.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // rating HTTP client CLI support package // diff --git a/api/gen/http/rating/client/client.go b/api/gen/http/rating/client/client.go index da20a5722d..e82720632b 100644 --- a/api/gen/http/rating/client/client.go +++ b/api/gen/http/rating/client/client.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // rating client HTTP transport // diff --git a/api/gen/http/rating/client/encode_decode.go b/api/gen/http/rating/client/encode_decode.go index 7f57c4f725..a59cd06bf7 100644 --- a/api/gen/http/rating/client/encode_decode.go +++ b/api/gen/http/rating/client/encode_decode.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // rating HTTP client encoders and decoders // diff --git a/api/gen/http/rating/client/paths.go b/api/gen/http/rating/client/paths.go index 8e967f5ffa..c57fde764c 100644 --- a/api/gen/http/rating/client/paths.go +++ b/api/gen/http/rating/client/paths.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // HTTP request path constructors for the rating service. // diff --git a/api/gen/http/rating/client/types.go b/api/gen/http/rating/client/types.go index 5e584102be..54c50b26aa 100644 --- a/api/gen/http/rating/client/types.go +++ b/api/gen/http/rating/client/types.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // rating HTTP client types // diff --git a/api/gen/http/rating/server/encode_decode.go b/api/gen/http/rating/server/encode_decode.go index 13aaf2b63b..fee157ff52 100644 --- a/api/gen/http/rating/server/encode_decode.go +++ b/api/gen/http/rating/server/encode_decode.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // rating HTTP server encoders and decoders // @@ -23,7 +23,7 @@ import ( // Get endpoint. func EncodeGetResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error { return func(ctx context.Context, w http.ResponseWriter, v interface{}) error { - res := v.(*rating.GetResult) + res, _ := v.(*rating.GetResult) enc := encoder(ctx, w) body := NewGetResponseBody(res) w.WriteHeader(http.StatusOK) diff --git a/api/gen/http/rating/server/paths.go b/api/gen/http/rating/server/paths.go index 4ae55b9eb0..cc4b239ebc 100644 --- a/api/gen/http/rating/server/paths.go +++ b/api/gen/http/rating/server/paths.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // HTTP request path constructors for the rating service. // diff --git a/api/gen/http/rating/server/server.go b/api/gen/http/rating/server/server.go index e91b4b2377..e630a9d245 100644 --- a/api/gen/http/rating/server/server.go +++ b/api/gen/http/rating/server/server.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // rating HTTP server // diff --git a/api/gen/http/rating/server/types.go b/api/gen/http/rating/server/types.go index 9931d47d0c..96772bc48b 100644 --- a/api/gen/http/rating/server/types.go +++ b/api/gen/http/rating/server/types.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // rating HTTP server types // diff --git a/api/gen/http/resource/client/cli.go b/api/gen/http/resource/client/cli.go new file mode 100644 index 0000000000..cd12b6bb24 --- /dev/null +++ b/api/gen/http/resource/client/cli.go @@ -0,0 +1,8 @@ +// Code generated by goa v3.4.0, DO NOT EDIT. +// +// resource HTTP client CLI support package +// +// Command: +// $ goa gen github.com/tektoncd/hub/api/design + +package client diff --git a/api/gen/http/resource/client/client.go b/api/gen/http/resource/client/client.go new file mode 100644 index 0000000000..2ae6d67b5d --- /dev/null +++ b/api/gen/http/resource/client/client.go @@ -0,0 +1,73 @@ +// Code generated by goa v3.4.0, DO NOT EDIT. +// +// resource client HTTP transport +// +// Command: +// $ goa gen github.com/tektoncd/hub/api/design + +package client + +import ( + "context" + "net/http" + + goahttp "goa.design/goa/v3/http" + goa "goa.design/goa/v3/pkg" +) + +// Client lists the resource service endpoint HTTP clients. +type Client struct { + // List Doer is the HTTP client used to make requests to the List endpoint. + ListDoer goahttp.Doer + + // CORS Doer is the HTTP client used to make requests to the endpoint. + CORSDoer goahttp.Doer + + // RestoreResponseBody controls whether the response bodies are reset after + // decoding so they can be read again. + RestoreResponseBody bool + + scheme string + host string + encoder func(*http.Request) goahttp.Encoder + decoder func(*http.Response) goahttp.Decoder +} + +// NewClient instantiates HTTP clients for all the resource service servers. +func NewClient( + scheme string, + host string, + doer goahttp.Doer, + enc func(*http.Request) goahttp.Encoder, + dec func(*http.Response) goahttp.Decoder, + restoreBody bool, +) *Client { + return &Client{ + ListDoer: doer, + CORSDoer: doer, + RestoreResponseBody: restoreBody, + scheme: scheme, + host: host, + decoder: dec, + encoder: enc, + } +} + +// List returns an endpoint that makes HTTP requests to the resource service +// List server. +func (c *Client) List() goa.Endpoint { + var ( + decodeResponse = DecodeListResponse(c.decoder, c.RestoreResponseBody) + ) + return func(ctx context.Context, v interface{}) (interface{}, error) { + req, err := c.BuildListRequest(ctx, v) + if err != nil { + return nil, err + } + resp, err := c.ListDoer.Do(req) + if err != nil { + return nil, goahttp.ErrRequestError("resource", "List", err) + } + return decodeResponse(resp) + } +} diff --git a/api/gen/http/resource/client/encode_decode.go b/api/gen/http/resource/client/encode_decode.go new file mode 100644 index 0000000000..a15ec979a9 --- /dev/null +++ b/api/gen/http/resource/client/encode_decode.go @@ -0,0 +1,182 @@ +// Code generated by goa v3.4.0, DO NOT EDIT. +// +// resource HTTP client encoders and decoders +// +// Command: +// $ goa gen github.com/tektoncd/hub/api/design + +package client + +import ( + "bytes" + "context" + "io/ioutil" + "net/http" + "net/url" + + resource "github.com/tektoncd/hub/api/gen/resource" + resourceviews "github.com/tektoncd/hub/api/gen/resource/views" + goahttp "goa.design/goa/v3/http" +) + +// BuildListRequest instantiates a HTTP request object with method and path set +// to call the "resource" service "List" endpoint +func (c *Client) BuildListRequest(ctx context.Context, v interface{}) (*http.Request, error) { + u := &url.URL{Scheme: c.scheme, Host: c.host, Path: ListResourcePath()} + req, err := http.NewRequest("GET", u.String(), nil) + if err != nil { + return nil, goahttp.ErrInvalidURL("resource", "List", u.String(), err) + } + if ctx != nil { + req = req.WithContext(ctx) + } + + return req, nil +} + +// DecodeListResponse returns a decoder for responses returned by the resource +// List endpoint. restoreBody controls whether the response body should be +// restored after having been read. +func DecodeListResponse(decoder func(*http.Response) goahttp.Decoder, restoreBody bool) func(*http.Response) (interface{}, error) { + return func(resp *http.Response) (interface{}, error) { + if restoreBody { + b, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + resp.Body = ioutil.NopCloser(bytes.NewBuffer(b)) + defer func() { + resp.Body = ioutil.NopCloser(bytes.NewBuffer(b)) + }() + } else { + defer resp.Body.Close() + } + switch resp.StatusCode { + case http.StatusMovedPermanently: + var ( + body ListResponseBody + err error + ) + err = decoder(resp).Decode(&body) + if err != nil { + return nil, goahttp.ErrDecodingError("resource", "List", err) + } + p := NewListResourcesMovedPermanently(&body) + view := "default" + vres := &resourceviews.Resources{Projected: p, View: view} + if err = resourceviews.ValidateResources(vres); err != nil { + return nil, goahttp.ErrValidationError("resource", "List", err) + } + res := resource.NewResources(vres) + return res, nil + default: + body, _ := ioutil.ReadAll(resp.Body) + return nil, goahttp.ErrInvalidResponse("resource", "List", resp.StatusCode, string(body)) + } + } +} + +// unmarshalResourceDataResponseBodyToResourceviewsResourceDataView builds a +// value of type *resourceviews.ResourceDataView from a value of type +// *ResourceDataResponseBody. +func unmarshalResourceDataResponseBodyToResourceviewsResourceDataView(v *ResourceDataResponseBody) *resourceviews.ResourceDataView { + res := &resourceviews.ResourceDataView{ + ID: v.ID, + Name: v.Name, + Kind: v.Kind, + HubURLPath: v.HubURLPath, + Rating: v.Rating, + } + res.Catalog = unmarshalCatalogResponseBodyToResourceviewsCatalogView(v.Catalog) + res.Categories = make([]*resourceviews.CategoryView, len(v.Categories)) + for i, val := range v.Categories { + res.Categories[i] = unmarshalCategoryResponseBodyToResourceviewsCategoryView(val) + } + res.LatestVersion = unmarshalResourceVersionDataResponseBodyToResourceviewsResourceVersionDataView(v.LatestVersion) + res.Tags = make([]*resourceviews.TagView, len(v.Tags)) + for i, val := range v.Tags { + res.Tags[i] = unmarshalTagResponseBodyToResourceviewsTagView(val) + } + res.Platforms = make([]*resourceviews.PlatformView, len(v.Platforms)) + for i, val := range v.Platforms { + res.Platforms[i] = unmarshalPlatformResponseBodyToResourceviewsPlatformView(val) + } + res.Versions = make([]*resourceviews.ResourceVersionDataView, len(v.Versions)) + for i, val := range v.Versions { + res.Versions[i] = unmarshalResourceVersionDataResponseBodyToResourceviewsResourceVersionDataView(val) + } + + return res +} + +// unmarshalCatalogResponseBodyToResourceviewsCatalogView builds a value of +// type *resourceviews.CatalogView from a value of type *CatalogResponseBody. +func unmarshalCatalogResponseBodyToResourceviewsCatalogView(v *CatalogResponseBody) *resourceviews.CatalogView { + res := &resourceviews.CatalogView{ + ID: v.ID, + Name: v.Name, + Type: v.Type, + URL: v.URL, + Provider: v.Provider, + } + + return res +} + +// unmarshalCategoryResponseBodyToResourceviewsCategoryView builds a value of +// type *resourceviews.CategoryView from a value of type *CategoryResponseBody. +func unmarshalCategoryResponseBodyToResourceviewsCategoryView(v *CategoryResponseBody) *resourceviews.CategoryView { + res := &resourceviews.CategoryView{ + ID: v.ID, + Name: v.Name, + } + + return res +} + +// unmarshalResourceVersionDataResponseBodyToResourceviewsResourceVersionDataView +// builds a value of type *resourceviews.ResourceVersionDataView from a value +// of type *ResourceVersionDataResponseBody. +func unmarshalResourceVersionDataResponseBodyToResourceviewsResourceVersionDataView(v *ResourceVersionDataResponseBody) *resourceviews.ResourceVersionDataView { + res := &resourceviews.ResourceVersionDataView{ + ID: v.ID, + Version: v.Version, + DisplayName: v.DisplayName, + Deprecated: v.Deprecated, + Description: v.Description, + MinPipelinesVersion: v.MinPipelinesVersion, + RawURL: v.RawURL, + WebURL: v.WebURL, + UpdatedAt: v.UpdatedAt, + HubURLPath: v.HubURLPath, + } + res.Platforms = make([]*resourceviews.PlatformView, len(v.Platforms)) + for i, val := range v.Platforms { + res.Platforms[i] = unmarshalPlatformResponseBodyToResourceviewsPlatformView(val) + } + res.Resource = unmarshalResourceDataResponseBodyToResourceviewsResourceDataView(v.Resource) + + return res +} + +// unmarshalPlatformResponseBodyToResourceviewsPlatformView builds a value of +// type *resourceviews.PlatformView from a value of type *PlatformResponseBody. +func unmarshalPlatformResponseBodyToResourceviewsPlatformView(v *PlatformResponseBody) *resourceviews.PlatformView { + res := &resourceviews.PlatformView{ + ID: v.ID, + Name: v.Name, + } + + return res +} + +// unmarshalTagResponseBodyToResourceviewsTagView builds a value of type +// *resourceviews.TagView from a value of type *TagResponseBody. +func unmarshalTagResponseBodyToResourceviewsTagView(v *TagResponseBody) *resourceviews.TagView { + res := &resourceviews.TagView{ + ID: v.ID, + Name: v.Name, + } + + return res +} diff --git a/api/gen/http/resource/client/paths.go b/api/gen/http/resource/client/paths.go new file mode 100644 index 0000000000..5ce0c727fe --- /dev/null +++ b/api/gen/http/resource/client/paths.go @@ -0,0 +1,13 @@ +// Code generated by goa v3.4.0, DO NOT EDIT. +// +// HTTP request path constructors for the resource service. +// +// Command: +// $ goa gen github.com/tektoncd/hub/api/design + +package client + +// ListResourcePath returns the URL path to the resource service List HTTP endpoint. +func ListResourcePath() string { + return "/resources" +} diff --git a/api/gen/http/resource/client/types.go b/api/gen/http/resource/client/types.go new file mode 100644 index 0000000000..d540f42762 --- /dev/null +++ b/api/gen/http/resource/client/types.go @@ -0,0 +1,339 @@ +// Code generated by goa v3.4.0, DO NOT EDIT. +// +// resource HTTP client types +// +// Command: +// $ goa gen github.com/tektoncd/hub/api/design + +package client + +import ( + resourceviews "github.com/tektoncd/hub/api/gen/resource/views" + goa "goa.design/goa/v3/pkg" +) + +// ListResponseBody is the type of the "resource" service "List" endpoint HTTP +// response body. +type ListResponseBody struct { + Data ResourceDataCollectionResponseBody `form:"data,omitempty" json:"data,omitempty" xml:"data,omitempty"` +} + +// ResourceDataCollectionResponseBody is used to define fields on response body +// types. +type ResourceDataCollectionResponseBody []*ResourceDataResponseBody + +// ResourceDataResponseBody is used to define fields on response body types. +type ResourceDataResponseBody struct { + // ID is the unique id of the resource + ID *uint `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"` + // Name of resource + Name *string `form:"name,omitempty" json:"name,omitempty" xml:"name,omitempty"` + // Type of catalog to which resource belongs + Catalog *CatalogResponseBody `form:"catalog,omitempty" json:"catalog,omitempty" xml:"catalog,omitempty"` + // Categories related to resource + Categories []*CategoryResponseBody `form:"categories,omitempty" json:"categories,omitempty" xml:"categories,omitempty"` + // Kind of resource + Kind *string `form:"kind,omitempty" json:"kind,omitempty" xml:"kind,omitempty"` + // Url path of the resource in hub + HubURLPath *string `form:"hubURLPath,omitempty" json:"hubURLPath,omitempty" xml:"hubURLPath,omitempty"` + // Latest version of resource + LatestVersion *ResourceVersionDataResponseBody `form:"latestVersion,omitempty" json:"latestVersion,omitempty" xml:"latestVersion,omitempty"` + // Tags related to resource + Tags []*TagResponseBody `form:"tags,omitempty" json:"tags,omitempty" xml:"tags,omitempty"` + // Platforms related to resource + Platforms []*PlatformResponseBody `form:"platforms,omitempty" json:"platforms,omitempty" xml:"platforms,omitempty"` + // Rating of resource + Rating *float64 `form:"rating,omitempty" json:"rating,omitempty" xml:"rating,omitempty"` + // List of all versions of a resource + Versions []*ResourceVersionDataResponseBody `form:"versions,omitempty" json:"versions,omitempty" xml:"versions,omitempty"` +} + +// CatalogResponseBody is used to define fields on response body types. +type CatalogResponseBody struct { + // ID is the unique id of the catalog + ID *uint `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"` + // Name of catalog + Name *string `form:"name,omitempty" json:"name,omitempty" xml:"name,omitempty"` + // Type of catalog + Type *string `form:"type,omitempty" json:"type,omitempty" xml:"type,omitempty"` + // URL of catalog + URL *string `form:"url,omitempty" json:"url,omitempty" xml:"url,omitempty"` + // Provider of catalog + Provider *string `form:"provider,omitempty" json:"provider,omitempty" xml:"provider,omitempty"` +} + +// CategoryResponseBody is used to define fields on response body types. +type CategoryResponseBody struct { + // ID is the unique id of the category + ID *uint `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"` + // Name of category + Name *string `form:"name,omitempty" json:"name,omitempty" xml:"name,omitempty"` +} + +// ResourceVersionDataResponseBody is used to define fields on response body +// types. +type ResourceVersionDataResponseBody struct { + // ID is the unique id of resource's version + ID *uint `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"` + // Version of resource + Version *string `form:"version,omitempty" json:"version,omitempty" xml:"version,omitempty"` + // Display name of version + DisplayName *string `form:"displayName,omitempty" json:"displayName,omitempty" xml:"displayName,omitempty"` + // Deprecation status of a version + Deprecated *bool `form:"deprecated,omitempty" json:"deprecated,omitempty" xml:"deprecated,omitempty"` + // Description of version + Description *string `form:"description,omitempty" json:"description,omitempty" xml:"description,omitempty"` + // Minimum pipelines version the resource's version is compatible with + MinPipelinesVersion *string `form:"minPipelinesVersion,omitempty" json:"minPipelinesVersion,omitempty" xml:"minPipelinesVersion,omitempty"` + // Raw URL of resource's yaml file of the version + RawURL *string `form:"rawURL,omitempty" json:"rawURL,omitempty" xml:"rawURL,omitempty"` + // Web URL of resource's yaml file of the version + WebURL *string `form:"webURL,omitempty" json:"webURL,omitempty" xml:"webURL,omitempty"` + // Timestamp when version was last updated + UpdatedAt *string `form:"updatedAt,omitempty" json:"updatedAt,omitempty" xml:"updatedAt,omitempty"` + // Platforms related to resource version + Platforms []*PlatformResponseBody `form:"platforms,omitempty" json:"platforms,omitempty" xml:"platforms,omitempty"` + // Url path of the resource in hub + HubURLPath *string `form:"hubURLPath,omitempty" json:"hubURLPath,omitempty" xml:"hubURLPath,omitempty"` + // Resource to which the version belongs + Resource *ResourceDataResponseBody `form:"resource,omitempty" json:"resource,omitempty" xml:"resource,omitempty"` +} + +// PlatformResponseBody is used to define fields on response body types. +type PlatformResponseBody struct { + // ID is the unique id of platform + ID *uint `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"` + // Name of platform + Name *string `form:"name,omitempty" json:"name,omitempty" xml:"name,omitempty"` +} + +// TagResponseBody is used to define fields on response body types. +type TagResponseBody struct { + // ID is the unique id of tag + ID *uint `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"` + // Name of tag + Name *string `form:"name,omitempty" json:"name,omitempty" xml:"name,omitempty"` +} + +// NewListResourcesMovedPermanently builds a "resource" service "List" endpoint +// result from a HTTP "MovedPermanently" response. +func NewListResourcesMovedPermanently(body *ListResponseBody) *resourceviews.ResourcesView { + v := &resourceviews.ResourcesView{} + v.Data = make([]*resourceviews.ResourceDataView, len(body.Data)) + for i, val := range body.Data { + v.Data[i] = unmarshalResourceDataResponseBodyToResourceviewsResourceDataView(val) + } + + return v +} + +// ValidateResourceDataCollectionResponseBody runs the validations defined on +// ResourceDataCollectionResponseBody +func ValidateResourceDataCollectionResponseBody(body ResourceDataCollectionResponseBody) (err error) { + for _, e := range body { + if e != nil { + if err2 := ValidateResourceDataResponseBody(e); err2 != nil { + err = goa.MergeErrors(err, err2) + } + } + } + return +} + +// ValidateResourceDataResponseBody runs the validations defined on +// ResourceDataResponseBody +func ValidateResourceDataResponseBody(body *ResourceDataResponseBody) (err error) { + if body.ID == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("id", "body")) + } + if body.Name == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("name", "body")) + } + if body.Catalog == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("catalog", "body")) + } + if body.Categories == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("categories", "body")) + } + if body.Kind == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("kind", "body")) + } + if body.HubURLPath == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("hubURLPath", "body")) + } + if body.LatestVersion == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("latestVersion", "body")) + } + if body.Tags == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("tags", "body")) + } + if body.Platforms == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("platforms", "body")) + } + if body.Rating == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("rating", "body")) + } + if body.Versions == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("versions", "body")) + } + if body.Catalog != nil { + if err2 := ValidateCatalogResponseBody(body.Catalog); err2 != nil { + err = goa.MergeErrors(err, err2) + } + } + for _, e := range body.Categories { + if e != nil { + if err2 := ValidateCategoryResponseBody(e); err2 != nil { + err = goa.MergeErrors(err, err2) + } + } + } + if body.LatestVersion != nil { + if err2 := ValidateResourceVersionDataResponseBody(body.LatestVersion); err2 != nil { + err = goa.MergeErrors(err, err2) + } + } + for _, e := range body.Tags { + if e != nil { + if err2 := ValidateTagResponseBody(e); err2 != nil { + err = goa.MergeErrors(err, err2) + } + } + } + for _, e := range body.Platforms { + if e != nil { + if err2 := ValidatePlatformResponseBody(e); err2 != nil { + err = goa.MergeErrors(err, err2) + } + } + } + for _, e := range body.Versions { + if e != nil { + if err2 := ValidateResourceVersionDataResponseBody(e); err2 != nil { + err = goa.MergeErrors(err, err2) + } + } + } + return +} + +// ValidateCatalogResponseBody runs the validations defined on +// CatalogResponseBody +func ValidateCatalogResponseBody(body *CatalogResponseBody) (err error) { + if body.ID == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("id", "body")) + } + if body.Name == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("name", "body")) + } + if body.Type == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("type", "body")) + } + if body.URL == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("url", "body")) + } + if body.Provider == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("provider", "body")) + } + if body.Type != nil { + if !(*body.Type == "official" || *body.Type == "community") { + err = goa.MergeErrors(err, goa.InvalidEnumValueError("body.type", *body.Type, []interface{}{"official", "community"})) + } + } + return +} + +// ValidateCategoryResponseBody runs the validations defined on +// CategoryResponseBody +func ValidateCategoryResponseBody(body *CategoryResponseBody) (err error) { + if body.ID == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("id", "body")) + } + if body.Name == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("name", "body")) + } + return +} + +// ValidateResourceVersionDataResponseBody runs the validations defined on +// ResourceVersionDataResponseBody +func ValidateResourceVersionDataResponseBody(body *ResourceVersionDataResponseBody) (err error) { + if body.ID == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("id", "body")) + } + if body.Version == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("version", "body")) + } + if body.DisplayName == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("displayName", "body")) + } + if body.Description == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("description", "body")) + } + if body.MinPipelinesVersion == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("minPipelinesVersion", "body")) + } + if body.RawURL == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("rawURL", "body")) + } + if body.WebURL == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("webURL", "body")) + } + if body.UpdatedAt == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("updatedAt", "body")) + } + if body.Platforms == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("platforms", "body")) + } + if body.Resource == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("resource", "body")) + } + if body.HubURLPath == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("hubURLPath", "body")) + } + if body.RawURL != nil { + err = goa.MergeErrors(err, goa.ValidateFormat("body.rawURL", *body.RawURL, goa.FormatURI)) + } + if body.WebURL != nil { + err = goa.MergeErrors(err, goa.ValidateFormat("body.webURL", *body.WebURL, goa.FormatURI)) + } + if body.UpdatedAt != nil { + err = goa.MergeErrors(err, goa.ValidateFormat("body.updatedAt", *body.UpdatedAt, goa.FormatDateTime)) + } + for _, e := range body.Platforms { + if e != nil { + if err2 := ValidatePlatformResponseBody(e); err2 != nil { + err = goa.MergeErrors(err, err2) + } + } + } + if body.Resource != nil { + if err2 := ValidateResourceDataResponseBody(body.Resource); err2 != nil { + err = goa.MergeErrors(err, err2) + } + } + return +} + +// ValidatePlatformResponseBody runs the validations defined on +// PlatformResponseBody +func ValidatePlatformResponseBody(body *PlatformResponseBody) (err error) { + if body.ID == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("id", "body")) + } + if body.Name == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("name", "body")) + } + return +} + +// ValidateTagResponseBody runs the validations defined on TagResponseBody +func ValidateTagResponseBody(body *TagResponseBody) (err error) { + if body.ID == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("id", "body")) + } + if body.Name == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("name", "body")) + } + return +} diff --git a/api/gen/http/resource/server/encode_decode.go b/api/gen/http/resource/server/encode_decode.go new file mode 100644 index 0000000000..bf4ad87f15 --- /dev/null +++ b/api/gen/http/resource/server/encode_decode.go @@ -0,0 +1,122 @@ +// Code generated by goa v3.4.0, DO NOT EDIT. +// +// resource HTTP server encoders and decoders +// +// Command: +// $ goa gen github.com/tektoncd/hub/api/design + +package server + +import ( + resourceviews "github.com/tektoncd/hub/api/gen/resource/views" +) + +// marshalResourceviewsResourceDataViewToResourceDataResponseBodyWithoutVersion +// builds a value of type *ResourceDataResponseBodyWithoutVersion from a value +// of type *resourceviews.ResourceDataView. +func marshalResourceviewsResourceDataViewToResourceDataResponseBodyWithoutVersion(v *resourceviews.ResourceDataView) *ResourceDataResponseBodyWithoutVersion { + res := &ResourceDataResponseBodyWithoutVersion{ + ID: *v.ID, + Name: *v.Name, + Kind: *v.Kind, + HubURLPath: *v.HubURLPath, + Rating: *v.Rating, + } + if v.Catalog != nil { + res.Catalog = marshalResourceviewsCatalogViewToCatalogResponseBodyMin(v.Catalog) + } + if v.Categories != nil { + res.Categories = make([]*CategoryResponseBody, len(v.Categories)) + for i, val := range v.Categories { + res.Categories[i] = marshalResourceviewsCategoryViewToCategoryResponseBody(val) + } + } + if v.LatestVersion != nil { + res.LatestVersion = marshalResourceviewsResourceVersionDataViewToResourceVersionDataResponseBodyWithoutResource(v.LatestVersion) + } + if v.Tags != nil { + res.Tags = make([]*TagResponseBody, len(v.Tags)) + for i, val := range v.Tags { + res.Tags[i] = marshalResourceviewsTagViewToTagResponseBody(val) + } + } + if v.Platforms != nil { + res.Platforms = make([]*PlatformResponseBody, len(v.Platforms)) + for i, val := range v.Platforms { + res.Platforms[i] = marshalResourceviewsPlatformViewToPlatformResponseBody(val) + } + } + + return res +} + +// marshalResourceviewsCatalogViewToCatalogResponseBodyMin builds a value of +// type *CatalogResponseBodyMin from a value of type *resourceviews.CatalogView. +func marshalResourceviewsCatalogViewToCatalogResponseBodyMin(v *resourceviews.CatalogView) *CatalogResponseBodyMin { + res := &CatalogResponseBodyMin{ + ID: *v.ID, + Name: *v.Name, + Type: *v.Type, + } + + return res +} + +// marshalResourceviewsCategoryViewToCategoryResponseBody builds a value of +// type *CategoryResponseBody from a value of type *resourceviews.CategoryView. +func marshalResourceviewsCategoryViewToCategoryResponseBody(v *resourceviews.CategoryView) *CategoryResponseBody { + res := &CategoryResponseBody{ + ID: *v.ID, + Name: *v.Name, + } + + return res +} + +// marshalResourceviewsResourceVersionDataViewToResourceVersionDataResponseBodyWithoutResource +// builds a value of type *ResourceVersionDataResponseBodyWithoutResource from +// a value of type *resourceviews.ResourceVersionDataView. +func marshalResourceviewsResourceVersionDataViewToResourceVersionDataResponseBodyWithoutResource(v *resourceviews.ResourceVersionDataView) *ResourceVersionDataResponseBodyWithoutResource { + res := &ResourceVersionDataResponseBodyWithoutResource{ + ID: *v.ID, + Version: *v.Version, + DisplayName: *v.DisplayName, + Deprecated: v.Deprecated, + Description: *v.Description, + MinPipelinesVersion: *v.MinPipelinesVersion, + RawURL: *v.RawURL, + WebURL: *v.WebURL, + UpdatedAt: *v.UpdatedAt, + HubURLPath: *v.HubURLPath, + } + if v.Platforms != nil { + res.Platforms = make([]*PlatformResponseBody, len(v.Platforms)) + for i, val := range v.Platforms { + res.Platforms[i] = marshalResourceviewsPlatformViewToPlatformResponseBody(val) + } + } + + return res +} + +// marshalResourceviewsPlatformViewToPlatformResponseBody builds a value of +// type *PlatformResponseBody from a value of type *resourceviews.PlatformView. +func marshalResourceviewsPlatformViewToPlatformResponseBody(v *resourceviews.PlatformView) *PlatformResponseBody { + res := &PlatformResponseBody{ + ID: *v.ID, + Name: *v.Name, + } + + return res +} + +// marshalResourceviewsTagViewToTagResponseBody builds a value of type +// *TagResponseBody from a value of type *resourceviews.TagView. +func marshalResourceviewsTagViewToTagResponseBody(v *resourceviews.TagView) *TagResponseBody { + res := &TagResponseBody{ + ID: *v.ID, + Name: *v.Name, + } + + return res +} diff --git a/api/gen/http/resource/server/paths.go b/api/gen/http/resource/server/paths.go new file mode 100644 index 0000000000..7ae31122ad --- /dev/null +++ b/api/gen/http/resource/server/paths.go @@ -0,0 +1,13 @@ +// Code generated by goa v3.4.0, DO NOT EDIT. +// +// HTTP request path constructors for the resource service. +// +// Command: +// $ goa gen github.com/tektoncd/hub/api/design + +package server + +// ListResourcePath returns the URL path to the resource service List HTTP endpoint. +func ListResourcePath() string { + return "/resources" +} diff --git a/api/gen/http/resource/server/server.go b/api/gen/http/resource/server/server.go new file mode 100644 index 0000000000..4c689b93d2 --- /dev/null +++ b/api/gen/http/resource/server/server.go @@ -0,0 +1,158 @@ +// Code generated by goa v3.4.0, DO NOT EDIT. +// +// resource HTTP server +// +// Command: +// $ goa gen github.com/tektoncd/hub/api/design + +package server + +import ( + "context" + "net/http" + + resource "github.com/tektoncd/hub/api/gen/resource" + goahttp "goa.design/goa/v3/http" + goa "goa.design/goa/v3/pkg" + "goa.design/plugins/v3/cors" +) + +// Server lists the resource service endpoint HTTP handlers. +type Server struct { + Mounts []*MountPoint + List http.Handler + CORS http.Handler +} + +// ErrorNamer is an interface implemented by generated error structs that +// exposes the name of the error as defined in the design. +type ErrorNamer interface { + ErrorName() string +} + +// MountPoint holds information about the mounted endpoints. +type MountPoint struct { + // Method is the name of the service method served by the mounted HTTP handler. + Method string + // Verb is the HTTP method used to match requests to the mounted handler. + Verb string + // Pattern is the HTTP request path pattern used to match requests to the + // mounted handler. + Pattern string +} + +// New instantiates HTTP handlers for all the resource service endpoints using +// the provided encoder and decoder. The handlers are mounted on the given mux +// using the HTTP verb and path defined in the design. errhandler is called +// whenever a response fails to be encoded. formatter is used to format errors +// returned by the service methods prior to encoding. Both errhandler and +// formatter are optional and can be nil. +func New( + e *resource.Endpoints, + mux goahttp.Muxer, + decoder func(*http.Request) goahttp.Decoder, + encoder func(context.Context, http.ResponseWriter) goahttp.Encoder, + errhandler func(context.Context, http.ResponseWriter, error), + formatter func(err error) goahttp.Statuser, +) *Server { + return &Server{ + Mounts: []*MountPoint{ + {"List", "GET", "/resources"}, + {"CORS", "OPTIONS", "/resources"}, + }, + List: NewListHandler(e.List, mux, decoder, encoder, errhandler, formatter), + CORS: NewCORSHandler(), + } +} + +// Service returns the name of the service served. +func (s *Server) Service() string { return "resource" } + +// Use wraps the server handlers with the given middleware. +func (s *Server) Use(m func(http.Handler) http.Handler) { + s.List = m(s.List) + s.CORS = m(s.CORS) +} + +// Mount configures the mux to serve the resource endpoints. +func Mount(mux goahttp.Muxer, h *Server) { + MountListHandler(mux, h.List) + MountCORSHandler(mux, h.CORS) +} + +// MountListHandler configures the mux to serve the "resource" service "List" +// endpoint. +func MountListHandler(mux goahttp.Muxer, h http.Handler) { + f, ok := handleResourceOrigin(h).(http.HandlerFunc) + if !ok { + f = func(w http.ResponseWriter, r *http.Request) { + h.ServeHTTP(w, r) + } + } + mux.Handle("GET", "/resources", f) +} + +// NewListHandler creates a HTTP handler which loads the HTTP request and calls +// the "resource" service "List" endpoint. +func NewListHandler( + endpoint goa.Endpoint, + mux goahttp.Muxer, + decoder func(*http.Request) goahttp.Decoder, + encoder func(context.Context, http.ResponseWriter) goahttp.Encoder, + errhandler func(context.Context, http.ResponseWriter, error), + formatter func(err error) goahttp.Statuser, +) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + ctx := context.WithValue(r.Context(), goahttp.AcceptTypeKey, r.Header.Get("Accept")) + ctx = context.WithValue(ctx, goa.MethodKey, "List") + ctx = context.WithValue(ctx, goa.ServiceKey, "resource") + http.Redirect(w, r, "/v1/resources", http.StatusMovedPermanently) + }) +} + +// MountCORSHandler configures the mux to serve the CORS endpoints for the +// service resource. +func MountCORSHandler(mux goahttp.Muxer, h http.Handler) { + h = handleResourceOrigin(h) + f, ok := h.(http.HandlerFunc) + if !ok { + f = func(w http.ResponseWriter, r *http.Request) { + h.ServeHTTP(w, r) + } + } + mux.Handle("OPTIONS", "/resources", f) +} + +// NewCORSHandler creates a HTTP handler which returns a simple 200 response. +func NewCORSHandler() http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(200) + }) +} + +// handleResourceOrigin applies the CORS response headers corresponding to the +// origin for the service resource. +func handleResourceOrigin(h http.Handler) http.Handler { + origHndlr := h.(http.HandlerFunc) + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + origin := r.Header.Get("Origin") + if origin == "" { + // Not a CORS request + origHndlr(w, r) + return + } + if cors.MatchOrigin(origin, "*") { + w.Header().Set("Access-Control-Allow-Origin", origin) + w.Header().Set("Access-Control-Allow-Credentials", "false") + if acrm := r.Header.Get("Access-Control-Request-Method"); acrm != "" { + // We are handling a preflight request + w.Header().Set("Access-Control-Allow-Methods", "GET, POST, PUT") + w.Header().Set("Access-Control-Allow-Headers", "Content-Type, Authorization") + } + origHndlr(w, r) + return + } + origHndlr(w, r) + return + }) +} diff --git a/api/gen/http/resource/server/types.go b/api/gen/http/resource/server/types.go new file mode 100644 index 0000000000..732b970560 --- /dev/null +++ b/api/gen/http/resource/server/types.go @@ -0,0 +1,121 @@ +// Code generated by goa v3.4.0, DO NOT EDIT. +// +// resource HTTP server types +// +// Command: +// $ goa gen github.com/tektoncd/hub/api/design + +package server + +import ( + resourceviews "github.com/tektoncd/hub/api/gen/resource/views" +) + +// ListResponseBody is the type of the "resource" service "List" endpoint HTTP +// response body. +type ListResponseBody struct { + Data ResourceDataResponseBodyWithoutVersionCollection `form:"data" json:"data" xml:"data"` +} + +// ResourceDataResponseBodyWithoutVersionCollection is used to define fields on +// response body types. +type ResourceDataResponseBodyWithoutVersionCollection []*ResourceDataResponseBodyWithoutVersion + +// ResourceDataResponseBodyWithoutVersion is used to define fields on response +// body types. +type ResourceDataResponseBodyWithoutVersion struct { + // ID is the unique id of the resource + ID uint `form:"id" json:"id" xml:"id"` + // Name of resource + Name string `form:"name" json:"name" xml:"name"` + // Type of catalog to which resource belongs + Catalog *CatalogResponseBodyMin `form:"catalog" json:"catalog" xml:"catalog"` + // Categories related to resource + Categories []*CategoryResponseBody `form:"categories" json:"categories" xml:"categories"` + // Kind of resource + Kind string `form:"kind" json:"kind" xml:"kind"` + // Url path of the resource in hub + HubURLPath string `form:"hubURLPath" json:"hubURLPath" xml:"hubURLPath"` + // Latest version of resource + LatestVersion *ResourceVersionDataResponseBodyWithoutResource `form:"latestVersion" json:"latestVersion" xml:"latestVersion"` + // Tags related to resource + Tags []*TagResponseBody `form:"tags" json:"tags" xml:"tags"` + // Platforms related to resource + Platforms []*PlatformResponseBody `form:"platforms" json:"platforms" xml:"platforms"` + // Rating of resource + Rating float64 `form:"rating" json:"rating" xml:"rating"` +} + +// CatalogResponseBodyMin is used to define fields on response body types. +type CatalogResponseBodyMin struct { + // ID is the unique id of the catalog + ID uint `form:"id" json:"id" xml:"id"` + // Name of catalog + Name string `form:"name" json:"name" xml:"name"` + // Type of catalog + Type string `form:"type" json:"type" xml:"type"` +} + +// CategoryResponseBody is used to define fields on response body types. +type CategoryResponseBody struct { + // ID is the unique id of the category + ID uint `form:"id" json:"id" xml:"id"` + // Name of category + Name string `form:"name" json:"name" xml:"name"` +} + +// ResourceVersionDataResponseBodyWithoutResource is used to define fields on +// response body types. +type ResourceVersionDataResponseBodyWithoutResource struct { + // ID is the unique id of resource's version + ID uint `form:"id" json:"id" xml:"id"` + // Version of resource + Version string `form:"version" json:"version" xml:"version"` + // Display name of version + DisplayName string `form:"displayName" json:"displayName" xml:"displayName"` + // Deprecation status of a version + Deprecated *bool `form:"deprecated,omitempty" json:"deprecated,omitempty" xml:"deprecated,omitempty"` + // Description of version + Description string `form:"description" json:"description" xml:"description"` + // Minimum pipelines version the resource's version is compatible with + MinPipelinesVersion string `form:"minPipelinesVersion" json:"minPipelinesVersion" xml:"minPipelinesVersion"` + // Raw URL of resource's yaml file of the version + RawURL string `form:"rawURL" json:"rawURL" xml:"rawURL"` + // Web URL of resource's yaml file of the version + WebURL string `form:"webURL" json:"webURL" xml:"webURL"` + // Url path of the resource in hub + HubURLPath string `form:"hubURLPath" json:"hubURLPath" xml:"hubURLPath"` + // Timestamp when version was last updated + UpdatedAt string `form:"updatedAt" json:"updatedAt" xml:"updatedAt"` + // Platforms related to resource version + Platforms []*PlatformResponseBody `form:"platforms" json:"platforms" xml:"platforms"` +} + +// PlatformResponseBody is used to define fields on response body types. +type PlatformResponseBody struct { + // ID is the unique id of platform + ID uint `form:"id" json:"id" xml:"id"` + // Name of platform + Name string `form:"name" json:"name" xml:"name"` +} + +// TagResponseBody is used to define fields on response body types. +type TagResponseBody struct { + // ID is the unique id of tag + ID uint `form:"id" json:"id" xml:"id"` + // Name of tag + Name string `form:"name" json:"name" xml:"name"` +} + +// NewListResponseBody builds the HTTP response body from the result of the +// "List" endpoint of the "resource" service. +func NewListResponseBody(res *resourceviews.ResourcesView) *ListResponseBody { + body := &ListResponseBody{} + if res.Data != nil { + body.Data = make([]*ResourceDataResponseBodyWithoutVersion, len(res.Data)) + for i, val := range res.Data { + body.Data[i] = marshalResourceviewsResourceDataViewToResourceDataResponseBodyWithoutVersion(val) + } + } + return body +} diff --git a/api/gen/http/status/client/cli.go b/api/gen/http/status/client/cli.go index 87150b54fe..3d7c677692 100644 --- a/api/gen/http/status/client/cli.go +++ b/api/gen/http/status/client/cli.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // status HTTP client CLI support package // diff --git a/api/gen/http/status/client/client.go b/api/gen/http/status/client/client.go index d0e1e7af08..b527ab3f4a 100644 --- a/api/gen/http/status/client/client.go +++ b/api/gen/http/status/client/client.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // status client HTTP transport // diff --git a/api/gen/http/status/client/encode_decode.go b/api/gen/http/status/client/encode_decode.go index 0447478df6..cbdf7de92c 100644 --- a/api/gen/http/status/client/encode_decode.go +++ b/api/gen/http/status/client/encode_decode.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // status HTTP client encoders and decoders // diff --git a/api/gen/http/status/client/paths.go b/api/gen/http/status/client/paths.go index b72723d88c..8d059f2c5c 100644 --- a/api/gen/http/status/client/paths.go +++ b/api/gen/http/status/client/paths.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // HTTP request path constructors for the status service. // diff --git a/api/gen/http/status/client/types.go b/api/gen/http/status/client/types.go index 387ce8b2a2..ed86466d0c 100644 --- a/api/gen/http/status/client/types.go +++ b/api/gen/http/status/client/types.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // status HTTP client types // diff --git a/api/gen/http/status/server/encode_decode.go b/api/gen/http/status/server/encode_decode.go index 9d7db2161f..75543d2c4f 100644 --- a/api/gen/http/status/server/encode_decode.go +++ b/api/gen/http/status/server/encode_decode.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // status HTTP server encoders and decoders // @@ -19,7 +19,7 @@ import ( // Status endpoint. func EncodeStatusResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error { return func(ctx context.Context, w http.ResponseWriter, v interface{}) error { - res := v.(*status.StatusResult) + res, _ := v.(*status.StatusResult) enc := encoder(ctx, w) body := NewStatusResponseBody(res) w.WriteHeader(http.StatusOK) diff --git a/api/gen/http/status/server/paths.go b/api/gen/http/status/server/paths.go index c3f184df13..5d8f09d13d 100644 --- a/api/gen/http/status/server/paths.go +++ b/api/gen/http/status/server/paths.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // HTTP request path constructors for the status service. // diff --git a/api/gen/http/status/server/server.go b/api/gen/http/status/server/server.go index 9082673674..aae9c3f885 100644 --- a/api/gen/http/status/server/server.go +++ b/api/gen/http/status/server/server.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // status HTTP server // diff --git a/api/gen/http/status/server/types.go b/api/gen/http/status/server/types.go index fa89e9a2fa..dd72911567 100644 --- a/api/gen/http/status/server/types.go +++ b/api/gen/http/status/server/types.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // status HTTP server types // diff --git a/api/gen/http/swagger/client/client.go b/api/gen/http/swagger/client/client.go index 02344dc03f..8b747b57d1 100644 --- a/api/gen/http/swagger/client/client.go +++ b/api/gen/http/swagger/client/client.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // swagger client HTTP transport // diff --git a/api/gen/http/swagger/client/encode_decode.go b/api/gen/http/swagger/client/encode_decode.go index 85021764c0..736e7b6425 100644 --- a/api/gen/http/swagger/client/encode_decode.go +++ b/api/gen/http/swagger/client/encode_decode.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // swagger HTTP client encoders and decoders // diff --git a/api/gen/http/swagger/client/paths.go b/api/gen/http/swagger/client/paths.go index 2034034821..3e5c68ee62 100644 --- a/api/gen/http/swagger/client/paths.go +++ b/api/gen/http/swagger/client/paths.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // HTTP request path constructors for the swagger service. // diff --git a/api/gen/http/swagger/client/types.go b/api/gen/http/swagger/client/types.go index 164de2d01c..4ddf8cee23 100644 --- a/api/gen/http/swagger/client/types.go +++ b/api/gen/http/swagger/client/types.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // swagger HTTP client types // diff --git a/api/gen/http/swagger/server/paths.go b/api/gen/http/swagger/server/paths.go index efb12c5e49..c3c8a983fa 100644 --- a/api/gen/http/swagger/server/paths.go +++ b/api/gen/http/swagger/server/paths.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // HTTP request path constructors for the swagger service. // diff --git a/api/gen/http/swagger/server/server.go b/api/gen/http/swagger/server/server.go index 823ee1e86c..e7dbfda456 100644 --- a/api/gen/http/swagger/server/server.go +++ b/api/gen/http/swagger/server/server.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // swagger HTTP server // @@ -18,8 +18,9 @@ import ( // Server lists the swagger service endpoint HTTP handlers. type Server struct { - Mounts []*MountPoint - CORS http.Handler + Mounts []*MountPoint + CORS http.Handler + DocsOpenapi3JSON http.Handler } // ErrorNamer is an interface implemented by generated error structs that @@ -52,13 +53,18 @@ func New( encoder func(context.Context, http.ResponseWriter) goahttp.Encoder, errhandler func(context.Context, http.ResponseWriter, error), formatter func(err error) goahttp.Statuser, + fileSystemDocsOpenapi3JSON http.FileSystem, ) *Server { + if fileSystemDocsOpenapi3JSON == nil { + fileSystemDocsOpenapi3JSON = http.Dir(".") + } return &Server{ Mounts: []*MountPoint{ {"CORS", "OPTIONS", "/schema/swagger.json"}, {"docs/openapi3.json", "GET", "/schema/swagger.json"}, }, - CORS: NewCORSHandler(), + CORS: NewCORSHandler(), + DocsOpenapi3JSON: http.FileServer(fileSystemDocsOpenapi3JSON), } } @@ -73,9 +79,7 @@ func (s *Server) Use(m func(http.Handler) http.Handler) { // Mount configures the mux to serve the swagger endpoints. func Mount(mux goahttp.Muxer, h *Server) { MountCORSHandler(mux, h.CORS) - MountDocsOpenapi3JSON(mux, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - http.ServeFile(w, r, "docs/openapi3.json") - })) + MountDocsOpenapi3JSON(mux, goahttp.ReplacePrefix("/schema/swagger.json", "/docs/openapi3.json", h.DocsOpenapi3JSON)) } // MountDocsOpenapi3JSON configures the mux to serve GET request made to diff --git a/api/gen/http/swagger/server/types.go b/api/gen/http/swagger/server/types.go index 4deab87be0..97f5360b1d 100644 --- a/api/gen/http/swagger/server/types.go +++ b/api/gen/http/swagger/server/types.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // swagger HTTP server types // diff --git a/api/gen/log/logger.go b/api/gen/log/logger.go index f5be1591b0..0690dc1d7e 100644 --- a/api/gen/log/logger.go +++ b/api/gen/log/logger.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // Zap logger implementation // diff --git a/api/gen/rating/client.go b/api/gen/rating/client.go index d131dd9efb..012f42913e 100644 --- a/api/gen/rating/client.go +++ b/api/gen/rating/client.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // rating client // diff --git a/api/gen/rating/endpoints.go b/api/gen/rating/endpoints.go index 2687c959cf..8755f206c5 100644 --- a/api/gen/rating/endpoints.go +++ b/api/gen/rating/endpoints.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // rating endpoints // diff --git a/api/gen/rating/service.go b/api/gen/rating/service.go index 5ec34a1a1a..54e720e7fe 100644 --- a/api/gen/rating/service.go +++ b/api/gen/rating/service.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // rating service // diff --git a/api/gen/resource/client.go b/api/gen/resource/client.go new file mode 100644 index 0000000000..3dcf02fc3a --- /dev/null +++ b/api/gen/resource/client.go @@ -0,0 +1,36 @@ +// Code generated by goa v3.4.0, DO NOT EDIT. +// +// resource client +// +// Command: +// $ goa gen github.com/tektoncd/hub/api/design + +package resource + +import ( + "context" + + goa "goa.design/goa/v3/pkg" +) + +// Client is the "resource" service client. +type Client struct { + ListEndpoint goa.Endpoint +} + +// NewClient initializes a "resource" service client given the endpoints. +func NewClient(list goa.Endpoint) *Client { + return &Client{ + ListEndpoint: list, + } +} + +// List calls the "List" endpoint of the "resource" service. +func (c *Client) List(ctx context.Context) (res *Resources, err error) { + var ires interface{} + ires, err = c.ListEndpoint(ctx, nil) + if err != nil { + return + } + return ires.(*Resources), nil +} diff --git a/api/gen/resource/endpoints.go b/api/gen/resource/endpoints.go new file mode 100644 index 0000000000..0a2f7ae29b --- /dev/null +++ b/api/gen/resource/endpoints.go @@ -0,0 +1,44 @@ +// Code generated by goa v3.4.0, DO NOT EDIT. +// +// resource endpoints +// +// Command: +// $ goa gen github.com/tektoncd/hub/api/design + +package resource + +import ( + "context" + + goa "goa.design/goa/v3/pkg" +) + +// Endpoints wraps the "resource" service endpoints. +type Endpoints struct { + List goa.Endpoint +} + +// NewEndpoints wraps the methods of the "resource" service with endpoints. +func NewEndpoints(s Service) *Endpoints { + return &Endpoints{ + List: NewListEndpoint(s), + } +} + +// Use applies the given middleware to all the "resource" service endpoints. +func (e *Endpoints) Use(m func(goa.Endpoint) goa.Endpoint) { + e.List = m(e.List) +} + +// NewListEndpoint returns an endpoint function that calls the method "List" of +// service "resource". +func NewListEndpoint(s Service) goa.Endpoint { + return func(ctx context.Context, req interface{}) (interface{}, error) { + res, err := s.List(ctx) + if err != nil { + return nil, err + } + vres := NewViewedResources(res, "default") + return vres, nil + } +} diff --git a/api/gen/resource/service.go b/api/gen/resource/service.go new file mode 100644 index 0000000000..8f1a7454ed --- /dev/null +++ b/api/gen/resource/service.go @@ -0,0 +1,976 @@ +// Code generated by goa v3.4.0, DO NOT EDIT. +// +// resource service +// +// Command: +// $ goa gen github.com/tektoncd/hub/api/design + +package resource + +import ( + "context" + + resourceviews "github.com/tektoncd/hub/api/gen/resource/views" +) + +// The resource service provides details about all kind of resources +type Service interface { + // List all resources sorted by rating and name + List(context.Context) (res *Resources, err error) +} + +// ServiceName is the name of the service as defined in the design. This is the +// same value that is set in the endpoint request contexts under the ServiceKey +// key. +const ServiceName = "resource" + +// MethodNames lists the service method names as defined in the design. These +// are the same values that are set in the endpoint request contexts under the +// MethodKey key. +var MethodNames = [1]string{"List"} + +// Resources is the result type of the resource service List method. +type Resources struct { + Data ResourceDataCollection +} + +type ResourceDataCollection []*ResourceData + +// The resource type describes resource information. +type ResourceData struct { + // ID is the unique id of the resource + ID uint + // Name of resource + Name string + // Type of catalog to which resource belongs + Catalog *Catalog + // Categories related to resource + Categories []*Category + // Kind of resource + Kind string + // Url path of the resource in hub + HubURLPath string + // Latest version of resource + LatestVersion *ResourceVersionData + // Tags related to resource + Tags []*Tag + // Platforms related to resource + Platforms []*Platform + // Rating of resource + Rating float64 + // List of all versions of a resource + Versions []*ResourceVersionData +} + +type Catalog struct { + // ID is the unique id of the catalog + ID uint + // Name of catalog + Name string + // Type of catalog + Type string + // URL of catalog + URL string + // Provider of catalog + Provider string +} + +type Category struct { + // ID is the unique id of the category + ID uint + // Name of category + Name string +} + +// The Version result type describes resource's version information. +type ResourceVersionData struct { + // ID is the unique id of resource's version + ID uint + // Version of resource + Version string + // Display name of version + DisplayName string + // Deprecation status of a version + Deprecated *bool + // Description of version + Description string + // Minimum pipelines version the resource's version is compatible with + MinPipelinesVersion string + // Raw URL of resource's yaml file of the version + RawURL string + // Web URL of resource's yaml file of the version + WebURL string + // Timestamp when version was last updated + UpdatedAt string + // Platforms related to resource version + Platforms []*Platform + // Url path of the resource in hub + HubURLPath string + // Resource to which the version belongs + Resource *ResourceData +} + +type Platform struct { + // ID is the unique id of platform + ID uint + // Name of platform + Name string +} + +type Tag struct { + // ID is the unique id of tag + ID uint + // Name of tag + Name string +} + +// NewResources initializes result type Resources from viewed result type +// Resources. +func NewResources(vres *resourceviews.Resources) *Resources { + return newResources(vres.Projected) +} + +// NewViewedResources initializes viewed result type Resources from result type +// Resources using the given view. +func NewViewedResources(res *Resources, view string) *resourceviews.Resources { + p := newResourcesView(res) + return &resourceviews.Resources{Projected: p, View: "default"} +} + +// newResources converts projected type Resources to service type Resources. +func newResources(vres *resourceviews.ResourcesView) *Resources { + res := &Resources{} + if vres.Data != nil { + res.Data = newResourceDataCollectionWithoutVersion(vres.Data) + } + return res +} + +// newResourcesView projects result type Resources to projected type +// ResourcesView using the "default" view. +func newResourcesView(res *Resources) *resourceviews.ResourcesView { + vres := &resourceviews.ResourcesView{} + if res.Data != nil { + vres.Data = newResourceDataCollectionViewWithoutVersion(res.Data) + } + return vres +} + +// newResourceDataCollectionInfo converts projected type ResourceDataCollection +// to service type ResourceDataCollection. +func newResourceDataCollectionInfo(vres resourceviews.ResourceDataCollectionView) ResourceDataCollection { + res := make(ResourceDataCollection, len(vres)) + for i, n := range vres { + res[i] = newResourceDataInfo(n) + } + return res +} + +// newResourceDataCollectionWithoutVersion converts projected type +// ResourceDataCollection to service type ResourceDataCollection. +func newResourceDataCollectionWithoutVersion(vres resourceviews.ResourceDataCollectionView) ResourceDataCollection { + res := make(ResourceDataCollection, len(vres)) + for i, n := range vres { + res[i] = newResourceDataWithoutVersion(n) + } + return res +} + +// newResourceDataCollection converts projected type ResourceDataCollection to +// service type ResourceDataCollection. +func newResourceDataCollection(vres resourceviews.ResourceDataCollectionView) ResourceDataCollection { + res := make(ResourceDataCollection, len(vres)) + for i, n := range vres { + res[i] = newResourceData(n) + } + return res +} + +// newResourceDataCollectionViewInfo projects result type +// ResourceDataCollection to projected type ResourceDataCollectionView using +// the "info" view. +func newResourceDataCollectionViewInfo(res ResourceDataCollection) resourceviews.ResourceDataCollectionView { + vres := make(resourceviews.ResourceDataCollectionView, len(res)) + for i, n := range res { + vres[i] = newResourceDataViewInfo(n) + } + return vres +} + +// newResourceDataCollectionViewWithoutVersion projects result type +// ResourceDataCollection to projected type ResourceDataCollectionView using +// the "withoutVersion" view. +func newResourceDataCollectionViewWithoutVersion(res ResourceDataCollection) resourceviews.ResourceDataCollectionView { + vres := make(resourceviews.ResourceDataCollectionView, len(res)) + for i, n := range res { + vres[i] = newResourceDataViewWithoutVersion(n) + } + return vres +} + +// newResourceDataCollectionView projects result type ResourceDataCollection to +// projected type ResourceDataCollectionView using the "default" view. +func newResourceDataCollectionView(res ResourceDataCollection) resourceviews.ResourceDataCollectionView { + vres := make(resourceviews.ResourceDataCollectionView, len(res)) + for i, n := range res { + vres[i] = newResourceDataView(n) + } + return vres +} + +// newResourceDataInfo converts projected type ResourceData to service type +// ResourceData. +func newResourceDataInfo(vres *resourceviews.ResourceDataView) *ResourceData { + res := &ResourceData{} + if vres.ID != nil { + res.ID = *vres.ID + } + if vres.Name != nil { + res.Name = *vres.Name + } + if vres.Kind != nil { + res.Kind = *vres.Kind + } + if vres.HubURLPath != nil { + res.HubURLPath = *vres.HubURLPath + } + if vres.Rating != nil { + res.Rating = *vres.Rating + } + if vres.Categories != nil { + res.Categories = make([]*Category, len(vres.Categories)) + for i, val := range vres.Categories { + res.Categories[i] = transformResourceviewsCategoryViewToCategory(val) + } + } + if vres.Tags != nil { + res.Tags = make([]*Tag, len(vres.Tags)) + for i, val := range vres.Tags { + res.Tags[i] = transformResourceviewsTagViewToTag(val) + } + } + if vres.Platforms != nil { + res.Platforms = make([]*Platform, len(vres.Platforms)) + for i, val := range vres.Platforms { + res.Platforms[i] = transformResourceviewsPlatformViewToPlatform(val) + } + } + if vres.Catalog != nil { + res.Catalog = newCatalogMin(vres.Catalog) + } + if vres.LatestVersion != nil { + res.LatestVersion = newResourceVersionData(vres.LatestVersion) + } + return res +} + +// newResourceDataWithoutVersion converts projected type ResourceData to +// service type ResourceData. +func newResourceDataWithoutVersion(vres *resourceviews.ResourceDataView) *ResourceData { + res := &ResourceData{} + if vres.ID != nil { + res.ID = *vres.ID + } + if vres.Name != nil { + res.Name = *vres.Name + } + if vres.Kind != nil { + res.Kind = *vres.Kind + } + if vres.HubURLPath != nil { + res.HubURLPath = *vres.HubURLPath + } + if vres.Rating != nil { + res.Rating = *vres.Rating + } + if vres.Categories != nil { + res.Categories = make([]*Category, len(vres.Categories)) + for i, val := range vres.Categories { + res.Categories[i] = transformResourceviewsCategoryViewToCategory(val) + } + } + if vres.Tags != nil { + res.Tags = make([]*Tag, len(vres.Tags)) + for i, val := range vres.Tags { + res.Tags[i] = transformResourceviewsTagViewToTag(val) + } + } + if vres.Platforms != nil { + res.Platforms = make([]*Platform, len(vres.Platforms)) + for i, val := range vres.Platforms { + res.Platforms[i] = transformResourceviewsPlatformViewToPlatform(val) + } + } + if vres.Catalog != nil { + res.Catalog = newCatalogMin(vres.Catalog) + } + if vres.LatestVersion != nil { + res.LatestVersion = newResourceVersionDataWithoutResource(vres.LatestVersion) + } + return res +} + +// newResourceData converts projected type ResourceData to service type +// ResourceData. +func newResourceData(vres *resourceviews.ResourceDataView) *ResourceData { + res := &ResourceData{} + if vres.ID != nil { + res.ID = *vres.ID + } + if vres.Name != nil { + res.Name = *vres.Name + } + if vres.Kind != nil { + res.Kind = *vres.Kind + } + if vres.HubURLPath != nil { + res.HubURLPath = *vres.HubURLPath + } + if vres.Rating != nil { + res.Rating = *vres.Rating + } + if vres.Categories != nil { + res.Categories = make([]*Category, len(vres.Categories)) + for i, val := range vres.Categories { + res.Categories[i] = transformResourceviewsCategoryViewToCategory(val) + } + } + if vres.Tags != nil { + res.Tags = make([]*Tag, len(vres.Tags)) + for i, val := range vres.Tags { + res.Tags[i] = transformResourceviewsTagViewToTag(val) + } + } + if vres.Platforms != nil { + res.Platforms = make([]*Platform, len(vres.Platforms)) + for i, val := range vres.Platforms { + res.Platforms[i] = transformResourceviewsPlatformViewToPlatform(val) + } + } + if vres.Versions != nil { + res.Versions = make([]*ResourceVersionData, len(vres.Versions)) + for i, val := range vres.Versions { + res.Versions[i] = transformResourceviewsResourceVersionDataViewToResourceVersionData(val) + } + } + if vres.Catalog != nil { + res.Catalog = newCatalogMin(vres.Catalog) + } + if vres.LatestVersion != nil { + res.LatestVersion = newResourceVersionDataWithoutResource(vres.LatestVersion) + } + return res +} + +// newResourceDataViewInfo projects result type ResourceData to projected type +// ResourceDataView using the "info" view. +func newResourceDataViewInfo(res *ResourceData) *resourceviews.ResourceDataView { + vres := &resourceviews.ResourceDataView{ + ID: &res.ID, + Name: &res.Name, + Kind: &res.Kind, + HubURLPath: &res.HubURLPath, + Rating: &res.Rating, + } + if res.Categories != nil { + vres.Categories = make([]*resourceviews.CategoryView, len(res.Categories)) + for i, val := range res.Categories { + vres.Categories[i] = transformCategoryToResourceviewsCategoryView(val) + } + } + if res.Tags != nil { + vres.Tags = make([]*resourceviews.TagView, len(res.Tags)) + for i, val := range res.Tags { + vres.Tags[i] = transformTagToResourceviewsTagView(val) + } + } + if res.Platforms != nil { + vres.Platforms = make([]*resourceviews.PlatformView, len(res.Platforms)) + for i, val := range res.Platforms { + vres.Platforms[i] = transformPlatformToResourceviewsPlatformView(val) + } + } + if res.Catalog != nil { + vres.Catalog = newCatalogViewMin(res.Catalog) + } + return vres +} + +// newResourceDataViewWithoutVersion projects result type ResourceData to +// projected type ResourceDataView using the "withoutVersion" view. +func newResourceDataViewWithoutVersion(res *ResourceData) *resourceviews.ResourceDataView { + vres := &resourceviews.ResourceDataView{ + ID: &res.ID, + Name: &res.Name, + Kind: &res.Kind, + HubURLPath: &res.HubURLPath, + Rating: &res.Rating, + } + if res.Categories != nil { + vres.Categories = make([]*resourceviews.CategoryView, len(res.Categories)) + for i, val := range res.Categories { + vres.Categories[i] = transformCategoryToResourceviewsCategoryView(val) + } + } + if res.Tags != nil { + vres.Tags = make([]*resourceviews.TagView, len(res.Tags)) + for i, val := range res.Tags { + vres.Tags[i] = transformTagToResourceviewsTagView(val) + } + } + if res.Platforms != nil { + vres.Platforms = make([]*resourceviews.PlatformView, len(res.Platforms)) + for i, val := range res.Platforms { + vres.Platforms[i] = transformPlatformToResourceviewsPlatformView(val) + } + } + if res.Catalog != nil { + vres.Catalog = newCatalogViewMin(res.Catalog) + } + if res.LatestVersion != nil { + vres.LatestVersion = newResourceVersionDataViewWithoutResource(res.LatestVersion) + } + return vres +} + +// newResourceDataView projects result type ResourceData to projected type +// ResourceDataView using the "default" view. +func newResourceDataView(res *ResourceData) *resourceviews.ResourceDataView { + vres := &resourceviews.ResourceDataView{ + ID: &res.ID, + Name: &res.Name, + Kind: &res.Kind, + HubURLPath: &res.HubURLPath, + Rating: &res.Rating, + } + if res.Categories != nil { + vres.Categories = make([]*resourceviews.CategoryView, len(res.Categories)) + for i, val := range res.Categories { + vres.Categories[i] = transformCategoryToResourceviewsCategoryView(val) + } + } + if res.Tags != nil { + vres.Tags = make([]*resourceviews.TagView, len(res.Tags)) + for i, val := range res.Tags { + vres.Tags[i] = transformTagToResourceviewsTagView(val) + } + } + if res.Platforms != nil { + vres.Platforms = make([]*resourceviews.PlatformView, len(res.Platforms)) + for i, val := range res.Platforms { + vres.Platforms[i] = transformPlatformToResourceviewsPlatformView(val) + } + } + if res.Versions != nil { + vres.Versions = make([]*resourceviews.ResourceVersionDataView, len(res.Versions)) + for i, val := range res.Versions { + vres.Versions[i] = transformResourceVersionDataToResourceviewsResourceVersionDataView(val) + } + } + if res.Catalog != nil { + vres.Catalog = newCatalogViewMin(res.Catalog) + } + if res.LatestVersion != nil { + vres.LatestVersion = newResourceVersionDataViewWithoutResource(res.LatestVersion) + } + return vres +} + +// newCatalogMin converts projected type Catalog to service type Catalog. +func newCatalogMin(vres *resourceviews.CatalogView) *Catalog { + res := &Catalog{} + if vres.ID != nil { + res.ID = *vres.ID + } + if vres.Name != nil { + res.Name = *vres.Name + } + if vres.Type != nil { + res.Type = *vres.Type + } + return res +} + +// newCatalog converts projected type Catalog to service type Catalog. +func newCatalog(vres *resourceviews.CatalogView) *Catalog { + res := &Catalog{} + if vres.ID != nil { + res.ID = *vres.ID + } + if vres.Name != nil { + res.Name = *vres.Name + } + if vres.Type != nil { + res.Type = *vres.Type + } + if vres.URL != nil { + res.URL = *vres.URL + } + if vres.Provider != nil { + res.Provider = *vres.Provider + } + return res +} + +// newCatalogViewMin projects result type Catalog to projected type CatalogView +// using the "min" view. +func newCatalogViewMin(res *Catalog) *resourceviews.CatalogView { + vres := &resourceviews.CatalogView{ + ID: &res.ID, + Name: &res.Name, + Type: &res.Type, + } + return vres +} + +// newCatalogView projects result type Catalog to projected type CatalogView +// using the "default" view. +func newCatalogView(res *Catalog) *resourceviews.CatalogView { + vres := &resourceviews.CatalogView{ + ID: &res.ID, + Name: &res.Name, + Type: &res.Type, + URL: &res.URL, + Provider: &res.Provider, + } + return vres +} + +// newResourceVersionDataTiny converts projected type ResourceVersionData to +// service type ResourceVersionData. +func newResourceVersionDataTiny(vres *resourceviews.ResourceVersionDataView) *ResourceVersionData { + res := &ResourceVersionData{} + if vres.ID != nil { + res.ID = *vres.ID + } + if vres.Version != nil { + res.Version = *vres.Version + } + if vres.Resource != nil { + res.Resource = newResourceData(vres.Resource) + } + return res +} + +// newResourceVersionDataMin converts projected type ResourceVersionData to +// service type ResourceVersionData. +func newResourceVersionDataMin(vres *resourceviews.ResourceVersionDataView) *ResourceVersionData { + res := &ResourceVersionData{} + if vres.ID != nil { + res.ID = *vres.ID + } + if vres.Version != nil { + res.Version = *vres.Version + } + if vres.RawURL != nil { + res.RawURL = *vres.RawURL + } + if vres.WebURL != nil { + res.WebURL = *vres.WebURL + } + if vres.HubURLPath != nil { + res.HubURLPath = *vres.HubURLPath + } + if vres.Platforms != nil { + res.Platforms = make([]*Platform, len(vres.Platforms)) + for i, val := range vres.Platforms { + res.Platforms[i] = transformResourceviewsPlatformViewToPlatform(val) + } + } + if vres.Resource != nil { + res.Resource = newResourceData(vres.Resource) + } + return res +} + +// newResourceVersionDataWithoutResource converts projected type +// ResourceVersionData to service type ResourceVersionData. +func newResourceVersionDataWithoutResource(vres *resourceviews.ResourceVersionDataView) *ResourceVersionData { + res := &ResourceVersionData{ + Deprecated: vres.Deprecated, + } + if vres.ID != nil { + res.ID = *vres.ID + } + if vres.Version != nil { + res.Version = *vres.Version + } + if vres.DisplayName != nil { + res.DisplayName = *vres.DisplayName + } + if vres.Description != nil { + res.Description = *vres.Description + } + if vres.MinPipelinesVersion != nil { + res.MinPipelinesVersion = *vres.MinPipelinesVersion + } + if vres.RawURL != nil { + res.RawURL = *vres.RawURL + } + if vres.WebURL != nil { + res.WebURL = *vres.WebURL + } + if vres.HubURLPath != nil { + res.HubURLPath = *vres.HubURLPath + } + if vres.UpdatedAt != nil { + res.UpdatedAt = *vres.UpdatedAt + } + if vres.Platforms != nil { + res.Platforms = make([]*Platform, len(vres.Platforms)) + for i, val := range vres.Platforms { + res.Platforms[i] = transformResourceviewsPlatformViewToPlatform(val) + } + } + if vres.Resource != nil { + res.Resource = newResourceData(vres.Resource) + } + return res +} + +// newResourceVersionData converts projected type ResourceVersionData to +// service type ResourceVersionData. +func newResourceVersionData(vres *resourceviews.ResourceVersionDataView) *ResourceVersionData { + res := &ResourceVersionData{ + Deprecated: vres.Deprecated, + } + if vres.ID != nil { + res.ID = *vres.ID + } + if vres.Version != nil { + res.Version = *vres.Version + } + if vres.DisplayName != nil { + res.DisplayName = *vres.DisplayName + } + if vres.Description != nil { + res.Description = *vres.Description + } + if vres.MinPipelinesVersion != nil { + res.MinPipelinesVersion = *vres.MinPipelinesVersion + } + if vres.RawURL != nil { + res.RawURL = *vres.RawURL + } + if vres.WebURL != nil { + res.WebURL = *vres.WebURL + } + if vres.HubURLPath != nil { + res.HubURLPath = *vres.HubURLPath + } + if vres.UpdatedAt != nil { + res.UpdatedAt = *vres.UpdatedAt + } + if vres.Platforms != nil { + res.Platforms = make([]*Platform, len(vres.Platforms)) + for i, val := range vres.Platforms { + res.Platforms[i] = transformResourceviewsPlatformViewToPlatform(val) + } + } + if vres.Resource != nil { + res.Resource = newResourceDataInfo(vres.Resource) + } + return res +} + +// newResourceVersionDataViewTiny projects result type ResourceVersionData to +// projected type ResourceVersionDataView using the "tiny" view. +func newResourceVersionDataViewTiny(res *ResourceVersionData) *resourceviews.ResourceVersionDataView { + vres := &resourceviews.ResourceVersionDataView{ + ID: &res.ID, + Version: &res.Version, + } + return vres +} + +// newResourceVersionDataViewMin projects result type ResourceVersionData to +// projected type ResourceVersionDataView using the "min" view. +func newResourceVersionDataViewMin(res *ResourceVersionData) *resourceviews.ResourceVersionDataView { + vres := &resourceviews.ResourceVersionDataView{ + ID: &res.ID, + Version: &res.Version, + RawURL: &res.RawURL, + WebURL: &res.WebURL, + HubURLPath: &res.HubURLPath, + } + if res.Platforms != nil { + vres.Platforms = make([]*resourceviews.PlatformView, len(res.Platforms)) + for i, val := range res.Platforms { + vres.Platforms[i] = transformPlatformToResourceviewsPlatformView(val) + } + } + return vres +} + +// newResourceVersionDataViewWithoutResource projects result type +// ResourceVersionData to projected type ResourceVersionDataView using the +// "withoutResource" view. +func newResourceVersionDataViewWithoutResource(res *ResourceVersionData) *resourceviews.ResourceVersionDataView { + vres := &resourceviews.ResourceVersionDataView{ + ID: &res.ID, + Version: &res.Version, + DisplayName: &res.DisplayName, + Deprecated: res.Deprecated, + Description: &res.Description, + MinPipelinesVersion: &res.MinPipelinesVersion, + RawURL: &res.RawURL, + WebURL: &res.WebURL, + UpdatedAt: &res.UpdatedAt, + HubURLPath: &res.HubURLPath, + } + if res.Platforms != nil { + vres.Platforms = make([]*resourceviews.PlatformView, len(res.Platforms)) + for i, val := range res.Platforms { + vres.Platforms[i] = transformPlatformToResourceviewsPlatformView(val) + } + } + return vres +} + +// newResourceVersionDataView projects result type ResourceVersionData to +// projected type ResourceVersionDataView using the "default" view. +func newResourceVersionDataView(res *ResourceVersionData) *resourceviews.ResourceVersionDataView { + vres := &resourceviews.ResourceVersionDataView{ + ID: &res.ID, + Version: &res.Version, + DisplayName: &res.DisplayName, + Deprecated: res.Deprecated, + Description: &res.Description, + MinPipelinesVersion: &res.MinPipelinesVersion, + RawURL: &res.RawURL, + WebURL: &res.WebURL, + UpdatedAt: &res.UpdatedAt, + HubURLPath: &res.HubURLPath, + } + if res.Platforms != nil { + vres.Platforms = make([]*resourceviews.PlatformView, len(res.Platforms)) + for i, val := range res.Platforms { + vres.Platforms[i] = transformPlatformToResourceviewsPlatformView(val) + } + } + if res.Resource != nil { + vres.Resource = newResourceDataViewInfo(res.Resource) + } + return vres +} + +// transformResourceviewsCategoryViewToCategory builds a value of type +// *Category from a value of type *resourceviews.CategoryView. +func transformResourceviewsCategoryViewToCategory(v *resourceviews.CategoryView) *Category { + if v == nil { + return nil + } + res := &Category{ + ID: *v.ID, + Name: *v.Name, + } + + return res +} + +// transformResourceviewsTagViewToTag builds a value of type *Tag from a value +// of type *resourceviews.TagView. +func transformResourceviewsTagViewToTag(v *resourceviews.TagView) *Tag { + if v == nil { + return nil + } + res := &Tag{ + ID: *v.ID, + Name: *v.Name, + } + + return res +} + +// transformResourceviewsPlatformViewToPlatform builds a value of type +// *Platform from a value of type *resourceviews.PlatformView. +func transformResourceviewsPlatformViewToPlatform(v *resourceviews.PlatformView) *Platform { + if v == nil { + return nil + } + res := &Platform{ + ID: *v.ID, + Name: *v.Name, + } + + return res +} + +// transformResourceviewsResourceVersionDataViewToResourceVersionData builds a +// value of type *ResourceVersionData from a value of type +// *resourceviews.ResourceVersionDataView. +func transformResourceviewsResourceVersionDataViewToResourceVersionData(v *resourceviews.ResourceVersionDataView) *ResourceVersionData { + if v == nil { + return nil + } + res := &ResourceVersionData{ + ID: *v.ID, + Version: *v.Version, + DisplayName: *v.DisplayName, + Deprecated: v.Deprecated, + Description: *v.Description, + MinPipelinesVersion: *v.MinPipelinesVersion, + RawURL: *v.RawURL, + WebURL: *v.WebURL, + UpdatedAt: *v.UpdatedAt, + HubURLPath: *v.HubURLPath, + } + if v.Platforms != nil { + res.Platforms = make([]*Platform, len(v.Platforms)) + for i, val := range v.Platforms { + res.Platforms[i] = transformResourceviewsPlatformViewToPlatform(val) + } + } + if v.Resource != nil { + res.Resource = transformResourceviewsResourceDataViewToResourceData(v.Resource) + } + + return res +} + +// transformResourceviewsResourceDataViewToResourceData builds a value of type +// *ResourceData from a value of type *resourceviews.ResourceDataView. +func transformResourceviewsResourceDataViewToResourceData(v *resourceviews.ResourceDataView) *ResourceData { + res := &ResourceData{} + if v.ID != nil { + res.ID = *v.ID + } + if v.Name != nil { + res.Name = *v.Name + } + if v.Kind != nil { + res.Kind = *v.Kind + } + if v.HubURLPath != nil { + res.HubURLPath = *v.HubURLPath + } + if v.Rating != nil { + res.Rating = *v.Rating + } + if v.Categories != nil { + res.Categories = make([]*Category, len(v.Categories)) + for i, val := range v.Categories { + res.Categories[i] = transformResourceviewsCategoryViewToCategory(val) + } + } + if v.Tags != nil { + res.Tags = make([]*Tag, len(v.Tags)) + for i, val := range v.Tags { + res.Tags[i] = transformResourceviewsTagViewToTag(val) + } + } + if v.Platforms != nil { + res.Platforms = make([]*Platform, len(v.Platforms)) + for i, val := range v.Platforms { + res.Platforms[i] = transformResourceviewsPlatformViewToPlatform(val) + } + } + if v.Versions != nil { + res.Versions = make([]*ResourceVersionData, len(v.Versions)) + for i, val := range v.Versions { + res.Versions[i] = transformResourceviewsResourceVersionDataViewToResourceVersionData(val) + } + } + + return res +} + +// transformCategoryToResourceviewsCategoryView builds a value of type +// *resourceviews.CategoryView from a value of type *Category. +func transformCategoryToResourceviewsCategoryView(v *Category) *resourceviews.CategoryView { + res := &resourceviews.CategoryView{ + ID: &v.ID, + Name: &v.Name, + } + + return res +} + +// transformTagToResourceviewsTagView builds a value of type +// *resourceviews.TagView from a value of type *Tag. +func transformTagToResourceviewsTagView(v *Tag) *resourceviews.TagView { + res := &resourceviews.TagView{ + ID: &v.ID, + Name: &v.Name, + } + + return res +} + +// transformPlatformToResourceviewsPlatformView builds a value of type +// *resourceviews.PlatformView from a value of type *Platform. +func transformPlatformToResourceviewsPlatformView(v *Platform) *resourceviews.PlatformView { + res := &resourceviews.PlatformView{ + ID: &v.ID, + Name: &v.Name, + } + + return res +} + +// transformResourceVersionDataToResourceviewsResourceVersionDataView builds a +// value of type *resourceviews.ResourceVersionDataView from a value of type +// *ResourceVersionData. +func transformResourceVersionDataToResourceviewsResourceVersionDataView(v *ResourceVersionData) *resourceviews.ResourceVersionDataView { + res := &resourceviews.ResourceVersionDataView{ + ID: &v.ID, + Version: &v.Version, + DisplayName: &v.DisplayName, + Deprecated: v.Deprecated, + Description: &v.Description, + MinPipelinesVersion: &v.MinPipelinesVersion, + RawURL: &v.RawURL, + WebURL: &v.WebURL, + UpdatedAt: &v.UpdatedAt, + HubURLPath: &v.HubURLPath, + } + if v.Platforms != nil { + res.Platforms = make([]*resourceviews.PlatformView, len(v.Platforms)) + for i, val := range v.Platforms { + res.Platforms[i] = transformPlatformToResourceviewsPlatformView(val) + } + } + if v.Resource != nil { + res.Resource = transformResourceDataToResourceviewsResourceDataView(v.Resource) + } + + return res +} + +// transformResourceDataToResourceviewsResourceDataView builds a value of type +// *resourceviews.ResourceDataView from a value of type *ResourceData. +func transformResourceDataToResourceviewsResourceDataView(v *ResourceData) *resourceviews.ResourceDataView { + res := &resourceviews.ResourceDataView{ + ID: &v.ID, + Name: &v.Name, + Kind: &v.Kind, + HubURLPath: &v.HubURLPath, + Rating: &v.Rating, + } + if v.Categories != nil { + res.Categories = make([]*resourceviews.CategoryView, len(v.Categories)) + for i, val := range v.Categories { + res.Categories[i] = transformCategoryToResourceviewsCategoryView(val) + } + } + if v.Tags != nil { + res.Tags = make([]*resourceviews.TagView, len(v.Tags)) + for i, val := range v.Tags { + res.Tags[i] = transformTagToResourceviewsTagView(val) + } + } + if v.Platforms != nil { + res.Platforms = make([]*resourceviews.PlatformView, len(v.Platforms)) + for i, val := range v.Platforms { + res.Platforms[i] = transformPlatformToResourceviewsPlatformView(val) + } + } + if v.Versions != nil { + res.Versions = make([]*resourceviews.ResourceVersionDataView, len(v.Versions)) + for i, val := range v.Versions { + res.Versions[i] = transformResourceVersionDataToResourceviewsResourceVersionDataView(val) + } + } + + return res +} diff --git a/api/gen/resource/views/view.go b/api/gen/resource/views/view.go new file mode 100644 index 0000000000..179a138943 --- /dev/null +++ b/api/gen/resource/views/view.go @@ -0,0 +1,752 @@ +// Code generated by goa v3.4.0, DO NOT EDIT. +// +// resource views +// +// Command: +// $ goa gen github.com/tektoncd/hub/api/design + +package views + +import ( + goa "goa.design/goa/v3/pkg" +) + +// Resources is the viewed result type that is projected based on a view. +type Resources struct { + // Type to project + Projected *ResourcesView + // View to render + View string +} + +// ResourcesView is a type that runs validations on a projected type. +type ResourcesView struct { + Data ResourceDataCollectionView +} + +// ResourceDataCollectionView is a type that runs validations on a projected +// type. +type ResourceDataCollectionView []*ResourceDataView + +// ResourceDataView is a type that runs validations on a projected type. +type ResourceDataView struct { + // ID is the unique id of the resource + ID *uint + // Name of resource + Name *string + // Type of catalog to which resource belongs + Catalog *CatalogView + // Categories related to resource + Categories []*CategoryView + // Kind of resource + Kind *string + // Url path of the resource in hub + HubURLPath *string + // Latest version of resource + LatestVersion *ResourceVersionDataView + // Tags related to resource + Tags []*TagView + // Platforms related to resource + Platforms []*PlatformView + // Rating of resource + Rating *float64 + // List of all versions of a resource + Versions []*ResourceVersionDataView +} + +// CatalogView is a type that runs validations on a projected type. +type CatalogView struct { + // ID is the unique id of the catalog + ID *uint + // Name of catalog + Name *string + // Type of catalog + Type *string + // URL of catalog + URL *string + // Provider of catalog + Provider *string +} + +// CategoryView is a type that runs validations on a projected type. +type CategoryView struct { + // ID is the unique id of the category + ID *uint + // Name of category + Name *string +} + +// ResourceVersionDataView is a type that runs validations on a projected type. +type ResourceVersionDataView struct { + // ID is the unique id of resource's version + ID *uint + // Version of resource + Version *string + // Display name of version + DisplayName *string + // Deprecation status of a version + Deprecated *bool + // Description of version + Description *string + // Minimum pipelines version the resource's version is compatible with + MinPipelinesVersion *string + // Raw URL of resource's yaml file of the version + RawURL *string + // Web URL of resource's yaml file of the version + WebURL *string + // Timestamp when version was last updated + UpdatedAt *string + // Platforms related to resource version + Platforms []*PlatformView + // Url path of the resource in hub + HubURLPath *string + // Resource to which the version belongs + Resource *ResourceDataView +} + +// PlatformView is a type that runs validations on a projected type. +type PlatformView struct { + // ID is the unique id of platform + ID *uint + // Name of platform + Name *string +} + +// TagView is a type that runs validations on a projected type. +type TagView struct { + // ID is the unique id of tag + ID *uint + // Name of tag + Name *string +} + +var ( + // ResourcesMap is a map of attribute names in result type Resources indexed by + // view name. + ResourcesMap = map[string][]string{ + "default": []string{ + "data", + }, + } + // ResourceDataCollectionMap is a map of attribute names in result type + // ResourceDataCollection indexed by view name. + ResourceDataCollectionMap = map[string][]string{ + "info": []string{ + "id", + "name", + "catalog", + "categories", + "kind", + "hubURLPath", + "tags", + "platforms", + "rating", + }, + "withoutVersion": []string{ + "id", + "name", + "catalog", + "categories", + "kind", + "hubURLPath", + "latestVersion", + "tags", + "platforms", + "rating", + }, + "default": []string{ + "id", + "name", + "catalog", + "categories", + "kind", + "hubURLPath", + "latestVersion", + "tags", + "platforms", + "rating", + "versions", + }, + } + // ResourceDataMap is a map of attribute names in result type ResourceData + // indexed by view name. + ResourceDataMap = map[string][]string{ + "info": []string{ + "id", + "name", + "catalog", + "categories", + "kind", + "hubURLPath", + "tags", + "platforms", + "rating", + }, + "withoutVersion": []string{ + "id", + "name", + "catalog", + "categories", + "kind", + "hubURLPath", + "latestVersion", + "tags", + "platforms", + "rating", + }, + "default": []string{ + "id", + "name", + "catalog", + "categories", + "kind", + "hubURLPath", + "latestVersion", + "tags", + "platforms", + "rating", + "versions", + }, + } + // CatalogMap is a map of attribute names in result type Catalog indexed by + // view name. + CatalogMap = map[string][]string{ + "min": []string{ + "id", + "name", + "type", + }, + "default": []string{ + "id", + "name", + "type", + "url", + "provider", + }, + } + // ResourceVersionDataMap is a map of attribute names in result type + // ResourceVersionData indexed by view name. + ResourceVersionDataMap = map[string][]string{ + "tiny": []string{ + "id", + "version", + }, + "min": []string{ + "id", + "version", + "rawURL", + "webURL", + "hubURLPath", + "platforms", + }, + "withoutResource": []string{ + "id", + "version", + "displayName", + "deprecated", + "description", + "minPipelinesVersion", + "rawURL", + "webURL", + "hubURLPath", + "updatedAt", + "platforms", + }, + "default": []string{ + "id", + "version", + "displayName", + "deprecated", + "description", + "minPipelinesVersion", + "rawURL", + "webURL", + "hubURLPath", + "updatedAt", + "resource", + "platforms", + }, + } +) + +// ValidateResources runs the validations defined on the viewed result type +// Resources. +func ValidateResources(result *Resources) (err error) { + switch result.View { + case "default", "": + err = ValidateResourcesView(result.Projected) + default: + err = goa.InvalidEnumValueError("view", result.View, []interface{}{"default"}) + } + return +} + +// ValidateResourcesView runs the validations defined on ResourcesView using +// the "default" view. +func ValidateResourcesView(result *ResourcesView) (err error) { + + if result.Data != nil { + if err2 := ValidateResourceDataCollectionViewWithoutVersion(result.Data); err2 != nil { + err = goa.MergeErrors(err, err2) + } + } + return +} + +// ValidateResourceDataCollectionViewInfo runs the validations defined on +// ResourceDataCollectionView using the "info" view. +func ValidateResourceDataCollectionViewInfo(result ResourceDataCollectionView) (err error) { + for _, item := range result { + if err2 := ValidateResourceDataViewInfo(item); err2 != nil { + err = goa.MergeErrors(err, err2) + } + } + return +} + +// ValidateResourceDataCollectionViewWithoutVersion runs the validations +// defined on ResourceDataCollectionView using the "withoutVersion" view. +func ValidateResourceDataCollectionViewWithoutVersion(result ResourceDataCollectionView) (err error) { + for _, item := range result { + if err2 := ValidateResourceDataViewWithoutVersion(item); err2 != nil { + err = goa.MergeErrors(err, err2) + } + } + return +} + +// ValidateResourceDataCollectionView runs the validations defined on +// ResourceDataCollectionView using the "default" view. +func ValidateResourceDataCollectionView(result ResourceDataCollectionView) (err error) { + for _, item := range result { + if err2 := ValidateResourceDataView(item); err2 != nil { + err = goa.MergeErrors(err, err2) + } + } + return +} + +// ValidateResourceDataViewInfo runs the validations defined on +// ResourceDataView using the "info" view. +func ValidateResourceDataViewInfo(result *ResourceDataView) (err error) { + if result.ID == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("id", "result")) + } + if result.Name == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("name", "result")) + } + if result.Categories == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("categories", "result")) + } + if result.Kind == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("kind", "result")) + } + if result.HubURLPath == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("hubURLPath", "result")) + } + if result.Tags == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("tags", "result")) + } + if result.Platforms == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("platforms", "result")) + } + if result.Rating == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("rating", "result")) + } + for _, e := range result.Categories { + if e != nil { + if err2 := ValidateCategoryView(e); err2 != nil { + err = goa.MergeErrors(err, err2) + } + } + } + for _, e := range result.Tags { + if e != nil { + if err2 := ValidateTagView(e); err2 != nil { + err = goa.MergeErrors(err, err2) + } + } + } + for _, e := range result.Platforms { + if e != nil { + if err2 := ValidatePlatformView(e); err2 != nil { + err = goa.MergeErrors(err, err2) + } + } + } + if result.Catalog != nil { + if err2 := ValidateCatalogViewMin(result.Catalog); err2 != nil { + err = goa.MergeErrors(err, err2) + } + } + return +} + +// ValidateResourceDataViewWithoutVersion runs the validations defined on +// ResourceDataView using the "withoutVersion" view. +func ValidateResourceDataViewWithoutVersion(result *ResourceDataView) (err error) { + if result.ID == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("id", "result")) + } + if result.Name == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("name", "result")) + } + if result.Categories == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("categories", "result")) + } + if result.Kind == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("kind", "result")) + } + if result.HubURLPath == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("hubURLPath", "result")) + } + if result.Tags == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("tags", "result")) + } + if result.Platforms == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("platforms", "result")) + } + if result.Rating == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("rating", "result")) + } + for _, e := range result.Categories { + if e != nil { + if err2 := ValidateCategoryView(e); err2 != nil { + err = goa.MergeErrors(err, err2) + } + } + } + for _, e := range result.Tags { + if e != nil { + if err2 := ValidateTagView(e); err2 != nil { + err = goa.MergeErrors(err, err2) + } + } + } + for _, e := range result.Platforms { + if e != nil { + if err2 := ValidatePlatformView(e); err2 != nil { + err = goa.MergeErrors(err, err2) + } + } + } + if result.Catalog != nil { + if err2 := ValidateCatalogViewMin(result.Catalog); err2 != nil { + err = goa.MergeErrors(err, err2) + } + } + if result.LatestVersion != nil { + if err2 := ValidateResourceVersionDataViewWithoutResource(result.LatestVersion); err2 != nil { + err = goa.MergeErrors(err, err2) + } + } + return +} + +// ValidateResourceDataView runs the validations defined on ResourceDataView +// using the "default" view. +func ValidateResourceDataView(result *ResourceDataView) (err error) { + if result.ID == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("id", "result")) + } + if result.Name == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("name", "result")) + } + if result.Categories == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("categories", "result")) + } + if result.Kind == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("kind", "result")) + } + if result.HubURLPath == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("hubURLPath", "result")) + } + if result.Tags == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("tags", "result")) + } + if result.Platforms == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("platforms", "result")) + } + if result.Rating == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("rating", "result")) + } + if result.Versions == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("versions", "result")) + } + for _, e := range result.Categories { + if e != nil { + if err2 := ValidateCategoryView(e); err2 != nil { + err = goa.MergeErrors(err, err2) + } + } + } + for _, e := range result.Tags { + if e != nil { + if err2 := ValidateTagView(e); err2 != nil { + err = goa.MergeErrors(err, err2) + } + } + } + for _, e := range result.Platforms { + if e != nil { + if err2 := ValidatePlatformView(e); err2 != nil { + err = goa.MergeErrors(err, err2) + } + } + } + for _, e := range result.Versions { + if e != nil { + if err2 := ValidateResourceVersionDataView(e); err2 != nil { + err = goa.MergeErrors(err, err2) + } + } + } + if result.Catalog != nil { + if err2 := ValidateCatalogViewMin(result.Catalog); err2 != nil { + err = goa.MergeErrors(err, err2) + } + } + if result.LatestVersion != nil { + if err2 := ValidateResourceVersionDataViewWithoutResource(result.LatestVersion); err2 != nil { + err = goa.MergeErrors(err, err2) + } + } + return +} + +// ValidateCatalogViewMin runs the validations defined on CatalogView using the +// "min" view. +func ValidateCatalogViewMin(result *CatalogView) (err error) { + if result.ID == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("id", "result")) + } + if result.Name == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("name", "result")) + } + if result.Type == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("type", "result")) + } + if result.Type != nil { + if !(*result.Type == "official" || *result.Type == "community") { + err = goa.MergeErrors(err, goa.InvalidEnumValueError("result.type", *result.Type, []interface{}{"official", "community"})) + } + } + return +} + +// ValidateCatalogView runs the validations defined on CatalogView using the +// "default" view. +func ValidateCatalogView(result *CatalogView) (err error) { + if result.ID == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("id", "result")) + } + if result.Name == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("name", "result")) + } + if result.Type == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("type", "result")) + } + if result.URL == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("url", "result")) + } + if result.Provider == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("provider", "result")) + } + if result.Type != nil { + if !(*result.Type == "official" || *result.Type == "community") { + err = goa.MergeErrors(err, goa.InvalidEnumValueError("result.type", *result.Type, []interface{}{"official", "community"})) + } + } + return +} + +// ValidateCategoryView runs the validations defined on CategoryView. +func ValidateCategoryView(result *CategoryView) (err error) { + if result.ID == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("id", "result")) + } + if result.Name == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("name", "result")) + } + return +} + +// ValidateResourceVersionDataViewTiny runs the validations defined on +// ResourceVersionDataView using the "tiny" view. +func ValidateResourceVersionDataViewTiny(result *ResourceVersionDataView) (err error) { + if result.ID == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("id", "result")) + } + if result.Version == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("version", "result")) + } + return +} + +// ValidateResourceVersionDataViewMin runs the validations defined on +// ResourceVersionDataView using the "min" view. +func ValidateResourceVersionDataViewMin(result *ResourceVersionDataView) (err error) { + if result.ID == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("id", "result")) + } + if result.Version == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("version", "result")) + } + if result.RawURL == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("rawURL", "result")) + } + if result.WebURL == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("webURL", "result")) + } + if result.Platforms == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("platforms", "result")) + } + if result.HubURLPath == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("hubURLPath", "result")) + } + if result.RawURL != nil { + err = goa.MergeErrors(err, goa.ValidateFormat("result.rawURL", *result.RawURL, goa.FormatURI)) + } + if result.WebURL != nil { + err = goa.MergeErrors(err, goa.ValidateFormat("result.webURL", *result.WebURL, goa.FormatURI)) + } + for _, e := range result.Platforms { + if e != nil { + if err2 := ValidatePlatformView(e); err2 != nil { + err = goa.MergeErrors(err, err2) + } + } + } + return +} + +// ValidateResourceVersionDataViewWithoutResource runs the validations defined +// on ResourceVersionDataView using the "withoutResource" view. +func ValidateResourceVersionDataViewWithoutResource(result *ResourceVersionDataView) (err error) { + if result.ID == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("id", "result")) + } + if result.Version == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("version", "result")) + } + if result.DisplayName == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("displayName", "result")) + } + if result.Description == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("description", "result")) + } + if result.MinPipelinesVersion == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("minPipelinesVersion", "result")) + } + if result.RawURL == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("rawURL", "result")) + } + if result.WebURL == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("webURL", "result")) + } + if result.UpdatedAt == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("updatedAt", "result")) + } + if result.Platforms == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("platforms", "result")) + } + if result.HubURLPath == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("hubURLPath", "result")) + } + if result.RawURL != nil { + err = goa.MergeErrors(err, goa.ValidateFormat("result.rawURL", *result.RawURL, goa.FormatURI)) + } + if result.WebURL != nil { + err = goa.MergeErrors(err, goa.ValidateFormat("result.webURL", *result.WebURL, goa.FormatURI)) + } + if result.UpdatedAt != nil { + err = goa.MergeErrors(err, goa.ValidateFormat("result.updatedAt", *result.UpdatedAt, goa.FormatDateTime)) + } + for _, e := range result.Platforms { + if e != nil { + if err2 := ValidatePlatformView(e); err2 != nil { + err = goa.MergeErrors(err, err2) + } + } + } + return +} + +// ValidateResourceVersionDataView runs the validations defined on +// ResourceVersionDataView using the "default" view. +func ValidateResourceVersionDataView(result *ResourceVersionDataView) (err error) { + if result.ID == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("id", "result")) + } + if result.Version == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("version", "result")) + } + if result.DisplayName == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("displayName", "result")) + } + if result.Description == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("description", "result")) + } + if result.MinPipelinesVersion == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("minPipelinesVersion", "result")) + } + if result.RawURL == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("rawURL", "result")) + } + if result.WebURL == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("webURL", "result")) + } + if result.UpdatedAt == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("updatedAt", "result")) + } + if result.Platforms == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("platforms", "result")) + } + if result.HubURLPath == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("hubURLPath", "result")) + } + if result.RawURL != nil { + err = goa.MergeErrors(err, goa.ValidateFormat("result.rawURL", *result.RawURL, goa.FormatURI)) + } + if result.WebURL != nil { + err = goa.MergeErrors(err, goa.ValidateFormat("result.webURL", *result.WebURL, goa.FormatURI)) + } + if result.UpdatedAt != nil { + err = goa.MergeErrors(err, goa.ValidateFormat("result.updatedAt", *result.UpdatedAt, goa.FormatDateTime)) + } + for _, e := range result.Platforms { + if e != nil { + if err2 := ValidatePlatformView(e); err2 != nil { + err = goa.MergeErrors(err, err2) + } + } + } + if result.Resource != nil { + if err2 := ValidateResourceDataViewInfo(result.Resource); err2 != nil { + err = goa.MergeErrors(err, err2) + } + } + return +} + +// ValidatePlatformView runs the validations defined on PlatformView. +func ValidatePlatformView(result *PlatformView) (err error) { + if result.ID == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("id", "result")) + } + if result.Name == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("name", "result")) + } + return +} + +// ValidateTagView runs the validations defined on TagView. +func ValidateTagView(result *TagView) (err error) { + if result.ID == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("id", "result")) + } + if result.Name == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("name", "result")) + } + return +} diff --git a/api/gen/status/client.go b/api/gen/status/client.go index 482eaf7610..c95229dbdb 100644 --- a/api/gen/status/client.go +++ b/api/gen/status/client.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // status client // diff --git a/api/gen/status/endpoints.go b/api/gen/status/endpoints.go index 9f8b908ef9..06f8ec30f2 100644 --- a/api/gen/status/endpoints.go +++ b/api/gen/status/endpoints.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // status endpoints // diff --git a/api/gen/status/service.go b/api/gen/status/service.go index 932a2b3ac1..3850ece232 100644 --- a/api/gen/status/service.go +++ b/api/gen/status/service.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // status service // diff --git a/api/gen/swagger/client.go b/api/gen/swagger/client.go index 5badc6e5dc..1b120f702b 100644 --- a/api/gen/swagger/client.go +++ b/api/gen/swagger/client.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // swagger client // diff --git a/api/gen/swagger/endpoints.go b/api/gen/swagger/endpoints.go index 00bcf7d43f..856a0dbb70 100644 --- a/api/gen/swagger/endpoints.go +++ b/api/gen/swagger/endpoints.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // swagger endpoints // diff --git a/api/gen/swagger/service.go b/api/gen/swagger/service.go index c3f9872282..b8ac9dd414 100644 --- a/api/gen/swagger/service.go +++ b/api/gen/swagger/service.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.3.1, DO NOT EDIT. +// Code generated by goa v3.4.0, DO NOT EDIT. // // swagger service // diff --git a/go.mod b/go.mod index 082b555ed3..31e7260283 100644 --- a/go.mod +++ b/go.mod @@ -26,7 +26,7 @@ require ( github.com/tektoncd/pipeline v0.33.1 github.com/tektoncd/plumbing v0.0.0-20211012143332-c7cc43d9bc0c go.uber.org/zap v1.19.1 - goa.design/goa/v3 v3.3.1 + goa.design/goa/v3 v3.4.0 goa.design/plugins/v3 v3.1.3 golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 gopkg.in/h2non/gock.v1 v1.0.16 diff --git a/go.sum b/go.sum index 61586f2c81..7013f0b1bd 100644 --- a/go.sum +++ b/go.sum @@ -539,6 +539,7 @@ github.com/fullstorydev/grpcurl v1.6.0/go.mod h1:ZQ+ayqbKMJNhzLmbpCiurTVlaK2M/3n github.com/fzipp/gocyclo v0.3.1/go.mod h1:DJHO6AUmbdqj2ET4Z9iArSuwWgYDRryYt2wASxc7x3E= github.com/garyburd/redigo v0.0.0-20150301180006-535138d7bcd7/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY= github.com/getkin/kin-openapi v0.53.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= +github.com/getkin/kin-openapi v0.61.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= github.com/getkin/kin-openapi v0.76.0 h1:j77zg3Ec+k+r+GA3d8hBoXpAc6KX9TbBPrwQGBIy2sY= github.com/getkin/kin-openapi v0.76.0/go.mod h1:660oXbgy5JFMKreazJaQTw7o+X00qeSyhcnluiMv+Xg= github.com/getsentry/raven-go v0.2.0/go.mod h1:KungGk8q33+aIAZUIVWZDr2OfAEBsO49PX4NzFV5kcQ= @@ -1723,6 +1724,8 @@ goa.design/goa/v3 v3.0.9/go.mod h1:oJR8VOFa4HV7wCQv4XhPtvyknz0B3VFFRUWDdEmI0FI= goa.design/goa/v3 v3.1.3/go.mod h1:GEog3KvHosQPKrrZSlpXDSnm7PpmzZEiy3mLxI/FtXM= goa.design/goa/v3 v3.3.1 h1:56aGfXSMDvjB0jdJ8/OThkL1dF8ACN7EJvN7SuMTwP4= goa.design/goa/v3 v3.3.1/go.mod h1:Br8id+evuay7oUIK3BXr6iFJVLxAiirb+FPzfYUYOWg= +goa.design/goa/v3 v3.4.0 h1:+8hEGziT5rP+YZQKR88PoEQW5q34c7QTADAjvu+UCk8= +goa.design/goa/v3 v3.4.0/go.mod h1:uQzms/p5PzFfbFtjR68+OsYVQv0gOAYp6ycF0Rpi0t0= goa.design/plugins/v3 v3.1.3 h1:WQ4qCbRihwi1cFXzWgEuKCtGFPm2AnTzbRAVZ3ACN00= goa.design/plugins/v3 v3.1.3/go.mod h1:j4gOWwZpEBsNmONKitV/tBlxG6Yu7unFCU1HJmqjiC8= golang.org/x/crypto v0.0.0-20171113213409-9f005a07e0d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= diff --git a/vendor/github.com/markbates/goth/providers/gitlab/gitlab.go b/vendor/github.com/markbates/goth/providers/gitlab/gitlab.go index 533632e7fd..9efd9c94b4 100644 --- a/vendor/github.com/markbates/goth/providers/gitlab/gitlab.go +++ b/vendor/github.com/markbates/goth/providers/gitlab/gitlab.go @@ -12,6 +12,7 @@ import ( "strconv" "fmt" + "github.com/markbates/goth" "golang.org/x/oauth2" ) diff --git a/vendor/goa.design/goa/v3/dsl/grpc.go b/vendor/goa.design/goa/v3/dsl/grpc.go index d89d88d081..e0e07d9a0c 100644 --- a/vendor/goa.design/goa/v3/dsl/grpc.go +++ b/vendor/goa.design/goa/v3/dsl/grpc.go @@ -106,6 +106,37 @@ func GRPC(fn func()) { } } +// Package defines the name of the protobuf package. It defaults to the name of +// the service (in snake_case). +// +// Package must appear in a service GRPC expression. +// +// Package accepts one argument: the name of the protobuf package. +// +// Example: +// +// var GRPCService = Service("my_grpc_service", func() { +// GRPC(func() { +// Package("svc") +// }) +// Method("add", func() { +// Payload(func() { +// Field(1, "a", Int) +// Field(2, "b", Int) +// }) +// Result(Int) +// }) +// GRPC(func() {}) +// }) +func Package(name string) { + switch actual := eval.Current().(type) { + case *expr.GRPCServiceExpr: + actual.ProtoPkg = name + default: + eval.IncompatibleDSL() + } +} + // Message describes a gRPC request or response message. // // Message must appear in a gRPC method expression to define the diff --git a/vendor/goa.design/goa/v3/dsl/http_redirect.go b/vendor/goa.design/goa/v3/dsl/http_redirect.go new file mode 100644 index 0000000000..f88d658b70 --- /dev/null +++ b/vendor/goa.design/goa/v3/dsl/http_redirect.go @@ -0,0 +1,49 @@ +package dsl + +import ( + "goa.design/goa/v3/eval" + "goa.design/goa/v3/expr" +) + +// Redirect indicates that HTTP requests reply to the request with a redirect. +// The logic is the same as the standard http package Redirect function. +// +// Redirect must appear in a HTTP endpoint expression or a HTTP file server +// expression. +// +// Redirect accepts 2 arguments. The first argument is the URL that is being +// redirected to. The second argument is the HTTP status code. +// +// Example: +// +// var _ = Service("service", func() { +// Method("method", func() { +// HTTP(func() { +// GET("/resources") +// Redirect("/redirect/dest", StatusMovedPermanently) +// }) +// }) +// }) +// +// var _ = Service("service", func() { +// Files("/file.json", "/path/to/file.json", func() { +// Redirect("/redirect/dest", StatusMovedPermanently) +// }) +// }) +// +func Redirect(url string, code int) { + redirect := &expr.HTTPRedirectExpr{ + URL: url, + StatusCode: code, + } + switch actual := eval.Current().(type) { + case *expr.HTTPEndpointExpr: + redirect.Parent = actual + actual.Redirect = redirect + case *expr.HTTPFileServerExpr: + redirect.Parent = actual + actual.Redirect = redirect + default: + eval.IncompatibleDSL() + } +} diff --git a/vendor/goa.design/goa/v3/dsl/result_type.go b/vendor/goa.design/goa/v3/dsl/result_type.go index 9f412606ef..fafb1b84db 100644 --- a/vendor/goa.design/goa/v3/dsl/result_type.go +++ b/vendor/goa.design/goa/v3/dsl/result_type.go @@ -15,10 +15,9 @@ var resultTypeCount int // ResultType defines a result type used to describe a method response. // -// Result types have a unique identifier as described in RFC 6838. The -// identifier defines the default value for the Content-Type header of HTTP -// responses. Result types may also define a type name used to override the -// default Go type name generated from the identifier. +// Result types have a unique identifier as described in RFC 6838. Result types +// may also define a type name used to override the default Go type name +// generated from the identifier. // // The result type expression includes a listing of all the response attributes. // Views specify which of the attributes are actually rendered so that the same @@ -42,7 +41,6 @@ var resultTypeCount int // // var BottleMT = ResultType("application/vnd.goa.example.bottle", "BottleResult", func() { // Description("A bottle of wine") -// ContentType("application/json") // Override Content-Type header // // Attributes(func() { // Attribute("id", Int, "ID of bottle") @@ -280,6 +278,23 @@ func View(name string, adsl ...func()) { // View("tiny") // use "tiny" view to render the collection elements // }) // +// var MultiResultsExample = CollectionOf(DivisionResult, func() { +// Attributes(func() { +// Example("DivisionResult Collection Examples", func() { +// Value([]Val{ +// { +// "value": 4.167, +// "reminder": 0, +// }, +// { +// "value": 3.0, +// "reminder": 0, +// }, +// }) +// }) +// }) +// }) +// func CollectionOf(v interface{}, adsl ...func()) *expr.ResultTypeExpr { var m *expr.ResultTypeExpr var ok bool diff --git a/vendor/goa.design/goa/v3/dsl/service.go b/vendor/goa.design/goa/v3/dsl/service.go index 58d8f71b9b..b5814a9fd9 100644 --- a/vendor/goa.design/goa/v3/dsl/service.go +++ b/vendor/goa.design/goa/v3/dsl/service.go @@ -26,7 +26,7 @@ import ( // Example: // // var _ = Service("divider", func() { -// Title("divider service") // optional +// Description("divider service") // optional // // Error("Unauthorized") // error that apply to all the service methods // HTTP(func() { // HTTP mapping for error responses diff --git a/vendor/goa.design/goa/v3/dsl/user_type.go b/vendor/goa.design/goa/v3/dsl/user_type.go index 10ef58acdd..70e5296a64 100644 --- a/vendor/goa.design/goa/v3/dsl/user_type.go +++ b/vendor/goa.design/goa/v3/dsl/user_type.go @@ -18,7 +18,7 @@ var ( // to an existing type or may describe a completely new type using a list of // attributes (object fields). Attribute types may themselves be user type. // When a user type is defined as an alias to another type it may define -// additional validations - for example it a user type which is an alias of +// additional validations - for example if a user type which is an alias of // String may define a validation pattern that all instances of the type // must match. // diff --git a/vendor/goa.design/goa/v3/expr/grpc_service.go b/vendor/goa.design/goa/v3/expr/grpc_service.go index 2cf7bfa711..2fffe92eba 100644 --- a/vendor/goa.design/goa/v3/expr/grpc_service.go +++ b/vendor/goa.design/goa/v3/expr/grpc_service.go @@ -14,6 +14,8 @@ type ( ServiceExpr *ServiceExpr // Name of parent service if any ParentName string + // ProtoPkg is the name of the generated protobuf package. + ProtoPkg string // GRPCEndpoints is the list of service endpoints. GRPCEndpoints []*GRPCEndpointExpr // GRPCErrors lists gRPC errors that apply to all endpoints. diff --git a/vendor/goa.design/goa/v3/expr/http_endpoint.go b/vendor/goa.design/goa/v3/expr/http_endpoint.go index 77ffefd18b..cdc471aa3a 100644 --- a/vendor/goa.design/goa/v3/expr/http_endpoint.go +++ b/vendor/goa.design/goa/v3/expr/http_endpoint.go @@ -64,6 +64,8 @@ type ( // MultipartRequest indicates that the request content type for // the endpoint is a multipart type. MultipartRequest bool + // Redirect defines a redirect for the endpoint. + Redirect *HTTPRedirectExpr // Meta is a set of key/value pairs with semantic that is // specific to each generator, see dsl.Meta. Meta MetaExpr @@ -261,7 +263,9 @@ func (e *HTTPEndpointExpr) Prepare() { // Make sure there's a default success response if none define explicitly. if len(e.Responses) == 0 { status := StatusOK - if e.MethodExpr.Result.Type == Empty && !e.SkipResponseBodyEncodeDecode { + if e.Redirect != nil { + status = e.Redirect.StatusCode + } else if e.MethodExpr.Result.Type == Empty && !e.SkipResponseBodyEncodeDecode { status = StatusNoContent } e.Responses = []*HTTPResponseExpr{{StatusCode: status}} @@ -342,6 +346,20 @@ func (e *HTTPEndpointExpr) Validate() error { } } + // Redirect is not compatible with Response. + if e.Redirect != nil { + found := false + for _, r := range e.Responses { + if r.StatusCode != e.Redirect.StatusCode { + found = true + break + } + } + if found { + verr.Add(e, "Endpoint cannot use Response when using Redirect.") + } + } + // Validate routes // Routes cannot be empty diff --git a/vendor/goa.design/goa/v3/expr/http_file_server.go b/vendor/goa.design/goa/v3/expr/http_file_server.go index ba234ce8c4..f7d9089163 100644 --- a/vendor/goa.design/goa/v3/expr/http_file_server.go +++ b/vendor/goa.design/goa/v3/expr/http_file_server.go @@ -20,6 +20,8 @@ type ( FilePath string // RequestPaths is the list of HTTP paths that serve the assets. RequestPaths []string + // Redirect defines a redirect for the endpoint. + Redirect *HTTPRedirectExpr // Meta is a list of key/value pairs Meta MetaExpr } diff --git a/vendor/goa.design/goa/v3/expr/http_redirect.go b/vendor/goa.design/goa/v3/expr/http_redirect.go new file mode 100644 index 0000000000..d76abea377 --- /dev/null +++ b/vendor/goa.design/goa/v3/expr/http_redirect.go @@ -0,0 +1,29 @@ +package expr + +import ( + "fmt" + + "goa.design/goa/v3/eval" +) + +type ( + // HTTPRedirectExpr defines an endpoint that replies to the request with a redirect. + HTTPRedirectExpr struct { + // URL is the URL that is being redirected to. + URL string + // StatusCode is the HTTP status code. + StatusCode int + // Parent expression, one of HTTPEndpointExpr or HTTPFileServerExpr. + Parent eval.Expression + } +) + +// EvalName returns the generic definition name used in error messages. +func (r *HTTPRedirectExpr) EvalName() string { + suffix := fmt.Sprintf("redirect to %s with status code %d", r.URL, r.StatusCode) + var prefix string + if r.Parent != nil { + prefix = r.Parent.EvalName() + " " + } + return prefix + suffix +} diff --git a/vendor/goa.design/goa/v3/grpc/codegen/example_cli.go b/vendor/goa.design/goa/v3/grpc/codegen/example_cli.go index c4e2c64dd8..b53eca1c18 100644 --- a/vendor/goa.design/goa/v3/grpc/codegen/example_cli.go +++ b/vendor/goa.design/goa/v3/grpc/codegen/example_cli.go @@ -78,7 +78,7 @@ func exampleCLI(genpkg string, root *expr.RootExpr, svr *expr.ServerExpr) *codeg { sections = []*codegen.SectionTemplate{ codegen.Header("", "main", specs), - &codegen.SectionTemplate{Name: "do-grpc-cli", Source: grpcCLIDoT, Data: svrdata}, + {Name: "do-grpc-cli", Source: grpcCLIDoT, Data: svrdata}, } } diff --git a/vendor/goa.design/goa/v3/grpc/codegen/example_server.go b/vendor/goa.design/goa/v3/grpc/codegen/example_server.go index 24a4e4248a..3774f07fda 100644 --- a/vendor/goa.design/goa/v3/grpc/codegen/example_server.go +++ b/vendor/goa.design/goa/v3/grpc/codegen/example_server.go @@ -101,22 +101,22 @@ func exampleServer(genpkg string, root *expr.RootExpr, svr *expr.ServerExpr) *co } sections = []*codegen.SectionTemplate{ codegen.Header("", "main", specs), - &codegen.SectionTemplate{ + { Name: "server-grpc-start", Source: grpcSvrStartT, Data: map[string]interface{}{ "Services": svcdata, }, - }, - &codegen.SectionTemplate{Name: "server-grpc-logger", Source: grpcSvrLoggerT}, - &codegen.SectionTemplate{ + }, { + Name: "server-grpc-logger", + Source: grpcSvrLoggerT, + }, { Name: "server-grpc-init", Source: grpcSvrInitT, Data: map[string]interface{}{ "Services": svcdata, }, - }, - &codegen.SectionTemplate{ + }, { Name: "server-grpc-register", Source: grpcRegisterSvrT, Data: map[string]interface{}{ @@ -126,8 +126,7 @@ func exampleServer(genpkg string, root *expr.RootExpr, svr *expr.ServerExpr) *co "goify": codegen.Goify, "needStream": needStream, }, - }, - &codegen.SectionTemplate{ + }, { Name: "server-grpc-end", Source: grpcSvrEndT, Data: map[string]interface{}{ diff --git a/vendor/goa.design/goa/v3/grpc/codegen/proto.go b/vendor/goa.design/goa/v3/grpc/codegen/proto.go index 8a268dcac7..9b77db0d24 100644 --- a/vendor/goa.design/goa/v3/grpc/codegen/proto.go +++ b/vendor/goa.design/goa/v3/grpc/codegen/proto.go @@ -32,7 +32,7 @@ func protoFile(genpkg string, svc *expr.GRPCServiceExpr) *codegen.File { sections := []*codegen.SectionTemplate{ // header comments - &codegen.SectionTemplate{ + { Name: "proto-header", Source: protoHeaderT, Data: map[string]interface{}{ @@ -41,16 +41,20 @@ func protoFile(genpkg string, svc *expr.GRPCServiceExpr) *codegen.File { }, }, // proto syntax and package - &codegen.SectionTemplate{ + { Name: "proto-start", Source: protoStartT, Data: map[string]interface{}{ "ProtoVersion": ProtoVersion, - "Pkg": codegen.SnakeCase(codegen.Goify(svcName, false)), + "Pkg": pkgName(svc, svcName), }, }, // service definition - &codegen.SectionTemplate{Name: "grpc-service", Source: serviceT, Data: data}, + { + Name: "grpc-service", + Source: serviceT, + Data: data, + }, } // message definition @@ -65,6 +69,13 @@ func protoFile(genpkg string, svc *expr.GRPCServiceExpr) *codegen.File { } } +func pkgName(svc *expr.GRPCServiceExpr, svcName string) string { + if svc.ProtoPkg != "" { + svcName = svc.ProtoPkg + } + return codegen.SnakeCase(codegen.Goify(svcName, false)) +} + func protoc(path string) error { dir := filepath.Dir(path) os.MkdirAll(dir, 0777) diff --git a/vendor/goa.design/goa/v3/grpc/codegen/protobuf_transform.go b/vendor/goa.design/goa/v3/grpc/codegen/protobuf_transform.go index a9a3c9c312..2ddaeff3c4 100644 --- a/vendor/goa.design/goa/v3/grpc/codegen/protobuf_transform.go +++ b/vendor/goa.design/goa/v3/grpc/codegen/protobuf_transform.go @@ -465,13 +465,24 @@ func convertType(source, target *expr.AttributeExpr, sourceVar string, ta *trans return fmt.Sprintf("%s(%s)", transformHelperName(source, target, ta), sourceVar) } + sourceType, _ := codegen.GetMetaType(source) + targetType, _ := codegen.GetMetaType(target) if source.Type.Kind() != expr.IntKind && source.Type.Kind() != expr.UIntKind { + if sourceType != "" || targetType != "" { + if ta.proto || targetType == "" { + targetType = protoBufNativeGoTypeName(target.Type) + } + return fmt.Sprintf("%s(%s)", targetType, sourceVar) + } return sourceVar } if ta.proto { - return fmt.Sprintf("%s(%s)", protoBufNativeGoTypeName(source.Type), sourceVar) + return fmt.Sprintf("%s(%s)", protoBufNativeGoTypeName(target.Type), sourceVar) + } + if targetType == "" { + targetType = codegen.GoNativeTypeName(target.Type) } - return fmt.Sprintf("%s(%s)", codegen.GoNativeTypeName(source.Type), sourceVar) + return fmt.Sprintf("%s(%s)", targetType, sourceVar) } // zeroValure returns the zero value for the given primitive type. @@ -569,9 +580,7 @@ func transformAttributeHelpers(source, target *expr.AttributeExpr, ta *transform // collectHelpers recursively traverses the given attributes and return the // transform helper functions required to generate the transform code. func collectHelpers(source, target *expr.AttributeExpr, req bool, ta *transformAttrs, seen ...map[string]*codegen.TransformFunctionData) ([]*codegen.TransformFunctionData, error) { - var ( - data []*codegen.TransformFunctionData - ) + var data []*codegen.TransformFunctionData switch { case expr.IsArray(source.Type): helpers, err := transformAttributeHelpers( diff --git a/vendor/goa.design/goa/v3/grpc/codegen/server.go b/vendor/goa.design/goa/v3/grpc/codegen/server.go index c5147beba8..1f975e771b 100644 --- a/vendor/goa.design/goa/v3/grpc/codegen/server.go +++ b/vendor/goa.design/goa/v3/grpc/codegen/server.go @@ -47,7 +47,7 @@ func serverFile(genpkg string, svc *expr.GRPCServiceExpr) *codegen.File { {Path: path.Join(genpkg, svcName, "views"), Name: data.Service.ViewsPkg}, {Path: path.Join(genpkg, "grpc", svcName, pbPkgName), Name: data.PkgName}, }), - &codegen.SectionTemplate{Name: "server-struct", Source: serverStructT, Data: data}, + {Name: "server-struct", Source: serverStructT, Data: data}, } for _, e := range data.Endpoints { if e.ServerStream != nil { diff --git a/vendor/goa.design/goa/v3/http/codegen/example_server.go b/vendor/goa.design/goa/v3/http/codegen/example_server.go index bf78ca83dd..f54235ca64 100644 --- a/vendor/goa.design/goa/v3/http/codegen/example_server.go +++ b/vendor/goa.design/goa/v3/http/codegen/example_server.go @@ -253,7 +253,7 @@ func handleHTTPServer(ctx context.Context, u *url.URL{{ range $.Services }}{{ if {{- if .Endpoints }} {{ .Service.VarName }}Server = {{ .Service.PkgName }}svr.New({{ .Service.VarName }}Endpoints, mux, dec, enc, eh, nil{{ if hasWebSocket $svc }}, upgrader, nil{{ end }}{{ range .Endpoints }}{{ if .MultipartRequestDecoder }}, {{ $.APIPkg }}.{{ .MultipartRequestDecoder.FuncName }}{{ end }}{{ end }}) {{- else }} - {{ .Service.VarName }}Server = {{ .Service.PkgName }}svr.New(nil, mux, dec, enc, eh, nil) + {{ .Service.VarName }}Server = {{ .Service.PkgName }}svr.New(nil, mux, dec, enc, eh, nil{{ range .FileServers }}, nil{{ end }}) {{- end }} {{- end }} {{- if .Services }} @@ -269,7 +269,7 @@ func handleHTTPServer(ctx context.Context, u *url.URL{{ range $.Services }}{{ if } // Configure the mux. {{- range .Services }} - {{ .Service.PkgName }}svr.Mount(mux{{ if .Endpoints }}, {{ .Service.VarName }}Server{{ end }}) + {{ .Service.PkgName }}svr.Mount(mux, {{ .Service.VarName }}Server) {{- end }} ` diff --git a/vendor/goa.design/goa/v3/http/codegen/openapi/v3/builder.go b/vendor/goa.design/goa/v3/http/codegen/openapi/v3/builder.go index 1438fbf097..96bd743f68 100644 --- a/vendor/goa.design/goa/v3/http/codegen/openapi/v3/builder.go +++ b/vendor/goa.design/goa/v3/http/codegen/openapi/v3/builder.go @@ -2,6 +2,7 @@ package openapiv3 import ( "fmt" + "sort" "strconv" "goa.design/goa/v3/expr" @@ -27,7 +28,7 @@ func New(root *expr.RootExpr) *OpenAPI { servers = buildServers(root.API.Servers) paths = buildPaths(root.API.HTTP, bodies, root.API) security = buildSecurityRequirements(root.API.Requirements) - tags = openapi.TagsFromExpr(root.API.Meta) + tags = buildTags(root.API) ) return &OpenAPI{ @@ -519,6 +520,57 @@ func buildSecurityScheme(se *expr.SchemeExpr) *SecurityScheme { return scheme } +// buildTags builds the OpenAPI Tag object from the API expression. +func buildTags(api *expr.APIExpr) []*openapi.Tag { + // if a tag with same name is defined in API, Service, and endpoint + // Meta expressions then the definition in endpoint Meta expression + // takes highest precedence followed by Service and API. + + m := make(map[string]*openapi.Tag) + for _, s := range api.HTTP.Services { + if !mustGenerate(s.Meta) || !mustGenerate(s.ServiceExpr.Meta) { + continue + } + for _, t := range openapi.TagsFromExpr(s.Meta) { + m[t.Name] = t + } + for _, e := range s.HTTPEndpoints { + if !mustGenerate(e.Meta) || !mustGenerate(e.MethodExpr.Meta) { + continue + } + for _, t := range openapi.TagsFromExpr(e.Meta) { + m[t.Name] = t + } + } + } + + // sort tag names alphabetically + var keys []string + for k := range m { + keys = append(keys, k) + } + sort.Strings(keys) + + var tags []*openapi.Tag + { + for _, k := range keys { + tags = append(tags, m[k]) + } + + if len(tags) == 0 { + // add service name and description to the tags since we tag every + // operation with service name when no custom tag is defined + for _, s := range api.HTTP.Services { + if !mustGenerate(s.Meta) || !mustGenerate(s.ServiceExpr.Meta) { + continue + } + tags = append(tags, &openapi.Tag{Name: s.Name(), Description: s.Description()}) + } + } + } + return tags +} + // mustGenerate returns true if the meta indicates that a OpenAPI specification should be // generated, false otherwise. func mustGenerate(meta expr.MetaExpr) bool { diff --git a/vendor/goa.design/goa/v3/http/codegen/server.go b/vendor/goa.design/goa/v3/http/codegen/server.go index 6a18fa31a0..19768497a8 100644 --- a/vendor/goa.design/goa/v3/http/codegen/server.go +++ b/vendor/goa.design/goa/v3/http/codegen/server.go @@ -40,6 +40,7 @@ func serverFile(genpkg string, svc *expr.HTTPServiceExpr) *codegen.File { "isWebSocketEndpoint": isWebSocketEndpoint, "viewedServerBody": viewedServerBody, "mustDecodeRequest": mustDecodeRequest, + "addLeadingSlash": addLeadingSlash, } sections := []*codegen.SectionTemplate{ codegen.Header(title, "server", []*codegen.ImportSpec{ @@ -74,7 +75,7 @@ func serverFile(genpkg string, svc *expr.HTTPServiceExpr) *codegen.File { sections = append(sections, &codegen.SectionTemplate{Name: "server-init", Source: serverInitT, Data: data, FuncMap: funcs}) sections = append(sections, &codegen.SectionTemplate{Name: "server-service", Source: serverServiceT, Data: data}) sections = append(sections, &codegen.SectionTemplate{Name: "server-use", Source: serverUseT, Data: data}) - sections = append(sections, &codegen.SectionTemplate{Name: "server-mount", Source: serverMountT, Data: data}) + sections = append(sections, &codegen.SectionTemplate{Name: "server-mount", Source: serverMountT, Data: data, FuncMap: funcs}) for _, e := range data.Endpoints { sections = append(sections, &codegen.SectionTemplate{Name: "server-handler", Source: serverHandlerT, Data: e}) @@ -113,7 +114,7 @@ func serverEncodeDecodeFile(genpkg string, svc *expr.HTTPServiceExpr) *codegen.F } for _, e := range data.Endpoints { - if !isWebSocketEndpoint(e) { + if e.Redirect == nil && !isWebSocketEndpoint(e) { sections = append(sections, &codegen.SectionTemplate{ Name: "response-encoder", FuncMap: transTmplFuncs(svc), @@ -238,6 +239,13 @@ func viewedServerBody(sbd []*TypeData, view string) *TypeData { panic("view not found in server body types: " + view) } +func addLeadingSlash(s string) string { + if strings.HasPrefix(s, "/") { + return s + } + return "/" + s +} + func mapQueryDecodeData(dt expr.DataType, varName string, inc int) map[string]interface{} { return map[string]interface{}{ "Type": dt, @@ -255,6 +263,9 @@ type {{ .ServerStruct }} struct { {{- range .Endpoints }} {{ .Method.VarName }} http.Handler {{- end }} + {{- range .FileServers }} + {{ .VarName }} http.Handler + {{- end }} } // ErrorNamer is an interface implemented by generated error structs that @@ -294,12 +305,20 @@ func {{ .ServerInit }}( {{ .MultipartRequestDecoder.VarName }} {{ .MultipartRequestDecoder.FuncName }}, {{- end }} {{- end }} + {{- range .FileServers }} + {{ .ArgName }} http.FileSystem, + {{- end }} ) *{{ .ServerStruct }} { {{- if hasWebSocket . }} if configurer == nil { configurer = &ConnConfigurer{} } {{- end }} + {{- range .FileServers }} + if {{ .ArgName }} == nil { + {{ .ArgName }} = http.Dir(".") + } + {{- end }} return &{{ .ServerStruct }}{ Mounts: []*{{ .MountPointStruct }}{ {{- range $e := .Endpoints }} @@ -317,6 +336,9 @@ func {{ .ServerInit }}( {{- range .Endpoints }} {{ .Method.VarName }}: {{ .HandlerInit }}(e.{{ .Method.VarName }}, mux, {{ if .MultipartRequestDecoder }}{{ .MultipartRequestDecoder.InitName }}(mux, {{ .MultipartRequestDecoder.VarName }}){{ else }}decoder{{ end }}, encoder, errhandler, formatter{{ if isWebSocketEndpoint . }}, upgrader, configurer.{{ .Method.VarName }}Fn{{ end }}), {{- end }} + {{- range .FileServers }} + {{ .VarName }}: http.FileServer({{ .ArgName }}), + {{- end }} } } ` @@ -337,26 +359,18 @@ func (s *{{ .ServerStruct }}) Use(m func(http.Handler) http.Handler) { // input: ServiceData const serverMountT = `{{ printf "%s configures the mux to serve the %s endpoints." .MountServer .Service.Name | comment }} -func {{ .MountServer }}(mux goahttp.Muxer{{ if .Endpoints }}, h *{{ .ServerStruct }}{{ end }}) { +func {{ .MountServer }}(mux goahttp.Muxer, h *{{ .ServerStruct }}) { {{- range .Endpoints }} {{ .MountHandler }}(mux, h.{{ .Method.VarName }}) {{- end }} {{- range .FileServers }} - {{- if .IsDir }} + {{- if .Redirect }} {{ .MountHandler }}(mux, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - upath := path.Clean(r.URL.Path) - rpath := upath - {{- range .RequestPaths }}{{ if ne . "/" }} - if strings.HasPrefix(upath, "{{ . }}") { - rpath = upath[{{ len . }}:] - } - {{- end }}{{ end }} - http.ServeFile(w, r, path.Join({{ printf "%q" .FilePath }}, rpath)) + http.Redirect(w, r, "{{ .Redirect.URL }}", {{ .Redirect.StatusCode }}) })) {{- else }} - {{ .MountHandler }}(mux, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - http.ServeFile(w, r, {{ printf "%q" .FilePath }}) - })) + {{- $filepath := addLeadingSlash .FilePath }} + {{ .MountHandler }}(mux, {{ range .RequestPaths }}{{if ne . $filepath }}goahttp.ReplacePrefix("{{ . }}", "{{ $filepath }}", {{ end }}{{ end }}h.{{ .VarName }}){{ range .RequestPaths }}{{ if ne . $filepath }}){{ end}}{{ end }} {{- end }} {{- end }} } @@ -407,29 +421,35 @@ func {{ .HandlerInit }}( configurer goahttp.ConnConfigureFunc, {{- end }} ) http.Handler { + {{- if (or (mustDecodeRequest .) (not (or .Redirect (isWebSocketEndpoint .))) (not .Redirect) .Method.SkipResponseBodyEncodeDecode) }} var ( + {{- end }} {{- if mustDecodeRequest . }} decodeRequest = {{ .RequestDecoder }}(mux, decoder) {{- end }} - {{- if not (isWebSocketEndpoint .) }} + {{- if not (or .Redirect (isWebSocketEndpoint .)) }} encodeResponse = {{ .ResponseEncoder }}(encoder) {{- end }} + {{- if (or (mustDecodeRequest .) (not .Redirect) .Method.SkipResponseBodyEncodeDecode) }} encodeError = {{ if .Errors }}{{ .ErrorEncoder }}{{ else }}goahttp.ErrorEncoder{{ end }}(encoder, formatter) + {{- end }} + {{- if (or (mustDecodeRequest .) (not (or .Redirect (isWebSocketEndpoint .))) (not .Redirect) .Method.SkipResponseBodyEncodeDecode) }} ) + {{- end }} return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { ctx := context.WithValue(r.Context(), goahttp.AcceptTypeKey, r.Header.Get("Accept")) ctx = context.WithValue(ctx, goa.MethodKey, {{ printf "%q" .Method.Name }}) ctx = context.WithValue(ctx, goa.ServiceKey, {{ printf "%q" .ServiceName }}) {{- if mustDecodeRequest . }} - payload, err := decodeRequest(r) + {{ if .Redirect }}_{{ else }}payload{{ end }}, err := decodeRequest(r) if err != nil { if err := encodeError(ctx, w, err); err != nil { errhandler(ctx, w, err) } return } - {{- else }} + {{- else if not .Redirect }} var err error {{- end }} {{- if isWebSocketEndpoint . }} @@ -451,9 +471,12 @@ func {{ .HandlerInit }}( {{- else if .Method.SkipRequestBodyEncodeDecode }} data := &{{ .ServicePkgName }}.{{ .Method.RequestStruct }}{ {{ if .Payload.Ref }}Payload: payload.({{ .Payload.Ref }}), {{ end }}Body: r.Body } res, err := endpoint(ctx, data) + {{- else if .Redirect }} + http.Redirect(w, r, "{{ .Redirect.URL }}", {{ .Redirect.StatusCode }}) {{- else }} res, err := endpoint(ctx, {{ if .Payload.Ref }}payload{{ else }}nil{{ end }}) {{- end }} + {{- if not .Redirect }} if err != nil { {{- if isWebSocketEndpoint . }} if _, ok := err.(websocket.HandshakeError); ok { @@ -465,11 +488,12 @@ func {{ .HandlerInit }}( } return } + {{- end }} {{- if .Method.SkipResponseBodyEncodeDecode }} o := res.(*{{ .ServicePkgName }}.{{ .Method.ResponseStruct }}) defer o.Body.Close() {{- end }} - {{- if not (isWebSocketEndpoint .) }} + {{- if not (or .Redirect (isWebSocketEndpoint .)) }} if err := encodeResponse(ctx, w, {{ if and .Method.SkipResponseBodyEncodeDecode .Result.Ref }}o.Result{{ else }}res{{ end }}); err != nil { errhandler(ctx, w, err) {{- if .Method.SkipResponseBodyEncodeDecode }} @@ -1122,7 +1146,7 @@ func {{ .ResponseEncoder }}(encoder func(context.Context, http.ResponseWriter) g w.Header().Set("goa-view", res.View) {{- end }} {{- else }} - res := v.({{ .Result.Ref }}) + res, _ := v.({{ .Result.Ref }}) {{- end }} {{- range .Result.Responses }} {{- if .ContentType }} diff --git a/vendor/goa.design/goa/v3/http/codegen/service_data.go b/vendor/goa.design/goa/v3/http/codegen/service_data.go index 413f96dea0..3b41a0037e 100644 --- a/vendor/goa.design/goa/v3/http/codegen/service_data.go +++ b/vendor/goa.design/goa/v3/http/codegen/service_data.go @@ -144,6 +144,8 @@ type ( // ServerWebSocket holds the data to render the server struct which // implements the server stream interface. ServerWebSocket *WebSocketData + // Redirect defines a redirect for the endpoint. + Redirect *RedirectData // client @@ -183,6 +185,21 @@ type ( // PathParam is the name of the parameter used to capture the // path for file servers that serve files under a directory. PathParam string + // Redirect defines a redirect for the endpoint. + Redirect *RedirectData + // VarName is the name of the variable that holds the file server. + VarName string + // ArgName is the name of the argument used to initialize the + // file server. + ArgName string + } + + // RedirectData lists the data needed to generate a redirect. + RedirectData struct { + // URL is the URL that is being redirected to. + URL string + // StatusCode is the HTTP status code. + StatusCode string } // PayloadData contains the payload information required to generate the @@ -595,12 +612,22 @@ func (d ServicesData) analyze(hs *expr.HTTPServiceExpr) *ServiceData { if s.IsDir() { pp = expr.ExtractHTTPWildcards(s.RequestPaths[0])[0] } + var redirect *RedirectData + if s.Redirect != nil { + redirect = &RedirectData{ + URL: s.Redirect.URL, + StatusCode: statusCodeToHTTPConst(s.Redirect.StatusCode), + } + } data := &FileServerData{ MountHandler: scope.Unique(fmt.Sprintf("Mount%s", codegen.Goify(s.FilePath, true))), RequestPaths: paths, FilePath: s.FilePath, IsDir: s.IsDir(), PathParam: pp, + Redirect: redirect, + VarName: scope.Unique(codegen.Goify(s.FilePath, true)), + ArgName: scope.Unique(fmt.Sprintf("fileSystem%s", codegen.Goify(s.FilePath, true))), } rd.FileServers = append(rd.FileServers, data) } @@ -825,6 +852,13 @@ func (d ServicesData) analyze(hs *expr.HTTPServiceExpr) *ServiceData { ad.BuildStreamPayload = scope.Unique("Build" + codegen.Goify(ep.Name, true) + "StreamPayload") } + if a.Redirect != nil { + ad.Redirect = &RedirectData{ + URL: a.Redirect.URL, + StatusCode: statusCodeToHTTPConst(a.Redirect.StatusCode), + } + } + rd.Endpoints = append(rd.Endpoints, ad) } diff --git a/vendor/goa.design/goa/v3/http/encoding.go b/vendor/goa.design/goa/v3/http/encoding.go index 57e63931c2..bf34904efd 100644 --- a/vendor/goa.design/goa/v3/http/encoding.go +++ b/vendor/goa.design/goa/v3/http/encoding.go @@ -134,15 +134,15 @@ func ResponseEncoder(ctx context.Context, w http.ResponseWriter) Encoder { // from the content type context key. if mt, _, err = mime.ParseMediaType(ct); err == nil { switch { - case ct == "application/json" || strings.HasSuffix(ct, "+json"): + case mt == "application/json" || strings.HasSuffix(mt, "+json"): enc = json.NewEncoder(w) - case ct == "application/xml" || strings.HasSuffix(ct, "+xml"): + case mt == "application/xml" || strings.HasSuffix(mt, "+xml"): enc = xml.NewEncoder(w) - case ct == "application/gob" || strings.HasSuffix(ct, "+gob"): + case mt == "application/gob" || strings.HasSuffix(mt, "+gob"): enc = gob.NewEncoder(w) - case ct == "text/html" || ct == "text/plain" || - strings.HasSuffix(ct, "+html") || strings.HasSuffix(ct, "+txt"): - enc = newTextEncoder(w, ct) + case mt == "text/html" || mt == "text/plain" || + strings.HasSuffix(mt, "+html") || strings.HasSuffix(mt, "+txt"): + enc = newTextEncoder(w, mt) default: enc = json.NewEncoder(w) } diff --git a/vendor/goa.design/goa/v3/http/server.go b/vendor/goa.design/goa/v3/http/server.go index 4439d1da42..4b34b6aa73 100644 --- a/vendor/goa.design/goa/v3/http/server.go +++ b/vendor/goa.design/goa/v3/http/server.go @@ -1,6 +1,10 @@ package http -import "net/http" +import ( + "net/http" + "net/url" + "strings" +) type ( // Server is the HTTP server interface used to wrap the server handlers @@ -19,3 +23,25 @@ func (s Servers) Use(m func(http.Handler) http.Handler) { v.Use(m) } } + +// ReplacePrefix returns a handler that serves HTTP requests by replacing the +// prefix from the request URL's Path (and RawPath if set) and invoking the +// handler h. The logic is the same as the standard http package StripPrefix +// function. +func ReplacePrefix(old, nw string, h http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + p := strings.Replace(r.URL.Path, old, nw, 1) + rp := strings.Replace(r.URL.RawPath, old, nw, 1) + if p != r.URL.Path && (r.URL.RawPath == "" || rp != r.URL.RawPath) { + r2 := new(http.Request) + *r2 = *r + r2.URL = new(url.URL) + *r2.URL = *r.URL + r2.URL.Path = p + r2.URL.RawPath = rp + h.ServeHTTP(w, r2) + } else { + http.NotFound(w, r) + } + }) +} diff --git a/vendor/goa.design/goa/v3/pkg/version.go b/vendor/goa.design/goa/v3/pkg/version.go index d82e0989c2..099eb71278 100644 --- a/vendor/goa.design/goa/v3/pkg/version.go +++ b/vendor/goa.design/goa/v3/pkg/version.go @@ -10,9 +10,9 @@ const ( // Major version number Major = 3 // Minor version number - Minor = 3 + Minor = 4 // Build number - Build = 1 + Build = 0 // Suffix - set to empty string in release tag commits. Suffix = "" ) diff --git a/vendor/modules.txt b/vendor/modules.txt index d4abfbc563..e39b4b9ab1 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -455,7 +455,7 @@ go.uber.org/zap/internal/exit go.uber.org/zap/internal/ztest go.uber.org/zap/zapcore go.uber.org/zap/zaptest -# goa.design/goa/v3 v3.3.1 +# goa.design/goa/v3 v3.4.0 ## explicit goa.design/goa/v3/codegen goa.design/goa/v3/codegen/cli