|
6 | 6 | use Aws\Api\Service; |
7 | 7 | use Aws\EndpointDiscovery\EndpointDiscoveryMiddleware; |
8 | 8 | use Aws\EndpointV2\EndpointProviderV2; |
9 | | -use Aws\EndpointV2\EndpointV2Middleware; |
10 | 9 | use Aws\Exception\AwsException; |
11 | 10 | use Aws\Signature\SignatureProvider; |
12 | 11 | use GuzzleHttp\Psr7\Uri; |
@@ -241,9 +240,7 @@ public function __construct(array $args) |
241 | 240 | $this->loadAliases(); |
242 | 241 | $this->addStreamRequestPayload(); |
243 | 242 | $this->addRecursionDetection(); |
244 | | - if ($this->isUseEndpointV2()) { |
245 | | - $this->addEndpointV2Middleware(); |
246 | | - } |
| 243 | + $this->addRequestBuilder(); |
247 | 244 |
|
248 | 245 | if (!is_null($this->api->getMetadata('awsQueryCompatible'))) { |
249 | 246 | $this->addQueryCompatibleInputMiddleware($this->api); |
@@ -515,18 +512,24 @@ private function addRecursionDetection() |
515 | 512 | ); |
516 | 513 | } |
517 | 514 |
|
518 | | - private function addEndpointV2Middleware() |
| 515 | + /** |
| 516 | + * Adds the `builder` middleware such that a client's endpoint |
| 517 | + * provider and endpoint resolution arguments can be passed. |
| 518 | + */ |
| 519 | + private function addRequestBuilder() |
519 | 520 | { |
520 | | - $list = $this->getHandlerList(); |
| 521 | + $handlerList = $this->getHandlerList(); |
| 522 | + $serializer = $this->serializer; |
| 523 | + $endpointProvider = $this->endpointProvider; |
521 | 524 | $endpointArgs = $this->getEndpointProviderArgs(); |
522 | 525 |
|
523 | | - $list->prependBuild( |
524 | | - EndpointV2Middleware::wrap( |
525 | | - $this->endpointProvider, |
526 | | - $this->getApi(), |
| 526 | + $handlerList->prependBuild( |
| 527 | + Middleware::requestBuilder( |
| 528 | + $serializer, |
| 529 | + $endpointProvider, |
527 | 530 | $endpointArgs |
528 | 531 | ), |
529 | | - 'endpointV2_middleware' |
| 532 | + 'builderV2' |
530 | 533 | ); |
531 | 534 | } |
532 | 535 |
|
|
0 commit comments