|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Docker\API\Resource; |
|
4
|
|
|
|
|
5
|
|
|
use Joli\Jane\Swagger\Client\QueryParam; |
|
6
|
|
|
use Joli\Jane\Swagger\Client\Resource; |
|
7
|
|
|
|
|
8
|
|
|
class ImageResource extends Resource |
|
9
|
|
|
{ |
|
10
|
|
|
/** |
|
11
|
|
|
* List Images. |
|
12
|
|
|
* |
|
13
|
|
|
* @param array $parameters List of parameters |
|
14
|
|
|
* |
|
15
|
|
|
* (bool)all: Show all images. Only images from a final layer (no children) are shown by default. |
|
16
|
|
|
* (string)filters: A JSON encoded value of the filters (a map[string][]string) to process on the containers list |
|
17
|
|
|
* (string)filter: Only return images with the specified name. |
|
18
|
|
|
* (bool)digests: Show digest information, default to false |
|
19
|
|
|
* @param string $fetch Fetch mode (object or response) |
|
20
|
|
|
* |
|
21
|
|
|
* @return \Psr\Http\Message\ResponseInterface|\Docker\API\Model\ImageItem[] |
|
22
|
|
|
*/ |
|
23
|
|
|
public function findAll($parameters = [], $fetch = self::FETCH_OBJECT) |
|
24
|
|
|
{ |
|
25
|
|
|
$queryParam = new QueryParam(); |
|
26
|
|
|
$queryParam->setDefault('all', false); |
|
27
|
|
|
$queryParam->setDefault('filters', null); |
|
28
|
|
|
$queryParam->setDefault('filter', null); |
|
29
|
|
|
$queryParam->setDefault('digests', null); |
|
30
|
|
|
$url = '/v1.21/images/json'; |
|
31
|
|
|
$url = $url . ('?' . $queryParam->buildQueryString($parameters)); |
|
32
|
|
|
$headers = array_merge(['Host' => 'localhost'], $queryParam->buildHeaders($parameters)); |
|
33
|
|
|
$body = $queryParam->buildFormDataString($parameters); |
|
34
|
|
|
$request = $this->messageFactory->createRequest('GET', $url, $headers, $body); |
|
35
|
|
|
$response = $this->httpClient->sendRequest($request); |
|
36
|
|
|
if (self::FETCH_OBJECT == $fetch) { |
|
37
|
|
|
if ('200' == $response->getStatusCode()) { |
|
38
|
|
|
return $this->serializer->deserialize($response->getBody()->getContents(), 'Docker\\API\\Model\\ImageItem[]', 'json'); |
|
39
|
|
|
} |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
return $response; |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* Build an image from Dockerfile via stdin. |
|
47
|
|
|
* |
|
48
|
|
|
* @param string $inputStream The input stream must be a tar archive compressed with one of the following algorithms: identity (no compression), gzip, bzip2, xz. |
|
49
|
|
|
* @param array $parameters List of parameters |
|
50
|
|
|
* |
|
51
|
|
|
* (string)dockerfile: Path within the build context to the Dockerfile. This is ignored if remote is specified and points to an individual filename. |
|
52
|
|
|
* (string)t: A repository name (and optionally a tag) to apply to the resulting image in case of success. |
|
53
|
|
|
* (string)remote: A Git repository URI or HTTP/HTTPS URI build source. If the URI specifies a filename, the file’s contents are placed into a file called Dockerfile. |
|
54
|
|
|
* (bool)q: Suppress verbose build output. |
|
55
|
|
|
* (bool)nocache: Do not use the cache when building the image. |
|
56
|
|
|
* (string)pull: Attempt to pull the image even if an older image exists locally |
|
57
|
|
|
* (bool)rm: Remove intermediate containers after a successful build (default behavior). |
|
58
|
|
|
* (bool)forcerm: always remove intermediate containers (includes rm)Request Headers: |
|
59
|
|
|
* (string)Content-type: Set to 'application/tar'. |
|
60
|
|
|
* (string)X-Registry-Config: A base64-url-safe-encoded Registry Auth Config JSON object |
|
61
|
|
|
* @param string $fetch Fetch mode (object or response) |
|
62
|
|
|
* |
|
63
|
|
|
* @return \Psr\Http\Message\ResponseInterface |
|
64
|
|
|
*/ |
|
65
|
|
|
public function build(string $inputStream, $parameters = [], $fetch = self::FETCH_OBJECT) |
|
|
|
|
|
|
66
|
|
|
{ |
|
67
|
|
|
$queryParam = new QueryParam(); |
|
68
|
|
|
$queryParam->setDefault('dockerfile', null); |
|
69
|
|
|
$queryParam->setDefault('t', null); |
|
70
|
|
|
$queryParam->setDefault('remote', null); |
|
71
|
|
|
$queryParam->setDefault('q', false); |
|
72
|
|
|
$queryParam->setDefault('nocache', false); |
|
73
|
|
|
$queryParam->setDefault('pull', null); |
|
74
|
|
|
$queryParam->setDefault('rm', true); |
|
75
|
|
|
$queryParam->setDefault('forcerm', false); |
|
76
|
|
|
$queryParam->setDefault('Content-type', 'application/tar'); |
|
77
|
|
|
$queryParam->setHeaderParameters(['Content-type']); |
|
78
|
|
|
$queryParam->setDefault('X-Registry-Config', null); |
|
79
|
|
|
$queryParam->setHeaderParameters(['X-Registry-Config']); |
|
80
|
|
|
$url = '/v1.21/build'; |
|
81
|
|
|
$url = $url . ('?' . $queryParam->buildQueryString($parameters)); |
|
82
|
|
|
$headers = array_merge(['Host' => 'localhost'], $queryParam->buildHeaders($parameters)); |
|
83
|
|
|
$body = $inputStream; |
|
84
|
|
|
$request = $this->messageFactory->createRequest('POST', $url, $headers, $body); |
|
85
|
|
|
$response = $this->httpClient->sendRequest($request); |
|
86
|
|
|
|
|
87
|
|
|
return $response; |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
/** |
|
91
|
|
|
* Create an image either by pulling it from the registry or by importing it. |
|
92
|
|
|
* |
|
93
|
|
|
* @param array $parameters List of parameters |
|
94
|
|
|
* |
|
95
|
|
|
* (string)fromImage: Name of the image to pull. The name may include a tag or digest. This parameter may only be used when pulling an image. |
|
96
|
|
|
* (string)fromSrc: Source to import. The value may be a URL from which the image can be retrieved or - to read the image from the request body. This parameter may only be used when importing an image. |
|
97
|
|
|
* (string)repo: Repository name given to an image when it is imported. The repo may include a tag. This parameter may only be used when importing an image. |
|
98
|
|
|
* (string)tag: Tag or digest. |
|
99
|
|
|
* (string)X-Registry-Config: A base64-encoded AuthConfig object |
|
100
|
|
|
* @param string $fetch Fetch mode (object or response) |
|
101
|
|
|
* |
|
102
|
|
|
* @return \Psr\Http\Message\ResponseInterface |
|
103
|
|
|
*/ |
|
104
|
|
|
public function create($parameters = [], $fetch = self::FETCH_OBJECT) |
|
|
|
|
|
|
105
|
|
|
{ |
|
106
|
|
|
$queryParam = new QueryParam(); |
|
107
|
|
|
$queryParam->setDefault('fromImage', null); |
|
108
|
|
|
$queryParam->setDefault('fromSrc', null); |
|
109
|
|
|
$queryParam->setDefault('repo', null); |
|
110
|
|
|
$queryParam->setDefault('tag', null); |
|
111
|
|
|
$queryParam->setDefault('X-Registry-Config', null); |
|
112
|
|
|
$queryParam->setHeaderParameters(['X-Registry-Config']); |
|
113
|
|
|
$url = '/v1.21/images/create'; |
|
114
|
|
|
$url = $url . ('?' . $queryParam->buildQueryString($parameters)); |
|
115
|
|
|
$headers = array_merge(['Host' => 'localhost'], $queryParam->buildHeaders($parameters)); |
|
116
|
|
|
$body = $queryParam->buildFormDataString($parameters); |
|
117
|
|
|
$request = $this->messageFactory->createRequest('POST', $url, $headers, $body); |
|
118
|
|
|
$response = $this->httpClient->sendRequest($request); |
|
119
|
|
|
|
|
120
|
|
|
return $response; |
|
121
|
|
|
} |
|
122
|
|
|
|
|
123
|
|
|
/** |
|
124
|
|
|
* Return low-level information on the image name. |
|
125
|
|
|
* |
|
126
|
|
|
* @param array $parameters List of parameters |
|
127
|
|
|
* @param string $fetch Fetch mode (object or response) |
|
128
|
|
|
* |
|
129
|
|
|
* @return \Psr\Http\Message\ResponseInterface|\Docker\API\Model\Image |
|
130
|
|
|
*/ |
|
131
|
|
View Code Duplication |
public function find($parameters = [], $fetch = self::FETCH_OBJECT) |
|
|
|
|
|
|
132
|
|
|
{ |
|
133
|
|
|
$queryParam = new QueryParam(); |
|
134
|
|
|
$url = '/v1.21/images/{name}/json'; |
|
135
|
|
|
$url = $url . ('?' . $queryParam->buildQueryString($parameters)); |
|
136
|
|
|
$headers = array_merge(['Host' => 'localhost'], $queryParam->buildHeaders($parameters)); |
|
137
|
|
|
$body = $queryParam->buildFormDataString($parameters); |
|
138
|
|
|
$request = $this->messageFactory->createRequest('GET', $url, $headers, $body); |
|
139
|
|
|
$response = $this->httpClient->sendRequest($request); |
|
140
|
|
|
if (self::FETCH_OBJECT == $fetch) { |
|
141
|
|
|
if ('200' == $response->getStatusCode()) { |
|
142
|
|
|
return $this->serializer->deserialize($response->getBody()->getContents(), 'Docker\\API\\Model\\Image', 'json'); |
|
143
|
|
|
} |
|
144
|
|
|
} |
|
145
|
|
|
|
|
146
|
|
|
return $response; |
|
147
|
|
|
} |
|
148
|
|
|
|
|
149
|
|
|
/** |
|
150
|
|
|
* Return the history of the image name. |
|
151
|
|
|
* |
|
152
|
|
|
* @param array $parameters List of parameters |
|
153
|
|
|
* @param string $fetch Fetch mode (object or response) |
|
154
|
|
|
* |
|
155
|
|
|
* @return \Psr\Http\Message\ResponseInterface|\Docker\API\Model\ImageHistoryItem[] |
|
156
|
|
|
*/ |
|
157
|
|
View Code Duplication |
public function history($parameters = [], $fetch = self::FETCH_OBJECT) |
|
|
|
|
|
|
158
|
|
|
{ |
|
159
|
|
|
$queryParam = new QueryParam(); |
|
160
|
|
|
$url = '/v1.21/images/{name}/history'; |
|
161
|
|
|
$url = $url . ('?' . $queryParam->buildQueryString($parameters)); |
|
162
|
|
|
$headers = array_merge(['Host' => 'localhost'], $queryParam->buildHeaders($parameters)); |
|
163
|
|
|
$body = $queryParam->buildFormDataString($parameters); |
|
164
|
|
|
$request = $this->messageFactory->createRequest('GET', $url, $headers, $body); |
|
165
|
|
|
$response = $this->httpClient->sendRequest($request); |
|
166
|
|
|
if (self::FETCH_OBJECT == $fetch) { |
|
167
|
|
|
if ('200' == $response->getStatusCode()) { |
|
168
|
|
|
return $this->serializer->deserialize($response->getBody()->getContents(), 'Docker\\API\\Model\\ImageHistoryItem[]', 'json'); |
|
169
|
|
|
} |
|
170
|
|
|
} |
|
171
|
|
|
|
|
172
|
|
|
return $response; |
|
173
|
|
|
} |
|
174
|
|
|
|
|
175
|
|
|
/** |
|
176
|
|
|
* Push the image name on the registry. |
|
177
|
|
|
* |
|
178
|
|
|
* @param array $parameters List of parameters |
|
179
|
|
|
* |
|
180
|
|
|
* (string)tag: The tag to associate with the image on the registry. |
|
181
|
|
|
* (string)X-Registry-Auth: A base64-encoded AuthConfig object |
|
182
|
|
|
* @param string $fetch Fetch mode (object or response) |
|
183
|
|
|
* |
|
184
|
|
|
* @return \Psr\Http\Message\ResponseInterface |
|
185
|
|
|
*/ |
|
186
|
|
View Code Duplication |
public function push($parameters = [], $fetch = self::FETCH_OBJECT) |
|
|
|
|
|
|
187
|
|
|
{ |
|
188
|
|
|
$queryParam = new QueryParam(); |
|
189
|
|
|
$queryParam->setDefault('tag', null); |
|
190
|
|
|
$queryParam->setDefault('X-Registry-Auth', null); |
|
191
|
|
|
$queryParam->setHeaderParameters(['X-Registry-Auth']); |
|
192
|
|
|
$url = '/v1.21/images/{name}/push'; |
|
193
|
|
|
$url = $url . ('?' . $queryParam->buildQueryString($parameters)); |
|
194
|
|
|
$headers = array_merge(['Host' => 'localhost'], $queryParam->buildHeaders($parameters)); |
|
195
|
|
|
$body = $queryParam->buildFormDataString($parameters); |
|
196
|
|
|
$request = $this->messageFactory->createRequest('POST', $url, $headers, $body); |
|
197
|
|
|
$response = $this->httpClient->sendRequest($request); |
|
198
|
|
|
|
|
199
|
|
|
return $response; |
|
200
|
|
|
} |
|
201
|
|
|
|
|
202
|
|
|
/** |
|
203
|
|
|
* Tag the image name into a repository. |
|
204
|
|
|
* |
|
205
|
|
|
* @param array $parameters List of parameters |
|
206
|
|
|
* |
|
207
|
|
|
* (string)repo: The repository to tag in. |
|
208
|
|
|
* (string)force: 1/True/true or 0/False/false, default false |
|
209
|
|
|
* (string)tag: The new tag name. |
|
210
|
|
|
* @param string $fetch Fetch mode (object or response) |
|
211
|
|
|
* |
|
212
|
|
|
* @return \Psr\Http\Message\ResponseInterface |
|
213
|
|
|
*/ |
|
214
|
|
View Code Duplication |
public function tag($parameters = [], $fetch = self::FETCH_OBJECT) |
|
|
|
|
|
|
215
|
|
|
{ |
|
216
|
|
|
$queryParam = new QueryParam(); |
|
217
|
|
|
$queryParam->setDefault('repo', null); |
|
218
|
|
|
$queryParam->setDefault('force', null); |
|
219
|
|
|
$queryParam->setDefault('tag', null); |
|
220
|
|
|
$url = '/v1.21/images/{name}/tag'; |
|
221
|
|
|
$url = $url . ('?' . $queryParam->buildQueryString($parameters)); |
|
222
|
|
|
$headers = array_merge(['Host' => 'localhost'], $queryParam->buildHeaders($parameters)); |
|
223
|
|
|
$body = $queryParam->buildFormDataString($parameters); |
|
224
|
|
|
$request = $this->messageFactory->createRequest('POST', $url, $headers, $body); |
|
225
|
|
|
$response = $this->httpClient->sendRequest($request); |
|
226
|
|
|
|
|
227
|
|
|
return $response; |
|
228
|
|
|
} |
|
229
|
|
|
|
|
230
|
|
|
/** |
|
231
|
|
|
* Remove the image name from the filesystem. |
|
232
|
|
|
* |
|
233
|
|
|
* @param array $parameters List of parameters |
|
234
|
|
|
* |
|
235
|
|
|
* (string)force: 1/True/true or 0/False/false, default false |
|
236
|
|
|
* (string)noprune: 1/True/true or 0/False/false, default false. |
|
237
|
|
|
* @param string $fetch Fetch mode (object or response) |
|
238
|
|
|
* |
|
239
|
|
|
* @return \Psr\Http\Message\ResponseInterface |
|
240
|
|
|
*/ |
|
241
|
|
View Code Duplication |
public function remove($parameters = [], $fetch = self::FETCH_OBJECT) |
|
|
|
|
|
|
242
|
|
|
{ |
|
243
|
|
|
$queryParam = new QueryParam(); |
|
244
|
|
|
$queryParam->setDefault('force', null); |
|
245
|
|
|
$queryParam->setDefault('noprune', null); |
|
246
|
|
|
$url = '/v1.21/images/{name}'; |
|
247
|
|
|
$url = $url . ('?' . $queryParam->buildQueryString($parameters)); |
|
248
|
|
|
$headers = array_merge(['Host' => 'localhost'], $queryParam->buildHeaders($parameters)); |
|
249
|
|
|
$body = $queryParam->buildFormDataString($parameters); |
|
250
|
|
|
$request = $this->messageFactory->createRequest('DELETE', $url, $headers, $body); |
|
251
|
|
|
$response = $this->httpClient->sendRequest($request); |
|
252
|
|
|
|
|
253
|
|
|
return $response; |
|
254
|
|
|
} |
|
255
|
|
|
|
|
256
|
|
|
/** |
|
257
|
|
|
* Search for an image on Docker Hub. |
|
258
|
|
|
* |
|
259
|
|
|
* @param array $parameters List of parameters |
|
260
|
|
|
* |
|
261
|
|
|
* (string)term: Term to search |
|
262
|
|
|
* @param string $fetch Fetch mode (object or response) |
|
263
|
|
|
* |
|
264
|
|
|
* @return \Psr\Http\Message\ResponseInterface|\Docker\API\Model\ImageSearchResult[] |
|
265
|
|
|
*/ |
|
266
|
|
View Code Duplication |
public function search($parameters = [], $fetch = self::FETCH_OBJECT) |
|
|
|
|
|
|
267
|
|
|
{ |
|
268
|
|
|
$queryParam = new QueryParam(); |
|
269
|
|
|
$queryParam->setDefault('term', null); |
|
270
|
|
|
$url = '/v1.21/images/search'; |
|
271
|
|
|
$url = $url . ('?' . $queryParam->buildQueryString($parameters)); |
|
272
|
|
|
$headers = array_merge(['Host' => 'localhost'], $queryParam->buildHeaders($parameters)); |
|
273
|
|
|
$body = $queryParam->buildFormDataString($parameters); |
|
274
|
|
|
$request = $this->messageFactory->createRequest('GET', $url, $headers, $body); |
|
275
|
|
|
$response = $this->httpClient->sendRequest($request); |
|
276
|
|
|
if (self::FETCH_OBJECT == $fetch) { |
|
277
|
|
|
if ('200' == $response->getStatusCode()) { |
|
278
|
|
|
return $this->serializer->deserialize($response->getBody()->getContents(), 'Docker\\API\\Model\\ImageSearchResult[]', 'json'); |
|
279
|
|
|
} |
|
280
|
|
|
} |
|
281
|
|
|
|
|
282
|
|
|
return $response; |
|
283
|
|
|
} |
|
284
|
|
|
|
|
285
|
|
|
/** |
|
286
|
|
|
* Create a new image from a container’s changes. |
|
287
|
|
|
* |
|
288
|
|
|
* @param \Docker\API\Model\ContainerConfig $containerConfig The container configuration |
|
289
|
|
|
* @param array $parameters List of parameters |
|
290
|
|
|
* |
|
291
|
|
|
* (string)container: Container id or name to commit |
|
292
|
|
|
* (string)repo: Repository name for the created image |
|
293
|
|
|
* (string)tag: Tag name for the create image |
|
294
|
|
|
* (string)comment: Commit message |
|
295
|
|
|
* (string)author: author (e.g., “John Hannibal Smith <[email protected]>“) |
|
296
|
|
|
* (string)pause: 1/True/true or 0/False/false, whether to pause the container before committing |
|
297
|
|
|
* (string)changes: Dockerfile instructions to apply while committing |
|
298
|
|
|
* @param string $fetch Fetch mode (object or response) |
|
299
|
|
|
* |
|
300
|
|
|
* @return \Psr\Http\Message\ResponseInterface|\Docker\API\Model\CommitResult |
|
301
|
|
|
*/ |
|
302
|
|
|
public function commit(\Docker\API\Model\ContainerConfig $containerConfig, $parameters = [], $fetch = self::FETCH_OBJECT) |
|
303
|
|
|
{ |
|
304
|
|
|
$queryParam = new QueryParam(); |
|
305
|
|
|
$queryParam->setDefault('container', null); |
|
306
|
|
|
$queryParam->setDefault('repo', null); |
|
307
|
|
|
$queryParam->setDefault('tag', null); |
|
308
|
|
|
$queryParam->setDefault('comment', null); |
|
309
|
|
|
$queryParam->setDefault('author', null); |
|
310
|
|
|
$queryParam->setDefault('pause', null); |
|
311
|
|
|
$queryParam->setDefault('changes', null); |
|
312
|
|
|
$url = '/v1.21/commit'; |
|
313
|
|
|
$url = $url . ('?' . $queryParam->buildQueryString($parameters)); |
|
314
|
|
|
$headers = array_merge(['Host' => 'localhost'], $queryParam->buildHeaders($parameters)); |
|
315
|
|
|
$body = $this->serializer->serialize($containerConfig, 'json'); |
|
316
|
|
|
$request = $this->messageFactory->createRequest('POST', $url, $headers, $body); |
|
317
|
|
|
$response = $this->httpClient->sendRequest($request); |
|
318
|
|
|
if (self::FETCH_OBJECT == $fetch) { |
|
319
|
|
|
if ('201' == $response->getStatusCode()) { |
|
320
|
|
|
return $this->serializer->deserialize($response->getBody()->getContents(), 'Docker\\API\\Model\\CommitResult', 'json'); |
|
321
|
|
|
} |
|
322
|
|
|
} |
|
323
|
|
|
|
|
324
|
|
|
return $response; |
|
325
|
|
|
} |
|
326
|
|
|
|
|
327
|
|
|
/** |
|
328
|
|
|
* Get a tarball containing all images and metadata for the repository specified by name. |
|
329
|
|
|
* |
|
330
|
|
|
* @param array $parameters List of parameters |
|
331
|
|
|
* @param string $fetch Fetch mode (object or response) |
|
332
|
|
|
* |
|
333
|
|
|
* @return \Psr\Http\Message\ResponseInterface |
|
334
|
|
|
*/ |
|
335
|
|
View Code Duplication |
public function save($parameters = [], $fetch = self::FETCH_OBJECT) |
|
|
|
|
|
|
336
|
|
|
{ |
|
337
|
|
|
$queryParam = new QueryParam(); |
|
338
|
|
|
$url = '/v1.21/images/{name}/get'; |
|
339
|
|
|
$url = $url . ('?' . $queryParam->buildQueryString($parameters)); |
|
340
|
|
|
$headers = array_merge(['Host' => 'localhost'], $queryParam->buildHeaders($parameters)); |
|
341
|
|
|
$body = $queryParam->buildFormDataString($parameters); |
|
342
|
|
|
$request = $this->messageFactory->createRequest('GET', $url, $headers, $body); |
|
343
|
|
|
$response = $this->httpClient->sendRequest($request); |
|
344
|
|
|
|
|
345
|
|
|
return $response; |
|
346
|
|
|
} |
|
347
|
|
|
|
|
348
|
|
|
/** |
|
349
|
|
|
* Get a tarball containing all images and metadata for one or more repositories. |
|
350
|
|
|
* |
|
351
|
|
|
* @param array $parameters List of parameters |
|
352
|
|
|
* |
|
353
|
|
|
* (array)names: Image names to filter |
|
354
|
|
|
* @param string $fetch Fetch mode (object or response) |
|
355
|
|
|
* |
|
356
|
|
|
* @return \Psr\Http\Message\ResponseInterface |
|
357
|
|
|
*/ |
|
358
|
|
View Code Duplication |
public function saveAll($parameters = [], $fetch = self::FETCH_OBJECT) |
|
|
|
|
|
|
359
|
|
|
{ |
|
360
|
|
|
$queryParam = new QueryParam(); |
|
361
|
|
|
$queryParam->setDefault('names', null); |
|
362
|
|
|
$url = '/v1.21/images/get'; |
|
363
|
|
|
$url = $url . ('?' . $queryParam->buildQueryString($parameters)); |
|
364
|
|
|
$headers = array_merge(['Host' => 'localhost'], $queryParam->buildHeaders($parameters)); |
|
365
|
|
|
$body = $queryParam->buildFormDataString($parameters); |
|
366
|
|
|
$request = $this->messageFactory->createRequest('GET', $url, $headers, $body); |
|
367
|
|
|
$response = $this->httpClient->sendRequest($request); |
|
368
|
|
|
|
|
369
|
|
|
return $response; |
|
370
|
|
|
} |
|
371
|
|
|
|
|
372
|
|
|
/** |
|
373
|
|
|
* Load a set of images and tags into a Docker repository. See the image tarball format for more details. |
|
374
|
|
|
* |
|
375
|
|
|
* @param string $imagesTarball Tar archive containing images |
|
376
|
|
|
* @param array $parameters List of parameters |
|
377
|
|
|
* @param string $fetch Fetch mode (object or response) |
|
378
|
|
|
* |
|
379
|
|
|
* @return \Psr\Http\Message\ResponseInterface |
|
380
|
|
|
*/ |
|
381
|
|
View Code Duplication |
public function load(string $imagesTarball, $parameters = [], $fetch = self::FETCH_OBJECT) |
|
|
|
|
|
|
382
|
|
|
{ |
|
383
|
|
|
$queryParam = new QueryParam(); |
|
384
|
|
|
$url = '/v1.21/images/load'; |
|
385
|
|
|
$url = $url . ('?' . $queryParam->buildQueryString($parameters)); |
|
386
|
|
|
$headers = array_merge(['Host' => 'localhost'], $queryParam->buildHeaders($parameters)); |
|
387
|
|
|
$body = $imagesTarball; |
|
388
|
|
|
$request = $this->messageFactory->createRequest('POST', $url, $headers, $body); |
|
389
|
|
|
$response = $this->httpClient->sendRequest($request); |
|
390
|
|
|
|
|
391
|
|
|
return $response; |
|
392
|
|
|
} |
|
393
|
|
|
} |
|
394
|
|
|
|
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.