Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 1441
Línea 3... Línea 3...
3
 
3
 
4
use Aws\Api\Service;
4
use Aws\Api\Service;
5
use Aws\CommandInterface;
5
use Aws\CommandInterface;
6
use Aws\EndpointV2\EndpointProviderV2;
6
use Aws\EndpointV2\EndpointProviderV2;
-
 
7
use Aws\EndpointV2\EndpointV2SerializerTrait;
7
use Aws\EndpointV2\EndpointV2SerializerTrait;
8
use Aws\EndpointV2\Ruleset\RulesetEndpoint;
8
use GuzzleHttp\Psr7\Request;
9
use GuzzleHttp\Psr7\Request;
Línea 9... Línea 10...
9
use Psr\Http\Message\RequestInterface;
10
use Psr\Http\Message\RequestInterface;
10
 
11
 
Línea 21... Línea 22...
21
    private $paramBuilder;
22
    private $paramBuilder;
Línea 22... Línea 23...
22
 
23
 
23
    public function __construct(
24
    public function __construct(
24
        Service $api,
25
        Service $api,
25
        $endpoint,
26
        $endpoint,
26
        callable $paramBuilder = null
27
        ?callable $paramBuilder = null
27
    ) {
28
    ) {
28
        $this->api = $api;
29
        $this->api = $api;
29
        $this->endpoint = $endpoint;
30
        $this->endpoint = $endpoint;
30
        $this->paramBuilder = $paramBuilder ?: new QueryParamBuilder();
31
        $this->paramBuilder = $paramBuilder ?: new QueryParamBuilder();
Línea 40... Línea 41...
40
     *
41
     *
41
     * @return RequestInterface
42
     * @return RequestInterface
42
     */
43
     */
43
    public function __invoke(
44
    public function __invoke(
44
        CommandInterface $command,
45
        CommandInterface $command,
45
        $endpointProvider = null,
46
        $endpoint = null
46
        $clientArgs = null
-
 
47
    )
47
    )
48
    {
48
    {
49
        $operation = $this->api->getOperation($command->getName());
49
        $operation = $this->api->getOperation($command->getName());
50
        $body = [
50
        $body = [
51
            'Action'  => $command->getName(),
51
            'Action'  => $command->getName(),
Línea 65... Línea 65...
65
        $headers = [
65
        $headers = [
66
            'Content-Length' => strlen($body),
66
            'Content-Length' => strlen($body),
67
            'Content-Type'   => 'application/x-www-form-urlencoded'
67
            'Content-Type'   => 'application/x-www-form-urlencoded'
68
        ];
68
        ];
Línea 69... Línea 69...
69
 
69
 
70
        if ($endpointProvider instanceof EndpointProviderV2) {
70
        if ($endpoint instanceof RulesetEndpoint) {
71
            $this->setRequestOptions(
-
 
72
                $endpointProvider,
-
 
73
                $command,
-
 
74
                $operation,
-
 
75
                $commandArgs,
-
 
76
                $clientArgs,
-
 
77
                $headers
-
 
78
            );
71
            $this->setEndpointV2RequestOptions($endpoint, $headers);
Línea 79... Línea 72...
79
        }
72
        }
80
 
73
 
81
        return new Request(
74
        return new Request(