public function __invoke(CommandTransaction $trans) { $command = $trans->command; $name = $command->getName(); $operation = $this->api->getOperation($name); return $trans->client->createRequest($operation['http']['method'], $this->endpoint, ['headers' => ['X-Amz-Target' => $this->api->getMetadata('targetPrefix') . '.' . $name, 'Content-Type' => $this->contentType], 'body' => $this->jsonFormatter->build($operation->getInput(), $command->toArray()), 'config' => ['command' => $command]]); }
/** * When invoked with an AWS command, returns a serialization array * containing "method", "uri", "headers", and "body" key value pairs. * * @param CommandInterface $command * * @return RequestInterface */ public function __invoke(CommandInterface $command) { $name = $command->getName(); $operation = $this->api->getOperation($name); return new Request($operation['http']['method'], $this->endpoint, ['X-Amz-Target' => $this->api->getMetadata('targetPrefix') . '.' . $name, 'Content-Type' => $this->contentType], $this->jsonFormatter->build($operation->getInput(), $command->toArray())); }
/** * Gets the JSON Content-Type header for a service API * * @param Service $service * * @return string */ public static function getContentType(Service $service) { return 'application/x-amz-json-' . number_format($service->getMetadata('jsonVersion'), 1); }