forked from TrueCloudLab/distribution
Clearer names for layer upload routes
This commit is contained in:
parent
7f75e6368d
commit
0618a2ebd7
2 changed files with 12 additions and 12 deletions
20
routes.go
20
routes.go
|
@ -5,21 +5,21 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
routeNameRoot = "root"
|
routeNameRoot = "root"
|
||||||
routeNameName = "name"
|
routeNameName = "name"
|
||||||
routeNameImageManifest = "image-manifest"
|
routeNameImageManifest = "image-manifest"
|
||||||
routeNameTags = "tags"
|
routeNameTags = "tags"
|
||||||
routeNameLayer = "layer"
|
routeNameLayer = "layer"
|
||||||
routeNameStartLayerUpload = "start-layer-upload"
|
routeNameLayerUpload = "layer-upload"
|
||||||
routeNameLayerUpload = "layer-upload"
|
routeNameLayerUploadResume = "layer-upload-resume"
|
||||||
)
|
)
|
||||||
|
|
||||||
var allEndpoints = []string{
|
var allEndpoints = []string{
|
||||||
routeNameImageManifest,
|
routeNameImageManifest,
|
||||||
routeNameTags,
|
routeNameTags,
|
||||||
routeNameLayer,
|
routeNameLayer,
|
||||||
routeNameStartLayerUpload,
|
|
||||||
routeNameLayerUpload,
|
routeNameLayerUpload,
|
||||||
|
routeNameLayerUploadResume,
|
||||||
}
|
}
|
||||||
|
|
||||||
// v2APIRouter builds a gorilla router with named routes for the various API
|
// v2APIRouter builds a gorilla router with named routes for the various API
|
||||||
|
@ -59,14 +59,14 @@ func v2APIRouter() *mux.Router {
|
||||||
// POST /v2/<name>/layer/<tarsum>/upload/ Layer Upload Initiate an upload of the layer identified by tarsum. Requires length and a checksum parameter.
|
// POST /v2/<name>/layer/<tarsum>/upload/ Layer Upload Initiate an upload of the layer identified by tarsum. Requires length and a checksum parameter.
|
||||||
namedRouter.
|
namedRouter.
|
||||||
Path("/layer/{tarsum}/upload/").
|
Path("/layer/{tarsum}/upload/").
|
||||||
Name(routeNameStartLayerUpload)
|
Name(routeNameLayerUpload)
|
||||||
|
|
||||||
// GET /v2/<name>/layer/<tarsum>/upload/<uuid> Layer Upload Get the status of the upload identified by tarsum and uuid.
|
// GET /v2/<name>/layer/<tarsum>/upload/<uuid> Layer Upload Get the status of the upload identified by tarsum and uuid.
|
||||||
// PUT /v2/<name>/layer/<tarsum>/upload/<uuid> Layer Upload Upload all or a chunk of the upload identified by tarsum and uuid.
|
// PUT /v2/<name>/layer/<tarsum>/upload/<uuid> Layer Upload Upload all or a chunk of the upload identified by tarsum and uuid.
|
||||||
// DELETE /v2/<name>/layer/<tarsum>/upload/<uuid> Layer Upload Cancel the upload identified by layer and uuid
|
// DELETE /v2/<name>/layer/<tarsum>/upload/<uuid> Layer Upload Cancel the upload identified by layer and uuid
|
||||||
namedRouter.
|
namedRouter.
|
||||||
Path("/layer/{tarsum}/upload/{uuid}").
|
Path("/layer/{tarsum}/upload/{uuid}").
|
||||||
Name(routeNameLayerUpload)
|
Name(routeNameLayerUploadResume)
|
||||||
|
|
||||||
return router
|
return router
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ func TestRouter(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
routeName: routeNameStartLayerUpload,
|
routeName: routeNameLayerUpload,
|
||||||
expectedRouteInfo: routeInfo{
|
expectedRouteInfo: routeInfo{
|
||||||
RequestURI: "/v2/foo/bar/layer/tarsum/upload/",
|
RequestURI: "/v2/foo/bar/layer/tarsum/upload/",
|
||||||
Vars: map[string]string{
|
Vars: map[string]string{
|
||||||
|
@ -86,7 +86,7 @@ func TestRouter(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
routeName: routeNameLayerUpload,
|
routeName: routeNameLayerUploadResume,
|
||||||
expectedRouteInfo: routeInfo{
|
expectedRouteInfo: routeInfo{
|
||||||
RequestURI: "/v2/foo/bar/layer/tarsum/upload/uuid",
|
RequestURI: "/v2/foo/bar/layer/tarsum/upload/uuid",
|
||||||
Vars: map[string]string{
|
Vars: map[string]string{
|
||||||
|
|
Loading…
Reference in a new issue