Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 1... Línea 1...
1
<?php
1
<?php
2
namespace Aws\Api\Serializer;
2
namespace Aws\Api\Serializer;
Línea 3... Línea 3...
3
 
3
 
4
use Aws\Api\Service;
4
use Aws\Api\Service;
5
use Aws\CommandInterface;
-
 
6
use Aws\EndpointV2\EndpointProviderV2;
5
use Aws\CommandInterface;
-
 
6
use Aws\EndpointV2\EndpointV2SerializerTrait;
7
use Aws\EndpointV2\EndpointV2SerializerTrait;
7
use Aws\EndpointV2\Ruleset\RulesetEndpoint;
8
use GuzzleHttp\Psr7\Request;
8
use GuzzleHttp\Psr7\Request;
Línea 9... Línea 9...
9
use Psr\Http\Message\RequestInterface;
9
use Psr\Http\Message\RequestInterface;
10
 
10
 
Línea 34... Línea 34...
34
     * @param JsonBody $jsonFormatter Optional JSON formatter to use
34
     * @param JsonBody $jsonFormatter Optional JSON formatter to use
35
     */
35
     */
36
    public function __construct(
36
    public function __construct(
37
        Service $api,
37
        Service $api,
38
        $endpoint,
38
        $endpoint,
39
        JsonBody $jsonFormatter = null
39
        ?JsonBody $jsonFormatter = null
40
    ) {
40
    ) {
41
        $this->endpoint = $endpoint;
41
        $this->endpoint = $endpoint;
42
        $this->api = $api;
42
        $this->api = $api;
43
        $this->jsonFormatter = $jsonFormatter ?: new JsonBody($this->api);
43
        $this->jsonFormatter = $jsonFormatter ?: new JsonBody($this->api);
44
        $this->contentType = JsonBody::getContentType($api);
44
        $this->contentType = JsonBody::getContentType($api);
Línea 54... Línea 54...
54
     *
54
     *
55
     * @return RequestInterface
55
     * @return RequestInterface
56
     */
56
     */
57
    public function __invoke(
57
    public function __invoke(
58
        CommandInterface $command,
58
        CommandInterface $command,
59
        $endpointProvider = null,
59
        $endpoint = null
60
        $clientArgs = null
-
 
61
    )
60
    )
62
    {
61
    {
63
        $operationName = $command->getName();
62
        $operationName = $command->getName();
64
        $operation = $this->api->getOperation($operationName);
63
        $operation = $this->api->getOperation($operationName);
65
        $commandArgs = $command->toArray();
64
        $commandArgs = $command->toArray();
66
        $headers = [
65
        $headers = [
67
                'X-Amz-Target' => $this->api->getMetadata('targetPrefix') . '.' . $operationName,
66
                'X-Amz-Target' => $this->api->getMetadata('targetPrefix') . '.' . $operationName,
68
                'Content-Type' => $this->contentType
67
                'Content-Type' => $this->contentType
69
            ];
68
            ];
Línea 70... Línea 69...
70
 
69
 
71
        if ($endpointProvider instanceof EndpointProviderV2) {
70
        if ($endpoint instanceof RulesetEndpoint) {
72
            $this->setRequestOptions(
-
 
73
                $endpointProvider,
-
 
74
                $command,
-
 
75
                $operation,
-
 
76
                $commandArgs,
-
 
77
                $clientArgs,
-
 
78
                $headers
-
 
79
            );
71
            $this->setEndpointV2RequestOptions($endpoint, $headers);
Línea 80... Línea 72...
80
        }
72
        }
81
 
73
 
82
        return new Request(
74
        return new Request(