Пример #1
0
 /**
  * Push the image name on the registry.
  *
  * @param string $name       Image name or id
  * @param array  $parameters List of parameters
  * 
  *     (string)tag: The tag to associate with the image on the registry.
  *     (string)X-Registry-Auth: A base64-encoded AuthConfig object
  * @param string $fetch Fetch mode (object or response)
  *
  * @return \Psr\Http\Message\ResponseInterface
  */
 public function push($name, $parameters = [], $fetch = self::FETCH_OBJECT)
 {
     $queryParam = new QueryParam();
     $queryParam->setDefault('tag', null);
     $queryParam->setRequired('X-Registry-Auth');
     $queryParam->setHeaderParameters(['X-Registry-Auth']);
     $url = '/images/{name}/push';
     $url = str_replace('{name}', $name, $url);
     $url = $url . ('?' . $queryParam->buildQueryString($parameters));
     $headers = array_merge(['Host' => 'localhost'], $queryParam->buildHeaders($parameters));
     $body = $queryParam->buildFormDataString($parameters);
     $request = $this->messageFactory->createRequest('POST', $url, $headers, $body);
     $response = $this->httpClient->sendRequest($request);
     return $response;
 }
Пример #2
0
 /**
  * Upload a tar archive to be extracted to a path in the filesystem of container id.
  *
  * @param string $id          The container id or name
  * @param string $inputStream The input stream must be a tar archive compressed with one of the following algorithms: identity (no compression), gzip, bzip2, xz.
  * @param array  $parameters  List of parameters
  * 
  *     (string)path: Path to a directory in the container to extract the archive’s contents into. 
  *     (string)noOverwriteDirNonDir: If “1”, “true”, or “True” then it will be an error if unpacking the given content would cause an existing directory to be replaced with a non-directory and vice versa.
  * @param string $fetch Fetch mode (object or response)
  *
  * @return \Psr\Http\Message\ResponseInterface
  */
 public function putArchive($id, $inputStream, $parameters = [], $fetch = self::FETCH_OBJECT)
 {
     $queryParam = new QueryParam();
     $queryParam->setRequired('path');
     $queryParam->setDefault('noOverwriteDirNonDir', null);
     $url = '/containers/{id}/archive';
     $url = str_replace('{id}', $id, $url);
     $url = $url . ('?' . $queryParam->buildQueryString($parameters));
     $headers = array_merge(['Host' => 'localhost'], $queryParam->buildHeaders($parameters));
     $body = $inputStream;
     $request = $this->messageFactory->createRequest('PUT', $url, $headers, $body);
     $response = $this->httpClient->sendRequest($request);
     return $response;
 }