Skip to content
This repository has been archived by the owner on Oct 26, 2019. It is now read-only.

Commit

Permalink
Fix build args and container volumes
Browse files Browse the repository at this point in the history
  • Loading branch information
joelwurtz committed Feb 28, 2018
1 parent 44713db commit 6591301
Show file tree
Hide file tree
Showing 11 changed files with 104 additions and 186 deletions.
13 changes: 6 additions & 7 deletions docker-swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -838,12 +838,11 @@ definitions:
Volumes:
description: "An object mapping mount point paths inside the container to empty objects."
type: "object"
properties:
additionalProperties:
type: "object"
enum:
- {}
default: {}
additionalProperties:
type: "object"
enum:
- {}
default: {}
WorkingDir:
description: "The working directory for commands to run in."
type: "string"
Expand Down Expand Up @@ -6161,7 +6160,7 @@ paths:
- name: "buildargs"
in: "query"
description: "JSON map of string pairs for build-time variables. Users pass these values at build-time. Docker uses the buildargs as the environment context for commands run via the `Dockerfile` RUN instruction, or for variable expansion in other `Dockerfile` instructions. This is not meant for passing secret values. [Read more about the buildargs instruction.](https://docs.docker.com/engine/reference/builder/#arg)"
type: "integer"
type: "string"
- name: "shmsize"
in: "query"
description: "Size of `/dev/shm` in bytes. The size must be greater than 0. If omitted the system uses 64MB."
Expand Down
2 changes: 1 addition & 1 deletion src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ public function imageList(array $queryParameters = [], string $fetch = self::FET
* @var string $cpusetcpus CPUs in which to allow execution (e.g., `0-3`, `0,1`).
* @var int $cpuperiod the length of a CPU period in microseconds
* @var int $cpuquota microseconds of CPU time that the container can get in a CPU period
* @var int $buildargs JSON map of string pairs for build-time variables. Users pass these values at build-time. Docker uses the buildargs as the environment context for commands run via the `Dockerfile` RUN instruction, or for variable expansion in other `Dockerfile` instructions. This is not meant for passing secret values. [Read more about the buildargs instruction.](https://docs.docker.com/engine/reference/builder/#arg)
* @var string $buildargs JSON map of string pairs for build-time variables. Users pass these values at build-time. Docker uses the buildargs as the environment context for commands run via the `Dockerfile` RUN instruction, or for variable expansion in other `Dockerfile` instructions. This is not meant for passing secret values. [Read more about the buildargs instruction.](https://docs.docker.com/engine/reference/builder/#arg)
* @var int $shmsize Size of `/dev/shm` in bytes. The size must be greater than 0. If omitted the system uses 64MB.
* @var bool $squash Squash the resulting images layers into a single layer. *(Experimental release only.)*
* @var string $labels arbitrary key/value labels to set on the image, as a JSON map of string pairs
Expand Down
2 changes: 1 addition & 1 deletion src/ClientAsync.php
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ public function imageList(array $queryParameters = [], string $fetch = self::FET
* @var string $cpusetcpus CPUs in which to allow execution (e.g., `0-3`, `0,1`).
* @var int $cpuperiod the length of a CPU period in microseconds
* @var int $cpuquota microseconds of CPU time that the container can get in a CPU period
* @var int $buildargs JSON map of string pairs for build-time variables. Users pass these values at build-time. Docker uses the buildargs as the environment context for commands run via the `Dockerfile` RUN instruction, or for variable expansion in other `Dockerfile` instructions. This is not meant for passing secret values. [Read more about the buildargs instruction.](https://docs.docker.com/engine/reference/builder/#arg)
* @var string $buildargs JSON map of string pairs for build-time variables. Users pass these values at build-time. Docker uses the buildargs as the environment context for commands run via the `Dockerfile` RUN instruction, or for variable expansion in other `Dockerfile` instructions. This is not meant for passing secret values. [Read more about the buildargs instruction.](https://docs.docker.com/engine/reference/builder/#arg)
* @var int $shmsize Size of `/dev/shm` in bytes. The size must be greater than 0. If omitted the system uses 64MB.
* @var bool $squash Squash the resulting images layers into a single layer. *(Experimental release only.)*
* @var string $labels arbitrary key/value labels to set on the image, as a JSON map of string pairs
Expand Down
4 changes: 2 additions & 2 deletions src/Endpoint/ImageBuild.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ImageBuild extends \Jane\OpenApiRuntime\Client\BaseEndpoint implements \Ja
* @var string $cpusetcpus CPUs in which to allow execution (e.g., `0-3`, `0,1`).
* @var int $cpuperiod the length of a CPU period in microseconds
* @var int $cpuquota microseconds of CPU time that the container can get in a CPU period
* @var int $buildargs JSON map of string pairs for build-time variables. Users pass these values at build-time. Docker uses the buildargs as the environment context for commands run via the `Dockerfile` RUN instruction, or for variable expansion in other `Dockerfile` instructions. This is not meant for passing secret values. [Read more about the buildargs instruction.](https://docs.docker.com/engine/reference/builder/#arg)
* @var string $buildargs JSON map of string pairs for build-time variables. Users pass these values at build-time. Docker uses the buildargs as the environment context for commands run via the `Dockerfile` RUN instruction, or for variable expansion in other `Dockerfile` instructions. This is not meant for passing secret values. [Read more about the buildargs instruction.](https://docs.docker.com/engine/reference/builder/#arg)
* @var int $shmsize Size of `/dev/shm` in bytes. The size must be greater than 0. If omitted the system uses 64MB.
* @var bool $squash Squash the resulting images layers into a single layer. *(Experimental release only.)*
* @var string $labels arbitrary key/value labels to set on the image, as a JSON map of string pairs
Expand Down Expand Up @@ -124,7 +124,7 @@ protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver
$optionsResolver->setAllowedTypes('cpusetcpus', ['string']);
$optionsResolver->setAllowedTypes('cpuperiod', ['int']);
$optionsResolver->setAllowedTypes('cpuquota', ['int']);
$optionsResolver->setAllowedTypes('buildargs', ['int']);
$optionsResolver->setAllowedTypes('buildargs', ['string']);
$optionsResolver->setAllowedTypes('shmsize', ['int']);
$optionsResolver->setAllowedTypes('squash', ['bool']);
$optionsResolver->setAllowedTypes('labels', ['string']);
Expand Down
10 changes: 5 additions & 5 deletions src/Model/ContainerConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class ContainerConfig
/**
* An object mapping mount point paths inside the container to empty objects.
*
* @var ContainerConfigVolumes
* @var mixed[]
*/
protected $volumes;
/**
Expand Down Expand Up @@ -538,21 +538,21 @@ public function setImage(?string $image): self
/**
* An object mapping mount point paths inside the container to empty objects.
*
* @return ContainerConfigVolumes
* @return mixed[]
*/
public function getVolumes(): ?ContainerConfigVolumes
public function getVolumes(): ?\ArrayObject
{
return $this->volumes;
}

/**
* An object mapping mount point paths inside the container to empty objects.
*
* @param ContainerConfigVolumes $volumes
* @param mixed[] $volumes
*
* @return self
*/
public function setVolumes(?ContainerConfigVolumes $volumes): self
public function setVolumes(?\ArrayObject $volumes): self
{
$this->volumes = $volumes;

Expand Down
39 changes: 0 additions & 39 deletions src/Model/ContainerConfigVolumes.php

This file was deleted.

10 changes: 5 additions & 5 deletions src/Model/ContainersCreatePostBody.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class ContainersCreatePostBody
/**
* An object mapping mount point paths inside the container to empty objects.
*
* @var ContainerConfigVolumes
* @var mixed[]
*/
protected $volumes;
/**
Expand Down Expand Up @@ -550,21 +550,21 @@ public function setImage(?string $image): self
/**
* An object mapping mount point paths inside the container to empty objects.
*
* @return ContainerConfigVolumes
* @return mixed[]
*/
public function getVolumes(): ?ContainerConfigVolumes
public function getVolumes(): ?\ArrayObject
{
return $this->volumes;
}

/**
* An object mapping mount point paths inside the container to empty objects.
*
* @param ContainerConfigVolumes $volumes
* @param mixed[] $volumes
*
* @return self
*/
public function setVolumes(?ContainerConfigVolumes $volumes): self
public function setVolumes(?\ArrayObject $volumes): self
{
$this->volumes = $volumes;

Expand Down
76 changes: 42 additions & 34 deletions src/Normalizer/ContainerConfigNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,21 @@ public function denormalize($data, $class, $format = null, array $context = [])
$object->setImage($data->{'Image'});
}
if (property_exists($data, 'Volumes') && $data->{'Volumes'} !== null) {
$object->setVolumes($this->denormalizer->denormalize($data->{'Volumes'}, 'Docker\\API\\Model\\ContainerConfigVolumes', 'json', $context));
$values_3 = new \ArrayObject([], \ArrayObject::ARRAY_AS_PROPS);
foreach ($data->{'Volumes'} as $key_1 => $value_3) {
$values_3[$key_1] = $value_3;
}
$object->setVolumes($values_3);
}
if (property_exists($data, 'WorkingDir') && $data->{'WorkingDir'} !== null) {
$object->setWorkingDir($data->{'WorkingDir'});
}
if (property_exists($data, 'Entrypoint') && $data->{'Entrypoint'} !== null) {
$values_3 = [];
foreach ($data->{'Entrypoint'} as $value_3) {
$values_3[] = $value_3;
$values_4 = [];
foreach ($data->{'Entrypoint'} as $value_4) {
$values_4[] = $value_4;
}
$object->setEntrypoint($values_3);
$object->setEntrypoint($values_4);
}
if (property_exists($data, 'NetworkDisabled') && $data->{'NetworkDisabled'} !== null) {
$object->setNetworkDisabled($data->{'NetworkDisabled'});
Expand All @@ -115,18 +119,18 @@ public function denormalize($data, $class, $format = null, array $context = [])
$object->setMacAddress($data->{'MacAddress'});
}
if (property_exists($data, 'OnBuild') && $data->{'OnBuild'} !== null) {
$values_4 = [];
foreach ($data->{'OnBuild'} as $value_4) {
$values_4[] = $value_4;
$values_5 = [];
foreach ($data->{'OnBuild'} as $value_5) {
$values_5[] = $value_5;
}
$object->setOnBuild($values_4);
$object->setOnBuild($values_5);
}
if (property_exists($data, 'Labels') && $data->{'Labels'} !== null) {
$values_5 = new \ArrayObject([], \ArrayObject::ARRAY_AS_PROPS);
foreach ($data->{'Labels'} as $key_1 => $value_5) {
$values_5[$key_1] = $value_5;
$values_6 = new \ArrayObject([], \ArrayObject::ARRAY_AS_PROPS);
foreach ($data->{'Labels'} as $key_2 => $value_6) {
$values_6[$key_2] = $value_6;
}
$object->setLabels($values_5);
$object->setLabels($values_6);
}
if (property_exists($data, 'StopSignal') && $data->{'StopSignal'} !== null) {
$object->setStopSignal($data->{'StopSignal'});
Expand All @@ -135,11 +139,11 @@ public function denormalize($data, $class, $format = null, array $context = [])
$object->setStopTimeout($data->{'StopTimeout'});
}
if (property_exists($data, 'Shell') && $data->{'Shell'} !== null) {
$values_6 = [];
foreach ($data->{'Shell'} as $value_6) {
$values_6[] = $value_6;
$values_7 = [];
foreach ($data->{'Shell'} as $value_7) {
$values_7[] = $value_7;
}
$object->setShell($values_6);
$object->setShell($values_7);
}

return $object;
Expand Down Expand Up @@ -206,17 +210,21 @@ public function normalize($object, $format = null, array $context = [])
$data->{'Image'} = $object->getImage();
}
if (null !== $object->getVolumes()) {
$data->{'Volumes'} = $this->normalizer->normalize($object->getVolumes(), 'json', $context);
$values_3 = new \stdClass();
foreach ($object->getVolumes() as $key_1 => $value_3) {
$values_3->{$key_1} = $value_3;
}
$data->{'Volumes'} = $values_3;
}
if (null !== $object->getWorkingDir()) {
$data->{'WorkingDir'} = $object->getWorkingDir();
}
if (null !== $object->getEntrypoint()) {
$values_3 = [];
foreach ($object->getEntrypoint() as $value_3) {
$values_3[] = $value_3;
$values_4 = [];
foreach ($object->getEntrypoint() as $value_4) {
$values_4[] = $value_4;
}
$data->{'Entrypoint'} = $values_3;
$data->{'Entrypoint'} = $values_4;
}
if (null !== $object->getNetworkDisabled()) {
$data->{'NetworkDisabled'} = $object->getNetworkDisabled();
Expand All @@ -225,18 +233,18 @@ public function normalize($object, $format = null, array $context = [])
$data->{'MacAddress'} = $object->getMacAddress();
}
if (null !== $object->getOnBuild()) {
$values_4 = [];
foreach ($object->getOnBuild() as $value_4) {
$values_4[] = $value_4;
$values_5 = [];
foreach ($object->getOnBuild() as $value_5) {
$values_5[] = $value_5;
}
$data->{'OnBuild'} = $values_4;
$data->{'OnBuild'} = $values_5;
}
if (null !== $object->getLabels()) {
$values_5 = new \stdClass();
foreach ($object->getLabels() as $key_1 => $value_5) {
$values_5->{$key_1} = $value_5;
$values_6 = new \stdClass();
foreach ($object->getLabels() as $key_2 => $value_6) {
$values_6->{$key_2} = $value_6;
}
$data->{'Labels'} = $values_5;
$data->{'Labels'} = $values_6;
}
if (null !== $object->getStopSignal()) {
$data->{'StopSignal'} = $object->getStopSignal();
Expand All @@ -245,11 +253,11 @@ public function normalize($object, $format = null, array $context = [])
$data->{'StopTimeout'} = $object->getStopTimeout();
}
if (null !== $object->getShell()) {
$values_6 = [];
foreach ($object->getShell() as $value_6) {
$values_6[] = $value_6;
$values_7 = [];
foreach ($object->getShell() as $value_7) {
$values_7[] = $value_7;
}
$data->{'Shell'} = $values_6;
$data->{'Shell'} = $values_7;
}

return $data;
Expand Down
57 changes: 0 additions & 57 deletions src/Normalizer/ContainerConfigVolumesNormalizer.php

This file was deleted.

Loading

0 comments on commit 6591301

Please sign in to comment.