Skip to content

Commit

Permalink
Fix endpoint without region (#880)
Browse files Browse the repository at this point in the history
* Fix endpoint without region

* Fixed tests

* cs fix

Co-authored-by: Nyholm <[email protected]>
  • Loading branch information
jderusse and Nyholm authored Nov 26, 2020
1 parent 2516545 commit a7e48a3
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions src/SesClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use AsyncAws\Core\AbstractApi;
use AsyncAws\Core\Configuration;
use AsyncAws\Core\Exception\UnsupportedRegion;
use AsyncAws\Core\RequestContext;
use AsyncAws\Ses\Input\SendEmailRequest;
use AsyncAws\Ses\Result\SendEmailResponse;
Expand Down Expand Up @@ -50,18 +49,6 @@ protected function getEndpointMetadata(?string $region): array
}

switch ($region) {
case 'ap-south-1':
case 'ap-southeast-2':
case 'eu-central-1':
case 'eu-west-1':
case 'us-east-1':
case 'us-west-2':
return [
'endpoint' => "https://email.$region.amazonaws.com",
'signRegion' => $region,
'signService' => 'ses',
'signVersions' => ['v4'],
];
case 'us-gov-west-1':
return [
'endpoint' => "https://email.$region.amazonaws.com",
Expand All @@ -78,7 +65,12 @@ protected function getEndpointMetadata(?string $region): array
];
}

throw new UnsupportedRegion(sprintf('The region "%s" is not supported by "Ses".', $region));
return [
'endpoint' => "https://email.$region.amazonaws.com",
'signRegion' => $region,
'signService' => 'ses',
'signVersions' => ['v4'],
];
}

protected function getServiceCode(): string
Expand Down

0 comments on commit a7e48a3

Please sign in to comment.