@@ 19-35 (lines=17) @@ | ||
16 | * |
|
17 | * @return \Psr\Http\Message\ResponseInterface|\Docker\API\Model\ExecCreateResult |
|
18 | */ |
|
19 | public function create(\Docker\API\Model\ExecConfig $execConfig, $parameters = [], $fetch = self::FETCH_OBJECT) |
|
20 | { |
|
21 | $queryParam = new QueryParam(); |
|
22 | $url = '/v1.21/containers/{id}/exec'; |
|
23 | $url = $url . ('?' . $queryParam->buildQueryString($parameters)); |
|
24 | $headers = array_merge(['Host' => 'localhost'], $queryParam->buildHeaders($parameters)); |
|
25 | $body = $this->serializer->serialize($execConfig, 'json'); |
|
26 | $request = $this->messageFactory->createRequest('POST', $url, $headers, $body); |
|
27 | $response = $this->httpClient->sendRequest($request); |
|
28 | if (self::FETCH_OBJECT == $fetch) { |
|
29 | if ('201' == $response->getStatusCode()) { |
|
30 | return $this->serializer->deserialize($response->getBody()->getContents(), 'Docker\\API\\Model\\ExecCreateResult', 'json'); |
|
31 | } |
|
32 | } |
|
33 | ||
34 | return $response; |
|
35 | } |
|
36 | ||
37 | /** |
|
38 | * Starts a previously set up exec instance id. If detach is true, this API returns after starting the exec command. Otherwise, this API sets up an interactive session with the exec command. |
@@ 40-56 (lines=17) @@ | ||
37 | * |
|
38 | * @return \Psr\Http\Message\ResponseInterface|\Docker\API\Model\SystemInformation |
|
39 | */ |
|
40 | public function getSystemInformation($parameters = [], $fetch = self::FETCH_OBJECT) |
|
41 | { |
|
42 | $queryParam = new QueryParam(); |
|
43 | $url = '/v1.21/info'; |
|
44 | $url = $url . ('?' . $queryParam->buildQueryString($parameters)); |
|
45 | $headers = array_merge(['Host' => 'localhost'], $queryParam->buildHeaders($parameters)); |
|
46 | $body = $queryParam->buildFormDataString($parameters); |
|
47 | $request = $this->messageFactory->createRequest('GET', $url, $headers, $body); |
|
48 | $response = $this->httpClient->sendRequest($request); |
|
49 | if (self::FETCH_OBJECT == $fetch) { |
|
50 | if ('200' == $response->getStatusCode()) { |
|
51 | return $this->serializer->deserialize($response->getBody()->getContents(), 'Docker\\API\\Model\\SystemInformation', 'json'); |
|
52 | } |
|
53 | } |
|
54 | ||
55 | return $response; |
|
56 | } |
|
57 | ||
58 | /** |
|
59 | * Show the docker version information. |
|
@@ 66-82 (lines=17) @@ | ||
63 | * |
|
64 | * @return \Psr\Http\Message\ResponseInterface|\Docker\API\Model\Version |
|
65 | */ |
|
66 | public function getVersion($parameters = [], $fetch = self::FETCH_OBJECT) |
|
67 | { |
|
68 | $queryParam = new QueryParam(); |
|
69 | $url = '/v1.21/version'; |
|
70 | $url = $url . ('?' . $queryParam->buildQueryString($parameters)); |
|
71 | $headers = array_merge(['Host' => 'localhost'], $queryParam->buildHeaders($parameters)); |
|
72 | $body = $queryParam->buildFormDataString($parameters); |
|
73 | $request = $this->messageFactory->createRequest('GET', $url, $headers, $body); |
|
74 | $response = $this->httpClient->sendRequest($request); |
|
75 | if (self::FETCH_OBJECT == $fetch) { |
|
76 | if ('200' == $response->getStatusCode()) { |
|
77 | return $this->serializer->deserialize($response->getBody()->getContents(), 'Docker\\API\\Model\\Version', 'json'); |
|
78 | } |
|
79 | } |
|
80 | ||
81 | return $response; |
|
82 | } |
|
83 | ||
84 | /** |
|
85 | * Ping the docker server. |
@@ 20-37 (lines=18) @@ | ||
17 | * |
|
18 | * @return \Psr\Http\Message\ResponseInterface|\Docker\API\Model\Network[] |
|
19 | */ |
|
20 | public function findAll($parameters = [], $fetch = self::FETCH_OBJECT) |
|
21 | { |
|
22 | $queryParam = new QueryParam(); |
|
23 | $queryParam->setDefault('filters', null); |
|
24 | $url = '/v1.21/networks'; |
|
25 | $url = $url . ('?' . $queryParam->buildQueryString($parameters)); |
|
26 | $headers = array_merge(['Host' => 'localhost'], $queryParam->buildHeaders($parameters)); |
|
27 | $body = $queryParam->buildFormDataString($parameters); |
|
28 | $request = $this->messageFactory->createRequest('GET', $url, $headers, $body); |
|
29 | $response = $this->httpClient->sendRequest($request); |
|
30 | if (self::FETCH_OBJECT == $fetch) { |
|
31 | if ('200' == $response->getStatusCode()) { |
|
32 | return $this->serializer->deserialize($response->getBody()->getContents(), 'Docker\\API\\Model\\Network[]', 'json'); |
|
33 | } |
|
34 | } |
|
35 | ||
36 | return $response; |
|
37 | } |
|
38 | ||
39 | /** |
|
40 | * Remove a network. |
|
@@ 99-115 (lines=17) @@ | ||
96 | * |
|
97 | * @return \Psr\Http\Message\ResponseInterface|\Docker\API\Model\NetworkCreateResult |
|
98 | */ |
|
99 | public function create(\Docker\API\Model\NetworkCreateConfig $networkConfig, $parameters = [], $fetch = self::FETCH_OBJECT) |
|
100 | { |
|
101 | $queryParam = new QueryParam(); |
|
102 | $url = '/v1.21/networks/create'; |
|
103 | $url = $url . ('?' . $queryParam->buildQueryString($parameters)); |
|
104 | $headers = array_merge(['Host' => 'localhost'], $queryParam->buildHeaders($parameters)); |
|
105 | $body = $this->serializer->serialize($networkConfig, 'json'); |
|
106 | $request = $this->messageFactory->createRequest('POST', $url, $headers, $body); |
|
107 | $response = $this->httpClient->sendRequest($request); |
|
108 | if (self::FETCH_OBJECT == $fetch) { |
|
109 | if ('201' == $response->getStatusCode()) { |
|
110 | return $this->serializer->deserialize($response->getBody()->getContents(), 'Docker\\API\\Model\\NetworkCreateResult', 'json'); |
|
111 | } |
|
112 | } |
|
113 | ||
114 | return $response; |
|
115 | } |
|
116 | ||
117 | /** |
|
118 | * Connect a container to a network. |
@@ 20-37 (lines=18) @@ | ||
17 | * |
|
18 | * @return \Psr\Http\Message\ResponseInterface|\Docker\API\Model\VolumeList |
|
19 | */ |
|
20 | public function findAll($parameters = [], $fetch = self::FETCH_OBJECT) |
|
21 | { |
|
22 | $queryParam = new QueryParam(); |
|
23 | $queryParam->setDefault('filters', null); |
|
24 | $url = '/v1.21/volumes'; |
|
25 | $url = $url . ('?' . $queryParam->buildQueryString($parameters)); |
|
26 | $headers = array_merge(['Host' => 'localhost'], $queryParam->buildHeaders($parameters)); |
|
27 | $body = $queryParam->buildFormDataString($parameters); |
|
28 | $request = $this->messageFactory->createRequest('GET', $url, $headers, $body); |
|
29 | $response = $this->httpClient->sendRequest($request); |
|
30 | if (self::FETCH_OBJECT == $fetch) { |
|
31 | if ('200' == $response->getStatusCode()) { |
|
32 | return $this->serializer->deserialize($response->getBody()->getContents(), 'Docker\\API\\Model\\VolumeList', 'json'); |
|
33 | } |
|
34 | } |
|
35 | ||
36 | return $response; |
|
37 | } |
|
38 | ||
39 | /** |
|
40 | * Create a volume. |
|
@@ 48-64 (lines=17) @@ | ||
45 | * |
|
46 | * @return \Psr\Http\Message\ResponseInterface|\Docker\API\Model\Volume |
|
47 | */ |
|
48 | public function create(\Docker\API\Model\VolumeConfig $volumeConfig, $parameters = [], $fetch = self::FETCH_OBJECT) |
|
49 | { |
|
50 | $queryParam = new QueryParam(); |
|
51 | $url = '/v1.21/volumes/create'; |
|
52 | $url = $url . ('?' . $queryParam->buildQueryString($parameters)); |
|
53 | $headers = array_merge(['Host' => 'localhost'], $queryParam->buildHeaders($parameters)); |
|
54 | $body = $this->serializer->serialize($volumeConfig, 'json'); |
|
55 | $request = $this->messageFactory->createRequest('POST', $url, $headers, $body); |
|
56 | $response = $this->httpClient->sendRequest($request); |
|
57 | if (self::FETCH_OBJECT == $fetch) { |
|
58 | if ('201' == $response->getStatusCode()) { |
|
59 | return $this->serializer->deserialize($response->getBody()->getContents(), 'Docker\\API\\Model\\Volume', 'json'); |
|
60 | } |
|
61 | } |
|
62 | ||
63 | return $response; |
|
64 | } |
|
65 | ||
66 | /** |
|
67 | * Instruct the driver to remove the volume. |
@@ 131-147 (lines=17) @@ | ||
128 | * |
|
129 | * @return \Psr\Http\Message\ResponseInterface|\Docker\API\Model\Image |
|
130 | */ |
|
131 | 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. |
|
@@ 157-173 (lines=17) @@ | ||
154 | * |
|
155 | * @return \Psr\Http\Message\ResponseInterface|\Docker\API\Model\ImageHistoryItem[] |
|
156 | */ |
|
157 | 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. |
|
@@ 266-283 (lines=18) @@ | ||
263 | * |
|
264 | * @return \Psr\Http\Message\ResponseInterface|\Docker\API\Model\ImageSearchResult[] |
|
265 | */ |
|
266 | 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. |