Skip to content

Commit 8e37022

Browse files
Update generated code (#2125)
* update generated code * Apply suggestion from @jderusse --------- Co-authored-by: Jérémy Derussé <jeremy@derusse.com>
1 parent a2e8dd4 commit 8e37022

8 files changed

Lines changed: 110 additions & 1 deletion

‎CHANGELOG.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## NOT RELEASED
44

5+
### Added
6+
7+
- AWS api-change: Added a deploymentMode parameter to CreateDeployment. Set it to RESTART to restart an EC2 and on-premises fleet, using the last successful revision, honoring Deployment Configuration.
8+
59
## 2.4.2
610

711
### Fixed

‎composer.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
},
3333
"extra": {
3434
"branch-alias": {
35-
"dev-master": "2.4-dev"
35+
"dev-master": "2.5-dev"
3636
}
3737
}
3838
}

‎src/CodeDeployClient.php‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace AsyncAws\CodeDeploy;
44

5+
use AsyncAws\CodeDeploy\Enum\DeploymentMode;
56
use AsyncAws\CodeDeploy\Enum\FileExistsBehavior;
67
use AsyncAws\CodeDeploy\Enum\LifecycleEventStatus;
78
use AsyncAws\CodeDeploy\Exception\AlarmsLimitExceededException;
@@ -18,12 +19,15 @@
1819
use AsyncAws\CodeDeploy\Exception\InvalidApplicationNameException;
1920
use AsyncAws\CodeDeploy\Exception\InvalidAutoRollbackConfigException;
2021
use AsyncAws\CodeDeploy\Exception\InvalidAutoScalingGroupException;
22+
use AsyncAws\CodeDeploy\Exception\InvalidComputePlatformException;
2123
use AsyncAws\CodeDeploy\Exception\InvalidDeploymentConfigNameException;
2224
use AsyncAws\CodeDeploy\Exception\InvalidDeploymentGroupNameException;
2325
use AsyncAws\CodeDeploy\Exception\InvalidDeploymentIdException;
26+
use AsyncAws\CodeDeploy\Exception\InvalidECSServiceException;
2427
use AsyncAws\CodeDeploy\Exception\InvalidFileExistsBehaviorException;
2528
use AsyncAws\CodeDeploy\Exception\InvalidGitHubAccountTokenException;
2629
use AsyncAws\CodeDeploy\Exception\InvalidIgnoreApplicationStopFailuresValueException;
30+
use AsyncAws\CodeDeploy\Exception\InvalidInputException;
2731
use AsyncAws\CodeDeploy\Exception\InvalidLifecycleEventHookExecutionIdException;
2832
use AsyncAws\CodeDeploy\Exception\InvalidLifecycleEventHookExecutionStatusException;
2933
use AsyncAws\CodeDeploy\Exception\InvalidLoadBalancerInfoException;
@@ -72,6 +76,7 @@ class CodeDeployClient extends AbstractApi
7276
* autoRollbackConfiguration?: AutoRollbackConfiguration|array|null,
7377
* updateOutdatedInstancesOnly?: bool|null,
7478
* fileExistsBehavior?: FileExistsBehavior::*|null,
79+
* deploymentMode?: DeploymentMode::*|null,
7580
* overrideAlarmConfiguration?: AlarmConfiguration|array|null,
7681
* '@region'?: string|null,
7782
* }|CreateDeploymentInput $input
@@ -88,11 +93,14 @@ class CodeDeployClient extends AbstractApi
8893
* @throws InvalidApplicationNameException
8994
* @throws InvalidAutoRollbackConfigException
9095
* @throws InvalidAutoScalingGroupException
96+
* @throws InvalidComputePlatformException
9197
* @throws InvalidDeploymentConfigNameException
9298
* @throws InvalidDeploymentGroupNameException
99+
* @throws InvalidECSServiceException
93100
* @throws InvalidFileExistsBehaviorException
94101
* @throws InvalidGitHubAccountTokenException
95102
* @throws InvalidIgnoreApplicationStopFailuresValueException
103+
* @throws InvalidInputException
96104
* @throws InvalidLoadBalancerInfoException
97105
* @throws InvalidRevisionException
98106
* @throws InvalidRoleException
@@ -119,11 +127,14 @@ public function createDeployment($input): CreateDeploymentOutput
119127
'InvalidApplicationNameException' => InvalidApplicationNameException::class,
120128
'InvalidAutoRollbackConfigException' => InvalidAutoRollbackConfigException::class,
121129
'InvalidAutoScalingGroupException' => InvalidAutoScalingGroupException::class,
130+
'InvalidComputePlatformException' => InvalidComputePlatformException::class,
122131
'InvalidDeploymentConfigNameException' => InvalidDeploymentConfigNameException::class,
123132
'InvalidDeploymentGroupNameException' => InvalidDeploymentGroupNameException::class,
133+
'InvalidECSServiceException' => InvalidECSServiceException::class,
124134
'InvalidFileExistsBehaviorException' => InvalidFileExistsBehaviorException::class,
125135
'InvalidGitHubAccountTokenException' => InvalidGitHubAccountTokenException::class,
126136
'InvalidIgnoreApplicationStopFailuresValueException' => InvalidIgnoreApplicationStopFailuresValueException::class,
137+
'InvalidInputException' => InvalidInputException::class,
127138
'InvalidLoadBalancerInfoException' => InvalidLoadBalancerInfoException::class,
128139
'InvalidRevisionException' => InvalidRevisionException::class,
129140
'InvalidRoleException' => InvalidRoleException::class,

