PageRenderTime 4267ms CodeModel.GetById 37ms RepoModel.GetById 1ms app.codeStats 0ms

/registry/api/v2/descriptors.go

https://gitlab.com/CORP-RESELLER/cf-distribution
Go | 1523 lines | 1397 code | 57 blank | 69 comment | 0 complexity | cb7a5cc1d88ee088f4a6c39ea5601b6a MD5 | raw file
  1. package v2
  2. import (
  3. "net/http"
  4. "regexp"
  5. "github.com/docker/distribution/digest"
  6. "github.com/docker/distribution/registry/api/errcode"
  7. )
  8. var (
  9. nameParameterDescriptor = ParameterDescriptor{
  10. Name: "name",
  11. Type: "string",
  12. Format: RepositoryNameRegexp.String(),
  13. Required: true,
  14. Description: `Name of the target repository.`,
  15. }
  16. referenceParameterDescriptor = ParameterDescriptor{
  17. Name: "reference",
  18. Type: "string",
  19. Format: TagNameRegexp.String(),
  20. Required: true,
  21. Description: `Tag or digest of the target manifest.`,
  22. }
  23. uuidParameterDescriptor = ParameterDescriptor{
  24. Name: "uuid",
  25. Type: "opaque",
  26. Required: true,
  27. Description: "A uuid identifying the upload. This field can accept characters that match `[a-zA-Z0-9-_.=]+`.",
  28. }
  29. digestPathParameter = ParameterDescriptor{
  30. Name: "digest",
  31. Type: "path",
  32. Required: true,
  33. Format: digest.DigestRegexp.String(),
  34. Description: `Digest of desired blob.`,
  35. }
  36. hostHeader = ParameterDescriptor{
  37. Name: "Host",
  38. Type: "string",
  39. Description: "Standard HTTP Host Header. Should be set to the registry host.",
  40. Format: "<registry host>",
  41. Examples: []string{"registry-1.docker.io"},
  42. }
  43. authHeader = ParameterDescriptor{
  44. Name: "Authorization",
  45. Type: "string",
  46. Description: "An RFC7235 compliant authorization header.",
  47. Format: "<scheme> <token>",
  48. Examples: []string{"Bearer dGhpcyBpcyBhIGZha2UgYmVhcmVyIHRva2VuIQ=="},
  49. }
  50. authChallengeHeader = ParameterDescriptor{
  51. Name: "WWW-Authenticate",
  52. Type: "string",
  53. Description: "An RFC7235 compliant authentication challenge header.",
  54. Format: `<scheme> realm="<realm>", ..."`,
  55. Examples: []string{
  56. `Bearer realm="https://auth.docker.com/", service="registry.docker.com", scopes="repository:library/ubuntu:pull"`,
  57. },
  58. }
  59. contentLengthZeroHeader = ParameterDescriptor{
  60. Name: "Content-Length",
  61. Description: "The `Content-Length` header must be zero and the body must be empty.",
  62. Type: "integer",
  63. Format: "0",
  64. }
  65. dockerUploadUUIDHeader = ParameterDescriptor{
  66. Name: "Docker-Upload-UUID",
  67. Description: "Identifies the docker upload uuid for the current request.",
  68. Type: "uuid",
  69. Format: "<uuid>",
  70. }
  71. digestHeader = ParameterDescriptor{
  72. Name: "Docker-Content-Digest",
  73. Description: "Digest of the targeted content for the request.",
  74. Type: "digest",
  75. Format: "<digest>",
  76. }
  77. linkHeader = ParameterDescriptor{
  78. Name: "Link",
  79. Type: "link",
  80. Description: "RFC5988 compliant rel='next' with URL to next result set, if available",
  81. Format: `<<url>?n=<last n value>&last=<last entry from response>>; rel="next"`,
  82. }
  83. paginationParameters = []ParameterDescriptor{
  84. {
  85. Name: "n",
  86. Type: "integer",
  87. Description: "Limit the number of entries in each response. It not present, all entries will be returned.",
  88. Format: "<integer>",
  89. Required: false,
  90. },
  91. {
  92. Name: "last",
  93. Type: "string",
  94. Description: "Result set will include values lexically after last.",
  95. Format: "<integer>",
  96. Required: false,
  97. },
  98. }
  99. unauthorizedResponse = ResponseDescriptor{
  100. Description: "The client does not have access to the repository.",
  101. StatusCode: http.StatusUnauthorized,
  102. Headers: []ParameterDescriptor{
  103. authChallengeHeader,
  104. {
  105. Name: "Content-Length",
  106. Type: "integer",
  107. Description: "Length of the JSON error response body.",
  108. Format: "<length>",
  109. },
  110. },
  111. ErrorCodes: []errcode.ErrorCode{
  112. errcode.ErrorCodeUnauthorized,
  113. },
  114. Body: BodyDescriptor{
  115. ContentType: "application/json; charset=utf-8",
  116. Format: unauthorizedErrorsBody,
  117. },
  118. }
  119. unauthorizedResponsePush = ResponseDescriptor{
  120. Description: "The client does not have access to push to the repository.",
  121. StatusCode: http.StatusUnauthorized,
  122. Headers: []ParameterDescriptor{
  123. authChallengeHeader,
  124. {
  125. Name: "Content-Length",
  126. Type: "integer",
  127. Description: "Length of the JSON error response body.",
  128. Format: "<length>",
  129. },
  130. },
  131. ErrorCodes: []errcode.ErrorCode{
  132. errcode.ErrorCodeUnauthorized,
  133. },
  134. Body: BodyDescriptor{
  135. ContentType: "application/json; charset=utf-8",
  136. Format: unauthorizedErrorsBody,
  137. },
  138. }
  139. )
  140. const (
  141. manifestBody = `{
  142. "name": <name>,
  143. "tag": <tag>,
  144. "fsLayers": [
  145. {
  146. "blobSum": "<digest>"
  147. },
  148. ...
  149. ]
  150. ],
  151. "history": <v1 images>,
  152. "signature": <JWS>
  153. }`
  154. errorsBody = `{
  155. "errors:" [
  156. {
  157. "code": <error code>,
  158. "message": "<error message>",
  159. "detail": ...
  160. },
  161. ...
  162. ]
  163. }`
  164. unauthorizedErrorsBody = `{
  165. "errors:" [
  166. {
  167. "code": "UNAUTHORIZED",
  168. "message": "access to the requested resource is not authorized",
  169. "detail": ...
  170. },
  171. ...
  172. ]
  173. }`
  174. )
  175. // APIDescriptor exports descriptions of the layout of the v2 registry API.
  176. var APIDescriptor = struct {
  177. // RouteDescriptors provides a list of the routes available in the API.
  178. RouteDescriptors []RouteDescriptor
  179. }{
  180. RouteDescriptors: routeDescriptors,
  181. }
  182. // RouteDescriptor describes a route specified by name.
  183. type RouteDescriptor struct {
  184. // Name is the name of the route, as specified in RouteNameXXX exports.
  185. // These names a should be considered a unique reference for a route. If
  186. // the route is registered with gorilla, this is the name that will be
  187. // used.
  188. Name string
  189. // Path is a gorilla/mux-compatible regexp that can be used to match the
  190. // route. For any incoming method and path, only one route descriptor
  191. // should match.
  192. Path string
  193. // Entity should be a short, human-readalbe description of the object
  194. // targeted by the endpoint.
  195. Entity string
  196. // Description should provide an accurate overview of the functionality
  197. // provided by the route.
  198. Description string
  199. // Methods should describe the various HTTP methods that may be used on
  200. // this route, including request and response formats.
  201. Methods []MethodDescriptor
  202. }
  203. // MethodDescriptor provides a description of the requests that may be
  204. // conducted with the target method.
  205. type MethodDescriptor struct {
  206. // Method is an HTTP method, such as GET, PUT or POST.
  207. Method string
  208. // Description should provide an overview of the functionality provided by
  209. // the covered method, suitable for use in documentation. Use of markdown
  210. // here is encouraged.
  211. Description string
  212. // Requests is a slice of request descriptors enumerating how this
  213. // endpoint may be used.
  214. Requests []RequestDescriptor
  215. }
  216. // RequestDescriptor covers a particular set of headers and parameters that
  217. // can be carried out with the parent method. Its most helpful to have one
  218. // RequestDescriptor per API use case.
  219. type RequestDescriptor struct {
  220. // Name provides a short identifier for the request, usable as a title or
  221. // to provide quick context for the particalar request.
  222. Name string
  223. // Description should cover the requests purpose, covering any details for
  224. // this particular use case.
  225. Description string
  226. // Headers describes headers that must be used with the HTTP request.
  227. Headers []ParameterDescriptor
  228. // PathParameters enumerate the parameterized path components for the
  229. // given request, as defined in the route's regular expression.
  230. PathParameters []ParameterDescriptor
  231. // QueryParameters provides a list of query parameters for the given
  232. // request.
  233. QueryParameters []ParameterDescriptor
  234. // Body describes the format of the request body.
  235. Body BodyDescriptor
  236. // Successes enumerates the possible responses that are considered to be
  237. // the result of a successful request.
  238. Successes []ResponseDescriptor
  239. // Failures covers the possible failures from this particular request.
  240. Failures []ResponseDescriptor
  241. }
  242. // ResponseDescriptor describes the components of an API response.
  243. type ResponseDescriptor struct {
  244. // Name provides a short identifier for the response, usable as a title or
  245. // to provide quick context for the particalar response.
  246. Name string
  247. // Description should provide a brief overview of the role of the
  248. // response.
  249. Description string
  250. // StatusCode specifies the status recieved by this particular response.
  251. StatusCode int
  252. // Headers covers any headers that may be returned from the response.
  253. Headers []ParameterDescriptor
  254. // Fields describes any fields that may be present in the response.
  255. Fields []ParameterDescriptor
  256. // ErrorCodes enumerates the error codes that may be returned along with
  257. // the response.
  258. ErrorCodes []errcode.ErrorCode
  259. // Body describes the body of the response, if any.
  260. Body BodyDescriptor
  261. }
  262. // BodyDescriptor describes a request body and its expected content type. For
  263. // the most part, it should be example json or some placeholder for body
  264. // data in documentation.
  265. type BodyDescriptor struct {
  266. ContentType string
  267. Format string
  268. }
  269. // ParameterDescriptor describes the format of a request parameter, which may
  270. // be a header, path parameter or query parameter.
  271. type ParameterDescriptor struct {
  272. // Name is the name of the parameter, either of the path component or
  273. // query parameter.
  274. Name string
  275. // Type specifies the type of the parameter, such as string, integer, etc.
  276. Type string
  277. // Description provides a human-readable description of the parameter.
  278. Description string
  279. // Required means the field is required when set.
  280. Required bool
  281. // Format is a specifying the string format accepted by this parameter.
  282. Format string
  283. // Regexp is a compiled regular expression that can be used to validate
  284. // the contents of the parameter.
  285. Regexp *regexp.Regexp
  286. // Examples provides multiple examples for the values that might be valid
  287. // for this parameter.
  288. Examples []string
  289. }
  290. var routeDescriptors = []RouteDescriptor{
  291. {
  292. Name: RouteNameBase,
  293. Path: "/v2/",
  294. Entity: "Base",
  295. Description: `Base V2 API route. Typically, this can be used for lightweight version checks and to validate registry authorization.`,
  296. Methods: []MethodDescriptor{
  297. {
  298. Method: "GET",
  299. Description: "Check that the endpoint implements Docker Registry API V2.",
  300. Requests: []RequestDescriptor{
  301. {
  302. Headers: []ParameterDescriptor{
  303. hostHeader,
  304. authHeader,
  305. },
  306. Successes: []ResponseDescriptor{
  307. {
  308. Description: "The API implements V2 protocol and is accessible.",
  309. StatusCode: http.StatusOK,
  310. },
  311. },
  312. Failures: []ResponseDescriptor{
  313. {
  314. Description: "The client is not authorized to access the registry.",
  315. StatusCode: http.StatusUnauthorized,
  316. Headers: []ParameterDescriptor{
  317. authChallengeHeader,
  318. },
  319. Body: BodyDescriptor{
  320. ContentType: "application/json; charset=utf-8",
  321. Format: errorsBody,
  322. },
  323. ErrorCodes: []errcode.ErrorCode{
  324. errcode.ErrorCodeUnauthorized,
  325. },
  326. },
  327. {
  328. Description: "The registry does not implement the V2 API.",
  329. StatusCode: http.StatusNotFound,
  330. },
  331. },
  332. },
  333. },
  334. },
  335. },
  336. },
  337. {
  338. Name: RouteNameTags,
  339. Path: "/v2/{name:" + RepositoryNameRegexp.String() + "}/tags/list",
  340. Entity: "Tags",
  341. Description: "Retrieve information about tags.",
  342. Methods: []MethodDescriptor{
  343. {
  344. Method: "GET",
  345. Description: "Fetch the tags under the repository identified by `name`.",
  346. Requests: []RequestDescriptor{
  347. {
  348. Name: "Tags",
  349. Description: "Return all tags for the repository",
  350. Headers: []ParameterDescriptor{
  351. hostHeader,
  352. authHeader,
  353. },
  354. PathParameters: []ParameterDescriptor{
  355. nameParameterDescriptor,
  356. },
  357. Successes: []ResponseDescriptor{
  358. {
  359. StatusCode: http.StatusOK,
  360. Description: "A list of tags for the named repository.",
  361. Headers: []ParameterDescriptor{
  362. {
  363. Name: "Content-Length",
  364. Type: "integer",
  365. Description: "Length of the JSON response body.",
  366. Format: "<length>",
  367. },
  368. },
  369. Body: BodyDescriptor{
  370. ContentType: "application/json; charset=utf-8",
  371. Format: `{
  372. "name": <name>,
  373. "tags": [
  374. <tag>,
  375. ...
  376. ]
  377. }`,
  378. },
  379. },
  380. },
  381. Failures: []ResponseDescriptor{
  382. {
  383. StatusCode: http.StatusNotFound,
  384. Description: "The repository is not known to the registry.",
  385. Body: BodyDescriptor{
  386. ContentType: "application/json; charset=utf-8",
  387. Format: errorsBody,
  388. },
  389. ErrorCodes: []errcode.ErrorCode{
  390. ErrorCodeNameUnknown,
  391. },
  392. },
  393. {
  394. StatusCode: http.StatusUnauthorized,
  395. Description: "The client does not have access to the repository.",
  396. Body: BodyDescriptor{
  397. ContentType: "application/json; charset=utf-8",
  398. Format: errorsBody,
  399. },
  400. ErrorCodes: []errcode.ErrorCode{
  401. errcode.ErrorCodeUnauthorized,
  402. },
  403. },
  404. },
  405. },
  406. {
  407. Name: "Tags Paginated",
  408. Description: "Return a portion of the tags for the specified repository.",
  409. PathParameters: []ParameterDescriptor{nameParameterDescriptor},
  410. QueryParameters: paginationParameters,
  411. Successes: []ResponseDescriptor{
  412. {
  413. StatusCode: http.StatusOK,
  414. Description: "A list of tags for the named repository.",
  415. Headers: []ParameterDescriptor{
  416. {
  417. Name: "Content-Length",
  418. Type: "integer",
  419. Description: "Length of the JSON response body.",
  420. Format: "<length>",
  421. },
  422. linkHeader,
  423. },
  424. Body: BodyDescriptor{
  425. ContentType: "application/json; charset=utf-8",
  426. Format: `{
  427. "name": <name>,
  428. "tags": [
  429. <tag>,
  430. ...
  431. ],
  432. }`,
  433. },
  434. },
  435. },
  436. Failures: []ResponseDescriptor{
  437. {
  438. StatusCode: http.StatusNotFound,
  439. Description: "The repository is not known to the registry.",
  440. Body: BodyDescriptor{
  441. ContentType: "application/json; charset=utf-8",
  442. Format: errorsBody,
  443. },
  444. ErrorCodes: []errcode.ErrorCode{
  445. ErrorCodeNameUnknown,
  446. },
  447. },
  448. {
  449. StatusCode: http.StatusUnauthorized,
  450. Description: "The client does not have access to the repository.",
  451. Body: BodyDescriptor{
  452. ContentType: "application/json; charset=utf-8",
  453. Format: errorsBody,
  454. },
  455. ErrorCodes: []errcode.ErrorCode{
  456. errcode.ErrorCodeUnauthorized,
  457. },
  458. },
  459. },
  460. },
  461. },
  462. },
  463. },
  464. },
  465. {
  466. Name: RouteNameManifest,
  467. Path: "/v2/{name:" + RepositoryNameRegexp.String() + "}/manifests/{reference:" + TagNameRegexp.String() + "|" + digest.DigestRegexp.String() + "}",
  468. Entity: "Manifest",
  469. Description: "Create, update, delete and retrieve manifests.",
  470. Methods: []MethodDescriptor{
  471. {
  472. Method: "GET",
  473. Description: "Fetch the manifest identified by `name` and `reference` where `reference` can be a tag or digest.",
  474. Requests: []RequestDescriptor{
  475. {
  476. Headers: []ParameterDescriptor{
  477. hostHeader,
  478. authHeader,
  479. },
  480. PathParameters: []ParameterDescriptor{
  481. nameParameterDescriptor,
  482. referenceParameterDescriptor,
  483. },
  484. Successes: []ResponseDescriptor{
  485. {
  486. Description: "The manifest identified by `name` and `reference`. The contents can be used to identify and resolve resources required to run the specified image.",
  487. StatusCode: http.StatusOK,
  488. Headers: []ParameterDescriptor{
  489. digestHeader,
  490. },
  491. Body: BodyDescriptor{
  492. ContentType: "application/json; charset=utf-8",
  493. Format: manifestBody,
  494. },
  495. },
  496. },
  497. Failures: []ResponseDescriptor{
  498. {
  499. Description: "The name or reference was invalid.",
  500. StatusCode: http.StatusBadRequest,
  501. ErrorCodes: []errcode.ErrorCode{
  502. ErrorCodeNameInvalid,
  503. ErrorCodeTagInvalid,
  504. },
  505. Body: BodyDescriptor{
  506. ContentType: "application/json; charset=utf-8",
  507. Format: errorsBody,
  508. },
  509. },
  510. {
  511. StatusCode: http.StatusUnauthorized,
  512. Description: "The client does not have access to the repository.",
  513. Body: BodyDescriptor{
  514. ContentType: "application/json; charset=utf-8",
  515. Format: errorsBody,
  516. },
  517. ErrorCodes: []errcode.ErrorCode{
  518. errcode.ErrorCodeUnauthorized,
  519. },
  520. },
  521. {
  522. Description: "The named manifest is not known to the registry.",
  523. StatusCode: http.StatusNotFound,
  524. ErrorCodes: []errcode.ErrorCode{
  525. ErrorCodeNameUnknown,
  526. ErrorCodeManifestUnknown,
  527. },
  528. Body: BodyDescriptor{
  529. ContentType: "application/json; charset=utf-8",
  530. Format: errorsBody,
  531. },
  532. },
  533. },
  534. },
  535. },
  536. },
  537. {
  538. Method: "PUT",
  539. Description: "Put the manifest identified by `name` and `reference` where `reference` can be a tag or digest.",
  540. Requests: []RequestDescriptor{
  541. {
  542. Headers: []ParameterDescriptor{
  543. hostHeader,
  544. authHeader,
  545. },
  546. PathParameters: []ParameterDescriptor{
  547. nameParameterDescriptor,
  548. referenceParameterDescriptor,
  549. },
  550. Body: BodyDescriptor{
  551. ContentType: "application/json; charset=utf-8",
  552. Format: manifestBody,
  553. },
  554. Successes: []ResponseDescriptor{
  555. {
  556. Description: "The manifest has been accepted by the registry and is stored under the specified `name` and `tag`.",
  557. StatusCode: http.StatusCreated,
  558. Headers: []ParameterDescriptor{
  559. {
  560. Name: "Location",
  561. Type: "url",
  562. Description: "The canonical location url of the uploaded manifest.",
  563. Format: "<url>",
  564. },
  565. contentLengthZeroHeader,
  566. digestHeader,
  567. },
  568. },
  569. },
  570. Failures: []ResponseDescriptor{
  571. {
  572. Name: "Invalid Manifest",
  573. 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.",
  574. StatusCode: http.StatusBadRequest,
  575. Body: BodyDescriptor{
  576. ContentType: "application/json; charset=utf-8",
  577. Format: errorsBody,
  578. },
  579. ErrorCodes: []errcode.ErrorCode{
  580. ErrorCodeNameInvalid,
  581. ErrorCodeTagInvalid,
  582. ErrorCodeManifestInvalid,
  583. ErrorCodeManifestUnverified,
  584. ErrorCodeBlobUnknown,
  585. },
  586. },
  587. {
  588. StatusCode: http.StatusUnauthorized,
  589. Description: "The client does not have permission to push to the repository.",
  590. Body: BodyDescriptor{
  591. ContentType: "application/json; charset=utf-8",
  592. Format: errorsBody,
  593. },
  594. ErrorCodes: []errcode.ErrorCode{
  595. errcode.ErrorCodeUnauthorized,
  596. },
  597. },
  598. {
  599. Name: "Missing Layer(s)",
  600. Description: "One or more layers may be missing during a manifest upload. If so, the missing layers will be enumerated in the error response.",
  601. StatusCode: http.StatusBadRequest,
  602. ErrorCodes: []errcode.ErrorCode{
  603. ErrorCodeBlobUnknown,
  604. },
  605. Body: BodyDescriptor{
  606. ContentType: "application/json; charset=utf-8",
  607. Format: `{
  608. "errors:" [{
  609. "code": "BLOB_UNKNOWN",
  610. "message": "blob unknown to registry",
  611. "detail": {
  612. "digest": "<digest>"
  613. }
  614. },
  615. ...
  616. ]
  617. }`,
  618. },
  619. },
  620. {
  621. StatusCode: http.StatusUnauthorized,
  622. Headers: []ParameterDescriptor{
  623. authChallengeHeader,
  624. {
  625. Name: "Content-Length",
  626. Type: "integer",
  627. Description: "Length of the JSON error response body.",
  628. Format: "<length>",
  629. },
  630. },
  631. ErrorCodes: []errcode.ErrorCode{
  632. errcode.ErrorCodeUnauthorized,
  633. },
  634. Body: BodyDescriptor{
  635. ContentType: "application/json; charset=utf-8",
  636. Format: errorsBody,
  637. },
  638. },
  639. {
  640. Name: "Not allowed",
  641. Description: "Manifest put is not allowed because the registry is configured as a pull-through cache or for some other reason",
  642. StatusCode: http.StatusMethodNotAllowed,
  643. ErrorCodes: []errcode.ErrorCode{
  644. errcode.ErrorCodeUnsupported,
  645. },
  646. },
  647. },
  648. },
  649. },
  650. },
  651. {
  652. Method: "DELETE",
  653. Description: "Delete the manifest identified by `name` and `reference`. Note that a manifest can _only_ be deleted by `digest`.",
  654. Requests: []RequestDescriptor{
  655. {
  656. Headers: []ParameterDescriptor{
  657. hostHeader,
  658. authHeader,
  659. },
  660. PathParameters: []ParameterDescriptor{
  661. nameParameterDescriptor,
  662. referenceParameterDescriptor,
  663. },
  664. Successes: []ResponseDescriptor{
  665. {
  666. StatusCode: http.StatusAccepted,
  667. },
  668. },
  669. Failures: []ResponseDescriptor{
  670. {
  671. Name: "Invalid Name or Reference",
  672. Description: "The specified `name` or `reference` were invalid and the delete was unable to proceed.",
  673. StatusCode: http.StatusBadRequest,
  674. ErrorCodes: []errcode.ErrorCode{
  675. ErrorCodeNameInvalid,
  676. ErrorCodeTagInvalid,
  677. },
  678. Body: BodyDescriptor{
  679. ContentType: "application/json; charset=utf-8",
  680. Format: errorsBody,
  681. },
  682. },
  683. {
  684. StatusCode: http.StatusUnauthorized,
  685. Headers: []ParameterDescriptor{
  686. authChallengeHeader,
  687. {
  688. Name: "Content-Length",
  689. Type: "integer",
  690. Description: "Length of the JSON error response body.",
  691. Format: "<length>",
  692. },
  693. },
  694. ErrorCodes: []errcode.ErrorCode{
  695. errcode.ErrorCodeUnauthorized,
  696. },
  697. Body: BodyDescriptor{
  698. ContentType: "application/json; charset=utf-8",
  699. Format: errorsBody,
  700. },
  701. },
  702. {
  703. Name: "Unknown Manifest",
  704. 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.",
  705. StatusCode: http.StatusNotFound,
  706. ErrorCodes: []errcode.ErrorCode{
  707. ErrorCodeNameUnknown,
  708. ErrorCodeManifestUnknown,
  709. },
  710. Body: BodyDescriptor{
  711. ContentType: "application/json; charset=utf-8",
  712. Format: errorsBody,
  713. },
  714. },
  715. {
  716. Name: "Not allowed",
  717. Description: "Manifest delete is not allowed because the registry is configured as a pull-through cache or `delete` has been disabled.",
  718. StatusCode: http.StatusMethodNotAllowed,
  719. ErrorCodes: []errcode.ErrorCode{
  720. errcode.ErrorCodeUnsupported,
  721. },
  722. },
  723. },
  724. },
  725. },
  726. },
  727. },
  728. },
  729. {
  730. Name: RouteNameBlob,
  731. Path: "/v2/{name:" + RepositoryNameRegexp.String() + "}/blobs/{digest:" + digest.DigestRegexp.String() + "}",
  732. Entity: "Blob",
  733. Description: "Operations on blobs identified by `name` and `digest`. Used to fetch or delete layers by digest.",
  734. Methods: []MethodDescriptor{
  735. {
  736. Method: "GET",
  737. 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.",
  738. Requests: []RequestDescriptor{
  739. {
  740. Name: "Fetch Blob",
  741. Headers: []ParameterDescriptor{
  742. hostHeader,
  743. authHeader,
  744. },
  745. PathParameters: []ParameterDescriptor{
  746. nameParameterDescriptor,
  747. digestPathParameter,
  748. },
  749. Successes: []ResponseDescriptor{
  750. {
  751. Description: "The blob identified by `digest` is available. The blob content will be present in the body of the request.",
  752. StatusCode: http.StatusOK,
  753. Headers: []ParameterDescriptor{
  754. {
  755. Name: "Content-Length",
  756. Type: "integer",
  757. Description: "The length of the requested blob content.",
  758. Format: "<length>",
  759. },
  760. digestHeader,
  761. },
  762. Body: BodyDescriptor{
  763. ContentType: "application/octet-stream",
  764. Format: "<blob binary data>",
  765. },
  766. },
  767. {
  768. Description: "The blob identified by `digest` is available at the provided location.",
  769. StatusCode: http.StatusTemporaryRedirect,
  770. Headers: []ParameterDescriptor{
  771. {
  772. Name: "Location",
  773. Type: "url",
  774. Description: "The location where the layer should be accessible.",
  775. Format: "<blob location>",
  776. },
  777. digestHeader,
  778. },
  779. },
  780. },
  781. Failures: []ResponseDescriptor{
  782. {
  783. Description: "There was a problem with the request that needs to be addressed by the client, such as an invalid `name` or `tag`.",
  784. StatusCode: http.StatusBadRequest,
  785. ErrorCodes: []errcode.ErrorCode{
  786. ErrorCodeNameInvalid,
  787. ErrorCodeDigestInvalid,
  788. },
  789. Body: BodyDescriptor{
  790. ContentType: "application/json; charset=utf-8",
  791. Format: errorsBody,
  792. },
  793. },
  794. unauthorizedResponse,
  795. {
  796. Description: "The blob, identified by `name` and `digest`, is unknown to the registry.",
  797. StatusCode: http.StatusNotFound,
  798. Body: BodyDescriptor{
  799. ContentType: "application/json; charset=utf-8",
  800. Format: errorsBody,
  801. },
  802. ErrorCodes: []errcode.ErrorCode{
  803. ErrorCodeNameUnknown,
  804. ErrorCodeBlobUnknown,
  805. },
  806. },
  807. },
  808. },
  809. {
  810. Name: "Fetch Blob Part",
  811. 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.",
  812. Headers: []ParameterDescriptor{
  813. hostHeader,
  814. authHeader,
  815. {
  816. Name: "Range",
  817. Type: "string",
  818. Description: "HTTP Range header specifying blob chunk.",
  819. Format: "bytes=<start>-<end>",
  820. },
  821. },
  822. PathParameters: []ParameterDescriptor{
  823. nameParameterDescriptor,
  824. digestPathParameter,
  825. },
  826. Successes: []ResponseDescriptor{
  827. {
  828. Description: "The blob identified by `digest` is available. The specified chunk of blob content will be present in the body of the request.",
  829. StatusCode: http.StatusPartialContent,
  830. Headers: []ParameterDescriptor{
  831. {
  832. Name: "Content-Length",
  833. Type: "integer",
  834. Description: "The length of the requested blob chunk.",
  835. Format: "<length>",
  836. },
  837. {
  838. Name: "Content-Range",
  839. Type: "byte range",
  840. Description: "Content range of blob chunk.",
  841. Format: "bytes <start>-<end>/<size>",
  842. },
  843. },
  844. Body: BodyDescriptor{
  845. ContentType: "application/octet-stream",
  846. Format: "<blob binary data>",
  847. },
  848. },
  849. },
  850. Failures: []ResponseDescriptor{
  851. {
  852. Description: "There was a problem with the request that needs to be addressed by the client, such as an invalid `name` or `tag`.",
  853. StatusCode: http.StatusBadRequest,
  854. ErrorCodes: []errcode.ErrorCode{
  855. ErrorCodeNameInvalid,
  856. ErrorCodeDigestInvalid,
  857. },
  858. Body: BodyDescriptor{
  859. ContentType: "application/json; charset=utf-8",
  860. Format: errorsBody,
  861. },
  862. },
  863. unauthorizedResponse,
  864. {
  865. StatusCode: http.StatusNotFound,
  866. ErrorCodes: []errcode.ErrorCode{
  867. ErrorCodeNameUnknown,
  868. ErrorCodeBlobUnknown,
  869. },
  870. Body: BodyDescriptor{
  871. ContentType: "application/json; charset=utf-8",
  872. Format: errorsBody,
  873. },
  874. },
  875. {
  876. 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.",
  877. StatusCode: http.StatusRequestedRangeNotSatisfiable,
  878. },
  879. },
  880. },
  881. },
  882. },
  883. {
  884. Method: "DELETE",
  885. Description: "Delete the blob identified by `name` and `digest`",
  886. Requests: []RequestDescriptor{
  887. {
  888. Headers: []ParameterDescriptor{
  889. hostHeader,
  890. authHeader,
  891. },
  892. PathParameters: []ParameterDescriptor{
  893. nameParameterDescriptor,
  894. digestPathParameter,
  895. },
  896. Successes: []ResponseDescriptor{
  897. {
  898. StatusCode: http.StatusAccepted,
  899. Headers: []ParameterDescriptor{
  900. {
  901. Name: "Content-Length",
  902. Type: "integer",
  903. Description: "0",
  904. Format: "0",
  905. },
  906. digestHeader,
  907. },
  908. },
  909. },
  910. Failures: []ResponseDescriptor{
  911. {
  912. Name: "Invalid Name or Digest",
  913. StatusCode: http.StatusBadRequest,
  914. ErrorCodes: []errcode.ErrorCode{
  915. ErrorCodeDigestInvalid,
  916. ErrorCodeNameInvalid,
  917. },
  918. },
  919. {
  920. Description: "The blob, identified by `name` and `digest`, is unknown to the registry.",
  921. StatusCode: http.StatusNotFound,
  922. Body: BodyDescriptor{
  923. ContentType: "application/json; charset=utf-8",
  924. Format: errorsBody,
  925. },
  926. ErrorCodes: []errcode.ErrorCode{
  927. ErrorCodeNameUnknown,
  928. ErrorCodeBlobUnknown,
  929. },
  930. },
  931. {
  932. Description: "Blob delete is not allowed because the registry is configured as a pull-through cache or `delete` has been disabled",
  933. StatusCode: http.StatusMethodNotAllowed,
  934. Body: BodyDescriptor{
  935. ContentType: "application/json; charset=utf-8",
  936. Format: errorsBody,
  937. },
  938. ErrorCodes: []errcode.ErrorCode{
  939. errcode.ErrorCodeUnsupported,
  940. },
  941. },
  942. },
  943. },
  944. },
  945. },
  946. // TODO(stevvooe): We may want to add a PUT request here to
  947. // kickoff an upload of a blob, integrated with the blob upload
  948. // API.
  949. },
  950. },
  951. {
  952. Name: RouteNameBlobUpload,
  953. Path: "/v2/{name:" + RepositoryNameRegexp.String() + "}/blobs/uploads/",
  954. Entity: "Initiate Blob Upload",
  955. Description: "Initiate a blob upload. This endpoint can be used to create resumable uploads or monolithic uploads.",
  956. Methods: []MethodDescriptor{
  957. {
  958. Method: "POST",
  959. 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.",
  960. Requests: []RequestDescriptor{
  961. {
  962. Name: "Initiate Monolithic Blob Upload",
  963. Description: "Upload a blob identified by the `digest` parameter in single request. This upload will not be resumable unless a recoverable error is returned.",
  964. Headers: []ParameterDescriptor{
  965. hostHeader,
  966. authHeader,
  967. {
  968. Name: "Content-Length",
  969. Type: "integer",
  970. Format: "<length of blob>",
  971. },
  972. },
  973. PathParameters: []ParameterDescriptor{
  974. nameParameterDescriptor,
  975. },
  976. QueryParameters: []ParameterDescriptor{
  977. {
  978. Name: "digest",
  979. Type: "query",
  980. Format: "<digest>",
  981. Regexp: digest.DigestRegexp,
  982. 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.`,
  983. },
  984. },
  985. Body: BodyDescriptor{
  986. ContentType: "application/octect-stream",
  987. Format: "<binary data>",
  988. },
  989. Successes: []ResponseDescriptor{
  990. {
  991. Description: "The blob has been created in the registry and is available at the provided location.",
  992. StatusCode: http.StatusCreated,
  993. Headers: []ParameterDescriptor{
  994. {
  995. Name: "Location",
  996. Type: "url",
  997. Format: "<blob location>",
  998. },
  999. contentLengthZeroHeader,
  1000. dockerUploadUUIDHeader,
  1001. },
  1002. },
  1003. },
  1004. Failures: []ResponseDescriptor{
  1005. {
  1006. Name: "Invalid Name or Digest",
  1007. StatusCode: http.StatusBadRequest,
  1008. ErrorCodes: []errcode.ErrorCode{
  1009. ErrorCodeDigestInvalid,
  1010. ErrorCodeNameInvalid,
  1011. },
  1012. },
  1013. unauthorizedResponsePush,
  1014. {
  1015. Name: "Not allowed",
  1016. Description: "Blob upload is not allowed because the registry is configured as a pull-through cache or for some other reason",
  1017. StatusCode: http.StatusMethodNotAllowed,
  1018. ErrorCodes: []errcode.ErrorCode{
  1019. errcode.ErrorCodeUnsupported,
  1020. },
  1021. },
  1022. },
  1023. },
  1024. {
  1025. Name: "Initiate Resumable Blob Upload",
  1026. Description: "Initiate a resumable blob upload with an empty request body.",
  1027. Headers: []ParameterDescriptor{
  1028. hostHeader,
  1029. authHeader,
  1030. contentLengthZeroHeader,
  1031. },
  1032. PathParameters: []ParameterDescriptor{
  1033. nameParameterDescriptor,
  1034. },
  1035. Successes: []ResponseDescriptor{
  1036. {
  1037. 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.",
  1038. StatusCode: http.StatusAccepted,
  1039. Headers: []ParameterDescriptor{
  1040. contentLengthZeroHeader,
  1041. {
  1042. Name: "Location",
  1043. Type: "url",
  1044. Format: "/v2/<name>/blobs/uploads/<uuid>",
  1045. Description: "The location of the created upload. Clients should use the contents verbatim to complete the upload, adding parameters where required.",
  1046. },
  1047. {
  1048. Name: "Range",
  1049. Format: "0-0",
  1050. 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.",
  1051. },
  1052. dockerUploadUUIDHeader,
  1053. },
  1054. },
  1055. },
  1056. Failures: []ResponseDescriptor{
  1057. {
  1058. Name: "Invalid Name or Digest",
  1059. StatusCode: http.StatusBadRequest,
  1060. ErrorCodes: []errcode.ErrorCode{
  1061. ErrorCodeDigestInvalid,
  1062. ErrorCodeNameInvalid,
  1063. },
  1064. },
  1065. unauthorizedResponsePush,
  1066. },
  1067. },
  1068. },
  1069. },
  1070. },
  1071. },
  1072. {
  1073. Name: RouteNameBlobUploadChunk,
  1074. Path: "/v2/{name:" + RepositoryNameRegexp.String() + "}/blobs/uploads/{uuid:[a-zA-Z0-9-_.=]+}",
  1075. Entity: "Blob Upload",
  1076. 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.",
  1077. Methods: []MethodDescriptor{
  1078. {
  1079. Method: "GET",
  1080. Description: "Retrieve status of upload identified by `uuid`. The primary purpose of this endpoint is to resolve the current status of a resumable upload.",
  1081. Requests: []RequestDescriptor{
  1082. {
  1083. Description: "Retrieve the progress of the current upload, as reported by the `Range` header.",
  1084. Headers: []ParameterDescriptor{
  1085. hostHeader,
  1086. authHeader,
  1087. },
  1088. PathParameters: []ParameterDescriptor{
  1089. nameParameterDescriptor,
  1090. uuidParameterDescriptor,
  1091. },
  1092. Successes: []ResponseDescriptor{
  1093. {
  1094. Name: "Upload Progress",
  1095. Description: "The upload is known and in progress. The last received offset is available in the `Range` header.",
  1096. StatusCode: http.StatusNoContent,
  1097. Headers: []ParameterDescriptor{
  1098. {
  1099. Name: "Range",
  1100. Type: "header",
  1101. Format: "0-<offset>",
  1102. Description: "Range indicating the current progress of the upload.",
  1103. },
  1104. contentLengthZeroHeader,
  1105. dockerUploadUUIDHeader,
  1106. },
  1107. },
  1108. },
  1109. Failures: []ResponseDescriptor{
  1110. {
  1111. Description: "There was an error processing the upload and it must be restarted.",
  1112. StatusCode: http.StatusBadRequest,
  1113. ErrorCodes: []errcode.ErrorCode{
  1114. ErrorCodeDigestInvalid,
  1115. ErrorCodeNameInvalid,
  1116. ErrorCodeBlobUploadInvalid,
  1117. },
  1118. Body: BodyDescriptor{
  1119. ContentType: "application/json; charset=utf-8",
  1120. Format: errorsBody,
  1121. },
  1122. },
  1123. unauthorizedResponse,
  1124. {
  1125. Description: "The upload is unknown to the registry. The upload must be restarted.",
  1126. StatusCode: http.StatusNotFound,
  1127. ErrorCodes: []errcode.ErrorCode{
  1128. ErrorCodeBlobUploadUnknown,
  1129. },
  1130. Body: BodyDescriptor{
  1131. ContentType: "application/json; charset=utf-8",
  1132. Format: errorsBody,
  1133. },
  1134. },
  1135. },
  1136. },
  1137. },
  1138. },
  1139. {
  1140. Method: "PATCH",
  1141. Description: "Upload a chunk of data for the specified upload.",
  1142. Requests: []RequestDescriptor{
  1143. {
  1144. Name: "Stream upload",
  1145. Description: "Upload a stream of data to upload without completing the upload.",
  1146. PathParameters: []ParameterDescriptor{
  1147. nameParameterDescriptor,
  1148. uuidParameterDescriptor,
  1149. },
  1150. Headers: []ParameterDescriptor{
  1151. hostHeader,
  1152. authHeader,
  1153. },
  1154. Body: BodyDescriptor{
  1155. ContentType: "application/octet-stream",
  1156. Format: "<binary data>",
  1157. },
  1158. Successes: []ResponseDescriptor{
  1159. {
  1160. Name: "Data Accepted",
  1161. 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.",
  1162. StatusCode: http.StatusNoContent,
  1163. Headers: []ParameterDescriptor{
  1164. {
  1165. Name: "Location",
  1166. Type: "url",
  1167. Format: "/v2/<name>/blobs/uploads/<uuid>",
  1168. 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.",
  1169. },
  1170. {
  1171. Name: "Range",
  1172. Type: "header",
  1173. Format: "0-<offset>",
  1174. Description: "Range indicating the current progress of the upload.",
  1175. },
  1176. contentLengthZeroHeader,
  1177. dockerUploadUUIDHeader,
  1178. },
  1179. },
  1180. },
  1181. Failures: []ResponseDescriptor{
  1182. {
  1183. Description: "There was an error processing the upload and it must be restarted.",
  1184. StatusCode: http.StatusBadRequest,
  1185. ErrorCodes: []errcode.ErrorCode{
  1186. ErrorCodeDigestInvalid,
  1187. ErrorCodeNameInvalid,
  1188. ErrorCodeBlobUploadInvalid,
  1189. },
  1190. Body: BodyDescriptor{
  1191. ContentType: "application/json; charset=utf-8",
  1192. Format: errorsBody,
  1193. },
  1194. },
  1195. unauthorizedResponsePush,
  1196. {
  1197. Description: "The upload is unknown to the registry. The upload must be restarted.",
  1198. StatusCode: http.StatusNotFound,
  1199. ErrorCodes: []errcode.ErrorCode{
  1200. ErrorCodeBlobUploadUnknown,
  1201. },
  1202. Body: BodyDescriptor{
  1203. ContentType: "application/json; charset=utf-8",
  1204. Format: errorsBody,
  1205. },
  1206. },
  1207. },
  1208. },
  1209. {
  1210. Name: "Chunked upload",
  1211. Description: "Upload a chunk of data to specified upload without completing the upload. The data will be uploaded to the specified Content Range.",
  1212. PathParameters: []ParameterDescriptor{
  1213. nameParameterDescriptor,
  1214. uuidParameterDescriptor,
  1215. },
  1216. Headers: []ParameterDescriptor{
  1217. hostHeader,
  1218. authHeader,
  1219. {
  1220. Name: "Content-Range",
  1221. Type: "header",
  1222. Format: "<start of range>-<end of range, inclusive>",
  1223. Required: true,
  1224. 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.",
  1225. },
  1226. {
  1227. Name: "Content-Length",
  1228. Type: "integer",
  1229. Format: "<length of chunk>",
  1230. Description: "Length of the chunk being uploaded, corresponding the length of the request body.",
  1231. },
  1232. },
  1233. Body: BodyDescriptor{
  1234. ContentType: "application/octet-stream",
  1235. Format: "<binary chunk>",
  1236. },
  1237. Successes: []ResponseDescriptor{
  1238. {
  1239. Name: "Chunk Accepted",
  1240. 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.",
  1241. StatusCode: http.StatusNoContent,
  1242. Headers: []ParameterDescriptor{
  1243. {
  1244. Name: "Location",
  1245. Type: "url",
  1246. Format: "/v2/<name>/blobs/uploads/<uuid>",
  1247. 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.",
  1248. },
  1249. {
  1250. Name: "Range",
  1251. Type: "header",
  1252. Format: "0-<offset>",
  1253. Description: "Range indicating the current progress of the upload.",
  1254. },
  1255. contentLengthZeroHeader,
  1256. dockerUploadUUIDHeader,
  1257. },
  1258. },
  1259. },
  1260. Failures: []ResponseDescriptor{
  1261. {
  1262. Description: "There was an error processing the upload and it must be restarted.",
  1263. StatusCode: http.StatusBadRequest,
  1264. ErrorCodes: []errcode.ErrorCode{
  1265. ErrorCodeDigestInvalid,
  1266. ErrorCodeNameInvalid,
  1267. ErrorCodeBlobUploadInvalid,
  1268. },
  1269. Body: BodyDescriptor{
  1270. ContentType: "application/json; charset=utf-8",
  1271. Format: errorsBody,
  1272. },
  1273. },
  1274. unauthorizedResponsePush,
  1275. {
  1276. Description: "The upload is unknown to the registry. The upload must be restarted.",
  1277. StatusCode: http.StatusNotFound,
  1278. ErrorCodes: []errcode.ErrorCode{
  1279. ErrorCodeBlobUploadUnknown,
  1280. },
  1281. Body: BodyDescriptor{
  1282. ContentType: "application/json; charset=utf-8",
  1283. Format: errorsBody,
  1284. },
  1285. },
  1286. {
  1287. Description: "The `Content-Range` specification cannot be accepted, either because it does not overlap with the current progress or it is invalid.",
  1288. StatusCode: http.StatusRequestedRangeNotSatisfiable,
  1289. },
  1290. },
  1291. },
  1292. },
  1293. },
  1294. {
  1295. Method: "PUT",
  1296. Description: "Complete the upload specified by `uuid`, optionally appending the body as the final chunk.",
  1297. Requests: []RequestDescriptor{
  1298. {
  1299. 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.",
  1300. Headers: []ParameterDescriptor{
  1301. hostHeader,
  1302. authHeader,
  1303. {
  1304. Name: "Content-Length",
  1305. Type: "integer",
  1306. Format: "<length of data>",
  1307. Description: "Length of the data being uploaded, corresponding to the length of the request body. May be zero if no data is provided.",
  1308. },
  1309. },
  1310. PathParameters: []ParameterDescriptor{
  1311. nameParameterDescriptor,
  1312. uuidParameterDescriptor,
  1313. },
  1314. QueryParameters: []ParameterDescriptor{
  1315. {
  1316. Name: "digest",
  1317. Type: "string",
  1318. Format: "<digest>",
  1319. Regexp: digest.DigestRegexp,
  1320. Required: true,
  1321. Description: `Digest of uploaded blob.`,
  1322. },
  1323. },
  1324. Body: BodyDescriptor{
  1325. ContentType: "application/octet-stream",
  1326. Format: "<binary data>",
  1327. },
  1328. Successes: []ResponseDescriptor{
  1329. {
  1330. Name: "Upload Complete",
  1331. Description: "The upload has been completed and accepted by the registry. The canonical location will be available in the `Location` header.",
  1332. StatusCode: http.StatusNoContent,
  1333. Headers: []ParameterDescriptor{
  1334. {
  1335. Name: "Location",
  1336. Type: "url",
  1337. Format: "<blob location>",
  1338. Description: "The canonical location of the blob for retrieval",
  1339. },
  1340. {
  1341. Name: "Content-Range",
  1342. Type: "header",
  1343. Format: "<start of range>-<end of range, inclusive>",
  1344. 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.",
  1345. },
  1346. contentLengthZeroHeader,
  1347. digestHeader,
  1348. },
  1349. },
  1350. },
  1351. Failures: []ResponseDescriptor{
  1352. {
  1353. Description: "There was an error processing the upload and it must be restarted.",
  1354. StatusCode: http.StatusBadRequest,
  1355. ErrorCodes: []errcode.ErrorCode{
  1356. ErrorCodeDigestInvalid,
  1357. ErrorCodeNameInvalid,
  1358. ErrorCodeBlobUploadInvalid,
  1359. errcode.ErrorCodeUnsupported,
  1360. },
  1361. Body: BodyDescriptor{
  1362. ContentType: "application/json; charset=utf-8",
  1363. Format: errorsBody,
  1364. },
  1365. },
  1366. unauthorizedResponsePush,
  1367. {
  1368. Description: "The upload is unknown to the registry. The upload must be restarted.",
  1369. StatusCode: http.StatusNotFound,
  1370. ErrorCodes: []errcode.ErrorCode{
  1371. ErrorCodeBlobUploadUnknown,
  1372. },
  1373. Body: BodyDescriptor{
  1374. ContentType: "application/json; charset=utf-8",
  1375. Format: errorsBody,
  1376. },
  1377. },
  1378. },
  1379. },
  1380. },
  1381. },
  1382. {
  1383. Method: "DELETE",
  1384. Description: "Cancel outstanding upload processes, releasing associated resources. If this is not called, the unfinished uploads will eventually timeout.",
  1385. Requests: []RequestDescriptor{
  1386. {
  1387. Description: "Cancel the upload specified by `uuid`.",
  1388. PathParameters: []ParameterDescriptor{
  1389. nameParameterDescriptor,
  1390. uuidParameterDescriptor,
  1391. },
  1392. Headers: []ParameterDescriptor{
  1393. hostHeader,
  1394. authHeader,
  1395. contentLengthZeroHeader,
  1396. },
  1397. Successes: []ResponseDescriptor{
  1398. {
  1399. Name: "Upload Deleted",
  1400. Description: "The upload has been successfully deleted.",
  1401. StatusCode: http.StatusNoContent,
  1402. Headers: []ParameterDescriptor{
  1403. contentLengthZeroHeader,
  1404. },
  1405. },
  1406. },
  1407. Failures: []ResponseDescriptor{
  1408. {
  1409. Description: "An error was encountered processing the delete. The client may ignore this error.",
  1410. StatusCode: http.StatusBadRequest,
  1411. ErrorCodes: []errcode.ErrorCode{
  1412. ErrorCodeNameInvalid,
  1413. ErrorCodeBlobUploadInvalid,
  1414. },
  1415. Body: BodyDescriptor{
  1416. ContentType: "application/json; charset=utf-8",
  1417. Format: errorsBody,
  1418. },
  1419. },
  1420. unauthorizedResponse,
  1421. {
  1422. Description: "The upload is unknown to the registry. The client may ignore this error and assume the upload has been deleted.",
  1423. StatusCode: http.StatusNotFound,
  1424. ErrorCodes: []errcode.ErrorCode{
  1425. ErrorCodeBlobUploadUnknown,
  1426. },
  1427. Body: BodyDescriptor{
  1428. ContentType: "application/json; charset=utf-8",
  1429. Format: errorsBody,
  1430. },
  1431. },
  1432. },
  1433. },
  1434. },
  1435. },
  1436. },
  1437. },
  1438. {
  1439. Name: RouteNameCatalog,
  1440. Path: "/v2/_catalog",
  1441. Entity: "Catalog",
  1442. 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.",
  1443. Methods: []MethodDescriptor{
  1444. {
  1445. Method: "GET",
  1446. Description: "Retrieve a sorted, json list of repositories available in the registry.",
  1447. Requests: []RequestDescriptor{
  1448. {
  1449. Name: "Catalog Fetch Complete",
  1450. Description: "Request an unabridged list of repositories available.",
  1451. Successes: []ResponseDescriptor{
  1452. {
  1453. Description: "Returns the unabridged list of repositories as a json response.",
  1454. StatusCode: http.StatusOK,
  1455. Headers: []ParameterDescriptor{
  1456. {
  1457. Name: "Content-Length",
  1458. Type: "integer",
  1459. Description: "Length of the JSON response body.",
  1460. Format: "<length>",
  1461. },
  1462. },
  1463. Body: BodyDescriptor{
  1464. ContentType: "application/json; charset=utf-8",
  1465. Format: `{
  1466. "repos