wupengfei 2 年之前
父節點
當前提交
df816601f2
共有 100 個文件被更改,包括 9741 次插入1607 次删除
  1. 10 0
      .idea/gaoyixia.iml
  2. 10 0
      .idea/php.xml
  3. 1 1543
      .idea/workspace.xml
  4. 48 62
      application/api/controller/VideoHls.php
  5. 2 1
      composer.json
  6. 560 1
      composer.lock
  7. 14 0
      vendor/alibabacloud/credentials/CHANGELOG.md
  8. 30 0
      vendor/alibabacloud/credentials/CONTRIBUTING.md
  9. 13 0
      vendor/alibabacloud/credentials/LICENSE.md
  10. 88 0
      vendor/alibabacloud/credentials/NOTICE.md
  11. 250 0
      vendor/alibabacloud/credentials/README-zh-CN.md
  12. 251 0
      vendor/alibabacloud/credentials/README.md
  13. 21 0
      vendor/alibabacloud/credentials/SECURITY.md
  14. 6 0
      vendor/alibabacloud/credentials/UPGRADING.md
  15. 104 0
      vendor/alibabacloud/credentials/composer.json
  16. 72 0
      vendor/alibabacloud/credentials/src/AccessKeyCredential.php
  17. 53 0
      vendor/alibabacloud/credentials/src/BearerTokenCredential.php
  18. 182 0
      vendor/alibabacloud/credentials/src/Credential.php
  19. 50 0
      vendor/alibabacloud/credentials/src/Credential/Config.php
  20. 102 0
      vendor/alibabacloud/credentials/src/Credentials.php
  21. 23 0
      vendor/alibabacloud/credentials/src/CredentialsInterface.php
  22. 151 0
      vendor/alibabacloud/credentials/src/EcsRamRoleCredential.php
  23. 134 0
      vendor/alibabacloud/credentials/src/Filter.php
  24. 202 0
      vendor/alibabacloud/credentials/src/Helper.php
  25. 98 0
      vendor/alibabacloud/credentials/src/MockTrait.php
  26. 187 0
      vendor/alibabacloud/credentials/src/Providers/ChainProvider.php
  27. 94 0
      vendor/alibabacloud/credentials/src/Providers/EcsRamRoleProvider.php
  28. 82 0
      vendor/alibabacloud/credentials/src/Providers/Provider.php
  29. 49 0
      vendor/alibabacloud/credentials/src/Providers/RamRoleArnProvider.php
  30. 53 0
      vendor/alibabacloud/credentials/src/Providers/RsaKeyPairProvider.php
  31. 218 0
      vendor/alibabacloud/credentials/src/RamRoleArnCredential.php
  32. 37 0
      vendor/alibabacloud/credentials/src/Request/AssumeRole.php
  33. 33 0
      vendor/alibabacloud/credentials/src/Request/GenerateSessionAccessKey.php
  34. 155 0
      vendor/alibabacloud/credentials/src/Request/Request.php
  35. 158 0
      vendor/alibabacloud/credentials/src/RsaKeyPairCredential.php
  36. 47 0
      vendor/alibabacloud/credentials/src/Signature/BearerTokenSignature.php
  37. 47 0
      vendor/alibabacloud/credentials/src/Signature/ShaHmac1Signature.php
  38. 47 0
      vendor/alibabacloud/credentials/src/Signature/ShaHmac256Signature.php
  39. 64 0
      vendor/alibabacloud/credentials/src/Signature/ShaHmac256WithRsaSignature.php
  40. 34 0
      vendor/alibabacloud/credentials/src/Signature/SignatureInterface.php
  41. 98 0
      vendor/alibabacloud/credentials/src/StsCredential.php
  42. 15 0
      vendor/alibabacloud/darabonba-openapi/.gitignore
  43. 65 0
      vendor/alibabacloud/darabonba-openapi/.php_cs.dist
  44. 31 0
      vendor/alibabacloud/darabonba-openapi/README-CN.md
  45. 31 0
      vendor/alibabacloud/darabonba-openapi/README.md
  46. 15 0
      vendor/alibabacloud/darabonba-openapi/autoload.php
  47. 34 0
      vendor/alibabacloud/darabonba-openapi/composer.json
  48. 433 0
      vendor/alibabacloud/darabonba-openapi/src/Models/Config.php
  49. 49 0
      vendor/alibabacloud/darabonba-openapi/src/Models/GlobalParameters.php
  50. 81 0
      vendor/alibabacloud/darabonba-openapi/src/Models/OpenApiRequest.php
  51. 137 0
      vendor/alibabacloud/darabonba-openapi/src/Models/Params.php
  52. 1123 0
      vendor/alibabacloud/darabonba-openapi/src/OpenApiClient.php
  53. 13 0
      vendor/alibabacloud/endpoint-util/.gitignore
  54. 65 0
      vendor/alibabacloud/endpoint-util/.php_cs.dist
  55. 13 0
      vendor/alibabacloud/endpoint-util/LICENSE
  56. 31 0
      vendor/alibabacloud/endpoint-util/README-CN.md
  57. 31 0
      vendor/alibabacloud/endpoint-util/README.md
  58. 42 0
      vendor/alibabacloud/endpoint-util/composer.json
  59. 32 0
      vendor/alibabacloud/endpoint-util/phpunit.xml
  60. 61 0
      vendor/alibabacloud/endpoint-util/src/Endpoint.php
  61. 58 0
      vendor/alibabacloud/endpoint-util/tests/EndpointTest.php
  62. 3 0
      vendor/alibabacloud/endpoint-util/tests/bootstrap.php
  63. 15 0
      vendor/alibabacloud/gateway-spi/.gitignore
  64. 65 0
      vendor/alibabacloud/gateway-spi/.php_cs.dist
  65. 15 0
      vendor/alibabacloud/gateway-spi/autoload.php
  66. 30 0
      vendor/alibabacloud/gateway-spi/composer.json
  67. 35 0
      vendor/alibabacloud/gateway-spi/src/Client.php
  68. 47 0
      vendor/alibabacloud/gateway-spi/src/Models/AttributeMap.php
  69. 63 0
      vendor/alibabacloud/gateway-spi/src/Models/InterceptorContext.php
  70. 83 0
      vendor/alibabacloud/gateway-spi/src/Models/InterceptorContext/configuration.php
  71. 220 0
      vendor/alibabacloud/gateway-spi/src/Models/InterceptorContext/request.php
  72. 54 0
      vendor/alibabacloud/gateway-spi/src/Models/InterceptorContext/response.php
  73. 15 0
      vendor/alibabacloud/openapi-util/.gitignore
  74. 65 0
      vendor/alibabacloud/openapi-util/.php_cs.dist
  75. 31 0
      vendor/alibabacloud/openapi-util/README-CN.md
  76. 31 0
      vendor/alibabacloud/openapi-util/README.md
  77. 17 0
      vendor/alibabacloud/openapi-util/autoload.php
  78. 45 0
      vendor/alibabacloud/openapi-util/composer.json
  79. 31 0
      vendor/alibabacloud/openapi-util/phpunit.xml
  80. 549 0
      vendor/alibabacloud/openapi-util/src/OpenApiUtilClient.php
  81. 375 0
      vendor/alibabacloud/openapi-util/tests/OpenApiUtilClientTest.php
  82. 3 0
      vendor/alibabacloud/openapi-util/tests/bootstrap.php
  83. 3 0
      vendor/alibabacloud/tea-utils/.gitignore
  84. 65 0
      vendor/alibabacloud/tea-utils/.php_cs.dist
  85. 31 0
      vendor/alibabacloud/tea-utils/README-CN.md
  86. 31 0
      vendor/alibabacloud/tea-utils/README.md
  87. 38 0
      vendor/alibabacloud/tea-utils/composer.json
  88. 15 0
      vendor/alibabacloud/tea-utils/phpunit.xml
  89. 581 0
      vendor/alibabacloud/tea-utils/src/Utils.php
  90. 41 0
      vendor/alibabacloud/tea-utils/src/Utils/RuntimeOptions.php
  91. 480 0
      vendor/alibabacloud/tea-utils/tests/UtilsTest.php
  92. 3 0
      vendor/alibabacloud/tea-utils/tests/bootstrap.php
  93. 12 0
      vendor/alibabacloud/tea-xml/.gitignore
  94. 65 0
      vendor/alibabacloud/tea-xml/.php_cs.dist
  95. 31 0
      vendor/alibabacloud/tea-xml/README-CN.md
  96. 31 0
      vendor/alibabacloud/tea-xml/README.md
  97. 44 0
      vendor/alibabacloud/tea-xml/composer.json
  98. 32 0
      vendor/alibabacloud/tea-xml/phpunit.xml
  99. 151 0
      vendor/alibabacloud/tea-xml/src/ArrayToXml.php
  100. 57 0
      vendor/alibabacloud/tea-xml/src/XML.php

+ 10 - 0
.idea/gaoyixia.iml

@@ -2,7 +2,17 @@
 <module type="WEB_MODULE" version="4">
   <component name="NewModuleRootManager">
     <content url="file://$MODULE_DIR$">
+      <excludeFolder url="file://$MODULE_DIR$/vendor/alibabacloud/credentials" />
+      <excludeFolder url="file://$MODULE_DIR$/vendor/alibabacloud/darabonba-openapi" />
+      <excludeFolder url="file://$MODULE_DIR$/vendor/alibabacloud/endpoint-util" />
+      <excludeFolder url="file://$MODULE_DIR$/vendor/alibabacloud/gateway-spi" />
+      <excludeFolder url="file://$MODULE_DIR$/vendor/alibabacloud/openapi-util" />
       <excludeFolder url="file://$MODULE_DIR$/vendor/alibabacloud/sdk" />
+      <excludeFolder url="file://$MODULE_DIR$/vendor/alibabacloud/tea" />
+      <excludeFolder url="file://$MODULE_DIR$/vendor/alibabacloud/tea-utils" />
+      <excludeFolder url="file://$MODULE_DIR$/vendor/alibabacloud/tea-xml" />
+      <excludeFolder url="file://$MODULE_DIR$/vendor/alibabacloud/vod-20170321" />
+      <excludeFolder url="file://$MODULE_DIR$/vendor/lizhichao/one-sm" />
       <excludeFolder url="file://$MODULE_DIR$/vendor/psr/http-factory" />
       <excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-php73" />
     </content>

+ 10 - 0
.idea/php.xml

@@ -65,6 +65,16 @@
       <path value="$PROJECT_DIR$/vendor/symfony/polyfill-php73" />
       <path value="$PROJECT_DIR$/vendor/psr/http-factory" />
       <path value="$PROJECT_DIR$/vendor/alibabacloud/sdk" />
+      <path value="$PROJECT_DIR$/vendor/alibabacloud/tea-utils" />
+      <path value="$PROJECT_DIR$/vendor/alibabacloud/endpoint-util" />
+      <path value="$PROJECT_DIR$/vendor/alibabacloud/tea" />
+      <path value="$PROJECT_DIR$/vendor/alibabacloud/openapi-util" />
+      <path value="$PROJECT_DIR$/vendor/alibabacloud/tea-xml" />
+      <path value="$PROJECT_DIR$/vendor/alibabacloud/darabonba-openapi" />
+      <path value="$PROJECT_DIR$/vendor/alibabacloud/gateway-spi" />
+      <path value="$PROJECT_DIR$/vendor/alibabacloud/vod-20170321" />
+      <path value="$PROJECT_DIR$/vendor/alibabacloud/credentials" />
+      <path value="$PROJECT_DIR$/vendor/lizhichao/one-sm" />
     </include_path>
   </component>
 </project>

文件差異過大導致無法顯示
+ 1 - 1543
.idea/workspace.xml


+ 48 - 62
application/api/controller/VideoHls.php

@@ -1,74 +1,60 @@
 <?php
