diff --git a/Obs/Internal/Common/CheckoutStream.php b/Obs/Internal/Common/CheckoutStream.php index 6fbeebb..a4d9e54 100644 --- a/Obs/Internal/Common/CheckoutStream.php +++ b/Obs/Internal/Common/CheckoutStream.php @@ -21,43 +21,44 @@ use GuzzleHttp\Psr7\StreamDecoratorTrait; use Obs\ObsException; -class CheckoutStream implements StreamInterface { +class CheckoutStream implements StreamInterface +{ use StreamDecoratorTrait; - private $expectedLength; private $readedCount = 0; - public function __construct(StreamInterface $stream, $expectedLength) { + public function __construct(StreamInterface $stream, $expectedLength) + { $this->stream = $stream; $this->expectedLength = $expectedLength; } - public function getContents() { + public function getContents() + { $contents = $this->stream->getContents(); $length = strlen($contents); if ($this->expectedLength !== null && floatval($length) !== $this->expectedLength) { - $this -> throwObsException($this->expectedLength, $length); + $this->throwObsException($this->expectedLength, $length); } return $contents; } - public function read($length) { + public function read($length) + { $string = $this->stream->read($length); if ($this->expectedLength !== null) { $this->readedCount += strlen($string); - if ($this->stream->eof()) { - if (floatval($this->readedCount) !== $this->expectedLength) { - $this -> throwObsException($this->expectedLength, $this->readedCount); - } + if ($this->stream->eof() && floatval($this->readedCount) !== $this->expectedLength) { + $this->throwObsException($this->expectedLength, $this->readedCount); } - } + } return $string; } - public function throwObsException($expectedLength, $reaLength) { + public function throwObsException($expectedLength, $reaLength) + { $obsException = new ObsException('premature end of Content-Length delimiter message body (expected:' . $expectedLength . '; received:' . $reaLength . ')'); $obsException->setExceptionType('server'); throw $obsException; } } - diff --git a/Obs/Internal/Common/ITransform.php b/Obs/Internal/Common/ITransform.php index a0c369c..9d47af2 100644 --- a/Obs/Internal/Common/ITransform.php +++ b/Obs/Internal/Common/ITransform.php @@ -17,7 +17,7 @@ namespace Obs\Internal\Common; -interface ITransform { +interface ITransform +{ public function transform($sign, $para); } - diff --git a/Obs/Internal/Common/Model.php b/Obs/Internal/Common/Model.php index 511e5f4..17975fc 100644 --- a/Obs/Internal/Common/Model.php +++ b/Obs/Internal/Common/Model.php @@ -26,232 +26,236 @@ class Model implements \ArrayAccess, \IteratorAggregate, \Countable, ToArrayInterface { - protected $data; - - public function __construct(array $data = []) - { - $this->data = $data; - } - - public function count() - { - return count($this->data); - } - - public function getIterator() - { - return new \ArrayIterator($this->data); - } - - public function toArray() - { - return $this->data; - } - - public function clear() - { - $this->data = []; - - return $this; - } - - public function getAll(array $keys = null) - { - return $keys ? array_intersect_key($this->data, array_flip($keys)) : $this->data; - } - - public function get($key) - { - return isset($this->data[$key]) ? $this->data[$key] : null; - } - - public function set($key, $value) - { - $this->data[$key] = $value; - - return $this; - } - - public function add($key, $value) - { - if (!array_key_exists($key, $this->data)) { - $this->data[$key] = $value; - } elseif (is_array($this->data[$key])) { - $this->data[$key][] = $value; - } else { - $this->data[$key] = [$this->data[$key], $value]; - } - - return $this; - } - - public function remove($key) - { - unset($this->data[$key]); - - return $this; - } - - public function getKeys() - { - return array_keys($this->data); - } - - public function hasKey($key) - { - return array_key_exists($key, $this->data); - } - - public function keySearch($key) - { - foreach (array_keys($this->data) as $k) { - if (!strcasecmp($k, $key)) { - return $k; - } - } - - return false; - } - - - public function hasValue($value) - { - return array_search($value, $this->data); - } - - public function replace(array $data) - { - $this->data = $data; - - return $this; - } - - public function merge($data) - { - foreach ($data as $key => $value) { - $this->add($key, $value); - } - - return $this; - } - - public function overwriteWith($data) - { - if (is_array($data)) { - $this->data = $data + $this->data; - } else { - foreach ($data as $key => $value) { - $this->data[$key] = $value; - } - } - - return $this; - } - - public function map(\Closure $closure, array $context = [], $static = true) - { - $collection = $static ? new static() : new self(); - foreach ($this as $key => $value) { - $collection->add($key, $closure($key, $value, $context)); - } - - return $collection; - } - - public function filter(\Closure $closure, $static = true) - { - $collection = ($static) ? new static() : new self(); - foreach ($this->data as $key => $value) { - if ($closure($key, $value)) { - $collection->add($key, $value); - } - } - - return $collection; - } - - public function offsetExists($offset) - { - return isset($this->data[$offset]); - } - - public function offsetGet($offset) - { - return isset($this->data[$offset]) ? $this->data[$offset] : null; - } - - public function offsetSet($offset, $value) - { - $this->data[$offset] = $value; - } - - public function offsetUnset($offset) - { - unset($this->data[$offset]); - } - - public function setPath($path, $value) - { - $current =& $this->data; - $queue = explode('/', $path); - while (null !== ($key = array_shift($queue))) { - if (!is_array($current)) { - throw new \RuntimeException("Trying to setPath {$path}, but {$key} is set and is not an array"); - } elseif (!$queue) { - $current[$key] = $value; - } elseif (isset($current[$key])) { - $current =& $current[$key]; - } else { - $current[$key] = []; - $current =& $current[$key]; - } - } - - return $this; - } - - public function getPath($path, $separator = '/', $data = null) - { - if ($data === null) { - $data =& $this->data; - } - - $path = is_array($path) ? $path : explode($separator, $path); - while (null !== ($part = array_shift($path))) { - if (!is_array($data)) { - return null; - } elseif (isset($data[$part])) { - $data =& $data[$part]; - } elseif ($part != '*') { - return null; - } else { - // Perform a wildcard search by diverging and merging paths - $result = []; - foreach ($data as $value) { - if (!$path) { - $result = array_merge_recursive($result, (array) $value); - } elseif (null !== ($test = $this->getPath($path, $separator, $value))) { - $result = array_merge_recursive($result, (array) $test); - } - } - return $result; - } - } - - return $data; - } - - public function __toString() - { - $output = 'Debug output of '; - $output .= 'model'; - $output = str_repeat('=', strlen($output)) . "\n" . $output . "\n" . str_repeat('=', strlen($output)) . "\n\n"; - $output .= "Model data\n-----------\n\n"; - $output .= "This data can be retrieved from the model object using the get() method of the model " - . "(e.g. \$model->get(\$key)) or accessing the model like an associative array (e.g. \$model['key']).\n\n"; - $lines = array_slice(explode("\n", trim(print_r($this->toArray(), true))), 2, -1); - $output .= implode("\n", $lines); - - return $output . "\n"; - } + protected $data; + + public function __construct(array $data = []) + { + $this->data = $data; + } + + public function count(): int + { + return count($this->data); + } + + public function getIterator(): \Traversable + { + return new \ArrayIterator($this->data); + } + + public function toArray() + { + return $this->data; + } + + public function clear() + { + $this->data = []; + + return $this; + } + + public function getAll(array $keys = null) + { + return $keys ? array_intersect_key($this->data, array_flip($keys)) : $this->data; + } + + public function get($key) + { + return isset($this->data[$key]) ? $this->data[$key] : null; + } + + public function set($key, $value) + { + $this->data[$key] = $value; + + return $this; + } + + public function add($key, $value) + { + if (!array_key_exists($key, $this->data)) { + $this->data[$key] = $value; + } elseif (is_array($this->data[$key])) { + $this->data[$key][] = $value; + } else { + $this->data[$key] = [$this->data[$key], $value]; + } + + return $this; + } + + public function remove($key) + { + unset($this->data[$key]); + + return $this; + } + + public function getKeys() + { + return array_keys($this->data); + } + + public function hasKey($key) + { + return array_key_exists($key, $this->data); + } + + public function keySearch($key) + { + foreach (array_keys($this->data) as $k) { + if (!strcasecmp($k, $key)) { + return $k; + } + } + + return false; + } + + public function hasValue($value) + { + return array_search($value, $this->data); + } + + public function replace(array $data) + { + $this->data = $data; + + return $this; + } + + public function merge($data) + { + foreach ($data as $key => $value) { + $this->add($key, $value); + } + + return $this; + } + + public function overwriteWith($data) + { + if (is_array($data)) { + $this->data = $data + $this->data; + } else { + foreach ($data as $key => $value) { + $this->data[$key] = $value; + } + } + + return $this; + } + + public function map(\Closure $closure, array $context = [], $static = true) + { + $collection = $static ? new static() : new self(); + foreach ($this as $key => $value) { + $collection->add($key, $closure($key, $value, $context)); + } + + return $collection; + } + + public function filter(\Closure $closure, $static = true) + { + $collection = ($static) ? new static() : new self(); + foreach ($this->data as $key => $value) { + if ($closure($key, $value)) { + $collection->add($key, $value); + } + } + + return $collection; + } + + public function offsetExists($offset): bool + { + return isset($this->data[$offset]); + } + + public function offsetGet($offset) + { + return isset($this->data[$offset]) ? $this->data[$offset] : null; + } + + public function offsetSet($offset, $value): void + { + $this->data[$offset] = $value; + } + + public function offsetUnset($offset): void + { + unset($this->data[$offset]); + } + + public function setPath($path, $value) + { + $current = &$this->data; + $queue = explode('/', $path); + while (null !== ($key = array_shift($queue))) { + if (!is_array($current)) { + throw new \InvalidArgumentException("Trying to setPath {$path}, but {$key} is set and is not an array"); + } elseif (!$queue) { + $current[$key] = $value; + } elseif (isset($current[$key])) { + $current = &$current[$key]; + } else { + $current[$key] = []; + $current = &$current[$key]; + } + } + + return $this; + } + + public function getPath($path, $separator = '/', $data = null) + { + if ($data === null) { + $data = &$this->data; + } + + $path = is_array($path) ? $path : explode($separator, $path); + $part = array_shift($path); + + while (null !== $part) { + if (!is_array($data)) { + return null; + } elseif (isset($data[$part])) { + $data = &$data[$part]; + } elseif ($part != '*') { + return null; + } else { + // Perform a wildcard search by diverging and merging paths + $result = []; + foreach ($data as $value) { + if (!$path) { + $result = array_merge_recursive($result, (array) $value); + } else { + $test = $this->getPath($path, $separator, $value); + if (null !== $test) { + $result = array_merge_recursive($result, (array) $test); + } + } + } + return $result; + } + } + + return $data; + } + + public function __toString() + { + $output = 'Debug output of '; + $output .= 'model'; + $output = str_repeat('=', strlen($output)) . "\n" . $output . "\n" . str_repeat('=', strlen($output)) . "\n\n"; + $output .= "Model data\n-----------\n\n"; + $output .= "This data can be retrieved from the model object using the get() method of the model " + . "(e.g. \$model->get(\$key)) or accessing the model like an associative array (e.g. \$model['key']).\n\n"; + $lines = array_slice(explode("\n", trim(print_r($this->toArray(), true))), 2, -1); + $output .= implode("\n", $lines); + + return $output . "\n"; + } } diff --git a/Obs/Internal/Common/ObsTransform.php b/Obs/Internal/Common/ObsTransform.php index 03d42b6..3b38a74 100644 --- a/Obs/Internal/Common/ObsTransform.php +++ b/Obs/Internal/Common/ObsTransform.php @@ -19,60 +19,68 @@ use Obs\ObsClient; -class ObsTransform implements ITransform { +class ObsTransform implements ITransform +{ private static $instance; - - private function __construct(){} - - public static function getInstance() { + + private function __construct() + {} + + public static function getInstance() + { if (!(self::$instance instanceof ObsTransform)) { self::$instance = new ObsTransform(); } return self::$instance; } - - - public function transform($sign, $para) { + + public function transform($sign, $para) + { if ($sign === 'aclHeader') { $para = $this->transAclHeader($para); - } else if ($sign === 'aclUri') { + } elseif ($sign === 'aclUri') { $para = $this->transAclGroupUri($para); - } else if ($sign == 'event') { + } elseif ($sign == 'event') { $para = $this->transNotificationEvent($para); - } else if ($sign == 'storageClass') { + } elseif ($sign == 'storageClass') { $para = $this->transStorageClass($para); + } else { + // nothing handle } return $para; } - - private function transAclHeader($para) { - if ($para === ObsClient::AclAuthenticatedRead || $para === ObsClient::AclBucketOwnerRead || - $para === ObsClient::AclBucketOwnerFullControl || $para === ObsClient::AclLogDeliveryWrite) { + + private function transAclHeader($para) + { + if ($para === ObsClient::AclAuthenticatedRead || $para === ObsClient::AclBucketOwnerRead || + $para === ObsClient::AclBucketOwnerFullControl || $para === ObsClient::AclLogDeliveryWrite) { $para = null; } return $para; } - - private function transAclGroupUri($para) { + + private function transAclGroupUri($para) + { if ($para === ObsClient::GroupAllUsers) { $para = ObsClient::AllUsers; } return $para; } - - private function transNotificationEvent($para) { + + private function transNotificationEvent($para) + { $pos = strpos($para, 's3:'); if ($pos !== false && $pos === 0) { $para = substr($para, 3); } return $para; } - - private function transStorageClass($para) { + + private function transStorageClass($para) + { $search = array('STANDARD', 'STANDARD_IA', 'GLACIER'); $repalce = array(ObsClient::StorageClassStandard, ObsClient::StorageClassWarm, ObsClient::StorageClassCold); - $para = str_replace($search, $repalce, $para); - return $para; + return str_replace($search, $repalce, $para); } } diff --git a/Obs/Internal/Common/SchemaFormatter.php b/Obs/Internal/Common/SchemaFormatter.php index 46b896b..4bcd9ef 100644 --- a/Obs/Internal/Common/SchemaFormatter.php +++ b/Obs/Internal/Common/SchemaFormatter.php @@ -17,50 +17,49 @@ namespace Obs\Internal\Common; - class SchemaFormatter { protected static $utcTimeZone; public static function format($fmt, $value) - { - if($fmt === 'date-time'){ - return self::formatDateTime($value); + { + if ($fmt === 'date-time') { + return SchemaFormatter::formatDateTime($value); } - - if($fmt === 'data-time-http'){ - return self::formatDateTimeHttp($value); + + if ($fmt === 'data-time-http') { + return SchemaFormatter::formatDateTimeHttp($value); } - - if($fmt === 'data-time-middle'){ - return self::formatDateTimeMiddle($value); + + if ($fmt === 'data-time-middle') { + return SchemaFormatter::formatDateTimeMiddle($value); } - - if($fmt === 'date'){ - return self::formatDate($value); + + if ($fmt === 'date') { + return SchemaFormatter::formatDate($value); } - - if($fmt === 'timestamp'){ - return self::formatTimestamp($value); + + if ($fmt === 'timestamp') { + return SchemaFormatter::formatTimestamp($value); } - - if($fmt === 'boolean-string'){ - return self::formatBooleanAsString($value); + + if ($fmt === 'boolean-string') { + return SchemaFormatter::formatBooleanAsString($value); } - + return $value; } - + public static function formatDateTimeMiddle($dateTime) { - if (is_string($dateTime)) { - $dateTime = new \DateTime($dateTime); - } - - if ($dateTime instanceof \DateTime) { - return $dateTime -> format('Y-m-d\T00:00:00\Z'); - } - return null; + if (is_string($dateTime)) { + $dateTime = new \DateTime($dateTime); + } + + if ($dateTime instanceof \DateTime) { + return $dateTime->format('Y-m-d\T00:00:00\Z'); + } + return null; } public static function formatDateTime($value) @@ -104,11 +103,11 @@ private static function dateFormatter($dt, $fmt) } if ($dt instanceof \DateTime) { - if (!self::$utcTimeZone) { - self::$utcTimeZone = new \DateTimeZone('UTC'); + if (!SchemaFormatter::$utcTimeZone) { + SchemaFormatter::$utcTimeZone = new \DateTimeZone('UTC'); } - - return $dt->setTimezone(self::$utcTimeZone)->format($fmt); + + return $dt->setTimezone(SchemaFormatter::$utcTimeZone)->format($fmt); } return null; diff --git a/Obs/Internal/Common/SdkCurlFactory.php b/Obs/Internal/Common/SdkCurlFactory.php index af56361..b91b6f5 100644 --- a/Obs/Internal/Common/SdkCurlFactory.php +++ b/Obs/Internal/Common/SdkCurlFactory.php @@ -47,7 +47,7 @@ public function create(RequestInterface $request, array $options): EasyHandle $options['_body_as_string'] = $options['curl']['body_as_string']; unset($options['curl']['body_as_string']); } - + $easy = new EasyHandle; $easy->request = $request; $easy->options = $options; @@ -55,8 +55,7 @@ public function create(RequestInterface $request, array $options): EasyHandle $this->applyMethod($easy, $conf); $this->applyHandlerOptions($easy, $conf); $this->applyHeaders($easy, $conf); - - + unset($conf['_headers']); if (isset($options['curl'])) { @@ -64,25 +63,25 @@ public function create(RequestInterface $request, array $options): EasyHandle } $conf[CURLOPT_HEADERFUNCTION] = $this->createHeaderFn($easy); - if($this->handles){ - $easy->handle = array_pop($this->handles); - }else{ - $easy->handle = curl_init(); + if ($this->handles) { + $easy->handle = array_pop($this->handles); + } else { + $easy->handle = curl_init(); } curl_setopt_array($easy->handle, $conf); return $easy; } - + public function close() { - if($this->handles){ - foreach ($this->handles as $handle){ - curl_close($handle); - } - unset($this->handles); - $this->handles = []; - } + if ($this->handles) { + foreach ($this->handles as $handle) { + curl_close($handle); + } + unset($this->handles); + $this->handles = []; + } } public function release(EasyHandle $easy): void @@ -133,18 +132,18 @@ private function applyMethod(EasyHandle $easy, array &$conf) { $body = $easy->request->getBody(); $size = $body->getSize(); - + if ($size === null || $size > 0) { $this->applyBody($easy->request, $easy->options, $conf); return; } $method = $easy->request->getMethod(); - if ($method === 'PUT' || $method === 'POST') { - if (!$easy->request->hasHeader('Content-Length')) { - $conf[CURLOPT_HTTPHEADER][] = 'Content-Length: 0'; - } - } elseif ($method === 'HEAD') { + if (($method === 'PUT' || $method === 'POST') && (!$easy->request->hasHeader('Content-Length'))) { + $conf[CURLOPT_HTTPHEADER][] = 'Content-Length: 0'; + } + + if ($method === 'HEAD') { $conf[CURLOPT_NOBODY] = true; unset( $conf[CURLOPT_WRITEFUNCTION], @@ -160,45 +159,43 @@ private function applyBody(RequestInterface $request, array $options, array &$co $size = $request->hasHeader('Content-Length') ? (int) $request->getHeaderLine('Content-Length') : $request->getBody()->getSize(); - - if($request->getBody()->getSize() === $size && $request -> getBody() ->tell() <= 0){ - if (($size !== null && $size < 1000000) || - !empty($options['_body_as_string']) - ) { - $conf[CURLOPT_POSTFIELDS] = (string) $request->getBody(); - $this->removeHeader('Content-Length', $conf); - $this->removeHeader('Transfer-Encoding', $conf); - } else { - $conf[CURLOPT_UPLOAD] = true; - if ($size !== null) { - $conf[CURLOPT_INFILESIZE] = $size; - $this->removeHeader('Content-Length', $conf); - } - $body = $request->getBody(); - if ($body->isSeekable()) { - $body->rewind(); - } - $conf[CURLOPT_READFUNCTION] = function ($ch, $fd, $length) use ($body) { - return $body->read($length); - }; - } - }else{ - $body = $request->getBody(); - $conf[CURLOPT_UPLOAD] = true; - $conf[CURLOPT_INFILESIZE] = $size; - $readCount = 0; - $conf[CURLOPT_READFUNCTION] = function ($ch, $fd, $length) use ($body, $readCount, $size) { - if($readCount >= $size){ - $body -> close(); - return ''; - } - $readCountOnce = $length <= $size ? $length : $size; - $readCount += $readCountOnce; - return $body->read($readCountOnce); - }; + + if ($request->getBody()->getSize() === $size && $request->getBody()->tell() <= 0) { + if (($size !== null && $size < 1000000) || + !empty($options['_body_as_string']) + ) { + $conf[CURLOPT_POSTFIELDS] = (string) $request->getBody(); + $this->removeHeader('Content-Length', $conf); + $this->removeHeader('Transfer-Encoding', $conf); + } else { + $conf[CURLOPT_UPLOAD] = true; + if ($size !== null) { + $conf[CURLOPT_INFILESIZE] = $size; + $this->removeHeader('Content-Length', $conf); + } + $body = $request->getBody(); + if ($body->isSeekable()) { + $body->rewind(); + } + $conf[CURLOPT_READFUNCTION] = function ($ch, $fd, $length) use ($body) { + return $body->read($length); + }; + } + } else { + $body = $request->getBody(); + $conf[CURLOPT_UPLOAD] = true; + $conf[CURLOPT_INFILESIZE] = $size; + $readCount = 0; + $conf[CURLOPT_READFUNCTION] = function ($ch, $fd, $length) use ($body, $readCount, $size) { + if ($readCount >= $size) { + $body->close(); + return ''; + } + $readCountOnce = $length <= $size ? $length : $size; + $readCount += $readCountOnce; + return $body->read($readCountOnce); + }; } - - if (!$request->hasHeader('Expect')) { $conf[CURLOPT_HTTPHEADER][] = 'Expect:'; @@ -237,7 +234,7 @@ private function applyHandlerOptions(EasyHandle $easy, array &$conf) { $options = $easy->options; if (isset($options['verify'])) { - $conf[CURLOPT_SSL_VERIFYHOST] = 0; + $conf[CURLOPT_SSL_VERIFYHOST] = 0; if ($options['verify'] === false) { unset($conf[CURLOPT_CAINFO]); $conf[CURLOPT_SSL_VERIFYPEER] = false; @@ -278,7 +275,7 @@ private function applyHandlerOptions(EasyHandle $easy, array &$conf) $sink = Psr7\Utils::streamFor($sink); } } elseif (!is_dir(dirname($sink))) { - throw new \RuntimeException(sprintf( + throw new \InvalidArgumentException(sprintf( 'Directory %s does not exist for sink value of %s', dirname($sink), $sink @@ -307,7 +304,8 @@ private function applyHandlerOptions(EasyHandle $easy, array &$conf) if (isset($options['force_ip_resolve'])) { if ('v4' === $options['force_ip_resolve']) { $conf[CURLOPT_IPRESOLVE] = CURL_IPRESOLVE_V4; - } else if ('v6' === $options['force_ip_resolve']) { + } + if ('v6' === $options['force_ip_resolve']) { $conf[CURLOPT_IPRESOLVE] = CURL_IPRESOLVE_V6; } } @@ -388,7 +386,6 @@ private function applyHandlerOptions(EasyHandle $easy, array &$conf) } } - private function createHeaderFn(EasyHandle $easy) { if (isset($easy->options['on_headers'])) { diff --git a/Obs/Internal/Common/SdkStreamHandler.php b/Obs/Internal/Common/SdkStreamHandler.php index c7075ac..78a6bc5 100644 --- a/Obs/Internal/Common/SdkStreamHandler.php +++ b/Obs/Internal/Common/SdkStreamHandler.php @@ -24,11 +24,10 @@ namespace Obs\Internal\Common; -use GuzzleHttp\Exception\RequestException; +use GuzzleHttp\Psr7; use GuzzleHttp\Exception\ConnectException; +use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Promise\FulfilledPromise; -use GuzzleHttp\Promise\PromiseInterface; -use GuzzleHttp\Psr7; use GuzzleHttp\TransferStats; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; @@ -108,7 +107,7 @@ private function createResponse( $status = $parts[1]; $reason = isset($parts[2]) ? $parts[2] : null; $headers = \GuzzleHttp\headers_from_lines($hdrs); - list ($stream, $headers) = $this->checkDecode($options, $headers, $stream); + list($stream, $headers) = $this->checkDecode($options, $headers, $stream); try { $stream = Psr7\stream_for($stream); } catch (\Throwable $e) { @@ -243,7 +242,7 @@ private function createResource(callable $callback) $message .= "[$key] $value" . PHP_EOL; } } - throw new \RuntimeException(trim($message)); + throw new \UnexpectedValueException(trim($message)); } return $resource; @@ -311,7 +310,7 @@ function () use ($context, $params) { return $this->createResource( function () use ($uri, &$http_response_header, $context, $options) { - $resource = fopen((string) $uri, 'r', null, $context); + $resource = fopen((string) $uri, 'r', false, $context); $this->lastHeaders = $http_response_header; if (isset($options['read_timeout'])) { @@ -334,13 +333,20 @@ private function resolveHost(RequestInterface $request, array $options) if ('v4' === $options['force_ip_resolve']) { $records = dns_get_record($uri->getHost(), DNS_A); if (!isset($records[0]['ip'])) { - throw new ConnectException(sprintf("Could not resolve IPv4 address for host '%s'", $uri->getHost()), $request); + throw new ConnectException( + sprintf("Could not resolve IPv4 address for host '%s'", $uri->getHost()), + $request + ); } $uri = $uri->withHost($records[0]['ip']); - } elseif ('v6' === $options['force_ip_resolve']) { + } + if ('v6' === $options['force_ip_resolve']) { $records = dns_get_record($uri->getHost(), DNS_AAAA); if (!isset($records[0]['ipv6'])) { - throw new ConnectException(sprintf("Could not resolve IPv6 address for host '%s'", $uri->getHost()), $request); + throw new ConnectException( + sprintf("Could not resolve IPv6 address for host '%s'", $uri->getHost()), + $request + ); } $uri = $uri->withHost('[' . $records[0]['ipv6'] . ']'); } @@ -381,139 +387,4 @@ private function getDefaultContext(RequestInterface $request) return $context; } - - private function add_proxy(RequestInterface $request, &$options, $value, &$params) - { - if (!is_array($value)) { - $options['http']['proxy'] = $value; - } else { - $scheme = $request->getUri()->getScheme(); - if (isset($value[$scheme])) { - if (!isset($value['no']) - || !\GuzzleHttp\is_host_in_noproxy( - $request->getUri()->getHost(), - $value['no'] - ) - ) { - $options['http']['proxy'] = $value[$scheme]; - } - } - } - } - - private function add_timeout(RequestInterface $request, &$options, $value, &$params) - { - if ($value > 0) { - $options['http']['timeout'] = $value; - } - } - - private function add_verify(RequestInterface $request, &$options, $value, &$params) - { - if ($value === true) { - if (PHP_VERSION_ID < 50600) { - $options['ssl']['cafile'] = \GuzzleHttp\default_ca_bundle(); - } - } elseif (is_string($value)) { - $options['ssl']['cafile'] = $value; - if (!file_exists($value)) { - throw new \RuntimeException("SSL CA bundle not found: $value"); - } - } elseif ($value === false) { - $options['ssl']['verify_peer'] = false; - $options['ssl']['verify_peer_name'] = false; - return; - } else { - throw new \InvalidArgumentException('Invalid verify request option'); - } - - $options['ssl']['verify_peer'] = true; - $options['ssl']['verify_peer_name'] = true; - $options['ssl']['allow_self_signed'] = false; - } - - private function add_cert(RequestInterface $request, &$options, $value, &$params) - { - if (is_array($value)) { - $options['ssl']['passphrase'] = $value[1]; - $value = $value[0]; - } - - if (!file_exists($value)) { - throw new \RuntimeException("SSL certificate not found: {$value}"); - } - - $options['ssl']['local_cert'] = $value; - } - - private function add_progress(RequestInterface $request, &$options, $value, &$params) - { - $this->addNotification( - $params, - function ($code, $a, $b, $c, $transferred, $total) use ($value) { - if ($code == STREAM_NOTIFY_PROGRESS) { - $value($total, $transferred, null, null); - } - } - ); - } - - private function add_debug(RequestInterface $request, &$options, $value, &$params) - { - if ($value === false) { - return; - } - - static $map = [ - STREAM_NOTIFY_CONNECT => 'CONNECT', - STREAM_NOTIFY_AUTH_REQUIRED => 'AUTH_REQUIRED', - STREAM_NOTIFY_AUTH_RESULT => 'AUTH_RESULT', - STREAM_NOTIFY_MIME_TYPE_IS => 'MIME_TYPE_IS', - STREAM_NOTIFY_FILE_SIZE_IS => 'FILE_SIZE_IS', - STREAM_NOTIFY_REDIRECTED => 'REDIRECTED', - STREAM_NOTIFY_PROGRESS => 'PROGRESS', - STREAM_NOTIFY_FAILURE => 'FAILURE', - STREAM_NOTIFY_COMPLETED => 'COMPLETED', - STREAM_NOTIFY_RESOLVE => 'RESOLVE', - ]; - static $args = ['severity', 'message', 'message_code', - 'bytes_transferred', 'bytes_max']; - - $value = \GuzzleHttp\debug_resource($value); - $ident = $request->getMethod() . ' ' . $request->getUri()->withFragment(''); - $this->addNotification( - $params, - function () use ($ident, $value, $map, $args) { - $passed = func_get_args(); - $code = array_shift($passed); - fprintf($value, '<%s> [%s] ', $ident, $map[$code]); - foreach (array_filter($passed) as $i => $v) { - fwrite($value, $args[$i] . ': "' . $v . '" '); - } - fwrite($value, "\n"); - } - ); - } - - private function addNotification(array &$params, callable $notify) - { - if (!isset($params['notification'])) { - $params['notification'] = $notify; - } else { - $params['notification'] = $this->callArray([ - $params['notification'], - $notify - ]); - } - } - - private function callArray(array $functions) - { - return function () use ($functions) { - $args = func_get_args(); - foreach ($functions as $fn) { - call_user_func_array($fn, $args); - } - }; - } } diff --git a/Obs/Internal/Common/V2Transform.php b/Obs/Internal/Common/V2Transform.php index b1ae4e8..017fb04 100644 --- a/Obs/Internal/Common/V2Transform.php +++ b/Obs/Internal/Common/V2Transform.php @@ -1,4 +1,5 @@ transStorageClass($para); - } else if ($sign === 'aclHeader') { - $para = $this->transAclHeader($para); - } else if ($sign === 'aclUri') { - $para = $this->transAclGroupUri($para); - } else if ($sign == 'event') { - $para = $this->transNotificationEvent($para); + $res = $this->transStorageClass($para); + } elseif ($sign === 'aclHeader') { + $res = $this->transAclHeader($para); + } elseif ($sign === 'aclUri') { + $res = $this->transAclGroupUri($para); + } elseif ($sign == 'event') { + $res = $this->transNotificationEvent($para); + } else { + // nothing handle } - return $para; + return $res; } - - private function transStorageClass($para) { + + private function transStorageClass($para) + { $search = array(ObsClient::StorageClassStandard, ObsClient::StorageClassWarm, ObsClient::StorageClassCold); $repalce = array('STANDARD', 'STANDARD_IA', 'GLACIER'); - $para = str_replace($search, $repalce, $para); - return $para; + return str_replace($search, $repalce, $para); } - - private function transAclHeader($para) { + + private function transAclHeader($para) + { if ($para === ObsClient::AclPublicReadDelivered || $para === ObsClient::AclPublicReadWriteDelivered) { $para = null; } - return $para; + return $para; } - - private function transAclGroupUri($para) { + + private function transAclGroupUri($para) + { + $res = $para; if ($para === ObsClient::GroupAllUsers) { - $para = V2Constants::GROUP_ALL_USERS_PREFIX . $para; - } else if ($para === ObsClient::GroupAuthenticatedUsers) { - $para = V2Constants::GROUP_AUTHENTICATED_USERS_PREFIX . $para; - } else if ($para === ObsClient::GroupLogDelivery) { - $para = V2Constants::GROUP_LOG_DELIVERY_PREFIX . $para; - } else if ($para === ObsClient::AllUsers) { - $para = V2Constants::GROUP_ALL_USERS_PREFIX . ObsClient::GroupAllUsers; + $res = V2Constants::GROUP_ALL_USERS_PREFIX . $para; + } elseif ($para === ObsClient::GroupAuthenticatedUsers) { + $res = V2Constants::GROUP_AUTHENTICATED_USERS_PREFIX . $para; + } elseif ($para === ObsClient::GroupLogDelivery) { + $res = V2Constants::GROUP_LOG_DELIVERY_PREFIX . $para; + } elseif ($para === ObsClient::AllUsers) { + $res = V2Constants::GROUP_ALL_USERS_PREFIX . ObsClient::GroupAllUsers; + } else { + // nothing handle } - return $para; + return $res; } - - private function transNotificationEvent($para) { + + private function transNotificationEvent($para) + { $pos = strpos($para, 's3:'); if ($pos === false || $pos !== 0) { $para = 's3:' . $para; @@ -79,5 +94,3 @@ private function transNotificationEvent($para) { return $para; } } - - diff --git a/Obs/Internal/GetResponseTrait.php b/Obs/Internal/GetResponseTrait.php index 90b8422..de00d20 100644 --- a/Obs/Internal/GetResponseTrait.php +++ b/Obs/Internal/GetResponseTrait.php @@ -16,282 +16,316 @@ */ namespace Obs\Internal; + +use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\Request; use GuzzleHttp\Psr7\Response; -use GuzzleHttp\Exception\RequestException; -use Obs\ObsException; +use Obs\Internal\Common\CheckoutStream; use Obs\Internal\Common\Model; use Obs\Internal\Resource\Constants; use Obs\Log\ObsLog; +use Obs\ObsException; use Psr\Http\Message\StreamInterface; -use Obs\Internal\Common\CheckoutStream; trait GetResponseTrait { + protected $exceptionResponseMode = true; + protected $chunkSize = 65536; + + protected function isClientError(Response $response) + { + return $response->getStatusCode() >= 400 && $response->getStatusCode() < 500; + } + + protected function parseXmlByType($searchPath, $key, &$value, $xml, $prefix) + { + $type = 'string'; + + if (isset($value['sentAs'])) { + $key = $value['sentAs']; + } + + if ($searchPath === null) { + $searchPath = '//' . $prefix . $key; + } + + if (isset($value['type'])) { + $type = $value['type']; + if ($type === 'array') { + $items = $value['items']; + if (isset($value['wrapper'])) { + $paths = explode('/', $searchPath); + $size = count($paths); + if ($size > 1) { + $end = $paths[$size - 1]; + $paths[$size - 1] = $value['wrapper']; + $paths[] = $end; + $searchPath = implode('/', $paths) . '/' . $prefix; + } + } + + $array = []; + if (!isset($value['data']['xmlFlattened'])) { + $pkey = isset($items['sentAs']) ? $items['sentAs'] : $items['name']; + $newSearchPath = $searchPath . '/' . $prefix . $pkey; + } else { + $pkey = $key; + $newSearchPath = $searchPath; + } + $result = $xml->xpath($newSearchPath); + if ($result && is_array($result)) { + foreach ($result as $subXml) { + $subXml = simplexml_load_string($subXml->asXML()); + $subPrefix = $this->getXpathPrefix($subXml); + $array[] = $this->parseXmlByType( + '//' . $subPrefix . $pkey, + $pkey, + $items, + $subXml, + $subPrefix + ); + } + } + return $array; + } elseif ($type === 'object') { + $properties = $value['properties']; + $array = []; + foreach ($properties as $pkey => $pvalue) { + $name = isset($pvalue['sentAs']) ? $pvalue['sentAs'] : $pkey; + $array[$pkey] = $this->parseXmlByType( + $searchPath . '/' . $prefix . $name, + $name, + $pvalue, + $xml, + $prefix + ); + } + return $array; + } else { + // nothing handle + } + } + + if ($result = $xml->xpath($searchPath)) { + if ($type === 'boolean') { + return strval($result[0]) !== 'false'; + } elseif ($type === 'numeric' || $type === 'float') { + return floatval($result[0]); + } elseif ($type === 'int' || $type === 'integer') { + return intval($result[0]); + } else { + return strval($result[0]); + } + } else { + if ($type === 'boolean') { + return false; + } elseif ($type === 'numeric' || $type === 'float' || $type === 'int' || $type === 'integer') { + return null; + } else { + return ''; + } + } + } + + private function isJsonResponse($response) + { + return $response->getHeaderLine('content-type') === 'application/json'; + } - protected $exceptionResponseMode = true; - - protected $chunkSize = 65536; - - protected function isClientError(Response $response) - { - return $response -> getStatusCode() >= 400 && $response -> getStatusCode() < 500; - } - - protected function parseXmlByType($searchPath, $key, &$value, $xml, $prefix) - { - $type = 'string'; - - if(isset($value['sentAs'])){ - $key = $value['sentAs']; - } - - if($searchPath === null){ - $searchPath = '//'.$prefix.$key; - } - - if(isset($value['type'])){ - $type = $value['type']; - if($type === 'array'){ - $items = $value['items']; - if(isset($value['wrapper'])){ - $paths = explode('/', $searchPath); - $size = count($paths); - if ($size > 1) { - $end = $paths[$size - 1]; - $paths[$size - 1] = $value['wrapper']; - $paths[] = $end; - $searchPath = implode('/', $paths) .'/' . $prefix; - } - } - - $array = []; - if(!isset($value['data']['xmlFlattened'])){ - $pkey = isset($items['sentAs']) ? $items['sentAs'] : $items['name']; - $_searchPath = $searchPath .'/' . $prefix .$pkey; - }else{ - $pkey = $key; - $_searchPath = $searchPath; - } - if($result = $xml -> xpath($_searchPath)){ - if(is_array($result)){ - foreach ($result as $subXml){ - $subXml = simplexml_load_string($subXml -> asXML()); - $subPrefix = $this->getXpathPrefix($subXml); - $array[] = $this->parseXmlByType('//'.$subPrefix. $pkey, $pkey, $items, $subXml, $subPrefix); - } - } - } - return $array; - }else if($type === 'object'){ - $properties = $value['properties']; - $array = []; - foreach ($properties as $pkey => $pvalue){ - $name = isset($pvalue['sentAs']) ? $pvalue['sentAs'] : $pkey; - $array[$pkey] = $this->parseXmlByType($searchPath.'/' . $prefix .$name, $name, $pvalue, $xml, $prefix); - } - return $array; - } - } - - if($result = $xml -> xpath($searchPath)){ - if($type === 'boolean'){ - return strval($result[0]) !== 'false'; - }else if($type === 'numeric' || $type === 'float'){ - return floatval($result[0]); - }else if($type === 'int' || $type === 'integer'){ - return intval($result[0]); - }else{ - return strval($result[0]); - } - }else{ - if($type === 'boolean'){ - return false; - }else if($type === 'numeric' || $type === 'float' || $type === 'int' || $type === 'integer'){ - return null; - }else{ - return ''; - } - } - } - - private function isJsonResponse($response) { - return $response -> getHeaderLine('content-type') === 'application/json'; + private function parseCommonHeaders($model, $response) + { + $constants = Constants::selectConstants($this->signature); + foreach ($constants::COMMON_HEADERS as $key => $value) { + $model[$value] = $response->getHeaderLine($key); + } } - private function parseCommonHeaders($model, $response){ - $constants = Constants::selectConstants($this -> signature); - foreach($constants::COMMON_HEADERS as $key => $value){ - $model[$value] = $response -> getHeaderLine($key); - } - } - - protected function parseItems($responseParameters, $model, $response, $body) - { - $prefix = ''; - - $this->parseCommonHeaders($model, $response); - - $closeBody = false; - try{ - foreach ($responseParameters as $key => $value){ - if(isset($value['location'])){ - $location = $value['location']; - if($location === 'header'){ - $name = isset($value['sentAs']) ? $value['sentAs'] : $key; - $isSet = false; - if(isset($value['type'])){ - $type = $value['type']; - if($type === 'object'){ - $headers = $response -> getHeaders(); - $temp = []; - foreach ($headers as $headerName => $headerValue){ - if(stripos($headerName, $name) === 0){ - $metaKey = rawurldecode(substr($headerName, strlen($name))); - $temp[$metaKey] = rawurldecode($response -> getHeaderLine($headerName)); - } - } - $model[$key] = $temp; - $isSet = true; - }else{ - if($response -> hasHeader($name)){ - if($type === 'boolean'){ - $model[$key] = ($response -> getHeaderLine($name)) !== 'false'; - $isSet = true; - }else if($type === 'numeric' || $type === 'float'){ - $model[$key] = floatval($response -> getHeaderLine($name)); - $isSet = true; - }else if($type === 'int' || $type === 'integer'){ - $model[$key] = intval($response -> getHeaderLine($name)); - $isSet = true; - } - } - } - } - if(!$isSet){ - $model[$key] = rawurldecode($response -> getHeaderLine($name)); - } - }else if($location === 'xml' && $body !== null){ - if(!isset($xml) && ($xml = simplexml_load_string($body -> getContents()))){ - $prefix = $this ->getXpathPrefix($xml); - } - $closeBody = true; - $model[$key] = $this -> parseXmlByType(null, $key,$value, $xml, $prefix); - }else if($location === 'body' && $body !== null){ - if(isset($value['type']) && $value['type'] === 'stream'){ - $model[$key] = $body; - }else if (isset($value['type']) && $value['type'] === 'json') { - $jsonBody = trim($body -> getContents()); - if ($jsonBody && ($data = json_decode($jsonBody, true))) { + protected function parseItems($responseParameters, $model, $response, $body) + { + $prefix = ''; + + $this->parseCommonHeaders($model, $response); + + $closeBody = false; + try { + foreach ($responseParameters as $key => $value) { + if (isset($value['location'])) { + $location = $value['location']; + if ($location === 'header') { + $name = isset($value['sentAs']) ? $value['sentAs'] : $key; + $isSet = false; + if (isset($value['type'])) { + $type = $value['type']; + if ($type === 'object') { + $headers = $response->getHeaders(); + $temp = []; + foreach ($headers as $headerName => $headerValue) { + if (stripos($headerName, $name) === 0) { + $metaKey = rawurldecode(substr($headerName, strlen($name))); + $temp[$metaKey] = rawurldecode($response->getHeaderLine($headerName)); + } + } + $model[$key] = $temp; + $isSet = true; + } else { + if ($response->hasHeader($name)) { + if ($type === 'boolean') { + $model[$key] = ($response->getHeaderLine($name)) !== 'false'; + $isSet = true; + } elseif ($type === 'numeric' || $type === 'float') { + $model[$key] = floatval($response->getHeaderLine($name)); + $isSet = true; + } elseif ($type === 'int' || $type === 'integer') { + $model[$key] = intval($response->getHeaderLine($name)); + $isSet = true; + } else { + // nothing handle + } + } + } + } + if (!$isSet) { + $model[$key] = rawurldecode($response->getHeaderLine($name)); + } + } elseif ($location === 'xml' && $body !== null) { + if (!isset($xml)) { + $xml = simplexml_load_string($body->getContents()); + if ($xml) { + $prefix = $this->getXpathPrefix($xml); + } + } + $closeBody = true; + $model[$key] = $this->parseXmlByType(null, $key, $value, $xml, $prefix); + } elseif ($location === 'body' && $body !== null) { + if (isset($value['type']) && $value['type'] === 'stream') { + $model[$key] = $body; + } elseif (isset($value['type']) && $value['type'] === 'json') { + $jsonBody = trim($body->getContents()); + $data = json_decode($jsonBody, true); + if ($jsonBody && $data) { if (is_array($data)) { $model[$key] = $data; } elseif (strlen($data)) { - ObsLog::commonLog(ERROR, "response body %s, and jsonToArray data is %s",$body, $data); + ObsLog::commonLog( + ERROR, + "response body %s, and jsonToArray data is %s", + $body, + $data + ); + } else { + // nothing handle } } $closeBody = true; } else { - $model[$key] = $body -> getContents(); - $closeBody = true; - } - } - } - } - }finally { - if($closeBody && $body !== null){ - $body -> close(); - } - } - } - - private function writeFile($filePath, StreamInterface &$body, $contentLength) - { - $filePath = iconv('UTF-8', 'GBK', $filePath); - if(is_string($filePath) && $filePath !== '') - { - $fp = null; - $dir = dirname($filePath); - try{ - if(!is_dir($dir)) - { - mkdir($dir,0755,true); - } - - if(($fp = fopen($filePath, 'w'))) - { - while(!$body->eof()) - { - $str = $body->read($this->chunkSize); - fwrite($fp, $str); - } - fflush($fp); - ObsLog::commonLog(DEBUG, "write file %s ok",$filePath); - } - else{ - ObsLog::commonLog(ERROR, "open file error,file path:%s",$filePath); - } - }finally{ - if($fp){ - fclose($fp); - } - $body->close(); - $body = null; - } - } - } - - private function parseXmlToException($body, $obsException){ - try{ - $xmlErrorBody = trim($body -> getContents()); - if($xmlErrorBody && ($xml = simplexml_load_string($xmlErrorBody))){ - $prefix = $this->getXpathPrefix($xml); - if ($tempXml = $xml->xpath('//'.$prefix . 'Code')) { - $obsException-> setExceptionCode(strval($tempXml[0])); - } - if ($tempXml = $xml->xpath('//'.$prefix . 'RequestId')) { - $obsException-> setRequestId(strval($tempXml[0])); - } - if ($tempXml = $xml->xpath('//'.$prefix . 'Message')) { - $obsException-> setExceptionMessage(strval($tempXml[0])); - } - if ($tempXml = $xml->xpath('//'.$prefix . 'HostId')) { - $obsException -> setHostId(strval($tempXml[0])); - } - } - }finally{ - $body -> close(); - } - } - - private function parseJsonToException($body, $obsException) { + $model[$key] = $body->getContents(); + $closeBody = true; + } + } else { + // nothing handle + } + } + } + } finally { + if ($closeBody && $body !== null) { + $body->close(); + } + } + } + + private function writeFile($filePath, StreamInterface &$body) + { + $filePath = iconv('UTF-8', 'GBK', $filePath); + if (is_string($filePath) && $filePath !== '') { + $fp = null; + $dir = dirname($filePath); + try { + if (!is_dir($dir)) { + mkdir($dir, 0755, true); + } + + if ($fp = fopen($filePath, 'w')) { + while (!$body->eof()) { + $str = $body->read($this->chunkSize); + fwrite($fp, $str); + } + fflush($fp); + ObsLog::commonLog(DEBUG, "write file %s ok", $filePath); + } else { + ObsLog::commonLog(ERROR, "open file error,file path:%s", $filePath); + } + } finally { + if ($fp) { + fclose($fp); + } + $body->close(); + $body = null; + } + } + } + + private function parseXmlToException($body, $obsException) + { try { - $jsonErrorBody = trim($body -> getContents()); - if ($jsonErrorBody && ($data = json_decode($jsonErrorBody, true))) { - if (is_array($data)) { + $xmlErrorBody = trim($body->getContents()); + if ($xmlErrorBody) { + $xml = simplexml_load_string($xmlErrorBody); + if ($xml) { + $prefix = $this->getXpathPrefix($xml); + if ($tempXml = $xml->xpath('//' . $prefix . 'Code')) { + $obsException->setExceptionCode(strval($tempXml[0])); + } + if ($tempXml = $xml->xpath('//' . $prefix . 'RequestId')) { + $obsException->setRequestId(strval($tempXml[0])); + } + if ($tempXml = $xml->xpath('//' . $prefix . 'Message')) { + $obsException->setExceptionMessage(strval($tempXml[0])); + } + if ($tempXml = $xml->xpath('//' . $prefix . 'HostId')) { + $obsException->setHostId(strval($tempXml[0])); + } + } + } + } finally { + $body->close(); + } + } + + private function parseJsonToException($body, $obsException) + { + try { + $jsonErrorBody = trim($body->getContents()); + if ($jsonErrorBody) { + $data = json_decode($jsonErrorBody, true); + if ($data && is_array($data)) { if ($data['request_id']) { - $obsException -> setRequestId(strval($data['request_id'])); + $obsException->setRequestId(strval($data['request_id'])); } if ($data['code']) { - $obsException -> setExceptionCode(strval($data['code'])); + $obsException->setExceptionCode(strval($data['code'])); } if ($data['message']) { - $obsException -> setExceptionMessage(strval($data['message'])); + $obsException->setExceptionMessage(strval($data['message'])); } - } elseif (strlen($data)) { - ObsLog::commonLog(ERROR, "response body %s, and jsonToArray data is %s",$body, $data); - $obsException-> setExceptionMessage("Invalid response data,since it is not json data"); + } elseif ($data && strlen($data)) { + ObsLog::commonLog(ERROR, "response body %s, and jsonToArray data is %s", $body, $data); + $obsException->setExceptionMessage("Invalid response data,since it is not json data"); + } else { + // nothing handle } } } finally { - $body -> close(); + $body->close(); } } - private function parseJsonToModel($body, $model) { - try{ - $jsonErrorBody = trim($body -> getContents()); - if ($jsonErrorBody && ($jsonArray = json_decode($jsonErrorBody, true))) { - if (is_array($jsonArray)) { + private function parseJsonToModel($body, $model) + { + try { + $jsonErrorBody = trim($body->getContents()); + if ($jsonErrorBody) { + $jsonArray = json_decode($jsonErrorBody, true); + if ($jsonArray && is_array($jsonArray)) { if ($jsonArray['request_id']) { $model['RequestId'] = strval($jsonArray['request_id']); } @@ -299,157 +333,160 @@ private function parseJsonToModel($body, $model) { $model['Code'] = strval($jsonArray['code']); } if ($jsonArray['message']) { - $model['Message'] = strval($jsonArray['message']); + $model['Message'] = strval($jsonArray['message']); } - } elseif (strlen($jsonArray)) { - ObsLog::commonLog(ERROR, "response body %s, and jsonToArray data is %s",$body, $jsonArray); + } elseif ($jsonArray && strlen($jsonArray)) { + ObsLog::commonLog(ERROR, "response body %s, and jsonToArray data is %s", $body, $jsonArray); $model['Message'] = "Invalid response data,since it is not json data"; + } else { + // nothing handle } } } finally { - $body -> close(); + $body->close(); } } - - private function parseXmlToModel($body, $model){ - try{ - $xmlErrorBody = trim($body -> getContents()); - if($xmlErrorBody && ($xml = simplexml_load_string($xmlErrorBody))){ - $prefix = $this->getXpathPrefix($xml); - if ($tempXml = $xml->xpath('//'.$prefix . 'Code')) { - $model['Code'] = strval($tempXml[0]); - } - if ($tempXml = $xml->xpath('//'.$prefix . 'RequestId')) { - $model['RequestId'] = strval($tempXml[0]); - } - - if ($tempXml = $xml->xpath('//'.$prefix . 'HostId')) { - $model['HostId'] = strval($tempXml[0]); - } - if ($tempXml = $xml->xpath('//'.$prefix . 'Resource')) { - $model['Resource'] = strval($tempXml[0]); - } - - if ($tempXml = $xml->xpath('//'.$prefix . 'Message')) { - $model['Message'] = strval($tempXml[0]); - } - } - }finally { - $body -> close(); - } - } - - protected function parseResponse(Model $model, Request $request, Response $response, array $requestConfig) - { - $statusCode = $response -> getStatusCode(); - $expectedLength = $response -> getHeaderLine('content-length'); - $responseContentType = $response -> getHeaderLine('content-type'); - - $expectedLength = is_numeric($expectedLength) ? floatval($expectedLength) : null; - - $body = new CheckoutStream($response->getBody(), $expectedLength); - - if($statusCode >= 300){ - if($this-> exceptionResponseMode){ - $obsException= new ObsException(); - $obsException-> setRequest($request); - $obsException-> setResponse($response); - $obsException-> setExceptionType($this->isClientError($response) ? 'client' : 'server'); - if ($responseContentType === 'application/json') { - $this->parseJsonToException($body, $obsException); + + private function parseXmlToModel($body, $model) + { + try { + $xmlErrorBody = trim($body->getContents()); + $xml = simplexml_load_string($xmlErrorBody); + if ($xmlErrorBody && $xml) { + $prefix = $this->getXpathPrefix($xml); + if ($tempXml = $xml->xpath('//' . $prefix . 'Code')) { + $model['Code'] = strval($tempXml[0]); + } + if ($tempXml = $xml->xpath('//' . $prefix . 'RequestId')) { + $model['RequestId'] = strval($tempXml[0]); + } + + if ($tempXml = $xml->xpath('//' . $prefix . 'HostId')) { + $model['HostId'] = strval($tempXml[0]); + } + if ($tempXml = $xml->xpath('//' . $prefix . 'Resource')) { + $model['Resource'] = strval($tempXml[0]); + } + + if ($tempXml = $xml->xpath('//' . $prefix . 'Message')) { + $model['Message'] = strval($tempXml[0]); + } + } + } finally { + $body->close(); + } + } + + protected function parseResponse(Model $model, Request $request, Response $response, array $requestConfig) + { + $statusCode = $response->getStatusCode(); + $expectedLength = $response->getHeaderLine('content-length'); + $responseContentType = $response->getHeaderLine('content-type'); + + $expectedLength = is_numeric($expectedLength) ? floatval($expectedLength) : null; + + $body = new CheckoutStream($response->getBody(), $expectedLength); + + if ($statusCode >= 300) { + if ($this->exceptionResponseMode) { + $obsException = new ObsException(); + $obsException->setRequest($request); + $obsException->setResponse($response); + $obsException->setExceptionType($this->isClientError($response) ? 'client' : 'server'); + if ($responseContentType === 'application/json') { + $this->parseJsonToException($body, $obsException); } else { $this->parseXmlToException($body, $obsException); } - throw $obsException; - }else{ - $this->parseCommonHeaders($model, $response); + throw $obsException; + } else { + $this->parseCommonHeaders($model, $response); if ($responseContentType === 'application/json') { $this->parseJsonToModel($body, $model); } else { $this->parseXmlToModel($body, $model); } - } - - }else{ - if(!empty($model)){ - foreach ($model as $key => $value){ - if($key === 'method'){ - continue; - } - if(isset($value['type']) && $value['type'] === 'file'){ - $this->writeFile($value['value'], $body, $expectedLength); - } - $model[$key] = $value['value']; - } - } - - if(isset($requestConfig['responseParameters'])){ - $responseParameters = $requestConfig['responseParameters']; - if(isset($responseParameters['type']) && $responseParameters['type'] === 'object'){ - $responseParameters = $responseParameters['properties']; - } - $this->parseItems($responseParameters, $model, $response, $body); - } - } - - $model['HttpStatusCode'] = $statusCode; - $model['Reason'] = $response -> getReasonPhrase(); - } - - protected function getXpathPrefix($xml) - { - $namespaces = $xml -> getDocNamespaces(); - if (isset($namespaces[''])) { - $xml->registerXPathNamespace('ns', $namespaces['']); - $prefix = 'ns:'; - } else { - $prefix = ''; - } - return $prefix; - } - - protected function buildException(Request $request, RequestException $exception, $message) - { - $response = $exception-> hasResponse() ? $exception-> getResponse() : null; - $obsException= new ObsException($message ? $message : $exception-> getMessage()); - $obsException-> setExceptionType('client'); - $obsException-> setRequest($request); - if($response){ - $obsException-> setResponse($response); - $obsException-> setExceptionType($this->isClientError($response) ? 'client' : 'server'); - if ($this->isJsonResponse($response)) { - $this->parseJsonToException($response -> getBody(), $obsException); + } + } else { + if (!empty($model)) { + foreach ($model as $key => $value) { + if ($key === 'method') { + continue; + } + if (isset($value['type']) && $value['type'] === 'file') { + $this->writeFile($value['value'], $body); + } + $model[$key] = $value['value']; + } + } + + if (isset($requestConfig['responseParameters'])) { + $responseParameters = $requestConfig['responseParameters']; + if (isset($responseParameters['type']) && $responseParameters['type'] === 'object') { + $responseParameters = $responseParameters['properties']; + } + $this->parseItems($responseParameters, $model, $response, $body); + } + } + + $model['HttpStatusCode'] = $statusCode; + $model['Reason'] = $response->getReasonPhrase(); + } + + protected function getXpathPrefix($xml) + { + $namespaces = $xml->getDocNamespaces(); + if (isset($namespaces[''])) { + $xml->registerXPathNamespace('ns', $namespaces['']); + $prefix = 'ns:'; + } else { + $prefix = ''; + } + return $prefix; + } + + protected function buildException(Request $request, RequestException $exception, $message) + { + $response = $exception->hasResponse() ? $exception->getResponse() : null; + $obsException = new ObsException($message ? $message : $exception->getMessage()); + $obsException->setExceptionType('client'); + $obsException->setRequest($request); + if ($response) { + $obsException->setResponse($response); + $obsException->setExceptionType($this->isClientError($response) ? 'client' : 'server'); + if ($this->isJsonResponse($response)) { + $this->parseJsonToException($response->getBody(), $obsException); } else { - $this->parseXmlToException($response -> getBody(), $obsException); + $this->parseXmlToException($response->getBody(), $obsException); + } + if ($obsException->getRequestId() === null) { + $prefix = strcasecmp($this->signature, 'obs') === 0 ? 'x-obs-' : 'x-amz-'; + $requestId = $response->getHeaderLine($prefix . 'request-id'); + $obsException->setRequestId($requestId); } - if ($obsException->getRequestId() === null) { - $prefix = strcasecmp($this->signature, 'obs' ) === 0 ? 'x-obs-' : 'x-amz-'; - $requestId = $response->getHeaderLine($prefix . 'request-id'); - $obsException->setRequestId($requestId); - } - } - return $obsException; - } - - protected function parseExceptionAsync(Request $request, RequestException $exception, $message=null) - { - return $this->buildException($request, $exception, $message); - } - - protected function parseException(Model $model, Request $request, RequestException $exception, $message=null) - { - $response = $exception-> hasResponse() ? $exception-> getResponse() : null; - if($this-> exceptionResponseMode){ - throw $this->buildException($request, $exception, $message); - }else{ - if($response){ - $model['HttpStatusCode'] = $response -> getStatusCode(); - $model['Reason'] = $response -> getReasonPhrase(); - $this->parseXmlToModel($response -> getBody(), $model); - }else{ - $model['HttpStatusCode'] = -1; - $model['Message'] = $exception -> getMessage(); - } - } - } + } + return $obsException; + } + + protected function parseExceptionAsync(Request $request, RequestException $exception, $message = null) + { + return $this->buildException($request, $exception, $message); + } + + protected function parseException(Model $model, Request $request, RequestException $exception, $message = null) + { + $response = $exception->hasResponse() ? $exception->getResponse() : null; + if ($this->exceptionResponseMode) { + throw $this->buildException($request, $exception, $message); + } else { + if ($response) { + $model['HttpStatusCode'] = $response->getStatusCode(); + $model['Reason'] = $response->getReasonPhrase(); + $this->parseXmlToModel($response->getBody(), $model); + } else { + $model['HttpStatusCode'] = -1; + $model['Message'] = $exception->getMessage(); + } + } + } } \ No newline at end of file diff --git a/Obs/Internal/Resource/Constants.php b/Obs/Internal/Resource/Constants.php index 6f99d80..6a416d1 100644 --- a/Obs/Internal/Resource/Constants.php +++ b/Obs/Internal/Resource/Constants.php @@ -17,124 +17,126 @@ namespace Obs\Internal\Resource; -class Constants { +class Constants +{ const ALLOWED_RESOURCE_PARAMTER_NAMES = [ - 'acl', - 'policy', - 'torrent', - 'logging', - 'location', - 'storageinfo', - 'quota', - 'storagepolicy', - 'requestpayment', - 'versions', - 'versioning', - 'versionid', - 'uploads', - 'uploadid', - 'partnumber', - 'website', - 'notification', - 'lifecycle', - 'deletebucket', - 'delete', - 'cors', - 'restore', - 'tagging', - 'response-content-type', - 'response-content-language', - 'response-expires', - 'response-cache-control', - 'response-content-disposition', - 'response-content-encoding', - 'x-image-process', + 'acl', + 'policy', + 'torrent', + 'logging', + 'location', + 'storageinfo', + 'quota', + 'storagepolicy', + 'requestpayment', + 'versions', + 'versioning', + 'versionid', + 'uploads', + 'uploadid', + 'partnumber', + 'website', + 'notification', + 'lifecycle', + 'deletebucket', + 'delete', + 'cors', + 'restore', + 'tagging', + 'response-content-type', + 'response-content-language', + 'response-expires', + 'response-cache-control', + 'response-content-disposition', + 'response-content-encoding', + 'x-image-process', - 'backtosource', - 'storageclass', - 'replication', - 'append', - 'position', - 'x-oss-process', + 'backtosource', + 'storageclass', + 'replication', + 'append', + 'position', + 'x-oss-process', - 'CDNNotifyConfiguration', - 'attname', - 'customdomain', - 'directcoldaccess', - 'encryption', - 'inventory', - 'length', - 'metadata', - 'modify', - 'name', - 'rename', - 'truncate', - 'x-image-save-bucket', - 'x-image-save-object', - 'x-obs-security-token', - 'x-obs-callback', + 'CDNNotifyConfiguration', + 'attname', + 'customdomain', + 'directcoldaccess', + 'encryption', + 'inventory', + 'length', + 'metadata', + 'modify', + 'name', + 'rename', + 'truncate', + 'x-image-save-bucket', + 'x-image-save-object', + 'x-obs-security-token', + 'x-obs-callback', ]; - const ALLOWED_REQUEST_HTTP_HEADER_METADATA_NAMES = [ - 'content-type', - 'content-md5', - 'content-length', - 'content-language', - 'expires', - 'origin', - 'cache-control', - 'content-disposition', - 'content-encoding', - 'access-control-request-method', - 'access-control-request-headers', - 'x-default-storage-class', - 'location', - 'date', - 'etag', - 'range', - 'host', - 'if-modified-since', - 'if-unmodified-since', - 'if-match', - 'if-none-match', - 'last-modified', - 'content-range', + const ALLOWED_REQUEST_HTTP_HEADER_METADATA_NAMES = [ + 'content-type', + 'content-md5', + 'content-length', + 'content-language', + 'expires', + 'origin', + 'cache-control', + 'content-disposition', + 'content-encoding', + 'access-control-request-method', + 'access-control-request-headers', + 'x-default-storage-class', + 'location', + 'date', + 'etag', + 'range', + 'host', + 'if-modified-since', + 'if-unmodified-since', + 'if-match', + 'if-none-match', + 'last-modified', + 'content-range', - 'success-action-redirect' + 'success-action-redirect', ]; - const ALLOWED_RESPONSE_HTTP_HEADER_METADATA_NAMES = [ - 'content-type', - 'content-md5', - 'content-length', - 'content-language', - 'expires', - 'origin', - 'cache-control', - 'content-disposition', - 'content-encoding', - 'x-default-storage-class', - 'location', - 'date', - 'etag', - 'host', - 'last-modified', - 'content-range', - 'x-reserved', - 'access-control-allow-origin', - 'access-control-allow-headers', - 'access-control-max-age', - 'access-control-allow-methods', - 'access-control-expose-headers', - 'connection' + const ALLOWED_RESPONSE_HTTP_HEADER_METADATA_NAMES = [ + 'content-type', + 'content-md5', + 'content-length', + 'content-language', + 'expires', + 'origin', + 'cache-control', + 'content-disposition', + 'content-encoding', + 'x-default-storage-class', + 'location', + 'date', + 'etag', + 'host', + 'last-modified', + 'content-range', + 'x-reserved', + 'access-control-allow-origin', + 'access-control-allow-headers', + 'access-control-max-age', + 'access-control-allow-methods', + 'access-control-expose-headers', + 'connection', ]; - - public static function selectConstants($signature) { - $signature = (strcasecmp ( $signature, 'obs' ) === 0) ? 'OBS' : 'V2'; + + public static function selectConstants($signature) + { + $signature = (strcasecmp($signature, 'obs') === 0) ? 'OBS' : 'V2'; return __NAMESPACE__ . '\\' . $signature . 'Constants'; } - - public static function selectRequestResource($signature) { - $signature = (strcasecmp ( $signature, 'obs' ) === 0) ? 'OBS' : 'V2'; + + public static function selectRequestResource($signature) + { + $signature = (strcasecmp($signature, 'obs') === 0) ? 'OBS' : 'V2'; return (__NAMESPACE__ . '\\' . $signature . 'RequestResource'); } - } \ No newline at end of file diff --git a/Obs/Internal/Resource/OBSConstants.php b/Obs/Internal/Resource/OBSConstants.php index 490dd21..f817def 100644 --- a/Obs/Internal/Resource/OBSConstants.php +++ b/Obs/Internal/Resource/OBSConstants.php @@ -17,19 +17,20 @@ namespace Obs\Internal\Resource; -class OBSConstants extends Constants { +class OBSConstants extends Constants +{ const FLAG = 'OBS'; const METADATA_PREFIX = 'x-obs-meta-'; const HEADER_PREFIX = 'x-obs-'; const ALTERNATIVE_DATE_HEADER = 'x-obs-date'; const SECURITY_TOKEN_HEAD = 'x-obs-security-token'; const TEMPURL_AK_HEAD = 'AccessKeyId'; - + const COMMON_HEADERS = [ 'content-length' => 'ContentLength', 'date' => 'Date', 'x-obs-request-id' => 'RequestId', 'x-obs-id-2' => 'Id2', - 'x-reserved' => 'Reserved' + 'x-reserved' => 'Reserved', ]; } diff --git a/Obs/Internal/Resource/OBSRequestResource.php b/Obs/Internal/Resource/OBSRequestResource.php index 38ceb42..8deecd7 100644 --- a/Obs/Internal/Resource/OBSRequestResource.php +++ b/Obs/Internal/Resource/OBSRequestResource.php @@ -17,4288 +17,4592 @@ namespace Obs\Internal\Resource; -class OBSRequestResource { - public static $RESOURCE_ARRAY = [ - 'operations' => [ - 'createBucket' => [ - 'httpMethod' => 'PUT', - 'data' => [ - 'xmlRoot' => [ - 'name' => 'CreateBucketConfiguration' - ] - ], - 'requestParameters' => [ - 'ACL' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-obs-acl', - 'transform' => 'aclHeader' - ], - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'LocationConstraint' => [ - 'type' => 'string', - 'location' => 'xml', - 'sentAs' => 'Location' - ], - 'StorageClass' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-obs-storage-class', - 'transform' => 'storageClass' - ] - ], - 'responseParameters' => [ - 'Location' => [ - 'type' => 'string', - 'location' => 'header' - ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ] - ] +class OBSRequestResource +{ + public static $resourceArray = [ + 'operations' => [ + 'createBucket' => [ + 'httpMethod' => 'PUT', + 'data' => [ + 'xmlRoot' => [ + 'name' => 'CreateBucketConfiguration', ], - - 'listBuckets' => [ - 'httpMethod' => 'GET', - 'responseParameters' => [ - 'Buckets' => [ - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'Buckets', - 'items' => [ - 'name' => 'Bucket', - 'type' => 'object', - 'sentAs' => 'Bucket', - 'properties' => [ - 'Name' => [ - 'type' => 'string' - ], - 'CreationDate' => [ - 'type' => 'string' - ], - 'Location' => [ - 'type' => 'string' - ] - ] - ] - ], - 'Owner' => [ - 'type' => 'object', - 'location' => 'xml', - 'properties' => [ - 'ID' => [ - 'type' => 'string' - ] - ] - ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ] - ] + ], + 'requestParameters' => [ + 'ACL' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-obs-acl', + 'transform' => 'aclHeader', + ], + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', ], + 'LocationConstraint' => [ + 'type' => 'string', + 'location' => 'xml', + 'sentAs' => 'Location', + ], + 'StorageClass' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-obs-storage-class', + 'transform' => 'storageClass', + ], + ], + 'responseParameters' => [ + 'Location' => [ + 'type' => 'string', + 'location' => 'header', + ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + ], + ], - 'deleteBucket' => [ - 'httpMethod' => 'DELETE', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ] + 'listBuckets' => [ + 'httpMethod' => 'GET', + 'responseParameters' => [ + 'Buckets' => [ + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'Buckets', + 'items' => [ + 'name' => 'Bucket', + 'type' => 'object', + 'sentAs' => 'Bucket', + 'properties' => [ + 'Name' => [ + 'type' => 'string', + ], + 'CreationDate' => [ + 'type' => 'string', + ], + 'Location' => [ + 'type' => 'string', + ], ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ] - ] - ] + ], ], - - 'listObjects' => [ - 'httpMethod' => 'GET', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'Delimiter' => [ - 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'delimiter' - ], - 'Marker' => [ - 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'marker' - ], - 'MaxKeys' => [ - 'type' => 'numeric', - 'location' => 'query', - 'sentAs' => 'max-keys' - ], - 'Prefix' => [ - 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'prefix' - ] + 'Owner' => [ + 'type' => 'object', + 'location' => 'xml', + 'properties' => [ + 'ID' => [ + 'type' => 'string', ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'IsTruncated' => [ - 'type' => 'boolean', - 'location' => 'xml' - ], - 'Marker' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'NextMarker' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'Contents' => [ - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'Contents', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'name' => 'Object', - 'type' => 'object', - 'properties' => [ - 'Key' => [ - 'type' => 'string' - ], - 'LastModified' => [ - 'type' => 'string' - ], - 'ETag' => [ - 'type' => 'string' - ], - 'Size' => [ - 'type' => 'integer' - ], - 'StorageClass' => [ - 'type' => 'string' - ], - 'Type' => [ - 'type' => 'string' - ], - 'Owner' => [ - 'type' => 'object', - 'properties' => [ - 'ID' => [ - 'type' => 'string' - ] - ] - ] - ] - ] - ], - 'Name' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'Prefix' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'Delimiter' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'MaxKeys' => [ - 'type' => 'integer', - 'location' => 'xml' - ], - 'CommonPrefixes' => [ - 'type' => 'array', - 'location' => 'xml', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'name' => 'CommonPrefix', - 'type' => 'object', - 'properties' => [ - 'Prefix' => [ - 'type' => 'string' - ] - ] - ] - ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ], - 'Location' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-bucket-location' - ] - ] - ] + ], ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + ], + ], - 'listVersions' => [ - 'httpMethod' => 'GET', - 'specialParam' => 'versions', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'Delimiter' => [ - 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'delimiter' - ], - 'KeyMarker' => [ - 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'key-marker' - ], - 'MaxKeys' => [ - 'type' => 'numeric', - 'location' => 'query', - 'sentAs' => 'max-keys' - ], - 'Prefix' => [ - 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'prefix' - ], - 'VersionIdMarker' => [ - 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'version-id-marker' - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'IsTruncated' => [ - 'type' => 'boolean', - 'location' => 'xml' - ], - 'KeyMarker' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'VersionIdMarker' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'NextKeyMarker' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'NextVersionIdMarker' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'Versions' => [ - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'Version', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'name' => 'ObjectVersion', - 'type' => 'object', - 'sentAs' => 'Version', - 'properties' => [ - 'ETag' => [ - 'type' => 'string' - ], - 'Size' => [ - 'type' => 'integer' - ], - 'StorageClass' => [ - 'type' => 'string' - ], - 'Key' => [ - 'type' => 'string' - ], - 'VersionId' => [ - 'type' => 'string' - ], - 'IsLatest' => [ - 'type' => 'boolean' - ], - 'LastModified' => [ - 'type' => 'string' - ], - 'Type' => [ - 'type' => 'string' - ], - 'Owner' => [ - 'type' => 'object', - 'properties' => [ - 'ID' => [ - 'type' => 'string' - ] - ] - ] - ] - ] - ], - 'DeleteMarkers' => [ - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'DeleteMarker', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'name' => 'DeleteMarkerEntry', - 'type' => 'object', - 'sentAs' => 'DeleteMarker', - 'properties' => [ - 'Owner' => [ - 'type' => 'object', - 'properties' => [ - 'ID' => [ - 'type' => 'string' - ] - ] - ], - 'Key' => [ - 'type' => 'string' - ], - 'VersionId' => [ - 'type' => 'string' - ], - 'IsLatest' => [ - 'type' => 'boolean' - ], - 'LastModified' => [ - 'type' => 'string' - ] - ] - ] - ], - 'Name' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'Prefix' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'Delimiter' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'MaxKeys' => [ - 'type' => 'integer', - 'location' => 'xml' - ], - 'CommonPrefixes' => [ - 'type' => 'array', - 'location' => 'xml', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'name' => 'CommonPrefix', - 'type' => 'object', - 'properties' => [ - 'Prefix' => [ - 'type' => 'string' - ] - ] - ] - ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ], - 'Location' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-bucket-location' - ] - ] - ] + 'deleteBucket' => [ + 'httpMethod' => 'DELETE', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + ], + ], + ], - 'getBucketMetadata' => [ - 'httpMethod' => 'HEAD', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'Origin' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'Origin' - ], - 'RequestHeader' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'Access-Control-Request-Headers' - ] + 'listObjects' => [ + 'httpMethod' => 'GET', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Delimiter' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'delimiter', + ], + 'Marker' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'marker', + ], + 'MaxKeys' => [ + 'type' => 'numeric', + 'location' => 'query', + 'sentAs' => 'max-keys', + ], + 'Prefix' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'prefix', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'IsTruncated' => [ + 'type' => 'boolean', + 'location' => 'xml', + ], + 'Marker' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'NextMarker' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'Contents' => [ + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'Contents', + 'data' => [ + 'xmlFlattened' => true, ], - 'responseParameters' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ], - 'StorageClass' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-storage-class' + 'items' => [ + 'name' => 'Object', + 'type' => 'object', + 'properties' => [ + 'Key' => [ + 'type' => 'string', ], - - 'Location' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-bucket-location' + 'LastModified' => [ + 'type' => 'string', ], - - 'AllowOrigin' => [ - 'location' => 'header', - 'sentAs' => 'access-control-allow-origin' + 'ETag' => [ + 'type' => 'string', ], - 'MaxAgeSeconds' => [ - 'location' => 'header', - 'sentAs' => 'access-control-max-age', - 'type' => 'integer' + 'Size' => [ + 'type' => 'integer', ], - 'ExposeHeader' => [ - 'location' => 'header', - 'sentAs' => 'access-control-expose-headers' + 'StorageClass' => [ + 'type' => 'string', ], - 'AllowMethod' => [ - 'location' => 'header', - 'sentAs' => 'access-control-allow-methods' + 'Type' => [ + 'type' => 'string', ], - 'AllowHeader' => [ - 'location' => 'header', - 'sentAs' => 'access-control-allow-headers' - ] - ] - ], - - 'getBucketLocation' => [ - 'httpMethod' => 'GET', - 'specialParam' => 'location', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'Location' => [ - 'type' => 'string', - 'location' => 'xml' + 'Owner' => [ + 'type' => 'object', + 'properties' => [ + 'ID' => [ + 'type' => 'string', ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ] - ] - ] - ], - - 'getBucketStorageInfo' => [ - 'httpMethod' => 'GET', - 'specialParam' => 'storageinfo', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ] + ], + ], + ], ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'Size' => [ - 'type' => 'numeric', - 'location' => 'xml', - 'sentAs' => 'Size' - ], - 'ObjectNumber' => [ - 'type' => 'integer', - 'location' => 'xml' - ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ] - ] - ] - ], - - 'setBucketQuota' => [ - 'httpMethod' => 'PUT', - 'specialParam' => 'quota', - 'data' => [ - 'xmlRoot' => [ - 'name' => 'Quota' - ] + ], + 'Name' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'Prefix' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'Delimiter' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'MaxKeys' => [ + 'type' => 'integer', + 'location' => 'xml', + ], + 'CommonPrefixes' => [ + 'type' => 'array', + 'location' => 'xml', + 'data' => [ + 'xmlFlattened' => true, ], - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' + 'items' => [ + 'name' => 'CommonPrefix', + 'type' => 'object', + 'properties' => [ + 'Prefix' => [ + 'type' => 'string', ], - 'StorageQuota' => [ - 'required' => true, - 'type' => 'numeric', - 'location' => 'xml' - ] + ], ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ] - ] - ] + ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + 'Location' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-bucket-location', + ], ], + ], + ], - 'getBucketQuota' => [ - 'httpMethod' => 'GET', - 'specialParam' => 'quota', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'StorageQuota' => [ - 'type' => 'integer', - 'location' => 'xml', - 'sentAs' => 'StorageQuota' - ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ] - ] - ] + 'listVersions' => [ + 'httpMethod' => 'GET', + 'specialParam' => 'versions', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', ], - - 'setBucketStoragePolicy' => [ - 'httpMethod' => 'PUT', - 'specialParam' => 'storageClass', - 'data' => [ - 'xmlRoot' => [ - 'name' => 'StorageClass' - ] - ], - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'StorageClass' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'xml', - 'transform' => 'storageClass', - 'data' => [ - 'xmlFlattened' => true - ] - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ] - ] - ] + 'Delimiter' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'delimiter', ], - - 'getBucketStoragePolicy' => [ - 'httpMethod' => 'GET', - 'specialParam' => 'storageClass', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'StorageClass' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ] - ] - ] + 'KeyMarker' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'key-marker', ], - - 'setBucketAcl' => [ - 'httpMethod' => 'PUT', - 'specialParam' => 'acl', - 'data' => [ - 'xmlRoot' => [ - 'name' => 'AccessControlPolicy' - ] + 'MaxKeys' => [ + 'type' => 'numeric', + 'location' => 'query', + 'sentAs' => 'max-keys', + ], + 'Prefix' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'prefix', + ], + 'VersionIdMarker' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'version-id-marker', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'IsTruncated' => [ + 'type' => 'boolean', + 'location' => 'xml', + ], + 'KeyMarker' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'VersionIdMarker' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'NextKeyMarker' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'NextVersionIdMarker' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'Versions' => [ + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'Version', + 'data' => [ + 'xmlFlattened' => true, ], - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'ACL' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-obs-acl', - 'transform' => 'aclHeader' + 'items' => [ + 'name' => 'ObjectVersion', + 'type' => 'object', + 'sentAs' => 'Version', + 'properties' => [ + 'ETag' => [ + 'type' => 'string', ], - 'GrantRead' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-obs-grant-read' + 'Size' => [ + 'type' => 'integer', ], - 'GrantWrite' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-obs-grant-write' + 'StorageClass' => [ + 'type' => 'string', ], - 'GrantReadAcp' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-obs-grant-read-acp' + 'Key' => [ + 'type' => 'string', ], - 'GrantWriteAcp' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-obs-grant-write-acp' + 'VersionId' => [ + 'type' => 'string', ], - 'GrantFullControl' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-obs-grant-full-control' + 'IsLatest' => [ + 'type' => 'boolean', ], - 'GrantDeliveryRead' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-obs-grant-read-delivered' + 'LastModified' => [ + 'type' => 'string', ], - 'GrantDeliveryFullControl' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-obs-grant-full-control-delivered' + 'Type' => [ + 'type' => 'string', ], - 'Owner' => [ - 'type' => 'object', - 'location' => 'xml', - 'properties' => [ - 'ID' => [ - 'type' => 'string' - ] - ] + 'Owner' => [ + 'type' => 'object', + 'properties' => [ + 'ID' => [ + 'type' => 'string', + ], + ], ], - 'Grants' => [ - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'AccessControlList', - 'items' => [ - 'name' => 'Grant', - 'type' => 'object', - 'properties' => [ - 'Grantee' => [ - 'type' => 'object', - 'properties' => [ - 'ID' => [ - 'type' => 'string' - ], - 'URI' => [ - 'type' => 'string', - 'sentAs' => 'Canned', - 'transform' => 'aclUri' - ] - ] - ], - 'Permission' => [ - 'type' => 'string' - ], - 'Delivered' => [ - 'type' => 'boolean' - ] - ] - ] - ] + ], ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ] - ] - ] - ], - - 'getBucketAcl' => [ - 'httpMethod' => 'GET', - 'specialParam' => 'acl', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ] + ], + 'DeleteMarkers' => [ + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'DeleteMarker', + 'data' => [ + 'xmlFlattened' => true, ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ], - 'Owner' => [ - 'type' => 'object', - 'location' => 'xml', - 'properties' => [ - 'ID' => [ - 'type' => 'string' - ] - ] + 'items' => [ + 'name' => 'DeleteMarkerEntry', + 'type' => 'object', + 'sentAs' => 'DeleteMarker', + 'properties' => [ + 'Owner' => [ + 'type' => 'object', + 'properties' => [ + 'ID' => [ + 'type' => 'string', ], - 'Grants' => [ - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'AccessControlList', - 'items' => [ - 'name' => 'Grant', - 'type' => 'object', - 'sentAs' => 'Grant', - 'properties' => [ - 'Grantee' => [ - 'type' => 'object', - 'properties' => [ - 'ID' => [ - 'type' => 'string' - ], - 'URI' => [ - 'type' => 'string', - 'sentAs' => 'Canned' - ] - ] - ], - 'Permission' => [ - 'type' => 'string' - ], - 'Delivered' => [ - 'type' => 'boolean' - ] - ] - ] - ] - ] - ] - ], - - 'setBucketLoggingConfiguration' => [ - 'httpMethod' => 'PUT', - 'specialParam' => 'logging', - 'data' => [ - 'xmlRoot' => [ - 'name' => 'BucketLoggingStatus' + ], ], - 'xmlAllowEmpty' => true - ], - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' + 'Key' => [ + 'type' => 'string', ], - 'Agency' => [ - 'type' => 'string', - 'location' => 'xml' + 'VersionId' => [ + 'type' => 'string', ], - 'LoggingEnabled' => [ - 'type' => 'object', - 'location' => 'xml', - 'properties' => [ - 'TargetBucket' => [ - 'type' => 'string' - ], - 'TargetPrefix' => [ - 'type' => 'string' - ], - 'TargetGrants' => [ - 'type' => 'array', - 'items' => [ - 'name' => 'Grant', - 'type' => 'object', - 'properties' => [ - 'Grantee' => [ - 'type' => 'object', - 'properties' => [ - 'ID' => [ - 'type' => 'string' - ], - 'URI' => [ - 'type' => 'string', - 'sentAs' => 'Canned', - 'transform' => 'aclUri' - ] - ] - ], - 'Permission' => [ - 'type' => 'string' - ] - ] - ] - ] - ] - ] + 'IsLatest' => [ + 'type' => 'boolean', + ], + 'LastModified' => [ + 'type' => 'string', + ], + ], ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ] - ] - ] - ], - - 'getBucketLoggingConfiguration' => [ - 'httpMethod' => 'GET', - 'specialParam' => 'logging', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ] + ], + 'Name' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'Prefix' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'Delimiter' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'MaxKeys' => [ + 'type' => 'integer', + 'location' => 'xml', + ], + 'CommonPrefixes' => [ + 'type' => 'array', + 'location' => 'xml', + 'data' => [ + 'xmlFlattened' => true, ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'Agency' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'LoggingEnabled' => [ - 'type' => 'object', - 'location' => 'xml', - 'properties' => [ - 'TargetBucket' => [ - 'type' => 'string' - ], - 'TargetGrants' => [ - 'type' => 'array', - 'sentAs' => 'TargetGrants', - 'items' => [ - 'name' => 'Grant', - 'type' => 'object', - 'sentAs' => 'Grant', - 'properties' => [ - 'Grantee' => [ - 'type' => 'object', - 'properties' => [ - 'ID' => [ - 'type' => 'string' - ], - 'URI' => [ - 'type' => 'string', - 'sentAs' => 'Canned' - ] - ] - ], - 'Permission' => [ - 'type' => 'string' - ] - ] - ] - ], - 'TargetPrefix' => [ - 'type' => 'string' - ] - ] - ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ] - ] - ] - ], - - 'setFetchPolicy' => [ - 'httpMethod' => 'PUT', - 'specialParam' => 'obsfetchpolicy', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' + 'items' => [ + 'name' => 'CommonPrefix', + 'type' => 'object', + 'properties' => [ + 'Prefix' => [ + 'type' => 'string', + ], + ], ], - 'Policy' => [ - 'required' => true, - 'type' => 'json', - 'location' => 'body' - ] ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ] - ] - ] + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + 'Location' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-bucket-location', + ], ], + ], + ], - 'getFetchPolicy' => [ - 'httpMethod' => 'GET', - 'specialParam' => 'obsfetchpolicy', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ] + 'getBucketMetadata' => [ + 'httpMethod' => 'HEAD', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Origin' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Origin', + ], + 'RequestHeader' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Access-Control-Request-Headers', + ], + ], + 'responseParameters' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + 'StorageClass' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-storage-class', + ], + + 'Location' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-bucket-location', + ], + + 'AllowOrigin' => [ + 'location' => 'header', + 'sentAs' => 'access-control-allow-origin', + ], + 'MaxAgeSeconds' => [ + 'location' => 'header', + 'sentAs' => 'access-control-max-age', + 'type' => 'integer', + ], + 'ExposeHeader' => [ + 'location' => 'header', + 'sentAs' => 'access-control-expose-headers', + ], + 'AllowMethod' => [ + 'location' => 'header', + 'sentAs' => 'access-control-allow-methods', + ], + 'AllowHeader' => [ + 'location' => 'header', + 'sentAs' => 'access-control-allow-headers', + ], + ], + ], + + 'getBucketLocation' => [ + 'httpMethod' => 'GET', + 'specialParam' => 'location', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'Location' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'Policy' => [ - 'type' => 'json', - 'location' => 'body' - ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ] - ] - ] ], + ], + ], - 'deleteFetchPolicy' => [ - 'httpMethod' => 'DELETE', - 'specialParam' => 'obsfetchpolicy', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ] + 'getBucketStorageInfo' => [ + 'httpMethod' => 'GET', + 'specialParam' => 'storageinfo', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'Size' => [ + 'type' => 'numeric', + 'location' => 'xml', + 'sentAs' => 'Size', + ], + 'ObjectNumber' => [ + 'type' => 'integer', + 'location' => 'xml', + ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', ], - 'responseParameters' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ] - ] ], + ], + ], - 'setBucketPolicy' => [ - 'httpMethod' => 'PUT', - 'specialParam' => 'policy', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'Policy' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'body' - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ] - ] - ] + 'setBucketQuota' => [ + 'httpMethod' => 'PUT', + 'specialParam' => 'quota', + 'data' => [ + 'xmlRoot' => [ + 'name' => 'Quota', + ], + ], + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', ], + 'StorageQuota' => [ + 'required' => true, + 'type' => 'numeric', + 'location' => 'xml', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + ], + ], + ], - 'getBucketPolicy' => [ - 'httpMethod' => 'GET', - 'specialParam' => 'policy', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'Policy' => [ - 'type' => 'string', - 'location' => 'body' - ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ] - ] - ] + 'getBucketQuota' => [ + 'httpMethod' => 'GET', + 'specialParam' => 'quota', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'StorageQuota' => [ + 'type' => 'integer', + 'location' => 'xml', + 'sentAs' => 'StorageQuota', + ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], ], + ], + ], - 'setFetchJob' => [ - 'httpMethod' => 'PUT', - 'specialParam' => 'obsfetchjob', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'Job' => [ - 'required' => true, - 'type' => 'json', - 'location' => 'body' - ] + 'setBucketStoragePolicy' => [ + 'httpMethod' => 'PUT', + 'specialParam' => 'storageClass', + 'data' => [ + 'xmlRoot' => [ + 'name' => 'StorageClass', + ], + ], + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'StorageClass' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'xml', + 'transform' => 'storageClass', + 'data' => [ + 'xmlFlattened' => true, + ], + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ], - 'JobInfo' => [ - 'type' => 'string', - 'location' => 'body' - ] - ] - ] ], + ], + ], - 'getFetchJob' => [ - 'httpMethod' => 'GET', - 'specialParam' => 'obsfetchjob', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'JobID' => [ - 'required' => true, + 'getBucketStoragePolicy' => [ + 'httpMethod' => 'GET', + 'specialParam' => 'storageClass', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'StorageClass' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + ], + ], + ], + + 'setBucketAcl' => [ + 'httpMethod' => 'PUT', + 'specialParam' => 'acl', + 'data' => [ + 'xmlRoot' => [ + 'name' => 'AccessControlPolicy', + ], + ], + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'ACL' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-obs-acl', + 'transform' => 'aclHeader', + ], + 'GrantRead' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-obs-grant-read', + ], + 'GrantWrite' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-obs-grant-write', + ], + 'GrantReadAcp' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-obs-grant-read-acp', + ], + 'GrantWriteAcp' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-obs-grant-write-acp', + ], + 'GrantFullControl' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-obs-grant-full-control', + ], + 'GrantDeliveryRead' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-obs-grant-read-delivered', + ], + 'GrantDeliveryFullControl' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-obs-grant-full-control-delivered', + ], + 'Owner' => [ + 'type' => 'object', + 'location' => 'xml', + 'properties' => [ + 'ID' => [ 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'x-fetch-job-id' ], ], - 'responseParameters' => [ + ], + 'Grants' => [ + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'AccessControlList', + 'items' => [ + 'name' => 'Grant', 'type' => 'object', 'properties' => [ - 'Job' => [ - 'type' => 'json', - 'location' => 'body' - ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ] - ] - ] - ], - - 'deleteBucketPolicy' => [ - 'httpMethod' => 'DELETE', - 'specialParam' => 'policy', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ] - ], - 'responseParameters' => [ + 'Grantee' => [ 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ] - ] - ] - ], - - 'setBucketLifecycleConfiguration' => [ - 'httpMethod' => 'PUT', - 'specialParam' => 'lifecycle', - 'data' => [ - 'xmlRoot' => [ - 'name' => 'LifecycleConfiguration' - ], - 'contentMd5' => true - ], - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, + 'properties' => [ + 'ID' => [ + 'type' => 'string', + ], + 'URI' => [ 'type' => 'string', - 'location' => 'dns' + 'sentAs' => 'Canned', + 'transform' => 'aclUri', + ], ], - 'Rules' => [ - 'required' => true, - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'Rule', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'name' => 'Rule', - 'type' => 'object', - 'sentAs' => 'Rule', - 'properties' => [ - 'Transitions' => [ - 'type' => 'array', - 'sentAs' => 'Transition', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'type' => 'object', - 'sentAs' => 'Transition', - 'properties' => [ - 'StorageClass' => [ - 'type' => 'string', - 'transform' => 'storageClass' - ], - 'Date' => [ - 'type' => 'string', - 'format' => 'date-time-middle' - ], - 'Days' => [ - 'type' => 'numeric' - ] - ] - ] - ], - 'Expiration' => [ - 'type' => 'object', - 'properties' => [ - 'Date' => [ - 'type' => 'string', - 'format' => 'date-time-middle' - ], - 'Days' => [ - 'type' => 'numeric' - ] - ] - ], - 'NoncurrentVersionTransitions' => [ - 'type' => 'array', - 'sentAs' => 'NoncurrentVersionTransition', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'type' => 'object', - 'sentAs' => 'NoncurrentVersionTransition', - 'properties' => [ - 'StorageClass' => [ - 'type' => 'string', - 'transform' => 'storageClass' - ], - 'NoncurrentDays' => [ - 'type' => 'numeric' - ] - ] - ] - ], - 'NoncurrentVersionExpiration' => [ - 'type' => 'object', - 'properties' => [ - 'NoncurrentDays' => [ - 'type' => 'numeric' - ] - ] - ], - 'ID' => [ - 'type' => 'string' - ], - 'Prefix' => [ - 'required' => true, - 'type' => 'string', - 'canEmpty' => true - ], - 'Status' => [ - 'required' => true, - 'type' => 'string' - ] - ] - ] - ] + ], + 'Permission' => [ + 'type' => 'string', + ], + 'Delivered' => [ + 'type' => 'boolean', + ], ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ] - ] - ] + ], ], - - 'getBucketLifecycleConfiguration' => [ - 'httpMethod' => 'GET', - 'specialParam' => 'lifecycle', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ], - 'Rules' => [ - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'Rule', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'name' => 'Rule', - 'type' => 'object', - 'sentAs' => 'Rule', - 'properties' => [ - 'Transitions' => [ - 'type' => 'array', - 'sentAs' => 'Transition', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'type' => 'object', - 'sentAs' => 'Transition', - 'properties' => [ - 'StorageClass' => [ - 'type' => 'string' - ], - 'Date' => [ - 'type' => 'string', - 'format' => 'date-time-middle' - ], - 'Days' => [ - 'type' => 'numeric' - ] - ] - ] - ], - 'Expiration' => [ - 'type' => 'object', - 'properties' => [ - 'Date' => [ - 'type' => 'string' - ], - 'Days' => [ - 'type' => 'integer' - ] - ] - ], - 'NoncurrentVersionTransitions' => [ - 'type' => 'array', - 'sentAs' => 'NoncurrentVersionTransition', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'type' => 'object', - 'sentAs' => 'NoncurrentVersionTransition', - 'properties' => [ - 'StorageClass' => [ - 'type' => 'string' - ], - 'NoncurrentDays' => [ - 'type' => 'numeric' - ] - ] - ] - ], - 'NoncurrentVersionExpiration' => [ - 'type' => 'object', - 'properties' => [ - 'NoncurrentDays' => [ - 'type' => 'integer' - ] - ] - ], - 'ID' => [ - 'type' => 'string' - ], - 'Prefix' => [ - 'type' => 'string' - ], - 'Status' => [ - 'type' => 'string' - ] - ] - ] - ] - ] - ] + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], ], + ], + ], - 'deleteBucketLifecycleConfiguration' => [ - 'httpMethod' => 'DELETE', - 'specialParam' => 'lifecycle', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ] - ] - ] + 'getBucketAcl' => [ + 'httpMethod' => 'GET', + 'specialParam' => 'acl', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', ], - - 'setBucketWebsiteConfiguration' => [ - 'httpMethod' => 'PUT', - 'specialParam' => 'website', - 'data' => [ - 'xmlRoot' => [ - 'name' => 'WebsiteConfiguration' - ] + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + 'Owner' => [ + 'type' => 'object', + 'location' => 'xml', + 'properties' => [ + 'ID' => [ + 'type' => 'string', + ], ], - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'ErrorDocument' => [ - 'type' => 'object', - 'location' => 'xml', - 'properties' => [ - 'Key' => [ - 'required' => true, - 'type' => 'string' - ] - ] + ], + 'Grants' => [ + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'AccessControlList', + 'items' => [ + 'name' => 'Grant', + 'type' => 'object', + 'sentAs' => 'Grant', + 'properties' => [ + 'Grantee' => [ + 'type' => 'object', + 'properties' => [ + 'ID' => [ + 'type' => 'string', + ], + 'URI' => [ + 'type' => 'string', + 'sentAs' => 'Canned', + ], + ], ], - 'IndexDocument' => [ - 'type' => 'object', - 'location' => 'xml', - 'properties' => [ - 'Suffix' => [ - 'required' => true, - 'type' => 'string' - ] - ] + 'Permission' => [ + 'type' => 'string', ], - 'RedirectAllRequestsTo' => [ - 'type' => 'object', - 'location' => 'xml', - 'properties' => [ - 'HostName' => [ - 'required' => true, - 'type' => 'string' - ], - 'Protocol' => [ - 'type' => 'string' - ] - ] + 'Delivered' => [ + 'type' => 'boolean', ], - 'RoutingRules' => [ - 'type' => 'array', - 'location' => 'xml', - 'items' => [ - 'name' => 'RoutingRule', - 'type' => 'object', - 'properties' => [ - 'Condition' => [ - 'type' => 'object', - 'properties' => [ - 'HttpErrorCodeReturnedEquals' => [ - 'type' => 'numeric' - ], - 'KeyPrefixEquals' => [ - 'type' => 'string' - ] - ] - ], - 'Redirect' => [ - 'required' => true, - 'type' => 'object', - 'properties' => [ - 'HostName' => [ - 'type' => 'string' - ], - 'HttpRedirectCode' => [ - 'type' => 'numeric' - ], - 'Protocol' => [ - 'type' => 'string' - ], - 'ReplaceKeyPrefixWith' => [ - 'type' => 'string' - ], - 'ReplaceKeyWith' => [ - 'type' => 'string' - ] - ] - ] - ] - ] - ] + ], ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ] - ] - ] + ], ], + ], + ], - 'getBucketWebsiteConfiguration' => [ - 'httpMethod' => 'GET', - 'specialParam' => 'website', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ], - 'RedirectAllRequestsTo' => [ - 'type' => 'object', - 'location' => 'xml', - 'properties' => [ - 'HostName' => [ - 'type' => 'string' - ], - 'Protocol' => [ - 'type' => 'string' - ] - ] - ], - 'IndexDocument' => [ - 'type' => 'object', - 'location' => 'xml', - 'properties' => [ - 'Suffix' => [ - 'type' => 'string' - ] - ] - ], - 'ErrorDocument' => [ - 'type' => 'object', - 'location' => 'xml', - 'properties' => [ - 'Key' => [ - 'type' => 'string' - ] - ] - ], - 'RoutingRules' => [ - 'type' => 'array', - 'location' => 'xml', - 'items' => [ - 'name' => 'RoutingRule', - 'type' => 'object', - 'sentAs' => 'RoutingRule', - 'properties' => [ - 'Condition' => [ - 'type' => 'object', - 'properties' => [ - 'HttpErrorCodeReturnedEquals' => [ - 'type' => 'integer' - ], - 'KeyPrefixEquals' => [ - 'type' => 'string' - ] - ] - ], - 'Redirect' => [ - 'type' => 'object', - 'properties' => [ - 'HostName' => [ - 'type' => 'string' - ], - 'HttpRedirectCode' => [ - 'type' => 'integer' - ], - 'Protocol' => [ - 'type' => 'string' - ], - 'ReplaceKeyPrefixWith' => [ - 'type' => 'string' - ], - 'ReplaceKeyWith' => [ - 'type' => 'string' - ] - ] - ] - ] - ] - ] - ] - ] + 'setBucketLoggingConfiguration' => [ + 'httpMethod' => 'PUT', + 'specialParam' => 'logging', + 'data' => [ + 'xmlRoot' => [ + 'name' => 'BucketLoggingStatus', ], - - 'deleteBucketWebsiteConfiguration' => [ - 'httpMethod' => 'DELETE', - 'specialParam' => 'website', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ] - ] - ] + 'xmlAllowEmpty' => true, + ], + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', ], - - 'setBucketVersioningConfiguration' => [ - 'httpMethod' => 'PUT', - 'specialParam' => 'versioning', - 'data' => [ - 'xmlRoot' => [ - 'name' => 'VersioningConfiguration' - ] - ], - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'Status' => [ - 'type' => 'string', - 'location' => 'xml' - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ] - ] - ] + 'Agency' => [ + 'type' => 'string', + 'location' => 'xml', ], - - 'getBucketVersioningConfiguration' => [ - 'httpMethod' => 'GET', - 'specialParam' => 'versioning', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ] + 'LoggingEnabled' => [ + 'type' => 'object', + 'location' => 'xml', + 'properties' => [ + 'TargetBucket' => [ + 'type' => 'string', + ], + 'TargetPrefix' => [ + 'type' => 'string', ], - 'responseParameters' => [ + 'TargetGrants' => [ + 'type' => 'array', + 'items' => [ + 'name' => 'Grant', 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ], - 'Status' => [ + 'properties' => [ + 'Grantee' => [ + 'type' => 'object', + 'properties' => [ + 'ID' => [ 'type' => 'string', - 'location' => 'xml' - ] - ] - ] - ], - - 'setBucketCors' => [ - 'httpMethod' => 'PUT', - 'specialParam' => 'cors', - 'data' => [ - 'xmlRoot' => [ - 'name' => 'CORSConfiguration' - ], - 'contentMd5' => true - ], - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, + ], + 'URI' => [ + 'type' => 'string', + 'sentAs' => 'Canned', + 'transform' => 'aclUri', + ], + ], + ], + 'Permission' => [ 'type' => 'string', - 'location' => 'dns' + ], ], - 'CorsRules' => [ - 'required' => true, - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'CORSRule', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'type' => 'object', - 'sentAs' => 'CORSRule', - 'properties' => [ - 'ID' => [ - 'type' => 'string' - ], - 'AllowedMethod' => [ - 'required' => true, - 'type' => 'array', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'type' => 'string', - 'sentAs' => 'AllowedMethod' - ] - ], - 'AllowedOrigin' => [ - 'required' => true, - 'type' => 'array', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'sentAs' => 'AllowedOrigin', - 'type' => 'string' - ] - ], - 'AllowedHeader' => [ - 'type' => 'array', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'name' => 'AllowedHeader', - 'type' => 'string' - ] - ], - 'MaxAgeSeconds' => [ - 'type' => 'numeric' - ], - 'ExposeHeader' => [ - 'type' => 'array', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'name' => 'ExposeHeader', - 'type' => 'string' - ] - ] - ] - ] - ] + ], ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ] - ] - ] + ], ], - - 'getBucketCors' => [ - 'httpMethod' => 'GET', - 'specialParam' => 'cors', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ], - 'CorsRules' => [ - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'CORSRule', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'type' => 'object', - 'properties' => [ - 'ID' => [ - 'type' => 'string' - ], - 'AllowedMethod' => [ - 'type' => 'array', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'type' => 'string', - 'sentAs' => 'AllowedMethod' - ] - ], - 'AllowedOrigin' => [ - 'type' => 'array', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'sentAs' => 'AllowedOrigin', - 'type' => 'string' - ] - ], - 'AllowedHeader' => [ - 'type' => 'array', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'name' => 'AllowedHeader', - 'type' => 'string' - ] - ], - 'MaxAgeSeconds' => [ - 'type' => 'integer' - ], - 'ExposeHeader' => [ - 'type' => 'array', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'name' => 'ExposeHeader', - 'type' => 'string' - ] - ] - ] - ] - ] - ] - ] + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], ], + ], + ], - 'deleteBucketCors' => [ - 'httpMethod' => 'DELETE', - 'specialParam' => 'cors', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ] - ] - ] + 'getBucketLoggingConfiguration' => [ + 'httpMethod' => 'GET', + 'specialParam' => 'logging', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', ], - - 'optionsBucket' => [ - 'httpMethod' => 'OPTIONS', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'Origin' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'header' - ], - 'AccessControlRequestMethods' => [ - 'required' => true, - 'type' => 'array', - 'location' => 'header', - 'items' => [ - 'sentAs' => 'Access-Control-Request-Method', - 'type' => 'string' - ] - ], - 'AccessControlRequestHeaders' => [ - 'type' => 'array', - 'location' => 'header', - 'items' => [ - 'sentAs' => 'Access-Control-Request-Headers', - 'type' => 'string' - ] - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ], - 'AllowOrigin' => [ - 'location' => 'header', - 'sentAs' => 'access-control-allow-origin' - ], - 'AllowHeader' => [ - 'location' => 'header', - 'sentAs' => 'access-control-allow-headers' - ], - 'AllowMethod' => [ - 'location' => 'header', - 'sentAs' => 'access-control-allow-methods' + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'Agency' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'LoggingEnabled' => [ + 'type' => 'object', + 'location' => 'xml', + 'properties' => [ + 'TargetBucket' => [ + 'type' => 'string', + ], + 'TargetGrants' => [ + 'type' => 'array', + 'sentAs' => 'TargetGrants', + 'items' => [ + 'name' => 'Grant', + 'type' => 'object', + 'sentAs' => 'Grant', + 'properties' => [ + 'Grantee' => [ + 'type' => 'object', + 'properties' => [ + 'ID' => [ + 'type' => 'string', + ], + 'URI' => [ + 'type' => 'string', + 'sentAs' => 'Canned', + ], + ], ], - 'ExposeHeader' => [ - 'location' => 'header', - 'sentAs' => 'access-control-expose-headers' + 'Permission' => [ + 'type' => 'string', ], - 'MaxAgeSeconds' => [ - 'location' => 'header', - 'sentAs' => 'access-control-max-age' - ] - ] - ] - ], - - 'setBucketTagging' => [ - 'httpMethod' => 'PUT', - 'specialParam' => 'tagging', - 'data' => [ - 'xmlRoot' => [ - 'name' => 'Tagging' - ], - 'contentMd5' => true - ], - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' + ], ], - 'Tags' => [ - 'required' => true, - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'TagSet', - 'items' => [ - 'required' => true, - 'type' => 'object', - 'name' => 'Tag', - 'properties' => [ - 'Key' => [ - 'required' => true, - 'type' => 'string' - ], - 'Value' => [ - 'required' => true, - 'type' => 'string' - ] - ] - ] - ] + ], + 'TargetPrefix' => [ + 'type' => 'string', + ], ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ] - ] - ] + ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], ], + ], + ], - 'getBucketTagging' => [ - 'httpMethod' => 'GET', - 'specialParam' => 'tagging', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ], - 'Tags' => [ - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'TagSet', - 'items' => [ - 'type' => 'object', - 'name' => 'Tag', - 'properties' => [ - 'Key' => [ - 'type' => 'string' - ], - 'Value' => [ - 'type' => 'string' - ] - ] - ] - ] - ] - ] + 'setFetchPolicy' => [ + 'httpMethod' => 'PUT', + 'specialParam' => 'obsfetchpolicy', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', ], - - 'deleteBucketTagging' => [ - 'httpMethod' => 'DELETE', - 'specialParam' => 'tagging', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ] - ] - ] + 'Policy' => [ + 'required' => true, + 'type' => 'json', + 'location' => 'body', ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + ], + ], + ], - 'setBucketNotification' => [ - 'httpMethod' => 'PUT', - 'specialParam' => 'notification', - 'data' => [ - 'xmlRoot' => [ - 'name' => 'NotificationConfiguration' - ], - 'xmlAllowEmpty' => true - ], - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'TopicConfigurations' => [ - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'TopicConfiguration', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'type' => 'object', - 'location' => 'xml', - 'sentAs' => 'TopicConfiguration', - 'properties' => [ - 'ID' => [ - 'type' => 'string', - 'sentAs' => 'Id' - ], - 'Filter' => [ - 'type' => 'array', - 'wrapper' => 'Filter', - 'sentAs' => 'Object', - 'items' => [ - 'type' => 'object', - 'sentAs' => 'FilterRule', - 'properties' => [ - 'Name' => [ - 'type' => 'string' - ], - - 'Value' => [ - 'type' => 'string' - ] - ] - ] - ], - 'Topic' => [ - 'type' => 'string' - ], - 'Event' => [ - 'type' => 'array', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'type' => 'string', - 'sentAs' => 'Event', - 'transform' => 'event' - ] - ], - ] - ] - ], - 'FunctionStageConfigurations' => [ - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'FunctionStageConfiguration', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'type' => 'object', - 'location' => 'xml', - 'sentAs' => 'FunctionStageConfiguration', - 'properties' => [ - 'ID' => [ - 'type' => 'string', - 'sentAs' => 'Id' - ], - 'FunctionStage' => [ - 'type' => 'string' - ], - 'Event' => [ - 'type' => 'array', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'type' => 'string', - 'sentAs' => 'Event' - ] - ], - 'Filter' => [ - 'type' => 'array', - 'wrapper' => 'Filter', - 'sentAs' => 'Object', - 'items' => [ - 'type' => 'object', - 'sentAs' => 'FilterRule', - 'properties' => [ - 'Name' => [ - 'type' => 'string' - ], - - 'Value' => [ - 'type' => 'string' - ] - ] - ] - ] - ] - ] - ], - 'FunctionGraphConfigurations' => [ - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'FunctionGraphConfiguration', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'type' => 'object', - 'location' => 'xml', - 'sentAs' => 'FunctionGraphConfiguration', - 'properties' => [ - 'ID' => [ - 'type' => 'string', - 'sentAs' => 'Id' - ], - 'FunctionGraph' => [ - 'type' => 'string' - ], - 'Event' => [ - 'type' => 'array', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'type' => 'string', - 'sentAs' => 'Event' - ] - ], - 'Filter' => [ - 'type' => 'array', - 'wrapper' => 'Filter', - 'sentAs' => 'Object', - 'items' => [ - 'type' => 'object', - 'sentAs' => 'FilterRule', - 'properties' => [ - 'Name' => [ - 'type' => 'string' - ], + 'getFetchPolicy' => [ + 'httpMethod' => 'GET', + 'specialParam' => 'obsfetchpolicy', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'Policy' => [ + 'type' => 'json', + 'location' => 'body', + ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + ], + ], + ], - 'Value' => [ - 'type' => 'string' - ] - ] - ] - ] - ] - ] - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ] - ] - ] + 'deleteFetchPolicy' => [ + 'httpMethod' => 'DELETE', + 'specialParam' => 'obsfetchpolicy', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', ], + ], + 'responseParameters' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + ], + ], - 'getBucketNotification' => [ - 'httpMethod' => 'GET', - 'specialParam' => 'notification', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ], - 'TopicConfigurations' => [ - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'TopicConfiguration', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'type' => 'object', - 'location' => 'xml', - 'sentAs' => 'TopicConfiguration', - 'properties' => [ - 'ID' => [ - 'type' => 'string', - 'sentAs' => 'Id' - ], - 'Topic' => [ - 'type' => 'string' - ], - 'Event' => [ - 'type' => 'array', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'type' => 'string', - 'sentAs' => 'Event' - ] - ], - 'Filter' => [ - 'type' => 'array', - 'wrapper' => 'Filter', - 'sentAs' => 'Object', - 'items' => [ - 'type' => 'object', - 'sentAs' => 'FilterRule', - 'properties' => [ - 'Name' => [ - 'type' => 'string' - ], + 'setBucketPolicy' => [ + 'httpMethod' => 'PUT', + 'specialParam' => 'policy', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Policy' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'body', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + ], + ], + ], - 'Value' => [ - 'type' => 'string' - ] - ] - ] - ] - ] - ] - ], - 'FunctionStageConfigurations' => [ - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'FunctionStageConfiguration', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'type' => 'object', - 'location' => 'xml', - 'sentAs' => 'FunctionStageConfiguration', - 'properties' => [ - 'ID' => [ - 'type' => 'string', - 'sentAs' => 'Id' - ], - 'FunctionStage' => [ - 'type' => 'string' - ], - 'Event' => [ - 'type' => 'array', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'type' => 'string', - 'sentAs' => 'Event' - ] - ], - 'Filter' => [ - 'type' => 'array', - 'wrapper' => 'Filter', - 'sentAs' => 'Object', - 'items' => [ - 'type' => 'object', - 'sentAs' => 'FilterRule', - 'properties' => [ - 'Name' => [ - 'type' => 'string' - ], + 'getBucketPolicy' => [ + 'httpMethod' => 'GET', + 'specialParam' => 'policy', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'Policy' => [ + 'type' => 'string', + 'location' => 'body', + ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + ], + ], + ], - 'Value' => [ - 'type' => 'string' - ] - ] - ] - ] - ] - ] - ], - 'FunctionGraphConfigurations' => [ - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'FunctionGraphConfiguration', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'type' => 'object', - 'location' => 'xml', - 'sentAs' => 'FunctionGraphConfiguration', - 'properties' => [ - 'ID' => [ - 'type' => 'string', - 'sentAs' => 'Id' - ], - 'FunctionGraph' => [ - 'type' => 'string' - ], - 'Event' => [ - 'type' => 'array', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'type' => 'string', - 'sentAs' => 'Event' - ] - ], - 'Filter' => [ - 'type' => 'array', - 'wrapper' => 'Filter', - 'sentAs' => 'Object', - 'items' => [ - 'type' => 'object', - 'sentAs' => 'FilterRule', - 'properties' => [ - 'Name' => [ - 'type' => 'string' - ], + 'setFetchJob' => [ + 'httpMethod' => 'PUT', + 'specialParam' => 'obsfetchjob', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Job' => [ + 'required' => true, + 'type' => 'json', + 'location' => 'body', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + 'JobInfo' => [ + 'type' => 'string', + 'location' => 'body', + ], + ], + ], + ], - 'Value' => [ - 'type' => 'string' - ] - ] - ] - ] - ] - ] - ] - ] - ] + 'getFetchJob' => [ + 'httpMethod' => 'GET', + 'specialParam' => 'obsfetchjob', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'JobID' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'x-fetch-job-id', ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'Job' => [ + 'type' => 'json', + 'location' => 'body', + ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + ], + ], + ], - 'optionsObject' => [ - 'httpMethod' => 'OPTIONS', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' + 'deleteBucketPolicy' => [ + 'httpMethod' => 'DELETE', + 'specialParam' => 'policy', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + ], + ], + ], + + 'setBucketLifecycleConfiguration' => [ + 'httpMethod' => 'PUT', + 'specialParam' => 'lifecycle', + 'data' => [ + 'xmlRoot' => [ + 'name' => 'LifecycleConfiguration', + ], + 'contentMd5' => true, + ], + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Rules' => [ + 'required' => true, + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'Rule', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'name' => 'Rule', + 'type' => 'object', + 'sentAs' => 'Rule', + 'properties' => [ + 'Transitions' => [ + 'type' => 'array', + 'sentAs' => 'Transition', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'type' => 'object', + 'sentAs' => 'Transition', + 'properties' => [ + 'StorageClass' => [ + 'type' => 'string', + 'transform' => 'storageClass', + ], + 'Date' => [ + 'type' => 'string', + 'format' => 'date-time-middle', + ], + 'Days' => [ + 'type' => 'numeric', + ], + ], ], - 'Key' => [ - 'required' => true, + ], + 'Expiration' => [ + 'type' => 'object', + 'properties' => [ + 'Date' => [ 'type' => 'string', - 'location' => 'uri' + 'format' => 'date-time-middle', + ], + 'Days' => [ + 'type' => 'numeric', + ], ], - 'Origin' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'header' + ], + 'NoncurrentVersionTransitions' => [ + 'type' => 'array', + 'sentAs' => 'NoncurrentVersionTransition', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'type' => 'object', + 'sentAs' => 'NoncurrentVersionTransition', + 'properties' => [ + 'StorageClass' => [ + 'type' => 'string', + 'transform' => 'storageClass', + ], + 'NoncurrentDays' => [ + 'type' => 'numeric', + ], + ], ], - 'AccessControlRequestMethods' => [ - 'required' => true, - 'type' => 'array', - 'location' => 'header', - 'items' => [ - 'sentAs' => 'Access-Control-Request-Method', - 'type' => 'string' - ] + ], + 'NoncurrentVersionExpiration' => [ + 'type' => 'object', + 'properties' => [ + 'NoncurrentDays' => [ + 'type' => 'numeric', + ], ], - 'AccessControlRequestHeaders' => [ - 'type' => 'array', - 'location' => 'header', - 'items' => [ - 'sentAs' => 'Access-Control-Request-Headers', - 'type' => 'string' - ] - ] + ], + 'ID' => [ + 'type' => 'string', + ], + 'Prefix' => [ + 'required' => true, + 'type' => 'string', + 'canEmpty' => true, + ], + 'Status' => [ + 'required' => true, + 'type' => 'string', + ], ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ], - 'AllowOrigin' => [ - 'location' => 'header', - 'sentAs' => 'access-control-allow-origin' - ], - 'AllowHeader' => [ - 'location' => 'header', - 'sentAs' => 'access-control-allow-headers' - ], - 'AllowMethod' => [ - 'location' => 'header', - 'sentAs' => 'access-control-allow-methods' - ], - 'ExposeHeader' => [ - 'location' => 'header', - 'sentAs' => 'access-control-expose-headers' - ], - 'MaxAgeSeconds' => [ - 'location' => 'header', - 'sentAs' => 'access-control-max-age' - ] - ] - ] + ], + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], ], + ], + ], - 'deleteObject' => [ - 'httpMethod' => 'DELETE', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'Key' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'uri' - ], - 'VersionId' => [ - 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'versionId' - ] + 'getBucketLifecycleConfiguration' => [ + 'httpMethod' => 'GET', + 'specialParam' => 'lifecycle', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + 'Rules' => [ + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'Rule', + 'data' => [ + 'xmlFlattened' => true, ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'DeleteMarker' => [ - 'type' => 'boolean', - 'location' => 'header', - 'sentAs' => 'x-obs-delete-marker' - ], - 'VersionId' => [ + 'items' => [ + 'name' => 'Rule', + 'type' => 'object', + 'sentAs' => 'Rule', + 'properties' => [ + 'Transitions' => [ + 'type' => 'array', + 'sentAs' => 'Transition', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'type' => 'object', + 'sentAs' => 'Transition', + 'properties' => [ + 'StorageClass' => [ + 'type' => 'string', + ], + 'Date' => [ 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-obs-version-id' + 'format' => 'date-time-middle', + ], + 'Days' => [ + 'type' => 'numeric', + ], ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ] - ] - ] - ], - 'deleteObjects' => [ - 'httpMethod' => 'POST', - 'specialParam' => 'delete', - 'data' => [ - 'xmlRoot' => [ - 'name' => 'Delete' - ], - 'contentMd5' => true - ], - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'Quiet' => [ - 'type' => 'boolean', - 'location' => 'xml' + ], ], - 'Objects' => [ - 'required' => true, - 'type' => 'array', - 'location' => 'xml', - 'data' => [ - 'xmlFlattened' => true + 'Expiration' => [ + 'type' => 'object', + 'properties' => [ + 'Date' => [ + 'type' => 'string', ], - 'items' => [ - 'type' => 'object', - 'sentAs' => 'Object', - 'properties' => [ - 'Key' => [ - 'required' => true, - 'type' => 'string' - ], - 'VersionId' => [ - 'type' => 'string' - ] - ] - ] - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'Deleteds' => [ - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'Deleted', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'name' => 'DeletedObject', - 'type' => 'object', - 'properties' => [ - 'Key' => [ - 'type' => 'string' - ], - 'VersionId' => [ - 'type' => 'string' - ], - 'DeleteMarker' => [ - 'type' => 'boolean' - ], - 'DeleteMarkerVersionId' => [ - 'type' => 'string' - ] - ] - ] - ], - 'Errors' => [ - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'Error', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'name' => 'Error', - 'type' => 'object', - 'sentAs' => 'Error', - 'properties' => [ - 'Key' => [ - 'type' => 'string' - ], - 'VersionId' => [ - 'type' => 'string' - ], - 'Code' => [ - 'type' => 'string' - ], - 'Message' => [ - 'type' => 'string' - ] - ] - ] + 'Days' => [ + 'type' => 'integer', ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ] - ] - ] - ], - - 'setObjectAcl' => [ - 'httpMethod' => 'PUT', - 'specialParam' => 'acl', - 'data' => [ - 'xmlRoot' => [ - 'name' => 'AccessControlPolicy' - ] - ], - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'Key' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'uri' - ], - 'VersionId' => [ - 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'versionId' - ], - 'ACL' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-obs-acl', - 'transform' => 'aclHeader' - ], - 'GrantRead' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-obs-grant-read' - ], - 'GrantWrite' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-obs-grant-write' + ], ], - 'GrantReadAcp' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-obs-grant-read-acp' + 'NoncurrentVersionTransitions' => [ + 'type' => 'array', + 'sentAs' => 'NoncurrentVersionTransition', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'type' => 'object', + 'sentAs' => 'NoncurrentVersionTransition', + 'properties' => [ + 'StorageClass' => [ + 'type' => 'string', + ], + 'NoncurrentDays' => [ + 'type' => 'numeric', + ], + ], + ], ], - 'GrantWriteAcp' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-obs-grant-write-acp' + 'NoncurrentVersionExpiration' => [ + 'type' => 'object', + 'properties' => [ + 'NoncurrentDays' => [ + 'type' => 'integer', + ], + ], ], - 'GrantFullControl' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-obs-grant-full-control' + 'ID' => [ + 'type' => 'string', ], - 'Owner' => [ - 'type' => 'object', - 'location' => 'xml', - 'properties' => [ - 'ID' => [ - 'type' => 'string' - ] - ] + 'Prefix' => [ + 'type' => 'string', ], - 'Delivered' => [ - 'type' => 'boolean' + 'Status' => [ + 'type' => 'string', ], - 'Grants' => [ - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'AccessControlList', - 'items' => [ - 'name' => 'Grant', - 'type' => 'object', - 'properties' => [ - 'Grantee' => [ - 'type' => 'object', - 'properties' => [ - 'ID' => [ - 'type' => 'string' - ], - 'URI' => [ - 'type' => 'string', - 'sentAs' => 'Canned', - 'transform' => 'aclUri' - ] - ] - ], - 'Permission' => [ - 'type' => 'string' - ] - ] - ] - ] + ], ], - 'responseParameters' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ] - ] + ], ], + ], + ], - 'getObjectAcl' => [ - 'httpMethod' => 'GET', - 'specialParam' => 'acl', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'Key' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'uri' - ], - 'VersionId' => [ - 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'versionId' - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'Owner' => [ - 'type' => 'object', - 'location' => 'xml', - 'properties' => [ - 'ID' => [ - 'type' => 'string' - ] - ] - ], - 'Delivered' => [ - 'type' => 'boolean', - 'location' => 'xml' - ], - 'Grants' => [ - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'AccessControlList', - 'items' => [ - 'name' => 'Grant', - 'type' => 'object', - 'sentAs' => 'Grant', - 'properties' => [ - 'Grantee' => [ - 'type' => 'object', - 'properties' => [ - 'ID' => [ - 'type' => 'string' - ], - 'URI' => [ - 'type' => 'string', - 'sentAs' => 'Canned' - ] - ] - ], - 'Permission' => [ - 'type' => 'string' - ] - ] - ] - ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ], - 'VersionId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-version-id' - ] - ] - ] + 'deleteBucketLifecycleConfiguration' => [ + 'httpMethod' => 'DELETE', + 'specialParam' => 'lifecycle', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], ], + ], + ], - 'restoreObject' => [ - 'httpMethod' => 'POST', - 'specialParam' => 'restore', - 'data' => [ - 'xmlRoot' => [ - 'name' => 'RestoreRequest' - ] + 'setBucketWebsiteConfiguration' => [ + 'httpMethod' => 'PUT', + 'specialParam' => 'website', + 'data' => [ + 'xmlRoot' => [ + 'name' => 'WebsiteConfiguration', + ], + ], + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'ErrorDocument' => [ + 'type' => 'object', + 'location' => 'xml', + 'properties' => [ + 'Key' => [ + 'required' => true, + 'type' => 'string', ], - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'Key' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'uri' - ], - 'VersionId' => [ - 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'versionId' - ], - 'Days' => [ - 'required' => true, - 'type' => 'numeric', - 'location' => 'xml', - 'sentAs' => 'Days' - ], - 'Tier' => [ - 'wrapper' => 'RestoreJob', - 'type' => 'string', - 'sentAs' => 'Tier', - 'location' => 'xml' - ] + ], + ], + 'IndexDocument' => [ + 'type' => 'object', + 'location' => 'xml', + 'properties' => [ + 'Suffix' => [ + 'required' => true, + 'type' => 'string', ], - 'responseParameters' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ] - ] + ], ], - - 'putObject' => [ - 'httpMethod' => 'PUT', - 'requestParameters' => [ - 'ACL' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-obs-acl', - 'transform' => 'aclHeader' - ], - 'StorageClass' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-obs-storage-class', - 'transform' => 'storageClass' - ], - 'Body' => [ - 'type' => 'stream', - 'location' => 'body' - ], - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'Callback' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-obs-callback' - ], - 'Key' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'uri' - ], - 'ContentMD5' => [ + 'RedirectAllRequestsTo' => [ + 'type' => 'object', + 'location' => 'xml', + 'properties' => [ + 'HostName' => [ + 'required' => true, + 'type' => 'string', + ], + 'Protocol' => [ + 'type' => 'string', + ], + ], + ], + 'RoutingRules' => [ + 'type' => 'array', + 'location' => 'xml', + 'items' => [ + 'name' => 'RoutingRule', + 'type' => 'object', + 'properties' => [ + 'Condition' => [ + 'type' => 'object', + 'properties' => [ + 'HttpErrorCodeReturnedEquals' => [ + 'type' => 'numeric', + ], + 'KeyPrefixEquals' => [ 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'Content-MD5' + ], ], - 'ContentType' => [ + ], + 'Redirect' => [ + 'required' => true, + 'type' => 'object', + 'properties' => [ + 'HostName' => [ 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'Content-Type' - ], - 'ContentLength' => [ + ], + 'HttpRedirectCode' => [ 'type' => 'numeric', - 'location' => 'header', - 'sentAs' => 'Content-Length' - ], - 'Metadata' => [ - 'type' => 'object', - 'location' => 'header', - 'sentAs' => 'x-obs-meta-' - ], - 'SourceFile' => [ - 'type' => 'file', - 'location' => 'body' - ], - 'WebsiteRedirectLocation' => [ + ], + 'Protocol' => [ 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-obs-website-redirect-location' - ], - 'SseKms' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption' - ], - 'SseKmsKey' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption-aws-kms-key-id' - ], - 'SseC' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption-customer-algorithm' - ], - 'SseCKey' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption-customer-key', - 'type' => 'password' - ], - 'SuccessRedirect' => [ - 'location' => 'header', + ], + 'ReplaceKeyPrefixWith' => [ 'type' => 'string', - 'sentAs' => 'success-action-redirect' - ], - 'Expires' => [ - 'location' => 'header', + ], + 'ReplaceKeyWith' => [ 'type' => 'string', - 'sentAs' => 'x-obs-expires' - ] + ], + ], + ], ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'ETag' => [ - 'type' => 'string', - 'location' => 'header' + ], + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + ], + ], + ], + + 'getBucketWebsiteConfiguration' => [ + 'httpMethod' => 'GET', + 'specialParam' => 'website', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + 'RedirectAllRequestsTo' => [ + 'type' => 'object', + 'location' => 'xml', + 'properties' => [ + 'HostName' => [ + 'type' => 'string', + ], + 'Protocol' => [ + 'type' => 'string', + ], + ], + ], + 'IndexDocument' => [ + 'type' => 'object', + 'location' => 'xml', + 'properties' => [ + 'Suffix' => [ + 'type' => 'string', + ], + ], + ], + 'ErrorDocument' => [ + 'type' => 'object', + 'location' => 'xml', + 'properties' => [ + 'Key' => [ + 'type' => 'string', + ], + ], + ], + 'RoutingRules' => [ + 'type' => 'array', + 'location' => 'xml', + 'items' => [ + 'name' => 'RoutingRule', + 'type' => 'object', + 'sentAs' => 'RoutingRule', + 'properties' => [ + 'Condition' => [ + 'type' => 'object', + 'properties' => [ + 'HttpErrorCodeReturnedEquals' => [ + 'type' => 'integer', ], - 'VersionId' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-obs-version-id' + 'KeyPrefixEquals' => [ + 'type' => 'string', ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' + ], + ], + 'Redirect' => [ + 'type' => 'object', + 'properties' => [ + 'HostName' => [ + 'type' => 'string', ], - 'StorageClass' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-storage-class' + 'HttpRedirectCode' => [ + 'type' => 'integer', ], - 'SseKms' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption' + 'Protocol' => [ + 'type' => 'string', ], - 'SseKmsKey' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption-aws-kms-key-id' + 'ReplaceKeyPrefixWith' => [ + 'type' => 'string', ], - 'SseC' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption-customer-algorithm' + 'ReplaceKeyWith' => [ + 'type' => 'string', ], - 'SseCKeyMd5' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption-customer-key-MD5' - ] - ] - ] + ], + ], + ], + ], + ], ], + ], + ], - 'getObject' => [ - 'httpMethod' => 'GET', - 'stream' => true, - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'IfMatch' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'If-Match' - ], - 'IfModifiedSince' => [ - 'type' => 'string', - 'format' => 'date-time-http', - 'location' => 'header', - 'sentAs' => 'If-Modified-Since' + 'deleteBucketWebsiteConfiguration' => [ + 'httpMethod' => 'DELETE', + 'specialParam' => 'website', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + ], + ], + ], + + 'setBucketVersioningConfiguration' => [ + 'httpMethod' => 'PUT', + 'specialParam' => 'versioning', + 'data' => [ + 'xmlRoot' => [ + 'name' => 'VersioningConfiguration', + ], + ], + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Status' => [ + 'type' => 'string', + 'location' => 'xml', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + ], + ], + ], + + 'getBucketVersioningConfiguration' => [ + 'httpMethod' => 'GET', + 'specialParam' => 'versioning', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + 'Status' => [ + 'type' => 'string', + 'location' => 'xml', + ], + ], + ], + ], + + 'setBucketCors' => [ + 'httpMethod' => 'PUT', + 'specialParam' => 'cors', + 'data' => [ + 'xmlRoot' => [ + 'name' => 'CORSConfiguration', + ], + 'contentMd5' => true, + ], + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'CorsRules' => [ + 'required' => true, + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'CORSRule', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'type' => 'object', + 'sentAs' => 'CORSRule', + 'properties' => [ + 'ID' => [ + 'type' => 'string', + ], + 'AllowedMethod' => [ + 'required' => true, + 'type' => 'array', + 'data' => [ + 'xmlFlattened' => true, ], - 'IfNoneMatch' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'If-None-Match' + 'items' => [ + 'type' => 'string', + 'sentAs' => 'AllowedMethod', ], - 'IfUnmodifiedSince' => [ - 'type' => 'string', - 'format' => 'date-time-http', - 'location' => 'header', - 'sentAs' => 'If-Unmodified-Since' + ], + 'AllowedOrigin' => [ + 'required' => true, + 'type' => 'array', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'sentAs' => 'AllowedOrigin', + 'type' => 'string', ], - 'Key' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'uri' + ], + 'AllowedHeader' => [ + 'type' => 'array', + 'data' => [ + 'xmlFlattened' => true, ], - 'Range' => [ - 'type' => 'string', - 'location' => 'header' + 'items' => [ + 'name' => 'AllowedHeader', + 'type' => 'string', ], - 'ImageProcess' => [ - 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'x-image-process' + ], + 'MaxAgeSeconds' => [ + 'type' => 'numeric', + ], + 'ExposeHeader' => [ + 'type' => 'array', + 'data' => [ + 'xmlFlattened' => true, ], - 'ResponseCacheControl' => [ - 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'response-cache-control' + 'items' => [ + 'name' => 'ExposeHeader', + 'type' => 'string', ], - 'ResponseContentDisposition' => [ - 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'response-content-disposition' + ], + ], + ], + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + ], + ], + ], + + 'getBucketCors' => [ + 'httpMethod' => 'GET', + 'specialParam' => 'cors', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + 'CorsRules' => [ + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'CORSRule', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'type' => 'object', + 'properties' => [ + 'ID' => [ + 'type' => 'string', ], - 'ResponseContentEncoding' => [ + 'AllowedMethod' => [ + 'type' => 'array', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'response-content-encoding' + 'sentAs' => 'AllowedMethod', + ], ], - 'ResponseContentLanguage' => [ + 'AllowedOrigin' => [ + 'type' => 'array', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'sentAs' => 'AllowedOrigin', 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'response-content-language' + ], ], - 'ResponseContentType' => [ + 'AllowedHeader' => [ + 'type' => 'array', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'name' => 'AllowedHeader', 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'response-content-type' + ], ], - 'ResponseExpires' => [ - 'type' => 'string', - 'format' => 'date-time-http', - 'location' => 'query', - 'sentAs' => 'response-expires' + 'MaxAgeSeconds' => [ + 'type' => 'integer', ], - 'VersionId' => [ + 'ExposeHeader' => [ + 'type' => 'array', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'name' => 'ExposeHeader', 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'versionId' + ], ], - 'SaveAsFile' => [ - 'type' => 'file', - 'location' => 'response' + ], + ], + ], + ], + ], + ], + + 'deleteBucketCors' => [ + 'httpMethod' => 'DELETE', + 'specialParam' => 'cors', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + ], + ], + ], + + 'optionsBucket' => [ + 'httpMethod' => 'OPTIONS', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Origin' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'header', + ], + 'AccessControlRequestMethods' => [ + 'required' => true, + 'type' => 'array', + 'location' => 'header', + 'items' => [ + 'sentAs' => 'Access-Control-Request-Method', + 'type' => 'string', + ], + ], + 'AccessControlRequestHeaders' => [ + 'type' => 'array', + 'location' => 'header', + 'items' => [ + 'sentAs' => 'Access-Control-Request-Headers', + 'type' => 'string', + ], + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + 'AllowOrigin' => [ + 'location' => 'header', + 'sentAs' => 'access-control-allow-origin', + ], + 'AllowHeader' => [ + 'location' => 'header', + 'sentAs' => 'access-control-allow-headers', + ], + 'AllowMethod' => [ + 'location' => 'header', + 'sentAs' => 'access-control-allow-methods', + ], + 'ExposeHeader' => [ + 'location' => 'header', + 'sentAs' => 'access-control-expose-headers', + ], + 'MaxAgeSeconds' => [ + 'location' => 'header', + 'sentAs' => 'access-control-max-age', + ], + ], + ], + ], + + 'setBucketTagging' => [ + 'httpMethod' => 'PUT', + 'specialParam' => 'tagging', + 'data' => [ + 'xmlRoot' => [ + 'name' => 'Tagging', + ], + 'contentMd5' => true, + ], + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Tags' => [ + 'required' => true, + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'TagSet', + 'items' => [ + 'required' => true, + 'type' => 'object', + 'name' => 'Tag', + 'properties' => [ + 'Key' => [ + 'required' => true, + 'type' => 'string', + ], + 'Value' => [ + 'required' => true, + 'type' => 'string', + ], + ], + ], + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + ], + ], + ], + + 'getBucketTagging' => [ + 'httpMethod' => 'GET', + 'specialParam' => 'tagging', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + 'Tags' => [ + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'TagSet', + 'items' => [ + 'type' => 'object', + 'name' => 'Tag', + 'properties' => [ + 'Key' => [ + 'type' => 'string', ], - 'FilePath' => [ - 'type' => 'file', - 'location' => 'response' + 'Value' => [ + 'type' => 'string', ], + ], + ], + ], + ], + ], + ], - 'Origin' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'Origin' + 'deleteBucketTagging' => [ + 'httpMethod' => 'DELETE', + 'specialParam' => 'tagging', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + ], + ], + ], + + 'setBucketNotification' => [ + 'httpMethod' => 'PUT', + 'specialParam' => 'notification', + 'data' => [ + 'xmlRoot' => [ + 'name' => 'NotificationConfiguration', + ], + 'xmlAllowEmpty' => true, + ], + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'TopicConfigurations' => [ + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'TopicConfiguration', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'type' => 'object', + 'location' => 'xml', + 'sentAs' => 'TopicConfiguration', + 'properties' => [ + 'ID' => [ + 'type' => 'string', + 'sentAs' => 'Id', + ], + 'Filter' => [ + 'type' => 'array', + 'wrapper' => 'Filter', + 'sentAs' => 'Object', + 'items' => [ + 'type' => 'object', + 'sentAs' => 'FilterRule', + 'properties' => [ + 'Name' => [ + 'type' => 'string', + ], + + 'Value' => [ + 'type' => 'string', + ], + ], ], - 'RequestHeader' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'Access-Control-Request-Headers' + ], + 'Topic' => [ + 'type' => 'string', + ], + 'Event' => [ + 'type' => 'array', + 'data' => [ + 'xmlFlattened' => true, ], - 'SseC' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption-customer-algorithm' + 'items' => [ + 'type' => 'string', + 'sentAs' => 'Event', + 'transform' => 'event', ], - 'SseCKey' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption-customer-key', - 'type' => 'password' - ] + ], ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'Body' => [ - 'type' => 'stream', - 'location' => 'body' - ], - 'DeleteMarker' => [ - 'type' => 'boolean', - 'location' => 'header', - 'sentAs' => 'x-obs-delete-marker' - ], - 'Expiration' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-obs-expiration' - ], - 'LastModified' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'last-modified' - ], - 'ContentLength' => [ - 'type' => 'integer', - 'location' => 'header', - 'sentAs' => 'content-length' - ], - 'ETag' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'etag' - ], - 'VersionId' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-obs-version-id' - ], - 'CacheControl' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'cache-control' - ], - 'ContentDisposition' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'content-disposition' - ], - 'ContentEncoding' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'content-encoding' - ], - 'ContentLanguage' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'content-language' - ], - 'ContentType' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'content-type' - ], - 'Expires' => [ - 'type' => 'string', - 'location' => 'header' - ], - 'WebsiteRedirectLocation' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-obs-website-redirect-location' - ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ], - 'StorageClass' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-storage-class' - ], - 'Restore' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-restore' - ], - 'AllowOrigin' => [ - 'location' => 'header', - 'sentAs' => 'access-control-allow-origin' - ], - 'MaxAgeSeconds' => [ - 'location' => 'header', - 'sentAs' => 'access-control-max-age' - ], - 'ExposeHeader' => [ - 'location' => 'header', - 'sentAs' => 'access-control-expose-headers' - ], - 'AllowMethod' => [ - 'location' => 'header', - 'sentAs' => 'access-control-allow-methods' - ], - 'AllowHeader' => [ - 'location' => 'header', - 'sentAs' => 'access-control-allow-headers' - ], - 'SseKms' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption' - ], - 'SseKmsKey' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption-aws-kms-key-id' - ], - 'SseC' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption-customer-algorithm' + ], + ], + 'FunctionStageConfigurations' => [ + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'FunctionStageConfiguration', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'type' => 'object', + 'location' => 'xml', + 'sentAs' => 'FunctionStageConfiguration', + 'properties' => [ + 'ID' => [ + 'type' => 'string', + 'sentAs' => 'Id', + ], + 'FunctionStage' => [ + 'type' => 'string', + ], + 'Event' => [ + 'type' => 'array', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'type' => 'string', + 'sentAs' => 'Event', + ], + ], + 'Filter' => [ + 'type' => 'array', + 'wrapper' => 'Filter', + 'sentAs' => 'Object', + 'items' => [ + 'type' => 'object', + 'sentAs' => 'FilterRule', + 'properties' => [ + 'Name' => [ + 'type' => 'string', ], - 'SseCKeyMd5' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption-customer-key-MD5' + + 'Value' => [ + 'type' => 'string', ], - 'Metadata' => [ - 'location' => 'header', - 'type' => 'object', - 'sentAs' => 'x-obs-meta-' + ], + ], + ], + ], + ], + ], + 'FunctionGraphConfigurations' => [ + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'FunctionGraphConfiguration', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'type' => 'object', + 'location' => 'xml', + 'sentAs' => 'FunctionGraphConfiguration', + 'properties' => [ + 'ID' => [ + 'type' => 'string', + 'sentAs' => 'Id', + ], + 'FunctionGraph' => [ + 'type' => 'string', + ], + 'Event' => [ + 'type' => 'array', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'type' => 'string', + 'sentAs' => 'Event', + ], + ], + 'Filter' => [ + 'type' => 'array', + 'wrapper' => 'Filter', + 'sentAs' => 'Object', + 'items' => [ + 'type' => 'object', + 'sentAs' => 'FilterRule', + 'properties' => [ + 'Name' => [ + 'type' => 'string', ], - 'ObjectType' => [ - 'location' => 'header', - 'type' => 'string', - 'sentAs' => 'x-obs-object-type' + + 'Value' => [ + 'type' => 'string', ], - 'AppendPosition' => [ - 'location' => 'header', - 'type' => 'string', - 'sentAs' => 'x-obs-next-append-position' - ] - ] - ] + ], + ], + ], + ], + ], + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], ], + ], + ], - 'copyObject' => [ - 'httpMethod' => 'PUT', - 'requestParameters' => [ - 'ACL' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-obs-acl', - 'transform' => 'aclHeader' - ], - 'StorageClass' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-obs-storage-class', - 'transform' => 'storageClass' + 'getBucketNotification' => [ + 'httpMethod' => 'GET', + 'specialParam' => 'notification', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + 'TopicConfigurations' => [ + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'TopicConfiguration', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'type' => 'object', + 'location' => 'xml', + 'sentAs' => 'TopicConfiguration', + 'properties' => [ + 'ID' => [ + 'type' => 'string', + 'sentAs' => 'Id', ], - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' + 'Topic' => [ + 'type' => 'string', ], - 'Key' => [ - 'required' => true, + 'Event' => [ + 'type' => 'array', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ 'type' => 'string', - 'location' => 'uri' + 'sentAs' => 'Event', + ], ], - 'CopySource' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-obs-copy-source' + 'Filter' => [ + 'type' => 'array', + 'wrapper' => 'Filter', + 'sentAs' => 'Object', + 'items' => [ + 'type' => 'object', + 'sentAs' => 'FilterRule', + 'properties' => [ + 'Name' => [ + 'type' => 'string', + ], + + 'Value' => [ + 'type' => 'string', + ], + ], + ], ], - 'CopySourceIfMatch' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-obs-copy-source-if-match' + ], + ], + ], + 'FunctionStageConfigurations' => [ + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'FunctionStageConfiguration', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'type' => 'object', + 'location' => 'xml', + 'sentAs' => 'FunctionStageConfiguration', + 'properties' => [ + 'ID' => [ + 'type' => 'string', + 'sentAs' => 'Id', ], - 'CopySourceIfModifiedSince' => [ - 'type' => 'string', - 'format' => 'date-time-http', - 'location' => 'header', - 'sentAs' => 'x-obs-copy-source-if-modified-since' + 'FunctionStage' => [ + 'type' => 'string', ], - 'CopySourceIfNoneMatch' => [ + 'Event' => [ + 'type' => 'array', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-obs-copy-source-if-none-match' + 'sentAs' => 'Event', + ], ], - 'CopySourceIfUnmodifiedSince' => [ - 'type' => 'string', - 'format' => 'date-time-http', - 'location' => 'header', - 'sentAs' => 'x-obs-copy-source-if-unmodified-since' - ], - 'MetadataDirective' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-obs-metadata-directive' - ], - 'ContentType' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'content-type' - ], - 'ContentEncoding' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'content-encoding' - ], - 'ContentLanguage' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'content-language' - ], - 'ContentDisposition' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'content-disposition' - ], - 'CacheControl' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'cache-control' - ], - 'Expires' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'expires' - ], - 'Metadata' => [ + 'Filter' => [ + 'type' => 'array', + 'wrapper' => 'Filter', + 'sentAs' => 'Object', + 'items' => [ 'type' => 'object', - 'location' => 'header', - 'sentAs' => 'x-obs-meta-' - ], - 'WebsiteRedirectLocation' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-obs-website-redirect-location' - ], - 'SseKms' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption' - ], - 'SseKmsKey' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption-aws-kms-key-id' - ], - 'SseC' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption-customer-algorithm' - ], - 'SseCKey' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption-customer-key', - 'type' => 'password' - ], - 'CopySourceSseC' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-copy-source-server-side-encryption-customer-algorithm' - ], - 'CopySourceSseCKey' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-copy-source-server-side-encryption-customer-key', - 'type' => 'password' - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'ETag' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'LastModified' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'VersionId' => [ + 'sentAs' => 'FilterRule', + 'properties' => [ + 'Name' => [ 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-obs-version-id' - ], - 'CopySourceVersionId' => [ + ], + + 'Value' => [ 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-obs-copy-source-version-id' - ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ], - 'SseKms' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption' - ], - 'SseKmsKey' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption-aws-kms-key-id' - ], - 'SseC' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption-customer-algorithm' + ], ], - 'SseCKeyMd5' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption-customer-key-MD5' - ] - ] - ] - ], - - 'getObjectMetadata' => [ - 'httpMethod' => 'HEAD', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'Key' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'uri' + ], ], - 'VersionId' => [ - 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'versionId' + ], + ], + ], + 'FunctionGraphConfigurations' => [ + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'FunctionGraphConfiguration', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'type' => 'object', + 'location' => 'xml', + 'sentAs' => 'FunctionGraphConfiguration', + 'properties' => [ + 'ID' => [ + 'type' => 'string', + 'sentAs' => 'Id', ], - 'Origin' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'Origin' + 'FunctionGraph' => [ + 'type' => 'string', ], - 'RequestHeader' => [ + 'Event' => [ + 'type' => 'array', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'Access-Control-Request-Headers' - ], - 'SseC' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption-customer-algorithm' + 'sentAs' => 'Event', + ], ], - 'SseCKey' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption-customer-key', - 'type' => 'password' - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'Expiration' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-obs-expiration' - ], - 'LastModified' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'last-modified' - ], - 'ContentLength' => [ - 'type' => 'integer', - 'location' => 'header', - 'sentAs' => 'content-length' - ], - 'ContentType' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'content-type' - ], - 'ETag' => [ - 'type' => 'string', - 'location' => 'header' - ], - 'VersionId' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-obs-version-id' - ], - 'WebsiteRedirectLocation' => [ + 'Filter' => [ + 'type' => 'array', + 'wrapper' => 'Filter', + 'sentAs' => 'Object', + 'items' => [ + 'type' => 'object', + 'sentAs' => 'FilterRule', + 'properties' => [ + 'Name' => [ 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-obs-website-redirect-location' - ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ], - 'StorageClass' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-storage-class' - ], - 'AllowOrigin' => [ - 'location' => 'header', - 'sentAs' => 'access-control-allow-origin' - ], - 'MaxAgeSeconds' => [ - 'type' => 'integer', - 'location' => 'header', - 'sentAs' => 'access-control-max-age' - ], - 'ExposeHeader' => [ - 'location' => 'header', - 'sentAs' => 'access-control-expose-headers' - ], - 'AllowMethod' => [ - 'location' => 'header', - 'sentAs' => 'access-control-allow-methods' - ], - 'AllowHeader' => [ - 'location' => 'header', - 'sentAs' => 'access-control-allow-headers' - ], - 'Restore' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-restore' - ], - 'SseKms' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption' - ], - 'SseKmsKey' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption-aws-kms-key-id' - ], - 'SseC' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption-customer-algorithm' - ], - 'SseCKeyMd5' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption-customer-key-MD5' - ], - 'Metadata' => [ - 'location' => 'header', - 'type' => 'object', - 'sentAs' => 'x-obs-meta-' - ], - 'ObjectType' => [ - 'location' => 'header', + ], + + 'Value' => [ 'type' => 'string', - 'sentAs' => 'x-obs-object-type' + ], ], - 'AppendPosition' => [ - 'location' => 'header', - 'type' => 'string', - 'sentAs' => 'x-obs-next-append-position' - ] - ] - ] + ], + ], + ], + ], + ], ], + ], + ], - 'initiateMultipartUpload' => [ - 'httpMethod' => 'POST', - 'specialParam' => 'uploads', - 'requestParameters' => [ - 'ACL' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-obs-acl', - 'transform' => 'aclHeader' - ], - 'StorageClass' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-obs-storage-class', - 'transform' => 'storageClass' - ], - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'ContentType' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'Content-Type' + 'optionsObject' => [ + 'httpMethod' => 'OPTIONS', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Key' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ], + 'Origin' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'header', + ], + 'AccessControlRequestMethods' => [ + 'required' => true, + 'type' => 'array', + 'location' => 'header', + 'items' => [ + 'sentAs' => 'Access-Control-Request-Method', + 'type' => 'string', + ], + ], + 'AccessControlRequestHeaders' => [ + 'type' => 'array', + 'location' => 'header', + 'items' => [ + 'sentAs' => 'Access-Control-Request-Headers', + 'type' => 'string', + ], + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + 'AllowOrigin' => [ + 'location' => 'header', + 'sentAs' => 'access-control-allow-origin', + ], + 'AllowHeader' => [ + 'location' => 'header', + 'sentAs' => 'access-control-allow-headers', + ], + 'AllowMethod' => [ + 'location' => 'header', + 'sentAs' => 'access-control-allow-methods', + ], + 'ExposeHeader' => [ + 'location' => 'header', + 'sentAs' => 'access-control-expose-headers', + ], + 'MaxAgeSeconds' => [ + 'location' => 'header', + 'sentAs' => 'access-control-max-age', + ], + ], + ], + ], + + 'deleteObject' => [ + 'httpMethod' => 'DELETE', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Key' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ], + 'VersionId' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'versionId', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'DeleteMarker' => [ + 'type' => 'boolean', + 'location' => 'header', + 'sentAs' => 'x-obs-delete-marker', + ], + 'VersionId' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-obs-version-id', + ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + ], + ], + ], + + 'deleteObjects' => [ + 'httpMethod' => 'POST', + 'specialParam' => 'delete', + 'data' => [ + 'xmlRoot' => [ + 'name' => 'Delete', + ], + 'contentMd5' => true, + ], + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Quiet' => [ + 'type' => 'boolean', + 'location' => 'xml', + ], + 'Objects' => [ + 'required' => true, + 'type' => 'array', + 'location' => 'xml', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'type' => 'object', + 'sentAs' => 'Object', + 'properties' => [ + 'Key' => [ + 'required' => true, + 'type' => 'string', + ], + 'VersionId' => [ + 'type' => 'string', + ], + ], + ], + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'Deleteds' => [ + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'Deleted', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'name' => 'DeletedObject', + 'type' => 'object', + 'properties' => [ + 'Key' => [ + 'type' => 'string', ], - 'Key' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'uri' + 'VersionId' => [ + 'type' => 'string', ], - 'Metadata' => [ - 'type' => 'object', - 'location' => 'header', - 'sentAs' => 'x-obs-meta-' + 'DeleteMarker' => [ + 'type' => 'boolean', ], - 'WebsiteRedirectLocation' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-obs-website-redirect-location' + 'DeleteMarkerVersionId' => [ + 'type' => 'string', ], - 'SseKms' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption' + ], + ], + ], + 'Errors' => [ + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'Error', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'name' => 'Error', + 'type' => 'object', + 'sentAs' => 'Error', + 'properties' => [ + 'Key' => [ + 'type' => 'string', ], - 'SseKmsKey' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption-aws-kms-key-id' + 'VersionId' => [ + 'type' => 'string', ], - 'SseC' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption-customer-algorithm' + 'Code' => [ + 'type' => 'string', ], - 'SseCKey' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption-customer-key', - 'type' => 'password' + 'Message' => [ + 'type' => 'string', ], - 'Expires' => [ - 'location' => 'header', - 'type' => 'string', - 'sentAs' => 'x-obs-expires' - ] + ], ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'Bucket' => [ - 'type' => 'string', - 'location' => 'xml', - 'sentAs' => 'Bucket' - ], - 'Key' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'UploadId' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ], - 'SseKms' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption' - ], - 'SseKmsKey' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption-aws-kms-key-id' - ], - 'SseC' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption-customer-algorithm' - ], - 'SseCKeyMd5' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption-customer-key-MD5' - ] - ] - ] + ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], ], + ], + ], - 'listMultipartUploads' => [ - 'httpMethod' => 'GET', - 'specialParam' => 'uploads', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'Delimiter' => [ - 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'delimiter' - ], - 'KeyMarker' => [ + 'setObjectAcl' => [ + 'httpMethod' => 'PUT', + 'specialParam' => 'acl', + 'data' => [ + 'xmlRoot' => [ + 'name' => 'AccessControlPolicy', + ], + ], + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Key' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ], + 'VersionId' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'versionId', + ], + 'ACL' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-obs-acl', + 'transform' => 'aclHeader', + ], + 'GrantRead' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-obs-grant-read', + ], + 'GrantWrite' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-obs-grant-write', + ], + 'GrantReadAcp' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-obs-grant-read-acp', + ], + 'GrantWriteAcp' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-obs-grant-write-acp', + ], + 'GrantFullControl' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-obs-grant-full-control', + ], + 'Owner' => [ + 'type' => 'object', + 'location' => 'xml', + 'properties' => [ + 'ID' => [ + 'type' => 'string', + ], + ], + ], + 'Delivered' => [ + 'type' => 'boolean', + ], + 'Grants' => [ + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'AccessControlList', + 'items' => [ + 'name' => 'Grant', + 'type' => 'object', + 'properties' => [ + 'Grantee' => [ + 'type' => 'object', + 'properties' => [ + 'ID' => [ 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'key-marker' - ], - 'MaxUploads' => [ - 'type' => 'numeric', - 'location' => 'query', - 'sentAs' => 'max-uploads' - ], - 'Prefix' => [ + ], + 'URI' => [ 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'prefix' + 'sentAs' => 'Canned', + 'transform' => 'aclUri', + ], ], - 'UploadIdMarker' => [ - 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'upload-id-marker' - ] + ], + 'Permission' => [ + 'type' => 'string', + ], ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'Bucket' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'KeyMarker' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'UploadIdMarker' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'NextKeyMarker' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'Prefix' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'Delimiter' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'NextUploadIdMarker' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'MaxUploads' => [ - 'type' => 'numeric', - 'location' => 'xml' - ], - 'IsTruncated' => [ - 'type' => 'boolean', - 'location' => 'xml' - ], - 'Uploads' => [ - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'Upload', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'name' => 'MultipartUpload', - 'type' => 'object', - 'sentAs' => 'Upload', - 'properties' => [ - 'UploadId' => [ - 'type' => 'string' - ], - 'Key' => [ - 'type' => 'string' - ], - 'Initiated' => [ - 'type' => 'string' - ], - 'StorageClass' => [ - 'type' => 'string' - ], - 'Owner' => [ - 'type' => 'object', - 'properties' => [ - 'ID' => [ - 'type' => 'string' - ] - ] - ], - 'Initiator' => [ - 'type' => 'object', - 'properties' => [ - 'ID' => [ - 'type' => 'string' - ] - ] - ] - ] - ] - ], - 'CommonPrefixes' => [ - 'type' => 'array', - 'location' => 'xml', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'name' => 'CommonPrefix', - 'type' => 'object', - 'properties' => [ - 'Prefix' => [ - 'type' => 'string' - ] - ] - ] - ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ] - ] - ] + ], + ], + ], + 'responseParameters' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', ], + ], + ], - 'abortMultipartUpload' => [ - 'httpMethod' => 'DELETE', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' + 'getObjectAcl' => [ + 'httpMethod' => 'GET', + 'specialParam' => 'acl', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Key' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ], + 'VersionId' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'versionId', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'Owner' => [ + 'type' => 'object', + 'location' => 'xml', + 'properties' => [ + 'ID' => [ + 'type' => 'string', + ], + ], + ], + 'Delivered' => [ + 'type' => 'boolean', + 'location' => 'xml', + ], + 'Grants' => [ + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'AccessControlList', + 'items' => [ + 'name' => 'Grant', + 'type' => 'object', + 'sentAs' => 'Grant', + 'properties' => [ + 'Grantee' => [ + 'type' => 'object', + 'properties' => [ + 'ID' => [ + 'type' => 'string', + ], + 'URI' => [ + 'type' => 'string', + 'sentAs' => 'Canned', + ], + ], ], - 'Key' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'uri' + 'Permission' => [ + 'type' => 'string', ], - 'UploadId' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'uploadId' - ] + ], ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ] - ] - ] + ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + 'VersionId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-version-id', + ], ], + ], + ], - 'uploadPart' => [ - 'httpMethod' => 'PUT', - 'requestParameters' => [ - 'Body' => [ - 'type' => 'stream', - 'location' => 'body' - ], - 'SourceFile' => [ - 'type' => 'file', - 'location' => 'body' - ], - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'Key' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'uri' - ], - 'PartNumber' => [ - 'required' => true, - 'type' => 'numeric', - 'location' => 'query', - 'sentAs' => 'partNumber' - ], - 'UploadId' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'uploadId' - ], - 'Offset' => [ - 'type' => 'numeric', - 'location' => 'response' - ], - 'PartSize' => [ - 'type' => 'numeric', - 'location' => 'response' - ], - 'ContentMD5' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'Content-MD5' - ], - 'ContentType' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'Content-Type' + 'restoreObject' => [ + 'httpMethod' => 'POST', + 'specialParam' => 'restore', + 'data' => [ + 'xmlRoot' => [ + 'name' => 'RestoreRequest', + ], + ], + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Key' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ], + 'VersionId' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'versionId', + ], + 'Days' => [ + 'required' => true, + 'type' => 'numeric', + 'location' => 'xml', + 'sentAs' => 'Days', + ], + 'Tier' => [ + 'wrapper' => 'RestoreJob', + 'type' => 'string', + 'sentAs' => 'Tier', + 'location' => 'xml', + ], + ], + 'responseParameters' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + ], + ], + + 'putObject' => [ + 'httpMethod' => 'PUT', + 'requestParameters' => [ + 'ACL' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-obs-acl', + 'transform' => 'aclHeader', + ], + 'StorageClass' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-obs-storage-class', + 'transform' => 'storageClass', + ], + 'Body' => [ + 'type' => 'stream', + 'location' => 'body', + ], + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Callback' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-obs-callback', + ], + 'Key' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ], + 'ContentMD5' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-MD5', + ], + 'ContentType' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Type', + ], + 'ContentLength' => [ + 'type' => 'numeric', + 'location' => 'header', + 'sentAs' => 'Content-Length', + ], + 'Metadata' => [ + 'type' => 'object', + 'location' => 'header', + 'sentAs' => 'x-obs-meta-', + ], + 'SourceFile' => [ + 'type' => 'file', + 'location' => 'body', + ], + 'WebsiteRedirectLocation' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-obs-website-redirect-location', + ], + 'SseKms' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption', + ], + 'SseKmsKey' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption-aws-kms-key-id', + ], + 'SseC' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption-customer-algorithm', + ], + 'SseCKey' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption-customer-key', + 'type' => 'password', + ], + 'SuccessRedirect' => [ + 'location' => 'header', + 'type' => 'string', + 'sentAs' => 'success-action-redirect', + ], + 'Expires' => [ + 'location' => 'header', + 'type' => 'string', + 'sentAs' => 'x-obs-expires', + ], + 'Tagging' => [ + 'location' => 'header', + 'type' => 'string', + 'sentAs' => 'x-obs-tagging', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'ETag' => [ + 'type' => 'string', + 'location' => 'header', + ], + 'VersionId' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-obs-version-id', + ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + 'StorageClass' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-storage-class', + ], + 'SseKms' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption', + ], + 'SseKmsKey' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption-aws-kms-key-id', + ], + 'SseC' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption-customer-algorithm', + ], + 'SseCKeyMd5' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption-customer-key-MD5', + ], + ], + ], + ], + + 'getObject' => [ + 'httpMethod' => 'GET', + 'stream' => true, + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'IfMatch' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'If-Match', + ], + 'IfModifiedSince' => [ + 'type' => 'string', + 'format' => 'date-time-http', + 'location' => 'header', + 'sentAs' => 'If-Modified-Since', + ], + 'IfNoneMatch' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'If-None-Match', + ], + 'IfUnmodifiedSince' => [ + 'type' => 'string', + 'format' => 'date-time-http', + 'location' => 'header', + 'sentAs' => 'If-Unmodified-Since', + ], + 'Key' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ], + 'Range' => [ + 'type' => 'string', + 'location' => 'header', + ], + 'ImageProcess' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'x-image-process', + ], + 'ResponseCacheControl' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'response-cache-control', + ], + 'ResponseContentDisposition' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'response-content-disposition', + ], + 'ResponseContentEncoding' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'response-content-encoding', + ], + 'ResponseContentLanguage' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'response-content-language', + ], + 'ResponseContentType' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'response-content-type', + ], + 'ResponseExpires' => [ + 'type' => 'string', + 'format' => 'date-time-http', + 'location' => 'query', + 'sentAs' => 'response-expires', + ], + 'VersionId' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'versionId', + ], + 'SaveAsFile' => [ + 'type' => 'file', + 'location' => 'response', + ], + 'FilePath' => [ + 'type' => 'file', + 'location' => 'response', + ], + + 'Origin' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Origin', + ], + 'RequestHeader' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Access-Control-Request-Headers', + ], + 'SseC' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption-customer-algorithm', + ], + 'SseCKey' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption-customer-key', + 'type' => 'password', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'Body' => [ + 'type' => 'stream', + 'location' => 'body', + ], + 'DeleteMarker' => [ + 'type' => 'boolean', + 'location' => 'header', + 'sentAs' => 'x-obs-delete-marker', + ], + 'Expiration' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-obs-expiration', + ], + 'LastModified' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'last-modified', + ], + 'ContentLength' => [ + 'type' => 'integer', + 'location' => 'header', + 'sentAs' => 'content-length', + ], + 'ETag' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'etag', + ], + 'VersionId' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-obs-version-id', + ], + 'CacheControl' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'cache-control', + ], + 'ContentDisposition' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'content-disposition', + ], + 'ContentEncoding' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'content-encoding', + ], + 'ContentLanguage' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'content-language', + ], + 'ContentType' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'content-type', + ], + 'Expires' => [ + 'type' => 'string', + 'location' => 'header', + ], + 'WebsiteRedirectLocation' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-obs-website-redirect-location', + ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + 'StorageClass' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-storage-class', + ], + 'Restore' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-restore', + ], + 'AllowOrigin' => [ + 'location' => 'header', + 'sentAs' => 'access-control-allow-origin', + ], + 'MaxAgeSeconds' => [ + 'location' => 'header', + 'sentAs' => 'access-control-max-age', + ], + 'ExposeHeader' => [ + 'location' => 'header', + 'sentAs' => 'access-control-expose-headers', + ], + 'AllowMethod' => [ + 'location' => 'header', + 'sentAs' => 'access-control-allow-methods', + ], + 'AllowHeader' => [ + 'location' => 'header', + 'sentAs' => 'access-control-allow-headers', + ], + 'SseKms' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption', + ], + 'SseKmsKey' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption-aws-kms-key-id', + ], + 'SseC' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption-customer-algorithm', + ], + 'SseCKeyMd5' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption-customer-key-MD5', + ], + 'Metadata' => [ + 'location' => 'header', + 'type' => 'object', + 'sentAs' => 'x-obs-meta-', + ], + 'ObjectType' => [ + 'location' => 'header', + 'type' => 'string', + 'sentAs' => 'x-obs-object-type', + ], + 'AppendPosition' => [ + 'location' => 'header', + 'type' => 'string', + 'sentAs' => 'x-obs-next-append-position', + ], + 'TaggingCount' => [ + 'location' => 'header', + 'type' => 'string', + 'sentAs' => 'x-obs-tagging-count', + ], + ], + ], + ], + + 'copyObject' => [ + 'httpMethod' => 'PUT', + 'requestParameters' => [ + 'ACL' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-obs-acl', + 'transform' => 'aclHeader', + ], + 'StorageClass' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-obs-storage-class', + 'transform' => 'storageClass', + ], + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Key' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ], + 'CopySource' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-obs-copy-source', + ], + 'CopySourceIfMatch' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-obs-copy-source-if-match', + ], + 'CopySourceIfModifiedSince' => [ + 'type' => 'string', + 'format' => 'date-time-http', + 'location' => 'header', + 'sentAs' => 'x-obs-copy-source-if-modified-since', + ], + 'CopySourceIfNoneMatch' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-obs-copy-source-if-none-match', + ], + 'CopySourceIfUnmodifiedSince' => [ + 'type' => 'string', + 'format' => 'date-time-http', + 'location' => 'header', + 'sentAs' => 'x-obs-copy-source-if-unmodified-since', + ], + 'MetadataDirective' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-obs-metadata-directive', + ], + 'ContentType' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'content-type', + ], + 'ContentEncoding' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'content-encoding', + ], + 'ContentLanguage' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'content-language', + ], + 'ContentDisposition' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'content-disposition', + ], + 'CacheControl' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'cache-control', + ], + 'Expires' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'expires', + ], + 'Metadata' => [ + 'type' => 'object', + 'location' => 'header', + 'sentAs' => 'x-obs-meta-', + ], + 'WebsiteRedirectLocation' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-obs-website-redirect-location', + ], + 'SseKms' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption', + ], + 'SseKmsKey' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption-aws-kms-key-id', + ], + 'SseC' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption-customer-algorithm', + ], + 'SseCKey' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption-customer-key', + 'type' => 'password', + ], + 'CopySourceSseC' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-copy-source-server-side-encryption-customer-algorithm', + ], + 'CopySourceSseCKey' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-copy-source-server-side-encryption-customer-key', + 'type' => 'password', + ], + 'Tagging' => [ + 'location' => 'header', + 'type' => 'string', + 'sentAs' => 'x-obs-tagging', + ], + 'TaggingDirective' => [ + 'location' => 'header', + 'type' => 'string', + 'sentAs' => 'x-obs-tagging-directive', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'ETag' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'LastModified' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'VersionId' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-obs-version-id', + ], + 'CopySourceVersionId' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-obs-copy-source-version-id', + ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + 'SseKms' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption', + ], + 'SseKmsKey' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption-aws-kms-key-id', + ], + 'SseC' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption-customer-algorithm', + ], + 'SseCKeyMd5' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption-customer-key-MD5', + ], + ], + ], + ], + + 'setObjectMetadata' => [ + 'httpMethod' => 'PUT', + 'specialParam' => 'metadata', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Key' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ], + 'VersionId' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'versionId', + ], + 'Origin' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Origin', + ], + 'RequestHeader' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Access-Control-Request-Headers', + ], + 'ContentType' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'content-type', + ], + 'ContentEncoding' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'content-encoding', + ], + 'ContentLanguage' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'content-language', + ], + 'ContentDisposition' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'content-disposition', + ], + 'CacheControl' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'cache-control', + ], + 'Expires' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'expires', + ], + 'StorageClass' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-storage-class', + ], + 'Metadata' => [ + 'type' => 'object', + 'location' => 'header', + 'sentAs' => 'x-obs-meta-', + ], + 'MetadataDirective' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-obs-metadata-directive', + ], + 'WebsiteRedirectLocation' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-obs-website-redirect-location', + ], + 'Tagging' => [ + 'location' => 'header', + 'type' => 'string', + 'sentAs' => 'x-obs-tagging', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + 'ContentType' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'content-type', + ], + 'ContentEncoding' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'content-encoding', + ], + 'ContentLanguage' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'content-language', + ], + 'ContentDisposition' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'content-disposition', + ], + 'CacheControl' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'cache-control', + ], + 'Expires' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'expires', + ], + 'StorageClass' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-storage-class', + ], + 'Metadata' => [ + 'type' => 'object', + 'location' => 'header', + 'sentAs' => 'x-obs-meta-', + ], + 'WebsiteRedirectLocation' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-obs-website-redirect-location', + ], + ], + ], + ], + + 'getObjectMetadata' => [ + 'httpMethod' => 'HEAD', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Key' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ], + 'VersionId' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'versionId', + ], + 'Origin' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Origin', + ], + 'RequestHeader' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Access-Control-Request-Headers', + ], + 'SseC' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption-customer-algorithm', + ], + 'SseCKey' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption-customer-key', + 'type' => 'password', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'Expiration' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-obs-expiration', + ], + 'LastModified' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'last-modified', + ], + 'ContentLength' => [ + 'type' => 'integer', + 'location' => 'header', + 'sentAs' => 'content-length', + ], + 'ContentType' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'content-type', + ], + 'ETag' => [ + 'type' => 'string', + 'location' => 'header', + ], + 'VersionId' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-obs-version-id', + ], + 'WebsiteRedirectLocation' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-obs-website-redirect-location', + ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + 'StorageClass' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-storage-class', + ], + 'AllowOrigin' => [ + 'location' => 'header', + 'sentAs' => 'access-control-allow-origin', + ], + 'MaxAgeSeconds' => [ + 'type' => 'integer', + 'location' => 'header', + 'sentAs' => 'access-control-max-age', + ], + 'ExposeHeader' => [ + 'location' => 'header', + 'sentAs' => 'access-control-expose-headers', + ], + 'AllowMethod' => [ + 'location' => 'header', + 'sentAs' => 'access-control-allow-methods', + ], + 'AllowHeader' => [ + 'location' => 'header', + 'sentAs' => 'access-control-allow-headers', + ], + 'Restore' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-restore', + ], + 'SseKms' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption', + ], + 'SseKmsKey' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption-aws-kms-key-id', + ], + 'SseC' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption-customer-algorithm', + ], + 'SseCKeyMd5' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption-customer-key-MD5', + ], + 'Metadata' => [ + 'location' => 'header', + 'type' => 'object', + 'sentAs' => 'x-obs-meta-', + ], + 'ObjectType' => [ + 'location' => 'header', + 'type' => 'string', + 'sentAs' => 'x-obs-object-type', + ], + 'AppendPosition' => [ + 'location' => 'header', + 'type' => 'string', + 'sentAs' => 'x-obs-next-append-position', + ], + 'TaggingCount' => [ + 'location' => 'header', + 'type' => 'string', + 'sentAs' => 'x-obs-tagging-count', + ], + ], + ], + ], + + 'setObjectTagging' => [ + 'httpMethod' => 'PUT', + 'specialParam' => 'tagging', + 'data' => [ + 'xmlRoot' => [ + 'name' => 'Tagging', + ], + 'contentMd5' => true, + ], + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Key' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ], + 'VersionId' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'versionId', + ], + 'Tags' => [ + 'required' => true, + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'TagSet', + 'items' => [ + 'required' => true, + 'type' => 'object', + 'name' => 'Tag', + 'properties' => [ + 'Key' => [ + 'required' => true, + 'type' => 'string', + ], + 'Value' => [ + 'required' => true, + 'type' => 'string', + ], + ], + ], + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + ], + ], + ], + + 'getObjectTagging' => [ + 'httpMethod' => 'GET', + 'specialParam' => 'tagging', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Key' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ], + 'VersionId' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'versionId', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + 'Tags' => [ + 'required' => true, + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'TagSet', + 'items' => [ + 'required' => true, + 'type' => 'object', + 'name' => 'Tag', + 'properties' => [ + 'Key' => [ + 'required' => true, + 'type' => 'string', ], - 'SseC' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption-customer-algorithm' + 'Value' => [ + 'required' => true, + 'type' => 'string', ], - 'SseCKey' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption-customer-key', - 'type' => 'password' - ] + ], ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'ETag' => [ - 'type' => 'string', - 'location' => 'header' - ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ], - 'SseKms' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption' - ], - 'SseKmsKey' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption-aws-kms-key-id' - ], - 'SseC' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption-customer-algorithm' - ], - 'SseCKeyMd5' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption-customer-key-MD5' - ] - ] - ] + ], + ], + ], + ], + + 'deleteObjectTagging' => [ + 'httpMethod' => 'DELETE', + 'specialParam' => 'tagging', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + ], + ], + ], + + + 'initiateMultipartUpload' => [ + 'httpMethod' => 'POST', + 'specialParam' => 'uploads', + 'requestParameters' => [ + 'ACL' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-obs-acl', + 'transform' => 'aclHeader', + ], + 'StorageClass' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-obs-storage-class', + 'transform' => 'storageClass', + ], + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'ContentType' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Type', + ], + 'Key' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ], + 'Metadata' => [ + 'type' => 'object', + 'location' => 'header', + 'sentAs' => 'x-obs-meta-', + ], + 'WebsiteRedirectLocation' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-obs-website-redirect-location', + ], + 'SseKms' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption', + ], + 'SseKmsKey' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption-aws-kms-key-id', ], + 'SseC' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption-customer-algorithm', + ], + 'SseCKey' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption-customer-key', + 'type' => 'password', + ], + 'Expires' => [ + 'location' => 'header', + 'type' => 'string', + 'sentAs' => 'x-obs-expires', + ], + 'Tagging' => [ + 'location' => 'header', + 'type' => 'string', + 'sentAs' => 'x-obs-tagging', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'Bucket' => [ + 'type' => 'string', + 'location' => 'xml', + 'sentAs' => 'Bucket', + ], + 'Key' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'UploadId' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + 'SseKms' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption', + ], + 'SseKmsKey' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption-aws-kms-key-id', + ], + 'SseC' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption-customer-algorithm', + ], + 'SseCKeyMd5' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption-customer-key-MD5', + ], + ], + ], + ], - 'completeMultipartUpload' => [ - 'httpMethod' => 'POST', - 'data' => [ - 'xmlRoot' => [ - 'name' => 'CompleteMultipartUpload' - ] + 'listMultipartUploads' => [ + 'httpMethod' => 'GET', + 'specialParam' => 'uploads', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Delimiter' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'delimiter', + ], + 'KeyMarker' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'key-marker', + ], + 'MaxUploads' => [ + 'type' => 'numeric', + 'location' => 'query', + 'sentAs' => 'max-uploads', + ], + 'Prefix' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'prefix', + ], + 'UploadIdMarker' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'upload-id-marker', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'Bucket' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'KeyMarker' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'UploadIdMarker' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'NextKeyMarker' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'Prefix' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'Delimiter' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'NextUploadIdMarker' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'MaxUploads' => [ + 'type' => 'numeric', + 'location' => 'xml', + ], + 'IsTruncated' => [ + 'type' => 'boolean', + 'location' => 'xml', + ], + 'Uploads' => [ + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'Upload', + 'data' => [ + 'xmlFlattened' => true, ], - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' + 'items' => [ + 'name' => 'MultipartUpload', + 'type' => 'object', + 'sentAs' => 'Upload', + 'properties' => [ + 'UploadId' => [ + 'type' => 'string', ], - 'Key' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'uri' + 'Key' => [ + 'type' => 'string', + ], + 'Initiated' => [ + 'type' => 'string', + ], + 'StorageClass' => [ + 'type' => 'string', ], - 'Parts' => [ - 'type' => 'array', - 'location' => 'xml', - 'data' => [ - 'xmlFlattened' => true + 'Owner' => [ + 'type' => 'object', + 'properties' => [ + 'ID' => [ + 'type' => 'string', ], - 'items' => [ - 'name' => 'CompletedPart', - 'type' => 'object', - 'sentAs' => 'Part', - 'properties' => [ - 'PartNumber' => [ - 'type' => 'numeric' - ], - 'ETag' => [ - 'type' => 'string' - ] - ] - ] + ], ], - 'UploadId' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'uploadId' + 'Initiator' => [ + 'type' => 'object', + 'properties' => [ + 'ID' => [ + 'type' => 'string', + ], + ], ], - 'Callback' => [ + ], + ], + ], + 'CommonPrefixes' => [ + 'type' => 'array', + 'location' => 'xml', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'name' => 'CommonPrefix', + 'type' => 'object', + 'properties' => [ + 'Prefix' => [ 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-obs-callback' - ] + ], + ], ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'Location' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'Bucket' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'Key' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'Location' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'ETag' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'VersionId' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-obs-version-id' - ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ], - 'SseKms' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption' - ], - 'SseKmsKey' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption-aws-kms-key-id' - ], - 'SseC' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption-customer-algorithm' - ], - 'SseCKeyMd5' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption-customer-key-MD5' - ] - ] - ] + ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], ], + ], + ], - 'listParts' => [ - 'httpMethod' => 'GET', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'Key' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'uri' - ], - 'MaxParts' => [ - 'type' => 'numeric', - 'location' => 'query', - 'sentAs' => 'max-parts' - ], - 'PartNumberMarker' => [ - 'type' => 'numeric', - 'location' => 'query', - 'sentAs' => 'part-number-marker' - ], - 'UploadId' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'uploadId' - ] + 'abortMultipartUpload' => [ + 'httpMethod' => 'DELETE', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Key' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ], + 'UploadId' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'uploadId', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + ], + ], + ], + + 'uploadPart' => [ + 'httpMethod' => 'PUT', + 'requestParameters' => [ + 'Body' => [ + 'type' => 'stream', + 'location' => 'body', + ], + 'SourceFile' => [ + 'type' => 'file', + 'location' => 'body', + ], + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Key' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ], + 'PartNumber' => [ + 'required' => true, + 'type' => 'numeric', + 'location' => 'query', + 'sentAs' => 'partNumber', + ], + 'UploadId' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'uploadId', + ], + 'Offset' => [ + 'type' => 'numeric', + 'location' => 'response', + ], + 'PartSize' => [ + 'type' => 'numeric', + 'location' => 'response', + ], + 'ContentMD5' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-MD5', + ], + 'ContentType' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Type', + ], + 'SseC' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption-customer-algorithm', + ], + 'SseCKey' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption-customer-key', + 'type' => 'password', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'ETag' => [ + 'type' => 'string', + 'location' => 'header', + ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + 'SseKms' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption', + ], + 'SseKmsKey' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption-aws-kms-key-id', + ], + 'SseC' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption-customer-algorithm', + ], + 'SseCKeyMd5' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption-customer-key-MD5', + ], + ], + ], + ], + + 'completeMultipartUpload' => [ + 'httpMethod' => 'POST', + 'data' => [ + 'xmlRoot' => [ + 'name' => 'CompleteMultipartUpload', + ], + ], + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Key' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ], + 'Parts' => [ + 'type' => 'array', + 'location' => 'xml', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'name' => 'CompletedPart', + 'type' => 'object', + 'sentAs' => 'Part', + 'properties' => [ + 'PartNumber' => [ + 'type' => 'numeric', + ], + 'ETag' => [ + 'type' => 'string', + ], ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'Bucket' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'Key' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'UploadId' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'PartNumberMarker' => [ - 'type' => 'numeric', - 'location' => 'xml' - ], - 'NextPartNumberMarker' => [ - 'type' => 'numeric', - 'location' => 'xml' - ], - 'MaxParts' => [ - 'type' => 'numeric', - 'location' => 'xml' - ], - 'IsTruncated' => [ - 'type' => 'boolean', - 'location' => 'xml' - ], - 'Parts' => [ - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'Part', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'name' => 'Part', - 'type' => 'object', - 'sentAs' => 'Part', - 'properties' => [ - 'PartNumber' => [ - 'type' => 'integer' - ], - 'LastModified' => [ - 'type' => 'string' - ], - 'ETag' => [ - 'type' => 'string' - ], - 'Size' => [ - 'type' => 'integer' - ] - ] - ] - ], - 'Initiator' => [ - 'type' => 'object', - 'location' => 'xml', - 'properties' => [ - 'ID' => [ - 'type' => 'string' - ] - ] - ], - 'Owner' => [ - 'type' => 'object', - 'location' => 'xml', - 'properties' => [ - 'ID' => [ - 'type' => 'string' - ] - ] - ], - 'StorageClass' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ] - ] - ] + ], + ], + 'UploadId' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'uploadId', + ], + 'Callback' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-obs-callback', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'Location' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'Bucket' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'Key' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'Location' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'ETag' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'VersionId' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-obs-version-id', + ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + 'SseKms' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption', + ], + 'SseKmsKey' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption-aws-kms-key-id', + ], + 'SseC' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption-customer-algorithm', + ], + 'SseCKeyMd5' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption-customer-key-MD5', + ], ], + ], + ], - 'copyPart' => [ - 'httpMethod' => 'PUT', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'CopySource' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-obs-copy-source' - ], - 'CopySourceRange' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-obs-copy-source-range' - ], - 'Key' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'uri' - ], - 'PartNumber' => [ - 'required' => true, - 'type' => 'numeric', - 'location' => 'query', - 'sentAs' => 'partNumber' - ], - 'UploadId' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'uploadId' + 'listParts' => [ + 'httpMethod' => 'GET', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Key' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ], + 'MaxParts' => [ + 'type' => 'numeric', + 'location' => 'query', + 'sentAs' => 'max-parts', + ], + 'PartNumberMarker' => [ + 'type' => 'numeric', + 'location' => 'query', + 'sentAs' => 'part-number-marker', + ], + 'UploadId' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'uploadId', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'Bucket' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'Key' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'UploadId' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'PartNumberMarker' => [ + 'type' => 'numeric', + 'location' => 'xml', + ], + 'NextPartNumberMarker' => [ + 'type' => 'numeric', + 'location' => 'xml', + ], + 'MaxParts' => [ + 'type' => 'numeric', + 'location' => 'xml', + ], + 'IsTruncated' => [ + 'type' => 'boolean', + 'location' => 'xml', + ], + 'Parts' => [ + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'Part', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'name' => 'Part', + 'type' => 'object', + 'sentAs' => 'Part', + 'properties' => [ + 'PartNumber' => [ + 'type' => 'integer', ], - 'SseC' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption-customer-algorithm' + 'LastModified' => [ + 'type' => 'string', ], - 'SseCKey' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption-customer-key', - 'type' => 'password' + 'ETag' => [ + 'type' => 'string', ], - 'CopySourceSseC' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-copy-source-server-side-encryption-customer-algorithm' + 'Size' => [ + 'type' => 'integer', ], - 'CopySourceSseCKey' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-copy-source-server-side-encryption-customer-key', - 'type' => 'password' - ] + ], ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'ETag' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'LastModified' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ], - 'SseKms' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption' - ], - 'SseKmsKey' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption-aws-kms-key-id' - ], - 'SseC' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption-customer-algorithm' - ], - 'SseCKeyMd5' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-server-side-encryption-customer-key-MD5' - ] - ] - ] + ], + 'Initiator' => [ + 'type' => 'object', + 'location' => 'xml', + 'properties' => [ + 'ID' => [ + 'type' => 'string', + ], + ], + ], + 'Owner' => [ + 'type' => 'object', + 'location' => 'xml', + 'properties' => [ + 'ID' => [ + 'type' => 'string', + ], + ], + ], + 'StorageClass' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], ], + ], + ], - 'setBucketCustomDomain' => [ - 'httpMethod' => 'PUT', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'DomainName' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'customdomain' - ] - - ], - 'responseParameters' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ] - ] + 'copyPart' => [ + 'httpMethod' => 'PUT', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'CopySource' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-obs-copy-source', + ], + 'CopySourceRange' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-obs-copy-source-range', + ], + 'Key' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ], + 'PartNumber' => [ + 'required' => true, + 'type' => 'numeric', + 'location' => 'query', + 'sentAs' => 'partNumber', + ], + 'UploadId' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'uploadId', + ], + 'SseC' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption-customer-algorithm', + ], + 'SseCKey' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption-customer-key', + 'type' => 'password', + ], + 'CopySourceSseC' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-copy-source-server-side-encryption-customer-algorithm', + ], + 'CopySourceSseCKey' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-copy-source-server-side-encryption-customer-key', + 'type' => 'password', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'ETag' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'LastModified' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + 'SseKms' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption', + ], + 'SseKmsKey' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption-aws-kms-key-id', + ], + 'SseC' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption-customer-algorithm', + ], + 'SseCKeyMd5' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-server-side-encryption-customer-key-MD5', + ], ], + ], + ], - 'getBucketCustomDomain' => [ - 'httpMethod' => 'GET', - 'specialParam' => 'customdomain', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ] + 'setBucketCustomDomain' => [ + 'httpMethod' => 'PUT', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'DomainName' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'customdomain', + ], + + ], + 'responseParameters' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + ], + ], + + 'getBucketCustomDomain' => [ + 'httpMethod' => 'GET', + 'specialParam' => 'customdomain', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', ], - 'responseParameters' => [ + 'Domains' => [ + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'Domains', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ 'type' => 'object', 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ], - 'Domains' => [ - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'Domains', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'type' => 'object', - 'properties' => [ - 'DomainName' => [ - 'type' => 'string', - 'location' => 'xml', - 'sentAs' => 'DomainName' - ], - 'CreateTime' => [ - 'type' => 'string', - 'location' => 'xml', - 'sentAs' => 'CreateTime' - ], - ] - ] - ] - ] - ] - ], - - 'deleteBucketCustomDomain' => [ - 'httpMethod' => 'DELETE', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, + 'DomainName' => [ 'type' => 'string', - 'location' => 'dns' - ], - 'DomainName' => [ - 'required' => true, + 'location' => 'xml', + 'sentAs' => 'DomainName', + ], + 'CreateTime' => [ 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'customdomain' - ] + 'location' => 'xml', + 'sentAs' => 'CreateTime', + ], + ], + ], ], - 'responseParameters' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ] - ] ], + ], + ], + 'deleteBucketCustomDomain' => [ + 'httpMethod' => 'DELETE', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'DomainName' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'customdomain', + ], + ], + 'responseParameters' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id', + ], + ], ], - 'aliases' => [ - 'headBucket' => 'getBucketMetadata', + ], + + 'aliases' => [ + 'headBucket' => 'getBucketMetadata', - 'getBucketLogging' => 'getBucketLoggingConfiguration', - 'setBucketLogging' => 'setBucketLoggingConfiguration', - 'getBucketVersioning' => 'getBucketVersioningConfiguration', - 'setBucketVersioning' => 'setBucketVersioningConfiguration', - 'setBucketWebsite' => 'setBucketWebsiteConfiguration', - 'getBucketWebsite' => 'getBucketWebsiteConfiguration', - 'deleteBucketWebsite' => 'deleteBucketWebsiteConfiguration', - 'setBucketLifecycle' => 'setBucketLifecycleConfiguration', - 'getBucketLifecycle' => 'getBucketLifecycleConfiguration', - 'deleteBucketLifecycle' => 'deleteBucketLifecycleConfiguration' - ] + 'getBucketLogging' => 'getBucketLoggingConfiguration', + 'setBucketLogging' => 'setBucketLoggingConfiguration', + 'getBucketVersioning' => 'getBucketVersioningConfiguration', + 'setBucketVersioning' => 'setBucketVersioningConfiguration', + 'setBucketWebsite' => 'setBucketWebsiteConfiguration', + 'getBucketWebsite' => 'getBucketWebsiteConfiguration', + 'deleteBucketWebsite' => 'deleteBucketWebsiteConfiguration', + 'setBucketLifecycle' => 'setBucketLifecycleConfiguration', + 'getBucketLifecycle' => 'getBucketLifecycleConfiguration', + 'deleteBucketLifecycle' => 'deleteBucketLifecycleConfiguration', + ], ]; -} \ No newline at end of file +} diff --git a/Obs/Internal/Resource/V2Constants.php b/Obs/Internal/Resource/V2Constants.php index 57cb93d..e901df7 100644 --- a/Obs/Internal/Resource/V2Constants.php +++ b/Obs/Internal/Resource/V2Constants.php @@ -16,23 +16,24 @@ namespace Obs\Internal\Resource; -class V2Constants extends Constants { +class V2Constants extends Constants +{ const FLAG = 'AWS'; const METADATA_PREFIX = 'x-amz-meta-'; const HEADER_PREFIX = 'x-amz-'; const ALTERNATIVE_DATE_HEADER = 'x-amz-date'; const SECURITY_TOKEN_HEAD = 'x-amz-security-token'; const TEMPURL_AK_HEAD = 'AWSAccessKeyId'; - + const GROUP_ALL_USERS_PREFIX = 'http://acs.amazonaws.com/groups/global/'; const GROUP_AUTHENTICATED_USERS_PREFIX = 'http://acs.amazonaws.com/groups/global/'; const GROUP_LOG_DELIVERY_PREFIX = 'http://acs.amazonaws.com/groups/s3/'; - + const COMMON_HEADERS = [ 'content-length' => 'ContentLength', 'date' => 'Date', 'x-amz-request-id' => 'RequestId', 'x-amz-id-2' => 'Id2', - 'x-reserved' => 'Reserved' + 'x-reserved' => 'Reserved', ]; } diff --git a/Obs/Internal/Resource/V2RequestResource.php b/Obs/Internal/Resource/V2RequestResource.php index a59c995..d283489 100644 --- a/Obs/Internal/Resource/V2RequestResource.php +++ b/Obs/Internal/Resource/V2RequestResource.php @@ -16,4106 +16,4418 @@ namespace Obs\Internal\Resource; -class V2RequestResource { - public static $RESOURCE_ARRAY = [ - 'operations' => [ - 'createBucket' => [ - 'httpMethod' => 'PUT', - 'data' => [ - 'xmlRoot' => [ - 'name' => 'CreateBucketConfiguration' - ] - ], - 'requestParameters' => [ - 'ACL' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-amz-acl', - 'transform' => 'aclHeader' - ], - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'LocationConstraint' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'StorageClass' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-default-storage-class', - 'transform' => 'storageClass' - ] - ], - 'responseParameters' => [ - 'Location' => [ - 'type' => 'string', - 'location' => 'header', - ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ] - ] +class V2RequestResource +{ + public static $resourceArray = [ + 'operations' => [ + 'createBucket' => [ + 'httpMethod' => 'PUT', + 'data' => [ + 'xmlRoot' => [ + 'name' => 'CreateBucketConfiguration', + ], + ], + 'requestParameters' => [ + 'ACL' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-amz-acl', + 'transform' => 'aclHeader', + ], + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'LocationConstraint' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'StorageClass' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-default-storage-class', + 'transform' => 'storageClass', ], + ], + 'responseParameters' => [ + 'Location' => [ + 'type' => 'string', + 'location' => 'header', + ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], + ], + ], - 'listBuckets' => [ - 'httpMethod' => 'GET', - 'requestParameters' => [ - 'QueryLocation' => [ - 'type' => 'boolean', - 'location' => 'header', - 'sentAs' => 'x-amz-location', + 'listBuckets' => [ + 'httpMethod' => 'GET', + 'requestParameters' => [ + 'QueryLocation' => [ + 'type' => 'boolean', + 'location' => 'header', + 'sentAs' => 'x-amz-location', + ], + ], + 'responseParameters' => [ + 'Buckets' => [ + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'Buckets', + 'items' => [ + 'name' => 'Bucket', + 'type' => 'object', + 'sentAs' => 'Bucket', + 'properties' => [ + 'Name' => [ + 'type' => 'string', + ], + 'CreationDate' => [ + 'type' => 'string', + ], + 'Location' => [ + 'type' => 'string', ], ], - 'responseParameters' => [ - 'Buckets' => [ - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'Buckets', - 'items' => [ - 'name' => 'Bucket', - 'type' => 'object', - 'sentAs' => 'Bucket', - 'properties' => [ - 'Name' => [ - 'type' => 'string' - ], - 'CreationDate' => [ - 'type' => 'string' - ], - 'Location' => [ - 'type' => 'string' - ] - ] - ] - ], - 'Owner' => [ - 'type' => 'object', - 'location' => 'xml', - 'properties' => [ - 'DisplayName' => [ - 'type' => 'string' - ], - 'ID' => [ - 'type' => 'string' - ] - ] - ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ] - ] + ], ], - - 'deleteBucket' => [ - 'httpMethod' => 'DELETE', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ] + 'Owner' => [ + 'type' => 'object', + 'location' => 'xml', + 'properties' => [ + 'DisplayName' => [ + 'type' => 'string', ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ] - ] - ] + 'ID' => [ + 'type' => 'string', + ], + ], ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], + ], + ], - 'listObjects' => [ - 'httpMethod' => 'GET', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'Delimiter' => [ - 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'delimiter' - ], - 'Marker' => [ - 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'marker' - ], - 'MaxKeys' => [ - 'type' => 'numeric', - 'location' => 'query', - 'sentAs' => 'max-keys' - ], - 'Prefix' => [ - 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'prefix' - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'IsTruncated' => [ - 'type' => 'boolean', - 'location' => 'xml' - ], - 'Marker' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'NextMarker' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'Contents' => [ - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'Contents', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'name' => 'Object', - 'type' => 'object', - 'properties' => [ - 'Key' => [ - 'type' => 'string' - ], - 'LastModified' => [ - 'type' => 'string' - ], - 'ETag' => [ - 'type' => 'string' - ], - 'Size' => [ - 'type' => 'integer' - ], - 'StorageClass' => [ - 'type' => 'string' - ], - 'Owner' => [ - 'type' => 'object', - 'properties' => [ - 'DisplayName' => [ - 'type' => 'string' - ], - 'ID' => [ - 'type' => 'string' - ] - ] - ] - ] - ] - ], - 'Name' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'Prefix' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'Delimiter' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'MaxKeys' => [ - 'type' => 'integer', - 'location' => 'xml' - ], - 'CommonPrefixes' => [ - 'type' => 'array', - 'location' => 'xml', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'name' => 'CommonPrefix', - 'type' => 'object', - 'properties' => [ - 'Prefix' => [ - 'type' => 'string' - ] - ] - ] - ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ], - 'Location' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-bucket-region' - ] - ] - ] + 'deleteBucket' => [ + 'httpMethod' => 'DELETE', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], ], + ], + ], - 'listVersions' => [ - 'httpMethod' => 'GET', - 'specialParam' => 'versions', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' + 'listObjects' => [ + 'httpMethod' => 'GET', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Delimiter' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'delimiter', + ], + 'Marker' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'marker', + ], + 'MaxKeys' => [ + 'type' => 'numeric', + 'location' => 'query', + 'sentAs' => 'max-keys', + ], + 'Prefix' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'prefix', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'IsTruncated' => [ + 'type' => 'boolean', + 'location' => 'xml', + ], + 'Marker' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'NextMarker' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'Contents' => [ + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'Contents', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'name' => 'Object', + 'type' => 'object', + 'properties' => [ + 'Key' => [ + 'type' => 'string', ], - 'Delimiter' => [ - 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'delimiter' + 'LastModified' => [ + 'type' => 'string', ], - 'KeyMarker' => [ - 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'key-marker' + 'ETag' => [ + 'type' => 'string', ], - 'MaxKeys' => [ - 'type' => 'numeric', - 'location' => 'query', - 'sentAs' => 'max-keys' + 'Size' => [ + 'type' => 'integer', ], - 'Prefix' => [ - 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'prefix' + 'StorageClass' => [ + 'type' => 'string', ], - 'VersionIdMarker' => [ - 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'version-id-marker' - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'IsTruncated' => [ - 'type' => 'boolean', - 'location' => 'xml' - ], - 'KeyMarker' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'VersionIdMarker' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'NextKeyMarker' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'NextVersionIdMarker' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'Versions' => [ - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'Version', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'name' => 'ObjectVersion', - 'type' => 'object', - 'sentAs' => 'Version', - 'properties' => [ - 'ETag' => [ - 'type' => 'string' - ], - 'Size' => [ - 'type' => 'integer' - ], - 'StorageClass' => [ - 'type' => 'string' - ], - 'Key' => [ - 'type' => 'string' - ], - 'VersionId' => [ - 'type' => 'string' - ], - 'IsLatest' => [ - 'type' => 'boolean' - ], - 'LastModified' => [ - 'type' => 'string' - ], - 'Owner' => [ - 'type' => 'object', - 'properties' => [ - 'DisplayName' => [ - 'type' => 'string' - ], - 'ID' => [ - 'type' => 'string' - ] - ] - ] - ] - ] - ], - 'DeleteMarkers' => [ - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'DeleteMarker', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'name' => 'DeleteMarkerEntry', - 'type' => 'object', - 'sentAs' => 'DeleteMarker', - 'properties' => [ - 'Owner' => [ - 'type' => 'object', - 'properties' => [ - 'DisplayName' => [ - 'type' => 'string' - ], - 'ID' => [ - 'type' => 'string' - ] - ] - ], - 'Key' => [ - 'type' => 'string' - ], - 'VersionId' => [ - 'type' => 'string' - ], - 'IsLatest' => [ - 'type' => 'boolean' - ], - 'LastModified' => [ - 'type' => 'string' - ] - ] - ] - ], - 'Name' => [ - 'type' => 'string', - 'location' => 'xml' + 'Owner' => [ + 'type' => 'object', + 'properties' => [ + 'DisplayName' => [ + 'type' => 'string', ], - 'Prefix' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'Delimiter' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'MaxKeys' => [ - 'type' => 'integer', - 'location' => 'xml' + 'ID' => [ + 'type' => 'string', ], - 'CommonPrefixes' => [ - 'type' => 'array', - 'location' => 'xml', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'name' => 'CommonPrefix', - 'type' => 'object', - 'properties' => [ - 'Prefix' => [ - 'type' => 'string' - ] - ] - ] - ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ], - 'Location' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-bucket-region' - ] - ] - ] - ], - - 'getBucketMetadata' => [ - 'httpMethod' => 'HEAD', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' + ], ], - 'Origin' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'Origin' + ], + ], + ], + 'Name' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'Prefix' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'Delimiter' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'MaxKeys' => [ + 'type' => 'integer', + 'location' => 'xml', + ], + 'CommonPrefixes' => [ + 'type' => 'array', + 'location' => 'xml', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'name' => 'CommonPrefix', + 'type' => 'object', + 'properties' => [ + 'Prefix' => [ + 'type' => 'string', ], - 'RequestHeader' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'Access-Control-Request-Headers' - ] + ], + ], + ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], + 'Location' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-bucket-region', + ], + ], + ], + ], + + 'listVersions' => [ + 'httpMethod' => 'GET', + 'specialParam' => 'versions', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Delimiter' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'delimiter', + ], + 'KeyMarker' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'key-marker', + ], + 'MaxKeys' => [ + 'type' => 'numeric', + 'location' => 'query', + 'sentAs' => 'max-keys', + ], + 'Prefix' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'prefix', + ], + 'VersionIdMarker' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'version-id-marker', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'IsTruncated' => [ + 'type' => 'boolean', + 'location' => 'xml', + ], + 'KeyMarker' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'VersionIdMarker' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'NextKeyMarker' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'NextVersionIdMarker' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'Versions' => [ + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'Version', + 'data' => [ + 'xmlFlattened' => true, ], - 'responseParameters' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' + 'items' => [ + 'name' => 'ObjectVersion', + 'type' => 'object', + 'sentAs' => 'Version', + 'properties' => [ + 'ETag' => [ + 'type' => 'string', ], - 'StorageClass' => [ - 'location' => 'header', - 'sentAs' => 'x-default-storage-class' + 'Size' => [ + 'type' => 'integer', ], - - 'Location' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-bucket-region' + 'StorageClass' => [ + 'type' => 'string', ], - - 'AllowOrigin' => [ - 'location' => 'header', - 'sentAs' => 'access-control-allow-origin' + 'Key' => [ + 'type' => 'string', ], - 'MaxAgeSeconds' => [ - 'location' => 'header', - 'sentAs' => 'access-control-max-age', - 'type' => 'integer' + 'VersionId' => [ + 'type' => 'string', ], - 'ExposeHeader' => [ - 'location' => 'header', - 'sentAs' => 'access-control-expose-headers' + 'IsLatest' => [ + 'type' => 'boolean', ], - 'AllowMethod' => [ - 'location' => 'header', - 'sentAs' => 'access-control-allow-methods' + 'LastModified' => [ + 'type' => 'string', ], - 'AllowHeader' => [ - 'location' => 'header', - 'sentAs' => 'access-control-allow-headers' - ] - ] - ], - - 'getBucketLocation' => [ - 'httpMethod' => 'GET', - 'specialParam' => 'location', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'Location' => [ - 'type' => 'string', - 'sentAs' => 'LocationConstraint', - 'location' => 'xml' - ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ] - ] - ] - ], - - 'getBucketStorageInfo' => [ - 'httpMethod' => 'GET', - 'specialParam' => 'storageinfo', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'Size' => [ - 'type' => 'numeric', - 'location' => 'xml', - 'sentAs' => 'Size' + 'Owner' => [ + 'type' => 'object', + 'properties' => [ + 'DisplayName' => [ + 'type' => 'string', ], - 'ObjectNumber' => [ - 'type' => 'integer', - 'location' => 'xml' + 'ID' => [ + 'type' => 'string', ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ] - ] - ] - ], - 'setBucketQuota' => [ - 'httpMethod' => 'PUT', - 'specialParam' => 'quota', - 'data' => [ - 'xmlRoot' => [ - 'name' => 'Quota' - ] - ], - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' + ], ], - 'StorageQuota' => [ - 'required' => true, - 'type' => 'numeric', - 'location' => 'xml' - ] + ], ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ] - ] - ] - ], - - 'getBucketQuota' => [ - 'httpMethod' => 'GET', - 'specialParam' => 'quota', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ] + ], + 'DeleteMarkers' => [ + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'DeleteMarker', + 'data' => [ + 'xmlFlattened' => true, ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'StorageQuota' => [ - 'type' => 'integer', - 'location' => 'xml', - 'sentAs' => 'StorageQuota' + 'items' => [ + 'name' => 'DeleteMarkerEntry', + 'type' => 'object', + 'sentAs' => 'DeleteMarker', + 'properties' => [ + 'Owner' => [ + 'type' => 'object', + 'properties' => [ + 'DisplayName' => [ + 'type' => 'string', ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ] - ] - ] - ], - - 'setBucketStoragePolicy' => [ - 'httpMethod' => 'PUT', - 'specialParam' => 'storagePolicy', - 'data' => [ - 'xmlRoot' => [ - 'name' => 'StoragePolicy' - ] - ], - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'StorageClass' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'xml', - 'sentAs' => 'DefaultStorageClass', - 'transform' => 'storageClass' - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ] - ] - ] - ], - - 'getBucketStoragePolicy' => [ - 'httpMethod' => 'GET', - 'specialParam' => 'storagePolicy', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'StorageClass' => [ - 'type' => 'string', - 'location' => 'xml', - 'sentAs' => 'DefaultStorageClass' + 'ID' => [ + 'type' => 'string', ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ] - ] - ] - ], - - 'setBucketAcl' => [ - 'httpMethod' => 'PUT', - 'specialParam' => 'acl', - 'data' => [ - 'xmlRoot' => [ - 'name' => 'AccessControlPolicy' - ] - ], - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'ACL' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-amz-acl', - 'transform' => 'aclHeader' - ], - 'GrantRead' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-amz-grant-read' + ], ], - 'GrantWrite' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-amz-grant-write' + 'Key' => [ + 'type' => 'string', ], - 'GrantReadAcp' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-amz-grant-read-acp' + 'VersionId' => [ + 'type' => 'string', ], - 'GrantWriteAcp' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-amz-grant-write-acp' + 'IsLatest' => [ + 'type' => 'boolean', ], - 'GrantFullControl' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-amz-grant-full-control' + 'LastModified' => [ + 'type' => 'string', ], - 'Owner' => [ - 'type' => 'object', - 'location' => 'xml', - 'properties' => [ - 'DisplayName' => [ - 'type' => 'string' - ], - 'ID' => [ - 'type' => 'string' - ] - ] + ], + ], + ], + 'Name' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'Prefix' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'Delimiter' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'MaxKeys' => [ + 'type' => 'integer', + 'location' => 'xml', + ], + 'CommonPrefixes' => [ + 'type' => 'array', + 'location' => 'xml', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'name' => 'CommonPrefix', + 'type' => 'object', + 'properties' => [ + 'Prefix' => [ + 'type' => 'string', ], - 'Grants' => [ - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'AccessControlList', - 'items' => [ - 'name' => 'Grant', - 'type' => 'object', - 'properties' => [ - 'Grantee' => [ - 'type' => 'object', - 'properties' => [ - 'DisplayName' => [ - 'type' => 'string' - ], - 'ID' => [ - 'type' => 'string' - ], - 'Type' => [ - 'required' => true, - 'type' => 'string', - 'sentAs' => 'xsi:type', - 'data' => [ - 'xmlAttribute' => true, - 'xmlNamespace' => 'http://www.w3.org/2001/XMLSchema-instance' - ] - ], - 'URI' => [ - 'type' => 'string', - 'transform' => 'aclUri' - ] - ] - ], - 'Permission' => [ - 'type' => 'string' - ] - ] - ] - ] + ], ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ] - ] - ] + ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], + 'Location' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-bucket-region', + ], ], + ], + ], - 'getBucketAcl' => [ - 'httpMethod' => 'GET', - 'specialParam' => 'acl', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ], - 'Owner' => [ - 'type' => 'object', - 'location' => 'xml', - 'properties' => [ - 'DisplayName' => [ - 'type' => 'string' - ], - 'ID' => [ - 'type' => 'string' - ] - ] - ], - 'Grants' => [ - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'AccessControlList', - 'items' => [ - 'name' => 'Grant', - 'type' => 'object', - 'sentAs' => 'Grant', - 'properties' => [ - 'Grantee' => [ - 'type' => 'object', - 'properties' => [ - 'DisplayName' => [ - 'type' => 'string' - ], - 'ID' => [ - 'type' => 'string' - ], - 'URI' => [ - 'type' => 'string' - ] - ] - ], - 'Permission' => [ - 'type' => 'string' - ] - ] - ] - ] - ] - ] + 'getBucketMetadata' => [ + 'httpMethod' => 'HEAD', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', ], - - 'setBucketLoggingConfiguration' => [ - 'httpMethod' => 'PUT', - 'specialParam' => 'logging', - 'data' => [ - 'xmlRoot' => [ - 'name' => 'BucketLoggingStatus' - ], - 'xmlAllowEmpty' => true - ], - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'LoggingEnabled' => [ - 'type' => 'object', - 'location' => 'xml', - 'properties' => [ - 'TargetBucket' => [ - 'type' => 'string' - ], - 'TargetPrefix' => [ - 'type' => 'string' - ], - 'TargetGrants' => [ - 'type' => 'array', - 'items' => [ - 'name' => 'Grant', - 'type' => 'object', - 'properties' => [ - 'Grantee' => [ - 'type' => 'object', - 'properties' => [ - 'DisplayName' => [ - 'type' => 'string' - ], - 'ID' => [ - 'type' => 'string' - ], - 'Type' => [ - 'required' => true, - 'type' => 'string', - 'sentAs' => 'xsi:type', - 'data' => [ - 'xmlAttribute' => true, - 'xmlNamespace' => 'http://www.w3.org/2001/XMLSchema-instance' - ] - ], - 'URI' => [ - 'type' => 'string', - 'transform' => 'aclUri' - ] - ] - ], - 'Permission' => [ - 'type' => 'string' - ] - ] - ] - ] - ] - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ] - ] - ] + 'Origin' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Origin', + ], + 'RequestHeader' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Access-Control-Request-Headers', + ], + ], + 'responseParameters' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], + 'StorageClass' => [ + 'location' => 'header', + 'sentAs' => 'x-default-storage-class', ], - 'getBucketLoggingConfiguration' => [ - 'httpMethod' => 'GET', - 'specialParam' => 'logging', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'LoggingEnabled' => [ - 'type' => 'object', - 'location' => 'xml', - 'properties' => [ - 'TargetBucket' => [ - 'type' => 'string' - ], - 'TargetGrants' => [ - 'type' => 'array', - 'sentAs' => 'TargetGrants', - 'items' => [ - 'name' => 'Grant', - 'type' => 'object', - 'sentAs' => 'Grant', - 'properties' => [ - 'Grantee' => [ - 'type' => 'object', - 'properties' => [ - 'DisplayName' => [ - 'type' => 'string' - ], - 'ID' => [ - 'type' => 'string' - ], - 'URI' => [ - 'type' => 'string' - ] - ] - ], - 'Permission' => [ - 'type' => 'string' - ] - ] - ] - ], - 'TargetPrefix' => [ - 'type' => 'string' - ] - ] - ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ] - ] - ] + 'Location' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-bucket-region', ], - 'setFetchPolicy' => [ - 'httpMethod' => 'PUT', - 'specialParam' => 'obsfetchpolicy', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'Policy' => [ - 'required' => true, - 'type' => 'json', - 'location' => 'body' - ] + 'AllowOrigin' => [ + 'location' => 'header', + 'sentAs' => 'access-control-allow-origin', + ], + 'MaxAgeSeconds' => [ + 'location' => 'header', + 'sentAs' => 'access-control-max-age', + 'type' => 'integer', + ], + 'ExposeHeader' => [ + 'location' => 'header', + 'sentAs' => 'access-control-expose-headers', + ], + 'AllowMethod' => [ + 'location' => 'header', + 'sentAs' => 'access-control-allow-methods', + ], + 'AllowHeader' => [ + 'location' => 'header', + 'sentAs' => 'access-control-allow-headers', + ], + ], + ], + + 'getBucketLocation' => [ + 'httpMethod' => 'GET', + 'specialParam' => 'location', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'Location' => [ + 'type' => 'string', + 'sentAs' => 'LocationConstraint', + 'location' => 'xml', + ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ] - ] - ] ], + ], + ], - 'getFetchPolicy' => [ - 'httpMethod' => 'GET', - 'specialParam' => 'obsfetchpolicy', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ] + 'getBucketStorageInfo' => [ + 'httpMethod' => 'GET', + 'specialParam' => 'storageinfo', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'Size' => [ + 'type' => 'numeric', + 'location' => 'xml', + 'sentAs' => 'Size', + ], + 'ObjectNumber' => [ + 'type' => 'integer', + 'location' => 'xml', + ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], + ], + ], + ], + 'setBucketQuota' => [ + 'httpMethod' => 'PUT', + 'specialParam' => 'quota', + 'data' => [ + 'xmlRoot' => [ + 'name' => 'Quota', + ], + ], + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'StorageQuota' => [ + 'required' => true, + 'type' => 'numeric', + 'location' => 'xml', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'Policy' => [ - 'type' => 'json', - 'location' => 'body' - ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ] - ] - ] ], + ], + ], - 'deleteFetchPolicy' => [ - 'httpMethod' => 'DELETE', - 'specialParam' => 'obsfetchpolicy', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ] + 'getBucketQuota' => [ + 'httpMethod' => 'GET', + 'specialParam' => 'quota', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'StorageQuota' => [ + 'type' => 'integer', + 'location' => 'xml', + 'sentAs' => 'StorageQuota', + ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', ], - 'responseParameters' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ] - ] ], + ], + ], - 'setFetchJob' => [ - 'httpMethod' => 'PUT', - 'specialParam' => 'obsfetchjob', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'Job' => [ - 'required' => true, - 'type' => 'json', - 'location' => 'body' - ] + 'setBucketStoragePolicy' => [ + 'httpMethod' => 'PUT', + 'specialParam' => 'storagePolicy', + 'data' => [ + 'xmlRoot' => [ + 'name' => 'StoragePolicy', + ], + ], + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'StorageClass' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'xml', + 'sentAs' => 'DefaultStorageClass', + 'transform' => 'storageClass', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ], - 'JobInfo' => [ - 'type' => 'string', - 'location' => 'body' - ] - ] - ] ], + ], + ], - 'getFetchJob' => [ - 'httpMethod' => 'GET', - 'specialParam' => 'obsfetchjob', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, + 'getBucketStoragePolicy' => [ + 'httpMethod' => 'GET', + 'specialParam' => 'storagePolicy', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'StorageClass' => [ + 'type' => 'string', + 'location' => 'xml', + 'sentAs' => 'DefaultStorageClass', + ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], + ], + ], + ], + + 'setBucketAcl' => [ + 'httpMethod' => 'PUT', + 'specialParam' => 'acl', + 'data' => [ + 'xmlRoot' => [ + 'name' => 'AccessControlPolicy', + ], + ], + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'ACL' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-amz-acl', + 'transform' => 'aclHeader', + ], + 'GrantRead' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-amz-grant-read', + ], + 'GrantWrite' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-amz-grant-write', + ], + 'GrantReadAcp' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-amz-grant-read-acp', + ], + 'GrantWriteAcp' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-amz-grant-write-acp', + ], + 'GrantFullControl' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-amz-grant-full-control', + ], + 'Owner' => [ + 'type' => 'object', + 'location' => 'xml', + 'properties' => [ + 'DisplayName' => [ 'type' => 'string', - 'location' => 'dns' ], - 'JobID' => [ - 'required' => true, + 'ID' => [ 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'x-fetch-job-id' ], ], - 'responseParameters' => [ + ], + 'Grants' => [ + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'AccessControlList', + 'items' => [ + 'name' => 'Grant', 'type' => 'object', 'properties' => [ - 'Job' => [ - 'type' => 'json', - 'location' => 'body' - ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ] - ] - ] - ], - - 'setBucketPolicy' => [ - 'httpMethod' => 'PUT', - 'specialParam' => 'policy', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, + 'Grantee' => [ + 'type' => 'object', + 'properties' => [ + 'DisplayName' => [ 'type' => 'string', - 'location' => 'dns' - ], - 'Policy' => [ - 'required' => true, + ], + 'ID' => [ 'type' => 'string', - 'location' => 'body' - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ] - ] - ] - ], - - 'getBucketPolicy' => [ - 'httpMethod' => 'GET', - 'specialParam' => 'policy', - 'requestParameters' => [ - 'Bucket' => [ + ], + 'Type' => [ 'required' => true, 'type' => 'string', - 'location' => 'dns' - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'Policy' => [ - 'type' => 'string', - 'location' => 'body' + 'sentAs' => 'xsi:type', + 'data' => [ + 'xmlAttribute' => true, + 'xmlNamespace' => 'http://www.w3.org/2001/XMLSchema-instance', ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ] - ] - ] - ], - - 'deleteBucketPolicy' => [ - 'httpMethod' => 'DELETE', - 'specialParam' => 'policy', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ] - ] - ] - ], - - 'setBucketLifecycleConfiguration' => [ - 'httpMethod' => 'PUT', - 'specialParam' => 'lifecycle', - 'data' => [ - 'xmlRoot' => [ - 'name' => 'LifecycleConfiguration' - ], - 'contentMd5' => true - ], - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, + ], + 'URI' => [ 'type' => 'string', - 'location' => 'dns' + 'transform' => 'aclUri', + ], ], - 'Rules' => [ - 'required' => true, - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'Rule', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'name' => 'Rule', - 'type' => 'object', - 'sentAs' => 'Rule', - 'properties' => [ - 'Transitions' => [ - 'type' => 'array', - 'sentAs' => 'Transition', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'type' => 'object', - 'sentAs' => 'Transition', - 'properties' => [ - 'StorageClass' => [ - 'type' => 'string', - 'transform' => 'storageClass' - ], - 'Date' => [ - 'type' => 'string', - 'format' => 'date-time-middle' - ], - 'Days' => [ - 'type' => 'numeric' - ] - ] - ] - ], - 'Expiration' => [ - 'type' => 'object', - 'properties' => [ - 'Date' => [ - 'type' => 'string', - 'format' => 'date-time-middle' - ], - 'Days' => [ - 'type' => 'numeric' - ] - ] - ], - 'NoncurrentVersionTransitions' => [ - 'type' => 'array', - 'sentAs' => 'NoncurrentVersionTransition', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'type' => 'object', - 'sentAs' => 'NoncurrentVersionTransition', - 'properties' => [ - 'StorageClass' => [ - 'type' => 'string', - 'transform' => 'storageClass' - ], - 'NoncurrentDays' => [ - 'type' => 'numeric' - ] - ] - ] - ], - 'NoncurrentVersionExpiration' => [ - 'type' => 'object', - 'properties' => [ - 'NoncurrentDays' => [ - 'type' => 'numeric' - ] - ] - ], - 'ID' => [ - 'type' => 'string' - ], - 'Prefix' => [ - 'required' => true, - 'type' => 'string', - 'canEmpty' => true - ], - 'Status' => [ - 'required' => true, - 'type' => 'string' - ] - ] - ] - ] + ], + 'Permission' => [ + 'type' => 'string', + ], ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ] - ] - ] + ], ], - - 'getBucketLifecycleConfiguration' => [ - 'httpMethod' => 'GET', - 'specialParam' => 'lifecycle', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ], - 'Rules' => [ - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'Rule', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'name' => 'Rule', - 'type' => 'object', - 'sentAs' => 'Rule', - 'properties' => [ - 'Transitions' => [ - 'type' => 'array', - 'sentAs' => 'Transition', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'type' => 'object', - 'sentAs' => 'Transition', - 'properties' => [ - 'StorageClass' => [ - 'type' => 'string' - ], - 'Date' => [ - 'type' => 'string', - 'format' => 'date-time-middle' - ], - 'Days' => [ - 'type' => 'numeric' - ] - ] - ] - ], - 'Expiration' => [ - 'type' => 'object', - 'properties' => [ - 'Date' => [ - 'type' => 'string' - ], - 'Days' => [ - 'type' => 'integer' - ] - ] - ], - 'NoncurrentVersionTransitions' => [ - 'type' => 'array', - 'sentAs' => 'NoncurrentVersionTransition', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'type' => 'object', - 'sentAs' => 'NoncurrentVersionTransition', - 'properties' => [ - 'StorageClass' => [ - 'type' => 'string' - ], - 'NoncurrentDays' => [ - 'type' => 'numeric' - ] - ] - ] - ], - 'NoncurrentVersionExpiration' => [ - 'type' => 'object', - 'properties' => [ - 'NoncurrentDays' => [ - 'type' => 'integer' - ] - ] - ], - 'ID' => [ - 'type' => 'string' - ], - 'Prefix' => [ - 'type' => 'string' - ], - 'Status' => [ - 'type' => 'string' - ] - ] - ] - ] - ] - ] + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], ], + ], + ], - 'deleteBucketLifecycleConfiguration' => [ - 'httpMethod' => 'DELETE', - 'specialParam' => 'lifecycle', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ] - ] - ] + 'getBucketAcl' => [ + 'httpMethod' => 'GET', + 'specialParam' => 'acl', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', ], - - 'setBucketWebsiteConfiguration' => [ - 'httpMethod' => 'PUT', - 'specialParam' => 'website', - 'data' => [ - 'xmlRoot' => [ - 'name' => 'WebsiteConfiguration' - ] + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], + 'Owner' => [ + 'type' => 'object', + 'location' => 'xml', + 'properties' => [ + 'DisplayName' => [ + 'type' => 'string', + ], + 'ID' => [ + 'type' => 'string', + ], ], - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'ErrorDocument' => [ - 'type' => 'object', - 'location' => 'xml', - 'properties' => [ - 'Key' => [ - 'required' => true, - 'type' => 'string' - ] - ] - ], - 'IndexDocument' => [ - 'type' => 'object', - 'location' => 'xml', - 'properties' => [ - 'Suffix' => [ - 'required' => true, - 'type' => 'string' - ] - ] + ], + 'Grants' => [ + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'AccessControlList', + 'items' => [ + 'name' => 'Grant', + 'type' => 'object', + 'sentAs' => 'Grant', + 'properties' => [ + 'Grantee' => [ + 'type' => 'object', + 'properties' => [ + 'DisplayName' => [ + 'type' => 'string', + ], + 'ID' => [ + 'type' => 'string', + ], + 'URI' => [ + 'type' => 'string', + ], + ], ], - 'RedirectAllRequestsTo' => [ - 'type' => 'object', - 'location' => 'xml', - 'properties' => [ - 'HostName' => [ - 'required' => true, - 'type' => 'string' - ], - 'Protocol' => [ - 'type' => 'string' - ] - ] + 'Permission' => [ + 'type' => 'string', ], - 'RoutingRules' => [ - 'type' => 'array', - 'location' => 'xml', - 'items' => [ - 'name' => 'RoutingRule', - 'type' => 'object', - 'properties' => [ - 'Condition' => [ - 'type' => 'object', - 'properties' => [ - 'HttpErrorCodeReturnedEquals' => [ - 'type' => 'numeric' - ], - 'KeyPrefixEquals' => [ - 'type' => 'string' - ] - ] - ], - 'Redirect' => [ - 'required' => true, - 'type' => 'object', - 'properties' => [ - 'HostName' => [ - 'type' => 'string' - ], - 'HttpRedirectCode' => [ - 'type' => 'numeric' - ], - 'Protocol' => [ - 'type' => 'string' - ], - 'ReplaceKeyPrefixWith' => [ - 'type' => 'string' - ], - 'ReplaceKeyWith' => [ - 'type' => 'string' - ] - ] - ] - ] - ] - ] + ], ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ] - ] - ] + ], ], + ], + ], - 'getBucketWebsiteConfiguration' => [ - 'httpMethod' => 'GET', - 'specialParam' => 'website', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ] + 'setBucketLoggingConfiguration' => [ + 'httpMethod' => 'PUT', + 'specialParam' => 'logging', + 'data' => [ + 'xmlRoot' => [ + 'name' => 'BucketLoggingStatus', + ], + 'xmlAllowEmpty' => true, + ], + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'LoggingEnabled' => [ + 'type' => 'object', + 'location' => 'xml', + 'properties' => [ + 'TargetBucket' => [ + 'type' => 'string', + ], + 'TargetPrefix' => [ + 'type' => 'string', ], - 'responseParameters' => [ + 'TargetGrants' => [ + 'type' => 'array', + 'items' => [ + 'name' => 'Grant', 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ], - 'RedirectAllRequestsTo' => [ - 'type' => 'object', - 'location' => 'xml', - 'properties' => [ - 'HostName' => [ - 'type' => 'string' - ], - 'Protocol' => [ - 'type' => 'string' - ] - ] - ], - 'IndexDocument' => [ - 'type' => 'object', - 'location' => 'xml', - 'properties' => [ - 'Suffix' => [ - 'type' => 'string' - ] - ] - ], - 'ErrorDocument' => [ - 'type' => 'object', - 'location' => 'xml', - 'properties' => [ - 'Key' => [ - 'type' => 'string' - ] - ] + 'properties' => [ + 'Grantee' => [ + 'type' => 'object', + 'properties' => [ + 'DisplayName' => [ + 'type' => 'string', + ], + 'ID' => [ + 'type' => 'string', + ], + 'Type' => [ + 'required' => true, + 'type' => 'string', + 'sentAs' => 'xsi:type', + 'data' => [ + 'xmlAttribute' => true, + 'xmlNamespace' => 'http://www.w3.org/2001/XMLSchema-instance', + ], + ], + 'URI' => [ + 'type' => 'string', + 'transform' => 'aclUri', + ], ], - 'RoutingRules' => [ - 'type' => 'array', - 'location' => 'xml', - 'items' => [ - 'name' => 'RoutingRule', - 'type' => 'object', - 'sentAs' => 'RoutingRule', - 'properties' => [ - 'Condition' => [ - 'type' => 'object', - 'properties' => [ - 'HttpErrorCodeReturnedEquals' => [ - 'type' => 'integer' - ], - 'KeyPrefixEquals' => [ - 'type' => 'string' - ] - ] - ], - 'Redirect' => [ - 'type' => 'object', - 'properties' => [ - 'HostName' => [ - 'type' => 'string' - ], - 'HttpRedirectCode' => [ - 'type' => 'integer' - ], - 'Protocol' => [ - 'type' => 'string' - ], - 'ReplaceKeyPrefixWith' => [ - 'type' => 'string' - ], - 'ReplaceKeyWith' => [ - 'type' => 'string' - ] - ] - ] - ] - ] - ] - ] - ] - ], - - 'deleteBucketWebsiteConfiguration' => [ - 'httpMethod' => 'DELETE', - 'specialParam' => 'website', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, + ], + 'Permission' => [ 'type' => 'string', - 'location' => 'dns' - ] + ], + ], + ], ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ] - ] - ] + ], + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], ], + ], + ], - 'setBucketVersioningConfiguration' => [ - 'httpMethod' => 'PUT', - 'specialParam' => 'versioning', - 'data' => [ - 'xmlRoot' => [ - 'name' => 'VersioningConfiguration' - ] - ], - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' + 'getBucketLoggingConfiguration' => [ + 'httpMethod' => 'GET', + 'specialParam' => 'logging', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'LoggingEnabled' => [ + 'type' => 'object', + 'location' => 'xml', + 'properties' => [ + 'TargetBucket' => [ + 'type' => 'string', + ], + 'TargetGrants' => [ + 'type' => 'array', + 'sentAs' => 'TargetGrants', + 'items' => [ + 'name' => 'Grant', + 'type' => 'object', + 'sentAs' => 'Grant', + 'properties' => [ + 'Grantee' => [ + 'type' => 'object', + 'properties' => [ + 'DisplayName' => [ + 'type' => 'string', + ], + 'ID' => [ + 'type' => 'string', + ], + 'URI' => [ + 'type' => 'string', + ], + ], + ], + 'Permission' => [ + 'type' => 'string', + ], + ], ], - 'Status' => [ - 'type' => 'string', - 'location' => 'xml' - ] + ], + 'TargetPrefix' => [ + 'type' => 'string', + ], ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ] - ] - ] + ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], ], + ], + ], - 'getBucketVersioningConfiguration' => [ - 'httpMethod' => 'GET', - 'specialParam' => 'versioning', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ], - 'Status' => [ - 'type' => 'string', - 'location' => 'xml' - ] - ] - ] + 'setFetchPolicy' => [ + 'httpMethod' => 'PUT', + 'specialParam' => 'obsfetchpolicy', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Policy' => [ + 'required' => true, + 'type' => 'json', + 'location' => 'body', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], ], + ], + ], - 'setBucketCors' => [ - 'httpMethod' => 'PUT', - 'specialParam' => 'cors', - 'data' => [ - 'xmlRoot' => [ - 'name' => 'CORSConfiguration' - ], - 'contentMd5' => true - ], - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'CorsRules' => [ - 'required' => true, - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'CORSRule', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'type' => 'object', - 'sentAs' => 'CORSRule', - 'properties' => [ - 'ID' => [ - 'type' => 'string' - ], - 'AllowedMethod' => [ - 'required' => true, - 'type' => 'array', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'type' => 'string', - 'sentAs' => 'AllowedMethod' - ] - ], - 'AllowedOrigin' => [ - 'required' => true, - 'type' => 'array', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'sentAs' => 'AllowedOrigin', - 'type' => 'string' - ] - ], - 'AllowedHeader' => [ - 'type' => 'array', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'name' => 'AllowedHeader', - 'type' => 'string' - ] - ], - 'MaxAgeSeconds' => [ - 'type' => 'numeric' - ], - 'ExposeHeader' => [ - 'type' => 'array', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'name' => 'ExposeHeader', - 'type' => 'string' - ] - ] - ] - ] - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ] - ] - ] + 'getFetchPolicy' => [ + 'httpMethod' => 'GET', + 'specialParam' => 'obsfetchpolicy', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'Policy' => [ + 'type' => 'json', + 'location' => 'body', + ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], ], + ], + ], - 'getBucketCors' => [ - 'httpMethod' => 'GET', - 'specialParam' => 'cors', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ], - 'CorsRules' => [ - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'CORSRule', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'type' => 'object', - 'properties' => [ - 'ID' => [ - 'type' => 'string' - ], - 'AllowedMethod' => [ - 'type' => 'array', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'type' => 'string', - 'sentAs' => 'AllowedMethod' - ] - ], - 'AllowedOrigin' => [ - 'type' => 'array', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'sentAs' => 'AllowedOrigin', - 'type' => 'string' - ] - ], - 'AllowedHeader' => [ - 'type' => 'array', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'name' => 'AllowedHeader', - 'type' => 'string' - ] - ], - 'MaxAgeSeconds' => [ - 'type' => 'integer' - ], - 'ExposeHeader' => [ - 'type' => 'array', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'name' => 'ExposeHeader', - 'type' => 'string' - ] - ] - ] - ] - ] - ] - ] + 'deleteFetchPolicy' => [ + 'httpMethod' => 'DELETE', + 'specialParam' => 'obsfetchpolicy', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + ], + 'responseParameters' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', ], + ], + ], - 'deleteBucketCors' => [ - 'httpMethod' => 'DELETE', - 'specialParam' => 'cors', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ] - ] - ] + 'setFetchJob' => [ + 'httpMethod' => 'PUT', + 'specialParam' => 'obsfetchjob', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Job' => [ + 'required' => true, + 'type' => 'json', + 'location' => 'body', ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], + 'JobInfo' => [ + 'type' => 'string', + 'location' => 'body', + ], + ], + ], + ], - 'optionsBucket' => [ - 'httpMethod' => 'OPTIONS', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'Origin' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'header' - ], - 'AccessControlRequestMethods' => [ - 'required' => true, - 'type' => 'array', - 'location' => 'header', - 'items' => [ - 'sentAs' => 'Access-Control-Request-Method', - 'type' => 'string' - ] - ], - 'AccessControlRequestHeaders' => [ - 'type' => 'array', - 'location' => 'header', - 'items' => [ - 'sentAs' => 'Access-Control-Request-Headers', - 'type' => 'string' - ] - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ], - 'AllowOrigin' => [ - 'location' => 'header', - 'sentAs' => 'access-control-allow-origin' - ], - 'AllowHeader' => [ - 'location' => 'header', - 'sentAs' => 'access-control-allow-headers' - ], - 'AllowMethod' => [ - 'location' => 'header', - 'sentAs' => 'access-control-allow-methods' - ], - 'ExposeHeader' => [ - 'location' => 'header', - 'sentAs' => 'access-control-expose-headers' - ], - 'MaxAgeSeconds' => [ - 'location' => 'header', - 'sentAs' => 'access-control-max-age' - ] - ] - ] + 'getFetchJob' => [ + 'httpMethod' => 'GET', + 'specialParam' => 'obsfetchjob', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', ], - - 'setBucketTagging' => [ - 'httpMethod' => 'PUT', - 'specialParam' => 'tagging', - 'data' => [ - 'xmlRoot' => [ - 'name' => 'Tagging' - ], - 'contentMd5' => true - ], - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'Tags' => [ - 'required' => true, - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'TagSet', - 'items' => [ - 'required' => true, - 'type' => 'object', - 'name' => 'Tag', - 'properties' => [ - 'Key' => [ - 'required' => true, - 'type' => 'string' - ], - 'Value' => [ - 'required' => true, - 'type' => 'string' - ] - ] - ] - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ] - ] - ] + 'JobID' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'x-fetch-job-id', ], - - 'getBucketTagging' => [ - 'httpMethod' => 'GET', - 'specialParam' => 'tagging', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ], - 'Tags' => [ - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'TagSet', - 'items' => [ - 'type' => 'object', - 'name' => 'Tag', - 'properties' => [ - 'Key' => [ - 'type' => 'string' - ], - 'Value' => [ - 'type' => 'string' - ] - ] - ] - ] - ] - ] + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'Job' => [ + 'type' => 'json', + 'location' => 'body', + ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], ], + ], + ], - 'deleteBucketTagging' => [ - 'httpMethod' => 'DELETE', - 'specialParam' => 'tagging', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ] - ] - ] + 'setBucketPolicy' => [ + 'httpMethod' => 'PUT', + 'specialParam' => 'policy', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', ], - - 'setBucketNotification' => [ - 'httpMethod' => 'PUT', - 'specialParam' => 'notification', - 'data' => [ - 'xmlRoot' => [ - 'name' => 'NotificationConfiguration' - ], - 'xmlAllowEmpty' => true - ], - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - - 'TopicConfigurations' => [ - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'TopicConfiguration', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'type' => 'object', - 'location' => 'xml', - 'sentAs' => 'TopicConfiguration', - 'properties' => [ - 'ID' => [ - 'type' => 'string', - 'sentAs' => 'Id' - ], - 'Filter' => [ - 'type' => 'array', - 'wrapper' => 'Filter', - 'sentAs' => 'S3Key', - 'items' => [ - 'type' => 'object', - 'sentAs' => 'FilterRule', - 'properties' => [ - 'Name' => [ - 'type' => 'string' - ], - - 'Value' => [ - 'type' => 'string' - ] - ] - ] - ], - 'Topic' => [ - 'type' => 'string' - ], - 'Event' => [ - 'type' => 'array', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'type' => 'string', - 'sentAs' => 'Event', - 'transform' => 'event' - ] - ], - ] - ] - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ] - ] - ] + 'Policy' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'body', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], ], + ], + ], - 'getBucketNotification' => [ - 'httpMethod' => 'GET', - 'specialParam' => 'notification', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ], - 'TopicConfigurations' => [ - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'TopicConfiguration', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'type' => 'object', - 'location' => 'xml', - 'sentAs' => 'TopicConfiguration', - 'properties' => [ - 'ID' => [ - 'type' => 'string', - 'sentAs' => 'Id' - ], - 'Topic' => [ - 'type' => 'string' - ], - 'Event' => [ - 'type' => 'array', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'type' => 'string', - 'sentAs' => 'Event' - ] - ], - 'Filter' => [ - 'type' => 'array', - 'wrapper' => 'Filter', - 'sentAs' => 'S3Key', - 'items' => [ - 'type' => 'object', - 'sentAs' => 'FilterRule', - 'properties' => [ - 'Name' => [ - 'type' => 'string' - ], + 'getBucketPolicy' => [ + 'httpMethod' => 'GET', + 'specialParam' => 'policy', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'Policy' => [ + 'type' => 'string', + 'location' => 'body', + ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], + ], + ], + ], - 'Value' => [ - 'type' => 'string' - ] - ] - ] - ] - ] - ] - ] - ] - ] + 'deleteBucketPolicy' => [ + 'httpMethod' => 'DELETE', + 'specialParam' => 'policy', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], ], + ], + ], - 'optionsObject' => [ - 'httpMethod' => 'OPTIONS', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' + 'setBucketLifecycleConfiguration' => [ + 'httpMethod' => 'PUT', + 'specialParam' => 'lifecycle', + 'data' => [ + 'xmlRoot' => [ + 'name' => 'LifecycleConfiguration', + ], + 'contentMd5' => true, + ], + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Rules' => [ + 'required' => true, + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'Rule', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'name' => 'Rule', + 'type' => 'object', + 'sentAs' => 'Rule', + 'properties' => [ + 'Transitions' => [ + 'type' => 'array', + 'sentAs' => 'Transition', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'type' => 'object', + 'sentAs' => 'Transition', + 'properties' => [ + 'StorageClass' => [ + 'type' => 'string', + 'transform' => 'storageClass', + ], + 'Date' => [ + 'type' => 'string', + 'format' => 'date-time-middle', + ], + 'Days' => [ + 'type' => 'numeric', + ], + ], ], - 'Key' => [ - 'required' => true, + ], + 'Expiration' => [ + 'type' => 'object', + 'properties' => [ + 'Date' => [ 'type' => 'string', - 'location' => 'uri' + 'format' => 'date-time-middle', + ], + 'Days' => [ + 'type' => 'numeric', + ], ], - 'Origin' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'header' + ], + 'NoncurrentVersionTransitions' => [ + 'type' => 'array', + 'sentAs' => 'NoncurrentVersionTransition', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'type' => 'object', + 'sentAs' => 'NoncurrentVersionTransition', + 'properties' => [ + 'StorageClass' => [ + 'type' => 'string', + 'transform' => 'storageClass', + ], + 'NoncurrentDays' => [ + 'type' => 'numeric', + ], + ], ], - 'AccessControlRequestMethods' => [ - 'required' => true, - 'type' => 'array', - 'location' => 'header', - 'items' => [ - 'sentAs' => 'Access-Control-Request-Method', - 'type' => 'string' - ] + ], + 'NoncurrentVersionExpiration' => [ + 'type' => 'object', + 'properties' => [ + 'NoncurrentDays' => [ + 'type' => 'numeric', + ], ], - 'AccessControlRequestHeaders' => [ - 'type' => 'array', - 'location' => 'header', - 'items' => [ - 'sentAs' => 'Access-Control-Request-Headers', - 'type' => 'string' - ] - ] + ], + 'ID' => [ + 'type' => 'string', + ], + 'Prefix' => [ + 'required' => true, + 'type' => 'string', + 'canEmpty' => true, + ], + 'Status' => [ + 'required' => true, + 'type' => 'string', + ], ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ], - 'AllowOrigin' => [ - 'location' => 'header', - 'sentAs' => 'access-control-allow-origin' - ], - 'AllowHeader' => [ - 'location' => 'header', - 'sentAs' => 'access-control-allow-headers' - ], - 'AllowMethod' => [ - 'location' => 'header', - 'sentAs' => 'access-control-allow-methods' - ], - 'ExposeHeader' => [ - 'location' => 'header', - 'sentAs' => 'access-control-expose-headers' - ], - 'MaxAgeSeconds' => [ - 'location' => 'header', - 'sentAs' => 'access-control-max-age' - ] - ] - ] + ], + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], ], + ], + ], - 'deleteObject' => [ - 'httpMethod' => 'DELETE', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'Key' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'uri' - ], - 'VersionId' => [ - 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'versionId' - ] + 'getBucketLifecycleConfiguration' => [ + 'httpMethod' => 'GET', + 'specialParam' => 'lifecycle', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], + 'Rules' => [ + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'Rule', + 'data' => [ + 'xmlFlattened' => true, ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'DeleteMarker' => [ - 'type' => 'boolean', - 'location' => 'header', - 'sentAs' => 'x-amz-delete-marker' - ], - 'VersionId' => [ + 'items' => [ + 'name' => 'Rule', + 'type' => 'object', + 'sentAs' => 'Rule', + 'properties' => [ + 'Transitions' => [ + 'type' => 'array', + 'sentAs' => 'Transition', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'type' => 'object', + 'sentAs' => 'Transition', + 'properties' => [ + 'StorageClass' => [ + 'type' => 'string', + ], + 'Date' => [ 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-amz-version-id' + 'format' => 'date-time-middle', + ], + 'Days' => [ + 'type' => 'numeric', + ], ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ] - ] - ] - ], - 'deleteObjects' => [ - 'httpMethod' => 'POST', - 'specialParam' => 'delete', - 'data' => [ - 'xmlRoot' => [ - 'name' => 'Delete' - ], - 'contentMd5' => true - ], - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'Quiet' => [ - 'type' => 'boolean', - 'location' => 'xml' + ], ], - 'Objects' => [ - 'required' => true, - 'type' => 'array', - 'location' => 'xml', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'type' => 'object', - 'sentAs' => 'Object', - 'properties' => [ - 'Key' => [ - 'required' => true, - 'type' => 'string' - ], - 'VersionId' => [ - 'type' => 'string' - ] - ] - ] - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'Deleteds' => [ - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'Deleted', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'name' => 'DeletedObject', - 'type' => 'object', - 'properties' => [ - 'Key' => [ - 'type' => 'string' - ], - 'VersionId' => [ - 'type' => 'string' - ], - 'DeleteMarker' => [ - 'type' => 'boolean' - ], - 'DeleteMarkerVersionId' => [ - 'type' => 'string' - ] - ] - ] + 'Expiration' => [ + 'type' => 'object', + 'properties' => [ + 'Date' => [ + 'type' => 'string', ], - 'Errors' => [ - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'Error', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'name' => 'Error', - 'type' => 'object', - 'sentAs' => 'Error', - 'properties' => [ - 'Key' => [ - 'type' => 'string' - ], - 'VersionId' => [ - 'type' => 'string' - ], - 'Code' => [ - 'type' => 'string' - ], - 'Message' => [ - 'type' => 'string' - ] - ] - ] + 'Days' => [ + 'type' => 'integer', ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ] - ] - ] - ], - - 'setObjectAcl' => [ - 'httpMethod' => 'PUT', - 'specialParam' => 'acl', - 'data' => [ - 'xmlRoot' => [ - 'name' => 'AccessControlPolicy' - ] - ], - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'Key' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'uri' - ], - 'VersionId' => [ - 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'versionId' - ], - 'ACL' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-amz-acl', - 'transform' => 'aclHeader' - ], - 'GrantRead' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-amz-grant-read' + ], ], - 'GrantWrite' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-amz-grant-write' + 'NoncurrentVersionTransitions' => [ + 'type' => 'array', + 'sentAs' => 'NoncurrentVersionTransition', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'type' => 'object', + 'sentAs' => 'NoncurrentVersionTransition', + 'properties' => [ + 'StorageClass' => [ + 'type' => 'string', + ], + 'NoncurrentDays' => [ + 'type' => 'numeric', + ], + ], + ], ], - 'GrantReadAcp' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-amz-grant-read-acp' + 'NoncurrentVersionExpiration' => [ + 'type' => 'object', + 'properties' => [ + 'NoncurrentDays' => [ + 'type' => 'integer', + ], + ], ], - 'GrantWriteAcp' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-amz-grant-write-acp' + 'ID' => [ + 'type' => 'string', ], - 'GrantFullControl' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-amz-grant-full-control' + 'Prefix' => [ + 'type' => 'string', ], - 'Owner' => [ - 'type' => 'object', - 'location' => 'xml', - 'properties' => [ - 'DisplayName' => [ - 'type' => 'string' - ], - 'ID' => [ - 'type' => 'string' - ] - ] + 'Status' => [ + 'type' => 'string', ], - 'Grants' => [ - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'AccessControlList', - 'items' => [ - 'name' => 'Grant', - 'type' => 'object', - 'properties' => [ - 'Grantee' => [ - 'type' => 'object', - 'properties' => [ - 'DisplayName' => [ - 'type' => 'string' - ], - 'ID' => [ - 'type' => 'string' - ], - 'Type' => [ - 'required' => true, - 'type' => 'string', - 'sentAs' => 'xsi:type', - 'data' => [ - 'xmlAttribute' => true, - 'xmlNamespace' => 'http://www.w3.org/2001/XMLSchema-instance' - ] - ], - 'URI' => [ - 'type' => 'string', - 'transform' => 'aclUri' - ] - ] - ], - 'Permission' => [ - 'type' => 'string' - ] - ] - ] - ] + ], ], - 'responseParameters' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ] - ] + ], ], + ], + ], - 'getObjectAcl' => [ - 'httpMethod' => 'GET', - 'specialParam' => 'acl', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'Key' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'uri' - ], - 'VersionId' => [ - 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'versionId' - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'Owner' => [ - 'type' => 'object', - 'location' => 'xml', - 'properties' => [ - 'DisplayName' => [ - 'type' => 'string' - ], - 'ID' => [ - 'type' => 'string' - ] - ] - ], - 'Grants' => [ - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'AccessControlList', - 'items' => [ - 'name' => 'Grant', - 'type' => 'object', - 'sentAs' => 'Grant', - 'properties' => [ - 'Grantee' => [ - 'type' => 'object', - 'properties' => [ - 'DisplayName' => [ - 'type' => 'string' - ], - 'ID' => [ - 'type' => 'string' - ], - 'URI' => [ - 'type' => 'string' - ] - ] - ], - 'Permission' => [ - 'type' => 'string' - ] - ] - ] - ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ], - 'VersionId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-version-id' - ] - ] - ] + 'deleteBucketLifecycleConfiguration' => [ + 'httpMethod' => 'DELETE', + 'specialParam' => 'lifecycle', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], ], + ], + ], - 'restoreObject' => [ - 'httpMethod' => 'POST', - 'specialParam' => 'restore', - 'data' => [ - 'xmlRoot' => [ - 'name' => 'RestoreRequest' - ] + 'setBucketWebsiteConfiguration' => [ + 'httpMethod' => 'PUT', + 'specialParam' => 'website', + 'data' => [ + 'xmlRoot' => [ + 'name' => 'WebsiteConfiguration', + ], + ], + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'ErrorDocument' => [ + 'type' => 'object', + 'location' => 'xml', + 'properties' => [ + 'Key' => [ + 'required' => true, + 'type' => 'string', ], - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'Key' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'uri' - ], - 'VersionId' => [ - 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'versionId' - ], - 'Days' => [ - 'required' => true, - 'type' => 'numeric', - 'location' => 'xml', - 'sentAs' => 'Days' - ], - 'Tier' => [ - 'wrapper' => 'GlacierJobParameters', - 'type' => 'string', - 'sentAs' => 'Tier', - 'location' => 'xml' - ] + ], + ], + 'IndexDocument' => [ + 'type' => 'object', + 'location' => 'xml', + 'properties' => [ + 'Suffix' => [ + 'required' => true, + 'type' => 'string', ], - 'responseParameters' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ] - ] + ], ], - - 'putObject' => [ - 'httpMethod' => 'PUT', - 'requestParameters' => [ - 'ACL' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-amz-acl', - 'transform' => 'aclHeader' - ], - 'StorageClass' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-amz-storage-class', - 'transform' => 'storageClass' - ], - 'Body' => [ - 'type' => 'stream', - 'location' => 'body' - ], - 'Bucket' => [ - 'required' => true, + 'RedirectAllRequestsTo' => [ + 'type' => 'object', + 'location' => 'xml', + 'properties' => [ + 'HostName' => [ + 'required' => true, + 'type' => 'string', + ], + 'Protocol' => [ + 'type' => 'string', + ], + ], + ], + 'RoutingRules' => [ + 'type' => 'array', + 'location' => 'xml', + 'items' => [ + 'name' => 'RoutingRule', + 'type' => 'object', + 'properties' => [ + 'Condition' => [ + 'type' => 'object', + 'properties' => [ + 'HttpErrorCodeReturnedEquals' => [ + 'type' => 'numeric', + ], + 'KeyPrefixEquals' => [ 'type' => 'string', - 'location' => 'dns' + ], ], - 'Key' => [ - 'required' => true, + ], + 'Redirect' => [ + 'required' => true, + 'type' => 'object', + 'properties' => [ + 'HostName' => [ 'type' => 'string', - 'location' => 'uri' - ], - 'Callback' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-amz-callback' - ], - 'ContentMD5' => [ + ], + 'HttpRedirectCode' => [ + 'type' => 'numeric', + ], + 'Protocol' => [ 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'Content-MD5' - ], - 'ContentType' => [ + ], + 'ReplaceKeyPrefixWith' => [ 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'Content-Type' - ], - 'ContentLength' => [ - 'type' => 'numeric', - 'location' => 'header', - 'sentAs' => 'Content-Length' - ], - 'Metadata' => [ - 'type' => 'object', - 'location' => 'header', - 'sentAs' => 'x-amz-meta-' - ], - 'SourceFile' => [ - 'type' => 'file', - 'location' => 'body' - ], - 'WebsiteRedirectLocation' => [ + ], + 'ReplaceKeyWith' => [ 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-amz-website-redirect-location' - ], - 'SseKms' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption' - ], - 'SseKmsKey' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption-aws-kms-key-id' - ], - 'SseC' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption-customer-algorithm' - ], - 'SseCKey' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption-customer-key', - 'type' => 'password' + ], ], - 'Expires' => [ - 'location' => 'header', - 'type' => 'string', - 'sentAs' => 'x-obs-expires' - ] + ], ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'ETag' => [ - 'type' => 'string', - 'location' => 'header' + ], + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], + ], + ], + ], + + 'getBucketWebsiteConfiguration' => [ + 'httpMethod' => 'GET', + 'specialParam' => 'website', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], + 'RedirectAllRequestsTo' => [ + 'type' => 'object', + 'location' => 'xml', + 'properties' => [ + 'HostName' => [ + 'type' => 'string', + ], + 'Protocol' => [ + 'type' => 'string', + ], + ], + ], + 'IndexDocument' => [ + 'type' => 'object', + 'location' => 'xml', + 'properties' => [ + 'Suffix' => [ + 'type' => 'string', + ], + ], + ], + 'ErrorDocument' => [ + 'type' => 'object', + 'location' => 'xml', + 'properties' => [ + 'Key' => [ + 'type' => 'string', + ], + ], + ], + 'RoutingRules' => [ + 'type' => 'array', + 'location' => 'xml', + 'items' => [ + 'name' => 'RoutingRule', + 'type' => 'object', + 'sentAs' => 'RoutingRule', + 'properties' => [ + 'Condition' => [ + 'type' => 'object', + 'properties' => [ + 'HttpErrorCodeReturnedEquals' => [ + 'type' => 'integer', ], - 'VersionId' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-amz-version-id' + 'KeyPrefixEquals' => [ + 'type' => 'string', ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' + ], + ], + 'Redirect' => [ + 'type' => 'object', + 'properties' => [ + 'HostName' => [ + 'type' => 'string', ], - 'StorageClass' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-storage-class' + 'HttpRedirectCode' => [ + 'type' => 'integer', ], - 'SseKms' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption' + 'Protocol' => [ + 'type' => 'string', ], - 'SseKmsKey' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption-aws-kms-key-id' + 'ReplaceKeyPrefixWith' => [ + 'type' => 'string', ], - 'SseC' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption-customer-algorithm' + 'ReplaceKeyWith' => [ + 'type' => 'string', ], - 'SseCKeyMd5' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption-customer-key-MD5' - ] - ] - ] + ], + ], + ], + ], + ], ], + ], + ], - 'getObject' => [ - 'httpMethod' => 'GET', - 'stream' => true, - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'IfMatch' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'If-Match' - ], - 'IfModifiedSince' => [ - 'type' => 'string', - 'format' => 'date-time-http', - 'location' => 'header', - 'sentAs' => 'If-Modified-Since' + 'deleteBucketWebsiteConfiguration' => [ + 'httpMethod' => 'DELETE', + 'specialParam' => 'website', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], + ], + ], + ], + + 'setBucketVersioningConfiguration' => [ + 'httpMethod' => 'PUT', + 'specialParam' => 'versioning', + 'data' => [ + 'xmlRoot' => [ + 'name' => 'VersioningConfiguration', + ], + ], + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Status' => [ + 'type' => 'string', + 'location' => 'xml', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], + ], + ], + ], + + 'getBucketVersioningConfiguration' => [ + 'httpMethod' => 'GET', + 'specialParam' => 'versioning', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], + 'Status' => [ + 'type' => 'string', + 'location' => 'xml', + ], + ], + ], + ], + + 'setBucketCors' => [ + 'httpMethod' => 'PUT', + 'specialParam' => 'cors', + 'data' => [ + 'xmlRoot' => [ + 'name' => 'CORSConfiguration', + ], + 'contentMd5' => true, + ], + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'CorsRules' => [ + 'required' => true, + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'CORSRule', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'type' => 'object', + 'sentAs' => 'CORSRule', + 'properties' => [ + 'ID' => [ + 'type' => 'string', + ], + 'AllowedMethod' => [ + 'required' => true, + 'type' => 'array', + 'data' => [ + 'xmlFlattened' => true, ], - 'IfNoneMatch' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'If-None-Match' + 'items' => [ + 'type' => 'string', + 'sentAs' => 'AllowedMethod', ], - 'IfUnmodifiedSince' => [ - 'type' => 'string', - 'format' => 'date-time-http', - 'location' => 'header', - 'sentAs' => 'If-Unmodified-Since' + ], + 'AllowedOrigin' => [ + 'required' => true, + 'type' => 'array', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'sentAs' => 'AllowedOrigin', + 'type' => 'string', ], - 'Key' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'uri' + ], + 'AllowedHeader' => [ + 'type' => 'array', + 'data' => [ + 'xmlFlattened' => true, ], - 'Range' => [ - 'type' => 'string', - 'location' => 'header' + 'items' => [ + 'name' => 'AllowedHeader', + 'type' => 'string', ], - 'ImageProcess' => [ - 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'x-image-process' + ], + 'MaxAgeSeconds' => [ + 'type' => 'numeric', + ], + 'ExposeHeader' => [ + 'type' => 'array', + 'data' => [ + 'xmlFlattened' => true, ], - 'ResponseCacheControl' => [ - 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'response-cache-control' + 'items' => [ + 'name' => 'ExposeHeader', + 'type' => 'string', ], - 'ResponseContentDisposition' => [ - 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'response-content-disposition' + ], + ], + ], + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], + ], + ], + ], + + 'getBucketCors' => [ + 'httpMethod' => 'GET', + 'specialParam' => 'cors', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], + 'CorsRules' => [ + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'CORSRule', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'type' => 'object', + 'properties' => [ + 'ID' => [ + 'type' => 'string', ], - 'ResponseContentEncoding' => [ + 'AllowedMethod' => [ + 'type' => 'array', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'response-content-encoding' + 'sentAs' => 'AllowedMethod', + ], ], - 'ResponseContentLanguage' => [ + 'AllowedOrigin' => [ + 'type' => 'array', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'sentAs' => 'AllowedOrigin', 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'response-content-language' + ], ], - 'ResponseContentType' => [ + 'AllowedHeader' => [ + 'type' => 'array', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'name' => 'AllowedHeader', 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'response-content-type' + ], ], - 'ResponseExpires' => [ - 'type' => 'string', - 'format' => 'date-time-http', - 'location' => 'query', - 'sentAs' => 'response-expires' + 'MaxAgeSeconds' => [ + 'type' => 'integer', ], - 'VersionId' => [ + 'ExposeHeader' => [ + 'type' => 'array', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'name' => 'ExposeHeader', 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'versionId' + ], ], - 'SaveAsFile' => [ - 'type' => 'file', - 'location' => 'response' + ], + ], + ], + ], + ], + ], + + 'deleteBucketCors' => [ + 'httpMethod' => 'DELETE', + 'specialParam' => 'cors', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], + ], + ], + ], + + 'optionsBucket' => [ + 'httpMethod' => 'OPTIONS', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Origin' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'header', + ], + 'AccessControlRequestMethods' => [ + 'required' => true, + 'type' => 'array', + 'location' => 'header', + 'items' => [ + 'sentAs' => 'Access-Control-Request-Method', + 'type' => 'string', + ], + ], + 'AccessControlRequestHeaders' => [ + 'type' => 'array', + 'location' => 'header', + 'items' => [ + 'sentAs' => 'Access-Control-Request-Headers', + 'type' => 'string', + ], + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], + 'AllowOrigin' => [ + 'location' => 'header', + 'sentAs' => 'access-control-allow-origin', + ], + 'AllowHeader' => [ + 'location' => 'header', + 'sentAs' => 'access-control-allow-headers', + ], + 'AllowMethod' => [ + 'location' => 'header', + 'sentAs' => 'access-control-allow-methods', + ], + 'ExposeHeader' => [ + 'location' => 'header', + 'sentAs' => 'access-control-expose-headers', + ], + 'MaxAgeSeconds' => [ + 'location' => 'header', + 'sentAs' => 'access-control-max-age', + ], + ], + ], + ], + + 'setBucketTagging' => [ + 'httpMethod' => 'PUT', + 'specialParam' => 'tagging', + 'data' => [ + 'xmlRoot' => [ + 'name' => 'Tagging', + ], + 'contentMd5' => true, + ], + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Tags' => [ + 'required' => true, + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'TagSet', + 'items' => [ + 'required' => true, + 'type' => 'object', + 'name' => 'Tag', + 'properties' => [ + 'Key' => [ + 'required' => true, + 'type' => 'string', + ], + 'Value' => [ + 'required' => true, + 'type' => 'string', + ], + ], + ], + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], + ], + ], + ], + + 'getBucketTagging' => [ + 'httpMethod' => 'GET', + 'specialParam' => 'tagging', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], + 'Tags' => [ + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'TagSet', + 'items' => [ + 'type' => 'object', + 'name' => 'Tag', + 'properties' => [ + 'Key' => [ + 'type' => 'string', ], - 'FilePath' => [ - 'type' => 'file', - 'location' => 'response' + 'Value' => [ + 'type' => 'string', ], + ], + ], + ], + ], + ], + ], - 'Origin' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'Origin' + 'deleteBucketTagging' => [ + 'httpMethod' => 'DELETE', + 'specialParam' => 'tagging', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], + ], + ], + ], + + 'setBucketNotification' => [ + 'httpMethod' => 'PUT', + 'specialParam' => 'notification', + 'data' => [ + 'xmlRoot' => [ + 'name' => 'NotificationConfiguration', + ], + 'xmlAllowEmpty' => true, + ], + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + + 'TopicConfigurations' => [ + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'TopicConfiguration', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'type' => 'object', + 'location' => 'xml', + 'sentAs' => 'TopicConfiguration', + 'properties' => [ + 'ID' => [ + 'type' => 'string', + 'sentAs' => 'Id', + ], + 'Filter' => [ + 'type' => 'array', + 'wrapper' => 'Filter', + 'sentAs' => 'S3Key', + 'items' => [ + 'type' => 'object', + 'sentAs' => 'FilterRule', + 'properties' => [ + 'Name' => [ + 'type' => 'string', + ], + + 'Value' => [ + 'type' => 'string', + ], + ], ], - 'RequestHeader' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'Access-Control-Request-Headers' + ], + 'Topic' => [ + 'type' => 'string', + ], + 'Event' => [ + 'type' => 'array', + 'data' => [ + 'xmlFlattened' => true, ], - 'SseC' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption-customer-algorithm' + 'items' => [ + 'type' => 'string', + 'sentAs' => 'Event', + 'transform' => 'event', ], - 'SseCKey' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption-customer-key', - 'type' => 'password' - ] + ], ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'Body' => [ - 'type' => 'stream', - 'location' => 'body' - ], - 'DeleteMarker' => [ - 'type' => 'boolean', - 'location' => 'header', - 'sentAs' => 'x-amz-delete-marker' - ], - 'Expiration' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-amz-expiration' - ], - 'LastModified' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'last-modified' - ], - 'ContentLength' => [ - 'type' => 'integer', - 'location' => 'header', - 'sentAs' => 'content-length' - ], - 'ETag' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'etag' - ], - 'VersionId' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-amz-version-id' - ], - 'CacheControl' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'cache-control' - ], - 'ContentDisposition' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'content-disposition' - ], - 'ContentEncoding' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'content-encoding' - ], - 'ContentLanguage' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'content-language' - ], - 'ContentType' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'content-type' - ], - 'Expires' => [ - 'type' => 'string', - 'location' => 'header' - ], - 'WebsiteRedirectLocation' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-amz-website-redirect-location' - ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ], - 'StorageClass' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-storage-class' - ], - 'Restore' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-restore' - ], - 'AllowOrigin' => [ - 'location' => 'header', - 'sentAs' => 'access-control-allow-origin' - ], - 'MaxAgeSeconds' => [ - 'location' => 'header', - 'sentAs' => 'access-control-max-age' - ], - 'ExposeHeader' => [ - 'location' => 'header', - 'sentAs' => 'access-control-expose-headers' - ], - 'AllowMethod' => [ - 'location' => 'header', - 'sentAs' => 'access-control-allow-methods' - ], - 'AllowHeader' => [ - 'location' => 'header', - 'sentAs' => 'access-control-allow-headers' - ], - 'SseKms' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption' - ], - 'SseKmsKey' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption-aws-kms-key-id' - ], - 'SseC' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption-customer-algorithm' - ], - 'SseCKeyMd5' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption-customer-key-MD5' - ], - 'Metadata' => [ - 'location' => 'header', - 'type' => 'object', - 'sentAs' => 'x-amz-meta-' - ] - ] - ] + ], + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], ], + ], + ], - 'copyObject' => [ - 'httpMethod' => 'PUT', - 'requestParameters' => [ - 'ACL' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-amz-acl', - 'transform' => 'aclHeader' - ], - 'StorageClass' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-amz-storage-class', - 'transform' => 'storageClass' + 'getBucketNotification' => [ + 'httpMethod' => 'GET', + 'specialParam' => 'notification', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], + 'TopicConfigurations' => [ + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'TopicConfiguration', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'type' => 'object', + 'location' => 'xml', + 'sentAs' => 'TopicConfiguration', + 'properties' => [ + 'ID' => [ + 'type' => 'string', + 'sentAs' => 'Id', ], - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' + 'Topic' => [ + 'type' => 'string', ], - 'Key' => [ - 'required' => true, + 'Event' => [ + 'type' => 'array', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ 'type' => 'string', - 'location' => 'uri' + 'sentAs' => 'Event', + ], ], - 'CopySource' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-amz-copy-source' + 'Filter' => [ + 'type' => 'array', + 'wrapper' => 'Filter', + 'sentAs' => 'S3Key', + 'items' => [ + 'type' => 'object', + 'sentAs' => 'FilterRule', + 'properties' => [ + 'Name' => [ + 'type' => 'string', + ], + + 'Value' => [ + 'type' => 'string', + ], + ], + ], ], - 'CopySourceIfMatch' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-amz-copy-source-if-match' - ], - 'CopySourceIfModifiedSince' => [ - 'type' => 'string', - 'format' => 'date-time-http', - 'location' => 'header', - 'sentAs' => 'x-amz-copy-source-if-modified-since' - ], - 'CopySourceIfNoneMatch' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-amz-copy-source-if-none-match' - ], - 'CopySourceIfUnmodifiedSince' => [ - 'type' => 'string', - 'format' => 'date-time-http', - 'location' => 'header', - 'sentAs' => 'x-amz-copy-source-if-unmodified-since' - ], - 'MetadataDirective' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-amz-metadata-directive' - ], - 'ContentType' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'content-type' - ], - 'ContentEncoding' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'content-encoding' - ], - 'ContentLanguage' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'content-language' - ], - 'ContentDisposition' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'content-disposition' - ], - 'CacheControl' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'cache-control' - ], - 'Expires' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'expires' - ], - 'Metadata' => [ - 'type' => 'object', - 'location' => 'header', - 'sentAs' => 'x-amz-meta-' - ], - 'WebsiteRedirectLocation' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-amz-website-redirect-location' - ], - 'SseKms' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption' - ], - 'SseKmsKey' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption-aws-kms-key-id' - ], - 'SseC' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption-customer-algorithm' - ], - 'SseCKey' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption-customer-key', - 'type' => 'password' - ], - 'CopySourceSseC' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-copy-source-server-side-encryption-customer-algorithm' - ], - 'CopySourceSseCKey' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-copy-source-server-side-encryption-customer-key', - 'type' => 'password' - ] + ], ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'ETag' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'LastModified' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'VersionId' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-amz-version-id' - ], - 'CopySourceVersionId' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-amz-copy-source-version-id' - ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ], - 'SseKms' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption' - ], - 'SseKmsKey' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption-aws-kms-key-id' - ], - 'SseC' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption-customer-algorithm' - ], - 'SseCKeyMd5' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption-customer-key-MD5' - ] - ] - ] + ], ], + ], + ], - 'getObjectMetadata' => [ - 'httpMethod' => 'HEAD', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'Key' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'uri' - ], - 'VersionId' => [ - 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'versionId' - ], - 'Origin' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'Origin' - ], - 'RequestHeader' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'Access-Control-Request-Headers' + 'setObjectTagging' => [ + 'httpMethod' => 'PUT', + 'specialParam' => 'tagging', + 'data' => [ + 'xmlRoot' => [ + 'name' => 'Tagging', + ], + 'contentMd5' => true, + ], + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Key' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ], + 'VersionId' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'versionId', + ], + 'Tags' => [ + 'required' => true, + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'TagSet', + 'items' => [ + 'required' => true, + 'type' => 'object', + 'name' => 'Tag', + 'properties' => [ + 'Key' => [ + 'required' => true, + 'type' => 'string', + ], + 'Value' => [ + 'required' => true, + 'type' => 'string', + ], + ], + ], + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], + ], + ], + ], + + 'getObjectTagging' => [ + 'httpMethod' => 'GET', + 'specialParam' => 'tagging', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Key' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ], + 'VersionId' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'versionId', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], + 'Tags' => [ + 'required' => true, + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'TagSet', + 'items' => [ + 'required' => true, + 'type' => 'object', + 'name' => 'Tag', + 'properties' => [ + 'Key' => [ + 'required' => true, + 'type' => 'string', ], - 'SseC' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption-customer-algorithm' + 'Value' => [ + 'required' => true, + 'type' => 'string', ], - 'SseCKey' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption-customer-key', - 'type' => 'password' - ] + ], ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'Expiration' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-amz-expiration' - ], - 'LastModified' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'last-modified' - ], - 'ContentLength' => [ - 'type' => 'integer', - 'location' => 'header', - 'sentAs' => 'content-length' - ], - 'ContentType' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'content-type' - ], - 'ETag' => [ - 'type' => 'string', - 'location' => 'header' - ], - 'VersionId' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-amz-version-id' - ], - 'WebsiteRedirectLocation' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-amz-website-redirect-location' - ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ], - 'StorageClass' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-storage-class' - ], - 'AllowOrigin' => [ - 'location' => 'header', - 'sentAs' => 'access-control-allow-origin' - ], - 'MaxAgeSeconds' => [ - 'type' => 'integer', - 'location' => 'header', - 'sentAs' => 'access-control-max-age' - ], - 'ExposeHeader' => [ - 'location' => 'header', - 'sentAs' => 'access-control-expose-headers' - ], - 'AllowMethod' => [ - 'location' => 'header', - 'sentAs' => 'access-control-allow-methods' - ], - 'AllowHeader' => [ - 'location' => 'header', - 'sentAs' => 'access-control-allow-headers' - ], - 'Restore' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-restore' - ], - 'SseKms' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption' - ], - 'SseKmsKey' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption-aws-kms-key-id' - ], - 'SseC' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption-customer-algorithm' - ], - 'SseCKeyMd5' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption-customer-key-MD5' - ], - 'Metadata' => [ - 'location' => 'header', - 'type' => 'object', - 'sentAs' => 'x-amz-meta-' - ] - ] - ] + ], ], + ], + ], - 'initiateMultipartUpload' => [ - 'httpMethod' => 'POST', - 'specialParam' => 'uploads', - 'requestParameters' => [ - 'ACL' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-amz-acl', - 'transform' => 'aclHeader' - ], - 'StorageClass' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-amz-storage-class', - 'transform' => 'storageClass' - ], - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'ContentType' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'Content-Type' - ], - 'Key' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'uri' + 'deleteObjectTagging' => [ + 'httpMethod' => 'DELETE', + 'specialParam' => 'tagging', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], + ], + ], + ], + + 'optionsObject' => [ + 'httpMethod' => 'OPTIONS', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Key' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ], + 'Origin' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'header', + ], + 'AccessControlRequestMethods' => [ + 'required' => true, + 'type' => 'array', + 'location' => 'header', + 'items' => [ + 'sentAs' => 'Access-Control-Request-Method', + 'type' => 'string', + ], + ], + 'AccessControlRequestHeaders' => [ + 'type' => 'array', + 'location' => 'header', + 'items' => [ + 'sentAs' => 'Access-Control-Request-Headers', + 'type' => 'string', + ], + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], + 'AllowOrigin' => [ + 'location' => 'header', + 'sentAs' => 'access-control-allow-origin', + ], + 'AllowHeader' => [ + 'location' => 'header', + 'sentAs' => 'access-control-allow-headers', + ], + 'AllowMethod' => [ + 'location' => 'header', + 'sentAs' => 'access-control-allow-methods', + ], + 'ExposeHeader' => [ + 'location' => 'header', + 'sentAs' => 'access-control-expose-headers', + ], + 'MaxAgeSeconds' => [ + 'location' => 'header', + 'sentAs' => 'access-control-max-age', + ], + ], + ], + ], + + 'deleteObject' => [ + 'httpMethod' => 'DELETE', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Key' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ], + 'VersionId' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'versionId', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'DeleteMarker' => [ + 'type' => 'boolean', + 'location' => 'header', + 'sentAs' => 'x-amz-delete-marker', + ], + 'VersionId' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-amz-version-id', + ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], + ], + ], + ], + 'deleteObjects' => [ + 'httpMethod' => 'POST', + 'specialParam' => 'delete', + 'data' => [ + 'xmlRoot' => [ + 'name' => 'Delete', + ], + 'contentMd5' => true, + ], + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Quiet' => [ + 'type' => 'boolean', + 'location' => 'xml', + ], + 'Objects' => [ + 'required' => true, + 'type' => 'array', + 'location' => 'xml', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'type' => 'object', + 'sentAs' => 'Object', + 'properties' => [ + 'Key' => [ + 'required' => true, + 'type' => 'string', + ], + 'VersionId' => [ + 'type' => 'string', + ], + ], + ], + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'Deleteds' => [ + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'Deleted', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'name' => 'DeletedObject', + 'type' => 'object', + 'properties' => [ + 'Key' => [ + 'type' => 'string', ], - 'Metadata' => [ - 'type' => 'object', - 'location' => 'header', - 'sentAs' => 'x-amz-meta-' + 'VersionId' => [ + 'type' => 'string', ], - 'WebsiteRedirectLocation' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-amz-website-redirect-location' + 'DeleteMarker' => [ + 'type' => 'boolean', ], - 'SseKms' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption' + 'DeleteMarkerVersionId' => [ + 'type' => 'string', ], - 'SseKmsKey' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption-aws-kms-key-id' + ], + ], + ], + 'Errors' => [ + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'Error', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'name' => 'Error', + 'type' => 'object', + 'sentAs' => 'Error', + 'properties' => [ + 'Key' => [ + 'type' => 'string', ], - 'SseC' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption-customer-algorithm' + 'VersionId' => [ + 'type' => 'string', ], - 'SseCKey' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption-customer-key', - 'type' => 'password' + 'Code' => [ + 'type' => 'string', ], - 'Expires' => [ - 'location' => 'header', + 'Message' => [ 'type' => 'string', - 'sentAs' => 'x-obs-expires' - ] + ], + ], ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'Bucket' => [ - 'type' => 'string', - 'location' => 'xml', - 'sentAs' => 'Bucket' - ], - 'Key' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'UploadId' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ], - 'SseKms' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption' - ], - 'SseKmsKey' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption-aws-kms-key-id' - ], - 'SseC' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption-customer-algorithm' - ], - 'SseCKeyMd5' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption-customer-key-MD5' - ] - ] - ] + ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], ], + ], + ], - 'listMultipartUploads' => [ - 'httpMethod' => 'GET', - 'specialParam' => 'uploads', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, + 'setObjectAcl' => [ + 'httpMethod' => 'PUT', + 'specialParam' => 'acl', + 'data' => [ + 'xmlRoot' => [ + 'name' => 'AccessControlPolicy', + ], + ], + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Key' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ], + 'VersionId' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'versionId', + ], + 'ACL' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-amz-acl', + 'transform' => 'aclHeader', + ], + 'GrantRead' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-amz-grant-read', + ], + 'GrantWrite' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-amz-grant-write', + ], + 'GrantReadAcp' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-amz-grant-read-acp', + ], + 'GrantWriteAcp' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-amz-grant-write-acp', + ], + 'GrantFullControl' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-amz-grant-full-control', + ], + 'Owner' => [ + 'type' => 'object', + 'location' => 'xml', + 'properties' => [ + 'DisplayName' => [ + 'type' => 'string', + ], + 'ID' => [ + 'type' => 'string', + ], + ], + ], + 'Grants' => [ + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'AccessControlList', + 'items' => [ + 'name' => 'Grant', + 'type' => 'object', + 'properties' => [ + 'Grantee' => [ + 'type' => 'object', + 'properties' => [ + 'DisplayName' => [ 'type' => 'string', - 'location' => 'dns' - ], - 'Delimiter' => [ + ], + 'ID' => [ 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'delimiter' - ], - 'KeyMarker' => [ + ], + 'Type' => [ + 'required' => true, 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'key-marker' - ], - 'MaxUploads' => [ - 'type' => 'numeric', - 'location' => 'query', - 'sentAs' => 'max-uploads' - ], - 'Prefix' => [ + 'sentAs' => 'xsi:type', + 'data' => [ + 'xmlAttribute' => true, + 'xmlNamespace' => 'http://www.w3.org/2001/XMLSchema-instance', + ], + ], + 'URI' => [ 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'prefix' + 'transform' => 'aclUri', + ], ], - 'UploadIdMarker' => [ - 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'upload-id-marker' - ] + ], + 'Permission' => [ + 'type' => 'string', + ], ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'Bucket' => [ - 'type' => 'string', - 'location' => 'xml' + ], + ], + ], + 'responseParameters' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], + ], + ], + + 'getObjectAcl' => [ + 'httpMethod' => 'GET', + 'specialParam' => 'acl', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Key' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ], + 'VersionId' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'versionId', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'Owner' => [ + 'type' => 'object', + 'location' => 'xml', + 'properties' => [ + 'DisplayName' => [ + 'type' => 'string', + ], + 'ID' => [ + 'type' => 'string', + ], + ], + ], + 'Grants' => [ + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'AccessControlList', + 'items' => [ + 'name' => 'Grant', + 'type' => 'object', + 'sentAs' => 'Grant', + 'properties' => [ + 'Grantee' => [ + 'type' => 'object', + 'properties' => [ + 'DisplayName' => [ + 'type' => 'string', ], - 'KeyMarker' => [ - 'type' => 'string', - 'location' => 'xml' + 'ID' => [ + 'type' => 'string', ], - 'UploadIdMarker' => [ - 'type' => 'string', - 'location' => 'xml' + 'URI' => [ + 'type' => 'string', ], - 'NextKeyMarker' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'Prefix' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'Delimiter' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'NextUploadIdMarker' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'MaxUploads' => [ - 'type' => 'numeric', - 'location' => 'xml' - ], - 'IsTruncated' => [ - 'type' => 'boolean', - 'location' => 'xml' - ], - 'Uploads' => [ - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'Upload', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'name' => 'MultipartUpload', - 'type' => 'object', - 'sentAs' => 'Upload', - 'properties' => [ - 'UploadId' => [ - 'type' => 'string' - ], - 'Key' => [ - 'type' => 'string' - ], - 'Initiated' => [ - 'type' => 'string' - ], - 'StorageClass' => [ - 'type' => 'string' - ], - 'Owner' => [ - 'type' => 'object', - 'properties' => [ - 'DisplayName' => [ - 'type' => 'string' - ], - 'ID' => [ - 'type' => 'string' - ] - ] - ], - 'Initiator' => [ - 'type' => 'object', - 'properties' => [ - 'ID' => [ - 'type' => 'string' - ], - 'DisplayName' => [ - 'type' => 'string' - ] - ] - ] - ] - ] - ], - 'CommonPrefixes' => [ - 'type' => 'array', - 'location' => 'xml', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'name' => 'CommonPrefix', - 'type' => 'object', - 'properties' => [ - 'Prefix' => [ - 'type' => 'string' - ] - ] - ] - ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ] - ] - ] - ], - - 'abortMultipartUpload' => [ - 'httpMethod' => 'DELETE', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' + ], ], - 'Key' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'uri' + 'Permission' => [ + 'type' => 'string', ], - 'UploadId' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'uploadId' - ] + ], ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ] - ] - ] + ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], + 'VersionId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-version-id', + ], ], + ], + ], - 'uploadPart' => [ - 'httpMethod' => 'PUT', - 'requestParameters' => [ - 'Body' => [ - 'type' => 'stream', - 'location' => 'body' - ], - 'SourceFile' => [ - 'type' => 'file', - 'location' => 'body' - ], - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'Key' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'uri' - ], - 'PartNumber' => [ - 'required' => true, - 'type' => 'numeric', - 'location' => 'query', - 'sentAs' => 'partNumber' - ], - 'UploadId' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'uploadId' - ], - 'Offset' => [ - 'type' => 'numeric', - 'location' => 'response' - ], - 'PartSize' => [ - 'type' => 'numeric', - 'location' => 'response' + 'restoreObject' => [ + 'httpMethod' => 'POST', + 'specialParam' => 'restore', + 'data' => [ + 'xmlRoot' => [ + 'name' => 'RestoreRequest', + ], + ], + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Key' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ], + 'VersionId' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'versionId', + ], + 'Days' => [ + 'required' => true, + 'type' => 'numeric', + 'location' => 'xml', + 'sentAs' => 'Days', + ], + 'Tier' => [ + 'wrapper' => 'GlacierJobParameters', + 'type' => 'string', + 'sentAs' => 'Tier', + 'location' => 'xml', + ], + ], + 'responseParameters' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], + ], + ], + + 'putObject' => [ + 'httpMethod' => 'PUT', + 'requestParameters' => [ + 'ACL' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-amz-acl', + 'transform' => 'aclHeader', + ], + 'StorageClass' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-amz-storage-class', + 'transform' => 'storageClass', + ], + 'Body' => [ + 'type' => 'stream', + 'location' => 'body', + ], + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Key' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ], + 'Callback' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-amz-callback', + ], + 'ContentMD5' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-MD5', + ], + 'ContentType' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Type', + ], + 'ContentLength' => [ + 'type' => 'numeric', + 'location' => 'header', + 'sentAs' => 'Content-Length', + ], + 'Metadata' => [ + 'type' => 'object', + 'location' => 'header', + 'sentAs' => 'x-amz-meta-', + ], + 'SourceFile' => [ + 'type' => 'file', + 'location' => 'body', + ], + 'WebsiteRedirectLocation' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-amz-website-redirect-location', + ], + 'SseKms' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption', + ], + 'SseKmsKey' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption-aws-kms-key-id', + ], + 'SseC' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption-customer-algorithm', + ], + 'SseCKey' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption-customer-key', + 'type' => 'password', + ], + 'Expires' => [ + 'location' => 'header', + 'type' => 'string', + 'sentAs' => 'x-amz-expires', + ], + 'Tagging' => [ + 'location' => 'header', + 'type' => 'string', + 'sentAs' => 'x-amz-tagging', + ] + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'ETag' => [ + 'type' => 'string', + 'location' => 'header', + ], + 'VersionId' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-amz-version-id', + ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], + 'StorageClass' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-storage-class', + ], + 'SseKms' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption', + ], + 'SseKmsKey' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption-aws-kms-key-id', + ], + 'SseC' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption-customer-algorithm', + ], + 'SseCKeyMd5' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption-customer-key-MD5', + ], + ], + ], + ], + + 'getObject' => [ + 'httpMethod' => 'GET', + 'stream' => true, + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'IfMatch' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'If-Match', + ], + 'IfModifiedSince' => [ + 'type' => 'string', + 'format' => 'date-time-http', + 'location' => 'header', + 'sentAs' => 'If-Modified-Since', + ], + 'IfNoneMatch' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'If-None-Match', + ], + 'IfUnmodifiedSince' => [ + 'type' => 'string', + 'format' => 'date-time-http', + 'location' => 'header', + 'sentAs' => 'If-Unmodified-Since', + ], + 'Key' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ], + 'Range' => [ + 'type' => 'string', + 'location' => 'header', + ], + 'ImageProcess' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'x-image-process', + ], + 'ResponseCacheControl' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'response-cache-control', + ], + 'ResponseContentDisposition' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'response-content-disposition', + ], + 'ResponseContentEncoding' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'response-content-encoding', + ], + 'ResponseContentLanguage' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'response-content-language', + ], + 'ResponseContentType' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'response-content-type', + ], + 'ResponseExpires' => [ + 'type' => 'string', + 'format' => 'date-time-http', + 'location' => 'query', + 'sentAs' => 'response-expires', + ], + 'VersionId' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'versionId', + ], + 'SaveAsFile' => [ + 'type' => 'file', + 'location' => 'response', + ], + 'FilePath' => [ + 'type' => 'file', + 'location' => 'response', + ], + + 'Origin' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Origin', + ], + 'RequestHeader' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Access-Control-Request-Headers', + ], + 'SseC' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption-customer-algorithm', + ], + 'SseCKey' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption-customer-key', + 'type' => 'password', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'Body' => [ + 'type' => 'stream', + 'location' => 'body', + ], + 'DeleteMarker' => [ + 'type' => 'boolean', + 'location' => 'header', + 'sentAs' => 'x-amz-delete-marker', + ], + 'Expiration' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-amz-expiration', + ], + 'LastModified' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'last-modified', + ], + 'ContentLength' => [ + 'type' => 'integer', + 'location' => 'header', + 'sentAs' => 'content-length', + ], + 'ETag' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'etag', + ], + 'VersionId' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-amz-version-id', + ], + 'CacheControl' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'cache-control', + ], + 'ContentDisposition' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'content-disposition', + ], + 'ContentEncoding' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'content-encoding', + ], + 'ContentLanguage' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'content-language', + ], + 'ContentType' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'content-type', + ], + 'Expires' => [ + 'type' => 'string', + 'location' => 'header', + ], + 'WebsiteRedirectLocation' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-amz-website-redirect-location', + ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], + 'StorageClass' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-storage-class', + ], + 'Restore' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-restore', + ], + 'AllowOrigin' => [ + 'location' => 'header', + 'sentAs' => 'access-control-allow-origin', + ], + 'MaxAgeSeconds' => [ + 'location' => 'header', + 'sentAs' => 'access-control-max-age', + ], + 'ExposeHeader' => [ + 'location' => 'header', + 'sentAs' => 'access-control-expose-headers', + ], + 'AllowMethod' => [ + 'location' => 'header', + 'sentAs' => 'access-control-allow-methods', + ], + 'AllowHeader' => [ + 'location' => 'header', + 'sentAs' => 'access-control-allow-headers', + ], + 'SseKms' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption', + ], + 'SseKmsKey' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption-aws-kms-key-id', + ], + 'SseC' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption-customer-algorithm', + ], + 'SseCKeyMd5' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption-customer-key-MD5', + ], + 'Metadata' => [ + 'location' => 'header', + 'type' => 'object', + 'sentAs' => 'x-amz-meta-', + ], + 'ObjectType' => [ + 'location' => 'header', + 'type' => 'string', + 'sentAs' => 'x-amz-object-type', + ], + 'AppendPosition' => [ + 'location' => 'header', + 'type' => 'string', + 'sentAs' => 'x-amz-next-append-position', + ], + 'TaggingCount' => [ + 'location' => 'header', + 'type' => 'string', + 'sentAs' => 'x-amz-tagging-count', + ], + ], + ], + ], + + 'copyObject' => [ + 'httpMethod' => 'PUT', + 'requestParameters' => [ + 'ACL' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-amz-acl', + 'transform' => 'aclHeader', + ], + 'StorageClass' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-amz-storage-class', + 'transform' => 'storageClass', + ], + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Key' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ], + 'CopySource' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-amz-copy-source', + ], + 'CopySourceIfMatch' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-amz-copy-source-if-match', + ], + 'CopySourceIfModifiedSince' => [ + 'type' => 'string', + 'format' => 'date-time-http', + 'location' => 'header', + 'sentAs' => 'x-amz-copy-source-if-modified-since', + ], + 'CopySourceIfNoneMatch' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-amz-copy-source-if-none-match', + ], + 'CopySourceIfUnmodifiedSince' => [ + 'type' => 'string', + 'format' => 'date-time-http', + 'location' => 'header', + 'sentAs' => 'x-amz-copy-source-if-unmodified-since', + ], + 'MetadataDirective' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-amz-metadata-directive', + ], + 'ContentType' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'content-type', + ], + 'ContentEncoding' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'content-encoding', + ], + 'ContentLanguage' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'content-language', + ], + 'ContentDisposition' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'content-disposition', + ], + 'CacheControl' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'cache-control', + ], + 'Expires' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'expires', + ], + 'Metadata' => [ + 'type' => 'object', + 'location' => 'header', + 'sentAs' => 'x-amz-meta-', + ], + 'WebsiteRedirectLocation' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-amz-website-redirect-location', + ], + 'SseKms' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption', + ], + 'SseKmsKey' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption-aws-kms-key-id', + ], + 'SseC' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption-customer-algorithm', + ], + 'SseCKey' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption-customer-key', + 'type' => 'password', + ], + 'CopySourceSseC' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-copy-source-server-side-encryption-customer-algorithm', + ], + 'CopySourceSseCKey' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-copy-source-server-side-encryption-customer-key', + 'type' => 'password', + ], + 'Tagging' => [ + 'location' => 'header', + 'type' => 'string', + 'sentAs' => 'x-amz-tagging', + ], + 'TaggingDirective' => [ + 'location' => 'header', + 'type' => 'string', + 'sentAs' => 'x-amz-tagging-directive', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'ETag' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'LastModified' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'VersionId' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-amz-version-id', + ], + 'CopySourceVersionId' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-amz-copy-source-version-id', + ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], + 'SseKms' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption', + ], + 'SseKmsKey' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption-aws-kms-key-id', + ], + 'SseC' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption-customer-algorithm', + ], + 'SseCKeyMd5' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption-customer-key-MD5', + ], + ], + ], + ], + + 'setObjectMetadata' => [ + 'httpMethod' => 'PUT', + 'specialParam' => 'metadata', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Key' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ], + 'VersionId' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'versionId', + ], + 'Origin' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Origin', + ], + 'RequestHeader' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Access-Control-Request-Headers', + ], + 'ContentType' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'content-type', + ], + 'ContentEncoding' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'content-encoding', + ], + 'ContentLanguage' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'content-language', + ], + 'ContentDisposition' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'content-disposition', + ], + 'CacheControl' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'cache-control', + ], + 'Expires' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'expires', + ], + 'StorageClass' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-storage-class', + ], + 'Metadata' => [ + 'type' => 'object', + 'location' => 'header', + 'sentAs' => 'x-amz-meta-', + ], + 'MetadataDirective' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-amz-metadata-directive', + ], + 'WebsiteRedirectLocation' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-amz-website-redirect-location', + ], + 'Tagging' => [ + 'location' => 'header', + 'type' => 'string', + 'sentAs' => 'x-amz-tagging', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], + 'ContentType' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'content-type', + ], + 'ContentEncoding' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'content-encoding', + ], + 'ContentLanguage' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'content-language', + ], + 'ContentDisposition' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'content-disposition', + ], + 'CacheControl' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'cache-control', + ], + 'Expires' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'expires', + ], + 'StorageClass' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-storage-class', + ], + 'Metadata' => [ + 'type' => 'object', + 'location' => 'header', + 'sentAs' => 'x-amz-meta-', + ], + 'WebsiteRedirectLocation' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-amz-website-redirect-location', + ], + ], + ], + ], + + 'getObjectMetadata' => [ + 'httpMethod' => 'HEAD', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Key' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ], + 'VersionId' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'versionId', + ], + 'Origin' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Origin', + ], + 'RequestHeader' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Access-Control-Request-Headers', + ], + 'SseC' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption-customer-algorithm', + ], + 'SseCKey' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption-customer-key', + 'type' => 'password', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'Expiration' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-amz-expiration', + ], + 'LastModified' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'last-modified', + ], + 'ContentLength' => [ + 'type' => 'integer', + 'location' => 'header', + 'sentAs' => 'content-length', + ], + 'ContentType' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'content-type', + ], + 'ETag' => [ + 'type' => 'string', + 'location' => 'header', + ], + 'VersionId' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-amz-version-id', + ], + 'WebsiteRedirectLocation' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-amz-website-redirect-location', + ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], + 'StorageClass' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-storage-class', + ], + 'AllowOrigin' => [ + 'location' => 'header', + 'sentAs' => 'access-control-allow-origin', + ], + 'MaxAgeSeconds' => [ + 'type' => 'integer', + 'location' => 'header', + 'sentAs' => 'access-control-max-age', + ], + 'ExposeHeader' => [ + 'location' => 'header', + 'sentAs' => 'access-control-expose-headers', + ], + 'AllowMethod' => [ + 'location' => 'header', + 'sentAs' => 'access-control-allow-methods', + ], + 'AllowHeader' => [ + 'location' => 'header', + 'sentAs' => 'access-control-allow-headers', + ], + 'Restore' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-restore', + ], + 'SseKms' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption', + ], + 'SseKmsKey' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption-aws-kms-key-id', + ], + 'SseC' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption-customer-algorithm', + ], + 'SseCKeyMd5' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption-customer-key-MD5', + ], + 'Metadata' => [ + 'location' => 'header', + 'type' => 'object', + 'sentAs' => 'x-amz-meta-', + ], + 'TaggingCount' => [ + 'location' => 'header', + 'type' => 'string', + 'sentAs' => 'x-amz-tagging-count', + ], + ], + ], + ], + + 'initiateMultipartUpload' => [ + 'httpMethod' => 'POST', + 'specialParam' => 'uploads', + 'requestParameters' => [ + 'ACL' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-amz-acl', + 'transform' => 'aclHeader', + ], + 'StorageClass' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-amz-storage-class', + 'transform' => 'storageClass', + ], + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'ContentType' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Type', + ], + 'Key' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ], + 'Metadata' => [ + 'type' => 'object', + 'location' => 'header', + 'sentAs' => 'x-amz-meta-', + ], + 'WebsiteRedirectLocation' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-amz-website-redirect-location', + ], + 'SseKms' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption', + ], + 'SseKmsKey' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption-aws-kms-key-id', + ], + 'SseC' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption-customer-algorithm', + ], + 'SseCKey' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption-customer-key', + 'type' => 'password', + ], + 'Expires' => [ + 'location' => 'header', + 'type' => 'string', + 'sentAs' => 'x-amz-expires', + ], + 'Tagging' => [ + 'location' => 'header', + 'type' => 'string', + 'sentAs' => 'x-amz-tagging', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'Bucket' => [ + 'type' => 'string', + 'location' => 'xml', + 'sentAs' => 'Bucket', + ], + 'Key' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'UploadId' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], + 'SseKms' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption', + ], + 'SseKmsKey' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption-aws-kms-key-id', + ], + 'SseC' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption-customer-algorithm', + ], + 'SseCKeyMd5' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption-customer-key-MD5', + ], + ], + ], + ], + + 'listMultipartUploads' => [ + 'httpMethod' => 'GET', + 'specialParam' => 'uploads', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Delimiter' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'delimiter', + ], + 'KeyMarker' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'key-marker', + ], + 'MaxUploads' => [ + 'type' => 'numeric', + 'location' => 'query', + 'sentAs' => 'max-uploads', + ], + 'Prefix' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'prefix', + ], + 'UploadIdMarker' => [ + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'upload-id-marker', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'Bucket' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'KeyMarker' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'UploadIdMarker' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'NextKeyMarker' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'Prefix' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'Delimiter' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'NextUploadIdMarker' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'MaxUploads' => [ + 'type' => 'numeric', + 'location' => 'xml', + ], + 'IsTruncated' => [ + 'type' => 'boolean', + 'location' => 'xml', + ], + 'Uploads' => [ + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'Upload', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'name' => 'MultipartUpload', + 'type' => 'object', + 'sentAs' => 'Upload', + 'properties' => [ + 'UploadId' => [ + 'type' => 'string', ], - 'ContentMD5' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'Content-MD5' + 'Key' => [ + 'type' => 'string', ], - 'ContentType' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'Content-Type' + 'Initiated' => [ + 'type' => 'string', ], - 'SseC' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption-customer-algorithm' + 'StorageClass' => [ + 'type' => 'string', ], - 'SseCKey' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption-customer-key', - 'type' => 'password' - ] - ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'ETag' => [ - 'type' => 'string', - 'location' => 'header' - ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ], - 'SseKms' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption' + 'Owner' => [ + 'type' => 'object', + 'properties' => [ + 'DisplayName' => [ + 'type' => 'string', ], - 'SseKmsKey' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption-aws-kms-key-id' + 'ID' => [ + 'type' => 'string', ], - 'SseC' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption-customer-algorithm' - ], - 'SseCKeyMd5' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption-customer-key-MD5' - ] - ] - ] - ], - - 'completeMultipartUpload' => [ - 'httpMethod' => 'POST', - 'data' => [ - 'xmlRoot' => [ - 'name' => 'CompleteMultipartUpload' - ] - ], - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'Key' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'uri' + ], ], - 'Parts' => [ - 'type' => 'array', - 'location' => 'xml', - 'data' => [ - 'xmlFlattened' => true + 'Initiator' => [ + 'type' => 'object', + 'properties' => [ + 'ID' => [ + 'type' => 'string', ], - 'items' => [ - 'name' => 'CompletedPart', - 'type' => 'object', - 'sentAs' => 'Part', - 'properties' => [ - 'PartNumber' => [ - 'type' => 'numeric' - ], - 'ETag' => [ - 'type' => 'string' - ] - ] - ] - ], - 'UploadId' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'uploadId' + 'DisplayName' => [ + 'type' => 'string', + ], + ], ], - 'Callback' => [ + ], + ], + ], + 'CommonPrefixes' => [ + 'type' => 'array', + 'location' => 'xml', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'name' => 'CommonPrefix', + 'type' => 'object', + 'properties' => [ + 'Prefix' => [ 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-amz-callback' - ] + ], + ], ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'Location' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'Bucket' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'Key' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'Location' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'ETag' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'VersionId' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-amz-version-id' - ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ], - 'SseKms' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption' - ], - 'SseKmsKey' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption-aws-kms-key-id' - ], - 'SseC' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption-customer-algorithm' - ], - 'SseCKeyMd5' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption-customer-key-MD5' - ] - ] - ] + ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], ], + ], + ], - 'listParts' => [ - 'httpMethod' => 'GET', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'Key' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'uri' - ], - 'MaxParts' => [ - 'type' => 'numeric', - 'location' => 'query', - 'sentAs' => 'max-parts' - ], - 'PartNumberMarker' => [ - 'type' => 'numeric', - 'location' => 'query', - 'sentAs' => 'part-number-marker' - ], - 'UploadId' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'uploadId' - ] + 'abortMultipartUpload' => [ + 'httpMethod' => 'DELETE', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Key' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ], + 'UploadId' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'uploadId', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], + ], + ], + ], + + 'uploadPart' => [ + 'httpMethod' => 'PUT', + 'requestParameters' => [ + 'Body' => [ + 'type' => 'stream', + 'location' => 'body', + ], + 'SourceFile' => [ + 'type' => 'file', + 'location' => 'body', + ], + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Key' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ], + 'PartNumber' => [ + 'required' => true, + 'type' => 'numeric', + 'location' => 'query', + 'sentAs' => 'partNumber', + ], + 'UploadId' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'uploadId', + ], + 'Offset' => [ + 'type' => 'numeric', + 'location' => 'response', + ], + 'PartSize' => [ + 'type' => 'numeric', + 'location' => 'response', + ], + 'ContentMD5' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-MD5', + ], + 'ContentType' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Type', + ], + 'SseC' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption-customer-algorithm', + ], + 'SseCKey' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption-customer-key', + 'type' => 'password', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'ETag' => [ + 'type' => 'string', + 'location' => 'header', + ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], + 'SseKms' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption', + ], + 'SseKmsKey' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption-aws-kms-key-id', + ], + 'SseC' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption-customer-algorithm', + ], + 'SseCKeyMd5' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption-customer-key-MD5', + ], + ], + ], + ], + + 'completeMultipartUpload' => [ + 'httpMethod' => 'POST', + 'data' => [ + 'xmlRoot' => [ + 'name' => 'CompleteMultipartUpload', + ], + ], + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Key' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ], + 'Parts' => [ + 'type' => 'array', + 'location' => 'xml', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'name' => 'CompletedPart', + 'type' => 'object', + 'sentAs' => 'Part', + 'properties' => [ + 'PartNumber' => [ + 'type' => 'numeric', + ], + 'ETag' => [ + 'type' => 'string', + ], ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'Bucket' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'Key' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'UploadId' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'PartNumberMarker' => [ - 'type' => 'numeric', - 'location' => 'xml' - ], - 'NextPartNumberMarker' => [ - 'type' => 'numeric', - 'location' => 'xml' - ], - 'MaxParts' => [ - 'type' => 'numeric', - 'location' => 'xml' - ], - 'IsTruncated' => [ - 'type' => 'boolean', - 'location' => 'xml' - ], - 'Parts' => [ - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'Part', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'name' => 'Part', - 'type' => 'object', - 'sentAs' => 'Part', - 'properties' => [ - 'PartNumber' => [ - 'type' => 'integer' - ], - 'LastModified' => [ - 'type' => 'string' - ], - 'ETag' => [ - 'type' => 'string' - ], - 'Size' => [ - 'type' => 'integer' - ] - ] - ] - ], - 'Initiator' => [ - 'type' => 'object', - 'location' => 'xml', - 'properties' => [ - 'ID' => [ - 'type' => 'string' - ], - 'DisplayName' => [ - 'type' => 'string' - ] - ] - ], - 'Owner' => [ - 'type' => 'object', - 'location' => 'xml', - 'properties' => [ - 'DisplayName' => [ - 'type' => 'string' - ], - 'ID' => [ - 'type' => 'string' - ] - ] - ], - 'StorageClass' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ] - ] - ] + ], + ], + 'UploadId' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'uploadId', + ], + 'Callback' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-amz-callback', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'Location' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'Bucket' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'Key' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'Location' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'ETag' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'VersionId' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-amz-version-id', + ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], + 'SseKms' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption', + ], + 'SseKmsKey' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption-aws-kms-key-id', + ], + 'SseC' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption-customer-algorithm', + ], + 'SseCKeyMd5' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption-customer-key-MD5', + ], ], + ], + ], - 'copyPart' => [ - 'httpMethod' => 'PUT', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ], - 'CopySource' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-amz-copy-source' - ], - 'CopySourceRange' => [ - 'type' => 'string', - 'location' => 'header', - 'sentAs' => 'x-amz-copy-source-range' - ], - 'Key' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'uri' - ], - 'PartNumber' => [ - 'required' => true, - 'type' => 'numeric', - 'location' => 'query', - 'sentAs' => 'partNumber' - ], - 'UploadId' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'uploadId' + 'listParts' => [ + 'httpMethod' => 'GET', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'Key' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ], + 'MaxParts' => [ + 'type' => 'numeric', + 'location' => 'query', + 'sentAs' => 'max-parts', + ], + 'PartNumberMarker' => [ + 'type' => 'numeric', + 'location' => 'query', + 'sentAs' => 'part-number-marker', + ], + 'UploadId' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'uploadId', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'Bucket' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'Key' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'UploadId' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'PartNumberMarker' => [ + 'type' => 'numeric', + 'location' => 'xml', + ], + 'NextPartNumberMarker' => [ + 'type' => 'numeric', + 'location' => 'xml', + ], + 'MaxParts' => [ + 'type' => 'numeric', + 'location' => 'xml', + ], + 'IsTruncated' => [ + 'type' => 'boolean', + 'location' => 'xml', + ], + 'Parts' => [ + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'Part', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'name' => 'Part', + 'type' => 'object', + 'sentAs' => 'Part', + 'properties' => [ + 'PartNumber' => [ + 'type' => 'integer', ], - 'SseC' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption-customer-algorithm' + 'LastModified' => [ + 'type' => 'string', ], - 'SseCKey' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption-customer-key', - 'type' => 'password' + 'ETag' => [ + 'type' => 'string', ], - 'CopySourceSseC' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-copy-source-server-side-encryption-customer-algorithm' + 'Size' => [ + 'type' => 'integer', ], - 'CopySourceSseCKey' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-copy-source-server-side-encryption-customer-key', - 'type' => 'password' - ] + ], ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'ETag' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'LastModified' => [ - 'type' => 'string', - 'location' => 'xml' - ], - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-request-id' - ], - 'SseKms' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption' - ], - 'SseKmsKey' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption-aws-kms-key-id' - ], - 'SseC' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption-customer-algorithm' - ], - 'SseCKeyMd5' => [ - 'location' => 'header', - 'sentAs' => 'x-amz-server-side-encryption-customer-key-MD5' - ] - ] - ] - ], - - 'setBucketCustomDomain' => [ - 'httpMethod' => 'PUT', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' + ], + 'Initiator' => [ + 'type' => 'object', + 'location' => 'xml', + 'properties' => [ + 'ID' => [ + 'type' => 'string', ], - 'DomainName' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'customdomain' - ] - - ], - 'responseParameters' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ] - ] + 'DisplayName' => [ + 'type' => 'string', + ], + ], + ], + 'Owner' => [ + 'type' => 'object', + 'location' => 'xml', + 'properties' => [ + 'DisplayName' => [ + 'type' => 'string', + ], + 'ID' => [ + 'type' => 'string', + ], + ], + ], + 'StorageClass' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], ], + ], + ], - 'getBucketCustomDomain' => [ - 'httpMethod' => 'GET', - 'specialParam' => 'customdomain', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'dns' - ] + 'copyPart' => [ + 'httpMethod' => 'PUT', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'CopySource' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-amz-copy-source', + ], + 'CopySourceRange' => [ + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-amz-copy-source-range', + ], + 'Key' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ], + 'PartNumber' => [ + 'required' => true, + 'type' => 'numeric', + 'location' => 'query', + 'sentAs' => 'partNumber', + ], + 'UploadId' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'uploadId', + ], + 'SseC' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption-customer-algorithm', + ], + 'SseCKey' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption-customer-key', + 'type' => 'password', + ], + 'CopySourceSseC' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-copy-source-server-side-encryption-customer-algorithm', + ], + 'CopySourceSseCKey' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-copy-source-server-side-encryption-customer-key', + 'type' => 'password', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'ETag' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'LastModified' => [ + 'type' => 'string', + 'location' => 'xml', + ], + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], + 'SseKms' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption', + ], + 'SseKmsKey' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption-aws-kms-key-id', + ], + 'SseC' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption-customer-algorithm', + ], + 'SseCKeyMd5' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-server-side-encryption-customer-key-MD5', ], - 'responseParameters' => [ - 'type' => 'object', - 'properties' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ], - 'Domains' => [ - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'Domains', - 'data' => [ - 'xmlFlattened' => true - ], - 'items' => [ - 'type' => 'object', - 'properties' => [ - 'DomainName' => [ - 'type' => 'string', - 'location' => 'xml', - 'sentAs' => 'DomainName' - ], - 'CreateTime' => [ - 'type' => 'string', - 'location' => 'xml', - 'sentAs' => 'CreateTime' - ], - ] - ] - ] - ] - ] ], + ], + ], - 'deleteBucketCustomDomain' => [ - 'httpMethod' => 'DELETE', - 'requestParameters' => [ - 'Bucket' => [ - 'required' => true, + 'setBucketCustomDomain' => [ + 'httpMethod' => 'PUT', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'DomainName' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'customdomain', + ], + + ], + 'responseParameters' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], + ], + ], + + 'getBucketCustomDomain' => [ + 'httpMethod' => 'GET', + 'specialParam' => 'customdomain', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], + 'Domains' => [ + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'Domains', + 'data' => [ + 'xmlFlattened' => true, + ], + 'items' => [ + 'type' => 'object', + 'properties' => [ + 'DomainName' => [ 'type' => 'string', - 'location' => 'dns' - ], - 'DomainName' => [ - 'required' => true, + 'location' => 'xml', + 'sentAs' => 'DomainName', + ], + 'CreateTime' => [ 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'customdomain' - ] + 'location' => 'xml', + 'sentAs' => 'CreateTime', + ], + ], + ], ], - 'responseParameters' => [ - 'RequestId' => [ - 'location' => 'header', - 'sentAs' => 'x-obs-request-id' - ] - ] ], + ], + ], + + 'deleteBucketCustomDomain' => [ + 'httpMethod' => 'DELETE', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns', + ], + 'DomainName' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'customdomain', + ], + ], + 'responseParameters' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-request-id', + ], + ], ], + ], - 'aliases' => [ - 'headBucket' => 'getBucketMetadata', + 'aliases' => [ + 'headBucket' => 'getBucketMetadata', - 'getBucketLogging' => 'getBucketLoggingConfiguration', - 'setBucketLogging' => 'setBucketLoggingConfiguration', - 'getBucketVersioning' => 'getBucketVersioningConfiguration', - 'setBucketVersioning' => 'setBucketVersioningConfiguration', - 'setBucketWebsite' => 'setBucketWebsiteConfiguration', - 'getBucketWebsite' => 'getBucketWebsiteConfiguration', - 'deleteBucketWebsite' => 'deleteBucketWebsiteConfiguration', - 'setBucketLifecycle' => 'setBucketLifecycleConfiguration', - 'getBucketLifecycle' => 'getBucketLifecycleConfiguration', - 'deleteBucketLifecycle' => 'deleteBucketLifecycleConfiguration' - ] + 'getBucketLogging' => 'getBucketLoggingConfiguration', + 'setBucketLogging' => 'setBucketLoggingConfiguration', + 'getBucketVersioning' => 'getBucketVersioningConfiguration', + 'setBucketVersioning' => 'setBucketVersioningConfiguration', + 'setBucketWebsite' => 'setBucketWebsiteConfiguration', + 'getBucketWebsite' => 'getBucketWebsiteConfiguration', + 'deleteBucketWebsite' => 'deleteBucketWebsiteConfiguration', + 'setBucketLifecycle' => 'setBucketLifecycleConfiguration', + 'getBucketLifecycle' => 'getBucketLifecycleConfiguration', + 'deleteBucketLifecycle' => 'deleteBucketLifecycleConfiguration', + ], ]; -} \ No newline at end of file +} diff --git a/Obs/Internal/SendRequestTrait.php b/Obs/Internal/SendRequestTrait.php index 6bfe583..af936d3 100644 --- a/Obs/Internal/SendRequestTrait.php +++ b/Obs/Internal/SendRequestTrait.php @@ -18,709 +18,798 @@ namespace Obs\Internal; use GuzzleHttp\Psr7; -use Obs\Log\ObsLog; +use GuzzleHttp\Client; +use GuzzleHttp\Exception\ConnectException; +use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\Request; use GuzzleHttp\Psr7\Response; -use GuzzleHttp\Exception\RequestException; -use GuzzleHttp\Exception\ConnectException; use Obs\Internal\Common\Model; +use Obs\Internal\Resource\Constants; use Obs\Internal\Resource\V2Constants; -use Obs\ObsException; -use Obs\Internal\Signature\V4Signature; use Obs\Internal\Signature\DefaultSignature; -use GuzzleHttp\Client; -use Obs\Internal\Resource\Constants; +use Obs\Internal\Signature\V4Signature; +use Obs\Log\ObsLog; +use Obs\ObsException; +use Obs\ObsClient; use Psr\Http\Message\StreamInterface; -use Obs\Internal\Resource\V2RequestResource; + +const INVALID_HTTP_METHOD_MSG = + "Method param must be specified, allowed values: GET | PUT | HEAD | POST | DELETE | OPTIONS"; trait SendRequestTrait { - protected $ak; - - protected $sk; - - protected $securityToken = false; - - protected $endpoint = ''; - - protected $pathStyle = false; - - protected $region = 'region'; - - protected $signature = 'obs'; - - protected $sslVerify = false; - - protected $maxRetryCount = 3; - - protected $timeout = 0; - - protected $socketTimeout = 60; - - protected $connectTimeout = 60; - - protected $isCname = false; - - /** @var Client */ - protected $httpClient; - - public function createSignedUrl(array $args=[]){ - if (strcasecmp($this -> signature, 'v4') === 0) { - return $this -> createV4SignedUrl($args); - } - return $this->createCommonSignedUrl($this->signature,$args); - } - - public function createV2SignedUrl(array $args=[]) { - return $this->createCommonSignedUrl( 'v2',$args); - } - - private function createCommonSignedUrl(string $signature,array $args=[]) { - if(!isset($args['Method'])){ - $obsException = new ObsException('Method param must be specified, allowed values: GET | PUT | HEAD | POST | DELETE | OPTIONS'); - $obsException-> setExceptionType('client'); - throw $obsException; - } - $method = strval($args['Method']); - $bucketName = isset($args['Bucket'])? strval($args['Bucket']): null; - $objectKey = isset($args['Key'])? strval($args['Key']): null; - $specialParam = isset($args['SpecialParam'])? strval($args['SpecialParam']): null; - $expires = isset($args['Expires']) && is_numeric($args['Expires']) ? intval($args['Expires']): 300; - - $headers = []; - if(isset($args['Headers']) && is_array($args['Headers']) ){ - foreach ($args['Headers'] as $key => $val){ - if(is_string($key) && $key !== ''){ - $headers[$key] = $val; - } - } - } - - - - $queryParams = []; - if(isset($args['QueryParams']) && is_array($args['QueryParams']) ){ - foreach ($args['QueryParams'] as $key => $val){ - if(is_string($key) && $key !== ''){ - $queryParams[$key] = $val; - } - } - } - - $constants = Constants::selectConstants($signature); - if($this->securityToken && !isset($queryParams[$constants::SECURITY_TOKEN_HEAD])){ - $queryParams[$constants::SECURITY_TOKEN_HEAD] = $this->securityToken; - } - - $sign = new DefaultSignature($this->ak, $this->sk, $this->pathStyle, $this->endpoint, $method, $this->signature, $this->securityToken, $this->isCname); - - $url = parse_url($this->endpoint); - $host = $url['host']; - - $result = ''; - - if($bucketName){ - if($this-> pathStyle){ - $result = '/' . $bucketName; - }else{ - $host = $this->isCname ? $host : $bucketName . '.' . $host; - } - } - - $headers['Host'] = $host; - - if($objectKey){ - $objectKey = $sign ->urlencodeWithSafe($objectKey); - $result .= '/' . $objectKey; - } - - $result .= '?'; - - if($specialParam){ - $queryParams[$specialParam] = ''; - } - - $queryParams[$constants::TEMPURL_AK_HEAD] = $this->ak; - - - if(!is_numeric($expires) || $expires < 0){ - $expires = 300; - } - $expires = intval($expires) + intval(microtime(true)); - - $queryParams['Expires'] = strval($expires); - - $_queryParams = []; - - foreach ($queryParams as $key => $val){ - $key = $sign -> urlencodeWithSafe($key); - $val = $sign -> urlencodeWithSafe($val); - $_queryParams[$key] = $val; - $result .= $key; - if($val){ - $result .= '=' . $val; - } - $result .= '&'; - } - - $canonicalstring = $sign ->makeCanonicalstring($method, $headers, $_queryParams, $bucketName, $objectKey, $expires); - $signatureContent = base64_encode(hash_hmac('sha1', $canonicalstring, $this->sk, true)); - - $result .= 'Signature=' . $sign->urlencodeWithSafe($signatureContent); - - $model = new Model(); - $model['ActualSignedRequestHeaders'] = $headers; - $model['SignedUrl'] = $url['scheme'] . '://' . $host . ':' . (isset($url['port']) ? $url['port'] : (strtolower($url['scheme']) === 'https' ? '443' : '80')) . $result; - return $model; - } - - public function createV4SignedUrl(array $args=[]){ - if(!isset($args['Method'])){ - $obsException= new ObsException('Method param must be specified, allowed values: GET | PUT | HEAD | POST | DELETE | OPTIONS'); - $obsException-> setExceptionType('client'); - throw $obsException; - } - $method = strval($args['Method']); - $bucketName = isset($args['Bucket'])? strval($args['Bucket']): null; - $objectKey = isset($args['Key'])? strval($args['Key']): null; - $specialParam = isset($args['SpecialParam'])? strval($args['SpecialParam']): null; - $expires = isset($args['Expires']) && is_numeric($args['Expires']) ? intval($args['Expires']): 300; - $headers = []; - if(isset($args['Headers']) && is_array($args['Headers']) ){ - foreach ($args['Headers'] as $key => $val){ - if(is_string($key) && $key !== ''){ - $headers[$key] = $val; - } - } - } - - $queryParams = []; - if(isset($args['QueryParams']) && is_array($args['QueryParams']) ){ - foreach ($args['QueryParams'] as $key => $val){ - if(is_string($key) && $key !== ''){ - $queryParams[$key] = $val; - } - } - } - - if($this->securityToken && !isset($queryParams['x-amz-security-token'])){ - $queryParams['x-amz-security-token'] = $this->securityToken; - } - - $v4 = new V4Signature($this->ak, $this->sk, $this->pathStyle, $this->endpoint, $this->region, $method, $this->signature, $this->securityToken, $this->isCname); - - $url = parse_url($this->endpoint); - $host = $url['host']; - - $result = ''; - - if($bucketName){ - if($this-> pathStyle){ - $result = '/' . $bucketName; - }else{ - $host = $this->isCname ? $host : $bucketName . '.' . $host; - } - } + protected $ak; + protected $sk; + protected $securityToken = false; + protected $endpoint = ''; + protected $pathStyle = false; + protected $region = 'region'; + protected $signature = 'obs'; + protected $sslVerify = false; + protected $maxRetryCount = 3; + protected $timeout = 0; + protected $socketTimeout = 60; + + protected $connectTimeout = 60; + protected $isCname = false; + + /** @var Client */ + protected $httpClient; + + public function createSignedUrl(array $args = []) + { + if (strcasecmp($this->signature, 'v4') === 0) { + return $this->createV4SignedUrl($args); + } + return $this->createCommonSignedUrl($this->signature, $args); + } + + public function createV2SignedUrl(array $args = []) + { + return $this->createCommonSignedUrl('v2', $args); + } + + private function createCommonSignedUrl(string $signature, array $args = []) + { + if (!isset($args['Method'])) { + $obsException = new ObsException(INVALID_HTTP_METHOD_MSG); + $obsException->setExceptionType('client'); + throw $obsException; + } + $method = strval($args['Method']); + $bucketName = isset($args['Bucket']) ? strval($args['Bucket']) : null; + $objectKey = isset($args['Key']) ? strval($args['Key']) : null; + $specialParam = isset($args['SpecialParam']) ? strval($args['SpecialParam']) : null; + $expires = isset($args['Expires']) && is_numeric($args['Expires']) ? intval($args['Expires']) : 300; + + $headers = []; + if (isset($args['Headers']) && is_array($args['Headers'])) { + foreach ($args['Headers'] as $key => $val) { + if (is_string($key) && $key !== '') { + $headers[$key] = $val; + } + } + } + + $queryParams = []; + if (isset($args['QueryParams']) && is_array($args['QueryParams'])) { + foreach ($args['QueryParams'] as $key => $val) { + if (is_string($key) && $key !== '') { + $queryParams[$key] = $val; + } + } + } + + $constants = Constants::selectConstants($signature); + if ($this->securityToken && !isset($queryParams[$constants::SECURITY_TOKEN_HEAD])) { + $queryParams[$constants::SECURITY_TOKEN_HEAD] = $this->securityToken; + } + + $sign = new DefaultSignature( + $this->ak, + $this->sk, + $this->pathStyle, + $this->endpoint, + $method, + $this->signature, + $this->securityToken, + $this->isCname + ); + + $url = parse_url($this->endpoint); + $host = $url['host']; + + $result = ''; + + if ($bucketName) { + if ($this->pathStyle) { + $result = '/' . $bucketName; + } else { + $host = $this->isCname ? $host : $bucketName . '.' . $host; + } + } + + $headers['Host'] = $host; + + if ($objectKey) { + $objectKey = $sign->urlencodeWithSafe($objectKey); + $result .= '/' . $objectKey; + } + + $result .= '?'; + + if ($specialParam) { + $queryParams[$specialParam] = ''; + } + + $queryParams[$constants::TEMPURL_AK_HEAD] = $this->ak; + + if (!is_numeric($expires) || $expires < 0) { + $expires = 300; + } + $expires = intval($expires) + intval(microtime(true)); + + $queryParams['Expires'] = strval($expires); + + $queryParamsResult = []; + + foreach ($queryParams as $key => $val) { + $key = $sign->urlencodeWithSafe($key); + $val = $sign->urlencodeWithSafe($val); + $queryParamsResult[$key] = $val; + $result .= $key; + if ($val) { + $result .= '=' . $val; + } + $result .= '&'; + } + + $canonicalstring = $sign->makeCanonicalstring( + $method, + $headers, + $queryParamsResult, + $bucketName, + $objectKey, + $expires + ); + $signatureContent = base64_encode(hash_hmac('sha1', $canonicalstring, $this->sk, true)); + + $result .= 'Signature=' . $sign->urlencodeWithSafe($signatureContent); + + $model = new Model(); + $model['ActualSignedRequestHeaders'] = $headers; + $defaultPort = strtolower($url['scheme']) === 'https' ? '443' : '80'; + $port = isset($url['port']) ? $url['port'] : $defaultPort; + $model['SignedUrl'] = $url['scheme'] . '://' . $host . ':' . $port . $result; + return $model; + } + + public function createV4SignedUrl(array $args = []) + { + if (!isset($args['Method'])) { + $obsException = new ObsException(INVALID_HTTP_METHOD_MSG); + $obsException->setExceptionType('client'); + throw $obsException; + } + $method = strval($args['Method']); + $bucketName = isset($args['Bucket']) ? strval($args['Bucket']) : null; + $objectKey = isset($args['Key']) ? strval($args['Key']) : null; + $specialParam = isset($args['SpecialParam']) ? strval($args['SpecialParam']) : null; + $expires = isset($args['Expires']) && is_numeric($args['Expires']) ? intval($args['Expires']) : 300; + $headers = []; + if (isset($args['Headers']) && is_array($args['Headers'])) { + foreach ($args['Headers'] as $key => $val) { + if (is_string($key) && $key !== '') { + $headers[$key] = $val; + } + } + } + + $queryParams = []; + if (isset($args['QueryParams']) && is_array($args['QueryParams'])) { + foreach ($args['QueryParams'] as $key => $val) { + if (is_string($key) && $key !== '') { + $queryParams[$key] = $val; + } + } + } + + if ($this->securityToken && !isset($queryParams['x-amz-security-token'])) { + $queryParams['x-amz-security-token'] = $this->securityToken; + } + $utcTimeZone = new \DateTimeZone('UTC'); + + $v4 = new V4Signature( + $this->ak, + $this->sk, + $this->pathStyle, + $this->endpoint, + $this->region, + $method, + $utcTimeZone, + $this->signature, + $this->securityToken, + $this->isCname + ); + + $url = parse_url($this->endpoint); + $host = $url['host']; + + $result = ''; + + if ($bucketName) { + if ($this->pathStyle) { + $result = '/' . $bucketName; + } else { + $host = $this->isCname ? $host : $bucketName . '.' . $host; + } + } $headers['Host'] = $host; - - if($objectKey){ - $objectKey = $v4 -> urlencodeWithSafe($objectKey); - $result .= '/' . $objectKey; - } - - $result .= '?'; - - if($specialParam){ - $queryParams[$specialParam] = ''; - } - - if(!is_numeric($expires) || $expires < 0){ - $expires = 300; - } - - $expires = strval($expires); - - $date = isset($headers['date']) ? $headers['date'] : (isset($headers['Date']) ? $headers['Date'] : null); - - $timestamp = $date ? date_create_from_format('D, d M Y H:i:s \G\M\T', $date, new \DateTimeZone ('UTC')) -> getTimestamp() - :time(); - - $longDate = gmdate('Ymd\THis\Z', $timestamp); - $shortDate = substr($longDate, 0, 8); - - $headers['host'] = $host; - if(isset($url['port'])){ - $port = $url['port']; - if($port !== 443 && $port !== 80){ - $headers['host'] = $headers['host'] . ':' . $port; - } - } - - $signedHeaders = $v4 -> getSignedHeaders($headers); - - $queryParams['X-Amz-Algorithm'] = 'AWS4-HMAC-SHA256'; - $queryParams['X-Amz-Credential'] = $v4 -> getCredential($shortDate); - $queryParams['X-Amz-Date'] = $longDate; - $queryParams['X-Amz-Expires'] = $expires; - $queryParams['X-Amz-SignedHeaders'] = $signedHeaders; - - $_queryParams = []; - - foreach ($queryParams as $key => $val){ - $key = rawurlencode($key); - $val = rawurlencode($val); - $_queryParams[$key] = $val; - $result .= $key; - if($val){ - $result .= '=' . $val; - } - $result .= '&'; - } - - $canonicalstring = $v4 -> makeCanonicalstring($method, $headers, $_queryParams, $bucketName, $objectKey, $signedHeaders, 'UNSIGNED-PAYLOAD'); - - $signatureContent = $v4 -> getSignature($canonicalstring, $longDate, $shortDate); - - $result .= 'X-Amz-Signature=' . $v4 -> urlencodeWithSafe($signatureContent); - - $model = new Model(); - $model['ActualSignedRequestHeaders'] = $headers; - $model['SignedUrl'] = $url['scheme'] . '://' . $host . ':' . (isset($url['port']) ? $url['port'] : (strtolower($url['scheme']) === 'https' ? '443' : '80')) . $result; - return $model; - } - - public function createPostSignature(array $args=[]) { - if (strcasecmp($this -> signature, 'v4') === 0) { - return $this -> createV4PostSignature($args); - } - - $bucketName = isset($args['Bucket'])? strval($args['Bucket']): null; - $objectKey = isset($args['Key'])? strval($args['Key']): null; - $expires = isset($args['Expires']) && is_numeric($args['Expires']) ? intval($args['Expires']): 300; - - $formParams = []; - - if(isset($args['FormParams']) && is_array($args['FormParams'])){ - foreach ($args['FormParams'] as $key => $val){ - $formParams[$key] = $val; - } - } - - $constants = Constants::selectConstants($this -> signature); - if($this->securityToken && !isset($formParams[$constants::SECURITY_TOKEN_HEAD])){ - $formParams[$constants::SECURITY_TOKEN_HEAD] = $this->securityToken; - } - - $timestamp = time(); - $expires = gmdate('Y-m-d\TH:i:s\Z', $timestamp + $expires); - - if($bucketName){ - $formParams['bucket'] = $bucketName; - } - - if($objectKey){ - $formParams['key'] = $objectKey; - } - - $policy = []; - - $policy[] = '{"expiration":"'; - $policy[] = $expires; - $policy[] = '", "conditions":['; - - $matchAnyBucket = true; - $matchAnyKey = true; - - $conditionAllowKeys = ['acl', 'bucket', 'key', 'success_action_redirect', 'redirect', 'success_action_status']; - - foreach($formParams as $key => $val){ - if($key){ - $key = strtolower(strval($key)); - - if($key === 'bucket'){ - $matchAnyBucket = false; - }else if($key === 'key'){ - $matchAnyKey = false; - } - - if(!in_array($key, Constants::ALLOWED_REQUEST_HTTP_HEADER_METADATA_NAMES) && strpos($key, $constants::HEADER_PREFIX) !== 0 && !in_array($key, $conditionAllowKeys)){ - $key = $constants::METADATA_PREFIX . $key; - } - - $policy[] = '{"'; - $policy[] = $key; - $policy[] = '":"'; - $policy[] = $val !== null ? strval($val) : ''; - $policy[] = '"},'; - } - } - - if($matchAnyBucket){ - $policy[] = '["starts-with", "$bucket", ""],'; - } - - if($matchAnyKey){ - $policy[] = '["starts-with", "$key", ""],'; - } - - $policy[] = ']}'; - - $originPolicy = implode('', $policy); - - $policy = base64_encode($originPolicy); - - $signatureContent = base64_encode(hash_hmac('sha1', $policy, $this->sk, true)); - - $model = new Model(); - $model['OriginPolicy'] = $originPolicy; - $model['Policy'] = $policy; - $model['Signature'] = $signatureContent; - return $model; - } - - public function createV4PostSignature(array $args=[]){ - $bucketName = isset($args['Bucket'])? strval($args['Bucket']): null; - $objectKey = isset($args['Key'])? strval($args['Key']): null; - $expires = isset($args['Expires']) && is_numeric($args['Expires']) ? intval($args['Expires']): 300; - - $formParams = []; - - if(isset($args['FormParams']) && is_array($args['FormParams'])){ - foreach ($args['FormParams'] as $key => $val){ - $formParams[$key] = $val; - } - } - - if($this->securityToken && !isset($formParams['x-amz-security-token'])){ - $formParams['x-amz-security-token'] = $this->securityToken; - } - - $timestamp = time(); - $longDate = gmdate('Ymd\THis\Z', $timestamp); - $shortDate = substr($longDate, 0, 8); - - $credential = sprintf('%s/%s/%s/s3/aws4_request', $this->ak, $shortDate, $this->region); - - $expires = gmdate('Y-m-d\TH:i:s\Z', $timestamp + $expires); - - $formParams['X-Amz-Algorithm'] = 'AWS4-HMAC-SHA256'; - $formParams['X-Amz-Date'] = $longDate; - $formParams['X-Amz-Credential'] = $credential; - - if($bucketName){ - $formParams['bucket'] = $bucketName; - } - - if($objectKey){ - $formParams['key'] = $objectKey; - } - - $policy = []; - - $policy[] = '{"expiration":"'; - $policy[] = $expires; - $policy[] = '", "conditions":['; - - $matchAnyBucket = true; - $matchAnyKey = true; - - $conditionAllowKeys = ['acl', 'bucket', 'key', 'success_action_redirect', 'redirect', 'success_action_status']; - - foreach($formParams as $key => $val){ - if($key){ - $key = strtolower(strval($key)); - - if($key === 'bucket'){ - $matchAnyBucket = false; - }else if($key === 'key'){ - $matchAnyKey = false; - } - - if(!in_array($key, Constants::ALLOWED_REQUEST_HTTP_HEADER_METADATA_NAMES) && strpos($key, V2Constants::HEADER_PREFIX) !== 0 && !in_array($key, $conditionAllowKeys)){ - $key = V2Constants::METADATA_PREFIX . $key; - } - - $policy[] = '{"'; - $policy[] = $key; - $policy[] = '":"'; - $policy[] = $val !== null ? strval($val) : ''; - $policy[] = '"},'; - } - } - - if($matchAnyBucket){ - $policy[] = '["starts-with", "$bucket", ""],'; - } - - if($matchAnyKey){ - $policy[] = '["starts-with", "$key", ""],'; - } - - $policy[] = ']}'; - - $originPolicy = implode('', $policy); - - $policy = base64_encode($originPolicy); - - $dateKey = hash_hmac('sha256', $shortDate, 'AWS4' . $this -> sk, true); - $regionKey = hash_hmac('sha256', $this->region, $dateKey, true); - $serviceKey = hash_hmac('sha256', 's3', $regionKey, true); - $signingKey = hash_hmac('sha256', 'aws4_request', $serviceKey, true); - $signatureContent = hash_hmac('sha256', $policy, $signingKey); - - $model = new Model(); - $model['OriginPolicy'] = $originPolicy; - $model['Policy'] = $policy; - $model['Algorithm'] = $formParams['X-Amz-Algorithm']; - $model['Credential'] = $formParams['X-Amz-Credential']; - $model['Date'] = $formParams['X-Amz-Date']; - $model['Signature'] = $signatureContent; - return $model; - } - - public function __call($originMethod, $args) - { - $method = $originMethod; - - $contents = Constants::selectRequestResource($this->signature); - $resource = &$contents::$RESOURCE_ARRAY; - $async = false; - if(strpos($method, 'Async') === (strlen($method) - 5)){ - $method = substr($method, 0, strlen($method) - 5); - $async = true; - } - - if(isset($resource['aliases'][$method])){ - $method = $resource['aliases'][$method]; - } - - $method = lcfirst($method); - - - $operation = isset($resource['operations'][$method]) ? - $resource['operations'][$method] : null; - - if(!$operation){ - ObsLog::commonLog(WARNING, 'unknow method ' . $originMethod); - $obsException= new ObsException('unknow method '. $originMethod); - $obsException-> setExceptionType('client'); - throw $obsException; - } - - $start = microtime(true); - if(!$async){ - ObsLog::commonLog(INFO, 'enter method '. $originMethod. '...'); - $model = new Model(); - $model['method'] = $method; - $params = empty($args) ? [] : $args[0]; - $this->checkMimeType($method, $params); - $this->doRequest($model, $operation, $params); - ObsLog::commonLog(INFO, 'obsclient cost ' . round(microtime(true) - $start, 3) * 1000 . ' ms to execute '. $originMethod); - unset($model['method']); - return $model; - }else{ - if(empty($args) || !(is_callable($callback = $args[count($args) -1]))){ - ObsLog::commonLog(WARNING, 'async method ' . $originMethod . ' must pass a CallbackInterface as param'); - $obsException= new ObsException('async method ' . $originMethod . ' must pass a CallbackInterface as param'); - $obsException-> setExceptionType('client'); - throw $obsException; - } - ObsLog::commonLog(INFO, 'enter method '. $originMethod. '...'); - $params = count($args) === 1 ? [] : $args[0]; - $this->checkMimeType($method, $params); - $model = new Model(); - $model['method'] = $method; - return $this->doRequestAsync($model, $operation, $params, $callback, $start, $originMethod); - } - } - - private function checkMimeType($method, &$params){ - // fix bug that guzzlehttp lib will add the content-type if not set - if(($method === 'putObject' || $method === 'initiateMultipartUpload' || $method === 'uploadPart') && (!isset($params['ContentType']) || $params['ContentType'] === null)){ - if(isset($params['Key'])){ - try { - $params['ContentType'] = Psr7\mimetype_from_filename($params['Key']); - } catch (\Throwable $e) { - $params['ContentType'] = Psr7\MimeType::fromFilename($params['Key']); - } - } - - if((!isset($params['ContentType']) || $params['ContentType'] === null) && isset($params['SourceFile'])){ - try { - $params['ContentType'] = Psr7\mimetype_from_filename($params['SourceFile']); - } catch (\Throwable $e) { - $params['ContentType'] = Psr7\MimeType::fromFilename($params['SourceFile']); - } - } - - if(!isset($params['ContentType']) || $params['ContentType'] === null){ - $params['ContentType'] = 'binary/octet-stream'; - } - } - } - - protected function makeRequest($model, &$operation, $params, $endpoint = null) - { - if($endpoint === null){ - $endpoint = $this->endpoint; - } - $signatureInterface = strcasecmp($this-> signature, 'v4') === 0 ? - new V4Signature($this->ak, $this->sk, $this->pathStyle, $endpoint, $this->region, $model['method'], $this->signature, $this->securityToken, $this->isCname) : - new DefaultSignature($this->ak, $this->sk, $this->pathStyle, $endpoint, $model['method'], $this->signature, $this->securityToken, $this->isCname); - $authResult = $signatureInterface -> doAuth($operation, $params, $model); - $httpMethod = $authResult['method']; - ObsLog::commonLog(DEBUG, 'perform '. strtolower($httpMethod) . ' request with url ' . $authResult['requestUrl']); - ObsLog::commonLog(DEBUG, 'cannonicalRequest:' . $authResult['cannonicalRequest']); - ObsLog::commonLog(DEBUG, 'request headers ' . var_export($authResult['headers'],true)); - $authResult['headers']['User-Agent'] = self::default_user_agent(); - if($model['method'] === 'putObject'){ - $model['ObjectURL'] = ['value' => $authResult['requestUrl']]; - } - return new Request($httpMethod, $authResult['requestUrl'], $authResult['headers'], $authResult['body']); - } - - - protected function doRequest($model, &$operation, $params, $endpoint = null) - { - $request = $this -> makeRequest($model, $operation, $params, $endpoint); - $this->sendRequest($model, $operation, $params, $request); - } - - protected function sendRequest($model, &$operation, $params, $request, $requestCount = 1) - { - $start = microtime(true); - $saveAsStream = false; - if(isset($operation['stream']) && $operation['stream']){ - $saveAsStream = isset($params['SaveAsStream']) ? $params['SaveAsStream'] : false; - - if(isset($params['SaveAsFile'])){ - if($saveAsStream){ - $obsException = new ObsException('SaveAsStream cannot be used with SaveAsFile together'); - $obsException-> setExceptionType('client'); - throw $obsException; - } - $saveAsStream = true; - } - if(isset($params['FilePath'])){ - if($saveAsStream){ - $obsException = new ObsException('SaveAsStream cannot be used with FilePath together'); - $obsException-> setExceptionType('client'); - throw $obsException; - } - $saveAsStream = true; - } - - if(isset($params['SaveAsFile']) && isset($params['FilePath'])){ - $obsException = new ObsException('SaveAsFile cannot be used with FilePath together'); - $obsException-> setExceptionType('client'); - throw $obsException; - } - } - - $promise = $this->httpClient->sendAsync($request, ['stream' => $saveAsStream])->then( - function(Response $response) use ($model, $operation, $params, $request, $requestCount, $start){ - - ObsLog::commonLog(INFO, 'http request cost ' . round(microtime(true) - $start, 3) * 1000 . ' ms'); - $statusCode = $response -> getStatusCode(); - $readable = isset($params['Body']) && ($params['Body'] instanceof StreamInterface || is_resource($params['Body'])); - if($statusCode >= 300 && $statusCode <400 && $statusCode !== 304 && !$readable && $requestCount <= $this->maxRetryCount){ - if($location = $response -> getHeaderLine('location')){ - $url = parse_url($this->endpoint); - $newUrl = parse_url($location); - $scheme = (isset($newUrl['scheme']) ? $newUrl['scheme'] : $url['scheme']); - $defaultPort = strtolower($scheme) === 'https' ? '443' : '80'; - $this->doRequest($model, $operation, $params, $scheme. '://' . $newUrl['host'] . - ':' . (isset($newUrl['port']) ? $newUrl['port'] : $defaultPort)); - return; - } - } - $this -> parseResponse($model, $request, $response, $operation); - }, - function (RequestException $exception) use ($model, $operation, $params, $request, $requestCount, $start) { - - ObsLog::commonLog(INFO, 'http request cost ' . round(microtime(true) - $start, 3) * 1000 . ' ms'); - $message = null; - if($exception instanceof ConnectException){ - if($requestCount <= $this->maxRetryCount){ - $this -> sendRequest($model, $operation, $params, $request, $requestCount + 1); - return; - }else{ - $message = 'Exceeded retry limitation, max retry count:'. $this->maxRetryCount . ', error message:' . $exception -> getMessage(); - } - } - $this -> parseException($model, $request, $exception, $message); - }); - $promise -> wait(); - } - - - protected function doRequestAsync($model, &$operation, $params, $callback, $startAsync, $originMethod, $endpoint = null){ - $request = $this -> makeRequest($model, $operation, $params, $endpoint); - return $this->sendRequestAsync($model, $operation, $params, $callback, $startAsync, $originMethod, $request); - } - - protected function sendRequestAsync($model, &$operation, $params, $callback, $startAsync, $originMethod, $request, $requestCount = 1) - { - $start = microtime(true); - - $saveAsStream = false; - if(isset($operation['stream']) && $operation['stream']){ - $saveAsStream = isset($params['SaveAsStream']) ? $params['SaveAsStream'] : false; - - if($saveAsStream){ - if(isset($params['SaveAsFile'])){ - $obsException = new ObsException('SaveAsStream cannot be used with SaveAsFile together'); - $obsException-> setExceptionType('client'); - throw $obsException; - } - if(isset($params['FilePath'])){ - $obsException = new ObsException('SaveAsStream cannot be used with FilePath together'); - $obsException-> setExceptionType('client'); - throw $obsException; - } - } - - if(isset($params['SaveAsFile']) && isset($params['FilePath'])){ - $obsException = new ObsException('SaveAsFile cannot be used with FilePath together'); - $obsException-> setExceptionType('client'); - throw $obsException; - } - } - return $this->httpClient->sendAsync($request, ['stream' => $saveAsStream])->then( - function(Response $response) use ($model, $operation, $params, $callback, $startAsync, $originMethod, $request, $start){ - ObsLog::commonLog(INFO, 'http request cost ' . round(microtime(true) - $start, 3) * 1000 . ' ms'); - $statusCode = $response -> getStatusCode(); - $readable = isset($params['Body']) && ($params['Body'] instanceof StreamInterface || is_resource($params['Body'])); - if($statusCode === 307 && !$readable){ - if($location = $response -> getHeaderLine('location')){ - $url = parse_url($this->endpoint); - $newUrl = parse_url($location); - $scheme = (isset($newUrl['scheme']) ? $newUrl['scheme'] : $url['scheme']); - $defaultPort = strtolower($scheme) === 'https' ? '443' : '80'; - return $this->doRequestAsync($model, $operation, $params, $callback, $startAsync, $originMethod, $scheme. '://' . $newUrl['host'] . - ':' . (isset($newUrl['port']) ? $newUrl['port'] : $defaultPort)); - } - } - $this -> parseResponse($model, $request, $response, $operation); - ObsLog::commonLog(INFO, 'obsclient cost ' . round(microtime(true) - $startAsync, 3) * 1000 . ' ms to execute '. $originMethod); - unset($model['method']); - $callback(null, $model); - }, - function (RequestException $exception) use ($model, $operation, $params, $callback, $startAsync, $originMethod, $request, $start, $requestCount){ - ObsLog::commonLog(INFO, 'http request cost ' . round(microtime(true) - $start, 3) * 1000 . ' ms'); - $message = null; - if($exception instanceof ConnectException){ - if($requestCount <= $this->maxRetryCount){ - return $this -> sendRequestAsync($model, $operation, $params, $callback, $startAsync, $originMethod, $request, $requestCount + 1); - }else{ - $message = 'Exceeded retry limitation, max retry count:'. $this->maxRetryCount . ', error message:' . $exception -> getMessage(); - } - } - $obsException = $this -> parseExceptionAsync($request, $exception, $message); - ObsLog::commonLog(INFO, 'obsclient cost ' . round(microtime(true) - $startAsync, 3) * 1000 . ' ms to execute '. $originMethod); - $callback($obsException, null); - } - ); - } + + if ($objectKey) { + $objectKey = $v4->urlencodeWithSafe($objectKey); + $result .= '/' . $objectKey; + } + + $result .= '?'; + + if ($specialParam) { + $queryParams[$specialParam] = ''; + } + + if (!is_numeric($expires) || $expires < 0) { + $expires = 300; + } + + $expires = strval($expires); + + $date = $headers['date']; + + if (!isset($date)) { + $date = $headers['Date']; + } + + if (!isset($date)) { + $date = null; + } + + $timestamp = time(); + + if (isset($date)) { + $timestamp = date_create_from_format('D, d M Y H:i:s \G\M\T', $date, new \DateTimeZone('UTC'))->getTimestamp(); + } + + $longDate = gmdate('Ymd\THis\Z', $timestamp); + $shortDate = substr($longDate, 0, 8); + + $headers['host'] = $host; + if (isset($url['port'])) { + $port = $url['port']; + if ($port !== 443 && $port !== 80) { + $headers['host'] = $headers['host'] . ':' . $port; + } + } + + $signedHeaders = $v4->getSignedHeaders($headers); + + $queryParams['X-Amz-Algorithm'] = 'AWS4-HMAC-SHA256'; + $queryParams['X-Amz-Credential'] = $v4->getCredential($shortDate); + $queryParams['X-Amz-Date'] = $longDate; + $queryParams['X-Amz-Expires'] = $expires; + $queryParams['X-Amz-SignedHeaders'] = $signedHeaders; + + $queryParamsResult = []; + + foreach ($queryParams as $key => $val) { + $key = rawurlencode($key); + $val = rawurlencode($val); + $queryParamsResult[$key] = $val; + $result .= $key; + if ($val) { + $result .= '=' . $val; + } + $result .= '&'; + } + + $canonicalstring = $v4->makeCanonicalstring( + $method, + $headers, + $queryParamsResult, + $bucketName, + $objectKey, + $signedHeaders, + 'UNSIGNED-PAYLOAD' + ); + + $signatureContent = $v4->getSignature($canonicalstring, $longDate, $shortDate); + + $result .= 'X-Amz-Signature=' . $v4->urlencodeWithSafe($signatureContent); + + $model = new Model(); + $model['ActualSignedRequestHeaders'] = $headers; + $defaultPort = strtolower($url['scheme']) === 'https' ? '443' : '80'; + $port = isset($url['port']) ? $url['port'] : $defaultPort; + $model['SignedUrl'] = $url['scheme'] . '://' . $host . ':' . $port . $result; + return $model; + } + + public function createPostSignature(array $args = []) + { + if (strcasecmp($this->signature, 'v4') === 0) { + return $this->createV4PostSignature($args); + } + + $bucketName = isset($args['Bucket']) ? strval($args['Bucket']) : null; + $objectKey = isset($args['Key']) ? strval($args['Key']) : null; + $expires = isset($args['Expires']) && is_numeric($args['Expires']) ? intval($args['Expires']) : 300; + + $formParams = []; + + if (isset($args['FormParams']) && is_array($args['FormParams'])) { + foreach ($args['FormParams'] as $key => $val) { + $formParams[$key] = $val; + } + } + + $constants = Constants::selectConstants($this->signature); + if ($this->securityToken && !isset($formParams[$constants::SECURITY_TOKEN_HEAD])) { + $formParams[$constants::SECURITY_TOKEN_HEAD] = $this->securityToken; + } + + $timestamp = time(); + $expires = gmdate('Y-m-d\TH:i:s\Z', $timestamp + $expires); + + if ($bucketName) { + $formParams['bucket'] = $bucketName; + } + + if ($objectKey) { + $formParams['key'] = $objectKey; + } + + $policy = []; + + $policy[] = '{"expiration":"'; + $policy[] = $expires; + $policy[] = '", "conditions":['; + + $matchAnyBucket = true; + $matchAnyKey = true; + + $conditionAllowKeys = ['acl', 'bucket', 'key', 'success_action_redirect', 'redirect', 'success_action_status']; + + foreach ($formParams as $key => $val) { + if ($key) { + $key = strtolower(strval($key)); + + if ($key === 'bucket') { + $matchAnyBucket = false; + } elseif ($key === 'key') { + $matchAnyKey = false; + } else { + // nothing handle + } + + if (!in_array($key, Constants::ALLOWED_REQUEST_HTTP_HEADER_METADATA_NAMES) + && strpos($key, $constants::HEADER_PREFIX) !== 0 + && !in_array($key, $conditionAllowKeys) + ) { + $key = $constants::METADATA_PREFIX . $key; + } + + $policy[] = '{"'; + $policy[] = $key; + $policy[] = '":"'; + $policy[] = $val !== null ? strval($val) : ''; + $policy[] = '"},'; + } + } + + if ($matchAnyBucket) { + $policy[] = '["starts-with", "$bucket", ""],'; + } + + if ($matchAnyKey) { + $policy[] = '["starts-with", "$key", ""],'; + } + + $policy[] = ']}'; + + $originPolicy = implode('', $policy); + + $policy = base64_encode($originPolicy); + + $signatureContent = base64_encode(hash_hmac('sha1', $policy, $this->sk, true)); + + $model = new Model(); + $model['OriginPolicy'] = $originPolicy; + $model['Policy'] = $policy; + $model['Signature'] = $signatureContent; + return $model; + } + + public function createV4PostSignature(array $args = []) + { + $bucketName = isset($args['Bucket']) ? strval($args['Bucket']) : null; + $objectKey = isset($args['Key']) ? strval($args['Key']) : null; + $expires = isset($args['Expires']) && is_numeric($args['Expires']) ? intval($args['Expires']) : 300; + + $formParams = []; + + if (isset($args['FormParams']) && is_array($args['FormParams'])) { + foreach ($args['FormParams'] as $key => $val) { + $formParams[$key] = $val; + } + } + + if ($this->securityToken && !isset($formParams['x-amz-security-token'])) { + $formParams['x-amz-security-token'] = $this->securityToken; + } + + $timestamp = time(); + $longDate = gmdate('Ymd\THis\Z', $timestamp); + $shortDate = substr($longDate, 0, 8); + + $credential = sprintf('%s/%s/%s/s3/aws4_request', $this->ak, $shortDate, $this->region); + + $expires = gmdate('Y-m-d\TH:i:s\Z', $timestamp + $expires); + + $formParams['X-Amz-Algorithm'] = 'AWS4-HMAC-SHA256'; + $formParams['X-Amz-Date'] = $longDate; + $formParams['X-Amz-Credential'] = $credential; + + if ($bucketName) { + $formParams['bucket'] = $bucketName; + } + + if ($objectKey) { + $formParams['key'] = $objectKey; + } + + $policy = []; + + $policy[] = '{"expiration":"'; + $policy[] = $expires; + $policy[] = '", "conditions":['; + + $matchAnyBucket = true; + $matchAnyKey = true; + + $conditionAllowKeys = ['acl', 'bucket', 'key', 'success_action_redirect', 'redirect', 'success_action_status']; + + foreach ($formParams as $key => $val) { + if ($key) { + $key = strtolower(strval($key)); + + if ($key === 'bucket') { + $matchAnyBucket = false; + } + + if ($key === 'key') { + $matchAnyKey = false; + } + + if (!in_array($key, Constants::ALLOWED_REQUEST_HTTP_HEADER_METADATA_NAMES) + && strpos($key, V2Constants::HEADER_PREFIX) !== 0 + && !in_array($key, $conditionAllowKeys) + ) { + $key = V2Constants::METADATA_PREFIX . $key; + } + + $policy[] = '{"'; + $policy[] = $key; + $policy[] = '":"'; + $policy[] = $val !== null ? strval($val) : ''; + $policy[] = '"},'; + } + } + + if ($matchAnyBucket) { + $policy[] = '["starts-with", "$bucket", ""],'; + } + + if ($matchAnyKey) { + $policy[] = '["starts-with", "$key", ""],'; + } + + $policy[] = ']}'; + + $originPolicy = implode('', $policy); + + $policy = base64_encode($originPolicy); + + $dateKey = hash_hmac('sha256', $shortDate, 'AWS4' . $this->sk, true); + $regionKey = hash_hmac('sha256', $this->region, $dateKey, true); + $serviceKey = hash_hmac('sha256', 's3', $regionKey, true); + $signingKey = hash_hmac('sha256', 'aws4_request', $serviceKey, true); + $signatureContent = hash_hmac('sha256', $policy, $signingKey); + + $model = new Model(); + $model['OriginPolicy'] = $originPolicy; + $model['Policy'] = $policy; + $model['Algorithm'] = $formParams['X-Amz-Algorithm']; + $model['Credential'] = $formParams['X-Amz-Credential']; + $model['Date'] = $formParams['X-Amz-Date']; + $model['Signature'] = $signatureContent; + return $model; + } + + public function __call($originMethod, $args) + { + $method = $originMethod; + + $contents = Constants::selectRequestResource($this->signature); + $resource = &$contents::$resourceArray; + $async = false; + if (strpos($method, 'Async') === (strlen($method) - 5)) { + $method = substr($method, 0, strlen($method) - 5); + $async = true; + } + + if (isset($resource['aliases'][$method])) { + $method = $resource['aliases'][$method]; + } + + $method = lcfirst($method); + + $operation = isset($resource['operations'][$method]) ? + $resource['operations'][$method] : null; + + if (!$operation) { + ObsLog::commonLog(WARNING, 'unknow method ' . $originMethod); + $obsException = new ObsException('unknow method ' . $originMethod); + $obsException->setExceptionType('client'); + throw $obsException; + } + + $start = microtime(true); + if (!$async) { + ObsLog::commonLog(INFO, 'enter method ' . $originMethod . '...'); + $model = new Model(); + $model['method'] = $method; + $params = empty($args) ? [] : $args[0]; + $this->checkMimeType($method, $params); + $this->doRequest($model, $operation, $params); + ObsLog::commonLog(INFO, 'obsclient cost ' . round(microtime(true) - $start, 3) * 1000 . ' ms to execute ' . $originMethod); + unset($model['method']); + return $model; + } else { + if (empty($args) || !(is_callable($callback = $args[count($args) - 1]))) { + ObsLog::commonLog(WARNING, 'async method ' . $originMethod . ' must pass a CallbackInterface as param'); + $obsException = new ObsException('async method ' . $originMethod . ' must pass a CallbackInterface as param'); + $obsException->setExceptionType('client'); + throw $obsException; + } + ObsLog::commonLog(INFO, 'enter method ' . $originMethod . '...'); + $params = count($args) === 1 ? [] : $args[0]; + $this->checkMimeType($method, $params); + $model = new Model(); + $model['method'] = $method; + return $this->doRequestAsync($model, $operation, $params, $callback, $start, $originMethod); + } + } + + private function hasContentType(&$params) + { + return isset($params['ContentType']) && $params['ContentType'] !== null; + } + + private function checkMimeType($method, &$params) + { + // fix bug that guzzlehttp lib will add the content-type if not set + $uploadMehods = array('putObject', 'initiateMultipartUpload', 'uploadPart'); + $hasContentTypeFlag = $this->hasContentType($params); + + if (in_array($method, $uploadMehods) && !$hasContentTypeFlag) { + if (isset($params['Key'])) { + try { + $params['ContentType'] = Psr7\mimetype_from_filename($params['Key']); + } catch (\Throwable $e) { + $params['ContentType'] = Psr7\MimeType::fromFilename($params['Key']); + } + } + + if (!$hasContentTypeFlag && isset($params['SourceFile'])) { + try { + $params['ContentType'] = Psr7\mimetype_from_filename($params['SourceFile']); + } catch (\Throwable $e) { + $params['ContentType'] = Psr7\MimeType::fromFilename($params['SourceFile']); + } + } + + if (!$hasContentTypeFlag) { + $params['ContentType'] = 'binary/octet-stream'; + } + } + } + + protected function makeRequest($model, &$operation, $params, $endpoint = null) + { + if ($endpoint === null) { + $endpoint = $this->endpoint; + } + $utcTimeZone = new \DateTimeZone('UTC'); + + $signatureInterface = strcasecmp($this->signature, 'v4') === 0 + ? new V4Signature( + $this->ak, + $this->sk, + $this->pathStyle, + $endpoint, + $this->region, + $model['method'], + $this->signature, + $utcTimeZone, + $this->securityToken, + $this->isCname + ) + : new DefaultSignature( + $this->ak, + $this->sk, + $this->pathStyle, + $endpoint, + $model['method'], + $this->signature, + $this->securityToken, + $this->isCname + ); + $authResult = $signatureInterface->doAuth($operation, $params, $model); + $httpMethod = $authResult['method']; + ObsLog::commonLog(DEBUG, 'perform ' . strtolower($httpMethod) . ' request with url ' . $authResult['requestUrl']); + ObsLog::commonLog(DEBUG, 'cannonicalRequest:' . $authResult['cannonicalRequest']); + ObsLog::commonLog(DEBUG, 'request headers ' . var_export($authResult['headers'], true)); + $authResult['headers']['User-Agent'] = ObsClient::getDefaultUserAgent(); + if ($model['method'] === 'putObject') { + $model['ObjectURL'] = ['value' => $authResult['requestUrl']]; + } + return new Request($httpMethod, $authResult['requestUrl'], $authResult['headers'], $authResult['body']); + } + + protected function doRequest($model, &$operation, $params, $endpoint = null) + { + $request = $this->makeRequest($model, $operation, $params, $endpoint); + $this->sendRequest($model, $operation, $params, $request); + } + + protected function sendRequest($model, &$operation, $params, $request, $requestCount = 1) + { + $start = microtime(true); + $saveAsStream = false; + if (isset($operation['stream']) && $operation['stream']) { + $saveAsStream = isset($params['SaveAsStream']) ? $params['SaveAsStream'] : false; + + if (isset($params['SaveAsFile'])) { + if ($saveAsStream) { + $obsException = new ObsException('SaveAsStream cannot be used with SaveAsFile together'); + $obsException->setExceptionType('client'); + throw $obsException; + } + $saveAsStream = true; + } + if (isset($params['FilePath'])) { + if ($saveAsStream) { + $obsException = new ObsException('SaveAsStream cannot be used with FilePath together'); + $obsException->setExceptionType('client'); + throw $obsException; + } + $saveAsStream = true; + } + + if (isset($params['SaveAsFile']) && isset($params['FilePath'])) { + $obsException = new ObsException('SaveAsFile cannot be used with FilePath together'); + $obsException->setExceptionType('client'); + throw $obsException; + } + } + + $promise = $this->httpClient->sendAsync($request, ['stream' => $saveAsStream])->then( + function (Response $response) use ($model, $operation, $params, $request, $requestCount, $start) { + + ObsLog::commonLog(INFO, 'http request cost ' . round(microtime(true) - $start, 3) * 1000 . ' ms'); + $statusCode = $response->getStatusCode(); + $readable = isset($params['Body']) && ($params['Body'] instanceof StreamInterface || is_resource($params['Body'])); + $isRetryRequest = $statusCode >= 300 && $statusCode < 400 && $statusCode !== 304 && !$readable && $requestCount <= $this->maxRetryCount; + $location = $response->getHeaderLine('location'); + if ($isRetryRequest && $location) { + $url = parse_url($this->endpoint); + $newUrl = parse_url($location); + $scheme = (isset($newUrl['scheme']) ? $newUrl['scheme'] : $url['scheme']); + $defaultPort = strtolower($scheme) === 'https' ? '443' : '80'; + $port = isset($newUrl['port']) ? $newUrl['port'] : $defaultPort; + $newEndpoint = $scheme . '://' . $newUrl['host'] . ':' . $port; + $this->doRequest($model, $operation, $params, $newEndpoint); + return; + } + $this->parseResponse($model, $request, $response, $operation); + }, + function (RequestException $exception) use ($model, $operation, $params, $request, $requestCount, $start) { + + ObsLog::commonLog(INFO, 'http request cost ' . round(microtime(true) - $start, 3) * 1000 . ' ms'); + $message = null; + if ($exception instanceof ConnectException) { + if ($requestCount <= $this->maxRetryCount) { + $this->sendRequest($model, $operation, $params, $request, $requestCount + 1); + return; + } else { + $message = 'Exceeded retry limitation, max retry count:' . $this->maxRetryCount . ', error message:' . $exception->getMessage(); + } + } + $this->parseException($model, $request, $exception, $message); + }); + $promise->wait(); + } + + protected function doRequestAsync($model, &$operation, $params, $callback, $startAsync, $originMethod, $endpoint = null) + { + $request = $this->makeRequest($model, $operation, $params, $endpoint); + return $this->sendRequestAsync($model, $operation, $params, $callback, $startAsync, $originMethod, $request); + } + + protected function sendRequestAsync($model, &$operation, $params, $callback, $startAsync, $originMethod, $request, $requestCount = 1) + { + $start = microtime(true); + + $saveAsStream = false; + if (isset($operation['stream']) && $operation['stream']) { + $saveAsStream = isset($params['SaveAsStream']) ? $params['SaveAsStream'] : false; + + if ($saveAsStream) { + if (isset($params['SaveAsFile'])) { + $obsException = new ObsException('SaveAsStream cannot be used with SaveAsFile together'); + $obsException->setExceptionType('client'); + throw $obsException; + } + if (isset($params['FilePath'])) { + $obsException = new ObsException('SaveAsStream cannot be used with FilePath together'); + $obsException->setExceptionType('client'); + throw $obsException; + } + } + + if (isset($params['SaveAsFile']) && isset($params['FilePath'])) { + $obsException = new ObsException('SaveAsFile cannot be used with FilePath together'); + $obsException->setExceptionType('client'); + throw $obsException; + } + } + return $this->httpClient->sendAsync($request, ['stream' => $saveAsStream])->then( + function (Response $response) use ($model, $operation, $params, $callback, $startAsync, $originMethod, $request, $start) { + ObsLog::commonLog(INFO, 'http request cost ' . round(microtime(true) - $start, 3) * 1000 . ' ms'); + $statusCode = $response->getStatusCode(); + + $readable = isset($params['Body']) && ($params['Body'] instanceof StreamInterface || is_resource($params['Body'])); + if ($statusCode === 307 && !$readable) { + $location = $response->getHeaderLine('location'); + if ($location) { + $url = parse_url($this->endpoint); + $newUrl = parse_url($location); + $scheme = (isset($newUrl['scheme']) ? $newUrl['scheme'] : $url['scheme']); + $defaultPort = strtolower($scheme) === 'https' ? '443' : '80'; + $port = isset($newUrl['port']) ? $newUrl['port'] : $defaultPort; + $newEndpoint = $scheme . '://' . $newUrl['host'] . ':' . $port; + return $this->doRequestAsync($model, $operation, $params, $callback, $startAsync, $originMethod, $newEndpoint); + } + } + $this->parseResponse($model, $request, $response, $operation); + ObsLog::commonLog(INFO, 'obsclient cost ' . round(microtime(true) - $startAsync, 3) * 1000 . ' ms to execute ' . $originMethod); + unset($model['method']); + $callback(null, $model); + }, + function (RequestException $exception) use ($model, $operation, $params, $callback, $startAsync, $originMethod, $request, $start, $requestCount) { + ObsLog::commonLog(INFO, 'http request cost ' . round(microtime(true) - $start, 3) * 1000 . ' ms'); + $message = null; + if ($exception instanceof ConnectException) { + if ($requestCount <= $this->maxRetryCount) { + return $this->sendRequestAsync($model, $operation, $params, $callback, $startAsync, $originMethod, $request, $requestCount + 1); + } else { + $message = 'Exceeded retry limitation, max retry count:' . $this->maxRetryCount . ', error message:' . $exception->getMessage(); + } + } + $obsException = $this->parseExceptionAsync($request, $exception, $message); + ObsLog::commonLog(INFO, 'obsclient cost ' . round(microtime(true) - $startAsync, 3) * 1000 . ' ms to execute ' . $originMethod); + $callback($obsException, null); + } + ); + } } diff --git a/Obs/Internal/Signature/AbstractSignature.php b/Obs/Internal/Signature/AbstractSignature.php index 3d36604..ebbea40 100644 --- a/Obs/Internal/Signature/AbstractSignature.php +++ b/Obs/Internal/Signature/AbstractSignature.php @@ -17,455 +17,482 @@ namespace Obs\Internal\Signature; -use Obs\Log\ObsLog; -use Obs\Internal\Resource\Constants; -use Obs\ObsException; -use Obs\Internal\Common\SchemaFormatter; use GuzzleHttp\Psr7\Stream; use Obs\Internal\Common\Model; -use Psr\Http\Message\StreamInterface; use Obs\Internal\Common\ObsTransform; +use Obs\Internal\Common\SchemaFormatter; use Obs\Internal\Common\V2Transform; +use Obs\Internal\Resource\Constants; +use Obs\Log\ObsLog; +use Obs\ObsException; +use Psr\Http\Message\StreamInterface; abstract class AbstractSignature implements SignatureInterface { - - protected $ak; - - protected $sk; - - protected $pathStyle; - - protected $endpoint; - - protected $methodName; - - protected $securityToken; - - protected $signature; - - protected $isCname; - - public static function urlencodeWithSafe($val, $safe='/'){ - if(($len = strlen($val)) === 0){ - return ''; - } - $buffer = []; - for ($index=0;$index<$len;$index++){ - $str = $val[$index]; - $buffer[] = !($pos = strpos($safe, $str)) && $pos !== 0 ? rawurlencode($str) : $str; - } - return implode('', $buffer); - } - - protected function __construct($ak, $sk, $pathStyle, $endpoint, $methodName, $signature, $securityToken=false, $isCname=false) - { - $this -> ak = $ak; - $this -> sk = $sk; - $this -> pathStyle = $pathStyle; - $this -> endpoint = $endpoint; - $this -> methodName = $methodName; - $this -> signature = $signature; - $this -> securityToken = $securityToken; - $this -> isCname = $isCname; - } - - protected function transXmlByType($key, &$value, &$subParams, $transHolder) - { - $xml = []; - $treatAsString = false; - if(isset($value['type'])){ - $type = $value['type']; - if($type === 'array'){ - $name = isset($value['sentAs']) ? $value['sentAs'] : $key; - $subXml = []; - foreach($subParams as $item){ - $temp = $this->transXmlByType($key, $value['items'], $item, $transHolder); - if($temp !== ''){ - $subXml[] = $temp; - } - } - if(!empty($subXml)){ - if(!isset($value['data']['xmlFlattened'])){ - $xml[] = '<' . $name . '>'; - $xml[] = implode('', $subXml); - $xml[] = ''; - }else{ - $xml[] = implode('', $subXml); - } - } - }else if($type === 'object'){ - $name = isset($value['sentAs']) ? $value['sentAs'] : (isset($value['name']) ? $value['name'] : $key); - $properties = $value['properties']; - $subXml = []; - $attr = []; - foreach ($properties as $pkey => $pvalue){ - if(isset($pvalue['required']) && $pvalue['required'] && !isset($subParams[$pkey])){ - $obsException= new ObsException('param:' .$pkey. ' is required'); - $obsException-> setExceptionType('client'); - throw $obsException; - } - if(isset($subParams[$pkey])){ - if(isset($pvalue['data']) && isset($pvalue['data']['xmlAttribute']) && $pvalue['data']['xmlAttribute']){ - $attrValue = $this->xml_tansfer(trim(strval($subParams[$pkey]))); - $attr[$pvalue['sentAs']] = '"' . $attrValue . '"'; - if(isset($pvalue['data']['xmlNamespace'])){ - $ns = substr($pvalue['sentAs'], 0, strpos($pvalue['sentAs'], ':')); - $attr['xmlns:' . $ns] = '"' . $pvalue['data']['xmlNamespace'] . '"'; - } - }else{ - $subXml[] = $this -> transXmlByType($pkey, $pvalue, $subParams[$pkey], $transHolder); - } - } - } - $val = implode('', $subXml); - if($val !== ''){ - $_name = $name; - if(!empty($attr)){ - foreach ($attr as $akey => $avalue){ - $_name .= ' ' . $akey . '=' . $avalue; - } - } - if(!isset($value['data']['xmlFlattened'])){ - $xml[] = '<' . $_name . '>'; - $xml[] = $val; - $xml[] = ''; - } else { - $xml[] = $val; - } - } - }else{ - $treatAsString = true; - } - }else{ - $treatAsString = true; - $type = null; - } - - if($treatAsString){ - if($type === 'boolean'){ - if(!is_bool($subParams) && strval($subParams) !== 'false' && strval($subParams) !== 'true'){ - $obsException= new ObsException('param:' .$key. ' is not a boolean value'); - $obsException-> setExceptionType('client'); - throw $obsException; - } - }else if($type === 'numeric'){ - if(!is_numeric($subParams)){ - $obsException= new ObsException('param:' .$key. ' is not a numeric value'); - $obsException-> setExceptionType('client'); - throw $obsException; - } - }else if($type === 'float'){ - if(!is_float($subParams)){ - $obsException= new ObsException('param:' .$key. ' is not a float value'); - $obsException-> setExceptionType('client'); - throw $obsException; - } - }else if($type === 'int' || $type === 'integer'){ - if(!is_int($subParams)){ - $obsException= new ObsException('param:' .$key. ' is not a int value'); - $obsException-> setExceptionType('client'); - throw $obsException; - } - } - - $name = isset($value['sentAs']) ? $value['sentAs'] : $key; - if(is_bool($subParams)){ - $val = $subParams ? 'true' : 'false'; - }else{ - $val = strval($subParams); - } - if(isset($value['format'])){ - $val = SchemaFormatter::format($value['format'], $val); - } - if (isset($value['transform'])) { - $val = $transHolder->transform($value['transform'], $val); - } - if(isset($val) && $val !== ''){ - $val = $this->xml_tansfer($val); - if(!isset($value['data']['xmlFlattened'])){ - $xml[] = '<' . $name . '>'; - $xml[] = $val; - $xml[] = ''; - } else { - $xml[] = $val; - } - }else if(isset($value['canEmpty']) && $value['canEmpty']){ - $xml[] = '<' . $name . '>'; - $xml[] = $val; - $xml[] = ''; - } - } - $ret = implode('', $xml); - - if(isset($value['wrapper'])){ - $ret = '<'. $value['wrapper'] . '>' . $ret . ''; - } - - return $ret; - } - - private function xml_tansfer($tag) { - $search = array('&', '<', '>', '\'', '"'); - $repalce = array('&', '<', '>', ''', '"'); - $transferXml = str_replace($search, $repalce, $tag); - return $transferXml; - } - - protected function prepareAuth(array &$requestConfig, array &$params, Model $model) - { - $transHolder = strcasecmp($this-> signature, 'obs') === 0 ? ObsTransform::getInstance() : V2Transform::getInstance(); - $method = $requestConfig['httpMethod']; - $requestUrl = $this->endpoint; - $headers = []; - $pathArgs = []; - $dnsParam = null; - $uriParam = null; - $body = []; - $xml = []; - - if(isset($requestConfig['specialParam'])){ - $pathArgs[$requestConfig['specialParam']] = ''; - } - - $result = ['body' => null]; - $url = parse_url($requestUrl); - $host = $url['host']; - - $fileFlag = false; - - if(isset($requestConfig['requestParameters'])){ - $paramsMetadata = $requestConfig['requestParameters']; - foreach ($paramsMetadata as $key => $value){ - if(isset($value['required']) && $value['required'] && !isset($params[$key])){ - $obsException= new ObsException('param:' .$key. ' is required'); - $obsException-> setExceptionType('client'); - throw $obsException; - } - if(isset($params[$key]) && isset($value['location'])){ - $location = $value['location']; - $val = $params[$key]; - $type = 'string'; - if($val !== '' && isset($value['type'])){ - $type = $value['type']; - if($type === 'boolean'){ - if(!is_bool($val) && strval($val) !== 'false' && strval($val) !== 'true'){ - $obsException= new ObsException('param:' .$key. ' is not a boolean value'); - $obsException-> setExceptionType('client'); - throw $obsException; - } - }else if($type === 'numeric'){ - if(!is_numeric($val)){ - $obsException= new ObsException('param:' .$key. ' is not a numeric value'); - $obsException-> setExceptionType('client'); - throw $obsException; - } - }else if($type === 'float'){ - if(!is_float($val)){ - $obsException= new ObsException('param:' .$key. ' is not a float value'); - $obsException-> setExceptionType('client'); - throw $obsException; - } - }else if($type === 'int' || $type === 'integer'){ - if(!is_int($val)){ - $obsException= new ObsException('param:' .$key. ' is not a int value'); - $obsException-> setExceptionType('client'); - throw $obsException; - } - } - } - - if($location === 'header'){ - if($type === 'object'){ - if(is_array($val)){ - $sentAs = strtolower($value['sentAs']); - foreach ($val as $k => $v){ - $k = self::urlencodeWithSafe(strtolower($k), ' ;/?:@&=+$,'); - $name = strpos($k, $sentAs) === 0 ? $k : $sentAs . $k; - $headers[$name] = self::urlencodeWithSafe($v, ' ;/?:@&=+$,\'*'); - } - } - }else if($type === 'array'){ - if(is_array($val)){ - $name = isset($value['sentAs']) ? $value['sentAs'] : (isset($value['items']['sentAs']) ? $value['items']['sentAs'] : $key); - $temp = []; - foreach ($val as $v){ - if(($v = strval($v)) !== ''){ - $temp[] = self::urlencodeWithSafe($val, ' ;/?:@&=+$,\'*'); - } - } - - $headers[$name] = $temp; - } - }else if($type === 'password'){ - if(($val = strval($val)) !== ''){ - $name = isset($value['sentAs']) ? $value['sentAs'] : $key; - $pwdName = isset($value['pwdSentAs']) ? $value['pwdSentAs'] : $name . '-MD5'; - $val1 = base64_encode($val); - $val2 = base64_encode(md5($val, true)); - $headers[$name] = $val1; - $headers[$pwdName] = $val2; - } - }else{ - if (isset($value['transform'])) { - $val = $transHolder->transform($value['transform'], strval($val)); - } - if(isset($val)){ - if(is_bool($val)){ - $val = $val ? 'true' : 'false'; - }else{ - $val = strval($val); - } - if($val !== ''){ - $name = isset($value['sentAs']) ? $value['sentAs'] : $key; - if(isset($value['format'])){ - $val = SchemaFormatter::format($value['format'], $val); - } - $headers[$name] = self::urlencodeWithSafe($val, ' ;/?:@&=+$,\'*'); - } - } - } - }else if($location === 'uri' && $uriParam === null){ - $uriParam = self::urlencodeWithSafe($val); - }else if($location === 'dns' && $dnsParam === null){ - $dnsParam = $val; - }else if($location === 'query'){ - $name = isset($value['sentAs']) ? $value['sentAs'] : $key; - if(strval($val) !== ''){ - if (strcasecmp ( $this->signature, 'v4' ) === 0) { - $pathArgs[rawurlencode($name)] = rawurlencode(strval($val)); - } else { - $pathArgs[self::urlencodeWithSafe($name)] = self::urlencodeWithSafe(strval($val)); - } - } - }else if($location === 'xml'){ - $val = $this->transXmlByType($key, $value, $val, $transHolder); - if($val !== ''){ - $xml[] = $val; - } - }else if($location === 'body'){ - - if(isset($result['body'])){ - $obsException= new ObsException('duplicated body provided'); - $obsException-> setExceptionType('client'); - throw $obsException; - } - - if($type === 'file'){ - if(!file_exists($val)){ - $obsException= new ObsException('file[' .$val. '] does not exist'); - $obsException-> setExceptionType('client'); - throw $obsException; - } - $result['body'] = new Stream(fopen($val, 'r')); - $fileFlag = true; - }else if($type === 'stream'){ - $result['body'] = $val; - } else if ($type === 'json') { - //TODO + + protected $ak; + + protected $sk; + + protected $pathStyle; + + protected $endpoint; + + protected $methodName; + + protected $securityToken; + + protected $signature; + + protected $isCname; + + public static function urlencodeWithSafe($val, $safe = '/') + { + $len = strlen($val); + if ($len === 0) { + return ''; + } + $buffer = []; + for ($index = 0; $index < $len; $index++) { + $str = $val[$index]; + $pos = strpos($safe, $str); + $buffer[] = !$pos && $pos !== 0 ? rawurlencode($str) : $str; + } + return implode('', $buffer); + } + + protected function __construct($ak, $sk, $pathStyle, $endpoint, $methodName, $signature, $securityToken = false, $isCname = false) + { + $this->ak = $ak; + $this->sk = $sk; + $this->pathStyle = $pathStyle; + $this->endpoint = $endpoint; + $this->methodName = $methodName; + $this->signature = $signature; + $this->securityToken = $securityToken; + $this->isCname = $isCname; + } + + protected function transXmlByType($key, &$value, &$subParams, $transHolder) + { + $xml = []; + $treatAsString = false; + if (isset($value['type'])) { + $type = $value['type']; + if ($type === 'array') { + $name = isset($value['sentAs']) ? $value['sentAs'] : $key; + $subXml = []; + foreach ($subParams as $item) { + $temp = $this->transXmlByType($key, $value['items'], $item, $transHolder); + if ($temp !== '') { + $subXml[] = $temp; + } + } + if (!empty($subXml)) { + if (!isset($value['data']['xmlFlattened'])) { + $xml[] = '<' . $name . '>'; + $xml[] = implode('', $subXml); + $xml[] = ''; + } else { + $xml[] = implode('', $subXml); + } + } + } elseif ($type === 'object') { + $name = $this->getNameByObjectType($key, $value); + $properties = $value['properties']; + $subXml = []; + $attr = []; + foreach ($properties as $pkey => $pvalue) { + if (isset($pvalue['required']) && $pvalue['required'] && !isset($subParams[$pkey])) { + $obsException = new ObsException('param:' . $pkey . ' is required'); + $obsException->setExceptionType('client'); + throw $obsException; + } + if (isset($subParams[$pkey])) { + if (isset($pvalue['data']) + && isset($pvalue['data']['xmlAttribute']) + && $pvalue['data']['xmlAttribute'] + ) { + $attrValue = $this->xmlTransfer(trim(strval($subParams[$pkey]))); + $attr[$pvalue['sentAs']] = '"' . $attrValue . '"'; + if (isset($pvalue['data']['xmlNamespace'])) { + $ns = substr($pvalue['sentAs'], 0, strpos($pvalue['sentAs'], ':')); + $attr['xmlns:' . $ns] = '"' . $pvalue['data']['xmlNamespace'] . '"'; + } + } else { + $subXml[] = $this->transXmlByType($pkey, $pvalue, $subParams[$pkey], $transHolder); + } + } + } + $val = implode('', $subXml); + if ($val !== '') { + $newName = $name; + if (!empty($attr)) { + foreach ($attr as $akey => $avalue) { + $newName .= ' ' . $akey . '=' . $avalue; + } + } + if (!isset($value['data']['xmlFlattened'])) { + $xml[] = '<' . $newName . '>'; + $xml[] = $val; + $xml[] = ''; + } else { + $xml[] = $val; + } + } + } else { + $treatAsString = true; + } + } else { + $treatAsString = true; + $type = null; + } + + if ($treatAsString) { + if ($type === 'boolean') { + if (!is_bool($subParams) && strval($subParams) !== 'false' && strval($subParams) !== 'true') { + $obsException = new ObsException('param:' . $key . ' is not a boolean value'); + $obsException->setExceptionType('client'); + throw $obsException; + } + } elseif ($type === 'numeric') { + if (!is_numeric($subParams)) { + $obsException = new ObsException('param:' . $key . ' is not a numeric value'); + $obsException->setExceptionType('client'); + throw $obsException; + } + } elseif ($type === 'float') { + if (!is_float($subParams)) { + $obsException = new ObsException('param:' . $key . ' is not a float value'); + $obsException->setExceptionType('client'); + throw $obsException; + } + } elseif ($type === 'int' || $type === 'integer') { + if (!is_int($subParams)) { + $obsException = new ObsException('param:' . $key . ' is not a int value'); + $obsException->setExceptionType('client'); + throw $obsException; + } + } else { + // nothing handle + } + + $name = isset($value['sentAs']) ? $value['sentAs'] : $key; + if (is_bool($subParams)) { + $val = $subParams ? 'true' : 'false'; + } else { + $val = strval($subParams); + } + if (isset($value['format'])) { + $val = SchemaFormatter::format($value['format'], $val); + } + if (isset($value['transform'])) { + $val = $transHolder->transform($value['transform'], $val); + } + if (isset($val) && $val !== '') { + $val = $this->xmlTransfer($val); + if (!isset($value['data']['xmlFlattened'])) { + $xml[] = '<' . $name . '>'; + $xml[] = $val; + $xml[] = ''; + } else { + $xml[] = $val; + } + } elseif (isset($value['canEmpty']) && $value['canEmpty']) { + $xml[] = '<' . $name . '>'; + $xml[] = $val; + $xml[] = ''; + } else { + // nothing handle + } + } + $ret = implode('', $xml); + + if (isset($value['wrapper'])) { + $ret = '<' . $value['wrapper'] . '>' . $ret . ''; + } + + return $ret; + } + + private function xmlTransfer($tag) + { + $search = array('&', '<', '>', '\'', '"'); + $repalce = array('&', '<', '>', ''', '"'); + return str_replace($search, $repalce, $tag); + } + + private function getNameByObjectType($key, $value) + { + return isset($value['sentAs']) ? $value['sentAs'] : (isset($value['name']) ? $value['name'] : $key); + } + + private function getNameByArrayType($key, $value) + { + return isset($value['sentAs']) ? $value['sentAs'] : (isset($value['items']['sentAs']) ? $value['items']['sentAs'] : $key); + } + + protected function prepareAuth(array &$requestConfig, array &$params, Model $model) + { + $transHolder = strcasecmp($this->signature, 'obs') === 0 + ? ObsTransform::getInstance() + : V2Transform::getInstance(); + $method = $requestConfig['httpMethod']; + $requestUrl = $this->endpoint; + $headers = []; + $pathArgs = []; + $dnsParam = null; + $uriParam = null; + $body = []; + $xml = []; + + if (isset($requestConfig['specialParam'])) { + $pathArgs[$requestConfig['specialParam']] = ''; + } + + $result = ['body' => null]; + $url = parse_url($requestUrl); + $host = $url['host']; + + $fileFlag = false; + + if (isset($requestConfig['requestParameters'])) { + $paramsMetadata = $requestConfig['requestParameters']; + foreach ($paramsMetadata as $key => $value) { + if (isset($value['required']) && $value['required'] && !isset($params[$key])) { + $obsException = new ObsException('param:' . $key . ' is required'); + $obsException->setExceptionType('client'); + throw $obsException; + } + if (isset($params[$key]) && isset($value['location'])) { + $location = $value['location']; + $val = $params[$key]; + $type = 'string'; + if ($val !== '' && isset($value['type'])) { + $type = $value['type']; + if ($type === 'boolean') { + if (!is_bool($val) && strval($val) !== 'false' && strval($val) !== 'true') { + $obsException = new ObsException('param:' . $key . ' is not a boolean value'); + $obsException->setExceptionType('client'); + throw $obsException; + } + } elseif ($type === 'numeric') { + if (!is_numeric($val)) { + $obsException = new ObsException('param:' . $key . ' is not a numeric value'); + $obsException->setExceptionType('client'); + throw $obsException; + } + } elseif ($type === 'float') { + if (!is_float($val)) { + $obsException = new ObsException('param:' . $key . ' is not a float value'); + $obsException->setExceptionType('client'); + throw $obsException; + } + } elseif ($type === 'int' || $type === 'integer') { + if (!is_int($val)) { + $obsException = new ObsException('param:' . $key . ' is not a int value'); + $obsException->setExceptionType('client'); + throw $obsException; + } + } else { + // nothing handle + } + } + + if ($location === 'header') { + if ($type === 'object') { + if (is_array($val)) { + $sentAs = strtolower($value['sentAs']); + foreach ($val as $k => $v) { + $k = AbstractSignature::urlencodeWithSafe(strtolower($k), ' ;/?:@&=+$,'); + $name = strpos($k, $sentAs) === 0 ? $k : $sentAs . $k; + $headers[$name] = AbstractSignature::urlencodeWithSafe($v, ' ;/?:@&=+$,\'*'); + } + } + } elseif ($type === 'array') { + if (is_array($val)) { + $name = $this->getNameByArrayType($key, $value); + $temp = []; + foreach ($val as $v) { + $v = strval($v); + if ($v !== '') { + $temp[] = AbstractSignature::urlencodeWithSafe($val, ' ;/?:@&=+$,\'*'); + } + } + + $headers[$name] = $temp; + } + } elseif ($type === 'password') { + $val = strval($val); + if ($val !== '') { + $name = isset($value['sentAs']) ? $value['sentAs'] : $key; + $pwdName = isset($value['pwdSentAs']) ? $value['pwdSentAs'] : $name . '-MD5'; + $headers[$name] = base64_encode($val); + $headers[$pwdName] = base64_encode(md5($val, true)); + } + } else { + if (isset($value['transform'])) { + $val = $transHolder->transform($value['transform'], strval($val)); + } + if (isset($val)) { + if (is_bool($val)) { + $val = $val ? 'true' : 'false'; + } else { + $val = strval($val); + } + if ($val !== '') { + $name = isset($value['sentAs']) ? $value['sentAs'] : $key; + if (isset($value['format'])) { + $val = SchemaFormatter::format($value['format'], $val); + } + $headers[$name] = AbstractSignature::urlencodeWithSafe($val, ' ;/?:@&=+$,\'*'); + } + } + } + } elseif ($location === 'uri' && $uriParam === null) { + $uriParam = AbstractSignature::urlencodeWithSafe($val); + } elseif ($location === 'dns' && $dnsParam === null) { + $dnsParam = $val; + } elseif ($location === 'query') { + $name = isset($value['sentAs']) ? $value['sentAs'] : $key; + if (strval($val) !== '') { + if (strcasecmp($this->signature, 'v4') === 0) { + $pathArgs[rawurlencode($name)] = rawurlencode(strval($val)); + } else { + $pathArgs[AbstractSignature::urlencodeWithSafe($name)] = AbstractSignature::urlencodeWithSafe(strval($val)); + } + } + } elseif ($location === 'xml') { + $val = $this->transXmlByType($key, $value, $val, $transHolder); + if ($val !== '') { + $xml[] = $val; + } + } elseif ($location === 'body') { + + if (isset($result['body'])) { + $obsException = new ObsException('duplicated body provided'); + $obsException->setExceptionType('client'); + throw $obsException; + } + + if ($type === 'file') { + if (!file_exists($val)) { + $obsException = new ObsException('file[' . $val . '] does not exist'); + $obsException->setExceptionType('client'); + throw $obsException; + } + $result['body'] = new Stream(fopen($val, 'r')); + $fileFlag = true; + } elseif ($type === 'stream') { + $result['body'] = $val; + } elseif ($type === 'json') { $jsonData = json_encode($val); if (!$jsonData) { - $obsException= new ObsException('input is invalid, since it is not json data'); - $obsException-> setExceptionType('client'); + $obsException = new ObsException('input is invalid, since it is not json data'); + $obsException->setExceptionType('client'); throw $obsException; } $result['body'] = strval($jsonData); - } else{ - $result['body'] = strval($val); - } - }else if($location === 'response'){ - $model[$key] = ['value' => $val, 'type' => $type]; - } - } - } - - - if($dnsParam){ - if($this -> pathStyle){ - $requestUrl = $requestUrl . '/' . $dnsParam; - }else{ - $defaultPort = strtolower($url['scheme']) === 'https' ? '443' : '80'; - $host = $this -> isCname ? $host : $dnsParam. '.' . $host; - $requestUrl = $url['scheme'] . '://' . $host . ':' . (isset($url['port']) ? $url['port'] : $defaultPort); - } - } - if($uriParam){ - $requestUrl = $requestUrl . '/' . $uriParam; - } - - if(!empty($pathArgs)){ - $requestUrl .= '?'; - $_pathArgs = []; - foreach ($pathArgs as $key => $value){ - $_pathArgs[] = $value === null || $value === '' ? $key : $key . '=' . $value; - } - $requestUrl .= implode('&', $_pathArgs); - } - } - - if($xml || (isset($requestConfig['data']['xmlAllowEmpty']) && $requestConfig['data']['xmlAllowEmpty'])){ - $body[] = '<'; - $xmlRoot = $requestConfig['data']['xmlRoot']['name']; - - $body[] = $xmlRoot; - $body[] = '>'; - $body[] = implode('', $xml); - $body[] = ''; - $headers['Content-Type'] = 'application/xml'; - $result['body'] = implode('', $body); - - ObsLog::commonLog(DEBUG, 'request content ' . $result['body']); - - if(isset($requestConfig['data']['contentMd5']) && $requestConfig['data']['contentMd5']){ - $headers['Content-MD5'] = base64_encode(md5($result['body'],true)); - } - } - - if($fileFlag && ($result['body'] instanceof StreamInterface)){ - if($this->methodName === 'uploadPart' && (isset($model['Offset']) || isset($model['PartSize']))){ - $bodySize = $result['body'] ->getSize(); - if(isset($model['Offset'])){ - $offset = intval($model['Offset']['value']); - $offset = $offset >= 0 && $offset < $bodySize ? $offset : 0; - }else{ - $offset = 0; - } - - if(isset($model['PartSize'])){ - $partSize = intval($model['PartSize']['value']); - $partSize = $partSize > 0 && $partSize <= ($bodySize - $offset) ? $partSize : $bodySize - $offset; - }else{ - $partSize = $bodySize - $offset; - } - $result['body'] -> rewind(); - $result['body'] -> seek($offset); - $headers['Content-Length'] = $partSize; - }else if(isset($headers['Content-Length'])){ - $bodySize = $result['body'] -> getSize(); - if(intval($headers['Content-Length']) > $bodySize){ - $headers['Content-Length'] = $bodySize; - } - } - } - - $constants = Constants::selectConstants($this -> signature); - - if($this->securityToken){ - $headers[$constants::SECURITY_TOKEN_HEAD] = $this->securityToken; - } - - $headers['Host'] = $host; - - $result['host'] = $host; - $result['method'] = $method; - $result['headers'] = $headers; - $result['pathArgs'] = $pathArgs; - $result['dnsParam'] = $dnsParam; - $result['uriParam'] = $uriParam; - $result['requestUrl'] = $requestUrl; - - return $result; - } + } else { + $result['body'] = strval($val); + } + } elseif ($location === 'response') { + $model[$key] = ['value' => $val, 'type' => $type]; + } else { + // nothing handle + } + } + } + + if ($dnsParam) { + if ($this->pathStyle) { + $requestUrl = $requestUrl . '/' . $dnsParam; + } else { + $defaultPort = strtolower($url['scheme']) === 'https' ? '443' : '80'; + $host = $this->isCname ? $host : $dnsParam . '.' . $host; + $port = isset($url['port']) ? $url['port'] : $defaultPort; + $requestUrl = $url['scheme'] . '://' . $host . ':' . $port; + } + } + if ($uriParam) { + $requestUrl = $requestUrl . '/' . $uriParam; + } + + if (!empty($pathArgs)) { + $requestUrl .= '?'; + $newPathArgs = []; + foreach ($pathArgs as $key => $value) { + $newPathArgs[] = $value === null || $value === '' ? $key : $key . '=' . $value; + } + $requestUrl .= implode('&', $newPathArgs); + } + } + + if ($xml || (isset($requestConfig['data']['xmlAllowEmpty']) && $requestConfig['data']['xmlAllowEmpty'])) { + $body[] = '<'; + $xmlRoot = $requestConfig['data']['xmlRoot']['name']; + + $body[] = $xmlRoot; + $body[] = '>'; + $body[] = implode('', $xml); + $body[] = ''; + $headers['Content-Type'] = 'application/xml'; + $result['body'] = implode('', $body); + + ObsLog::commonLog(DEBUG, 'request content ' . $result['body']); + + if (isset($requestConfig['data']['contentMd5']) && $requestConfig['data']['contentMd5']) { + $headers['Content-MD5'] = base64_encode(md5($result['body'], true)); + } + } + + if ($fileFlag && ($result['body'] instanceof StreamInterface)) { + if ($this->methodName === 'uploadPart' && (isset($model['Offset']) || isset($model['PartSize']))) { + $bodySize = $result['body']->getSize(); + if (isset($model['Offset'])) { + $offset = intval($model['Offset']['value']); + $offset = $offset >= 0 && $offset < $bodySize ? $offset : 0; + } else { + $offset = 0; + } + + if (isset($model['PartSize'])) { + $partSize = intval($model['PartSize']['value']); + $partSize = $partSize > 0 && $partSize <= ($bodySize - $offset) ? $partSize : $bodySize - $offset; + } else { + $partSize = $bodySize - $offset; + } + $result['body']->rewind(); + $result['body']->seek($offset); + $headers['Content-Length'] = $partSize; + } elseif (isset($headers['Content-Length'])) { + $bodySize = $result['body']->getSize(); + if (intval($headers['Content-Length']) > $bodySize) { + $headers['Content-Length'] = $bodySize; + } + } else { + // nothing handle + } + } + + $constants = Constants::selectConstants($this->signature); + + if ($this->securityToken) { + $headers[$constants::SECURITY_TOKEN_HEAD] = $this->securityToken; + } + + $headers['Host'] = $host; + + $result['host'] = $host; + $result['method'] = $method; + $result['headers'] = $headers; + $result['pathArgs'] = $pathArgs; + $result['dnsParam'] = $dnsParam; + $result['uriParam'] = $uriParam; + $result['requestUrl'] = $requestUrl; + + return $result; + } } \ No newline at end of file diff --git a/Obs/Internal/Signature/DefaultSignature.php b/Obs/Internal/Signature/DefaultSignature.php index d83c230..525628e 100644 --- a/Obs/Internal/Signature/DefaultSignature.php +++ b/Obs/Internal/Signature/DefaultSignature.php @@ -17,122 +17,120 @@ namespace Obs\Internal\Signature; - -use Obs\Internal\Resource\Constants; use Obs\Internal\Common\Model; -use Obs\Internal\Resource\V2Constants; +use Obs\Internal\Resource\Constants; class DefaultSignature extends AbstractSignature { - const INTEREST_HEADER_KEY_LIST = array('content-type', 'content-md5', 'date'); - - - public function __construct($ak, $sk, $pathStyle, $endpoint, $methodName, $signature, $securityToken=false, $isCname=false) - { - - parent::__construct($ak, $sk, $pathStyle, $endpoint, $methodName, $signature, $securityToken, $isCname); - } - - public function doAuth(array &$requestConfig, array &$params, Model $model) - { - $result = $this -> prepareAuth($requestConfig, $params, $model); - - $result['headers']['Date'] = gmdate('D, d M Y H:i:s \G\M\T'); - $canonicalstring = $this-> makeCanonicalstring($result['method'], $result['headers'], $result['pathArgs'], $result['dnsParam'], $result['uriParam']); - - $result['cannonicalRequest'] = $canonicalstring; - - $signature = base64_encode(hash_hmac('sha1', $canonicalstring, $this->sk, true)); - - $constants = Constants::selectConstants($this -> signature); - $signatureFlag = $constants::FLAG; - - $authorization = $signatureFlag . ' ' . $this->ak . ':' . $signature; - - $result['headers']['Authorization'] = $authorization; - - return $result; - } - - public function makeCanonicalstring($method, $headers, $pathArgs, $bucketName, $objectKey, $expires = null) - { - $buffer = []; - $buffer[] = $method; - $buffer[] = "\n"; - $interestHeaders = []; - $constants = Constants::selectConstants($this -> signature); - - foreach ($headers as $key => $value){ + const INTEREST_HEADER_KEY_LIST = array('content-type', 'content-md5', 'date'); + + public function __construct($ak, $sk, $pathStyle, $endpoint, $methodName, $signature, $securityToken = false, $isCname = false) + { + + parent::__construct($ak, $sk, $pathStyle, $endpoint, $methodName, $signature, $securityToken, $isCname); + } + + public function doAuth(array &$requestConfig, array &$params, Model $model) + { + $result = $this->prepareAuth($requestConfig, $params, $model); + + $result['headers']['Date'] = gmdate('D, d M Y H:i:s \G\M\T'); + $canonicalstring = $this->makeCanonicalstring($result['method'], $result['headers'], $result['pathArgs'], $result['dnsParam'], $result['uriParam']); + + $result['cannonicalRequest'] = $canonicalstring; + + $signature = base64_encode(hash_hmac('sha1', $canonicalstring, $this->sk, true)); + + $constants = Constants::selectConstants($this->signature); + $signatureFlag = $constants::FLAG; + + $authorization = $signatureFlag . ' ' . $this->ak . ':' . $signature; + + $result['headers']['Authorization'] = $authorization; + + return $result; + } + + public function makeCanonicalstring($method, $headers, $pathArgs, $bucketName, $objectKey, $expires = null) + { + $buffer = []; + $buffer[] = $method; + $buffer[] = "\n"; + $interestHeaders = []; + $constants = Constants::selectConstants($this->signature); + + foreach ($headers as $key => $value) { $key = strtolower($key); - if(in_array($key, self::INTEREST_HEADER_KEY_LIST) || strpos($key, $constants::HEADER_PREFIX) === 0){ - $interestHeaders[$key] = $value; - } - } - - if(array_key_exists($constants::ALTERNATIVE_DATE_HEADER, $interestHeaders)){ - $interestHeaders['date'] = ''; - } - - if($expires !== null){ - $interestHeaders['date'] = strval($expires); - } - - if(!array_key_exists('content-type', $interestHeaders)){ - $interestHeaders['content-type'] = ''; - } - - if(!array_key_exists('content-md5', $interestHeaders)){ - $interestHeaders['content-md5'] = ''; - } - - ksort($interestHeaders); - - foreach ($interestHeaders as $key => $value){ - if(strpos($key, $constants::HEADER_PREFIX) === 0){ - $buffer[] = $key . ':' . $value; - }else{ - $buffer[] = $value; - } - $buffer[] = "\n"; - } - - $uri = ''; - - $bucketName = $this->isCname ? $headers['Host'] : $bucketName; - - if($bucketName){ - $uri .= '/'; - $uri .= $bucketName; - if(!$this->pathStyle){ - $uri .= '/'; - } - } - - if($objectKey){ - if(!($pos=strripos($uri, '/')) || strlen($uri)-1 !== $pos){ - $uri .= '/'; - } - $uri .= $objectKey; - } - - $buffer[] = $uri === ''? '/' : $uri; - - - if(!empty($pathArgs)){ - ksort($pathArgs); - $_pathArgs = []; - foreach ($pathArgs as $key => $value){ - if(in_array(strtolower($key), $constants::ALLOWED_RESOURCE_PARAMTER_NAMES) || strpos($key, $constants::HEADER_PREFIX) === 0){ - $_pathArgs[] = $value === null || $value === '' ? $key : $key . '=' . urldecode($value); - } - } - if(!empty($_pathArgs)){ - $buffer[] = '?'; - $buffer[] = implode('&', $_pathArgs); - } - } - - return implode('', $buffer); - } + if (in_array($key, self::INTEREST_HEADER_KEY_LIST) || strpos($key, $constants::HEADER_PREFIX) === 0) { + $interestHeaders[$key] = $value; + } + } + + if (array_key_exists($constants::ALTERNATIVE_DATE_HEADER, $interestHeaders)) { + $interestHeaders['date'] = ''; + } + + if ($expires !== null) { + $interestHeaders['date'] = strval($expires); + } + + if (!array_key_exists('content-type', $interestHeaders)) { + $interestHeaders['content-type'] = ''; + } + + if (!array_key_exists('content-md5', $interestHeaders)) { + $interestHeaders['content-md5'] = ''; + } + + ksort($interestHeaders); + + foreach ($interestHeaders as $key => $value) { + if (strpos($key, $constants::HEADER_PREFIX) === 0) { + $buffer[] = $key . ':' . $value; + } else { + $buffer[] = $value; + } + $buffer[] = "\n"; + } + + $uri = ''; + + $bucketName = $this->isCname ? $headers['Host'] : $bucketName; + + if ($bucketName) { + $uri .= '/'; + $uri .= $bucketName; + if (!$this->pathStyle) { + $uri .= '/'; + } + } + + if ($objectKey) { + $pos = strripos($uri, '/'); + if (!$pos || strlen($uri) - 1 !== $pos) { + $uri .= '/'; + } + $uri .= $objectKey; + } + + $buffer[] = $uri === '' ? '/' : $uri; + + if (!empty($pathArgs)) { + ksort($pathArgs); + $pathArgsResult = []; + foreach ($pathArgs as $key => $value) { + if (in_array(strtolower($key), $constants::ALLOWED_RESOURCE_PARAMTER_NAMES) + || strpos($key, $constants::HEADER_PREFIX) === 0 + ) { + $pathArgsResult[] = $value === null || $value === '' ? $key : $key . '=' . urldecode($value); + } + } + if (!empty($pathArgsResult)) { + $buffer[] = '?'; + $buffer[] = implode('&', $pathArgsResult); + } + } + return implode('', $buffer); + } } diff --git a/Obs/Internal/Signature/V4Signature.php b/Obs/Internal/Signature/V4Signature.php index f2a1857..0cf08bd 100644 --- a/Obs/Internal/Signature/V4Signature.php +++ b/Obs/Internal/Signature/V4Signature.php @@ -21,179 +21,181 @@ class V4Signature extends AbstractSignature { - const CONTENT_SHA256 = 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'; - - protected $region; - - protected $utcTimeZone; - - public function __construct($ak, $sk, $pathStyle, $endpoint, $region, $methodName, $signature, $securityToken=false, $isCname=false) - { - parent::__construct($ak, $sk, $pathStyle, $endpoint, $methodName, $signature, $securityToken, $isCname); - $this->region = $region; - $this->utcTimeZone = new \DateTimeZone ('UTC'); - } - - public function doAuth(array &$requestConfig, array &$params, Model $model) - { - $result = $this -> prepareAuth($requestConfig, $params, $model); - - $result['headers']['x-amz-content-sha256'] = self::CONTENT_SHA256; - - $bucketName = $result['dnsParam']; - - $result['headers']['Host'] = $result['host']; - - $time = null; - if(array_key_exists('x-amz-date', $result['headers'])){ - $time = $result['headers']['x-amz-date']; - }else if(array_key_exists('X-Amz-Date', $result['headers'])){ - $time = $result['headers']['X-Amz-Date']; - } - $timestamp = $time ? date_create_from_format('Ymd\THis\Z', $time, $this->utcTimeZone) -> getTimestamp() - :time(); - - $result['headers']['Date'] = gmdate('D, d M Y H:i:s \G\M\T', $timestamp); - - $longDate = gmdate('Ymd\THis\Z', $timestamp); - $shortDate = substr($longDate, 0, 8); - - $credential = $this-> getCredential($shortDate); - - $signedHeaders = $this->getSignedHeaders($result['headers']); - - $canonicalstring = $this-> makeCanonicalstring($result['method'], $result['headers'], $result['pathArgs'], $bucketName, $result['uriParam'], $signedHeaders); - - $result['cannonicalRequest'] = $canonicalstring; - - $signature = $this -> getSignature($canonicalstring, $longDate, $shortDate); - - $authorization = 'AWS4-HMAC-SHA256 ' . 'Credential=' . $credential. ',' . 'SignedHeaders=' . $signedHeaders . ',' . 'Signature=' . $signature; - - $result['headers']['Authorization'] = $authorization; - - return $result; - } - - public function getSignature($canonicalstring, $longDate, $shortDate) - { - $stringToSign = []; - $stringToSign[] = 'AWS4-HMAC-SHA256'; - - $stringToSign[] = "\n"; - - $stringToSign[] = $longDate; - - $stringToSign[] = "\n"; - $stringToSign[] = $this -> getScope($shortDate); - $stringToSign[] = "\n"; - - $stringToSign[] = hash('sha256', $canonicalstring); - - $dateKey = hash_hmac('sha256', $shortDate, 'AWS4' . $this -> sk, true); - $regionKey = hash_hmac('sha256', $this->region, $dateKey, true); - $serviceKey = hash_hmac('sha256', 's3', $regionKey, true); - $signingKey = hash_hmac('sha256', 'aws4_request', $serviceKey, true); - $signature = hash_hmac('sha256', implode('', $stringToSign), $signingKey); - return $signature; - } - - public function getCanonicalQueryString($pathArgs) - { - $queryStr = ''; - - ksort($pathArgs); - $index = 0; - foreach ($pathArgs as $key => $value){ - $queryStr .= $key . '=' . $value; - if($index++ !== count($pathArgs) - 1){ - $queryStr .= '&'; - } - } - return $queryStr; - } - - public function getCanonicalHeaders($headers) - { - $_headers = []; - foreach ($headers as $key => $value) { - $_headers[strtolower($key)] = $value; - } - ksort($_headers); - - $canonicalHeaderStr = ''; - - foreach ($_headers as $key => $value){ - $value = is_array($value) ? implode(',', $value) : $value; - $canonicalHeaderStr .= $key . ':' . $value; - $canonicalHeaderStr .= "\n"; - } - return $canonicalHeaderStr; - } - - public function getCanonicalURI($bucketName, $objectKey) - { - $uri = ''; - if($this -> pathStyle && $bucketName){ - $uri .= '/' . $bucketName; - } - - if($objectKey){ - $uri .= '/' . $objectKey; - } - - if($uri === ''){ - $uri = '/'; - } - return $uri; - } - - public function makeCanonicalstring($method, $headers, $pathArgs, $bucketName, $objectKey, $signedHeaders=null, $payload=null) - { - $buffer = []; - $buffer[] = $method; - $buffer[] = "\n"; - $buffer[] = $this->getCanonicalURI($bucketName, $objectKey); - $buffer[] = "\n"; - $buffer[] = $this->getCanonicalQueryString($pathArgs); - $buffer[] = "\n"; - $buffer[] = $this->getCanonicalHeaders($headers); - $buffer[] = "\n"; - $buffer[] = $signedHeaders ? $signedHeaders : $this->getSignedHeaders($headers); - $buffer[] = "\n"; - $buffer[] = $payload ? strval($payload) : self::CONTENT_SHA256; - - return implode('', $buffer); - } - - public function getSignedHeaders($headers) - { - $_headers = []; - - foreach ($headers as $key => $value) { - $_headers[] = strtolower($key); - } - - sort($_headers); - - $signedHeaders = ''; - - foreach ($_headers as $key => $value){ - $signedHeaders .= $value; - if($key !== count($_headers) - 1){ - $signedHeaders .= ';'; - } - } - return $signedHeaders; - } - - public function getScope($shortDate) - { - return $shortDate . '/' . $this->region . '/s3/aws4_request'; - } - - public function getCredential($shortDate) - { - return $this->ak . '/' . $this->getScope($shortDate); - } + const CONTENT_SHA256 = 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'; + + protected $region; + + protected $utcTimeZone; + + public function __construct($ak, $sk, $pathStyle, $endpoint, $region, $methodName, $signature, $utcTimeZone, $securityToken = false, $isCname = false) + { + parent::__construct($ak, $sk, $pathStyle, $endpoint, $methodName, $signature, $securityToken, $isCname); + $this->region = $region; + $this->utcTimeZone = $utcTimeZone; + } + + public function doAuth(array &$requestConfig, array &$params, Model $model) + { + $result = $this->prepareAuth($requestConfig, $params, $model); + + $result['headers']['x-amz-content-sha256'] = self::CONTENT_SHA256; + + $bucketName = $result['dnsParam']; + + $result['headers']['Host'] = $result['host']; + + $time = null; + if (array_key_exists('x-amz-date', $result['headers'])) { + $time = $result['headers']['x-amz-date']; + } elseif (array_key_exists('X-Amz-Date', $result['headers'])) { + $time = $result['headers']['X-Amz-Date']; + } else { + // nothing handle + } + $timestamp = $time ? date_create_from_format('Ymd\THis\Z', $time, $this->utcTimeZone)->getTimestamp() + : time(); + + $result['headers']['Date'] = gmdate('D, d M Y H:i:s \G\M\T', $timestamp); + + $longDate = gmdate('Ymd\THis\Z', $timestamp); + $shortDate = substr($longDate, 0, 8); + + $credential = $this->getCredential($shortDate); + + $signedHeaders = $this->getSignedHeaders($result['headers']); + + $canonicalstring = $this->makeCanonicalstring($result['method'], $result['headers'], $result['pathArgs'], $bucketName, $result['uriParam'], $signedHeaders); + + $result['cannonicalRequest'] = $canonicalstring; + + $signature = $this->getSignature($canonicalstring, $longDate, $shortDate); + + $authorization = "AWS4-HMAC-SHA256 Credential={$credential},SignedHeaders={$signedHeaders},Signature={$signature}"; + + $result['headers']['Authorization'] = $authorization; + + return $result; + } + + public function getSignature($canonicalstring, $longDate, $shortDate) + { + $stringToSign = []; + $stringToSign[] = 'AWS4-HMAC-SHA256'; + + $stringToSign[] = "\n"; + + $stringToSign[] = $longDate; + + $stringToSign[] = "\n"; + $stringToSign[] = $this->getScope($shortDate); + $stringToSign[] = "\n"; + + $stringToSign[] = hash('sha256', $canonicalstring); + + $dateKey = hash_hmac('sha256', $shortDate, 'AWS4' . $this->sk, true); + $regionKey = hash_hmac('sha256', $this->region, $dateKey, true); + $serviceKey = hash_hmac('sha256', 's3', $regionKey, true); + $signingKey = hash_hmac('sha256', 'aws4_request', $serviceKey, true); + return hash_hmac('sha256', implode('', $stringToSign), $signingKey); + } + + public function getCanonicalQueryString($pathArgs) + { + $queryStr = ''; + + ksort($pathArgs); + $index = 0; + foreach ($pathArgs as $key => $value) { + $queryStr .= $key . '=' . $value; + if ($index !== count($pathArgs) - 1) { + $queryStr .= '&'; + } + $index++; + } + return $queryStr; + } + + public function getCanonicalHeaders($headers) + { + $headersResult = []; + foreach ($headers as $key => $value) { + $headersResult[strtolower($key)] = $value; + } + ksort($headersResult); + + $canonicalHeaderStr = ''; + + foreach ($headersResult as $key => $value) { + $value = is_array($value) ? implode(',', $value) : $value; + $canonicalHeaderStr .= $key . ':' . $value; + $canonicalHeaderStr .= "\n"; + } + return $canonicalHeaderStr; + } + + public function getCanonicalURI($bucketName, $objectKey) + { + $uri = ''; + if ($this->pathStyle && $bucketName) { + $uri .= '/' . $bucketName; + } + + if ($objectKey) { + $uri .= '/' . $objectKey; + } + + if ($uri === '') { + $uri = '/'; + } + return $uri; + } + + public function makeCanonicalstring($method, $headers, $pathArgs, $bucketName, $objectKey, $signedHeaders = null, $payload = null) + { + $buffer = []; + $buffer[] = $method; + $buffer[] = "\n"; + $buffer[] = $this->getCanonicalURI($bucketName, $objectKey); + $buffer[] = "\n"; + $buffer[] = $this->getCanonicalQueryString($pathArgs); + $buffer[] = "\n"; + $buffer[] = $this->getCanonicalHeaders($headers); + $buffer[] = "\n"; + $buffer[] = $signedHeaders ? $signedHeaders : $this->getSignedHeaders($headers); + $buffer[] = "\n"; + $buffer[] = $payload ? strval($payload) : self::CONTENT_SHA256; + + return implode('', $buffer); + } + + public function getSignedHeaders($headers) + { + $headersResult = []; + + foreach ($headers as $key => $value) { + $headersResult[] = strtolower($key); + } + + sort($headersResult); + + $signedHeaders = ''; + + foreach ($headersResult as $key => $value) { + $signedHeaders .= $value; + if ($key !== count($headersResult) - 1) { + $signedHeaders .= ';'; + } + } + return $signedHeaders; + } + + public function getScope($shortDate) + { + return $shortDate . '/' . $this->region . '/s3/aws4_request'; + } + + public function getCredential($shortDate) + { + return $this->ak . '/' . $this->getScope($shortDate); + } } diff --git a/Obs/Log/ObsConfig.php b/Obs/Log/ObsConfig.php index aea8213..c81e5a4 100644 --- a/Obs/Log/ObsConfig.php +++ b/Obs/Log/ObsConfig.php @@ -19,10 +19,10 @@ class ObsConfig { - const LOG_FILE_CONFIG = [ - 'FilePath'=>'./logs', - 'FileName'=>'eSDK-OBS-PHP.log', - 'MaxFiles'=>10, - 'Level'=>INFO - ]; + const LOG_FILE_CONFIG = [ + 'FilePath' => './logs', + 'FileName' => 'eSDK-OBS-PHP.log', + 'MaxFiles' => 10, + 'Level' => INFO, + ]; } diff --git a/Obs/Log/ObsLog.php b/Obs/Log/ObsLog.php index 7cc8c5d..97b25f6 100644 --- a/Obs/Log/ObsLog.php +++ b/Obs/Log/ObsLog.php @@ -23,104 +23,105 @@ class ObsLog extends Logger { - public static $log = null; - - protected $log_path = './'; - protected $log_name = null; - protected $log_level = Logger::DEBUG; - protected $log_maxFiles = 0; - - private $formatter = null; - private $handler = null; - private $filepath = ''; - - public static function initLog($logConfig= []) - { - $s3log = new ObsLog(''); - $s3log->setConfig($logConfig); - $s3log->cheakDir(); - $s3log->setFilePath(); - $s3log->setFormat(); - $s3log->setHande(); - } - private function setFormat() - { - $output = '[%datetime%][%level_name%]'.'%message%' . "\n"; - $this->formatter = new LineFormatter($output); - - } - private function setHande() - { - self::$log = new Logger('obs_logger'); - $rotating = new RotatingFileHandler($this->filepath, $this->log_maxFiles, $this->log_level); - $rotating->setFormatter($this->formatter); - self::$log->pushHandler($rotating); - } - private function setConfig($logConfig= []) - { - $arr = empty($logConfig) ? ObsConfig::LOG_FILE_CONFIG : $logConfig; - $this->log_path = iconv('UTF-8', 'GBK',$arr['FilePath']); - $this->log_name = iconv('UTF-8', 'GBK',$arr['FileName']); - $this->log_maxFiles = is_numeric($arr['MaxFiles']) ? 0 : intval($arr['MaxFiles']); - $this->log_level = $arr['Level']; - } - private function cheakDir() - { - if (!is_dir($this->log_path)){ - mkdir($this->log_path, 0755, true); - } - } - private function setFilePath() - { - $this->filepath = $this->log_path.'/'.$this->log_name; - } - private static function writeLog($level, $msg) - { - switch ($level) { - case DEBUG: - self::$log->debug($msg); - break; - case INFO: - self::$log->info($msg); - break; - case NOTICE: - self::$log->notice($msg); - break; - case WARNING: - self::$log->warning($msg); - break; - case ERROR: - self::$log->error($msg); - break; - case CRITICAL: - self::$log->critical($msg); - break; - case ALERT: - self::$log->alert($msg); - break; - case EMERGENCY: - self::$log->emergency($msg); - break; - default: - break; - } - - } - - public static function commonLog($level, $format, $args1 = null, $arg2 = null) - { - if(ObsLog::$log){ - if ($args1 === null && $arg2 === null) { - $msg = urldecode($format); - } else { - $msg = sprintf($format, $args1, $arg2); - } - $back = debug_backtrace(); - $line = $back[0]['line']; - $funcname = $back[1]['function']; - $filename = basename($back[0]['file']); - $message = '['.$filename.':'.$line.']: '.$msg; - ObsLog::writeLog($level, $message); - } - } + public static $log = null; + protected $logPath = './'; + protected $logName = null; + protected $logLevel = Logger::DEBUG; + protected $logMaxFiles = 0; + + private $formatter = null; + private $filepath = ''; + + public static function initLog($logConfig = []) + { + $s3log = new ObsLog(''); + $s3log->setConfig($logConfig); + $s3log->cheakDir(); + $s3log->setFilePath(); + $s3log->setFormat(); + $s3log->setHande(); + } + + private function setFormat() + { + $output = "[%datetime%][%level_name%]%message%\n"; + $this->formatter = new LineFormatter($output); + } + + private function setHande() + { + static::$log = new Logger('obs_logger'); + $rotating = new RotatingFileHandler($this->filepath, $this->logMaxFiles, $this->logLevel); + $rotating->setFormatter($this->formatter); + static::$log->pushHandler($rotating); + } + + private function setConfig($logConfig = []) + { + $arr = empty($logConfig) ? ObsConfig::LOG_FILE_CONFIG : $logConfig; + $this->logPath = iconv('UTF-8', 'GBK', $arr['FilePath']); + $this->logName = iconv('UTF-8', 'GBK', $arr['FileName']); + $this->logMaxFiles = is_numeric($arr['MaxFiles']) ? 0 : intval($arr['MaxFiles']); + $this->logLevel = $arr['Level']; + } + + private function cheakDir() + { + if (!is_dir($this->logPath)) { + mkdir($this->logPath, 0755, true); + } + } + + private function setFilePath() + { + $this->filepath = $this->logPath . '/' . $this->logName; + } + + private static function writeLog($level, $msg) + { + switch ($level) { + case DEBUG: + static::$log->debug($msg); + break; + case INFO: + static::$log->info($msg); + break; + case NOTICE: + static::$log->notice($msg); + break; + case WARNING: + static::$log->warning($msg); + break; + case ERROR: + static::$log->error($msg); + break; + case CRITICAL: + static::$log->critical($msg); + break; + case ALERT: + static::$log->alert($msg); + break; + case EMERGENCY: + static::$log->emergency($msg); + break; + default: + break; + } + } + + public static function commonLog($level, $format, $args1 = null, $arg2 = null) + { + if (ObsLog::$log) { + if ($args1 === null && $arg2 === null) { + $msg = urldecode($format); + } else { + $msg = sprintf($format, $args1, $arg2); + } + $back = debug_backtrace(); + $line = $back[0]['line']; + $filename = basename($back[0]['file']); + $message = '[' . $filename . ':' . $line . ']: ' . $msg; + ObsLog::writeLog($level, $message); + } + } } diff --git a/Obs/ObsClient.php b/Obs/ObsClient.php index 41dc4bd..a7ed264 100644 --- a/Obs/ObsClient.php +++ b/Obs/ObsClient.php @@ -28,8 +28,6 @@ use GuzzleHttp\Handler\CurlMultiHandler; use GuzzleHttp\Handler\Proxy; use GuzzleHttp\Promise\Promise; -use Obs\Internal\Resource\Constants; - define('DEBUG', Logger::DEBUG); define('INFO', Logger::INFO); @@ -79,6 +77,9 @@ * @method Model getBucketNotification(array $args = []); * @method Model setBucketTagging(array $args = []); * @method Model getBucketTagging(array $args = []); + * @method Model setBucketCustomDomain(array $args = []); + * @method Model getBucketCustomDomain(array $args = []); + * @method Model deleteBucketCustomDomain(array $args = []); * @method Model deleteBucketTagging(array $args = []); * @method Model optionsBucket(array $args = []); * @method Model getFetchPolicy(array $args = []); @@ -89,6 +90,9 @@ * * @method Model putObject(array $args = []); * @method Model getObject(array $args = []); + * @method Model setObjectTagging(array $args = []); + * @method Model deleteObjectTagging(array $args = []); + * @method Model getObjectTagging(array $args = []); * @method Model copyObject(array $args = []); * @method Model deleteObject(array $args = []); * @method Model deleteObjects(array $args = []); @@ -104,7 +108,7 @@ * @method Model listMultipartUploads(array $args = []); * @method Model optionsObject(array $args = []); * @method Model restoreObject(array $args = []); - * + * * @method Promise createBucketAsync(array $args = [], callable $callback); * @method Promise listBucketsAsync(callable $callback); * @method Promise deleteBucketAsync(array $args = [], callable $callback); @@ -140,11 +144,17 @@ * @method Promise getBucketNotificationAsync(array $args = [], callable $callback); * @method Promise setBucketTaggingAsync(array $args = [], callable $callback); * @method Promise getBucketTaggingAsync(array $args = [], callable $callback); + * @method Promise setBucketCustomDomainAsync(array $args = [], callable $callback); + * @method Promise getBucketCustomDomainAsync(array $args = [], callable $callback); + * @method Promise deleteBucketCustomDomainAsync(array $args = [], callable $callback); * @method Promise deleteBucketTaggingAsync(array $args = [], callable $callback); * @method Promise optionsBucketAsync(array $args = [], callable $callback); - * + * * @method Promise putObjectAsync(array $args = [], callable $callback); * @method Promise getObjectAsync(array $args = [], callable $callback); + * @method Promise setObjectTaggingAsync(array $args = [], callable $callback); + * @method Promise deleteObjectTaggingAsync(array $args = [], callable $callback); + * @method Promise getObjectTaggingAsync(array $args = [], callable $callback); * @method Promise copyObjectAsync(array $args = [], callable $callback); * @method Promise deleteObjectAsync(array $args = [], callable $callback); * @method Promise deleteObjectsAsync(array $args = [], callable $callback); @@ -160,256 +170,272 @@ * @method Promise listMultipartUploadsAsync(array $args = [], callable $callback); * @method Promise optionsObjectAsync(array $args = [], callable $callback); * @method Promise restoreObjectAsync(array $args = [], callable $callback); - * @method Model getFetchPolicyAsync(array $args = [], callable $callback); - * @method Model setFetchPolicyAsync(array $args = [], callable $callback); - * @method Model deleteFetchPolicyAsync(array $args = [], callable $callback); - * @method Model setFetchJobAsync(array $args = [], callable $callback); - * @method Model getFetchJobAsync(array $args = [], callable $callback); - * + * @method Promise getFetchPolicyAsync(array $args = [], callable $callback); + * @method Promise setFetchPolicyAsync(array $args = [], callable $callback); + * @method Promise deleteFetchPolicyAsync(array $args = [], callable $callback); + * @method Promise setFetchJobAsync(array $args = [], callable $callback); + * @method Promise getFetchJobAsync(array $args = [], callable $callback); + * */ class ObsClient { - - const SDK_VERSION = '3.21.9'; - - const AclPrivate = 'private'; - const AclPublicRead = 'public-read'; - const AclPublicReadWrite = 'public-read-write'; - const AclPublicReadDelivered = 'public-read-delivered'; - const AclPublicReadWriteDelivered = 'public-read-write-delivered'; - - const AclAuthenticatedRead = 'authenticated-read'; - const AclBucketOwnerRead = 'bucket-owner-read'; - const AclBucketOwnerFullControl = 'bucket-owner-full-control'; - const AclLogDeliveryWrite = 'log-delivery-write'; - - const StorageClassStandard = 'STANDARD'; - const StorageClassWarm = 'WARM'; - const StorageClassCold = 'COLD'; - - const PermissionRead = 'READ'; - const PermissionWrite = 'WRITE'; - const PermissionReadAcp = 'READ_ACP'; - const PermissionWriteAcp = 'WRITE_ACP'; - const PermissionFullControl = 'FULL_CONTROL'; - - const AllUsers = 'Everyone'; - - const GroupAllUsers = 'AllUsers'; - const GroupAuthenticatedUsers = 'AuthenticatedUsers'; - const GroupLogDelivery = 'LogDelivery'; - - const RestoreTierExpedited = 'Expedited'; - const RestoreTierStandard = 'Standard'; - const RestoreTierBulk = 'Bulk'; - - const GranteeGroup = 'Group'; - const GranteeUser = 'CanonicalUser'; - - const CopyMetadata = 'COPY'; - const ReplaceMetadata = 'REPLACE'; - - const SignatureV2 = 'v2'; - const SignatureV4 = 'v4'; - const SigantureObs = 'obs'; - - const ObjectCreatedAll = 'ObjectCreated:*'; - const ObjectCreatedPut = 'ObjectCreated:Put'; - const ObjectCreatedPost = 'ObjectCreated:Post'; - const ObjectCreatedCopy = 'ObjectCreated:Copy'; - const ObjectCreatedCompleteMultipartUpload = 'ObjectCreated:CompleteMultipartUpload'; - const ObjectRemovedAll = 'ObjectRemoved:*'; - const ObjectRemovedDelete = 'ObjectRemoved:Delete'; - const ObjectRemovedDeleteMarkerCreated = 'ObjectRemoved:DeleteMarkerCreated'; - - use Internal\SendRequestTrait; - use Internal\GetResponseTrait; - - private $factorys; - - public function __construct(array $config = []){ - $this ->factorys = []; - - $this -> ak = strval($config['key']); - $this -> sk = strval($config['secret']); - - if(isset($config['security_token'])){ - $this -> securityToken = strval($config['security_token']); - } - - if(isset($config['endpoint'])){ - $this -> endpoint = trim(strval($config['endpoint'])); - } - - if($this -> endpoint === ''){ - throw new \RuntimeException('endpoint is not set'); - } - - while($this -> endpoint[strlen($this -> endpoint)-1] === '/'){ - $this -> endpoint = substr($this -> endpoint, 0, strlen($this -> endpoint)-1); - } - - if(strpos($this-> endpoint, 'http') !== 0){ - $this -> endpoint = 'https://' . $this -> endpoint; - } - - if(isset($config['signature'])){ - $this -> signature = strval($config['signature']); - } - - if(isset($config['path_style'])){ - $this -> pathStyle = $config['path_style']; - } - - if(isset($config['region'])){ - $this -> region = strval($config['region']); - } - - if(isset($config['ssl_verify'])){ - $this -> sslVerify = $config['ssl_verify']; - }else if(isset($config['ssl.certificate_authority'])){ - $this -> sslVerify = $config['ssl.certificate_authority']; - } - - if(isset($config['max_retry_count'])){ - $this -> maxRetryCount = intval($config['max_retry_count']); - } - - if(isset($config['timeout'])){ - $this -> timeout = intval($config['timeout']); - } - - if(isset($config['socket_timeout'])){ - $this -> socketTimeout = intval($config['socket_timeout']); - } - - if(isset($config['connect_timeout'])){ - $this -> connectTimeout = intval($config['connect_timeout']); - } - - if(isset($config['chunk_size'])){ - $this -> chunkSize = intval($config['chunk_size']); - } - - if(isset($config['exception_response_mode'])){ - $this -> exceptionResponseMode = $config['exception_response_mode']; - } - - if (isset($config['is_cname'])) { - $this -> isCname = $config['is_cname']; + + const SDK_VERSION = '3.23.10'; + + const AclPrivate = 'private'; + const AclPublicRead = 'public-read'; + const AclPublicReadWrite = 'public-read-write'; + const AclPublicReadDelivered = 'public-read-delivered'; + const AclPublicReadWriteDelivered = 'public-read-write-delivered'; + + const AclAuthenticatedRead = 'authenticated-read'; + const AclBucketOwnerRead = 'bucket-owner-read'; + const AclBucketOwnerFullControl = 'bucket-owner-full-control'; + const AclLogDeliveryWrite = 'log-delivery-write'; + + const StorageClassStandard = 'STANDARD'; + const StorageClassWarm = 'WARM'; + const StorageClassCold = 'COLD'; + + const PermissionRead = 'READ'; + const PermissionWrite = 'WRITE'; + const PermissionReadAcp = 'READ_ACP'; + const PermissionWriteAcp = 'WRITE_ACP'; + const PermissionFullControl = 'FULL_CONTROL'; + + const AllUsers = 'Everyone'; + + const GroupAllUsers = 'AllUsers'; + const GroupAuthenticatedUsers = 'AuthenticatedUsers'; + const GroupLogDelivery = 'LogDelivery'; + + const RestoreTierExpedited = 'Expedited'; + const RestoreTierStandard = 'Standard'; + const RestoreTierBulk = 'Bulk'; + + const GranteeGroup = 'Group'; + const GranteeUser = 'CanonicalUser'; + + const CopyMetadata = 'COPY'; + const ReplaceMetadata = 'REPLACE'; + + const SignatureV2 = 'v2'; + const SignatureV4 = 'v4'; + const SigantureObs = 'obs'; + + const ObjectCreatedAll = 'ObjectCreated:*'; + const ObjectCreatedPut = 'ObjectCreated:Put'; + const ObjectCreatedPost = 'ObjectCreated:Post'; + const ObjectCreatedCopy = 'ObjectCreated:Copy'; + const ObjectCreatedCompleteMultipartUpload = 'ObjectCreated:CompleteMultipartUpload'; + const ObjectRemovedAll = 'ObjectRemoved:*'; + const ObjectRemovedDelete = 'ObjectRemoved:Delete'; + const ObjectRemovedDeleteMarkerCreated = 'ObjectRemoved:DeleteMarkerCreated'; + + use Internal\SendRequestTrait; + use Internal\GetResponseTrait; + + private $factorys; + + public function __construct(array $config = []) + { + $this->factorys = []; + + $this->ak = strval($config['key']); + $this->sk = strval($config['secret']); + + if (isset($config['security_token'])) { + $this->securityToken = strval($config['security_token']); + } + + if (isset($config['endpoint'])) { + $this->endpoint = trim(strval($config['endpoint'])); + } + + if ($this->endpoint === '') { + throw new \InvalidArgumentException('endpoint is not set'); + } + + while ($this->endpoint[strlen($this->endpoint) - 1] === '/') { + $this->endpoint = substr($this->endpoint, 0, strlen($this->endpoint) - 1); + } + + if (strpos($this->endpoint, 'http') !== 0) { + $this->endpoint = 'https://' . $this->endpoint; + } + + if (isset($config['signature'])) { + $this->signature = strval($config['signature']); + } + + if (isset($config['path_style'])) { + $this->pathStyle = $config['path_style']; + } + + if (isset($config['region'])) { + $this->region = strval($config['region']); + } + + if (isset($config['ssl_verify'])) { + $this->sslVerify = $config['ssl_verify']; + } elseif (isset($config['ssl.certificate_authority'])) { + $this->sslVerify = $config['ssl.certificate_authority']; + } else { + // nothing handle + } + + if (isset($config['max_retry_count'])) { + $this->maxRetryCount = intval($config['max_retry_count']); + } + + if (isset($config['timeout'])) { + $this->timeout = intval($config['timeout']); + } + + if (isset($config['socket_timeout'])) { + $this->socketTimeout = intval($config['socket_timeout']); + } + + if (isset($config['connect_timeout'])) { + $this->connectTimeout = intval($config['connect_timeout']); + } + + if (isset($config['chunk_size'])) { + $this->chunkSize = intval($config['chunk_size']); + } + + if (isset($config['exception_response_mode'])) { + $this->exceptionResponseMode = $config['exception_response_mode']; + } + + if (isset($config['is_cname'])) { + $this->isCname = $config['is_cname']; + } + + $host = parse_url($this->endpoint)['host']; + if (filter_var($host, FILTER_VALIDATE_IP) !== false) { + $this->pathStyle = true; + } + + $handler = self::chooseHandler($this); + + $this->httpClient = self::createHttpClient($handler); + } + + private function createHttpClient($handler) + { + return new Client( + [ + 'timeout' => 0, + 'read_timeout' => $this->socketTimeout, + 'connect_timeout' => $this->connectTimeout, + 'allow_redirects' => false, + 'verify' => $this->sslVerify, + 'expect' => false, + 'handler' => HandlerStack::create($handler), + 'curl' => [ + CURLOPT_BUFFERSIZE => $this->chunkSize, + ], + ] + ); + } + public function __destruct() + { + $this->close(); + } + + public function refresh($key, $secret, $securityToken = false) + { + $this->ak = strval($key); + $this->sk = strval($secret); + if ($securityToken) { + $this->securityToken = strval($securityToken); + } + } + + /** + * Get the default User-Agent string to use with Guzzle + * + * @return string + */ + public static function getDefaultUserAgent() + { + static $defaultAgent = ''; + if (!$defaultAgent) { + $defaultAgent = 'obs-sdk-php/' . self::SDK_VERSION; + } + + return $defaultAgent; + } + + /** + * Factory method to create a new Obs client using an array of configuration options. + * + * @param array $config Client configuration data + * + * @return ObsClient + */ + public static function factory(array $config = []) + { + return new ObsClient($config); + } + + public function close() + { + if ($this->factorys) { + foreach ($this->factorys as $factory) { + $factory->close(); + } } - - $host = parse_url($this -> endpoint)['host']; - if(filter_var($host, FILTER_VALIDATE_IP) !== false) { - $this -> pathStyle = true; - } - - $handler = self::choose_handler($this); - - $this -> httpClient = new Client( - [ - 'timeout' => 0, - 'read_timeout' => $this -> socketTimeout, - 'connect_timeout' => $this -> connectTimeout, - 'allow_redirects' => false, - 'verify' => $this -> sslVerify, - 'expect' => false, - 'handler' => HandlerStack::create($handler), - 'curl' => [ - CURLOPT_BUFFERSIZE => $this -> chunkSize - ] - ] - ); - - } - - public function __destruct(){ - $this-> close(); - } - - public function refresh($key, $secret, $security_token=false){ - $this -> ak = strval($key); - $this -> sk = strval($secret); - if($security_token){ - $this -> securityToken = strval($security_token); - } - } - - /** - * Get the default User-Agent string to use with Guzzle - * - * @return string - */ - private static function default_user_agent() - { - static $defaultAgent = ''; - if (!$defaultAgent) { - $defaultAgent = 'obs-sdk-php/' . self::SDK_VERSION; - } - - return $defaultAgent; - } - - /** - * Factory method to create a new Obs client using an array of configuration options. - * - * @param array $config Client configuration data - * - * @return ObsClient - */ - public static function factory(array $config = []) - { - return new ObsClient($config); - } - - public function close(){ - if($this->factorys){ - foreach ($this->factorys as $factory){ - $factory->close(); - } - } - } - - public function initLog(array $logConfig= []) - { - ObsLog::initLog($logConfig); - - $msg = []; - $msg[] = '[OBS SDK Version=' . self::SDK_VERSION; - $msg[] = 'Endpoint=' . $this->endpoint; - $msg[] = 'Access Mode=' . ($this->pathStyle ? 'Path' : 'Virtual Hosting').']'; - - ObsLog::commonLog(WARNING, implode("];[", $msg)); - } - - private static function choose_handler($obsclient) - { - $handler = null; - if (function_exists('curl_multi_exec') && function_exists('curl_exec')) { - $f1 = new SdkCurlFactory(50); - $f2 = new SdkCurlFactory(3); - $obsclient->factorys[] = $f1; - $obsclient->factorys[] = $f2; - $handler = Proxy::wrapSync(new CurlMultiHandler(['handle_factory' => $f1]), new CurlHandler(['handle_factory' => $f2])); - } elseif (function_exists('curl_exec')) { - $f = new SdkCurlFactory(3); - $obsclient->factorys[] = $f; - $handler = new CurlHandler(['handle_factory' => $f]); - } elseif (function_exists('curl_multi_exec')) { - $f = new SdkCurlFactory(50); - $obsclient->factorys[] = $f; - $handler = new CurlMultiHandler(['handle_factory' => $f]); - } - - if (ini_get('allow_url_fopen')) { - $handler = $handler - ? Proxy::wrapStreaming($handler, new SdkStreamHandler()) - : new SdkStreamHandler(); - } elseif (!$handler) { - throw new \RuntimeException('GuzzleHttp requires cURL, the ' - . 'allow_url_fopen ini setting, or a custom HTTP handler.'); - } - - return $handler; - } + } + + public function initLog(array $logConfig = []) + { + ObsLog::initLog($logConfig); + + $msg = []; + $msg[] = '[OBS SDK Version=' . self::SDK_VERSION; + $msg[] = 'Endpoint=' . $this->endpoint; + $msg[] = 'Access Mode=' . ($this->pathStyle ? 'Path' : 'Virtual Hosting') . ']'; + + ObsLog::commonLog(WARNING, implode("];[", $msg)); + } + + private static function chooseHandler($obsclient) + { + $handler = null; + if (function_exists('curl_multi_exec') && function_exists('curl_exec')) { + $f1 = new SdkCurlFactory(50); + $f2 = new SdkCurlFactory(3); + $obsclient->factorys[] = $f1; + $obsclient->factorys[] = $f2; + $handler = Proxy::wrapSync( + new CurlMultiHandler(['handle_factory' => $f1]), + new CurlHandler(['handle_factory' => $f2]) + ); + } elseif (function_exists('curl_exec')) { + $f = new SdkCurlFactory(3); + $obsclient->factorys[] = $f; + $handler = new CurlHandler(['handle_factory' => $f]); + } elseif (function_exists('curl_multi_exec')) { + $f = new SdkCurlFactory(50); + $obsclient->factorys[] = $f; + $handler = new CurlMultiHandler(['handle_factory' => $f]); + } else { + // nothing handle + } + + if (ini_get('allow_url_fopen')) { + $handler = $handler + ? Proxy::wrapStreaming($handler, new SdkStreamHandler()) + : new SdkStreamHandler(); + } elseif (!$handler) { + throw new \UnexpectedValueException( + 'GuzzleHttp requires cURL, the allow_url_fopen ini setting, or a custom HTTP handler.'); + } else { + // nothing handle + } + + return $handler; + } } diff --git a/Obs/ObsException.php b/Obs/ObsException.php index 29d555e..71a04dc 100644 --- a/Obs/ObsException.php +++ b/Obs/ObsException.php @@ -23,10 +23,10 @@ class ObsException extends \RuntimeException { - const CLIENT = 'client'; - - const SERVER = 'server'; - + const CLIENT = 'client'; + + const SERVER = 'server'; + private $response; private $request; @@ -34,18 +34,18 @@ class ObsException extends \RuntimeException private $requestId; private $exceptionType; - + private $exceptionCode; - + private $exceptionMessage; - + private $hostId; - - public function __construct ($message = null, $code = null, $previous = null) + + public function __construct($message = null, $code = null, $previous = null) { - parent::__construct($message, $code, $previous); + parent::__construct($message, $code, $previous); } - + public function setExceptionCode($exceptionCode) { $this->exceptionCode = $exceptionCode; @@ -55,15 +55,15 @@ public function getExceptionCode() { return $this->exceptionCode; } - + public function setExceptionMessage($exceptionMessage) { $this->exceptionMessage = $exceptionMessage; } - + public function getExceptionMessage() { - return $this->exceptionMessage ? $this->exceptionMessage : $this->message; + return $this->exceptionMessage ? $this->exceptionMessage : $this->message; } public function setExceptionType($exceptionType) @@ -110,31 +110,38 @@ public function getStatusCode() { return $this->response ? $this->response->getStatusCode() : -1; } - - public function setHostId($hostId){ - $this->hostId = $hostId; + + public function setHostId($hostId) + { + $this->hostId = $hostId; } - - public function getHostId(){ - return $this->hostId; + + public function getHostId() + { + return $this->hostId; } public function __toString() { - $message = get_class($this) . ': ' - . 'OBS Error Code: ' . $this->getExceptionCode() . ', ' - . 'Status Code: ' . $this->getStatusCode() . ', ' - . 'OBS Error Type: ' . $this->getExceptionType() . ', ' - . 'OBS Error Message: ' . ($this->getExceptionMessage() ? $this->getExceptionMessage():$this->getMessage()); - + $className = get_class($this); + $statusCode = $this->getStatusCode(); + + $errCodeMsg = "OBS Error Code: {$statusCode}"; + $statusCodeMsg = "Status Code: {$this->getStatusCode()}"; + $errTypeMsg = "OBS Error Type: {$this->getExceptionType()}"; + $errMsg = $this->getExceptionMessage() ? $this->getExceptionMessage() : $this->getMessage(); + $newErrMsg = "OBS Error Message: {$errMsg}"; + $message = "{$className}: {$errCodeMsg}, {$statusCodeMsg}, {$errTypeMsg}, $newErrMsg"; // Add the User-Agent if available if ($this->request) { - $message .= ', ' . 'User-Agent: ' . $this->request->getHeaderLine('User-Agent'); + $message = "{$message}, 'User-Agent: {$this->request->getHeaderLine('User-Agent')}"; } $message .= "\n"; - - ObsLog::commonLog(INFO, "http request:status:%d, %s",$this->getStatusCode(),"code:".$this->getExceptionCode().", message:".$this->getMessage()); + + ObsLog::commonLog(INFO, + "http request:status:%d, %s", + $statusCode, "code:{$this->getExceptionCode()}, message:{$errMsg}"); + return $message; } - } diff --git a/README.md b/README.md index b147897..4c41f04 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,14 @@ +Version 3.23.9 + +新特性: +1. 新增对象标签相关接口; + +资料&demo: + +修复问题: +1. 优化部分代码; + +---- Version 3.23.5 新特性: diff --git a/composer.json b/composer.json index 68da5be..226039d 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name" : "obs/esdk-obs-php", "description" : "OBS PHP SDK", "license":"Apache-2.0", - "version":"3.23.5", + "version":"3.23.11", "require" : { "php" : ">=5.6.0", "guzzlehttp/guzzle" : "^6.3.0 || ^7.0",