forked from beluga-php/docker-php-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathImageGet.php
More file actions
81 lines (71 loc) · 2.59 KB
/
Copy pathImageGet.php
File metadata and controls
81 lines (71 loc) · 2.59 KB
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
<?php
declare(strict_types=1);
namespace Docker\API\Endpoint;
class ImageGet extends \Docker\API\Runtime\Client\BaseEndpoint implements \Docker\API\Runtime\Client\Endpoint
{
use \Docker\API\Runtime\Client\EndpointTrait;
protected $name;
/**
* Get a tarball containing all images and metadata for a repository.
*
* If `name` is a specific name and tag (e.g. `ubuntu:latest`), then only that image (and its parents) are returned. If `name` is an image ID, similarly only that image (and its parents) are returned, but with the exclusion of the `repositories` file in the tarball, as there were no image names referenced.
*
* ### Image tarball format
*
* An image tarball contains one directory per image layer (named using its long ID), each containing these files:
*
* - `VERSION`: currently `1.0` - the file format version
* - `json`: detailed layer information, similar to `docker inspect layer_id`
* - `layer.tar`: A tarfile containing the filesystem changes in this layer
*
* The `layer.tar` file contains `aufs` style `.wh..wh.aufs` files and directories for storing attribute changes and deletions.
*
* If the tarball defines a repository, the tarball should also include a `repositories` file at the root that contains a list of repository and tag names mapped to layer IDs.
*
* ```json
* {
* "hello-world": {
* "latest": "565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"
* }
* }
* ```
*
* @param string $name Image name or ID
*/
public function __construct(string $name)
{
$this->name = $name;
}
public function getMethod(): string
{
return 'GET';
}
public function getUri(): string
{
return str_replace(['{name}'], [$this->name], '/images/{name}/get');
}
public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null): array
{
return [[], null];
}
public function getExtraHeaders(): array
{
return ['Accept' => ['application/x-tar']];
}
/**
* @return null
*/
protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null)
{
$status = $response->getStatusCode();
$body = (string) $response->getBody();
if (200 === $status) {
}
if (500 === $status) {
}
}
public function getAuthenticationScopes(): array
{
return [];
}
}