Skip to content

Commit a0b3387

Browse files
Update generated code (#1741)
* update generated code * Update src/Service/StepFunctions/CHANGELOG.md --------- Co-authored-by: Jérémy Derussé <jeremy@derusse.com>
1 parent 33500ac commit a0b3387

7 files changed

+127
-1
lines changed

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 `KmsAccessDeniedException`, `KmsInvalidStateException` and `KmsThrottlingException` exceptions
8+
59
## 1.2.3
610

711
### Changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
},
2828
"extra": {
2929
"branch-alias": {
30-
"dev-master": "1.2-dev"
30+
"dev-master": "1.3-dev"
3131
}
3232
}
3333
}

src/Enum/KmsKeyState.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
namespace AsyncAws\StepFunctions\Enum;
4+
5+
final class KmsKeyState
6+
{
7+
public const CREATING = 'CREATING';
8+
public const DISABLED = 'DISABLED';
9+
public const PENDING_DELETION = 'PENDING_DELETION';
10+
public const PENDING_IMPORT = 'PENDING_IMPORT';
11+
public const UNAVAILABLE = 'UNAVAILABLE';
12+
13+
public static function exists(string $value): bool
14+
{
15+
return isset([
16+
self::CREATING => true,
17+
self::DISABLED => true,
18+
self::PENDING_DELETION => true,
19+
self::PENDING_IMPORT => true,
20+
self::UNAVAILABLE => true,
21+
][$value]);
22+
}
23+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
namespace AsyncAws\StepFunctions\Exception;
4+
5+
use AsyncAws\Core\Exception\Http\ClientException;
6+
7+
/**
8+
* Either your KMS key policy or API caller does not have the required permissions.
9+
*/
10+
final class KmsAccessDeniedException extends ClientException
11+
{
12+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
namespace AsyncAws\StepFunctions\Exception;
4+
5+
use AsyncAws\Core\Exception\Http\ClientException;
6+
use AsyncAws\StepFunctions\Enum\KmsKeyState;
7+
use Symfony\Contracts\HttpClient\ResponseInterface;
8+
9+
/**
10+
* The KMS key is not in valid state, for example: Disabled or Deleted.
11+
*/
12+
final class KmsInvalidStateException extends ClientException
13+
{
14+
/**
15+
* Current status of the KMS; key. For example: `DISABLED`, `PENDING_DELETION`, `PENDING_IMPORT`, `UNAVAILABLE`,
16+
* `CREATING`.
17+
*
18+
* @var KmsKeyState::*|null
19+
*/
20+
private $kmsKeyState;
21+
22+
/**
23+
* @return KmsKeyState::*|null
24+
*/
25+
public function getKmsKeyState(): ?string
26+
{
27+
return $this->kmsKeyState;
28+
}
29+
30+
protected function populateResult(ResponseInterface $response): void
31+
{
32+
$data = $response->toArray(false);
33+
34+
$this->kmsKeyState = isset($data['kmsKeyState']) ? (string) $data['kmsKeyState'] : null;
35+
}
36+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
namespace AsyncAws\StepFunctions\Exception;
4+
5+
use AsyncAws\Core\Exception\Http\ClientException;
6+
7+
/**
8+
* Received when KMS returns `ThrottlingException` for a KMS call that Step Functions makes on behalf of the caller.
9+
*/
10+
final class KmsThrottlingException extends ClientException
11+
{
12+
}

src/StepFunctionsClient.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
use AsyncAws\StepFunctions\Exception\InvalidNameException;
1616
use AsyncAws\StepFunctions\Exception\InvalidOutputException;
1717
use AsyncAws\StepFunctions\Exception\InvalidTokenException;
18+
use AsyncAws\StepFunctions\Exception\KmsAccessDeniedException;
19+
use AsyncAws\StepFunctions\Exception\KmsInvalidStateException;
20+
use AsyncAws\StepFunctions\Exception\KmsThrottlingException;
1821
use AsyncAws\StepFunctions\Exception\StateMachineDeletingException;
1922
use AsyncAws\StepFunctions\Exception\StateMachineDoesNotExistException;
2023
use AsyncAws\StepFunctions\Exception\TaskDoesNotExistException;
@@ -37,6 +40,12 @@ class StepFunctionsClient extends AbstractApi
3740
* Used by activity workers, Task states using the callback [^1] pattern, and optionally Task states using the job run
3841
* [^2] pattern to report that the task identified by the `taskToken` failed.
3942
*
43+
* For an execution with encryption enabled, Step Functions will encrypt the error and cause fields using the KMS key
44+
* for the execution role.
45+
*
46+
* A caller can mark a task as fail without using any KMS permissions in the execution role if the caller provides a
47+
* null value for both `error` and `cause` fields because no data needs to be encrypted.
48+
*
4049
* [^1]: https://docs.aws.amazon.com/step-functions/latest/dg/connect-to-resource.html#connect-wait-token
4150
* [^2]: https://docs.aws.amazon.com/step-functions/latest/dg/connect-to-resource.html#connect-sync
4251
*
@@ -53,6 +62,9 @@ class StepFunctionsClient extends AbstractApi
5362
* @throws TaskDoesNotExistException
5463
* @throws InvalidTokenException
5564
* @throws TaskTimedOutException
65+
* @throws KmsAccessDeniedException
66+
* @throws KmsInvalidStateException
67+
* @throws KmsThrottlingException
5668
*/
5769
public function sendTaskFailure($input): SendTaskFailureOutput
5870
{
@@ -61,6 +73,9 @@ public function sendTaskFailure($input): SendTaskFailureOutput
6173
'TaskDoesNotExist' => TaskDoesNotExistException::class,
6274
'InvalidToken' => InvalidTokenException::class,
6375
'TaskTimedOut' => TaskTimedOutException::class,
76+
'KmsAccessDeniedException' => KmsAccessDeniedException::class,
77+
'KmsInvalidStateException' => KmsInvalidStateException::class,
78+
'KmsThrottlingException' => KmsThrottlingException::class,
6479
]]));
6580

