@@ 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 = '/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. |
|
@@ 473-490 (lines=18) @@ | ||
470 | * |
|
471 | * @return \Psr\Http\Message\ResponseInterface |
|
472 | */ |
|
473 | public function attach($id, $parameters = [], $fetch = self::FETCH_OBJECT) |
|
474 | { |
|
475 | $queryParam = new QueryParam(); |
|
476 | $queryParam->setDefault('logs', null); |
|
477 | $queryParam->setDefault('stream', null); |
|
478 | $queryParam->setDefault('stdin', null); |
|
479 | $queryParam->setDefault('stdout', null); |
|
480 | $queryParam->setDefault('stderr', null); |
|
481 | $url = '/containers/{id}/attach'; |
|
482 | $url = str_replace('{id}', $id, $url); |
|
483 | $url = $url . ('?' . $queryParam->buildQueryString($parameters)); |
|
484 | $headers = array_merge(['Host' => 'localhost'], $queryParam->buildHeaders($parameters)); |
|
485 | $body = $queryParam->buildFormDataString($parameters); |
|
486 | $request = $this->messageFactory->createRequest('POST', $url, $headers, $body); |
|
487 | $response = $this->httpClient->sendRequest($request); |
|
488 | ||
489 | return $response; |
|
490 | } |
|
491 | ||
492 | /** |
|
493 | * Attach to the container id with a websocket. |
|
@@ 507-524 (lines=18) @@ | ||
504 | * |
|
505 | * @return \Psr\Http\Message\ResponseInterface |
|
506 | */ |
|
507 | public function attachWebsocket($id, $parameters = [], $fetch = self::FETCH_OBJECT) |
|
508 | { |
|
509 | $queryParam = new QueryParam(); |
|
510 | $queryParam->setDefault('logs', null); |
|
511 | $queryParam->setDefault('stream', null); |
|
512 | $queryParam->setDefault('stdin', null); |
|
513 | $queryParam->setDefault('stdout', null); |
|
514 | $queryParam->setDefault('stderr', null); |
|
515 | $url = '/containers/{id}/attach/ws'; |
|
516 | $url = str_replace('{id}', $id, $url); |
|
517 | $url = $url . ('?' . $queryParam->buildQueryString($parameters)); |
|
518 | $headers = array_merge(['Host' => 'localhost'], $queryParam->buildHeaders($parameters)); |
|
519 | $body = $queryParam->buildFormDataString($parameters); |
|
520 | $request = $this->messageFactory->createRequest('GET', $url, $headers, $body); |
|
521 | $response = $this->httpClient->sendRequest($request); |
|
522 | ||
523 | return $response; |
|
524 | } |
|
525 | ||
526 | /** |
|
527 | * Block until container id stops, then returns the exit code. |