|
6 | 6 | use AsyncAws\Core\AwsError\AwsErrorFactoryInterface; |
7 | 7 | use AsyncAws\Core\AwsError\JsonRpcAwsErrorFactory; |
8 | 8 | use AsyncAws\Core\Configuration; |
| 9 | +use AsyncAws\Core\Exception\UnsupportedRegion; |
9 | 10 | use AsyncAws\Core\RequestContext; |
10 | 11 | use AsyncAws\Translate\Exception\DetectedLanguageLowConfidenceException; |
11 | 12 | use AsyncAws\Translate\Exception\InternalServerException; |
@@ -77,6 +78,29 @@ protected function getEndpointMetadata(?string $region): array |
77 | 78 | } |
78 | 79 |
|
79 | 80 | switch ($region) { |
| 81 | + case 'ap-east-1': |
| 82 | + case 'ap-northeast-1': |
| 83 | + case 'ap-northeast-2': |
| 84 | + case 'ap-south-1': |
| 85 | + case 'ap-southeast-1': |
| 86 | + case 'ap-southeast-2': |
| 87 | + case 'ca-central-1': |
| 88 | + case 'eu-central-1': |
| 89 | + case 'eu-north-1': |
| 90 | + case 'eu-west-1': |
| 91 | + case 'eu-west-2': |
| 92 | + case 'eu-west-3': |
| 93 | + case 'us-east-1': |
| 94 | + case 'us-east-2': |
| 95 | + case 'us-gov-west-1': |
| 96 | + case 'us-west-1': |
| 97 | + case 'us-west-2': |
| 98 | + return [ |
| 99 | + 'endpoint' => "https://translate.$region.amazonaws.com", |
| 100 | + 'signRegion' => $region, |
| 101 | + 'signService' => 'translate', |
| 102 | + 'signVersions' => ['v4'], |
| 103 | + ]; |
80 | 104 | case 'us-east-1-fips': |
81 | 105 | return [ |
82 | 106 | 'endpoint' => 'https://translate-fips.us-east-1.amazonaws.com', |
@@ -136,11 +160,6 @@ protected function getEndpointMetadata(?string $region): array |
136 | 160 | ]; |
137 | 161 | } |
138 | 162 |
|
139 | | - return [ |
140 | | - 'endpoint' => "https://translate.$region.amazonaws.com", |
141 | | - 'signRegion' => $region, |
142 | | - 'signService' => 'translate', |
143 | | - 'signVersions' => ['v4'], |
144 | | - ]; |
| 163 | + throw new UnsupportedRegion(\sprintf('The region "%s" is not supported by "Translate".', $region)); |
145 | 164 | } |
146 | 165 | } |
0 commit comments