github.com/containers/libpod@v1.9.4-0.20220419124438-4284fd425507/pkg/api/server/register_manifest.go (about)

     1  package server
     2  
     3  import (
     4  	"net/http"
     5  
     6  	"github.com/containers/libpod/pkg/api/handlers/libpod"
     7  	"github.com/gorilla/mux"
     8  )
     9  
    10  func (s *APIServer) registerManifestHandlers(r *mux.Router) error {
    11  	// swagger:operation POST /libpod/manifests/create manifests Create
    12  	// ---
    13  	// summary: Create
    14  	// description: Create a manifest list
    15  	// produces:
    16  	// - application/json
    17  	// parameters:
    18  	// - in: query
    19  	//   name: name
    20  	//   type: string
    21  	//   description: manifest list name
    22  	//   required: true
    23  	// - in: query
    24  	//   name: image
    25  	//   type: string
    26  	//   description: name of the image
    27  	// - in: query
    28  	//   name: all
    29  	//   type: boolean
    30  	//   description: add all contents if given list
    31  	// responses:
    32  	//   200:
    33  	//     $ref: "#/definitions/IDResponse"
    34  	//   400:
    35  	//     $ref: "#/responses/BadParamError"
    36  	//   404:
    37  	//     $ref: "#/responses/NoSuchImage"
    38  	//   500:
    39  	//     $ref: "#/responses/InternalError"
    40  	r.Handle(VersionedPath("/libpod/manifests/create"), s.APIHandler(libpod.ManifestCreate)).Methods(http.MethodPost)
    41  	// swagger:operation GET /libpod/manifests/{name:.*}/json manifests Inspect
    42  	// ---
    43  	// summary: Inspect
    44  	// description: Display a manifest list
    45  	// produces:
    46  	// - application/json
    47  	// parameters:
    48  	//  - in: path
    49  	//    name: name:.*
    50  	//    type: string
    51  	//    required: true
    52  	//    description: the name or ID of the manifest
    53  	// responses:
    54  	//   200:
    55  	//     $ref: "#/responses/InspectManifest"
    56  	//   404:
    57  	//     $ref: "#/responses/NoSuchManifest"
    58  	//   500:
    59  	//     $ref: "#/responses/InternalError"
    60  	r.Handle(VersionedPath("/libpod/manifests/{name:.*}/json"), s.APIHandler(libpod.ManifestInspect)).Methods(http.MethodGet)
    61  	// swagger:operation POST /libpod/manifests/{name:.*}/add manifests AddManifest
    62  	// ---
    63  	// description: Add an image to a manifest list
    64  	// produces:
    65  	// - application/json
    66  	// parameters:
    67  	//  - in: path
    68  	//    name: name:.*
    69  	//    type: string
    70  	//    required: true
    71  	//    description: the name or ID of the manifest
    72  	//  - in: body
    73  	//    name: options
    74  	//    description: options for creating a manifest
    75  	//    schema:
    76  	//      $ref: "#/definitions/ManifestAddOpts"
    77  	// responses:
    78  	//   200:
    79  	//     $ref: "#/definitions/IDResponse"
    80  	//   404:
    81  	//     $ref: "#/responses/NoSuchManifest"
    82  	//   409:
    83  	//     $ref: "#/responses/BadParamError"
    84  	//   500:
    85  	//     $ref: "#/responses/InternalError"
    86  	r.Handle(VersionedPath("/libpod/manifests/{name:.*}/add"), s.APIHandler(libpod.ManifestAdd)).Methods(http.MethodPost)
    87  	// swagger:operation DELETE /libpod/manifests/{name:.*} manifests RemoveManifest
    88  	// ---
    89  	// summary: Remove
    90  	// description: Remove an image from a manifest list
    91  	// produces:
    92  	// - application/json
    93  	// parameters:
    94  	//  - in: path
    95  	//    name: name:.*
    96  	//    type: string
    97  	//    required: true
    98  	//    description: the image associated with the manifest
    99  	//  - in: query
   100  	//    name: digest
   101  	//    type: string
   102  	//    description: image digest to be removed
   103  	// responses:
   104  	//   200:
   105  	//     $ref: "#/definitions/IDResponse"
   106  	//   400:
   107  	//     $ref: "#/responses/BadParamError"
   108  	//   404:
   109  	//     $ref: "#/responses/NoSuchManifest"
   110  	//   500:
   111  	//     $ref: "#/responses/InternalError"
   112  	r.Handle(VersionedPath("/libpod/manifests/{name:.*}"), s.APIHandler(libpod.ManifestRemove)).Methods(http.MethodDelete)
   113  	// swagger:operation POST /libpod/manifests/{name}/push manifests PushManifest
   114  	// ---
   115  	// summary: Push
   116  	// description: Push a manifest list or image index to a registry
   117  	// produces:
   118  	// - application/json
   119  	// parameters:
   120  	//  - in: path
   121  	//    name: name
   122  	//    type: string
   123  	//    required: true
   124  	//    description: the name or ID of the manifest
   125  	//  - in: query
   126  	//    name: destination
   127  	//    type: string
   128  	//    required: true
   129  	//    description: the destination for the manifest
   130  	//  - in: query
   131  	//    name: all
   132  	//    description: push all images
   133  	//    type: boolean
   134  	// responses:
   135  	//   200:
   136  	//     $ref: "#/definitions/IDResponse"
   137  	//   400:
   138  	//     $ref: "#/responses/BadParamError"
   139  	//   404:
   140  	//     $ref: "#/responses/NoSuchManifest"
   141  	//   500:
   142  	//     $ref: "#/responses/InternalError"
   143  	r.Handle(VersionedPath("/libpod/manifests/{name}/push"), s.APIHandler(libpod.ManifestPush)).Methods(http.MethodPost)
   144  	return nil
   145  }