-namespace app\api\controller;
-require __DIR__ . '/vendor/autoload.php';
-require_once __DIR__ .'/aliyunmail/aliyun-php-sdk-core/Config.php';   // 假定您的源码文件和aliyun-php-sdk处于同一目录
-use AlibabaCloud\Client\AlibabaCloud;
-use AlibabaCloud\Vod\Vod;
-use AlibabaCloud\Client\Exception\ClientException;
-use AlibabaCloud\Client\Exception\ServerException;
-use AlibabaCloud\Vod\V20170321;
-define("VOD_CLIENT_NAME", 'AliyunVodClientDemo');
-class VideoHls extends Base
-{
-    function initVodClient($accessKeyId, $accessKeySecret) {
-        $regionId = 'cn-shanghai';
-        AlibabaCloud::accessKeyClient($accessKeyId, $accessKeySecret)
-            ->regionId($regionId)
-            ->connectTimeout(1)
-            ->timeout(3)
-            ->name(VOD_CLIENT_NAME);
-    }
 
+// This file is auto-generated, don't edit it. Thanks.
+namespace AlibabaCloud\SDK\Sample;
 
-    function initStsClient($accessKeyId, $accessKeySecret, $securityToken) {
-        $regionId = 'cn-shanghai';
-        //填入STS信息
-        AlibabaCloud::stsClient($accessKeyId, $accessKeySecret, $securityToken)
-            ->regionId($regionId)
-            ->connectTimeout(1)
-            ->timeout(3)
-            ->name(VOD_CLIENT_NAME);
-    }
+use AlibabaCloud\SDK\Vod\V20170321\Vod;
+use \Exception;
+use AlibabaCloud\Tea\Exception\TeaError;
+use AlibabaCloud\Tea\Utils\Utils;
 
+use Darabonba\OpenApi\Models\Config;
+use AlibabaCloud\SDK\Vod\V20170321\Models\CreateUploadVideoRequest;
+use AlibabaCloud\Tea\Utils\Utils\RuntimeOptions;
 
+class Sample {
 
-    function getPlayInfo($videoId) {
-        return Vod::v20170321()->getPlayInfo()->client(VOD_CLIENT_NAME)
-            ->withVideoId($videoId)    // 指定接口参数
-            ->withAuthTimeout(3600*24)
-            ->format('JSON')  // 指定返回格式
-            ->request();      // 执行请求
+    /**
+     * 使用AK&SK初始化账号Client
+     * @param string $accessKeyId
+     * @param string $accessKeySecret
+     * @return Vod Client
+     */
+    public static function createClient($accessKeyId, $accessKeySecret){
+        $config = new Config([
+            // 您的 AccessKey ID
+            "accessKeyId" => $accessKeyId,
+            // 您的 AccessKey Secret
+            "accessKeySecret" => $accessKeySecret
+        ]);
+        // 访问的域名
+        $config->endpoint = "vod.cn-shanghai.aliyuncs.com";
+        return new Vod($config);
     }
 
-
-    function index()
-    {
-        try {
-            $this->initVodClient('<AccessKeyId>', '<AccessKeySecret>');
-            $playInfo =$this->getPlayInfo('<MediaId>');
-            print_r($playInfo->PlayInfoList->PlayInfo);
-            print_r(VOD_CLIENT_NAME);
-        } catch (\Exception $e) {
-            print $e->getMessage()."\n";
-        }
-    }
     /**
-     * 获取音/视频上传地址和凭证
-     * @param client 发送请求客户端
-     * @return CreateUploadVideoResponse 获取音/视频上传地址和凭证响应数据
+     * @param string[] $args
+     * @return void
      */
-    function createUploadVideo($client) {
-        $request = new V20170321\CreateUploadVideoRequest();
-        $request->setTitle("Sample Title");
-        $request->setFileName("videoFile.mov");
-        $request->setDescription("Video Description");
-        $request->setCoverURL("http://192.168.0.0/16/tps/TB1qnJ1PVXXXXXCXXXXXXXXXXXX-700-700.png");
-        $request->setTags("tag1,tag2");
-
-        $request->setAcceptFormat('JSON');
-        return $client->getAcsResponse($request);
+    public static function main($args){
+        $client = self::createClient("accessKeyId", "accessKeySecret");
+        $createUploadVideoRequest = new CreateUploadVideoRequest([]);
+        $runtime = new RuntimeOptions([]);
+        try {
+            // 复制代码运行请自行打印 API 的返回值
+            $client->createUploadVideoWithOptions($createUploadVideoRequest, $runtime);
+        }
+        catch (Exception $error) {
+            if (!($error instanceof TeaError)) {
+                $error = new TeaError([], $error->getMessage(), $error->getCode(), $error);
+            }
+            // 如有需要,请打印 error
+            Utils::assertAsString($error->message);
+        }
     }
-
-
-
 }
+$path = __DIR__ . \DIRECTORY_SEPARATOR . '..' . \DIRECTORY_SEPARATOR . 'vendor' . \DIRECTORY_SEPARATOR . 'autoload.php';
+if (file_exists($path)) {
+    require_once $path;
+}
+Sample::main(array_slice($argv, 1));

+ 2 - 1
composer.json

@@ -27,7 +27,8 @@
     "phpoffice/phpexcel": "^1.8",
     "alibabacloud/client": "^1.5",
     "qiniu/php-sdk": "^7.6",
-    "alibabacloud/sdk": "^1.8"
+    "alibabacloud/sdk": "^1.8",
+    "alibabacloud/vod-20170321": "2.16.9"
   },
   "repositories": {
     "packagist": {

+ 560 - 1
composer.lock

@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "8d41d6a69df90d954b9146eedaddf234",
+    "content-hash": "c052b497a47e8db2e96412cee3888406",
     "packages": [
         {
             "name": "adbario/php-dot-notation",
@@ -157,6 +157,289 @@
             "time": "2021-05-13T06:26:38+00:00"
         },
         {
+            "name": "alibabacloud/credentials",
+            "version": "1.1.4",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/aliyun/credentials-php.git",
+                "reference": "e79d4151ad8924c0cf79d4fe0ec151b8d7663a25"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/aliyun/credentials-php/zipball/e79d4151ad8924c0cf79d4fe0ec151b8d7663a25",
+                "reference": "e79d4151ad8924c0cf79d4fe0ec151b8d7663a25",
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
+            },
+            "require": {
+                "adbario/php-dot-notation": "^2.2",
+                "alibabacloud/tea": "^3.0",
+                "ext-curl": "*",
+                "ext-json": "*",
+                "ext-libxml": "*",
+                "ext-mbstring": "*",
+                "ext-openssl": "*",
+                "ext-simplexml": "*",
+                "ext-xmlwriter": "*",
+                "guzzlehttp/guzzle": "^6.3|^7.0",
+                "php": ">=5.6"
+            },
+            "require-dev": {
+                "composer/composer": "^1.8",
+                "drupal/coder": "^8.3",
+                "ext-dom": "*",
+                "ext-pcre": "*",
+                "ext-sockets": "*",
+                "ext-spl": "*",
+                "mikey179/vfsstream": "^1.6",
+                "monolog/monolog": "^1.24",
+                "phpunit/phpunit": "^4.8.35|^5.4.3",
+                "psr/cache": "^1.0",
+                "symfony/dotenv": "^3.4",
+                "symfony/var-dumper": "^3.4"
+            },
+            "suggest": {
+                "ext-sockets": "To use client-side monitoring"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "AlibabaCloud\\Credentials\\": "src"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "Apache-2.0"
+            ],
+            "authors": [
+                {
+                    "name": "Alibaba Cloud SDK",
+                    "email": "sdk-team@alibabacloud.com",
+                    "homepage": "http://www.alibabacloud.com"
+                }
+            ],
+            "description": "Alibaba Cloud Credentials for PHP",
+            "homepage": "https://www.alibabacloud.com/",
+            "keywords": [
+                "alibaba",
+                "alibabacloud",
+                "aliyun",
+                "client",
+                "cloud",
+                "credentials",
+                "library",
+                "sdk",
+                "tool"
+            ],
+            "support": {
+                "issues": "https://github.com/aliyun/credentials-php/issues",
+                "source": "https://github.com/aliyun/credentials-php"
+            },
+            "time": "2021-06-08T10:49:34+00:00"
+        },
+        {
+            "name": "alibabacloud/darabonba-openapi",
+            "version": "0.2.6",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/alibabacloud-sdk-php/darabonba-openapi.git",
+                "reference": "c64a2bafde3aaf8d11ba5aebfc08f59916b4c742"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/alibabacloud-sdk-php/darabonba-openapi/zipball/c64a2bafde3aaf8d11ba5aebfc08f59916b4c742",
+                "reference": "c64a2bafde3aaf8d11ba5aebfc08f59916b4c742",
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
+            },
+            "require": {
+                "alibabacloud/credentials": "^1.1",
+                "alibabacloud/gateway-spi": "^1",
+                "alibabacloud/openapi-util": "^0.1.10",
+                "alibabacloud/tea-utils": "^0.2.0",
+                "alibabacloud/tea-xml": "^0.2",
+                "php": ">5.5"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "Darabonba\\OpenApi\\": "src"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "Apache-2.0"
+            ],
+            "authors": [
+                {
+                    "name": "Alibaba Cloud SDK",
+                    "email": "sdk-team@alibabacloud.com"
+                }
+            ],
+            "description": "Alibaba Cloud OpenApi Client",
+            "support": {
+                "issues": "https://github.com/alibabacloud-sdk-php/darabonba-openapi/issues",
+                "source": "https://github.com/alibabacloud-sdk-php/darabonba-openapi/tree/0.2.6"
+            },
+            "time": "2022-07-20T08:38:03+00:00"
+        },
+        {
+            "name": "alibabacloud/endpoint-util",
+            "version": "0.1.1",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/alibabacloud-sdk-php/endpoint-util.git",
+                "reference": "f3fe88a25d8df4faa3b0ae14ff202a9cc094e6c5"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/alibabacloud-sdk-php/endpoint-util/zipball/f3fe88a25d8df4faa3b0ae14ff202a9cc094e6c5",
+                "reference": "f3fe88a25d8df4faa3b0ae14ff202a9cc094e6c5",
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
+            },
+            "require": {
+                "php": ">5.5"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "^4.8.35|^5.4.3"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "AlibabaCloud\\Endpoint\\": "src"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "Apache-2.0"
+            ],
+            "authors": [
+                {
+                    "name": "Alibaba Cloud SDK",
+                    "email": "sdk-team@alibabacloud.com"
+                }
+            ],
+            "description": "Alibaba Cloud Endpoint Library for PHP",
+            "support": {
+                "source": "https://github.com/alibabacloud-sdk-php/endpoint-util/tree/0.1.1"
+            },
+            "time": "2020-06-04T10:57:15+00:00"
+        },
+        {
+            "name": "alibabacloud/gateway-spi",
+            "version": "1.0.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/alibabacloud-sdk-php/alibabacloud-gateway-spi.git",
+                "reference": "7440f77750c329d8ab252db1d1d967314ccd1fcb"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/alibabacloud-sdk-php/alibabacloud-gateway-spi/zipball/7440f77750c329d8ab252db1d1d967314ccd1fcb",
+                "reference": "7440f77750c329d8ab252db1d1d967314ccd1fcb",
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
+            },
+            "require": {
+                "alibabacloud/credentials": "^1.1",
+                "php": ">5.5"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "Darabonba\\GatewaySpi\\": "src"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "Apache-2.0"
+            ],
+            "authors": [
+                {
+                    "name": "Alibaba Cloud SDK",
+                    "email": "sdk-team@alibabacloud.com"
+                }
+            ],
+            "description": "Alibaba Cloud Gateway SPI Client",
+            "support": {
+                "source": "https://github.com/alibabacloud-sdk-php/alibabacloud-gateway-spi/tree/1.0.0"
+            },
+            "time": "2022-07-14T05:31:35+00:00"
+        },
+        {
+            "name": "alibabacloud/openapi-util",
+            "version": "0.1.11",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/alibabacloud-sdk-php/openapi-util.git",
+                "reference": "61ee137955a25c9f5f33170babb6071d4bccf12c"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/alibabacloud-sdk-php/openapi-util/zipball/61ee137955a25c9f5f33170babb6071d4bccf12c",
+                "reference": "61ee137955a25c9f5f33170babb6071d4bccf12c",
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
+            },
+            "require": {
+                "alibabacloud/tea": "^3.1",
+                "alibabacloud/tea-utils": "^0.2",
+                "lizhichao/one-sm": "^1.5",
+                "php": ">5.5"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "^4.8.35|^5.4.3"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "AlibabaCloud\\OpenApiUtil\\": "src"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "Apache-2.0"
+            ],
+            "authors": [
+                {
+                    "name": "Alibaba Cloud SDK",
+                    "email": "sdk-team@alibabacloud.com"
+                }
+            ],
+            "description": "Alibaba Cloud OpenApi Util",
+            "support": {
+                "issues": "https://github.com/alibabacloud-sdk-php/openapi-util/issues",
+                "source": "https://github.com/alibabacloud-sdk-php/openapi-util/tree/0.1.11"
+            },
+            "time": "2021-12-28T07:57:21+00:00"
+        },
+        {
             "name": "alibabacloud/sdk",
             "version": "1.8.1392",
             "source": {
@@ -401,6 +684,222 @@
             "time": "2022-07-14T07:58:13+00:00"
         },
         {
+            "name": "alibabacloud/tea",
+            "version": "3.1.24",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/aliyun/tea-php.git",
+                "reference": "bb33395f47db3847d1940d6eb8ba1e56cd0623cb"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/aliyun/tea-php/zipball/bb33395f47db3847d1940d6eb8ba1e56cd0623cb",
+                "reference": "bb33395f47db3847d1940d6eb8ba1e56cd0623cb",
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
+            },
+            "require": {
+                "adbario/php-dot-notation": "^2.3",
+                "ext-curl": "*",
+                "ext-json": "*",
+                "ext-libxml": "*",
+                "ext-mbstring": "*",
+                "ext-openssl": "*",
+                "ext-simplexml": "*",
+                "ext-xmlwriter": "*",
+                "guzzlehttp/guzzle": "^6.3|^7.0",
+                "php": ">=5.5"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "*",
+                "symfony/dotenv": "^3.4",
+                "symfony/var-dumper": "^3.4"
+            },
+            "suggest": {
+                "ext-sockets": "To use client-side monitoring"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "AlibabaCloud\\Tea\\": "src"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "Apache-2.0"
+            ],
+            "authors": [
+                {
+                    "name": "Alibaba Cloud SDK",
+                    "email": "sdk-team@alibabacloud.com",
+                    "homepage": "http://www.alibabacloud.com"
+                }
+            ],
+            "description": "Client of Tea for PHP",
+            "homepage": "https://www.alibabacloud.com/",
+            "keywords": [
+                "alibabacloud",
+                "client",
+                "cloud",
+                "tea"
+            ],
+            "support": {
+                "issues": "https://github.com/aliyun/tea-php/issues",
+                "source": "https://github.com/aliyun/tea-php"
+            },
+            "time": "2022-07-18T11:27:29+00:00"
+        },
+        {
+            "name": "alibabacloud/tea-utils",
+            "version": "0.2.16",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/alibabacloud-sdk-php/tea-utils.git",
+                "reference": "ae10b306509a196e4af71803db710a0a05c54e60"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/alibabacloud-sdk-php/tea-utils/zipball/ae10b306509a196e4af71803db710a0a05c54e60",
+                "reference": "ae10b306509a196e4af71803db710a0a05c54e60",
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
+            },
+            "require": {
+                "alibabacloud/tea": "^3.1",
+                "php": ">5.5"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "AlibabaCloud\\Tea\\Utils\\": "src"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "Apache-2.0"
+            ],
+            "authors": [
+                {
+                    "name": "Alibaba Cloud SDK",
+                    "email": "sdk-team@alibabacloud.com"
+                }
+            ],
+            "description": "Alibaba Cloud Tea Utils for PHP",
+            "support": {
+                "issues": "https://github.com/aliyun/tea-util/issues",
+                "source": "https://github.com/aliyun/tea-util"
+            },
+            "time": "2022-07-05T09:58:20+00:00"
+        },
+        {
+            "name": "alibabacloud/tea-xml",
+            "version": "0.2.3",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/alibabacloud-sdk-php/tea-xml.git",
+                "reference": "4bd2303d71c968cb7ae4e487c5fa3023aed3ff3b"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/alibabacloud-sdk-php/tea-xml/zipball/4bd2303d71c968cb7ae4e487c5fa3023aed3ff3b",
+                "reference": "4bd2303d71c968cb7ae4e487c5fa3023aed3ff3b",
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
+            },
+            "require": {
+                "php": ">5.5"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "^4.8.35|^5.4.3",
+                "symfony/var-dumper": "*"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "AlibabaCloud\\Tea\\XML\\": "src"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "Apache-2.0"
+            ],
+            "authors": [
+                {
+                    "name": "Alibaba Cloud SDK",
+                    "email": "sdk-team@alibabacloud.com"
+                }
+            ],
+            "description": "Alibaba Cloud Tea XML Library for PHP",
+            "support": {
+                "source": "https://github.com/alibabacloud-sdk-php/tea-xml/tree/0.2.3"
+            },
+            "time": "2021-12-08T06:43:00+00:00"
+        },
+        {
+            "name": "alibabacloud/vod-20170321",
+            "version": "2.16.9",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/alibabacloud-sdk-php/vod-20170321.git",
+                "reference": "0046a6941b332ee6a02e15d0c94e664796cd4b30"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/alibabacloud-sdk-php/vod-20170321/zipball/0046a6941b332ee6a02e15d0c94e664796cd4b30",
+                "reference": "0046a6941b332ee6a02e15d0c94e664796cd4b30",
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
+            },
+            "require": {
+                "alibabacloud/darabonba-openapi": "^0.2.5",
+                "alibabacloud/endpoint-util": "^0.1.0",
+                "alibabacloud/openapi-util": "^0.1.10",
+                "alibabacloud/tea-utils": "^0.2.0",
+                "php": ">5.5"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "AlibabaCloud\\SDK\\Vod\\V20170321\\": "src"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "Apache-2.0"
+            ],
+            "authors": [
+                {
+                    "name": "Alibaba Cloud SDK",
+                    "email": "sdk-team@alibabacloud.com"
+                }
+            ],
+            "description": "Alibaba Cloud ApsaraVideo for VOD (20170321) SDK Library for PHP",
+            "support": {
+                "source": "https://github.com/alibabacloud-sdk-php/vod-20170321/tree/2.16.9"
+            },
+            "time": "2022-04-11T06:08:40+00:00"
+        },
+        {
             "name": "aliyuncs/oss-sdk-php",
             "version": "v2.5.0",
             "source": {
@@ -1358,6 +1857,66 @@
             "time": "2021-07-13T18:46:38+00:00"
         },
         {
+            "name": "lizhichao/one-sm",
+            "version": "1.10",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/lizhichao/sm.git",
+                "reference": "687a012a44a5bfd4d9143a0234e1060543be455a"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/lizhichao/sm/zipball/687a012a44a5bfd4d9143a0234e1060543be455a",
+                "reference": "687a012a44a5bfd4d9143a0234e1060543be455a",
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
+            },
+            "require": {
+                "php": ">=5.6"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "OneSm\\": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "Apache-2.0"
+            ],
+            "authors": [
+                {
+                    "name": "tanszhe",
+                    "email": "1018595261@qq.com"
+                }
+            ],
+            "description": "国密sm3",
+            "keywords": [
+                "php",
+                "sm3"
+            ],
+            "support": {
+                "issues": "https://github.com/lizhichao/sm/issues",
+                "source": "https://github.com/lizhichao/sm/tree/1.10"
+            },
+            "funding": [
+                {
+                    "url": "https://www.vicsdf.com/img/w.jpg",
+                    "type": "custom"
+                },
+                {
+                    "url": "https://www.vicsdf.com/img/z.jpg",
+                    "type": "custom"
+                }
+            ],
+            "time": "2021-05-26T06:19:22+00:00"
+        },
+        {
             "name": "monolog/monolog",
             "version": "2.8.0",
             "source": {

+ 14 - 0
vendor/alibabacloud/credentials/CHANGELOG.md

@@ -0,0 +1,14 @@
+# CHANGELOG
+
+## 1.1.3 - 2020-12-24
+
+- Require guzzle ^6.3|^7.0
+
+## 1.0.2 - 2020-02-14
+- Update Tea.
+
+## 1.0.1 - 2019-12-30
+- Supported get `Role Name` automatically.
+
+## 1.0.0 - 2019-09-01
+- Initial release of the Alibaba Cloud Credentials for PHP Version 1.0.0 on Packagist See <https://github.com/aliyun/credentials-php> for more information.

+ 30 - 0
vendor/alibabacloud/credentials/CONTRIBUTING.md

@@ -0,0 +1,30 @@
+# CONTRIBUTING
+
+We work hard to provide a high-quality and useful SDK for Alibaba Cloud, and
+we greatly value feedback and contributions from our community. Please submit
+your [issues][issues] or [pull requests][pull-requests] through GitHub.
+
+## Tips
+
+- The SDK is released under the [Apache license][license]. Any code you submit
+   will be released under that license. For substantial contributions, we may
+   ask you to sign a [Alibaba Documentation Corporate Contributor License 
+   Agreement (CLA)][cla].
+- We follow all of the relevant PSR recommendations from the [PHP Framework
+   Interop Group][php-fig]. Please submit code that follows these standards.
+   The [PHP CS Fixer][cs-fixer] tool can be helpful for formatting your code.
+   Your can use `composer fixer` to fix code.
+- We maintain a high percentage of code coverage in our unit tests. If you make
+   changes to the code, please add, update, and/or remove tests as appropriate.
+- If your code does not conform to the PSR standards, does not include adequate
+   tests, or does not contain a changelog document, we may ask you to update
+   your pull requests before we accept them. We also reserve the right to deny
+   any pull requests that do not align with our standards or goals.
+
+[issues]: https://github.com/aliyun/credentials-php/issues
+[pull-requests]: https://github.com/aliyun/credentials-php/pulls
+[license]: http://www.apache.org/licenses/LICENSE-2.0
+[cla]: https://alibaba-cla-2018.oss-cn-beijing.aliyuncs.com/Alibaba_Documentation_Open_Source_Corporate_CLA.pdf
+[php-fig]: http://php-fig.org
+[cs-fixer]: http://cs.sensiolabs.org/
+[docs-readme]: https://github.com/aliyun/credentials-php/blob/master/README.md

+ 13 - 0
vendor/alibabacloud/credentials/LICENSE.md

@@ -0,0 +1,13 @@
+Copyright (c) 2009-present, Alibaba Cloud All rights reserved.
+
+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.

+ 88 - 0
vendor/alibabacloud/credentials/NOTICE.md

@@ -0,0 +1,88 @@
+# NOTICE
+
+<https://www.alibabacloud.com/>
+
+Copyright (c) 2009-present, Alibaba Cloud All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License").
+You may not use this file except in compliance with the License.
+A copy of the License is located at
+
+<http://www.apache.org/licenses/LICENSE-2.0>
+
+or in the "license" file accompanying this file. This file 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.
+
+# Guzzle
+
+<https://github.com/guzzle/guzzle>
+
+Copyright (c) 2011-2018 Michael Dowling, https://github.com/mtdowling <mtdowling@gmail.com>
+
+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.
+
+# jmespath.php
+
+<https://github.com/mtdowling/jmespath.php>
+
+Copyright (c) 2014 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.
+
+# Dot
+
+<https://github.com/adbario/php-dot-notation>
+
+Copyright (c) 2016-2019 Riku Särkinen
+
+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.

+ 250 - 0
vendor/alibabacloud/credentials/README-zh-CN.md

@@ -0,0 +1,250 @@
+[English](/README.md) | 简体中文
+
+
+# Alibaba Cloud Credentials for PHP
+[![Latest Stable Version](https://poser.pugx.org/alibabacloud/credentials/v/stable)](https://packagist.org/packages/alibabacloud/credentials)
+[![composer.lock](https://poser.pugx.org/alibabacloud/credentials/composerlock)](https://packagist.org/packages/alibabacloud/credentials)
+[![Total Downloads](https://poser.pugx.org/alibabacloud/credentials/downloads)](https://packagist.org/packages/alibabacloud/credentials)
+[![License](https://poser.pugx.org/alibabacloud/credentials/license)](https://packagist.org/packages/alibabacloud/credentials)
+[![codecov](https://codecov.io/gh/aliyun/credentials-php/branch/master/graph/badge.svg)](https://codecov.io/gh/aliyun/credentials-php)
+[![Travis Build Status](https://travis-ci.org/aliyun/credentials-php.svg?branch=master)](https://travis-ci.org/aliyun/credentials-php)
+[![Appveyor Build Status](https://ci.appveyor.com/api/projects/status/6jxpwmhyfipagtge/branch/master?svg=true)](https://ci.appveyor.com/project/aliyun/credentials-php)
+
+
+![](https://aliyunsdk-pages.alicdn.com/icons/AlibabaCloud.svg)
+
+
+Alibaba Cloud Credentials for PHP 是帮助 PHP 开发者管理凭据的工具。
+
+
+## 先决条件
+您的系统需要满足[先决条件](/docs/zh-CN/0-Prerequisites.md),包括 PHP> = 5.6。 我们强烈建议使用cURL扩展,并使用TLS后端编译cURL 7.16.2+。
+
+
+## 安装依赖
+如果已在系统上[全局安装 Composer](https://getcomposer.org/doc/00-intro.md#globally),请直接在项目目录中运行以下内容来安装 Alibaba Cloud Credentials for PHP 作为依赖项:
+```
+composer require alibabacloud/credentials
+```
+> 一些用户可能由于网络问题无法安装,可以使用[阿里云 Composer 全量镜像](https://developer.aliyun.com/composer)。
+
+请看[安装](/docs/zh-CN/1-Installation.md)有关通过 Composer 和其他方式安装的详细信息。
+
+
+## 快速使用
+在您开始之前,您需要注册阿里云帐户并获取您的[凭证](https://usercenter.console.aliyun.com/#/manage/ak)。
+
+### 凭证类型
+
+#### AccessKey
+
+通过[用户信息管理][ak]设置 access_key,它们具有该账户完全的权限,请妥善保管。有时出于安全考虑,您不能把具有完全访问权限的主账户 AccessKey 交于一个项目的开发者使用,您可以[创建RAM子账户][ram]并为子账户[授权][permissions],使用RAM子用户的 AccessKey 来进行API调用。
+
+```php
+<?php
+
+use AlibabaCloud\Credentials\Credential;
+
+// Chain Provider if no Parameter
+$credential = new Credential();
+$credential->getAccessKeyId();
+$credential->getAccessKeySecret();
+
+// Access Key
+$ak = new Credential([
+    'type'              => 'access_key',
+    'access_key_id'     => '<access_key_id>',
+    'access_key_secret' => '<access_key_secret>',
+]);
+$ak->getAccessKeyId();
+$ak->getAccessKeySecret();
+```
+
+#### STS
+
+通过安全令牌服务(Security Token Service,简称 STS),申请临时安全凭证(Temporary Security Credentials,简称 TSC),创建临时安全凭证。
+
+```php
+<?php
+
+use AlibabaCloud\Credentials\Credential;
+
+$sts = new Credential([
+    'type'             => 'sts',
+    'access_key_id'    => '<access_key_id>',
+    'accessKey_secret' => '<accessKey_secret>',
+    'security_token'   => '<security_token>',
+]);
+$sts->getAccessKeyId();
+$sts->getAccessKeySecret();
+$sts->getSecurityToken();
+```
+
+#### RamRoleArn
+
+通过指定[RAM角色][RAM Role],让凭证自动申请维护 STS Token。你可以通过为 `Policy` 赋值来限制获取到的 STS Token 的权限。
+
+```php
+<?php
+
+use AlibabaCloud\Credentials\Credential;
+
+$ramRoleArn = new Credential([
+    'type'              => 'ram_role_arn',
+    'access_key_id'     => '<access_key_id>',
+    'access_key_secret' => '<access_key_secret>',
+    'role_arn'          => '<role_arn>',
+    'role_session_name' => '<role_session_name>',
+    'policy'            => '',
+]);
+$ramRoleArn->getAccessKeyId();
+$ramRoleArn->getAccessKeySecret();
+$ramRoleArn->getRoleArn();
+$ramRoleArn->getRoleSessionName();
+$ramRoleArn->getPolicy();
+```
+
+#### EcsRamRole
+
+通过指定角色名称,让凭证自动申请维护 STS Token
+
+```php
+<?php
+
+use AlibabaCloud\Credentials\Credential;
+
+$ecsRamRole = new Credential([
+    'type'      => 'ecs_ram_role',
+    'role_name' => '<role_name>',
+]);
+$ecsRamRole->getRoleName();
+// Note: `role_name` is optional. It will be retrieved automatically if not set. It is highly recommended to set it up to reduce requests.
+```
+
+#### RsaKeyPair
+
+通过指定公钥Id和私钥文件,让凭证自动申请维护 AccessKey。仅支持日本站。
+
+```php
+<?php
+
+use AlibabaCloud\Credentials\Credential;
+
+$rsaKeyPair = new Credential([
+    'type'             => 'rsa_key_pair',
+    'public_key_id'    => '<public_key_id>',
+    'private_key_file' => '<private_key_file>',
+]);
+$rsaKeyPair->getPublicKeyId();
+$rsaKeyPair->getPrivateKey();
+```
+
+#### Bearer Token
+
+如呼叫中心(CCC)需用此凭证,请自行申请维护 Bearer Token。
+
+```php
+<?php
+
+use AlibabaCloud\Credentials\Credential;
+
+$bearerToken = new Credential([
+    'type'         => 'bearer_token',
+    'bearer_token' => '<bearer_token>',
+]);
+$bearerToken->getBearerToken();
+$bearerToken->getSignature();
+```
+
+## 默认凭证提供程序链
+默认凭证提供程序链查找可用的凭证,寻找顺序如下:
+
+### 1. 环境凭证
+程序首先会在环境变量里寻找环境凭证,如果定义了 `ALIBABA_CLOUD_ACCESS_KEY_ID`  和 `ALIBABA_CLOUD_ACCESS_KEY_SECRET` 环境变量且不为空,程序将使用他们创建默认凭证。
+
+### 2. 配置文件
+> 如果用户主目录存在默认文件 `~/.alibabacloud/credentials` (Windows 为 `C:\Users\USER_NAME\.alibabacloud\credentials`),程序会自动创建指定类型和名称的凭证。默认文件可以不存在,但解析错误会抛出异常。  凭证名称不分大小写,若凭证同名,后者会覆盖前者。不同的项目、工具之间可以共用这个配置文件,因为超出项目之外,也不会被意外提交到版本控制。Windows 上可以使用环境变量引用到主目录 %UserProfile%。类 Unix 的系统可以使用环境变量 $HOME 或 ~ (tilde)。 可以通过定义 `ALIBABA_CLOUD_CREDENTIALS_FILE` 环境变量修改默认文件的路径。
+
+```ini
+[default]
+type = access_key                  # 认证方式为 access_key
+access_key_id = foo                # Key
+access_key_secret = bar            # Secret
+
+[project1]
+type = ecs_ram_role                # 认证方式为 ecs_ram_role
+role_name = EcsRamRoleTest         # Role Name,非必填,不填则自动获取,建议设置,可以减少网络请求。
+
+[project2]
+type = ram_role_arn                # 认证方式为 ram_role_arn
+access_key_id = foo
+access_key_secret = bar
+role_arn = role_arn
+role_session_name = session_name
+
+[project3]
+type = rsa_key_pair                # 认证方式为 rsa_key_pair
+public_key_id = publicKeyId        # Public Key ID
+private_key_file = /your/pk.pem    # Private Key 文件
+```
+
+### 3. 实例 RAM 角色
+如果定义了环境变量 `ALIBABA_CLOUD_ECS_METADATA` 且不为空,程序会将该环境变量的值作为角色名称,请求 `http://100.100.100.200/latest/meta-data/ram/security-credentials/` 获取临时安全凭证作为默认凭证。
+
+### 自定义凭证提供程序链
+可通过自定义程序链代替默认程序链的寻找顺序,也可以自行编写闭包传入提供者。
+```php
+<?php
+
+use AlibabaCloud\Credentials\Providers\ChainProvider;
+
+ChainProvider::set(
+        ChainProvider::ini(),
+        ChainProvider::env(),
+        ChainProvider::instance()
+);
+```
+
+
+## 文档
+* [先决条件](/docs/zh-CN/0-Prerequisites.md)
+* [安装](/docs/zh-CN/1-Installation.md)
+
+
+## 问题
+[提交 Issue](https://github.com/aliyun/credentials-php/issues/new/choose),不符合指南的问题可能会立即关闭。
+
+
+## 发行说明
+每个版本的详细更改记录在[发行说明](/CHANGELOG.md)中。
+
+
+## 贡献
+提交 Pull Request 之前请阅读[贡献指南](/CONTRIBUTING.md)。
+
+
+## 相关
+* [OpenAPI 开发者门户][open-api]
+* [Packagist][packagist]
+* [Composer][composer]
+* [Guzzle中文文档][guzzle-docs]
+* [最新源码][latest-release]
+
+
+## 许可证
+[Apache-2.0](/LICENSE.md)
+
+Copyright (c) 2009-present, Alibaba Cloud All rights reserved.
+
+
+[open-api]: https://next.api.aliyun.com
+[latest-release]: https://github.com/aliyun/credentials-php
+[guzzle-docs]: https://guzzle-cn.readthedocs.io/zh_CN/latest/request-options.html
+[composer]: https://getcomposer.org
+[packagist]: https://packagist.org/packages/alibabacloud/credentials
+[home]: https://home.console.aliyun.com
+[aliyun]: https://www.aliyun.com
+[cURL]: http://php.net/manual/zh/book.curl.php
+[OPCache]: http://php.net/manual/zh/book.opcache.php
+[xdebug]: http://xdebug.org
+[OpenSSL]: http://php.net/manual/zh/book.openssl.php

+ 251 - 0
vendor/alibabacloud/credentials/README.md

@@ -0,0 +1,251 @@
+English | [简体中文](/README-zh-CN.md)
+
+
+# Alibaba Cloud Credentials for PHP
+[![Latest Stable Version](https://poser.pugx.org/alibabacloud/credentials/v/stable)](https://packagist.org/packages/alibabacloud/credentials)
+[![composer.lock](https://poser.pugx.org/alibabacloud/credentials/composerlock)](https://packagist.org/packages/alibabacloud/credentials)
+[![Total Downloads](https://poser.pugx.org/alibabacloud/credentials/downloads)](https://packagist.org/packages/alibabacloud/credentials)
+[![License](https://poser.pugx.org/alibabacloud/credentials/license)](https://packagist.org/packages/alibabacloud/credentials)
+[![codecov](https://codecov.io/gh/aliyun/credentials-php/branch/master/graph/badge.svg)](https://codecov.io/gh/aliyun/credentials-php)
+[![Travis Build Status](https://travis-ci.org/aliyun/credentials-php.svg?branch=master)](https://travis-ci.org/aliyun/credentials-php)
+[![Appveyor Build Status](https://ci.appveyor.com/api/projects/status/6jxpwmhyfipagtge/branch/master?svg=true)](https://ci.appveyor.com/project/aliyun/credentials-php)
+
+
+![](https://aliyunsdk-pages.alicdn.com/icons/AlibabaCloud.svg)
+
+
+Alibaba Cloud Credentials for PHP is a tool that helps PHP developers manage their credentials.
+
+
+## Prerequisites
+Your system needs to meet [Prerequisites](/docs/zh-CN/0-Prerequisites.md), including PHP> = 5.6. We strongly recommend using the cURL extension and compiling cURL 7.16.2+ using the TLS backend.
+
+
+## Installation
+If you have [Globally Install Composer](https://getcomposer.org/doc/00-intro.md#globally) on your system, install Alibaba Cloud Credentials for PHP as a dependency by running the following directly in the project directory:
+```
+composer require alibabacloud/credentials
+```
+> Some users may not be able to install due to network problems, you can switch to the [Alibaba Cloud Composer Mirror](https://developer.aliyun.com/composer).
+
+See [Installation](/docs/zh-CN/1-Installation.md) for details on installing through Composer and other means.
+
+
+## Quick Examples
+Before you begin, you need to sign up for an Alibaba Cloud account and retrieve your [Credentials](https://usercenter.console.aliyun.com/#/manage/ak).
+
+### Credential Type
+
+#### AccessKey
+
+Setup access_key credential through [User Information Management][ak], it have full authority over the account, please keep it safe. Sometimes for security reasons, you cannot hand over a primary account AccessKey with full access to the developer of a project. You may create a sub-account [RAM Sub-account][ram] , grant its [authorization][permissions],and use the AccessKey of RAM Sub-account.
+
+```php
+<?php
+
+use AlibabaCloud\Credentials\Credential;
+
+// Chain Provider if no Parameter
+$credential = new Credential();
+$credential->getAccessKeyId();
+$credential->getAccessKeySecret();
+
+// Access Key
+$ak = new Credential([
+    'type'              => 'access_key',
+    'access_key_id'     => '<access_key_id>',
+    'access_key_secret' => '<access_key_secret>',
+]);
+$ak->getAccessKeyId();
+$ak->getAccessKeySecret();
+```
+
+#### STS
+
+Create a temporary security credential by applying Temporary Security Credentials (TSC) through the Security Token Service (STS).
+
+```php
+<?php
+
+use AlibabaCloud\Credentials\Credential;
+
+$sts = new Credential([
+    'type'             => 'sts',
+    'access_key_id'    => '<access_key_id>',
+    'accessKey_secret' => '<accessKey_secret>',
+    'security_token'   => '<security_token>',
+]);
+$sts->getAccessKeyId();
+$sts->getAccessKeySecret();
+$sts->getSecurityToken();
+```
+
+#### RamRoleArn
+
+By specifying [RAM Role][RAM Role], the credential will be able to automatically request maintenance of STS Token. If you want to limit the permissions([How to make a policy][policy]) of STS Token, you can assign value for `Policy`.
+
+```php
+<?php
+
+use AlibabaCloud\Credentials\Credential;
+
+$ramRoleArn = new Credential([
+    'type'              => 'ram_role_arn',
+    'access_key_id'     => '<access_key_id>',
+    'access_key_secret' => '<access_key_secret>',
+    'role_arn'          => '<role_arn>',
+    'role_session_name' => '<role_session_name>',
+    'policy'            => '',
+]);
+$ramRoleArn->getAccessKeyId();
+$ramRoleArn->getAccessKeySecret();
+$ramRoleArn->getRoleArn();
+$ramRoleArn->getRoleSessionName();
+$ramRoleArn->getPolicy();
+```
+
+#### EcsRamRole
+
+By specifying the role name, the credential will be able to automatically request maintenance of STS Token.
+
+```php
+<?php
+
+use AlibabaCloud\Credentials\Credential;
+
+$ecsRamRole = new Credential([
+    'type'      => 'ecs_ram_role',
+    'role_name' => '<role_name>',
+]);
+$ecsRamRole->getRoleName();
+// Note: `role_name` is optional. It will be retrieved automatically if not set. It is highly recommended to set it up to reduce requests.
+```
+
+#### RsaKeyPair
+
+By specifying the public key Id and the private key file, the credential will be able to automatically request maintenance of the AccessKey before sending the request. Only Japan station is supported. 
+
+
+```php
+<?php
+
+use AlibabaCloud\Credentials\Credential;
+
+$rsaKeyPair = new Credential([
+    'type'             => 'rsa_key_pair',
+    'public_key_id'    => '<public_key_id>',
+    'private_key_file' => '<private_key_file>',
+]);
+$rsaKeyPair->getPublicKeyId();
+$rsaKeyPair->getPrivateKey();
+```
+
+#### Bearer Token
+
+If credential is required by the Cloud Call Centre (CCC), please apply for Bearer Token maintenance by yourself.
+
+```php
+<?php
+
+use AlibabaCloud\Credentials\Credential;
+
+$bearerToken = new Credential([
+    'type'         => 'bearer_token',
+    'bearer_token' => '<bearer_token>',
+]);
+$bearerToken->getBearerToken();
+$bearerToken->getSignature();
+```
+
+## Default credential provider chain
+The default credential provider chain looks for available credentials, looking in the following order:
+
+### 1. Environmental certificate
+The program first looks for environment credentials in the environment variable. If the `ALIBABA_CLOUD_ACCESS_KEY_ID` and `ALIBABA_CLOUD_ACCESS_KEY_SECRET` environment variables are defined and not empty, the program will use them to create default credentials.
+
+### 2. Configuration file
+> If the user's home directory has the default file `~/.alibabacloud/credentials` (Windows is `C:\Users\USER_NAME\.alibabacloud\credentials`), the program will automatically create credentials with the specified type and name. The default file may not exist, but parsing errors will throw an exception. The voucher name is not case sensitive. If the voucher has the same name, the latter will overwrite the former. This configuration file can be shared between different projects and tools, and it will not be accidentally submitted to version control because it is outside the project. Environment variables can be referenced to the home directory %UserProfile% on Windows. Unix-like systems can use the environment variable $HOME or ~ (tilde). The path to the default file can be modified by defining the `ALIBABA_CLOUD_CREDENTIALS_FILE` environment variable.
+
+```ini
+[default]
+type = access_key                  # Authentication method is access_key
+access_key_id = foo                # Key
+access_key_secret = bar            # Secret
+
+[project1]
+type = ecs_ram_role                # Authentication method is ecs_ram_role
+role_name = EcsRamRoleTest         # Role name, optional. It will be retrieved automatically if not set. It is highly recommended to set it up to reduce requests.
+
+[project2]
+type = ram_role_arn                # Authentication method is ram_role_arn
+access_key_id = foo
+access_key_secret = bar
+role_arn = role_arn
+role_session_name = session_name
+
+[project3]
+type = rsa_key_pair                # Authentication method is rsa_key_pair
+public_key_id = publicKeyId        # Public Key ID
+private_key_file = /your/pk.pem    # Private Key File
+```
+
+### 3. Instance RAM role
+If the environment variable `ALIBABA_CLOUD_ECS_METADATA` is defined and not empty, the program will take the value of the environment variable as the role name and request `http://100.100.100.200/latest/meta-data/ram/security-credentials/` to get the temporary Security credentials are used as default credentials.
+
+### Custom credential provider chain
+You can replace the default order of the program chain by customizing the program chain, or you can write the closure to the provider.
+```php
+<?php
+
+use AlibabaCloud\Credentials\Providers\ChainProvider;
+
+ChainProvider::set(
+        ChainProvider::ini(),
+        ChainProvider::env(),
+        ChainProvider::instance()
+);
+```
+
+
+## Documentation
+* [Prerequisites](/docs/zh-CN/0-Prerequisites.md)
+* [Installation](/docs/zh-CN/1-Installation.md)
+
+
+## Issue
+[Submit Issue](https://github.com/aliyun/credentials-php/issues/new/choose), Problems that do not meet the guidelines may close immediately.
+
+
+## Release notes
+Detailed changes for each version are recorded in the [Release Notes](/CHANGELOG.md).
+
+
+## Contribution
+Please read the [Contribution Guide](/CONTRIBUTING.md) before submitting a Pull Request.
+
+
+## Related
+* [OpenAPI Developer Portal][open-api]
+* [Packagist][packagist]
+* [Composer][composer]
+* [Guzzle Doc][guzzle-docs]
+* [Latest Release][latest-release]
+
+
+## License
+[Apache-2.0](/LICENSE.md)
+
+Copyright (c) 2009-present, Alibaba Cloud All rights reserved.
+
+
+[open-api]: https://next.api.aliyun.com
+[latest-release]: https://github.com/aliyun/credentials-php
+[guzzle-docs]: http://docs.guzzlephp.org/en/stable/request-options.html
+[composer]: https://getcomposer.org
+[packagist]: https://packagist.org/packages/alibabacloud/credentials
+[home]: https://home.console.aliyun.com
+[aliyun]: https://www.aliyun.com
+[cURL]: https://www.php.net/manual/en/book.curl.php
+[OPCache]: http://php.net/manual/en/book.opcache.php
+[xdebug]: http://xdebug.org
+[OpenSSL]: http://php.net/manual/en/book.openssl.php

+ 21 - 0
vendor/alibabacloud/credentials/SECURITY.md

@@ -0,0 +1,21 @@
+# Security Policy
+
+## Supported Versions
+
+Use this section to tell people about which versions of your project are
+currently being supported with security updates.
+
+| Version | Supported          |
+| ------- | ------------------ |
+| 5.1.x   | :white_check_mark: |
+| 5.0.x   | :x:                |
+| 4.0.x   | :white_check_mark: |
+| < 4.0   | :x:                |
+
+## Reporting a Vulnerability
+
+Use this section to tell people how to report a vulnerability.
+
+Tell them where to go, how often they can expect to get an update on a
+reported vulnerability, what to expect if the vulnerability is accepted or
+declined, etc.

+ 6 - 0
vendor/alibabacloud/credentials/UPGRADING.md

@@ -0,0 +1,6 @@
+Upgrading Guide
+===============
+
+1.x
+-----------------------
+- This is the first version. See <https://github.com/aliyun/credentials-php> for more information.

+ 104 - 0
vendor/alibabacloud/credentials/composer.json

@@ -0,0 +1,104 @@
+{
+    "name": "alibabacloud/credentials",
+    "homepage": "https://www.alibabacloud.com/",
+    "description": "Alibaba Cloud Credentials for PHP",
+    "keywords": [
+        "sdk",
+        "tool",
+        "cloud",
+        "client",
+        "aliyun",
+        "library",
+        "alibaba",
+        "Credentials",
+        "alibabacloud"
+    ],
+    "type": "library",
+    "license": "Apache-2.0",
+    "support": {
+        "source": "https://github.com/aliyun/credentials-php",
+        "issues": "https://github.com/aliyun/credentials-php/issues"
+    },
+    "authors": [
+        {
+            "name": "Alibaba Cloud SDK",
+            "email": "sdk-team@alibabacloud.com",
+            "homepage": "http://www.alibabacloud.com"
+        }
+    ],
+    "require": {
+        "php": ">=5.6",
+        "ext-curl": "*",
+        "ext-json": "*",
+        "ext-libxml": "*",
+        "ext-openssl": "*",
+        "ext-mbstring": "*",
+        "ext-simplexml": "*",
+        "ext-xmlwriter": "*",
+        "guzzlehttp/guzzle": "^6.3|^7.0",
+        "adbario/php-dot-notation": "^2.2",
+        "alibabacloud/tea": "^3.0"
+    },
+    "require-dev": {
+        "ext-spl": "*",
+        "ext-dom": "*",
+        "ext-pcre": "*",
+        "psr/cache": "^1.0",
+        "ext-sockets": "*",
+        "drupal/coder": "^8.3",
+        "symfony/dotenv": "^3.4",
+        "phpunit/phpunit": "^4.8.35|^5.4.3",
+        "monolog/monolog": "^1.24",
+        "composer/composer": "^1.8",
+        "mikey179/vfsstream": "^1.6",
+        "symfony/var-dumper": "^3.4"
+    },
+    "suggest": {
+        "ext-sockets": "To use client-side monitoring"
+    },
+    "autoload": {
+        "psr-4": {
+            "AlibabaCloud\\Credentials\\": "src"
+        }
+    },
+    "autoload-dev": {
+        "psr-4": {
+            "AlibabaCloud\\Credentials\\Tests\\": "tests/"
+        }
+    },
+    "config": {
+        "preferred-install": "dist",
+        "optimize-autoloader": true
+    },
+    "minimum-stability": "dev",
+    "prefer-stable": true,
+    "scripts-descriptions": {
+        "cs": "Tokenizes PHP, JavaScript and CSS files to detect violations of a defined coding standard.",
+        "cbf": "Automatically correct coding standard violations.",
+        "fixer": "Fixes code to follow standards.",
+        "test": "Run all tests.",
+        "unit": "Run Unit tests.",
+        "feature": "Run Feature tests.",
+        "clearCache": "Clear cache like coverage.",
+        "coverage": "Show Coverage html.",
+        "endpoints": "Update endpoints from OSS."
+    },
+    "scripts": {
+        "cs": "phpcs --standard=PSR2 -n ./",
+        "cbf": "phpcbf --standard=PSR2 -n ./",
+        "fixer": "php-cs-fixer fix ./",
+        "test": [
+            "phpunit --colors=always"
+        ],
+        "unit": [
+            "@clearCache",
+            "phpunit --testsuite=Unit --colors=always"
+        ],
+        "feature": [
+            "@clearCache",
+            "phpunit --testsuite=Feature --colors=always"
+        ],
+        "coverage": "open cache/coverage/index.html",
+        "clearCache": "rm -rf cache/*"
+    }
+}

+ 72 - 0
vendor/alibabacloud/credentials/src/AccessKeyCredential.php

@@ -0,0 +1,72 @@
+<?php
+
+namespace AlibabaCloud\Credentials;
+
+use AlibabaCloud\Credentials\Signature\ShaHmac1Signature;
+
+/**
+ * Use the AccessKey to complete the authentication.
+ */
+class AccessKeyCredential implements CredentialsInterface
+{
+    /**
+     * @var string
+     */
+    private $accessKeyId;
+
+    /**
+     * @var string
+     */
+    private $accessKeySecret;
+
+    /**
+     * AccessKeyCredential constructor.
+     *
+     * @param string $access_key_id     Access key ID
+     * @param string $access_key_secret Access Key Secret
+     */
+    public function __construct($access_key_id, $access_key_secret)
+    {
+        Filter::accessKey($access_key_id, $access_key_secret);
+
+        $this->accessKeyId     = $access_key_id;
+        $this->accessKeySecret = $access_key_secret;
+    }
+
+    /**
+     * @return string
+     */
+    public function getAccessKeyId()
+    {
+        return $this->accessKeyId;
+    }
+
+    /**
+     * @return string
+     */
+    public function getAccessKeySecret()
+    {
+        return $this->accessKeySecret;
+    }
+
+    /**
+     * @return string
+     */
+    public function __toString()
+    {
+        return "$this->accessKeyId#$this->accessKeySecret";
+    }
+
+    /**
+     * @return ShaHmac1Signature
+     */
+    public function getSignature()
+    {
+        return new ShaHmac1Signature();
+    }
+
+    public function getSecurityToken()
+    {
+        return '';
+    }
+}

+ 53 - 0
vendor/alibabacloud/credentials/src/BearerTokenCredential.php

@@ -0,0 +1,53 @@
+<?php
+
+namespace AlibabaCloud\Credentials;
+
+use AlibabaCloud\Credentials\Signature\BearerTokenSignature;
+
+/**
+ * Class BearerTokenCredential
+ */
+class BearerTokenCredential implements CredentialsInterface
+{
+
+    /**
+     * @var string
+     */
+    private $bearerToken;
+
+    /**
+     * BearerTokenCredential constructor.
+     *
+     * @param $bearerToken
+     */
+    public function __construct($bearerToken)
+    {
+        Filter::bearerToken($bearerToken);
+
+        $this->bearerToken = $bearerToken;
+    }
+
+    /**
+     * @return string
+     */
+    public function getBearerToken()
+    {
+        return $this->bearerToken;
+    }
+
+    /**
+     * @return string
+     */
+    public function __toString()
+    {
+        return "bearerToken#$this->bearerToken";
+    }
+
+    /**
+     * @return BearerTokenSignature
+     */
+    public function getSignature()
+    {
+        return new BearerTokenSignature();
+    }
+}

+ 182 - 0
vendor/alibabacloud/credentials/src/Credential.php

@@ -0,0 +1,182 @@
+<?php
+
+namespace AlibabaCloud\Credentials;
+
+use AlibabaCloud\Credentials\Credential\Config;
+use InvalidArgumentException;
+use ReflectionClass;
+use ReflectionException;
+use ReflectionParameter;
+
+/**
+ * Class Credential
+ *
+ * @package AlibabaCloud\Credentials
+ *
+ * @mixin AccessKeyCredential
+ * @mixin BearerTokenCredential
+ * @mixin EcsRamRoleCredential
+ * @mixin RamRoleArnCredential
+ * @mixin RsaKeyPairCredential
+ */
+class Credential
+{
+    /**
+     * @var array
+     */
+    protected $config = [];
+
+    /**
+     * @var array
+     */
+    protected $types = [
+        'access_key'   => AccessKeyCredential::class,
+        'sts'          => StsCredential::class,
+        'ecs_ram_role' => EcsRamRoleCredential::class,
+        'ram_role_arn' => RamRoleArnCredential::class,
+        'rsa_key_pair' => RsaKeyPairCredential::class,
+    ];
+
+    /**
+     * @var AccessKeyCredential|BearerTokenCredential|EcsRamRoleCredential|RamRoleArnCredential|RsaKeyPairCredential
+     */
+    protected $credential;
+
+    /**
+     * @var string
+     */
+    protected $type;
+
+    /**
+     * Credential constructor.
+     *
+     * @param array|Config $config
+     *
+     * @throws ReflectionException
+     */
+    public function __construct($config = [])
+    {
+        if ($config instanceof Config) {
+            $config = $this->parse($config);
+        }
+        if ($config !== []) {
+            $this->config = array_change_key_case($config);
+            $this->parseConfig();
+        } else {
+            $this->credential = Credentials::get()->getCredential();
+        }
+    }
+
+    /**
+     * @param Config $config
+     *
+     * @return array
+     */
+    private function parse($config)
+    {
+        $config = get_object_vars($config);
+        $res    = [];
+        foreach ($config as $key => $value) {
+            $res[$this->toUnderScore($key)] = $value;
+        }
+        return $res;
+    }
+
+    private function toUnderScore($str)
+    {
+        $dstr = preg_replace_callback('/([A-Z]+)/', function ($matchs) {
+            return '_' . strtolower($matchs[0]);
+        }, $str);
+        return trim(preg_replace('/_{2,}/', '_', $dstr), '_');
+    }
+
+    /**
+     * @throws ReflectionException
+     */
+    private function parseConfig()
+    {
+        if (!isset($this->config['type'])) {
+            throw  new InvalidArgumentException('Missing required type option');
+        }
+
+        $this->type = $this->config['type'];
+        if (!isset($this->types[$this->type])) {
+            throw  new InvalidArgumentException(
+                'Invalid type option, support: ' .
+                implode(', ', array_keys($this->types))
+            );
+        }
+
+        $class      = new ReflectionClass($this->types[$this->type]);
+        $parameters = [];
+        /**
+         * @var $parameter ReflectionParameter
+         */
+        foreach ($class->getConstructor()->getParameters() as $parameter) {
+            $parameters[] = $this->getValue($parameter);
+        }
+
+        $this->credential = $class->newInstance(...$parameters);
+    }
+
+    /**
+     * @param ReflectionParameter $parameter
+     *
+     * @return string|array
+     * @throws ReflectionException
+     */
+    protected function getValue(ReflectionParameter $parameter)
+    {
+        if ($parameter->name === 'config' || $parameter->name === 'credential') {
+            return $this->config;
+        }
+
+        foreach ($this->config as $key => $value) {
+            if (strtolower($parameter->name) === $key) {
+                return $value;
+            }
+        }
+
+        if ($parameter->isDefaultValueAvailable()) {
+            return $parameter->getDefaultValue();
+        }
+
+        throw new InvalidArgumentException("Missing required {$parameter->name} option in config for {$this->type}");
+    }
+
+    /**
+     * @return AccessKeyCredential|BearerTokenCredential|EcsRamRoleCredential|RamRoleArnCredential|RsaKeyPairCredential
+     */
+    public function getCredential()
+    {
+        return $this->credential;
+    }
+
+    /**
+     * @return array
+     */
+    public function getConfig()
+    {
+        return $this->config;
+    }
+
+    /**
+     * @return string
+     */
+    public function getType()
+    {
+        return $this->type;
+    }
+
+
+    /**
+     * @param string $name
+     * @param array  $arguments
+     *
+     * @return mixed
+     */
+    public function __call($name, $arguments)
+    {
+        return $this->credential->$name($arguments);
+    }
+}

+ 50 - 0
vendor/alibabacloud/credentials/src/Credential/Config.php

@@ -0,0 +1,50 @@
+<?php
+
+namespace AlibabaCloud\Credentials\Credential;
+
+class Config
+{
+    /**
+     * @var string
+     */
+    public $type = 'default';
+
+    public $accessKeyId = "";
+
+    public $accessKeySecret = "";
+
+    public $securityToken = "";
+
+    public $bearerToken = "";
+
+    public $roleName = "";
+
+    public $roleArn = "";
+
+    public $roleSessionName = "";
+
+    public $host = "";
+
+    public $publicKeyId = "";
+
+    public $privateKeyFile = "";
+
+    public $readTimeout = 0;
+
+    public $connectTimeout = 0;
+
+    public $certFile = "";
+
+    public $certPassword = "";
+
+    public $proxy = "";
+
+    public $expiration = 0;
+
+    public function __construct($config)
+    {
+        foreach ($config as $k => $v) {
+            $this->{$k} = $v;
+        }
+    }
+}

+ 102 - 0
vendor/alibabacloud/credentials/src/Credentials.php

@@ -0,0 +1,102 @@
+<?php
+
+namespace AlibabaCloud\Credentials;
+
+use AlibabaCloud\Credentials\Providers\ChainProvider;
+use ReflectionException;
+use RuntimeException;
+
+/**
+ * Class Credentials
+ *
+ * @package AlibabaCloud\Credentials
+ */
+class Credentials
+{
+    use MockTrait;
+
+    /**
+     * @var array|CredentialsInterface[] containers of credentials
+     */
+    protected static $credentials = [];
+
+    /**
+     * Get the credential instance by name.
+     *
+     * @param string $name
+     *
+     * @return Credential
+     * @throws ReflectionException
+     */
+    public static function get($name = null)
+    {
+        if ($name !== null) {
+            Filter::credentialName($name);
+        } else {
+            $name = ChainProvider::getDefaultName();
+        }
+
+        self::load();
+
+        if (self::has($name)) {
+            return new Credential(self::$credentials[\strtolower($name)]);
+        }
+
+        throw new RuntimeException("Credential '$name' not found");
+    }
+
+    private static function load()
+    {
+        if (self::$credentials) {
+            return;
+        }
+
+        if (ChainProvider::hasCustomChain()) {
+            ChainProvider::customProvider(ChainProvider::getDefaultName());
+        } else {
+            ChainProvider::defaultProvider(ChainProvider::getDefaultName());
+        }
+    }
+
+    /**
+     * Determine whether there is a credential.
+     *
+     * @param string $name
+     *
+     * @return bool
+     */
+    public static function has($name)
+    {
+        Filter::credentialName($name);
+
+        return isset(self::$credentials[\strtolower($name)]);
+    }
+
+    public static function flush()
+    {
+        self::$credentials = [];
+    }
+
+    /**
+     * Get all credentials.
+     *
+     * @return array
+     */
+    public static function all()
+    {
+        self::load();
+
+        return self::$credentials;
+    }
+
+    /**
+     * @param string $name
+     * @param array  $credential
+     */
+    public static function set($name, array $credential)
+    {
+        Filter::credentialName($name);
+
+        self::$credentials[\strtolower($name)] = \array_change_key_case($credential);
+    }
+}

+ 23 - 0
vendor/alibabacloud/credentials/src/CredentialsInterface.php

@@ -0,0 +1,23 @@
+<?php
+
+namespace AlibabaCloud\Credentials;
+
+use AlibabaCloud\Credentials\Signature\SignatureInterface;
+
+/**
+ * Interface CredentialsInterface
+ *
+ * @codeCoverageIgnore
+ */
+interface CredentialsInterface
+{
+    /**
+     * @return string
+     */
+    public function __toString();
+
+    /**
+     * @return SignatureInterface
+     */
+    public function getSignature();
+}

+ 151 - 0
vendor/alibabacloud/credentials/src/EcsRamRoleCredential.php

@@ -0,0 +1,151 @@
+<?php
+
+namespace AlibabaCloud\Credentials;
+
+use AlibabaCloud\Credentials\Providers\EcsRamRoleProvider;
+use AlibabaCloud\Credentials\Request\Request;
+use AlibabaCloud\Credentials\Signature\ShaHmac1Signature;
+use Exception;
+use GuzzleHttp\Exception\GuzzleException;
+use InvalidArgumentException;
+use RuntimeException;
+
+/**
+ * Use the RAM role of an ECS instance to complete the authentication.
+ */
+class EcsRamRoleCredential implements CredentialsInterface
+{
+
+    /**
+     * @var string
+     */
+    private $roleName;
+
+    /**
+     * EcsRamRoleCredential constructor.
+     *
+     * @param $role_name
+     */
+    public function __construct($role_name = null)
+    {
+        Filter::roleName($role_name);
+
+        $this->roleName = $role_name;
+    }
+
+    /**
+     * @return string
+     * @throws GuzzleException
+     * @throws Exception
+     */
+    public function getRoleName()
+    {
+        if ($this->roleName !== null) {
+            return $this->roleName;
+        }
+
+        $this->roleName = $this->getRoleNameFromMeta();
+
+        return $this->roleName;
+    }
+
+    /**
+     * @return string
+     * @throws Exception
+     */
+    public function getRoleNameFromMeta()
+    {
+        $options = [
+            'http_errors'     => false,
+            'timeout'         => 1,
+            'connect_timeout' => 1,
+        ];
+
+        $result = Request::createClient()->request(
+            'GET',
+            'http://100.100.100.200/latest/meta-data/ram/security-credentials/',
+            $options
+        );
+
+        if ($result->getStatusCode() === 404) {
+            throw new InvalidArgumentException('The role name was not found in the instance');
+        }
+
+        if ($result->getStatusCode() !== 200) {
+            throw new RuntimeException('Error retrieving credentials from result: ' . $result->getBody());
+        }
+
+        $role_name = (string)$result;
+        if (!$role_name) {
+            throw new RuntimeException('Error retrieving credentials from result is empty');
+        }
+
+        return $role_name;
+    }
+
+    /**
+     * @return string
+     */
+    public function __toString()
+    {
+        return "roleName#$this->roleName";
+    }
+
+    /**
+     * @return ShaHmac1Signature
+     */
+    public function getSignature()
+    {
+        return new ShaHmac1Signature();
+    }
+
+    /**
+     * @return string
+     * @throws Exception
+     * @throws GuzzleException
+     */
+    public function getAccessKeyId()
+    {
+        return $this->getSessionCredential()->getAccessKeyId();
+    }
+
+    /**
+     * @return StsCredential
+     * @throws Exception
+     * @throws GuzzleException
+     */
+    protected function getSessionCredential()
+    {
+        return (new EcsRamRoleProvider($this))->get();
+    }
+
+    /**
+     * @return string
+     * @throws Exception
+     * @throws GuzzleException
+     */
+    public function getAccessKeySecret()
+    {
+        return $this->getSessionCredential()->getAccessKeySecret();
+    }
+
+    /**
+     * @return string
+     * @throws Exception
+     * @throws GuzzleException
+     */
+    public function getSecurityToken()
+    {
+        return $this->getSessionCredential()->getSecurityToken();
+    }
+
+    /**
+     * @return int
+     * @throws Exception
+     * @throws GuzzleException
+     */
+    public function getExpiration()
+    {
+        return $this->getSessionCredential()->getExpiration();
+    }
+}

+ 134 - 0
vendor/alibabacloud/credentials/src/Filter.php

@@ -0,0 +1,134 @@
+<?php
+
+namespace AlibabaCloud\Credentials;
+
+use InvalidArgumentException;
+
+class Filter
+{
+
+    /**
+     * @param $name
+     *
+     * @codeCoverageIgnore
+     * @return string
+     */
+    public static function credentialName($name)
+    {
+        if (!is_string($name)) {
+            throw new InvalidArgumentException('Name must be a string');
+        }
+
+        if ($name === '') {
+            throw new InvalidArgumentException('Name cannot be empty');
+        }
+
+        return $name;
+    }
+
+    /**
+     * @param $bearerToken
+     *
+     * @return mixed
+     * @throws InvalidArgumentException
+     */
+    public static function bearerToken($bearerToken)
+    {
+        if (!is_string($bearerToken)) {
+            throw new InvalidArgumentException('Bearer Token must be a string');
+        }
+
+        if ($bearerToken === '') {
+            throw new InvalidArgumentException('Bearer Token cannot be empty');
+        }
+
+        return $bearerToken;
+    }
+
+    /**
+     * @param $publicKeyId
+     *
+     * @return mixed
+     */
+    public static function publicKeyId($publicKeyId)
+    {
+        if (!is_string($publicKeyId)) {
+            throw new InvalidArgumentException('public_key_id must be a string');
+        }
+
+        if ($publicKeyId === '') {
+            throw new InvalidArgumentException('public_key_id cannot be empty');
+        }
+
+        return $publicKeyId;
+    }
+
+    /**
+     * @param $privateKeyFile
+     *
+     * @return mixed
+     */
+    public static function privateKeyFile($privateKeyFile)
+    {
+        if (!is_string($privateKeyFile)) {
+            throw new InvalidArgumentException('private_key_file must be a string');
+        }
+
+        if ($privateKeyFile === '') {
+            throw new InvalidArgumentException('private_key_file cannot be empty');
+        }
+
+        return $privateKeyFile;
+    }
+
+    /**
+     * @param string|null $role_name
+     */
+    public static function roleName($role_name)
+    {
+        if ($role_name === null) {
+            return;
+        }
+
+        if (!is_string($role_name)) {
+            throw new InvalidArgumentException('role_name must be a string');
+        }
+
+        if ($role_name === '') {
+            throw new InvalidArgumentException('role_name cannot be empty');
+        }
+    }
+
+    /**
+     * @param string $accessKeyId
+     * @param string $accessKeySecret
+     */
+    public static function accessKey($accessKeyId, $accessKeySecret)
+    {
+        if (!is_string($accessKeyId)) {
+            throw new InvalidArgumentException('access_key_id must be a string');
+        }
+
+        if ($accessKeyId === '') {
+            throw new InvalidArgumentException('access_key_id cannot be empty');
+        }
+
+        if (!is_string($accessKeySecret)) {
+            throw new InvalidArgumentException('access_key_secret must be a string');
+        }
+
+        if ($accessKeySecret === '') {
+            throw new InvalidArgumentException('access_key_secret cannot be empty');
+        }
+    }
+
+    /**
+     * @param int $expiration
+     */
+    public static function expiration($expiration)
+    {
+        if (!is_int($expiration)) {
+            throw new InvalidArgumentException('expiration must be a int');
+        }
+    }
+}

+ 202 - 0
vendor/alibabacloud/credentials/src/Helper.php

@@ -0,0 +1,202 @@
+<?php
+
+namespace AlibabaCloud\Credentials;
+
+use Closure;
+
+/**
+ * Class Helper
+ *
+ * @package AlibabaCloud\Credentials
+ */
+class Helper
+{
+    /**
+     * @param array $arrays
+     *
+     * @return array
+     */
+    public static function merge(array $arrays)
+    {
+        $result = [];
+        foreach ($arrays as $array) {
+            foreach ($array as $key => $value) {
+                if (is_int($key)) {
+                    $result[] = $value;
+                    continue;
+                }
+
+                if (isset($result[$key]) && is_array($result[$key])) {
+                    $result[$key] = self::merge(
+                        [$result[$key], $value]
+                    );
+                    continue;
+                }
+
+                $result[$key] = $value;
+            }
+        }
+
+        return $result;
+    }
+
+    /**
+     * @param      $filename
+     *
+     * @return bool
+     */
+    public static function inOpenBasedir($filename)
+    {
+        $open_basedir = ini_get('open_basedir');
+        if (!$open_basedir) {
+            return true;
+        }
+
+        $dirs = explode(PATH_SEPARATOR, $open_basedir);
+
+        return empty($dirs) || self::inDir($filename, $dirs);
+    }
+
+    /**
+     * @param string $filename
+     * @param array  $dirs
+     *
+     * @return bool
+     */
+    public static function inDir($filename, array $dirs)
+    {
+        foreach ($dirs as $dir) {
+            if ($dir[strlen($dir) - 1] !== DIRECTORY_SEPARATOR) {
+                $dir .= DIRECTORY_SEPARATOR;
+            }
+
+            if (0 === strpos($filename, $dir)) {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    /**
+     * @return bool
+     */
+    public static function isWindows()
+    {
+        return PATH_SEPARATOR === ';';
+    }
+
+    /**
+     * @param $key
+     *
+     * @return bool|mixed
+     */
+    public static function envNotEmpty($key)
+    {
+        $value = self::env($key, false);
+        if ($value) {
+            return $value;
+        }
+
+        return false;
+    }
+
+    /**
+     * Gets the value of an environment variable.
+     *
+     * @param string $key
+     * @param mixed  $default
+     *
+     * @return mixed
+     */
+    public static function env($key, $default = null)
+    {
+        $value = getenv($key);
+
+        if ($value === false) {
+            return self::value($default);
+        }
+
+        if (self::envSubstr($value)) {
+            return substr($value, 1, -1);
+        }
+
+        return self::envConversion($value);
+    }
+
+    /**
+     * Return the default value of the given value.
+     *
+     * @param mixed $value
+     *
+     * @return mixed
+     */
+    public static function value($value)
+    {
+        return $value instanceof Closure ? $value() : $value;
+    }
+
+    /**
+     * @param $value
+     *
+     * @return bool
+     */
+    public static function envSubstr($value)
+    {
+        return ($valueLength = strlen($value)) > 1
+            && strpos($value, '"') === 0
+            && $value[$valueLength - 1] === '"';
+    }
+
+    /**
+     * @param $value
+     *
+     * @return bool|string|null
+     */
+    public static function envConversion($value)
+    {
+        $key = strtolower($value);
+
+        if ($key === 'null' || $key === '(null)') {
+            return null;
+        }
+
+        $list = [
+            'true'    => true,
+            '(true)'  => true,
+            'false'   => false,
+            '(false)' => false,
+            'empty'   => '',
+            '(empty)' => '',
+        ];
+
+        return isset($list[$key]) ? $list[$key] : $value;
+    }
+
+    /**
+     * Gets the environment's HOME directory.
+     *
+     * @return null|string
+     */
+    public static function getHomeDirectory()
+    {
+        if (getenv('HOME')) {
+            return getenv('HOME');
+        }
+
+        return (getenv('HOMEDRIVE') && getenv('HOMEPATH'))
+            ? getenv('HOMEDRIVE') . getenv('HOMEPATH')
+            : null;
+    }
+
+    /**
+     * @param mixed ...$parameters
+     *
+     * @codeCoverageIgnore
+     */
+    public static function dd(...$parameters)
+    {
+        dump(...$parameters);
+        exit;
+    }
+}

+ 98 - 0
vendor/alibabacloud/credentials/src/MockTrait.php

@@ -0,0 +1,98 @@
+<?php
+
+namespace AlibabaCloud\Credentials;
+
+use Exception;
+use GuzzleHttp\Exception\RequestException;
+use GuzzleHttp\Handler\MockHandler;
+use GuzzleHttp\Psr7\Response;
+use Psr\Http\Message\RequestInterface;
+use Psr\Http\Message\ResponseInterface;
+
+/**
+ * Trait MockTrait
+ *
+ * @package AlibabaCloud\Credentials
+ */
+trait MockTrait
+{
+    /**
+     * @var array
+     */
+    private static $mockQueue = [];
+
+    /**
+     * @var MockHandler
+     */
+    private static $mock;
+
+    /**
+     * @param integer             $status
+     * @param array               $headers
+     * @param array|string|object $body
+     */
+    public static function mockResponse($status = 200, array $headers = [], $body = null)
+    {
+        if (is_array($body) || is_object($body)) {
+            $body = json_encode($body);
+        }
+
+        self::$mockQueue[] = new Response($status, $headers, $body);
+        self::createHandlerStack();
+    }
+
+    private static function createHandlerStack()
+    {
+        self::$mock = new MockHandler(self::$mockQueue);
+    }
+
+    /**
+     * @param string                 $message
+     * @param RequestInterface       $request
+     * @param ResponseInterface|null $response
+     * @param Exception|null         $previous
+     * @param array                  $handlerContext
+     */
+    public static function mockRequestException(
+        $message,
+        RequestInterface $request,
+        ResponseInterface $response = null,
+        Exception $previous = null,
+        array $handlerContext = []
+    ) {
+        self::$mockQueue[] = new RequestException(
+            $message,
+            $request,
+            $response,
+            $previous,
+            $handlerContext
+        );
+
+        self::createHandlerStack();
+    }
+
+    /**
+     * @return void
+     */
+    public static function cancelMock()
+    {
+        self::$mockQueue = [];
+        self::$mock      = null;
+    }
+
+    /**
+     * @return bool
+     */
+    public static function hasMock()
+    {
+        return (bool)self::$mockQueue;
+    }
+
+    /**
+     * @return MockHandler
+     */
+    public static function getMock()
+    {
+        return self::$mock;
+    }
+}

+ 187 - 0
vendor/alibabacloud/credentials/src/Providers/ChainProvider.php

@@ -0,0 +1,187 @@
+<?php
+
+namespace AlibabaCloud\Credentials\Providers;
+
+use AlibabaCloud\Credentials\Credentials;
+use AlibabaCloud\Credentials\Helper;
+use Closure;
+use InvalidArgumentException;
+use RuntimeException;
+
+/**
+ * Class ChainProvider
+ *
+ * @package AlibabaCloud\Credentials\Providers
+ */
+class ChainProvider
+{
+    /**
+     * @var array
+     */
+    private static $customChains;
+
+    /**
+     * @param callable ...$providers
+     */
+    public static function set(...$providers)
+    {
+        if (empty($providers)) {
+            throw new InvalidArgumentException('No providers in chain');
+        }
+
+        foreach ($providers as $provider) {
+            if (!$provider instanceof Closure) {
+                throw new InvalidArgumentException('Providers must all be Closures');
+            }
+        }
+
+        self::$customChains = $providers;
+    }
+
+    /**
+     * @return bool
+     */
+    public static function hasCustomChain()
+    {
+        return (bool)self::$customChains;
+    }
+
+    public static function flush()
+    {
+        self::$customChains = [];
+    }
+
+    /**
+     * @param string $name
+     */
+    public static function customProvider($name)
+    {
+        foreach (self::$customChains as $provider) {
+            $provider();
+
+            if (Credentials::has($name)) {
+                break;
+            }
+        }
+    }
+
+    /**
+     * @param string $name
+     */
+    public static function defaultProvider($name)
+    {
+        $providers = [
+            self::env(),
+            self::ini(),
+            self::instance(),
+        ];
+
+        foreach ($providers as $provider) {
+            $provider();
+
+            if (Credentials::has($name)) {
+                break;
+            }
+        }
+    }
+
+    /**
+     * @return Closure
+     */
+    public static function env()
+    {
+        return static function () {
+            $accessKeyId     = Helper::envNotEmpty('ALIBABA_CLOUD_ACCESS_KEY_ID');
+            $accessKeySecret = Helper::envNotEmpty('ALIBABA_CLOUD_ACCESS_KEY_SECRET');
+
+            if ($accessKeyId && $accessKeySecret) {
+                Credentials::set(
+                    self::getDefaultName(),
+                    [
+                        'type'              => 'access_key',
+                        'access_key_id'     => $accessKeyId,
+                        'access_key_secret' => $accessKeySecret,
+                    ]
+                );
+            }
+        };
+    }
+
+    /**
+     * @return string
+     */
+    public static function getDefaultName()
+    {
+        $name = Helper::envNotEmpty('ALIBABA_CLOUD_PROFILE');
+
+        if ($name) {
+            return $name;
+        }
+
+        return 'default';
+    }
+
+    /**
+     * @return Closure
+     */
+    public static function ini()
+    {
+        return static function () {
+            $filename = Helper::envNotEmpty('ALIBABA_CLOUD_CREDENTIALS_FILE');
+            if (!$filename) {
+                $filename = self::getDefaultFile();
+            }
+
+            if (!Helper::inOpenBasedir($filename)) {
+                return;
+            }
+
+            if ($filename !== self::getDefaultFile() && (!\is_readable($filename) || !\is_file($filename))) {
+                throw new RuntimeException(
+                    'Credentials file is not readable: ' . $filename
+                );
+            }
+
+            $file_array = \parse_ini_file($filename, true);
+
+            if (\is_array($file_array) && !empty($file_array)) {
+                foreach (\array_change_key_case($file_array) as $name => $configures) {
+                    Credentials::set($name, $configures);
+                }
+            }
+        };
+    }
+
+    /**
+     * Get the default credential file.
+     *
+     * @return string
+     */
+    public static function getDefaultFile()
+    {
+        return Helper::getHomeDirectory() .
+               DIRECTORY_SEPARATOR .
+               '.alibabacloud' .
+               DIRECTORY_SEPARATOR .
+               'credentials';
+    }
+
+    /**
+     * @return Closure
+     */
+    public static function instance()
+    {
+        return static function () {
+            $instance = Helper::envNotEmpty('ALIBABA_CLOUD_ECS_METADATA');
+            if ($instance) {
+                Credentials::set(
+                    self::getDefaultName(),
+                    [
+                        'type'      => 'ecs_ram_role',
+                        'role_name' => $instance,
+                    ]
+                );
+            }
+        };
+    }
+}

+ 94 - 0
vendor/alibabacloud/credentials/src/Providers/EcsRamRoleProvider.php

@@ -0,0 +1,94 @@
+<?php
+
+namespace AlibabaCloud\Credentials\Providers;
+
+use AlibabaCloud\Credentials\Request\Request;
+use AlibabaCloud\Credentials\StsCredential;
+use Exception;
+use GuzzleHttp\Exception\GuzzleException;
+use AlibabaCloud\Tea\Response;
+use InvalidArgumentException;
+use Psr\Http\Message\ResponseInterface;
+use RuntimeException;
+
+/**
+ * Class EcsRamRoleProvider
+ *
+ * @package AlibabaCloud\Credentials\Providers
+ */
+class EcsRamRoleProvider extends Provider
+{
+
+    /**
+     * Expiration time slot for temporary security credentials.
+     *
+     * @var int
+     */
+    protected $expirationSlot = 10;
+
+    /**
+     * @var string
+     */
+    private $uri = 'http://100.100.100.200/latest/meta-data/ram/security-credentials/';
+
+    /**
+     * Get credential.
+     *
+     * @return StsCredential
+     * @throws Exception
+     * @throws GuzzleException
+     */
+    public function get()
+    {
+        $result = $this->getCredentialsInCache();
+
+        if ($result === null) {
+            $result = $this->request();
+
+            if (!isset($result['AccessKeyId'], $result['AccessKeySecret'], $result['SecurityToken'])) {
+                throw new RuntimeException($this->error);
+            }
+
+            $this->cache($result->toArray());
+        }
+
+        return new StsCredential(
+            $result['AccessKeyId'],
+            $result['AccessKeySecret'],
+            strtotime($result['Expiration']),
+            $result['SecurityToken']
+        );
+    }
+
+    /**
+     * Get credentials by request.
+     *
+     * @return ResponseInterface
+     * @throws Exception
+     * @throws GuzzleException
+     */
+    public function request()
+    {
+        $credential = $this->credential;
+        $url        = $this->uri . $credential->getRoleName();
+
+        $options = [
+            'http_errors'     => false,
+            'timeout'         => 1,
+            'connect_timeout' => 1,
+        ];
+
+        $result = Request::createClient()->request('GET', $url, $options);
+
+        if ($result->getStatusCode() === 404) {
+            $message = 'The role was not found in the instance';
+            throw new InvalidArgumentException($message);
+        }
+
+        if ($result->getStatusCode() !== 200) {
+            throw new RuntimeException('Error retrieving credentials from result: ' . $result->toJson());
+        }
+
+        return $result;
+    }
+}

+ 82 - 0
vendor/alibabacloud/credentials/src/Providers/Provider.php

@@ -0,0 +1,82 @@
+<?php
+
+namespace AlibabaCloud\Credentials\Providers;
+
+use AlibabaCloud\Credentials\CredentialsInterface;
+use AlibabaCloud\Credentials\EcsRamRoleCredential;
+use AlibabaCloud\Credentials\RamRoleArnCredential;
+use AlibabaCloud\Credentials\RsaKeyPairCredential;
+
+abstract class Provider
+{
+    /**
+     * For TSC Duration Seconds
+     */
+    const DURATION_SECONDS = 3600;
+
+    /**
+     * @var array
+     */
+    protected static $credentialsCache = [];
+
+    /**
+     * Expiration time slot for temporary security credentials.
+     *
+     * @var int
+     */
+    protected $expirationSlot = 180;
+
+    /**
+     * @var RamRoleArnCredential|RsaKeyPairCredential|EcsRamRoleCredential
+     */
+    protected $credential;
+
+    /**
+     * @var string
+     */
+    protected $error = 'Result contains no credentials';
+
+    /**
+     * @var array
+     */
+    protected $config = [];
+
+    /**
+     * CredentialTrait constructor.
+     *
+     * @param CredentialsInterface $credential
+     * @param array                $config
+     */
+    public function __construct(CredentialsInterface $credential, $config = [])
+    {
+        $this->credential = $credential;
+        $this->config     = $config;
+    }
+
+    /**
+     * Get the credentials from the cache in the validity period.
+     *
+     * @return array|null
+     */
+    public function getCredentialsInCache()
+    {
+        if (isset(self::$credentialsCache[(string)$this->credential])) {
+            $result = self::$credentialsCache[(string)$this->credential];
+            if (\strtotime($result['Expiration']) - \time() >= $this->expirationSlot) {
+                return $result;
+            }
+        }
+
+        return null;
+    }
+
+    /**
+     * Cache credentials.
+     *
+     * @param array $credential
+     */
+    protected function cache(array $credential)
+    {
+        self::$credentialsCache[(string)$this->credential] = $credential;
+    }
+}

+ 49 - 0
vendor/alibabacloud/credentials/src/Providers/RamRoleArnProvider.php

@@ -0,0 +1,49 @@
+<?php
+
+namespace AlibabaCloud\Credentials\Providers;
+
+use AlibabaCloud\Credentials\Request\AssumeRole;
+use AlibabaCloud\Credentials\StsCredential;
+use Exception;
+use GuzzleHttp\Exception\GuzzleException;
+use RuntimeException;
+
+class RamRoleArnProvider extends Provider
+{
+
+    /**
+     * Get credential.
+     *
+     * @return StsCredential
+     * @throws Exception
+     * @throws GuzzleException
+     */
+    public function get()
+    {
+        $credential = $this->getCredentialsInCache();
+
+        if (null === $credential) {
+            $result = (new AssumeRole($this->credential))->request();
+
+            if ($result->getStatusCode() !== 200) {
+                throw new RuntimeException(isset($result['Message']) ? $result['Message'] : (string)$result->getBody());
+            }
+
+            if (!isset($result['Credentials']['AccessKeyId'],
+                $result['Credentials']['AccessKeySecret'],
+                $result['Credentials']['SecurityToken'])) {
+                throw new RuntimeException($this->error);
+            }
+
+            $credential = $result['Credentials'];
+            $this->cache($credential);
+        }
+
+        return new StsCredential(
+            $credential['AccessKeyId'],
+            $credential['AccessKeySecret'],
+            strtotime($credential['Expiration']),
+            $credential['SecurityToken']
+        );
+    }
+}

+ 53 - 0
vendor/alibabacloud/credentials/src/Providers/RsaKeyPairProvider.php

@@ -0,0 +1,53 @@
+<?php
+
+namespace AlibabaCloud\Credentials\Providers;
+
+use AlibabaCloud\Credentials\Request\GenerateSessionAccessKey;
+use AlibabaCloud\Credentials\StsCredential;
+use Exception;
+use GuzzleHttp\Exception\GuzzleException;
+use RuntimeException;
+
+/**
+ * Class RsaKeyPairProvider
+ *
+ * @package AlibabaCloud\Credentials\Providers
+ */
+class RsaKeyPairProvider extends Provider
+{
+
+    /**
+     * Get credential.
+     *
+     *
+     * @return StsCredential
+     * @throws Exception
+     * @throws GuzzleException
+     */
+    public function get()
+    {
+        $credential = $this->getCredentialsInCache();
+
+        if ($credential === null) {
+            $result = (new GenerateSessionAccessKey($this->credential))->request();
+
+            if ($result->getStatusCode() !== 200) {
+                throw new RuntimeException(isset($result['Message']) ? $result['Message'] : (string)$result->getBody());
+            }
+
+            if (!isset($result['SessionAccessKey']['SessionAccessKeyId'],
+                $result['SessionAccessKey']['SessionAccessKeySecret'])) {
+                throw new RuntimeException($this->error);
+            }
+
+            $credential = $result['SessionAccessKey'];
+            $this->cache($credential);
+        }
+
+        return new StsCredential(
+            $credential['SessionAccessKeyId'],
+            $credential['SessionAccessKeySecret'],
+            strtotime($credential['Expiration'])
+        );
+    }
+}

+ 218 - 0
vendor/alibabacloud/credentials/src/RamRoleArnCredential.php

@@ -0,0 +1,218 @@
+<?php
+
+namespace AlibabaCloud\Credentials;
+
+use AlibabaCloud\Credentials\Providers\RamRoleArnProvider;
+use AlibabaCloud\Credentials\Signature\ShaHmac1Signature;
+use Exception;
+use GuzzleHttp\Exception\GuzzleException;
+use InvalidArgumentException;
+
+/**
+ * Use the AssumeRole of the RAM account to complete  the authentication.
+ */
+class RamRoleArnCredential implements CredentialsInterface
+{
+
+    /**
+     * @var string
+     */
+    private $accessKeyId;
+
+    /**
+     * @var string
+     */
+    private $accessKeySecret;
+
+    /**
+     * @var string
+     */
+    private $roleArn;
+
+    /**
+     * @var string
+     */
+    private $roleSessionName;
+
+    /**
+     * @var string
+     */
+    private $policy;
+
+    /**
+     * @var array
+     */
+    private $config;
+
+    /**
+     * RamRoleArnCredential constructor.
+     *
+     * @param array $credential
+     * @param array $config
+     */
+    public function __construct(array $credential = [], array $config = [])
+    {
+        $this->filterParameters($credential);
+        $this->filterPolicy($credential);
+
+        Filter::accessKey($credential['access_key_id'], $credential['access_key_secret']);
+
+        $this->config          = $config;
+        $this->accessKeyId     = $credential['access_key_id'];
+        $this->accessKeySecret = $credential['access_key_secret'];
+        $this->roleArn         = $credential['role_arn'];
+        $this->roleSessionName = $credential['role_session_name'];
+    }
+
+    /**
+     * @param array $credential
+     */
+    private function filterParameters(array $credential)
+    {
+        if (!isset($credential['access_key_id'])) {
+            throw new InvalidArgumentException('Missing required access_key_id option in config for ram_role_arn');
+        }
+
+        if (!isset($credential['access_key_secret'])) {
+            throw new InvalidArgumentException('Missing required access_key_secret option in config for ram_role_arn');
+        }
+
+        if (!isset($credential['role_arn'])) {
+            throw new InvalidArgumentException('Missing required role_arn option in config for ram_role_arn');
+        }
+
+        if (!isset($credential['role_session_name'])) {
+            throw new InvalidArgumentException('Missing required role_session_name option in config for ram_role_arn');
+        }
+    }
+
+    /**
+     * @param array $credential
+     */
+    private function filterPolicy(array $credential)
+    {
+        if (isset($credential['policy'])) {
+            if (is_string($credential['policy'])) {
+                $this->policy = $credential['policy'];
+            }
+
+            if (is_array($credential['policy'])) {
+                $this->policy = json_encode($credential['policy']);
+            }
+        }
+    }
+
+    /**
+     * @return array
+     */
+    public function getConfig()
+    {
+        return $this->config;
+    }
+
+    /**
+     * @return string
+     */
+    public function getRoleArn()
+    {
+        return $this->roleArn;
+    }
+
+    /**
+     * @return string
+     */
+    public function getRoleSessionName()
+    {
+        return $this->roleSessionName;
+    }
+
+    /**
+     * @return string
+     */
+    public function getPolicy()
+    {
+        return $this->policy;
+    }
+
+    /**
+     * @return string
+     */
+    public function __toString()
+    {
+        return "$this->accessKeyId#$this->accessKeySecret#$this->roleArn#$this->roleSessionName";
+    }
+
+    /**
+     * @return ShaHmac1Signature
+     */
+    public function getSignature()
+    {
+        return new ShaHmac1Signature();
+    }
+
+    /**
+     * @return string
+     */
+    public function getOriginalAccessKeyId()
+    {
+        return $this->accessKeyId;
+    }
+
+    /**
+     * @return string
+     */
+    public function getOriginalAccessKeySecret()
+    {
+        return $this->accessKeySecret;
+    }
+
+    /**
+     * @return string
+     * @throws Exception
+     * @throws GuzzleException
+     */
+    public function getAccessKeyId()
+    {
+        return $this->getSessionCredential()->getAccessKeyId();
+    }
+
+    /**
+     * @return StsCredential
+     * @throws Exception
+     * @throws GuzzleException
+     */
+    protected function getSessionCredential()
+    {
+        return (new RamRoleArnProvider($this))->get();
+    }
+
+    /**
+     * @return string
+     * @throws Exception
+     * @throws GuzzleException
+     */
+    public function getAccessKeySecret()
+    {
+        return $this->getSessionCredential()->getAccessKeySecret();
+    }
+
+    /**
+     * @return string
+     * @throws Exception
+     * @throws GuzzleException
+     */
+    public function getSecurityToken()
+    {
+        return $this->getSessionCredential()->getSecurityToken();
+    }
+
+    /**
+     * @return string
+     * @throws Exception
+     * @throws GuzzleException
+     */
+    public function getExpiration()
+    {
+        return $this->getSessionCredential()->getExpiration();
+    }
+}

+ 37 - 0
vendor/alibabacloud/credentials/src/Request/AssumeRole.php

@@ -0,0 +1,37 @@
+<?php
+
+namespace AlibabaCloud\Credentials\Request;
+
+use AlibabaCloud\Credentials\Providers\Provider;
+use AlibabaCloud\Credentials\RamRoleArnCredential;
+use AlibabaCloud\Credentials\Signature\ShaHmac1Signature;
+
+/**
+ * Retrieving assume role credentials.
+ */
+class AssumeRole extends Request
+{
+    /**
+     * AssumeRole constructor.
+     *
+     * @param RamRoleArnCredential $arnCredential
+     */
+    public function __construct(RamRoleArnCredential $arnCredential)
+    {
+        parent::__construct();
+        $this->signature                           = new ShaHmac1Signature();
+        $this->credential                          = $arnCredential;
+        $this->uri                                 = $this->uri->withHost('sts.aliyuncs.com');
+        $this->options['verify']                   = false;
+        $this->options['query']['RoleArn']         = $arnCredential->getRoleArn();
+        $this->options['query']['RoleSessionName'] = $arnCredential->getRoleSessionName();
+        $this->options['query']['DurationSeconds'] = Provider::DURATION_SECONDS;
+        $this->options['query']['AccessKeyId']     = $this->credential->getOriginalAccessKeyId();
+        $this->options['query']['Version']         = '2015-04-01';
+        $this->options['query']['Action']          = 'AssumeRole';
+        $this->options['query']['RegionId']        = 'cn-hangzhou';
+        if ($arnCredential->getPolicy()) {
+            $this->options['query']['Policy'] = $arnCredential->getPolicy();
+        }
+    }
+}

+ 33 - 0
vendor/alibabacloud/credentials/src/Request/GenerateSessionAccessKey.php

@@ -0,0 +1,33 @@
+<?php
+
+namespace AlibabaCloud\Credentials\Request;
+
+use AlibabaCloud\Credentials\Providers\Provider;
+use AlibabaCloud\Credentials\RsaKeyPairCredential;
+use AlibabaCloud\Credentials\Signature\ShaHmac256WithRsaSignature;
+
+/**
+ * Use the RSA key pair to complete the authentication (supported only on Japanese site)
+ */
+class GenerateSessionAccessKey extends Request
+{
+    /**
+     * GenerateSessionAccessKey constructor.
+     *
+     * @param RsaKeyPairCredential $credential
+     */
+    public function __construct(RsaKeyPairCredential $credential)
+    {
+        parent::__construct();
+        $this->signature                           = new ShaHmac256WithRsaSignature();
+        $this->credential                          = $credential;
+        $this->uri                                 = $this->uri->withHost('sts.ap-northeast-1.aliyuncs.com');
+        $this->options['verify']                   = false;
+        $this->options['query']['Version']         = '2015-04-01';
+        $this->options['query']['Action']          = 'GenerateSessionAccessKey';
+        $this->options['query']['RegionId']        = 'cn-hangzhou';
+        $this->options['query']['AccessKeyId']     = $credential->getPublicKeyId();
+        $this->options['query']['PublicKeyId']     = $credential->getPublicKeyId();
+        $this->options['query']['DurationSeconds'] = Provider::DURATION_SECONDS;
+    }
+}

+ 155 - 0
vendor/alibabacloud/credentials/src/Request/Request.php

@@ -0,0 +1,155 @@
+<?php
+
+namespace AlibabaCloud\Credentials\Request;
+
+use AlibabaCloud\Credentials\Credentials;
+use AlibabaCloud\Credentials\EcsRamRoleCredential;
+use AlibabaCloud\Credentials\Helper;
+use AlibabaCloud\Credentials\RamRoleArnCredential;
+use AlibabaCloud\Credentials\Signature\ShaHmac1Signature;
+use AlibabaCloud\Credentials\Signature\ShaHmac256WithRsaSignature;
+use Exception;
+use GuzzleHttp\Client;
+use GuzzleHttp\HandlerStack;
+use GuzzleHttp\Middleware;
+use GuzzleHttp\Psr7\Uri;
+use AlibabaCloud\Tea\Response;
+use Psr\Http\Message\ResponseInterface;
+
+/**
+ * RESTful RPC Request.
+ */
+class Request
+{
+
+    /**
+     * Request Connect Timeout
+     */
+    const CONNECT_TIMEOUT = 5;
+
+    /**
+     * Request Timeout
+     */
+    const TIMEOUT = 10;
+
+    /**
+     * @var array
+     */
+    private static $config = [];
+
+    /**
+     * @var array
+     */
+    public $options = [];
+
+    /**
+     * @var Uri
+     */
+    public $uri;
+
+    /**
+     * @var EcsRamRoleCredential|RamRoleArnCredential
+     */
+    protected $credential;
+
+    /**
+     * @var ShaHmac256WithRsaSignature|ShaHmac1Signature
+     */
+    protected $signature;
+
+    /**
+     * Request constructor.
+     */
+    public function __construct()
+    {
+        $this->uri                        = (new Uri())->withScheme('https');
+        $this->options['http_errors']     = false;
+        $this->options['connect_timeout'] = self::CONNECT_TIMEOUT;
+        $this->options['timeout']         = self::TIMEOUT;
+
+        // Turn on debug mode based on environment variable.
+        if (strtolower(Helper::env('DEBUG')) === 'sdk') {
+            $this->options['debug'] = true;
+        }
+    }
+
+    /**
+     * @return ResponseInterface
+     * @throws Exception
+     */
+    public function request()
+    {
+        $this->options['query']['Format']           = 'JSON';
+        $this->options['query']['SignatureMethod']  = $this->signature->getMethod();
+        $this->options['query']['SignatureVersion'] = $this->signature->getVersion();
+        $this->options['query']['SignatureNonce']   = self::uuid(json_encode($this->options['query']));
+        $this->options['query']['Timestamp']        = gmdate('Y-m-d\TH:i:s\Z');
+        $this->options['query']['Signature']        = $this->signature->sign(
+            self::signString('GET', $this->options['query']),
+            $this->credential->getOriginalAccessKeySecret() . '&'
+        );
+        return self::createClient()->request('GET', (string)$this->uri, $this->options);
+    }
+
+    /**
+     * @param string $salt
+     *
+     * @return string
+     */
+    public static function uuid($salt)
+    {
+        return md5($salt . uniqid(md5(microtime(true)), true));
+    }
+
+    /**
+     * @param string $method
+     * @param array  $parameters
+     *
+     * @return string
+     */
+    public static function signString($method, array $parameters)
+    {
+        ksort($parameters);
+        $canonicalized = '';
+        foreach ($parameters as $key => $value) {
+            $canonicalized .= '&' . self::percentEncode($key) . '=' . self::percentEncode($value);
+        }
+
+        return $method . '&%2F&' . self::percentEncode(substr($canonicalized, 1));
+    }
+
+    /**
+     * @param string $string
+     *
+     * @return null|string|string[]
+     */
+    private static function percentEncode($string)
+    {
+        $result = rawurlencode($string);
+        $result = str_replace(['+', '*'], ['%20', '%2A'], $result);
+        $result = preg_replace('/%7E/', '~', $result);
+
+        return $result;
+    }
+
+    /**
+     * @return Client
+     * @throws Exception
+     */
+    public static function createClient()
+    {
+        if (Credentials::hasMock()) {
+            $stack = HandlerStack::create(Credentials::getMock());
+        } else {
+            $stack = HandlerStack::create();
+        }
+
+        $stack->push(Middleware::mapResponse(static function (ResponseInterface $response) {
+            return new Response($response);
+        }));
+
+        self::$config['handler'] = $stack;
+
+        return new Client(self::$config);
+    }
+}

+ 158 - 0
vendor/alibabacloud/credentials/src/RsaKeyPairCredential.php

@@ -0,0 +1,158 @@
+<?php
+
+namespace AlibabaCloud\Credentials;
+
+use AlibabaCloud\Credentials\Providers\RsaKeyPairProvider;
+use AlibabaCloud\Credentials\Signature\ShaHmac1Signature;
+use Exception;
+use GuzzleHttp\Exception\GuzzleException;
+use InvalidArgumentException;
+
+/**
+ * Use the RSA key pair to complete the authentication (supported only on Japanese site)
+ */
+class RsaKeyPairCredential implements CredentialsInterface
+{
+
+    /**
+     * @var string
+     */
+    private $publicKeyId;
+
+    /**
+     * @var string
+     */
+    private $privateKey;
+
+    /**
+     * @var array
+     */
+    private $config;
+
+    /**
+     * RsaKeyPairCredential constructor.
+     *
+     * @param string $public_key_id
+     * @param string $private_key_file
+     * @param array  $config
+     */
+    public function __construct($public_key_id, $private_key_file, array $config = [])
+    {
+        Filter::publicKeyId($public_key_id);
+        Filter::privateKeyFile($private_key_file);
+
+        $this->publicKeyId = $public_key_id;
+        $this->config      = $config;
+        try {
+            $this->privateKey = file_get_contents($private_key_file);
+        } catch (Exception $exception) {
+            throw new InvalidArgumentException($exception->getMessage());
+        }
+    }
+
+    /**
+     * @return array
+     */
+    public function getConfig()
+    {
+        return $this->config;
+    }
+
+    /**
+     * @return string
+     */
+    public function getOriginalAccessKeyId()
+    {
+        return $this->getPublicKeyId();
+    }
+
+    /**
+     * @return string
+     */
+    public function getPublicKeyId()
+    {
+        return $this->publicKeyId;
+    }
+
+    /**
+     * @return string
+     */
+    public function getOriginalAccessKeySecret()
+    {
+        return $this->getPrivateKey();
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getPrivateKey()
+    {
+        return $this->privateKey;
+    }
+
+    /**
+     * @return string
+     */
+    public function __toString()
+    {
+        return "publicKeyId#$this->publicKeyId";
+    }
+
+    /**
+     * @return ShaHmac1Signature
+     */
+    public function getSignature()
+    {
+        return new ShaHmac1Signature();
+    }
+
+    /**
+     * @return string
+     * @throws Exception
+     * @throws GuzzleException
+     */
+    public function getAccessKeyId()
+    {
+        return $this->getSessionCredential()->getAccessKeyId();
+    }
+
+    /**
+     * @return StsCredential
+     * @throws Exception
+     * @throws GuzzleException
+     */
+    protected function getSessionCredential()
+    {
+        return (new RsaKeyPairProvider($this))->get();
+    }
+
+    /**
+     * @return string
+     * @throws Exception
+     * @throws GuzzleException
+     */
+    public function getAccessKeySecret()
+    {
+        return $this->getSessionCredential()->getAccessKeySecret();
+    }
+
+    /**
+     * @return string
+     * @throws Exception
+     * @throws GuzzleException
+     */
+    public function getSecurityToken()
+    {
+        return $this->getSessionCredential()->getSecurityToken();
+    }
+
+    /**
+     * @return int
+     * @throws Exception
+     * @throws GuzzleException
+     */
+    public function getExpiration()
+    {
+        return $this->getSessionCredential()->getExpiration();
+    }
+}

+ 47 - 0
vendor/alibabacloud/credentials/src/Signature/BearerTokenSignature.php

@@ -0,0 +1,47 @@
+<?php
+
+namespace AlibabaCloud\Credentials\Signature;
+
+/**
+ * Class BearerTokenSignature
+ *
+ * @package AlibabaCloud\Credentials\Signature
+ */
+class BearerTokenSignature implements SignatureInterface
+{
+
+    /**
+     * @return string
+     */
+    public function getMethod()
+    {
+        return '';
+    }
+
+    /**
+     * @return string
+     */
+    public function getType()
+    {
+        return 'BEARERTOKEN';
+    }
+
+    /**
+     * @return string
+     */
+    public function getVersion()
+    {
+        return '1.0';
+    }
+
+    /**
+     * @param string $string
+     * @param string $accessKeySecret
+     *
+     * @return string
+     */
+    public function sign($string, $accessKeySecret)
+    {
+        return '';
+    }
+}

+ 47 - 0
vendor/alibabacloud/credentials/src/Signature/ShaHmac1Signature.php

@@ -0,0 +1,47 @@
+<?php
+
+namespace AlibabaCloud\Credentials\Signature;
+
+/**
+ * Class ShaHmac1Signature
+ *
+ * @package AlibabaCloud\Credentials\Signature
+ */
+class ShaHmac1Signature implements SignatureInterface
+{
+
+    /**
+     * @return string
+     */
+    public function getMethod()
+    {
+        return 'HMAC-SHA1';
+    }
+
+    /**
+     * @return string
+     */
+    public function getType()
+    {
+        return '';
+    }
+
+    /**
+     * @return string
+     */
+    public function getVersion()
+    {
+        return '1.0';
+    }
+
+    /**
+     * @param string $string
+     * @param string $accessKeySecret
+     *
+     * @return string
+     */
+    public function sign($string, $accessKeySecret)
+    {
+        return base64_encode(hash_hmac('sha1', $string, $accessKeySecret, true));
+    }
+}

+ 47 - 0
vendor/alibabacloud/credentials/src/Signature/ShaHmac256Signature.php

@@ -0,0 +1,47 @@
+<?php
+
+namespace AlibabaCloud\Credentials\Signature;
+
+/**
+ * Class ShaHmac256Signature
+ *
+ * @package AlibabaCloud\Credentials\Signature
+ */
+class ShaHmac256Signature implements SignatureInterface
+{
+
+    /**
+     * @return string
+     */
+    public function getMethod()
+    {
+        return 'HMAC-SHA256';
+    }
+
+    /**
+     * @return string
+     */
+    public function getType()
+    {
+        return '';
+    }
+
+    /**
+     * @return string
+     */
+    public function getVersion()
+    {
+        return '1.0';
+    }
+
+    /**
+     * @param string $string
+     * @param string $accessKeySecret
+     *
+     * @return string
+     */
+    public function sign($string, $accessKeySecret)
+    {
+        return base64_encode(hash_hmac('sha256', $string, $accessKeySecret, true));
+    }
+}

+ 64 - 0
vendor/alibabacloud/credentials/src/Signature/ShaHmac256WithRsaSignature.php

@@ -0,0 +1,64 @@
+<?php
+
+namespace AlibabaCloud\Credentials\Signature;
+
+use Exception;
+use InvalidArgumentException;
+
+/**
+ * Class ShaHmac256WithRsaSignature
+ *
+ * @package AlibabaCloud\Credentials\Signature
+ */
+class ShaHmac256WithRsaSignature implements SignatureInterface
+{
+
+    /**
+     * @return string
+     */
+    public function getMethod()
+    {
+        return 'SHA256withRSA';
+    }
+
+    /**
+     * @return string
+     */
+    public function getType()
+    {
+        return 'PRIVATEKEY';
+    }
+
+    /**
+     * @return string
+     */
+    public function getVersion()
+    {
+        return '1.0';
+    }
+
+    /**
+     * @param string $string
+     * @param string $privateKey
+     *
+     * @return string
+     */
+    public function sign($string, $privateKey)
+    {
+        $binarySignature = '';
+        try {
+            openssl_sign(
+                $string,
+                $binarySignature,
+                $privateKey,
+                \OPENSSL_ALGO_SHA256
+            );
+        } catch (Exception $exception) {
+            throw  new InvalidArgumentException(
+                $exception->getMessage()
+            );
+        }
+
+        return base64_encode($binarySignature);
+    }
+}

+ 34 - 0
vendor/alibabacloud/credentials/src/Signature/SignatureInterface.php

@@ -0,0 +1,34 @@
+<?php
+
+namespace AlibabaCloud\Credentials\Signature;
+
+/**
+ * Interface SignatureInterface
+ *
+ * @package AlibabaCloud\Credentials\Signature
+ */
+interface SignatureInterface
+{
+    /**
+     * @return string
+     */
+    public function getMethod();
+
+    /**
+     * @return string
+     */
+    public function getVersion();
+
+    /**
+     * @param string $string
+     * @param string $accessKeySecret
+     *
+     * @return string
+     */
+    public function sign($string, $accessKeySecret);
+
+    /**
+     * @return string
+     */
+    public function getType();
+}

+ 98 - 0
vendor/alibabacloud/credentials/src/StsCredential.php

@@ -0,0 +1,98 @@
+<?php
+
+namespace AlibabaCloud\Credentials;
+
+use AlibabaCloud\Credentials\Signature\ShaHmac1Signature;
+
+/**
+ * Use the STS Token to complete the authentication.
+ */
+class StsCredential implements CredentialsInterface
+{
+
+    /**
+     * @var string
+     */
+    private $accessKeyId;
+
+    /**
+     * @var string
+     */
+    private $accessKeySecret;
+
+    /**
+     * @var string
+     */
+    private $securityToken;
+
+    /**
+     * @var int
+     */
+    private $expiration;
+
+    /**
+     * StsCredential constructor.
+     *
+     * @param string $access_key_id     Access key ID
+     * @param string $access_key_secret Access Key Secret
+     * @param int    $expiration
+     * @param string $security_token    Security Token
+     */
+    public function __construct($access_key_id, $access_key_secret, $expiration, $security_token = '')
+    {
+        Filter::accessKey($access_key_id, $access_key_secret);
+        Filter::expiration($expiration);
+        $this->accessKeyId     = $access_key_id;
+        $this->accessKeySecret = $access_key_secret;
+        $this->expiration      = $expiration;
+        $this->securityToken   = $security_token;
+    }
+
+    /**
+     * @return int
+     */
+    public function getExpiration()
+    {
+        return $this->expiration;
+    }
+
+    /**
+     * @return string
+     */
+    public function getAccessKeyId()
+    {
+        return $this->accessKeyId;
+    }
+
+    /**
+     * @return string
+     */
+    public function getAccessKeySecret()
+    {
+        return $this->accessKeySecret;
+    }
+
+    /**
+     * @return string
+     */
+    public function getSecurityToken()
+    {
+        return $this->securityToken;
+    }
+
+    /**
+     * @return string
+     */
+    public function __toString()
+    {
+        return "$this->accessKeyId#$this->accessKeySecret#$this->securityToken";
+    }
+
+    /**
+     * @return ShaHmac1Signature
+     */
+    public function getSignature()
+    {
+        return new ShaHmac1Signature();
+    }
+}

+ 15 - 0
vendor/alibabacloud/darabonba-openapi/.gitignore

@@ -0,0 +1,15 @@
+composer.phar
+/vendor/
+
+# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
+# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
+composer.lock
+
+.vscode/
+.idea
+.DS_Store
+
+cache/
+*.cache
+runtime/
+.php_cs.cache

+ 65 - 0
vendor/alibabacloud/darabonba-openapi/.php_cs.dist

@@ -0,0 +1,65 @@
+<?php
+/*
+ * This document has been generated with
+ * https://mlocati.github.io/php-cs-fixer-configurator/#version:2.15|configurator
+ * you can change this configuration by importing this file.
+ */
+
+return PhpCsFixer\Config::create()
+    ->setRiskyAllowed(true)
+    ->setIndent('    ')
+    ->setRules([
+        '@PSR2'                                       => true,
+        '@PhpCsFixer'                                 => true,
+        '@Symfony:risky'                              => true,
+        'concat_space'                                => ['spacing' => 'one'],
+        'array_syntax'                                => ['syntax' => 'short'],
+        'array_indentation'                           => true,
+        'combine_consecutive_unsets'                  => true,
+        'method_separation'                           => true,
+        'single_quote'                                => true,
+        'declare_equal_normalize'                     => true,
+        'function_typehint_space'                     => true,
+        'hash_to_slash_comment'                       => true,
+        'include'                                     => true,
+        'lowercase_cast'                              => true,
+        'no_multiline_whitespace_before_semicolons'   => true,
+        'no_leading_import_slash'                     => true,
+        'no_multiline_whitespace_around_double_arrow' => true,
+        'no_spaces_around_offset'                     => true,
+        'no_unneeded_control_parentheses'             => true,
+        'no_unused_imports'                           => true,
+        'no_whitespace_before_comma_in_array'         => true,
+        'no_whitespace_in_blank_line'                 => true,
+        'object_operator_without_whitespace'          => true,
+        'single_blank_line_before_namespace'          => true,
+        'single_class_element_per_statement'          => true,
+        'space_after_semicolon'                       => true,
+        'standardize_not_equals'                      => true,
+        'ternary_operator_spaces'                     => true,
+        'trailing_comma_in_multiline_array'           => true,
+        'trim_array_spaces'                           => true,
+        'unary_operator_spaces'                       => true,
+        'whitespace_after_comma_in_array'             => true,
+        'no_extra_consecutive_blank_lines'            => [
+            'curly_brace_block',
+            'extra',
+            'parenthesis_brace_block',
+            'square_brace_block',
+            'throw',
+            'use',
+        ],
+        'binary_operator_spaces'       => [
+            'align_double_arrow' => true,
+            'align_equals'       => true,
+        ],
+        'braces'                                    => [
+            'allow_single_line_closure' => true,
+        ],
+    ])
+    ->setFinder(
+        PhpCsFixer\Finder::create()
+            ->exclude('vendor')
+            ->exclude('tests')
+            ->in(__DIR__)
+  );

+ 31 - 0
vendor/alibabacloud/darabonba-openapi/README-CN.md

@@ -0,0 +1,31 @@
+[English](README.md) | 简体中文
+
+![](https://aliyunsdk-pages.alicdn.com/icons/AlibabaCloud.svg)
+
+## Alibaba Cloud OpenApi Client
+
+## 安装
+
+### Composer
+
+```bash
+composer require alibabacloud/darabonba-openapi
+```
+
+## 问题
+
+[提交 Issue](https://github.com/aliyun/darabonba-openapi/issues/new),不符合指南的问题可能会立即关闭。
+
+## 发行说明
+
+每个版本的详细更改记录在[发行说明](./ChangeLog.txt)中。
+
+## 相关
+
+* [最新源码](https://github.com/aliyun/darabonba-openapi)
+
+## 许可证
+
+[Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0)
+
+Copyright (c) 2009-present, Alibaba Cloud All rights reserved.

+ 31 - 0
vendor/alibabacloud/darabonba-openapi/README.md

@@ -0,0 +1,31 @@
+English | [简体中文](README-CN.md)
+
+![](https://aliyunsdk-pages.alicdn.com/icons/AlibabaCloud.svg)
+
+## Alibaba Cloud OpenApi Client
+
+## Installation
+
+### Composer
+
+```bash
+composer require alibabacloud/darabonba-openapi
+```
+
+## Issues
+
+[Opening an Issue](https://github.com/aliyun/darabonba-openapi/issues/new), Issues not conforming to the guidelines may be closed immediately.
+
+## Changelog
+
+Detailed changes for each release are documented in the [release notes](./ChangeLog.txt).
+
+## References
+
+* [Latest Release](https://github.com/aliyun/darabonba-openapi)
+
+## License
+
+[Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0)
+
+Copyright (c) 2009-present, Alibaba Cloud All rights reserved.

+ 15 - 0
vendor/alibabacloud/darabonba-openapi/autoload.php

@@ -0,0 +1,15 @@
+<?php
+
+if (file_exists(__DIR__ . \DIRECTORY_SEPARATOR . 'vendor' . \DIRECTORY_SEPARATOR . 'autoload.php')) {
+    require_once __DIR__ . \DIRECTORY_SEPARATOR . 'vendor' . \DIRECTORY_SEPARATOR . 'autoload.php';
+}
+
+spl_autoload_register(function ($class) {
+    $name = str_replace('Darabonba\\OpenApi\\', '', $class);
+    $file = __DIR__ . \DIRECTORY_SEPARATOR . 'src' . \DIRECTORY_SEPARATOR . str_replace('\\', \DIRECTORY_SEPARATOR, $name) . '.php';
+    if (file_exists($file)) {
+        require_once $file;
+        return true;
+    }
+    return false;
+});

+ 34 - 0
vendor/alibabacloud/darabonba-openapi/composer.json

@@ -0,0 +1,34 @@
+{
+  "name": "alibabacloud/darabonba-openapi",
+  "description": "Alibaba Cloud OpenApi Client",
+  "type": "library",
+  "license": "Apache-2.0",
+  "authors": [
+    {
+      "name": "Alibaba Cloud SDK",
+      "email": "sdk-team@alibabacloud.com"
+    }
+  ],
+  "require": {
+    "php": ">5.5",
+    "alibabacloud/tea-utils": "^0.2.0",
+    "alibabacloud/credentials": "^1.1",
+    "alibabacloud/openapi-util": "^0.1.10",
+    "alibabacloud/gateway-spi": "^1",
+    "alibabacloud/tea-xml": "^0.2"
+  },
+  "autoload": {
+    "psr-4": {
+      "Darabonba\\OpenApi\\": "src"
+    }
+  },
+  "scripts": {
+    "fixer": "php-cs-fixer fix ./"
+  },
+  "config": {
+    "sort-packages": true,
+    "preferred-install": "dist",
+    "optimize-autoloader": true
+  },
+  "prefer-stable": true
+}

+ 433 - 0
vendor/alibabacloud/darabonba-openapi/src/Models/Config.php

@@ -0,0 +1,433 @@
+<?php
+
+// This file is auto-generated, don't edit it. Thanks.
+
+namespace Darabonba\OpenApi\Models;
+
+use AlibabaCloud\Credentials\Credential;
+use AlibabaCloud\Tea\Model;
+
+/**
+ * Model for initing client.
+ */
+class Config extends Model
+{
+    protected $_default = [
+        'accessKeyId' => '',
+        'accessKeySecret' => '',
+        'securityToken' => '',
+        'protocol' => 'http',
+        'method' => '',
+        'regionId' => '',
+        'readTimeout' => '',
+        'connectTimeout' => '',
+        'httpProxy' => '',
+        'httpsProxy' => '',
+        'credential' => '',
+        'endpoint' => '',
+        'noProxy' => '',
+        'maxIdleConns' => '',
+        'network' => '',
+        'userAgent' => '',
+        'suffix' => '',
+        'socks5Proxy' => '',
+        'socks5NetWork' => '',
+        'endpointType' => '',
+        'openPlatformEndpoint' => '',
+        'type' => '',
+        'signatureVersion' => '',
+        'signatureAlgorithm' => '',
+    ];
+
+    public function validate()
+    {
+    }
+
+    public function toMap()
+    {
+        $res = [];
+        if (null !== $this->accessKeyId) {
+            $res['accessKeyId'] = $this->accessKeyId;
+        }
+        if (null !== $this->accessKeySecret) {
+            $res['accessKeySecret'] = $this->accessKeySecret;
+        }
+        if (null !== $this->securityToken) {
+            $res['securityToken'] = $this->securityToken;
+        }
+        if (null !== $this->protocol) {
+            $res['protocol'] = $this->protocol;
+        }
+        if (null !== $this->method) {
+            $res['method'] = $this->method;
+        }
+        if (null !== $this->regionId) {
+            $res['regionId'] = $this->regionId;
+        }
+        if (null !== $this->readTimeout) {
+            $res['readTimeout'] = $this->readTimeout;
+        }
+        if (null !== $this->connectTimeout) {
+            $res['connectTimeout'] = $this->connectTimeout;
+        }
+        if (null !== $this->httpProxy) {
+            $res['httpProxy'] = $this->httpProxy;
+        }
+        if (null !== $this->httpsProxy) {
+            $res['httpsProxy'] = $this->httpsProxy;
+        }
+        if (null !== $this->credential) {
+            $res['credential'] = null !== $this->credential ? $this->credential->toMap() : null;
+        }
+        if (null !== $this->endpoint) {
+            $res['endpoint'] = $this->endpoint;
+        }
+        if (null !== $this->noProxy) {
+            $res['noProxy'] = $this->noProxy;
+        }
+        if (null !== $this->maxIdleConns) {
+            $res['maxIdleConns'] = $this->maxIdleConns;
+        }
+        if (null !== $this->network) {
+            $res['network'] = $this->network;
+        }
+        if (null !== $this->userAgent) {
+            $res['userAgent'] = $this->userAgent;
+        }
+        if (null !== $this->suffix) {
+            $res['suffix'] = $this->suffix;
+        }
+        if (null !== $this->socks5Proxy) {
+            $res['socks5Proxy'] = $this->socks5Proxy;
+        }
+        if (null !== $this->socks5NetWork) {
+            $res['socks5NetWork'] = $this->socks5NetWork;
+        }
+        if (null !== $this->endpointType) {
+            $res['endpointType'] = $this->endpointType;
+        }
+        if (null !== $this->openPlatformEndpoint) {
+            $res['openPlatformEndpoint'] = $this->openPlatformEndpoint;
+        }
+        if (null !== $this->type) {
+            $res['type'] = $this->type;
+        }
+        if (null !== $this->signatureVersion) {
+            $res['signatureVersion'] = $this->signatureVersion;
+        }
+        if (null !== $this->signatureAlgorithm) {
+            $res['signatureAlgorithm'] = $this->signatureAlgorithm;
+        }
+        if (null !== $this->globalParameters) {
+            $res['globalParameters'] = null !== $this->globalParameters ? $this->globalParameters->toMap() : null;
+        }
+
+        return $res;
+    }
+
+    /**
+     * @param array $map
+     *
+     * @return Config
+     */
+    public static function fromMap($map = [])
+    {
+        $model = new self();
+        if (isset($map['accessKeyId'])) {
+            $model->accessKeyId = $map['accessKeyId'];
+        }
+        if (isset($map['accessKeySecret'])) {
+            $model->accessKeySecret = $map['accessKeySecret'];
+        }
+        if (isset($map['securityToken'])) {
+            $model->securityToken = $map['securityToken'];
+        }
+        if (isset($map['protocol'])) {
+            $model->protocol = $map['protocol'];
+        }
+        if (isset($map['method'])) {
+            $model->method = $map['method'];
+        }
+        if (isset($map['regionId'])) {
+            $model->regionId = $map['regionId'];
+        }
+        if (isset($map['readTimeout'])) {
+            $model->readTimeout = $map['readTimeout'];
+        }
+        if (isset($map['connectTimeout'])) {
+            $model->connectTimeout = $map['connectTimeout'];
+        }
+        if (isset($map['httpProxy'])) {
+            $model->httpProxy = $map['httpProxy'];
+        }
+        if (isset($map['httpsProxy'])) {
+            $model->httpsProxy = $map['httpsProxy'];
+        }
+        if (isset($map['credential'])) {
+            $model->credential = Credential::fromMap($map['credential']);
+        }
+        if (isset($map['endpoint'])) {
+            $model->endpoint = $map['endpoint'];
+        }
+        if (isset($map['noProxy'])) {
+            $model->noProxy = $map['noProxy'];
+        }
+        if (isset($map['maxIdleConns'])) {
+            $model->maxIdleConns = $map['maxIdleConns'];
+        }
+        if (isset($map['network'])) {
+            $model->network = $map['network'];
+        }
+        if (isset($map['userAgent'])) {
+            $model->userAgent = $map['userAgent'];
+        }
+        if (isset($map['suffix'])) {
+            $model->suffix = $map['suffix'];
+        }
+        if (isset($map['socks5Proxy'])) {
+            $model->socks5Proxy = $map['socks5Proxy'];
+        }
+        if (isset($map['socks5NetWork'])) {
+            $model->socks5NetWork = $map['socks5NetWork'];
+        }
+        if (isset($map['endpointType'])) {
+            $model->endpointType = $map['endpointType'];
+        }
+        if (isset($map['openPlatformEndpoint'])) {
+            $model->openPlatformEndpoint = $map['openPlatformEndpoint'];
+        }
+        if (isset($map['type'])) {
+            $model->type = $map['type'];
+        }
+        if (isset($map['signatureVersion'])) {
+            $model->signatureVersion = $map['signatureVersion'];
+        }
+        if (isset($map['signatureAlgorithm'])) {
+            $model->signatureAlgorithm = $map['signatureAlgorithm'];
+        }
+        if (isset($map['globalParameters'])) {
+            $model->globalParameters = GlobalParameters::fromMap($map['globalParameters']);
+        }
+
+        return $model;
+    }
+
+    /**
+     * @description accesskey id
+     *
+     * @var string
+     */
+    public $accessKeyId;
+
+    /**
+     * @description accesskey secret
+     *
+     * @var string
+     */
+    public $accessKeySecret;
+
+    /**
+     * @description security token
+     *
+     * @example a.txt
+     *
+     * @var string
+     */
+    public $securityToken;
+
+    /**
+     * @description http protocol
+     *
+     * @example http
+     *
+     * @var string
+     */
+    public $protocol;
+
+    /**
+     * @description http method
+     *
+     * @example GET
+     *
+     * @var string
+     */
+    public $method;
+
+    /**
+     * @description region id
+     *
+     * @example cn-hangzhou
+     *
+     * @var string
+     */
+    public $regionId;
+
+    /**
+     * @description read timeout
+     *
+     * @example 10
+     *
+     * @var int
+     */
+    public $readTimeout;
+
+    /**
+     * @description connect timeout
+     *
+     * @example 10
+     *
+     * @var int
+     */
+    public $connectTimeout;
+
+    /**
+     * @description http proxy
+     *
+     * @example http://localhost
+     *
+     * @var string
+     */
+    public $httpProxy;
+
+    /**
+     * @description https proxy
+     *
+     * @example https://localhost
+     *
+     * @var string
+     */
+    public $httpsProxy;
+
+    /**
+     * @description credential
+     *
+     * @example
+     *
+     * @var Credential
+     */
+    public $credential;
+
+    /**
+     * @description endpoint
+     *
+     * @example cs.aliyuncs.com
+     *
+     * @var string
+     */
+    public $endpoint;
+
+    /**
+     * @description proxy white list
+     *
+     * @example http://localhost
+     *
+     * @var string
+     */
+    public $noProxy;
+
+    /**
+     * @description max idle conns
+     *
+     * @example 3
+     *
+     * @var int
+     */
+    public $maxIdleConns;
+
+    /**
+     * @description network for endpoint
+     *
+     * @example public
+     *
+     * @var string
+     */
+    public $network;
+
+    /**
+     * @description user agent
+     *
+     * @example Alibabacloud/1
+     *
+     * @var string
+     */
+    public $userAgent;
+
+    /**
+     * @description suffix for endpoint
+     *
+     * @example aliyun
+     *
+     * @var string
+     */
+    public $suffix;
+
+    /**
+     * @description socks5 proxy
+     *
+     * @var string
+     */
+    public $socks5Proxy;
+
+    /**
+     * @description socks5 network
+     *
+     * @example TCP
+     *
+     * @var string
+     */
+    public $socks5NetWork;
+
+    /**
+     * @description endpoint type
+     *
+     * @example internal
+     *
+     * @var string
+     */
+    public $endpointType;
+
+    /**
+     * @description OpenPlatform endpoint
+     *
+     * @example openplatform.aliyuncs.com
+     *
+     * @var string
+     */
+    public $openPlatformEndpoint;
+
+    /**
+     * @description credential type
+     *
+     * @example access_key
+     *
+     * @deprecated
+     *
+     * @var string
+     */
+    public $type;
+
+    /**
+     * @description Signature Version
+     *
+     * @example v1
+     *
+     * @var string
+     */
+    public $signatureVersion;
+
+    /**
+     * @description Signature Algorithm
+     *
+     * @example ACS3-HMAC-SHA256
+     *
+     * @var string
+     */
+    public $signatureAlgorithm;
+
+    /**
+     * @description Global Parameters
+     *
+     * @var GlobalParameters
+     */
+    public $globalParameters;
+}

+ 49 - 0
vendor/alibabacloud/darabonba-openapi/src/Models/GlobalParameters.php

@@ -0,0 +1,49 @@
+<?php
+
+// This file is auto-generated, don't edit it. Thanks.
+
+namespace Darabonba\OpenApi\Models;
+
+use AlibabaCloud\Tea\Model;
+
+class GlobalParameters extends Model
+{
+    public function validate()
+    {
+    }
+
+    public function toMap()
+    {
+        $res = [];
+        if (null !== $this->headers) {
+            $res['headers'] = $this->headers;
+        }
+        if (null !== $this->queries) {
+            $res['queries'] = $this->queries;
+        }
+
+        return $res;
+    }
+
+    /**
+     * @param array $map
+     *
+     * @return GlobalParameters
+     */
+    public static function fromMap($map = [])
+    {
+        $model = new self();
+        if (isset($map['headers'])) {
+            $model->headers = $map['headers'];
+        }
+        if (isset($map['queries'])) {
+            $model->queries = $map['queries'];
+        }
+
+        return $model;
+    }
+
+    public $headers;
+
+    public $queries;
+}

+ 81 - 0
vendor/alibabacloud/darabonba-openapi/src/Models/OpenApiRequest.php

@@ -0,0 +1,81 @@
+<?php
+
+// This file is auto-generated, don't edit it. Thanks.
+
+namespace Darabonba\OpenApi\Models;
+
+use AlibabaCloud\Tea\Model;
+
+class OpenApiRequest extends Model
+{
+    public function validate()
+    {
+    }
+
+    public function toMap()
+    {
+        $res = [];
+        if (null !== $this->headers) {
+            $res['headers'] = $this->headers;
+        }
+        if (null !== $this->query) {
+            $res['query'] = $this->query;
+        }
+        if (null !== $this->body) {
+            $res['body'] = $this->body;
+        }
+        if (null !== $this->stream) {
+            $res['stream'] = $this->stream;
+        }
+        if (null !== $this->hostMap) {
+            $res['hostMap'] = $this->hostMap;
+        }
+        if (null !== $this->endpointOverride) {
+            $res['endpointOverride'] = $this->endpointOverride;
+        }
+
+        return $res;
+    }
+
+    /**
+     * @param array $map
+     *
+     * @return OpenApiRequest
+     */
+    public static function fromMap($map = [])
+    {
+        $model = new self();
+        if (isset($map['headers'])) {
+            $model->headers = $map['headers'];
+        }
+        if (isset($map['query'])) {
+            $model->query = $map['query'];
+        }
+        if (isset($map['body'])) {
+            $model->body = $map['body'];
+        }
+        if (isset($map['stream'])) {
+            $model->stream = $map['stream'];
+        }
+        if (isset($map['hostMap'])) {
+            $model->hostMap = $map['hostMap'];
+        }
+        if (isset($map['endpointOverride'])) {
+            $model->endpointOverride = $map['endpointOverride'];
+        }
+
+        return $model;
+    }
+
+    public $headers;
+
+    public $query;
+
+    public $body;
+
+    public $stream;
+
+    public $hostMap;
+
+    public $endpointOverride;
+}

+ 137 - 0
vendor/alibabacloud/darabonba-openapi/src/Models/Params.php

@@ -0,0 +1,137 @@
+<?php
+
+// This file is auto-generated, don't edit it. Thanks.
+
+namespace Darabonba\OpenApi\Models;
+
+use AlibabaCloud\Tea\Model;
+
+class Params extends Model
+{
+    public function validate()
+    {
+        Model::validateRequired('action', $this->action, true);
+        Model::validateRequired('version', $this->version, true);
+        Model::validateRequired('protocol', $this->protocol, true);
+        Model::validateRequired('pathname', $this->pathname, true);
+        Model::validateRequired('method', $this->method, true);
+        Model::validateRequired('authType', $this->authType, true);
+        Model::validateRequired('bodyType', $this->bodyType, true);
+        Model::validateRequired('reqBodyType', $this->reqBodyType, true);
+    }
+
+    public function toMap()
+    {
+        $res = [];
+        if (null !== $this->action) {
+            $res['action'] = $this->action;
+        }
+        if (null !== $this->version) {
+            $res['version'] = $this->version;
+        }
+        if (null !== $this->protocol) {
+            $res['protocol'] = $this->protocol;
+        }
+        if (null !== $this->pathname) {
+            $res['pathname'] = $this->pathname;
+        }
+        if (null !== $this->method) {
+            $res['method'] = $this->method;
+        }
+        if (null !== $this->authType) {
+            $res['authType'] = $this->authType;
+        }
+        if (null !== $this->bodyType) {
+            $res['bodyType'] = $this->bodyType;
+        }
+        if (null !== $this->reqBodyType) {
+            $res['reqBodyType'] = $this->reqBodyType;
+        }
+        if (null !== $this->style) {
+            $res['style'] = $this->style;
+        }
+
+        return $res;
+    }
+
+    /**
+     * @param array $map
+     *
+     * @return Params
+     */
+    public static function fromMap($map = [])
+    {
+        $model = new self();
+        if (isset($map['action'])) {
+            $model->action = $map['action'];
+        }
+        if (isset($map['version'])) {
+            $model->version = $map['version'];
+        }
+        if (isset($map['protocol'])) {
+            $model->protocol = $map['protocol'];
+        }
+        if (isset($map['pathname'])) {
+            $model->pathname = $map['pathname'];
+        }
+        if (isset($map['method'])) {
+            $model->method = $map['method'];
+        }
+        if (isset($map['authType'])) {
+            $model->authType = $map['authType'];
+        }
+        if (isset($map['bodyType'])) {
+            $model->bodyType = $map['bodyType'];
+        }
+        if (isset($map['reqBodyType'])) {
+            $model->reqBodyType = $map['reqBodyType'];
+        }
+        if (isset($map['style'])) {
+            $model->style = $map['style'];
+        }
+
+        return $model;
+    }
+
+    /**
+     * @var string
+     */
+    public $action;
+
+    /**
+     * @var string
+     */
+    public $version;
+
+    /**
+     * @var string
+     */
+    public $protocol;
+
+    /**
+     * @var string
+     */
+    public $pathname;
+
+    /**
+     * @var string
+     */
+    public $method;
+
+    /**
+     * @var string
+     */
+    public $authType;
+
+    /**
+     * @var string
+     */
+    public $bodyType;
+
+    /**
+     * @var string
+     */
+    public $reqBodyType;
+
+    public $style;
+}

+ 1123 - 0
vendor/alibabacloud/darabonba-openapi/src/OpenApiClient.php

@@ -0,0 +1,1123 @@
+<?php
+
+// This file is auto-generated, don't edit it. Thanks.
+
+namespace Darabonba\OpenApi;
+
+use AlibabaCloud\Credentials\Credential;
+use AlibabaCloud\Credentials\Credential\Config;
+use AlibabaCloud\OpenApiUtil\OpenApiUtilClient;
+use AlibabaCloud\Tea\Exception\TeaError;
+use AlibabaCloud\Tea\Exception\TeaUnableRetryError;
+use AlibabaCloud\Tea\Request;
+use AlibabaCloud\Tea\Tea;
+use AlibabaCloud\Tea\Utils\Utils;
+use AlibabaCloud\Tea\Utils\Utils\RuntimeOptions;
+use AlibabaCloud\Tea\XML\XML;
+use Darabonba\GatewaySpi\Models\AttributeMap;
+use Darabonba\GatewaySpi\Models\InterceptorContext;
+use Darabonba\GatewaySpi\Models\InterceptorContext\configuration;
+use Darabonba\GatewaySpi\Models\InterceptorContext\response;
+use Darabonba\OpenApi\Models\OpenApiRequest;
+use Darabonba\OpenApi\Models\Params;
+use Exception;
+
+/**
+ * This is for OpenApi SDK.
+ */
+class OpenApiClient
+{
+    protected $_endpoint;
+
+    protected $_regionId;
+
+    protected $_protocol;
+
+    protected $_method;
+
+    protected $_userAgent;
+
+    protected $_endpointRule;
+
+    protected $_endpointMap;
+
+    protected $_suffix;
+
+    protected $_readTimeout;
+
+    protected $_connectTimeout;
+
+    protected $_httpProxy;
+
+    protected $_httpsProxy;
+
+    protected $_socks5Proxy;
+
+    protected $_socks5NetWork;
+
+    protected $_noProxy;
+
+    protected $_network;
+
+    protected $_productId;
+
+    protected $_maxIdleConns;
+
+    protected $_endpointType;
+
+    protected $_openPlatformEndpoint;
+
+    protected $_credential;
+
+    protected $_signatureVersion;
+
+    protected $_signatureAlgorithm;
+
+    protected $_headers;
+
+    protected $_spi;
+
+    protected $_globalParameters;
+
+    /**
+     * Init client with Config.
+     *
+     * @param config config contains the necessary information to create a client
+     */
+    public function __construct($config)
+    {
+        if (Utils::isUnset($config)) {
+            throw new TeaError(['code' => 'ParameterMissing', 'message' => "'config' can not be unset"]);
+        }
+        if (!Utils::empty_($config->accessKeyId) && !Utils::empty_($config->accessKeySecret)) {
+            if (!Utils::empty_($config->securityToken)) {
+                $config->type = 'sts';
+            } else {
+                $config->type = 'access_key';
+            }
+            $credentialConfig = new Config([
+                'accessKeyId' => $config->accessKeyId,
+                'type' => $config->type,
+                'accessKeySecret' => $config->accessKeySecret,
+                'securityToken' => $config->securityToken,
+            ]);
+            $this->_credential = new Credential($credentialConfig);
+        } elseif (!Utils::isUnset($config->credential)) {
+            $this->_credential = $config->credential;
+        }
+        $this->_endpoint = $config->endpoint;
+        $this->_endpointType = $config->endpointType;
+        $this->_network = $config->network;
+        $this->_suffix = $config->suffix;
+        $this->_protocol = $config->protocol;
+        $this->_method = $config->method;
+        $this->_regionId = $config->regionId;
+        $this->_userAgent = $config->userAgent;
+        $this->_readTimeout = $config->readTimeout;
+        $this->_connectTimeout = $config->connectTimeout;
+        $this->_httpProxy = $config->httpProxy;
+        $this->_httpsProxy = $config->httpsProxy;
+        $this->_noProxy = $config->noProxy;
+        $this->_socks5Proxy = $config->socks5Proxy;
+        $this->_socks5NetWork = $config->socks5NetWork;
+        $this->_maxIdleConns = $config->maxIdleConns;
+        $this->_signatureVersion = $config->signatureVersion;
+        $this->_signatureAlgorithm = $config->signatureAlgorithm;
+        $this->_globalParameters = $config->globalParameters;
+    }
+
+    /**
+     * Encapsulate the request and invoke the network.
+     *
+     * @param string         $action   api name
+     * @param string         $version  product version
+     * @param string         $protocol http or https
+     * @param string         $method   e.g. GET
+     * @param string         $authType authorization type e.g. AK
+     * @param string         $bodyType response body type e.g. String
+     * @param OpenApiRequest $request  object of OpenApiRequest
+     * @param RuntimeOptions $runtime  which controls some details of call api, such as retry times
+     *
+     * @return array the response
+     *
+     * @throws TeaError
+     * @throws Exception
+     * @throws TeaUnableRetryError
+     */
+    public function doRPCRequest($action, $version, $protocol, $method, $authType, $bodyType, $request, $runtime)
+    {
+        $request->validate();
+        $runtime->validate();
+        $_runtime = [
+            'timeouted' => 'retry',
+            'readTimeout' => Utils::defaultNumber($runtime->readTimeout, $this->_readTimeout),
+            'connectTimeout' => Utils::defaultNumber($runtime->connectTimeout, $this->_connectTimeout),
+            'httpProxy' => Utils::defaultString($runtime->httpProxy, $this->_httpProxy),
+            'httpsProxy' => Utils::defaultString($runtime->httpsProxy, $this->_httpsProxy),
+            'noProxy' => Utils::defaultString($runtime->noProxy, $this->_noProxy),
+            'socks5Proxy' => Utils::defaultString($runtime->socks5Proxy, $this->_socks5Proxy),
+            'socks5NetWork' => Utils::defaultString($runtime->socks5NetWork, $this->_socks5NetWork),
+            'maxIdleConns' => Utils::defaultNumber($runtime->maxIdleConns, $this->_maxIdleConns),
+            'retry' => [
+                'retryable' => $runtime->autoretry,
+                'maxAttempts' => Utils::defaultNumber($runtime->maxAttempts, 3),
+            ],
+            'backoff' => [
+                'policy' => Utils::defaultString($runtime->backoffPolicy, 'no'),
+                'period' => Utils::defaultNumber($runtime->backoffPeriod, 1),
+            ],
+            'ignoreSSL' => $runtime->ignoreSSL,
+        ];
+        $_lastRequest = null;
+        $_lastException = null;
+        $_now = time();
+        $_retryTimes = 0;
+        while (Tea::allowRetry(@$_runtime['retry'], $_retryTimes, $_now)) {
+            if ($_retryTimes > 0) {
+                $_backoffTime = Tea::getBackoffTime(@$_runtime['backoff'], $_retryTimes);
+                if ($_backoffTime > 0) {
+                    Tea::sleep($_backoffTime);
+                }
+            }
+            $_retryTimes = $_retryTimes + 1;
+            try {
+                $_request = new Request();
+                $_request->protocol = Utils::defaultString($this->_protocol, $protocol);
+                $_request->method = $method;
+                $_request->pathname = '/';
+                $_request->query = Tea::merge([
+                    'Action' => $action,
+                    'Format' => 'json',
+                    'Version' => $version,
+                    'Timestamp' => OpenApiUtilClient::getTimestamp(),
+                    'SignatureNonce' => Utils::getNonce(),
+                ], $request->query);
+                $headers = $this->getRpcHeaders();
+                if (Utils::isUnset($headers)) {
+                    // endpoint is setted in product client
+                    $_request->headers = [
+                        'host' => $this->_endpoint,
+                        'x-acs-version' => $version,
+                        'x-acs-action' => $action,
+                        'user-agent' => $this->getUserAgent(),
+                    ];
+                } else {
+                    $_request->headers = Tea::merge([
+                        'host' => $this->_endpoint,
+                        'x-acs-version' => $version,
+                        'x-acs-action' => $action,
+                        'user-agent' => $this->getUserAgent(),
+                    ], $headers);
+                }
+                if (!Utils::isUnset($request->body)) {
+                    $m = Utils::assertAsMap($request->body);
+                    $tmp = Utils::anyifyMapValue(OpenApiUtilClient::query($m));
+                    $_request->body = Utils::toFormString($tmp);
+                    $_request->headers['content-type'] = 'application/x-www-form-urlencoded';
+                }
+                if (!Utils::equalString($authType, 'Anonymous')) {
+                    $accessKeyId = $this->getAccessKeyId();
+                    $accessKeySecret = $this->getAccessKeySecret();
+                    $securityToken = $this->getSecurityToken();
+                    if (!Utils::empty_($securityToken)) {
+                        $_request->query['SecurityToken'] = $securityToken;
+                    }
+                    $_request->query['SignatureMethod'] = 'HMAC-SHA1';
+                    $_request->query['SignatureVersion'] = '1.0';
+                    $_request->query['AccessKeyId'] = $accessKeyId;
+                    $t = null;
+                    if (!Utils::isUnset($request->body)) {
+                        $t = Utils::assertAsMap($request->body);
+                    }
+                    $signedParam = Tea::merge($_request->query, OpenApiUtilClient::query($t));
+                    $_request->query['Signature'] = OpenApiUtilClient::getRPCSignature($signedParam, $_request->method, $accessKeySecret);
+                }
+                $_lastRequest = $_request;
+                $_response = Tea::send($_request, $_runtime);
+                if (Utils::is4xx($_response->statusCode) || Utils::is5xx($_response->statusCode)) {
+                    $_res = Utils::readAsJSON($_response->body);
+                    $err = Utils::assertAsMap($_res);
+                    $requestId = self::defaultAny(@$err['RequestId'], @$err['requestId']);
+                    throw new TeaError(['code' => ''.(string) (self::defaultAny(@$err['Code'], @$err['code'])).'', 'message' => 'code: '.(string) ($_response->statusCode).', '.(string) (self::defaultAny(@$err['Message'], @$err['message'])).' request id: '.(string) ($requestId).'', 'data' => $err]);
+                }
+                if (Utils::equalString($bodyType, 'binary')) {
+                    $resp = [
+                        'body' => $_response->body,
+                        'headers' => $_response->headers,
+                    ];
+
+                    return $resp;
+                } elseif (Utils::equalString($bodyType, 'byte')) {
+                    $byt = Utils::readAsBytes($_response->body);
+
+                    return [
+                        'body' => $byt,
+                        'headers' => $_response->headers,
+                    ];
+                } elseif (Utils::equalString($bodyType, 'string')) {
+                    $str = Utils::readAsString($_response->body);
+
+                    return [
+                        'body' => $str,
+                        'headers' => $_response->headers,
+                    ];
+                } elseif (Utils::equalString($bodyType, 'json')) {
+                    $obj = Utils::readAsJSON($_response->body);
+                    $res = Utils::assertAsMap($obj);
+
+                    return [
+                        'body' => $res,
+                        'headers' => $_response->headers,
+                    ];
+                } elseif (Utils::equalString($bodyType, 'array')) {
+                    $arr = Utils::readAsJSON($_response->body);
+
+                    return [
+                        'body' => $arr,
+                        'headers' => $_response->headers,
+                    ];
+                } else {
+                    return [
+                        'headers' => $_response->headers,
+                    ];
+                }
+            } catch (Exception $e) {
+                if (!($e instanceof TeaError)) {
+                    $e = new TeaError([], $e->getMessage(), $e->getCode(), $e);
+                }
+                if (Tea::isRetryable($e)) {
+                    $_lastException = $e;
+                    continue;
+                }
+                throw $e;
+            }
+        }
+        throw new TeaUnableRetryError($_lastRequest, $_lastException);
+    }
+
+    /**
+     * Encapsulate the request and invoke the network.
+     *
+     * @param string         $action   api name
+     * @param string         $version  product version
+     * @param string         $protocol http or https
+     * @param string         $method   e.g. GET
+     * @param string         $authType authorization type e.g. AK
+     * @param string         $pathname pathname of every api
+     * @param string         $bodyType response body type e.g. String
+     * @param OpenApiRequest $request  object of OpenApiRequest
+     * @param RuntimeOptions $runtime  which controls some details of call api, such as retry times
+     *
+     * @return array the response
+     *
+     * @throws TeaError
+     * @throws Exception
+     * @throws TeaUnableRetryError
+     */
+    public function doROARequest($action, $version, $protocol, $method, $authType, $pathname, $bodyType, $request, $runtime)
+    {
+        $request->validate();
+        $runtime->validate();
+        $_runtime = [
+            'timeouted' => 'retry',
+            'readTimeout' => Utils::defaultNumber($runtime->readTimeout, $this->_readTimeout),
+            'connectTimeout' => Utils::defaultNumber($runtime->connectTimeout, $this->_connectTimeout),
+            'httpProxy' => Utils::defaultString($runtime->httpProxy, $this->_httpProxy),
+            'httpsProxy' => Utils::defaultString($runtime->httpsProxy, $this->_httpsProxy),
+            'noProxy' => Utils::defaultString($runtime->noProxy, $this->_noProxy),
+            'socks5Proxy' => Utils::defaultString($runtime->socks5Proxy, $this->_socks5Proxy),
+            'socks5NetWork' => Utils::defaultString($runtime->socks5NetWork, $this->_socks5NetWork),
+            'maxIdleConns' => Utils::defaultNumber($runtime->maxIdleConns, $this->_maxIdleConns),
+            'retry' => [
+                'retryable' => $runtime->autoretry,
+                'maxAttempts' => Utils::defaultNumber($runtime->maxAttempts, 3),
+            ],
+            'backoff' => [
+                'policy' => Utils::defaultString($runtime->backoffPolicy, 'no'),
+                'period' => Utils::defaultNumber($runtime->backoffPeriod, 1),
+            ],
+            'ignoreSSL' => $runtime->ignoreSSL,
+        ];
+        $_lastRequest = null;
+        $_lastException = null;
+        $_now = time();
+        $_retryTimes = 0;
+        while (Tea::allowRetry(@$_runtime['retry'], $_retryTimes, $_now)) {
+            if ($_retryTimes > 0) {
+                $_backoffTime = Tea::getBackoffTime(@$_runtime['backoff'], $_retryTimes);
+                if ($_backoffTime > 0) {
+                    Tea::sleep($_backoffTime);
+                }
+            }
+            $_retryTimes = $_retryTimes + 1;
+            try {
+                $_request = new Request();
+                $_request->protocol = Utils::defaultString($this->_protocol, $protocol);
+                $_request->method = $method;
+                $_request->pathname = $pathname;
+                $_request->headers = Tea::merge([
+                    'date' => Utils::getDateUTCString(),
+                    'host' => $this->_endpoint,
+                    'accept' => 'application/json',
+                    'x-acs-signature-nonce' => Utils::getNonce(),
+                    'x-acs-signature-method' => 'HMAC-SHA1',
+                    'x-acs-signature-version' => '1.0',
+                    'x-acs-version' => $version,
+                    'x-acs-action' => $action,
+                    'user-agent' => Utils::getUserAgent($this->_userAgent),
+                ], $request->headers);
+                if (!Utils::isUnset($request->body)) {
+                    $_request->body = Utils::toJSONString($request->body);
+                    $_request->headers['content-type'] = 'application/json; charset=utf-8';
+                }
+                if (!Utils::isUnset($request->query)) {
+                    $_request->query = $request->query;
+                }
+                if (!Utils::equalString($authType, 'Anonymous')) {
+                    $accessKeyId = $this->getAccessKeyId();
+                    $accessKeySecret = $this->getAccessKeySecret();
+                    $securityToken = $this->getSecurityToken();
+                    if (!Utils::empty_($securityToken)) {
+                        $_request->headers['x-acs-accesskey-id'] = $accessKeyId;
+                        $_request->headers['x-acs-security-token'] = $securityToken;
+                    }
+                    $stringToSign = OpenApiUtilClient::getStringToSign($_request);
+                    $_request->headers['authorization'] = 'acs '.$accessKeyId.':'.OpenApiUtilClient::getROASignature($stringToSign, $accessKeySecret).'';
+                }
+                $_lastRequest = $_request;
+                $_response = Tea::send($_request, $_runtime);
+                if (Utils::equalNumber($_response->statusCode, 204)) {
+                    return [
+                        'headers' => $_response->headers,
+                    ];
+                }
+                if (Utils::is4xx($_response->statusCode) || Utils::is5xx($_response->statusCode)) {
+                    $_res = Utils::readAsJSON($_response->body);
+                    $err = Utils::assertAsMap($_res);
+                    $requestId = self::defaultAny(@$err['RequestId'], @$err['requestId']);
+                    $requestId = self::defaultAny($requestId, @$err['requestid']);
+                    throw new TeaError(['code' => ''.(string) (self::defaultAny(@$err['Code'], @$err['code'])).'', 'message' => 'code: '.(string) ($_response->statusCode).', '.(string) (self::defaultAny(@$err['Message'], @$err['message'])).' request id: '.(string) ($requestId).'', 'data' => $err]);
+                }
+                if (Utils::equalString($bodyType, 'binary')) {
+                    $resp = [
+                        'body' => $_response->body,
+                        'headers' => $_response->headers,
+                    ];
+
+                    return $resp;
+                } elseif (Utils::equalString($bodyType, 'byte')) {
+                    $byt = Utils::readAsBytes($_response->body);
+
+                    return [
+                        'body' => $byt,
+                        'headers' => $_response->headers,
+                    ];
+                } elseif (Utils::equalString($bodyType, 'string')) {
+                    $str = Utils::readAsString($_response->body);
+
+                    return [
+                        'body' => $str,
+                        'headers' => $_response->headers,
+                    ];
+                } elseif (Utils::equalString($bodyType, 'json')) {
+                    $obj = Utils::readAsJSON($_response->body);
+                    $res = Utils::assertAsMap($obj);
+
+                    return [
+                        'body' => $res,
+                        'headers' => $_response->headers,
+                    ];
+                } elseif (Utils::equalString($bodyType, 'array')) {
+                    $arr = Utils::readAsJSON($_response->body);
+
+                    return [
+                        'body' => $arr,
+                        'headers' => $_response->headers,
+                    ];
+                } else {
+                    return [
+                        'headers' => $_response->headers,
+                    ];
+                }
+            } catch (Exception $e) {
+                if (!($e instanceof TeaError)) {
+                    $e = new TeaError([], $e->getMessage(), $e->getCode(), $e);
+                }
+                if (Tea::isRetryable($e)) {
+                    $_lastException = $e;
+                    continue;
+                }
+                throw $e;
+            }
+        }
+        throw new TeaUnableRetryError($_lastRequest, $_lastException);
+    }
+
+    /**
+     * Encapsulate the request and invoke the network with form body.
+     *
+     * @param string         $action   api name
+     * @param string         $version  product version
+     * @param string         $protocol http or https
+     * @param string         $method   e.g. GET
+     * @param string         $authType authorization type e.g. AK
+     * @param string         $pathname pathname of every api
+     * @param string         $bodyType response body type e.g. String
+     * @param OpenApiRequest $request  object of OpenApiRequest
+     * @param RuntimeOptions $runtime  which controls some details of call api, such as retry times
+     *
+     * @return array the response
+     *
+     * @throws TeaError
+     * @throws Exception
+     * @throws TeaUnableRetryError
+     */
+    public function doROARequestWithForm($action, $version, $protocol, $method, $authType, $pathname, $bodyType, $request, $runtime)
+    {
+        $request->validate();
+        $runtime->validate();
+        $_runtime = [
+            'timeouted' => 'retry',
+            'readTimeout' => Utils::defaultNumber($runtime->readTimeout, $this->_readTimeout),
+            'connectTimeout' => Utils::defaultNumber($runtime->connectTimeout, $this->_connectTimeout),
+            'httpProxy' => Utils::defaultString($runtime->httpProxy, $this->_httpProxy),
+            'httpsProxy' => Utils::defaultString($runtime->httpsProxy, $this->_httpsProxy),
+            'noProxy' => Utils::defaultString($runtime->noProxy, $this->_noProxy),
+            'socks5Proxy' => Utils::defaultString($runtime->socks5Proxy, $this->_socks5Proxy),
+            'socks5NetWork' => Utils::defaultString($runtime->socks5NetWork, $this->_socks5NetWork),
+            'maxIdleConns' => Utils::defaultNumber($runtime->maxIdleConns, $this->_maxIdleConns),
+            'retry' => [
+                'retryable' => $runtime->autoretry,
+                'maxAttempts' => Utils::defaultNumber($runtime->maxAttempts, 3),
+            ],
+            'backoff' => [
+                'policy' => Utils::defaultString($runtime->backoffPolicy, 'no'),
+                'period' => Utils::defaultNumber($runtime->backoffPeriod, 1),
+            ],
+            'ignoreSSL' => $runtime->ignoreSSL,
+        ];
+        $_lastRequest = null;
+        $_lastException = null;
+        $_now = time();
+        $_retryTimes = 0;
+        while (Tea::allowRetry(@$_runtime['retry'], $_retryTimes, $_now)) {
+            if ($_retryTimes > 0) {
+                $_backoffTime = Tea::getBackoffTime(@$_runtime['backoff'], $_retryTimes);
+                if ($_backoffTime > 0) {
+                    Tea::sleep($_backoffTime);
+                }
+            }
+            $_retryTimes = $_retryTimes + 1;
+            try {
+                $_request = new Request();
+                $_request->protocol = Utils::defaultString($this->_protocol, $protocol);
+                $_request->method = $method;
+                $_request->pathname = $pathname;
+                $_request->headers = Tea::merge([
+                    'date' => Utils::getDateUTCString(),
+                    'host' => $this->_endpoint,
+                    'accept' => 'application/json',
+                    'x-acs-signature-nonce' => Utils::getNonce(),
+                    'x-acs-signature-method' => 'HMAC-SHA1',
+                    'x-acs-signature-version' => '1.0',
+                    'x-acs-version' => $version,
+                    'x-acs-action' => $action,
+                    'user-agent' => Utils::getUserAgent($this->_userAgent),
+                ], $request->headers);
+                if (!Utils::isUnset($request->body)) {
+                    $m = Utils::assertAsMap($request->body);
+                    $_request->body = OpenApiUtilClient::toForm($m);
+                    $_request->headers['content-type'] = 'application/x-www-form-urlencoded';
+                }
+                if (!Utils::isUnset($request->query)) {
+                    $_request->query = $request->query;
+                }
+                if (!Utils::equalString($authType, 'Anonymous')) {
+                    $accessKeyId = $this->getAccessKeyId();
+                    $accessKeySecret = $this->getAccessKeySecret();
+                    $securityToken = $this->getSecurityToken();
+                    if (!Utils::empty_($securityToken)) {
+                        $_request->headers['x-acs-accesskey-id'] = $accessKeyId;
+                        $_request->headers['x-acs-security-token'] = $securityToken;
+                    }
+                    $stringToSign = OpenApiUtilClient::getStringToSign($_request);
+                    $_request->headers['authorization'] = 'acs '.$accessKeyId.':'.OpenApiUtilClient::getROASignature($stringToSign, $accessKeySecret).'';
+                }
+                $_lastRequest = $_request;
+                $_response = Tea::send($_request, $_runtime);
+                if (Utils::equalNumber($_response->statusCode, 204)) {
+                    return [
+                        'headers' => $_response->headers,
+                    ];
+                }
+                if (Utils::is4xx($_response->statusCode) || Utils::is5xx($_response->statusCode)) {
+                    $_res = Utils::readAsJSON($_response->body);
+                    $err = Utils::assertAsMap($_res);
+                    throw new TeaError(['code' => ''.(string) (self::defaultAny(@$err['Code'], @$err['code'])).'', 'message' => 'code: '.(string) ($_response->statusCode).', '.(string) (self::defaultAny(@$err['Message'], @$err['message'])).' request id: '.(string) (self::defaultAny(@$err['RequestId'], @$err['requestId'])).'', 'data' => $err]);
+                }
+                if (Utils::equalString($bodyType, 'binary')) {
+                    $resp = [
+                        'body' => $_response->body,
+                        'headers' => $_response->headers,
+                    ];
+
+                    return $resp;
+                } elseif (Utils::equalString($bodyType, 'byte')) {
+                    $byt = Utils::readAsBytes($_response->body);
+
+                    return [
+                        'body' => $byt,
+                        'headers' => $_response->headers,
+                    ];
+                } elseif (Utils::equalString($bodyType, 'string')) {
+                    $str = Utils::readAsString($_response->body);
+
+                    return [
+                        'body' => $str,
+                        'headers' => $_response->headers,
+                    ];
+                } elseif (Utils::equalString($bodyType, 'json')) {
+                    $obj = Utils::readAsJSON($_response->body);
+                    $res = Utils::assertAsMap($obj);
+
+                    return [
+                        'body' => $res,
+                        'headers' => $_response->headers,
+                    ];
+                } elseif (Utils::equalString($bodyType, 'array')) {
+                    $arr = Utils::readAsJSON($_response->body);
+
+                    return [
+                        'body' => $arr,
+                        'headers' => $_response->headers,
+                    ];
+                } else {
+                    return [
+                        'headers' => $_response->headers,
+                    ];
+                }
+            } catch (Exception $e) {
+                if (!($e instanceof TeaError)) {
+                    $e = new TeaError([], $e->getMessage(), $e->getCode(), $e);
+                }
+                if (Tea::isRetryable($e)) {
+                    $_lastException = $e;
+                    continue;
+                }
+                throw $e;
+            }
+        }
+        throw new TeaUnableRetryError($_lastRequest, $_lastException);
+    }
+
+    /**
+     * Encapsulate the request and invoke the network.
+     *
+     * @param Params         $params
+     * @param OpenApiRequest $request object of OpenApiRequest
+     * @param RuntimeOptions $runtime which controls some details of call api, such as retry times
+     *
+     * @return array the response
+     *
+     * @throws TeaError
+     * @throws Exception
+     * @throws TeaUnableRetryError
+     */
+    public function doRequest($params, $request, $runtime)
+    {
+        $params->validate();
+        $request->validate();
+        $runtime->validate();
+        $_runtime = [
+            'timeouted' => 'retry',
+            'readTimeout' => Utils::defaultNumber($runtime->readTimeout, $this->_readTimeout),
+            'connectTimeout' => Utils::defaultNumber($runtime->connectTimeout, $this->_connectTimeout),
+            'httpProxy' => Utils::defaultString($runtime->httpProxy, $this->_httpProxy),
+            'httpsProxy' => Utils::defaultString($runtime->httpsProxy, $this->_httpsProxy),
+            'noProxy' => Utils::defaultString($runtime->noProxy, $this->_noProxy),
+            'socks5Proxy' => Utils::defaultString($runtime->socks5Proxy, $this->_socks5Proxy),
+            'socks5NetWork' => Utils::defaultString($runtime->socks5NetWork, $this->_socks5NetWork),
+            'maxIdleConns' => Utils::defaultNumber($runtime->maxIdleConns, $this->_maxIdleConns),
+            'retry' => [
+                'retryable' => $runtime->autoretry,
+                'maxAttempts' => Utils::defaultNumber($runtime->maxAttempts, 3),
+            ],
+            'backoff' => [
+                'policy' => Utils::defaultString($runtime->backoffPolicy, 'no'),
+                'period' => Utils::defaultNumber($runtime->backoffPeriod, 1),
+            ],
+            'ignoreSSL' => $runtime->ignoreSSL,
+        ];
+        $_lastRequest = null;
+        $_lastException = null;
+        $_now = time();
+        $_retryTimes = 0;
+        while (Tea::allowRetry(@$_runtime['retry'], $_retryTimes, $_now)) {
+            if ($_retryTimes > 0) {
+                $_backoffTime = Tea::getBackoffTime(@$_runtime['backoff'], $_retryTimes);
+                if ($_backoffTime > 0) {
+                    Tea::sleep($_backoffTime);
+                }
+            }
+            $_retryTimes = $_retryTimes + 1;
+            try {
+                $_request = new Request();
+                $_request->protocol = Utils::defaultString($this->_protocol, $params->protocol);
+                $_request->method = $params->method;
+                $_request->pathname = $params->pathname;
+                $globalQueries = [];
+                $globalHeaders = [];
+                if (!Utils::isUnset($this->_globalParameters)) {
+                    $globalParams = $this->_globalParameters;
+                    if (!Utils::isUnset($globalParams->queries)) {
+                        $globalQueries = $globalParams->queries;
+                    }
+                    if (!Utils::isUnset($globalParams->headers)) {
+                        $globalHeaders = $globalParams->headers;
+                    }
+                }
+                $_request->query = Tea::merge($globalQueries, $request->query);
+                // endpoint is setted in product client
+                $_request->headers = Tea::merge([
+                    'host' => $this->_endpoint,
+                    'x-acs-version' => $params->version,
+                    'x-acs-action' => $params->action,
+                    'user-agent' => $this->getUserAgent(),
+                    'x-acs-date' => OpenApiUtilClient::getTimestamp(),
+                    'x-acs-signature-nonce' => Utils::getNonce(),
+                    'accept' => 'application/json',
+                ], $globalHeaders, $request->headers);
+                if (Utils::equalString($params->style, 'RPC')) {
+                    $headers = $this->getRpcHeaders();
+                    if (!Utils::isUnset($headers)) {
+                        $_request->headers = Tea::merge($_request->headers, $headers);
+                    }
+                }
+                $signatureAlgorithm = Utils::defaultString($this->_signatureAlgorithm, 'ACS3-HMAC-SHA256');
+                $hashedRequestPayload = OpenApiUtilClient::hexEncode(OpenApiUtilClient::hash(Utils::toBytes(''), $signatureAlgorithm));
+                if (!Utils::isUnset($request->stream)) {
+                    $tmp = Utils::readAsBytes($request->stream);
+                    $hashedRequestPayload = OpenApiUtilClient::hexEncode(OpenApiUtilClient::hash($tmp, $signatureAlgorithm));
+                    $_request->body = $tmp;
+                    $_request->headers['content-type'] = 'application/octet-stream';
+                } else {
+                    if (!Utils::isUnset($request->body)) {
+                        if (Utils::equalString($params->reqBodyType, 'json')) {
+                            $jsonObj = Utils::toJSONString($request->body);
+                            $hashedRequestPayload = OpenApiUtilClient::hexEncode(OpenApiUtilClient::hash(Utils::toBytes($jsonObj), $signatureAlgorithm));
+                            $_request->body = $jsonObj;
+                            $_request->headers['content-type'] = 'application/json; charset=utf-8';
+                        } else {
+                            $m = Utils::assertAsMap($request->body);
+                            $formObj = OpenApiUtilClient::toForm($m);
+                            $hashedRequestPayload = OpenApiUtilClient::hexEncode(OpenApiUtilClient::hash(Utils::toBytes($formObj), $signatureAlgorithm));
+                            $_request->body = $formObj;
+                            $_request->headers['content-type'] = 'application/x-www-form-urlencoded';
+                        }
+                    }
+                }
+                $_request->headers['x-acs-content-sha256'] = $hashedRequestPayload;
+                if (!Utils::equalString($params->authType, 'Anonymous')) {
+                    $authType = $this->getType();
+                    if (Utils::equalString($authType, 'bearer')) {
+                        $bearerToken = $this->getBearerToken();
+                        $_request->headers['x-acs-bearer-token'] = $bearerToken;
+                    } else {
+                        $accessKeyId = $this->getAccessKeyId();
+                        $accessKeySecret = $this->getAccessKeySecret();
+                        $securityToken = $this->getSecurityToken();
+                        if (!Utils::empty_($securityToken)) {
+                            $_request->headers['x-acs-accesskey-id'] = $accessKeyId;
+                            $_request->headers['x-acs-security-token'] = $securityToken;
+                        }
+                        $_request->headers['Authorization'] = OpenApiUtilClient::getAuthorization($_request, $signatureAlgorithm, $hashedRequestPayload, $accessKeyId, $accessKeySecret);
+                    }
+                }
+                $_lastRequest = $_request;
+                $_response = Tea::send($_request, $_runtime);
+                if (Utils::is4xx($_response->statusCode) || Utils::is5xx($_response->statusCode)) {
+                    $err = [];
+                    // if (!Utils::isUnset(@$_response->headers['content-type']) && Utils::equalString(@$_response->headers['content-type'], 'text/xml;charset=utf-8')) {
+                    //     $_str = Utils::readAsString($_response->body);
+                    //     $respMap = XML::parseXml($_str, null);
+                    //     $err = Utils::assertAsMap(@$respMap['Error']);
+                    // } else {
+                    //     $_res = Utils::readAsJSON($_response->body);
+                    //     $err = Utils::assertAsMap($_res);
+                    // }
+                    $_res = Utils::readAsJSON($_response->body);
+                    $err = Utils::assertAsMap($_res);
+                    @$err['statusCode'] = $_response->statusCode;
+                    throw new TeaError(['code' => ''.(string) (self::defaultAny(@$err['Code'], @$err['code'])).'', 'message' => 'code: '.(string) ($_response->statusCode).', '.(string) (self::defaultAny(@$err['Message'], @$err['message'])).' request id: '.(string) (self::defaultAny(@$err['RequestId'], @$err['requestId'])).'', 'data' => $err]);
+                }
+                if (Utils::equalString($params->bodyType, 'binary')) {
+                    $resp = [
+                        'body' => $_response->body,
+                        'headers' => $_response->headers,
+                        'statusCode' => $_response->statusCode,
+                    ];
+
+                    return $resp;
+                } elseif (Utils::equalString($params->bodyType, 'byte')) {
+                    $byt = Utils::readAsBytes($_response->body);
+
+                    return [
+                        'body' => $byt,
+                        'headers' => $_response->headers,
+                        'statusCode' => $_response->statusCode,
+                    ];
+                } elseif (Utils::equalString($params->bodyType, 'string')) {
+                    $str = Utils::readAsString($_response->body);
+
+                    return [
+                        'body' => $str,
+                        'headers' => $_response->headers,
+                        'statusCode' => $_response->statusCode,
+                    ];
+                } elseif (Utils::equalString($params->bodyType, 'json')) {
+                    $obj = Utils::readAsJSON($_response->body);
+                    $res = Utils::assertAsMap($obj);
+
+                    return [
+                        'body' => $res,
+                        'headers' => $_response->headers,
+                        'statusCode' => $_response->statusCode,
+                    ];
+                } elseif (Utils::equalString($params->bodyType, 'array')) {
+                    $arr = Utils::readAsJSON($_response->body);
+
+                    return [
+                        'body' => $arr,
+                        'headers' => $_response->headers,
+                        'statusCode' => $_response->statusCode,
+                    ];
+                } else {
+                    return [
+                        'headers' => $_response->headers,
+                        'statusCode' => $_response->statusCode,
+                    ];
+                }
+            } catch (Exception $e) {
+                if (!($e instanceof TeaError)) {
+                    $e = new TeaError([], $e->getMessage(), $e->getCode(), $e);
+                }
+                if (Tea::isRetryable($e)) {
+                    $_lastException = $e;
+                    continue;
+                }
+                throw $e;
+            }
+        }
+        throw new TeaUnableRetryError($_lastRequest, $_lastException);
+    }
+
+    /**
+     * Encapsulate the request and invoke the network.
+     *
+     * @param Params         $params
+     * @param OpenApiRequest $request object of OpenApiRequest
+     * @param RuntimeOptions $runtime which controls some details of call api, such as retry times
+     *
+     * @return array the response
+     *
+     * @throws TeaError
+     * @throws Exception
+     * @throws TeaUnableRetryError
+     */
+    public function execute($params, $request, $runtime)
+    {
+        $params->validate();
+        $request->validate();
+        $runtime->validate();
+        $_runtime = [
+            'timeouted' => 'retry',
+            'readTimeout' => Utils::defaultNumber($runtime->readTimeout, $this->_readTimeout),
+            'connectTimeout' => Utils::defaultNumber($runtime->connectTimeout, $this->_connectTimeout),
+            'httpProxy' => Utils::defaultString($runtime->httpProxy, $this->_httpProxy),
+            'httpsProxy' => Utils::defaultString($runtime->httpsProxy, $this->_httpsProxy),
+            'noProxy' => Utils::defaultString($runtime->noProxy, $this->_noProxy),
+            'socks5Proxy' => Utils::defaultString($runtime->socks5Proxy, $this->_socks5Proxy),
+            'socks5NetWork' => Utils::defaultString($runtime->socks5NetWork, $this->_socks5NetWork),
+            'maxIdleConns' => Utils::defaultNumber($runtime->maxIdleConns, $this->_maxIdleConns),
+            'retry' => [
+                'retryable' => $runtime->autoretry,
+                'maxAttempts' => Utils::defaultNumber($runtime->maxAttempts, 3),
+            ],
+            'backoff' => [
+                'policy' => Utils::defaultString($runtime->backoffPolicy, 'no'),
+                'period' => Utils::defaultNumber($runtime->backoffPeriod, 1),
+            ],
+            'ignoreSSL' => $runtime->ignoreSSL,
+        ];
+        $_lastRequest = null;
+        $_lastException = null;
+        $_now = time();
+        $_retryTimes = 0;
+        while (Tea::allowRetry(@$_runtime['retry'], $_retryTimes, $_now)) {
+            if ($_retryTimes > 0) {
+                $_backoffTime = Tea::getBackoffTime(@$_runtime['backoff'], $_retryTimes);
+                if ($_backoffTime > 0) {
+                    Tea::sleep($_backoffTime);
+                }
+            }
+            $_retryTimes = $_retryTimes + 1;
+            try {
+                $_request = new Request();
+                // spi = new Gateway();//Gateway implements SPI,这一步在产品 SDK 中实例化
+                $headers = $this->getRpcHeaders();
+                $globalQueries = [];
+                $globalHeaders = [];
+                if (!Utils::isUnset($this->_globalParameters)) {
+                    $globalParams = $this->_globalParameters;
+                    if (!Utils::isUnset($globalParams->queries)) {
+                        $globalQueries = $globalParams->queries;
+                    }
+                    if (!Utils::isUnset($globalParams->headers)) {
+                        $globalHeaders = $globalParams->headers;
+                    }
+                }
+                $requestContext = new \Darabonba\GatewaySpi\Models\InterceptorContext\request([
+                    'headers' => Tea::merge($globalHeaders, $request->headers, $headers),
+                    'query' => Tea::merge($globalQueries, $request->query),
+                    'body' => $request->body,
+                    'stream' => $request->stream,
+                    'hostMap' => $request->hostMap,
+                    'pathname' => $params->pathname,
+                    'productId' => $this->_productId,
+                    'action' => $params->action,
+                    'version' => $params->version,
+                    'protocol' => Utils::defaultString($this->_protocol, $params->protocol),
+                    'method' => Utils::defaultString($this->_method, $params->method),
+                    'authType' => $params->authType,
+                    'bodyType' => $params->bodyType,
+                    'reqBodyType' => $params->reqBodyType,
+                    'style' => $params->style,
+                    'credential' => $this->_credential,
+                    'signatureVersion' => $this->_signatureVersion,
+                    'signatureAlgorithm' => $this->_signatureAlgorithm,
+                    'userAgent' => $this->getUserAgent(),
+                ]);
+                $configurationContext = new configuration([
+                    'regionId' => $this->_regionId,
+                    'endpoint' => Utils::defaultString($request->endpointOverride, $this->_endpoint),
+                    'endpointRule' => $this->_endpointRule,
+                    'endpointMap' => $this->_endpointMap,
+                    'endpointType' => $this->_endpointType,
+                    'network' => $this->_network,
+                    'suffix' => $this->_suffix,
+                ]);
+                $interceptorContext = new InterceptorContext([
+                    'request' => $requestContext,
+                    'configuration' => $configurationContext,
+                ]);
+                $attributeMap = new AttributeMap([]);
+                // 1. spi.modifyConfiguration(context: SPI.InterceptorContext, attributeMap: SPI.AttributeMap);
+                $this->_spi->modifyConfiguration($interceptorContext, $attributeMap);
+                // 2. spi.modifyRequest(context: SPI.InterceptorContext, attributeMap: SPI.AttributeMap);
+                $this->_spi->modifyRequest($interceptorContext, $attributeMap);
+                $_request->protocol = $interceptorContext->request->protocol;
+                $_request->method = $interceptorContext->request->method;
+                $_request->pathname = $interceptorContext->request->pathname;
+                $_request->query = $interceptorContext->request->query;
+                $_request->body = $interceptorContext->request->stream;
+                $_request->headers = $interceptorContext->request->headers;
+                $_lastRequest = $_request;
+                $_response = Tea::send($_request, $_runtime);
+                $responseContext = new response([
+                    'statusCode' => $_response->statusCode,
+                    'headers' => $_response->headers,
+                    'body' => $_response->body,
+                ]);
+                $interceptorContext->response = $responseContext;
+                // 3. spi.modifyResponse(context: SPI.InterceptorContext, attributeMap: SPI.AttributeMap);
+                $this->_spi->modifyResponse($interceptorContext, $attributeMap);
+
+                return [
+                    'headers' => $interceptorContext->response->headers,
+                    'statusCode' => $interceptorContext->response->statusCode,
+                    'body' => $interceptorContext->response->deserializedBody,
+                ];
+            } catch (Exception $e) {
+                if (!($e instanceof TeaError)) {
+                    $e = new TeaError([], $e->getMessage(), $e->getCode(), $e);
+                }
+                if (Tea::isRetryable($e)) {
+                    $_lastException = $e;
+                    continue;
+                }
+                throw $e;
+            }
+        }
+        throw new TeaUnableRetryError($_lastRequest, $_lastException);
+    }
+
+    /**
+     * @param Params         $params
+     * @param OpenApiRequest $request
+     * @param RuntimeOptions $runtime
+     *
+     * @return array
+     *
+     * @throws TeaError
+     */
+    public function callApi($params, $request, $runtime)
+    {
+        if (Utils::isUnset($params)) {
+            throw new TeaError(['code' => 'ParameterMissing', 'message' => "'params' can not be unset"]);
+        }
+        if (Utils::isUnset($this->_signatureAlgorithm) || !Utils::equalString($this->_signatureAlgorithm, 'v2')) {
+            return $this->doRequest($params, $request, $runtime);
+        } elseif (Utils::equalString($params->style, 'ROA') && Utils::equalString($params->reqBodyType, 'json')) {
+            return $this->doROARequest($params->action, $params->version, $params->protocol, $params->method, $params->authType, $params->pathname, $params->bodyType, $request, $runtime);
+        } elseif (Utils::equalString($params->style, 'ROA')) {
+            return $this->doROARequestWithForm($params->action, $params->version, $params->protocol, $params->method, $params->authType, $params->pathname, $params->bodyType, $request, $runtime);
+        } else {
+            return $this->doRPCRequest($params->action, $params->version, $params->protocol, $params->method, $params->authType, $params->bodyType, $request, $runtime);
+        }
+    }
+
+    /**
+     * Get user agent.
+     *
+     * @return string user agent
+     */
+    public function getUserAgent()
+    {
+        $userAgent = Utils::getUserAgent($this->_userAgent);
+
+        return $userAgent;
+    }
+
+    /**
+     * Get accesskey id by using credential.
+     *
+     * @return string accesskey id
+     */
+    public function getAccessKeyId()
+    {
+        if (Utils::isUnset($this->_credential)) {
+            return '';
+        }
+        $accessKeyId = $this->_credential->getAccessKeyId();
+
+        return $accessKeyId;
+    }
+
+    /**
+     * Get accesskey secret by using credential.
+     *
+     * @return string accesskey secret
+     */
+    public function getAccessKeySecret()
+    {
+        if (Utils::isUnset($this->_credential)) {
+            return '';
+        }
+        $secret = $this->_credential->getAccessKeySecret();
+
+        return $secret;
+    }
+
+    /**
+     * Get security token by using credential.
+     *
+     * @return string security token
+     */
+    public function getSecurityToken()
+    {
+        if (Utils::isUnset($this->_credential)) {
+            return '';
+        }
+        $token = $this->_credential->getSecurityToken();
+
+        return $token;
+    }
+
+    /**
+     * Get bearer token by credential.
+     *
+     * @return string bearer token
+     */
+    public function getBearerToken()
+    {
+        if (Utils::isUnset($this->_credential)) {
+            return '';
+        }
+        $token = $this->_credential->getBearerToken();
+
+        return $token;
+    }
+
+    /**
+     * Get credential type by credential.
+     *
+     * @return string credential type e.g. access_key
+     */
+    public function getType()
+    {
+        if (Utils::isUnset($this->_credential)) {
+            return '';
+        }
+        $authType = $this->_credential->getType();
+
+        return $authType;
+    }
+
+    /**
+     * If inputValue is not null, return it or return defaultValue.
+     *
+     * @param mixed $inputValue   users input value
+     * @param mixed $defaultValue default value
+     *
+     * @return any the final result
+     */
+    public static function defaultAny($inputValue, $defaultValue)
+    {
+        if (Utils::isUnset($inputValue)) {
+            return $defaultValue;
+        }
+
+        return $inputValue;
+    }
+
+    /**
+     * If the endpointRule and config.endpoint are empty, throw error.
+     *
+     * @param \Darabonba\OpenApi\Models\Config $config config contains the necessary information to create a client
+     *
+     * @return void
+     *
+     * @throws TeaError
+     */
+    public function checkConfig($config)
+    {
+        if (Utils::empty_($this->_endpointRule) && Utils::empty_($config->endpoint)) {
+            throw new TeaError(['code' => 'ParameterMissing', 'message' => "'config.endpoint' can not be empty"]);
+        }
+    }
+
+    /**
+     * set RPC header for debug.
+     *
+     * @param string[] $headers headers for debug, this header can be used only once
+     *
+     * @return void
+     */
+    public function setRpcHeaders($headers)
+    {
+        $this->_headers = $headers;
+    }
+
+    /**
+     * get RPC header for debug.
+     *
+     * @return array
+     */
+    public function getRpcHeaders()
+    {
+        $headers = $this->_headers;
+        $this->_headers = null;
+
+        return $headers;
+    }
+}

+ 13 - 0
vendor/alibabacloud/endpoint-util/.gitignore

@@ -0,0 +1,13 @@
+composer.phar
+/vendor/
+
+# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
+# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
+composer.lock
+
+.idea
+.DS_Store
+
+cache/
+*.cache
+runtime/

+ 65 - 0
vendor/alibabacloud/endpoint-util/.php_cs.dist

@@ -0,0 +1,65 @@
+<?php
+/*
+ * This document has been generated with
+ * https://mlocati.github.io/php-cs-fixer-configurator/#version:2.15|configurator
+ * you can change this configuration by importing this file.
+ */
+
+return PhpCsFixer\Config::create()
+    ->setRiskyAllowed(true)
+    ->setIndent('    ')
+    ->setRules([
+        '@PSR2'                                       => true,
+        '@PhpCsFixer'                                 => true,
+        '@Symfony:risky'                              => true,
+        'concat_space'                                => ['spacing' => 'one'],
+        'array_syntax'                                => ['syntax' => 'short'],
+        'array_indentation'                           => true,
+        'combine_consecutive_unsets'                  => true,
+        'method_separation'                           => true,
+        'single_quote'                                => true,
+        'declare_equal_normalize'                     => true,
+        'function_typehint_space'                     => true,
+        'hash_to_slash_comment'                       => true,
+        'include'                                     => true,
+        'lowercase_cast'                              => true,
+        'no_multiline_whitespace_before_semicolons'   => true,
+        'no_leading_import_slash'                     => true,
+        'no_multiline_whitespace_around_double_arrow' => true,
+        'no_spaces_around_offset'                     => true,
+        'no_unneeded_control_parentheses'             => true,
+        'no_unused_imports'                           => true,
+        'no_whitespace_before_comma_in_array'         => true,
+        'no_whitespace_in_blank_line'                 => true,
+        'object_operator_without_whitespace'          => true,
+        'single_blank_line_before_namespace'          => true,
+        'single_class_element_per_statement'          => true,
+        'space_after_semicolon'                       => true,
+        'standardize_not_equals'                      => true,
+        'ternary_operator_spaces'                     => true,
+        'trailing_comma_in_multiline_array'           => true,
+        'trim_array_spaces'                           => true,
+        'unary_operator_spaces'                       => true,
+        'whitespace_after_comma_in_array'             => true,
+        'no_extra_consecutive_blank_lines'            => [
+            'curly_brace_block',
+            'extra',
+            'parenthesis_brace_block',
+            'square_brace_block',
+            'throw',
+            'use',
+        ],
+        'binary_operator_spaces'       => [
+            'align_double_arrow' => true,
+            'align_equals'       => true,
+        ],
+        'braces'                                    => [
+            'allow_single_line_closure' => true,
+        ],
+    ])
+    ->setFinder(
+        PhpCsFixer\Finder::create()
+            ->exclude('vendor')
+            ->exclude('tests')
+            ->in(__DIR__)
+  );

+ 13 - 0
vendor/alibabacloud/endpoint-util/LICENSE

@@ -0,0 +1,13 @@
+Copyright (c) 2009-present, Alibaba Cloud All rights reserved.
+
+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.

+ 31 - 0
vendor/alibabacloud/endpoint-util/README-CN.md

@@ -0,0 +1,31 @@
+English | [简体中文](README-CN.md)
+
+![](https://aliyunsdk-pages.alicdn.com/icons/AlibabaCloud.svg)
+
+## Alibaba Cloud Endpoint Library for PHP
+
+## Installation
+
+### Composer
+
+```bash
+composer require alibabacloud/endpoint-util
+```
+
+## Issues
+
+[Opening an Issue](https://github.com/aliyun/endpoint-util/issues/new), Issues not conforming to the guidelines may be closed immediately.
+
+## Changelog
+
+Detailed changes for each release are documented in the [release notes](./ChangeLog.txt).
+
+## References
+
+* [Latest Release](https://github.com/aliyun/endpoint-util)
+
+## License
+
+[Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0)
+
+Copyright (c) 2009-present, Alibaba Cloud All rights reserved.

+ 31 - 0
vendor/alibabacloud/endpoint-util/README.md

@@ -0,0 +1,31 @@
+[English](README.md) | 简体中文
+
+![](https://aliyunsdk-pages.alicdn.com/icons/AlibabaCloud.svg)
+
+## Alibaba Cloud Endpoint Library for PHP
+
+## 安装
+
+### Composer
+
+```bash
+composer require alibabacloud/endpoint-util
+```
+
+## 问题
+
+[提交 Issue](https://github.com/aliyun/endpoint-util/issues/new),不符合指南的问题可能会立即关闭。
+
+## 发行说明
+
+每个版本的详细更改记录在[发行说明](./ChangeLog.txt)中。
+
+## 相关
+
+* [最新源码](https://github.com/aliyun/endpoint-util)
+
+## 许可证
+
+[Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0)
+
+Copyright (c) 2009-present, Alibaba Cloud All rights reserved.

+ 42 - 0
vendor/alibabacloud/endpoint-util/composer.json

@@ -0,0 +1,42 @@
+{
+  "name": "alibabacloud/endpoint-util",
+  "description": "Alibaba Cloud Endpoint Library for PHP",
+  "type": "library",
+  "license": "Apache-2.0",
+  "authors": [
+    {
+      "name": "Alibaba Cloud SDK",
+      "email": "sdk-team@alibabacloud.com"
+    }
+  ],
+  "require": {
+    "php": ">5.5"
+  },
+  "require-dev": {
+    "phpunit/phpunit": "^4.8.35|^5.4.3"
+  },
+  "autoload": {
+    "psr-4": {
+      "AlibabaCloud\\Endpoint\\": "src"
+    }
+  },
+  "autoload-dev": {
+    "psr-4": {
+      "AlibabaCloud\\Endpoint\\Tests\\": "tests"
+    }
+  },
+  "scripts": {
+    "fixer": "php-cs-fixer fix ./",
+    "test": [
+      "@clearCache",
+      "./vendor/bin/phpunit --colors=always"
+    ],
+    "clearCache": "rm -rf cache/*"
+  },
+  "config": {
+    "sort-packages": true,
+    "preferred-install": "dist",
+    "optimize-autoloader": true
+  },
+  "prefer-stable": true
+}

+ 32 - 0
vendor/alibabacloud/endpoint-util/phpunit.xml

@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<phpunit bootstrap="./tests/bootstrap.php" colors="true" processIsolation="false" stopOnFailure="false"
+         convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true"
+         testSuiteLoaderFile="phpunit/src/Runner/StandardTestSuiteLoader.php">
+
+    <testsuites>
+        <testsuite name="All">
+            <directory>tests</directory>
+        </testsuite>
+        <testsuite name="Unit">
+            <directory suffix="Test.php">./tests/Unit</directory>
+        </testsuite>
+    </testsuites>
+
+    <groups>
+        <exclude>
+            <group>integration</group>
+        </exclude>
+    </groups>
+
+    <logging>
+        <log type="coverage-html" target="cache/coverage" lowUpperBound="35" highLowerBound="70"/>
+        <log type="coverage-clover" target="cache/coverage.clover"/>
+    </logging>
+
+
+    <filter>
+        <whitelist processUncoveredFilesFromWhitelist="true">
+            <directory suffix=".php">./src</directory>
+        </whitelist>
+    </filter>
+</phpunit>

+ 61 - 0
vendor/alibabacloud/endpoint-util/src/Endpoint.php

@@ -0,0 +1,61 @@
+<?php
+
+namespace AlibabaCloud\Endpoint;
+
+/**
+ * Get endpoint.
+ */
+class Endpoint
+{
+    const ENDPOINT_TYPE_REGIONAL = 'regional';
+    const ENDPOINT_TYPE_CENTRAL  = 'central';
+
+    const REGIONAL_RULES = '<product><suffix><network>.<region_id>.aliyuncs.com';
+    const CENTRAL_RULES  = '<product><suffix><network>.aliyuncs.com';
+
+    /**
+     * @param string $product      required
+     * @param string $regionId     optional It will be required when endpoint type is 'regional'
+     * @param string $endpointType optional regional|central
+     * @param string $network      optional
+     * @param string $suffix       optional
+     *
+     * @throws \InvalidArgumentException
+     *
+     * @return string
+     */
+    public static function getEndpointRules($product, $regionId, $endpointType = '', $network = '', $suffix = '')
+    {
+        if (empty($product)) {
+            throw new \InvalidArgumentException('Product name cannot be empty.');
+        }
+        $endpoint = self::REGIONAL_RULES;
+        if (self::ENDPOINT_TYPE_REGIONAL === $endpointType) {
+            if (empty($regionId)) {
+                throw new \InvalidArgumentException('RegionId is empty, please set a valid RegionId');
+            }
+            $endpoint = self::render($endpoint, 'region_id', strtolower($regionId));
+        } elseif (self::ENDPOINT_TYPE_CENTRAL === $endpointType) {
+            $endpoint = self::CENTRAL_RULES;
+        } else {
+            throw new \InvalidArgumentException('Invalid EndpointType');
+        }
+        if (!empty($network) && 'public' !== $network) {
+            $endpoint = self::render($endpoint, 'network', '-' . $network);
+        } else {
+            $endpoint = self::render($endpoint, 'network', '');
+        }
+        if (!empty($suffix)) {
+            $endpoint = self::render($endpoint, 'suffix', '-' . $suffix);
+        } else {
+            $endpoint = self::render($endpoint, 'suffix', '');
+        }
+
+        return self::render($endpoint, 'product', strtolower($product));
+    }
+
+    private static function render($str, $tag, $replace)
+    {
+        return str_replace('<' . $tag . '>', $replace, $str);
+    }
+}

+ 58 - 0
vendor/alibabacloud/endpoint-util/tests/EndpointTest.php

@@ -0,0 +1,58 @@
+<?php
+
+namespace AlibabaCloud\Endpoint\Tests;
+
+use AlibabaCloud\Endpoint\Endpoint;
+use PHPUnit\Framework\TestCase;
+
+/**
+ * @internal
+ * @coversNothing
+ */
+class EndpointTest extends TestCase
+{
+    public function testGetEndpointWhenInvalidProduct()
+    {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionMessage('Product name cannot be empty.');
+        Endpoint::getEndpointRules('', '', '', '');
+    }
+
+    public function testGetEndpointWhenInvalidEndpointType()
+    {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionMessage('Invalid EndpointType');
+        Endpoint::getEndpointRules('ecs', '', 'fake endpoint type', '');
+    }
+
+    public function testGetEndpointWhenInvalidRegionId()
+    {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionMessage('RegionId is empty, please set a valid RegionId');
+        Endpoint::getEndpointRules('ecs', '', Endpoint::ENDPOINT_TYPE_REGIONAL, '');
+    }
+
+    public function testGetEndpointCentral()
+    {
+        $endpoint = Endpoint::getEndpointRules('ecs', '', Endpoint::ENDPOINT_TYPE_CENTRAL);
+        $this->assertEquals('ecs.aliyuncs.com', $endpoint);
+    }
+
+    public function testGetEndpointRegional()
+    {
+        $endpoint = Endpoint::getEndpointRules('ecs', 'cn-hangzhou', Endpoint::ENDPOINT_TYPE_REGIONAL);
+        $this->assertEquals('ecs.cn-hangzhou.aliyuncs.com', $endpoint);
+    }
+
+    public function testGetEndpointRegionalWithNetwork()
+    {
+        $endpoint = Endpoint::getEndpointRules('ecs', 'cn-hangzhou', Endpoint::ENDPOINT_TYPE_REGIONAL, 'internal');
+        $this->assertEquals('ecs-internal.cn-hangzhou.aliyuncs.com', $endpoint);
+    }
+
+    public function testGetEndpointRegionalWithSuffix()
+    {
+        $endpoint = Endpoint::getEndpointRules('ecs', 'cn-hangzhou', Endpoint::ENDPOINT_TYPE_REGIONAL, 'internal', 'test');
+        $this->assertEquals('ecs-test-internal.cn-hangzhou.aliyuncs.com', $endpoint);
+    }
+}

+ 3 - 0
vendor/alibabacloud/endpoint-util/tests/bootstrap.php

@@ -0,0 +1,3 @@
+<?php
+
+require dirname(__DIR__) . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';

+ 15 - 0
vendor/alibabacloud/gateway-spi/.gitignore

@@ -0,0 +1,15 @@
+composer.phar
+/vendor/
+
+# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
+# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
+composer.lock
+
+.vscode/
+.idea
+.DS_Store
+
+cache/
+*.cache
+runtime/
+.php_cs.cache

+ 65 - 0
vendor/alibabacloud/gateway-spi/.php_cs.dist

@@ -0,0 +1,65 @@
+<?php
+/*
+ * This document has been generated with
+ * https://mlocati.github.io/php-cs-fixer-configurator/#version:2.15|configurator
+ * you can change this configuration by importing this file.
+ */
+
+return PhpCsFixer\Config::create()
+    ->setRiskyAllowed(true)
+    ->setIndent('    ')
+    ->setRules([
+        '@PSR2'                                       => true,
+        '@PhpCsFixer'                                 => true,
+        '@Symfony:risky'                              => true,
+        'concat_space'                                => ['spacing' => 'one'],
+        'array_syntax'                                => ['syntax' => 'short'],
+        'array_indentation'                           => true,
+        'combine_consecutive_unsets'                  => true,
+        'method_separation'                           => true,
+        'single_quote'                                => true,
+        'declare_equal_normalize'                     => true,
+        'function_typehint_space'                     => true,
+        'hash_to_slash_comment'                       => true,
+        'include'                                     => true,
+        'lowercase_cast'                              => true,
+        'no_multiline_whitespace_before_semicolons'   => true,
+        'no_leading_import_slash'                     => true,
+        'no_multiline_whitespace_around_double_arrow' => true,
+        'no_spaces_around_offset'                     => true,
+        'no_unneeded_control_parentheses'             => true,
+        'no_unused_imports'                           => true,
+        'no_whitespace_before_comma_in_array'         => true,
+        'no_whitespace_in_blank_line'                 => true,
+        'object_operator_without_whitespace'          => true,
+        'single_blank_line_before_namespace'          => true,
+        'single_class_element_per_statement'          => true,
+        'space_after_semicolon'                       => true,
+        'standardize_not_equals'                      => true,
+        'ternary_operator_spaces'                     => true,
+        'trailing_comma_in_multiline_array'           => true,
+        'trim_array_spaces'                           => true,
+        'unary_operator_spaces'                       => true,
+        'whitespace_after_comma_in_array'             => true,
+        'no_extra_consecutive_blank_lines'            => [
+            'curly_brace_block',
+            'extra',
+            'parenthesis_brace_block',
+            'square_brace_block',
+            'throw',
+            'use',
+        ],
+        'binary_operator_spaces'       => [
+            'align_double_arrow' => true,
+            'align_equals'       => true,
+        ],
+        'braces'                                    => [
+            'allow_single_line_closure' => true,
+        ],
+    ])
+    ->setFinder(
+        PhpCsFixer\Finder::create()
+            ->exclude('vendor')
+            ->exclude('tests')
+            ->in(__DIR__)
+  );

+ 15 - 0
vendor/alibabacloud/gateway-spi/autoload.php

@@ -0,0 +1,15 @@
+<?php
+
+if (file_exists(__DIR__ . \DIRECTORY_SEPARATOR . 'vendor' . \DIRECTORY_SEPARATOR . 'autoload.php')) {
+    require_once __DIR__ . \DIRECTORY_SEPARATOR . 'vendor' . \DIRECTORY_SEPARATOR . 'autoload.php';
+}
+
+spl_autoload_register(function ($class) {
+    $name = str_replace('Darabonba\\GatewaySpi\\', '', $class);
+    $file = __DIR__ . \DIRECTORY_SEPARATOR . 'src' . \DIRECTORY_SEPARATOR . str_replace('\\', \DIRECTORY_SEPARATOR, $name) . '.php';
+    if (file_exists($file)) {
+        require_once $file;
+        return true;
+    }
+    return false;
+});

+ 30 - 0
vendor/alibabacloud/gateway-spi/composer.json

@@ -0,0 +1,30 @@
+{
+  "name": "alibabacloud/gateway-spi",
+  "description": "Alibaba Cloud Gateway SPI Client",
+  "type": "library",
+  "license": "Apache-2.0",
+  "authors": [
+    {
+      "name": "Alibaba Cloud SDK",
+      "email": "sdk-team@alibabacloud.com"
+    }
+  ],
+  "require": {
+    "php": ">5.5",
+    "alibabacloud/credentials": "^1.1"
+  },
+  "autoload": {
+    "psr-4": {
+      "Darabonba\\GatewaySpi\\": "src"
+    }
+  },
+  "scripts": {
+    "fixer": "php-cs-fixer fix ./"
+  },
+  "config": {
+    "sort-packages": true,
+    "preferred-install": "dist",
+    "optimize-autoloader": true
+  },
+  "prefer-stable": true
+}

+ 35 - 0
vendor/alibabacloud/gateway-spi/src/Client.php

@@ -0,0 +1,35 @@
+<?php
+
+// This file is auto-generated, don't edit it. Thanks.
+namespace Darabonba\GatewaySpi;
+
+use \Exception;
+
+use Darabonba\GatewaySpi\Models\InterceptorContext;
+use Darabonba\GatewaySpi\Models\AttributeMap;
+
+abstract class Client {
+    public function __construct(){
+    }
+
+    /**
+     * @param InterceptorContext $context
+     * @param AttributeMap $attributeMap
+     * @return void
+     */
+    abstract function modifyConfiguration($context, $attributeMap);
+
+    /**
+     * @param InterceptorContext $context
+     * @param AttributeMap $attributeMap
+     * @return void
+     */
+    abstract function modifyRequest($context, $attributeMap);
+
+    /**
+     * @param InterceptorContext $context
+     * @param AttributeMap $attributeMap
+     * @return void
+     */
+    abstract function modifyResponse($context, $attributeMap);
+}

+ 47 - 0
vendor/alibabacloud/gateway-spi/src/Models/AttributeMap.php

@@ -0,0 +1,47 @@
+<?php
+
+// This file is auto-generated, don't edit it. Thanks.
+namespace Darabonba\GatewaySpi\Models;
+
+use AlibabaCloud\Tea\Model;
+
+class AttributeMap extends Model {
+    public function validate() {
+        Model::validateRequired('attributes', $this->attributes, true);
+        Model::validateRequired('key', $this->key, true);
+    }
+    public function toMap() {
+        $res = [];
+        if (null !== $this->attributes) {
+            $res['attributes'] = $this->attributes;
+        }
+        if (null !== $this->key) {
+            $res['key'] = $this->key;
+        }
+        return $res;
+    }
+    /**
+     * @param array $map
+     * @return AttributeMap
+     */
+    public static function fromMap($map = []) {
+        $model = new self();
+        if(isset($map['attributes'])){
+            $model->attributes = $map['attributes'];
+        }
+        if(isset($map['key'])){
+            $model->key = $map['key'];
+        }
+        return $model;
+    }
+    /**
+     * @var mixed[]
+     */
+    public $attributes;
+
+    /**
+     * @var string[]
+     */
+    public $key;
+
+}

+ 63 - 0
vendor/alibabacloud/gateway-spi/src/Models/InterceptorContext.php

@@ -0,0 +1,63 @@
+<?php
+
+// This file is auto-generated, don't edit it. Thanks.
+namespace Darabonba\GatewaySpi\Models;
+
+use AlibabaCloud\Tea\Model;
+
+use Darabonba\GatewaySpi\Models\InterceptorContext\request;
+use Darabonba\GatewaySpi\Models\InterceptorContext\configuration;
+use Darabonba\GatewaySpi\Models\InterceptorContext\response;
+
+class InterceptorContext extends Model {
+    public function validate() {
+        Model::validateRequired('request', $this->request, true);
+        Model::validateRequired('configuration', $this->configuration, true);
+        Model::validateRequired('response', $this->response, true);
+    }
+    public function toMap() {
+        $res = [];
+        if (null !== $this->request) {
+            $res['request'] = null !== $this->request ? $this->request->toMap() : null;
+        }
+        if (null !== $this->configuration) {
+            $res['configuration'] = null !== $this->configuration ? $this->configuration->toMap() : null;
+        }
+        if (null !== $this->response) {
+            $res['response'] = null !== $this->response ? $this->response->toMap() : null;
+        }
+        return $res;
+    }
+    /**
+     * @param array $map
+     * @return InterceptorContext
+     */
+    public static function fromMap($map = []) {
+        $model = new self();
+        if(isset($map['request'])){
+            $model->request = request::fromMap($map['request']);
+        }
+        if(isset($map['configuration'])){
+            $model->configuration = configuration::fromMap($map['configuration']);
+        }
+        if(isset($map['response'])){
+            $model->response = response::fromMap($map['response']);
+        }
+        return $model;
+    }
+    /**
+     * @var request
+     */
+    public $request;
+
+    /**
+     * @var configuration
+     */
+    public $configuration;
+
+    /**
+     * @var response
+     */
+    public $response;
+
+}

+ 83 - 0
vendor/alibabacloud/gateway-spi/src/Models/InterceptorContext/configuration.php

@@ -0,0 +1,83 @@
+<?php
+
+// This file is auto-generated, don't edit it. Thanks.
+namespace Darabonba\GatewaySpi\Models\InterceptorContext;
+
+use AlibabaCloud\Tea\Model;
+
+class configuration extends Model {
+    public function validate() {
+        Model::validateRequired('regionId', $this->regionId, true);
+    }
+    public function toMap() {
+        $res = [];
+        if (null !== $this->regionId) {
+            $res['regionId'] = $this->regionId;
+        }
+        if (null !== $this->endpoint) {
+            $res['endpoint'] = $this->endpoint;
+        }
+        if (null !== $this->endpointRule) {
+            $res['endpointRule'] = $this->endpointRule;
+        }
+        if (null !== $this->endpointMap) {
+            $res['endpointMap'] = $this->endpointMap;
+        }
+        if (null !== $this->endpointType) {
+            $res['endpointType'] = $this->endpointType;
+        }
+        if (null !== $this->network) {
+            $res['network'] = $this->network;
+        }
+        if (null !== $this->suffix) {
+            $res['suffix'] = $this->suffix;
+        }
+        return $res;
+    }
+    /**
+     * @param array $map
+     * @return configuration
+     */
+    public static function fromMap($map = []) {
+        $model = new self();
+        if(isset($map['regionId'])){
+            $model->regionId = $map['regionId'];
+        }
+        if(isset($map['endpoint'])){
+            $model->endpoint = $map['endpoint'];
+        }
+        if(isset($map['endpointRule'])){
+            $model->endpointRule = $map['endpointRule'];
+        }
+        if(isset($map['endpointMap'])){
+            $model->endpointMap = $map['endpointMap'];
+        }
+        if(isset($map['endpointType'])){
+            $model->endpointType = $map['endpointType'];
+        }
+        if(isset($map['network'])){
+            $model->network = $map['network'];
+        }
+        if(isset($map['suffix'])){
+            $model->suffix = $map['suffix'];
+        }
+        return $model;
+    }
+    /**
+     * @var string
+     */
+    public $regionId;
+
+    public $endpoint;
+
+    public $endpointRule;
+
+    public $endpointMap;
+
+    public $endpointType;
+
+    public $network;
+
+    public $suffix;
+
+}

+ 220 - 0
vendor/alibabacloud/gateway-spi/src/Models/InterceptorContext/request.php

@@ -0,0 +1,220 @@
+<?php
+
+// This file is auto-generated, don't edit it. Thanks.
+namespace Darabonba\GatewaySpi\Models\InterceptorContext;
+
+use AlibabaCloud\Tea\Model;
+use AlibabaCloud\Credentials\Credential;
+
+class request extends Model {
+    public function validate() {
+        Model::validateRequired('pathname', $this->pathname, true);
+        Model::validateRequired('productId', $this->productId, true);
+        Model::validateRequired('action', $this->action, true);
+        Model::validateRequired('version', $this->version, true);
+        Model::validateRequired('protocol', $this->protocol, true);
+        Model::validateRequired('method', $this->method, true);
+        Model::validateRequired('authType', $this->authType, true);
+        Model::validateRequired('bodyType', $this->bodyType, true);
+        Model::validateRequired('reqBodyType', $this->reqBodyType, true);
+        Model::validateRequired('credential', $this->credential, true);
+        Model::validateRequired('userAgent', $this->userAgent, true);
+    }
+    public function toMap() {
+        $res = [];
+        if (null !== $this->headers) {
+            $res['headers'] = $this->headers;
+        }
+        if (null !== $this->query) {
+            $res['query'] = $this->query;
+        }
+        if (null !== $this->body) {
+            $res['body'] = $this->body;
+        }
+        if (null !== $this->stream) {
+            $res['stream'] = $this->stream;
+        }
+        if (null !== $this->hostMap) {
+            $res['hostMap'] = $this->hostMap;
+        }
+        if (null !== $this->pathname) {
+            $res['pathname'] = $this->pathname;
+        }
+        if (null !== $this->productId) {
+            $res['productId'] = $this->productId;
+        }
+        if (null !== $this->action) {
+            $res['action'] = $this->action;
+        }
+        if (null !== $this->version) {
+            $res['version'] = $this->version;
+        }
+        if (null !== $this->protocol) {
+            $res['protocol'] = $this->protocol;
+        }
+        if (null !== $this->method) {
+            $res['method'] = $this->method;
+        }
+        if (null !== $this->authType) {
+            $res['authType'] = $this->authType;
+        }
+        if (null !== $this->bodyType) {
+            $res['bodyType'] = $this->bodyType;
+        }
+        if (null !== $this->reqBodyType) {
+            $res['reqBodyType'] = $this->reqBodyType;
+        }
+        if (null !== $this->style) {
+            $res['style'] = $this->style;
+        }
+        if (null !== $this->credential) {
+            $res['credential'] = null !== $this->credential ? $this->credential->toMap() : null;
+        }
+        if (null !== $this->signatureVersion) {
+            $res['signatureVersion'] = $this->signatureVersion;
+        }
+        if (null !== $this->signatureAlgorithm) {
+            $res['signatureAlgorithm'] = $this->signatureAlgorithm;
+        }
+        if (null !== $this->userAgent) {
+            $res['userAgent'] = $this->userAgent;
+        }
+        return $res;
+    }
+    /**
+     * @param array $map
+     * @return request
+     */
+    public static function fromMap($map = []) {
+        $model = new self();
+        if(isset($map['headers'])){
+            $model->headers = $map['headers'];
+        }
+        if(isset($map['query'])){
+            $model->query = $map['query'];
+        }
+        if(isset($map['body'])){
+            $model->body = $map['body'];
+        }
+        if(isset($map['stream'])){
+            $model->stream = $map['stream'];
+        }
+        if(isset($map['hostMap'])){
+            $model->hostMap = $map['hostMap'];
+        }
+        if(isset($map['pathname'])){
+            $model->pathname = $map['pathname'];
+        }
+        if(isset($map['productId'])){
+            $model->productId = $map['productId'];
+        }
+        if(isset($map['action'])){
+            $model->action = $map['action'];
+        }
+        if(isset($map['version'])){
+            $model->version = $map['version'];
+        }
+        if(isset($map['protocol'])){
+            $model->protocol = $map['protocol'];
+        }
+        if(isset($map['method'])){
+            $model->method = $map['method'];
+        }
+        if(isset($map['authType'])){
+            $model->authType = $map['authType'];
+        }
+        if(isset($map['bodyType'])){
+            $model->bodyType = $map['bodyType'];
+        }
+        if(isset($map['reqBodyType'])){
+            $model->reqBodyType = $map['reqBodyType'];
+        }
+        if(isset($map['style'])){
+            $model->style = $map['style'];
+        }
+        if(isset($map['credential'])){
+            $model->credential = Credential::fromMap($map['credential']);
+        }
+        if(isset($map['signatureVersion'])){
+            $model->signatureVersion = $map['signatureVersion'];
+        }
+        if(isset($map['signatureAlgorithm'])){
+            $model->signatureAlgorithm = $map['signatureAlgorithm'];
+        }
+        if(isset($map['userAgent'])){
+            $model->userAgent = $map['userAgent'];
+        }
+        return $model;
+    }
+    public $headers;
+
+    public $query;
+
+    public $body;
+
+    public $stream;
+
+    public $hostMap;
+
+    /**
+     * @var string
+     */
+    public $pathname;
+
+    /**
+     * @var string
+     */
+    public $productId;
+
+    /**
+     * @var string
+     */
+    public $action;
+
+    /**
+     * @var string
+     */
+    public $version;
+
+    /**
+     * @var string
+     */
+    public $protocol;
+
+    /**
+     * @var string
+     */
+    public $method;
+
+    /**
+     * @var string
+     */
+    public $authType;
+
+    /**
+     * @var string
+     */
+    public $bodyType;
+
+    /**
+     * @var string
+     */
+    public $reqBodyType;
+
+    public $style;
+
+    /**
+     * @var Credential
+     */
+    public $credential;
+
+    public $signatureVersion;
+
+    public $signatureAlgorithm;
+
+    /**
+     * @var string
+     */
+    public $userAgent;
+
+}

+ 54 - 0
vendor/alibabacloud/gateway-spi/src/Models/InterceptorContext/response.php

@@ -0,0 +1,54 @@
+<?php
+
+// This file is auto-generated, don't edit it. Thanks.
+namespace Darabonba\GatewaySpi\Models\InterceptorContext;
+
+use AlibabaCloud\Tea\Model;
+
+class response extends Model {
+    public function validate() {}
+    public function toMap() {
+        $res = [];
+        if (null !== $this->statusCode) {
+            $res['statusCode'] = $this->statusCode;
+        }
+        if (null !== $this->headers) {
+            $res['headers'] = $this->headers;
+        }
+        if (null !== $this->body) {
+            $res['body'] = $this->body;
+        }
+        if (null !== $this->deserializedBody) {
+            $res['deserializedBody'] = $this->deserializedBody;
+        }
+        return $res;
+    }
+    /**
+     * @param array $map
+     * @return response
+     */
+    public static function fromMap($map = []) {
+        $model = new self();
+        if(isset($map['statusCode'])){
+            $model->statusCode = $map['statusCode'];
+        }
+        if(isset($map['headers'])){
+            $model->headers = $map['headers'];
+        }
+        if(isset($map['body'])){
+            $model->body = $map['body'];
+        }
+        if(isset($map['deserializedBody'])){
+            $model->deserializedBody = $map['deserializedBody'];
+        }
+        return $model;
+    }
+    public $statusCode;
+
+    public $headers;
+
+    public $body;
+
+    public $deserializedBody;
+
+}

+ 15 - 0
vendor/alibabacloud/openapi-util/.gitignore

@@ -0,0 +1,15 @@
+composer.phar
+/vendor/
+
+# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
+# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
+composer.lock
+
+.vscode/
+.idea
+.DS_Store
+
+cache/
+*.cache
+runtime/
+.php_cs.cache

+ 65 - 0
vendor/alibabacloud/openapi-util/.php_cs.dist

@@ -0,0 +1,65 @@
+<?php
+/*
+ * This document has been generated with
+ * https://mlocati.github.io/php-cs-fixer-configurator/#version:2.15|configurator
+ * you can change this configuration by importing this file.
+ */
+
+return PhpCsFixer\Config::create()
+    ->setRiskyAllowed(true)
+    ->setIndent('    ')
+    ->setRules([
+        '@PSR2'                                       => true,
+        '@PhpCsFixer'                                 => true,
+        '@Symfony:risky'                              => true,
+        'concat_space'                                => ['spacing' => 'one'],
+        'array_syntax'                                => ['syntax' => 'short'],
+        'array_indentation'                           => true,
+        'combine_consecutive_unsets'                  => true,
+        'method_separation'                           => true,
+        'single_quote'                                => true,
+        'declare_equal_normalize'                     => true,
+        'function_typehint_space'                     => true,
+        'hash_to_slash_comment'                       => true,
+        'include'                                     => true,
+        'lowercase_cast'                              => true,
+        'no_multiline_whitespace_before_semicolons'   => true,
+        'no_leading_import_slash'                     => true,
+        'no_multiline_whitespace_around_double_arrow' => true,
+        'no_spaces_around_offset'                     => true,
+        'no_unneeded_control_parentheses'             => true,
+        'no_unused_imports'                           => true,
+        'no_whitespace_before_comma_in_array'         => true,
+        'no_whitespace_in_blank_line'                 => true,
+        'object_operator_without_whitespace'          => true,
+        'single_blank_line_before_namespace'          => true,
+        'single_class_element_per_statement'          => true,
+        'space_after_semicolon'                       => true,
+        'standardize_not_equals'                      => true,
+        'ternary_operator_spaces'                     => true,
+        'trailing_comma_in_multiline_array'           => true,
+        'trim_array_spaces'                           => true,
+        'unary_operator_spaces'                       => true,
+        'whitespace_after_comma_in_array'             => true,
+        'no_extra_consecutive_blank_lines'            => [
+            'curly_brace_block',
+            'extra',
+            'parenthesis_brace_block',
+            'square_brace_block',
+            'throw',
+            'use',
+        ],
+        'binary_operator_spaces'       => [
+            'align_double_arrow' => true,
+            'align_equals'       => true,
+        ],
+        'braces'                                    => [
+            'allow_single_line_closure' => true,
+        ],
+    ])
+    ->setFinder(
+        PhpCsFixer\Finder::create()
+            ->exclude('vendor')
+            ->exclude('tests')
+            ->in(__DIR__)
+  );

+ 31 - 0
vendor/alibabacloud/openapi-util/README-CN.md

@@ -0,0 +1,31 @@
+[English](README.md) | 简体中文
+
+![](https://aliyunsdk-pages.alicdn.com/icons/AlibabaCloud.svg)
+
+## Alibaba Cloud OpenApi Util
+
+## 安装
+
+### Composer
+
+```bash
+composer require alibabacloud/openapi-util
+```
+
+## 问题
+
+[提交 Issue](https://github.com/aliyun/openapiutil/issues/new),不符合指南的问题可能会立即关闭。
+
+## 发行说明
+
+每个版本的详细更改记录在[发行说明](./ChangeLog.txt)中。
+
+## 相关
+
+* [最新源码](https://github.com/aliyun/openapiutil)
+
+## 许可证
+
+[Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0)
+
+Copyright (c) 2009-present, Alibaba Cloud All rights reserved.

+ 31 - 0
vendor/alibabacloud/openapi-util/README.md

@@ -0,0 +1,31 @@
+English | [简体中文](README-CN.md)
+
+![](https://aliyunsdk-pages.alicdn.com/icons/AlibabaCloud.svg)
+
+## Alibaba Cloud OpenApi Util
+
+## Installation
+
+### Composer
+
+```bash
+composer require alibabacloud/openapi-util
+```
+
+## Issues
+
+[Opening an Issue](https://github.com/aliyun/openapiutil/issues/new), Issues not conforming to the guidelines may be closed immediately.
+
+## Changelog
+
+Detailed changes for each release are documented in the [release notes](./ChangeLog.txt).
+
+## References
+
+* [Latest Release](https://github.com/aliyun/openapiutil)
+
+## License
+
+[Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0)
+
+Copyright (c) 2009-present, Alibaba Cloud All rights reserved.

+ 17 - 0
vendor/alibabacloud/openapi-util/autoload.php

@@ -0,0 +1,17 @@
+<?php
+
+spl_autoload_register(function ($class) {
+    $name = str_replace('AlibabaCloud\\OpenApiUtil\\', '', $class);
+    $file = __DIR__ . \DIRECTORY_SEPARATOR . 'src' . \DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $name) . '.php';
+    if (file_exists($file)) {
+        require_once $file;
+
+        return true;
+    }
+
+    return false;
+});
+
+if (file_exists(__DIR__ . '/vendor/autoload.php')) {
+    require_once __DIR__ . '/vendor/autoload.php';
+}

+ 45 - 0
vendor/alibabacloud/openapi-util/composer.json

@@ -0,0 +1,45 @@
+{
+  "name": "alibabacloud/openapi-util",
+  "description": "Alibaba Cloud OpenApi Util",
+  "type": "library",
+  "license": "Apache-2.0",
+  "authors": [
+    {
+      "name": "Alibaba Cloud SDK",
+      "email": "sdk-team@alibabacloud.com"
+    }
+  ],
+  "require": {
+    "php": ">5.5",
+    "alibabacloud/tea": "^3.1",
+    "alibabacloud/tea-utils": "^0.2",
+    "lizhichao/one-sm": "^1.5"
+  },
+  "require-dev": {
+    "phpunit/phpunit": "^4.8.35|^5.4.3"
+  },
+  "autoload": {
+    "psr-4": {
+      "AlibabaCloud\\OpenApiUtil\\": "src"
+    }
+  },
+  "autoload-dev": {
+    "psr-4": {
+      "AlibabaCloud\\OpenApiUtil\\Tests\\": "tests"
+    }
+  },
+  "scripts": {
+    "fixer": "php-cs-fixer fix ./",
+    "test": [
+      "@clearCache",
+      "./vendor/bin/phpunit --colors=always"
+    ],
+    "clearCache": "rm -rf cache/*"
+  },
+  "config": {
+    "sort-packages": true,
+    "preferred-install": "dist",
+    "optimize-autoloader": true
+  },
+  "prefer-stable": true
+}

+ 31 - 0
vendor/alibabacloud/openapi-util/phpunit.xml

@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<phpunit bootstrap="./tests/bootstrap.php" colors="true" processIsolation="false" stopOnFailure="false"
+         convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true"
+         testSuiteLoaderFile="phpunit/src/Runner/StandardTestSuiteLoader.php">
+
+    <testsuites>
+        <testsuite name="All">
+            <directory>tests</directory>
+        </testsuite>
+        <testsuite name="Unit">
+            <directory suffix="Test.php">./tests/Unit</directory>
+        </testsuite>
+    </testsuites>
+
+    <groups>
+        <exclude>
+            <group>integration</group>
+        </exclude>
+    </groups>
+
+    <logging>
+        <log type="coverage-html" target="cache/coverage" lowUpperBound="35" highLowerBound="70"/>
+        <log type="coverage-clover" target="cache/coverage.clover"/>
+    </logging>
+
+    <filter>
+        <whitelist processUncoveredFilesFromWhitelist="true">
+            <directory suffix=".php">./src</directory>
+        </whitelist>
+    </filter>
+</phpunit>

+ 549 - 0
vendor/alibabacloud/openapi-util/src/OpenApiUtilClient.php

@@ -0,0 +1,549 @@
+<?php
+
+namespace AlibabaCloud\OpenApiUtil;
+
+use AlibabaCloud\Tea\Model;
+use AlibabaCloud\Tea\Request;
+use AlibabaCloud\Tea\Utils\Utils;
+use OneSm\Sm3;
+use Psr\Http\Message\StreamInterface;
+
+/**
+ * This is for OpenApi Util.
+ */
+class OpenApiUtilClient
+{
+    /**
+     * Convert all params of body other than type of readable into content.
+     *
+     * @param Model $body    source Model
+     * @param Model $content target Model
+     */
+    public static function convert($body, $content)
+    {
+        $class = new \ReflectionClass($body);
+        foreach ($class->getProperties(\ReflectionProperty::IS_PUBLIC) as $property) {
+            $name = $property->getName();
+            if (!$property->isStatic()) {
+                $value = $property->getValue($body);
+                if ($value instanceof StreamInterface) {
+                    continue;
+                }
+                $content->{$name} = $value;
+            }
+        }
+    }
+
+    /**
+     * Get the string to be signed according to request.
+     *
+     * @param Request $request which contains signed messages
+     *
+     * @return string the signed string
+     */
+    public static function getStringToSign($request)
+    {
+        $pathname = $request->pathname ?: '';
+        $query    = $request->query ?: [];
+
+        $accept      = isset($request->headers['accept']) ? $request->headers['accept'] : '';
+        $contentMD5  = isset($request->headers['content-md5']) ? $request->headers['content-md5'] : '';
+        $contentType = isset($request->headers['content-type']) ? $request->headers['content-type'] : '';
+        $date        = isset($request->headers['date']) ? $request->headers['date'] : '';
+
+        $result = $request->method . "\n" .
+            $accept . "\n" .
+            $contentMD5 . "\n" .
+            $contentType . "\n" .
+            $date . "\n";
+
+        $canonicalizedHeaders  = self::getCanonicalizedHeaders($request->headers);
+        $canonicalizedResource = self::getCanonicalizedResource($pathname, $query);
+
+        return $result . $canonicalizedHeaders . $canonicalizedResource;
+    }
+
+    /**
+     * Get signature according to stringToSign, secret.
+     *
+     * @param string $stringToSign the signed string
+     * @param string $secret       accesskey secret
+     *
+     * @return string the signature
+     */
+    public static function getROASignature($stringToSign, $secret)
+    {
+        return base64_encode(hash_hmac('sha1', $stringToSign, $secret, true));
+    }
+
+    /**
+     * Parse filter into a form string.
+     *
+     * @param array $filter object
+     *
+     * @return string the string
+     */
+    public static function toForm($filter)
+    {
+        $query = $filter;
+        if (null === $query) {
+            return '';
+        }
+        if ($query instanceof Model) {
+            $query = $query->toMap();
+        }
+        $tmp = [];
+        foreach ($query as $k => $v) {
+            if (0 !== strpos($k, '_')) {
+                $tmp[$k] = $v;
+            }
+        }
+        $res = self::flatten($tmp);
+        ksort($res);
+
+        return http_build_query($res);
+    }
+
+    /**
+     * Get timestamp.
+     *
+     * @return string the timestamp string
+     */
+    public static function getTimestamp()
+    {
+        return gmdate('Y-m-d\\TH:i:s\\Z');
+    }
+
+    /**
+     * Parse filter into a object which's type is map[string]string.
+     *
+     * @param array $filter query param
+     *
+     * @return array the object
+     */
+    public static function query($filter)
+    {
+        if (null === $filter) {
+            return [];
+        }
+        $dict = $filter;
+        if ($dict instanceof Model) {
+            $dict = $dict->toMap();
+        }
+        $tmp = [];
+        foreach ($dict as $k => $v) {
+            if (0 !== strpos($k, '_')) {
+                $tmp[$k] = $v;
+            }
+        }
+
+        return self::flatten($tmp);
+    }
+
+    /**
+     * Get signature according to signedParams, method and secret.
+     *
+     * @param array  $signedParams params which need to be signed
+     * @param string $method       http method e.g. GET
+     * @param string $secret       AccessKeySecret
+     *
+     * @return string the signature
+     */
+    public static function getRPCSignature($signedParams, $method, $secret)
+    {
+        $secret    .= '&';
+        $strToSign = self::getRpcStrToSign($method, $signedParams);
+
+        $signMethod = 'HMAC-SHA1';
+
+        return self::encode($signMethod, $strToSign, $secret);
+    }
+
+    /**
+     * Parse array into a string with specified style.
+     *
+     * @style specified style e.g. repeatList
+     *
+     * @param mixed  $array  the array
+     * @param string $prefix the prefix string
+     * @param string $style
+     *
+     * @return string the string
+     */
+    public static function arrayToStringWithSpecifiedStyle($array, $prefix, $style)
+    {
+        if (null === $array) {
+            return '';
+        }
+        if ('repeatList' === $style) {
+            return self::toForm([$prefix => $array]);
+        }
+        if ('simple' == $style || 'spaceDelimited' == $style || 'pipeDelimited' == $style) {
+            $strs = self::flatten($array);
+
+            switch ($style) {
+                case 'spaceDelimited':
+                    return implode(' ', $strs);
+
+                case 'pipeDelimited':
+                    return implode('|', $strs);
+
+                default:
+                    return implode(',', $strs);
+            }
+        } elseif ('json' === $style) {
+            return json_encode($array);
+        }
+
+        return '';
+    }
+
+    /**
+     * Transform input as array.
+     *
+     * @param mixed $input
+     *
+     * @return array
+     */
+    public static function parseToArray($input)
+    {
+        self::parse($input, $result);
+
+        return $result;
+    }
+
+    /**
+     * Transform input as map.
+     *
+     * @param mixed $input
+     *
+     * @return array
+     */
+    public static function parseToMap($input)
+    {
+        self::parse($input, $result);
+
+        return $result;
+    }
+
+    public static function getEndpoint($endpoint, $useAccelerate, $endpointType = 'public')
+    {
+        if ('internal' == $endpointType) {
+            $tmp      = explode('.', $endpoint);
+            $tmp[0]   .= '-internal';
+            $endpoint = implode('.', $tmp);
+        }
+        if ($useAccelerate && 'accelerate' == $endpointType) {
+            return 'oss-accelerate.aliyuncs.com';
+        }
+
+        return $endpoint;
+    }
+
+    /**
+     * Encode raw with base16.
+     *
+     * @param int[] $raw encoding data
+     *
+     * @return string encoded string
+     */
+    public static function hexEncode($raw)
+    {
+        if (is_array($raw)) {
+            $raw = Utils::toString($raw);
+        }
+        return bin2hex($raw);
+    }
+
+    /**
+     * Hash the raw data with signatureAlgorithm.
+     *
+     * @param int[]  $raw                hashing data
+     * @param string $signatureAlgorithm the autograph method
+     *
+     * @return array hashed bytes
+     */
+    public static function hash($raw, $signatureAlgorithm)
+    {
+        $str = Utils::toString($raw);
+
+        switch ($signatureAlgorithm) {
+            case 'ACS3-HMAC-SHA256':
+            case 'ACS3-RSA-SHA256':
+                $res = hash('sha256', $str, true);
+                return Utils::toBytes($res);
+            case 'ACS3-HMAC-SM3':
+                $res = self::sm3($str);
+                return Utils::toBytes(hex2bin($res));
+        }
+
+        return [];
+    }
+
+    /**
+     * Get the authorization.
+     *
+     * @param Request $request            request params
+     * @param string  $signatureAlgorithm the autograph method
+     * @param string  $payload            the hashed request
+     * @param string  $accesskey          the accessKey string
+     * @param string  $accessKeySecret    the accessKeySecret string
+     *
+     * @return string authorization string
+     * @throws \ErrorException
+     *
+     */
+    public static function getAuthorization($request, $signatureAlgorithm, $payload, $accesskey, $accessKeySecret)
+    {
+        $canonicalURI = $request->pathname ? $request->pathname : '/';
+        $query    = $request->query ?: [];
+        $method               = strtoupper($request->method);
+        $canonicalQueryString = self::getCanonicalQueryString($query);
+        $signHeaders          = [];
+        foreach ($request->headers as $k => $v) {
+            $k = strtolower($k);
+            if (0 === strpos($k, 'x-acs-') || 'host' === $k || 'content-type' === $k) {
+                $signHeaders[$k] = $v;
+            }
+        }
+        ksort($signHeaders);
+        $headers = [];
+        foreach ($request->headers as $k => $v) {
+            $k = strtolower($k);
+            if (0 === strpos($k, 'x-acs-') || 'host' === $k || 'content-type' === $k) {
+                $headers[$k] = trim($v);
+            }
+        }
+        $canonicalHeaderString = '';
+        ksort($headers);
+        foreach ($headers as $k => $v) {
+            $canonicalHeaderString .= $k . ':' . trim(self::filter($v)) . "\n";
+        }
+        if (empty($canonicalHeaderString)) {
+            $canonicalHeaderString = "\n";
+        }
+
+        $canonicalRequest = $method . "\n" . $canonicalURI . "\n" . $canonicalQueryString . "\n" .
+            $canonicalHeaderString . "\n" . implode(';', array_keys($signHeaders)) . "\n" . $payload;
+        $strtosign        = $signatureAlgorithm . "\n" . self::hexEncode(self::hash(Utils::toBytes($canonicalRequest), $signatureAlgorithm));
+        $signature        = self::sign($accessKeySecret, $strtosign, $signatureAlgorithm);
+        $signature        = self::hexEncode($signature);
+
+        return $signatureAlgorithm .
+            ' Credential=' . $accesskey .
+            ',SignedHeaders=' . implode(';', array_keys($signHeaders)) .
+            ',Signature=' . $signature;
+    }
+
+    public static function sign($secret, $str, $algorithm)
+    {
+        $result = '';
+        switch ($algorithm) {
+            case 'ACS3-HMAC-SHA256':
+                $result = hash_hmac('sha256', $str, $secret, true);
+                break;
+            case 'ACS3-HMAC-SM3':
+                $result = self::hmac_sm3($str, $secret, true);
+                break;
+            case 'ACS3-RSA-SHA256':
+                $privateKey = "-----BEGIN RSA PRIVATE KEY-----\n" . $secret . "\n-----END RSA PRIVATE KEY-----";
+                @openssl_sign($str, $result, $privateKey, OPENSSL_ALGO_SHA256);
+        }
+
+        return Utils::toBytes($result);
+    }
+
+    /**
+     * Get encoded path.
+     *
+     * @param string $path the raw path
+     *
+     * @return string encoded path
+     */
+    public static function getEncodePath($path)
+    {
+        $tmp = explode('/', $path);
+        foreach ($tmp as &$t) {
+            $t = rawurlencode($t);
+        }
+
+        return implode('/', $tmp);
+    }
+
+    /**
+     * Get encoded param.
+     *
+     * @param string $param the raw param
+     *
+     * @return string encoded param
+     */
+    public static function getEncodeParam($param)
+    {
+        return rawurlencode($param);
+    }
+
+    private static function getRpcStrToSign($method, $query)
+    {
+        ksort($query);
+
+        $params = [];
+        foreach ($query as $k => $v) {
+            if (null !== $v) {
+                $k = rawurlencode($k);
+                $v = rawurlencode($v);
+                $params[] = $k . '=' . (string)$v;
+            }
+        }
+        $str = implode('&', $params);
+
+        return $method . '&' . rawurlencode('/') . '&' . rawurlencode($str);
+    }
+
+    private static function encode($signMethod, $strToSign, $secret)
+    {
+        switch ($signMethod) {
+            case 'HMAC-SHA256':
+                return base64_encode(hash_hmac('sha256', $strToSign, $secret, true));
+
+            default:
+                return base64_encode(hash_hmac('sha1', $strToSign, $secret, true));
+        }
+    }
+
+    /**
+     * @param array  $items
+     * @param string $delimiter
+     * @param string $prepend
+     *
+     * @return array
+     */
+    private static function flatten($items = [], $delimiter = '.', $prepend = '')
+    {
+        $flatten = [];
+
+        foreach ($items as $key => $value) {
+            $pos = \is_int($key) ? $key + 1 : $key;
+            
+            if ($value instanceof Model) {
+                $value = $value->toMap();
+            } elseif (\is_object($value)) {
+                $value = get_object_vars($value);
+            }
+
+            if (\is_array($value) && !empty($value)) {
+                $flatten = array_merge(
+                    $flatten,
+                    self::flatten($value, $delimiter, $prepend . $pos . $delimiter)
+                );
+            } else {
+                $flatten[$prepend . $pos] = $value;
+            }
+        }
+
+        return $flatten;
+    }
+
+    private static function getCanonicalizedHeaders($headers, $prefix = 'x-acs-')
+    {
+        ksort($headers);
+        $str = '';
+        foreach ($headers as $k => $v) {
+            if (0 === strpos(strtolower($k), $prefix)) {
+                $str .= $k . ':' . trim(self::filter($v)) . "\n";
+            }
+        }
+
+        return $str;
+    }
+
+    private static function getCanonicalizedResource($pathname, $query)
+    {
+        if (0 === \count($query)) {
+            return $pathname;
+        }
+        ksort($query);
+        $tmp = [];
+        foreach ($query as $k => $v) {
+            if (!empty($v)) {
+                $tmp[] = $k . '=' . $v;
+            } else {
+                $tmp[] = $k;
+            }
+        }
+
+        return $pathname . '?' . implode('&', $tmp);
+    }
+
+    private static function parse($input, &$output)
+    {
+        if (null === $input || '' === $input) {
+            $output = [];
+        }
+        $recursive = function ($input) use (&$recursive) {
+            if ($input instanceof Model) {
+                $input = $input->toMap();
+            } elseif (\is_object($input)) {
+                $input = get_object_vars($input);
+            }
+            if (!\is_array($input)) {
+                return $input;
+            }
+            $data = [];
+            foreach ($input as $k => $v) {
+                $data[$k] = $recursive($v);
+            }
+
+            return $data;
+        };
+        $output    = $recursive($input);
+        if (!\is_array($output)) {
+            $output = [$output];
+        }
+    }
+
+    private static function filter($str)
+    {
+        return str_replace(["\t", "\n", "\r", "\f"], '', $str);
+    }
+
+    private static function hmac_sm3($data, $key, $raw_output = false)
+    {
+        $pack      = 'H' . \strlen(self::sm3('test'));
+        $blocksize = 64;
+        if (\strlen($key) > $blocksize) {
+            $key = pack($pack, self::sm3($key));
+        }
+        $key  = str_pad($key, $blocksize, \chr(0x00));
+        $ipad = $key ^ str_repeat(\chr(0x36), $blocksize);
+        $opad = $key ^ str_repeat(\chr(0x5C), $blocksize);
+        $hmac = self::sm3($opad . pack($pack, self::sm3($ipad . $data)));
+
+        return $raw_output ? pack($pack, $hmac) : $hmac;
+    }
+
+    private static function sm3($message)
+    {
+        return (new Sm3())->sign($message);
+    }
+
+    private static function getCanonicalQueryString($query)
+    {
+        ksort($query);
+
+        $params = [];
+        foreach ($query as $k => $v) {
+            if (null === $v) {
+                continue;
+            }
+            $str = rawurlencode($k);
+            if ('' !== $v && null !== $v) {
+                $str .= '=' . rawurlencode($v);
+            } else {
+                $str .= '=';
+            }
+            $params[] = $str;
+        }
+
+        return implode('&', $params);
+    }
+}

+ 375 - 0
vendor/alibabacloud/openapi-util/tests/OpenApiUtilClientTest.php

@@ -0,0 +1,375 @@
+<?php
+
+namespace AlibabaCloud\OpenApiUtil\Tests;
+
+use AlibabaCloud\OpenApiUtil\OpenApiUtilClient;
+use AlibabaCloud\Tea\Model;
+use AlibabaCloud\Tea\Request;
+use AlibabaCloud\Tea\Utils\Utils;
+use PHPUnit\Framework\TestCase;
+
+/**
+ * @internal
+ * @coversNothing
+ */
+class OpenApiUtilClientTest extends TestCase
+{
+    public function testConvert()
+    {
+        $model    = new MockModel();
+        $model->a = 'foo';
+
+        $output = new MockModel();
+        OpenApiUtilClient::convert($model, $output);
+        $this->assertEquals($model->a, $output->a);
+    }
+
+    public function testGetStringToSign()
+    {
+        $request                    = new Request();
+        $request->method            = 'GET';
+        $request->pathname          = '/';
+        $request->headers['accept'] = 'application/json';
+
+        $this->assertEquals("GET\napplication/json\n\n\n\n/", OpenApiUtilClient::getStringToSign($request));
+
+        $request->headers = [
+            'accept'       => 'application/json',
+            'content-md5'  => 'md5',
+            'content-type' => 'application/json',
+            'date'         => 'date',
+        ];
+        $this->assertEquals("GET\napplication/json\nmd5\napplication/json\ndate\n/", OpenApiUtilClient::getStringToSign($request));
+
+        $request->headers = [
+            'accept'           => 'application/json',
+            'content-md5'      => 'md5',
+            'content-type'     => 'application/json',
+            'date'             => 'date',
+            'x-acs-custom-key' => 'any value',
+        ];
+        $this->assertEquals("GET\napplication/json\nmd5\napplication/json\ndate\nx-acs-custom-key:any value\n/", OpenApiUtilClient::getStringToSign($request));
+
+        $request->query = [
+            'key' => 'val ue with space',
+        ];
+        $this->assertEquals("GET\napplication/json\nmd5\napplication/json\ndate\nx-acs-custom-key:any value\n/?key=val ue with space", OpenApiUtilClient::getStringToSign($request));
+    }
+
+    public function testGetROASignature()
+    {
+        $this->assertEquals('OmuTAr79tpI6CRoAdmzKRq5lHs0=', OpenApiUtilClient::getROASignature('stringtosign', 'secret'));
+    }
+
+    public function testToForm()
+    {
+        $this->assertEquals('client=test&strs.1=str1&strs.2=str2&tag.key=value', OpenApiUtilClient::toForm([
+            'client' => 'test',
+            'tag'    => [
+                'key' => 'value',
+            ],
+            'strs'   => ['str1', 'str2'],
+        ]));
+    }
+
+    public function testGetTimestamp()
+    {
+        $date = OpenApiUtilClient::getTimestamp();
+        $this->assertEquals(20, \strlen($date));
+    }
+
+    public function testQuery()
+    {
+        $model    = new MockModel();
+        $model->a = 'foo';
+        $model->c = 'boo';
+
+        $array = [
+            'a'  => 'a',
+            'b1' => [
+                'a' => 'a',
+            ],
+            'b2' => [
+                'a' => 'a',
+            ],
+            'c'  => ['x', 'y', 'z'],
+            'd' => [
+                $model
+            ]
+        ];
+        $this->assertEquals([
+            'a'    => 'a',
+            'b1.a' => 'a',
+            'b2.a' => 'a',
+            'c.1'  => 'x',
+            'c.2'  => 'y',
+            'c.3'  => 'z',
+            'd.1.A'  => 'foo',
+            'd.1.b'  => '',
+            'd.1.c'  => 'boo',
+        ], OpenApiUtilClient::query($array));
+    }
+
+    public function testGetRPCSignature()
+    {
+        $request           = new Request();
+        $request->pathname = '';
+        $request->query    = [
+            'query' => 'test',
+            'body'  => 'test',
+        ];
+        $this->assertEquals('XlUyV4sXjOuX5FnjUz9IF9tm5rU=', OpenApiUtilClient::getRPCSignature($request->query, $request->method, 'secret'));
+    }
+
+    public function testArrayToStringWithSpecifiedStyle()
+    {
+        $data = ['ok', 'test', 2, 3];
+        $this->assertEquals(
+            'instance.1=ok&instance.2=test&instance.3=2&instance.4=3',
+            OpenApiUtilClient::arrayToStringWithSpecifiedStyle(
+                $data,
+                'instance',
+                'repeatList'
+            )
+        );
+
+        $this->assertEquals(
+            '["ok","test",2,3]',
+            OpenApiUtilClient::arrayToStringWithSpecifiedStyle(
+                $data,
+                'instance',
+                'json'
+            )
+        );
+
+        $this->assertEquals(
+            'ok,test,2,3',
+            OpenApiUtilClient::arrayToStringWithSpecifiedStyle(
+                $data,
+                'instance',
+                'simple'
+            )
+        );
+
+        $this->assertEquals(
+            'ok test 2 3',
+            OpenApiUtilClient::arrayToStringWithSpecifiedStyle(
+                $data,
+                'instance',
+                'spaceDelimited'
+            )
+        );
+
+        $this->assertEquals(
+            'ok|test|2|3',
+            OpenApiUtilClient::arrayToStringWithSpecifiedStyle(
+                $data,
+                'instance',
+                'pipeDelimited'
+            )
+        );
+
+        $this->assertEquals(
+            '',
+            OpenApiUtilClient::arrayToStringWithSpecifiedStyle(
+                $data,
+                'instance',
+                'piDelimited'
+            )
+        );
+
+        $this->assertEquals(
+            '',
+            OpenApiUtilClient::arrayToStringWithSpecifiedStyle(
+                null,
+                'instance',
+                'pipeDelimited'
+            )
+        );
+    }
+
+    public function testParseToArray()
+    {
+        $test     = $this->parseData();
+        $data     = $test['data'];
+        $expected = $test['expected'];
+        foreach ($data as $index => $item) {
+            $this->assertEquals($expected[$index], OpenApiUtilClient::parseToArray($item));
+        }
+    }
+
+    public function testParseToMap()
+    {
+        $test     = $this->parseData();
+        $data     = $test['data'];
+        $expected = $test['expected'];
+        foreach ($data as $index => $item) {
+            $this->assertEquals($expected[$index], OpenApiUtilClient::parseToMap($item));
+        }
+    }
+
+    public function testGetEndpoint()
+    {
+        $endpoint      = 'ecs.cn-hangzhou.aliyun.cs.com';
+        $useAccelerate = false;
+        $endpointType  = 'public';
+
+        $this->assertEquals('ecs.cn-hangzhou.aliyun.cs.com', OpenApiUtilClient::getEndpoint($endpoint, $useAccelerate, $endpointType));
+
+        $endpointType = 'internal';
+        $this->assertEquals('ecs-internal.cn-hangzhou.aliyun.cs.com', OpenApiUtilClient::getEndpoint($endpoint, $useAccelerate, $endpointType));
+
+        $useAccelerate = true;
+        $endpointType  = 'accelerate';
+        $this->assertEquals('oss-accelerate.aliyuncs.com', OpenApiUtilClient::getEndpoint($endpoint, $useAccelerate, $endpointType));
+    }
+
+    public function testHexEncode()
+    {
+        $data = OpenApiUtilClient::hash(Utils::toBytes('test'), 'ACS3-HMAC-SHA256');
+        $this->assertEquals(
+            Utils::toBytes(hex2bin('9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08')),
+            $data
+        );
+
+        $data = OpenApiUtilClient::hash(Utils::toBytes('test'), 'ACS3-RSA-SHA256');
+        $this->assertEquals(
+            Utils::toBytes(hex2bin('9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08')),
+            $data
+        );
+
+        $data = OpenApiUtilClient::hash(Utils::toBytes('test'), 'ACS3-HMAC-SM3');
+        $this->assertEquals(
+            Utils::toBytes(hex2bin('55e12e91650d2fec56ec74e1d3e4ddbfce2ef3a65890c2a19ecf88a307e76a23')),
+            $data
+        );
+
+        $data = OpenApiUtilClient::hash(Utils::toBytes('test'), 'ACS3-HM-SHA256');
+        $this->assertEquals('', Utils::toString($data));
+    }
+
+    public function testGetEncodePath()
+    {
+        $this->assertEquals(
+            '/path/%20test',
+            OpenApiUtilClient::getEncodePath('/path/ test')
+        );
+    }
+
+    public function testGetEncodeParam()
+    {
+        $this->assertEquals(
+            'a%2Fb%2Fc%2F%20test',
+            OpenApiUtilClient::getEncodeParam('a/b/c/ test')
+        );
+    }
+
+    public function testGetAuthorization()
+    {
+        $request           = new Request();
+        $request->method   = '';
+        $request->pathname = '';
+        $request->query    = [
+            'test'  => 'ok',
+            'empty' => '',
+        ];
+        $request->headers  = [
+            'x-acs-test' => 'http',
+            'x-acs-TEST' => 'https',
+        ];
+
+        $res = OpenApiUtilClient::getAuthorization($request, 'ACS3-HMAC-SHA256', '55e12e91650d2fec56ec74e1d3e4ddbfce2ef3a65890c2a19ecf88a307e76a23', 'acesskey', 'secret');
+
+        $this->assertEquals('ACS3-HMAC-SHA256 Credential=acesskey,SignedHeaders=x-acs-test,Signature=0a0f89a45f1ec3537a2d1a1046c71b95513a8f1f02526056968da19b99a5b914', $res);
+
+        $request->query = null;
+
+        $res = OpenApiUtilClient::getAuthorization($request, 'ACS3-HMAC-SHA256', '55e12e91650d2fec56ec74e1d3e4ddbfce2ef3a65890c2a19ecf88a307e76a23', 'acesskey', 'secret');
+
+        $this->assertEquals('ACS3-HMAC-SHA256 Credential=acesskey,SignedHeaders=x-acs-test,Signature=af6d32deb090ae85a21d7183055cf18dca17751da96979cdf964f8f0853e9dd2', $res);
+    }
+
+    public function testSign()
+    {
+        $this->assertEquals(
+            'b9ff646822f41ef647c1416fa2b8408923828abc0464af6706e18db3e8553da8',
+            OpenApiUtilClient::hexEncode(OpenApiUtilClient::sign('secret', 'source', 'ACS3-HMAC-SM3'))
+        );
+        $this->assertEquals('1d93c62698a1c26427265668e79fac099aa26c1df873669599a2fb2f272e64c9',
+            OpenApiUtilClient::hexEncode(OpenApiUtilClient::sign('secret', 'source', 'ACS3-HMAC-SHA256'))
+        );
+    }
+
+    private function parseData()
+    {
+        return [
+            'data'     => [
+                'NotArray',
+                new ParseModel([
+                    'str'   => 'A',
+                    'model' => new ParseModel(['str' => 'sub model']),
+                    'array' => [1, 2, 3],
+                ]),
+                [ // model item in array
+                  new ParseModel([
+                      'str' => 'A',
+                  ]),
+                ],
+                [ // model item in map
+                  'model' => new ParseModel([
+                      'str' => 'A',
+                  ]),
+                ],
+            ],
+            'expected' => [
+                ['NotArray'],
+                [
+                    'str'   => 'A',
+                    'model' => [
+                        'str'   => 'sub model',
+                        'model' => null,
+                        'array' => null,
+                    ],
+                    'array' => [1, 2, 3],
+                ],
+                [
+                    [
+                        'str'   => 'A',
+                        'model' => null,
+                        'array' => null,
+                    ],
+                ],
+                [
+                    'model' => [
+                        'str'   => 'A',
+                        'model' => null,
+                        'array' => null,
+                    ],
+                ],
+            ],
+        ];
+    }
+}
+
+class MockModel extends Model
+{
+    public $a = 'A';
+
+    public $b = '';
+
+    public $c = '';
+
+    public function __construct()
+    {
+        $this->_name['a']     = 'A';
+        $this->_required['c'] = true;
+        parent::__construct([]);
+    }
+}
+
+class ParseModel extends Model
+{
+    public $str;
+    public $model;
+    public $array;
+}

+ 3 - 0
vendor/alibabacloud/openapi-util/tests/bootstrap.php

@@ -0,0 +1,3 @@
+<?php
+
+require dirname(__DIR__) . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';

+ 3 - 0
vendor/alibabacloud/tea-utils/.gitignore

@@ -0,0 +1,3 @@
+vendor/
+composer.lock
+.php_cs.cache

+ 65 - 0
vendor/alibabacloud/tea-utils/.php_cs.dist

@@ -0,0 +1,65 @@
+<?php
+/*
+ * This document has been generated with
+ * https://mlocati.github.io/php-cs-fixer-configurator/#version:2.15|configurator
+ * you can change this configuration by importing this file.
+ */
+
+return PhpCsFixer\Config::create()
+    ->setRiskyAllowed(true)
+    ->setIndent('    ')
+    ->setRules([
+        '@PSR2'                                       => true,
+        '@PhpCsFixer'                                 => true,
+        '@Symfony:risky'                              => true,
+        'concat_space'                                => ['spacing' => 'one'],
+        'array_syntax'                                => ['syntax' => 'short'],
+        'array_indentation'                           => true,
+        'combine_consecutive_unsets'                  => true,
+        'method_separation'                           => true,
+        'single_quote'                                => true,
+        'declare_equal_normalize'                     => true,
+        'function_typehint_space'                     => true,
+        'hash_to_slash_comment'                       => true,
+        'include'                                     => true,
+        'lowercase_cast'                              => true,
+        'no_multiline_whitespace_before_semicolons'   => true,
+        'no_leading_import_slash'                     => true,
+        'no_multiline_whitespace_around_double_arrow' => true,
+        'no_spaces_around_offset'                     => true,
+        'no_unneeded_control_parentheses'             => true,
+        'no_unused_imports'                           => true,
+        'no_whitespace_before_comma_in_array'         => true,
+        'no_whitespace_in_blank_line'                 => true,
+        'object_operator_without_whitespace'          => true,
+        'single_blank_line_before_namespace'          => true,
+        'single_class_element_per_statement'          => true,
+        'space_after_semicolon'                       => true,
+        'standardize_not_equals'                      => true,
+        'ternary_operator_spaces'                     => true,
+        'trailing_comma_in_multiline_array'           => true,
+        'trim_array_spaces'                           => true,
+        'unary_operator_spaces'                       => true,
+        'whitespace_after_comma_in_array'             => true,
+        'no_extra_consecutive_blank_lines'            => [
+            'curly_brace_block',
+            'extra',
+            'parenthesis_brace_block',
+            'square_brace_block',
+            'throw',
+            'use',
+        ],
+        'binary_operator_spaces'       => [
+            'align_double_arrow' => true,
+            'align_equals'       => true,
+        ],
+        'braces'                                    => [
+            'allow_single_line_closure' => true,
+        ],
+    ])
+    ->setFinder(
+        PhpCsFixer\Finder::create()
+            ->exclude('vendor')
+            ->exclude('tests')
+            ->in(__DIR__)
+  );

+ 31 - 0
vendor/alibabacloud/tea-utils/README-CN.md

@@ -0,0 +1,31 @@
+English | [简体中文](README-CN.md)
+
+![](https://aliyunsdk-pages.alicdn.com/icons/AlibabaCloud.svg)
+
+## Alibaba Cloud Tea Util for PHP
+
+## Installation
+
+### Composer
+
+```bash
+composer require alibabacloud/tea-utils
+```
+
+## Issues
+
+[Opening an Issue](https://github.com/aliyun/tea-util/issues/new), Issues not conforming to the guidelines may be closed immediately.
+
+## Changelog
+
+Detailed changes for each release are documented in the [release notes](./ChangeLog.txt).
+
+## References
+
+* [Latest Release](https://github.com/aliyun/tea-util)
+
+## License
+
+[Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0)
+
+Copyright (c) 2009-present, Alibaba Cloud All rights reserved.

+ 31 - 0
vendor/alibabacloud/tea-utils/README.md

@@ -0,0 +1,31 @@
+[English](README.md) | 简体中文
+
+![](https://aliyunsdk-pages.alicdn.com/icons/AlibabaCloud.svg)
+
+## Alibaba Cloud Tea Util for PHP
+
+## 安装
+
+### Composer
+
+```bash
+composer require alibabacloud/tea-utils
+```
+
+## 问题
+
+[提交 Issue](https://github.com/aliyun/tea-util/issues/new),不符合指南的问题可能会立即关闭。
+
+## 发行说明
+
+每个版本的详细更改记录在[发行说明](./ChangeLog.txt)中。
+
+## 相关
+
+* [最新源码](https://github.com/aliyun/tea-util)
+
+## 许可证
+
+[Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0)
+
+Copyright (c) 2009-present, Alibaba Cloud All rights reserved.

+ 38 - 0
vendor/alibabacloud/tea-utils/composer.json

@@ -0,0 +1,38 @@
+{
+  "name": "alibabacloud/tea-utils",
+  "description": "Alibaba Cloud Tea Utils for PHP",
+  "type": "library",
+  "license": "Apache-2.0",
+  "authors": [
+    {
+      "name": "Alibaba Cloud SDK",
+      "email": "sdk-team@alibabacloud.com"
+    }
+  ],
+  "support": {
+    "source": "https://github.com/aliyun/tea-util",
+    "issues": "https://github.com/aliyun/tea-util/issues"
+  },
+  "require": {
+    "php": ">5.5",
+    "alibabacloud/tea": "^3.1"
+  },
+  "autoload": {
+    "psr-4": {
+      "AlibabaCloud\\Tea\\Utils\\": "src"
+    }
+  },
+  "autoload-dev": {
+    "psr-4": {
+      "AlibabaCloud\\Tea\\Utils\\Tests\\": "tests"
+    }
+  },
+  "scripts": {
+    "fixer": "php-cs-fixer fix ./",
+    "test": [
+      "@clearCache",
+      "./vendor/bin/phpunit --colors=always"
+    ],
+    "clearCache": "rm -rf cache/*"
+  }
+}

+ 15 - 0
vendor/alibabacloud/tea-utils/phpunit.xml

@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<phpunit backupGlobals="false" backupStaticAttributes="false" bootstrap="tests/bootstrap.php" colors="true"
+         convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true"
+         executionOrder="depends,defects" processIsolation="false" stopOnFailure="false">
+    <logging>
+        <log type="coverage-html" target="cache/coverage" lowUpperBound="35" highLowerBound="70"/>
+        <log type="coverage-clover" target="cache/coverage.clover"/>
+    </logging>
+
+    <testsuites>
+        <testsuite name="default">
+            <directory suffix="Test.php">tests</directory>
+        </testsuite>
+    </testsuites>
+</phpunit>

+ 581 - 0
vendor/alibabacloud/tea-utils/src/Utils.php

@@ -0,0 +1,581 @@
+<?php
+
+namespace AlibabaCloud\Tea\Utils;
+
+use AlibabaCloud\Tea\Model;
+use GuzzleHttp\Psr7\Stream;
+use Psr\Http\Message\StreamInterface;
+
+class Utils
+{
+    private static $defaultUserAgent = '';
+
+    /**
+     * Convert a string(utf8) to bytes.
+     *
+     * @param string $string
+     *
+     * @return array the return bytes
+     */
+    public static function toBytes($string)
+    {
+        $bytes = [];
+        for ($i = 0; $i < \strlen($string); ++$i) {
+            $bytes[] = \ord($string[$i]);
+        }
+
+        return $bytes;
+    }
+
+    /**
+     * Convert a bytes to string(utf8).
+     *
+     * @param array $bytes
+     *
+     * @return string the return string
+     */
+    public static function toString($bytes)
+    {
+        $str = '';
+        foreach ($bytes as $ch) {
+            $str .= \chr($ch);
+        }
+
+        return $str;
+    }
+
+    /**
+     * Parse it by JSON format.
+     *
+     * @param string $jsonString
+     *
+     * @return array the parsed result
+     */
+    public static function parseJSON($jsonString)
+    {
+        return json_decode($jsonString, true);
+    }
+
+    /**
+     * Read data from a readable stream, and compose it to a bytes.
+     *
+     * @param StreamInterface $stream the readable stream
+     *
+     * @return array the bytes result
+     */
+    public static function readAsBytes($stream)
+    {
+        $str = self::readAsString($stream);
+
+        return self::toBytes($str);
+    }
+
+    /**
+     * Read data from a readable stream, and compose it to a string.
+     *
+     * @param StreamInterface $stream the readable stream
+     *
+     * @return string the string result
+     */
+    public static function readAsString($stream)
+    {
+        if ($stream->isSeekable()) {
+            $stream->rewind();
+        }
+
+        return $stream->getContents();
+    }
+
+    /**
+     * Read data from a readable stream, and parse it by JSON format.
+     *
+     * @param StreamInterface $stream the readable stream
+     *
+     * @return array the parsed result
+     */
+    public static function readAsJSON($stream)
+    {
+        return self::parseJSON(self::readAsString($stream));
+    }
+
+    /**
+     * Generate a nonce string.
+     *
+     * @return string the nonce string
+     */
+    public static function getNonce()
+    {
+        return md5(uniqid() . uniqid(md5(microtime(true)), true));
+    }
+
+    /**
+     * Get an UTC format string by current date, e.g. 'Thu, 06 Feb 2020 07:32:54 GMT'.
+     *
+     * @return string the UTC format string
+     */
+    public static function getDateUTCString()
+    {
+        return gmdate('D, d M Y H:i:s T');
+    }
+
+    /**
+     * If not set the real, use default value.
+     *
+     * @param string $real
+     * @param string $default
+     *
+     * @return string
+     */
+    public static function defaultString($real, $default = '')
+    {
+        return null === $real ? $default : $real;
+    }
+
+    /**
+     * If not set the real, use default value.
+     *
+     * @param int $real
+     * @param int $default
+     *
+     * @return int the return number
+     */
+    public static function defaultNumber($real, $default = 0)
+    {
+        if (null === $real) {
+            return $default;
+        }
+
+        return (int) $real;
+    }
+
+    /**
+     * Format a map to form string, like a=a%20b%20c.
+     *
+     * @param array|object $query
+     *
+     * @return string the form string
+     */
+    public static function toFormString($query)
+    {
+        if (null === $query) {
+            return '';
+        }
+
+        if (\is_object($query)) {
+            $query = json_decode(self::toJSONString($query), true);
+        }
+
+        return str_replace('+', '%20', http_build_query($query));
+    }
+
+    /**
+     * If not set the real, use default value.
+     *
+     * @param array|Model $object
+     *
+     * @return string the return string
+     */
+    public static function toJSONString($object)
+    {
+        if (is_string($object)) {
+            return $object;
+        }
+
+        if ($object instanceof Model) {
+            $object = $object->toMap();
+        }
+
+        return json_encode($object);
+    }
+
+    /**
+     * Check the string is empty?
+     *
+     * @param string $val
+     *
+     * @return bool if string is null or zero length, return true
+     *
+     * @deprecated
+     */
+    public static function _empty($val)
+    {
+        return empty($val);
+    }
+
+    /**
+     * Check the string is empty?
+     *
+     * @param string $val
+     *
+     * @return bool if string is null or zero length, return true
+     *
+     * @deprecated
+     */
+    public static function emptyWithSuffix($val)
+    {
+        return empty($val);
+    }
+
+    /**
+     * Check the string is empty?
+     *
+     * @param string $val
+     *
+     * @return bool if string is null or zero length, return true
+     */
+    public static function empty_($val)
+    {
+        return empty($val);
+    }
+
+    /**
+     * Check one string equals another one?
+     *
+     * @param int $left
+     * @param int $right
+     *
+     * @return bool if equals, return true
+     */
+    public static function equalString($left, $right)
+    {
+        return $left === $right;
+    }
+
+    /**
+     * Check one number equals another one?
+     *
+     * @param int $left
+     * @param int $right
+     *
+     * @return bool if equals, return true
+     */
+    public static function equalNumber($left, $right)
+    {
+        return $left === $right;
+    }
+
+    /**
+     * Check one value is unset.
+     *
+     * @param mixed $value
+     *
+     * @return bool if unset, return true
+     */
+    public static function isUnset(&$value = null)
+    {
+        return !isset($value) || null === $value;
+    }
+
+    /**
+     * Stringify the value of map.
+     *
+     * @param array $map
+     *
+     * @return array the new stringified map
+     */
+    public static function stringifyMapValue($map)
+    {
+        if (null === $map) {
+            return [];
+        }
+        foreach ($map as &$node) {
+            if (is_numeric($node)) {
+                $node = (string) $node;
+            } elseif (null === $node) {
+                $node = '';
+            } elseif (\is_bool($node)) {
+                $node = true === $node ? 'true' : 'false';
+            } elseif (\is_object($node)) {
+                $node = json_decode(json_encode($node), true);
+            }
+        }
+
+        return $map;
+    }
+
+    /**
+     * Anyify the value of map.
+     *
+     * @param array $m
+     *
+     * @return array the new anyfied map
+     */
+    public static function anyifyMapValue($m)
+    {
+        return $m;
+    }
+
+    /**
+     * Assert a value, if it is a boolean, return it, otherwise throws.
+     *
+     * @param mixed $value
+     *
+     * @return bool the boolean value
+     */
+    public static function assertAsBoolean($value)
+    {
+        if (\is_bool($value)) {
+            return $value;
+        }
+
+        throw new \InvalidArgumentException('It is not a boolean value.');
+    }
+
+    /**
+     * Assert a value, if it is a string, return it, otherwise throws.
+     *
+     * @param mixed $value
+     *
+     * @return string the string value
+     */
+    public static function assertAsString($value)
+    {
+        if (\is_string($value)) {
+            return $value;
+        }
+
+        throw new \InvalidArgumentException('It is not a string value.');
+    }
+
+    private static function is_bytes($value)
+    {
+        if (!\is_array($value)) {
+            return false;
+        }
+        $i = 0;
+        foreach ($value as $k => $ord) {
+            if ($k !== $i) {
+                return false;
+            }
+            if (!\is_int($ord)) {
+                return false;
+            }
+            if ($ord < 0 || $ord > 255) {
+                return false;
+            }
+            ++$i;
+        }
+
+        return true;
+    }
+
+    /**
+     * Assert a value, if it is a bytes, return it, otherwise throws.
+     *
+     * @param mixed $value
+     *
+     * @return bytes the bytes value
+     */
+    public static function assertAsBytes($value)
+    {
+        if (self::is_bytes($value)) {
+            return $value;
+        }
+
+        throw new \InvalidArgumentException('It is not a bytes value.');
+    }
+
+    /**
+     * Assert a value, if it is a number, return it, otherwise throws.
+     *
+     * @param mixed $value
+     *
+     * @return bool the number value
+     */
+    public static function assertAsNumber($value)
+    {
+        if (\is_numeric($value)) {
+            return $value;
+        }
+
+        throw new \InvalidArgumentException('It is not a number value.');
+    }
+
+    /**
+     * Assert a value, if it is a map, return it, otherwise throws.
+     *
+     * @param $any
+     *
+     * @return array the map value
+     */
+    public static function assertAsMap($any)
+    {
+        if (\is_array($any)) {
+            return $any;
+        }
+
+        throw new \InvalidArgumentException('It is not a map value.');
+    }
+
+    public static function assertAsArray($any){
+        if (\is_array($any)) {
+            return $any;
+        }
+
+        throw new \InvalidArgumentException('It is not a array value.');
+    }
+
+    /**
+     * Get user agent, if it userAgent is not null, splice it with defaultUserAgent and return, otherwise return
+     * defaultUserAgent.
+     *
+     * @param string $userAgent
+     *
+     * @return string the string value
+     */
+    public static function getUserAgent($userAgent = '')
+    {
+        if (empty(self::$defaultUserAgent)) {
+            self::$defaultUserAgent = sprintf('AlibabaCloud (%s; %s) PHP/%s Core/3.1 TeaDSL/1', PHP_OS, \PHP_SAPI, PHP_VERSION);
+        }
+        if (!empty($userAgent)) {
+            return self::$defaultUserAgent . ' ' . $userAgent;
+        }
+
+        return self::$defaultUserAgent;
+    }
+
+    /**
+     * If the code between 200 and 300, return true, or return false.
+     *
+     * @param int $code
+     *
+     * @return bool
+     */
+    public static function is2xx($code)
+    {
+        return $code >= 200 && $code < 300;
+    }
+
+    /**
+     * If the code between 300 and 400, return true, or return false.
+     *
+     * @param int $code
+     *
+     * @return bool
+     */
+    public static function is3xx($code)
+    {
+        return $code >= 300 && $code < 400;
+    }
+
+    /**
+     * If the code between 400 and 500, return true, or return false.
+     *
+     * @param int $code
+     *
+     * @return bool
+     */
+    public static function is4xx($code)
+    {
+        return $code >= 400 && $code < 500;
+    }
+
+    /**
+     * If the code between 500 and 600, return true, or return false.
+     *
+     * @param int $code
+     *
+     * @return bool
+     */
+    public static function is5xx($code)
+    {
+        return $code >= 500 && $code < 600;
+    }
+
+    /**
+     * Validate model.
+     *
+     * @param Model $model
+     */
+    public static function validateModel($model)
+    {
+        if (null !== $model) {
+            $model->validate();
+        }
+    }
+
+    /**
+     * Model transforms to map[string]any.
+     *
+     * @param Model $model
+     *
+     * @return array
+     */
+    public static function toMap($model)
+    {
+        if (null === $model) {
+            return [];
+        }
+        $map   = $model->toMap();
+        $names = $model->getName();
+        $vars  = get_object_vars($model);
+        foreach ($vars as $k => $v) {
+            if (false !== strpos($k, 'Shrink') && !isset($names[$k])) {
+                // A field that has the suffix `Shrink` and is not a Model class property.
+                $targetKey = ucfirst(substr($k, 0, \strlen($k) - 6));
+                if (isset($map[$targetKey])) {
+                    // $targetKey exists in $map.
+                    $map[$targetKey] = $v;
+                }
+            }
+        }
+
+        return $map;
+    }
+
+    /**
+     * Suspends the current thread for the specified number of milliseconds.
+     *
+     * @param int $millisecond
+     */
+    public static function sleep($millisecond)
+    {
+        usleep($millisecond * 1000);
+    }
+
+    /**
+     * Transform input as array.
+     *
+     * @param mixed $input
+     *
+     * @return array
+     */
+    public static function toArray($input)
+    {
+        if (\is_array($input)) {
+            foreach ($input as $k => &$v) {
+                $v = self::toArray($v);
+            }
+        } elseif ($input instanceof Model) {
+            $input = $input->toMap();
+            foreach ($input as $k => &$v) {
+                $v = self::toArray($v);
+            }
+        }
+
+        return $input;
+    }
+
+    /**
+     * Assert a value, if it is a readable, return it, otherwise throws.
+     *
+     * @param mixed $value
+     *
+     * @return Stream the readable value
+     */
+    public static function assertAsReadable($value)
+    {
+        if (\is_string($value)) {
+            return new Stream(
+                fopen('data://text/plain;base64,' .
+                    base64_encode($value), 'r')
+            );
+        }
+        if ($value instanceof Stream) {
+            return $value;
+        }
+
+        throw new \InvalidArgumentException('It is not a stream value.');
+    }
+}

+ 41 - 0
vendor/alibabacloud/tea-utils/src/Utils/RuntimeOptions.php

@@ -0,0 +1,41 @@
+<?php
+
+// This file is auto-generated, don't edit it. Thanks.
+
+namespace AlibabaCloud\Tea\Utils\Utils;
+
+use AlibabaCloud\Tea\Model;
+
+class RuntimeOptions extends Model
+{
+    public $autoretry;
+
+    public $ignoreSSL;
+
+    public $maxAttempts;
+
+    public $backoffPolicy;
+
+    public $backoffPeriod;
+
+    public $readTimeout;
+
+    public $connectTimeout;
+
+    public $httpProxy;
+
+    public $httpsProxy;
+
+    public $noProxy;
+
+    public $maxIdleConns;
+
+    public $localAddr;
+
+    public $socks5Proxy;
+
+    public $socks5NetWork;
+
+    public $keepAlive;
+    protected $_name = [];
+}

+ 480 - 0
vendor/alibabacloud/tea-utils/tests/UtilsTest.php

@@ -0,0 +1,480 @@
+<?php
+
+namespace AlibabaCloud\Tea\Utils\Tests;
+
+use AlibabaCloud\Tea\Model;
+use AlibabaCloud\Tea\Utils\Utils;
+use GuzzleHttp\Psr7\Stream;
+use PHPUnit\Framework\TestCase;
+use Psr\Http\Message\StreamInterface;
+
+/**
+ * @internal
+ * @coversNothing
+ */
+final class UtilsTest extends TestCase
+{
+    public function getStream()
+    {
+        return new Stream(fopen('http://httpbin.org/get', 'r'));
+    }
+
+    public function testToBytes()
+    {
+        $this->assertEquals([
+            115, 116, 114, 105, 110, 103,
+        ], Utils::toBytes('string'));
+    }
+
+    public function testToString()
+    {
+        $this->assertEquals('string', Utils::toString([
+            115, 116, 114, 105, 110, 103,
+        ]));
+    }
+
+    public function testParseJSON()
+    {
+        $this->assertEquals([
+            'a' => 'b',
+        ], Utils::parseJSON('{"a":"b"}'));
+    }
+
+    public function testReadAsBytes()
+    {
+        $bytes = Utils::readAsBytes($this->getStream());
+        $this->assertEquals(123, $bytes[0]);
+    }
+
+    public function testReadAsString()
+    {
+        $string = Utils::readAsString($this->getStream());
+        $this->assertEquals($string[0], '{');
+    }
+
+    public function testReadAsJSON()
+    {
+        $result = Utils::readAsJSON($this->getStream());
+        $this->assertEquals('http://httpbin.org/get', $result['url']);
+    }
+
+    public function testGetNonce()
+    {
+        $nonce1 = Utils::getNonce();
+        $nonce2 = Utils::getNonce();
+
+        $this->assertNotEquals($nonce1, $nonce2);
+    }
+
+    public function testGetDateUTCString()
+    {
+        $gmdate = Utils::getDateUTCString();
+        $now    = time();
+        $this->assertTrue(abs($now - strtotime($gmdate)) <= 1);
+    }
+
+    public function testDefaultString()
+    {
+        $this->assertEquals('', Utils::defaultString(null));
+        $this->assertEquals('default', Utils::defaultString(null, 'default'));
+        $this->assertEquals('real', Utils::defaultString('real', 'default'));
+    }
+
+    public function testDefaultNumber()
+    {
+        $this->assertEquals(0, Utils::defaultNumber(null));
+        $this->assertEquals(0, Utils::defaultNumber(0, 3));
+        $this->assertEquals(404, Utils::defaultNumber(null, 404));
+        $this->assertEquals(200, Utils::defaultNumber(200, 404));
+    }
+
+    public function testToFormString()
+    {
+        $query = [
+            'foo'            => 'bar',
+            'empty'          => '',
+            'a'              => null,
+            'withWhiteSpace' => 'a b',
+        ];
+        $this->assertEquals('foo=bar&empty=&withWhiteSpace=a%20b', Utils::toFormString($query));
+
+        $object = json_decode(json_encode($query));
+        $this->assertEquals('foo=bar&empty=&withWhiteSpace=a%20b', Utils::toFormString($object));
+    }
+
+    public function testToJSONString()
+    {
+        $object = new \stdClass();
+        $this->assertJson(Utils::toJSONString($object));
+        $this->assertEquals('[]', Utils::toJSONString([]));
+        $this->assertEquals('["foo"]', Utils::toJSONString(['foo']));
+        $this->assertEquals('{"str":"test","number":1,"bool":false,"null":null}', Utils::toJSONString([
+            'str'            => 'test',
+            'number'         => 1,
+            'bool'           => FALSE,
+            'null'           => null,
+        ]));
+        $this->assertEquals('1', Utils::toJSONString(1));
+        $this->assertEquals('true', Utils::toJSONString(TRUE));
+        $this->assertEquals('null', Utils::toJSONString(null));
+    }
+
+    public function testEmpty()
+    {
+        $this->assertTrue(Utils::_empty(''));
+        $this->assertFalse(Utils::_empty('not empty'));
+    }
+
+    public function testEqualString()
+    {
+        $this->assertTrue(Utils::equalString('a', 'a'));
+        $this->assertFalse(Utils::equalString('a', 'b'));
+    }
+
+    public function testEqualNumber()
+    {
+        $this->assertTrue(Utils::equalNumber(1, 1));
+        $this->assertFalse(Utils::equalNumber(1, 2));
+    }
+
+    public function testIsUnset()
+    {
+        $this->assertTrue(Utils::isUnset($a));
+        $b = 1;
+        $this->assertFalse(Utils::isUnset($b));
+    }
+
+    public function testStringifyMapValue()
+    {
+        $this->assertEquals([], Utils::stringifyMapValue(null));
+        $this->assertEquals([
+            'foo'    => 'bar',
+            'null'   => '',
+            'true'   => 'true',
+            'false'  => 'false',
+            'number' => '1000',
+        ], Utils::stringifyMapValue([
+            'foo'    => 'bar',
+            'null'   => null,
+            'true'   => true,
+            'false'  => false,
+            'number' => 1000,
+        ]));
+    }
+
+    public function testAnyifyMapValue()
+    {
+        $this->assertEquals([
+            'foo'    => 'bar',
+            'null'   => null,
+            'true'   => true,
+            'false'  => false,
+            'number' => 1000,
+        ], Utils::anyifyMapValue([
+            'foo'    => 'bar',
+            'null'   => null,
+            'true'   => true,
+            'false'  => false,
+            'number' => 1000,
+        ]));
+    }
+
+    public function testAssertAsBoolean()
+    {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionMessage('It is not a boolean value.');
+        Utils::assertAsBoolean('true');
+
+        try {
+            $map = true;
+            $this->assertEquals($map, Utils::assertAsBoolean($map));
+        } catch (\Exception $e) {
+            // should not be here
+            $this->assertTrue(false);
+        }
+    }
+
+    public function testAssertAsString()
+    {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionMessage('It is not a string value.');
+        Utils::assertAsString(123);
+
+        try {
+            $map = '123';
+            $this->assertEquals($map, Utils::assertAsString($map));
+        } catch (\Exception $e) {
+            // should not be here
+            $this->assertTrue(false);
+        }
+    }
+
+    public function testAssertAsBytes()
+    {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionMessage('It is not a bytes value.');
+        // failed because $var is not array
+        Utils::assertAsBytes('test');
+        // failed because $var is map not array
+        Utils::assertAsBytes(['foo' => 1]);
+        // failed because item value is not int
+        Utils::assertAsBytes(['1']);
+        // failed because item value is out off range
+        Utils::assertAsBytes([256]);
+
+        try {
+            // success
+            $map = [1, 2, 3];
+            $this->assertEquals($map, Utils::assertAsBytes($map));
+            $this->assertEquals([
+                115, 116, 114, 105, 110, 103,
+            ], Utils::assertAsBytes(Utils::toBytes('string')));
+        } catch (\Exception $e) {
+            // should not be here
+            $this->assertTrue(false);
+        }
+    }
+
+    public function testAssertAsNumber()
+    {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionMessage('It is not a number value.');
+        Utils::assertAsNumber('is not number');
+
+        try {
+            $map = 123;
+            $this->assertEquals($map, Utils::assertAsNumber($map));
+        } catch (\Exception $e) {
+            // should not be here
+            $this->assertTrue(false);
+        }
+    }
+
+    public function testAssertAsMap()
+    {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionMessage('It is not a map value.');
+        Utils::assertAsMap('is not array');
+
+        try {
+            $map = ['foo' => 'bar'];
+            $this->assertEquals($map, Utils::assertAsMap($map));
+        } catch (\Exception $e) {
+            // should not be here
+            $this->assertTrue(false);
+        }
+    }
+
+    public function testAssertAsArray()
+    {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionMessage('It is not a array value.');
+        Utils::assertAsArray('is not array');
+
+        try {
+            $map = ['foo'];
+            $this->assertEquals($map, Utils::assertAsArray($map));
+        } catch (\Exception $e) {
+            // should not be here
+            $this->assertTrue(false);
+        }
+    }
+
+    public function testGetUserAgent()
+    {
+        $this->assertTrue(false !== strpos(Utils::getUserAgent('CustomUserAgent'), 'CustomUserAgent'));
+    }
+
+    public function testIs2xx()
+    {
+        $this->assertTrue(Utils::is2xx(200));
+        $this->assertFalse(Utils::is2xx(300));
+    }
+
+    public function testIs3xx()
+    {
+        $this->assertTrue(Utils::is3xx(300));
+        $this->assertFalse(Utils::is3xx(400));
+    }
+
+    public function testIs4xx()
+    {
+        $this->assertTrue(Utils::is4xx(400));
+        $this->assertFalse(Utils::is4xx(500));
+    }
+
+    public function testIs5xx()
+    {
+        $this->assertTrue(Utils::is5xx(500));
+        $this->assertFalse(Utils::is5xx(600));
+    }
+
+    public function testToMap()
+    {
+        $from        = new RequestTest();
+        $from->query = new RequestTestQuery([
+            'booleanParamInQuery' => true,
+            'mapParamInQuery'     => [1, 2, 3],
+        ]);
+        $this->assertTrue($from->query->booleanParamInQuery);
+        $this->assertEquals([1, 2, 3], $from->query->mapParamInQuery);
+
+        $target = new RequestShrinkTest([]);
+        $this->convert($from, $target);
+        $this->assertEquals([
+            'BooleanParamInQuery' => true,
+            'MapParamInQuery'     => [1, 2, 3],
+        ], $target->query->toMap());
+
+        $target->query->mapParamInQueryShrink = json_encode($from->query->mapParamInQuery);
+        $this->assertEquals([
+            'BooleanParamInQuery' => true,
+            'MapParamInQuery'     => '[1,2,3]',
+        ], Utils::toMap($target->query));
+    }
+
+    public function testSleep()
+    {
+        $before = microtime(true) * 1000;
+        Utils::sleep(1000);
+        $after = microtime(true) * 1000;
+        $sub   = $after - $before;
+        $this->assertTrue(990 <= $sub && $sub <= 1100);
+    }
+
+    public function testToArray()
+    {
+        $model        = new RequestTest();
+        $model->query = 'foo';
+        $this->assertEquals([
+            ['query' => 'foo'],
+        ], Utils::toArray([$model]));
+
+        $subModel        = new RequestTest();
+        $subModel->query = 'bar';
+        $model->query    = $subModel;
+        $this->assertEquals([
+            ['query' => ['query' => 'bar']],
+        ], Utils::toArray([$model]));
+    }
+
+    public function testAssertAsReadable()
+    {
+        $s0 = Utils::assertAsReadable('string content');
+        $this->assertTrue($s0 instanceof Stream);
+
+        $s1 = Utils::assertAsReadable($s0);
+        $this->assertEquals($s1, $s0);
+
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionMessage('It is not a stream value.');
+        Utils::assertAsReadable(0);
+    }
+
+    private function convert($body, &$content)
+    {
+        $class = new \ReflectionClass($body);
+        foreach ($class->getProperties(\ReflectionProperty::IS_PUBLIC) as $property) {
+            $name = $property->getName();
+            if (!$property->isStatic()) {
+                $value = $property->getValue($body);
+                if ($value instanceof StreamInterface) {
+                    continue;
+                }
+                $content->{$name} = $value;
+            }
+        }
+    }
+}
+
+/**
+ * @internal
+ * @coversNothing
+ */
+class RequestTest extends Model
+{
+    /**
+     * @var RequestTestQuery
+     */
+    public $query;
+}
+
+/**
+ * @internal
+ * @coversNothing
+ */
+class RequestShrinkTest extends Model
+{
+    /**
+     * @var RequestTestShrinkQuery
+     */
+    public $query;
+}
+
+class RequestTestQuery extends Model
+{
+    /**
+     * @description test
+     *
+     * @var bool
+     */
+    public $booleanParamInQuery;
+
+    /**
+     * @description test
+     *
+     * @var array
+     */
+    public $mapParamInQuery;
+    protected $_name = [
+        'booleanParamInQuery' => 'BooleanParamInQuery',
+        'mapParamInQuery'     => 'MapParamInQuery',
+    ];
+
+    public function toMap()
+    {
+        $res = [];
+        if (null !== $this->booleanParamInQuery) {
+            $res['BooleanParamInQuery'] = $this->booleanParamInQuery;
+        }
+        if (null !== $this->mapParamInQuery) {
+            $res['MapParamInQuery'] = $this->mapParamInQuery;
+        }
+
+        return $res;
+    }
+}
+
+class RequestTestShrinkQuery extends Model
+{
+    /**
+     * @description test
+     *
+     * @var float
+     */
+    public $booleanParamInQuery;
+
+    /**
+     * @description test
+     *
+     * @var string
+     */
+    public $mapParamInQueryShrink;
+    protected $_name = [
+        'booleanParamInQuery'   => 'BooleanParamInQuery',
+        'mapParamInQueryShrink' => 'MapParamInQuery',
+    ];
+
+    public function toMap()
+    {
+        $res = [];
+        if (null !== $this->booleanParamInQuery) {
+            $res['BooleanParamInQuery'] = $this->booleanParamInQuery;
+        }
+        if (null !== $this->mapParamInQueryShrink) {
+            $res['MapParamInQuery'] = $this->mapParamInQueryShrink;
+        }
+
+        return $res;
+    }
+}

+ 3 - 0
vendor/alibabacloud/tea-utils/tests/bootstrap.php

@@ -0,0 +1,3 @@
+<?php
+
+require dirname(__DIR__) . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';

+ 12 - 0
vendor/alibabacloud/tea-xml/.gitignore

@@ -0,0 +1,12 @@
+composer.phar
+/vendor/
+
+# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
+# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
+composer.lock
+
+.idea
+.DS_Store
+
+cache/
+*.cache

+ 65 - 0
vendor/alibabacloud/tea-xml/.php_cs.dist

@@ -0,0 +1,65 @@
+<?php
+/*
+ * This document has been generated with
+ * https://mlocati.github.io/php-cs-fixer-configurator/#version:2.15|configurator
+ * you can change this configuration by importing this file.
+ */
+
+return PhpCsFixer\Config::create()
+    ->setRiskyAllowed(true)
+    ->setIndent('    ')
+    ->setRules([
+        '@PSR2'                                       => true,
+        '@PhpCsFixer'                                 => true,
+        '@Symfony:risky'                              => true,
+        'concat_space'                                => ['spacing' => 'one'],
+        'array_syntax'                                => ['syntax' => 'short'],
+        'array_indentation'                           => true,
+        'combine_consecutive_unsets'                  => true,
+        'method_separation'                           => true,
+        'single_quote'                                => true,
+        'declare_equal_normalize'                     => true,
+        'function_typehint_space'                     => true,
+        'hash_to_slash_comment'                       => true,
+        'include'                                     => true,
+        'lowercase_cast'                              => true,
+        'no_multiline_whitespace_before_semicolons'   => true,
+        'no_leading_import_slash'                     => true,
+        'no_multiline_whitespace_around_double_arrow' => true,
+        'no_spaces_around_offset'                     => true,
+        'no_unneeded_control_parentheses'             => true,
+        'no_unused_imports'                           => true,
+        'no_whitespace_before_comma_in_array'         => true,
+        'no_whitespace_in_blank_line'                 => true,
+        'object_operator_without_whitespace'          => true,
+        'single_blank_line_before_namespace'          => true,
+        'single_class_element_per_statement'          => true,
+        'space_after_semicolon'                       => true,
+        'standardize_not_equals'                      => true,
+        'ternary_operator_spaces'                     => true,
+        'trailing_comma_in_multiline_array'           => true,
+        'trim_array_spaces'                           => true,
+        'unary_operator_spaces'                       => true,
+        'whitespace_after_comma_in_array'             => true,
+        'no_extra_consecutive_blank_lines'            => [
+            'curly_brace_block',
+            'extra',
+            'parenthesis_brace_block',
+            'square_brace_block',
+            'throw',
+            'use',
+        ],
+        'binary_operator_spaces'       => [
+            'align_double_arrow' => true,
+            'align_equals'       => true,
+        ],
+        'braces'                                    => [
+            'allow_single_line_closure' => true,
+        ],
+    ])
+    ->setFinder(
+        PhpCsFixer\Finder::create()
+            ->exclude('vendor')
+            ->exclude('tests')
+            ->in(__DIR__)
+  );

+ 31 - 0
vendor/alibabacloud/tea-xml/README-CN.md

@@ -0,0 +1,31 @@
+English | [简体中文](README-CN.md)
+
+![](https://aliyunsdk-pages.alicdn.com/icons/AlibabaCloud.svg)
+
+## Alibaba Cloud Tea XML Library for PHP
+
+## Installation
+
+### Composer
+
+```bash
+composer require alibabacloud/tea-xml
+```
+
+## Issues
+
+[Opening an Issue](https://github.com/aliyun/tea-xml/issues/new), Issues not conforming to the guidelines may be closed immediately.
+
+## Changelog
+
+Detailed changes for each release are documented in the [release notes](./ChangeLog.txt).
+
+## References
+
+* [Latest Release](https://github.com/aliyun/tea-xml)
+
+## License
+
+[Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0)
+
+Copyright (c) 2009-present, Alibaba Cloud All rights reserved.

+ 31 - 0
vendor/alibabacloud/tea-xml/README.md

@@ -0,0 +1,31 @@
+[English](README.md) | 简体中文
+
+![](https://aliyunsdk-pages.alicdn.com/icons/AlibabaCloud.svg)
+
+## Alibaba Cloud Tea XML Library for PHP
+
+## 安装
+
+### Composer
+
+```bash
+composer require alibabacloud/tea-xml
+```
+
+## 问题
+
+[提交 Issue](https://github.com/aliyun/tea-xml/issues/new),不符合指南的问题可能会立即关闭。
+
+## 发行说明
+
+每个版本的详细更改记录在[发行说明](./ChangeLog.txt)中。
+
+## 相关
+
+* [最新源码](https://github.com/aliyun/tea-xml)
+
+## 许可证
+
+[Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0)
+
+Copyright (c) 2009-present, Alibaba Cloud All rights reserved.

+ 44 - 0
vendor/alibabacloud/tea-xml/composer.json

@@ -0,0 +1,44 @@
+{
+  "name": "alibabacloud/tea-xml",
+  "description": "Alibaba Cloud Tea XML Library for PHP",
+  "type": "library",
+  "license": "Apache-2.0",
+  "authors": [
+    {
+      "name": "Alibaba Cloud SDK",
+      "email": "sdk-team@alibabacloud.com"
+    }
+  ],
+  "require": {
+    "php": ">5.5"
+  },
+  "require-dev": {
+    "phpunit/phpunit": "^4.8.35|^5.4.3",
+    "symfony/var-dumper": "*"
+  },
+  "autoload": {
+    "psr-4": {
+      "AlibabaCloud\\Tea\\XML\\": "src"
+    }
+  },
+  "autoload-dev": {
+    "psr-4": {
+      "AlibabaCloud\\Tea\\XML\\Tests\\": "tests"
+    }
+  },
+  "scripts": {
+    "fixer": "php-cs-fixer fix ./",
+    "test": [
+      "@clearCache",
+      "phpunit --colors=always"
+    ],
+    "clearCache": "rm -rf cache/*"
+  },
+  "config": {
+    "sort-packages": true,
+    "preferred-install": "dist",
+    "optimize-autoloader": true
+  },
+  "prefer-stable": true,
+  "minimum-stability": "dev"
+}

+ 32 - 0
vendor/alibabacloud/tea-xml/phpunit.xml

@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<phpunit bootstrap="./tests/bootstrap.php" colors="true" processIsolation="false" stopOnFailure="false"
+         convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true"
+         testSuiteLoaderFile="phpunit/src/Runner/StandardTestSuiteLoader.php">
+
+    <testsuites>
+        <testsuite name="All">
+            <directory>tests</directory>
+        </testsuite>
+        <testsuite name="Unit">
+            <directory suffix="Test.php">./tests/Unit</directory>
+        </testsuite>
+    </testsuites>
+
+    <groups>
+        <exclude>
+            <group>integration</group>
+        </exclude>
+    </groups>
+
+    <logging>
+        <log type="coverage-html" target="cache/coverage" lowUpperBound="35" highLowerBound="70"/>
+        <log type="coverage-clover" target="cache/coverage.clover"/>
+    </logging>
+
+
+    <filter>
+        <whitelist processUncoveredFilesFromWhitelist="true">
+            <directory suffix=".php">./src</directory>
+        </whitelist>
+    </filter>
+</phpunit>

+ 151 - 0
vendor/alibabacloud/tea-xml/src/ArrayToXml.php

@@ -0,0 +1,151 @@
+<?php
+
+namespace AlibabaCloud\Tea\XML;
+
+use XmlWriter;
+
+/**
+ * Based on: http://stackoverflow.com/questions/99350/passing-php-associative-arrays-to-and-from-xml.
+ */
+class ArrayToXml
+{
+    private $version;
+    private $encoding;
+
+    /**
+     * Construct ArrayToXML object with selected version and encoding
+     * for available values check XmlWriter docs http://www.php.net/manual/en/function.xmlwriter-start-document.php.
+     *
+     * @param string $xmlVersion  XML Version, default 1.0
+     * @param string $xmlEncoding XML Encoding, default UTF-8
+     */
+    public function __construct($xmlVersion = '1.0', $xmlEncoding = 'utf-8')
+    {
+        $this->version  = $xmlVersion;
+        $this->encoding = $xmlEncoding;
+    }
+
+    /**
+     * Build an XML Data Set.
+     *
+     * @param array  $data         Associative Array containing values to be parsed into an XML Data Set(s)
+     * @param string $startElement Root Opening Tag, default data
+     *
+     * @return string XML String containing values
+     * @return mixed  Boolean false on failure, string XML result on success
+     */
+    public function buildXML($data, $startElement = 'data')
+    {
+        if (!\is_array($data)) {
+            $err = 'Invalid variable type supplied, expected array not found on line ' . __LINE__ . ' in Class: ' . __CLASS__ . ' Method: ' . __METHOD__;
+            trigger_error($err);
+
+            return false; //return false error occurred
+        }
+        $xml = new XmlWriter();
+        $xml->openMemory();
+        $xml->startDocument($this->version, $this->encoding);
+        $xml->startElement($startElement);
+        $data = $this->writeAttr($xml, $data);
+        $this->writeEl($xml, $data);
+        $xml->endElement(); //write end element
+        //returns the XML results
+        return $xml->outputMemory(true);
+    }
+
+    /**
+     * Write keys in $data prefixed with @ as XML attributes, if $data is an array.
+     * When an @ prefixed key is found, a '%' key is expected to indicate the element itself,
+     * and '#' prefixed key indicates CDATA content.
+     *
+     * @param XMLWriter $xml  object
+     * @param array     $data with attributes filtered out
+     *
+     * @return array $data | $nonAttributes
+     */
+    protected function writeAttr(XMLWriter $xml, $data)
+    {
+        if (\is_array($data)) {
+            $nonAttributes = [];
+            foreach ($data as $key => $val) {
+                //handle an attribute with elements
+                if ('@' == $key[0]) {
+                    $xml->writeAttribute(substr($key, 1), $val);
+                } elseif ('%' == $key[0]) {
+                    if (\is_array($val)) {
+                        $nonAttributes = $val;
+                    } else {
+                        $xml->text($val);
+                    }
+                } elseif ('#' == $key[0]) {
+                    if (\is_array($val)) {
+                        $nonAttributes = $val;
+                    } else {
+                        $xml->startElement(substr($key, 1));
+                        $xml->writeCData($val);
+                        $xml->endElement();
+                    }
+                } elseif ('!' == $key[0]) {
+                    if (\is_array($val)) {
+                        $nonAttributes = $val;
+                    } else {
+                        $xml->writeCData($val);
+                    }
+                } //ignore normal elements
+                else {
+                    $nonAttributes[$key] = $val;
+                }
+            }
+
+            return $nonAttributes;
+        }
+
+        return $data;
+    }
+
+    /**
+     * Write XML as per Associative Array.
+     *
+     * @param XMLWriter $xml  object
+     * @param array     $data Associative Data Array
+     */
+    protected function writeEl(XMLWriter $xml, $data)
+    {
+        foreach ($data as $key => $value) {
+            if (\is_array($value) && !$this->isAssoc($value)) { //numeric array
+                foreach ($value as $itemValue) {
+                    if (\is_array($itemValue)) {
+                        $xml->startElement($key);
+                        $itemValue = $this->writeAttr($xml, $itemValue);
+                        $this->writeEl($xml, $itemValue);
+                        $xml->endElement();
+                    } else {
+                        $itemValue = $this->writeAttr($xml, $itemValue);
+                        $xml->writeElement($key, "{$itemValue}");
+                    }
+                }
+            } elseif (\is_array($value)) { //associative array
+                $xml->startElement($key);
+                $value = $this->writeAttr($xml, $value);
+                $this->writeEl($xml, $value);
+                $xml->endElement();
+            } else { //scalar
+                $value = $this->writeAttr($xml, $value);
+                $xml->writeElement($key, "{$value}");
+            }
+        }
+    }
+
+    /**
+     * Check if array is associative with string based keys
+     * FROM: http://stackoverflow.com/questions/173400/php-arrays-a-good-way-to-check-if-an-array-is-associative-or-sequential/4254008#4254008.
+     *
+     * @param array $array Array to check
+     *
+     * @return bool
+     */
+    protected function isAssoc($array)
+    {
+        return (bool) \count(array_filter(array_keys($array), 'is_string'));
+    }
+}

+ 57 - 0
vendor/alibabacloud/tea-xml/src/XML.php

@@ -0,0 +1,57 @@
+<?php
+
+namespace AlibabaCloud\Tea\XML;
+
+class XML
+{
+    public static function parseXml($xmlStr, $response)
+    {
+        $res    = self::parse($xmlStr);
+        if ($response === null) {
+            return $ref;
+        } else {
+            if (\is_string($response)) {
+                $response = new $response();
+            }
+            $prop   = get_object_vars($response);
+            $target = [];
+    
+            foreach ($res as $k => $v) {
+                if (isset($prop[$k])) {
+                    $target[$k] = $v;
+                }
+            }
+            return $target;
+        }
+    }
+
+    public static function toXML($array)
+    {
+        $arrayToXml = new ArrayToXml();
+        if (\is_object($array)) {
+            $tmp      = explode('\\', \get_class($array));
+            $rootName = $tmp[\count($tmp) - 1];
+            $data     = json_decode(json_encode($array), true);
+        } else {
+            $tmp = $array;
+            reset($tmp);
+            $rootName = key($tmp);
+            $data     = $array[$rootName];
+        }
+        ksort($data);
+
+        return $arrayToXml->buildXML($data, $rootName);
+    }
+
+    private static function parse($xml)
+    {
+        libxml_disable_entity_loader(true);
+
+        return json_decode(
+            json_encode(
+                simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA)
+            ),
+            true
+        );
+    }
+}

部分文件因文件數量過多而無法顯示