Skip to content

Commit 189cfdc

Browse files
Implement KMS client (#1161)
* Implement KMS client * Added `ListAliases` * Fixed docs * Added CreateKey / CreateAlias and functionnal tests Co-authored-by: Jérémy Derussé <[email protected]>
1 parent a65dc75 commit 189cfdc

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
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+
- Support for KMS
8+
59
## 1.13.0
610

711
### Added

src/AbstractApi.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ protected function getAwsErrorFactory(): AwsErrorFactoryInterface
200200
*/
201201
protected function getEndpointMetadata(?string $region): array
202202
{
203+
/** @psalm-suppress TooManyArguments */
203204
trigger_deprecation('async-aws/core', '1.2', 'Extending "%s"" without overriding "%s" is deprecated. This method will be abstract in version 2.0.', __CLASS__, __FUNCTION__);
204205

205206
/** @var string $endpoint */
@@ -238,6 +239,7 @@ protected function getEndpoint(string $uri, array $query, ?string $region): stri
238239
}
239240

240241
if (false !== strpos($endpoint, '%region%') || false !== strpos($endpoint, '%service%')) {
242+
/** @psalm-suppress TooManyArguments */
241243
trigger_deprecation('async-aws/core', '1.2', 'providing an endpoint with placeholder is deprecated and will be ignored in version 2.0. Provide full endpoint instead.');
242244

243245
$endpoint = strtr($endpoint, [

src/AwsClientFactory.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
use AsyncAws\Firehose\FirehoseClient;
2525
use AsyncAws\Iam\IamClient;
2626
use AsyncAws\Kinesis\KinesisClient;
27+
use AsyncAws\Kms\KmsClient;
2728
use AsyncAws\Lambda\LambdaClient;
2829
use AsyncAws\RdsDataService\RdsDataServiceClient;
2930
use AsyncAws\Rekognition\RekognitionClient;
@@ -259,6 +260,19 @@ public function kinesis(): KinesisClient
259260
return $this->serviceCache[__METHOD__];
260261
}
261262

263+
public function kms(): KmsClient
264+
{
265+
if (!class_exists(KmsClient::class)) {
266+
throw MissingDependency::create('aws/kms', 'Kms');
267+
}
268+
269+
if (!isset($this->serviceCache[__METHOD__])) {
270+
$this->serviceCache[__METHOD__] = new KmsClient($this->configuration, $this->credentialProvider, $this->httpClient, $this->logger);
271+
}
272+
273+
return $this->serviceCache[__METHOD__];
274+
}
275+
262276
public function lambda(): LambdaClient
263277
{
264278
if (!class_exists(LambdaClient::class)) {

0 commit comments

Comments
 (0)