‎src/Enum/DeploymentMode.php‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
namespace AsyncAws\CodeDeploy\Enum;
4+
5+
final class DeploymentMode
6+
{
7+
public const RESTART = 'RESTART';
8+
public const STANDARD = 'STANDARD';
9+
10+
/**
11+
* @psalm-assert-if-true self::* $value
12+
*/
13+
public static function exists(string $value): bool
14+
{
15+
return isset([
16+
self::RESTART => true,
17+
self::STANDARD => true,
18+
][$value]);
19+
}
20+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
namespace AsyncAws\CodeDeploy\Exception;
4+
5+
use AsyncAws\Core\Exception\Http\ClientException;
6+
7+
/**
8+
* The computePlatform is invalid. The computePlatform should be `Lambda`, `Server`, or `ECS`.
9+
*/
10+
final class InvalidComputePlatformException extends ClientException
11+
{
12+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
namespace AsyncAws\CodeDeploy\Exception;
4+
5+
use AsyncAws\Core\Exception\Http\ClientException;
6+
7+
/**
8+
* The Amazon ECS service identifier is not valid.
9+
*/
10+
final class InvalidECSServiceException extends ClientException
11+
{
12+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
namespace AsyncAws\CodeDeploy\Exception;
4+
5+
use AsyncAws\Core\Exception\Http\ClientException;
6+
7+
/**
8+
* The input was specified in an invalid format.
9+
*/
10+
final class InvalidInputException extends ClientException
11+
{
12+
}

‎src/Input/CreateDeploymentInput.php‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace AsyncAws\CodeDeploy\Input;
44

5+
use AsyncAws\CodeDeploy\Enum\DeploymentMode;
56
use AsyncAws\CodeDeploy\Enum\FileExistsBehavior;
67
use AsyncAws\CodeDeploy\ValueObject\AlarmConfiguration;
78
use AsyncAws\CodeDeploy\ValueObject\AutoRollbackConfiguration;
@@ -118,6 +119,15 @@ final class CreateDeploymentInput extends Input
118119
*/
119120
private $fileExistsBehavior;
120121

122+
/**
123+
* The deployment mode to use for the deployment. When set to STANDARD (the default), the deployment runs the standard
124+
* set of deployment lifecycle events. When set to RESTART, an EC2/On-premises in-place deployment runs a shortened set
125+
* of lifecycle events to quickly restart the application on the target instances.
126+
*
127+
* @var DeploymentMode::*|null
128+
*/
129+
private $deploymentMode;
130+
121131
/**
122132
* Allows you to specify information about alarms associated with a deployment. The alarm configuration that you specify
123133
* here will override the alarm configuration at the deployment group level. Consider overriding the alarm configuration
@@ -145,6 +155,7 @@ final class CreateDeploymentInput extends Input
145155
* autoRollbackConfiguration?: AutoRollbackConfiguration|array|null,
146156
* updateOutdatedInstancesOnly?: bool|null,
147157
* fileExistsBehavior?: FileExistsBehavior::*|null,
158+
* deploymentMode?: DeploymentMode::*|null,
148159
* overrideAlarmConfiguration?: AlarmConfiguration|array|null,
149160
* '@region'?: string|null,
150161
* } $input
@@ -161,6 +172,7 @@ public function __construct(array $input = [])
161172
$this->autoRollbackConfiguration = isset($input['autoRollbackConfiguration']) ? AutoRollbackConfiguration::create($input['autoRollbackConfiguration']) : null;
162173
$this->updateOutdatedInstancesOnly = $input['updateOutdatedInstancesOnly'] ?? null;
163174
$this->fileExistsBehavior = $input['fileExistsBehavior'] ?? null;
175+
$this->deploymentMode = $input['deploymentMode'] ?? null;
164176
$this->overrideAlarmConfiguration = isset($input['overrideAlarmConfiguration']) ? AlarmConfiguration::create($input['overrideAlarmConfiguration']) : null;
165177
parent::__construct($input);
166178
}
@@ -177,6 +189,7 @@ public function __construct(array $input = [])
177189
* autoRollbackConfiguration?: AutoRollbackConfiguration|array|null,
178190
* updateOutdatedInstancesOnly?: bool|null,
179191
* fileExistsBehavior?: FileExistsBehavior::*|null,
192+
* deploymentMode?: DeploymentMode::*|null,
180193
* overrideAlarmConfiguration?: AlarmConfiguration|array|null,
181194
* '@region'?: string|null,
182195
* }|CreateDeploymentInput $input
@@ -206,6 +219,14 @@ public function getDeploymentGroupName(): ?string
206219
return $this->deploymentGroupName;
207220
}
208221

222+
/**
223+
* @return DeploymentMode::*|null
224+
*/
225+
public function getDeploymentMode(): ?string
226+
{
227+
return $this->deploymentMode;
228+
}
229+
209230
public function getDescription(): ?string
210231
{
211232
return $this->description;
@@ -298,6 +319,16 @@ public function setDeploymentGroupName(?string $value): self
298319
return $this;
299320
}
300321

322+
/**
323+
* @param DeploymentMode::*|null $value
324+
*/
325+
public function setDeploymentMode(?string $value): self
326+
{
327+
$this->deploymentMode = $value;
328+
329+
return $this;
330+
}
331+
301332
public function setDescription(?string $value): self
302333
{
303334
$this->description = $value;
@@ -388,6 +419,13 @@ private function requestBody(): array
388419
}
389420
$payload['fileExistsBehavior'] = $v;
390421
}
422+
if (null !== $v = $this->deploymentMode) {
423+
if (!DeploymentMode::exists($v)) {
424+
/** @psalm-suppress NoValue */
425+
throw new InvalidArgument(\sprintf('Invalid parameter "deploymentMode" for "%s". The value "%s" is not a valid "DeploymentMode".', __CLASS__, $v));
426+
}
427+
$payload['deploymentMode'] = $v;
428+
}
391429
if (null !== $v = $this->overrideAlarmConfiguration) {
392430
$payload['overrideAlarmConfiguration'] = $v->requestBody();
393431
}

0 commit comments

Comments
 (0)