File: register_artifacts.go

package info (click to toggle)
podman 5.7.0%2Bds2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 23,824 kB
  • sloc: sh: 4,700; python: 2,798; perl: 1,885; ansic: 1,484; makefile: 977; ruby: 42; csh: 8
file content (303 lines) | stat: -rw-r--r-- 9,588 bytes parent folder | download
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
//go:build !remote

package server

import (
	"net/http"

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

func (s *APIServer) registerArtifactHandlers(r *mux.Router) error {
	// swagger:operation GET /libpod/artifacts/{name}/json libpod ArtifactInspectLibpod
	// ---
	// tags:
	//   - artifacts
	// summary: Inspect an artifact
	// description: |
	//   Retrieve detailed information about a specific OCI artifact by name or ID.
	// produces:
	//   - application/json
	// parameters:
	//   - name: name
	//     in: path
	//     description: Name or ID of the artifact
	//     required: true
	//     type: string
	// responses:
	//   200:
	//     $ref: "#/responses/inspectArtifactResponse"
	//   404:
	//     $ref: "#/responses/artifactNotFound"
	//   500:
	//     $ref: "#/responses/internalError"
	r.HandleFunc(VersionedPath("/libpod/artifacts/{name:.*}/json"), s.APIHandler(libpod.InspectArtifact)).Methods(http.MethodGet)
	// swagger:operation GET /libpod/artifacts/json libpod ArtifactListLibpod
	// ---
	// tags:
	//   - artifacts
	// summary: List artifacts
	// description: Return a list of all OCI artifacts in local storage.
	// produces:
	// - application/json
	// responses:
	//   200:
	//     $ref: "#/responses/artifactListResponse"
	//   500:
	//     $ref: "#/responses/internalError"
	r.HandleFunc(VersionedPath("/libpod/artifacts/json"), s.APIHandler(libpod.ListArtifact)).Methods(http.MethodGet)
	// swagger:operation POST /libpod/artifacts/pull libpod ArtifactPullLibpod
	// ---
	// tags:
	//  - artifacts
	// summary: Pull an artifact
	// description: Pull an OCI artifact from a remote registry to local storage.
	// produces:
	// - application/json
	// parameters:
	//   - name: name
	//     in: query
	//     description: Mandatory reference to the artifact (e.g., quay.io/image/artifact:tag)
	//     required: true
	//     type: string
	//   - name: retry
	//     in: query
	//     description: Number of times to retry in case of failure when performing pull
	//     type: integer
	//     default: 3
	//   - name: retryDelay
	//     in: query
	//     description: Delay between retries in case of pull failures (e.g., 10s)
	//     type: string
	//     default: 1s
	//   - name: tlsVerify
	//     in: query
	//     description: Require TLS verification
	//     type: boolean
	//     default: true
	//   - name: X-Registry-Auth
	//     in: header
	//     description: |
	//       base-64 encoded auth config.
	//       Must include the following four values: username, password, email and server address
	//       OR simply just an identity token.
	//     type: string
	// responses:
	//   200:
	//     $ref: "#/responses/artifactPullResponse"
	//   400:
	//     $ref: "#/responses/badParamError"
	//   401:
	//     $ref: "#/responses/artifactBadAuth"
	//   404:
	//     $ref: "#/responses/artifactNotFound"
	//   500:
	//     $ref: "#/responses/internalError"
	r.Handle(VersionedPath("/libpod/artifacts/pull"), s.APIHandler(libpod.PullArtifact)).Methods(http.MethodPost)
	// swagger:operation DELETE /libpod/artifacts/remove libpod ArtifactDeleteAllLibpod
	// ---
	// tags:
	//  - artifacts
	// summary: Remove one or more artifacts
	// description: |
	//   Remove one or more OCI artifacts from local storage.
	//   Can be filtered by name/ID or all artifacts can be removed.
	// produces:
	//  - application/json
	// parameters:
	//  - name: artifacts
	//    in: query
	//    description: List of artifact names/IDs to remove
	//    type: array
	//    items:
	//        type: string
	//  - name: all
	//    in: query
	//    description: Remove all artifacts
	//    type: boolean
	//  - name: ignore
	//    in: query
	//    description: Ignore errors if artifact does not exist
	//    type: boolean
	// responses:
	//   200:
	//     $ref: "#/responses/artifactRemoveResponse"
	//   404:
	//     $ref: "#/responses/artifactNotFound"
	//   500:
	//     $ref: "#/responses/internalError"
	r.Handle(VersionedPath("/libpod/artifacts/remove"), s.APIHandler(libpod.BatchRemoveArtifact)).Methods(http.MethodDelete)
	// swagger:operation DELETE /libpod/artifacts/{name} libpod ArtifactDeleteLibpod
	// ---
	// tags:
	//  - artifacts
	// summary: Remove an artifact
	// description: Remove a single artifact from local storage by name or ID.
	// produces:
	//  - application/json
	// parameters:
	//  - name: name
	//    in: path
	//    description: Name or ID of the artifact to remove
	//    required: true
	//    type: string
	// responses:
	//   200:
	//     $ref: "#/responses/artifactRemoveResponse"
	//   404:
	//     $ref: "#/responses/artifactNotFound"
	//   500:
	//     $ref: "#/responses/internalError"
	r.Handle(VersionedPath("/libpod/artifacts/{name:.*}"), s.APIHandler(libpod.RemoveArtifact)).Methods(http.MethodDelete)
	// swagger:operation POST /libpod/artifacts/add libpod ArtifactAddLibpod
	// ---
	// tags:
	//  - artifacts
	// summary: Add a file as an artifact
	// description: |
	//   Add a file as a new OCI artifact, or append to an existing artifact if 'append' is true.
	// produces:
	//   - application/json
	// consumes:
	//   - application/octet-stream
	// parameters:
	//   - name: name
	//     in: query
	//     description: Mandatory reference to the artifact (e.g., quay.io/image/artifact:tag)
	//     required: true
	//     type: string
	//   - name: fileName
	//     in: query
	//     description: Path of the file to be added
	//     required: true
	//     type: string
	//   - name: fileMIMEType
	//     in: query
	//     description: Optionally set the type of file
	//     type: string
	//   - name: annotations
	//     in: query
	//     description: Array of annotation strings e.g "test=true"
	//     type: array
	//     items:
	//       type: string
	//   - name: artifactMIMEType
	//     in: query
	//     description: Use type to describe an artifact
	//     type: string
	//   - name: append
	//     in: query
	//     description: Append files to an existing artifact
	//     type: boolean
	//     default: false
	//   - name: replace
	//     in: query
	//     description: Replace an existing artifact with the same name
	//     type: boolean
	//     default: false
	//   - name: inputStream
	//     in: body
	//     description: Binary stream of the file to add to an artifact
	//     schema:
	//       type: string
	//       format: binary
	// responses:
	//   201:
	//     $ref: "#/responses/artifactAddResponse"
	//   400:
	//     $ref: "#/responses/badParamError"
	//   404:
	//     $ref: "#/responses/artifactNotFound"
	//   500:
	//     $ref: "#/responses/internalError"
	r.Handle(VersionedPath("/libpod/artifacts/add"), s.APIHandler(libpod.AddArtifact)).Methods(http.MethodPost)
	// swagger:operation POST /libpod/artifacts/{name}/push libpod ArtifactPushLibpod
	// ---
	// tags:
	//  - artifacts
	// summary: Push an artifact
	// description: Push an OCI artifact from local storage to a remote image registry.
	// produces:
	//   - application/json
	// parameters:
	//   - name: name
	//     in: path
	//     description: Mandatory reference to the artifact (e.g., quay.io/image/artifact:tag)
	//     required: true
	//     type: string
	//   - name: retry
	//     in: query
	//     description: Number of times to retry in case of failure when performing pull
	//     type: integer
	//     default: 3
	//   - name: retryDelay
	//     in: query
	//     description: Delay between retries in case of pull failures (e.g., 10s)
	//     type: string
	//     default: 1s
	//   - name: tlsVerify
	//     in: query
	//     description: Require TLS verification
	//     type: boolean
	//     default: true
	//   - name: X-Registry-Auth
	//     in: header
	//     description: |
	//       base-64 encoded auth config.
	//       Must include the following four values: username, password, email and server address
	//       OR simply just an identity token.
	//     type: string
	// responses:
	//   200:
	//     $ref: "#/responses/artifactPushResponse"
	//   400:
	//     $ref: "#/responses/badParamError"
	//   401:
	//     $ref: "#/responses/artifactBadAuth"
	//   404:
	//     $ref: "#/responses/artifactNotFound"
	//   500:
	//     $ref: "#/responses/internalError"
	r.Handle(VersionedPath("/libpod/artifacts/{name:.*}/push"), s.APIHandler(libpod.PushArtifact)).Methods(http.MethodPost)
	// swagger:operation GET /libpod/artifacts/{name}/extract libpod ArtifactExtractLibpod
	// ---
	// tags:
	//  - artifacts
	// summary: Extract an artifacts contents
	// description: Extract the files of an OCI artifact to the local filesystem as a tar archive.
	// produces:
	//   - application/x-tar
	// parameters:
	//  - name: name
	//    in: path
	//    description: Name or digest of the artifact
	//    required: true
	//    type: string
	//  - name: title
	//    in: query
	//    description: Only extract the file with the given title
	//    type: string
	//  - name: digest
	//    in: query
	//    description: Only extract the file with the given digest
	//    type: string
	//  - name: excludeTitle
	//    in: query
	//    description: |
	//      When extracting a single file from an artifact, don't use the files title as the file name in the tar archive
	//    type: boolean
	// responses:
	//   200:
	//     description: Extract successful
	//     schema:
	//       type: file
	//   400:
	//     $ref: "#/responses/badParamError"
	//   404:
	//     $ref: "#/responses/artifactNotFound"
	//   500:
	//     $ref: "#/responses/internalError"
	r.Handle(VersionedPath("/libpod/artifacts/{name:.*}/extract"), s.APIHandler(libpod.ExtractArtifact)).Methods(http.MethodGet)
	return nil
}