summaryrefslogtreecommitdiff
path: root/pkg/api/server/register_manifest.go
blob: 88df6910d75a460555ca42e188c5253ea828a569 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
package server

import (
	"net/http"

	"github.com/containers/podman/v4/pkg/api/handlers/libpod"
	"github.com/gorilla/mux"
)

func (s *APIServer) registerManifestHandlers(r *mux.Router) error {
	v3 := r.PathPrefix("/v{version:[0-3][0-9A-Za-z.-]*}/libpod/manifests").Subrouter()
	v4 := r.PathPrefix("/v{version:[4-9][0-9A-Za-z.-]*}/libpod/manifests").Subrouter()
	// swagger:operation POST /libpod/manifests manifests ManifestCreateLibpod
	// ---
	// summary: Create
	// description: Create a manifest list
	// produces:
	// - application/json
	// parameters:
	// - in: query
	//   name: name
	//   type: string
	//   description: manifest list or index name to create
	//   required: true
	// - in: query
	//   name: images
	//   type: string
	//   required: true
	//   description: |
	//     One or more names of an image or a manifest list. Repeat parameter as needed.
	//
	//     Support for multiple images, as of version 4.0.0
	//     Alias of `image` is support for compatibility with < 4.0.0
	//     Response status code is 200 with < 4.0.0 for compatibility
	// - in: query
	//   name: all
	//   type: boolean
	//   description: add all contents if given list
	// - in: body
	//   name: options
	//   description: options for new manifest
	//   required: false
	//   schema:
	//     $ref: "#/definitions/ManifestModifyOptions"
	// responses:
	//   201:
	//     schema:
	//       $ref: "#/definitions/IDResponse"
	//   400:
	//     $ref: "#/responses/BadParamError"
	//   404:
	//     $ref: "#/responses/NoSuchImage"
	//   500:
	//     $ref: "#/responses/InternalError"
	v3.Handle("/create", s.APIHandler(libpod.ManifestCreate)).Methods(http.MethodPost)
	v4.Handle("/{name:.*}", s.APIHandler(libpod.ManifestCreate)).Methods(http.MethodPost)
	// swagger:operation GET /libpod/manifests/{name}/exists manifests ManifestExistsLibpod
	// ---
	// summary: Exists
	// description: |
	//   Check if manifest list exists
	//
	//   Note: There is no contract that the manifest list will exist for a follow-on operation
	// parameters:
	//  - in: path
	//    name: name
	//    type: string
	//    required: true
	//    description: the name or ID of the manifest list
	// produces:
	// - application/json
	// responses:
	//   204:
	//     description: manifest list exists
	//   404:
	//     $ref: '#/responses/NoSuchManifest'
	//   500:
	//     $ref: '#/responses/InternalError'
	v3.Handle("/{name:.*}/exists", s.APIHandler(libpod.ManifestExists)).Methods(http.MethodGet)
	v4.Handle("/{name:.*}/exists", s.APIHandler(libpod.ManifestExists)).Methods(http.MethodGet)
	// swagger:operation GET /libpod/manifests/{name}/json manifests ManifestInspectLibpod
	// ---
	// summary: Inspect
	// description: Display attributes of given manifest list
	// produces:
	// - application/json
	// parameters:
	//  - in: path
	//    name: name
	//    type: string
	//    required: true
	//    description: the name or ID of the manifest list
	// responses:
	//   200:
	//     $ref: "#/responses/InspectManifest"
	//   404:
	//     $ref: "#/responses/NoSuchManifest"
	//   500:
	//     $ref: "#/responses/InternalError"
	v3.Handle("/{name:.*}/json", s.APIHandler(libpod.ManifestInspect)).Methods(http.MethodGet)
	v4.Handle("/{name:.*}/json", s.APIHandler(libpod.ManifestInspect)).Methods(http.MethodGet)
	// swagger:operation PUT /libpod/manifests/{name} manifests ManifestModifyLibpod
	// ---
	// summary: Modify manifest list
	// description: |
	//   Add/Remove an image(s) to a manifest list
	//
	//   Note: operations are not atomic when multiple Images are provided.
	//
	//   As of v4.0.0
	// produces:
	// - application/json
	// parameters:
	//  - in: path
	//    name: name
	//    type: string
	//    required: true
	//    description: the name or ID of the manifest
	//  - in: body
	//    name: options
	//    description: options for mutating a manifest
	//    required: true
	//    schema:
	//        $ref: "#/definitions/ManifestModifyOptions"
	// responses:
	//   200:
	//     schema:
	//       $ref: "#/definitions/ManifestModifyReport"
	//   404:
	//     $ref: "#/responses/NoSuchManifest"
	//   400:
	//     $ref: "#/responses/BadParamError"
	//   409:
	//     description: Operation had partial success, both Images and Errors may have members
	//     schema:
	//       $ref: "#/definitions/ManifestModifyReport"
	//   500:
	//     $ref: "#/responses/InternalError"
	v4.Handle("/{name:.*}", s.APIHandler(libpod.ManifestModify)).Methods(http.MethodPut)
	// swagger:operation POST /libpod/manifests/{name}/add manifests ManifestAddLibpod
	// ---
	// summary: Add image
	// description: |
	//   Add an image to a manifest list
	//
	//   Deprecated: As of 4.0.0 use ManifestModifyLibpod instead
	// produces:
	// - application/json
	// parameters:
	//  - in: path
	//    name: name
	//    type: string
	//    required: true
	//    description: the name or ID of the manifest
	//  - in: body
	//    name: options
	//    description: options for creating a manifest
	//    schema:
	//      $ref: "#/definitions/ManifestAddOptions"
	// responses:
	//   200:
	//     schema:
	//       $ref: "#/definitions/IDResponse"
	//   404:
	//     $ref: "#/responses/NoSuchManifest"
	//   409:
	//     $ref: "#/responses/BadParamError"
	//   500:
	//     $ref: "#/responses/InternalError"
	//lint:ignore SA1019 We still want to support the V3 endpoints
	v3.Handle("/{name:.*}/add", s.APIHandler(libpod.ManifestAdd)).Methods(http.MethodPost)
	// swagger:operation DELETE /libpod/manifests/{name} manifests ManifestDeleteV3Libpod
	// ---
	// summary: Remove image from a manifest list
	// description: |
	//   Remove an image from a manifest list
	//
	//   Deprecated: As of 4.0.0 use ManifestModifyLibpod instead
	// produces:
	// - application/json
	// parameters:
	//  - in: path
	//    name: name
	//    type: string
	//    required: true
	//    description: the image associated with the manifest
	//  - in: query
	//    name: digest
	//    type: string
	//    description: image digest to be removed
	// responses:
	//   200:
	//     schema:
	//       $ref: "#/definitions/IDResponse"
	//   400:
	//     $ref: "#/responses/BadParamError"
	//   404:
	//     $ref: "#/responses/NoSuchManifest"
	//   500:
	//     $ref: "#/responses/InternalError"
	//lint:ignore SA1019 We still want to support the V3 endpoints
	v3.Handle("/{name:.*}", s.APIHandler(libpod.ManifestRemoveDigest)).Methods(http.MethodDelete)
	// swagger:operation DELETE /libpod/manifests/{name} manifests ManifestDeleteLibpod
	// ---
	// summary: Delete manifest list
	// description: |
	//   Delete named manifest list
	//
	//   As of v4.0.0
	// produces:
	// - application/json
	// parameters:
	//  - in: path
	//    name: name
	//    type: string
	//    required: true
	//    description: The name or ID of the  list to be deleted
	// responses:
	//   200:
	//     $ref: "#/responses/DocsLibpodImagesRemoveResponse"
	//   404:
	//     $ref: "#/responses/NoSuchManifest"
	//   500:
	//     $ref: "#/responses/InternalError"
	v4.Handle("/{name:.*}", s.APIHandler(libpod.ManifestDelete)).Methods(http.MethodDelete)
	// swagger:operation POST /libpod/manifests/{name}/push manifests ManifestPushV3Libpod
	// ---
	// summary: Push manifest to registry
	// description: |
	//   Push a manifest list or image index to a registry
	//
	//   Deprecated: As of 4.0.0 use ManifestPushLibpod instead
	// produces:
	// - application/json
	// parameters:
	//  - in: path
	//    name: name
	//    type: string
	//    required: true
	//    description: the name or ID of the manifest
	//  - in: query
	//    name: destination
	//    type: string
	//    required: true
	//    description: the destination for the manifest
	//  - in: query
	//    name: all
	//    description: push all images
	//    type: boolean
	// responses:
	//   200:
	//     schema:
	//       $ref: "#/definitions/IDResponse"
	//   400:
	//     $ref: "#/responses/BadParamError"
	//   404:
	//     $ref: "#/responses/NoSuchManifest"
	//   500:
	//     $ref: "#/responses/InternalError"
	//lint:ignore SA1019 We still want to support the V3 endpoints
	v3.Handle("/{name}/push", s.APIHandler(libpod.ManifestPushV3)).Methods(http.MethodPost)
	// swagger:operation POST /libpod/manifests/{name}/registry/{destination} manifests ManifestPushLibpod
	// ---
	// summary: Push manifest list to registry
	// description: |
	//   Push a manifest list or image index to the named registry
	//
	//   As of v4.0.0
	// produces:
	// - application/json
	// parameters:
	//  - in: path
	//    name: name
	//    type: string
	//    required: true
	//    description: the name or ID of the manifest list
	//  - in: path
	//    name: destination
	//    type: string
	//    required: true
	//    description: the registry for the manifest list
	//  - in: query
	//    name: all
	//    description: push all images
	//    type: boolean
	//    default: false
	//  - in: query
	//    name: tlsVerify
	//    type: boolean
	//    default: false
	//    description: skip TLS verification for registries
	// responses:
	//   200:
	//     schema:
	//       $ref: "#/definitions/IDResponse"
	//   400:
	//     $ref: "#/responses/BadParamError"
	//   404:
	//     $ref: "#/responses/NoSuchManifest"
	//   500:
	//     $ref: "#/responses/InternalError"
	v4.Handle("/{name:.*}/registry/{destination:.*}", s.APIHandler(libpod.ManifestPush)).Methods(http.MethodPost)
	return nil
}