updated-packages
This commit is contained in:
@@ -3,6 +3,8 @@ namespace Aws\Api\Serializer;
|
||||
|
||||
use Aws\Api\Service;
|
||||
use Aws\CommandInterface;
|
||||
use Aws\EndpointV2\EndpointProviderV2;
|
||||
use Aws\EndpointV2\EndpointV2SerializerTrait;
|
||||
use GuzzleHttp\Psr7\Request;
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
|
||||
@@ -12,6 +14,8 @@ use Psr\Http\Message\RequestInterface;
|
||||
*/
|
||||
class JsonRpcSerializer
|
||||
{
|
||||
use EndpointV2SerializerTrait;
|
||||
|
||||
/** @var JsonBody */
|
||||
private $jsonFormatter;
|
||||
|
||||
@@ -44,25 +48,44 @@ class JsonRpcSerializer
|
||||
* When invoked with an AWS command, returns a serialization array
|
||||
* containing "method", "uri", "headers", and "body" key value pairs.
|
||||
*
|
||||
* @param CommandInterface $command
|
||||
* @param CommandInterface $command Command to serialize into a request.
|
||||
* @param $endpointProvider Provider used for dynamic endpoint resolution.
|
||||
* @param $clientArgs Client arguments used for dynamic endpoint resolution.
|
||||
*
|
||||
* @return RequestInterface
|
||||
*/
|
||||
public function __invoke(CommandInterface $command)
|
||||
public function __invoke(
|
||||
CommandInterface $command,
|
||||
$endpointProvider = null,
|
||||
$clientArgs = null
|
||||
)
|
||||
{
|
||||
$name = $command->getName();
|
||||
$operation = $this->api->getOperation($name);
|
||||
$operationName = $command->getName();
|
||||
$operation = $this->api->getOperation($operationName);
|
||||
$commandArgs = $command->toArray();
|
||||
$headers = [
|
||||
'X-Amz-Target' => $this->api->getMetadata('targetPrefix') . '.' . $operationName,
|
||||
'Content-Type' => $this->contentType
|
||||
];
|
||||
|
||||
if ($endpointProvider instanceof EndpointProviderV2) {
|
||||
$this->setRequestOptions(
|
||||
$endpointProvider,
|
||||
$command,
|
||||
$operation,
|
||||
$commandArgs,
|
||||
$clientArgs,
|
||||
$headers
|
||||
);
|
||||
}
|
||||
|
||||
return new Request(
|
||||
$operation['http']['method'],
|
||||
$this->endpoint,
|
||||
[
|
||||
'X-Amz-Target' => $this->api->getMetadata('targetPrefix') . '.' . $name,
|
||||
'Content-Type' => $this->contentType
|
||||
],
|
||||
$headers,
|
||||
$this->jsonFormatter->build(
|
||||
$operation->getInput(),
|
||||
$command->toArray()
|
||||
$commandArgs
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user