Skip to content

Commit

Permalink
Adds design and implementation to redirect preview Query to v1
Browse files Browse the repository at this point in the history
This patch redirects `/query` to `/v1/query`

Signed-off-by: Puneet Punamiya <[email protected]>
  • Loading branch information
PuneetPunamiya committed Apr 11, 2022
1 parent 0e71f32 commit d642931
Show file tree
Hide file tree
Showing 21 changed files with 1,014 additions and 323 deletions.
58 changes: 58 additions & 0 deletions api/design/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,64 @@ var _ = Service("resource", func() {
Error("internal-error", ErrorResult, "Internal Server Error")
Error("not-found", ErrorResult, "Resource Not Found Error")

Method("Query", func() {
Description("Find resources by a combination of name, kind, catalog, categories, platforms and tags")
Payload(func() {
Attribute("name", String, "Name of resource", func() {
Default("")
Example("name", "buildah")
})
Attribute("catalogs", ArrayOf(String), "Catalogs of resource to filter by", func() {
Example([]string{"tekton", "openshift"})
})
Attribute("kinds", ArrayOf(String), "Kinds of resource to filter by", func() {
Example([]string{"task", "pipelines"})
})
Attribute("categories", ArrayOf(String), "Category associated with a resource to filter by", func() {
Example([]string{"build", "tools"})
})
Attribute("tags", ArrayOf(String), "Tags associated with a resource to filter by", func() {
Example([]string{"image", "build"})
})
Attribute("platforms", ArrayOf(String), "Platforms associated with a resource to filter by", func() {
Example([]string{"linux/s390x", "linux/amd64"})
})
Attribute("limit", UInt, "Maximum number of resources to be returned", func() {
Default(1000)
Example("limit", 100)
})

Attribute("match", String, "Strategy used to find matching resources", func() {
Enum("exact", "contains")
Default("contains")
})
})
Result(func() {
Attribute("location", String, "Redirect URL", func() {
Format(FormatURI)
})
Required("location")
})

HTTP(func() {
GET("/query")

Param("name")
Param("catalogs")
Param("categories")
Param("kinds")
Param("tags")
Param("platforms")
Param("limit")
Param("match")

Response(StatusFound, func() {
Header("location")
})

})
})

Method("List", func() {
Description("List all resources sorted by rating and name")
Result(types.Resources)
Expand Down
86 changes: 76 additions & 10 deletions 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 d642931

Please sign in to comment.