diff --git a/niucloud/composer.json b/niucloud/composer.json index 7bb3cfcd2..84f5d32f6 100644 --- a/niucloud/composer.json +++ b/niucloud/composer.json @@ -58,7 +58,8 @@ "workerman/workerman": "v4.1.15", "workerman/redis-queue": "v1.2.0", "workerman/crontab": "v1.0.6", - "hyperf/pimple": "~2.2.0" + "hyperf/pimple": "~2.2.0", + "365taofang/huaweicloud-sdk-php-obs": "^3.23" }, "require-dev": { "symfony/var-dumper": "v6.0.19", diff --git a/niucloud/composer.lock b/niucloud/composer.lock index f3030a57c..324dd5e00 100644 --- a/niucloud/composer.lock +++ b/niucloud/composer.lock @@ -4,8 +4,56 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "6560fc4ccaa22130b5147f28adec811d", + "content-hash": "58d9753b0d3af0e968c66bbe65ae92ed", "packages": [ + { + "name": "365taofang/huaweicloud-sdk-php-obs", + "version": "3.23.501", + "source": { + "type": "git", + "url": "https://github.com/365taofang/huaweicloud-sdk-php-obs.git", + "reference": "85448144b10d26c1b4c15388a2ea11a76e41a1b5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/365taofang/huaweicloud-sdk-php-obs/zipball/85448144b10d26c1b4c15388a2ea11a76e41a1b5", + "reference": "85448144b10d26c1b4c15388a2ea11a76e41a1b5", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "guzzlehttp/guzzle": "^6.3.0 || ^7.0", + "guzzlehttp/psr7": "^1.4.2 || ^2.0", + "monolog/monolog": "^1.23.0 || ^2.0", + "php": ">=5.6.0", + "psr/http-message": "^1.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Obs\\": "Obs/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "OBS PHP SDK", + "keywords": [ + "OBS", + "php" + ], + "support": { + "issues": "https://github.com/365taofang/huaweicloud-sdk-php-obs/issues", + "source": "https://github.com/365taofang/huaweicloud-sdk-php-obs/tree/v3.23.501" + }, + "time": "2023-09-15T00:55:23+00:00" + }, { "name": "adbario/php-dot-notation", "version": "2.5.0", diff --git a/niucloud/route/app.php b/niucloud/route/app.php index a2588ecf3..c23d60478 100644 --- a/niucloud/route/app.php +++ b/niucloud/route/app.php @@ -46,7 +46,6 @@ Route::any('wap//MP_verify_.txt', function ($name) { echo $name;exit(); }); - // 手机端 Route::rule('wap', function () { return view(app()->getRootPath() . 'public/wap/index.html'); @@ -56,3 +55,12 @@ Route::rule('web', function () { return view(app()->getRootPath() . 'public/web/index.html'); })->pattern(['any' => '\w+']); +// 加载插件的route +$addon_dir = root_path() . 'addon'; +$addons = array_diff(scandir($addon_dir), ['.', '..']); +foreach ($addons as $addon) { + $route = $addon_dir . DIRECTORY_SEPARATOR . $addon . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'route.php'; + if (file_exists($route)) { + include $route; + } +} diff --git a/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/.gitignore b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/.gitignore new file mode 100644 index 000000000..8f2077f70 --- /dev/null +++ b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/.gitignore @@ -0,0 +1,3 @@ +.idea +vendor/ +composer.lock \ No newline at end of file diff --git a/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Help on License b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Help on License new file mode 100644 index 000000000..1e4325ba9 --- /dev/null +++ b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Help on License @@ -0,0 +1,35 @@ +This help guides Huawei engineers to add or modify the license announcement +during the development. + +In the case that you add a new file, the text below should be added in the head. + Copyright 2019 Huawei Technologies Co.,Ltd. + + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software distributed + under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. See the License for the + specific language governing permissions and limitations under the License. + + +In the case that you modify one existing file, the text below should be added after +the exiting license. + Huawei has modified this source file. + + Copyright 2019 Huawei Technologies Co., Ltd. + + Licensed under the Apache License, Version 2.0 (the "License"); you may not + use this file except in compliance with the License. You may obtain a copy of + the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + License for the specific language governing permissions and limitations under + the License. diff --git a/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/LICENSE b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/LICENSE new file mode 100644 index 000000000..4cd54f94e --- /dev/null +++ b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2019 Huawei Technologies Co., Ltd. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Notice.MD b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Notice.MD new file mode 100644 index 000000000..8a8943514 --- /dev/null +++ b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Notice.MD @@ -0,0 +1,39 @@ +OPEN SOURCE SOFTWARE NOTICE + +Please note we provide an open source software notice along with this product and/or this product firmware (in the following just “this product”). The open source software licenses are granted by the respective right holders. And the open source licenses prevail all other license information with regard to the respective open source software contained in the product, including but not limited to End User Software Licensing Agreement. This notice is provided on behalf of Huawei Technologies Co. Ltd. and any of its local subsidiaries which may have provided this product to you in your local country. + +Warranty Disclaimer +THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. + +Copyright Notice and License Texts + +Software: guzzle 6.3.3 +Copyright notice: + +Copyright (c) 2011-2018 Michael Dowling, https://github.com/mtdowling + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + +License: +MIT License + + + + diff --git a/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/Common/CheckoutStream.php b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/Common/CheckoutStream.php new file mode 100644 index 000000000..6fbeebbb9 --- /dev/null +++ b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/Common/CheckoutStream.php @@ -0,0 +1,63 @@ +stream = $stream; + $this->expectedLength = $expectedLength; + } + + public function getContents() { + $contents = $this->stream->getContents(); + $length = strlen($contents); + if ($this->expectedLength !== null && floatval($length) !== $this->expectedLength) { + $this -> throwObsException($this->expectedLength, $length); + } + return $contents; + } + + 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); + } + } + } + return $string; + } + + 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/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/Common/ITransform.php b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/Common/ITransform.php new file mode 100644 index 000000000..a0c369c32 --- /dev/null +++ b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/Common/ITransform.php @@ -0,0 +1,23 @@ + + + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +namespace Obs\Internal\Common; + +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"; + } +} diff --git a/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/Common/ObsTransform.php b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/Common/ObsTransform.php new file mode 100644 index 000000000..03d42b69f --- /dev/null +++ b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/Common/ObsTransform.php @@ -0,0 +1,78 @@ +transAclHeader($para); + } else if ($sign === 'aclUri') { + $para = $this->transAclGroupUri($para); + } else if ($sign == 'event') { + $para = $this->transNotificationEvent($para); + } else if ($sign == 'storageClass') { + $para = $this->transStorageClass($para); + } + return $para; + } + + 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) { + if ($para === ObsClient::GroupAllUsers) { + $para = ObsClient::AllUsers; + } + return $para; + } + + private function transNotificationEvent($para) { + $pos = strpos($para, 's3:'); + if ($pos !== false && $pos === 0) { + $para = substr($para, 3); + } + return $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; + } +} + diff --git a/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/Common/SchemaFormatter.php b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/Common/SchemaFormatter.php new file mode 100644 index 000000000..46b896b14 --- /dev/null +++ b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/Common/SchemaFormatter.php @@ -0,0 +1,116 @@ + format('Y-m-d\T00:00:00\Z'); + } + return null; + } + + public static function formatDateTime($value) + { + return self::dateFormatter($value, 'Y-m-d\TH:i:s\Z'); + } + + public static function formatDateTimeHttp($value) + { + return self::dateFormatter($value, 'D, d M Y H:i:s \G\M\T'); + } + + public static function formatDate($value) + { + return self::dateFormatter($value, 'Y-m-d'); + } + + public static function formatTime($value) + { + return self::dateFormatter($value, 'H:i:s'); + } + + public static function formatBooleanAsString($value) + { + return filter_var($value, FILTER_VALIDATE_BOOLEAN) ? 'true' : 'false'; + } + + public static function formatTimestamp($value) + { + return (int) self::dateFormatter($value, 'U'); + } + + private static function dateFormatter($dt, $fmt) + { + if (is_numeric($dt)) { + return gmdate($fmt, (int) $dt); + } + + if (is_string($dt)) { + $dt = new \DateTime($dt); + } + + if ($dt instanceof \DateTime) { + if (!self::$utcTimeZone) { + self::$utcTimeZone = new \DateTimeZone('UTC'); + } + + return $dt->setTimezone(self::$utcTimeZone)->format($fmt); + } + + return null; + } +} diff --git a/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/Common/SdkCurlFactory.php b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/Common/SdkCurlFactory.php new file mode 100644 index 000000000..af563618a --- /dev/null +++ b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/Common/SdkCurlFactory.php @@ -0,0 +1,430 @@ + + + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +namespace Obs\Internal\Common; + +use GuzzleHttp\Psr7; +use GuzzleHttp\Psr7\LazyOpenStream; +use Psr\Http\Message\RequestInterface; +use GuzzleHttp\Handler\CurlFactoryInterface; +use GuzzleHttp\Handler\EasyHandle; + +class SdkCurlFactory implements CurlFactoryInterface +{ + private $handles = []; + + private $maxHandles; + + public function __construct($maxHandles) + { + $this->maxHandles = $maxHandles; + } + + public function create(RequestInterface $request, array $options): EasyHandle + { + if (isset($options['curl']['body_as_string'])) { + $options['_body_as_string'] = $options['curl']['body_as_string']; + unset($options['curl']['body_as_string']); + } + + $easy = new EasyHandle; + $easy->request = $request; + $easy->options = $options; + $conf = $this->getDefaultConf($easy); + $this->applyMethod($easy, $conf); + $this->applyHandlerOptions($easy, $conf); + $this->applyHeaders($easy, $conf); + + + unset($conf['_headers']); + + if (isset($options['curl'])) { + $conf = array_replace($conf, $options['curl']); + } + + $conf[CURLOPT_HEADERFUNCTION] = $this->createHeaderFn($easy); + 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 = []; + } + } + + public function release(EasyHandle $easy): void + { + $resource = $easy->handle; + unset($easy->handle); + + if (count($this->handles) >= $this->maxHandles) { + curl_close($resource); + } else { + curl_setopt($resource, CURLOPT_HEADERFUNCTION, null); + curl_setopt($resource, CURLOPT_READFUNCTION, null); + curl_setopt($resource, CURLOPT_WRITEFUNCTION, null); + curl_setopt($resource, CURLOPT_PROGRESSFUNCTION, null); + curl_reset($resource); + $this->handles[] = $resource; + } + } + + private function getDefaultConf(EasyHandle $easy) + { + $conf = [ + '_headers' => $easy->request->getHeaders(), + CURLOPT_CUSTOMREQUEST => $easy->request->getMethod(), + CURLOPT_URL => (string) $easy->request->getUri()->withFragment(''), + CURLOPT_RETURNTRANSFER => false, + CURLOPT_HEADER => false, + CURLOPT_CONNECTTIMEOUT => 150, + ]; + + if (defined('CURLOPT_PROTOCOLS')) { + $conf[CURLOPT_PROTOCOLS] = CURLPROTO_HTTP | CURLPROTO_HTTPS; + } + + $version = $easy->request->getProtocolVersion(); + if ($version == 1.1) { + $conf[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_1; + } elseif ($version == 2.0) { + $conf[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_2_0; + } else { + $conf[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_0; + } + + return $conf; + } + + 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') { + $conf[CURLOPT_NOBODY] = true; + unset( + $conf[CURLOPT_WRITEFUNCTION], + $conf[CURLOPT_READFUNCTION], + $conf[CURLOPT_FILE], + $conf[CURLOPT_INFILE] + ); + } + } + + private function applyBody(RequestInterface $request, array $options, array &$conf) + { + $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->hasHeader('Expect')) { + $conf[CURLOPT_HTTPHEADER][] = 'Expect:'; + } + + if (!$request->hasHeader('Content-Type')) { + $conf[CURLOPT_HTTPHEADER][] = 'Content-Type:'; + } + } + + private function applyHeaders(EasyHandle $easy, array &$conf) + { + foreach ($conf['_headers'] as $name => $values) { + foreach ($values as $value) { + $conf[CURLOPT_HTTPHEADER][] = "$name: $value"; + } + } + + // Remove the Accept header if one was not set + if (!$easy->request->hasHeader('Accept')) { + $conf[CURLOPT_HTTPHEADER][] = 'Accept:'; + } + } + + private function removeHeader($name, array &$options) + { + foreach (array_keys($options['_headers']) as $key) { + if (!strcasecmp($key, $name)) { + unset($options['_headers'][$key]); + return; + } + } + } + + private function applyHandlerOptions(EasyHandle $easy, array &$conf) + { + $options = $easy->options; + if (isset($options['verify'])) { + $conf[CURLOPT_SSL_VERIFYHOST] = 0; + if ($options['verify'] === false) { + unset($conf[CURLOPT_CAINFO]); + $conf[CURLOPT_SSL_VERIFYPEER] = false; + } else { + $conf[CURLOPT_SSL_VERIFYPEER] = true; + if (is_string($options['verify'])) { + if (!file_exists($options['verify'])) { + throw new \InvalidArgumentException( + "SSL CA bundle not found: {$options['verify']}" + ); + } + if (is_dir($options['verify']) || + (is_link($options['verify']) && is_dir(readlink($options['verify'])))) { + $conf[CURLOPT_CAPATH] = $options['verify']; + } else { + $conf[CURLOPT_CAINFO] = $options['verify']; + } + } + } + } + + if (!empty($options['decode_content'])) { + $accept = $easy->request->getHeaderLine('Accept-Encoding'); + if ($accept) { + $conf[CURLOPT_ENCODING] = $accept; + } else { + $conf[CURLOPT_ENCODING] = ''; + $conf[CURLOPT_HTTPHEADER][] = 'Accept-Encoding:'; + } + } + + if (isset($options['sink'])) { + $sink = $options['sink']; + if (!is_string($sink)) { + try { + $sink = Psr7\stream_for($sink); + } catch (\Throwable $e) { + $sink = Psr7\Utils::streamFor($sink); + } + } elseif (!is_dir(dirname($sink))) { + throw new \RuntimeException(sprintf( + 'Directory %s does not exist for sink value of %s', + dirname($sink), + $sink + )); + } else { + $sink = new LazyOpenStream($sink, 'w+'); + } + $easy->sink = $sink; + $conf[CURLOPT_WRITEFUNCTION] = function ($ch, $write) use ($sink) { + return $sink->write($write); + }; + } else { + $conf[CURLOPT_FILE] = fopen('php://temp', 'w+'); + try { + $easy->sink = Psr7\stream_for($conf[CURLOPT_FILE]); + } catch (\Throwable $e) { + $easy->sink = Psr7\Utils::streamFor($conf[CURLOPT_FILE]); + } + } + $timeoutRequiresNoSignal = false; + if (isset($options['timeout'])) { + $timeoutRequiresNoSignal |= $options['timeout'] < 1; + $conf[CURLOPT_TIMEOUT_MS] = $options['timeout'] * 1000; + } + + 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']) { + $conf[CURLOPT_IPRESOLVE] = CURL_IPRESOLVE_V6; + } + } + + if (isset($options['connect_timeout'])) { + $timeoutRequiresNoSignal |= $options['connect_timeout'] < 1; + $conf[CURLOPT_CONNECTTIMEOUT_MS] = $options['connect_timeout'] * 1000; + } + + if ($timeoutRequiresNoSignal && strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { + $conf[CURLOPT_NOSIGNAL] = true; + } + + if (isset($options['proxy'])) { + if (!is_array($options['proxy'])) { + $conf[CURLOPT_PROXY] = $options['proxy']; + } else { + $scheme = $easy->request->getUri()->getScheme(); + if (isset($options['proxy'][$scheme])) { + $host = $easy->request->getUri()->getHost(); + if (!isset($options['proxy']['no']) || + !\GuzzleHttp\is_host_in_noproxy($host, $options['proxy']['no']) + ) { + $conf[CURLOPT_PROXY] = $options['proxy'][$scheme]; + } + } + } + } + + if (isset($options['cert'])) { + $cert = $options['cert']; + if (is_array($cert)) { + $conf[CURLOPT_SSLCERTPASSWD] = $cert[1]; + $cert = $cert[0]; + } + if (!file_exists($cert)) { + throw new \InvalidArgumentException( + "SSL certificate not found: {$cert}" + ); + } + $conf[CURLOPT_SSLCERT] = $cert; + } + + if (isset($options['ssl_key'])) { + $sslKey = $options['ssl_key']; + if (is_array($sslKey)) { + $conf[CURLOPT_SSLKEYPASSWD] = $sslKey[1]; + $sslKey = $sslKey[0]; + } + if (!file_exists($sslKey)) { + throw new \InvalidArgumentException( + "SSL private key not found: {$sslKey}" + ); + } + $conf[CURLOPT_SSLKEY] = $sslKey; + } + + if (isset($options['progress'])) { + $progress = $options['progress']; + if (!is_callable($progress)) { + throw new \InvalidArgumentException( + 'progress client option must be callable' + ); + } + $conf[CURLOPT_NOPROGRESS] = false; + $conf[CURLOPT_PROGRESSFUNCTION] = function () use ($progress) { + $args = func_get_args(); + if (is_resource($args[0])) { + array_shift($args); + } + call_user_func_array($progress, $args); + }; + } + + if (!empty($options['debug'])) { + $conf[CURLOPT_STDERR] = \GuzzleHttp\debug_resource($options['debug']); + $conf[CURLOPT_VERBOSE] = true; + } + } + + + private function createHeaderFn(EasyHandle $easy) + { + if (isset($easy->options['on_headers'])) { + $onHeaders = $easy->options['on_headers']; + + if (!is_callable($onHeaders)) { + throw new \InvalidArgumentException('on_headers must be callable'); + } + } else { + $onHeaders = null; + } + + return function ($ch, $h) use ( + $onHeaders, + $easy, + &$startingResponse + ) { + $value = trim($h); + if ($value === '') { + $startingResponse = true; + $easy->createResponse(); + if ($onHeaders !== null) { + try { + $onHeaders($easy->response); + } catch (\Exception $e) { + $easy->onHeadersException = $e; + return -1; + } + } + } elseif ($startingResponse) { + $startingResponse = false; + $easy->headers = [$value]; + } else { + $easy->headers[] = $value; + } + return strlen($h); + }; + } +} diff --git a/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/Common/SdkStreamHandler.php b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/Common/SdkStreamHandler.php new file mode 100644 index 000000000..c7075aca0 --- /dev/null +++ b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/Common/SdkStreamHandler.php @@ -0,0 +1,519 @@ + + + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +namespace Obs\Internal\Common; + +use GuzzleHttp\Exception\RequestException; +use GuzzleHttp\Exception\ConnectException; +use GuzzleHttp\Promise\FulfilledPromise; +use GuzzleHttp\Promise\PromiseInterface; +use GuzzleHttp\Psr7; +use GuzzleHttp\TransferStats; +use Psr\Http\Message\RequestInterface; +use Psr\Http\Message\ResponseInterface; +use Psr\Http\Message\StreamInterface; + +class SdkStreamHandler +{ + private $lastHeaders = []; + + public function __invoke(RequestInterface $request, array $options) + { + if (isset($options['delay'])) { + usleep($options['delay'] * 1000); + } + + $startTime = isset($options['on_stats']) ? microtime(true) : null; + + try { + $request = $request->withoutHeader('Expect'); + + if (0 === $request->getBody()->getSize()) { + $request = $request->withHeader('Content-Length', 0); + } + + return $this->createResponse( + $request, + $options, + $this->createStream($request, $options), + $startTime + ); + } catch (\InvalidArgumentException $e) { + throw $e; + } catch (\Exception $e) { + $message = $e->getMessage(); + if (strpos($message, 'getaddrinfo') + || strpos($message, 'Connection refused') + || strpos($message, "couldn't connect to host") + ) { + $e = new ConnectException($e->getMessage(), $request, $e); + } + $e = RequestException::wrapException($request, $e); + $this->invokeStats($options, $request, $startTime, null, $e); + + return \GuzzleHttp\Promise\rejection_for($e); + } + } + + private function invokeStats( + array $options, + RequestInterface $request, + $startTime, + ResponseInterface $response = null, + $error = null + ) { + if (isset($options['on_stats'])) { + $stats = new TransferStats( + $request, + $response, + microtime(true) - $startTime, + $error, + [] + ); + call_user_func($options['on_stats'], $stats); + } + } + + private function createResponse( + RequestInterface $request, + array $options, + $stream, + $startTime + ) { + $hdrs = $this->lastHeaders; + $this->lastHeaders = []; + $parts = explode(' ', array_shift($hdrs), 3); + $ver = explode('/', $parts[0])[1]; + $status = $parts[1]; + $reason = isset($parts[2]) ? $parts[2] : null; + $headers = \GuzzleHttp\headers_from_lines($hdrs); + list ($stream, $headers) = $this->checkDecode($options, $headers, $stream); + try { + $stream = Psr7\stream_for($stream); + } catch (\Throwable $e) { + $stream = Psr7\Utils::streamFor($stream); + } + $sink = $stream; + + if (strcasecmp('HEAD', $request->getMethod())) { + $sink = $this->createSink($stream, $options); + } + + $response = new Psr7\Response($status, $headers, $sink, $ver, $reason); + + if (isset($options['on_headers'])) { + try { + $options['on_headers']($response); + } catch (\Exception $e) { + $msg = 'An error was encountered during the on_headers event'; + $ex = new RequestException($msg, $request, $response, $e); + return \GuzzleHttp\Promise\rejection_for($ex); + } + } + + if ($sink !== $stream) { + $this->drain( + $stream, + $sink, + $response->getHeaderLine('Content-Length') + ); + } + + $this->invokeStats($options, $request, $startTime, $response, null); + + return new FulfilledPromise($response); + } + + private function createSink(StreamInterface $stream, array $options) + { + if (!empty($options['stream'])) { + return $stream; + } + + $sink = isset($options['sink']) + ? $options['sink'] + : fopen('php://temp', 'r+'); + + if (is_string($sink)) { + return new Psr7\LazyOpenStream($sink, 'w+'); + } + + try { + return Psr7\stream_for($sink); + } catch (\Throwable $e) { + return Psr7\Utils::streamFor($sink); + } + } + + private function checkDecode(array $options, array $headers, $stream) + { + if (!empty($options['decode_content'])) { + $normalizedKeys = \GuzzleHttp\normalize_header_keys($headers); + if (isset($normalizedKeys['content-encoding'])) { + $encoding = $headers[$normalizedKeys['content-encoding']]; + if ($encoding[0] === 'gzip' || $encoding[0] === 'deflate') { + try { + $stream = new Psr7\InflateStream( + Psr7\stream_for($stream) + ); + } catch (\Throwable $th) { + $stream = new Psr7\InflateStream( + Psr7\Utils::streamFor($stream) + ); + } + + $headers['x-encoded-content-encoding'] + = $headers[$normalizedKeys['content-encoding']]; + unset($headers[$normalizedKeys['content-encoding']]); + if (isset($normalizedKeys['content-length'])) { + $headers['x-encoded-content-length'] + = $headers[$normalizedKeys['content-length']]; + + $length = (int) $stream->getSize(); + if ($length === 0) { + unset($headers[$normalizedKeys['content-length']]); + } else { + $headers[$normalizedKeys['content-length']] = [$length]; + } + } + } + } + } + + return [$stream, $headers]; + } + + private function drain( + StreamInterface $source, + StreamInterface $sink, + $contentLength + ) { + Psr7\copy_to_stream( + $source, + $sink, + (strlen($contentLength) > 0 && (int) $contentLength > 0) ? (int) $contentLength : -1 + ); + + $sink->seek(0); + $source->close(); + + return $sink; + } + + private function createResource(callable $callback) + { + $errors = null; + set_error_handler(function ($_, $msg, $file, $line) use (&$errors) { + $errors[] = [ + 'message' => $msg, + 'file' => $file, + 'line' => $line + ]; + return true; + }); + + $resource = $callback(); + restore_error_handler(); + + if (!$resource) { + $message = 'Error creating resource: '; + foreach ($errors as $err) { + foreach ($err as $key => $value) { + $message .= "[$key] $value" . PHP_EOL; + } + } + throw new \RuntimeException(trim($message)); + } + + return $resource; + } + + private function createStream(RequestInterface $request, array $options) + { + static $methods; + if (!$methods) { + $methods = array_flip(get_class_methods(__CLASS__)); + } + + if ($request->getProtocolVersion() == '1.1' + && !$request->hasHeader('Connection') + ) { + $request = $request->withHeader('Connection', 'close'); + } + + if (!isset($options['verify'])) { + $options['verify'] = true; + } + + $params = []; + $context = $this->getDefaultContext($request, $options); + + if (isset($options['on_headers']) && !is_callable($options['on_headers'])) { + throw new \InvalidArgumentException('on_headers must be callable'); + } + + if (!empty($options)) { + foreach ($options as $key => $value) { + $method = "add_{$key}"; + if (isset($methods[$method])) { + $this->{$method}($request, $context, $value, $params); + } + } + } + + if (isset($options['stream_context'])) { + if (!is_array($options['stream_context'])) { + throw new \InvalidArgumentException('stream_context must be an array'); + } + $context = array_replace_recursive( + $context, + $options['stream_context'] + ); + } + + if (isset($options['auth']) + && is_array($options['auth']) + && isset($options['auth'][2]) + && 'ntlm' == $options['auth'][2] + ) { + + throw new \InvalidArgumentException('Microsoft NTLM authentication only supported with curl handler'); + } + + $uri = $this->resolveHost($request, $options); + + $context = $this->createResource( + function () use ($context, $params) { + return stream_context_create($context, $params); + } + ); + + return $this->createResource( + function () use ($uri, &$http_response_header, $context, $options) { + $resource = fopen((string) $uri, 'r', null, $context); + $this->lastHeaders = $http_response_header; + + if (isset($options['read_timeout'])) { + $readTimeout = $options['read_timeout']; + $sec = (int) $readTimeout; + $usec = ($readTimeout - $sec) * 100000; + stream_set_timeout($resource, $sec, $usec); + } + + return $resource; + } + ); + } + + private function resolveHost(RequestInterface $request, array $options) + { + $uri = $request->getUri(); + + if (isset($options['force_ip_resolve']) && !filter_var($uri->getHost(), FILTER_VALIDATE_IP)) { + 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); + } + $uri = $uri->withHost($records[0]['ip']); + } elseif ('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); + } + $uri = $uri->withHost('[' . $records[0]['ipv6'] . ']'); + } + } + + return $uri; + } + + private function getDefaultContext(RequestInterface $request) + { + $headers = ''; + foreach ($request->getHeaders() as $name => $value) { + foreach ($value as $val) { + $headers .= "$name: $val\r\n"; + } + } + + $context = [ + 'http' => [ + 'method' => $request->getMethod(), + 'header' => $headers, + 'protocol_version' => $request->getProtocolVersion(), + 'ignore_errors' => true, + 'follow_location' => 0, + ], + ]; + + $body = (string) $request->getBody(); + + if (!empty($body)) { + $context['http']['content'] = $body; + if (!$request->hasHeader('Content-Type')) { + $context['http']['header'] .= "Content-Type:\r\n"; + } + } + + $context['http']['header'] = rtrim($context['http']['header']); + + 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/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/Common/ToArrayInterface.php b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/Common/ToArrayInterface.php new file mode 100644 index 000000000..e8d517739 --- /dev/null +++ b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/Common/ToArrayInterface.php @@ -0,0 +1,23 @@ +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); + } + return $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; + } + + private function transAclHeader($para) { + if ($para === ObsClient::AclPublicReadDelivered || $para === ObsClient::AclPublicReadWriteDelivered) { + $para = null; + } + return $para; + } + + private function transAclGroupUri($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; + } + return $para; + } + + private function transNotificationEvent($para) { + $pos = strpos($para, 's3:'); + if ($pos === false || $pos !== 0) { + $para = 's3:' . $para; + } + return $para; + } +} + + diff --git a/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/GetResponseTrait.php b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/GetResponseTrait.php new file mode 100644 index 000000000..90b842204 --- /dev/null +++ b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/GetResponseTrait.php @@ -0,0 +1,455 @@ + 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); + } + } + + 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))) { + if (is_array($data)) { + $model[$key] = $data; + } elseif (strlen($data)) { + ObsLog::commonLog(ERROR, "response body %s, and jsonToArray data is %s",$body, $data); + } + } + $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) { + try { + $jsonErrorBody = trim($body -> getContents()); + if ($jsonErrorBody && ($data = json_decode($jsonErrorBody, true))) { + if (is_array($data)) { + if ($data['request_id']) { + $obsException -> setRequestId(strval($data['request_id'])); + } + if ($data['code']) { + $obsException -> setExceptionCode(strval($data['code'])); + } + if ($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"); + } + } + } finally { + $body -> close(); + } + } + + private function parseJsonToModel($body, $model) { + try{ + $jsonErrorBody = trim($body -> getContents()); + if ($jsonErrorBody && ($jsonArray = json_decode($jsonErrorBody, true))) { + if (is_array($jsonArray)) { + if ($jsonArray['request_id']) { + $model['RequestId'] = strval($jsonArray['request_id']); + } + if ($jsonArray['code']) { + $model['Code'] = strval($jsonArray['code']); + } + if ($jsonArray['message']) { + $model['Message'] = strval($jsonArray['message']); + } + } elseif (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"; + } + } + } finally { + $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); + } else { + $this->parseXmlToException($body, $obsException); + } + 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 { + $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); + } + } + 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/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/Resource/Constants.php b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/Resource/Constants.php new file mode 100644 index 000000000..6f99d809b --- /dev/null +++ b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/Resource/Constants.php @@ -0,0 +1,140 @@ + 'ContentLength', + 'date' => 'Date', + 'x-obs-request-id' => 'RequestId', + 'x-obs-id-2' => 'Id2', + 'x-reserved' => 'Reserved' + ]; +} diff --git a/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/Resource/OBSRequestResource.php b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/Resource/OBSRequestResource.php new file mode 100644 index 000000000..38ceb4227 --- /dev/null +++ b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/Resource/OBSRequestResource.php @@ -0,0 +1,4304 @@ + [ + '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' + ] + ] + ], + + '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' + ] + ] + ], + + 'deleteBucket' => [ + 'httpMethod' => 'DELETE', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns' + ] + ], + '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' + ] + ], + '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' + ] + ] + ] + ], + + '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' + ] + ] + ] + ], + + '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' + ] + ] + ] + ], + + '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' + ] + ], + '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' + ] + ] + ] + ], + + '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' + ] + ] + ] + ], + + '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' + ] + ] + ] + ], + + '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' + ] + ] + ], + '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' + ] + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-request-id' + ], + 'Owner' => [ + 'type' => 'object', + 'location' => 'xml', + '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' + ], + 'Agency' => [ + 'type' => 'string', + 'location' => 'xml' + ], + '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' + ] + ] + ] + ] + ] + ] + ], + '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' + ] + ], + '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' + ], + 'Policy' => [ + 'required' => true, + 'type' => 'json', + 'location' => 'body' + ] + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + 'RequestId' => [ + 'location' => 'header', + 'sentAs' => 'x-obs-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-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' + ] + ] + ], + + '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' + ] + ] + ] + ], + + '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' + ] + ] + ] + ], + + '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' + ] + ] + ] + ], + + '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' + ] + ] + ] + ], + + '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' + ] + ] + ] + ], + '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' + ] + ] + ] + ] + ], + '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' + ] + ] + ] + ] + ] + ] + ], + + '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' + ] + ] + ] + ], + + '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' + ] + ] + ], + 'IndexDocument' => [ + 'type' => 'object', + 'location' => 'xml', + 'properties' => [ + 'Suffix' => [ + 'required' => true, + 'type' => 'string' + ] + ] + ], + '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' + ] + ] + ], + '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' + ] + ] + ] + ] + ] + ] + ] + ] + ], + + '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 + ], + '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' + ] + ] + ] + ] + ] + ] + ] + ], + + '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' + ], + 'Value' => [ + 'type' => 'string' + ] + ] + ] + ] + ] + ] + ], + + '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' + ] + ] + ] + ], + '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' + ], + + 'Value' => [ + 'type' => 'string' + ] + ] + ] + ] + ] + ] + ] + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + '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' + ], + + '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' + ], + + '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' + ], + + 'Value' => [ + 'type' => 'string' + ] + ] + ] + ] + ] + ] + ] + ] + ] + ], + + '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' + ], + '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' + ] + ] + ] + ], + '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' + ], + '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' + ], + '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' + ] + ] + ] + ], + + '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' + ] + ], + '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' + ] + ] + ] + ], + + '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' + ] + ], + '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' + ] + ] + ] + ], + + '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' + ] + ] + ] + ], + + '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' + ] + ], + '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' + ] + ] + ] + ], + + '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' + ], + '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' + ] + ] + ] + ], + + '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' + ] + ] + ] + ], + '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' + ] + ] + ] + ], + + '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' + ], + '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' + ] + ] + ] + ], + + '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' + ] + ] + ] + ], + + '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' + ], + '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, + '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', + + '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/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/Resource/V2Constants.php b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/Resource/V2Constants.php new file mode 100644 index 000000000..57cb93d46 --- /dev/null +++ b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/Resource/V2Constants.php @@ -0,0 +1,38 @@ + 'ContentLength', + 'date' => 'Date', + 'x-amz-request-id' => 'RequestId', + 'x-amz-id-2' => 'Id2', + 'x-reserved' => 'Reserved' + ]; +} diff --git a/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/Resource/V2RequestResource.php b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/Resource/V2RequestResource.php new file mode 100644 index 000000000..a59c99521 --- /dev/null +++ b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/Resource/V2RequestResource.php @@ -0,0 +1,4121 @@ + [ + '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', + ], + ], + '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' + ] + ], + 'responseParameters' => [ + 'type' => 'object', + 'properties' => [ + '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' + ] + ] + ] + ], + + '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' + ], + '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' + ], + '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' + ] + ] + ] + ], + + '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-amz-request-id' + ], + 'StorageClass' => [ + 'location' => 'header', + 'sentAs' => 'x-default-storage-class' + ], + + 'Location' => [ + 'location' => 'header', + 'sentAs' => 'x-amz-bucket-region' + ], + + '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' + ] + ] + ] + ], + + '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' + ] + ] + ] + ], + + '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' + ] + ] + ] + ], + + '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' + ], + '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' + ], + 'ID' => [ + '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' + ] + ] + ] + ], + + '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' + ] + ] + ] + ] + ] + ] + ], + + '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' + ] + ] + ] + ], + + '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' + ] + ] + ] + ], + + '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' + ] + ] + ] + ], + + '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' + ] + ] + ] + ], + + 'deleteFetchPolicy' => [ + 'httpMethod' => 'DELETE', + 'specialParam' => 'obsfetchpolicy', + 'requestParameters' => [ + 'Bucket' => [ + 'required' => true, + 'type' => 'string', + 'location' => 'dns' + ] + ], + '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' + ] + ], + '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, + '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-amz-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-amz-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-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, + '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' + ] + ] + ] + ], + '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' + ] + ] + ] + ] + ], + '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' + ] + ] + ] + ] + ] + ] + ], + + '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' + ] + ] + ] + ], + + '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' + ] + ] + ], + 'IndexDocument' => [ + 'type' => 'object', + 'location' => 'xml', + 'properties' => [ + 'Suffix' => [ + 'required' => true, + 'type' => 'string' + ] + ] + ], + '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' + ] + ] + ], + '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' + ] + ], + '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' + ], + '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, + '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 + ], + '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' + ] + ] + ] + ], + + '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' + ] + ] + ] + ] + ] + ] + ] + ], + + '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' + ], + 'Value' => [ + 'type' => 'string' + ] + ] + ] + ] + ] + ] + ], + + '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' + ] + ] + ] + ], + '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' + ] + ] + ] + ], + + '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' + ], + + 'Value' => [ + 'type' => 'string' + ] + ] + ] + ] + ] + ] + ] + ] + ] + ], + + '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' + ], + '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' + ] + ] + ] + ], + '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' + ], + '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' + ], + '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' + ] + ] + ] + ], + + '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-obs-expires' + ] + ], + '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-' + ] + ] + ] + ], + + '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' + ] + ], + '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' + ], + '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-' + ] + ] + ] + ], + + '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-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' + ] + ] + ] + ], + + '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' + ], + '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' + ], + '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' + ] + ] + ] + ], + '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' + ] + ] + ] + ], + + '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' + ], + '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' + ] + ] + ] + ], + + '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' + ] + ] + ] + ], + + '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' + ], + '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, + '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', + + '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/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/SendRequestTrait.php b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/SendRequestTrait.php new file mode 100644 index 000000000..6bfe5830a --- /dev/null +++ b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/SendRequestTrait.php @@ -0,0 +1,726 @@ + 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; + } + } + + $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); + } + ); + } +} diff --git a/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/Signature/AbstractSignature.php b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/Signature/AbstractSignature.php new file mode 100644 index 000000000..3d3660416 --- /dev/null +++ b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/Signature/AbstractSignature.php @@ -0,0 +1,471 @@ + 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 + $jsonData = json_encode($val); + if (!$jsonData) { + $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; + } +} \ No newline at end of file diff --git a/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/Signature/DefaultSignature.php b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/Signature/DefaultSignature.php new file mode 100644 index 000000000..d83c230ff --- /dev/null +++ b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/Signature/DefaultSignature.php @@ -0,0 +1,138 @@ + 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); + } + +} diff --git a/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/Signature/SignatureInterface.php b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/Signature/SignatureInterface.php new file mode 100644 index 000000000..ae11c788c --- /dev/null +++ b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Internal/Signature/SignatureInterface.php @@ -0,0 +1,25 @@ +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); + } +} diff --git a/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Log/ObsConfig.php b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Log/ObsConfig.php new file mode 100644 index 000000000..aea821391 --- /dev/null +++ b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Log/ObsConfig.php @@ -0,0 +1,28 @@ +'./logs', + 'FileName'=>'eSDK-OBS-PHP.log', + 'MaxFiles'=>10, + 'Level'=>INFO + ]; +} diff --git a/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Log/ObsLog.php b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Log/ObsLog.php new file mode 100644 index 000000000..7cc8c5df9 --- /dev/null +++ b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/Log/ObsLog.php @@ -0,0 +1,126 @@ +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); + } + } +} diff --git a/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/ObsClient.php b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/ObsClient.php new file mode 100644 index 000000000..41dc4bd6a --- /dev/null +++ b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/ObsClient.php @@ -0,0 +1,415 @@ +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']; + } + + $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; + } +} diff --git a/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/ObsException.php b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/ObsException.php new file mode 100644 index 000000000..29d555e32 --- /dev/null +++ b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/ObsException.php @@ -0,0 +1,140 @@ +exceptionCode = $exceptionCode; + } + + public function getExceptionCode() + { + return $this->exceptionCode; + } + + public function setExceptionMessage($exceptionMessage) + { + $this->exceptionMessage = $exceptionMessage; + } + + public function getExceptionMessage() + { + return $this->exceptionMessage ? $this->exceptionMessage : $this->message; + } + + public function setExceptionType($exceptionType) + { + $this->exceptionType = $exceptionType; + } + + public function getExceptionType() + { + return $this->exceptionType; + } + + public function setRequestId($requestId) + { + $this->requestId = $requestId; + } + + public function getRequestId() + { + return $this->requestId; + } + + public function setResponse(Response $response) + { + $this->response = $response; + } + + public function getResponse() + { + return $this->response; + } + + public function setRequest(Request $request) + { + $this->request = $request; + } + + public function getRequest() + { + return $this->request; + } + + public function getStatusCode() + { + return $this->response ? $this->response->getStatusCode() : -1; + } + + public function setHostId($hostId){ + $this->hostId = $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()); + + // Add the User-Agent if available + if ($this->request) { + $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()); + return $message; + } + +} diff --git a/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/ObsImageClient.php b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/ObsImageClient.php new file mode 100644 index 000000000..31f3ebd17 --- /dev/null +++ b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/Obs/ObsImageClient.php @@ -0,0 +1,642 @@ +factorys = []; + + $this->ak = strval($config['key']); + $this->sk = strval($config['secret']); + + if (isset($config['project_name'])) { + $this->project_name = strval($config['project_name']); + } + + if (isset($config['project_sub_name'])) { + $this->project_sub_name = strval($config['project_sub_name']); + } + + if (isset($config['custom_domain'])) { + $this->custom_domain = strval($config['custom_domain']); + } + + 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']; + } + + $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 createSignedUrl(array $args=[]) + { + if (strcasecmp($this -> signature, 'v4') === 0) { + return $this -> createV4SignedUrl($args); + } + return $this->createCommonSignedUrl($this->signature,$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; + $objectKey = $this->genKey($objectKey); + + $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'] = $this->custom_domain ?? $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'] . '://' . ($this->custom_domain ?? $host) . ':' . (isset($url['port']) ? $url['port'] : (strtolower($url['scheme']) === 'https' ? '443' : '80')) . $result; + return $model; + } + + public function genKey(&$key) + { + if (empty($this->project_name)) { + throw new \RuntimeException('project_name 参数有误'); + } + $extension = explode('.', $key); + $ext = end($extension); + $date_ym = date('Y-m'); + $date_ymd = date('Ymd'); + $filePath = empty($this->project_sub_name) ? $this->project_name : $this->project_name . '/' . $this->project_sub_name; + $filePath .= "/{$date_ym}/{$date_ymd}_"; + $hash_data = $this->project_name . $key . time() . mt_rand(111111, 999999); + $filePath .= hash('sha256', $hash_data) . '.' . $ext; + return $filePath; + } + + /************************************************ 改造内容 *******************************************************/ + 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->_checkParams($params);//house365::校验参数,自动生成文件路径名 + $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']); + $this->_replaceDomain($model);//house365::替换域名 + 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); + } + } + + //house365::校验参数,自动生成文件路径名 + private function _checkParams(&$params) + { + if (!isset($params['Key'])) { + throw new \RuntimeException('Key 参数有误'); + } + if (empty($this->project_name)) { + throw new \RuntimeException('project_name 参数有误'); + } + $extension = explode('.', $params['Key']); + $ext = end($extension); + $date_ym = date('Y-m'); + $date_ymd = date('Ymd'); + $filePath = empty($this->project_sub_name) ? $this->project_name : $this->project_name . '/' . $this->project_sub_name; + $filePath .= "/{$date_ym}/{$date_ymd}_"; + $hash_data = $this->project_name . $params['Key'] . time() . mt_rand(111111, 999999); + $filePath .= hash('sha256', $hash_data) . '.' . $ext; + $params['Key'] = $filePath; + } + + //house365::替换域名 + private function _replaceDomain(&$model) + { + if ($this->custom_domain && $model['ObjectURL']) { + $origin_url = $model['ObjectURL']; + $url_arr = parse_url($origin_url); + if (!empty($url_arr['host'])) { + $url_ = $url_arr['scheme'] . '://' . $this->custom_domain . $url_arr['path']; + $url_ .= isset($url_arr['query']) ? '?' . $url_arr['query'] : ''; + $model['ObjectURL'] = $url_; + } + } + } +} diff --git a/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/README.md b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/README.md new file mode 100644 index 000000000..3348eccbf --- /dev/null +++ b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/README.md @@ -0,0 +1,48 @@ +Version 3.23.501 +基于华为3.23.5版本,增加自定义ObsImageClient + +Version 3.23.5 + +新特性: +1. 新增自定义域名相关接口; +2. 新增上传回调参数; + +资料&demo: + +修复问题: +1. 优化部分代码; + +---- + +Version 3.22.6 + +新特性: + +资料&demo: + +修复问题: +1. 修复三方依赖冲突的问题; + +---- + +Version 3.19.9 + +新特性: + +资料&demo: + +修复问题: +1. 修复OBS请求时,Host偶尔被异常替换的问题; +2. 修复特殊场景下,日志模块无法正常工作的问题; +3. 修复header中的正常特殊字符被url编码的问题; + +------------------------------------------------------------------------------------------------- + +Version 3.1.3 +新特性: + +资料&demo: + +修复问题: +1. 修复连接OBS服务超时时,解析request-id报错导致异常信息被截断的问题; + diff --git a/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/composer.json b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/composer.json new file mode 100644 index 000000000..90257d9fd --- /dev/null +++ b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/composer.json @@ -0,0 +1,20 @@ +{ + "name" : "365taofang/huaweicloud-sdk-php-obs", + "description" : "OBS PHP SDK", + "license":"Apache-2.0", + "version":"3.23.501", + "require" : { + "php" : ">=5.6.0", + "guzzlehttp/guzzle" : "^6.3.0 || ^7.0", + "guzzlehttp/psr7" : "^1.4.2 || ^2.0", + "monolog/monolog" : "^1.23.0 || ^2.0", + "psr/http-message": "^1.0" + }, + + "keywords" :["obs", "php"], + "autoload": { + "psr-4": { + "Obs\\": "Obs/" + } + } +} \ No newline at end of file diff --git a/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/BucketOperationsSample.php b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/BucketOperationsSample.php new file mode 100644 index 000000000..4c98e55ec --- /dev/null +++ b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/BucketOperationsSample.php @@ -0,0 +1,503 @@ + $ak, + 'secret' => $sk, + 'endpoint' => $endpoint, + 'socket_timeout' => 30, + 'connect_timeout' => 10 +] ); + + +try { + + /* + * Put bucket operation + */ + createBucket (); + + /* + * Get bucket location operation + */ + getBucketLocation (); + + /* + * Get bucket storageInfo operation + */ + getBucketStorageInfo (); + + /* + * Put/Get bucket quota operations + */ + doBucketQuotaOperation (); + + /* + * Put/Get bucket versioning operations + */ + doBucketVersioningOperation (); + + /* + * Put/Get bucket acl operations + */ + $ownerId = doBucketAclOperation (); + + /* + * Put/Get/Delete bucket cors operations + */ + doBucketCorsOperation (); + + /* + * Options bucket operation + */ + optionsBucket (); + + /* + * Get bucket metadata operation + */ + getBucketMetadata (); + + /* + * Put/Get/Delete bucket lifecycle operations + */ + doBucketLifecycleOperation (); + + /* + * Put/Get/Delete bucket logging operations + */ + doBucketLoggingOperation ($ownerId); + + /* + * Put/Get/Delete bucket website operations + */ + doBucketWebsiteOperation (); + + /* + * Put/Get/Delete bucket tagging operations + */ + doBucketTaggingOperation (); + + /* + * Delete bucket operation + */ + deleteBucket (); +} catch ( ObsException $e ) { + echo 'Response Code:' . $e->getStatusCode () . PHP_EOL; + echo 'Error Message:' . $e->getExceptionMessage () . PHP_EOL; + echo 'Error Code:' . $e->getExceptionCode () . PHP_EOL; + echo 'Request ID:' . $e->getRequestId () . PHP_EOL; + echo 'Exception Type:' . $e->getExceptionType () . PHP_EOL; +} finally{ + $obsClient->close (); +} + + +function createBucket() +{ + global $obsClient; + global $bucketName; + + $resp = $obsClient->createBucket ([ + 'Bucket' => $bucketName, + ]); + printf("HttpStatusCode:%s\n\n", $resp ['HttpStatusCode']); + printf("Create bucket: %s successfully!\n\n", $bucketName); +} + +function getBucketLocation() +{ + global $obsClient; + global $bucketName; + + $promise = $obsClient -> getBucketLocationAsync(['Bucket' => $bucketName], function($exception, $resp){ + printf("Getting bucket location %s\n\n", $resp ['Location']); + }); + $promise -> wait(); +} + +function getBucketStorageInfo() +{ + global $obsClient; + global $bucketName; + $promise = $obsClient -> getBucketStorageInfoAsync(['Bucket' => $bucketName], function($exception, $resp){ + printf("Getting bucket storageInfo Size:%d,ObjectNumber:%d\n\n", $resp ['Size'], $resp ['ObjectNumber']); + }); + $promise -> wait(); +} + +function doBucketQuotaOperation() +{ + global $obsClient; + global $bucketName; + $obsClient->setBucketQuota ([ + 'Bucket' => $bucketName, + 'StorageQuota' => 1024 * 1024 * 1024//Set bucket quota to 1GB + ]); + + $resp = $obsClient->getBucketQuota ([ + 'Bucket' => $bucketName + ]); + printf ("Getting bucket quota:%s\n\n", $resp ['StorageQuota'] ); +} + +function doBucketVersioningOperation() +{ + global $obsClient; + global $bucketName; + + $resp = $obsClient->getBucketVersioningConfiguration ( [ + 'Bucket' => $bucketName + ]); + printf ( "Getting bucket versioning config:%s\n\n", $resp ['Status']); + //Enable bucket versioning + $obsClient->setBucketVersioningConfiguration ([ + 'Bucket' => $bucketName, + 'Status' => 'Enabled' + ]); + $resp = $obsClient->getBucketVersioningConfiguration ( [ + 'Bucket' => $bucketName + ]); + printf ( "Current bucket versioning config:%s\n\n", $resp ['Status']); + + //Suspend bucket versioning + $obsClient->setBucketVersioningConfiguration ([ + 'Bucket' => $bucketName, + 'Status' => 'Suspended' + ]); + $resp = $obsClient->getBucketVersioningConfiguration ( [ + 'Bucket' => $bucketName + ]); + printf ( "Current bucket versioning config:%s\n\n", $resp ['Status']); +} + +function doBucketAclOperation() +{ + global $obsClient; + global $bucketName; + printf ("Setting bucket ACL to ". ObsClient::AclPublicRead. "\n\n"); + $obsClient->setBucketAcl ([ + 'Bucket' => $bucketName, + 'ACL' => ObsClient::AclPublicRead, + ]); + + $resp = $obsClient->getBucketAcl ([ + 'Bucket' => $bucketName + ]); + printf ("Getting bucket ACL:%s\n\n", json_encode($resp -> toArray())); + + printf ("Setting bucket ACL to ". ObsClient::AclPrivate. "\n\n"); + + $obsClient->setBucketAcl ([ + 'Bucket' => $bucketName, + 'ACL' => ObsClient::AclPrivate, + ]); + $resp = $obsClient->getBucketAcl ([ + 'Bucket' => $bucketName + ]); + printf ("Getting bucket ACL:%s\n\n", json_encode($resp -> toArray())); + return $resp ['Owner'] ['ID']; +} + +function doBucketCorsOperation() +{ + global $obsClient; + global $bucketName; + printf ("Setting bucket CORS\n\n"); + $obsClient->setBucketCors ( [ + 'Bucket' => $bucketName, + 'CorsRule' => [ + [ + 'AllowedMethod' => ['HEAD', 'GET', 'PUT'], + 'AllowedOrigin' => ['http://www.a.com', 'http://www.b.com'], + 'AllowedHeader'=> ['Authorization'], + 'ExposeHeaders' => ['x-obs-test1', 'x-obs-test2'], + 'MaxAgeSeconds' => 100 + ] + ] + ] ); + printf ("Getting bucket CORS:%s\n\n", json_encode($obsClient-> getBucketCors(['Bucket' => $bucketName])-> toArray())); + +} + +function optionsBucket() +{ + global $obsClient; + global $bucketName; + + $resp = $obsClient->optionsBucket([ + 'Bucket'=>$bucketName, + 'Origin'=>'http://www.a.com', + 'AccessControlRequestMethods' => ['PUT'], + 'AccessControlRequestHeaders'=> ['Authorization'] + ]); + printf ("Options bucket: %s\n\n", json_encode($resp -> toArray())); + +} + +function getBucketMetadata() +{ + global $obsClient; + global $bucketName; + printf ("Getting bucket metadata\n\n"); + + $resp = $obsClient->getBucketMetadata ( [ + "Bucket" => $bucketName, + "Origin" => "http://www.a.com", + "RequestHeader" => "Authorization" + ] ); + printf ( "\tHttpStatusCode:%s\n", $resp ['HttpStatusCode'] ); + printf ( "\tStorageClass:%s\n", $resp ["StorageClass"] ); + printf ( "\tAllowOrigin:%s\n", $resp ["AllowOrigin"] ); + printf ( "\tMaxAgeSeconds:%s\n", $resp ["MaxAgeSeconds"] ); + printf ( "\tExposeHeader:%s\n", $resp ["ExposeHeader"] ); + printf ( "\tAllowHeader:%s\n", $resp ["AllowHeader"] ); + printf ( "\tAllowMethod:%s\n", $resp ["AllowMethod"] ); + + printf ("Deleting bucket CORS\n\n"); + $obsClient -> deleteBucketCors(['Bucket' => $bucketName]); +} + +function doBucketLifecycleOperation() +{ + global $obsClient; + global $bucketName; + + $ruleId0 = "delete obsoleted files"; + $matchPrefix0 = "obsoleted/"; + $ruleId1 = "delete temporary files"; + $matchPrefix1 = "temporary/"; + $ruleId2 = "delete temp files"; + $matchPrefix2 = "temp/"; + + printf ("Setting bucket lifecycle\n\n"); + + $obsClient->setBucketLifecycleConfiguration ( [ + 'Bucket' => $bucketName, + 'Rules' => [ + [ + 'ID' => $ruleId0, + 'Prefix' => $matchPrefix0, + 'Status' => 'Enabled', + 'Expiration'=> ['Days'=>5] + ], + [ + 'ID' => $ruleId1, + 'Prefix' => $matchPrefix1, + 'Status' => 'Enabled', + 'Expiration' => ['Date' => '2017-12-31T00:00:00Z'] + ], + [ + 'ID' => $ruleId2, + 'Prefix' => $matchPrefix2, + 'Status' => 'Enabled', + 'NoncurrentVersionExpiration' => ['NoncurrentDays' => 10] + ] + ] + ]); + + printf ("Getting bucket lifecycle\n\n"); + + $resp = $obsClient->getBucketLifecycleConfiguration ([ + 'Bucket' => $bucketName + ]); + + $i = 0; + foreach ( $resp ['Rules'] as $rule ) { + printf ( "\tRules[$i][Expiration][Date]:%s,Rules[$i][Expiration][Days]:%d\n", $rule ['Expiration'] ['Date'], $rule ['Expiration'] ['Days'] ); + printf ( "\yRules[$i][NoncurrentVersionExpiration][NoncurrentDays]:%s\n", $rule ['NoncurrentVersionExpiration'] ['NoncurrentDays'] ); + printf ( "\tRules[$i][ID]:%s,Rules[$i][Prefix]:%s,Rules[$i][Status]:%s\n", $rule ['ID'], $rule ['Prefix'], $rule ['Status'] ); + $i ++; + } + + printf ("Deleting bucket lifecycle\n\n"); + $obsClient->deleteBucketLifecycleConfiguration (['Bucket' => $bucketName]); +} + +function doBucketLoggingOperation($ownerId) +{ + global $obsClient; + global $bucketName; + + printf ("Setting bucket ACL, give the log-delivery group " . ObsClient::PermissionWrite ." and " .ObsClient::PermissionReadAcp ." permissions\n\n"); + + $obsClient->setBucketAcl ([ + 'Bucket' => $bucketName, + 'Owner' => [ + 'ID' => $ownerId + ], + 'Grants' => [ + [ + 'Grantee' => [ + 'URI' => ObsClient::GroupLogDelivery, + 'Type' => 'Group' + ], + 'Permission' => ObsClient::PermissionWrite + ], + [ + 'Grantee' => [ + 'URI' => ObsClient::GroupLogDelivery, + 'Type' => 'Group' + ], + 'Permission' => ObsClient::PermissionReadAcp + ], + ] + ]); + + printf ("Setting bucket logging\n\n"); + + $targetBucket = $bucketName; + $targetPrefix = 'log-'; + + $obsClient->setBucketLoggingConfiguration ( [ + 'Bucket' => $bucketName, + 'LoggingEnabled' => [ + 'TargetBucket' => $targetBucket, + 'TargetPrefix' => $targetPrefix, + 'TargetGrants' => [ + [ + 'Grantee' => [ + 'URI' => ObsClient::GroupAuthenticatedUsers, + 'Type' => 'Group' + ], + 'Permission' => ObsClient::PermissionRead + ] + ] + ] + ]); + + printf ("Getting bucket logging\n"); + + $resp = $obsClient->getBucketLoggingConfiguration ([ + 'Bucket' => $bucketName + ]); + + printf ("\tTarget bucket=%s, target prefix=%s\n", $resp ['LoggingEnabled'] ['TargetBucket'], $resp ['LoggingEnabled'] ['TargetPrefix'] ); + printf("\tTargetGrants=%s\n\n", json_encode($resp ['LoggingEnabled'] ['TargetGrants'])); + + printf ("Deletting bucket logging\n"); + + $obsClient->setBucketLoggingConfiguration ( [ + 'Bucket' => $bucketName + ]); +} + +function doBucketWebsiteOperation() +{ + global $obsClient; + global $bucketName; + + printf ("Setting bucket website\n\n"); + + $obsClient->setBucketWebsiteConfiguration ([ + 'Bucket' => $bucketName, + 'IndexDocument' => [ + 'Suffix' => 'index.html' + ], + 'ErrorDocument' => [ + 'Key' => 'error.html' + ] + ]); + printf ("Getting bucket website\n"); + + $resp = $obsClient->GetBucketWebsiteConfiguration ( [ + 'Bucket' => $bucketName + ]); + + printf ("\tIndex document=%s, error document=%s\n\n", $resp ['IndexDocument'] ['Suffix'], $resp ['ErrorDocument'] ['Key']); + printf ("Deletting bucket website\n"); + + $obsClient->deleteBucketWebsiteConfiguration ([ + 'Bucket' => $bucketName + ]); +} + +function doBucketTaggingOperation() +{ + global $obsClient; + global $bucketName; + printf ("Setting bucket tagging\n\n"); + $obsClient -> setBucketTagging([ + 'Bucket' => $bucketName, + 'TagSet' => [ + [ + 'Key' => 'testKey1', + 'Value' => 'testValue1' + ], + [ + 'Key' => 'testKey2', + 'Value' => 'testValue2' + ] + ] + ]); + printf ("Getting bucket tagging\n"); + + $resp = $obsClient -> getBucketTagging(['Bucket' => $bucketName]); + + printf ("\t%s\n\n", json_encode($resp->toArray())); + + printf ("Deletting bucket tagging\n\n"); + + $obsClient -> deleteBucketTagging(['Bucket' => $bucketName]); +} + +function deleteBucket() +{ + + global $obsClient; + global $bucketName; + + $resp = $obsClient->deleteBucket ([ + 'Bucket' => $bucketName + ] ); + printf("Deleting bucket %s successfully!\n\n", $bucketName); + printf("HttpStatusCode:%s\n\n", $resp ['HttpStatusCode']); +} + + diff --git a/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/ConcurrentCopyPartSample.php b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/ConcurrentCopyPartSample.php new file mode 100644 index 000000000..4e1809055 --- /dev/null +++ b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/ConcurrentCopyPartSample.php @@ -0,0 +1,221 @@ + $ak, + 'secret' => $sk, + 'endpoint' => $endpoint, + 'socket_timeout' => 30, + 'connect_timeout' => 10 +] ); + +try +{ + /* + * Create bucket + */ + printf("Create a new bucket for demo\n\n"); + $obsClient -> createBucket(['Bucket' => $bucketName]); + + + $sampleFilePath = '/temp/test.txt'; //sample large file path + // you can prepare a large file in you filesystem first + createSampleFile($sampleFilePath); + + /* + * Upload an object to your source bucket + */ + $obsClient -> putObject(['Bucket' => $sourceBucketName, 'Key' => $sourceObjectKey, 'SourceFile' => $sampleFilePath]); + + /* + * Claim a upload id firstly + */ + $resp = $obsClient -> initiateMultipartUpload(['Bucket' => $bucketName, 'Key' => $objectKey]); + $uploadId = $resp['UploadId']; + printf("Claiming a new upload id %s\n\n", $uploadId); + + + $partSize = 5 * 1024 * 1024; + $resp = $obsClient -> getObjectMetadata(['Bucket' => $sourceBucketName, 'Key' => $sourceObjectKey]); + $objectSize = $resp['ContentLength']; + + $partCount = $objectSize % $partSize === 0 ? intval($objectSize / $partSize) : intval($objectSize / $partSize) + 1; + + if($partCount > 10000){ + throw new \RuntimeException('Total parts count should not exceed 10000'); + } + printf("Total parts count %d\n\n", $partCount); + + /* + * Upload multiparts by copy mode + */ + $promise = null; + $parts = []; + printf("Begin to upload multiparts to OBS by copy mode\n\n"); + for($i = 0; $i < $partCount; $i++){ + $rangeStart = $i * $partSize; + $rangeEnd = ($i + 1 === $partCount) ? $objectSize - 1 : $rangeStart + $partSize - 1; + $partNumber = $i + 1; + $p = $obsClient -> copyPartAsync([ + 'Bucket' => $bucketName, + 'Key' => $objectKey, + 'UploadId' => $uploadId, + 'PartNumber' => $partNumber, + 'CopySource'=>sprintf('%s/%s', $sourceBucketName, $sourceObjectKey), + 'CopySourceRange' => sprintf('bytes=%d-%d', $rangeStart, $rangeEnd) + ], function($exception, $resp) use (&$parts, $partNumber){ + $parts[] = ['PartNumber' => $partNumber, 'ETag' => $resp['ETag']]; + printf ( "Part#" . strval ( $partNumber ) . " done\n\n" ); + }); + + if($promise === null){ + $promise = $p; + } + } + + + /* + * Waiting for all parts finished + */ + $promise->wait(); + + usort($parts, function($a, $b){ + if($a['PartNumber'] === $b['PartNumber']){ + return 0; + } + return $a['PartNumber'] > $b['PartNumber'] ? 1 : -1; + }); + + /* + * Verify whether all parts are finished + */ + if(count($parts) !== $partCount){ + throw new \RuntimeException('Upload multiparts fail due to some parts are not finished yet'); + } + + + printf("Succeed to complete multiparts into an object named %s\n\n", $objectKey); + + /* + * View all parts uploaded recently + */ + printf("Listing all parts......\n"); + $resp = $obsClient -> listParts(['Bucket' => $bucketName, 'Key' => $objectKey, 'UploadId' => $uploadId]); + foreach ($resp['Parts'] as $part) + { + printf("\tPart#%d, ETag=%s\n", $part['PartNumber'], $part['ETag']); + } + printf("\n"); + + /* + * Complete to upload multiparts + */ + $resp = $obsClient->completeMultipartUpload([ + 'Bucket' => $bucketName, + 'Key' => $objectKey, + 'UploadId' => $uploadId, + 'Parts'=> $parts + ]); + + if(file_exists($sampleFilePath)){ + unlink($sampleFilePath); + } + +} catch ( ObsException $e ) { + echo 'Response Code:' . $e->getStatusCode () . PHP_EOL; + echo 'Error Message:' . $e->getExceptionMessage () . PHP_EOL; + echo 'Error Code:' . $e->getExceptionCode () . PHP_EOL; + echo 'Request ID:' . $e->getRequestId () . PHP_EOL; + echo 'Exception Type:' . $e->getExceptionType () . PHP_EOL; +} finally{ + $obsClient->close (); +} + + +function createSampleFile($filePath) +{ + if(file_exists($filePath)){ + return; + } + $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'))) + { + + for($i=0;$i< 1000000;$i++){ + fwrite($fp, uniqid() . "\n"); + fwrite($fp, uniqid() . "\n"); + if($i % 100 === 0){ + fflush($fp); + } + } + } + }finally{ + if($fp){ + fclose($fp); + } + } + } +} \ No newline at end of file diff --git a/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/ConcurrentDownloadObjectSample.php b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/ConcurrentDownloadObjectSample.php new file mode 100644 index 000000000..17ff984ca --- /dev/null +++ b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/ConcurrentDownloadObjectSample.php @@ -0,0 +1,203 @@ + $ak, + 'secret' => $sk, + 'endpoint' => $endpoint, + 'socket_timeout' => 30, + 'connect_timeout' => 10 +]); + +try { + /* + * Create bucket + */ + printf("Create a new bucket for demo\n\n"); + $obsClient->createBucket([ + 'Bucket' => $bucketName + ]); + + $sampleFilePath = '/temp/test.txt'; // sample large file path + // you can prepare a large file in you filesystem first + createSampleFile($sampleFilePath); + + /* + * Upload an object to your bucket + */ + printf("Uploading a new object to OBS from a file\n\n"); + $obsClient->putObject([ + 'Bucket' => $bucketName, + 'Key' => $objectKey, + 'SourceFile' => $sampleFilePath + ]); + + /* + * Get size of the object and pre-create a random access file to hold object data + */ + $resp = $obsClient->getObjectMetadata([ + 'Bucket' => $bucketName, + 'Key' => $objectKey + ]); + + $objectSize = $resp ['ContentLength']; + + printf("Object size from metadata:%d\n\n", $objectSize); + + $dir = dirname($localFilePath); + if (! is_dir($dir)) { + mkdir($dir, 0755, true); + } + + /* + * Calculate how many blocks to be divided + */ + $blockSize = 5 * 1024 * 1024; // 5MB + $blockCount = intval($objectSize / $blockSize); + + if ($objectSize % $blockSize !== 0) { + $blockCount ++; + } + + printf("Total blocks count:%d\n\n", $blockCount); + + /* + * Download the object concurrently + */ + printf("Start to download %s\n\n", $objectKey); + + $fp = fopen($localFilePath, 'w'); + $promise = null; + + for($i = 0; $i < $blockCount;) { + $startPos = $i ++ * $blockSize; + $endPos = ($i == $blockCount) ? $objectSize - 1 : ($i * $blockSize - 1); + $range = sprintf('bytes=%d-%d', $startPos, $endPos); + $p = $obsClient->getObjectAsync([ + 'Bucket' => $bucketName, + 'Key' => $objectKey, + 'Range' => $range + ], function ($exception, $resp) use ($startPos, $fp, $i, $range) { + fseek($fp, $startPos, 0); + printf("%s\n", $range); + try { + while ( ! $resp ['Body']->eof() ) { + $str = $resp ['Body']->read(65536); + fwrite($fp, $str); + } + } catch ( Exception $exception ) { + printf($exception); + } + $resp ['Body']->close(); + printf("Part#" . strval($i) . " done\n\n"); + }); + if ($promise === null) { + $promise = $p; + } + } + + /* + * Waiting for all blocks finished + */ + $promise->wait(); + fclose($fp); + if (file_exists($sampleFilePath)) { + unlink($sampleFilePath); + } + + /* + * Deleting object + */ + printf("Deleting object %s \n\n", $objectKey); + $obsClient->deleteObject([ + 'Bucket' => $bucketName, + 'Key' => $objectKey + ]); +} catch ( ObsException $e ) { + echo 'Response Code:' . $e->getStatusCode() . PHP_EOL; + echo 'Error Message:' . $e->getExceptionMessage() . PHP_EOL; + echo 'Error Code:' . $e->getExceptionCode() . PHP_EOL; + echo 'Request ID:' . $e->getRequestId() . PHP_EOL; + echo 'Exception Type:' . $e->getExceptionType() . PHP_EOL; +} finally{ + $obsClient->close(); +} + +function createSampleFile($filePath) { + if (file_exists($filePath)) { + return; + } + $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'))) { + + for($i = 0; $i < 1000000; $i ++) { + fwrite($fp, uniqid() . "\n"); + fwrite($fp, uniqid() . "\n"); + if ($i % 100 === 0) { + fflush($fp); + } + } + } + } finally{ + if ($fp) { + fclose($fp); + } + } + } +} diff --git a/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/ConcurrentUploadPartSample.php b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/ConcurrentUploadPartSample.php new file mode 100644 index 000000000..7d558a786 --- /dev/null +++ b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/ConcurrentUploadPartSample.php @@ -0,0 +1,215 @@ + $ak, + 'secret' => $sk, + 'endpoint' => $endpoint, + 'socket_timeout' => 30, + 'connect_timeout' => 10 +] ); + +try +{ + + /* + * Create bucket + */ + printf("Create a new bucket for demo\n\n"); + $obsClient -> createBucket(['Bucket' => $bucketName]); + + /* + * Claim a upload id firstly + */ + $resp = $obsClient -> initiateMultipartUpload(['Bucket' => $bucketName, 'Key' => $objectKey]); + + $uploadId = $resp['UploadId']; + printf("Claiming a new upload id %s\n\n", $uploadId); + + $sampleFilePath = '/temp/test.txt'; //sample large file path + // you can prepare a large file in you filesystem first + createSampleFile($sampleFilePath); + + $partSize = 5 * 1024 * 1024; + $fileLength = filesize($sampleFilePath); + + $partCount = $fileLength % $partSize === 0 ? intval($fileLength / $partSize) : intval($fileLength / $partSize) + 1; + + if($partCount > 10000){ + throw new \RuntimeException('Total parts count should not exceed 10000'); + } + + printf("Total parts count %d\n\n", $partCount); + $parts = []; + $promise = null; + /* + * Upload multiparts to your bucket + */ + printf("Begin to upload multiparts to OBS from a file\n\n"); + for($i = 0; $i < $partCount; $i++){ + $offset = $i * $partSize; + $currPartSize = ($i + 1 === $partCount) ? $fileLength - $offset : $partSize; + $partNumber = $i + 1; + $p = $obsClient -> uploadPartAsync([ + 'Bucket' => $bucketName, + 'Key' => $objectKey, + 'UploadId' => $uploadId, + 'PartNumber' => $partNumber, + 'SourceFile' => $sampleFilePath, + 'Offset' => $offset, + 'PartSize' => $currPartSize + ], function($exception, $resp) use(&$parts, $partNumber) { + $parts[] = ['PartNumber' => $partNumber, 'ETag' => $resp['ETag']]; + printf ( "Part#" . strval ( $partNumber ) . " done\n\n" ); + }); + + if($promise === null){ + $promise = $p; + } + } + + /* + * Waiting for all parts finished + */ + $promise -> wait(); + + usort($parts, function($a, $b){ + if($a['PartNumber'] === $b['PartNumber']){ + return 0; + } + return $a['PartNumber'] > $b['PartNumber'] ? 1 : -1; + }); + + /* + * Verify whether all parts are finished + */ + if(count($parts) !== $partCount){ + throw new \RuntimeException('Upload multiparts fail due to some parts are not finished yet'); + } + + + printf("Succeed to complete multiparts into an object named %s\n\n", $objectKey); + + /* + * View all parts uploaded recently + */ + printf("Listing all parts......\n"); + $resp = $obsClient -> listParts(['Bucket' => $bucketName, 'Key' => $objectKey, 'UploadId' => $uploadId]); + foreach ($resp['Parts'] as $part) + { + printf("\tPart#%d, ETag=%s\n", $part['PartNumber'], $part['ETag']); + } + printf("\n"); + + + /* + * Complete to upload multiparts + */ + $resp = $obsClient->completeMultipartUpload([ + 'Bucket' => $bucketName, + 'Key' => $objectKey, + 'UploadId' => $uploadId, + 'Parts'=> $parts + ]); + +// deleteTempFile($sampleFilePath); + + +} catch ( ObsException $e ) { + echo 'Response Code:' . $e->getStatusCode () . PHP_EOL; + echo 'Error Message:' . $e->getExceptionMessage () . PHP_EOL; + echo 'Error Code:' . $e->getExceptionCode () . PHP_EOL; + echo 'Request ID:' . $e->getRequestId () . PHP_EOL; + echo 'Exception Type:' . $e->getExceptionType () . PHP_EOL; +} finally{ + $obsClient->close (); +} + + +function createSampleFile($filePath) +{ + if(file_exists($filePath)){ + return; + } + $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'))) + { + + for($i=0;$i< 1000000;$i++){ + fwrite($fp, uniqid() . "\n"); + fwrite($fp, uniqid() . "\n"); + if($i % 100 === 0){ + fflush($fp); + } + } + } + }finally{ + if($fp){ + fclose($fp); + } + } + } +} + +function deleteTempFile($sampleFilePath) { + if(file_exists($sampleFilePath)){ + unlink($sampleFilePath); + }; +} diff --git a/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/CreateFolderSample.php b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/CreateFolderSample.php new file mode 100644 index 000000000..99ef7a54d --- /dev/null +++ b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/CreateFolderSample.php @@ -0,0 +1,100 @@ + $ak, + 'secret' => $sk, + 'endpoint' => $endpoint, + 'socket_timeout' => 30, + 'connect_timeout' => 10 +] ); + +try +{ + /* + * Create bucket + */ + echo "Create a new bucket for demo\n\n"; + $obsClient -> createBucket(['Bucket' => $bucketName]); + + + /* + * Create an empty folder without request body, note that the key must be + * suffixed with a slash + */ + $keySuffixWithSlash = "MyObjectKey1/"; + $obsClient -> putObject(['Bucket' => $bucketName, 'Key' => $keySuffixWithSlash]); + echo "Creating an empty folder " . $keySuffixWithSlash . "\n\n"; + + /* + * Verify whether the size of the empty folder is zero + */ + $resp = $obsClient -> getObject(['Bucket' => $bucketName, 'Key' => $keySuffixWithSlash]); + + echo "Size of the empty folder '" . $keySuffixWithSlash. "' is " . $resp['ContentLength'] . "\n\n"; + if($resp['Body']){ + $resp['Body'] -> close(); + } + + /* + * Create an object under the folder just created + */ + $obsClient -> putObject(['Bucket' => $bucketName, 'Key' => $keySuffixWithSlash . $objectKey, 'Body' => 'Hello OBS']); + +} catch ( ObsException $e ) { + echo 'Response Code:' . $e->getStatusCode () . PHP_EOL; + echo 'Error Message:' . $e->getExceptionMessage () . PHP_EOL; + echo 'Error Code:' . $e->getExceptionCode () . PHP_EOL; + echo 'Request ID:' . $e->getRequestId () . PHP_EOL; + echo 'Exception Type:' . $e->getExceptionType () . PHP_EOL; +} finally{ + $obsClient->close (); +} + diff --git a/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/DeleteObjectsSample.php b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/DeleteObjectsSample.php new file mode 100644 index 000000000..66966006e --- /dev/null +++ b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/DeleteObjectsSample.php @@ -0,0 +1,149 @@ + $ak, + 'secret' => $sk, + 'endpoint' => $endpoint, + 'socket_timeout' => 30, + 'connect_timeout' => 10 +] ); + +try +{ + /* + * Create bucket + */ + echo "Create a new bucket for demo\n\n"; + $obsClient -> createBucket(['Bucket' => $bucketName]); + + /* + * Batch put objects into the bucket + */ + $content = 'Thank you for using Object Storage Service'; + $keyPrefix = 'MyObjectKey'; + $keys = []; + + $start = microtime(true); + +// doUploadSync($keys, $keyPrefix, $content); + + doUploadAsync($keys, $keyPrefix, $content); + + printf("Cost " . round(microtime(true) - $start, 3) * 1000 . " ms to upload 100 objects\n\n"); + + /* + * Delete all objects uploaded recently under the bucket + */ + + printf("Deleting all objects\n\n"); + + $resp = $obsClient->deleteObjects([ + 'Bucket'=>$bucketName, + 'Objects'=>$keys, + 'Quiet'=> false, + ]); + + printf("Delete results:\n\n"); + $i = 0; + foreach ($resp['Deleteds'] as $delete) + { + printf("\tDeleteds[$i][Key]:%s,Deleted[$i][VersionId]:%s,Deleted[$i][DeleteMarker]:%s,Deleted[$i][DeleteMarkerVersionId]:%s\n", + $delete['Key'],$delete['VersionId'],$delete['DeleteMarker'],$delete['DeleteMarkerVersionId']); + $i++; + } + printf("\n"); + printf("Error results:\n\n"); + $i = 0; + foreach ($resp['Errors'] as $error) + { + printf("\tErrors[$i][Key]:%s,Errors[$i][VersionId]:%s,Errors[$i][Code]:%s,Errors[$i][Message]:%s\n", + $error['Key'],$error['VersionId'],$error['Code'],$error['Message']); + $i++; + } + +} catch ( ObsException $e ) { + echo 'Response Code:' . $e->getStatusCode () . PHP_EOL; + echo 'Error Message:' . $e->getExceptionMessage () . PHP_EOL; + echo 'Error Code:' . $e->getExceptionCode () . PHP_EOL; + echo 'Request ID:' . $e->getRequestId () . PHP_EOL; + echo 'Exception Type:' . $e->getExceptionType () . PHP_EOL; +} finally{ + $obsClient->close (); +} + +function doUploadSync(&$keys, $keyPrefix, $content) +{ + global $obsClient; + global $bucketName; + for($i = 0;$i < 100;$i++){ + $key = $keyPrefix . strval($i); + $obsClient -> putObject(['Bucket' => $bucketName, 'Key' => $key, 'Body' => $content]); + printf("Succeed to put object %s\n\n", $key); + $keys[] = ['Key' => $key]; + } +} + +function doUploadAsync(&$keys, $keyPrefix, $content) +{ + global $obsClient; + global $bucketName; + $promise = null; + for($i = 0;$i < 100;$i++){ + $key = $keyPrefix . strval($i); + $p = $obsClient -> putObjectAsync(['Bucket' => $bucketName, 'Key' => $key, 'Body' => $content], + function($exception, $resp) use ($key){ + printf("Succeed to put object %s\n\n", $key); + }); + if($promise === null){ + $promise = $p; + } + $keys[] = ['Key' => $key]; + } + $promise -> wait(); +} diff --git a/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/DownloadSample.php b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/DownloadSample.php new file mode 100644 index 000000000..9e2ede07f --- /dev/null +++ b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/DownloadSample.php @@ -0,0 +1,101 @@ + $ak, + 'secret' => $sk, + 'endpoint' => $endpoint, + 'socket_timeout' => 30, + 'connect_timeout' => 10 +] ); + +try +{ + /* + * Create bucket + */ + printf("Create a new bucket for demo\n\n"); + $obsClient -> createBucket(['Bucket' => $bucketName]); + + /* + * Upload an object to your bucket + */ + printf("Uploading a new object to OBS\n\n"); + $content = "abcdefghijklmnopqrstuvwxyz\n\t0123456789011234567890\n"; + $obsClient -> putObject(['Bucket' => $bucketName, 'Key' => $objectKey, 'Body' => $content]); + + /* + * Download the object as an inputstream and display it directly + */ + printf("Downloading an object\n"); + $resp = $obsClient -> getObject(['Bucket' => $bucketName, 'Key' => $objectKey]); + printf("\t%s\n\n", $resp['Body']); + + + /* + * Download the object to a file + */ + printf("Downloading an object to local file\n"); + $resp = $obsClient -> getObject(['Bucket' => $bucketName, 'Key' => $objectKey, 'SaveAsFile' => '/temp/' .$objectKey]); + printf("\tSaveAsFile:%s\n\n", $resp['SaveAsFile']); + + + printf("Deleting object %s \n\n", $objectKey); + $obsClient -> deleteObject(['Bucket' => $bucketName, 'Key' => $objectKey]); + + +} catch ( ObsException $e ) { + echo 'Response Code:' . $e->getStatusCode () . PHP_EOL; + echo 'Error Message:' . $e->getExceptionMessage () . PHP_EOL; + echo 'Error Code:' . $e->getExceptionCode () . PHP_EOL; + echo 'Request ID:' . $e->getRequestId () . PHP_EOL; + echo 'Exception Type:' . $e->getExceptionType () . PHP_EOL; +} finally{ + $obsClient->close (); +} \ No newline at end of file diff --git a/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/ListObjectsInFolderSample.php b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/ListObjectsInFolderSample.php new file mode 100644 index 000000000..dcb7e38e4 --- /dev/null +++ b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/ListObjectsInFolderSample.php @@ -0,0 +1,191 @@ + $ak, + 'secret' => $sk, + 'endpoint' => $endpoint, + 'socket_timeout' => 30, + 'connect_timeout' => 10 +] ); + +try +{ + /* + * Create bucket + */ + printf("Create a new bucket for demo\n\n"); + $obsClient -> createBucket(['Bucket' => $bucketName]); + + /* + * First prepare folders and sub folders + */ + $keys = []; + $promise = null; + $keyPrefix = 'MyObjectKey'; + $folderPrefix = 'src'; + $subFolderPrefix = 'test'; + + for($i = 0; $i<5; $i++){ + $key = $folderPrefix . $i . '/'; + $obsClient -> putObject(['Bucket'=>$bucketName, 'Key' => $key]); + $keys[] = ['Key' => $key]; + for($j = 0; $j < 3; $j++){ + $subKey = $key . $subFolderPrefix . $j . '/'; + $obsClient -> putObject(['Bucket'=>$bucketName, 'Key' => $subKey]); + $keys[] = ['Key' => $subKey]; + } + } + + /* + * Insert 2 objects in each folder + */ + $resp = $obsClient -> listObjects(['Bucket' => $bucketName]); + foreach ($resp ['Contents'] as $content ) { + for($k =0; $k < 2; $k++){ + $objectKey = $content['Key'] . $keyPrefix . $k; + $obsClient -> putObject(['Bucket'=>$bucketName, 'Key' => $objectKey, 'Body' => 'Hello OBS']); + $keys[] = ['Key' => $objectKey]; + } + } + + /* + * Insert 2 objects in root path + */ + $obsClient -> putObject(['Bucket'=>$bucketName, 'Key' => $keyPrefix . '0', 'Body' => 'Hello OBS']); + $obsClient -> putObject(['Bucket'=>$bucketName, 'Key' => $keyPrefix . '1', 'Body' => 'Hello OBS']); + printf("Put %d objects completed.\n\n", count($keys)); + + + /* + * List all objects in folder src0/ + */ + printf("List all objects in folder src0/\n\n"); + $resp = $obsClient -> listObjects(['Bucket' => $bucketName, 'Prefix' => 'src0/']); + foreach ( $resp ['Contents'] as $content ) { + printf("\t%s etag[%s]\n", $content ['Key'], $content ['ETag']); + } + printf("\n"); + + /* + * List all objects in sub folder src0/test0/ + */ + + printf("List all objects in folder src0/test0/\n\n"); + $resp = $obsClient -> listObjects(['Bucket' => $bucketName, 'Prefix' => 'src0/test0/']); + foreach ( $resp ['Contents'] as $content ) { + printf("\t%s etag[%s]\n", $content ['Key'], $content ['ETag']); + } + printf("\n"); + + /* + * List all objects group by folder + */ + printf("List all objects group by folder\n\n"); + $resp = $obsClient -> listObjects(['Bucket' => $bucketName, 'Delimiter' => '/']); + printf("Root path:\n"); + foreach ( $resp ['Contents'] as $content ) { + printf("\t%s etag[%s]\n", $content ['Key'], $content ['ETag']); + } + listObjectsByPrefix($resp); + printf("\n"); + + /* + * Delete all the objects created + */ + $resp = $obsClient->deleteObjects([ + 'Bucket'=>$bucketName, + 'Objects'=>$keys, + 'Quiet'=> false, + ]); + + printf("Delete results:\n\n"); + $i = 0; + foreach ($resp['Deleteds'] as $delete) + { + printf("\tDeleteds[$i][Key]:%s,Deleted[$i][VersionId]:%s,Deleted[$i][DeleteMarker]:%s,Deleted[$i][DeleteMarkerVersionId]:%s\n", + $delete['Key'],$delete['VersionId'],$delete['DeleteMarker'],$delete['DeleteMarkerVersionId']); + $i++; + } + printf("\n"); + printf("Error results:\n\n"); + $i = 0; + foreach ($resp['Errors'] as $error) + { + printf("\tErrors[$i][Key]:%s,Errors[$i][VersionId]:%s,Errors[$i][Code]:%s,Errors[$i][Message]:%s\n", + $error['Key'],$error['VersionId'],$error['Code'],$error['Message']); + $i++; + } + +} catch ( ObsException $e ) { + echo 'Response Code:' . $e->getStatusCode () . PHP_EOL; + echo 'Error Message:' . $e->getExceptionMessage () . PHP_EOL; + echo 'Error Code:' . $e->getExceptionCode () . PHP_EOL; + echo 'Request ID:' . $e->getRequestId () . PHP_EOL; + echo 'Exception Type:' . $e->getExceptionType () . PHP_EOL; +} finally{ + $obsClient->close (); +} + + +function listObjectsByPrefix($resp){ + global $obsClient; + global $bucketName; + while(!empty($resp ['CommonPrefixes'])){ + foreach ($resp ['CommonPrefixes'] as $commonPrefix){ + $commonPrefix = $commonPrefix['Prefix']; + printf("Folder %s:\n", $commonPrefix); + $resp = $obsClient -> listObjects(['Bucket' => $bucketName, 'Delimiter' => '/', 'Prefix' => $commonPrefix]); + foreach ( $resp ['Contents'] as $content ) { + printf("\t%s etag[%s]\n", $content ['Key'], $content ['ETag']); + } + listObjectsByPrefix($resp); + } + } + +} diff --git a/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/ListObjectsSample.php b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/ListObjectsSample.php new file mode 100644 index 000000000..2087d9f88 --- /dev/null +++ b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/ListObjectsSample.php @@ -0,0 +1,180 @@ + $ak, + 'secret' => $sk, + 'endpoint' => $endpoint, + 'socket_timeout' => 30, + 'connect_timeout' => 10 +] ); + +try +{ + + /* + * Create bucket + */ + printf("Create a new bucket for demo\n\n"); + $obsClient -> createBucket(['Bucket' => $bucketName]); + + + /* + * First insert 100 objects for demo + */ + $promise = null; + $keyPrefix = 'MyObjectKey'; + for($i = 0;$i < 100;$i++){ + $key = $keyPrefix . strval($i); + $p = $obsClient -> putObjectAsync(['Bucket' => $bucketName, 'Key' => $key, 'Body' => 'Hello OBS'],function(){}); + if($promise === null){ + $promise = $p; + } + $keys[] = ['Key' => $key]; + } + $promise -> wait(); + + printf("Put %d objects completed.\n\n", count($keys)); + + /* + * List objects using default parameters, will return up to 1000 objects + */ + printf("List objects using default parameters:\n"); + + $resp = $obsClient -> listObjects(['Bucket' => $bucketName]); + foreach ( $resp ['Contents'] as $content ) { + printf("\t%s etag[%s]\n", $content ['Key'], $content ['ETag']); + } + printf("\n"); + + /* + * List the first 10 objects + */ + printf("List the first 10 objects:\n"); + + $resp = $obsClient -> listObjects(['Bucket' => $bucketName, 'MaxKeys' => 10]); + foreach ( $resp ['Contents'] as $content ) { + printf("\t%s etag[%s]\n", $content ['Key'], $content ['ETag']); + } + printf("\n"); + + $theSecond10ObjectsMarker = $resp['NextMarker']; + /* + * List the second 10 objects using marker + */ + printf("List the second 10 objects using marker:\n"); + $resp = $obsClient -> listObjects(['Bucket' => $bucketName, 'MaxKeys' => 10, 'Marker' => $theSecond10ObjectsMarker]); + foreach ( $resp ['Contents'] as $content ) { + printf("\t%s etag[%s]\n", $content ['Key'], $content ['ETag']); + } + printf("\n"); + + /* + * List objects with prefix and max keys + */ + printf("List objects with prefix and max keys:\n"); + $resp = $obsClient -> listObjects(['Bucket' => $bucketName, 'MaxKeys' => 5, 'Prefix' => $keyPrefix . '2']); + foreach ( $resp ['Contents'] as $content ) { + printf("\t%s etag[%s]\n", $content ['Key'], $content ['ETag']); + } + printf("\n"); + + /* + * List all the objects in way of pagination + */ + printf("List all the objects in way of pagination:\n"); + $nextMarker = null; + $index = 1; + do{ + + $resp = $obsClient -> listObjects(['Bucket' => $bucketName, 'MaxKeys' => 10, 'Marker' => $nextMarker]); + $nextMarker = $resp['NextMarker']; + printf("Page:%d\n", $index++); + foreach ( $resp ['Contents'] as $content ) { + printf("\t%s etag[%s]\n", $content ['Key'], $content ['ETag']); + } + + }while($resp['IsTruncated']); + printf("\n"); + /* + * Delete all the objects created + */ + $resp = $obsClient->deleteObjects([ + 'Bucket'=>$bucketName, + 'Objects'=>$keys, + 'Quiet'=> false, + ]); + + printf("Delete results:\n\n"); + $i = 0; + foreach ($resp['Deleteds'] as $delete) + { + printf("\tDeleteds[$i][Key]:%s,Deleted[$i][VersionId]:%s,Deleted[$i][DeleteMarker]:%s,Deleted[$i][DeleteMarkerVersionId]:%s\n", + $delete['Key'],$delete['VersionId'],$delete['DeleteMarker'],$delete['DeleteMarkerVersionId']); + $i++; + } + printf("\n"); + printf("Error results:\n\n"); + $i = 0; + foreach ($resp['Errors'] as $error) + { + printf("\tErrors[$i][Key]:%s,Errors[$i][VersionId]:%s,Errors[$i][Code]:%s,Errors[$i][Message]:%s\n", + $error['Key'],$error['VersionId'],$error['Code'],$error['Message']); + $i++; + } + + +} catch ( ObsException $e ) { + echo 'Response Code:' . $e->getStatusCode () . PHP_EOL; + echo 'Error Message:' . $e->getExceptionMessage () . PHP_EOL; + echo 'Error Code:' . $e->getExceptionCode () . PHP_EOL; + echo 'Request ID:' . $e->getRequestId () . PHP_EOL; + echo 'Exception Type:' . $e->getExceptionType () . PHP_EOL; +} finally{ + $obsClient->close (); +} \ No newline at end of file diff --git a/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/ListVersionsSample.php b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/ListVersionsSample.php new file mode 100644 index 000000000..3364ee047 --- /dev/null +++ b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/ListVersionsSample.php @@ -0,0 +1,236 @@ + $ak, + 'secret' => $sk, + 'endpoint' => $endpoint, + 'socket_timeout' => 30, + 'connect_timeout' => 10 +] ); + +try +{ + /* + * Create bucket + */ + printf("Create a new bucket for demo\n\n"); + $obsClient -> createBucket(['Bucket' => $bucketName]); + + /* + * Enable bucket versioning + */ + $obsClient -> setBucketVersioningConfiguration(['Bucket' => $bucketName, 'Status' => 'Enabled']); + + /* + * First prepare folders and sub folders + */ + $keys = []; + $promise = null; + $keyPrefix = 'MyObjectKey'; + $folderPrefix = 'src'; + $subFolderPrefix = 'test'; + + for($i = 0; $i<5; $i++){ + $key = $folderPrefix . $i . '/'; + $obsClient -> putObject(['Bucket'=>$bucketName, 'Key' => $key]); + $keys[] = ['Key' => $key]; + for($j = 0; $j < 3; $j++){ + $subKey = $key . $subFolderPrefix . $j . '/'; + $obsClient -> putObject(['Bucket'=>$bucketName, 'Key' => $subKey]); + $keys[] = ['Key' => $subKey]; + } + } + + /* + * Insert 2 objects in each folder + */ + $resp = $obsClient -> listObjects(['Bucket' => $bucketName]); + foreach ($resp ['Contents'] as $content ) { + for($k =0; $k < 2; $k++){ + $objectKey = $content['Key'] . $keyPrefix . $k; + $obsClient -> putObject(['Bucket'=>$bucketName, 'Key' => $objectKey, 'Body' => 'Hello OBS']); + $keys[] = ['Key' => $objectKey]; + } + } + + /* + * Insert 2 objects in root path + */ + $obsClient -> putObject(['Bucket'=>$bucketName, 'Key' => $keyPrefix . '0', 'Body' => 'Hello OBS']); + $obsClient -> putObject(['Bucket'=>$bucketName, 'Key' => $keyPrefix . '1', 'Body' => 'Hello OBS']); + + printf("Put %d objects completed.\n\n", count($keys)); + + + $keys = []; + + /* + * List versions using default parameters, will return up to 1000 objects + */ + $resp = $obsClient -> listVersions (['Bucket' => $bucketName ]); + printf("\tVersions:\n"); + foreach ( $resp ['Versions'] as $version ) { + printf("\t%s etag[%s] versionid[%s]\n", $version['Key'], $version['ETag'],$version['VersionId']); + $keys[] = ['Key' => $version['Key'], 'VersionId' => $version['VersionId']]; + } + printf("\n"); + + printf("\tDeleteMarkers:\n"); + foreach ( $resp ['DeleteMarkers'] as $deleteMarker ) { + printf("\t%s versionid[%s]\n", $deleteMarker['Key'], $deleteMarker['VersionId']); + $keys[] = ['Key' => $deleteMarker['Key'], 'VersionId' => $deleteMarker['VersionId']]; + } + printf("\n"); + + + /* + * List all the versions in way of pagination + */ + printf("List all the versions in way of pagination:\n"); + $nextMarker = null; + $index = 1; + do{ + $resp = $obsClient -> listVersions(['Bucket' => $bucketName, 'MaxKeys' => 10, 'KeyMarker' => $nextMarker]); + $nextMarker = $resp['NextKeyMarker']; + printf("Page:%d\n", $index++); + + printf("\tVersions:\n"); + foreach ( $resp ['Versions'] as $version ) { + printf("\t%s etag[%s] versionid[%s]\n", $version['Key'], $version['ETag'],$version['VersionId']); + } + + printf("\n"); + printf("\tDeleteMarkers:\n"); + foreach ( $resp ['DeleteMarkers'] as $deleteMarker ) { + printf("\t%s versionid[%s]\n", $deleteMarker['Key'], $deleteMarker['VersionId']); + } + }while($resp['IsTruncated']); + printf("\n"); + + /* + * List all versions group by folder + */ + printf("List all versions group by folder \n"); + $resp = $obsClient -> listVersions(['Bucket' => $bucketName, 'Delimiter' => '/']); + + printf("Root path:\n"); + printf("\tVersions:\n"); + foreach ( $resp ['Versions'] as $version ) { + printf("\t%s etag[%s] versionid[%s]\n", $version['Key'], $version['ETag'],$version['VersionId']); + } + + printf("\n"); + printf("\tDeleteMarkers:\n"); + foreach ( $resp ['DeleteMarkers'] as $deleteMarker ) { + printf("\t%s versionid[%s]\n", $deleteMarker['Key'], $deleteMarker['VersionId']); + } + + listVersionsByPrefix($resp); + + + printf("\n"); + /* + * Delete all the objects created + */ + $resp = $obsClient->deleteObjects([ + 'Bucket'=>$bucketName, + 'Objects'=>$keys, + 'Quiet'=> false, + ]); + + printf("Delete results:\n\n"); + $i = 0; + foreach ($resp['Deleteds'] as $delete) + { + printf("\tDeleteds[$i][Key]:%s,Deleted[$i][VersionId]:%s,Deleted[$i][DeleteMarker]:%s,Deleted[$i][DeleteMarkerVersionId]:%s\n", + $delete['Key'],$delete['VersionId'],$delete['DeleteMarker'],$delete['DeleteMarkerVersionId']); + $i++; + } + printf("\n"); + printf("Error results:\n\n"); + $i = 0; + foreach ($resp['Errors'] as $error) + { + printf("\tErrors[$i][Key]:%s,Errors[$i][VersionId]:%s,Errors[$i][Code]:%s,Errors[$i][Message]:%s\n", + $error['Key'],$error['VersionId'],$error['Code'],$error['Message']); + $i++; + } + +} catch ( ObsException $e ) { + echo 'Response Code:' . $e->getStatusCode () . PHP_EOL; + echo 'Error Message:' . $e->getExceptionMessage () . PHP_EOL; + echo 'Error Code:' . $e->getExceptionCode () . PHP_EOL; + echo 'Request ID:' . $e->getRequestId () . PHP_EOL; + echo 'Exception Type:' . $e->getExceptionType () . PHP_EOL; +} finally{ + $obsClient->close (); +} + +function listVersionsByPrefix($resp){ + global $obsClient; + global $bucketName; + while(!empty($resp ['CommonPrefixes'])){ + foreach ($resp ['CommonPrefixes'] as $commonPrefix){ + $commonPrefix = $commonPrefix['Prefix']; + printf("Folder %s:\n", $commonPrefix); + $resp = $obsClient -> listVersions(['Bucket' => $bucketName, 'Delimiter' => '/', 'Prefix' => $commonPrefix]); + printf("\tVersions:\n"); + foreach ( $resp ['Versions'] as $version ) { + printf("\t%s etag[%s] versionid[%s]\n", $version['Key'], $version['ETag'],$version['VersionId']); + } + printf("\n"); + printf("\tDeleteMarkers:\n"); + foreach ( $resp ['DeleteMarkers'] as $deleteMarker ) { + printf("\t%s versionid[%s]\n", $deleteMarker['Key'], $deleteMarker['VersionId']); + } + listVersionsByPrefix($resp); + } + } + +} \ No newline at end of file diff --git a/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/ObjectMetaSample.php b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/ObjectMetaSample.php new file mode 100644 index 000000000..55edf927a --- /dev/null +++ b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/ObjectMetaSample.php @@ -0,0 +1,107 @@ + $ak, + 'secret' => $sk, + 'endpoint' => $endpoint, + 'socket_timeout' => 30, + 'connect_timeout' => 10 +] ); + +try +{ + /* + * Create bucket + */ + printf("Create a new bucket for demo\n\n"); + $obsClient -> createBucket(['Bucket' => $bucketName]); + + /* + * Create object + */ + $content = 'Hello OBS'; + + /* + * Setting self-defined metadata + */ + + $metadata = []; + + $metadata['meta1'] = 'value1'; + $metadata['meta2'] = 'value2'; + $obsClient -> putObject(['Bucket' => $bucketName, 'Key' => $objectKey, 'Body' => $content, 'Metadata' => $metadata]); + + printf("Create object %s successfully!\n\n", $objectKey); + + /* + * Get object metadata + */ + $resp = $obsClient -> getObjectMetadata(['Bucket' => $bucketName, 'Key' => $objectKey]); + printf("Getting object metadata:\n"); + foreach ($resp['Metadata'] as $key => $value){ + printf("\t%s=%s\n", $key, $value); + } + + /* + * Delete object + */ + $obsClient -> deleteObject(['Bucket' => $bucketName, 'Key' => $objectKey]); + + +} catch ( ObsException $e ) { + echo 'Response Code:' . $e->getStatusCode () . PHP_EOL; + echo 'Error Message:' . $e->getExceptionMessage () . PHP_EOL; + echo 'Error Code:' . $e->getExceptionCode () . PHP_EOL; + echo 'Request ID:' . $e->getRequestId () . PHP_EOL; + echo 'Exception Type:' . $e->getExceptionType () . PHP_EOL; +} finally{ + $obsClient->close (); +} \ No newline at end of file diff --git a/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/ObjectOperationsSample.php b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/ObjectOperationsSample.php new file mode 100644 index 000000000..f18788089 --- /dev/null +++ b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/ObjectOperationsSample.php @@ -0,0 +1,187 @@ + $ak, + 'secret' => $sk, + 'endpoint' => $endpoint, + 'socket_timeout' => 30, + 'connect_timeout' => 10 +] ); + +try +{ + /* + * Create bucket + */ + printf("Create a new bucket for demo\n\n"); + $obsClient -> createBucket(['Bucket' => $bucketName]); + + /* + * Create object + */ + $content = 'Hello OBS'; + $obsClient -> putObject(['Bucket' => $bucketName, 'Key' => $objectKey, 'Body' => $content]); + printf("Create object: %s successfully!\n\n", $objectKey); + + + /* + * Get object metadata + */ + printf("Getting object metadata\n"); + $resp = $obsClient->getObjectMetadata([ + 'Bucket'=>$bucketName, + 'Key'=>$objectKey, + ]); + printf("\tMetadata:%s\n\n", json_encode($resp)); + + /* + * Get object + */ + printf("Getting object content\n"); + $resp = $obsClient -> getObject(['Bucket' => $bucketName, 'Key' => $objectKey]); + printf("\t%s\n\n", $resp['Body']); + + /* + * Copy object + */ + $sourceBucketName = $bucketName; + $destBucketName = $bucketName; + $sourceObjectKey = $objectKey; + $destObjectKey = $objectKey . '-back'; + printf("Copying object\n\n"); + $obsClient -> copyObject([ + 'Bucket'=> $destBucketName, + 'Key'=> $destObjectKey, + 'CopySource'=>$sourceBucketName . '/' . $sourceObjectKey, + 'MetadataDirective' => ObsClient::CopyMetadata + ]); + + /* + * Options object + */ + doObjectOptions(); + + /* + * Put/Get object acl operations + */ + doObjectAclOperations(); + + /* + * Delete object + */ + printf("Deleting objects\n\n"); + $obsClient -> deleteObject(['Bucket' => $bucketName, 'Key' => $objectKey]); + $obsClient -> deleteObject(['Bucket' => $bucketName, 'Key' => $destObjectKey]); + +} catch ( ObsException $e ) { + echo 'Response Code:' . $e->getStatusCode () . PHP_EOL; + echo 'Error Message:' . $e->getExceptionMessage () . PHP_EOL; + echo 'Error Code:' . $e->getExceptionCode () . PHP_EOL; + echo 'Request ID:' . $e->getRequestId () . PHP_EOL; + echo 'Exception Type:' . $e->getExceptionType () . PHP_EOL; +} finally{ + $obsClient->close (); +} + +function doObjectOptions() +{ + + global $obsClient; + global $bucketName; + global $objectKey; + + $obsClient->setBucketCors ( [ + 'Bucket' => $bucketName, + 'CorsRule' => [ + [ + 'AllowedMethod' => ['HEAD', 'GET', 'PUT'], + 'AllowedOrigin' => ['http://www.a.com', 'http://www.b.com'], + 'AllowedHeader'=> ['Authorization'], + 'ExposeHeaders' => ['x-obs-test1', 'x-obs-test2'], + 'MaxAgeSeconds' => 100 + ] + ] + ] ); + + $resp = $obsClient->optionsObject([ + 'Bucket'=>$bucketName, + 'Key' => $objectKey, + 'Origin'=>'http://www.a.com', + 'AccessControlRequestMethods' => ['PUT'], + 'AccessControlRequestHeaders'=> ['Authorization'] + ]); + printf ("Options bucket: %s\n\n", json_encode($resp -> toArray())); + +} + +function doObjectAclOperations() +{ + global $obsClient; + global $bucketName; + global $objectKey; + + printf("Setting object ACL to " . ObsClient::AclPublicRead . "\n\n"); + + $obsClient ->setObjectAcl([ + 'Bucket' => $bucketName, + 'Key' => $objectKey, + 'ACL' => ObsClient::AclPublicRead + ]); + + printf("Getting object ACL\n"); + $resp = $obsClient -> getObjectAcl([ + 'Bucket' => $bucketName, + 'Key' => $objectKey + ]); + printf("\tOwner:%s\n", json_encode($resp['Owner'])); + printf("\tGrants:%s\n\n", json_encode($resp['Grants'])); +} \ No newline at end of file diff --git a/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/ObsPhpDemo.php b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/ObsPhpDemo.php new file mode 100644 index 000000000..a80c2e8cc --- /dev/null +++ b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/ObsPhpDemo.php @@ -0,0 +1,1406 @@ + $ak, + 'secret' => $sk, + 'endpoint' => $endpoint, +)); + +$obsClient->initLog(array ( + 'FilePath' => './logs', + 'FileName' => 'eSDK-OBS-PHP.log', + 'MaxFiles' => 10, + 'Level' => WARN +)); + +$bucketName = 'bucket000'; +$objectKey = 'test'; + +// create bucket +function CreateBucket() { + global $obsClient; + global $bucketName; + echo "create bucket start...\n"; + try { + $resp = $obsClient->createBucket(array ( + 'Bucket' => $bucketName, + 'ACL' => ObsClient::AclPrivate, + 'LocationConstraint' => '', + 'StorageClass' => ObsClient::StorageClassWarm + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("Location:%s\n", $resp ['Location']); + printf("RequestId:%s\n", $resp ['RequestId']); + } catch ( ObsException $e ) { + echo $e; + } +} + +// list buckets +function ListBuckets() { + global $obsClient; + echo "list bucket start...\n"; + try { + $resp = $obsClient->listBuckets(); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ['RequestId']); + $i = 0; + foreach ( $resp ['Buckets'] as $bucket ) { + printf("Buckets[$i][Name]:%s,Buckets[$i][CreationDate]:%s\n", $bucket ['Name'], $bucket ['CreationDate']); + $i ++; + } + printf("Owner[ID]:%s\n", $resp ['Owner'] ['ID']); + } catch ( ObsException $e ) { + echo $e; + } +} + + +// delete bucket +function DeleteBucket() { + global $obsClient; + global $bucketName; + echo "delete bucket start...\n"; + try { + $resp = $obsClient->deleteBucket(array ( + 'Bucket' => $bucketName + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ['RequestId']); + } catch ( ObsException $e ) { + echo $e; + } +} + +// list objects +function ListObjects() { + global $obsClient; + global $bucketName; + echo "list objects start...\n"; + try { + $resp = $obsClient->listObjects(array ( + 'Bucket' => $bucketName, + 'Delimiter' => '', + 'Marker' => '', + 'MaxKeys' => '', + 'Prefix' => '' + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ['RequestId']); + printf("IsTruncated:%d,Marker:%s,NextMarker:%s,Name:%s\n", $resp ['IsTruncated'], $resp ['Marker'], $resp ['NextMarker'], $resp ['Name']); + printf("Prefix:%s,Delimiter:%s,MaxKeys:%d\n", $resp ['Prefix'], $resp ['Delimiter'], $resp ['MaxKeys']); + $i = 0; + foreach ( $resp ['CommonPrefixes'] as $CommonPrefixe ) { + printf("CommonPrefixes[$i][Prefix]:%s\n", $CommonPrefixe ['Prefix']); + $i ++; + } + $i = 0; + foreach ( $resp ['Contents'] as $content ) { + printf("Contents[$i][ETag]:%s,Contents[$i][Size]:%d,Contents[$i][StorageClass]:%s\n", $content ['ETag'], $content ['Size'], $content ['StorageClass']); + printf("Contents[$i][Key]:%s,Contents[$i][LastModified]:%s\n", $content ['Key'], $content ['LastModified']); + printf("Contents[$i][Owner][ID]:%s\n", $content ['Owner'] ['ID']); + $i ++; + } + } catch ( ObsException $e ) { + echo $e; + } +} + +// list versions +function ListVersions() { + global $obsClient; + global $bucketName; + echo "list versions start...\n"; + try { + $resp = $obsClient->listVersions(array ( + 'Bucket' => $bucketName, + 'Delimiter' => '', + 'KeyMarker' => '', + 'MaxKeys' => '', + 'Prefix' => '', + 'VersionIdMarker' => '' + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ['RequestId']); + printf("IsTruncated:%d,KeyMarker:%s,VersionIdMarker:%s,NextKeyMarker:%s\n", $resp ['IsTruncated'], $resp ['KeyMarker'], $resp ['VersionIdMarker'], $resp ['NextKeyMarker']); + printf("NextVersionIdMarker:%s,Name:%s,Prefix:%s,Delimiter:%s,MaxKeys:%s\n", $resp ['NextVersionIdMarker'], $resp ['Name'], $resp ['Prefix'], $resp ['Delimiter'], $resp ['MaxKeys']); + $i = 0; + foreach ( $resp ['CommonPrefixes'] as $CommonPrefixe ) { + printf("CommonPrefixes[$i][Prefix]:%s\n", $CommonPrefixe ['Prefix']); + $i ++; + } + $i = 0; + foreach ( $resp ['Versions'] as $version ) { + printf("Versions[$i][ETag]:%s,Versions[$i][Size]:%d,Versions[$i][StorageClass]:%s\n", $version ['ETag'], $version ['Size'], $version ['StorageClass']); + printf("Versions[$i][Key]:%s,Versions[$i][VersionId]:%s,Versions[$i][IsLatest]:%d,Versions[$i][LastModified]:%s\n", $version ['Key'], $version ['VersionId'], $version ['IsLatest'], $version ['LastModified']); + printf("Versions[$i][Owner][ID]:%s\n", $version ['Owner'] ['ID']); + $i ++; + } + $i = 0; + foreach ( $resp ['DeleteMarkers'] as $deleteMarker ) { + printf("DeleteMarkers[$i][Key]:%s,DeleteMarkers[$i][VersionId]:%s,DeleteMarkers[$i][IsLatest]:%d,DeleteMarkers[$i][LastModified]:%s\n", $deleteMarker ['Key'], $deleteMarker ['VersionId'], $deleteMarker ['IsLatest'], $deleteMarker ['LastModified']); + printf("DeleteMarkers[$i][Owner][ID]:%s\n", $deleteMarker ['Owner'] ['ID']); + $i ++; + } + } catch ( ObsException $e ) { + echo $e; + } +} + +// head bucket +function HeadBucket() { + global $obsClient; + global $bucketName; + echo "head bucket start...\n"; + try { + $resp = $obsClient->headBucket(array ( + 'Bucket' => $bucketName + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ['RequestId']); + } catch ( ObsException $e ) { + echo $e; + } +} + +// get bucket metadata +function GetBucketMetadata() { + global $obsClient; + global $bucketName; + echo "get bucket metatdata start...\n"; + try { + $resp = $obsClient->getBucketMetadata(array ( + "Bucket" => $bucketName, + "Origin" => "www.example.com", + "RequestHeader" => "header1" + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("StorageClass:%s\n", $resp ["StorageClass"]); + printf("AllowOrigin:%s\n", $resp ["AllowOrigin"]); + printf("MaxAgeSeconds:%s\n", $resp ["MaxAgeSeconds"]); + printf("ExposeHeader:%s\n", $resp ["ExposeHeader"]); + printf("AllowHeader:%s\n", $resp ["AllowHeader"]); + printf("AllowMethod:%s\n", $resp ["AllowMethod"]); + } catch ( ObsException $e ) { + echo $e; + } +} + +// get bucket location +function GetBucketLocation() { + global $obsClient; + global $bucketName; + echo "get bucket location start...\n"; + try { + $resp = $obsClient->getBucketLocation(array ( + 'Bucket' => $bucketName + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ['RequestId']); + printf("Location:%s\n", $resp ['Location']); + } catch ( ObsException $e ) { + echo $e; + } +} + +// get bucket storageinfo +function GetBucketStorageInfo() { + global $obsClient; + global $bucketName; + echo "get bucket storage info start...\n"; + try { + $resp = $obsClient->getBucketStorageInfo(array ( + 'Bucket' => $bucketName + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ['RequestId']); + printf("Size:%d,ObjectNumber:%d\n", $resp ['Size'], $resp ['ObjectNumber']); + } catch ( ObsException $e ) { + echo $e; + } +} + + +// set bucket quota +function SetBucketQuota() { + global $obsClient; + global $bucketName; + echo "set bucket quota start...\n"; + try { + $resp = $obsClient->setBucketQuota(array ( + 'Bucket' => $bucketName, + 'StorageQuota' => 1048576 + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ['RequestId']); + } catch ( ObsException $e ) { + echo $e; + } +} + +// get bucket quota +function GetBucketQuota() { + global $obsClient; + global $bucketName; + echo "get bucket quota start...\n"; + try { + $resp = $obsClient->getBucketQuota(array ( + 'Bucket' => $bucketName + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ['RequestId']); + printf("StorageQuota:%s\n", $resp ['StorageQuota']); + } catch ( ObsException $e ) { + echo $e; + } +} + +// set bucket storage policy +function SetBucketStoragePolicy() { + global $obsClient; + global $bucketName; + echo "set bucket storage policy start...\n"; + try { + $resp = $obsClient->setBucketStoragePolicy(array ( + 'Bucket' => $bucketName, + 'StorageClass' => ObsClient::StorageClassCold + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ['RequestId']); + } catch ( ObsException $e ) { + echo $e; + } +} + +// get bucket storage policy +function GetBucketStoragePolicy() { + global $obsClient; + global $bucketName; + echo "get bucket storage policy start...\n"; + try { + $resp = $obsClient->getBucketStoragePolicy(array ( + 'Bucket' => $bucketName + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ['RequestId']); + printf("StorageClass:%s\n", $resp ['StorageClass']); + } catch ( ObsException $e ) { + echo $e; + } +} + + +// set bucket acl +function SetBucketAcl() { + global $obsClient; + global $bucketName; + echo "set bucket ACL start...\n"; + try { + $resp = $obsClient->setBucketAcl(array ( + 'Bucket' => $bucketName, + 'ACL' => '', + 'Owner' => array ( + 'ID' => 'ownerid' + ), + 'Grants' => array ( + 0 => array ( + 'Grantee' => array ( + 'ID' => 'userid' + ), + 'Permission' => ObsClient::PermissionRead, + 'Delivered' => true + ), + 1 => array ( + 'Grantee' => array ( + 'URI' => ObsClient::AllUsers + ), + 'Permission' => ObsClient::PermissionWrite, + 'Delivered' => true + ) + ) + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ['RequestId']); + } catch ( ObsException $e ) { + echo $e; + } +} + +// get bucket acl +function GetBucketAcl() { + global $obsClient; + global $bucketName; + echo "get bucket ACL start...\n"; + try { + $resp = $obsClient->getBucketAcl(array ( + 'Bucket' => $bucketName + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ['RequestId']); + printf("Owner[ID]:%s\n", $resp ['Owner'] ['ID'] ); + $i = 0; + foreach ( $resp ['Grants'] as $grant ) { + printf("Grants[$i][Grantee][ID]:%s,Grants[$i][Grantee][URI]:%s\n",$grant ['Grantee'] ['ID'], $grant ['Grantee'] ['URI']); + printf("Grants[$i][Permission]:%s\n", $grant ['Permission']); + printf("Grants[$i][Delivered]:%s\n", $grant['Delivered'] ? 'true' : 'false'); + $i ++; + } + } catch ( ObsException $e ) { + echo $e; + } +} + +// set bucket logging configuration +function SetBucketLogging() { + global $obsClient; + global $bucketName; + echo "set bucket logging configuration start...\n"; + try { + $resp = $obsClient->setBucketLogging(array ( + 'Bucket' => $bucketName, + 'Agency' => 'your agency', + 'LoggingEnabled' => array ( + 'TargetBucket' => 'bucket003', + 'TargetPrefix' => 'bucket.log', + 'TargetGrants' => array ( + 0 => array ( + 'Grantee' => array ( + 'ID' => 'userid' + ), + 'Permission' => ObsClient::PermissionRead + ), + 1 => array ( + 'Grantee' => array ( + 'URI' => ObsClient::AllUsers, + ), + 'Permission' => ObsClient::PermissionRead + ) + ) + ) + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ['RequestId']); + } catch ( ObsException $e ) { + echo $e; + } +} + +// get bucket logging configuration +function GetBucketLogging() { + global $obsClient; + global $bucketName; + echo "get bucket logging configuration start...\n"; + try { + $resp = $obsClient->getBucketLogging(array ( + 'Bucket' => $bucketName + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ['RequestId']); + printf("Agency:%s\n", $resp ['Agency']); + printf("LoggingEnabled[TargetBucket]:%s,LoggingEnabled[TargetPrefix]:%s\n", $resp ['LoggingEnabled'] ['TargetBucket'], $resp ['LoggingEnabled'] ['TargetPrefix']); + if (is_array($resp ['LoggingEnabled'] ['TargetGrants'])) { + $i = 0; + foreach ( $resp ['LoggingEnabled'] ['TargetGrants'] as $grant ) { + printf("LoggingEnabled[$i][TargetGrants][Permission]:%s\n", $grant ['Permission']); + printf("LoggingEnabled[$i][TargetGrants][Grantee][ID]:%s,LoggingEnabled[$i][TargetGrants][Grantee][URI]:%s\n", $grant ['Grantee'] ['ID'], $grant ['Grantee'] ['URI']); + $i ++; + } + } + } catch ( ObsException $e ) { + echo $e; + } +} + +// set bucket policy +function SetBucketPolicy() { + global $obsClient; + global $bucketName; + echo "set bucket policy start...\n"; + try { + $resp = $obsClient->setBucketPolicy(array ( + 'Bucket' => $bucketName, + 'Policy' => 'your policy' + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ['RequestId']); + } catch ( ObsException $e ) { + echo $e; + } +} + +// get bucket policy +function GetBucketPolicy() { + global $obsClient; + global $bucketName; + echo "get bucket policy start...\n"; + try { + $resp = $obsClient->getBucketPolicy(array ( + 'Bucket' => $bucketName + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("Policy:%s\n", $resp ['Policy']); + printf("RequestId:%s\n", $resp ['RequestId']); + } catch ( ObsException $e ) { + echo $e; + } +} + +// delete bucket policy +function DeleteBucketPolicy() { + global $obsClient; + global $bucketName; + echo "delete bucket policy start...\n"; + try { + $resp = $obsClient->deleteBucketPolicy(array ( + 'Bucket' => $bucketName + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ['RequestId']); + } catch ( ObsException $e ) { + echo $e; + } +} + +// set bucket lifycycle configuration +function SetBucketLifecycle() { + global $obsClient; + global $bucketName; + echo "set bucket lifecycle configuration start...\n"; + try { + $resp = $obsClient->setBucketLifecycle(array ( + 'Bucket' => $bucketName, + 'Rules' => array ( + 0 => array ( + 'ID' => '', + 'Prefix' => 'ok', + 'Status' => 'Enabled', + 'Transitions' => array ( + 0 => array ( + 'StorageClass' => ObsClient::StorageClassWarm, + 'Date' => '2019-02-01T00:00:00Z' + ), + 1 => array ( + 'StorageClass' => ObsClient::StorageClassCold, + 'Date' => '2019-03-01T00:00:00Z' + ) + ), + 'Expiration' => array ( + 'Date' => '2019-04-01T00:00:00Z' + ), + 'NoncurrentVersionTransitions' => array ( + 0 => array ( + 'StorageClass' => ObsClient::StorageClassWarm, + 'NoncurrentDays' => 30 + ), + 1 => array ( + 'StorageClass' => ObsClient::StorageClassCold, + 'NoncurrentDays' => 60 + ) + ), + // 'Expiration'=>array('Days'=>100), + 'NoncurrentVersionExpiration' => array ( + 'NoncurrentDays' => 60 + ) + ) + ) + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ['RequestId']); + } catch ( ObsException $e ) { + echo $e; + } +} + +// get bucket lifycycle configuration +function GetBucketLifecycle() { + global $obsClient; + global $bucketName; + echo "get bucket lifecycle configuration start...\n"; + try { + $resp = $obsClient->getBucketLifecycle(array ( + 'Bucket' => $bucketName + )); + $i = 0; + foreach ( $resp ['Rules'] as $rule ) { + foreach ( $rule ['Transitions'] as $index => $transition ) { + printf("Rules[$i][Transitions][$index][Date]:%s,Rules[$i][Transitions][$index][StorageClass]:%s\n", $transition ['Date'], $transition ['StorageClass']); + } + printf("Rules[$i][Expiration][Date]:%s,Rules[$i][Expiration][Days]:%d\n", $rule ['Expiration'] ['Date'], $rule ['Expiration'] ['Days']); + printf("Rules[$i][NoncurrentVersionExpiration][NoncurrentDays]:%s\n", $rule ['NoncurrentVersionExpiration'] ['NoncurrentDays']); + foreach ( $rule ['NoncurrentVersionTransitions'] as $index => $noncurrentVersionTransition ) { + printf("Rules[$i][NoncurrentVersionTransitions][$index][NoncurrentDays]:%d,Rules[$i][NoncurrentVersionTransitions][$index][StorageClass]:%s\n", $noncurrentVersionTransition ['NoncurrentDays'], $noncurrentVersionTransition ['StorageClass']); + } + printf("Rules[$i][ID]:%s,Rules[$i][Prefix]:%s,Rules[$i][Status]:%s\n", $rule ['ID'], $rule ['Prefix'], $rule ['Status']); + $i ++; + } + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ['RequestId']); + } catch ( ObsException $e ) { + echo $e; + } +} + +// delete bucket lifycycle configuration +function DeleteBucketLifecycle() { + global $obsClient; + global $bucketName; + echo "delete bucket lifecycle configuration start...\n"; + try { + $resp = $obsClient->deleteBucketLifecycle(array ( + 'Bucket' => $bucketName + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ['RequestId']); + } catch ( ObsException $e ) { + echo $e; + } +} + +// set bucket website configuration +function SetBucketWebsite() { + global $obsClient; + global $bucketName; + echo "set bucket website configuration start...\n"; + try { + $resp = $obsClient->setBucketWebsite(array ( + 'Bucket' => $bucketName, + // 'RedirectAllRequestsTo'=>array('HostName'=>'obs.hostname','Protocol'=>'http'), + 'IndexDocument' => array ( + 'Suffix' => 'index.html' + ), + 'ErrorDocument' => array ( + 'Key' => 'error.html' + ), + 'RoutingRules' => array ( + 0 => array ( + 'Condition' => array ( + 'KeyPrefixEquals' => 'docs/', + 'HttpErrorCodeReturnedEquals' => 404 + ), + 'Redirect' => array ( + 'ReplaceKeyPrefixWith' => 'documents/', + 'HostName' => 'obs.hostname', + 'Protocol' => 'http', + 'HttpRedirectCode' => 308 + ) + ) + ) + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ['RequestId']); + } catch ( ObsException $e ) { + echo $e; + } +} + +// get bucket website configuration +function GetBucketWebsite() { + global $obsClient; + global $bucketName; + echo "get bucket website configuration start...\n"; + try { + $resp = $obsClient->GetBucketWebsite(array ( + 'Bucket' => $bucketName + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ['RequestId']); + printf("RedirectAllRequestsTo[HostName]:%s,RedirectAllRequestsTo[Protocol]:%s\n", $resp ['RedirectAllRequestsTo'] ['HostName'], $resp ['RedirectAllRequestsTo'] ['Protocol']); + printf("IndexDocument[Suffix]:%s\n", $resp ['IndexDocument'] ['Suffix']); + printf("ErrorDocument[Key]:%s\n", $resp ['ErrorDocument'] ['Key']); + $i = 0; + foreach ( $resp ['RoutingRules'] as $rout ) { + printf("RoutingRules[$i][Condition][HttpErrorCodeReturnedEquals]:%s,RoutingRules[$i][Condition][KeyPrefixEquals]:%s\n", $rout ['Condition'] ['HttpErrorCodeReturnedEquals'], $rout ['Condition'] ['KeyPrefixEquals']); + printf("RoutingRules[$i][Redirect][Protocol]:%s,RoutingRules[$i][Redirect][HostName]:%s,RoutingRules[$i][Redirect][ReplaceKeyPrefixWith]:%s,RoutingRules[$i][Redirect][ReplaceKeyWith]:%s,RoutingRules[$i][Redirect][HttpRedirectCode]:%s\n", $rout ['Redirect'] ['Protocol'], $rout ['Redirect'] ['HostName'], $rout ['Redirect'] ['ReplaceKeyPrefixWith'], $rout ['Redirect'] ['ReplaceKeyWith'], $rout ['Redirect'] ['HttpRedirectCode']); + $i ++; + } + } catch ( ObsException $e ) { + echo $e; + } +} + +// delete bucket website configuration +function DeleteBucketWebsite() { + global $obsClient; + global $bucketName; + echo "delete bucket website configuration start...\n"; + try { + $resp = $obsClient->deleteBucketWebsite(array ( + 'Bucket' => $bucketName + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ['RequestId']); + } catch ( ObsException $e ) { + echo $e; + } +} + +// set bucket versioning configuration +function SetBucketVersioning() { + global $obsClient; + global $bucketName; + echo "set bucket versioning configuration start...\n"; + try { + $resp = $obsClient->setBucketVersioning(array ( + 'Bucket' => $bucketName, + 'Status' => 'Suspended' + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ['RequestId']); + } catch ( ObsException $e ) { + echo $e; + } +} + +// get bucket versioning configuration +function GetBucketVersioning() { + global $obsClient; + global $bucketName; + echo "get bucket versioning configuration start...\n"; + try { + $resp = $obsClient->getBucketVersioning(array ( + 'Bucket' => $bucketName + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("Status:%s\n", $resp ['Status']); + printf("RequestId:%s\n", $resp ['RequestId']); + } catch ( ObsException $e ) { + echo $e; + } +} + +// set bucket cors +function SetBucketCors() { + global $obsClient; + global $bucketName; + echo "set bucket cors start...\n"; + try { + $resp = $obsClient->setBucketCors(array ( + 'Bucket' => $bucketName, + 'CorsRules' => array ( + 0 => array ( + 'ID' => '123456', + 'AllowedMethod' => array ( + 0 => "PUT", + 1 => "POST", + 2 => "GET", + 3 => "DELETE" + ), + 'AllowedOrigin' => array ( + 0 => "obs.hostname1" + ), + 'AllowedHeader' => array ( + 0 => "header-1", + 1 => "header-2" + ) + ) + ) + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ['RequestId']); + } catch ( ObsException $e ) { + echo $e; + } +} + +// delete bucket cors +function DeleteBucketCors() { + global $obsClient; + global $bucketName; + echo "delete bucket cors start...\n"; + try { + $resp = $obsClient->deleteBucketCors(array ( + 'Bucket' => $bucketName + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ['RequestId']); + } catch ( ObsException $e ) { + echo $e; + } +} + +// get bucket cors +function GetBucketCors() { + global $obsClient; + global $bucketName; + echo "get bucket cors start...\n"; + try { + $resp = $obsClient->getBucketCors(array ( + 'Bucket' => $bucketName + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ['RequestId']); + print_r($resp ['CorsRules']); + } catch ( ObsException $e ) { + echo $e; + } +} + +// options bucket +function OptionsBucket() { + global $obsClient; + global $bucketName; + echo "options bucket start...\n"; + try { + $resp = $obsClient->optionsBucket(array ( + 'Bucket' => $bucketName, + 'Origin' => 'obs.hostname1', + 'AccessControlRequestMethods' => array ( + 0 => "PUT", + 1 => "POST" + ), + 'AccessControlRequestHeaders' => array ( + 0 => "header-1", + 1 => "header-2" + ) + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ['RequestId']); + print_r($resp); + } catch ( ObsException $e ) { + echo $e; + } +} + +// set bucket tagging +function SetBucketTagging() { + global $obsClient; + global $bucketName; + echo "set bucket tagging start...\n"; + try { + $resp = $obsClient->setBucketTagging(array ( + 'Bucket' => $bucketName, + 'Tags' => array ( + 0 => array ( + 'Key' => 'testKey1', + 'Value' => 'testValue1' + ), + 1 => array ( + 'Key' => 'testKey2', + 'Value' => 'testValue2' + ) + ) + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ["RequestId"]); + } catch ( ObsException $e ) { + echo $e; + } +} + +// get bucket tagging +function GetBucketTagging() { + global $obsClient; + global $bucketName; + echo "get bucket tagging start...\n"; + try { + $resp = $obsClient->getBucketTagging(array ( + 'Bucket' => $bucketName + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ["RequestId"]); + foreach ( $resp ["Tags"] as $tag ) { + printf("Tag[%s:%s]\n", $tag ["Key"], $tag ["Value"]); + } + } catch ( ObsException $e ) { + echo $e; + } +} + +// delete bucket tagging +function DeleteBucketTagging() { + global $obsClient; + global $bucketName; + echo "delete bucket tagging start...\n"; + try { + $resp = $obsClient->deleteBucketTagging(array ( + 'Bucket' => $bucketName + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ["RequestId"]); + } catch ( ObsException $e ) { + echo $e; + } +} + +// set bucket notification +function SetBucketNotification() { + global $obsClient; + global $bucketName; + echo "set bucket notification start...\n"; + try { + $resp = $obsClient->setBucketNotification(array ( + 'Bucket' => $bucketName, + 'TopicConfigurations' => array ( + 0 => array ( + 'ID' => '001', + 'Topic' => 'your topic', + 'Event' => array ( + 0 => 'ObjectCreated:*' + ), + 'Filter' => array ( + 0 => array ( + 'Name' => 'prefix', + 'Value' => 'smn/' + ), + 1 => array ( + 'Name' => 'suffix', + 'Value' => '.jpg' + ) + ) + ) + ) + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ["RequestId"]); + } catch ( ObsException $e ) { + echo $e; + } +} + +// get bucket notification +function GetBucketNotification() { + global $obsClient; + global $bucketName; + echo "get bucket notification start...\n"; + try { + $resp = $obsClient->getBucketNotification(array ( + 'Bucket' => $bucketName + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ["RequestId"]); + print_r($resp ['TopicConfigurations']); + } catch ( ObsException $e ) { + echo $e; + } +} + +// delete object +function DeleteObject() { + global $obsClient; + global $bucketName; + global $objectKey; + echo "delete object start...\n"; + try { + $resp = $obsClient->deleteObject(array ( + 'Bucket' => $bucketName, + 'Key' => $objectKey, + 'VersionId' => '' + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ['RequestId']); + printf("DeleteMarker:%s,VersionId:%s\n", $resp ['DeleteMarker'], $resp ['VersionId']); + } catch ( ObsException $e ) { + echo $e; + } +} + +// options object +function OptionsObject() { + global $obsClient; + global $bucketName; + global $objectKey; + echo "options bucket start...\n"; + try { + $resp = $obsClient->optionsObject(array ( + 'Bucket' => $bucketName, + 'Key' => $objectKey, + 'Origin' => 'obs.hostname1', + 'AccessControlRequestMethods' => array ( + "PUT", + "GET" + ), + 'AccessControlRequestHeaders' => array ( + 0 => "header-1", + 1 => "header-2" + ) + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ['RequestId']); + print_r($resp); + } catch ( ObsException $e ) { + echo $e; + } +} + +// delete objects +function DeleteObjects() { + global $obsClient; + global $bucketName; + echo "delete objects start...\n"; + try { + $resp = $obsClient->deleteObjects(array ( + 'Bucket' => $bucketName, + 'Objects' => array ( + 0 => array ( + 'Key' => 'test' + ), + 1 => array ( + 'Key' => 'file.log' + ) + ), + 'Quiet' => false + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ['RequestId']); + $i = 0; + foreach ( $resp ['Errors'] as $error ) { + printf("Errors[$i][Key]:%s,Errors[$i][VersionId]:%s锛孍rrors[$i][Code]:%s锛孍rrors[$i][Message]:%s\n", $error ['Key'], $error ['VersionId'], $error ['Code'], $error ['Message']); + $i ++; + } + $i = 0; + foreach ( $resp ['Deleteds'] as $delete ) { + printf("Deleteds[$i][Key]:%s,Deleted[$i][VersionId]:%s锛孌eleted[$i][DeleteMarker]:%s锛孌eleted[$i][DeleteMarkerVersionId]:%s\n", $delete ['Key'], $delete ['VersionId'], $delete ['DeleteMarker'], $delete ['DeleteMarkerVersionId']); + $i ++; + } + } catch ( ObsException $e ) { + echo $e; + } +} + +// set object acl +function SetObjectAcl() { + global $obsClient; + global $bucketName; + global $objectKey; + echo "set object ACL start...\n"; + try { + $resp = $obsClient->setObjectAcl(array ( + 'Bucket' => $bucketName, + 'Key' => $objectKey, + 'Delivered' => true, + 'Grants' => array ( + 0 => array ( + 'Grantee' => array ( + 'ID' => 'userid', + ), + 'Permission' => ObsClient::PermissionWrite + ), + 1 => array ( + 'Grantee' => array ( + 'URI' => ObsClient::AllUsers + ), + 'Permission' => ObsClient::PermissionRead + ) + ), + 'Owner' => array ( + 'ID' => 'ownerid' + ) + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ['RequestId']); + } catch ( ObsException $e ) { + echo $e; + } +} + +// get object acl +function GetObjectAcl() { + global $obsClient; + global $bucketName; + global $objectKey; + echo "get bucket ACL start...\n"; + try { + $resp = $obsClient->getObjectAcl(array ( + 'Bucket' => $bucketName, + 'Key' => $objectKey + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ['RequestId']); + printf("Owner[ID]:%s\n", $resp ['Owner'] ['ID']); + printf("Delivered:%s\n", $resp['Delivered'] ? 'true' : 'false'); + $i = 0; + foreach ( $resp ['Grants'] as $grant ) { + printf("Grants[$i][Grantee][ID]:%s,Grants[$i][Grantee][URI]:%s\n", $grant ['Grantee'] ['ID'], $grant ['Grantee'] ['URI']); + printf("Grants[$i][Permission]:%s\n", $grant ['Permission']); + $i ++; + } + } catch ( ObsException $e ) { + echo $e; + } +} + +// restore object +function RestoreObject() { + global $obsClient; + global $bucketName; + global $objectKey; + echo "restore object start...\n"; + + try { + $resp = $obsClient->restoreObject(array ( + "Bucket" => $bucketName, + "Key" => $objectKey, + "VersionId" => NULL, + "Days" => 1, + "Tier" => ObsClient::RestoreTierExpedited + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ["RequestId"]); + } catch ( ObsException $e ) { + echo $e; + } +} + +// put object +function PutObject() { + global $obsClient; + global $bucketName; + global $objectKey; + echo "put object start...\n"; + try { + $resp = $obsClient->putObject(array ( + 'Bucket' => $bucketName, + 'Key' => $objectKey, + 'Metadata' => array ( + 'test' => "value" + ), + // 'Body'=>'msg to put', + 'ContentType' => 'text/plain', + 'SourceFile' => '/temp/test.txt' + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ['RequestId']); + printf("ETag:%s,VersionId:%s\n", $resp ['ETag'], $resp ['VersionId']); + } catch ( ObsException $e ) { + echo $e; + } +} + +// get object metadata +function GetObjectMetadata() { + global $obsClient; + global $bucketName; + global $objectKey; + echo "get object metadata start...\n"; + try { + $resp = $obsClient->getObjectMetadata(array ( + 'Bucket' => $bucketName, + 'Key' => $objectKey + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ['RequestId']); + printf("Expiration:%s,LastModified:%s,ContentLength:%d,StorageClass:%s\n", $resp ['Expiration'], $resp ['LastModified'], $resp ['ContentLength'], $resp ['StorageClass']); + printf("ETag:%s,VersionId:%s,WebsiteRedirectLocation:%s\n", $resp ['ETag'], $resp ['VersionId'], $resp ['WebsiteRedirectLocation']); + } catch ( ObsException $e ) { + echo $e; + } +} + +// get object +function GetObject() { + global $obsClient; + global $bucketName; + global $objectKey; + echo "get object start...\n"; + try { + $resp = $obsClient->getObject(array ( + 'Bucket' => $bucketName, + 'Key' => $objectKey, + 'Range' => 'bytes=0-10', + 'SaveAsFile' => '/temp/test.txt' + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ['RequestId']); + printf("Metadata:%s\n", json_encode($resp ['Metadata'])); + printf("DeleteMarker:%s,Expiration:%s,LastModified:%s\n", $resp ['DeleteMarker'], $resp ['Expiration'], $resp ['LastModified']); + printf("ContentLength:%d,ETag:%s,VersionId:%s,SaveAsFile:%s\n", $resp ['ContentLength'], $resp ['ETag'], $resp ['VersionId'], $resp ['SaveAsFile']); + printf("Expires:%s,WebsiteRedirectLocation:%s\n", $resp ['Expires'], $resp ['WebsiteRedirectLocation']); + } catch ( ObsException $e ) { + echo $e; + } +} + +// copy object +function CopyObject() { + global $obsClient; + global $bucketName; + global $objectKey; + echo "copy object start...\n"; + try { + $resp = $obsClient->copyObject(array ( + 'Bucket' => $bucketName, + 'Key' => $objectKey, + 'CopySource' => 'bucket003/test', + 'Metadata' => array ( + 'test' => "value" + ) + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ['RequestId']); + printf("ETag:%s,VersionId:%s,LastModified:%s,CopySourceVersionId:%s\n", $resp ['ETag'], $resp ['VersionId'], $resp ['LastModified'], $resp ['CopySourceVersionId']); + } catch ( ObsException $e ) { + echo $e; + } +} + +// initiate multipart upload +function InitiateMultipartUpload() { + global $obsClient; + global $bucketName; + global $objectKey; + echo "initiate mutipart upload start...\n"; + try { + $resp = $obsClient->initiateMultipartUpload(array ( + 'Bucket' => $bucketName, + 'Key' => $objectKey + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ['RequestId']); + printf("Bucket:%s,Key:%s,UploadId:%s\n", $resp ['Bucket'], $resp ['Key'], $resp ['UploadId']); + } catch ( ObsException $e ) { + echo $e; + } +} + +// abort multipart upload +function AbortMultipartUpload() { + global $obsClient; + global $bucketName; + global $objectKey; + echo "abort mutipart upload start...\n"; + try { + $resp = $obsClient->abortMultipartUpload(array ( + 'Bucket' => $bucketName, + 'Key' => $objectKey, + 'UploadId' => 'uploadid' + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ['RequestId']); + } catch ( ObsException $e ) { + echo $e; + } +} + +// list multipart uploads +function ListMultipartUploads() { + global $obsClient; + global $bucketName; + echo "list mutipart upload start...\n"; + try { + $resp = $obsClient->listMultipartUploads(array ( + 'Bucket' => $bucketName, + 'MaxUploads' => 1000 + )); + printf("RequestId:%s\n", $resp ['RequestId']); + printf("Bucket锛�%s,KeyMarker:%s,UploadIdMarker:%s,NextKeyMarker:%s\n", $resp ['Bucket'], $resp ['KeyMarker'], $resp ['UploadIdMarker'], $resp ['NextKeyMarker']); + printf("Prefix:%s,Delimiter:%s,NextUploadIdMarker:%s,MaxUploads:%d,IsTruncated:%s\n", $resp ['Prefix'], $resp ['Delimiter'], $resp ['NextUploadIdMarker'], $resp ['MaxUploads'], $resp ['IsTruncated']); + $i = 0; + foreach ( $resp ['CommonPrefixes'] as $common ) { + printf("CommonPrefixes[$i][Prefix]:%s\n", $common ['Prefix']); + $i ++; + } + $i = 0; + foreach ( $resp ['Uploads'] as $upload ) { + printf("Uploads[$i][Key]:%s,Uploads[$i][UploadId]:%s,Uploads[$i][StorageClass]:%s,Uploads[$i][Initiated]:%s\n", $upload ['Key'], $upload ['UploadId'], $upload ['StorageClass'], $upload ['Initiated']); + printf("Uploads[$i][Initiator][ID]:%s,Uploads[$i][Initiator][DisplayName]:%s\n", $upload ['Initiator'] ['ID'], $upload ['Initiator'] ['DisplayName']); + printf("Uploads[$i][Owner][ID]:%s,Uploads[$i][Owner][DisplayName]:%s\n", $upload ['Owner'] ['ID'], $upload ['Owner'] ['DisplayName']); + $i ++; + } + } catch ( ObsException $e ) { + echo $e; + } +} + +// upload part +function UploadPart() { + global $obsClient; + global $bucketName; + global $objectKey; + echo "upload part start...\n"; + try { + $resp = $obsClient->uploadPart(array ( + 'Bucket' => $bucketName, + 'Key' => $objectKey, + 'UploadId' => 'uploadid', + 'PartNumber' => 1, + // 'Body' => 'test', + 'SourceFile' => '/temp/test.txt' + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ['RequestId']); + printf("ETag:%s\n", $resp ['ETag']); + } catch ( ObsException $e ) { + echo $e; + } +} + +// copry part +function CopyPart() { + global $obsClient; + global $bucketName; + global $objectKey; + echo "copy part start...\n"; + try { + $resp = $obsClient->copyPart(array ( + 'Bucket' => $bucketName, + 'Key' => $objectKey, + 'UploadId' => 'uploadid', + 'PartNumber' => 1, + 'CopySource' => 'bucket003/test' + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ['RequestId']); + printf("ETag:%s,LastModified:%s\n", $resp ['ETag'], $resp ['LastModified']); + } catch ( ObsException $e ) { + echo $e; + } +} + +// list parts +function ListParts() { + global $obsClient; + global $bucketName; + global $objectKey; + echo "list parts start...\n"; + try { + $resp = $obsClient->listParts(array ( + 'Bucket' => $bucketName, + 'Key' => $objectKey, + 'UploadId' => 'uploadid', + 'MaxParts' => 500, + 'PartNumberMarker' => 0 + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ['RequestId']); + printf("Bucket锛�%s,Key:%s,UploadId:%s,PartNumberMarker:%d\n", $resp ['Bucket'], $resp ['Key'], $resp ['UploadId'], $resp ['PartNumberMarker']); + printf("NextPartNumberMarker:%d,MaxParts:%d,IsTruncated:%d,StorageClass:%s\n", $resp ['NextPartNumberMarker'], $resp ['MaxParts'], $resp ['IsTruncated'], $resp ['StorageClass']); + printf("Initiator[ID]:%s,Initiator[DisplayName]:%s\n", $resp ['Initiator'] ['ID'], $resp ['Initiator'] ['DisplayName']); + printf("Owner[ID]:%s,Owner[DisplayName]:%s\n", $resp ['Owner'] ['ID'], $resp ['Owner'] ['DisplayName']); + $i = 0; + foreach ( $resp ['Parts'] as $part ) { + printf("Parts[$i][PartNumber]:%s,Parts[$i][LastModified]:%s,Parts[$i][ETag]:%s,Parts[$i][Size]:%d\n", $part ['PartNumber'], $part ['LastModified'], $part ['ETag'], $part ['Size']); + $i ++; + } + } catch ( ObsException $e ) { + echo $e; + } +} + +// merge parts +function CompleteMultipartUpload() { + global $obsClient; + global $bucketName; + global $objectKey; + echo "complete multipart upload start...\n"; + try { + $resp = $obsClient->completeMultipartUpload(array ( + 'Bucket' => $bucketName, + 'Key' => $objectKey, + 'UploadId' => 'uploadid', + 'Parts' => array ( + 0 => array ( + 'PartNumber' => 1, + 'ETag' => 'etagvalue' + ) + ) + )); + printf("HttpStatusCode:%s\n", $resp ['HttpStatusCode']); + printf("RequestId:%s\n", $resp ['RequestId']); + printf("Bucket:%s,Key:%s,ETag:%s,VersionId:%s,Location:%s\n", $resp ['Bucket'], $resp ['Key'], $resp ['ETag'], $resp ['VersionId'], $resp ['Location']); + } catch ( ObsException $e ) { + echo $e; + } +} + +//----bucket related apis--- +// CreateBucket(); +// ListBuckets(); +// DeleteBucket(); +// ListObjects(); +// ListVersions(); +// HeadBucket(); +// GetBucketMetadata(); +// GetBucketLocation(); +// GetBucketStorageInfo(); +// SetBucketQuota(); +// GetBucketQuota(); +// SetBucketStoragePolicy(); +// GetBucketStoragePolicy(); +// SetBucketAcl(); +// GetBucketAcl(); +// SetBucketLogging(); +// GetBucketLogging(); +// SetBucketPolicy(); +// GetBucketPolicy(); +// DeleteBucketPolicy(); +// SetBucketLifecycle(); +// GetBucketLifecycle(); +// DeleteBucketLifecycle(); +// SetBucketWebsite(); +// GetBucketWebsite(); +// DeleteBucketWebsite(); +// SetBucketVersioning(); +// GetBucketVersioning(); +// SetBucketCors(); +// GetBucketCors(); +// DeleteBucketCors(); +// OptionsBucket(); +// SetBucketTagging(); +// GetBucketTagging(); +// DeleteBucketTagging(); +// SetBucketNotification(); +// GetBucketNotification(); + +//-----object related apis-------- +// DeleteObject(); +// OptionsObject(); +// SetObjectAcl(); +// GetObjectAcl(); +// RestoreObject(); +// DeleteObjects(); +// PutObject(); +// GetObject(); +// CopyObject(); +// GetObjectMetadata(); +// InitiateMultipartUpload(); +// ListMultipartUploads(); +// AbortMultipartUpload(); +// UploadPart(); +// ListParts(); +// CompleteMultipartUpload(); +// CopyPart(); + + + + + + + + diff --git a/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/PostObjectSample.php b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/PostObjectSample.php new file mode 100644 index 000000000..2f1d32759 --- /dev/null +++ b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/PostObjectSample.php @@ -0,0 +1,227 @@ + $ak, + 'secret' => $sk, + 'endpoint' => $endpoint, + 'socket_timeout' => 30, + 'connect_timeout' => 10, + 'signature' => $signature +]); + +/* + * Create bucket + */ +printf("Create a new bucket for demo\n\n"); +$obsClient -> createBucket(['Bucket' => $bucketName]); + + +/* + * Create sample file + */ +$sampleFilePath = '/temp/text.txt'; +createSampleFile($sampleFilePath); + +/* + * Claim a post object request + */ +$formParams = []; +if (strcasecmp($signature, 'obs') === 0) { + $formParams['x-obs-acl'] = ObsClient::AclPublicRead; +} else { + $formParams['acl'] = ObsClient::AclPublicRead; +} +$formParams['content-type'] = 'text/plain'; + +$res = $obsClient -> createPostSignature(['Bucket' => $bucketName, 'Key' => $objectKey, 'Expires' => 3600, 'FormParams' => $formParams]); + +$formParams['key'] = $objectKey; +$formParams['policy'] = $res['Policy']; + +if (strcasecmp($signature, 'obs') === 0) { + $formParams['Accesskeyid'] = $ak; +} else { + $formParams['AWSAccesskeyid'] = $ak; +} + +$formParams['signature'] = $res['Signature']; + + +printf("Creating object in browser-based post way\n\n"); +$boundary = '9431149156168'; + +$buffers = []; +$contentLength = 0; + +/* + * Construct form data + */ +$buffer = []; +$first = true; +foreach ($formParams as $key => $val){ + if(!$first){ + $buffer[] = "\r\n"; + }else{ + $first = false; + } + + $buffer[] = "--"; + $buffer[] = $boundary; + $buffer[] = "\r\n"; + $buffer[] = "Content-Disposition: form-data; name=\""; + $buffer[] = strval($key); + $buffer[] = "\"\r\n\r\n"; + $buffer[] = strval($val); +} + +$buffer = implode('', $buffer); +$contentLength += strlen($buffer); +$buffers[] = $buffer; + +/* + * Construct file description + */ +$buffer = []; + +$buffer[] = "\r\n"; +$buffer[] = "--"; +$buffer[] = $boundary; +$buffer[] = "\r\n"; +$buffer[] = "Content-Disposition: form-data; name=\"file\"; filename=\""; +$buffer[] = "myfile"; +$buffer[] = "\"\r\n"; +$buffer[] = "Content-Type: text/plain"; +$buffer[] = "\r\n\r\n"; + +$buffer = implode('', $buffer); +$contentLength += strlen($buffer); +$buffers[] = $buffer; + +/* + * Construct file data + */ +$buffer = []; + +$fp = fopen($sampleFilePath, 'r'); +if($fp){ + while(!feof($fp)){ + $buffer[] = fgetc($fp); + } + fclose($fp); +} + +$buffer = implode('', $buffer); +$contentLength += strlen($buffer); +$buffers[] = $buffer; + +/* + * Contruct end data + */ +$buffer = []; +$buffer[] = "\r\n--"; +$buffer[] = $boundary; +$buffer[] = "--\r\n"; + +$buffer = implode('', $buffer); +$contentLength += strlen($buffer); +$buffers[] = $buffer; + + +$httpClient = new Client(['verify' => false]); +$host = parse_url($endpoint)['host']; +$host = $bucketName . '.' . $host; +$url = 'https://' . $host . ':443'; +$headers = ['Content-Length' => strval($contentLength), 'Content-Type' => 'multipart/form-data; boundary=' . $boundary]; + +try{ + $response = $httpClient -> request('POST', $url, ['body' => implode('', $buffers), 'headers'=> $headers]); + + printf('Post object successfully!'); + $response -> getBody()-> close(); +}catch (ClientException $ex){ + printf('Exception message:%s', $ex ->getMessage()); +} + + +if(file_exists($sampleFilePath)){ + unlink($sampleFilePath); +} + +function createSampleFile($filePath) +{ + if(file_exists($filePath)){ + return; + } + $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+'))) + { + fwrite($fp, uniqid() . "\n"); + fwrite($fp, uniqid() . "\n"); + } + }finally{ + if($fp){ + fclose($fp); + } + } + } +} diff --git a/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/RestoreObjectSample.php b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/RestoreObjectSample.php new file mode 100644 index 000000000..a4bbb0e1d --- /dev/null +++ b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/RestoreObjectSample.php @@ -0,0 +1,110 @@ + $ak, + 'secret' => $sk, + 'endpoint' => $endpoint, + 'socket_timeout' => 30, + 'connect_timeout' => 10 +] ); + +try +{ + /* + * Create a cold bucket + */ + printf("Create a new cold bucket for demo\n\n"); + $obsClient -> createBucket(['Bucket' => $bucketName, 'StorageClass' => ObsClient::StorageClassCold]); + + /* + * Create a cold object + */ + printf("Create a new cold object for demo\n\n"); + $content = 'Hello OBS'; + $obsClient -> putObject(['Bucket' => $bucketName, 'Key' => $objectKey, 'Body' => $content]); + + /* + * Restore the cold object + */ + printf("Restore the cold object\n\n"); + $obsClient -> restoreObject([ + 'Bucket' => $bucketName, + 'Key' => $objectKey, + 'Days' => 1, + 'Tier' => ObsClient::RestoreTierExpedited + ]); + + /* + * Wait 6 minute to get the object + */ + sleep(60 * 6); + + /* + * Get the cold object + */ + printf("Get the cold object\n"); + $resp = $obsClient -> getObject(['Bucket' => $bucketName, 'Key' => $objectKey]); + printf("\t%s\n\n", $resp['Body']); + + /* + * Delete the cold object + */ + $obsClient -> deleteObject(['Bucket' => $bucketName, 'Key' => $objectKey]); + +} catch ( ObsException $e ) { + echo 'Response Code:' . $e->getStatusCode () . PHP_EOL; + echo 'Error Message:' . $e->getExceptionMessage () . PHP_EOL; + echo 'Error Code:' . $e->getExceptionCode () . PHP_EOL; + echo 'Request ID:' . $e->getRequestId () . PHP_EOL; + echo 'Exception Type:' . $e->getExceptionType () . PHP_EOL; +} finally{ + $obsClient->close (); +} \ No newline at end of file diff --git a/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/SimpleMultipartUploadSample.php b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/SimpleMultipartUploadSample.php new file mode 100644 index 000000000..950f26995 --- /dev/null +++ b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/SimpleMultipartUploadSample.php @@ -0,0 +1,109 @@ + $ak, + 'secret' => $sk, + 'endpoint' => $endpoint, + 'socket_timeout' => 30, + 'connect_timeout' => 10 +] ); + +try +{ + printf("Create a new bucket for demo\n\n"); + $obsClient -> createBucket(['Bucket' => $bucketName]); + + /* + * Step 1: initiate multipart upload + */ + printf("Step 1: initiate multipart upload\n\n"); + + $resp = $obsClient -> initiateMultipartUpload(['Bucket'=>$bucketName, + 'Key'=>$objectKey]); + + $uploadId = $resp['UploadId']; + /* + * Step 2: upload a part + */ + printf("Step 2: upload a part\n\n"); + $resp = $obsClient->uploadPart([ + 'Bucket'=>$bucketName, + 'Key' => $objectKey, + 'UploadId'=>$uploadId, + 'PartNumber'=>1, + 'Body' => 'Hello OBS' + ]); + + $etag = $resp['ETag']; + + /* + * Step 3: complete multipart upload + */ + printf("Step 3: complete multipart upload\n\n"); + $obsClient->completeMultipartUpload([ + 'Bucket'=>$bucketName, + 'Key'=>$objectKey, + 'UploadId'=>$uploadId, + 'Parts'=>[ + ['PartNumber'=>1,'ETag'=>$etag] + ], + ]); + + +} catch ( ObsException $e ) { + echo 'Response Code:' . $e->getStatusCode () . PHP_EOL; + echo 'Error Message:' . $e->getExceptionMessage () . PHP_EOL; + echo 'Error Code:' . $e->getExceptionCode () . PHP_EOL; + echo 'Request ID:' . $e->getRequestId () . PHP_EOL; + echo 'Exception Type:' . $e->getExceptionType () . PHP_EOL; +} finally{ + $obsClient->close (); +} \ No newline at end of file diff --git a/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/TemporarySignatureSample.php b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/TemporarySignatureSample.php new file mode 100644 index 000000000..cea21bfbf --- /dev/null +++ b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/examples/TemporarySignatureSample.php @@ -0,0 +1,151 @@ + $ak, + 'secret' => $sk, + 'endpoint' => $endpoint, + 'socket_timeout' => 30, + 'connect_timeout' => 10 +] ); + +$httpClient = new Client(['verify' => false]); + +/* + * Create bucket + */ +$method = 'PUT'; +$res = $obsClient -> createSignedUrl(['Bucket' => $bucketName, 'Method' => $method]); +doAction('Create bucket', $method, $res['SignedUrl']); + +/* + * Set/Get/Delete bucket cors + */ +$method = 'PUT'; +$content = 'PUThttp://www.a.comheader1100header2'; +$headers = ['Content-Length'=> strval(strlen($content)), 'Content-MD5' => base64_encode(md5($content, true))]; +$res = $obsClient -> createSignedUrl(['Bucket' => $bucketName, 'Method' => $method, 'SpecialParam' => 'cors', 'Headers' => $headers]); +doAction('Set bucket cors ', $method, $res['SignedUrl'], $content, $res['ActualSignedRequestHeaders']); + + +$method = 'GET'; +$res= $obsClient -> createSignedUrl(['Bucket' => $bucketName, 'Method' => $method, 'SpecialParam' => 'cors']); +doAction('Get bucket cors ', $method, $res['SignedUrl']); + +$method = 'DELETE'; +$res= $obsClient -> createSignedUrl(['Bucket' => $bucketName, 'Method' => $method, 'SpecialParam' => 'cors']); +doAction('Delete bucket cors ', $method, $res['SignedUrl']); + +/* + * Create object + */ +$method = 'PUT'; +$content = 'Hello OBS'; +$headers = ['Content-Length'=> strval(strlen($content))]; +$res = $obsClient -> createSignedUrl(['Method' => $method, 'Bucket' => $bucketName, 'Key' => $objectKey, 'Headers'=> $headers]); +doAction('Create object', $method, $res['SignedUrl'], $content, $res['ActualSignedRequestHeaders']); + + +/* + * Get object + */ +$method = 'GET'; +$res = $obsClient -> createSignedUrl(['Method' => $method, 'Bucket' => $bucketName, 'Key' => $objectKey]); +doAction('Get object', $method, $res['SignedUrl']); + +/* + * Set/Get object acl + */ +$method = 'PUT'; +$headers = ['x-amz-acl'=> ObsClient::AclPublicRead]; +$res = $obsClient -> createSignedUrl(['Method' => $method, 'Bucket' => $bucketName, 'Key' => $objectKey, 'Headers'=> $headers, 'SpecialParam' => 'acl']); +doAction('Set object Acl', $method, $res['SignedUrl'], null, $res['ActualSignedRequestHeaders']); + + +$method = 'GET'; +$res = $obsClient -> createSignedUrl(['Method' => $method, 'Bucket' => $bucketName, 'Key' => $objectKey, 'SpecialParam' => 'acl']); +doAction('Get object Acl', $method, $res['SignedUrl']); + +/* + * Delete object + */ +$method = 'DELETE'; +$res = $obsClient -> createSignedUrl(['Method' => $method, 'Bucket' => $bucketName, 'Key' => $objectKey]); +doAction('Delete object', $method, $res['SignedUrl']); + +/* + * Delete bucket + */ +$method = 'DELETE'; +$res = $obsClient -> createSignedUrl(['Bucket' => $bucketName, 'Method' => $method]); +doAction('Delete bucket', $method, $res['SignedUrl']); + + +function doAction($msg, $method, $url, $content=null, $headers=null){ + global $httpClient; + + try{ + $response = $httpClient -> request($method, $url, ['body' => $content, 'headers'=> $headers]); + printf("%s using temporary signature url:\n", $msg); + printf("\t%s successfully.\n", $url); + printf("\tStatus:%d\n", $response -> getStatusCode()); + printf("\tContent:%s\n", $response -> getBody() -> getContents()); + $response -> getBody()-> close(); + }catch (ClientException $ex){ + printf("%s using temporary signature url:\n", $msg); + printf("\t%s failed!\n", $url); + printf('Exception message:%s', $ex ->getMessage()); + } + + printf("\n"); +} + + + diff --git a/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/obs-autoloader.php b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/obs-autoloader.php new file mode 100644 index 000000000..98bef9aa4 --- /dev/null +++ b/niucloud/vendor/365taofang/huaweicloud-sdk-php-obs/obs-autoloader.php @@ -0,0 +1,37 @@ + __DIR__.'/Obs/Internal/Common/CheckoutStream.php', + 'Obs\Internal\Common\ITransform' => __DIR__.'/Obs/Internal/Common/ITransform.php', + 'Obs\Internal\Common\Model' => __DIR__.'/Obs/Internal/Common/Model.php', + 'Obs\Internal\Common\ObsTransform' => __DIR__.'/Obs/Internal/Common/ObsTransform.php', + 'Obs\Internal\Common\SchemaFormatter' => __DIR__.'/Obs/Internal/Common/SchemaFormatter.php', + 'Obs\Internal\Common\SdkCurlFactory' => __DIR__.'/Obs/Internal/Common/SdkCurlFactory.php', + 'Obs\Internal\Common\SdkStreamHandler' => __DIR__.'/Obs/Internal/Common/SdkStreamHandler.php', + 'Obs\Internal\Common\ToArrayInterface' => __DIR__.'/Obs/Internal/Common/ToArrayInterface.php', + 'Obs\Internal\Common\V2Transform' => __DIR__.'/Obs/Internal/Common/V2Transform.php', + 'Obs\Internal\GetResponseTrait' => __DIR__.'/Obs/Internal/GetResponseTrait.php', + 'Obs\Internal\Resource\Constants' => __DIR__.'/Obs/Internal/Resource/Constants.php', + 'Obs\Internal\Resource\OBSConstants' => __DIR__.'/Obs/Internal/Resource/OBSConstants.php', + 'Obs\Internal\Resource\OBSRequestResource' => __DIR__.'/Obs/Internal/Resource/OBSRequestResource.php', + 'Obs\Internal\Resource\V2Constants' => __DIR__.'/Obs/Internal/Resource/V2Constants.php', + 'Obs\Internal\Resource\V2RequestResource' => __DIR__.'/Obs/Internal/Resource/V2RequestResource.php', + 'Obs\Internal\SendRequestTrait' => __DIR__.'/Obs/Internal/SendRequestTrait.php', + 'Obs\Internal\Signature\AbstractSignature' => __DIR__.'/Obs/Internal/Signature/AbstractSignature.php', + 'Obs\Internal\Signature\DefaultSignature' => __DIR__.'/Obs/Internal/Signature/DefaultSignature.php', + 'Obs\Internal\Signature\SignatureInterface' => __DIR__.'/Obs/Internal/Signature/SignatureInterface.php', + 'Obs\Internal\Signature\V4Signature' => __DIR__.'/Obs/Internal/Signature/V4Signature.php', + 'Obs\Log\ObsConfig' => __DIR__.'/Obs/Log/ObsConfig.php', + 'Obs\Log\ObsLog' => __DIR__.'/Obs/Log/ObsLog.php', + 'Obs\ObsClient' => __DIR__.'/Obs/ObsClient.php', + 'Obs\ObsImageClient' => __DIR__.'/Obs/ObsImageClient.php', + 'Obs\ObsException' => __DIR__.'/Obs/ObsException.php', +]; + + +spl_autoload_register(function ($class) use ($mapping) { + if (isset($mapping[$class])) { + require $mapping[$class]; + } +}, true); diff --git a/niucloud/vendor/composer/InstalledVersions.php b/niucloud/vendor/composer/InstalledVersions.php index 51e734a77..c6b54af7b 100644 --- a/niucloud/vendor/composer/InstalledVersions.php +++ b/niucloud/vendor/composer/InstalledVersions.php @@ -98,7 +98,7 @@ class InstalledVersions { foreach (self::getInstalled() as $installed) { if (isset($installed['versions'][$packageName])) { - return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false; + return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']); } } @@ -119,7 +119,7 @@ class InstalledVersions */ public static function satisfies(VersionParser $parser, $packageName, $constraint) { - $constraint = $parser->parseConstraints((string) $constraint); + $constraint = $parser->parseConstraints($constraint); $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); return $provided->matches($constraint); @@ -328,9 +328,7 @@ class InstalledVersions if (isset(self::$installedByVendor[$vendorDir])) { $installed[] = self::$installedByVendor[$vendorDir]; } elseif (is_file($vendorDir.'/composer/installed.php')) { - /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */ - $required = require $vendorDir.'/composer/installed.php'; - $installed[] = self::$installedByVendor[$vendorDir] = $required; + $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php'; if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { self::$installed = $installed[count($installed) - 1]; } @@ -342,17 +340,12 @@ class InstalledVersions // only require the installed.php file if this file is loaded from its dumped location, // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 if (substr(__DIR__, -8, 1) !== 'C') { - /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */ - $required = require __DIR__ . '/installed.php'; - self::$installed = $required; + self::$installed = require __DIR__ . '/installed.php'; } else { self::$installed = array(); } } - - if (self::$installed !== array()) { - $installed[] = self::$installed; - } + $installed[] = self::$installed; return $installed; } diff --git a/niucloud/vendor/composer/autoload_psr4.php b/niucloud/vendor/composer/autoload_psr4.php index e6a5263f2..5ac1441af 100644 --- a/niucloud/vendor/composer/autoload_psr4.php +++ b/niucloud/vendor/composer/autoload_psr4.php @@ -57,6 +57,7 @@ return array( 'Psr\\Cache\\' => array($vendorDir . '/psr/cache/src'), 'PhpOffice\\PhpSpreadsheet\\' => array($vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet'), 'Overtrue\\Socialite\\' => array($vendorDir . '/overtrue/socialite/src'), + 'Obs\\' => array($vendorDir . '/365taofang/huaweicloud-sdk-php-obs/Obs'), 'OSS\\' => array($vendorDir . '/aliyuncs/oss-sdk-php/src/OSS'), 'Nyholm\\Psr7\\' => array($vendorDir . '/nyholm/psr7/src'), 'Nyholm\\Psr7Server\\' => array($vendorDir . '/nyholm/psr7-server/src'), diff --git a/niucloud/vendor/composer/autoload_static.php b/niucloud/vendor/composer/autoload_static.php index c7be02155..9808f331e 100644 --- a/niucloud/vendor/composer/autoload_static.php +++ b/niucloud/vendor/composer/autoload_static.php @@ -126,6 +126,7 @@ class ComposerStaticInitf082efa3600aae2b847c3e8b4e641a4e 'O' => array ( 'Overtrue\\Socialite\\' => 19, + 'Obs\\' => 4, 'OSS\\' => 4, ), 'N' => @@ -411,6 +412,10 @@ class ComposerStaticInitf082efa3600aae2b847c3e8b4e641a4e array ( 0 => __DIR__ . '/..' . '/overtrue/socialite/src', ), + 'Obs\\' => + array ( + 0 => __DIR__ . '/..' . '/365taofang/huaweicloud-sdk-php-obs/Obs', + ), 'OSS\\' => array ( 0 => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS', diff --git a/niucloud/vendor/composer/installed.json b/niucloud/vendor/composer/installed.json index d2c047459..19e1cb4cc 100644 --- a/niucloud/vendor/composer/installed.json +++ b/niucloud/vendor/composer/installed.json @@ -1,5 +1,56 @@ { "packages": [ + { + "name": "365taofang/huaweicloud-sdk-php-obs", + "version": "3.23.501", + "version_normalized": "3.23.501.0", + "source": { + "type": "git", + "url": "https://github.com/365taofang/huaweicloud-sdk-php-obs.git", + "reference": "85448144b10d26c1b4c15388a2ea11a76e41a1b5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/365taofang/huaweicloud-sdk-php-obs/zipball/85448144b10d26c1b4c15388a2ea11a76e41a1b5", + "reference": "85448144b10d26c1b4c15388a2ea11a76e41a1b5", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "guzzlehttp/guzzle": "^6.3.0 || ^7.0", + "guzzlehttp/psr7": "^1.4.2 || ^2.0", + "monolog/monolog": "^1.23.0 || ^2.0", + "php": ">=5.6.0", + "psr/http-message": "^1.0" + }, + "time": "2023-09-15T00:55:23+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Obs\\": "Obs/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "OBS PHP SDK", + "keywords": [ + "OBS", + "php" + ], + "support": { + "issues": "https://github.com/365taofang/huaweicloud-sdk-php-obs/issues", + "source": "https://github.com/365taofang/huaweicloud-sdk-php-obs/tree/v3.23.501" + }, + "install-path": "../365taofang/huaweicloud-sdk-php-obs" + }, { "name": "adbario/php-dot-notation", "version": "2.5.0", diff --git a/niucloud/vendor/composer/installed.php b/niucloud/vendor/composer/installed.php index 6b241505e..95e0a186c 100644 --- a/niucloud/vendor/composer/installed.php +++ b/niucloud/vendor/composer/installed.php @@ -3,13 +3,22 @@ 'name' => 'topthink/think', 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => 'bae20a9f6c76fb67dc5ac0d66e572567b6217cef', + 'reference' => '783127440ec6e7540af2a2126eefb22fad7895ff', 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev' => true, ), 'versions' => array( + '365taofang/huaweicloud-sdk-php-obs' => array( + 'pretty_version' => '3.23.501', + 'version' => '3.23.501.0', + 'reference' => '85448144b10d26c1b4c15388a2ea11a76e41a1b5', + 'type' => 'library', + 'install_path' => __DIR__ . '/../365taofang/huaweicloud-sdk-php-obs', + 'aliases' => array(), + 'dev_requirement' => false, + ), 'adbario/php-dot-notation' => array( 'pretty_version' => '2.5.0', 'version' => '2.5.0.0', @@ -774,7 +783,7 @@ 'topthink/think' => array( 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => 'bae20a9f6c76fb67dc5ac0d66e572567b6217cef', + 'reference' => '783127440ec6e7540af2a2126eefb22fad7895ff', 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), diff --git a/niucloud/vendor/kosinix/grafika/src/Grafika/Gd/Editor.php b/niucloud/vendor/kosinix/grafika/src/Grafika/Gd/Editor.php index 1fb29a57f..f51b8d2df 100644 --- a/niucloud/vendor/kosinix/grafika/src/Grafika/Gd/Editor.php +++ b/niucloud/vendor/kosinix/grafika/src/Grafika/Gd/Editor.php @@ -660,7 +660,7 @@ final class Editor implements EditorInterface $resizeWidth = $newHeight * $ratio; } - $this->_resize($image, $resizeWidth, $resizeHeight); + $this->_resize($image, round($resizeWidth, 2), round($resizeHeight, 2)); return $this; } diff --git a/niucloud/vendor/services.php b/niucloud/vendor/services.php index bea9f7bd2..f383fad85 100644 --- a/niucloud/vendor/services.php +++ b/niucloud/vendor/services.php @@ -1,5 +1,5 @@ 'think\\captcha\\CaptchaService',