2015-02-11 01:32:22 +00:00
package v2
import (
"net/http"
"regexp"
"github.com/docker/distribution/digest"
2015-05-15 01:21:39 +00:00
"github.com/docker/distribution/registry/api/errcode"
2015-02-11 01:32:22 +00:00
)
var (
nameParameterDescriptor = ParameterDescriptor {
Name : "name" ,
Type : "string" ,
Format : RepositoryNameRegexp . String ( ) ,
Required : true ,
Description : ` Name of the target repository. ` ,
}
2015-06-01 15:14:03 +00:00
referenceParameterDescriptor = ParameterDescriptor {
Name : "reference" ,
2015-02-11 01:32:22 +00:00
Type : "string" ,
Format : TagNameRegexp . String ( ) ,
Required : true ,
2015-06-01 15:14:03 +00:00
Description : ` Tag or digest of the target manifest. ` ,
2015-02-11 01:32:22 +00:00
}
uuidParameterDescriptor = ParameterDescriptor {
Name : "uuid" ,
Type : "opaque" ,
Required : true ,
2015-04-02 01:57:59 +00:00
Description : "A uuid identifying the upload. This field can accept characters that match `[a-zA-Z0-9-_.=]+`." ,
2015-02-11 01:32:22 +00:00
}
digestPathParameter = ParameterDescriptor {
Name : "digest" ,
Type : "path" ,
Required : true ,
Format : digest . DigestRegexp . String ( ) ,
Description : ` Digest of desired blob. ` ,
}
hostHeader = ParameterDescriptor {
Name : "Host" ,
Type : "string" ,
Description : "Standard HTTP Host Header. Should be set to the registry host." ,
Format : "<registry host>" ,
Examples : [ ] string { "registry-1.docker.io" } ,
}
authHeader = ParameterDescriptor {
Name : "Authorization" ,
Type : "string" ,
Description : "An RFC7235 compliant authorization header." ,
Format : "<scheme> <token>" ,
Examples : [ ] string { "Bearer dGhpcyBpcyBhIGZha2UgYmVhcmVyIHRva2VuIQ==" } ,
}
authChallengeHeader = ParameterDescriptor {
Name : "WWW-Authenticate" ,
Type : "string" ,
Description : "An RFC7235 compliant authentication challenge header." ,
Format : ` <scheme> realm="<realm>", ..." ` ,
Examples : [ ] string {
` Bearer realm="https://auth.docker.com/", service="registry.docker.com", scopes="repository:library/ubuntu:pull" ` ,
} ,
}
contentLengthZeroHeader = ParameterDescriptor {
Name : "Content-Length" ,
Description : "The `Content-Length` header must be zero and the body must be empty." ,
Type : "integer" ,
Format : "0" ,
}
2015-02-27 00:43:47 +00:00
dockerUploadUUIDHeader = ParameterDescriptor {
Name : "Docker-Upload-UUID" ,
Description : "Identifies the docker upload uuid for the current request." ,
Type : "uuid" ,
Format : "<uuid>" ,
}
2015-02-26 02:04:28 +00:00
digestHeader = ParameterDescriptor {
Name : "Docker-Content-Digest" ,
Description : "Digest of the targeted content for the request." ,
Type : "digest" ,
Format : "<digest>" ,
}
2015-06-03 03:16:59 +00:00
linkHeader = ParameterDescriptor {
Name : "Link" ,
Type : "link" ,
Description : "RFC5988 compliant rel='next' with URL to next result set, if available" ,
Format : ` <<url>?n=<last n value>&last=<last entry from response>>; rel="next" ` ,
}
2015-06-02 02:10:51 +00:00
paginationParameters = [ ] ParameterDescriptor {
{
Name : "n" ,
Type : "integer" ,
Description : "Limit the number of entries in each response. It not present, all entries will be returned." ,
Format : "<integer>" ,
Required : false ,
} ,
{
Name : "last" ,
Type : "string" ,
Description : "Result set will include values lexically after last." ,
Format : "<integer>" ,
Required : false ,
} ,
}
2015-09-28 17:41:18 +00:00
unauthorizedResponseDescriptor = ResponseDescriptor {
Name : "Authentication Required" ,
2015-02-11 01:32:22 +00:00
StatusCode : http . StatusUnauthorized ,
2015-09-28 17:41:18 +00:00
Description : "The client is not authenticated." ,
2015-02-11 01:32:22 +00:00
Headers : [ ] ParameterDescriptor {
authChallengeHeader ,
{
Name : "Content-Length" ,
Type : "integer" ,
2015-09-28 17:41:18 +00:00
Description : "Length of the JSON response body." ,
2015-02-11 01:32:22 +00:00
Format : "<length>" ,
} ,
} ,
2015-09-28 17:41:18 +00:00
Body : BodyDescriptor {
ContentType : "application/json; charset=utf-8" ,
Format : errorsBody ,
} ,
2015-05-15 01:21:39 +00:00
ErrorCodes : [ ] errcode . ErrorCode {
2015-08-06 23:25:08 +00:00
errcode . ErrorCodeUnauthorized ,
2015-02-11 01:32:22 +00:00
} ,
2015-09-28 17:41:18 +00:00
}
repositoryNotFoundResponseDescriptor = ResponseDescriptor {
Name : "No Such Repository Error" ,
StatusCode : http . StatusNotFound ,
Description : "The repository is not known to the registry." ,
Headers : [ ] ParameterDescriptor {
{
Name : "Content-Length" ,
Type : "integer" ,
Description : "Length of the JSON response body." ,
Format : "<length>" ,
} ,
} ,
2015-02-11 01:32:22 +00:00
Body : BodyDescriptor {
ContentType : "application/json; charset=utf-8" ,
2015-09-28 17:41:18 +00:00
Format : errorsBody ,
} ,
ErrorCodes : [ ] errcode . ErrorCode {
ErrorCodeNameUnknown ,
2015-02-11 01:32:22 +00:00
} ,
}
2015-09-28 17:41:18 +00:00
deniedResponseDescriptor = ResponseDescriptor {
Name : "Access Denied" ,
StatusCode : http . StatusForbidden ,
Description : "The client does not have required access to the repository." ,
2015-02-11 01:32:22 +00:00
Headers : [ ] ParameterDescriptor {
{
Name : "Content-Length" ,
Type : "integer" ,
2015-09-28 17:41:18 +00:00
Description : "Length of the JSON response body." ,
2015-02-11 01:32:22 +00:00
Format : "<length>" ,
} ,
} ,
Body : BodyDescriptor {
ContentType : "application/json; charset=utf-8" ,
2015-09-28 17:41:18 +00:00
Format : errorsBody ,
} ,
ErrorCodes : [ ] errcode . ErrorCode {
errcode . ErrorCodeDenied ,
2015-02-11 01:32:22 +00:00
} ,
}
)
const (
manifestBody = ` {
"name" : < name > ,
"tag" : < tag > ,
"fsLayers" : [
{
2015-05-02 00:13:11 +00:00
"blobSum" : "<digest>"
2015-02-11 01:32:22 +00:00
} ,
...
]
] ,
"history" : < v1 images > ,
"signature" : < JWS >
} `
errorsBody = ` {
"errors:" [
{
"code" : < error code > ,
"message" : "<error message>" ,
"detail" : ...
} ,
...
]
} `
unauthorizedErrorsBody = ` {
"errors:" [
{
"code" : "UNAUTHORIZED" ,
"message" : "access to the requested resource is not authorized" ,
"detail" : ...
} ,
...
]
} `
)
// APIDescriptor exports descriptions of the layout of the v2 registry API.
var APIDescriptor = struct {
// RouteDescriptors provides a list of the routes available in the API.
RouteDescriptors [ ] RouteDescriptor
} {
RouteDescriptors : routeDescriptors ,
}
// RouteDescriptor describes a route specified by name.
type RouteDescriptor struct {
// Name is the name of the route, as specified in RouteNameXXX exports.
// These names a should be considered a unique reference for a route. If
// the route is registered with gorilla, this is the name that will be
// used.
Name string
// Path is a gorilla/mux-compatible regexp that can be used to match the
// route. For any incoming method and path, only one route descriptor
// should match.
Path string
// Entity should be a short, human-readalbe description of the object
// targeted by the endpoint.
Entity string
// Description should provide an accurate overview of the functionality
// provided by the route.
Description string
// Methods should describe the various HTTP methods that may be used on
// this route, including request and response formats.
Methods [ ] MethodDescriptor
}
// MethodDescriptor provides a description of the requests that may be
// conducted with the target method.
type MethodDescriptor struct {
// Method is an HTTP method, such as GET, PUT or POST.
Method string
// Description should provide an overview of the functionality provided by
// the covered method, suitable for use in documentation. Use of markdown
// here is encouraged.
Description string
// Requests is a slice of request descriptors enumerating how this
// endpoint may be used.
Requests [ ] RequestDescriptor
}
// RequestDescriptor covers a particular set of headers and parameters that
// can be carried out with the parent method. Its most helpful to have one
// RequestDescriptor per API use case.
type RequestDescriptor struct {
// Name provides a short identifier for the request, usable as a title or
// to provide quick context for the particalar request.
Name string
// Description should cover the requests purpose, covering any details for
// this particular use case.
Description string
// Headers describes headers that must be used with the HTTP request.
Headers [ ] ParameterDescriptor
// PathParameters enumerate the parameterized path components for the
// given request, as defined in the route's regular expression.
PathParameters [ ] ParameterDescriptor
// QueryParameters provides a list of query parameters for the given
// request.
QueryParameters [ ] ParameterDescriptor
// Body describes the format of the request body.
Body BodyDescriptor
// Successes enumerates the possible responses that are considered to be
// the result of a successful request.
Successes [ ] ResponseDescriptor
// Failures covers the possible failures from this particular request.
Failures [ ] ResponseDescriptor
}
// ResponseDescriptor describes the components of an API response.
type ResponseDescriptor struct {
// Name provides a short identifier for the response, usable as a title or
// to provide quick context for the particalar response.
Name string
// Description should provide a brief overview of the role of the
// response.
Description string
// StatusCode specifies the status recieved by this particular response.
StatusCode int
// Headers covers any headers that may be returned from the response.
Headers [ ] ParameterDescriptor
2015-06-02 02:10:51 +00:00
// Fields describes any fields that may be present in the response.
Fields [ ] ParameterDescriptor
2015-02-11 01:32:22 +00:00
// ErrorCodes enumerates the error codes that may be returned along with
// the response.
2015-05-15 01:21:39 +00:00
ErrorCodes [ ] errcode . ErrorCode
2015-02-11 01:32:22 +00:00
// Body describes the body of the response, if any.
Body BodyDescriptor
}
// BodyDescriptor describes a request body and its expected content type. For
// the most part, it should be example json or some placeholder for body
// data in documentation.
type BodyDescriptor struct {
ContentType string
Format string
}
// ParameterDescriptor describes the format of a request parameter, which may
// be a header, path parameter or query parameter.
type ParameterDescriptor struct {
// Name is the name of the parameter, either of the path component or
// query parameter.
Name string
// Type specifies the type of the parameter, such as string, integer, etc.
Type string
// Description provides a human-readable description of the parameter.
Description string
// Required means the field is required when set.
Required bool
// Format is a specifying the string format accepted by this parameter.
Format string
// Regexp is a compiled regular expression that can be used to validate
// the contents of the parameter.
Regexp * regexp . Regexp
// Examples provides multiple examples for the values that might be valid
// for this parameter.
Examples [ ] string
}
var routeDescriptors = [ ] RouteDescriptor {
{
Name : RouteNameBase ,
Path : "/v2/" ,
Entity : "Base" ,
2015-09-28 17:41:18 +00:00
Description : ` Base V2 API route. Typically, this can be used for lightweight version checks and to validate registry authentication. ` ,
2015-02-11 01:32:22 +00:00
Methods : [ ] MethodDescriptor {
{
Method : "GET" ,
Description : "Check that the endpoint implements Docker Registry API V2." ,
Requests : [ ] RequestDescriptor {
{
Headers : [ ] ParameterDescriptor {
hostHeader ,
authHeader ,
} ,
Successes : [ ] ResponseDescriptor {
{
Description : "The API implements V2 protocol and is accessible." ,
StatusCode : http . StatusOK ,
} ,
} ,
Failures : [ ] ResponseDescriptor {
{
Description : "The registry does not implement the V2 API." ,
StatusCode : http . StatusNotFound ,
} ,
2015-09-28 17:41:18 +00:00
unauthorizedResponseDescriptor ,
2015-02-11 01:32:22 +00:00
} ,
} ,
} ,
} ,
} ,
} ,
{
Name : RouteNameTags ,
Path : "/v2/{name:" + RepositoryNameRegexp . String ( ) + "}/tags/list" ,
Entity : "Tags" ,
Description : "Retrieve information about tags." ,
Methods : [ ] MethodDescriptor {
{
Method : "GET" ,
Description : "Fetch the tags under the repository identified by `name`." ,
Requests : [ ] RequestDescriptor {
{
2015-07-23 03:00:28 +00:00
Name : "Tags" ,
Description : "Return all tags for the repository" ,
2015-02-11 01:32:22 +00:00
Headers : [ ] ParameterDescriptor {
hostHeader ,
authHeader ,
} ,
PathParameters : [ ] ParameterDescriptor {
nameParameterDescriptor ,
} ,
Successes : [ ] ResponseDescriptor {
{
StatusCode : http . StatusOK ,
Description : "A list of tags for the named repository." ,
Headers : [ ] ParameterDescriptor {
{
Name : "Content-Length" ,
Type : "integer" ,
Description : "Length of the JSON response body." ,
Format : "<length>" ,
} ,
} ,
Body : BodyDescriptor {
ContentType : "application/json; charset=utf-8" ,
Format : ` {
"name" : < name > ,
"tags" : [
< tag > ,
...
]
} ` ,
} ,
} ,
} ,
Failures : [ ] ResponseDescriptor {
2015-09-28 17:41:18 +00:00
unauthorizedResponseDescriptor ,
repositoryNotFoundResponseDescriptor ,
deniedResponseDescriptor ,
2015-02-11 01:32:22 +00:00
} ,
} ,
2015-06-02 02:10:51 +00:00
{
2015-07-23 03:00:28 +00:00
Name : "Tags Paginated" ,
2015-06-02 02:10:51 +00:00
Description : "Return a portion of the tags for the specified repository." ,
PathParameters : [ ] ParameterDescriptor { nameParameterDescriptor } ,
QueryParameters : paginationParameters ,
Successes : [ ] ResponseDescriptor {
{
StatusCode : http . StatusOK ,
Description : "A list of tags for the named repository." ,
Headers : [ ] ParameterDescriptor {
{
Name : "Content-Length" ,
Type : "integer" ,
Description : "Length of the JSON response body." ,
Format : "<length>" ,
} ,
2015-06-03 03:16:59 +00:00
linkHeader ,
2015-06-02 02:10:51 +00:00
} ,
Body : BodyDescriptor {
ContentType : "application/json; charset=utf-8" ,
Format : ` {
"name" : < name > ,
"tags" : [
< tag > ,
...
] ,
} ` ,
} ,
} ,
} ,
2015-07-23 03:00:28 +00:00
Failures : [ ] ResponseDescriptor {
2015-09-28 17:41:18 +00:00
unauthorizedResponseDescriptor ,
repositoryNotFoundResponseDescriptor ,
deniedResponseDescriptor ,
2015-07-23 03:00:28 +00:00
} ,
2015-06-02 02:10:51 +00:00
} ,
2015-02-11 01:32:22 +00:00
} ,
} ,
} ,
} ,
{
Name : RouteNameManifest ,
2015-02-26 02:04:28 +00:00
Path : "/v2/{name:" + RepositoryNameRegexp . String ( ) + "}/manifests/{reference:" + TagNameRegexp . String ( ) + "|" + digest . DigestRegexp . String ( ) + "}" ,
2015-02-11 01:32:22 +00:00
Entity : "Manifest" ,
2015-08-03 18:59:19 +00:00
Description : "Create, update, delete and retrieve manifests." ,
2015-02-11 01:32:22 +00:00
Methods : [ ] MethodDescriptor {
{
Method : "GET" ,
2015-02-26 02:04:28 +00:00
Description : "Fetch the manifest identified by `name` and `reference` where `reference` can be a tag or digest." ,
2015-02-11 01:32:22 +00:00
Requests : [ ] RequestDescriptor {
{
Headers : [ ] ParameterDescriptor {
hostHeader ,
authHeader ,
} ,
PathParameters : [ ] ParameterDescriptor {
nameParameterDescriptor ,
2015-06-01 15:14:03 +00:00
referenceParameterDescriptor ,
2015-02-11 01:32:22 +00:00
} ,
Successes : [ ] ResponseDescriptor {
{
2015-07-31 23:43:01 +00:00
Description : "The manifest identified by `name` and `reference`. The contents can be used to identify and resolve resources required to run the specified image." ,
2015-02-11 01:32:22 +00:00
StatusCode : http . StatusOK ,
2015-02-26 02:04:28 +00:00
Headers : [ ] ParameterDescriptor {
digestHeader ,
} ,
2015-02-11 01:32:22 +00:00
Body : BodyDescriptor {
ContentType : "application/json; charset=utf-8" ,
Format : manifestBody ,
} ,
} ,
} ,
Failures : [ ] ResponseDescriptor {
{
2015-02-26 02:04:28 +00:00
Description : "The name or reference was invalid." ,
2015-02-11 01:32:22 +00:00
StatusCode : http . StatusBadRequest ,
2015-05-15 01:21:39 +00:00
ErrorCodes : [ ] errcode . ErrorCode {
2015-02-11 01:32:22 +00:00
ErrorCodeNameInvalid ,
ErrorCodeTagInvalid ,
} ,
Body : BodyDescriptor {
ContentType : "application/json; charset=utf-8" ,
Format : errorsBody ,
} ,
} ,
2015-09-28 17:41:18 +00:00
unauthorizedResponseDescriptor ,
repositoryNotFoundResponseDescriptor ,
deniedResponseDescriptor ,
2015-02-11 01:32:22 +00:00
} ,
} ,
} ,
} ,
{
Method : "PUT" ,
2015-02-26 02:04:28 +00:00
Description : "Put the manifest identified by `name` and `reference` where `reference` can be a tag or digest." ,
2015-02-11 01:32:22 +00:00
Requests : [ ] RequestDescriptor {
{
Headers : [ ] ParameterDescriptor {
hostHeader ,
authHeader ,
} ,
PathParameters : [ ] ParameterDescriptor {
nameParameterDescriptor ,
2015-06-01 15:14:03 +00:00
referenceParameterDescriptor ,
2015-02-11 01:32:22 +00:00
} ,
Body : BodyDescriptor {
ContentType : "application/json; charset=utf-8" ,
Format : manifestBody ,
} ,
Successes : [ ] ResponseDescriptor {
{
Description : "The manifest has been accepted by the registry and is stored under the specified `name` and `tag`." ,
2015-07-24 17:42:02 +00:00
StatusCode : http . StatusCreated ,
2015-02-11 01:32:22 +00:00
Headers : [ ] ParameterDescriptor {
{
Name : "Location" ,
Type : "url" ,
Description : "The canonical location url of the uploaded manifest." ,
Format : "<url>" ,
} ,
contentLengthZeroHeader ,
2015-02-26 02:04:28 +00:00
digestHeader ,
2015-02-11 01:32:22 +00:00
} ,
} ,
} ,
Failures : [ ] ResponseDescriptor {
{
Name : "Invalid Manifest" ,
Description : "The received manifest was invalid in some way, as described by the error codes. The client should resolve the issue and retry the request." ,
StatusCode : http . StatusBadRequest ,
Body : BodyDescriptor {
ContentType : "application/json; charset=utf-8" ,
Format : errorsBody ,
} ,
2015-05-15 01:21:39 +00:00
ErrorCodes : [ ] errcode . ErrorCode {
2015-02-11 01:32:22 +00:00
ErrorCodeNameInvalid ,
ErrorCodeTagInvalid ,
ErrorCodeManifestInvalid ,
ErrorCodeManifestUnverified ,
ErrorCodeBlobUnknown ,
} ,
} ,
2015-09-28 17:41:18 +00:00
unauthorizedResponseDescriptor ,
repositoryNotFoundResponseDescriptor ,
deniedResponseDescriptor ,
2015-02-11 01:32:22 +00:00
{
Name : "Missing Layer(s)" ,
Description : "One or more layers may be missing during a manifest upload. If so, the missing layers will be enumerated in the error response." ,
StatusCode : http . StatusBadRequest ,
2015-05-15 01:21:39 +00:00
ErrorCodes : [ ] errcode . ErrorCode {
2015-02-11 01:32:22 +00:00
ErrorCodeBlobUnknown ,
} ,
Body : BodyDescriptor {
ContentType : "application/json; charset=utf-8" ,
Format : ` {
"errors:" [ {
"code" : "BLOB_UNKNOWN" ,
"message" : "blob unknown to registry" ,
"detail" : {
2015-05-02 00:13:11 +00:00
"digest" : "<digest>"
2015-02-11 01:32:22 +00:00
}
} ,
...
]
} ` ,
} ,
} ,
2015-08-11 18:00:30 +00:00
{
Name : "Not allowed" ,
Description : "Manifest put is not allowed because the registry is configured as a pull-through cache or for some other reason" ,
StatusCode : http . StatusMethodNotAllowed ,
ErrorCodes : [ ] errcode . ErrorCode {
errcode . ErrorCodeUnsupported ,
} ,
} ,
2015-02-11 01:32:22 +00:00
} ,
} ,
} ,
} ,
{
Method : "DELETE" ,
2015-06-05 01:59:08 +00:00
Description : "Delete the manifest identified by `name` and `reference`. Note that a manifest can _only_ be deleted by `digest`." ,
2015-02-11 01:32:22 +00:00
Requests : [ ] RequestDescriptor {
{
Headers : [ ] ParameterDescriptor {
hostHeader ,
authHeader ,
} ,
PathParameters : [ ] ParameterDescriptor {
nameParameterDescriptor ,
2015-06-01 15:14:03 +00:00
referenceParameterDescriptor ,
2015-02-11 01:32:22 +00:00
} ,
Successes : [ ] ResponseDescriptor {
{
StatusCode : http . StatusAccepted ,
} ,
} ,
Failures : [ ] ResponseDescriptor {
{
2015-06-05 01:59:08 +00:00
Name : "Invalid Name or Reference" ,
Description : "The specified `name` or `reference` were invalid and the delete was unable to proceed." ,
2015-02-11 01:32:22 +00:00
StatusCode : http . StatusBadRequest ,
2015-05-15 01:21:39 +00:00
ErrorCodes : [ ] errcode . ErrorCode {
2015-02-11 01:32:22 +00:00
ErrorCodeNameInvalid ,
ErrorCodeTagInvalid ,
} ,
Body : BodyDescriptor {
ContentType : "application/json; charset=utf-8" ,
Format : errorsBody ,
} ,
} ,
2015-09-28 17:41:18 +00:00
unauthorizedResponseDescriptor ,
repositoryNotFoundResponseDescriptor ,
deniedResponseDescriptor ,
2015-02-11 01:32:22 +00:00
{
Name : "Unknown Manifest" ,
2015-06-05 01:59:08 +00:00
Description : "The specified `name` or `reference` are unknown to the registry and the delete was unable to proceed. Clients can assume the manifest was already deleted if this response is returned." ,
2015-02-11 01:32:22 +00:00
StatusCode : http . StatusNotFound ,
2015-05-15 01:21:39 +00:00
ErrorCodes : [ ] errcode . ErrorCode {
2015-02-11 01:32:22 +00:00
ErrorCodeNameUnknown ,
ErrorCodeManifestUnknown ,
} ,
Body : BodyDescriptor {
ContentType : "application/json; charset=utf-8" ,
Format : errorsBody ,
} ,
} ,
2015-08-11 18:00:30 +00:00
{
Name : "Not allowed" ,
Description : "Manifest delete is not allowed because the registry is configured as a pull-through cache or `delete` has been disabled." ,
StatusCode : http . StatusMethodNotAllowed ,
ErrorCodes : [ ] errcode . ErrorCode {
errcode . ErrorCodeUnsupported ,
} ,
} ,
2015-02-11 01:32:22 +00:00
} ,
} ,
} ,
} ,
} ,
} ,
{
Name : RouteNameBlob ,
Path : "/v2/{name:" + RepositoryNameRegexp . String ( ) + "}/blobs/{digest:" + digest . DigestRegexp . String ( ) + "}" ,
Entity : "Blob" ,
2015-08-03 18:59:19 +00:00
Description : "Operations on blobs identified by `name` and `digest`. Used to fetch or delete layers by digest." ,
2015-02-11 01:32:22 +00:00
Methods : [ ] MethodDescriptor {
{
Method : "GET" ,
Description : "Retrieve the blob from the registry identified by `digest`. A `HEAD` request can also be issued to this endpoint to obtain resource information without receiving all data." ,
Requests : [ ] RequestDescriptor {
{
Name : "Fetch Blob" ,
Headers : [ ] ParameterDescriptor {
hostHeader ,
authHeader ,
} ,
PathParameters : [ ] ParameterDescriptor {
nameParameterDescriptor ,
digestPathParameter ,
} ,
Successes : [ ] ResponseDescriptor {
{
Description : "The blob identified by `digest` is available. The blob content will be present in the body of the request." ,
StatusCode : http . StatusOK ,
Headers : [ ] ParameterDescriptor {
{
Name : "Content-Length" ,
Type : "integer" ,
Description : "The length of the requested blob content." ,
Format : "<length>" ,
} ,
2015-02-26 02:04:28 +00:00
digestHeader ,
2015-02-11 01:32:22 +00:00
} ,
Body : BodyDescriptor {
ContentType : "application/octet-stream" ,
Format : "<blob binary data>" ,
} ,
} ,
{
Description : "The blob identified by `digest` is available at the provided location." ,
StatusCode : http . StatusTemporaryRedirect ,
Headers : [ ] ParameterDescriptor {
{
Name : "Location" ,
Type : "url" ,
Description : "The location where the layer should be accessible." ,
Format : "<blob location>" ,
} ,
2015-02-26 02:04:28 +00:00
digestHeader ,
2015-02-11 01:32:22 +00:00
} ,
} ,
} ,
Failures : [ ] ResponseDescriptor {
{
Description : "There was a problem with the request that needs to be addressed by the client, such as an invalid `name` or `tag`." ,
StatusCode : http . StatusBadRequest ,
2015-05-15 01:21:39 +00:00
ErrorCodes : [ ] errcode . ErrorCode {
2015-02-11 01:32:22 +00:00
ErrorCodeNameInvalid ,
ErrorCodeDigestInvalid ,
} ,
Body : BodyDescriptor {
ContentType : "application/json; charset=utf-8" ,
Format : errorsBody ,
} ,
} ,
{
Description : "The blob, identified by `name` and `digest`, is unknown to the registry." ,
StatusCode : http . StatusNotFound ,
Body : BodyDescriptor {
ContentType : "application/json; charset=utf-8" ,
Format : errorsBody ,
} ,
2015-05-15 01:21:39 +00:00
ErrorCodes : [ ] errcode . ErrorCode {
2015-02-11 01:32:22 +00:00
ErrorCodeNameUnknown ,
ErrorCodeBlobUnknown ,
} ,
} ,
2015-09-28 17:41:18 +00:00
unauthorizedResponseDescriptor ,
repositoryNotFoundResponseDescriptor ,
deniedResponseDescriptor ,
2015-02-11 01:32:22 +00:00
} ,
} ,
{
Name : "Fetch Blob Part" ,
Description : "This endpoint may also support RFC7233 compliant range requests. Support can be detected by issuing a HEAD request. If the header `Accept-Range: bytes` is returned, range requests can be used to fetch partial content." ,
Headers : [ ] ParameterDescriptor {
hostHeader ,
authHeader ,
{
Name : "Range" ,
Type : "string" ,
Description : "HTTP Range header specifying blob chunk." ,
Format : "bytes=<start>-<end>" ,
} ,
} ,
PathParameters : [ ] ParameterDescriptor {
nameParameterDescriptor ,
digestPathParameter ,
} ,
Successes : [ ] ResponseDescriptor {
{
Description : "The blob identified by `digest` is available. The specified chunk of blob content will be present in the body of the request." ,
StatusCode : http . StatusPartialContent ,
Headers : [ ] ParameterDescriptor {
{
Name : "Content-Length" ,
Type : "integer" ,
Description : "The length of the requested blob chunk." ,
Format : "<length>" ,
} ,
{
Name : "Content-Range" ,
Type : "byte range" ,
Description : "Content range of blob chunk." ,
Format : "bytes <start>-<end>/<size>" ,
} ,
} ,
Body : BodyDescriptor {
ContentType : "application/octet-stream" ,
Format : "<blob binary data>" ,
} ,
} ,
} ,
Failures : [ ] ResponseDescriptor {
{
Description : "There was a problem with the request that needs to be addressed by the client, such as an invalid `name` or `tag`." ,
StatusCode : http . StatusBadRequest ,
2015-05-15 01:21:39 +00:00
ErrorCodes : [ ] errcode . ErrorCode {
2015-02-11 01:32:22 +00:00
ErrorCodeNameInvalid ,
ErrorCodeDigestInvalid ,
} ,
Body : BodyDescriptor {
ContentType : "application/json; charset=utf-8" ,
Format : errorsBody ,
} ,
} ,
{
StatusCode : http . StatusNotFound ,
2015-05-15 01:21:39 +00:00
ErrorCodes : [ ] errcode . ErrorCode {
2015-02-11 01:32:22 +00:00
ErrorCodeNameUnknown ,
ErrorCodeBlobUnknown ,
} ,
Body : BodyDescriptor {
ContentType : "application/json; charset=utf-8" ,
Format : errorsBody ,
} ,
} ,
{
Description : "The range specification cannot be satisfied for the requested content. This can happen when the range is not formatted correctly or if the range is outside of the valid size of the content." ,
StatusCode : http . StatusRequestedRangeNotSatisfiable ,
} ,
2015-09-28 17:41:18 +00:00
unauthorizedResponseDescriptor ,
repositoryNotFoundResponseDescriptor ,
deniedResponseDescriptor ,
2015-02-11 01:32:22 +00:00
} ,
} ,
} ,
} ,
2015-08-03 18:59:19 +00:00
{
Method : "DELETE" ,
Description : "Delete the blob identified by `name` and `digest`" ,
Requests : [ ] RequestDescriptor {
{
Headers : [ ] ParameterDescriptor {
hostHeader ,
authHeader ,
} ,
PathParameters : [ ] ParameterDescriptor {
nameParameterDescriptor ,
digestPathParameter ,
} ,
Successes : [ ] ResponseDescriptor {
{
StatusCode : http . StatusAccepted ,
Headers : [ ] ParameterDescriptor {
{
Name : "Content-Length" ,
Type : "integer" ,
Description : "0" ,
Format : "0" ,
} ,
digestHeader ,
} ,
} ,
} ,
Failures : [ ] ResponseDescriptor {
{
Name : "Invalid Name or Digest" ,
StatusCode : http . StatusBadRequest ,
ErrorCodes : [ ] errcode . ErrorCode {
ErrorCodeDigestInvalid ,
ErrorCodeNameInvalid ,
} ,
} ,
{
Description : "The blob, identified by `name` and `digest`, is unknown to the registry." ,
StatusCode : http . StatusNotFound ,
Body : BodyDescriptor {
ContentType : "application/json; charset=utf-8" ,
Format : errorsBody ,
} ,
ErrorCodes : [ ] errcode . ErrorCode {
ErrorCodeNameUnknown ,
ErrorCodeBlobUnknown ,
} ,
} ,
{
2015-08-11 18:00:30 +00:00
Description : "Blob delete is not allowed because the registry is configured as a pull-through cache or `delete` has been disabled" ,
2015-08-03 18:59:19 +00:00
StatusCode : http . StatusMethodNotAllowed ,
Body : BodyDescriptor {
ContentType : "application/json; charset=utf-8" ,
Format : errorsBody ,
} ,
ErrorCodes : [ ] errcode . ErrorCode {
2015-08-06 23:25:08 +00:00
errcode . ErrorCodeUnsupported ,
2015-08-03 18:59:19 +00:00
} ,
} ,
2015-09-28 17:41:18 +00:00
unauthorizedResponseDescriptor ,
repositoryNotFoundResponseDescriptor ,
deniedResponseDescriptor ,
2015-08-03 18:59:19 +00:00
} ,
} ,
} ,
} ,
2015-02-11 01:32:22 +00:00
// TODO(stevvooe): We may want to add a PUT request here to
// kickoff an upload of a blob, integrated with the blob upload
// API.
} ,
} ,
{
Name : RouteNameBlobUpload ,
Path : "/v2/{name:" + RepositoryNameRegexp . String ( ) + "}/blobs/uploads/" ,
2015-07-31 23:43:01 +00:00
Entity : "Initiate Blob Upload" ,
2015-02-11 01:32:22 +00:00
Description : "Initiate a blob upload. This endpoint can be used to create resumable uploads or monolithic uploads." ,
Methods : [ ] MethodDescriptor {
{
Method : "POST" ,
Description : "Initiate a resumable blob upload. If successful, an upload location will be provided to complete the upload. Optionally, if the `digest` parameter is present, the request body will be used to complete the upload in a single request." ,
Requests : [ ] RequestDescriptor {
{
Name : "Initiate Monolithic Blob Upload" ,
Description : "Upload a blob identified by the `digest` parameter in single request. This upload will not be resumable unless a recoverable error is returned." ,
Headers : [ ] ParameterDescriptor {
hostHeader ,
authHeader ,
{
Name : "Content-Length" ,
Type : "integer" ,
Format : "<length of blob>" ,
} ,
} ,
PathParameters : [ ] ParameterDescriptor {
nameParameterDescriptor ,
} ,
QueryParameters : [ ] ParameterDescriptor {
{
Name : "digest" ,
Type : "query" ,
2015-05-02 00:13:11 +00:00
Format : "<digest>" ,
2015-02-11 01:32:22 +00:00
Regexp : digest . DigestRegexp ,
Description : ` Digest of uploaded blob. If present, the upload will be completed, in a single request, with contents of the request body as the resulting blob. ` ,
} ,
} ,
Body : BodyDescriptor {
ContentType : "application/octect-stream" ,
Format : "<binary data>" ,
} ,
Successes : [ ] ResponseDescriptor {
{
Description : "The blob has been created in the registry and is available at the provided location." ,
StatusCode : http . StatusCreated ,
Headers : [ ] ParameterDescriptor {
{
Name : "Location" ,
Type : "url" ,
Format : "<blob location>" ,
} ,
contentLengthZeroHeader ,
2015-02-27 00:43:47 +00:00
dockerUploadUUIDHeader ,
2015-02-11 01:32:22 +00:00
} ,
} ,
} ,
Failures : [ ] ResponseDescriptor {
{
Name : "Invalid Name or Digest" ,
StatusCode : http . StatusBadRequest ,
2015-05-15 01:21:39 +00:00
ErrorCodes : [ ] errcode . ErrorCode {
2015-02-11 01:32:22 +00:00
ErrorCodeDigestInvalid ,
ErrorCodeNameInvalid ,
} ,
} ,
2015-08-11 18:00:30 +00:00
{
Name : "Not allowed" ,
Description : "Blob upload is not allowed because the registry is configured as a pull-through cache or for some other reason" ,
StatusCode : http . StatusMethodNotAllowed ,
ErrorCodes : [ ] errcode . ErrorCode {
errcode . ErrorCodeUnsupported ,
} ,
} ,
2015-09-28 17:41:18 +00:00
unauthorizedResponseDescriptor ,
repositoryNotFoundResponseDescriptor ,
deniedResponseDescriptor ,
2015-02-11 01:32:22 +00:00
} ,
} ,
{
Name : "Initiate Resumable Blob Upload" ,
Description : "Initiate a resumable blob upload with an empty request body." ,
Headers : [ ] ParameterDescriptor {
hostHeader ,
authHeader ,
contentLengthZeroHeader ,
} ,
PathParameters : [ ] ParameterDescriptor {
nameParameterDescriptor ,
} ,
Successes : [ ] ResponseDescriptor {
{
Description : "The upload has been created. The `Location` header must be used to complete the upload. The response should be identical to a `GET` request on the contents of the returned `Location` header." ,
StatusCode : http . StatusAccepted ,
Headers : [ ] ParameterDescriptor {
contentLengthZeroHeader ,
{
Name : "Location" ,
Type : "url" ,
Format : "/v2/<name>/blobs/uploads/<uuid>" ,
Description : "The location of the created upload. Clients should use the contents verbatim to complete the upload, adding parameters where required." ,
} ,
{
Name : "Range" ,
Format : "0-0" ,
Description : "Range header indicating the progress of the upload. When starting an upload, it will return an empty range, since no content has been received." ,
} ,
2015-02-27 00:43:47 +00:00
dockerUploadUUIDHeader ,
2015-02-11 01:32:22 +00:00
} ,
} ,
} ,
Failures : [ ] ResponseDescriptor {
{
Name : "Invalid Name or Digest" ,
StatusCode : http . StatusBadRequest ,
2015-05-15 01:21:39 +00:00
ErrorCodes : [ ] errcode . ErrorCode {
2015-02-11 01:32:22 +00:00
ErrorCodeDigestInvalid ,
ErrorCodeNameInvalid ,
} ,
} ,
2015-09-28 17:41:18 +00:00
unauthorizedResponseDescriptor ,
repositoryNotFoundResponseDescriptor ,
deniedResponseDescriptor ,
2015-02-11 01:32:22 +00:00
} ,
} ,
} ,
} ,
} ,
} ,
{
Name : RouteNameBlobUploadChunk ,
2015-04-02 01:57:59 +00:00
Path : "/v2/{name:" + RepositoryNameRegexp . String ( ) + "}/blobs/uploads/{uuid:[a-zA-Z0-9-_.=]+}" ,
2015-02-11 01:32:22 +00:00
Entity : "Blob Upload" ,
Description : "Interact with blob uploads. Clients should never assemble URLs for this endpoint and should only take it through the `Location` header on related API requests. The `Location` header and its parameters should be preserved by clients, using the latest value returned via upload related API calls." ,
Methods : [ ] MethodDescriptor {
{
Method : "GET" ,
Description : "Retrieve status of upload identified by `uuid`. The primary purpose of this endpoint is to resolve the current status of a resumable upload." ,
Requests : [ ] RequestDescriptor {
{
Description : "Retrieve the progress of the current upload, as reported by the `Range` header." ,
Headers : [ ] ParameterDescriptor {
hostHeader ,
authHeader ,
} ,
PathParameters : [ ] ParameterDescriptor {
nameParameterDescriptor ,
uuidParameterDescriptor ,
} ,
Successes : [ ] ResponseDescriptor {
{
Name : "Upload Progress" ,
Description : "The upload is known and in progress. The last received offset is available in the `Range` header." ,
StatusCode : http . StatusNoContent ,
Headers : [ ] ParameterDescriptor {
{
Name : "Range" ,
Type : "header" ,
Format : "0-<offset>" ,
Description : "Range indicating the current progress of the upload." ,
} ,
contentLengthZeroHeader ,
2015-02-27 00:43:47 +00:00
dockerUploadUUIDHeader ,
2015-02-11 01:32:22 +00:00
} ,
} ,
} ,
Failures : [ ] ResponseDescriptor {
{
Description : "There was an error processing the upload and it must be restarted." ,
StatusCode : http . StatusBadRequest ,
2015-05-15 01:21:39 +00:00
ErrorCodes : [ ] errcode . ErrorCode {
2015-02-11 01:32:22 +00:00
ErrorCodeDigestInvalid ,
ErrorCodeNameInvalid ,
ErrorCodeBlobUploadInvalid ,
} ,
Body : BodyDescriptor {
ContentType : "application/json; charset=utf-8" ,
Format : errorsBody ,
} ,
} ,
{
Description : "The upload is unknown to the registry. The upload must be restarted." ,
StatusCode : http . StatusNotFound ,
2015-05-15 01:21:39 +00:00
ErrorCodes : [ ] errcode . ErrorCode {
2015-02-11 01:32:22 +00:00
ErrorCodeBlobUploadUnknown ,
} ,
Body : BodyDescriptor {
ContentType : "application/json; charset=utf-8" ,
Format : errorsBody ,
} ,
} ,
2015-09-28 17:41:18 +00:00
unauthorizedResponseDescriptor ,
repositoryNotFoundResponseDescriptor ,
deniedResponseDescriptor ,
2015-02-11 01:32:22 +00:00
} ,
} ,
} ,
} ,
{
Method : "PATCH" ,
Description : "Upload a chunk of data for the specified upload." ,
Requests : [ ] RequestDescriptor {
{
2015-05-04 15:56:37 +00:00
Name : "Stream upload" ,
Description : "Upload a stream of data to upload without completing the upload." ,
PathParameters : [ ] ParameterDescriptor {
nameParameterDescriptor ,
uuidParameterDescriptor ,
} ,
Headers : [ ] ParameterDescriptor {
hostHeader ,
authHeader ,
} ,
Body : BodyDescriptor {
ContentType : "application/octet-stream" ,
Format : "<binary data>" ,
} ,
Successes : [ ] ResponseDescriptor {
{
Name : "Data Accepted" ,
Description : "The stream of data has been accepted and the current progress is available in the range header. The updated upload location is available in the `Location` header." ,
StatusCode : http . StatusNoContent ,
Headers : [ ] ParameterDescriptor {
{
Name : "Location" ,
Type : "url" ,
Format : "/v2/<name>/blobs/uploads/<uuid>" ,
Description : "The location of the upload. Clients should assume this changes after each request. Clients should use the contents verbatim to complete the upload, adding parameters where required." ,
} ,
{
Name : "Range" ,
Type : "header" ,
Format : "0-<offset>" ,
Description : "Range indicating the current progress of the upload." ,
} ,
contentLengthZeroHeader ,
dockerUploadUUIDHeader ,
} ,
} ,
} ,
Failures : [ ] ResponseDescriptor {
{
Description : "There was an error processing the upload and it must be restarted." ,
StatusCode : http . StatusBadRequest ,
2015-05-15 01:21:39 +00:00
ErrorCodes : [ ] errcode . ErrorCode {
2015-05-04 15:56:37 +00:00
ErrorCodeDigestInvalid ,
ErrorCodeNameInvalid ,
ErrorCodeBlobUploadInvalid ,
} ,
Body : BodyDescriptor {
ContentType : "application/json; charset=utf-8" ,
Format : errorsBody ,
} ,
} ,
{
Description : "The upload is unknown to the registry. The upload must be restarted." ,
StatusCode : http . StatusNotFound ,
2015-05-15 01:21:39 +00:00
ErrorCodes : [ ] errcode . ErrorCode {
2015-05-04 15:56:37 +00:00
ErrorCodeBlobUploadUnknown ,
} ,
Body : BodyDescriptor {
ContentType : "application/json; charset=utf-8" ,
Format : errorsBody ,
} ,
} ,
2015-09-28 17:41:18 +00:00
unauthorizedResponseDescriptor ,
repositoryNotFoundResponseDescriptor ,
deniedResponseDescriptor ,
2015-05-04 15:56:37 +00:00
} ,
} ,
{
Name : "Chunked upload" ,
Description : "Upload a chunk of data to specified upload without completing the upload. The data will be uploaded to the specified Content Range." ,
2015-02-11 01:32:22 +00:00
PathParameters : [ ] ParameterDescriptor {
nameParameterDescriptor ,
uuidParameterDescriptor ,
} ,
Headers : [ ] ParameterDescriptor {
hostHeader ,
authHeader ,
{
Name : "Content-Range" ,
Type : "header" ,
Format : "<start of range>-<end of range, inclusive>" ,
Required : true ,
Description : "Range of bytes identifying the desired block of content represented by the body. Start must the end offset retrieved via status check plus one. Note that this is a non-standard use of the `Content-Range` header." ,
} ,
{
Name : "Content-Length" ,
Type : "integer" ,
Format : "<length of chunk>" ,
Description : "Length of the chunk being uploaded, corresponding the length of the request body." ,
} ,
} ,
Body : BodyDescriptor {
ContentType : "application/octet-stream" ,
Format : "<binary chunk>" ,
} ,
Successes : [ ] ResponseDescriptor {
{
Name : "Chunk Accepted" ,
Description : "The chunk of data has been accepted and the current progress is available in the range header. The updated upload location is available in the `Location` header." ,
StatusCode : http . StatusNoContent ,
Headers : [ ] ParameterDescriptor {
{
Name : "Location" ,
Type : "url" ,
Format : "/v2/<name>/blobs/uploads/<uuid>" ,
Description : "The location of the upload. Clients should assume this changes after each request. Clients should use the contents verbatim to complete the upload, adding parameters where required." ,
} ,
{
Name : "Range" ,
Type : "header" ,
Format : "0-<offset>" ,
Description : "Range indicating the current progress of the upload." ,
} ,
contentLengthZeroHeader ,
2015-02-27 00:43:47 +00:00
dockerUploadUUIDHeader ,
2015-02-11 01:32:22 +00:00
} ,
} ,
} ,
Failures : [ ] ResponseDescriptor {
{
Description : "There was an error processing the upload and it must be restarted." ,
StatusCode : http . StatusBadRequest ,
2015-05-15 01:21:39 +00:00
ErrorCodes : [ ] errcode . ErrorCode {
2015-02-11 01:32:22 +00:00
ErrorCodeDigestInvalid ,
ErrorCodeNameInvalid ,
ErrorCodeBlobUploadInvalid ,
} ,
Body : BodyDescriptor {
ContentType : "application/json; charset=utf-8" ,
Format : errorsBody ,
} ,
} ,
{
Description : "The upload is unknown to the registry. The upload must be restarted." ,
StatusCode : http . StatusNotFound ,
2015-05-15 01:21:39 +00:00
ErrorCodes : [ ] errcode . ErrorCode {
2015-02-11 01:32:22 +00:00
ErrorCodeBlobUploadUnknown ,
} ,
Body : BodyDescriptor {
ContentType : "application/json; charset=utf-8" ,
Format : errorsBody ,
} ,
} ,
{
Description : "The `Content-Range` specification cannot be accepted, either because it does not overlap with the current progress or it is invalid." ,
StatusCode : http . StatusRequestedRangeNotSatisfiable ,
} ,
2015-09-28 17:41:18 +00:00
unauthorizedResponseDescriptor ,
repositoryNotFoundResponseDescriptor ,
deniedResponseDescriptor ,
2015-02-11 01:32:22 +00:00
} ,
} ,
} ,
} ,
{
Method : "PUT" ,
Description : "Complete the upload specified by `uuid`, optionally appending the body as the final chunk." ,
Requests : [ ] RequestDescriptor {
{
2015-05-04 15:56:37 +00:00
Description : "Complete the upload, providing all the data in the body, if necessary. A request without a body will just complete the upload with previously uploaded content." ,
2015-02-11 01:32:22 +00:00
Headers : [ ] ParameterDescriptor {
hostHeader ,
authHeader ,
{
Name : "Content-Length" ,
Type : "integer" ,
2015-05-04 15:56:37 +00:00
Format : "<length of data>" ,
Description : "Length of the data being uploaded, corresponding to the length of the request body. May be zero if no data is provided." ,
2015-02-11 01:32:22 +00:00
} ,
} ,
PathParameters : [ ] ParameterDescriptor {
nameParameterDescriptor ,
uuidParameterDescriptor ,
} ,
QueryParameters : [ ] ParameterDescriptor {
{
Name : "digest" ,
Type : "string" ,
2015-05-02 00:13:11 +00:00
Format : "<digest>" ,
2015-02-11 01:32:22 +00:00
Regexp : digest . DigestRegexp ,
Required : true ,
Description : ` Digest of uploaded blob. ` ,
} ,
} ,
Body : BodyDescriptor {
ContentType : "application/octet-stream" ,
2015-05-04 15:56:37 +00:00
Format : "<binary data>" ,
2015-02-11 01:32:22 +00:00
} ,
Successes : [ ] ResponseDescriptor {
{
Name : "Upload Complete" ,
Description : "The upload has been completed and accepted by the registry. The canonical location will be available in the `Location` header." ,
StatusCode : http . StatusNoContent ,
Headers : [ ] ParameterDescriptor {
{
2015-04-16 00:55:15 +00:00
Name : "Location" ,
Type : "url" ,
Format : "<blob location>" ,
Description : "The canonical location of the blob for retrieval" ,
2015-02-11 01:32:22 +00:00
} ,
{
Name : "Content-Range" ,
Type : "header" ,
Format : "<start of range>-<end of range, inclusive>" ,
Description : "Range of bytes identifying the desired block of content represented by the body. Start must match the end of offset retrieved via status check. Note that this is a non-standard use of the `Content-Range` header." ,
} ,
2015-04-16 00:55:15 +00:00
contentLengthZeroHeader ,
2015-02-26 02:04:28 +00:00
digestHeader ,
2015-02-11 01:32:22 +00:00
} ,
} ,
} ,
Failures : [ ] ResponseDescriptor {
{
Description : "There was an error processing the upload and it must be restarted." ,
StatusCode : http . StatusBadRequest ,
2015-05-15 01:21:39 +00:00
ErrorCodes : [ ] errcode . ErrorCode {
2015-02-11 01:32:22 +00:00
ErrorCodeDigestInvalid ,
ErrorCodeNameInvalid ,
ErrorCodeBlobUploadInvalid ,
2015-08-11 18:00:30 +00:00
errcode . ErrorCodeUnsupported ,
2015-02-11 01:32:22 +00:00
} ,
Body : BodyDescriptor {
ContentType : "application/json; charset=utf-8" ,
Format : errorsBody ,
} ,
} ,
{
Description : "The upload is unknown to the registry. The upload must be restarted." ,
StatusCode : http . StatusNotFound ,
2015-05-15 01:21:39 +00:00
ErrorCodes : [ ] errcode . ErrorCode {
2015-02-11 01:32:22 +00:00
ErrorCodeBlobUploadUnknown ,
} ,
Body : BodyDescriptor {
ContentType : "application/json; charset=utf-8" ,
Format : errorsBody ,
} ,
} ,
2015-09-28 17:41:18 +00:00
unauthorizedResponseDescriptor ,
repositoryNotFoundResponseDescriptor ,
deniedResponseDescriptor ,
2015-02-11 01:32:22 +00:00
} ,
} ,
} ,
} ,
{
Method : "DELETE" ,
Description : "Cancel outstanding upload processes, releasing associated resources. If this is not called, the unfinished uploads will eventually timeout." ,
Requests : [ ] RequestDescriptor {
{
Description : "Cancel the upload specified by `uuid`." ,
PathParameters : [ ] ParameterDescriptor {
nameParameterDescriptor ,
uuidParameterDescriptor ,
} ,
Headers : [ ] ParameterDescriptor {
hostHeader ,
authHeader ,
contentLengthZeroHeader ,
} ,
Successes : [ ] ResponseDescriptor {
{
Name : "Upload Deleted" ,
Description : "The upload has been successfully deleted." ,
StatusCode : http . StatusNoContent ,
Headers : [ ] ParameterDescriptor {
contentLengthZeroHeader ,
} ,
} ,
} ,
Failures : [ ] ResponseDescriptor {
{
Description : "An error was encountered processing the delete. The client may ignore this error." ,
StatusCode : http . StatusBadRequest ,
2015-05-15 01:21:39 +00:00
ErrorCodes : [ ] errcode . ErrorCode {
2015-02-11 01:32:22 +00:00
ErrorCodeNameInvalid ,
ErrorCodeBlobUploadInvalid ,
} ,
Body : BodyDescriptor {
ContentType : "application/json; charset=utf-8" ,
Format : errorsBody ,
} ,
} ,
{
Description : "The upload is unknown to the registry. The client may ignore this error and assume the upload has been deleted." ,
StatusCode : http . StatusNotFound ,
2015-05-15 01:21:39 +00:00
ErrorCodes : [ ] errcode . ErrorCode {
2015-02-11 01:32:22 +00:00
ErrorCodeBlobUploadUnknown ,
} ,
Body : BodyDescriptor {
ContentType : "application/json; charset=utf-8" ,
Format : errorsBody ,
} ,
} ,
2015-09-28 17:41:18 +00:00
unauthorizedResponseDescriptor ,
repositoryNotFoundResponseDescriptor ,
deniedResponseDescriptor ,
2015-02-11 01:32:22 +00:00
} ,
} ,
} ,
} ,
} ,
} ,
2015-06-02 02:10:51 +00:00
{
Name : RouteNameCatalog ,
Path : "/v2/_catalog" ,
Entity : "Catalog" ,
Description : "List a set of available repositories in the local registry cluster. Does not provide any indication of what may be available upstream. Applications can only determine if a repository is available but not if it is not available." ,
Methods : [ ] MethodDescriptor {
{
Method : "GET" ,
Description : "Retrieve a sorted, json list of repositories available in the registry." ,
Requests : [ ] RequestDescriptor {
{
Name : "Catalog Fetch Complete" ,
Description : "Request an unabridged list of repositories available." ,
Successes : [ ] ResponseDescriptor {
{
Description : "Returns the unabridged list of repositories as a json response." ,
StatusCode : http . StatusOK ,
Headers : [ ] ParameterDescriptor {
{
Name : "Content-Length" ,
Type : "integer" ,
Description : "Length of the JSON response body." ,
Format : "<length>" ,
} ,
} ,
Body : BodyDescriptor {
ContentType : "application/json; charset=utf-8" ,
Format : ` {
"repositories" : [
< name > ,
...
]
} ` ,
} ,
} ,
} ,
} ,
{
Name : "Catalog Fetch Paginated" ,
Description : "Return the specified portion of repositories." ,
QueryParameters : paginationParameters ,
Successes : [ ] ResponseDescriptor {
{
StatusCode : http . StatusOK ,
Body : BodyDescriptor {
ContentType : "application/json; charset=utf-8" ,
Format : ` {
"repositories" : [
< name > ,
...
]
"next" : "<url>?last=<name>&n=<last value of n>"
} ` ,
} ,
Headers : [ ] ParameterDescriptor {
{
Name : "Content-Length" ,
Type : "integer" ,
Description : "Length of the JSON response body." ,
Format : "<length>" ,
} ,
2015-06-03 03:16:59 +00:00
linkHeader ,
2015-06-02 02:10:51 +00:00
} ,
} ,
} ,
} ,
} ,
} ,
} ,
} ,
2015-02-11 01:32:22 +00:00
}
2015-02-24 22:59:01 +00:00
var routeDescriptorsMap map [ string ] RouteDescriptor
2015-02-11 01:32:22 +00:00
func init ( ) {
2015-02-24 22:59:01 +00:00
routeDescriptorsMap = make ( map [ string ] RouteDescriptor , len ( routeDescriptors ) )
2015-02-11 01:32:22 +00:00
2015-02-24 22:59:01 +00:00
for _ , descriptor := range routeDescriptors {
routeDescriptorsMap [ descriptor . Name ] = descriptor
}
2015-02-11 01:32:22 +00:00
}