cloudapi/v2: Plural path section when querying a collection
This commit is contained in:
parent
7e6365742f
commit
87cc722021
6 changed files with 33 additions and 33 deletions
|
|
@ -320,10 +320,10 @@ type ServerInterface interface {
|
|||
// (POST /compose)
|
||||
PostCompose(ctx echo.Context) error
|
||||
// The status of a compose
|
||||
// (GET /compose/{id})
|
||||
// (GET /composes/{id})
|
||||
GetComposeStatus(ctx echo.Context, id string) error
|
||||
// Get the metadata for a compose.
|
||||
// (GET /compose/{id}/metadata)
|
||||
// (GET /composes/{id}/metadata)
|
||||
GetComposeMetadata(ctx echo.Context, id string) error
|
||||
// Get a list of all possible errors
|
||||
// (GET /errors)
|
||||
|
|
@ -467,8 +467,8 @@ func RegisterHandlers(router EchoRouter, si ServerInterface) {
|
|||
}
|
||||
|
||||
router.POST("/compose", wrapper.PostCompose)
|
||||
router.GET("/compose/:id", wrapper.GetComposeStatus)
|
||||
router.GET("/compose/:id/metadata", wrapper.GetComposeMetadata)
|
||||
router.GET("/composes/:id", wrapper.GetComposeStatus)
|
||||
router.GET("/composes/:id/metadata", wrapper.GetComposeMetadata)
|
||||
router.GET("/errors", wrapper.GetErrorList)
|
||||
router.GET("/errors/:id", wrapper.GetError)
|
||||
router.GET("/openapi", wrapper.GetOpenapi)
|
||||
|
|
@ -528,15 +528,15 @@ var swaggerSpec = []string{
|
|||
"AMeFLrR6bN9ZP4QzfU/CUQRqie2hVi8zLiNv4n1iQlrRPGMHIORbFq3MTYtOwLRHZVlCTI+0+y97ibJ5",
|
||||
"JbfzHrJ+H7qu25s6eM3Tk4ypvVDUBr3+S3O/jAzjhsrNIIqxQEJiLiFS2zjq9V6Mv72fafO+pKb/a3e6",
|
||||
"eN5k+Pd/f/5nuVRG8hUoIgIRg8ZwH/7+3D9TnMuYcfJkbhIy4CpvQ6VxGiSjPwLJV8qWtNwHo4TxH2EC",
|
||||
"nyk8ZhBKiBCoOYiFYc6VW1RjrT7Giij75W5953siT1OsqqsiaBTBRa0rIk33O4nW+hBz3d29B2nuRfS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5q4qMS3VojZPC5rBReXZJspXX0PtK11",
|
||||
"VJmnL4p+V9ffyOCydvNQl82RVcarm/1n3MwY+p/PyXBpQDhJUMaEILMESmvauNn+oghT02aiYfnHLgbZ",
|
||||
"5u3ebIX00el21MMygJLubz31h3/wGV5u5auPvvroc3zUrK2S1n5ZNk23n39XdorbqutgLTntrYhQpHRg",
|
||||
"nzj+GTOHneKsy8tGE2fq3W6ckY5aLmJi/zoMZ6Srq5lAt9SBB8XT4+7DwGtK8cE+M2RRHpq3sYaXzifa",
|
||||
"rITEC/hNDKcSLwhdtNk8k47WNS1eO3rru/X/BwAA///p3GBJ3j4AAA==",
|
||||
}
|
||||
|
||||
// GetSwagger returns the Swagger specification corresponding to the generated code
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ paths:
|
|||
schema:
|
||||
$ref: '#/components/schemas/Error'
|
||||
|
||||
/compose/{id}:
|
||||
/composes/{id}:
|
||||
get:
|
||||
operationId: getComposeStatus
|
||||
summary: The status of a compose
|
||||
|
|
@ -89,7 +89,7 @@ paths:
|
|||
schema:
|
||||
$ref: '#/components/schemas/Error'
|
||||
|
||||
/compose/{id}/metadata:
|
||||
/composes/{id}/metadata:
|
||||
get:
|
||||
operationId: getComposeMetadata
|
||||
summary: Get the metadata for a compose.
|
||||
|
|
|
|||
|
|
@ -512,7 +512,7 @@ func (h *apiHandlers) GetComposeStatus(ctx echo.Context, id string) error {
|
|||
|
||||
return ctx.JSON(http.StatusOK, ComposeStatus{
|
||||
ObjectReference: ObjectReference{
|
||||
Href: fmt.Sprintf("/api/image-builder-composer/v2/compose/%v", jobId),
|
||||
Href: fmt.Sprintf("/api/image-builder-composer/v2/composes/%v", jobId),
|
||||
Id: jobId.String(),
|
||||
Kind: "ComposeStatus",
|
||||
},
|
||||
|
|
@ -545,7 +545,7 @@ func composeStatusFromJobStatus(js *worker.JobStatus, result *worker.OSBuildJobR
|
|||
return ImageStatusValue_failure
|
||||
}
|
||||
|
||||
// ComposeMetadata handles a /compose/{id}/metadata GET request
|
||||
// ComposeMetadata handles a /composes/{id}/metadata GET request
|
||||
func (h *apiHandlers) GetComposeMetadata(ctx echo.Context, id string) error {
|
||||
jobId, err := uuid.Parse(id)
|
||||
if err != nil {
|
||||
|
|
@ -645,7 +645,7 @@ func (h *apiHandlers) GetComposeMetadata(ctx echo.Context, id string) error {
|
|||
|
||||
resp := &ComposeMetadata{
|
||||
ObjectReference: ObjectReference{
|
||||
Href: fmt.Sprintf("/api/image-builder-composer/v2/compose/%v/metadata", jobId),
|
||||
Href: fmt.Sprintf("/api/image-builder-composer/v2/composes/%v/metadata", jobId),
|
||||
Id: jobId.String(),
|
||||
Kind: "ComposeMetadata",
|
||||
},
|
||||
|
|
|
|||
|
|
@ -279,9 +279,9 @@ func TestComposeStatusSuccess(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
require.Equal(t, "osbuild", jobType)
|
||||
|
||||
test.TestRoute(t, srv.Handler("/api/image-builder-composer/v2"), false, "GET", fmt.Sprintf("/api/image-builder-composer/v2/compose/%v", jobId), ``, http.StatusOK, fmt.Sprintf(`
|
||||
test.TestRoute(t, srv.Handler("/api/image-builder-composer/v2"), false, "GET", fmt.Sprintf("/api/image-builder-composer/v2/composes/%v", jobId), ``, http.StatusOK, fmt.Sprintf(`
|
||||
{
|
||||
"href": "/api/image-builder-composer/v2/compose/%v",
|
||||
"href": "/api/image-builder-composer/v2/composes/%v",
|
||||
"kind": "ComposeStatus",
|
||||
"id": "%v",
|
||||
"image_status": {"status": "building"}
|
||||
|
|
@ -295,15 +295,15 @@ func TestComposeStatusSuccess(t *testing.T) {
|
|||
|
||||
err = wrksrv.FinishJob(token, res)
|
||||
require.NoError(t, err)
|
||||
test.TestRoute(t, srv.Handler("/api/image-builder-composer/v2"), false, "GET", fmt.Sprintf("/api/image-builder-composer/v2/compose/%v", jobId), ``, http.StatusOK, fmt.Sprintf(`
|
||||
test.TestRoute(t, srv.Handler("/api/image-builder-composer/v2"), false, "GET", fmt.Sprintf("/api/image-builder-composer/v2/composes/%v", jobId), ``, http.StatusOK, fmt.Sprintf(`
|
||||
{
|
||||
"href": "/api/image-builder-composer/v2/compose/%v",
|
||||
"href": "/api/image-builder-composer/v2/composes/%v",
|
||||
"kind": "ComposeStatus",
|
||||
"id": "%v",
|
||||
"image_status": {"status": "success"}
|
||||
}`, jobId, jobId))
|
||||
|
||||
test.TestRoute(t, srv.Handler("/api/image-builder-composer/v2"), false, "GET", fmt.Sprintf("/api/image-builder-composer/v2/compose/%v/metadata", jobId), ``, http.StatusInternalServerError, `
|
||||
test.TestRoute(t, srv.Handler("/api/image-builder-composer/v2"), false, "GET", fmt.Sprintf("/api/image-builder-composer/v2/composes/%v/metadata", jobId), ``, http.StatusInternalServerError, `
|
||||
{
|
||||
"href": "/api/image-builder-composer/v2/errors/1012",
|
||||
"id": "1012",
|
||||
|
|
@ -345,9 +345,9 @@ func TestComposeStatusFailure(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
require.Equal(t, "osbuild", jobType)
|
||||
|
||||
test.TestRoute(t, srv.Handler("/api/image-builder-composer/v2"), false, "GET", fmt.Sprintf("/api/image-builder-composer/v2/compose/%v", jobId), ``, http.StatusOK, fmt.Sprintf(`
|
||||
test.TestRoute(t, srv.Handler("/api/image-builder-composer/v2"), false, "GET", fmt.Sprintf("/api/image-builder-composer/v2/composes/%v", jobId), ``, http.StatusOK, fmt.Sprintf(`
|
||||
{
|
||||
"href": "/api/image-builder-composer/v2/compose/%v",
|
||||
"href": "/api/image-builder-composer/v2/composes/%v",
|
||||
"kind": "ComposeStatus",
|
||||
"id": "%v",
|
||||
"image_status": {"status": "building"}
|
||||
|
|
@ -355,9 +355,9 @@ func TestComposeStatusFailure(t *testing.T) {
|
|||
|
||||
err = wrksrv.FinishJob(token, nil)
|
||||
require.NoError(t, err)
|
||||
test.TestRoute(t, srv.Handler("/api/image-builder-composer/v2"), false, "GET", fmt.Sprintf("/api/image-builder-composer/v2/compose/%v", jobId), ``, http.StatusOK, fmt.Sprintf(`
|
||||
test.TestRoute(t, srv.Handler("/api/image-builder-composer/v2"), false, "GET", fmt.Sprintf("/api/image-builder-composer/v2/composes/%v", jobId), ``, http.StatusOK, fmt.Sprintf(`
|
||||
{
|
||||
"href": "/api/image-builder-composer/v2/compose/%v",
|
||||
"href": "/api/image-builder-composer/v2/composes/%v",
|
||||
"kind": "ComposeStatus",
|
||||
"id": "%v",
|
||||
"image_status": {"status": "failure"}
|
||||
|
|
|
|||
|
|
@ -670,7 +670,7 @@ function waitForState() {
|
|||
local VERSION="${2:-v1}"
|
||||
local URL=https://localhost/api/composer/v1/compose/"$COMPOSE_ID"
|
||||
if [ "$VERSION" = "v2" ]; then
|
||||
URL=https://localhost/api/image-builder-composer/v2/compose/"$COMPOSE_ID"
|
||||
URL=https://localhost/api/image-builder-composer/v2/composes/"$COMPOSE_ID"
|
||||
fi
|
||||
|
||||
while true
|
||||
|
|
@ -974,7 +974,7 @@ function verifyInAWSS3() {
|
|||
--cacert /etc/osbuild-composer/ca-crt.pem \
|
||||
--key /etc/osbuild-composer/client-key.pem \
|
||||
--cert /etc/osbuild-composer/client-crt.pem \
|
||||
https://localhost/api/image-builder-composer/v2/compose/"$COMPOSE_ID"/metadata | jq -r '.ostree_commit')
|
||||
https://localhost/api/image-builder-composer/v2/composes/"$COMPOSE_ID"/metadata | jq -r '.ostree_commit')
|
||||
|
||||
if [[ "${API_COMMIT_ID_V2}" != "${TAR_COMMIT_ID}" ]]; then
|
||||
echo "Commit ID returned from API v2 does not match Commit ID in archive 😠"
|
||||
|
|
|
|||
|
|
@ -403,7 +403,7 @@ function waitForState() {
|
|||
--cacert /etc/osbuild-composer/ca-crt.pem \
|
||||
--key /etc/osbuild-composer/client-key.pem \
|
||||
--cert /etc/osbuild-composer/client-crt.pem \
|
||||
https://localhost/api/image-builder-composer/v2/compose/"$COMPOSE_ID")
|
||||
https://localhost/api/image-builder-composer/v2/composes/"$COMPOSE_ID")
|
||||
|
||||
COMPOSE_STATUS=$(echo "$OUTPUT" | jq -r '.image_status.status')
|
||||
UPLOAD_STATUS=$(echo "$OUTPUT" | jq -r '.image_status.upload_status.status')
|
||||
|
|
@ -615,7 +615,7 @@ function verifyPackageList() {
|
|||
--cacert /etc/osbuild-composer/ca-crt.pem \
|
||||
--key /etc/osbuild-composer/client-key.pem \
|
||||
--cert /etc/osbuild-composer/client-crt.pem \
|
||||
https://localhost/api/image-builder-composer/v2/compose/"$COMPOSE_ID"/metadata --output "${ARTIFACTS}/metadata.json"
|
||||
https://localhost/api/image-builder-composer/v2/composes/"$COMPOSE_ID"/metadata --output "${ARTIFACTS}/metadata.json"
|
||||
local PACKAGENAMES
|
||||
PACKAGENAMES=$(jq -rM '.packages[].name' "${ARTIFACTS}/metadata.json")
|
||||
|
||||
|
|
@ -720,14 +720,14 @@ TOKEN="$(curl localhost:8081/token | jq -r .access_token)"
|
|||
--output /dev/null \
|
||||
--write-out '%{http_code}' \
|
||||
--header "Authorization: Bearer $TOKEN" \
|
||||
http://localhost:443/api/image-builder-composer/v2/openapi)" = "200" ]
|
||||
http://localhost:443/api/image-builder-composer/v2/composes/"$COMPOSE_ID")" = "200" ]
|
||||
|
||||
[ "$(curl \
|
||||
--silent \
|
||||
--output /dev/null \
|
||||
--write-out '%{http_code}' \
|
||||
--header "Authorization: Bearer badtoken" \
|
||||
http://localhost:443/api/image-builder-composer/v2/openapi)" = "401" ]
|
||||
http://localhost:443/api/image-builder-composer/v2/composes/"$COMPOSE_ID")" = "401" ]
|
||||
|
||||
sudo systemctl start osbuild-remote-worker@https:--localhost:8700.service
|
||||
sudo systemctl is-active --quiet osbuild-remote-worker@https:--localhost:8700.service
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue