@@ 157-175 (lines=19) @@ | ||
154 | * |
|
155 | * @return \Psr\Http\Message\ResponseInterface |
|
156 | */ |
|
157 | public function logs($id, $parameters = [], $fetch = self::FETCH_OBJECT) |
|
158 | { |
|
159 | $queryParam = new QueryParam(); |
|
160 | $queryParam->setDefault('follow', false); |
|
161 | $queryParam->setDefault('stdout', false); |
|
162 | $queryParam->setDefault('stderr', false); |
|
163 | $queryParam->setDefault('since', 0); |
|
164 | $queryParam->setDefault('timestamps', false); |
|
165 | $queryParam->setDefault('tail', null); |
|
166 | $url = '/v1.21/containers/{id}/logs'; |
|
167 | $url = str_replace('{id}', $id, $url); |
|
168 | $url = $url . ('?' . $queryParam->buildQueryString($parameters)); |
|
169 | $headers = array_merge(['Host' => 'localhost'], $queryParam->buildHeaders($parameters)); |
|
170 | $body = $queryParam->buildFormDataString($parameters); |
|
171 | $request = $this->messageFactory->createRequest('GET', $url, $headers, $body); |
|
172 | $response = $this->httpClient->sendRequest($request); |
|
173 | ||
174 | return $response; |
|
175 | } |
|
176 | ||
177 | /** |
|
178 | * Inspect changes on a container’s filesystem. |
|
@@ 470-487 (lines=18) @@ | ||
467 | * |
|
468 | * @return \Psr\Http\Message\ResponseInterface |
|
469 | */ |
|
470 | public function attach($id, $parameters = [], $fetch = self::FETCH_OBJECT) |
|
471 | { |
|
472 | $queryParam = new QueryParam(); |
|
473 | $queryParam->setDefault('logs', null); |
|
474 | $queryParam->setDefault('stream', null); |
|
475 | $queryParam->setDefault('stdin', null); |
|
476 | $queryParam->setDefault('stdout', null); |
|
477 | $queryParam->setDefault('stderr', null); |
|
478 | $url = '/v1.21/containers/{id}/attach'; |
|
479 | $url = str_replace('{id}', $id, $url); |
|
480 | $url = $url . ('?' . $queryParam->buildQueryString($parameters)); |
|
481 | $headers = array_merge(['Host' => 'localhost'], $queryParam->buildHeaders($parameters)); |
|
482 | $body = $queryParam->buildFormDataString($parameters); |
|
483 | $request = $this->messageFactory->createRequest('POST', $url, $headers, $body); |
|
484 | $response = $this->httpClient->sendRequest($request); |
|
485 | ||
486 | return $response; |
|
487 | } |
|
488 | ||
489 | /** |
|
490 | * Block until container id stops, then returns the exit code. |