Skip to content

Commit

Permalink
Revert /resource/{id}/versions api
Browse files Browse the repository at this point in the history
With Hub v1.7.0 release we removed all the preview api's,
but in order to support backward compatibility reverting
`/resource/{id}/verions` api

Signed-off-by: Puneet Punamiya <[email protected]>
  • Loading branch information
PuneetPunamiya authored and tekton-robot committed Mar 17, 2022
1 parent b22a728 commit ee7e839
Show file tree
Hide file tree
Showing 24 changed files with 1,645 additions and 35 deletions.
2 changes: 2 additions & 0 deletions api/cmd/api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import (
catalogsvc "github.com/tektoncd/hub/api/pkg/service/catalog"
categorysvc "github.com/tektoncd/hub/api/pkg/service/category"
ratingsvc "github.com/tektoncd/hub/api/pkg/service/rating"
resourcesvc "github.com/tektoncd/hub/api/pkg/service/resource"
statussvc "github.com/tektoncd/hub/api/pkg/service/status"
userSvc "github.com/tektoncd/hub/api/pkg/user"
v1catalog "github.com/tektoncd/hub/api/v1/gen/catalog"
Expand Down Expand Up @@ -100,6 +101,7 @@ func main() {
v1catalogSvc = v1catalogsvc.New(api)
categorySvc = categorysvc.New(api)
ratingSvc = ratingsvc.New(api)
resourceSvc = resourcesvc.New(api)
v1resourceSvc = v1resourcesvc.New(api)
statusSvc = statussvc.New(api)
}
Expand Down
22 changes: 22 additions & 0 deletions api/design/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ import (
var _ = Service("resource", func() {
Description("The resource service provides details about all kind of resources")

Error("internal-error", ErrorResult, "Internal Server Error")
Error("not-found", ErrorResult, "Resource Not Found Error")

Method("List", func() {
Description("List all resources sorted by rating and name")
Result(types.Resources)
Expand All @@ -34,4 +37,23 @@ var _ = Service("resource", func() {
})
})

Method("VersionsByID", func() {
Description("Find all versions of a resource by its id")
Payload(func() {
Attribute("id", UInt, "ID of a resource", func() {
Example("id", 1)
})
Required("id")
})
Result(types.ResourceVersions)

HTTP(func() {
GET("/resource/{id}/versions")

Response(StatusOK)
Response("internal-error", StatusInternalServerError)
Response("not-found", StatusNotFound)
})
})

})
24 changes: 23 additions & 1 deletion api/gen/http/cli/hub/cli.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/gen/http/openapi.json

Large diffs are not rendered by default.

Loading

0 comments on commit ee7e839

Please sign in to comment.