podman

Форк
0
/
register_manifest.go 
332 строки · 10.0 Кб
1
package server
2

3
import (
4
	"net/http"
5

6
	"github.com/containers/podman/v5/pkg/api/handlers/libpod"
7
	"github.com/gorilla/mux"
8
)
9

10
func (s *APIServer) registerManifestHandlers(r *mux.Router) error {
11
	v3 := r.PathPrefix("/v{version:[0-3][0-9A-Za-z.-]*}/libpod/manifests").Subrouter()
12
	v4 := r.PathPrefix("/v{version:[4-9][0-9A-Za-z.-]*}/libpod/manifests").Subrouter()
13
	// swagger:operation POST /libpod/manifests/{name}/push manifests ManifestPushV3Libpod
14
	// ---
15
	// summary: Push manifest to registry
16
	// description: |
17
	//   Push a manifest list or image index to a registry
18
	//
19
	//   Deprecated: As of 4.0.0 use ManifestPushLibpod instead
20
	// produces:
21
	// - application/json
22
	// parameters:
23
	//  - in: path
24
	//    name: name
25
	//    type: string
26
	//    required: true
27
	//    description: the name or ID of the manifest
28
	//  - in: query
29
	//    name: destination
30
	//    type: string
31
	//    required: true
32
	//    description: the destination for the manifest
33
	//  - in: query
34
	//    name: all
35
	//    description: push all images
36
	//    type: boolean
37
	// responses:
38
	//   200:
39
	//     schema:
40
	//       $ref: "#/definitions/IDResponse"
41
	//   400:
42
	//     $ref: "#/responses/badParamError"
43
	//   404:
44
	//     $ref: "#/responses/manifestNotFound"
45
	//   500:
46
	//     $ref: "#/responses/internalError"
47
	v3.Handle("/{name}/push", s.APIHandler(libpod.ManifestPushV3)).Methods(http.MethodPost)
48
	// swagger:operation POST /libpod/manifests/{name}/registry/{destination} manifests ManifestPushLibpod
49
	// ---
50
	// summary: Push manifest list to registry
51
	// description: |
52
	//   Push a manifest list or image index to the named registry
53
	//
54
	//   As of v4.0.0
55
	// produces:
56
	// - application/json
57
	// parameters:
58
	//  - in: path
59
	//    name: name
60
	//    type: string
61
	//    required: true
62
	//    description: the name or ID of the manifest list
63
	//  - in: query
64
	//    name: addCompression
65
	//    required: false
66
	//    description: add existing instances with requested compression algorithms to manifest list
67
	//    type: array
68
	//    items:
69
	//      type: string
70
	//  - in: query
71
	//    name: forceCompressionFormat
72
	//    description: Enforce compressing the layers with the specified --compression and do not reuse differently compressed blobs on the registry.
73
	//    type: boolean
74
	//    default: false
75
	//  - in: path
76
	//    name: destination
77
	//    type: string
78
	//    required: true
79
	//    description: the registry for the manifest list
80
	//  - in: query
81
	//    name: all
82
	//    description: push all images
83
	//    type: boolean
84
	//    default: true
85
	//  - in: query
86
	//    name: tlsVerify
87
	//    type: boolean
88
	//    default: true
89
	//    description: Require HTTPS and verify signatures when contacting registries.
90
	//  - in: query
91
	//    name: quiet
92
	//    description: "silences extra stream data on push"
93
	//    type: boolean
94
	//    default: true
95
	// responses:
96
	//   200:
97
	//     schema:
98
	//       $ref: "#/definitions/IDResponse"
99
	//   400:
100
	//     $ref: "#/responses/badParamError"
101
	//   404:
102
	//     $ref: "#/responses/manifestNotFound"
103
	//   500:
104
	//     $ref: "#/responses/internalError"
105
	v4.Handle("/{name:.*}/registry/{destination:.*}", s.APIHandler(libpod.ManifestPush)).Methods(http.MethodPost)
106
	// swagger:operation POST /libpod/manifests/{name} manifests ManifestCreateLibpod
107
	// ---
108
	// summary: Create
109
	// description: Create a manifest list
110
	// produces:
111
	// - application/json
112
	// parameters:
113
	// - in: path
114
	//   name: name
115
	//   type: string
116
	//   description: manifest list or index name to create
117
	//   required: true
118
	// - in: query
119
	//   name: images
120
	//   type: string
121
	//   required: true
122
	//   description: |
123
	//     One or more names of an image or a manifest list. Repeat parameter as needed.
124
	//
125
	//     Support for multiple images, as of version 4.0.0
126
	//     Alias of `image` is support for compatibility with < 4.0.0
127
	//     Response status code is 200 with < 4.0.0 for compatibility
128
	// - in: query
129
	//   name: all
130
	//   type: boolean
131
	//   description: add all contents if given list
132
	// - in: query
133
	//   name: amend
134
	//   type: boolean
135
	//   description: modify an existing list if one with the desired name already exists
136
	// - in: body
137
	//   name: options
138
	//   description: options for new manifest
139
	//   required: false
140
	//   schema:
141
	//     $ref: "#/definitions/ManifestModifyOptions"
142
	// responses:
143
	//   201:
144
	//     schema:
145
	//       $ref: "#/definitions/IDResponse"
146
	//   400:
147
	//     $ref: "#/responses/badParamError"
148
	//   404:
149
	//     $ref: "#/responses/imageNotFound"
150
	//   500:
151
	//     $ref: "#/responses/internalError"
152
	v3.Handle("/create", s.APIHandler(libpod.ManifestCreate)).Methods(http.MethodPost)
153
	v4.Handle("/{name:.*}", s.APIHandler(libpod.ManifestCreate)).Methods(http.MethodPost)
154
	// swagger:operation GET /libpod/manifests/{name}/exists manifests ManifestExistsLibpod
155
	// ---
156
	// summary: Exists
157
	// description: |
158
	//   Check if manifest list exists
159
	//
160
	//   Note: There is no contract that the manifest list will exist for a follow-on operation
161
	// parameters:
162
	//  - in: path
163
	//    name: name
164
	//    type: string
165
	//    required: true
166
	//    description: the name or ID of the manifest list
167
	// produces:
168
	// - application/json
169
	// responses:
170
	//   204:
171
	//     description: manifest list exists
172
	//   404:
173
	//     $ref: '#/responses/manifestNotFound'
174
	//   500:
175
	//     $ref: '#/responses/internalError'
176
	v3.Handle("/{name:.*}/exists", s.APIHandler(libpod.ManifestExists)).Methods(http.MethodGet)
177
	v4.Handle("/{name:.*}/exists", s.APIHandler(libpod.ManifestExists)).Methods(http.MethodGet)
178
	// swagger:operation GET /libpod/manifests/{name}/json manifests ManifestInspectLibpod
179
	// ---
180
	// summary: Inspect
181
	// description: Display attributes of given manifest list
182
	// produces:
183
	// - application/json
184
	// parameters:
185
	//  - in: path
186
	//    name: name
187
	//    type: string
188
	//    required: true
189
	//    description: the name or ID of the manifest list
190
	//  - in: query
191
	//    name: tlsVerify
192
	//    type: boolean
193
	//    default: true
194
	//    description: Require HTTPS and verify signatures when contacting registries.
195
	// responses:
196
	//   200:
197
	//     $ref: "#/responses/manifestInspect"
198
	//   404:
199
	//     $ref: "#/responses/manifestNotFound"
200
	//   500:
201
	//     $ref: "#/responses/internalError"
202
	v3.Handle("/{name:.*}/json", s.APIHandler(libpod.ManifestInspect)).Methods(http.MethodGet)
203
	v4.Handle("/{name:.*}/json", s.APIHandler(libpod.ManifestInspect)).Methods(http.MethodGet)
204
	// swagger:operation PUT /libpod/manifests/{name} manifests ManifestModifyLibpod
205
	// ---
206
	// summary: Modify manifest list
207
	// description: |
208
	//   Add/Remove an image(s) to a manifest list
209
	//
210
	//   Note: operations are not atomic when multiple Images are provided.
211
	//
212
	//   As of v4.0.0
213
	// produces:
214
	// - application/json
215
	// parameters:
216
	//  - in: path
217
	//    name: name
218
	//    type: string
219
	//    required: true
220
	//    description: the name or ID of the manifest
221
	//  - in: query
222
	//    name: tlsVerify
223
	//    type: boolean
224
	//    default: true
225
	//    description: Require HTTPS and verify signatures when contacting registries.
226
	//  - in: body
227
	//    name: options
228
	//    description: options for mutating a manifest
229
	//    required: true
230
	//    schema:
231
	//        $ref: "#/definitions/ManifestModifyOptions"
232
	// responses:
233
	//   200:
234
	//     schema:
235
	//       $ref: "#/definitions/ManifestModifyReport"
236
	//   404:
237
	//     $ref: "#/responses/manifestNotFound"
238
	//   400:
239
	//     $ref: "#/responses/badParamError"
240
	//   409:
241
	//     description: Operation had partial success, both Images and Errors may have members
242
	//     schema:
243
	//       $ref: "#/definitions/ManifestModifyReport"
244
	//   500:
245
	//     $ref: "#/responses/internalError"
246
	v4.Handle("/{name:.*}", s.APIHandler(libpod.ManifestModify)).Methods(http.MethodPut)
247
	// swagger:operation POST /libpod/manifests/{name}/add manifests ManifestAddLibpod
248
	// ---
249
	// summary: Add image
250
	// description: |
251
	//   Add an image to a manifest list
252
	//
253
	//   Deprecated: As of 4.0.0 use ManifestModifyLibpod instead
254
	// produces:
255
	// - application/json
256
	// parameters:
257
	//  - in: path
258
	//    name: name
259
	//    type: string
260
	//    required: true
261
	//    description: the name or ID of the manifest
262
	//  - in: body
263
	//    name: options
264
	//    description: options for creating a manifest
265
	//    schema:
266
	//      $ref: "#/definitions/ManifestAddOptions"
267
	// responses:
268
	//   200:
269
	//     schema:
270
	//       $ref: "#/definitions/IDResponse"
271
	//   404:
272
	//     $ref: "#/responses/manifestNotFound"
273
	//   409:
274
	//     $ref: "#/responses/badParamError"
275
	//   500:
276
	//     $ref: "#/responses/internalError"
277
	v3.Handle("/{name:.*}/add", s.APIHandler(libpod.ManifestAddV3)).Methods(http.MethodPost)
278
	// swagger:operation DELETE /libpod/manifests/{name} manifests ManifestDeleteV3Libpod
279
	// ---
280
	// summary: Remove image from a manifest list
281
	// description: |
282
	//   Remove an image from a manifest list
283
	//
284
	//   Deprecated: As of 4.0.0 use ManifestModifyLibpod instead
285
	// produces:
286
	// - application/json
287
	// parameters:
288
	//  - in: path
289
	//    name: name
290
	//    type: string
291
	//    required: true
292
	//    description: the image associated with the manifest
293
	//  - in: query
294
	//    name: digest
295
	//    type: string
296
	//    description: image digest to be removed
297
	// responses:
298
	//   200:
299
	//     schema:
300
	//       $ref: "#/definitions/IDResponse"
301
	//   400:
302
	//     $ref: "#/responses/badParamError"
303
	//   404:
304
	//     $ref: "#/responses/manifestNotFound"
305
	//   500:
306
	//     $ref: "#/responses/internalError"
307
	v3.Handle("/{name:.*}", s.APIHandler(libpod.ManifestRemoveDigestV3)).Methods(http.MethodDelete)
308
	// swagger:operation DELETE /libpod/manifests/{name} manifests ManifestDeleteLibpod
309
	// ---
310
	// summary: Delete manifest list
311
	// description: |
312
	//   Delete named manifest list
313
	//
314
	//   As of v4.0.0
315
	// produces:
316
	// - application/json
317
	// parameters:
318
	//  - in: path
319
	//    name: name
320
	//    type: string
321
	//    required: true
322
	//    description: The name or ID of the  list to be deleted
323
	// responses:
324
	//   200:
325
	//     $ref: "#/responses/imagesRemoveResponseLibpod"
326
	//   404:
327
	//     $ref: "#/responses/manifestNotFound"
328
	//   500:
329
	//     $ref: "#/responses/internalError"
330
	v4.Handle("/{name:.*}", s.APIHandler(libpod.ManifestDelete)).Methods(http.MethodDelete)
331
	return nil
332
}
333

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.