6681
return new SendTaskFailureOutput($response);
@@ -127,6 +142,9 @@ public function sendTaskHeartbeat($input): SendTaskHeartbeatOutput
127142
* @throws InvalidOutputException
128143
* @throws InvalidTokenException
129144
* @throws TaskTimedOutException
145+
* @throws KmsAccessDeniedException
146+
* @throws KmsInvalidStateException
147+
* @throws KmsThrottlingException
130148
*/
131149
public function sendTaskSuccess($input): SendTaskSuccessOutput
132150
{
@@ -136,6 +154,9 @@ public function sendTaskSuccess($input): SendTaskSuccessOutput
136154
'InvalidOutput' => InvalidOutputException::class,
137155
'InvalidToken' => InvalidTokenException::class,
138156
'TaskTimedOut' => TaskTimedOutException::class,
157+
'KmsAccessDeniedException' => KmsAccessDeniedException::class,
158+
'KmsInvalidStateException' => KmsInvalidStateException::class,
159+
'KmsThrottlingException' => KmsThrottlingException::class,
139160
]]));
140161

141162
return new SendTaskSuccessOutput($response);
@@ -203,6 +224,9 @@ public function sendTaskSuccess($input): SendTaskSuccessOutput
203224
* @throws StateMachineDoesNotExistException
204225
* @throws StateMachineDeletingException
205226
* @throws ValidationException
227+
* @throws KmsAccessDeniedException
228+
* @throws KmsInvalidStateException
229+
* @throws KmsThrottlingException
206230
*/
207231
public function startExecution($input): StartExecutionOutput
208232
{
@@ -216,6 +240,9 @@ public function startExecution($input): StartExecutionOutput
216240
'StateMachineDoesNotExist' => StateMachineDoesNotExistException::class,
217241
'StateMachineDeleting' => StateMachineDeletingException::class,
218242
'ValidationException' => ValidationException::class,
243+
'KmsAccessDeniedException' => KmsAccessDeniedException::class,
244+
'KmsInvalidStateException' => KmsInvalidStateException::class,
245+
'KmsThrottlingException' => KmsThrottlingException::class,
219246
]]));
220247

221248
return new StartExecutionOutput($response);
@@ -226,6 +253,12 @@ public function startExecution($input): StartExecutionOutput
226253
*
227254
* This API action is not supported by `EXPRESS` state machines.
228255
*
256+
* For an execution with encryption enabled, Step Functions will encrypt the error and cause fields using the KMS key
257+
* for the execution role.
258+
*
259+
* A caller can stop an execution without using any KMS permissions in the execution role if the caller provides a null
260+
* value for both `error` and `cause` fields because no data needs to be encrypted.
261+
*
229262
* @see https://docs.aws.amazon.com/step-functions/latest/apireference/API_StopExecution.html
230263
* @see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-states-2016-11-23.html#stopexecution
231264
*
@@ -239,6 +272,9 @@ public function startExecution($input): StartExecutionOutput
239272
* @throws ExecutionDoesNotExistException
240273
* @throws InvalidArnException
241274
* @throws ValidationException
275+
* @throws KmsAccessDeniedException
276+
* @throws KmsInvalidStateException
277+
* @throws KmsThrottlingException
242278
*/
243279
public function stopExecution($input): StopExecutionOutput
244280
{
@@ -247,6 +283,9 @@ public function stopExecution($input): StopExecutionOutput
247283
'ExecutionDoesNotExist' => ExecutionDoesNotExistException::class,
248284
'InvalidArn' => InvalidArnException::class,
249285
'ValidationException' => ValidationException::class,
286+
'KmsAccessDeniedException' => KmsAccessDeniedException::class,
287+
'KmsInvalidStateException' => KmsInvalidStateException::class,
288+
'KmsThrottlingException' => KmsThrottlingException::class,
250289
]]));
251290

252291
return new StopExecutionOutput($response);

0 commit comments

Comments
 (0)