diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 00000000..e9d9d405
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1 @@
+/examples export-ignore
diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml
new file mode 100644
index 00000000..cd7b5460
--- /dev/null
+++ b/.github/workflows/php.yml
@@ -0,0 +1,32 @@
+name: build
+
+on: [push, pull_request]
+
+jobs:
+ build:
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v1
+
+ - name: Validate composer.json and composer.lock
+ run: composer validate
+
+ - name: Install dependencies
+ run: composer install --prefer-dist --no-progress --no-suggest
+
+ - name: Run code sniffer
+ run: vendor/bin/phpcs
+
+ - name: Run test suite
+ run: vendor/bin/phpunit --coverage-clover=coverage.xml
+ env:
+ XDEBUG_MODE: coverage
+ UCLOUD_PUBLIC_KEY: foo
+ UCLOUD_PRIVATE_KEY: bar
+ UCLOUD_PROJECT_ID: oas
+
+ - uses: codecov/codecov-action@v1
+ with:
+ file: ./coverage.xml
diff --git a/.gitignore b/.gitignore
index 4f4773fb..28d0baa4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,11 @@
-config.php
+*.lock
+package.xml
+/vendor
+.idea
+.php_cs.cache
+docs/_build
+/.vagrant
+*.phar
+.phpunit*
+build/
+coverage.xml
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 00000000..78851e22
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,12 @@
+image: hub.ucloudadmin.com/esl_ipdd/composer:latest
+
+test:
+ script:
+ - composer install
+ - make test-cov
+ - make lint
+ tags:
+ - uaek-c1
+ artifacts:
+ paths:
+ - build/
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 00000000..d6456956
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/Makefile b/Makefile
new file mode 100644
index 00000000..591a90d2
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,48 @@
+install:
+ composer install
+
+lint:
+ php vendor/bin/phpcs -n
+
+fmt:
+ php vendor/bin/phpcbf
+
+build:
+ composer dump-autoload
+
+test:
+ php vendor/bin/phpunit tests/*
+
+test-cov:
+ UCLOUD_PUBLIC_KEY=foo UCLOUD_PRIVATE_KEY=bar UCLOUD_PROJECT_ID=oas \
+ XDEBUG_MODE=coverage php vendor/bin/phpunit --testsuite=unit --coverage-html=build/coverage
+
+cov-show:
+ open build/coverage/index.html
+
+gen:
+ ucloud-spec create opensdk \
+ --only "UFS" \
+ --only "UDisk" \
+ --only "UHost" \
+ --only "PathX" \
+ --only "UDDB" \
+ --only "UCDN" \
+ --only "UNet" \
+ --only "VPC2.0" \
+ --only "UDB" \
+ --only "UMem" \
+ --only "ULB" \
+ --only "Cube" \
+ --only "UK8S" \
+ --only "IPSecVPN" \
+ --only "UAccount" \
+ --only "UDPN" \
+ --only "UBill" \
+ --only "UPHost" \
+ --only "UFile" \
+ --only "USMS" \
+ --only "UEC" \
+ --public \
+ -s https://git.ucloudadmin.com/apispec/apispec.git \
+ /Users/user/code/oas/plugins/template-opensdk-php .
diff --git a/README b/README
deleted file mode 100644
index b95d6582..00000000
--- a/README
+++ /dev/null
@@ -1,22 +0,0 @@
-#监控脚本使用 ucloud 提供短信包服务请先购买短信包否则无法接收短信
-
-1. sendsms.php 短信发送脚本
-
-
-#使用方法
-
-打开 cp config.simple.php config.php 修改以下配置
-
-
-#配置公私钥 公私钥请到用户中心获取
-
-define("PUBLIC_KEY" ,"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
-define("PRIVATE_KEY" ,"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
-define("PROJECT_ID" ,"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); # 项目ID 请从 dashbord 获取
-
-#配置api地址'''
-define("BASE_URL" ,"http://api.ucloud.cn");
-
-
-sendsms.php 使用示范
-php sendsms.php '137xxxxxxx|138xxxxxxxx' '测试短信'
diff --git a/README.md b/README.md
new file mode 100644
index 00000000..e8b1b43b
--- /dev/null
+++ b/README.md
@@ -0,0 +1,23 @@
+# UCloud SDK PHP
+
+[![Build Status](https://github.com/ucloud/ucloud-sdk-php/workflows/build/badge.svg)](https://github.com/ucloud/ucloud-sdk-php/actions)
+[![CodeCov](https://codecov.io/gh/ucloud/ucloud-sdk-php/branch/master/graph/badge.svg)](https://codecov.io/gh/ucloud/ucloud-sdk-php)
+[![Release](https://img.shields.io/github/release/ucloud/ucloud-sdk-php.svg)](https://github.com/ucloud/ucloud-sdk-php/releases)
+[![PHPv](https://img.shields.io/packagist/php-v/ucloud/ucloud.svg)](http://www.php.net)
+[![Downloads](https://img.shields.io/packagist/dt/ucloud/ucloud.svg)](https://packagist.org/packages/ucloud/ucloud)
+
+## Chinese Guide
+
+* [快速开始](docs/quickstart.md)
+* [通用配置](docs/configure.md)
+* [错误处理](docs/error.md)
+* [类型系统](docs/typesystem.md)
+* [请求中间件](docs/middleware.md)
+* [泛化调用](docs/generic.md)
+
+旧版请移步 [backup](https://github.com/ucloud/ucloud-sdk-php/tree/backup) 分支。
+
+## Examples
+
+- [批量创建云主机](examples/uhost)
+- [创建基于负载均衡器的两层架构](examples/two-tier)
diff --git a/composer.json b/composer.json
new file mode 100644
index 00000000..e8eb1e00
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,43 @@
+{
+ "name": "ucloud/ucloud-sdk-php",
+ "type": "library",
+ "description": "UCloud",
+ "keywords": ["php", "ucloud"],
+ "homepage": "https://github.com/ucloud/ucloud-sdk-php",
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "ucloud",
+ "email": "yufei.li@ucloud.cn"
+ }
+ ],
+ "require": {
+ "php": ">=5.5",
+ "guzzlehttp/guzzle": "^6.2.1|^7.0",
+ "psr/log": "^1.1"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^9.0",
+ "squizlabs/php_codesniffer": "^3.0"
+ },
+ "autoload": {
+ "psr-4" : {
+ "UCloud\\": "src/"
+ }
+ },
+ "autoload-dev": {
+ "psr-4": { "UCloud\\Tests\\": "tests/" }
+ },
+ "config": {
+ "preferred-install": "dist",
+ "sort-packages": true
+ },
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "scripts": {
+ "test": "vendor/bin/phpunit"
+ }
+}
diff --git a/config.simple.php b/config.simple.php
deleted file mode 100644
index b3acf248..00000000
--- a/config.simple.php
+++ /dev/null
@@ -1,8 +0,0 @@
- “PHP/8.0.6 PHP-SDK/0.1.0 MyAPP/0.10.1” |
+| **timeout** | int | (选填)请求超时时间,默认 30s |
+| **maxRetries** | int | (选填)最大重试次数. 默认重试 3 次。设置该值大于 0 将对网络和服务可用性问题进行自动重试,使用指数退避的重试间隔,并自动跳过资源创建类的接口。 |
+| **logger** | LoggerInterface | (选填)自定义 Logger,可参考 [PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md) Logger Interface 的定义 |
+
+## 进阶配置选项
+
+### 修改默认日志
+
+关闭日志:
+
+```php
+use UCloud\Core\Client;
+use UCloud\Core\Logger\DisabledLogger;
+
+$client = new Client([
+ // ...
+ "logger" => new DisabledLogger(),
+]);
+```
+
+### 访问专有云/渠道云或其它网关
+
+```php
+use UCloud\Core\Client;
+
+$client = new Client([
+ // ...
+ "region" => "专有云地域", // 替换成专有地域
+ "base_url" => "foo.api.ucloud.cn", // 替换成专有云网关
+]);
+```
diff --git a/docs/error.md b/docs/error.md
new file mode 100644
index 00000000..866b3073
--- /dev/null
+++ b/docs/error.md
@@ -0,0 +1,30 @@
+
+
+# 错误处理
+
+了解如何处理不同类型的 SDK 异常,包括参数错误,RetCode 不为 0 的业务异常等。
+
+```php
+use UCloud\UHost\Apis\DescribeImageRequest;
+use UCloud\UHost\UHostClient;
+use UCloud\Core\Exception\UCloudException;
+
+$client = new UHostClient([
+ "publicKey" => getenv("UCLOUD_PUBLIC_KEY"),
+ "privateKey" => getenv("UCLOUD_PRIVATE_KEY"),
+ "projectId" => getenv("UCLOUD_PROJECT_ID"),
+ "region" => "cn-bj2",
+]);
+
+try {
+ $req = new DescribeImageRequest();
+ $req->setZone("cn-bj2-05");
+ $resp = $client->describeImage($req);
+} catch (UCloudException $e) {
+ if ($e->getType() == UCloudException::EXC_TYPE_RET_CODE) {
+ echo $e->getCode();
+ echo $e->getRequestId();
+ }
+ echo $e->getMessage();
+}
+```
diff --git a/docs/generic.md b/docs/generic.md
new file mode 100644
index 00000000..411879d3
--- /dev/null
+++ b/docs/generic.md
@@ -0,0 +1,35 @@
+# 泛化调用
+
+如何调用 SDK 尚未支持的 API ?可以使用泛化调用方式。
+
+**NOTE** 如果没有必须使用的理由,不建议使用泛化方式调用 API,因为无法享受 OpenAPI 提供的兼容性保证。
+
+## 调用方式
+
+```php
+use UCloud\Core\Client;
+use UCloud\Core\Exception\UCloudException;
+use UCloud\Core\Request\Request;
+
+$client = new Client([
+ "publicKey" => getenv("UCLOUD_PUBLIC_KEY"),
+ "privateKey" => getenv("UCLOUD_PRIVATE_KEY"),
+ "projectId" => getenv("UCLOUD_PROJECT_ID"),
+ "region" => "cn-bj2",
+]);
+
+try {
+ $client->invoke(new Request([
+ "Action" => "GetImage",
+ "Zone" => "cn-bj2-05",
+ "ImageType" => "Base",
+ "OsType" => "Linux",
+ ]));
+} catch (UCloudException $e) {
+ if ($e->getType() == UCloudException::EXC_TYPE_RET_CODE) {
+ echo $e->getCode();
+ echo $e->getRequestId();
+ }
+ echo $e->getMessage();
+}
+```
diff --git a/docs/middleware.md b/docs/middleware.md
new file mode 100644
index 00000000..d3499037
--- /dev/null
+++ b/docs/middleware.md
@@ -0,0 +1,49 @@
+# 请求中间件
+
+了解如何拦截 SDK 发起的请求,并统一添加额外的逻辑。
+
+UCloud SDK 为请求提供了请求中间件的特性。
+
+该特性允许在 请求/响应 的生命周期中添加自定义的逻辑。
+
+例如,Client 级别的中间件,可以拦截参数/响应字典:
+
+```php
+use UCloud\Core\Middleware\Context;
+use UCloud\Core\Middleware\Middleware;
+use UCloud\Core\Request\Request;
+use UCloud\Core\Response\Response;
+
+class LogMiddleware extends Middleware
+{
+ public function handleRequest(Context $ctx): Request
+ {
+ $req = $ctx->getRequest();
+ $logger = $ctx->getConfig()->getLogger();
+ if ($logger != null) {
+ $logger->info(sprintf("[request] %s", json_encode($req->toArray())));
+ }
+ return $req;
+ }
+
+ public function handleResponse(Context $ctx): Response
+ {
+ $resp = $ctx->getResponse();
+ $logger = $ctx->getConfig()->getLogger();
+ if ($logger != null) {
+ $body = $resp->toArray();
+ $logger->info(sprintf("[response: %s] %s", $resp->getRequestId(), json_encode($body)));
+ }
+ return $resp;
+ }
+
+ public function handleException(Context $ctx)
+ {
+ $e = $ctx->getException();
+ $logger = $ctx->getConfig()->getLogger();
+ if ($logger != null) {
+ $logger->error(sprintf("[response: %s] %s Error: %s", $e->getRequestId(), $e->getType(), $e->getMessage()));
+ }
+ }
+}
+```
diff --git a/docs/quickstart.md b/docs/quickstart.md
new file mode 100644
index 00000000..0bb4e833
--- /dev/null
+++ b/docs/quickstart.md
@@ -0,0 +1,81 @@
+# 快速开始
+
+## 安装
+
+使用 `composer` 安装(推荐):
+
+```bash
+$ composer require ucloud/ucloud-sdk-php
+```
+
+## 初次使用
+
+目前,SDK 使用 PublicKey/PrivateKey 作为唯一的鉴权方式,该公私钥可以从以下途径获取:
+
+- [UAPI 密钥管理](https://console.ucloud.cn/uapi/apikey)
+
+下面提供一个简单的示例:
+
+```php
+use UCloud\UHost\UHostClient;
+use UCloud\Core\Exception\UCloudException;
+use UCloud\UHost\Apis\CreateUHostInstanceRequest;
+use UCloud\UHost\Params\CreateUHostInstanceParamDisks;
+
+$client = new UHostClient([
+ "publicKey" => getenv("UCLOUD_PUBLIC_KEY"),
+ "privateKey" => getenv("UCLOUD_PRIVATE_KEY"),
+ "projectId" => getenv("UCLOUD_PROJECT_ID"),
+ "region" => "cn-bj2",
+]);
+$zone = "cn-bj2-05";
+
+// Create Instance
+try {
+ $req = new CreateUHostInstanceRequest();
+ $req->setName("sdk-php-example");
+ $req->setZone($zone);
+ $req->setImageId("...");
+ $req->setLoginMode("Password");
+ $req->setPassword(base64_encode("UCloud1234!"));
+ $req->setCPU(1);
+ $req->setMemory(1024);
+
+ $disk = new CreateUHostInstanceParamDisks();
+ $disk->setSize(40);
+ $disk->setType("CLOUD_SSD");
+ $disk->setIsBoot("True");
+
+ $req->setDisks([$disk]);
+
+ $resp = $client->createUHostInstance($req);
+} catch (UCloudException $e) {
+ throw $e;
+}
+$id = $resp->getUHostIds()[0];
+```
+
+将上述代码中 client 相关配置,以及主机的 image id 等,替换成自己的配置,即可创建一台云主机。
+
+在该示例中,使用 SDK 完成了一个创建云主机的请求。至此,已经涵盖了 SDK 的基本核心用法,可以构建自己的脚本啦!
+
+SDK 中的每一个 api 调用都有详细的注释文档,
+可以通过 Editor/IDE 跳转到具体的方法中查看(也可以 [查看接口文档](https://docs.ucloud.cn/api/summary/README) ),
+并根据 IDE 自动补全和报错信息继续探索 SDK 的用法。
+
+如果需要了解这段代码提及但未完全覆盖的使用技巧,请参考:
+
+- [通用配置](configure.md),了解如何配置 SDK,如日志、重试、服务访问端点(公有云、专有云)等
+- [错误处理](error.md),了解如何处理不同类型的 SDK 异常,包括参数错误,RetCode 不为 0 的业务异常等
+- [类型系统](typesystem.md),了解 SDK 如何校验参数,并规范化 API 的返回值。
+- [请求中间件](middleware.md),了解如何拦截 SDK 发起的请求,并统一添加额外的逻辑。
+- [泛化调用](generic.md),如何调用 SDK 尚未支持的 API(不建议使用此类 API,因为没有兼容性保证)
+
+## 获取更多示例
+
+### 基于场景的示例
+
+SDK 提供了部分基于场景的示例,并提供了对应的资源销毁逻辑,可以点击以下链接查看源码:
+
+- [批量创建云主机](../examples/uhost)
+- [创建基于负载均衡器的两层架构](../examples/two-tier),ULB + UHost
diff --git a/docs/typesystem.md b/docs/typesystem.md
new file mode 100644
index 00000000..98d19070
--- /dev/null
+++ b/docs/typesystem.md
@@ -0,0 +1,3 @@
+# 类型系统
+
+待定。
diff --git a/examples/two-tier/README.md b/examples/two-tier/README.md
new file mode 100644
index 00000000..ce2ab65c
--- /dev/null
+++ b/examples/two-tier/README.md
@@ -0,0 +1,19 @@
+# UCloud SDK Two-Tier Example
+
+## What is the goal
+
+Build a two-tier architecture with ulb and uhost, and remove all example data.
+
+## Setup Environment
+
+```go
+export UCLOUD_PUBLIC_KEY="your public key"
+export UCLOUD_PRIVATE_KEY="your private key"
+export UCLOUD_PROJECT_ID="your project id"
+```
+
+## How to run
+
+```sh
+php main.php
+```
diff --git a/examples/two-tier/main.php b/examples/two-tier/main.php
new file mode 100644
index 00000000..68a5e418
--- /dev/null
+++ b/examples/two-tier/main.php
@@ -0,0 +1,264 @@
+ getenv("UCLOUD_PUBLIC_KEY"),
+ "privateKey" => getenv("UCLOUD_PRIVATE_KEY"),
+ "projectId" => getenv("UCLOUD_PROJECT_ID"),
+ "region" => "cn-bj2",
+ ];
+ $this->uhostClient = new UHostClient($cfg);
+ $this->ulbClient = new ULBClient($cfg);
+ $this->zone = "cn-bj2-05";
+ $this->name = "sdk-php-example-two-tier";
+ }
+
+ /**
+ * @throws UCloudException
+ */
+ public function __invoke()
+ {
+ $imageId = $this->describeImage();
+
+ $uhostIds = $this->createUHostBatch($imageId, 2);
+
+ $ulbId = $this->createUlb();
+
+ $vserverId = $this->createVServer($ulbId);
+
+ $backendIds = $this->allocateBackendBatch($ulbId, $vserverId, $uhostIds);
+
+ $this->releaseBackendBatch($ulbId, $backendIds);
+
+ $this->deleteVServer($ulbId, $vserverId);
+
+ $this->deleteUlb($ulbId);
+
+ $this->deleteUHostBatch($uhostIds);
+ }
+
+ /**
+ * Describe Image
+ *
+ * @return string
+ * @throws UCloudException
+ */
+ private function describeImage(): string
+ {
+ $req = new DescribeImageRequest();
+ $req->setZone($this->zone);
+ $req->setImageType("Base");
+ $req->setOsType("Linux");
+ $resp = $this->uhostClient->describeImage($req);
+ $image = $resp->getImageSet()[0];
+ return $image->getImageId();
+ }
+
+ /**
+ * Create Instance
+ *
+ * @param string $imageId
+ * @param int $count
+ * @return array
+ * @throws UCloudException
+ */
+ private function createUHostBatch(string $imageId, int $count): array
+ {
+ $ids = [];
+ foreach(range(1, $count) as $index) {
+ $req = new CreateUHostInstanceRequest();
+ $req->setName($this->name);
+ $req->setZone($this->zone);
+ $req->setImageId($imageId);
+ $req->setLoginMode("Password");
+ $req->setPassword(base64_encode("UCloud1234!"));
+ $req->setCPU(1);
+ $req->setMemory(1024);
+
+ $resp = $this->uhostClient->createUHostInstance($req);
+ array_push($ids, $resp->getUHostIds()[0]);
+ }
+ $this->waitUHostState($ids, "Running");
+ return $ids;
+ }
+
+ /**
+ * Create ULB
+ *
+ * @return string
+ * @throws UCloudException
+ */
+ private function createUlb(): string
+ {
+ $req = new CreateULBRequest();
+ $req->setULBName($this->name);
+ $resp = $this->ulbClient->createULB($req);
+ return $resp->getULBId();
+ }
+
+ /**
+ * Create VServer under ULB
+ *
+ * @param string $ulbId
+ * @return string
+ * @throws UCloudException
+ */
+ private function createVServer(string $ulbId): string
+ {
+
+ $req = new CreateVServerRequest();
+ $req->setVServerName($this->name);
+ $req->setULBId($ulbId);
+ $resp = $this->ulbClient->createVServer($req);
+ return $resp->getVServerId();
+ }
+
+ /**
+ * Create several backends under VServer
+ *
+ * @param string $ulbId
+ * @param string $vserverId
+ * @param array $uhostIds
+ * @return array
+ * @throws UCloudException
+ */
+ private function allocateBackendBatch(string $ulbId, string $vserverId, array $uhostIds): array
+ {
+ $backendIds = [];
+ foreach ($uhostIds as $uhostId) {
+ $req = new AllocateBackendRequest();
+ $req->setULBId($ulbId);
+ $req->setVServerId($vserverId);
+ $req->setResourceId($uhostId);
+ $req->setResourceType("UHost");
+ $resp = $this->ulbClient->allocateBackend($req);
+ array_push($backendIds, $resp->getBackendId());
+ }
+ return $backendIds;
+ }
+
+ /**
+ * Delete backends from VServer
+ *
+ * @param string $ulbId
+ * @param string $vserverId
+ * @param array $backendIds
+ * @throws UCloudException
+ */
+ private function releaseBackendBatch(string $ulbId, array $backendIds)
+ {
+ foreach ($backendIds as $backendId) {
+ $req = new ReleaseBackendRequest();
+ $req->setULBId($ulbId);
+ $req->setBackendId($backendId);
+ $this->ulbClient->releaseBackend($req);
+ }
+ }
+
+ /**
+ * Delete VServer from ULB
+ *
+ * @param string $ulbId
+ * @param string $vserverId
+ * @throws UCloudException
+ */
+ private function deleteVServer(string $ulbId, string $vserverId)
+ {
+ $req = new DeleteVServerRequest();
+ $req->setULBId($ulbId);
+ $req->setVServerId($vserverId);
+ }
+
+ /**
+ * Delete ULB
+ *
+ * @param string $ulbId
+ * @throws UCloudException
+ */
+ private function deleteUlb(string $ulbId)
+ {
+ $req = new DeleteULBRequest();
+ $req->setULBId($ulbId);
+ $this->ulbClient->deleteULB($req);
+ }
+
+ /**
+ * Delete UHost instances
+ *
+ * @param array $uhostIds
+ * @throws UCloudException
+ */
+ private function deleteUHostBatch(array $uhostIds)
+ {
+ foreach ($uhostIds as $uhostId) {
+ $req = new StopUHostInstanceRequest();
+ $req->setUHostId($uhostId);
+ $this->uhostClient->stopUHostInstance($req);
+ }
+
+ $this->waitUHostState($uhostIds, "Stopped");
+
+ foreach ($uhostIds as $uhostId) {
+ $req = new TerminateUHostInstanceRequest();
+ $req->setUHostId($uhostId);
+ $this->uhostClient->terminateUHostInstance($req);
+ }
+ }
+
+ /**
+ * @throws UCloudException
+ */
+ private function waitUHostState(array $uhostIds, string $state)
+ {
+ while (true) {
+ $hasNotReady = false;
+
+ $req = new DescribeUHostInstanceRequest();
+ $req->setUHostIds($uhostIds);
+ $resp = $this->uhostClient->describeUHostInstance($req);
+ foreach ($resp->getUHostSet() as $instance) {
+ if ($instance->getState() != $state) {
+ $hasNotReady = true;
+ }
+ }
+ if (!$hasNotReady) {
+ break;
+ }
+ sleep(1);
+ }
+ }
+}
+
+
+$main = new Main();
+$main();
diff --git a/examples/uhost/README.md b/examples/uhost/README.md
new file mode 100644
index 00000000..b308f167
--- /dev/null
+++ b/examples/uhost/README.md
@@ -0,0 +1,21 @@
+# UCloud SDK UHost Example
+
+## What is the goal
+
+Create an uhost, wait it created, and remove all example data.
+
+## Setup Environment
+
+```go
+export UCLOUD_PUBLIC_KEY="your public key"
+export UCLOUD_PRIVATE_KEY="your private key"
+export UCLOUD_PROJECT_ID="your project id"
+```
+
+## How to run
+
+change directory to here.
+
+```sh
+php main.php
+```
diff --git a/examples/uhost/main.php b/examples/uhost/main.php
new file mode 100644
index 00000000..276d8b00
--- /dev/null
+++ b/examples/uhost/main.php
@@ -0,0 +1,124 @@
+ getenv("UCLOUD_PUBLIC_KEY"),
+ "privateKey" => getenv("UCLOUD_PRIVATE_KEY"),
+ "projectId" => getenv("UCLOUD_PROJECT_ID"),
+ "region" => "cn-bj2",
+ ]);
+ $zone = "cn-bj2-05";
+
+ // Describe Image
+ try {
+ $req = new DescribeImageRequest();
+ $req->setZone($zone);
+ $req->setImageType("Base");
+ $req->setOsType("Linux");
+
+ $resp = $client->describeImage($req);
+ } catch (UCloudException $e) {
+ throw $e;
+ }
+ $image = $resp->getImageSet()[0];
+
+ // Create Instance
+ try {
+ $req = new CreateUHostInstanceRequest();
+ $req->setName("sdk-php-example");
+ $req->setZone($zone);
+ $req->setImageId($image->getImageId());
+ $req->setLoginMode("Password");
+ $req->setPassword(base64_encode("UCloud1234!"));
+ $req->setCPU(1);
+ $req->setMemory(1024);
+
+ $disk = new CreateUHostInstanceParamDisks();
+ $disk->setSize($image->getImageSize());
+ $disk->setType("CLOUD_SSD");
+ $disk->setIsBoot("True");
+
+ $req->setDisks([$disk]);
+
+ $resp = $client->createUHostInstance($req);
+ } catch (UCloudException $e) {
+ throw $e;
+ }
+ $id = $resp->getUHostIds()[0];
+
+ // Wait instance to boot
+ while (True) {
+ sleep(3);
+
+ try {
+ $req = new DescribeUHostInstanceRequest();
+ $req->setZone($zone);
+ $req->setUHostIds([$id]);
+ $resp = $client->describeUHostInstance($req);
+ } catch (UCloudException $e) {
+ break;
+ }
+
+ $instance = $resp->getUHostSet()[0];
+ echo "waiting " . $id . " to boot, got " . $instance->getState() . "\n";
+ if (in_array($instance->getState(), ["Running"])) {
+ break;
+ }
+ }
+
+ // Stop the instance
+ try {
+ $req = new StopUHostInstanceRequest();
+ $req->setZone($zone);
+ $req->setUHostId($id);
+ $client->stopUHostInstance($req);
+ } catch (UCloudException $e) {
+ throw $e;
+ }
+
+ // Wait instance to boot
+ while (True) {
+ sleep(3);
+
+ try {
+ $req = new DescribeUHostInstanceRequest();
+ $req->setZone($zone);
+ $req->setUHostIds([$id]);
+ $resp = $client->describeUHostInstance($req);
+ } catch (UCloudException $e) {
+ break;
+ }
+ $instance = $resp->getUHostSet()[0];
+ echo "waiting " . $id . " to stopped, got " . $instance->getState() . "\n";
+ if (in_array($instance->getState(), ["Stopped"])) {
+ break;
+ }
+ }
+
+ // Cleanup the instance
+ try {
+ $req = new TerminateUHostInstanceRequest();
+ $req->setZone($zone);
+ $req->setUHostId($id);
+ $client->terminateUHostInstance($req);
+ } catch (UCloudException $e) {
+ throw $e;
+ }
+}
+
+main();
diff --git a/phpcs.xml b/phpcs.xml
new file mode 100644
index 00000000..b0c8cfd2
--- /dev/null
+++ b/phpcs.xml
@@ -0,0 +1,35 @@
+
+
+ The coding standard for laravel package
+
+ src
+
+ *.json
+ *.xml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/phpunit.xml b/phpunit.xml
new file mode 100644
index 00000000..a9b21671
--- /dev/null
+++ b/phpunit.xml
@@ -0,0 +1,26 @@
+
+
+
+
+ ./src/Core
+
+
+ ./vendor
+ ./tests
+
+
+
+
+ ./tests/
+
+
+
diff --git a/sdk.php b/sdk.php
deleted file mode 100644
index 0a14fef6..00000000
--- a/sdk.php
+++ /dev/null
@@ -1,311 +0,0 @@
- $value){
- $params_data .= $key;
- $params_data .= $value;
- }
- $params_data .= $private_key;
- return sha1($params_data);
-}
-
-class UConnection{
- /**
- * Contains the last HTTP status code returned.
- *
- * @ignore
- */
- public $http_code;
- /**
- * Contains the last API call.
- *
- * @ignore
- */
- public $url;
- /**
- * Set up the API root URL.
- *
- * @ignore
- */
- public $host;
- /**
- * Set timeout default.
- *
- * @ignore
- */
- public $timeout = 30;
- /**
- * Set connect timeout.
- *
- * @ignore
- */
- public $connecttimeout = 30;
- /**
- * Verify SSL Cert.
- *
- * @ignore
- */
- public $ssl_verifypeer = FALSE;
- /**
- * Respons format.
- *
- * @ignore
- */
- public $format = 'json';
- /**
- * Decode returned json data.
- *
- * @ignore
- */
- public $decode_json = TRUE;
- /**
- * Contains the last HTTP headers returned.
- *
- * @ignore
- */
- public $http_info;
- /**
- * Set the useragnet.
- *
- * @ignore
- */
- public $useragent = 'Sae T OAuth2 v0.1';
-
- /**
- * print the debug info
- *
- * @ignore
- */
- public $debug = false;
-
- /**
- * boundary of multipart
- * @ignore
- */
- public static $boundary = '';
-
- function __construct($base_url) {
- $this->host = $base_url;
- }
-
- /**
- * GET wrappwer for oAuthRequest.
- *
- * @return mixed
- */
- function get($url, $parameters = array()) {
- $response = $this->oAuthRequest($url, 'GET', $parameters);
- if ($this->format === 'json' && $this->decode_json) {
- return json_decode($response, true);
- }
- return $response;
- }
-
- /**
- * POST wreapper for oAuthRequest.
- *
- * @return mixed
- */
- function post($url, $parameters = array(), $multi = false) {
- $response = $this->oAuthRequest($url, 'POST', $parameters, $multi );
- if ($this->format === 'json' && $this->decode_json) {
- return json_decode($response, true);
- }
- return $response;
- }
-
- /**
- * DELTE wrapper for oAuthReqeust.
- *
- * @return mixed
- */
- function delete($url, $parameters = array()) {
- $response = $this->oAuthRequest($url, 'DELETE', $parameters);
- if ($this->format === 'json' && $this->decode_json) {
- return json_decode($response, true);
- }
- return $response;
- }
-
- /**
- * Format and sign an OAuth / API request
- *
- * @return string
- * @ignore
- */
- function oAuthRequest($url, $method, $parameters, $multi = false) {
- if (strrpos($url, 'http://') !== 0 && strrpos($url, 'https://') !== 0) {
- $url = "{$this->host}{$url}";
- }
-
- switch ($method) {
- case 'GET':
- $url = $url . '?' . http_build_query($parameters);
- return $this->http($url, 'GET');
- default:
- $headers = array();
- if (!$multi && (is_array($parameters) || is_object($parameters)) ) {
- $body = http_build_query($parameters);
- } else {
- $body = self::build_http_query_multi($parameters);
- $headers[] = "Content-Type: multipart/form-data; boundary=" . self::$boundary;
- }
- return $this->http($url, $method, $body, $headers);
- }
- }
-
- /**
- * Make an HTTP request
- *
- * @return string API results
- * @ignore
- */
- function http($url, $method, $postfields = NULL, $headers = array()) {
- $this->http_info = array();
- $ci = curl_init();
- /* Curl settings */
- curl_setopt($ci, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
- curl_setopt($ci, CURLOPT_USERAGENT, $this->useragent);
- curl_setopt($ci, CURLOPT_CONNECTTIMEOUT, $this->connecttimeout);
- curl_setopt($ci, CURLOPT_TIMEOUT, $this->timeout);
- curl_setopt($ci, CURLOPT_RETURNTRANSFER, TRUE);
- curl_setopt($ci, CURLOPT_ENCODING, "");
- curl_setopt($ci, CURLOPT_SSL_VERIFYPEER, $this->ssl_verifypeer);
- curl_setopt($ci, CURLOPT_HEADERFUNCTION, array($this, 'getHeader'));
- curl_setopt($ci, CURLOPT_HEADER, FALSE);
-
- switch ($method) {
- case 'POST':
- curl_setopt($ci, CURLOPT_POST, TRUE);
- if (!empty($postfields)) {
- curl_setopt($ci, CURLOPT_POSTFIELDS, $postfields);
- $this->postdata = $postfields;
- }
- break;
- case 'DELETE':
- curl_setopt($ci, CURLOPT_CUSTOMREQUEST, 'DELETE');
- if (!empty($postfields)) {
- $url = "{$url}?{$postfields}";
- }
- }
-
- curl_setopt($ci, CURLOPT_URL, $url );
- curl_setopt($ci, CURLOPT_HTTPHEADER, $headers );
- curl_setopt($ci, CURLINFO_HEADER_OUT, TRUE );
-
- $response = curl_exec($ci);
- $this->http_code = curl_getinfo($ci, CURLINFO_HTTP_CODE);
- $this->http_info = array_merge($this->http_info, curl_getinfo($ci));
- $this->url = $url;
-
- if ($this->debug) {
- echo "=====http code======\r\n";
- var_dump($this->http_code);
- echo "=====post data======\r\n";
- var_dump($postfields);
-
- echo '=====info====='."\r\n";
- print_r( curl_getinfo($ci) );
-
- echo '=====$response====='."\r\n";
- print_r( $response );
- }
- curl_close ($ci);
- return $response;
- }
-
- /**
- * Get the header info to store.
- *
- * @return int
- * @ignore
- */
- function getHeader($ch, $header) {
- $i = strpos($header, ':');
- if (!empty($i)) {
- $key = str_replace('-', '_', strtolower(substr($header, 0, $i)));
- $value = trim(substr($header, $i + 2));
- $this->http_header[$key] = $value;
- }
- return strlen($header);
- }
-
- /**
- * @ignore
- */
- public static function build_http_query_multi($params) {
- if (!$params) return '';
-
- uksort($params, 'strcmp');
-
- $pairs = array();
-
- self::$boundary = $boundary = uniqid('------------------');
- $MPboundary = '--'.$boundary;
- $endMPboundary = $MPboundary. '--';
- $multipartbody = '';
-
- foreach ($params as $parameter => $value) {
-
- if( in_array($parameter, array('pic', 'image')) && $value{0} == '@' ) {
- $url = ltrim( $value, '@' );
- $content = file_get_contents( $url );
- $array = explode( '?', basename( $url ) );
- $filename = $array[0];
-
- $multipartbody .= $MPboundary . "\r\n";
- $multipartbody .= 'Content-Disposition: form-data; name="' . $parameter . '"; filename="' . $filename . '"'. "\r\n";
- $multipartbody .= "Content-Type: image/unknown\r\n\r\n";
- $multipartbody .= $content. "\r\n";
- } else {
- $multipartbody .= $MPboundary . "\r\n";
- $multipartbody .= 'content-disposition: form-data; name="' . $parameter . "\"\r\n\r\n";
- $multipartbody .= $value."\r\n";
- }
-
- }
-
- $multipartbody .= $endMPboundary;
- return $multipartbody;
- }
-}
-
-
-
-class UcloudApiClient {
-
- function __construct( $base_url, $public_key, $private_key, $project_id)
- {
- $this->conn = new UConnection($base_url);
- $this->public_key = $public_key;
- $this->private_key = $private_key;
-
- if ($project_id !== "") {
- $this->project_id = $project_id;
- }
- }
-
- function get($api, $params){
- $params["PublicKey"] = $this->public_key;
-
- if ( isset($this->project_id) && !empty($this->project_id) )
- {
- $params["ProjectId"] = $this->project_id;
- }
- $params["Signature"] = _verfy_ac($this->private_key, $params);
- return $this->conn->get($api, $params);
- }
-
- function post($api, $params){
- $params["PublicKey"] = $this->PublicKey;
- if ( isset($this->project_id) && !empty($this->project_id) )
- {
- $params["ProjectId"] = $this->project_id;
- }
- $params["Signature"] = _verfy_ac($this->private_key, $params);
- return $this->conn->post($api, $params);
- }
-}
-
diff --git a/sendsms.php b/sendsms.php
deleted file mode 100644
index ee601c15..00000000
--- a/sendsms.php
+++ /dev/null
@@ -1,23 +0,0 @@
- $val){
- $params["Phone.".$key] = $val;
-}
-
-print_r($response = $conn->get("/", $params));
diff --git a/src/Core/Client.php b/src/Core/Client.php
new file mode 100644
index 00000000..1c3b1d2d
--- /dev/null
+++ b/src/Core/Client.php
@@ -0,0 +1,180 @@
+
+ */
+ private array $middlewares;
+
+ /**
+ * Transport object, customized transport is allowed
+ *
+ * @var TransportInterface
+ */
+ private TransportInterface $transport;
+
+ /**
+ * Client constructor.
+ *
+ * @param array $args configuration
+ */
+ public function __construct(array $args)
+ {
+ $this->credential = new Credential($args);
+ $this->config = new Config($args);
+ $this->middlewares = [
+ new DefaultsMiddleware(),
+ new CredentialMiddleware(),
+ new LogMiddleware(),
+ ];
+ $ua = sprintf("PHP/%s PHP-SDK/%s", phpversion(), self::VERSION);
+ if (!empty($this->config->getUserAgent())) {
+ $ua = $ua . " " . $this->config->getUserAgent();
+ }
+ $this->setTransport(new Transport($this->config->getBaseUrl(), $ua));
+ }
+
+ /**
+ * Invoke an api call from request object
+ *
+ * @param Request $req request object
+ * @return Response response
+ * @throws UCloudException
+ */
+ public function invoke(Request $req): Response
+ {
+ $ctx = new Context();
+ $ctx->setConfig($this->getConfig());
+ $ctx->setCredential($this->getCredential());
+
+ // resolve request
+ $ctx->setRequest($req);
+ foreach ($this->middlewares as $i => $m) {
+ $ctx->setRequest($m->handleRequest($ctx));
+ }
+
+ // do invoking
+ $resp = null;
+ $maxRetries = $req->loadMaxRetries();
+ for ($k = 0; $k <= $maxRetries; $k++) {
+ try {
+ $resp = $this->getTransport()->invoke($ctx->getRequest());
+ break;
+ } catch (UCloudException $e) {
+ $ctx->setException($e);
+ foreach ($this->middlewares as $i => $m) {
+ $m->handleException($ctx);
+ }
+ if ($k == $maxRetries) {
+ throw $e;
+ }
+ }
+ }
+
+ // resolve response
+ $ctx->setResponse($resp);
+ foreach ($this->middlewares as $i => $m) {
+ $ctx->setResponse($m->handleResponse($ctx));
+ }
+ return $ctx->getResponse();
+ }
+
+ /**
+ * Add a new middleware to client middlewares list
+ *
+ * @param Middleware $m middleware
+ */
+ public function useMiddleware(Middleware $m)
+ {
+ array_push($this->middlewares, $m);
+ }
+
+ /**
+ * Get config
+ *
+ * @return Config
+ */
+ public function getConfig(): Config
+ {
+ return $this->config;
+ }
+
+ /**
+ * Credential will return the credential object of the client
+ *
+ * @return Credential
+ */
+ public function getCredential(): Credential
+ {
+ return $this->credential;
+ }
+
+ /**
+ * Get transport
+ *
+ * @return TransportInterface transport
+ */
+ public function getTransport(): TransportInterface
+ {
+ return $this->transport;
+ }
+
+ /**
+ * Set transport
+ *
+ * @param TransportInterface $transport transport
+ */
+ public function setTransport(TransportInterface $transport): void
+ {
+ $this->transport = $transport;
+ }
+
+ /**
+ * A magic method to call action
+ *
+ * @codeCoverageIgnore
+ * @param string $product Product name, upper camel style
+ * @param string $action Action name
+ * @param Request $req Arguments of action
+ * @return Response
+ * @throws UCloudException
+ */
+ protected function call(string $product, string $action, Request $req): Response
+ {
+ $req->setAction($action);
+ $outputs = $this->invoke($req)->toArray();
+ $respClass = "UCloud"."\\".$product."\\"."Schema"."\\".$action."Response";
+ return new $respClass($outputs);
+ }
+}
diff --git a/src/Core/ClientInterface.php b/src/Core/ClientInterface.php
new file mode 100644
index 00000000..af9681b8
--- /dev/null
+++ b/src/Core/ClientInterface.php
@@ -0,0 +1,11 @@
+ ...
+ * - zone: (string) Zone is the zone of backend service
+ * See also ...
+ * - projectId: (string) ProjectId is the unique identify of project, used for organize resources,
+ * Most of resources should belong to a project.
+ * Sub-Account must have an project id.
+ * See also ...
+ * - baseUrl: (string) BaseUrl is the url of backend api.
+ * See also ...
+ * - userAgent: (string) UserAgent is an attribute for sdk client, used for distinguish who is using sdk.
+ * See also https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent
+ * It will be appended to the end of sdk user-agent.
+ * eg. "Terraform/0.10.1" -> "GO/1.9.1 GO-SDK/0.1.0 Terraform/0.10.1"
+ * NOTE: it will conflict with the User-Agent of HTTPHeaders
+ * - timeout: (string) Timeout is timeout for every request.
+ * - maxRetries: (string) MaxRetries is the number of max retry times.
+ * Set MaxRetries more than 0 to enable auto-retry for network and service availability problem
+ * if auto-retry is enabled, it will enable default retry policy using exponential backoff.
+ * - logger: (LoggerInterface) if logLevel not be set, use INFO level as default.
+ *
+ * @param array $args arguments
+ */
+ public function __construct(array $args)
+ {
+ $this->setRegion($args["region"] ?? "");
+ $this->setProjectId($args["projectId"] ?? "");
+ $this->setBaseUrl($args["baseUrl"] ?? "https://api.ucloud.cn");
+ $this->setUserAgent($args["userAgent"] ?? "");
+ $this->setTimeout($args["timeout"] ?? 30);
+ $this->setMaxRetries($args["maxRetries"] ?? 0);
+ $this->setLogger($args["logger"] ?? new DefaultLogger());
+ }
+
+ /**
+ * Get region
+ *
+ * @return string
+ */
+ public function getRegion(): string
+ {
+ return $this->region;
+ }
+
+ /**
+ * Set region
+ *
+ * @param string $region region
+ */
+ public function setRegion(string $region)
+ {
+ $this->region = $region;
+ }
+
+ /**
+ * Get project id
+ *
+ * @return string
+ */
+ public function getProjectId(): string
+ {
+ return $this->projectId;
+ }
+
+ /**
+ * Set project id
+ *
+ * @param string $projectId project id
+ */
+ public function setProjectId(string $projectId)
+ {
+ $this->projectId = $projectId;
+ }
+
+ /**
+ * Get base url
+ *
+ * @return string
+ */
+ public function getBaseUrl(): string
+ {
+ return $this->baseUrl;
+ }
+
+ /**
+ * Set base url
+ *
+ * @param string $baseUrl base url
+ */
+ public function setBaseUrl(string $baseUrl)
+ {
+ $this->baseUrl = $baseUrl;
+ }
+
+ /**
+ * Get user agent
+ *
+ * @return string
+ */
+ public function getUserAgent(): string
+ {
+ return $this->userAgent;
+ }
+
+ /**
+ * Set user agent
+ *
+ * @param string $userAgent user agent
+ */
+ public function setUserAgent(string $userAgent)
+ {
+ $this->userAgent = $userAgent;
+ }
+
+ /**
+ * Get timeout
+ *
+ * @return integer
+ */
+ public function getTimeout(): int
+ {
+ return $this->timeout;
+ }
+
+ /**
+ * Set timeout
+ *
+ * @param int $timeout timeout
+ */
+ public function setTimeout(int $timeout)
+ {
+ $this->timeout = $timeout;
+ }
+
+ /**
+ * Get max retries
+ *
+ * @return integer
+ */
+ public function getMaxRetries(): int
+ {
+ return $this->maxRetries;
+ }
+
+ /**
+ * Set max retries
+ *
+ * @param int $maxRetries max retries
+ */
+ public function setMaxRetries(int $maxRetries)
+ {
+ $this->maxRetries = $maxRetries;
+ }
+
+ /**
+ * Get logger
+ *
+ * @return LoggerInterface
+ */
+ public function getLogger(): LoggerInterface
+ {
+ return $this->logger;
+ }
+
+ /**
+ * Set logger
+ *
+ * @param LoggerInterface $logger logger
+ */
+ public function setLogger(LoggerInterface $logger): void
+ {
+ $this->logger = $logger;
+ }
+}
diff --git a/src/Core/Credential/Credential.php b/src/Core/Credential/Credential.php
new file mode 100644
index 00000000..056fb0d8
--- /dev/null
+++ b/src/Core/Credential/Credential.php
@@ -0,0 +1,103 @@
+setPrivateKey($args["privateKey"]);
+ $this->setPublicKey($args["publicKey"]);
+ }
+
+ /**
+ * Generate signature string from an array
+ *
+ * @param array $args arguments to generate signature
+ * @return string the signature
+ */
+ public function verifyAc(array $args): string
+ {
+ $args['PublicKey'] = $this->getPublicKey();
+ ksort($args);
+ $s = "";
+ foreach ($args as $key => $value) {
+ $s .= $key;
+ $s .= $value;
+ }
+ $s .= $this->getPrivateKey();
+ return sha1($s);
+ }
+
+ /**
+ * Attach signature and additional key fields to an array
+ *
+ * @param array $args arguments to by attached
+ * @return array array with signature and keys
+ */
+ public function sign(array $args): array
+ {
+ $args['Signature'] = $this->verifyAc($args);
+ $args['PublicKey'] = $this->getPublicKey();
+ return $args;
+ }
+
+ /**
+ * Get public key
+ *
+ * @return string
+ */
+ public function getPublicKey(): string
+ {
+ return $this->publicKey;
+ }
+
+ /**
+ * Set public key
+ *
+ * @param string $publicKey Public key
+ */
+ public function setPublicKey(string $publicKey): void
+ {
+ $this->publicKey = $publicKey;
+ }
+
+ /**
+ * Get private key
+ *
+ * @return string
+ */
+ public function getPrivateKey(): string
+ {
+ return $this->privateKey;
+ }
+
+ /**
+ * Set private key
+ *
+ * @param string $privateKey Private key
+ */
+ public function setPrivateKey(string $privateKey): void
+ {
+ $this->privateKey = $privateKey;
+ }
+}
diff --git a/src/Core/Credential/CredentialInterface.php b/src/Core/Credential/CredentialInterface.php
new file mode 100644
index 00000000..57d27bfd
--- /dev/null
+++ b/src/Core/Credential/CredentialInterface.php
@@ -0,0 +1,27 @@
+getRequest();
+ $cred = $ctx->getCredential();
+ return new Request($cred->sign($req->toArray()));
+ }
+}
diff --git a/src/Core/DefaultsMiddleware.php b/src/Core/DefaultsMiddleware.php
new file mode 100644
index 00000000..bb345b59
--- /dev/null
+++ b/src/Core/DefaultsMiddleware.php
@@ -0,0 +1,44 @@
+getRequest();
+ $cfg = $ctx->getConfig();
+
+ if (!$req->has(self::FIELD_REGION) && $cfg->getRegion() != "") {
+ $req->set(self::FIELD_REGION, $cfg->getRegion());
+ }
+
+ if (!$req->has(self::FIELD_PROJECT_ID) && $cfg->getProjectId() != "") {
+ $req->set(self::FIELD_PROJECT_ID, $cfg->getProjectId());
+ }
+
+ if ($req->loadMaxRetries() == 0) {
+ $req->withMaxRetries($cfg->getMaxRetries());
+ }
+
+ if ($req->loadTimeout() == 0) {
+ $req->withTimeout($cfg->getTimeout());
+ }
+ $req->validate();
+ return $req;
+ }
+}
diff --git a/src/Core/Exception/UCloudException.php b/src/Core/Exception/UCloudException.php
new file mode 100644
index 00000000..2138b870
--- /dev/null
+++ b/src/Core/Exception/UCloudException.php
@@ -0,0 +1,59 @@
+type = $type;
+ $this->requestId = $requestId;
+ parent::__construct($message, $retCode, $previous);
+ }
+
+ /**
+ * Get type
+ *
+ * @return string
+ */
+ public function getType(): string
+ {
+ return $this->type;
+ }
+
+ /**
+ * Get request id
+ *
+ * @return string
+ */
+ public function getRequestId(): string
+ {
+ return $this->requestId;
+ }
+}
diff --git a/src/Core/LogMiddleware.php b/src/Core/LogMiddleware.php
new file mode 100644
index 00000000..593698dd
--- /dev/null
+++ b/src/Core/LogMiddleware.php
@@ -0,0 +1,42 @@
+getRequest();
+ $logger = $ctx->getConfig()->getLogger();
+ if ($logger != null) {
+ $logger->info(sprintf("[request] %s", json_encode($req->toArray())));
+ }
+ return $req;
+ }
+
+ public function handleResponse(Context $ctx): Response
+ {
+ $resp = $ctx->getResponse();
+ $logger = $ctx->getConfig()->getLogger();
+ if ($logger != null) {
+ $body = $resp->toArray();
+ $logger->info(sprintf("[response: %s] %s", $resp->getRequestId(), json_encode($body)));
+ }
+ return $resp;
+ }
+
+ public function handleException(Context $ctx)
+ {
+ $e = $ctx->getException();
+ $logger = $ctx->getConfig()->getLogger();
+ if ($logger != null) {
+ $logger->error(sprintf("[response: %s] %s Error: %s", $e->getRequestId(), $e->getType(), $e->getMessage()));
+ }
+ }
+}
diff --git a/src/Core/Logger/DefaultLogger.php b/src/Core/Logger/DefaultLogger.php
new file mode 100644
index 00000000..8cdcc9df
--- /dev/null
+++ b/src/Core/Logger/DefaultLogger.php
@@ -0,0 +1,18 @@
+credential;
+ }
+
+ /**
+ * Set credential
+ *
+ * @param Credential $credential Credential
+ */
+ public function setCredential(Credential $credential): void
+ {
+ $this->credential = $credential;
+ }
+
+ /**
+ * Get config
+ *
+ * @return Config
+ */
+ public function getConfig(): Config
+ {
+ return $this->config;
+ }
+
+ /**
+ * Set config
+ *
+ * @param Config $config Config
+ */
+ public function setConfig(Config $config): void
+ {
+ $this->config = $config;
+ }
+
+ /**
+ * Get request
+ *
+ * @return Request
+ */
+ public function getRequest(): Request
+ {
+ return $this->request;
+ }
+
+ /**
+ * Set request
+ *
+ * @param Request $request Request
+ */
+ public function setRequest(Request $request): void
+ {
+ $this->request = $request;
+ }
+
+ /**
+ * Get response
+ *
+ * @return Response
+ */
+ public function getResponse(): Response
+ {
+ return $this->response;
+ }
+
+ /**
+ * Set response
+ *
+ * @param Response $response Response
+ */
+ public function setResponse(Response $response): void
+ {
+ $this->response = $response;
+ }
+
+ /**
+ * Get exception
+ *
+ * @return UCloudException
+ */
+ public function getException(): UCloudException
+ {
+ return $this->exception;
+ }
+
+ /**
+ * Set exception
+ *
+ * @param UCloudException $exception Exception
+ */
+ public function setException(UCloudException $exception): void
+ {
+ $this->exception = $exception;
+ }
+}
diff --git a/src/Core/Middleware/Middleware.php b/src/Core/Middleware/Middleware.php
new file mode 100644
index 00000000..93b54b09
--- /dev/null
+++ b/src/Core/Middleware/Middleware.php
@@ -0,0 +1,24 @@
+getRequest();
+ }
+
+ public function handleResponse(Context $ctx): Response
+ {
+ return $ctx->getResponse();
+ }
+
+ public function handleException(Context $ctx)
+ {
+ }
+}
diff --git a/src/Core/Middleware/MiddlewareInterface.php b/src/Core/Middleware/MiddlewareInterface.php
new file mode 100644
index 00000000..9f60a1bb
--- /dev/null
+++ b/src/Core/Middleware/MiddlewareInterface.php
@@ -0,0 +1,15 @@
+args = $args ?? [];
+ }
+
+ /**
+ * Set any field in first-level of data
+ *
+ * @param string $key field name
+ * @param mixed $value field value
+ */
+ public function set(string $key, mixed $value)
+ {
+ $this->args[$key] = $value;
+ }
+
+ /**
+ * Get any field in first-level of data
+ *
+ * @param string $key field name
+ * @return mixed
+ */
+ public function get(string $key)
+ {
+ return $this->args[$key] ?? null;
+ }
+
+ /**
+ * Check any field is exists in first-level of data
+ *
+ * @param string $key field name
+ * @return boolean
+ */
+ public function has(string $key): bool
+ {
+ return array_key_exists($key, $this->args);
+ }
+
+ /**
+ * Get action name
+ *
+ * @return string
+ */
+ public function getAction(): string
+ {
+ return $this->get(self::FIELD_ACTION);
+ }
+
+ /**
+ * Set action name
+ *
+ * @param string $action action name
+ */
+ public function setAction(string $action)
+ {
+ $this->set(self::FIELD_ACTION, $action);
+ }
+
+ /**
+ * Convert request object to array
+ *
+ * @return array
+ */
+ public function toArray(): array
+ {
+ return $this->encode($this->args);
+ }
+
+ /**
+ * Add required field
+ *
+ * @param string $field
+ */
+ public function markRequired(string $field)
+ {
+ array_push($this->requiredFields, $field);
+ }
+
+ /**
+ * Validate data
+ *
+ * @throws UCloudException
+ */
+ public function validate()
+ {
+ $fields = [];
+ foreach ($this->requiredFields as $i => $field) {
+ if ($this->get($field) != null) {
+ continue;
+ }
+ array_push($fields, $field);
+ }
+
+ if (!empty($fields)) {
+ throw new UCloudException(
+ UCloudException::EXC_TYPE_VALIDATION,
+ "field " . implode(",", $fields) . " is required",
+ -1,
+ );
+ }
+ }
+
+ /**
+ * Get all data for arguments
+ *
+ * @return array
+ */
+ public function getAll(): array
+ {
+ return $this->args;
+ }
+
+ /**
+ * Encode request data to one-level style
+ *
+ * @param array $args array of arguments
+ * @return array
+ */
+ private static function encode(array $args): array
+ {
+ $result = [];
+ foreach ($args as $key => $value) {
+ if (is_array($value)) {
+ $values = Request::encode($value);
+ foreach ($values as $i => $v) {
+ $result[$key . '.' . $i] = $v;
+ }
+ } else {
+ $result[$key] = $value;
+ }
+ }
+ return $result;
+ }
+
+ /**
+ * Get timeout
+ *
+ * @return integer
+ */
+ public function loadTimeout(): int
+ {
+ return $this->timeout || 0;
+ }
+
+ /**
+ * Set timeout
+ *
+ * @param int $timeout timeout
+ */
+ public function withTimeout(int $timeout): void
+ {
+ $this->timeout = $timeout;
+ }
+
+ /**
+ * Get max retries
+ *
+ * @return integer
+ */
+ public function loadMaxRetries(): int
+ {
+ return $this->maxRetries || 0;
+ }
+
+ /**
+ * Set max retries
+ *
+ * @param int $maxRetries max retries
+ */
+ public function withMaxRetries(int $maxRetries): void
+ {
+ $this->maxRetries = $maxRetries;
+ }
+}
diff --git a/src/Core/Request/RequestInterface.php b/src/Core/Request/RequestInterface.php
new file mode 100644
index 00000000..736c4f10
--- /dev/null
+++ b/src/Core/Request/RequestInterface.php
@@ -0,0 +1,13 @@
+data = $data;
+ $this->requestId = $requestId;
+ }
+
+ /**
+ * Set any field in first-level of data
+ *
+ * @param string $key field name
+ * @param mixed $value field value
+ */
+ public function set(string $key, mixed $value)
+ {
+ $this->data[$key] = $value;
+ }
+
+ /**
+ * Get any field in first-level of data
+ *
+ * @param string $key field name
+ * @return mixed
+ */
+ public function get(string $key)
+ {
+ return $this->data[$key];
+ }
+
+ public function toArray(): array
+ {
+ return $this->data;
+ }
+
+ public function getRetCode(): int
+ {
+ return $this->data["RetCode"] ?? 0;
+ }
+
+ public function getMessage(): string
+ {
+ return $this->data["Message"] ?? "";
+ }
+
+ public function getRequestId()
+ {
+ return $this->requestId;
+ }
+}
diff --git a/src/Core/Response/ResponseInterface.php b/src/Core/Response/ResponseInterface.php
new file mode 100644
index 00000000..a4d0f8c6
--- /dev/null
+++ b/src/Core/Response/ResponseInterface.php
@@ -0,0 +1,13 @@
+baseUrl = $baseUrl;
+ $this->userAgent = $userAgent;
+ $this->client = new Client($options);
+ }
+
+ /**
+ * Invoke action with request object
+ *
+ * @param Request $req request
+ * @return Response
+ * @throws UCloudException
+ */
+ public function invoke(Request $req): Response
+ {
+ // do http request
+ try {
+ $response = $this->client->post($this->baseUrl, [
+ RequestOptions::JSON => $req->toArray(),
+ RequestOptions::TIMEOUT => $req->loadTimeout(),
+ RequestOptions::HEADERS => [
+ "User-Agent" => $this->userAgent,
+ ],
+ ]);
+ } catch (Throwable $e) {
+ throw new UCloudException(
+ UCloudException::EXC_TYPE_TRANSPORT,
+ $e->getMessage(),
+ -1,
+ $e,
+ );
+ }
+
+ // resolve http response
+ $ids = $response->getHeader(self::HEADER_REQUEST_ID);
+ $requestId = array_pop($ids) ?? "";
+ $resp = new Response(json_decode($response->getBody(), true), $requestId);
+ if ($resp->getRetCode() != 0) {
+ throw new UCloudException(
+ UCloudException::EXC_TYPE_RET_CODE,
+ $resp->getMessage(),
+ $resp->getRetCode(),
+ null,
+ $requestId,
+ );
+ }
+ return $resp;
+ }
+}
diff --git a/src/Core/Transport/TransportInterface.php b/src/Core/Transport/TransportInterface.php
new file mode 100644
index 00000000..1a007238
--- /dev/null
+++ b/src/Core/Transport/TransportInterface.php
@@ -0,0 +1,12 @@
+ "CreateCubeDeployment"]);
+ $this->markRequired("Region");
+ $this->markRequired("Zone");
+ $this->markRequired("VPCId");
+ $this->markRequired("SubnetId");
+ $this->markRequired("Deployment");
+ }
+
+
+
+ /**
+ * Region: 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ *
+ * @return string|null
+ */
+ public function getRegion(): string
+ {
+ return $this->get("Region");
+ }
+
+ /**
+ * Region: 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ *
+ * @param string $region
+ */
+ public function setRegion(string $region)
+ {
+ $this->set("Region", $region);
+ }
+
+ /**
+ * Zone: 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ *
+ * @return string|null
+ */
+ public function getZone(): string
+ {
+ return $this->get("Zone");
+ }
+
+ /**
+ * Zone: 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ *
+ * @param string $zone
+ */
+ public function setZone(string $zone)
+ {
+ $this->set("Zone", $zone);
+ }
+
+ /**
+ * ProjectId: 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list)
+ *
+ * @return string|null
+ */
+ public function getProjectId(): string
+ {
+ return $this->get("ProjectId");
+ }
+
+ /**
+ * ProjectId: 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list)
+ *
+ * @param string $projectId
+ */
+ public function setProjectId(string $projectId)
+ {
+ $this->set("ProjectId", $projectId);
+ }
+
+ /**
+ * VPCId: VPCId
+ *
+ * @return string|null
+ */
+ public function getVPCId(): string
+ {
+ return $this->get("VPCId");
+ }
+
+ /**
+ * VPCId: VPCId
+ *
+ * @param string $vpcId
+ */
+ public function setVPCId(string $vpcId)
+ {
+ $this->set("VPCId", $vpcId);
+ }
+
+ /**
+ * SubnetId: 子网Id
+ *
+ * @return string|null
+ */
+ public function getSubnetId(): string
+ {
+ return $this->get("SubnetId");
+ }
+
+ /**
+ * SubnetId: 子网Id
+ *
+ * @param string $subnetId
+ */
+ public function setSubnetId(string $subnetId)
+ {
+ $this->set("SubnetId", $subnetId);
+ }
+
+ /**
+ * Deployment: base64编码的Deployment的yaml。大小不超过16KB
+ *
+ * @return string|null
+ */
+ public function getDeployment(): string
+ {
+ return $this->get("Deployment");
+ }
+
+ /**
+ * Deployment: base64编码的Deployment的yaml。大小不超过16KB
+ *
+ * @param string $deployment
+ */
+ public function setDeployment(string $deployment)
+ {
+ $this->set("Deployment", $deployment);
+ }
+
+ /**
+ * Name: Deployment名称
+ *
+ * @return string|null
+ */
+ public function getName(): string
+ {
+ return $this->get("Name");
+ }
+
+ /**
+ * Name: Deployment名称
+ *
+ * @param string $name
+ */
+ public function setName(string $name)
+ {
+ $this->set("Name", $name);
+ }
+
+ /**
+ * ChargeType: 计费模式。枚举值为: \\ > Year,按年付费; \\ > Month,按月付费;\\ > Postpay, \\ 后付费;默认为后付费
+ *
+ * @return string|null
+ */
+ public function getChargeType(): string
+ {
+ return $this->get("ChargeType");
+ }
+
+ /**
+ * ChargeType: 计费模式。枚举值为: \\ > Year,按年付费; \\ > Month,按月付费;\\ > Postpay, \\ 后付费;默认为后付费
+ *
+ * @param string $chargeType
+ */
+ public function setChargeType(string $chargeType)
+ {
+ $this->set("ChargeType", $chargeType);
+ }
+
+ /**
+ * CpuPlatform: Cpu平台(V6:Intel、A2:AMD),默认V6。支持的地域(北京2B、北京2E、上海2A、广东、香港 、东京)目前北京2E仅有A2,其余地域仅有V6
+ *
+ * @return string|null
+ */
+ public function getCpuPlatform(): string
+ {
+ return $this->get("CpuPlatform");
+ }
+
+ /**
+ * CpuPlatform: Cpu平台(V6:Intel、A2:AMD),默认V6。支持的地域(北京2B、北京2E、上海2A、广东、香港 、东京)目前北京2E仅有A2,其余地域仅有V6
+ *
+ * @param string $cpuPlatform
+ */
+ public function setCpuPlatform(string $cpuPlatform)
+ {
+ $this->set("CpuPlatform", $cpuPlatform);
+ }
+
+ /**
+ * KubeConfig: base64编码的kubeconfig。大小不超过16KB
+ *
+ * @return string|null
+ */
+ public function getKubeConfig(): string
+ {
+ return $this->get("KubeConfig");
+ }
+
+ /**
+ * KubeConfig: base64编码的kubeconfig。大小不超过16KB
+ *
+ * @param string $kubeConfig
+ */
+ public function setKubeConfig(string $kubeConfig)
+ {
+ $this->set("KubeConfig", $kubeConfig);
+ }
+
+ /**
+ * Quantity: 购买时长。默认:值 1。 月付时,此参数传0,代表购买至月末。
+ *
+ * @return integer|null
+ */
+ public function getQuantity(): int
+ {
+ return $this->get("Quantity");
+ }
+
+ /**
+ * Quantity: 购买时长。默认:值 1。 月付时,此参数传0,代表购买至月末。
+ *
+ * @param int $quantity
+ */
+ public function setQuantity(int $quantity)
+ {
+ $this->set("Quantity", $quantity);
+ }
+
+ /**
+ * Tag: 业务组。默认:Default(Default即为未分组)
+ *
+ * @return string|null
+ */
+ public function getTag(): string
+ {
+ return $this->get("Tag");
+ }
+
+ /**
+ * Tag: 业务组。默认:Default(Default即为未分组)
+ *
+ * @param string $tag
+ */
+ public function setTag(string $tag)
+ {
+ $this->set("Tag", $tag);
+ }
+}
diff --git a/src/Cube/Apis/CreateCubeDeploymentResponse.php b/src/Cube/Apis/CreateCubeDeploymentResponse.php
new file mode 100644
index 00000000..199e85f8
--- /dev/null
+++ b/src/Cube/Apis/CreateCubeDeploymentResponse.php
@@ -0,0 +1,64 @@
+get("DeploymentId");
+ }
+
+ /**
+ * DeploymentId: 控制器ID
+ *
+ * @param string $deploymentId
+ */
+ public function setDeploymentId(string $deploymentId)
+ {
+ $this->set("DeploymentId", $deploymentId);
+ }
+
+ /**
+ * Deployment: 经过base64编码的Deployment的yaml
+ *
+ * @return string|null
+ */
+ public function getDeployment(): string
+ {
+ return $this->get("Deployment");
+ }
+
+ /**
+ * Deployment: 经过base64编码的Deployment的yaml
+ *
+ * @param string $deployment
+ */
+ public function setDeployment(string $deployment)
+ {
+ $this->set("Deployment", $deployment);
+ }
+}
diff --git a/src/Cube/Apis/CreateCubePodRequest.php b/src/Cube/Apis/CreateCubePodRequest.php
new file mode 100644
index 00000000..37476e50
--- /dev/null
+++ b/src/Cube/Apis/CreateCubePodRequest.php
@@ -0,0 +1,314 @@
+ "CreateCubePod"]);
+ $this->markRequired("Region");
+ $this->markRequired("Zone");
+ $this->markRequired("VPCId");
+ $this->markRequired("SubnetId");
+ $this->markRequired("Pod");
+ }
+
+
+
+ /**
+ * Region: 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ *
+ * @return string|null
+ */
+ public function getRegion(): string
+ {
+ return $this->get("Region");
+ }
+
+ /**
+ * Region: 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ *
+ * @param string $region
+ */
+ public function setRegion(string $region)
+ {
+ $this->set("Region", $region);
+ }
+
+ /**
+ * Zone: 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ *
+ * @return string|null
+ */
+ public function getZone(): string
+ {
+ return $this->get("Zone");
+ }
+
+ /**
+ * Zone: 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ *
+ * @param string $zone
+ */
+ public function setZone(string $zone)
+ {
+ $this->set("Zone", $zone);
+ }
+
+ /**
+ * ProjectId: 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list)
+ *
+ * @return string|null
+ */
+ public function getProjectId(): string
+ {
+ return $this->get("ProjectId");
+ }
+
+ /**
+ * ProjectId: 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list)
+ *
+ * @param string $projectId
+ */
+ public function setProjectId(string $projectId)
+ {
+ $this->set("ProjectId", $projectId);
+ }
+
+ /**
+ * VPCId: VPCId
+ *
+ * @return string|null
+ */
+ public function getVPCId(): string
+ {
+ return $this->get("VPCId");
+ }
+
+ /**
+ * VPCId: VPCId
+ *
+ * @param string $vpcId
+ */
+ public function setVPCId(string $vpcId)
+ {
+ $this->set("VPCId", $vpcId);
+ }
+
+ /**
+ * SubnetId: 子网Id
+ *
+ * @return string|null
+ */
+ public function getSubnetId(): string
+ {
+ return $this->get("SubnetId");
+ }
+
+ /**
+ * SubnetId: 子网Id
+ *
+ * @param string $subnetId
+ */
+ public function setSubnetId(string $subnetId)
+ {
+ $this->set("SubnetId", $subnetId);
+ }
+
+ /**
+ * Pod: base64编码的Pod的yaml。大小不超过16KB
+ *
+ * @return string|null
+ */
+ public function getPod(): string
+ {
+ return $this->get("Pod");
+ }
+
+ /**
+ * Pod: base64编码的Pod的yaml。大小不超过16KB
+ *
+ * @param string $pod
+ */
+ public function setPod(string $pod)
+ {
+ $this->set("Pod", $pod);
+ }
+
+ /**
+ * Group: pod所在组
+ *
+ * @return string|null
+ */
+ public function getGroup(): string
+ {
+ return $this->get("Group");
+ }
+
+ /**
+ * Group: pod所在组
+ *
+ * @param string $group
+ */
+ public function setGroup(string $group)
+ {
+ $this->set("Group", $group);
+ }
+
+ /**
+ * Name: pod的名字
+ *
+ * @return string|null
+ */
+ public function getName(): string
+ {
+ return $this->get("Name");
+ }
+
+ /**
+ * Name: pod的名字
+ *
+ * @param string $name
+ */
+ public function setName(string $name)
+ {
+ $this->set("Name", $name);
+ }
+
+ /**
+ * Tag: 业务组。默认:Default(Default即为未分组)
+ *
+ * @return string|null
+ */
+ public function getTag(): string
+ {
+ return $this->get("Tag");
+ }
+
+ /**
+ * Tag: 业务组。默认:Default(Default即为未分组)
+ *
+ * @param string $tag
+ */
+ public function setTag(string $tag)
+ {
+ $this->set("Tag", $tag);
+ }
+
+ /**
+ * CpuPlatform: Cpu平台(V6:Intel、A2:AMD、Auto),默认Auto。支持的地域(北京2B、北京2E、上海2A、广东、香港 、东京)目前北京2E仅有A2,其余地域仅有V6
+ *
+ * @return string|null
+ */
+ public function getCpuPlatform(): string
+ {
+ return $this->get("CpuPlatform");
+ }
+
+ /**
+ * CpuPlatform: Cpu平台(V6:Intel、A2:AMD、Auto),默认Auto。支持的地域(北京2B、北京2E、上海2A、广东、香港 、东京)目前北京2E仅有A2,其余地域仅有V6
+ *
+ * @param string $cpuPlatform
+ */
+ public function setCpuPlatform(string $cpuPlatform)
+ {
+ $this->set("CpuPlatform", $cpuPlatform);
+ }
+
+ /**
+ * ChargeType: 计费模式。枚举值为: \\ > Year,按年付费; \\ > Month,按月付费;\\ > Postpay, \\ 后付费;默认为后付费
+ *
+ * @return string|null
+ */
+ public function getChargeType(): string
+ {
+ return $this->get("ChargeType");
+ }
+
+ /**
+ * ChargeType: 计费模式。枚举值为: \\ > Year,按年付费; \\ > Month,按月付费;\\ > Postpay, \\ 后付费;默认为后付费
+ *
+ * @param string $chargeType
+ */
+ public function setChargeType(string $chargeType)
+ {
+ $this->set("ChargeType", $chargeType);
+ }
+
+ /**
+ * Quantity: 购买时长。默认:值 1。 月付时,此参数传0,代表购买至月末。
+ *
+ * @return integer|null
+ */
+ public function getQuantity(): int
+ {
+ return $this->get("Quantity");
+ }
+
+ /**
+ * Quantity: 购买时长。默认:值 1。 月付时,此参数传0,代表购买至月末。
+ *
+ * @param int $quantity
+ */
+ public function setQuantity(int $quantity)
+ {
+ $this->set("Quantity", $quantity);
+ }
+
+ /**
+ * KubeConfig: base64编码的kubeconfig。大小不超过16KB
+ *
+ * @return string|null
+ */
+ public function getKubeConfig(): string
+ {
+ return $this->get("KubeConfig");
+ }
+
+ /**
+ * KubeConfig: base64编码的kubeconfig。大小不超过16KB
+ *
+ * @param string $kubeConfig
+ */
+ public function setKubeConfig(string $kubeConfig)
+ {
+ $this->set("KubeConfig", $kubeConfig);
+ }
+
+ /**
+ * CouponId: 代金券ID。请通过DescribeCoupon接口查询,或登录用户中心查看
+ *
+ * @return string|null
+ */
+ public function getCouponId(): string
+ {
+ return $this->get("CouponId");
+ }
+
+ /**
+ * CouponId: 代金券ID。请通过DescribeCoupon接口查询,或登录用户中心查看
+ *
+ * @param string $couponId
+ */
+ public function setCouponId(string $couponId)
+ {
+ $this->set("CouponId", $couponId);
+ }
+}
diff --git a/src/Cube/Apis/CreateCubePodResponse.php b/src/Cube/Apis/CreateCubePodResponse.php
new file mode 100644
index 00000000..4f7c574c
--- /dev/null
+++ b/src/Cube/Apis/CreateCubePodResponse.php
@@ -0,0 +1,64 @@
+get("Pod");
+ }
+
+ /**
+ * Pod: base64编码的yaml
+ *
+ * @param string $pod
+ */
+ public function setPod(string $pod)
+ {
+ $this->set("Pod", $pod);
+ }
+
+ /**
+ * CubeId: cube的资源Id
+ *
+ * @return string|null
+ */
+ public function getCubeId(): string
+ {
+ return $this->get("CubeId");
+ }
+
+ /**
+ * CubeId: cube的资源Id
+ *
+ * @param string $cubeId
+ */
+ public function setCubeId(string $cubeId)
+ {
+ $this->set("CubeId", $cubeId);
+ }
+}
diff --git a/src/Cube/Apis/DeleteCubeDeploymentRequest.php b/src/Cube/Apis/DeleteCubeDeploymentRequest.php
new file mode 100644
index 00000000..ccde6f41
--- /dev/null
+++ b/src/Cube/Apis/DeleteCubeDeploymentRequest.php
@@ -0,0 +1,111 @@
+ "DeleteCubeDeployment"]);
+ $this->markRequired("Region");
+ $this->markRequired("DeploymentId");
+ }
+
+
+
+ /**
+ * Region: 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ *
+ * @return string|null
+ */
+ public function getRegion(): string
+ {
+ return $this->get("Region");
+ }
+
+ /**
+ * Region: 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ *
+ * @param string $region
+ */
+ public function setRegion(string $region)
+ {
+ $this->set("Region", $region);
+ }
+
+ /**
+ * Zone: 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ *
+ * @return string|null
+ */
+ public function getZone(): string
+ {
+ return $this->get("Zone");
+ }
+
+ /**
+ * Zone: 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ *
+ * @param string $zone
+ */
+ public function setZone(string $zone)
+ {
+ $this->set("Zone", $zone);
+ }
+
+ /**
+ * ProjectId: 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list)
+ *
+ * @return string|null
+ */
+ public function getProjectId(): string
+ {
+ return $this->get("ProjectId");
+ }
+
+ /**
+ * ProjectId: 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list)
+ *
+ * @param string $projectId
+ */
+ public function setProjectId(string $projectId)
+ {
+ $this->set("ProjectId", $projectId);
+ }
+
+ /**
+ * DeploymentId: 控制器Id
+ *
+ * @return string|null
+ */
+ public function getDeploymentId(): string
+ {
+ return $this->get("DeploymentId");
+ }
+
+ /**
+ * DeploymentId: 控制器Id
+ *
+ * @param string $deploymentId
+ */
+ public function setDeploymentId(string $deploymentId)
+ {
+ $this->set("DeploymentId", $deploymentId);
+ }
+}
diff --git a/src/Cube/Apis/DeleteCubeDeploymentResponse.php b/src/Cube/Apis/DeleteCubeDeploymentResponse.php
new file mode 100644
index 00000000..461c9fa3
--- /dev/null
+++ b/src/Cube/Apis/DeleteCubeDeploymentResponse.php
@@ -0,0 +1,26 @@
+ "DeleteCubePod"]);
+ $this->markRequired("Region");
+ $this->markRequired("ProjectId");
+ }
+
+
+
+ /**
+ * Region: 地域。 参见 [地域和可用区列表](../summary/regionlist.html)
+ *
+ * @return string|null
+ */
+ public function getRegion(): string
+ {
+ return $this->get("Region");
+ }
+
+ /**
+ * Region: 地域。 参见 [地域和可用区列表](../summary/regionlist.html)
+ *
+ * @param string $region
+ */
+ public function setRegion(string $region)
+ {
+ $this->set("Region", $region);
+ }
+
+ /**
+ * Zone: 可用区。参见 [可用区列表](../summary/regionlist.html)
+ *
+ * @return string|null
+ */
+ public function getZone(): string
+ {
+ return $this->get("Zone");
+ }
+
+ /**
+ * Zone: 可用区。参见 [可用区列表](../summary/regionlist.html)
+ *
+ * @param string $zone
+ */
+ public function setZone(string $zone)
+ {
+ $this->set("Zone", $zone);
+ }
+
+ /**
+ * ProjectId: 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html)
+ *
+ * @return string|null
+ */
+ public function getProjectId(): string
+ {
+ return $this->get("ProjectId");
+ }
+
+ /**
+ * ProjectId: 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html)
+ *
+ * @param string $projectId
+ */
+ public function setProjectId(string $projectId)
+ {
+ $this->set("ProjectId", $projectId);
+ }
+
+ /**
+ * Uid: cubeid和uid任意一个(必须)
+ *
+ * @return string|null
+ */
+ public function getUid(): string
+ {
+ return $this->get("Uid");
+ }
+
+ /**
+ * Uid: cubeid和uid任意一个(必须)
+ *
+ * @param string $uid
+ */
+ public function setUid(string $uid)
+ {
+ $this->set("Uid", $uid);
+ }
+
+ /**
+ * CubeId: cubeid和uid任意一个(必须)
+ *
+ * @return string|null
+ */
+ public function getCubeId(): string
+ {
+ return $this->get("CubeId");
+ }
+
+ /**
+ * CubeId: cubeid和uid任意一个(必须)
+ *
+ * @param string $cubeId
+ */
+ public function setCubeId(string $cubeId)
+ {
+ $this->set("CubeId", $cubeId);
+ }
+
+ /**
+ * ReleaseEIP: 删除cube时是否释放绑定的EIP。默认为false。
+ *
+ * @return boolean|null
+ */
+ public function getReleaseEIP(): bool
+ {
+ return $this->get("ReleaseEIP");
+ }
+
+ /**
+ * ReleaseEIP: 删除cube时是否释放绑定的EIP。默认为false。
+ *
+ * @param boolean $releaseEIP
+ */
+ public function setReleaseEIP(bool $releaseEIP)
+ {
+ $this->set("ReleaseEIP", $releaseEIP);
+ }
+}
diff --git a/src/Cube/Apis/DeleteCubePodResponse.php b/src/Cube/Apis/DeleteCubePodResponse.php
new file mode 100644
index 00000000..fa45cd5c
--- /dev/null
+++ b/src/Cube/Apis/DeleteCubePodResponse.php
@@ -0,0 +1,26 @@
+ "GetCubeDeployment"]);
+ $this->markRequired("Region");
+ $this->markRequired("DeploymentId");
+ }
+
+
+
+ /**
+ * Region: 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ *
+ * @return string|null
+ */
+ public function getRegion(): string
+ {
+ return $this->get("Region");
+ }
+
+ /**
+ * Region: 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ *
+ * @param string $region
+ */
+ public function setRegion(string $region)
+ {
+ $this->set("Region", $region);
+ }
+
+ /**
+ * Zone: 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ *
+ * @return string|null
+ */
+ public function getZone(): string
+ {
+ return $this->get("Zone");
+ }
+
+ /**
+ * Zone: 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ *
+ * @param string $zone
+ */
+ public function setZone(string $zone)
+ {
+ $this->set("Zone", $zone);
+ }
+
+ /**
+ * ProjectId: 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list)
+ *
+ * @return string|null
+ */
+ public function getProjectId(): string
+ {
+ return $this->get("ProjectId");
+ }
+
+ /**
+ * ProjectId: 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list)
+ *
+ * @param string $projectId
+ */
+ public function setProjectId(string $projectId)
+ {
+ $this->set("ProjectId", $projectId);
+ }
+
+ /**
+ * DeploymentId: Deployment的Id
+ *
+ * @return string|null
+ */
+ public function getDeploymentId(): string
+ {
+ return $this->get("DeploymentId");
+ }
+
+ /**
+ * DeploymentId: Deployment的Id
+ *
+ * @param string $deploymentId
+ */
+ public function setDeploymentId(string $deploymentId)
+ {
+ $this->set("DeploymentId", $deploymentId);
+ }
+}
diff --git a/src/Cube/Apis/GetCubeDeploymentResponse.php b/src/Cube/Apis/GetCubeDeploymentResponse.php
new file mode 100644
index 00000000..ef45cf5d
--- /dev/null
+++ b/src/Cube/Apis/GetCubeDeploymentResponse.php
@@ -0,0 +1,44 @@
+get("Deployment");
+ }
+
+ /**
+ * Deployment: 经过base64编码的Deployment的yaml
+ *
+ * @param string $deployment
+ */
+ public function setDeployment(string $deployment)
+ {
+ $this->set("Deployment", $deployment);
+ }
+}
diff --git a/src/Cube/Apis/GetCubeExecTokenRequest.php b/src/Cube/Apis/GetCubeExecTokenRequest.php
new file mode 100644
index 00000000..b8a1fefa
--- /dev/null
+++ b/src/Cube/Apis/GetCubeExecTokenRequest.php
@@ -0,0 +1,152 @@
+ "GetCubeExecToken"]);
+ $this->markRequired("Region");
+ $this->markRequired("ProjectId");
+ $this->markRequired("ContainerName");
+ }
+
+
+
+ /**
+ * Region: 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ *
+ * @return string|null
+ */
+ public function getRegion(): string
+ {
+ return $this->get("Region");
+ }
+
+ /**
+ * Region: 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ *
+ * @param string $region
+ */
+ public function setRegion(string $region)
+ {
+ $this->set("Region", $region);
+ }
+
+ /**
+ * Zone: 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ *
+ * @return string|null
+ */
+ public function getZone(): string
+ {
+ return $this->get("Zone");
+ }
+
+ /**
+ * Zone: 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ *
+ * @param string $zone
+ */
+ public function setZone(string $zone)
+ {
+ $this->set("Zone", $zone);
+ }
+
+ /**
+ * ProjectId: 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list)
+ *
+ * @return string|null
+ */
+ public function getProjectId(): string
+ {
+ return $this->get("ProjectId");
+ }
+
+ /**
+ * ProjectId: 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list)
+ *
+ * @param string $projectId
+ */
+ public function setProjectId(string $projectId)
+ {
+ $this->set("ProjectId", $projectId);
+ }
+
+ /**
+ * ContainerName: 容器名称
+ *
+ * @return string|null
+ */
+ public function getContainerName(): string
+ {
+ return $this->get("ContainerName");
+ }
+
+ /**
+ * ContainerName: 容器名称
+ *
+ * @param string $containerName
+ */
+ public function setContainerName(string $containerName)
+ {
+ $this->set("ContainerName", $containerName);
+ }
+
+ /**
+ * CubeId: CubeId 和 Uid 中必须填写任意一个。CubeId 是所有 Cube 资源的唯一 ID,如非在 UK8S 通过 Virtual Kubelet 插件创建的 Cube, 则必填 CubeId
+ *
+ * @return string|null
+ */
+ public function getCubeId(): string
+ {
+ return $this->get("CubeId");
+ }
+
+ /**
+ * CubeId: CubeId 和 Uid 中必须填写任意一个。CubeId 是所有 Cube 资源的唯一 ID,如非在 UK8S 通过 Virtual Kubelet 插件创建的 Cube, 则必填 CubeId
+ *
+ * @param string $cubeId
+ */
+ public function setCubeId(string $cubeId)
+ {
+ $this->set("CubeId", $cubeId);
+ }
+
+ /**
+ * Uid: CubeId 和 Uid 中必须填写任意一个。Uid 是在 UK8S 中通过 Virtual Kubelet 插件创建出的 Cube 的唯一标识
+ *
+ * @return string|null
+ */
+ public function getUid(): string
+ {
+ return $this->get("Uid");
+ }
+
+ /**
+ * Uid: CubeId 和 Uid 中必须填写任意一个。Uid 是在 UK8S 中通过 Virtual Kubelet 插件创建出的 Cube 的唯一标识
+ *
+ * @param string $uid
+ */
+ public function setUid(string $uid)
+ {
+ $this->set("Uid", $uid);
+ }
+}
diff --git a/src/Cube/Apis/GetCubeExecTokenResponse.php b/src/Cube/Apis/GetCubeExecTokenResponse.php
new file mode 100644
index 00000000..b7579994
--- /dev/null
+++ b/src/Cube/Apis/GetCubeExecTokenResponse.php
@@ -0,0 +1,64 @@
+get("Token");
+ }
+
+ /**
+ * Token: 有效时间5min
+ *
+ * @param string $token
+ */
+ public function setToken(string $token)
+ {
+ $this->set("Token", $token);
+ }
+
+ /**
+ * TerminalUrl: terminal的登录连接地址,限单点登录,有效时间5min
+ *
+ * @return string|null
+ */
+ public function getTerminalUrl(): string
+ {
+ return $this->get("TerminalUrl");
+ }
+
+ /**
+ * TerminalUrl: terminal的登录连接地址,限单点登录,有效时间5min
+ *
+ * @param string $terminalUrl
+ */
+ public function setTerminalUrl(string $terminalUrl)
+ {
+ $this->set("TerminalUrl", $terminalUrl);
+ }
+}
diff --git a/src/Cube/Apis/GetCubeExtendInfoRequest.php b/src/Cube/Apis/GetCubeExtendInfoRequest.php
new file mode 100644
index 00000000..78196658
--- /dev/null
+++ b/src/Cube/Apis/GetCubeExtendInfoRequest.php
@@ -0,0 +1,112 @@
+ "GetCubeExtendInfo"]);
+ $this->markRequired("Region");
+ $this->markRequired("ProjectId");
+ $this->markRequired("CubeIds");
+ }
+
+
+
+ /**
+ * Region: 地域。 参见 [地域和可用区列表](../summary/regionlist.html)
+ *
+ * @return string|null
+ */
+ public function getRegion(): string
+ {
+ return $this->get("Region");
+ }
+
+ /**
+ * Region: 地域。 参见 [地域和可用区列表](../summary/regionlist.html)
+ *
+ * @param string $region
+ */
+ public function setRegion(string $region)
+ {
+ $this->set("Region", $region);
+ }
+
+ /**
+ * Zone: 可用区。参见 [可用区列表](../summary/regionlist.html)
+ *
+ * @return string|null
+ */
+ public function getZone(): string
+ {
+ return $this->get("Zone");
+ }
+
+ /**
+ * Zone: 可用区。参见 [可用区列表](../summary/regionlist.html)
+ *
+ * @param string $zone
+ */
+ public function setZone(string $zone)
+ {
+ $this->set("Zone", $zone);
+ }
+
+ /**
+ * ProjectId: 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html)
+ *
+ * @return string|null
+ */
+ public function getProjectId(): string
+ {
+ return $this->get("ProjectId");
+ }
+
+ /**
+ * ProjectId: 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html)
+ *
+ * @param string $projectId
+ */
+ public function setProjectId(string $projectId)
+ {
+ $this->set("ProjectId", $projectId);
+ }
+
+ /**
+ * CubeIds: id列表以逗号(,)分割
+ *
+ * @return string|null
+ */
+ public function getCubeIds(): string
+ {
+ return $this->get("CubeIds");
+ }
+
+ /**
+ * CubeIds: id列表以逗号(,)分割
+ *
+ * @param string $cubeIds
+ */
+ public function setCubeIds(string $cubeIds)
+ {
+ $this->set("CubeIds", $cubeIds);
+ }
+}
diff --git a/src/Cube/Apis/GetCubeExtendInfoResponse.php b/src/Cube/Apis/GetCubeExtendInfoResponse.php
new file mode 100644
index 00000000..904c3fe8
--- /dev/null
+++ b/src/Cube/Apis/GetCubeExtendInfoResponse.php
@@ -0,0 +1,56 @@
+get("ExtendInfo") ?? [];
+ $result = [];
+ foreach ($items as $i => $item) {
+ array_push($result, new CubeExtendInfo($item));
+ }
+ return $result;
+ }
+
+ /**
+ * ExtendInfo: CubeExtendInfo
+ *
+ * @param CubeExtendInfo[] $extendInfo
+ */
+ public function setExtendInfo(array $extendInfo)
+ {
+ $result = [];
+ foreach ($extendInfo as $i => $item) {
+ array_push($result, $item->getAll());
+ }
+ return $result;
+ }
+}
diff --git a/src/Cube/Apis/GetCubeMetricsRequest.php b/src/Cube/Apis/GetCubeMetricsRequest.php
new file mode 100644
index 00000000..83383df4
--- /dev/null
+++ b/src/Cube/Apis/GetCubeMetricsRequest.php
@@ -0,0 +1,196 @@
+ "GetCubeMetrics"]);
+ $this->markRequired("Region");
+ $this->markRequired("Zone");
+ $this->markRequired("ResourceId");
+ $this->markRequired("MetricName");
+ $this->markRequired("BeginTime");
+ $this->markRequired("EndTime");
+ $this->markRequired("ContainerName");
+ }
+
+
+
+ /**
+ * Region: 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ *
+ * @return string|null
+ */
+ public function getRegion(): string
+ {
+ return $this->get("Region");
+ }
+
+ /**
+ * Region: 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ *
+ * @param string $region
+ */
+ public function setRegion(string $region)
+ {
+ $this->set("Region", $region);
+ }
+
+ /**
+ * Zone: 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ *
+ * @return string|null
+ */
+ public function getZone(): string
+ {
+ return $this->get("Zone");
+ }
+
+ /**
+ * Zone: 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ *
+ * @param string $zone
+ */
+ public function setZone(string $zone)
+ {
+ $this->set("Zone", $zone);
+ }
+
+ /**
+ * ProjectId: 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list)
+ *
+ * @return string|null
+ */
+ public function getProjectId(): string
+ {
+ return $this->get("ProjectId");
+ }
+
+ /**
+ * ProjectId: 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list)
+ *
+ * @param string $projectId
+ */
+ public function setProjectId(string $projectId)
+ {
+ $this->set("ProjectId", $projectId);
+ }
+
+ /**
+ * ResourceId: Cube实例资源ID
+ *
+ * @return string|null
+ */
+ public function getResourceId(): string
+ {
+ return $this->get("ResourceId");
+ }
+
+ /**
+ * ResourceId: Cube实例资源ID
+ *
+ * @param string $resourceId
+ */
+ public function setResourceId(string $resourceId)
+ {
+ $this->set("ResourceId", $resourceId);
+ }
+
+ /**
+ * MetricName: 监控指标名称
+ *
+ * @return string[]|null
+ */
+ public function getMetricName(): array
+ {
+ return $this->get("MetricName");
+ }
+
+ /**
+ * MetricName: 监控指标名称
+ *
+ * @param string[] $metricName
+ */
+ public function setMetricName(array $metricName)
+ {
+ $this->set("MetricName", $metricName);
+ }
+
+ /**
+ * BeginTime: 开始时间
+ *
+ * @return integer|null
+ */
+ public function getBeginTime(): int
+ {
+ return $this->get("BeginTime");
+ }
+
+ /**
+ * BeginTime: 开始时间
+ *
+ * @param int $beginTime
+ */
+ public function setBeginTime(int $beginTime)
+ {
+ $this->set("BeginTime", $beginTime);
+ }
+
+ /**
+ * EndTime: 结束时间,必须大于开始时间
+ *
+ * @return integer|null
+ */
+ public function getEndTime(): int
+ {
+ return $this->get("EndTime");
+ }
+
+ /**
+ * EndTime: 结束时间,必须大于开始时间
+ *
+ * @param int $endTime
+ */
+ public function setEndTime(int $endTime)
+ {
+ $this->set("EndTime", $endTime);
+ }
+
+ /**
+ * ContainerName: Pod内容器名称
+ *
+ * @return string|null
+ */
+ public function getContainerName(): string
+ {
+ return $this->get("ContainerName");
+ }
+
+ /**
+ * ContainerName: Pod内容器名称
+ *
+ * @param string $containerName
+ */
+ public function setContainerName(string $containerName)
+ {
+ $this->set("ContainerName", $containerName);
+ }
+}
diff --git a/src/Cube/Apis/GetCubeMetricsResponse.php b/src/Cube/Apis/GetCubeMetricsResponse.php
new file mode 100644
index 00000000..d4f65f6a
--- /dev/null
+++ b/src/Cube/Apis/GetCubeMetricsResponse.php
@@ -0,0 +1,55 @@
+get("DataSets") ?? [];
+ $result = [];
+ foreach ($items as $i => $item) {
+ array_push($result, new MetricDataSet($item));
+ }
+ return $result;
+ }
+
+ /**
+ * DataSets: 时间序列集合
+ *
+ * @param MetricDataSet[] $dataSets
+ */
+ public function setDataSets(array $dataSets)
+ {
+ $result = [];
+ foreach ($dataSets as $i => $item) {
+ array_push($result, $item->getAll());
+ }
+ return $result;
+ }
+}
diff --git a/src/Cube/Apis/GetCubePodRequest.php b/src/Cube/Apis/GetCubePodRequest.php
new file mode 100644
index 00000000..b5f9405e
--- /dev/null
+++ b/src/Cube/Apis/GetCubePodRequest.php
@@ -0,0 +1,131 @@
+ "GetCubePod"]);
+ $this->markRequired("Region");
+ $this->markRequired("ProjectId");
+ }
+
+
+
+ /**
+ * Region: 地域。 参见 [地域和可用区列表](../summary/regionlist.html)
+ *
+ * @return string|null
+ */
+ public function getRegion(): string
+ {
+ return $this->get("Region");
+ }
+
+ /**
+ * Region: 地域。 参见 [地域和可用区列表](../summary/regionlist.html)
+ *
+ * @param string $region
+ */
+ public function setRegion(string $region)
+ {
+ $this->set("Region", $region);
+ }
+
+ /**
+ * Zone: 可用区。参见 [可用区列表](../summary/regionlist.html)
+ *
+ * @return string|null
+ */
+ public function getZone(): string
+ {
+ return $this->get("Zone");
+ }
+
+ /**
+ * Zone: 可用区。参见 [可用区列表](../summary/regionlist.html)
+ *
+ * @param string $zone
+ */
+ public function setZone(string $zone)
+ {
+ $this->set("Zone", $zone);
+ }
+
+ /**
+ * ProjectId: 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html)
+ *
+ * @return string|null
+ */
+ public function getProjectId(): string
+ {
+ return $this->get("ProjectId");
+ }
+
+ /**
+ * ProjectId: 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html)
+ *
+ * @param string $projectId
+ */
+ public function setProjectId(string $projectId)
+ {
+ $this->set("ProjectId", $projectId);
+ }
+
+ /**
+ * CubeId: CubeId和Uid任意一个
+ *
+ * @return string|null
+ */
+ public function getCubeId(): string
+ {
+ return $this->get("CubeId");
+ }
+
+ /**
+ * CubeId: CubeId和Uid任意一个
+ *
+ * @param string $cubeId
+ */
+ public function setCubeId(string $cubeId)
+ {
+ $this->set("CubeId", $cubeId);
+ }
+
+ /**
+ * Uid: CubeId和Uid任意一个
+ *
+ * @return string|null
+ */
+ public function getUid(): string
+ {
+ return $this->get("Uid");
+ }
+
+ /**
+ * Uid: CubeId和Uid任意一个
+ *
+ * @param string $uid
+ */
+ public function setUid(string $uid)
+ {
+ $this->set("Uid", $uid);
+ }
+}
diff --git a/src/Cube/Apis/GetCubePodResponse.php b/src/Cube/Apis/GetCubePodResponse.php
new file mode 100644
index 00000000..64402c14
--- /dev/null
+++ b/src/Cube/Apis/GetCubePodResponse.php
@@ -0,0 +1,44 @@
+get("Pod");
+ }
+
+ /**
+ * Pod: base64编码的pod的yaml
+ *
+ * @param string $pod
+ */
+ public function setPod(string $pod)
+ {
+ $this->set("Pod", $pod);
+ }
+}
diff --git a/src/Cube/Apis/GetCubePriceRequest.php b/src/Cube/Apis/GetCubePriceRequest.php
new file mode 100644
index 00000000..ad7c6f7e
--- /dev/null
+++ b/src/Cube/Apis/GetCubePriceRequest.php
@@ -0,0 +1,196 @@
+ "GetCubePrice"]);
+ $this->markRequired("Region");
+ $this->markRequired("Zone");
+ $this->markRequired("Count");
+ $this->markRequired("Cpu");
+ $this->markRequired("Mem");
+ $this->markRequired("ChargeType");
+ $this->markRequired("Quantity");
+ }
+
+
+
+ /**
+ * Region: 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ *
+ * @return string|null
+ */
+ public function getRegion(): string
+ {
+ return $this->get("Region");
+ }
+
+ /**
+ * Region: 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ *
+ * @param string $region
+ */
+ public function setRegion(string $region)
+ {
+ $this->set("Region", $region);
+ }
+
+ /**
+ * Zone: 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ *
+ * @return string|null
+ */
+ public function getZone(): string
+ {
+ return $this->get("Zone");
+ }
+
+ /**
+ * Zone: 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ *
+ * @param string $zone
+ */
+ public function setZone(string $zone)
+ {
+ $this->set("Zone", $zone);
+ }
+
+ /**
+ * ProjectId: 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list)
+ *
+ * @return string|null
+ */
+ public function getProjectId(): string
+ {
+ return $this->get("ProjectId");
+ }
+
+ /**
+ * ProjectId: 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list)
+ *
+ * @param string $projectId
+ */
+ public function setProjectId(string $projectId)
+ {
+ $this->set("ProjectId", $projectId);
+ }
+
+ /**
+ * Count: 购买数量
+ *
+ * @return string|null
+ */
+ public function getCount(): string
+ {
+ return $this->get("Count");
+ }
+
+ /**
+ * Count: 购买数量
+ *
+ * @param string $count
+ */
+ public function setCount(string $count)
+ {
+ $this->set("Count", $count);
+ }
+
+ /**
+ * Cpu: CPU 配置,单位为毫核,例如如 1 核则须输入 1000
+ *
+ * @return string|null
+ */
+ public function getCpu(): string
+ {
+ return $this->get("Cpu");
+ }
+
+ /**
+ * Cpu: CPU 配置,单位为毫核,例如如 1 核则须输入 1000
+ *
+ * @param string $cpu
+ */
+ public function setCpu(string $cpu)
+ {
+ $this->set("Cpu", $cpu);
+ }
+
+ /**
+ * Mem: 内存配置,单位为 Mi,例如 1Gi 须输入 1024
+ *
+ * @return string|null
+ */
+ public function getMem(): string
+ {
+ return $this->get("Mem");
+ }
+
+ /**
+ * Mem: 内存配置,单位为 Mi,例如 1Gi 须输入 1024
+ *
+ * @param string $mem
+ */
+ public function setMem(string $mem)
+ {
+ $this->set("Mem", $mem);
+ }
+
+ /**
+ * ChargeType: 计费模式。枚举值为: \\ > Year,按年付费; \\ > Month,按月付费;\\ > Dynamic,按小时预付费 \\ > Postpay,按秒后付费,默认为月付
+ *
+ * @return string|null
+ */
+ public function getChargeType(): string
+ {
+ return $this->get("ChargeType");
+ }
+
+ /**
+ * ChargeType: 计费模式。枚举值为: \\ > Year,按年付费; \\ > Month,按月付费;\\ > Dynamic,按小时预付费 \\ > Postpay,按秒后付费,默认为月付
+ *
+ * @param string $chargeType
+ */
+ public function setChargeType(string $chargeType)
+ {
+ $this->set("ChargeType", $chargeType);
+ }
+
+ /**
+ * Quantity: 购买时长。默认:值 1。按小时购买(Dynamic/Postpay)时无需此参数。 月付时,此参数传0,代表购买至月末。
+ *
+ * @return integer|null
+ */
+ public function getQuantity(): int
+ {
+ return $this->get("Quantity");
+ }
+
+ /**
+ * Quantity: 购买时长。默认:值 1。按小时购买(Dynamic/Postpay)时无需此参数。 月付时,此参数传0,代表购买至月末。
+ *
+ * @param int $quantity
+ */
+ public function setQuantity(int $quantity)
+ {
+ $this->set("Quantity", $quantity);
+ }
+}
diff --git a/src/Cube/Apis/GetCubePriceResponse.php b/src/Cube/Apis/GetCubePriceResponse.php
new file mode 100644
index 00000000..177c24af
--- /dev/null
+++ b/src/Cube/Apis/GetCubePriceResponse.php
@@ -0,0 +1,64 @@
+get("Price");
+ }
+
+ /**
+ * Price: 折扣后价格,单位为分
+ *
+ * @param int $price
+ */
+ public function setPrice(int $price)
+ {
+ $this->set("Price", $price);
+ }
+
+ /**
+ * OriginalPrice: 列表价格,单位为分
+ *
+ * @return integer|null
+ */
+ public function getOriginalPrice(): int
+ {
+ return $this->get("OriginalPrice");
+ }
+
+ /**
+ * OriginalPrice: 列表价格,单位为分
+ *
+ * @param int $originalPrice
+ */
+ public function setOriginalPrice(int $originalPrice)
+ {
+ $this->set("OriginalPrice", $originalPrice);
+ }
+}
diff --git a/src/Cube/Apis/ListCubeDeploymentRequest.php b/src/Cube/Apis/ListCubeDeploymentRequest.php
new file mode 100644
index 00000000..54850386
--- /dev/null
+++ b/src/Cube/Apis/ListCubeDeploymentRequest.php
@@ -0,0 +1,132 @@
+ "ListCubeDeployment"]);
+ $this->markRequired("Region");
+ $this->markRequired("Offset");
+ $this->markRequired("Limit");
+ }
+
+
+
+ /**
+ * Region: 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ *
+ * @return string|null
+ */
+ public function getRegion(): string
+ {
+ return $this->get("Region");
+ }
+
+ /**
+ * Region: 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ *
+ * @param string $region
+ */
+ public function setRegion(string $region)
+ {
+ $this->set("Region", $region);
+ }
+
+ /**
+ * Zone: 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ *
+ * @return string|null
+ */
+ public function getZone(): string
+ {
+ return $this->get("Zone");
+ }
+
+ /**
+ * Zone: 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ *
+ * @param string $zone
+ */
+ public function setZone(string $zone)
+ {
+ $this->set("Zone", $zone);
+ }
+
+ /**
+ * ProjectId: 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list)
+ *
+ * @return string|null
+ */
+ public function getProjectId(): string
+ {
+ return $this->get("ProjectId");
+ }
+
+ /**
+ * ProjectId: 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list)
+ *
+ * @param string $projectId
+ */
+ public function setProjectId(string $projectId)
+ {
+ $this->set("ProjectId", $projectId);
+ }
+
+ /**
+ * Offset: 默认0
+ *
+ * @return integer|null
+ */
+ public function getOffset(): int
+ {
+ return $this->get("Offset");
+ }
+
+ /**
+ * Offset: 默认0
+ *
+ * @param int $offset
+ */
+ public function setOffset(int $offset)
+ {
+ $this->set("Offset", $offset);
+ }
+
+ /**
+ * Limit: 默认20
+ *
+ * @return integer|null
+ */
+ public function getLimit(): int
+ {
+ return $this->get("Limit");
+ }
+
+ /**
+ * Limit: 默认20
+ *
+ * @param int $limit
+ */
+ public function setLimit(int $limit)
+ {
+ $this->set("Limit", $limit);
+ }
+}
diff --git a/src/Cube/Apis/ListCubeDeploymentResponse.php b/src/Cube/Apis/ListCubeDeploymentResponse.php
new file mode 100644
index 00000000..5a68d4f9
--- /dev/null
+++ b/src/Cube/Apis/ListCubeDeploymentResponse.php
@@ -0,0 +1,64 @@
+get("TotalCount");
+ }
+
+ /**
+ * TotalCount:
+ *
+ * @param int $totalCount
+ */
+ public function setTotalCount(int $totalCount)
+ {
+ $this->set("TotalCount", $totalCount);
+ }
+
+ /**
+ * Deployments: DeploymentInfo
+ *
+ * @return string[]|null
+ */
+ public function getDeployments(): array
+ {
+ return $this->get("Deployments");
+ }
+
+ /**
+ * Deployments: DeploymentInfo
+ *
+ * @param string[] $deployments
+ */
+ public function setDeployments(array $deployments)
+ {
+ $this->set("Deployments", $deployments);
+ }
+}
diff --git a/src/Cube/Apis/ListCubePodRequest.php b/src/Cube/Apis/ListCubePodRequest.php
new file mode 100644
index 00000000..749286ed
--- /dev/null
+++ b/src/Cube/Apis/ListCubePodRequest.php
@@ -0,0 +1,210 @@
+ "ListCubePod"]);
+ $this->markRequired("Region");
+ }
+
+
+
+ /**
+ * Region: 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ *
+ * @return string|null
+ */
+ public function getRegion(): string
+ {
+ return $this->get("Region");
+ }
+
+ /**
+ * Region: 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ *
+ * @param string $region
+ */
+ public function setRegion(string $region)
+ {
+ $this->set("Region", $region);
+ }
+
+ /**
+ * Zone: 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ *
+ * @return string|null
+ */
+ public function getZone(): string
+ {
+ return $this->get("Zone");
+ }
+
+ /**
+ * Zone: 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ *
+ * @param string $zone
+ */
+ public function setZone(string $zone)
+ {
+ $this->set("Zone", $zone);
+ }
+
+ /**
+ * ProjectId: 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list)
+ *
+ * @return string|null
+ */
+ public function getProjectId(): string
+ {
+ return $this->get("ProjectId");
+ }
+
+ /**
+ * ProjectId: 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list)
+ *
+ * @param string $projectId
+ */
+ public function setProjectId(string $projectId)
+ {
+ $this->set("ProjectId", $projectId);
+ }
+
+ /**
+ * VPCId: VPC的Id
+ *
+ * @return string|null
+ */
+ public function getVPCId(): string
+ {
+ return $this->get("VPCId");
+ }
+
+ /**
+ * VPCId: VPC的Id
+ *
+ * @param string $vpcId
+ */
+ public function setVPCId(string $vpcId)
+ {
+ $this->set("VPCId", $vpcId);
+ }
+
+ /**
+ * SubnetId: 子网Id
+ *
+ * @return string|null
+ */
+ public function getSubnetId(): string
+ {
+ return $this->get("SubnetId");
+ }
+
+ /**
+ * SubnetId: 子网Id
+ *
+ * @param string $subnetId
+ */
+ public function setSubnetId(string $subnetId)
+ {
+ $this->set("SubnetId", $subnetId);
+ }
+
+ /**
+ * Group: 组名称
+ *
+ * @return string|null
+ */
+ public function getGroup(): string
+ {
+ return $this->get("Group");
+ }
+
+ /**
+ * Group: 组名称
+ *
+ * @param string $group
+ */
+ public function setGroup(string $group)
+ {
+ $this->set("Group", $group);
+ }
+
+ /**
+ * Offset: 默认0
+ *
+ * @return integer|null
+ */
+ public function getOffset(): int
+ {
+ return $this->get("Offset");
+ }
+
+ /**
+ * Offset: 默认0
+ *
+ * @param int $offset
+ */
+ public function setOffset(int $offset)
+ {
+ $this->set("Offset", $offset);
+ }
+
+ /**
+ * Limit: 默认20
+ *
+ * @return integer|null
+ */
+ public function getLimit(): int
+ {
+ return $this->get("Limit");
+ }
+
+ /**
+ * Limit: 默认20
+ *
+ * @param int $limit
+ */
+ public function setLimit(int $limit)
+ {
+ $this->set("Limit", $limit);
+ }
+
+ /**
+ * DeploymentId: Deployment的Id
+ *
+ * @return string|null
+ */
+ public function getDeploymentId(): string
+ {
+ return $this->get("DeploymentId");
+ }
+
+ /**
+ * DeploymentId: Deployment的Id
+ *
+ * @param string $deploymentId
+ */
+ public function setDeploymentId(string $deploymentId)
+ {
+ $this->set("DeploymentId", $deploymentId);
+ }
+}
diff --git a/src/Cube/Apis/ListCubePodResponse.php b/src/Cube/Apis/ListCubePodResponse.php
new file mode 100644
index 00000000..534c7543
--- /dev/null
+++ b/src/Cube/Apis/ListCubePodResponse.php
@@ -0,0 +1,64 @@
+get("Pods");
+ }
+
+ /**
+ * Pods: Pod列表,每条数据都做了base64编码
+ *
+ * @param string[] $pods
+ */
+ public function setPods(array $pods)
+ {
+ $this->set("Pods", $pods);
+ }
+
+ /**
+ * TotalCount: Cube的总数
+ *
+ * @return integer|null
+ */
+ public function getTotalCount(): int
+ {
+ return $this->get("TotalCount");
+ }
+
+ /**
+ * TotalCount: Cube的总数
+ *
+ * @param int $totalCount
+ */
+ public function setTotalCount(int $totalCount)
+ {
+ $this->set("TotalCount", $totalCount);
+ }
+}
diff --git a/src/Cube/Apis/ModifyCubeExtendInfoRequest.php b/src/Cube/Apis/ModifyCubeExtendInfoRequest.php
new file mode 100644
index 00000000..d5750a04
--- /dev/null
+++ b/src/Cube/Apis/ModifyCubeExtendInfoRequest.php
@@ -0,0 +1,132 @@
+ "ModifyCubeExtendInfo"]);
+ $this->markRequired("Region");
+ $this->markRequired("ProjectId");
+ $this->markRequired("CubeId");
+ }
+
+
+
+ /**
+ * Region: 地域。 参见 [地域和可用区列表](../summary/regionlist.html)
+ *
+ * @return string|null
+ */
+ public function getRegion(): string
+ {
+ return $this->get("Region");
+ }
+
+ /**
+ * Region: 地域。 参见 [地域和可用区列表](../summary/regionlist.html)
+ *
+ * @param string $region
+ */
+ public function setRegion(string $region)
+ {
+ $this->set("Region", $region);
+ }
+
+ /**
+ * Zone: 可用区。参见 [可用区列表](../summary/regionlist.html)
+ *
+ * @return string|null
+ */
+ public function getZone(): string
+ {
+ return $this->get("Zone");
+ }
+
+ /**
+ * Zone: 可用区。参见 [可用区列表](../summary/regionlist.html)
+ *
+ * @param string $zone
+ */
+ public function setZone(string $zone)
+ {
+ $this->set("Zone", $zone);
+ }
+
+ /**
+ * ProjectId: 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html)
+ *
+ * @return string|null
+ */
+ public function getProjectId(): string
+ {
+ return $this->get("ProjectId");
+ }
+
+ /**
+ * ProjectId: 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html)
+ *
+ * @param string $projectId
+ */
+ public function setProjectId(string $projectId)
+ {
+ $this->set("ProjectId", $projectId);
+ }
+
+ /**
+ * CubeId: cube的id
+ *
+ * @return string|null
+ */
+ public function getCubeId(): string
+ {
+ return $this->get("CubeId");
+ }
+
+ /**
+ * CubeId: cube的id
+ *
+ * @param string $cubeId
+ */
+ public function setCubeId(string $cubeId)
+ {
+ $this->set("CubeId", $cubeId);
+ }
+
+ /**
+ * Name: 修改的名字,规则(^[a-zA-Z0-9-_.\u4e00-\u9fa5]{1,32})
+ *
+ * @return string|null
+ */
+ public function getName(): string
+ {
+ return $this->get("Name");
+ }
+
+ /**
+ * Name: 修改的名字,规则(^[a-zA-Z0-9-_.\u4e00-\u9fa5]{1,32})
+ *
+ * @param string $name
+ */
+ public function setName(string $name)
+ {
+ $this->set("Name", $name);
+ }
+}
diff --git a/src/Cube/Apis/ModifyCubeExtendInfoResponse.php b/src/Cube/Apis/ModifyCubeExtendInfoResponse.php
new file mode 100644
index 00000000..449e8f1c
--- /dev/null
+++ b/src/Cube/Apis/ModifyCubeExtendInfoResponse.php
@@ -0,0 +1,26 @@
+ "ModifyCubeTag"]);
+ $this->markRequired("Region");
+ $this->markRequired("CubeId");
+ $this->markRequired("Tag");
+ }
+
+
+
+ /**
+ * Region: 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ *
+ * @return string|null
+ */
+ public function getRegion(): string
+ {
+ return $this->get("Region");
+ }
+
+ /**
+ * Region: 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ *
+ * @param string $region
+ */
+ public function setRegion(string $region)
+ {
+ $this->set("Region", $region);
+ }
+
+ /**
+ * Zone: 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ *
+ * @return string|null
+ */
+ public function getZone(): string
+ {
+ return $this->get("Zone");
+ }
+
+ /**
+ * Zone: 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ *
+ * @param string $zone
+ */
+ public function setZone(string $zone)
+ {
+ $this->set("Zone", $zone);
+ }
+
+ /**
+ * ProjectId: 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list)
+ *
+ * @return string|null
+ */
+ public function getProjectId(): string
+ {
+ return $this->get("ProjectId");
+ }
+
+ /**
+ * ProjectId: 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list)
+ *
+ * @param string $projectId
+ */
+ public function setProjectId(string $projectId)
+ {
+ $this->set("ProjectId", $projectId);
+ }
+
+ /**
+ * CubeId: CubeId
+ *
+ * @return string|null
+ */
+ public function getCubeId(): string
+ {
+ return $this->get("CubeId");
+ }
+
+ /**
+ * CubeId: CubeId
+ *
+ * @param string $cubeId
+ */
+ public function setCubeId(string $cubeId)
+ {
+ $this->set("CubeId", $cubeId);
+ }
+
+ /**
+ * Tag: 业务组名称
+ *
+ * @return string|null
+ */
+ public function getTag(): string
+ {
+ return $this->get("Tag");
+ }
+
+ /**
+ * Tag: 业务组名称
+ *
+ * @param string $tag
+ */
+ public function setTag(string $tag)
+ {
+ $this->set("Tag", $tag);
+ }
+}
diff --git a/src/Cube/Apis/ModifyCubeTagResponse.php b/src/Cube/Apis/ModifyCubeTagResponse.php
new file mode 100644
index 00000000..3d486251
--- /dev/null
+++ b/src/Cube/Apis/ModifyCubeTagResponse.php
@@ -0,0 +1,44 @@
+get("CubeId");
+ }
+
+ /**
+ * CubeId: CubeId
+ *
+ * @param string $cubeId
+ */
+ public function setCubeId(string $cubeId)
+ {
+ $this->set("CubeId", $cubeId);
+ }
+}
diff --git a/src/Cube/Apis/RenewCubePodRequest.php b/src/Cube/Apis/RenewCubePodRequest.php
new file mode 100644
index 00000000..6fbea83e
--- /dev/null
+++ b/src/Cube/Apis/RenewCubePodRequest.php
@@ -0,0 +1,133 @@
+ "RenewCubePod"]);
+ $this->markRequired("Region");
+ $this->markRequired("ProjectId");
+ $this->markRequired("CubeId");
+ $this->markRequired("Pod");
+ }
+
+
+
+ /**
+ * Region: 地域。 参见 [地域和可用区列表](../summary/regionlist.html)
+ *
+ * @return string|null
+ */
+ public function getRegion(): string
+ {
+ return $this->get("Region");
+ }
+
+ /**
+ * Region: 地域。 参见 [地域和可用区列表](../summary/regionlist.html)
+ *
+ * @param string $region
+ */
+ public function setRegion(string $region)
+ {
+ $this->set("Region", $region);
+ }
+
+ /**
+ * Zone: 可用区。参见 [可用区列表](../summary/regionlist.html)
+ *
+ * @return string|null
+ */
+ public function getZone(): string
+ {
+ return $this->get("Zone");
+ }
+
+ /**
+ * Zone: 可用区。参见 [可用区列表](../summary/regionlist.html)
+ *
+ * @param string $zone
+ */
+ public function setZone(string $zone)
+ {
+ $this->set("Zone", $zone);
+ }
+
+ /**
+ * ProjectId: 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html)
+ *
+ * @return string|null
+ */
+ public function getProjectId(): string
+ {
+ return $this->get("ProjectId");
+ }
+
+ /**
+ * ProjectId: 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html)
+ *
+ * @param string $projectId
+ */
+ public function setProjectId(string $projectId)
+ {
+ $this->set("ProjectId", $projectId);
+ }
+
+ /**
+ * CubeId: 容器Id
+ *
+ * @return string|null
+ */
+ public function getCubeId(): string
+ {
+ return $this->get("CubeId");
+ }
+
+ /**
+ * CubeId: 容器Id
+ *
+ * @param string $cubeId
+ */
+ public function setCubeId(string $cubeId)
+ {
+ $this->set("CubeId", $cubeId);
+ }
+
+ /**
+ * Pod: base64编码的Pod的yaml
+ *
+ * @return string|null
+ */
+ public function getPod(): string
+ {
+ return $this->get("Pod");
+ }
+
+ /**
+ * Pod: base64编码的Pod的yaml
+ *
+ * @param string $pod
+ */
+ public function setPod(string $pod)
+ {
+ $this->set("Pod", $pod);
+ }
+}
diff --git a/src/Cube/Apis/RenewCubePodResponse.php b/src/Cube/Apis/RenewCubePodResponse.php
new file mode 100644
index 00000000..0c2c7863
--- /dev/null
+++ b/src/Cube/Apis/RenewCubePodResponse.php
@@ -0,0 +1,44 @@
+get("Pod");
+ }
+
+ /**
+ * Pod: base64编码过的yaml,需要解码获取信息
+ *
+ * @param string $pod
+ */
+ public function setPod(string $pod)
+ {
+ $this->set("Pod", $pod);
+ }
+}
diff --git a/src/Cube/Apis/UpdateCubeDeploymentRequest.php b/src/Cube/Apis/UpdateCubeDeploymentRequest.php
new file mode 100644
index 00000000..a1c2aea8
--- /dev/null
+++ b/src/Cube/Apis/UpdateCubeDeploymentRequest.php
@@ -0,0 +1,152 @@
+ "UpdateCubeDeployment"]);
+ $this->markRequired("Region");
+ $this->markRequired("DeploymentId");
+ $this->markRequired("Deployment");
+ }
+
+
+
+ /**
+ * Region: 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ *
+ * @return string|null
+ */
+ public function getRegion(): string
+ {
+ return $this->get("Region");
+ }
+
+ /**
+ * Region: 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ *
+ * @param string $region
+ */
+ public function setRegion(string $region)
+ {
+ $this->set("Region", $region);
+ }
+
+ /**
+ * Zone: 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ *
+ * @return string|null
+ */
+ public function getZone(): string
+ {
+ return $this->get("Zone");
+ }
+
+ /**
+ * Zone: 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ *
+ * @param string $zone
+ */
+ public function setZone(string $zone)
+ {
+ $this->set("Zone", $zone);
+ }
+
+ /**
+ * ProjectId: 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list)
+ *
+ * @return string|null
+ */
+ public function getProjectId(): string
+ {
+ return $this->get("ProjectId");
+ }
+
+ /**
+ * ProjectId: 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list)
+ *
+ * @param string $projectId
+ */
+ public function setProjectId(string $projectId)
+ {
+ $this->set("ProjectId", $projectId);
+ }
+
+ /**
+ * DeploymentId: Deployment的Id
+ *
+ * @return string|null
+ */
+ public function getDeploymentId(): string
+ {
+ return $this->get("DeploymentId");
+ }
+
+ /**
+ * DeploymentId: Deployment的Id
+ *
+ * @param string $deploymentId
+ */
+ public function setDeploymentId(string $deploymentId)
+ {
+ $this->set("DeploymentId", $deploymentId);
+ }
+
+ /**
+ * Deployment: base64编码的Deployment的yaml。大小不超过16KB
+ *
+ * @return string|null
+ */
+ public function getDeployment(): string
+ {
+ return $this->get("Deployment");
+ }
+
+ /**
+ * Deployment: base64编码的Deployment的yaml。大小不超过16KB
+ *
+ * @param string $deployment
+ */
+ public function setDeployment(string $deployment)
+ {
+ $this->set("Deployment", $deployment);
+ }
+
+ /**
+ * Name: Deployment的name
+ *
+ * @return string|null
+ */
+ public function getName(): string
+ {
+ return $this->get("Name");
+ }
+
+ /**
+ * Name: Deployment的name
+ *
+ * @param string $name
+ */
+ public function setName(string $name)
+ {
+ $this->set("Name", $name);
+ }
+}
diff --git a/src/Cube/Apis/UpdateCubeDeploymentResponse.php b/src/Cube/Apis/UpdateCubeDeploymentResponse.php
new file mode 100644
index 00000000..49b6dbc8
--- /dev/null
+++ b/src/Cube/Apis/UpdateCubeDeploymentResponse.php
@@ -0,0 +1,44 @@
+get("Deployment");
+ }
+
+ /**
+ * Deployment: 经过base64编码的Deployment的yaml
+ *
+ * @param string $deployment
+ */
+ public function setDeployment(string $deployment)
+ {
+ $this->set("Deployment", $deployment);
+ }
+}
diff --git a/src/Cube/CubeClient.php b/src/Cube/CubeClient.php
new file mode 100644
index 00000000..b9ab0b0a
--- /dev/null
+++ b/src/Cube/CubeClient.php
@@ -0,0 +1,587 @@
+ (string) 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ * "Zone" => (string) 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ * "ProjectId" => (string) 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list)
+ * "VPCId" => (string) VPCId
+ * "SubnetId" => (string) 子网Id
+ * "Deployment" => (string) base64编码的Deployment的yaml。大小不超过16KB
+ * "Name" => (string) Deployment名称
+ * "ChargeType" => (string) 计费模式。枚举值为: \\ > Year,按年付费; \\ > Month,按月付费;\\ > Postpay, \\ 后付费;默认为后付费
+ * "CpuPlatform" => (string) Cpu平台(V6:Intel、A2:AMD),默认V6。支持的地域(北京2B、北京2E、上海2A、广东、香港 、东京)目前北京2E仅有A2,其余地域仅有V6
+ * "KubeConfig" => (string) base64编码的kubeconfig。大小不超过16KB
+ * "Quantity" => (integer) 购买时长。默认:值 1。 月付时,此参数传0,代表购买至月末。
+ * "Tag" => (string) 业务组。默认:Default(Default即为未分组)
+ * ]
+ *
+ * Outputs:
+ *
+ * $outputs = [
+ * "DeploymentId" => (string) 控制器ID
+ * "Deployment" => (string) 经过base64编码的Deployment的yaml
+ * ]
+ *
+ * @throws UCloudException
+ */
+ public function createCubeDeployment(CreateCubeDeploymentRequest $request = null): CreateCubeDeploymentResponse
+ {
+ $resp = $this->invoke($request);
+ return new CreateCubeDeploymentResponse($resp->toArray(), $resp->getRequestId());
+ }
+
+ /**
+ * CreateCubePod - 创建Pod
+ *
+ * See also: https://docs.ucloud.cn/api/Cube-api/create_cube_pod
+ *
+ * Arguments:
+ *
+ * $args = [
+ * "Region" => (string) 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ * "Zone" => (string) 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ * "ProjectId" => (string) 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list)
+ * "VPCId" => (string) VPCId
+ * "SubnetId" => (string) 子网Id
+ * "Pod" => (string) base64编码的Pod的yaml。大小不超过16KB
+ * "Group" => (string) pod所在组
+ * "Name" => (string) pod的名字
+ * "Tag" => (string) 业务组。默认:Default(Default即为未分组)
+ * "CpuPlatform" => (string) Cpu平台(V6:Intel、A2:AMD、Auto),默认Auto。支持的地域(北京2B、北京2E、上海2A、广东、香港 、东京)目前北京2E仅有A2,其余地域仅有V6
+ * "ChargeType" => (string) 计费模式。枚举值为: \\ > Year,按年付费; \\ > Month,按月付费;\\ > Postpay, \\ 后付费;默认为后付费
+ * "Quantity" => (integer) 购买时长。默认:值 1。 月付时,此参数传0,代表购买至月末。
+ * "KubeConfig" => (string) base64编码的kubeconfig。大小不超过16KB
+ * "CouponId" => (string) 代金券ID。请通过DescribeCoupon接口查询,或登录用户中心查看
+ * ]
+ *
+ * Outputs:
+ *
+ * $outputs = [
+ * "Pod" => (string) base64编码的yaml
+ * "CubeId" => (string) cube的资源Id
+ * ]
+ *
+ * @throws UCloudException
+ */
+ public function createCubePod(CreateCubePodRequest $request = null): CreateCubePodResponse
+ {
+ $resp = $this->invoke($request);
+ return new CreateCubePodResponse($resp->toArray(), $resp->getRequestId());
+ }
+
+ /**
+ * DeleteCubeDeployment - 删除Cube的Deployment
+ *
+ * See also: https://docs.ucloud.cn/api/Cube-api/delete_cube_deployment
+ *
+ * Arguments:
+ *
+ * $args = [
+ * "Region" => (string) 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ * "Zone" => (string) 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ * "ProjectId" => (string) 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list)
+ * "DeploymentId" => (string) 控制器Id
+ * ]
+ *
+ * Outputs:
+ *
+ * $outputs = [
+ * ]
+ *
+ * @throws UCloudException
+ */
+ public function deleteCubeDeployment(DeleteCubeDeploymentRequest $request = null): DeleteCubeDeploymentResponse
+ {
+ $resp = $this->invoke($request);
+ return new DeleteCubeDeploymentResponse($resp->toArray(), $resp->getRequestId());
+ }
+
+ /**
+ * DeleteCubePod - 删除Pod
+ *
+ * See also: https://docs.ucloud.cn/api/Cube-api/delete_cube_pod
+ *
+ * Arguments:
+ *
+ * $args = [
+ * "Region" => (string) 地域。 参见 [地域和可用区列表](../summary/regionlist.html)
+ * "Zone" => (string) 可用区。参见 [可用区列表](../summary/regionlist.html)
+ * "ProjectId" => (string) 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html)
+ * "Uid" => (string) cubeid和uid任意一个(必须)
+ * "CubeId" => (string) cubeid和uid任意一个(必须)
+ * "ReleaseEIP" => (boolean) 删除cube时是否释放绑定的EIP。默认为false。
+ * ]
+ *
+ * Outputs:
+ *
+ * $outputs = [
+ * ]
+ *
+ * @throws UCloudException
+ */
+ public function deleteCubePod(DeleteCubePodRequest $request = null): DeleteCubePodResponse
+ {
+ $resp = $this->invoke($request);
+ return new DeleteCubePodResponse($resp->toArray(), $resp->getRequestId());
+ }
+
+ /**
+ * GetCubeDeployment - 获取Deployment的详细信息
+ *
+ * See also: https://docs.ucloud.cn/api/Cube-api/get_cube_deployment
+ *
+ * Arguments:
+ *
+ * $args = [
+ * "Region" => (string) 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ * "Zone" => (string) 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ * "ProjectId" => (string) 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list)
+ * "DeploymentId" => (string) Deployment的Id
+ * ]
+ *
+ * Outputs:
+ *
+ * $outputs = [
+ * "Deployment" => (string) 经过base64编码的Deployment的yaml
+ * ]
+ *
+ * @throws UCloudException
+ */
+ public function getCubeDeployment(GetCubeDeploymentRequest $request = null): GetCubeDeploymentResponse
+ {
+ $resp = $this->invoke($request);
+ return new GetCubeDeploymentResponse($resp->toArray(), $resp->getRequestId());
+ }
+
+ /**
+ * GetCubeExecToken - 获取登录容器的token
+ *
+ * See also: https://docs.ucloud.cn/api/Cube-api/get_cube_exec_token
+ *
+ * Arguments:
+ *
+ * $args = [
+ * "Region" => (string) 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ * "Zone" => (string) 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist)
+ * "ProjectId" => (string) 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list)
+ * "ContainerName" => (string) 容器名称
+ * "CubeId" => (string) CubeId 和 Uid 中必须填写任意一个。CubeId 是所有 Cube 资源的唯一 ID,如非在 UK8S 通过 Virtual Kubelet 插件创建的 Cube, 则必填 CubeId
+ * "Uid" => (string) CubeId 和 Uid 中必须填写任意一个。Uid 是在 UK8S 中通过 Virtual Kubelet 插件创建出的 Cube 的唯一标识
+ * ]
+ *
+ * Outputs:
+ *
+ * $outputs = [
+ * "Token" => (string) 有效时间5min
+ * "TerminalUrl" => (string) terminal的登录连接地址,限单点登录,有效时间5min
+ * ]
+ *
+ * @throws UCloudException
+ */
+ public function getCubeExecToken(GetCubeExecTokenRequest $request = null): GetCubeExecTokenResponse
+ {
+ $resp = $this->invoke($request);
+ return new GetCubeExecTokenResponse($resp->toArray(), $resp->getRequestId());
+ }
+
+ /**
+ * GetCubeExtendInfo - 获取Cube的额外信息
+ *
+ * See also: https://docs.ucloud.cn/api/Cube-api/get_cube_extend_info
+ *
+ * Arguments:
+ *
+ * $args = [
+ * "Region" => (string) 地域。 参见 [地域和可用区列表](../summary/regionlist.html)
+ * "Zone" => (string) 可用区。参见 [可用区列表](../summary/regionlist.html)
+ * "ProjectId" => (string) 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html)
+ * "CubeIds" => (string) id列表以逗号(,)分割
+ * ]
+ *
+ * Outputs:
+ *
+ * $outputs = [
+ * "ExtendInfo" => (array