Changeset View
Changeset View
Standalone View
Standalone View
src/future/aws/PhutilAWSFuture.php
Show First 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | abstract class PhutilAWSFuture extends FutureProxy { | ||||
protected function getProxiedFuture() { | protected function getProxiedFuture() { | ||||
if (!$this->future) { | if (!$this->future) { | ||||
$params = $this->getParameters(); | $params = $this->getParameters(); | ||||
$method = $this->getHTTPMethod(); | $method = $this->getHTTPMethod(); | ||||
$host = $this->getEndpoint(); | $host = $this->getEndpoint(); | ||||
$path = $this->getPath(); | $path = $this->getPath(); | ||||
$data = $this->getData(); | $data = $this->getData(); | ||||
$uri = id(new PhutilURI("https://{$host}/", $params)) | $uri = (new PhutilURI("https://{$host}/", $params)) | ||||
->setPath($path); | ->setPath($path); | ||||
$future = id(new HTTPSFuture($uri, $data)) | $future = (new HTTPSFuture($uri, $data)) | ||||
->setMethod($method); | ->setMethod($method); | ||||
foreach ($this->headers as $header) { | foreach ($this->headers as $header) { | ||||
list($key, $value) = $header; | list($key, $value) = $header; | ||||
$future->addHeader($key, $value); | $future->addHeader($key, $value); | ||||
} | } | ||||
$this->signRequest($future); | $this->signRequest($future); | ||||
$this->future = $future; | $this->future = $future; | ||||
} | } | ||||
return $this->future; | return $this->future; | ||||
} | } | ||||
protected function signRequest(HTTPSFuture $future) { | protected function signRequest(HTTPSFuture $future) { | ||||
$access_key = $this->getAccessKey(); | $access_key = $this->getAccessKey(); | ||||
$secret_key = $this->getSecretKey(); | $secret_key = $this->getSecretKey(); | ||||
$region = $this->getRegion(); | $region = $this->getRegion(); | ||||
id(new PhutilAWSv4Signature()) | (new PhutilAWSv4Signature()) | ||||
->setRegion($region) | ->setRegion($region) | ||||
->setService($this->getServiceName()) | ->setService($this->getServiceName()) | ||||
->setAccessKey($access_key) | ->setAccessKey($access_key) | ||||
->setSecretKey($secret_key) | ->setSecretKey($secret_key) | ||||
->setSignContent($this->shouldSignContent()) | ->setSignContent($this->shouldSignContent()) | ||||
->signRequest($future); | ->signRequest($future); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 56 Lines • Show Last 20 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0