京东云

This commit is contained in:
“wanyongkang”
2024-05-28 17:04:50 +08:00
parent f644932afb
commit f3c7432100
672 changed files with 209344 additions and 6593 deletions

View File

@@ -0,0 +1,11 @@
language: php
before_script:
- mkdir build
- composer install
env:
- PHP_TEST_AK="0E91C3765B78CBD71715F9BF24997AF3"
script:
- ./vendor/phpunit/phpunit/phpunit tests

View File

@@ -0,0 +1,8 @@
# CHANGELOG
## 0.2.0 - 2018-07-10
* Initial release of the Jdcloud SDK
* Jdcloud signature algorithm

View File

@@ -0,0 +1,4 @@
# Contributing to the JdCloud SDK for PHP
Greatly value feedback and contributions from our community. Please submit
your [issues][] or [pull requests][pull-requests] through GitHub.

View File

@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [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.

View File

@@ -0,0 +1,126 @@
# 简介 #
欢迎使用京东云开发者Php工具套件Php SDK。使用京东云Php SDK您无需复杂编程就可以访问京东云提供的各种服务。
为了方便您理解SDK中的一些概念和参数的含义使用SDK前建议您先查看[京东云OpenAPI使用入门](http://www.jdcloud.com/help/detail/355/isCatalog/0)。要了解每个API的具体参数和含义请参考程序注释或参考OpenAPI&SDK下具体产品线的API文档。
# 环境准备 #
1.京东云Php SDK适用于Php 5.5及以上。
2.在开始调用京东云open API之前需提前在京东云用户中心账户管理下的[AccessKey管理页面](https://uc.jdcloud.com/accesskey/index)申请accesskey和secretKey密钥对简称AK/SK。AK/SK信息请妥善保管如果遗失可能会造成非法用户使用此信息操作您在云上的资源给你造成数据和财产损失。
# SDK使用方法 #
建议使用Composer安装京东云Php SDK
首先在composer.json添加
"require" : {
"php" : ">=5.5",
"jdcloud-api/jdcloud-sdk-php" : ">=4.0.0"
}
然后使用Composer安装
php composer.phar install
composer install
您还可以下载sdk源代码自行使用。
SDK使用中的任何问题欢迎您[SDK使用问题反馈页面](https://github.com/jdcloud-api/jdcloud-sdk-php/issues)交流。
注意:京东云并没有提供其他下载方式,请务必使用上述官方下载方式!
## 调用示例 ##
以下是创建单个云主机实例详情的调用示例
use Jdcloud\Credentials\Credentials;
use Jdcloud\Result;
use Jdcloud\Vm\VmClient;
public function testCreateInstances()
{
$vm = new VmClient([
'credentials' => new Credentials('ak', 'sk'),
'version' => 'latest',
'scheme' => 'https'
]);
try{
$res = $vm->createInstances([
'regionId' => 'cn-north-1',
'instanceSpec' => [
'az' => 'cn-north-1a',
'imageId' => '8e187a0a-ea7c-4ad1-ba32-f21e52fb8926',
'instanceType' => 'g.n2.medium',
'name' => 'phpcreate',
'primaryNetworkInterface' => [
'networkInterface' => [
'subnetId' => 'subnet-ll47yy373i'
]
],
'systemDisk' => [
'diskCategory' => 'local'
]
]
]);
print_r($res);
print("Request Id: ". $res['requestId']. "\n");
print_r($res['result']);
}catch (\Jdcloud\Exception\JdcloudException $e) {
print("Detail Message: " . $e->getMessage(). "\n");
print("Request Id: ". $e->getJdcloudRequestId(). "\n");
print("Error Type: ". $e->getJdcloudErrorType(). "\n");
print("Error Code: " . $e->getJdcloudErrorCode(). "\n");
print("Error Detail Status: ". $e->getJdcloudErrorStatus(). "\n");
print("Error Detail Message: ". $e->getJdcloudErrorMessage(). "\n");
}
}
如果需要设置额外的header例如要调用开启了MFA操作保护的接口需要传递x-jdcloud-security-token则按照如下方式
$res = $vm->deleteInstances([
'regionId' => 'cn-north-1',
'instanceId' => 'xxx',
'extraHeaders' => [
'x-jdcloud-security-token' => 'xxxx'
]
]);
如果需要设置访问点,配置超时等,请参考如下更复杂的例子:
```
$fix_endpoint = EndpointProvider::patterns([
'*/*' => ['endpoint' => 'vm.cn-north-1.jdcloud-api.com'] //指定非默认访问地址 step 1
]);
$vm = new VmClient([
'credentials' => new Credentials('ak', 'sk'),
'version' => 'latest',
'debug' => [
'logfn' => function ($msg) { echo $msg . "\n"; }, //输出调试详细日志
],
'validate' => false, //关闭客户端参数验证
'endpoint_provider' => $fix_endpoint, //指定非默认访问地址 step 2
'scheme' => 'https',
'http' => [
'verify' => 'C:/ca-bundle.crt', //指定本地证书文件
'connect_timeout' => 20, //指定连接超时
'proxy' => 'http://192.168.16.1:10', //指定代理
'timeout' => 5 //指定请求超时
]
]);
```
更多调用示例参考 [SDK使用Demo](https://github.com/jdcloud-api/jdcloud-sdk-php/tree/master/tests)

View File

@@ -0,0 +1,65 @@
{
"name" : "jdcloud-api/jdcloud-sdk-php",
"homepage" : "https://www.jdcloud.com/help/faq?act=3",
"description" : "JDCloud SDK for PHP",
"keywords" : [
"sdk",
"cloud",
"jdcloud"
],
"type" : "library",
"license" : "Apache-2.0",
"authors" : [{
"name" : "Bibo",
"email" : "wangbibo@jd.com"
}
],
"support" : {
"issues" : "https://github.com/jdcloud-api/jdcloud-sdk-php/issues"
},
"require" : {
"php" : ">=5.5",
"guzzlehttp/guzzle" : "^5.3.1|^6.2.1",
"guzzlehttp/psr7" : "^1.4.1",
"guzzlehttp/promises" : "~1.0",
"mtdowling/jmespath.php" : "~2.2",
"ext-pcre" : "*",
"ext-json" : "*",
"ext-simplexml" : "*",
"ext-spl" : "*"
},
"require-dev" : {
"ext-dom" : "*",
"phpunit/phpunit" : "^4.8.35|^5.4.3",
"behat/behat" : "~3.0",
"doctrine/cache" : "~1.4",
"nette/neon" : "^2.3",
"andrewsville/php-token-reflection" : "^1.4",
"psr/cache" : "^1.0"
},
"suggest" : {
"ext-openssl" : "Allows using ssl",
"ext-curl" : "To send requests using cURL"
},
"autoload" : {
"psr-4" : {
"Jdcloud\\" : "src"
},
"files" : [
"src/functions.php"
]
},
"autoload-dev" : {
"psr-4" : {
"Jdcloud\\Test\\" : "tests/"
},
"classmap" : [
"build/"
]
},
"extra" : {
"branch-alias" : {
"dev-master" : "0.1.0-dev"
}
}
}

View File

@@ -0,0 +1,108 @@
<?php
/**
* Ag
*
* @category Jdcloud
* @package Jdcloud\Ag
* @author Jdcloud <jdcloud-api@jd.com>
* @license Apache-2.0 http://www.apache.org/licenses/LICENSE-2.0
* @link https://www.jdcloud.com/help/faq
*/
namespace Jdcloud\Ag;
use Jdcloud\JdCloudClient;
use Jdcloud\Api\Service;
use Jdcloud\Api\DocModel;
use Jdcloud\Api\ApiProvider;
use Jdcloud\PresignUrlMiddleware;
/**
* Client used to interact with ag.
*
* @method \Jdcloud\Result describeScalingActivities(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeScalingActivitiesAsync(array $args = [])
* @method \Jdcloud\Result describeAsAlarms(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeAsAlarmsAsync(array $args = [])
* @method \Jdcloud\Result createAsAlarm(array $args = [])
* @method \GuzzleHttp\Promise\Promise createAsAlarmAsync(array $args = [])
* @method \Jdcloud\Result updateAsAlarm(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateAsAlarmAsync(array $args = [])
* @method \Jdcloud\Result deleteAsAlarm(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteAsAlarmAsync(array $args = [])
* @method \Jdcloud\Result disableAsAlarm(array $args = [])
* @method \GuzzleHttp\Promise\Promise disableAsAlarmAsync(array $args = [])
* @method \Jdcloud\Result enableAsAlarm(array $args = [])
* @method \GuzzleHttp\Promise\Promise enableAsAlarmAsync(array $args = [])
* @method \Jdcloud\Result describeAsCrons(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeAsCronsAsync(array $args = [])
* @method \Jdcloud\Result createAsCron(array $args = [])
* @method \GuzzleHttp\Promise\Promise createAsCronAsync(array $args = [])
* @method \Jdcloud\Result updateAsCron(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateAsCronAsync(array $args = [])
* @method \Jdcloud\Result deleteAsCron(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteAsCronAsync(array $args = [])
* @method \Jdcloud\Result disableAsCron(array $args = [])
* @method \GuzzleHttp\Promise\Promise disableAsCronAsync(array $args = [])
* @method \Jdcloud\Result enableAsCron(array $args = [])
* @method \GuzzleHttp\Promise\Promise enableAsCronAsync(array $args = [])
* @method \Jdcloud\Result enableAutoScaling(array $args = [])
* @method \GuzzleHttp\Promise\Promise enableAutoScalingAsync(array $args = [])
* @method \Jdcloud\Result disableAutoScaling(array $args = [])
* @method \GuzzleHttp\Promise\Promise disableAutoScalingAsync(array $args = [])
* @method \Jdcloud\Result updateAutoScaling(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateAutoScalingAsync(array $args = [])
* @method \Jdcloud\Result modifyInstancesManaged(array $args = [])
* @method \GuzzleHttp\Promise\Promise modifyInstancesManagedAsync(array $args = [])
* @method \Jdcloud\Result modifyInstancesProtected(array $args = [])
* @method \GuzzleHttp\Promise\Promise modifyInstancesProtectedAsync(array $args = [])
* @method \Jdcloud\Result describeAsRules(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeAsRulesAsync(array $args = [])
* @method \Jdcloud\Result createAsRule(array $args = [])
* @method \GuzzleHttp\Promise\Promise createAsRuleAsync(array $args = [])
* @method \Jdcloud\Result updateAsRule(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateAsRuleAsync(array $args = [])
* @method \Jdcloud\Result deleteAsRule(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteAsRuleAsync(array $args = [])
* @method \Jdcloud\Result executeAsRule(array $args = [])
* @method \GuzzleHttp\Promise\Promise executeAsRuleAsync(array $args = [])
* @method \Jdcloud\Result describeAgs(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeAgsAsync(array $args = [])
* @method \Jdcloud\Result createAg(array $args = [])
* @method \GuzzleHttp\Promise\Promise createAgAsync(array $args = [])
* @method \Jdcloud\Result describeAg(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeAgAsync(array $args = [])
* @method \Jdcloud\Result updateAg(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateAgAsync(array $args = [])
* @method \Jdcloud\Result deleteAg(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteAgAsync(array $args = [])
* @method \Jdcloud\Result abandonInstances(array $args = [])
* @method \GuzzleHttp\Promise\Promise abandonInstancesAsync(array $args = [])
* @method \Jdcloud\Result setInstanceTemplate(array $args = [])
* @method \GuzzleHttp\Promise\Promise setInstanceTemplateAsync(array $args = [])
* @method \Jdcloud\Result describeQuotas(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeQuotasAsync(array $args = [])
*/
class AgClient extends JdCloudClient
{
public function __construct(array $args)
{
$args['with_resolved'] = function (array $args) {
$this->getHandlerList()->appendInit(
PresignUrlMiddleware::wrap(
$this,
$args['endpoint_provider'],
[
'operations' => [
],
'service' => 'ag',
'presign_param' => 'PresignedUrl',
]
),
'ag'
);
};
parent::__construct($args);
}
}

View File

@@ -0,0 +1,18 @@
# 更新历史 #
API版本0.8.5
| 发布时间 | 版本号 | 更新 | 说明 |
|------------|-------|----------|-------------------|
| 2023-12-08 | 0.8.5 | 功能完善 | 支持保护设置对外发布 |
| 2023-12-07 | 0.8.4 | 功能完善 | 支持托管设置对外发布 |
| 2023-12-06 | 0.8.3 | 功能完善 | 弹性伸缩组内支持实例维度保护设置 |
| 2023-11-22 | 0.8.2 | 功能完善 | 弹性伸缩组内支持实例维度保护设置 |
| 2023-11-08 | 0.8.1 | 功能完善 | 弹性伸缩组内支持实例维度托管设置 |
| 2023-04-06 | 0.8.0 | 弹性伸缩重构更新 | 弹性伸缩重构更新 |
| 2022-07-21 | 0.7.0 | 功能完善 | ag增加资源放置策略 |
| 2022-07-15 | 0.6.0 | 功能完善 | 修复自定义配置类型模版必传的问题 |
| 2022-07-08 | 0.5.0 | 功能完善 | 新增自定义配置类型 |
| 2019-05-29 | 0.4.0 | 功能完善 | 修正必传的参数为未设置为必传的问题 |
| 2019-05-28 | 0.3.0 | 功能完善 | 创建ag的资源类型修改为vm |
| 2018-05-10 | 0.2.0 | 接口完善 | 内网提供全部接口的 SDK |
| 2018-03-30 | 0.1.0 | 初始版本 | 提供 Quota 相关接口 |

View File

@@ -0,0 +1,50 @@
<?php
/**
* Ams
*
* @category Jdcloud
* @package Jdcloud\Ams
* @author Jdcloud <jdcloud-api@jd.com>
* @license Apache-2.0 http://www.apache.org/licenses/LICENSE-2.0
* @link https://www.jdcloud.com/help/faq
*/
namespace Jdcloud\Ams;
use Jdcloud\JdCloudClient;
use Jdcloud\Api\Service;
use Jdcloud\Api\DocModel;
use Jdcloud\Api\ApiProvider;
use Jdcloud\PresignUrlMiddleware;
/**
* Client used to interact with ams.
*
* @method \Jdcloud\Result describeStreamsInput(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeStreamsInputAsync(array $args = [])
* @method \Jdcloud\Result describeAuthenticate(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeAuthenticateAsync(array $args = [])
*/
class AmsClient extends JdCloudClient
{
public function __construct(array $args)
{
$args['with_resolved'] = function (array $args) {
$this->getHandlerList()->appendInit(
PresignUrlMiddleware::wrap(
$this,
$args['endpoint_provider'],
[
'operations' => [
],
'service' => 'ams',
'presign_param' => 'PresignedUrl',
]
),
'ams'
);
};
parent::__construct($args);
}
}

View File

@@ -0,0 +1,6 @@
# 更新历史 #
API版本1.0.0
|发布时间|版本号|更新|说明|
|---|---|---|---|
|2018-09-10|1.0.0|初始版本|京东云 视频云 应用管理平台 业务接口|

View File

@@ -0,0 +1,134 @@
<?php
/**
* Antipro
*
* @category Jdcloud
* @package Jdcloud\Antipro
* @author Jdcloud <jdcloud-api@jd.com>
* @license Apache-2.0 http://www.apache.org/licenses/LICENSE-2.0
* @link https://www.jdcloud.com/help/faq
*/
namespace Jdcloud\Antipro;
use Jdcloud\JdCloudClient;
use Jdcloud\Api\Service;
use Jdcloud\Api\DocModel;
use Jdcloud\Api\ApiProvider;
use Jdcloud\PresignUrlMiddleware;
/**
* Client used to interact with antipro.
*
* @method \Jdcloud\Result describeAttackLogs(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeAttackLogsAsync(array $args = [])
* @method \Jdcloud\Result describeAttackStatistics(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeAttackStatisticsAsync(array $args = [])
* @method \Jdcloud\Result describeAttackTypeCount(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeAttackTypeCountAsync(array $args = [])
* @method \Jdcloud\Result describeAttackSource(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeAttackSourceAsync(array $args = [])
* @method \Jdcloud\Result describeIpMonitorFlow(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeIpMonitorFlowAsync(array $args = [])
* @method \Jdcloud\Result describeInstances(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeInstancesAsync(array $args = [])
* @method \Jdcloud\Result createInstance(array $args = [])
* @method \GuzzleHttp\Promise\Promise createInstanceAsync(array $args = [])
* @method \Jdcloud\Result describeInstance(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeInstanceAsync(array $args = [])
* @method \Jdcloud\Result modifyInstance(array $args = [])
* @method \GuzzleHttp\Promise\Promise modifyInstanceAsync(array $args = [])
* @method \Jdcloud\Result modifyInstanceName(array $args = [])
* @method \GuzzleHttp\Promise\Promise modifyInstanceNameAsync(array $args = [])
* @method \Jdcloud\Result addProtectedIp(array $args = [])
* @method \GuzzleHttp\Promise\Promise addProtectedIpAsync(array $args = [])
* @method \Jdcloud\Result deleteProtectedIp(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteProtectedIpAsync(array $args = [])
* @method \Jdcloud\Result describeProtectedIpList(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeProtectedIpListAsync(array $args = [])
* @method \Jdcloud\Result describeProtectionRule(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeProtectionRuleAsync(array $args = [])
* @method \Jdcloud\Result describeGeoAreas(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeGeoAreasAsync(array $args = [])
* @method \Jdcloud\Result modifyProtectionRule(array $args = [])
* @method \GuzzleHttp\Promise\Promise modifyProtectionRuleAsync(array $args = [])
* @method \Jdcloud\Result checkInstanceName(array $args = [])
* @method \GuzzleHttp\Promise\Promise checkInstanceNameAsync(array $args = [])
* @method \Jdcloud\Result describeProtectionOutline(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeProtectionOutlineAsync(array $args = [])
* @method \Jdcloud\Result describeInstanceAclCnt(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeInstanceAclCntAsync(array $args = [])
* @method \Jdcloud\Result enableInstanceAcl(array $args = [])
* @method \GuzzleHttp\Promise\Promise enableInstanceAclAsync(array $args = [])
* @method \Jdcloud\Result disableInstanceAcl(array $args = [])
* @method \GuzzleHttp\Promise\Promise disableInstanceAclAsync(array $args = [])
* @method \Jdcloud\Result describeInstanceAclEnable(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeInstanceAclEnableAsync(array $args = [])
* @method \Jdcloud\Result describeAcls(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeAclsAsync(array $args = [])
* @method \Jdcloud\Result createAcl(array $args = [])
* @method \GuzzleHttp\Promise\Promise createAclAsync(array $args = [])
* @method \Jdcloud\Result modifyAcl(array $args = [])
* @method \GuzzleHttp\Promise\Promise modifyAclAsync(array $args = [])
* @method \Jdcloud\Result deleteAcl(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteAclAsync(array $args = [])
* @method \Jdcloud\Result modifyAclPriority(array $args = [])
* @method \GuzzleHttp\Promise\Promise modifyAclPriorityAsync(array $args = [])
* @method \Jdcloud\Result enableAcl(array $args = [])
* @method \GuzzleHttp\Promise\Promise enableAclAsync(array $args = [])
* @method \Jdcloud\Result disableAcl(array $args = [])
* @method \GuzzleHttp\Promise\Promise disableAclAsync(array $args = [])
* @method \Jdcloud\Result describeIpSets(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeIpSetsAsync(array $args = [])
* @method \Jdcloud\Result createIpSet(array $args = [])
* @method \GuzzleHttp\Promise\Promise createIpSetAsync(array $args = [])
* @method \Jdcloud\Result describeIpSet(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeIpSetAsync(array $args = [])
* @method \Jdcloud\Result modifyIpSet(array $args = [])
* @method \GuzzleHttp\Promise\Promise modifyIpSetAsync(array $args = [])
* @method \Jdcloud\Result deleteIpSet(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteIpSetAsync(array $args = [])
* @method \Jdcloud\Result describePortSets(array $args = [])
* @method \GuzzleHttp\Promise\Promise describePortSetsAsync(array $args = [])
* @method \Jdcloud\Result createPortSet(array $args = [])
* @method \GuzzleHttp\Promise\Promise createPortSetAsync(array $args = [])
* @method \Jdcloud\Result describePortSet(array $args = [])
* @method \GuzzleHttp\Promise\Promise describePortSetAsync(array $args = [])
* @method \Jdcloud\Result modifyPortSet(array $args = [])
* @method \GuzzleHttp\Promise\Promise modifyPortSetAsync(array $args = [])
* @method \Jdcloud\Result deletePortSet(array $args = [])
* @method \GuzzleHttp\Promise\Promise deletePortSetAsync(array $args = [])
* @method \Jdcloud\Result describeElasticIpResources(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeElasticIpResourcesAsync(array $args = [])
* @method \Jdcloud\Result describeCpsIpResources(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeCpsIpResourcesAsync(array $args = [])
* @method \Jdcloud\Result describeCcsIpResources(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeCcsIpResourcesAsync(array $args = [])
* @method \Jdcloud\Result describeWafIpResources(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeWafIpResourcesAsync(array $args = [])
* @method \Jdcloud\Result describeOperationRecords(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeOperationRecordsAsync(array $args = [])
*/
class AntiproClient extends JdCloudClient
{
public function __construct(array $args)
{
$args['with_resolved'] = function (array $args) {
$this->getHandlerList()->appendInit(
PresignUrlMiddleware::wrap(
$this,
$args['endpoint_provider'],
[
'operations' => [
],
'service' => 'antipro',
'presign_param' => 'PresignedUrl',
]
),
'antipro'
);
};
parent::__construct($args);
}
}

View File

@@ -0,0 +1,8 @@
# 更新历史 #
API版本1.2.0
|发布时间|版本号|更新|说明|
|---|---|---|---|
|2022-01-14|1.2.0|接口新增与更新|1. 增加接口支持访问控制规则配置<br>2. 增加接口支持防护Web应用防护墙公网 IP 接口<br>3. 创建实例时支持配置自动续费,创建实例成功自动绑定IP|
|2019-07-26|1.1.0|接口新增与更新|1. 增加 DDoS 防护包可防护的托管区公网 IP 查询接口<br>2. 查询已防护公网 IP 接口支持托管区<br>3. 防护规则支持 IP 黑白名单|
|2018-05-25|1.0.0|初始版本|京东云 DDoS 防护包基本操作接口|

View File

@@ -0,0 +1,67 @@
<?php
namespace Jdcloud\Api;
/**
* Base class that is used by most API shapes
*/
abstract class AbstractModel implements \ArrayAccess
{
/** @var array */
protected $definition;
/** @var ShapeMap */
protected $shapeMap;
/**
* @param array $definition Service description
* @param ShapeMap $shapeMap Shapemap used for creating shapes
*/
public function __construct(array $definition, ShapeMap $shapeMap)
{
$this->definition = $definition;
$this->shapeMap = $shapeMap;
}
public function toArray()
{
return $this->definition;
}
public function offsetGet($offset)
{
return isset($this->definition[$offset])
? $this->definition[$offset] : null;
}
public function offsetSet($offset, $value)
{
$this->definition[$offset] = $value;
}
public function offsetExists($offset)
{
return isset($this->definition[$offset]);
}
public function offsetUnset($offset)
{
unset($this->definition[$offset]);
}
protected function shapeAt($key)
{
if (!isset($this->definition[$key])) {
throw new \InvalidArgumentException('Expected shape definition at '
. $key);
}
return $this->shapeFor($this->definition[$key]);
}
protected function shapeFor(array $definition)
{
return isset($definition['shape'])
? $this->shapeMap->resolve($definition)
: Shape::create($definition, $this->shapeMap);
}
}

View File

@@ -0,0 +1,244 @@
<?php
namespace Jdcloud\Api;
use Jdcloud\Exception\UnresolvedApiException;
/**
* API providers.
*
* An API provider is a function that accepts a type, service, and version and
* returns an array of API data on success or NULL if no API data can be created
* for the provided arguments.
*
* You can wrap your calls to an API provider with the
* {@see ApiProvider::resolve} method to ensure that API data is created. If the
* API data is not created, then the resolve() method will throw a
* {@see Jdcloud\Exception\UnresolvedApiException}.
*
* use Jdcloud\Api\ApiProvider;
* $provider = ApiProvider::defaultProvider();
* // Returns an array or NULL.
* $data = $provider('api', 's3', '2006-03-01');
* // Returns an array or throws.
* $data = ApiProvider::resolve($provider, 'api', 'elasticfood', '2020-01-01');
*
* You can compose multiple providers into a single provider using
* {@see Jdcloud\or_chain}. This method accepts providers as arguments and
* returns a new function that will invoke each provider until a non-null value
* is returned.
*
* $a = ApiProvider::filesystem(sys_get_temp_dir() . '/Jdcloud-beta-models');
* $b = ApiProvider::manifest();
*
* $c = \Jdcloud\or_chain($a, $b);
* $data = $c('api', 'betaservice', '2015-08-08'); // $a handles this.
* $data = $c('api', 's3', '2006-03-01'); // $b handles this.
* $data = $c('api', 'invalid', '2014-12-15'); // Neither handles this.
*/
class ApiProvider
{
/** @var array A map of public API type names to their file suffix. */
private static $typeMap = [
'api' => 'api-2',
'paginator' => 'paginators-1',
'waiter' => 'waiters-2',
'docs' => 'docs-2',
];
/** @var array API manifest */
private $manifest;
/** @var string The directory containing service models. */
private $modelsDir;
/**
* Resolves an API provider and ensures a non-null return value.
*
* @param callable $provider Provider function to invoke.
* @param string $type Type of data ('api', 'waiter', 'paginator').
* @param string $service Service name.
* @param string $version API version.
*
* @return array
* @throws UnresolvedApiException
*/
public static function resolve(callable $provider, $type, $service, $version)
{
// Execute the provider and return the result, if there is one.
$result = $provider($type, $service, $version);
if (is_array($result)) {
if (!isset($result['metadata']['serviceIdentifier'])) {
$result['metadata']['serviceIdentifier'] = $service;
}
return $result;
}
// Throw an exception with a message depending on the inputs.
if (!isset(self::$typeMap[$type])) {
$msg = "The type must be one of: " . implode(', ', self::$typeMap);
} elseif ($service) {
$msg = "The {$service} service does not have version: {$version}.";
} else {
$msg = "You must specify a service name to retrieve its API data.";
}
throw new UnresolvedApiException($msg);
}
/**
* Default SDK API provider.
*
* This provider loads pre-built manifest data from the `data` directory.
*
* @return self
*/
public static function defaultProvider()
{
return new self(__DIR__ . '/../data', \Jdcloud\manifest());
}
/**
* Loads API data after resolving the version to the latest, compatible,
* available version based on the provided manifest data.
*
* Manifest data is essentially an associative array of service names to
* associative arrays of API version aliases.
*
* [
* ...
* 'ec2' => [
* 'latest' => '2014-10-01',
* '2014-10-01' => '2014-10-01',
* '2014-09-01' => '2014-10-01',
* '2014-06-15' => '2014-10-01',
* ...
* ],
* 'ecs' => [...],
* 'elasticache' => [...],
* ...
* ]
*
* @param string $dir Directory containing service models.
* @param array $manifest The API version manifest data.
*
* @return self
*/
public static function manifest($dir, array $manifest)
{
return new self($dir, $manifest);
}
/**
* Loads API data from the specified directory.
*
* If "latest" is specified as the version, this provider must glob the
* directory to find which is the latest available version.
*
* @param string $dir Directory containing service models.
*
* @return self
* @throws \InvalidArgumentException if the provided `$dir` is invalid.
*/
public static function filesystem($dir)
{
return new self($dir);
}
/**
* Retrieves a list of valid versions for the specified service.
*
* @param string $service Service name
*
* @return array
*/
public function getVersions($service)
{
if (!isset($this->manifest)) {
$this->buildVersionsList($service);
}
if (!isset($this->manifest[$service]['versions'])) {
return [];
}
return array_values(array_unique($this->manifest[$service]['versions']));
}
/**
* Execute the the provider.
*
* @param string $type Type of data ('api', 'waiter', 'paginator').
* @param string $service Service name.
* @param string $version API version.
*
* @return array|null
*/
public function __invoke($type, $service, $version)
{
// Resolve the type or return null.
if (isset(self::$typeMap[$type])) {
$type = self::$typeMap[$type];
} else {
return null;
}
// Resolve the version or return null.
if (!isset($this->manifest)) {
$this->buildVersionsList($service);
}
if (!isset($this->manifest[$service]['versions'][$version])) {
return null;
}
$version = $this->manifest[$service]['versions'][$version];
$path = "{$this->modelsDir}/{$service}/{$version}/{$type}.json";
try {
return \Jdcloud\load_compiled_json($path);
} catch (\InvalidArgumentException $e) {
return null;
}
}
/**
* @param string $modelsDir Directory containing service models.
* @param array $manifest The API version manifest data.
*/
private function __construct($modelsDir, array $manifest = null)
{
$this->manifest = $manifest;
$this->modelsDir = rtrim($modelsDir, '/');
if (!is_dir($this->modelsDir)) {
throw new \InvalidArgumentException(
"The specified models directory, {$modelsDir}, was not found."
);
}
}
/**
* Build the versions list for the specified service by globbing the dir.
*/
private function buildVersionsList($service)
{
$dir = "{$this->modelsDir}/{$service}/";
if (!is_dir($dir)) {
return;
}
// Get versions, remove . and .., and sort in descending order.
$results = array_diff(scandir($dir, SCANDIR_SORT_DESCENDING), ['..', '.']);
if (!$results) {
$this->manifest[$service] = ['versions' => []];
} else {
$this->manifest[$service] = [
'versions' => [
'latest' => $results[0]
]
];
$this->manifest[$service]['versions'] += array_combine($results, $results);
}
}
}

View File

@@ -0,0 +1,41 @@
<?php
namespace Jdcloud\Api;
/**
* DateTime overrides that make DateTime work more seamlessly as a string,
* with JSON documents, and with JMESPath.
*/
class DateTimeResult extends \DateTime implements \JsonSerializable
{
/**
* Create a new DateTimeResult from a unix timestamp.
*
* @param $unixTimestamp
*
* @return DateTimeResult
*/
public static function fromEpoch($unixTimestamp)
{
return new self(gmdate('c', $unixTimestamp));
}
/**
* Serialize the DateTimeResult as an ISO 8601 date string.
*
* @return string
*/
public function __toString()
{
return $this->format('c');
}
/**
* Serialize the date as an ISO 8601 date when serializing as JSON.
*
* @return mixed|string
*/
public function jsonSerialize()
{
return (string) $this;
}
}

View File

@@ -0,0 +1,128 @@
<?php
namespace Jdcloud\Api;
/**
* Encapsulates the documentation strings for a given service-version and
* provides methods for extracting the desired parts related to a service,
* operation, error, or shape (i.e., parameter).
*/
class DocModel
{
/** @var array */
private $docs;
/**
* @param array $docs
*
* @throws \RuntimeException
*/
public function __construct(array $docs)
{
if (!extension_loaded('tidy')) {
throw new \RuntimeException('The "tidy" PHP extension is required.');
}
$this->docs = $docs;
}
/**
* Convert the doc model to an array.
*
* @return array
*/
public function toArray()
{
return $this->docs;
}
/**
* Retrieves documentation about the service.
*
* @return null|string
*/
public function getServiceDocs()
{
return isset($this->docs['service']) ? $this->docs['service'] : null;
}
/**
* Retrieves documentation about an operation.
*
* @param string $operation Name of the operation
*
* @return null|string
*/
public function getOperationDocs($operation)
{
return isset($this->docs['operations'][$operation])
? $this->docs['operations'][$operation]
: null;
}
/**
* Retrieves documentation about an error.
*
* @param string $error Name of the error
*
* @return null|string
*/
public function getErrorDocs($error)
{
return isset($this->docs['shapes'][$error]['base'])
? $this->docs['shapes'][$error]['base']
: null;
}
/**
* Retrieves documentation about a shape, specific to the context.
*
* @param string $shapeName Name of the shape.
* @param string $parentName Name of the parent/context shape.
* @param string $ref Name used by the context to reference the shape.
*
* @return null|string
*/
public function getShapeDocs($shapeName, $parentName, $ref)
{
if (!isset($this->docs['shapes'][$shapeName])) {
return '';
}
$result = '';
$d = $this->docs['shapes'][$shapeName];
if (isset($d['refs']["{$parentName}\$${ref}"])) {
$result = $d['refs']["{$parentName}\$${ref}"];
} elseif (isset($d['base'])) {
$result = $d['base'];
}
if (isset($d['append'])) {
$result .= $d['append'];
}
return $this->clean($result);
}
private function clean($content)
{
if (!$content) {
return '';
}
$tidy = new \Tidy();
$tidy->parseString($content, [
'indent' => true,
'doctype' => 'omit',
'output-html' => true,
'show-body-only' => true,
'drop-empty-paras' => true,
'drop-font-tags' => true,
'drop-proprietary-attributes' => true,
'hide-comments' => true,
'logical-emphasis' => true
]);
$tidy->cleanRepair();
return (string) $content;
}
}

View File

@@ -0,0 +1,43 @@
<?php
namespace Jdcloud\Api\ErrorParser;
use Jdcloud\Api\Parser\PayloadParserTrait;
use Psr\Http\Message\ResponseInterface;
/**
* Provides basic JSON error parsing functionality.
*/
trait JsonParserTrait
{
use PayloadParserTrait;
private function genericHandler(ResponseInterface $response)
{
$requestId = (string) $response->getHeaderLine('x-jdcloud-request-id');
$code = (string) $response->getStatusCode();
$bizCode = null;
$bizStatus = null;
$bizMessage = null;
$body = $this->parseJson($response->getBody());
if ($body != null) {
if ($body['requestId'] != null) {
$requestId = $body['requestId'];
}
if ($body['error'] != null) {
$bizCode = $body['error']['code'];
$bizStatus = $body['error']['status'];
$bizMessage = $body['error']['message'];
}
}
return [
'requestId' => $requestId,
'code' => $bizCode,
'status' => $bizStatus,
'message' => $bizMessage,
'type' => $code[0] == '4' ? 'client' : 'server',
'parsed' => $this->parseJson($response->getBody())
];
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace Jdcloud\Api\ErrorParser;
use Psr\Http\Message\ResponseInterface;
/**
* Parsers JSON-RPC errors.
*/
class JsonRpcErrorParser
{
use JsonParserTrait;
public function __invoke(ResponseInterface $response)
{
$data = $this->genericHandler($response);
// Make the casing consistent across services.
if ($data['parsed']) {
$data['parsed'] = array_change_key_case($data['parsed']);
}
if (isset($data['parsed']['__type'])) {
$parts = explode('#', $data['parsed']['__type']);
$data['code'] = isset($parts[1]) ? $parts[1] : $parts[0];
$data['message'] = isset($data['parsed']['message'])
? $data['parsed']['message']
: null;
}
return $data;
}
}

View File

@@ -0,0 +1,35 @@
<?php
namespace Jdcloud\Api\ErrorParser;
use Psr\Http\Message\ResponseInterface;
/**
* Parses JSON-REST errors.
*/
class RestJsonErrorParser
{
use JsonParserTrait;
public function __invoke(ResponseInterface $response)
{
$data = $this->genericHandler($response);
// Merge in error data from the JSON body
if ($json = $data['parsed']) {
$data = array_replace($data, $json);
}
// Correct error type from services like Amazon Glacier
if (!empty($data['type'])) {
$data['type'] = strtolower($data['type']);
}
// Retrieve the error code from services like Amazon Elastic Transcoder
if ($code = $response->getHeaderLine('x-amzn-errortype')) {
$colon = strpos($code, ':');
$data['code'] = $colon ? substr($code, 0, $colon) : $code;
}
return $data;
}
}

View File

@@ -0,0 +1,82 @@
<?php
namespace Jdcloud\Api\ErrorParser;
use Jdcloud\Api\Parser\PayloadParserTrait;
use Psr\Http\Message\ResponseInterface;
/**
* Parses XML errors.
*/
class XmlErrorParser
{
use PayloadParserTrait;
public function __invoke(ResponseInterface $response)
{
$code = (string) $response->getStatusCode();
$data = [
'type' => $code[0] == '4' ? 'client' : 'server',
'requestId' => null,
'code' => null,
'message' => null,
'parsed' => null
];
$body = $response->getBody();
if ($body->getSize() > 0) {
$this->parseBody($this->parseXml($body), $data);
} else {
$this->parseHeaders($response, $data);
}
return $data;
}
private function parseHeaders(ResponseInterface $response, array &$data)
{
if ($response->getStatusCode() == '404') {
$data['code'] = 'NotFound';
}
$data['message'] = $response->getStatusCode() . ' '
. $response->getReasonPhrase();
if ($requestId = $response->getHeaderLine('x-jdcloud-requestId')) {
$data['requestId'] = $requestId;
$data['message'] .= " (Request-ID: $requestId)";
}
}
private function parseBody(\SimpleXMLElement $body, array &$data)
{
$data['parsed'] = $body;
$namespaces = $body->getDocNamespaces();
if (!isset($namespaces[''])) {
$prefix = '';
} else {
// Account for the default namespace being defined and PHP not
// being able to handle it :(.
$body->registerXPathNamespace('ns', $namespaces['']);
$prefix = 'ns:';
}
if ($tempXml = $body->xpath("//{$prefix}Code[1]")) {
$data['code'] = (string) $tempXml[0];
}
if ($tempXml = $body->xpath("//{$prefix}Message[1]")) {
$data['message'] = (string) $tempXml[0];
}
$tempXml = $body->xpath("//{$prefix}RequestId[1]");
if (empty($tempXml)) {
$tempXml = $body->xpath("//{$prefix}RequestID[1]");
}
if (isset($tempXml[0])) {
$data['requestId'] = (string) $tempXml[0];
}
}
}

View File

@@ -0,0 +1,35 @@
<?php
namespace Jdcloud\Api;
/**
* Represents a list shape.
*/
class ListShape extends Shape
{
private $member;
public function __construct(array $definition, ShapeMap $shapeMap)
{
$definition['type'] = 'list';
parent::__construct($definition, $shapeMap);
}
/**
* @return Shape
* @throws \RuntimeException if no member is specified
*/
public function getMember()
{
if (!$this->member) {
if (!isset($this->definition['member'])) {
throw new \RuntimeException('No member attribute specified');
}
$this->member = Shape::create(
$this->definition['member'],
$this->shapeMap
);
}
return $this->member;
}
}

View File

@@ -0,0 +1,54 @@
<?php
namespace Jdcloud\Api;
/**
* Represents a map shape.
*/
class MapShape extends Shape
{
/** @var Shape */
private $value;
/** @var Shape */
private $key;
public function __construct(array $definition, ShapeMap $shapeMap)
{
$definition['type'] = 'map';
parent::__construct($definition, $shapeMap);
}
/**
* @return Shape
* @throws \RuntimeException if no value is specified
*/
public function getValue()
{
if (!$this->value) {
if (!isset($this->definition['value'])) {
throw new \RuntimeException('No value specified');
}
$this->value = Shape::create(
$this->definition['value'],
$this->shapeMap
);
}
return $this->value;
}
/**
* @return Shape
*/
public function getKey()
{
if (!$this->key) {
$this->key = isset($this->definition['key'])
? Shape::create($this->definition['key'], $this->shapeMap)
: new Shape(['type' => 'string'], $this->shapeMap);
}
return $this->key;
}
}

View File

@@ -0,0 +1,97 @@
<?php
namespace Jdcloud\Api;
/**
* Represents an API operation.
*/
class Operation extends AbstractModel
{
private $input;
private $output;
private $errors;
public function __construct(array $definition, ShapeMap $shapeMap)
{
$definition['type'] = 'structure';
if (!isset($definition['http']['method'])) {
$definition['http']['method'] = 'POST';
}
if (!isset($definition['http']['requestUri'])) {
$definition['http']['requestUri'] = '/';
}
parent::__construct($definition, $shapeMap);
}
/**
* Returns an associative array of the HTTP attribute of the operation:
*
* - method: HTTP method of the operation
* - requestUri: URI of the request (can include URI template placeholders)
*
* @return array
*/
public function getHttp()
{
return $this->definition['http'];
}
/**
* Get the input shape of the operation.
*
* @return StructureShape
*/
public function getInput()
{
if (!$this->input) {
if ($input = $this['input']) {
$this->input = $this->shapeFor($input);
} else {
$this->input = new StructureShape([], $this->shapeMap);
}
}
return $this->input;
}
/**
* Get the output shape of the operation.
*
* @return StructureShape
*/
public function getOutput()
{
if (!$this->output) {
if ($output = $this['output']) {
$this->output = $this->shapeFor($output);
} else {
$this->output = new StructureShape([], $this->shapeMap);
}
}
return $this->output;
}
/**
* Get an array of operation error shapes.
*
* @return Shape[]
*/
public function getErrors()
{
if ($this->errors === null) {
if ($errors = $this['errors']) {
foreach ($errors as $key => $error) {
$errors[$key] = $this->shapeFor($error);
}
$this->errors = $errors;
} else {
$this->errors = [];
}
}
return $this->errors;
}
}

View File

@@ -0,0 +1,35 @@
<?php
namespace Jdcloud\Api\Parser;
use Jdcloud\Api\Service;
use Jdcloud\CommandInterface;
use Jdcloud\ResultInterface;
use Psr\Http\Message\ResponseInterface;
/**
* @internal
*/
abstract class AbstractParser
{
/** @var \Jdcloud\Api\Service Representation of the service API*/
protected $api;
/**
* @param Service $api Service description.
*/
public function __construct(Service $api)
{
$this->api = $api;
}
/**
* @param CommandInterface $command Command that was executed.
* @param ResponseInterface $response Response that was received.
*
* @return ResultInterface
*/
abstract public function __invoke(
CommandInterface $command,
ResponseInterface $response
);
}

View File

@@ -0,0 +1,163 @@
<?php
namespace Jdcloud\Api\Parser;
use Jdcloud\Api\DateTimeResult;
use Jdcloud\Api\Shape;
use Jdcloud\Api\StructureShape;
use Jdcloud\Result;
use Jdcloud\CommandInterface;
use Psr\Http\Message\ResponseInterface;
/**
* @internal
*/
abstract class AbstractRestParser extends AbstractParser
{
use PayloadParserTrait;
/**
* Parses a payload from a response.
*
* @param ResponseInterface $response Response to parse.
* @param StructureShape $member Member to parse
* @param array $result Result value
*
* @return mixed
*/
abstract protected function payload(
ResponseInterface $response,
StructureShape $member,
array &$result
);
public function __invoke(
CommandInterface $command,
ResponseInterface $response
) {
$output = $this->api->getOperation($command->getName())->getOutput();
$result = [];
if ($payload = $output['payload']) {
$this->extractPayload($payload, $output, $response, $result);
}
foreach ($output->getMembers() as $name => $member) {
switch ($member['location']) {
case 'header':
$this->extractHeader($name, $member, $response, $result);
break;
case 'headers':
$this->extractHeaders($name, $member, $response, $result);
break;
case 'statusCode':
$this->extractStatus($name, $response, $result);
break;
}
}
if (!$payload
&& $response->getBody()->getSize() > 0
&& count($output->getMembers()) > 0
) {
// if no payload was found, then parse the contents of the body
$this->payload($response, $output, $result);
}
return new Result($result);
}
private function extractPayload(
$payload,
StructureShape $output,
ResponseInterface $response,
array &$result
) {
$member = $output->getMember($payload);
if ($member instanceof StructureShape) {
// Structure members parse top-level data into a specific key.
$result[$payload] = [];
$this->payload($response, $member, $result[$payload]);
} else {
// Streaming data is just the stream from the response body.
$result[$payload] = $response->getBody();
}
}
/**
* Extract a single header from the response into the result.
*/
private function extractHeader(
$name,
Shape $shape,
ResponseInterface $response,
&$result
) {
$value = $response->getHeaderLine($shape['locationName'] ?: $name);
switch ($shape->getType()) {
case 'float':
case 'double':
$value = (float) $value;
break;
case 'long':
$value = (int) $value;
break;
case 'boolean':
$value = filter_var($value, FILTER_VALIDATE_BOOLEAN);
break;
case 'blob':
$value = base64_decode($value);
break;
case 'timestamp':
try {
$value = new DateTimeResult($value);
break;
} catch (\Exception $e) {
// If the value cannot be parsed, then do not add it to the
// output structure.
return;
}
case 'string':
if ($shape['jsonvalue']) {
$value = $this->parseJson(base64_decode($value));
}
break;
}
$result[$name] = $value;
}
/**
* Extract a map of headers with an optional prefix from the response.
*/
private function extractHeaders(
$name,
Shape $shape,
ResponseInterface $response,
&$result
) {
// Check if the headers are prefixed by a location name
$result[$name] = [];
$prefix = $shape['locationName'];
$prefixLen = strlen($prefix);
foreach ($response->getHeaders() as $k => $values) {
if (!$prefixLen) {
$result[$name][$k] = implode(', ', $values);
} elseif (stripos($k, $prefix) === 0) {
$result[$name][substr($k, $prefixLen)] = implode(', ', $values);
}
}
}
/**
* Places the status code of the response into the result array.
*/
private function extractStatus(
$name,
ResponseInterface $response,
array &$result
) {
$result[$name] = (int) $response->getStatusCode();
}
}

View File

@@ -0,0 +1,4 @@
<?php
namespace Jdcloud\Api\Parser\Exception;
class ParserException extends \RuntimeException {}

View File

@@ -0,0 +1,58 @@
<?php
namespace Jdcloud\Api\Parser;
use Jdcloud\Api\DateTimeResult;
use Jdcloud\Api\Shape;
/**
* @internal Implements standard JSON parsing.
*/
class JsonParser
{
public function parse(Shape $shape, $value)
{
if ($value === null) {
return $value;
}
switch ($shape['type']) {
case 'structure':
$target = [];
foreach ($shape->getMembers() as $name => $member) {
$locationName = $member['locationName'] ?: $name;
if (isset($value[$locationName])) {
$target[$name] = $this->parse($member, $value[$locationName]);
}
}
return $target;
case 'list':
$member = $shape->getMember();
$target = [];
foreach ($value as $v) {
$target[] = $this->parse($member, $v);
}
return $target;
case 'map':
$values = $shape->getValue();
$target = [];
foreach ($value as $k => $v) {
$target[$k] = $this->parse($values, $v);
}
return $target;
case 'timestamp':
// The Unix epoch (or Unix time or POSIX time or Unix
// timestamp) is the number of seconds that have elapsed since
// January 1, 1970 (midnight UTC/GMT).
return DateTimeResult::fromEpoch($value);
case 'blob':
return base64_decode($value);
default:
return $value;
}
}
}

View File

@@ -0,0 +1,42 @@
<?php
namespace Jdcloud\Api\Parser;
use Jdcloud\Api\Service;
use Jdcloud\Result;
use Jdcloud\CommandInterface;
use Psr\Http\Message\ResponseInterface;
/**
* @internal Implements JSON-RPC parsing (e.g., DynamoDB)
*/
class JsonRpcParser extends AbstractParser
{
use PayloadParserTrait;
private $parser;
/**
* @param Service $api Service description
* @param JsonParser $parser JSON body builder
*/
public function __construct(Service $api, JsonParser $parser = null)
{
parent::__construct($api);
$this->parser = $parser ?: new JsonParser();
}
public function __invoke(
CommandInterface $command,
ResponseInterface $response
) {
$operation = $this->api->getOperation($command->getName());
$result = null === $operation['output']
? null
: $this->parser->parse(
$operation->getOutput(),
$this->parseJson($response->getBody())
);
return new Result($result ?: []);
}
}

View File

@@ -0,0 +1,52 @@
<?php
namespace Jdcloud\Api\Parser;
use Jdcloud\Api\Parser\Exception\ParserException;
trait PayloadParserTrait
{
/**
* @param string $json
*
* @throws ParserException
*
* @return array
*/
private function parseJson($json)
{
$jsonPayload = json_decode($json, true);
if (JSON_ERROR_NONE !== json_last_error()) {
return null;
// throw new ParserException('Error parsing JSON: '
// . json_last_error_msg());
}
return $jsonPayload;
}
/**
* @param string $xml
*
* @throws ParserException
*
* @return \SimpleXMLElement
*/
private function parseXml($xml)
{
$priorSetting = libxml_use_internal_errors(true);
try {
libxml_clear_errors();
$xmlPayload = new \SimpleXMLElement($xml);
if ($error = libxml_get_last_error()) {
throw new \RuntimeException($error->message);
}
} catch (\Exception $e) {
throw new ParserException("Error parsing XML: {$e->getMessage()}", 0, $e);
} finally {
libxml_use_internal_errors($priorSetting);
}
return $xmlPayload;
}
}

View File

@@ -0,0 +1,52 @@
<?php
namespace Jdcloud\Api\Parser;
use Jdcloud\Api\Service;
use Jdcloud\Result;
use Jdcloud\CommandInterface;
use Psr\Http\Message\ResponseInterface;
/**
* @internal Parses query (XML) responses (e.g., EC2, SQS, and many others)
*/
class QueryParser extends AbstractParser
{
use PayloadParserTrait;
/** @var XmlParser */
private $xmlParser;
/** @var bool */
private $honorResultWrapper;
/**
* @param Service $api Service description
* @param XmlParser $xmlParser Optional XML parser
* @param bool $honorResultWrapper Set to false to disable the peeling
* back of result wrappers from the
* output structure.
*/
public function __construct(
Service $api,
XmlParser $xmlParser = null,
$honorResultWrapper = true
) {
parent::__construct($api);
$this->xmlParser = $xmlParser ?: new XmlParser();
$this->honorResultWrapper = $honorResultWrapper;
}
public function __invoke(
CommandInterface $command,
ResponseInterface $response
) {
$output = $this->api->getOperation($command->getName())->getOutput();
$xml = $this->parseXml($response->getBody());
if ($this->honorResultWrapper && $output['resultWrapper']) {
$xml = $xml->{$output['resultWrapper']};
}
return new Result($this->xmlParser->parse($output, $xml));
}
}

View File

@@ -0,0 +1,39 @@
<?php
namespace Jdcloud\Api\Parser;
use Jdcloud\Api\Service;
use Jdcloud\Api\StructureShape;
use Psr\Http\Message\ResponseInterface;
/**
* @internal Implements REST-JSON parsing (e.g., Glacier, Elastic Transcoder)
*/
class RestJsonParser extends AbstractRestParser
{
use PayloadParserTrait;
/** @var JsonParser */
private $parser;
/**
* @param Service $api Service description
* @param JsonParser $parser JSON body builder
*/
public function __construct(Service $api, JsonParser $parser = null)
{
parent::__construct($api);
$this->parser = $parser ?: new JsonParser();
}
protected function payload(
ResponseInterface $response,
StructureShape $member,
array &$result
) {
$jsonBody = $this->parseJson($response->getBody());
if ($jsonBody) {
$result += $this->parser->parse($member, $jsonBody);
}
}
}

View File

@@ -0,0 +1,36 @@
<?php
namespace Jdcloud\Api\Parser;
use Jdcloud\Api\StructureShape;
use Jdcloud\Api\Service;
use Psr\Http\Message\ResponseInterface;
/**
* @internal Implements REST-XML parsing (e.g., S3, CloudFront, etc...)
*/
class RestXmlParser extends AbstractRestParser
{
use PayloadParserTrait;
/** @var XmlParser */
private $parser;
/**
* @param Service $api Service description
* @param XmlParser $parser XML body parser
*/
public function __construct(Service $api, XmlParser $parser = null)
{
parent::__construct($api);
$this->parser = $parser ?: new XmlParser();
}
protected function payload(
ResponseInterface $response,
StructureShape $member,
array &$result
) {
$xml = $this->parseXml($response->getBody());
$result += $this->parser->parse($member, $xml);
}
}

View File

@@ -0,0 +1,134 @@
<?php
namespace Jdcloud\Api\Parser;
use Jdcloud\Api\DateTimeResult;
use Jdcloud\Api\ListShape;
use Jdcloud\Api\MapShape;
use Jdcloud\Api\Shape;
use Jdcloud\Api\StructureShape;
/**
* @internal Implements standard XML parsing for REST-XML and Query protocols.
*/
class XmlParser
{
public function parse(StructureShape $shape, \SimpleXMLElement $value)
{
return $this->dispatch($shape, $value);
}
private function dispatch($shape, \SimpleXMLElement $value)
{
static $methods = [
'structure' => 'parse_structure',
'list' => 'parse_list',
'map' => 'parse_map',
'blob' => 'parse_blob',
'boolean' => 'parse_boolean',
'integer' => 'parse_integer',
'float' => 'parse_float',
'double' => 'parse_float',
'timestamp' => 'parse_timestamp',
];
$type = $shape['type'];
if (isset($methods[$type])) {
return $this->{$methods[$type]}($shape, $value);
}
return (string) $value;
}
private function parse_structure(
StructureShape $shape,
\SimpleXMLElement $value
) {
$target = [];
foreach ($shape->getMembers() as $name => $member) {
// Extract the name of the XML node
$node = $this->memberKey($member, $name);
if (isset($value->{$node})) {
$target[$name] = $this->dispatch($member, $value->{$node});
}
}
return $target;
}
private function memberKey(Shape $shape, $name)
{
if (null !== $shape['locationName']) {
return $shape['locationName'];
}
if ($shape instanceof ListShape && $shape['flattened']) {
return $shape->getMember()['locationName'] ?: $name;
}
return $name;
}
private function parse_list(ListShape $shape, \SimpleXMLElement $value)
{
$target = [];
$member = $shape->getMember();
if (!$shape['flattened']) {
$value = $value->{$member['locationName'] ?: 'member'};
}
foreach ($value as $v) {
$target[] = $this->dispatch($member, $v);
}
return $target;
}
private function parse_map(MapShape $shape, \SimpleXMLElement $value)
{
$target = [];
if (!$shape['flattened']) {
$value = $value->entry;
}
$mapKey = $shape->getKey();
$mapValue = $shape->getValue();
$keyName = $shape->getKey()['locationName'] ?: 'key';
$valueName = $shape->getValue()['locationName'] ?: 'value';
foreach ($value as $node) {
$key = $this->dispatch($mapKey, $node->{$keyName});
$value = $this->dispatch($mapValue, $node->{$valueName});
$target[$key] = $value;
}
return $target;
}
private function parse_blob(Shape $shape, $value)
{
return base64_decode((string) $value);
}
private function parse_float(Shape $shape, $value)
{
return (float) (string) $value;
}
private function parse_integer(Shape $shape, $value)
{
return (int) (string) $value;
}
private function parse_boolean(Shape $shape, $value)
{
return $value == 'true';
}
private function parse_timestamp(Shape $shape, $value)
{
return new DateTimeResult($value);
}
}

View File

@@ -0,0 +1,40 @@
<?php
namespace Jdcloud\Api\Serializer;
use Jdcloud\Api\Shape;
use Jdcloud\Api\ListShape;
/**
* @internal
*/
class Ec2ParamBuilder extends QueryParamBuilder
{
protected function queryName(Shape $shape, $default = null)
{
return ($shape['queryName']
?: ucfirst($shape['locationName']))
?: $default;
}
protected function isFlat(Shape $shape)
{
return false;
}
protected function format_list(
ListShape $shape,
array $value,
$prefix,
&$query
) {
// Handle empty list serialization
if (!$value) {
$query[$prefix] = false;
} else {
$items = $shape->getMember();
foreach ($value as $k => $v) {
$this->format($items, $v, $prefix . '.' . ($k + 1), $query);
}
}
}
}

View File

@@ -0,0 +1,89 @@
<?php
namespace Jdcloud\Api\Serializer;
use Jdcloud\Api\Service;
use Jdcloud\Api\Shape;
use Jdcloud\Api\TimestampShape;
/**
* Formats the JSON body of a JSON-REST or JSON-RPC operation.
* @internal
*/
class JsonBody
{
private $api;
public function __construct(Service $api)
{
$this->api = $api;
}
/**
* Gets the JSON Content-Type header for a service API
*
* @param Service $service
*
* @return string
*/
public static function getContentType(Service $service)
{
return 'application/json';
}
/**
* Builds the JSON body based on an array of arguments.
*
* @param Shape $shape Operation being constructed
* @param array $args Associative array of arguments
*
* @return string
*/
public function build(Shape $shape, array $args)
{
$result = json_encode($this->format($shape, $args));
return $result == '[]' ? '{}' : $result;
}
private function format(Shape $shape, $value)
{
switch ($shape['type']) {
case 'structure':
$data = [];
foreach ($value as $k => $v) {
if ($v !== null && $shape->hasMember($k)) {
$valueShape = $shape->getMember($k);
$data[$valueShape['locationName'] ?: $k]
= $this->format($valueShape, $v);
}
}
return $data;
case 'list':
$items = $shape->getMember();
foreach ($value as $k => $v) {
$value[$k] = $this->format($items, $v);
}
return $value;
case 'map':
if (empty($value)) {
return new \stdClass;
}
$values = $shape->getValue();
foreach ($value as $k => $v) {
$value[$k] = $this->format($values, $v);
}
return $value;
case 'blob':
return base64_encode($value);
case 'timestamp':
return TimestampShape::format($value, 'unixTimestamp');
default:
return $value;
}
}
}

View File

@@ -0,0 +1,106 @@
<?php
namespace Jdcloud\Api\Serializer;
use Jdcloud\Api\Service;
use Jdcloud\CommandInterface;
use GuzzleHttp\Psr7\Request;
use Psr\Http\Message\RequestInterface;
use GuzzleHttp\Psr7\Uri;
use GuzzleHttp\Psr7;
/**
* Prepares a JSON-RPC request for transfer.
* @internal
*/
class JsonRpcSerializer
{
/** @var JsonBody */
private $jsonFormatter;
/** @var ParamBuilder */
private $paramFormatter;
/** @var string */
private $endpoint;
/** @var Service */
private $api;
/** @var string */
private $contentType;
/**
* @param Service $api Service description
* @param string $endpoint Endpoint to connect to
* @param JsonBody $jsonFormatter Optional JSON formatter to use
*/
public function __construct(
Service $api,
$endpoint,
JsonBody $jsonFormatter = null
) {
$this->endpoint = $endpoint;
$this->api = $api;
$this->jsonFormatter = $jsonFormatter ?: new JsonBody($this->api);
$this->paramFormatter = new ParamBuilder($api, $endpoint);
$this->contentType = JsonBody::getContentType($api);
}
/**
* When invoked with an Jdcloud command, returns a serialization array
* containing "method", "uri", "headers", and "body" key value pairs.
*
* @param CommandInterface $command
*
* @return RequestInterface
*/
public function __invoke(CommandInterface $command)
{
$name = $command->getName();
$operation = $this->api->getOperation($name);
$method = $operation['http']['method'];
$headers = ['Content-Type' => $this->contentType ];
$extraHeaders = $command -> offsetGet('extraHeaders');
if($extraHeaders != null) {
$headers = array_merge($headers, $extraHeaders);
}
$paramArray = $this->paramFormatter->build($command);
$requestUri = $this->endpoint.$operation['http']['requestUri'];
if(strpos($requestUri, '{')) {
foreach ($paramArray as $k => $v) {
if(strpos($requestUri, '{'.$k.'}')) {
$requestUri = str_replace('{'.$k.'}', $v, $requestUri);
unset($paramArray[$k]);
}
}
}
if($method == "GET" || $method == "DELETE" || $method == "HEAD") {
$param = Psr7\build_query($paramArray);
// var_dump($param);
$uri = Uri::composeComponents('', '', $requestUri,
$param, "");
return new Request(
$operation['http']['method'],
$uri,
$headers,
null
);
}
$uri = Uri::composeComponents('', '', $requestUri,
"", "");
return new Request(
$operation['http']['method'],
$uri,
$headers,
$this->jsonFormatter->build(
$operation->getInput(),
$command->toArray()
)
);
}
}

View File

@@ -0,0 +1,51 @@
<?php
namespace Jdcloud\Api\Serializer;
use Jdcloud\Api\Service;
use Jdcloud\CommandInterface;
use GuzzleHttp\Psr7\Request;
use Psr\Http\Message\RequestInterface;
/**
* Serializes a query protocol request.
* @internal
*/
class ParamBuilder
{
private $endpoint;
private $api;
private $paramBuilder;
public function __construct(
Service $api,
$endpoint,
callable $paramBuilder = null
) {
$this->api = $api;
$this->endpoint = $endpoint;
$this->paramBuilder = $paramBuilder ?: new QueryParamBuilder();
}
/**
* When invoked with an Jdcloud command, returns a serialization array
* containing "method", "uri", "headers", and "body" key value pairs.
*
* @param CommandInterface $command
*
* @return RequestInterface
*/
public function build(CommandInterface $command)
{
$operation = $this->api->getOperation($command->getName());
$params = $command->toArray();
$data = call_user_func(
$this->paramBuilder,
$operation->getInput(),
$params
);
return $data;
}
}

View File

@@ -0,0 +1,157 @@
<?php
namespace Jdcloud\Api\Serializer;
use Jdcloud\Api\StructureShape;
use Jdcloud\Api\ListShape;
use Jdcloud\Api\MapShape;
use Jdcloud\Api\Shape;
use Jdcloud\Api\TimestampShape;
/**
* @internal
*/
class QueryParamBuilder
{
private $methods;
protected function queryName(Shape $shape, $default = null)
{
if (null !== $shape['queryName']) {
return $shape['queryName'];
}
if (null !== $shape['locationName']) {
return $shape['locationName'];
}
if ($this->isFlat($shape) && !empty($shape['member']['locationName'])) {
return $shape['member']['locationName'];
}
return $default;
}
protected function isFlat(Shape $shape)
{
return $shape['flattened'] === true;
}
public function __invoke(StructureShape $shape, array $params)
{
if (!$this->methods) {
$this->methods = array_fill_keys(get_class_methods($this), true);
}
$query = [];
$this->format_structure($shape, $params, '', $query);
return $query;
}
protected function format(Shape $shape, $value, $prefix, array &$query)
{
$type = 'format_' . $shape['type'];
if (isset($this->methods[$type])) {
$this->{$type}($shape, $value, $prefix, $query);
} else {
$query[$prefix] = (string) $value;
}
}
protected function format_structure(
StructureShape $shape,
array $value,
$prefix,
&$query
) {
if ($prefix) {
$prefix .= '.';
}
foreach ($value as $k => $v) {
if ($shape->hasMember($k)) {
$member = $shape->getMember($k);
$this->format(
$member,
$v,
$prefix . $this->queryName($member, $k),
$query
);
}
}
}
protected function format_list(
ListShape $shape,
array $value,
$prefix,
&$query
) {
// Handle empty list serialization
if (!$value) {
$query[$prefix] = '';
return;
}
$items = $shape->getMember();
if (!$this->isFlat($shape)) {
$locationName = $shape->getMember()['locationName'];
if($locationName) {
$prefix .= ".$locationName";
}
} elseif ($name = $this->queryName($items)) {
$parts = explode('.', $prefix);
$parts[count($parts) - 1] = $name;
$prefix = implode('.', $parts);
}
foreach ($value as $k => $v) {
$this->format($items, $v, $prefix . '.' . ($k + 1), $query);
}
}
protected function format_map(
MapShape $shape,
array $value,
$prefix,
array &$query
) {
$vals = $shape->getValue();
$keys = $shape->getKey();
if (!$this->isFlat($shape)) {
$prefix .= '.entry';
}
$i = 0;
$keyName = '%s.%d.' . $this->queryName($keys, 'key');
$valueName = '%s.%s.' . $this->queryName($vals, 'value');
foreach ($value as $k => $v) {
$i++;
print($prefix);
$this->format($keys, $k, sprintf($keyName, $prefix, $i), $query);
$this->format($vals, $v, sprintf($valueName, $prefix, $i), $query);
}
}
protected function format_blob(Shape $shape, $value, $prefix, array &$query)
{
$query[$prefix] = base64_encode($value);
}
protected function format_timestamp(
TimestampShape $shape,
$value,
$prefix,
array &$query
) {
$query[$prefix] = TimestampShape::format($value, 'iso8601');
}
protected function format_boolean(Shape $shape, $value, $prefix, array &$query)
{
$query[$prefix] = ($value) ? 'true' : 'false';
}
}

View File

@@ -0,0 +1,69 @@
<?php
namespace Jdcloud\Api\Serializer;
use Jdcloud\Api\Service;
use Jdcloud\CommandInterface;
use GuzzleHttp\Psr7\Request;
use Psr\Http\Message\RequestInterface;
/**
* Serializes a query protocol request.
* @internal
*/
class QuerySerializer
{
private $endpoint;
private $api;
private $paramBuilder;
public function __construct(
Service $api,
$endpoint,
callable $paramBuilder = null
) {
$this->api = $api;
$this->endpoint = $endpoint;
$this->paramBuilder = $paramBuilder ?: new QueryParamBuilder();
}
/**
* When invoked with an Jdcloud command, returns a serialization array
* containing "method", "uri", "headers", and "body" key value pairs.
*
* @param CommandInterface $command
*
* @return RequestInterface
*/
public function __invoke(CommandInterface $command)
{
$operation = $this->api->getOperation($command->getName());
$body = [
'Action' => $command->getName(),
'Version' => $this->api->getMetadata('apiVersion')
];
$params = $command->toArray();
// Only build up the parameters when there are parameters to build
if ($params) {
$body += call_user_func(
$this->paramBuilder,
$operation->getInput(),
$params
);
}
$body = http_build_query($body, null, '&', PHP_QUERY_RFC3986);
return new Request(
'POST',
$this->endpoint,
[
'Content-Length' => strlen($body),
'Content-Type' => 'application/x-www-form-urlencoded'
],
$body
);
}
}

View File

@@ -0,0 +1,39 @@
<?php
namespace Jdcloud\Api\Serializer;
use Jdcloud\Api\Service;
use Jdcloud\Api\StructureShape;
/**
* Serializes requests for the REST-JSON protocol.
* @internal
*/
class RestJsonSerializer extends RestSerializer
{
/** @var JsonBody */
private $jsonFormatter;
/** @var string */
private $contentType;
/**
* @param Service $api Service API description
* @param string $endpoint Endpoint to connect to
* @param JsonBody $jsonFormatter Optional JSON formatter to use
*/
public function __construct(
Service $api,
$endpoint,
JsonBody $jsonFormatter = null
) {
parent::__construct($api, $endpoint);
$this->contentType = JsonBody::getContentType($api);
$this->jsonFormatter = $jsonFormatter ?: new JsonBody($api);
}
protected function payload(StructureShape $member, array $value, array &$opts)
{
$opts['headers']['Content-Type'] = $this->contentType;
$opts['body'] = (string) $this->jsonFormatter->build($member, $value);
}
}

View File

@@ -0,0 +1,211 @@
<?php
namespace Jdcloud\Api\Serializer;
use Jdcloud\Api\MapShape;
use Jdcloud\Api\Service;
use Jdcloud\Api\Operation;
use Jdcloud\Api\Shape;
use Jdcloud\Api\StructureShape;
use Jdcloud\Api\TimestampShape;
use Jdcloud\CommandInterface;
use GuzzleHttp\Psr7;
use GuzzleHttp\Psr7\Uri;
use GuzzleHttp\Psr7\UriResolver;
use Psr\Http\Message\RequestInterface;
/**
* Serializes HTTP locations like header, uri, payload, etc...
* @internal
*/
abstract class RestSerializer
{
/** @var Service */
private $api;
/** @var Psr7\Uri */
private $endpoint;
/**
* @param Service $api Service API description
* @param string $endpoint Endpoint to connect to
*/
public function __construct(Service $api, $endpoint)
{
$this->api = $api;
$this->endpoint = Psr7\uri_for($endpoint);
}
/**
* @param CommandInterface $command Command to serialized
*
* @return RequestInterface
*/
public function __invoke(CommandInterface $command)
{
$operation = $this->api->getOperation($command->getName());
$args = $command->toArray();
$opts = $this->serialize($operation, $args);
$uri = $this->buildEndpoint($operation, $args, $opts);
return new Psr7\Request(
$operation['http']['method'],
$uri,
isset($opts['headers']) ? $opts['headers'] : [],
isset($opts['body']) ? $opts['body'] : null
);
}
/**
* Modifies a hash of request options for a payload body.
*
* @param StructureShape $member Member to serialize
* @param array $value Value to serialize
* @param array $opts Request options to modify.
*/
abstract protected function payload(
StructureShape $member,
array $value,
array &$opts
);
private function serialize(Operation $operation, array $args)
{
$opts = [];
$input = $operation->getInput();
// Apply the payload trait if present
if ($payload = $input['payload']) {
$this->applyPayload($input, $payload, $args, $opts);
}
foreach ($args as $name => $value) {
if ($input->hasMember($name)) {
$member = $input->getMember($name);
$location = $member['location'];
if (!$payload && !$location) {
$bodyMembers[$name] = $value;
} elseif ($location == 'header') {
$this->applyHeader($name, $member, $value, $opts);
} elseif ($location == 'querystring') {
$this->applyQuery($name, $member, $value, $opts);
} elseif ($location == 'headers') {
$this->applyHeaderMap($name, $member, $value, $opts);
}
}
}
if (isset($bodyMembers)) {
$this->payload($operation->getInput(), $bodyMembers, $opts);
}
return $opts;
}
private function applyPayload(StructureShape $input, $name, array $args, array &$opts)
{
if (!isset($args[$name])) {
return;
}
$m = $input->getMember($name);
if ($m['streaming'] ||
($m['type'] == 'string' || $m['type'] == 'blob')
) {
// Streaming bodies or payloads that are strings are
// always just a stream of data.
$opts['body'] = Psr7\stream_for($args[$name]);
return;
}
$this->payload($m, $args[$name], $opts);
}
private function applyHeader($name, Shape $member, $value, array &$opts)
{
if ($member->getType() == 'timestamp') {
$value = TimestampShape::format($value, 'rfc822');
}
if ($member['jsonvalue']) {
$value = json_encode($value);
if (empty($value) && JSON_ERROR_NONE !== json_last_error()) {
throw new \InvalidArgumentException('Unable to encode the provided value'
. ' with \'json_encode\'. ' . json_last_error_msg());
}
$value = base64_encode($value);
}
$opts['headers'][$member['locationName'] ?: $name] = $value;
}
/**
* Note: This is currently only present in the Amazon S3 model.
*/
private function applyHeaderMap($name, Shape $member, array $value, array &$opts)
{
$prefix = $member['locationName'];
foreach ($value as $k => $v) {
$opts['headers'][$prefix . $k] = $v;
}
}
private function applyQuery($name, Shape $member, $value, array &$opts)
{
if ($member instanceof MapShape) {
$opts['query'] = isset($opts['query']) && is_array($opts['query'])
? $opts['query'] + $value
: $value;
} elseif ($value !== null) {
if ($member->getType() === 'boolean') {
$value = $value ? 'true' : 'false';
}
$opts['query'][$member['locationName'] ?: $name] = $value;
}
}
private function buildEndpoint(Operation $operation, array $args, array $opts)
{
$varspecs = [];
// Create an associative array of varspecs used in expansions
foreach ($operation->getInput()->getMembers() as $name => $member) {
if ($member['location'] == 'uri') {
$varspecs[$member['locationName'] ?: $name] =
isset($args[$name])
? $args[$name]
: null;
}
}
$relative = preg_replace_callback(
'/\{([^\}]+)\}/',
function (array $matches) use ($varspecs) {
$isGreedy = substr($matches[1], -1, 1) == '+';
$k = $isGreedy ? substr($matches[1], 0, -1) : $matches[1];
if (!isset($varspecs[$k])) {
return '';
}
if ($isGreedy) {
return str_replace('%2F', '/', rawurlencode($varspecs[$k]));
}
return rawurlencode($varspecs[$k]);
},
$operation['http']['requestUri']
);
// Add the query string variables or appending to one if needed.
if (!empty($opts['query'])) {
$append = Psr7\build_query($opts['query']);
$relative .= strpos($relative, '?') ? "&{$append}" : "?$append";
}
// Expand path place holders using Amazon's slightly different URI
// template syntax.
return UriResolver::resolve($this->endpoint, new Uri($relative));
}
}

View File

@@ -0,0 +1,34 @@
<?php
namespace Jdcloud\Api\Serializer;
use Jdcloud\Api\StructureShape;
use Jdcloud\Api\Service;
/**
* @internal
*/
class RestXmlSerializer extends RestSerializer
{
/** @var XmlBody */
private $xmlBody;
/**
* @param Service $api Service API description
* @param string $endpoint Endpoint to connect to
* @param XmlBody $xmlBody Optional XML formatter to use
*/
public function __construct(
Service $api,
$endpoint,
XmlBody $xmlBody = null
) {
parent::__construct($api, $endpoint);
$this->xmlBody = $xmlBody ?: new XmlBody($api);
}
protected function payload(StructureShape $member, array $value, array &$opts)
{
$opts['headers']['Content-Type'] = 'application/xml';
$opts['body'] = (string) $this->xmlBody->build($member, $value);
}
}

View File

@@ -0,0 +1,217 @@
<?php
namespace Jdcloud\Api\Serializer;
use Jdcloud\Api\MapShape;
use Jdcloud\Api\Service;
use Jdcloud\Api\Shape;
use Jdcloud\Api\StructureShape;
use Jdcloud\Api\ListShape;
use Jdcloud\Api\TimestampShape;
use XMLWriter;
/**
* @internal Formats the XML body of a REST-XML services.
*/
class XmlBody
{
/** @var \Jdcloud\Api\Service */
private $api;
/**
* @param Service $api API being used to create the XML body.
*/
public function __construct(Service $api)
{
$this->api = $api;
}
/**
* Builds the XML body based on an array of arguments.
*
* @param Shape $shape Operation being constructed
* @param array $args Associative array of arguments
*
* @return string
*/
public function build(Shape $shape, array $args)
{
$xml = new XMLWriter();
$xml->openMemory();
$xml->startDocument('1.0', 'UTF-8');
$this->format($shape, $shape['locationName'] ?: $shape['name'], $args, $xml);
$xml->endDocument();
return $xml->outputMemory();
}
private function startElement(Shape $shape, $name, XMLWriter $xml)
{
$xml->startElement($name);
if ($ns = $shape['xmlNamespace']) {
$xml->writeAttribute(
isset($ns['prefix']) ? "xmlns:{$ns['prefix']}" : 'xmlns',
$shape['xmlNamespace']['uri']
);
}
}
private function format(Shape $shape, $name, $value, XMLWriter $xml)
{
// Any method mentioned here has a custom serialization handler.
static $methods = [
'add_structure' => true,
'add_list' => true,
'add_blob' => true,
'add_timestamp' => true,
'add_boolean' => true,
'add_map' => true,
'add_string' => true
];
$type = 'add_' . $shape['type'];
if (isset($methods[$type])) {
$this->{$type}($shape, $name, $value, $xml);
} else {
$this->defaultShape($shape, $name, $value, $xml);
}
}
private function defaultShape(Shape $shape, $name, $value, XMLWriter $xml)
{
$this->startElement($shape, $name, $xml);
$xml->writeRaw($value);
$xml->endElement();
}
private function add_structure(
StructureShape $shape,
$name,
array $value,
\XMLWriter $xml
) {
$this->startElement($shape, $name, $xml);
foreach ($this->getStructureMembers($shape, $value) as $k => $definition) {
$this->format(
$definition['member'],
$definition['member']['locationName'] ?: $k,
$definition['value'],
$xml
);
}
$xml->endElement();
}
private function getStructureMembers(StructureShape $shape, array $value)
{
$members = [];
foreach ($value as $k => $v) {
if ($v !== null && $shape->hasMember($k)) {
$definition = [
'member' => $shape->getMember($k),
'value' => $v,
];
if ($definition['member']['xmlAttribute']) {
// array_unshift_associative
$members = [$k => $definition] + $members;
} else {
$members[$k] = $definition;
}
}
}
return $members;
}
private function add_list(
ListShape $shape,
$name,
array $value,
XMLWriter $xml
) {
$items = $shape->getMember();
if ($shape['flattened']) {
$elementName = $name;
} else {
$this->startElement($shape, $name, $xml);
$elementName = $items['locationName'] ?: 'member';
}
foreach ($value as $v) {
$this->format($items, $elementName, $v, $xml);
}
if (!$shape['flattened']) {
$xml->endElement();
}
}
private function add_map(
MapShape $shape,
$name,
array $value,
XMLWriter $xml
) {
$xmlEntry = $shape['flattened'] ? $shape['locationName'] : 'entry';
$xmlKey = $shape->getKey()['locationName'] ?: 'key';
$xmlValue = $shape->getValue()['locationName'] ?: 'value';
$this->startElement($shape, $name, $xml);
foreach ($value as $key => $v) {
$this->startElement($shape, $xmlEntry, $xml);
$this->format($shape->getKey(), $xmlKey, $key, $xml);
$this->format($shape->getValue(), $xmlValue, $v, $xml);
$xml->endElement();
}
$xml->endElement();
}
private function add_blob(Shape $shape, $name, $value, XMLWriter $xml)
{
$this->startElement($shape, $name, $xml);
$xml->writeRaw(base64_encode($value));
$xml->endElement();
}
private function add_timestamp(
TimestampShape $shape,
$name,
$value,
XMLWriter $xml
) {
$this->startElement($shape, $name, $xml);
$xml->writeRaw(TimestampShape::format($value, 'iso8601'));
$xml->endElement();
}
private function add_boolean(
Shape $shape,
$name,
$value,
XMLWriter $xml
) {
$this->startElement($shape, $name, $xml);
$xml->writeRaw($value ? 'true' : 'false');
$xml->endElement();
}
private function add_string(
Shape $shape,
$name,
$value,
XMLWriter $xml
) {
if ($shape['xmlAttribute']) {
$xml->writeAttribute($shape['locationName'] ?: $name, $value);
} else {
$this->defaultShape($shape, $name, $value, $xml);
}
}
}

View File

@@ -0,0 +1,432 @@
<?php
namespace Jdcloud\Api;
use Jdcloud\Api\Serializer\QuerySerializer;
use Jdcloud\Api\Serializer\Ec2ParamBuilder;
use Jdcloud\Api\Parser\QueryParser;
/**
* Represents a web service API model.
*/
class Service extends AbstractModel
{
/** @var callable */
private $apiProvider;
/** @var string */
private $serviceName;
/** @var string */
private $apiVersion;
/** @var Operation[] */
private $operations = [];
/** @var array */
private $paginators = null;
/** @var array */
private $waiters = null;
/**
* @param array $definition
* @param callable $provider
*
* @internal param array $definition Service description
*/
public function __construct(array $definition, callable $provider)
{
static $defaults = [
'operations' => [],
'shapes' => [],
'metadata' => []
], $defaultMeta = [
'apiVersion' => null,
'serviceFullName' => null,
'endpointPrefix' => null,
'signingName' => null,
'signatureVersion' => null,
'protocol' => null,
'uid' => null
];
$definition += $defaults;
$definition['metadata'] += $defaultMeta;
$this->definition = $definition;
$this->apiProvider = $provider;
parent::__construct($definition, new ShapeMap($definition['shapes']));
if (isset($definition['metadata']['serviceIdentifier'])) {
$this->serviceName = $this->getServiceName();
} else {
$this->serviceName = $this->getEndpointPrefix();
}
$this->apiVersion = $this->getApiVersion();
}
/**
* Creates a request serializer for the provided API object.
*
* @param Service $api API that contains a protocol.
* @param string $endpoint Endpoint to send requests to.
*
* @return callable
* @throws \UnexpectedValueException
*/
public static function createSerializer(Service $api, $endpoint)
{
static $mapping = [
'json' => 'Jdcloud\Api\Serializer\JsonRpcSerializer',
'query' => 'Jdcloud\Api\Serializer\QuerySerializer',
'rest-json' => 'Jdcloud\Api\Serializer\RestJsonSerializer',
'rest-xml' => 'Jdcloud\Api\Serializer\RestXmlSerializer'
];
$proto = $api->getProtocol();
if (isset($mapping[$proto])) {
return new $mapping[$proto]($api, $endpoint);
}
if ($proto == 'ec2') {
return new QuerySerializer($api, $endpoint, new Ec2ParamBuilder());
}
throw new \UnexpectedValueException(
'Unknown protocol: ' . $api->getProtocol()
);
}
/**
* Creates an error parser for the given protocol.
*
* @param string $protocol Protocol to parse (e.g., query, json, etc.)
*
* @return callable
* @throws \UnexpectedValueException
*/
public static function createErrorParser($protocol)
{
static $mapping = [
'json' => 'Jdcloud\Api\ErrorParser\JsonRpcErrorParser',
'query' => 'Jdcloud\Api\ErrorParser\XmlErrorParser',
'rest-json' => 'Jdcloud\Api\ErrorParser\RestJsonErrorParser',
'rest-xml' => 'Jdcloud\Api\ErrorParser\XmlErrorParser'
];
if (isset($mapping[$protocol])) {
return new $mapping[$protocol]();
}
throw new \UnexpectedValueException("Unknown protocol: $protocol");
}
/**
* Applies the listeners needed to parse client models.
*
* @param Service $api API to create a parser for
* @return callable
* @throws \UnexpectedValueException
*/
public static function createParser(Service $api)
{
static $mapping = [
'json' => 'Jdcloud\Api\Parser\JsonRpcParser',
'query' => 'Jdcloud\Api\Parser\QueryParser',
'rest-json' => 'Jdcloud\Api\Parser\RestJsonParser',
'rest-xml' => 'Jdcloud\Api\Parser\RestXmlParser'
];
$proto = $api->getProtocol();
if (isset($mapping[$proto])) {
return new $mapping[$proto]($api);
}
throw new \UnexpectedValueException(
'Unknown protocol: ' . $api->getProtocol()
);
}
/**
* Get the full name of the service
*
* @return string
*/
public function getServiceFullName()
{
return $this->definition['metadata']['serviceFullName'];
}
/**
* Get the API version of the service
*
* @return string
*/
public function getApiVersion()
{
return $this->definition['metadata']['apiVersion'];
}
/**
* Get the API version of the service
*
* @return string
*/
public function getEndpointPrefix()
{
return $this->definition['metadata']['endpointPrefix'];
}
/**
* Get the signing name used by the service.
*
* @return string
*/
public function getSigningName()
{
return $this->definition['metadata']['signingName']
?: $this->definition['metadata']['endpointPrefix'];
}
/**
* Get the service name.
*
* @return string
*/
public function getServiceName()
{
return $this->definition['metadata']['serviceIdentifier'];
}
/**
* Get the default signature version of the service.
*
* Note: this method assumes "v4" when not specified in the model.
*
* @return string
*/
public function getSignatureVersion()
{
return $this->definition['metadata']['signatureVersion'] ?: 'v4';
}
/**
* Get the protocol used by the service.
*
* @return string
*/
public function getProtocol()
{
return $this->definition['metadata']['protocol'];
}
/**
* Get the uid string used by the service
*
* @return string
*/
public function getUid()
{
return $this->definition['metadata']['uid'];
}
/**
* Check if the description has a specific operation by name.
*
* @param string $name Operation to check by name
*
* @return bool
*/
public function hasOperation($name)
{
return isset($this['operations'][$name]);
}
/**
* Get an operation by name.
*
* @param string $name Operation to retrieve by name
*
* @return Operation
* @throws \InvalidArgumentException If the operation is not found
*/
public function getOperation($name)
{
if (!isset($this->operations[$name])) {
if (!isset($this->definition['operations'][$name])) {
throw new \InvalidArgumentException("Unknown operation: $name");
}
$this->operations[$name] = new Operation(
$this->definition['operations'][$name],
$this->shapeMap
);
}
return $this->operations[$name];
}
/**
* Get all of the operations of the description.
*
* @return Operation[]
*/
public function getOperations()
{
$result = [];
foreach ($this->definition['operations'] as $name => $definition) {
$result[$name] = $this->getOperation($name);
}
return $result;
}
/**
* Get all of the service metadata or a specific metadata key value.
*
* @param string|null $key Key to retrieve or null to retrieve all metadata
*
* @return mixed Returns the result or null if the key is not found
*/
public function getMetadata($key = null)
{
if (!$key) {
return $this['metadata'];
}
if (isset($this->definition['metadata'][$key])) {
return $this->definition['metadata'][$key];
}
return null;
}
/**
* Gets an associative array of available paginator configurations where
* the key is the name of the paginator, and the value is the paginator
* configuration.
*
* @return array
* @unstable The configuration format of paginators may change in the future
*/
public function getPaginators()
{
if (!isset($this->paginators)) {
$res = call_user_func(
$this->apiProvider,
'paginator',
$this->serviceName,
$this->apiVersion
);
$this->paginators = isset($res['pagination'])
? $res['pagination']
: [];
}
return $this->paginators;
}
/**
* Determines if the service has a paginator by name.
*
* @param string $name Name of the paginator.
*
* @return bool
*/
public function hasPaginator($name)
{
return isset($this->getPaginators()[$name]);
}
/**
* Retrieve a paginator by name.
*
* @param string $name Paginator to retrieve by name. This argument is
* typically the operation name.
* @return array
* @throws \UnexpectedValueException if the paginator does not exist.
* @unstable The configuration format of paginators may change in the future
*/
public function getPaginatorConfig($name)
{
static $defaults = [
'input_token' => null,
'output_token' => null,
'limit_key' => null,
'result_key' => null,
'more_results' => null,
];
if ($this->hasPaginator($name)) {
return $this->paginators[$name] + $defaults;
}
throw new \UnexpectedValueException("There is no {$name} "
. "paginator defined for the {$this->serviceName} service.");
}
/**
* Gets an associative array of available waiter configurations where the
* key is the name of the waiter, and the value is the waiter
* configuration.
*
* @return array
*/
public function getWaiters()
{
if (!isset($this->waiters)) {
$res = call_user_func(
$this->apiProvider,
'waiter',
$this->serviceName,
$this->apiVersion
);
$this->waiters = isset($res['waiters'])
? $res['waiters']
: [];
}
return $this->waiters;
}
/**
* Determines if the service has a waiter by name.
*
* @param string $name Name of the waiter.
*
* @return bool
*/
public function hasWaiter($name)
{
return isset($this->getWaiters()[$name]);
}
/**
* Get a waiter configuration by name.
*
* @param string $name Name of the waiter by name.
*
* @return array
* @throws \UnexpectedValueException if the waiter does not exist.
*/
public function getWaiterConfig($name)
{
// Error if the waiter is not defined
if ($this->hasWaiter($name)) {
return $this->waiters[$name];
}
throw new \UnexpectedValueException("There is no {$name} waiter "
. "defined for the {$this->serviceName} service.");
}
/**
* Get the shape map used by the API.
*
* @return ShapeMap
*/
public function getShapeMap()
{
return $this->shapeMap;
}
}

View File

@@ -0,0 +1,70 @@
<?php
namespace Jdcloud\Api;
/**
* Base class representing a modeled shape.
*/
class Shape extends AbstractModel
{
/**
* Get a concrete shape for the given definition.
*
* @param array $definition
* @param ShapeMap $shapeMap
*
* @return mixed
* @throws \RuntimeException if the type is invalid
*/
public static function create(array $definition, ShapeMap $shapeMap)
{
static $map = [
'structure' => 'Jdcloud\Api\StructureShape',
'map' => 'Jdcloud\Api\MapShape',
'list' => 'Jdcloud\Api\ListShape',
'timestamp' => 'Jdcloud\Api\TimestampShape',
'integer' => 'Jdcloud\Api\Shape',
'double' => 'Jdcloud\Api\Shape',
'float' => 'Jdcloud\Api\Shape',
'long' => 'Jdcloud\Api\Shape',
'string' => 'Jdcloud\Api\Shape',
'object' => 'Jdcloud\Api\Shape',
'byte' => 'Jdcloud\Api\Shape',
'character' => 'Jdcloud\Api\Shape',
'blob' => 'Jdcloud\Api\Shape',
'boolean' => 'Jdcloud\Api\Shape'
];
if (isset($definition['shape'])) {
return $shapeMap->resolve($definition);
}
if (!isset($map[$definition['type']])) {
throw new \RuntimeException('Invalid type: '
. print_r($definition, true));
}
$type = $map[$definition['type']];
return new $type($definition, $shapeMap);
}
/**
* Get the type of the shape
*
* @return string
*/
public function getType()
{
return $this->definition['type'];
}
/**
* Get the name of the shape
*
* @return string
*/
public function getName()
{
return $this->definition['name'];
}
}

View File

@@ -0,0 +1,66 @@
<?php
namespace Jdcloud\Api;
/**
* Builds shape based on shape references.
*/
class ShapeMap
{
/** @var array */
private $definitions;
/** @var Shape[] */
private $simple;
/**
* @param array $shapeModels Associative array of shape definitions.
*/
public function __construct(array $shapeModels)
{
$this->definitions = $shapeModels;
}
/**
* Get an array of shape names.
*
* @return array
*/
public function getShapeNames()
{
return array_keys($this->definitions);
}
/**
* Resolve a shape reference
*
* @param array $shapeRef Shape reference shape
*
* @return Shape
* @throws \InvalidArgumentException
*/
public function resolve(array $shapeRef)
{
$shape = $shapeRef['shape'];
if (!isset($this->definitions[$shape])) {
throw new \InvalidArgumentException('Shape not found: ' . $shape);
}
$isSimple = count($shapeRef) == 1;
if ($isSimple && isset($this->simple[$shape])) {
return $this->simple[$shape];
}
$definition = $shapeRef + $this->definitions[$shape];
$definition['name'] = $definition['shape'];
unset($definition['shape']);
$result = Shape::create($definition, $this);
if ($isSimple) {
$this->simple[$shape] = $result;
}
return $result;
}
}

View File

@@ -0,0 +1,79 @@
<?php
namespace Jdcloud\Api;
/**
* Represents a structure shape and resolve member shape references.
*/
class StructureShape extends Shape
{
/**
* @var Shape[]
*/
private $members;
public function __construct(array $definition, ShapeMap $shapeMap)
{
$definition['type'] = 'structure';
if (!isset($definition['members'])) {
$definition['members'] = [];
}
parent::__construct($definition, $shapeMap);
}
/**
* Gets a list of all members
*
* @return Shape[]
*/
public function getMembers()
{
if (empty($this->members)) {
$this->generateMembersHash();
}
return $this->members;
}
/**
* Check if a specific member exists by name.
*
* @param string $name Name of the member to check
*
* @return bool
*/
public function hasMember($name)
{
return isset($this->definition['members'][$name]);
}
/**
* Retrieve a member by name.
*
* @param string $name Name of the member to retrieve
*
* @return Shape
* @throws \InvalidArgumentException if the member is not found.
*/
public function getMember($name)
{
$members = $this->getMembers();
if (!isset($members[$name])) {
throw new \InvalidArgumentException('Unknown member ' . $name);
}
return $members[$name];
}
private function generateMembersHash()
{
$this->members = [];
foreach ($this->definition['members'] as $name => $definition) {
$this->members[$name] = $this->shapeFor($definition);
}
}
}

View File

@@ -0,0 +1,48 @@
<?php
namespace Jdcloud\Api;
/**
* Represents a timestamp shape.
*/
class TimestampShape extends Shape
{
public function __construct(array $definition, ShapeMap $shapeMap)
{
$definition['type'] = 'timestamp';
parent::__construct($definition, $shapeMap);
}
/**
* Formats a timestamp value for a service.
*
* @param mixed $value Value to format
* @param string $format Format used to serialize the value
*
* @return int|string
* @throws \UnexpectedValueException if the format is unknown.
* @throws \InvalidArgumentException if the value is an unsupported type.
*/
public static function format($value, $format)
{
if ($value instanceof \DateTime) {
$value = $value->getTimestamp();
} elseif (is_string($value)) {
$value = strtotime($value);
} elseif (!is_int($value)) {
throw new \InvalidArgumentException('Unable to handle the provided'
. ' timestamp type: ' . gettype($value));
}
switch ($format) {
case 'iso8601':
return gmdate('Y-m-d\TH:i:s\Z', $value);
case 'rfc822':
return gmdate('D, d M Y H:i:s \G\M\T', $value);
case 'unixTimestamp':
return $value;
default:
throw new \UnexpectedValueException('Unknown timestamp format: '
. $format);
}
}
}

View File

@@ -0,0 +1,273 @@
<?php
namespace Jdcloud\Api;
use Jdcloud;
/**
* Validates a schema against a hash of input.
*/
class Validator
{
private $path = [];
private $errors = [];
private $constraints = [];
private static $defaultConstraints = [
'required' => true,
'min' => true,
'max' => false,
'pattern' => false
];
/**
* @param array $constraints Associative array of constraints to enforce.
* Accepts the following keys: "required", "min",
* "max", and "pattern". If a key is not
* provided, the constraint will assume false.
*/
public function __construct(array $constraints = null)
{
static $assumedFalseValues = [
'required' => false,
'min' => false,
'max' => false,
'pattern' => false
];
$this->constraints = empty($constraints)
? self::$defaultConstraints
: $constraints + $assumedFalseValues;
}
/**
* Validates the given input against the schema.
*
* @param string $name Operation name
* @param Shape $shape Shape to validate
* @param array $input Input to validate
*
* @throws \InvalidArgumentException if the input is invalid.
*/
public function validate($name, Shape $shape, array $input)
{
$this->dispatch($shape, $input);
if ($this->errors) {
$message = sprintf(
"Found %d error%s while validating the input provided for the "
. "%s operation:\n%s",
count($this->errors),
count($this->errors) > 1 ? 's' : '',
$name,
implode("\n", $this->errors)
);
$this->errors = [];
throw new \InvalidArgumentException($message);
}
}
private function dispatch(Shape $shape, $value)
{
static $methods = [
'structure' => 'check_structure',
'list' => 'check_list',
'map' => 'check_map',
'blob' => 'check_blob',
'boolean' => 'check_boolean',
'integer' => 'check_numeric',
'float' => 'check_numeric',
'long' => 'check_numeric',
'string' => 'check_string',
'byte' => 'check_string',
'char' => 'check_string'
];
$type = $shape->getType();
if (isset($methods[$type])) {
$this->{$methods[$type]}($shape, $value);
}
}
private function check_structure(StructureShape $shape, $value)
{
if (!$this->checkAssociativeArray($value)) {
return;
}
if ($this->constraints['required'] && $shape['required']) {
foreach ($shape['required'] as $req) {
if (!isset($value[$req])) {
$this->path[] = $req;
$this->addError('is missing and is a required parameter');
array_pop($this->path);
}
}
}
foreach ($value as $name => $v) {
if ($shape->hasMember($name)) {
$this->path[] = $name;
$this->dispatch(
$shape->getMember($name),
isset($value[$name]) ? $value[$name] : null
);
array_pop($this->path);
}
}
}
private function check_list(ListShape $shape, $value)
{
if (!is_array($value)) {
$this->addError('must be an array. Found '
. Jdcloud\describe_type($value));
return;
}
$this->validateRange($shape, count($value), "list element count");
$items = $shape->getMember();
foreach ($value as $index => $v) {
$this->path[] = $index;
$this->dispatch($items, $v);
array_pop($this->path);
}
}
private function check_map(MapShape $shape, $value)
{
if (!$this->checkAssociativeArray($value)) {
return;
}
$values = $shape->getValue();
foreach ($value as $key => $v) {
$this->path[] = $key;
$this->dispatch($values, $v);
array_pop($this->path);
}
}
private function check_blob(Shape $shape, $value)
{
static $valid = [
'string' => true,
'integer' => true,
'double' => true,
'resource' => true
];
$type = gettype($value);
if (!isset($valid[$type])) {
if ($type != 'object' || !method_exists($value, '__toString')) {
$this->addError('must be an fopen resource, a '
. 'GuzzleHttp\Stream\StreamInterface object, or something '
. 'that can be cast to a string. Found '
. Jdcloud\describe_type($value));
}
}
}
private function check_numeric(Shape $shape, $value)
{
if (!is_numeric($value)) {
$this->addError('must be numeric. Found '
. Jdcloud\describe_type($value));
return;
}
$this->validateRange($shape, $value, "numeric value");
}
private function check_boolean(Shape $shape, $value)
{
if (!is_bool($value)) {
$this->addError('must be a boolean. Found '
. Jdcloud\describe_type($value));
}
}
private function check_string(Shape $shape, $value)
{
if ($shape['jsonvalue']) {
if (!self::canJsonEncode($value)) {
$this->addError('must be a value encodable with \'json_encode\'.'
. ' Found ' . Jdcloud\describe_type($value));
}
return;
}
if (!$this->checkCanString($value)) {
$this->addError('must be a string or an object that implements '
. '__toString(). Found ' . Jdcloud\describe_type($value));
return;
}
$this->validateRange($shape, strlen($value), "string length");
if ($this->constraints['pattern']) {
$pattern = $shape['pattern'];
if ($pattern && !preg_match("/$pattern/", $value)) {
$this->addError("Pattern /$pattern/ failed to match '$value'");
}
}
}
private function validateRange(Shape $shape, $length, $descriptor)
{
if ($this->constraints['min']) {
$min = $shape['min'];
if ($min && $length < $min) {
$this->addError("expected $descriptor to be >= $min, but "
. "found $descriptor of $length");
}
}
if ($this->constraints['max']) {
$max = $shape['max'];
if ($max && $length > $max) {
$this->addError("expected $descriptor to be <= $max, but "
. "found $descriptor of $length");
}
}
}
private function checkCanString($value)
{
static $valid = [
'string' => true,
'integer' => true,
'double' => true,
'NULL' => true,
];
$type = gettype($value);
return isset($valid[$type]) ||
($type == 'object' && method_exists($value, '__toString'));
}
private function checkAssociativeArray($value)
{
if (!is_array($value) || isset($value[0])) {
$this->addError('must be an associative array. Found '
. Jdcloud\describe_type($value));
return false;
}
return true;
}
private function addError($message)
{
$this->errors[] =
implode('', array_map(function ($s) { return "[{$s}]"; }, $this->path))
. ' '
. $message;
}
private function canJsonEncode($data)
{
return !is_resource($data);
}
}

View File

@@ -0,0 +1,196 @@
<?php
/**
* Apigateway
*
* @category Jdcloud
* @package Jdcloud\Apigateway
* @author Jdcloud <jdcloud-api@jd.com>
* @license Apache-2.0 http://www.apache.org/licenses/LICENSE-2.0
* @link https://www.jdcloud.com/help/faq
*/
namespace Jdcloud\Apigateway;
use Jdcloud\JdCloudClient;
use Jdcloud\Api\Service;
use Jdcloud\Api\DocModel;
use Jdcloud\Api\ApiProvider;
use Jdcloud\PresignUrlMiddleware;
/**
* Client used to interact with apigateway.
*
* @method \Jdcloud\Result queryAccessAuths(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryAccessAuthsAsync(array $args = [])
* @method \Jdcloud\Result createAccessAuth(array $args = [])
* @method \GuzzleHttp\Promise\Promise createAccessAuthAsync(array $args = [])
* @method \Jdcloud\Result checkAuthExist(array $args = [])
* @method \GuzzleHttp\Promise\Promise checkAuthExistAsync(array $args = [])
* @method \Jdcloud\Result queryAccessAuth(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryAccessAuthAsync(array $args = [])
* @method \Jdcloud\Result updateAccessAuth(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateAccessAuthAsync(array $args = [])
* @method \Jdcloud\Result deleteAccessAuth(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteAccessAuthAsync(array $args = [])
* @method \Jdcloud\Result queryBindGroupAuth(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryBindGroupAuthAsync(array $args = [])
* @method \Jdcloud\Result bindGroupAuth(array $args = [])
* @method \GuzzleHttp\Promise\Promise bindGroupAuthAsync(array $args = [])
* @method \Jdcloud\Result queryAuthGroupList(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryAuthGroupListAsync(array $args = [])
* @method \Jdcloud\Result authorizedApiGroupList(array $args = [])
* @method \GuzzleHttp\Promise\Promise authorizedApiGroupListAsync(array $args = [])
* @method \Jdcloud\Result queryAccessKeys(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryAccessKeysAsync(array $args = [])
* @method \Jdcloud\Result createAccessKey(array $args = [])
* @method \GuzzleHttp\Promise\Promise createAccessKeyAsync(array $args = [])
* @method \Jdcloud\Result checkKeyExist(array $args = [])
* @method \GuzzleHttp\Promise\Promise checkKeyExistAsync(array $args = [])
* @method \Jdcloud\Result queryAccessKey(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryAccessKeyAsync(array $args = [])
* @method \Jdcloud\Result updateAccessKey(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateAccessKeyAsync(array $args = [])
* @method \Jdcloud\Result deleteAccessKey(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteAccessKeyAsync(array $args = [])
* @method \Jdcloud\Result queryBindGroupKey(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryBindGroupKeyAsync(array $args = [])
* @method \Jdcloud\Result bindGroupKey(array $args = [])
* @method \GuzzleHttp\Promise\Promise bindGroupKeyAsync(array $args = [])
* @method \Jdcloud\Result queryKeyGroupList(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryKeyGroupListAsync(array $args = [])
* @method \Jdcloud\Result queryApis(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryApisAsync(array $args = [])
* @method \Jdcloud\Result createApis(array $args = [])
* @method \GuzzleHttp\Promise\Promise createApisAsync(array $args = [])
* @method \Jdcloud\Result checkApiNameExist(array $args = [])
* @method \GuzzleHttp\Promise\Promise checkApiNameExistAsync(array $args = [])
* @method \Jdcloud\Result queryApi(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryApiAsync(array $args = [])
* @method \Jdcloud\Result updateApi(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateApiAsync(array $args = [])
* @method \Jdcloud\Result deleteApi(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteApiAsync(array $args = [])
* @method \Jdcloud\Result updateApiByName(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateApiByNameAsync(array $args = [])
* @method \Jdcloud\Result deleteApiByName(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteApiByNameAsync(array $args = [])
* @method \Jdcloud\Result describeApiGroups(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeApiGroupsAsync(array $args = [])
* @method \Jdcloud\Result createApiGroup(array $args = [])
* @method \GuzzleHttp\Promise\Promise createApiGroupAsync(array $args = [])
* @method \Jdcloud\Result checkGroupNameExist(array $args = [])
* @method \GuzzleHttp\Promise\Promise checkGroupNameExistAsync(array $args = [])
* @method \Jdcloud\Result describeApiGroup(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeApiGroupAsync(array $args = [])
* @method \Jdcloud\Result modifyApiGroupAttribute(array $args = [])
* @method \GuzzleHttp\Promise\Promise modifyApiGroupAttributeAsync(array $args = [])
* @method \Jdcloud\Result deleteApiGroup(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteApiGroupAsync(array $args = [])
* @method \Jdcloud\Result describeIsDeployApiGroups(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeIsDeployApiGroupsAsync(array $args = [])
* @method \Jdcloud\Result createBackendConfig(array $args = [])
* @method \GuzzleHttp\Promise\Promise createBackendConfigAsync(array $args = [])
* @method \Jdcloud\Result describeBackendConfigs(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeBackendConfigsAsync(array $args = [])
* @method \Jdcloud\Result describeBackendConfig(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeBackendConfigAsync(array $args = [])
* @method \Jdcloud\Result updateBackendConfig(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateBackendConfigAsync(array $args = [])
* @method \Jdcloud\Result deleteBackendConfig(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteBackendConfigAsync(array $args = [])
* @method \Jdcloud\Result describeDeployments(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeDeploymentsAsync(array $args = [])
* @method \Jdcloud\Result deploy(array $args = [])
* @method \GuzzleHttp\Promise\Promise deployAsync(array $args = [])
* @method \Jdcloud\Result describeDeployment(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeDeploymentAsync(array $args = [])
* @method \Jdcloud\Result offline(array $args = [])
* @method \GuzzleHttp\Promise\Promise offlineAsync(array $args = [])
* @method \Jdcloud\Result batchOffline(array $args = [])
* @method \GuzzleHttp\Promise\Promise batchOfflineAsync(array $args = [])
* @method \Jdcloud\Result queryKeys(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryKeysAsync(array $args = [])
* @method \Jdcloud\Result createKey(array $args = [])
* @method \GuzzleHttp\Promise\Promise createKeyAsync(array $args = [])
* @method \Jdcloud\Result resetKey(array $args = [])
* @method \GuzzleHttp\Promise\Promise resetKeyAsync(array $args = [])
* @method \Jdcloud\Result updateKey(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateKeyAsync(array $args = [])
* @method \Jdcloud\Result queryKeyInfo(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryKeyInfoAsync(array $args = [])
* @method \Jdcloud\Result queryRateLimitPolicies(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryRateLimitPoliciesAsync(array $args = [])
* @method \Jdcloud\Result createRateLimitPolicy(array $args = [])
* @method \GuzzleHttp\Promise\Promise createRateLimitPolicyAsync(array $args = [])
* @method \Jdcloud\Result checkPolicyName(array $args = [])
* @method \GuzzleHttp\Promise\Promise checkPolicyNameAsync(array $args = [])
* @method \Jdcloud\Result queryRateLimitPolicy(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryRateLimitPolicyAsync(array $args = [])
* @method \Jdcloud\Result updateRateLimitPolicy(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateRateLimitPolicyAsync(array $args = [])
* @method \Jdcloud\Result deleteRateLimitPolicy(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteRateLimitPolicyAsync(array $args = [])
* @method \Jdcloud\Result queryBindGroupPolicy(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryBindGroupPolicyAsync(array $args = [])
* @method \Jdcloud\Result bindGroupPolicy(array $args = [])
* @method \GuzzleHttp\Promise\Promise bindGroupPolicyAsync(array $args = [])
* @method \Jdcloud\Result queryPolicyGroupList(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryPolicyGroupListAsync(array $args = [])
* @method \Jdcloud\Result describeRevisions(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeRevisionsAsync(array $args = [])
* @method \Jdcloud\Result createRevision(array $args = [])
* @method \GuzzleHttp\Promise\Promise createRevisionAsync(array $args = [])
* @method \Jdcloud\Result getRevisionIds(array $args = [])
* @method \GuzzleHttp\Promise\Promise getRevisionIdsAsync(array $args = [])
* @method \Jdcloud\Result checkRevisionExist(array $args = [])
* @method \GuzzleHttp\Promise\Promise checkRevisionExistAsync(array $args = [])
* @method \Jdcloud\Result queryRevision(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryRevisionAsync(array $args = [])
* @method \Jdcloud\Result modifyRevision(array $args = [])
* @method \GuzzleHttp\Promise\Promise modifyRevisionAsync(array $args = [])
* @method \Jdcloud\Result deleteRevision(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteRevisionAsync(array $args = [])
* @method \Jdcloud\Result querySubscriptionKeys(array $args = [])
* @method \GuzzleHttp\Promise\Promise querySubscriptionKeysAsync(array $args = [])
* @method \Jdcloud\Result createSubscriptionKey(array $args = [])
* @method \GuzzleHttp\Promise\Promise createSubscriptionKeyAsync(array $args = [])
* @method \Jdcloud\Result querySubscriptionKey(array $args = [])
* @method \GuzzleHttp\Promise\Promise querySubscriptionKeyAsync(array $args = [])
* @method \Jdcloud\Result updateSubscriptionKey(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateSubscriptionKeyAsync(array $args = [])
* @method \Jdcloud\Result deleteSubscriptionKey(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteSubscriptionKeyAsync(array $args = [])
* @method \Jdcloud\Result queryUcAccessKeys(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryUcAccessKeysAsync(array $args = [])
* @method \Jdcloud\Result checkPin(array $args = [])
* @method \GuzzleHttp\Promise\Promise checkPinAsync(array $args = [])
* @method \Jdcloud\Result queryUserDomains(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryUserDomainsAsync(array $args = [])
* @method \Jdcloud\Result createUserDomain(array $args = [])
* @method \GuzzleHttp\Promise\Promise createUserDomainAsync(array $args = [])
* @method \Jdcloud\Result deleteUserDomain(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteUserDomainAsync(array $args = [])
*/
class ApigatewayClient extends JdCloudClient
{
public function __construct(array $args)
{
$args['with_resolved'] = function (array $args) {
$this->getHandlerList()->appendInit(
PresignUrlMiddleware::wrap(
$this,
$args['endpoint_provider'],
[
'operations' => [
],
'service' => 'apigateway',
'presign_param' => 'PresignedUrl',
]
),
'apigateway'
);
};
parent::__construct($args);
}
}

View File

@@ -0,0 +1,21 @@
# 更新历史 #
API版本1.0.1
|发布时间|版本号|更新|说明|
|---|---|---|---|
|2019-11-26|1.0.1|将接口对外发布|
|2019-08-05|0.11.0|增加计费支持|
|2019-06-17|0.10.0|增加微服务后端支持|
|2019-05-22|0.9.0|增加查询删除列表及删除恢复接口|
|2019-05-06|0.8.1|修改不符合openapi规范的接口|
|2019-04-12|0.8.0|添加function查询所有绑定API接口|* describeApisByFunctionId|
|2019-03-18|0.7.0|添加虎符专用查询接口|* 添加订阅密钥,虎符专用查询接口|
|2018-10-30|0.5.1|优化部分接口|* 优化部分接口|
|2018-10-30|0.5.1|API分组支持鉴权方式配置|* 涉及API分组的创建、查询、修改接口|
|2018-10-30|0.5.0|后端接入function|* 增加function绑定接口<br>* 增加function查询接口|
|2018-08-15|0.4.0|部署相关优化|* 绑定接口统一改为绑定部署<br>* 查询SDK和文档下载增加根据部署ID查询|
|2018-07-17|0.3.1|appKey鉴权查询|* 增加appid鉴权的查询接口|
|2018-07-17|0.3.0|appKey鉴权方式|* 增加appid鉴权的相关服务|
|2018-07-17|0.2.0|修订与部署|* 增加部署相关服务<br>* 增加修订列表相关服务<br>* 修改api分组接口|
|2018-07-10|0.1.0|API后端配置|* 增加API后端服务配置<br>* 支持path参数|
|2018-04-31|0.0.1|初始版本|* API及分组定义基础接口|

View File

@@ -0,0 +1,50 @@
<?php
/**
* Asset
*
* @category Jdcloud
* @package Jdcloud\Asset
* @author Jdcloud <jdcloud-api@jd.com>
* @license Apache-2.0 http://www.apache.org/licenses/LICENSE-2.0
* @link https://www.jdcloud.com/help/faq
*/
namespace Jdcloud\Asset;
use Jdcloud\JdCloudClient;
use Jdcloud\Api\Service;
use Jdcloud\Api\DocModel;
use Jdcloud\Api\ApiProvider;
use Jdcloud\PresignUrlMiddleware;
/**
* Client used to interact with asset.
*
* @method \Jdcloud\Result describeAccountAmount(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeAccountAmountAsync(array $args = [])
* @method \Jdcloud\Result modifyBalanceWarningInfo(array $args = [])
* @method \GuzzleHttp\Promise\Promise modifyBalanceWarningInfoAsync(array $args = [])
*/
class AssetClient extends JdCloudClient
{
public function __construct(array $args)
{
$args['with_resolved'] = function (array $args) {
$this->getHandlerList()->appendInit(
PresignUrlMiddleware::wrap(
$this,
$args['endpoint_provider'],
[
'operations' => [
],
'service' => 'asset',
'presign_param' => 'PresignedUrl',
]
),
'asset'
);
};
parent::__construct($args);
}
}

View File

@@ -0,0 +1,9 @@
# 更新历史 #
API版本0.0.2
| 发布时间 | 版本号 | 更新 | 说明 |
| ---------- | ------ | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 2020-07-10 | 0.0.3 | 修改网关地址 | host修改为asset.jdcloud-api.com | |
| 2020-07-07 | 0.0.2 | 完善返回字段描述信息 | 开放查询余额openAPI接口完善返回字段描述信息 | |
| 2019-04-30 | 0.0.1 | 接口新增与更新 |初始版本,提供控制台以下功能接口:<br>1、控制台查询余额、充值状态、余额预警信息<br>2、消费/充值/提现列表<br>3、设置余额预警开关/金额<br>4、充值、提现 | |

View File

@@ -0,0 +1,58 @@
<?php
/**
* Assistant
*
* @category Jdcloud
* @package Jdcloud\Assistant
* @author Jdcloud <jdcloud-api@jd.com>
* @license Apache-2.0 http://www.apache.org/licenses/LICENSE-2.0
* @link https://www.jdcloud.com/help/faq
*/
namespace Jdcloud\Assistant;
use Jdcloud\JdCloudClient;
use Jdcloud\Api\Service;
use Jdcloud\Api\DocModel;
use Jdcloud\Api\ApiProvider;
use Jdcloud\PresignUrlMiddleware;
/**
* Client used to interact with assistant.
*
* @method \Jdcloud\Result createCommand(array $args = [])
* @method \GuzzleHttp\Promise\Promise createCommandAsync(array $args = [])
* @method \Jdcloud\Result describeCommands(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeCommandsAsync(array $args = [])
* @method \Jdcloud\Result deleteCommands(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteCommandsAsync(array $args = [])
* @method \Jdcloud\Result invokeCommand(array $args = [])
* @method \GuzzleHttp\Promise\Promise invokeCommandAsync(array $args = [])
* @method \Jdcloud\Result describeInvocations(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeInvocationsAsync(array $args = [])
* @method \Jdcloud\Result addLogConfig(array $args = [])
* @method \GuzzleHttp\Promise\Promise addLogConfigAsync(array $args = [])
*/
class AssistantClient extends JdCloudClient
{
public function __construct(array $args)
{
$args['with_resolved'] = function (array $args) {
$this->getHandlerList()->appendInit(
PresignUrlMiddleware::wrap(
$this,
$args['endpoint_provider'],
[
'operations' => [
],
'service' => 'assistant',
'presign_param' => 'PresignedUrl',
]
),
'assistant'
);
};
parent::__construct($args);
}
}

View File

@@ -0,0 +1,7 @@
# 更新历史 #
API版本1.0.1
| 发布时间 | 版本号 | 更新 | 说明 |
|------------|-------|--------|----------------------------------------------------------------------------------------------------------------|
| 2024-03-27 | 1.0.1 | 支持定时任务 | 保存命令、执行命令、停止命令和查询执行结果等。 |
| 2023-04-03 | 1.0.0 | 增加接口 | 保存命令、执行命令、停止命令和查询执行结果等。 |

View File

@@ -0,0 +1,66 @@
<?php
/**
* Autotaskpolicy
*
* @category Jdcloud
* @package Jdcloud\Autotaskpolicy
* @author Jdcloud <jdcloud-api@jd.com>
* @license Apache-2.0 http://www.apache.org/licenses/LICENSE-2.0
* @link https://www.jdcloud.com/help/faq
*/
namespace Jdcloud\Autotaskpolicy;
use Jdcloud\JdCloudClient;
use Jdcloud\Api\Service;
use Jdcloud\Api\DocModel;
use Jdcloud\Api\ApiProvider;
use Jdcloud\PresignUrlMiddleware;
/**
* Client used to interact with autotaskpolicy.
*
* @method \Jdcloud\Result createPolicy(array $args = [])
* @method \GuzzleHttp\Promise\Promise createPolicyAsync(array $args = [])
* @method \Jdcloud\Result modifyPolicy(array $args = [])
* @method \GuzzleHttp\Promise\Promise modifyPolicyAsync(array $args = [])
* @method \Jdcloud\Result describePolicy(array $args = [])
* @method \GuzzleHttp\Promise\Promise describePolicyAsync(array $args = [])
* @method \Jdcloud\Result deletePolicy(array $args = [])
* @method \GuzzleHttp\Promise\Promise deletePolicyAsync(array $args = [])
* @method \Jdcloud\Result describePolicies(array $args = [])
* @method \GuzzleHttp\Promise\Promise describePoliciesAsync(array $args = [])
* @method \Jdcloud\Result copyPolicy(array $args = [])
* @method \GuzzleHttp\Promise\Promise copyPolicyAsync(array $args = [])
* @method \Jdcloud\Result enablePolicy(array $args = [])
* @method \GuzzleHttp\Promise\Promise enablePolicyAsync(array $args = [])
* @method \Jdcloud\Result disablePolicy(array $args = [])
* @method \GuzzleHttp\Promise\Promise disablePolicyAsync(array $args = [])
* @method \Jdcloud\Result associateExecResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise associateExecResourceAsync(array $args = [])
* @method \Jdcloud\Result disassociateExecResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise disassociateExecResourceAsync(array $args = [])
*/
class AutotaskpolicyClient extends JdCloudClient
{
public function __construct(array $args)
{
$args['with_resolved'] = function (array $args) {
$this->getHandlerList()->appendInit(
PresignUrlMiddleware::wrap(
$this,
$args['endpoint_provider'],
[
'operations' => [
],
'service' => 'autotaskpolicy',
'presign_param' => 'PresignedUrl',
]
),
'autotaskpolicy'
);
};
parent::__construct($args);
}
}

View File

@@ -0,0 +1,6 @@
# 更新历史 #
API版本1.0.1
| 发布时间 |版本号| 更新 | 说明 |
|------------|---|-----|--------------|
| 2023-01-09 | 1.0.1 | 发布 | * 发布自动任务策略接口 |

View File

@@ -0,0 +1,78 @@
<?php
/**
* Baseanti
*
* @category Jdcloud
* @package Jdcloud\Baseanti
* @author Jdcloud <jdcloud-api@jd.com>
* @license Apache-2.0 http://www.apache.org/licenses/LICENSE-2.0
* @link https://www.jdcloud.com/help/faq
*/
namespace Jdcloud\Baseanti;
use Jdcloud\JdCloudClient;
use Jdcloud\Api\Service;
use Jdcloud\Api\DocModel;
use Jdcloud\Api\ApiProvider;
use Jdcloud\PresignUrlMiddleware;
/**
* Client used to interact with baseanti.
*
* @method \Jdcloud\Result describeAttackLogs(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeAttackLogsAsync(array $args = [])
* @method \Jdcloud\Result describeAttackStatistics(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeAttackStatisticsAsync(array $args = [])
* @method \Jdcloud\Result describeAttackTypeCount(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeAttackTypeCountAsync(array $args = [])
* @method \Jdcloud\Result describeIpMonitorFlow(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeIpMonitorFlowAsync(array $args = [])
* @method \Jdcloud\Result describeIpResources(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeIpResourcesAsync(array $args = [])
* @method \Jdcloud\Result describeElasticIpResources(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeElasticIpResourcesAsync(array $args = [])
* @method \Jdcloud\Result describeCpsIpResources(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeCpsIpResourcesAsync(array $args = [])
* @method \Jdcloud\Result describeCcsIpResources(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeCcsIpResourcesAsync(array $args = [])
* @method \Jdcloud\Result describeWafIpResources(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeWafIpResourcesAsync(array $args = [])
* @method \Jdcloud\Result describeIpResourceInfo(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeIpResourceInfoAsync(array $args = [])
* @method \Jdcloud\Result describeIpSafetyInfo(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeIpSafetyInfoAsync(array $args = [])
* @method \Jdcloud\Result setCleanThreshold(array $args = [])
* @method \GuzzleHttp\Promise\Promise setCleanThresholdAsync(array $args = [])
* @method \Jdcloud\Result setIpCleanThreshold(array $args = [])
* @method \GuzzleHttp\Promise\Promise setIpCleanThresholdAsync(array $args = [])
* @method \Jdcloud\Result describeIpCleanThresholdRange(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeIpCleanThresholdRangeAsync(array $args = [])
* @method \Jdcloud\Result describeIpResourceProtectInfo(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeIpResourceProtectInfoAsync(array $args = [])
* @method \Jdcloud\Result describeIpResourceFlow(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeIpResourceFlowAsync(array $args = [])
*/
class BaseantiClient extends JdCloudClient
{
public function __construct(array $args)
{
$args['with_resolved'] = function (array $args) {
$this->getHandlerList()->appendInit(
PresignUrlMiddleware::wrap(
$this,
$args['endpoint_provider'],
[
'operations' => [
],
'service' => 'baseanti',
'presign_param' => 'PresignedUrl',
]
),
'baseanti'
);
};
parent::__construct($args);
}
}

View File

@@ -0,0 +1,11 @@
# 更新历史 #
API版本1.3.0
|发布时间|版本号|更新|说明|
|---|---|---|---|
|2022-01-14|1.3.0|接口新增与更新|1. 新增接口 describeWafIpResources 查询已防护的Web应用防火墙公网IP|
|2020-04-17|1.2.3|接口修复|1. 修复 describeAttackStatistics 接口返回字段类型错误|
|2019-07-26|1.2.0|新增接口|1. 新增接口查询基础防护已防护的托管区公网 IP 安全信息|
|2019-05-25|1.1.0|新增接口|1. 查询区域下的公网 IP 资源列表接口(describeIpResources)增加返回字段<br>2. 增加查询弹性公网 IP, 查询云物理机公网 IP 接口<br>3. 增加攻击记录查询接口, 攻击记录统计接口, 各类型攻击次数查询接口<br>4. 增加查询多个公网 IP 流量接口<br>5. 增加查询公网IP安全信息接口(支持ipv6)<br>6. 增加公网 IP 清洗阈值查询与修改接口(支持ipv6)|
|2018-08-21|1.0.1|接口优化|1. 查询区域下的公网 IP 资源列表接口(describeIpResources)增加云物理机公网 IP 的查询, 同时增加 IP 模糊查询的功能|
|2018-05-25|1.0.0|初始版本|1. 基础防护基本操作接口|

View File

@@ -0,0 +1,2 @@
2018-05-25 version: 1.0.0
1. 初始版本

View File

@@ -0,0 +1,72 @@
<?php
/**
* Bastion
*
* @category Jdcloud
* @package Jdcloud\Bastion
* @author Jdcloud <jdcloud-api@jd.com>
* @license Apache-2.0 http://www.apache.org/licenses/LICENSE-2.0
* @link https://www.jdcloud.com/help/faq
*/
namespace Jdcloud\Bastion;
use Jdcloud\JdCloudClient;
use Jdcloud\Api\Service;
use Jdcloud\Api\DocModel;
use Jdcloud\Api\ApiProvider;
use Jdcloud\PresignUrlMiddleware;
/**
* Client used to interact with bastion.
*
* @method \Jdcloud\Result describeBastions(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeBastionsAsync(array $args = [])
* @method \Jdcloud\Result describeBastion(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeBastionAsync(array $args = [])
* @method \Jdcloud\Result updateBastionDesc(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateBastionDescAsync(array $args = [])
* @method \Jdcloud\Result describeSign(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeSignAsync(array $args = [])
* @method \Jdcloud\Result describeInstance(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeInstanceAsync(array $args = [])
* @method \Jdcloud\Result deleteInstance(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteInstanceAsync(array $args = [])
* @method \Jdcloud\Result setInstanceZeroEnable(array $args = [])
* @method \GuzzleHttp\Promise\Promise setInstanceZeroEnableAsync(array $args = [])
* @method \Jdcloud\Result setInstancePublicAccess(array $args = [])
* @method \GuzzleHttp\Promise\Promise setInstancePublicAccessAsync(array $args = [])
* @method \Jdcloud\Result createInstance(array $args = [])
* @method \GuzzleHttp\Promise\Promise createInstanceAsync(array $args = [])
* @method \Jdcloud\Result modifyInstanceSpec(array $args = [])
* @method \GuzzleHttp\Promise\Promise modifyInstanceSpecAsync(array $args = [])
* @method \Jdcloud\Result modifyInstanceExpireOrStart(array $args = [])
* @method \GuzzleHttp\Promise\Promise modifyInstanceExpireOrStartAsync(array $args = [])
* @method \Jdcloud\Result describeSourceId(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeSourceIdAsync(array $args = [])
* @method \Jdcloud\Result describePins(array $args = [])
* @method \GuzzleHttp\Promise\Promise describePinsAsync(array $args = [])
*/
class BastionClient extends JdCloudClient
{
public function __construct(array $args)
{
$args['with_resolved'] = function (array $args) {
$this->getHandlerList()->appendInit(
PresignUrlMiddleware::wrap(
$this,
$args['endpoint_provider'],
[
'operations' => [
],
'service' => 'bastion',
'presign_param' => 'PresignedUrl',
]
),
'bastion'
);
};
parent::__construct($args);
}
}

View File

@@ -0,0 +1,50 @@
<?php
/**
* Bgw
*
* @category Jdcloud
* @package Jdcloud\Bgw
* @author Jdcloud <jdcloud-api@jd.com>
* @license Apache-2.0 http://www.apache.org/licenses/LICENSE-2.0
* @link https://www.jdcloud.com/help/faq
*/
namespace Jdcloud\Bgw;
use Jdcloud\JdCloudClient;
use Jdcloud\Api\Service;
use Jdcloud\Api\DocModel;
use Jdcloud\Api\ApiProvider;
use Jdcloud\PresignUrlMiddleware;
/**
* Client used to interact with bgw.
*
* @method \Jdcloud\Result modifyAdminStatus(array $args = [])
* @method \GuzzleHttp\Promise\Promise modifyAdminStatusAsync(array $args = [])
* @method \Jdcloud\Result describeConnections(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeConnectionsAsync(array $args = [])
*/
class BgwClient extends JdCloudClient
{
public function __construct(array $args)
{
$args['with_resolved'] = function (array $args) {
$this->getHandlerList()->appendInit(
PresignUrlMiddleware::wrap(
$this,
$args['endpoint_provider'],
[
'operations' => [
],
'service' => 'bgw',
'presign_param' => 'PresignedUrl',
]
),
'bgw'
);
};
parent::__construct($args);
}
}

View File

@@ -0,0 +1,10 @@
# 更新历史 #
API版本1.3.1
|发布时间|版本号|更新|说明|
|---|---|---|---|
|2022-11-30|1.3.1|增加新参数|* 修改vif创建接口和更新接口支持healthcheck|
|2020-03-10|1.3.0|增加新街口|* 修改createConnection接口上行参数添加locationPortSpecId、locationISPId字段<br>* 修改describeConnections和describeConnection接口返回locationPortSpec和locationISP信息<br>* 增加describeLocationPortSpecs和describeLocationPortSpec接口查询locationPortSpec信息<br>* 增加describeLocationISPs和describeLocationISP接口返回locationISP信息<br>* 修改modifyConnection接口,添加新计费项,端口占用费和流量使用费|
|2019-09-20|1.2.0|增加新接口|* 增加createVpnConnection<br>* 增加describeVpnConnections<br>* 增加describeVpnConnection<br>* 增加modifyVpnConnection<br>* 增加deleteVpnConnection<br>* 增加createVpnTunnel<br>* 增加describeVpnTunnels<br>* 增加describeVpnTunnel<br>* 增加modifyVpnTunnel<br>* 增加deleteVpnTunnel<br>* 增加修改VPN隧道管理状态modifyAdminStatus<br>* 增加createCustomerGateway<br>* 增加describeCustomerGateways<br>* 增加describeCustomerGateway<br>* 增加modifyCustomerGateway<br>* 增加deleteCustomerGateway|
|2019-08-17|1.1.0|增加新接口|* 增加CreateVpcAttachment<br>* 增加DeleteVpcAttachment<br>* 增加DescribeVpcAttachment和DescribeVpcAttachments接口<br>* 增加ModifyVpcAttachment<br>* 修改DescribeBgws和DescribeBgw接口返回 Bgw上vpc接口Id列表<br>* 修改CreateBgwRoutes接口增加、修改bgwRouteType、origin、description等信息<br>* 修改ModifyBgwRoutes接口增加、修改bgwRouteType、description等信息<br>* 修改DescribeBgwRoutes接口传播路由只展示优选路由增加查询过滤条件返回静态、动态、未生效路由数及新增routes属性等<br>* 查询和修改配额接口支持vpcAttachment、bgwRouter(传播)|
|2018-11-26|1.0.0|增加新接口|* 增加边界网关的创建、修改、删除、查询列表、查询详情接口<br>* 增加边界网关路由的创建、修改、删除、查询列表接口<br>* 增加私有虚拟连接的创建、修改、删除、查询列表、查询详情接口<br>* 增加连接的创建、修改、删除、查询列表、查询详情接口<br>* 增加合作伙伴查询连接资源列表接口<br>* 增加合作伙伴修改连接状态接口<br>* 增加查询Location列表、详情接口<br>* 增加查询合作伙伴列表、详情接口<br>* 增加查询配额接口|

View File

@@ -0,0 +1,58 @@
<?php
/**
* Billing
*
* @category Jdcloud
* @package Jdcloud\Billing
* @author Jdcloud <jdcloud-api@jd.com>
* @license Apache-2.0 http://www.apache.org/licenses/LICENSE-2.0
* @link https://www.jdcloud.com/help/faq
*/
namespace Jdcloud\Billing;
use Jdcloud\JdCloudClient;
use Jdcloud\Api\Service;
use Jdcloud\Api\DocModel;
use Jdcloud\Api\ApiProvider;
use Jdcloud\PresignUrlMiddleware;
/**
* Client used to interact with billing.
*
* @method \Jdcloud\Result queryBillSummary(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryBillSummaryAsync(array $args = [])
* @method \Jdcloud\Result queryBillDetail(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryBillDetailAsync(array $args = [])
* @method \Jdcloud\Result describeBillSummarys(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeBillSummarysAsync(array $args = [])
* @method \Jdcloud\Result describeBillDetails(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeBillDetailsAsync(array $args = [])
* @method \Jdcloud\Result describeFormulaSummaryList(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeFormulaSummaryListAsync(array $args = [])
* @method \Jdcloud\Result calculateTotalPrice(array $args = [])
* @method \GuzzleHttp\Promise\Promise calculateTotalPriceAsync(array $args = [])
*/
class BillingClient extends JdCloudClient
{
public function __construct(array $args)
{
$args['with_resolved'] = function (array $args) {
$this->getHandlerList()->appendInit(
PresignUrlMiddleware::wrap(
$this,
$args['endpoint_provider'],
[
'operations' => [
],
'service' => 'billing',
'presign_param' => 'PresignedUrl',
]
),
'billing'
);
};
parent::__construct($args);
}
}

View File

@@ -0,0 +1,87 @@
2022-11-21 version 1.1.4
1.对外接口返回增加可用区字段
2022-08-18 version 1.1.3
1.增加计费项月汇总账单对外接口
2022-04-26 version: 1.1.1
1.增加资源加入/移出回收站接口
2021-11-08 version: 1.0.34
1.解决go SDK返回值类型转换问题
2021-07-12 version: 1.0.33
1.更新官网计费文档,涉及查询账单资源汇总、明细接口
2020-11-10 version: 1.0.28
1.新增客户账单汇总接口
2020-06-16 version: 1.0.24
1.更新接口文档参数说明
2020-06-03 version: 1.0.23
1.更新接口文档参数说明
2020-05-19 version: 1.0.20
1. 控制台资源账单、消费明细相关接口增加资源id字段
2020-04-14 version: 1.0.18
1. 控制台查询新增返回原价、优惠金额列
2020-03-25 version: 1.0.15
1. billStatisticsInfo增加查询条件queryTimeRangeType
2020-02-20 version: 1.0.14
1. 新增计费规则相关接口
2019-12-12 version: 1.0.13
1. 增加集团安全部门查询资源单列表接口
2019-12-02 version: 1.0.12
1. 修改帐单接口参数含义
2019-12-02 version: 1.0.11
1. EBS接收分摊表返回值修改
2019-11-08 version: 1.0.10
1. 新增查询欠费接口
2019-08-14 version: 1.0.9
1. 控制台查询接口增加tag条件
2019-07-11 version: 1.0.8
1. 新增财务核算接口
2019-07-11 version: 1.0.7
1. 开放查价接口上线
2019-07-04 version: 1.0.6
1. 账单详情-新增账单时间参数
2019-05-10 version: 1.0.5
1. 临时升配-查价接口变更
2019-03-29 version: 1.0.4
1. 新增查询资源单状态列表API
2019-03-04 version: 1.0.3
1. 新增查询账单资源汇总数据API
2. 新增查询账单明细数据API
2018-10-10 version: 1.0.1
1. 新增消费管理导出API
2018-09-20 version: 1.0.0
1. 修改service Title&description
2. 修改价格计算sdk 对外
2018-09-20 version: 0.4.0
1. 计费项支持number
2018-04-09 version: 0.3.0
1. 完善titledescription
2018-03-31 version: 0.2.0
1. 待补充
2018-01-31 version: 0.1.0
1. 初始版本

View File

@@ -0,0 +1,54 @@
<?php
/**
* Bri
*
* @category Jdcloud
* @package Jdcloud\Bri
* @author Jdcloud <jdcloud-api@jd.com>
* @license Apache-2.0 http://www.apache.org/licenses/LICENSE-2.0
* @link https://www.jdcloud.com/help/faq
*/
namespace Jdcloud\Bri;
use Jdcloud\JdCloudClient;
use Jdcloud\Api\Service;
use Jdcloud\Api\DocModel;
use Jdcloud\Api\ApiProvider;
use Jdcloud\PresignUrlMiddleware;
/**
* Client used to interact with bri.
*
* @method \Jdcloud\Result describeBWList(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeBWListAsync(array $args = [])
* @method \Jdcloud\Result setBWList(array $args = [])
* @method \GuzzleHttp\Promise\Promise setBWListAsync(array $args = [])
* @method \Jdcloud\Result delBWList(array $args = [])
* @method \GuzzleHttp\Promise\Promise delBWListAsync(array $args = [])
* @method \Jdcloud\Result creditScore(array $args = [])
* @method \GuzzleHttp\Promise\Promise creditScoreAsync(array $args = [])
*/
class BriClient extends JdCloudClient
{
public function __construct(array $args)
{
$args['with_resolved'] = function (array $args) {
$this->getHandlerList()->appendInit(
PresignUrlMiddleware::wrap(
$this,
$args['endpoint_provider'],
[
'operations' => [
],
'service' => 'bri',
'presign_param' => 'PresignedUrl',
]
),
'bri'
);
};
parent::__construct($args);
}
}

View File

@@ -0,0 +1,7 @@
# 更新历史 #
API版本1.1.0
|发布时间|版本号|更新|说明|
|---|---|---|---|
|2020-07-20|1.0.0|初始版本|* API及分组定义基础接口|
|2021-03-25|1.1.0|更新版本|* API新增返回数据|

View File

@@ -0,0 +1,50 @@
<?php
/**
* Captcha
*
* @category Jdcloud
* @package Jdcloud\Captcha
* @author Jdcloud <jdcloud-api@jd.com>
* @license Apache-2.0 http://www.apache.org/licenses/LICENSE-2.0
* @link https://www.jdcloud.com/help/faq
*/
namespace Jdcloud\Captcha;
use Jdcloud\JdCloudClient;
use Jdcloud\Api\Service;
use Jdcloud\Api\DocModel;
use Jdcloud\Api\ApiProvider;
use Jdcloud\PresignUrlMiddleware;
/**
* Client used to interact with captcha.
*
* @method \Jdcloud\Result getSessionId(array $args = [])
* @method \GuzzleHttp\Promise\Promise getSessionIdAsync(array $args = [])
* @method \Jdcloud\Result verifyToken(array $args = [])
* @method \GuzzleHttp\Promise\Promise verifyTokenAsync(array $args = [])
*/
class CaptchaClient extends JdCloudClient
{
public function __construct(array $args)
{
$args['with_resolved'] = function (array $args) {
$this->getHandlerList()->appendInit(
PresignUrlMiddleware::wrap(
$this,
$args['endpoint_provider'],
[
'operations' => [
],
'service' => 'captcha',
'presign_param' => 'PresignedUrl',
]
),
'captcha'
);
};
parent::__construct($args);
}
}

View File

@@ -0,0 +1,7 @@
# 更新历史 #
API版本1.0.1
|发布时间|版本号|更新|说明|
|---|---|---|---|
|2021-07-06|1.0.1|更新VerifyToken接口||
|2020-11-20|1.0.0|初始版本||

View File

@@ -0,0 +1,450 @@
<?php
/**
* Cdn
*
* @category Jdcloud
* @package Jdcloud\Cdn
* @author Jdcloud <jdcloud-api@jd.com>
* @license Apache-2.0 http://www.apache.org/licenses/LICENSE-2.0
* @link https://www.jdcloud.com/help/faq
*/
namespace Jdcloud\Cdn;
use Jdcloud\JdCloudClient;
use Jdcloud\Api\Service;
use Jdcloud\Api\DocModel;
use Jdcloud\Api\ApiProvider;
use Jdcloud\PresignUrlMiddleware;
/**
* Client used to interact with cdn.
*
* @method \Jdcloud\Result queryDomainsLog(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryDomainsLogAsync(array $args = [])
* @method \Jdcloud\Result queryDomainsLogForJd(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryDomainsLogForJdAsync(array $args = [])
* @method \Jdcloud\Result queryDomainLog(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryDomainLogAsync(array $args = [])
* @method \Jdcloud\Result queryOnlineBillingType(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryOnlineBillingTypeAsync(array $args = [])
* @method \Jdcloud\Result setOnlineBillingType(array $args = [])
* @method \GuzzleHttp\Promise\Promise setOnlineBillingTypeAsync(array $args = [])
* @method \Jdcloud\Result setAuthConfig(array $args = [])
* @method \GuzzleHttp\Promise\Promise setAuthConfigAsync(array $args = [])
* @method \Jdcloud\Result setSourceAuthConfig(array $args = [])
* @method \GuzzleHttp\Promise\Promise setSourceAuthConfigAsync(array $args = [])
* @method \Jdcloud\Result queryBand(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryBandAsync(array $args = [])
* @method \Jdcloud\Result queryBandWithArea(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryBandWithAreaAsync(array $args = [])
* @method \Jdcloud\Result queryDomainConfigStatus(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryDomainConfigStatusAsync(array $args = [])
* @method \Jdcloud\Result queryAreaIspList(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryAreaIspListAsync(array $args = [])
* @method \Jdcloud\Result queryAreaIspListV2(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryAreaIspListV2Async(array $args = [])
* @method \Jdcloud\Result queryForbiddenInfoList(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryForbiddenInfoListAsync(array $args = [])
* @method \Jdcloud\Result createForbiddenInfo(array $args = [])
* @method \GuzzleHttp\Promise\Promise createForbiddenInfoAsync(array $args = [])
* @method \Jdcloud\Result deleteForbiddenInfo(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteForbiddenInfoAsync(array $args = [])
* @method \Jdcloud\Result queryUnForbiddenStatus(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryUnForbiddenStatusAsync(array $args = [])
* @method \Jdcloud\Result queryForbiddenInfoListCommon(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryForbiddenInfoListCommonAsync(array $args = [])
* @method \Jdcloud\Result createForbiddenInfoCommon(array $args = [])
* @method \GuzzleHttp\Promise\Promise createForbiddenInfoCommonAsync(array $args = [])
* @method \Jdcloud\Result deleteForbiddenInfoCommon(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteForbiddenInfoCommonAsync(array $args = [])
* @method \Jdcloud\Result previewCertificate(array $args = [])
* @method \GuzzleHttp\Promise\Promise previewCertificateAsync(array $args = [])
* @method \Jdcloud\Result queryDefaultHttpHeaderKey(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryDefaultHttpHeaderKeyAsync(array $args = [])
* @method \Jdcloud\Result queryIpBlackList(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryIpBlackListAsync(array $args = [])
* @method \Jdcloud\Result setIpBlackList(array $args = [])
* @method \GuzzleHttp\Promise\Promise setIpBlackListAsync(array $args = [])
* @method \Jdcloud\Result operateIpBlackList(array $args = [])
* @method \GuzzleHttp\Promise\Promise operateIpBlackListAsync(array $args = [])
* @method \Jdcloud\Result queryCustomErrorPage(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryCustomErrorPageAsync(array $args = [])
* @method \Jdcloud\Result setCustomErrorPage(array $args = [])
* @method \GuzzleHttp\Promise\Promise setCustomErrorPageAsync(array $args = [])
* @method \Jdcloud\Result createCacheRule(array $args = [])
* @method \GuzzleHttp\Promise\Promise createCacheRuleAsync(array $args = [])
* @method \Jdcloud\Result updateCacheRule(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateCacheRuleAsync(array $args = [])
* @method \Jdcloud\Result deleteCacheRule(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteCacheRuleAsync(array $args = [])
* @method \Jdcloud\Result setCacheRules(array $args = [])
* @method \GuzzleHttp\Promise\Promise setCacheRulesAsync(array $args = [])
* @method \Jdcloud\Result queryHttpHeader(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryHttpHeaderAsync(array $args = [])
* @method \Jdcloud\Result setHttpHeader(array $args = [])
* @method \GuzzleHttp\Promise\Promise setHttpHeaderAsync(array $args = [])
* @method \Jdcloud\Result deleteHttpHeader(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteHttpHeaderAsync(array $args = [])
* @method \Jdcloud\Result setVideoDraft(array $args = [])
* @method \GuzzleHttp\Promise\Promise setVideoDraftAsync(array $args = [])
* @method \Jdcloud\Result setRange(array $args = [])
* @method \GuzzleHttp\Promise\Promise setRangeAsync(array $args = [])
* @method \Jdcloud\Result setIgnoreQueryString(array $args = [])
* @method \GuzzleHttp\Promise\Promise setIgnoreQueryStringAsync(array $args = [])
* @method \Jdcloud\Result setFilterArgs(array $args = [])
* @method \GuzzleHttp\Promise\Promise setFilterArgsAsync(array $args = [])
* @method \Jdcloud\Result queryFilterArgs(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryFilterArgsAsync(array $args = [])
* @method \Jdcloud\Result queryUserAgent(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryUserAgentAsync(array $args = [])
* @method \Jdcloud\Result setUserAgentConfig(array $args = [])
* @method \GuzzleHttp\Promise\Promise setUserAgentConfigAsync(array $args = [])
* @method \Jdcloud\Result queryAccesskeyConfig(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryAccesskeyConfigAsync(array $args = [])
* @method \Jdcloud\Result setAccesskeyConfig(array $args = [])
* @method \GuzzleHttp\Promise\Promise setAccesskeyConfigAsync(array $args = [])
* @method \Jdcloud\Result setRefer(array $args = [])
* @method \GuzzleHttp\Promise\Promise setReferAsync(array $args = [])
* @method \Jdcloud\Result queryMonitor(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryMonitorAsync(array $args = [])
* @method \Jdcloud\Result setMonitor(array $args = [])
* @method \GuzzleHttp\Promise\Promise setMonitorAsync(array $args = [])
* @method \Jdcloud\Result stopMonitor(array $args = [])
* @method \GuzzleHttp\Promise\Promise stopMonitorAsync(array $args = [])
* @method \Jdcloud\Result setSource(array $args = [])
* @method \GuzzleHttp\Promise\Promise setSourceAsync(array $args = [])
* @method \Jdcloud\Result operateShareCache(array $args = [])
* @method \GuzzleHttp\Promise\Promise operateShareCacheAsync(array $args = [])
* @method \Jdcloud\Result setHttpType(array $args = [])
* @method \GuzzleHttp\Promise\Promise setHttpTypeAsync(array $args = [])
* @method \Jdcloud\Result queryFollowRedirect(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryFollowRedirectAsync(array $args = [])
* @method \Jdcloud\Result setFollowRedirect(array $args = [])
* @method \GuzzleHttp\Promise\Promise setFollowRedirectAsync(array $args = [])
* @method \Jdcloud\Result queryFollowSourceProtocol(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryFollowSourceProtocolAsync(array $args = [])
* @method \Jdcloud\Result setFollowSourceProtocol(array $args = [])
* @method \GuzzleHttp\Promise\Promise setFollowSourceProtocolAsync(array $args = [])
* @method \Jdcloud\Result setDomainConfig(array $args = [])
* @method \GuzzleHttp\Promise\Promise setDomainConfigAsync(array $args = [])
* @method \Jdcloud\Result queryDomainAllConfigClassify(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryDomainAllConfigClassifyAsync(array $args = [])
* @method \Jdcloud\Result executeDomainCopy(array $args = [])
* @method \GuzzleHttp\Promise\Promise executeDomainCopyAsync(array $args = [])
* @method \Jdcloud\Result queryExtraCacheTime(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryExtraCacheTimeAsync(array $args = [])
* @method \Jdcloud\Result setExtraCacheTime(array $args = [])
* @method \GuzzleHttp\Promise\Promise setExtraCacheTimeAsync(array $args = [])
* @method \Jdcloud\Result deleteExtraCacheTime(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteExtraCacheTimeAsync(array $args = [])
* @method \Jdcloud\Result batchSetExtraCacheTime(array $args = [])
* @method \GuzzleHttp\Promise\Promise batchSetExtraCacheTimeAsync(array $args = [])
* @method \Jdcloud\Result setGzip(array $args = [])
* @method \GuzzleHttp\Promise\Promise setGzipAsync(array $args = [])
* @method \Jdcloud\Result configBackSourceRule(array $args = [])
* @method \GuzzleHttp\Promise\Promise configBackSourceRuleAsync(array $args = [])
* @method \Jdcloud\Result queryBackSourceRule(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryBackSourceRuleAsync(array $args = [])
* @method \Jdcloud\Result configUrlRule(array $args = [])
* @method \GuzzleHttp\Promise\Promise configUrlRuleAsync(array $args = [])
* @method \Jdcloud\Result queryUrlRule(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryUrlRuleAsync(array $args = [])
* @method \Jdcloud\Result configHttp2(array $args = [])
* @method \GuzzleHttp\Promise\Promise configHttp2Async(array $args = [])
* @method \Jdcloud\Result queryHttp2(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryHttp2Async(array $args = [])
* @method \Jdcloud\Result configBackSourcePath(array $args = [])
* @method \GuzzleHttp\Promise\Promise configBackSourcePathAsync(array $args = [])
* @method \Jdcloud\Result queryBackSourcePath(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryBackSourcePathAsync(array $args = [])
* @method \Jdcloud\Result setAccelerateRegion(array $args = [])
* @method \GuzzleHttp\Promise\Promise setAccelerateRegionAsync(array $args = [])
* @method \Jdcloud\Result configBackSourceRules(array $args = [])
* @method \GuzzleHttp\Promise\Promise configBackSourceRulesAsync(array $args = [])
* @method \Jdcloud\Result queryBackSourceRules(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryBackSourceRulesAsync(array $args = [])
* @method \Jdcloud\Result configBackSourceOss(array $args = [])
* @method \GuzzleHttp\Promise\Promise configBackSourceOssAsync(array $args = [])
* @method \Jdcloud\Result queryBackSourceOss(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryBackSourceOssAsync(array $args = [])
* @method \Jdcloud\Result speedLimit(array $args = [])
* @method \GuzzleHttp\Promise\Promise speedLimitAsync(array $args = [])
* @method \Jdcloud\Result batchIpBlackList(array $args = [])
* @method \GuzzleHttp\Promise\Promise batchIpBlackListAsync(array $args = [])
* @method \Jdcloud\Result queryDomainGroupList(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryDomainGroupListAsync(array $args = [])
* @method \Jdcloud\Result queryDomainGroupDetail(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryDomainGroupDetailAsync(array $args = [])
* @method \Jdcloud\Result queryDomainsNotInGroup(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryDomainsNotInGroupAsync(array $args = [])
* @method \Jdcloud\Result updateDomainGroup(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateDomainGroupAsync(array $args = [])
* @method \Jdcloud\Result createDomainGroup(array $args = [])
* @method \GuzzleHttp\Promise\Promise createDomainGroupAsync(array $args = [])
* @method \Jdcloud\Result batchDeleteDomainGroup(array $args = [])
* @method \GuzzleHttp\Promise\Promise batchDeleteDomainGroupAsync(array $args = [])
* @method \Jdcloud\Result getDomainList(array $args = [])
* @method \GuzzleHttp\Promise\Promise getDomainListAsync(array $args = [])
* @method \Jdcloud\Result getDomainListByFilter(array $args = [])
* @method \GuzzleHttp\Promise\Promise getDomainListByFilterAsync(array $args = [])
* @method \Jdcloud\Result getDomainDetail(array $args = [])
* @method \GuzzleHttp\Promise\Promise getDomainDetailAsync(array $args = [])
* @method \Jdcloud\Result createDomain(array $args = [])
* @method \GuzzleHttp\Promise\Promise createDomainAsync(array $args = [])
* @method \Jdcloud\Result deleteDomain(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteDomainAsync(array $args = [])
* @method \Jdcloud\Result queryDomainCnameTag(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryDomainCnameTagAsync(array $args = [])
* @method \Jdcloud\Result startDomain(array $args = [])
* @method \GuzzleHttp\Promise\Promise startDomainAsync(array $args = [])
* @method \Jdcloud\Result stopDomain(array $args = [])
* @method \GuzzleHttp\Promise\Promise stopDomainAsync(array $args = [])
* @method \Jdcloud\Result queryOssBuckets(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryOssBucketsAsync(array $args = [])
* @method \Jdcloud\Result batchCreate(array $args = [])
* @method \GuzzleHttp\Promise\Promise batchCreateAsync(array $args = [])
* @method \Jdcloud\Result queryDomainConfig(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryDomainConfigAsync(array $args = [])
* @method \Jdcloud\Result generateDomainTxt(array $args = [])
* @method \GuzzleHttp\Promise\Promise generateDomainTxtAsync(array $args = [])
* @method \Jdcloud\Result domainTxtValidate(array $args = [])
* @method \GuzzleHttp\Promise\Promise domainTxtValidateAsync(array $args = [])
* @method \Jdcloud\Result queryDomainTempInstList(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryDomainTempInstListAsync(array $args = [])
* @method \Jdcloud\Result queryDomainTempProKeys(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryDomainTempProKeysAsync(array $args = [])
* @method \Jdcloud\Result modifyDomainTempInst(array $args = [])
* @method \GuzzleHttp\Promise\Promise modifyDomainTempInstAsync(array $args = [])
* @method \Jdcloud\Result queryDomainTempInst(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryDomainTempInstAsync(array $args = [])
* @method \Jdcloud\Result delDomainTempInstance(array $args = [])
* @method \GuzzleHttp\Promise\Promise delDomainTempInstanceAsync(array $args = [])
* @method \Jdcloud\Result checkWhetherIpBelongToJCloud(array $args = [])
* @method \GuzzleHttp\Promise\Promise checkWhetherIpBelongToJCloudAsync(array $args = [])
* @method \Jdcloud\Result queryServiceIp(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryServiceIpAsync(array $args = [])
* @method \Jdcloud\Result setLiveDomainBackSource(array $args = [])
* @method \GuzzleHttp\Promise\Promise setLiveDomainBackSourceAsync(array $args = [])
* @method \Jdcloud\Result setLiveDomainIpBlackList(array $args = [])
* @method \GuzzleHttp\Promise\Promise setLiveDomainIpBlackListAsync(array $args = [])
* @method \Jdcloud\Result setLiveDomainRefer(array $args = [])
* @method \GuzzleHttp\Promise\Promise setLiveDomainReferAsync(array $args = [])
* @method \Jdcloud\Result operateLiveDomainIpBlackList(array $args = [])
* @method \GuzzleHttp\Promise\Promise operateLiveDomainIpBlackListAsync(array $args = [])
* @method \Jdcloud\Result setLiveDomainBackSourceHost(array $args = [])
* @method \GuzzleHttp\Promise\Promise setLiveDomainBackSourceHostAsync(array $args = [])
* @method \Jdcloud\Result setLiveDomainAccessKey(array $args = [])
* @method \GuzzleHttp\Promise\Promise setLiveDomainAccessKeyAsync(array $args = [])
* @method \Jdcloud\Result setProtocolConvert(array $args = [])
* @method \GuzzleHttp\Promise\Promise setProtocolConvertAsync(array $args = [])
* @method \Jdcloud\Result deleteForbiddenStream(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteForbiddenStreamAsync(array $args = [])
* @method \Jdcloud\Result queryPushDomainORAppOrStream(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryPushDomainORAppOrStreamAsync(array $args = [])
* @method \Jdcloud\Result queryLiveDomainIpBlackWhiteList(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryLiveDomainIpBlackWhiteListAsync(array $args = [])
* @method \Jdcloud\Result batchCreateLiveDomain(array $args = [])
* @method \GuzzleHttp\Promise\Promise batchCreateLiveDomainAsync(array $args = [])
* @method \Jdcloud\Result queryLiveDomainDetail(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryLiveDomainDetailAsync(array $args = [])
* @method \Jdcloud\Result queryLiveDomainApps(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryLiveDomainAppsAsync(array $args = [])
* @method \Jdcloud\Result createLiveDomainPrefecthTask(array $args = [])
* @method \GuzzleHttp\Promise\Promise createLiveDomainPrefecthTaskAsync(array $args = [])
* @method \Jdcloud\Result queryLivePrefetchTask(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryLivePrefetchTaskAsync(array $args = [])
* @method \Jdcloud\Result queryPinCanIPType(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryPinCanIPTypeAsync(array $args = [])
* @method \Jdcloud\Result batCreatePrefetchTask(array $args = [])
* @method \GuzzleHttp\Promise\Promise batCreatePrefetchTaskAsync(array $args = [])
* @method \Jdcloud\Result updatePrefetchTask(array $args = [])
* @method \GuzzleHttp\Promise\Promise updatePrefetchTaskAsync(array $args = [])
* @method \Jdcloud\Result queryPrefetchTask(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryPrefetchTaskAsync(array $args = [])
* @method \Jdcloud\Result stopPrefetchTask(array $args = [])
* @method \GuzzleHttp\Promise\Promise stopPrefetchTaskAsync(array $args = [])
* @method \Jdcloud\Result operatePurgeTask(array $args = [])
* @method \GuzzleHttp\Promise\Promise operatePurgeTaskAsync(array $args = [])
* @method \Jdcloud\Result queryPurgeTask(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryPurgeTaskAsync(array $args = [])
* @method \Jdcloud\Result queryCdnUserQuota(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryCdnUserQuotaAsync(array $args = [])
* @method \Jdcloud\Result queryRefreshTaskByIds(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryRefreshTaskByIdsAsync(array $args = [])
* @method \Jdcloud\Result setRefreshLimit(array $args = [])
* @method \GuzzleHttp\Promise\Promise setRefreshLimitAsync(array $args = [])
* @method \Jdcloud\Result queryRefreshLimit(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryRefreshLimitAsync(array $args = [])
* @method \Jdcloud\Result queryRefreshTaskById(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryRefreshTaskByIdAsync(array $args = [])
* @method \Jdcloud\Result createRefreshTaskForCallback(array $args = [])
* @method \GuzzleHttp\Promise\Promise createRefreshTaskForCallbackAsync(array $args = [])
* @method \Jdcloud\Result createRefreshTaskForCallbackV2(array $args = [])
* @method \GuzzleHttp\Promise\Promise createRefreshTaskForCallbackV2Async(array $args = [])
* @method \Jdcloud\Result queryRefreshTask(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryRefreshTaskAsync(array $args = [])
* @method \Jdcloud\Result createRefreshTask(array $args = [])
* @method \GuzzleHttp\Promise\Promise createRefreshTaskAsync(array $args = [])
* @method \Jdcloud\Result queryNetProtectionRules(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryNetProtectionRulesAsync(array $args = [])
* @method \Jdcloud\Result setNetProtectionRules(array $args = [])
* @method \GuzzleHttp\Promise\Promise setNetProtectionRulesAsync(array $args = [])
* @method \Jdcloud\Result queryNetProtectionRulesSwitch(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryNetProtectionRulesSwitchAsync(array $args = [])
* @method \Jdcloud\Result setNetProtectionRulesSwitch(array $args = [])
* @method \GuzzleHttp\Promise\Promise setNetProtectionRulesSwitchAsync(array $args = [])
* @method \Jdcloud\Result queryGeoAreas(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryGeoAreasAsync(array $args = [])
* @method \Jdcloud\Result queryAttackTypeCount(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryAttackTypeCountAsync(array $args = [])
* @method \Jdcloud\Result queryDdosGraph(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryDdosGraphAsync(array $args = [])
* @method \Jdcloud\Result searchAttackLog(array $args = [])
* @method \GuzzleHttp\Promise\Promise searchAttackLogAsync(array $args = [])
* @method \Jdcloud\Result getAllUpperNodeIpList(array $args = [])
* @method \GuzzleHttp\Promise\Promise getAllUpperNodeIpListAsync(array $args = [])
* @method \Jdcloud\Result configServiceNotice(array $args = [])
* @method \GuzzleHttp\Promise\Promise configServiceNoticeAsync(array $args = [])
* @method \Jdcloud\Result queryServiceNotice(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryServiceNoticeAsync(array $args = [])
* @method \Jdcloud\Result getSslCertList(array $args = [])
* @method \GuzzleHttp\Promise\Promise getSslCertListAsync(array $args = [])
* @method \Jdcloud\Result getSslCertDetail(array $args = [])
* @method \GuzzleHttp\Promise\Promise getSslCertDetailAsync(array $args = [])
* @method \Jdcloud\Result uploadCert(array $args = [])
* @method \GuzzleHttp\Promise\Promise uploadCertAsync(array $args = [])
* @method \Jdcloud\Result queryMixStatisticsData(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryMixStatisticsDataAsync(array $args = [])
* @method \Jdcloud\Result queryMixStatisticsWithAreaData(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryMixStatisticsWithAreaDataAsync(array $args = [])
* @method \Jdcloud\Result queryMixTrafficGroupSum(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryMixTrafficGroupSumAsync(array $args = [])
* @method \Jdcloud\Result queryStatisticsData(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryStatisticsDataAsync(array $args = [])
* @method \Jdcloud\Result queryStatisticsDataGroupByArea(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryStatisticsDataGroupByAreaAsync(array $args = [])
* @method \Jdcloud\Result queryStatisticsDataGroupSum(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryStatisticsDataGroupSumAsync(array $args = [])
* @method \Jdcloud\Result queryLiveStatisticsData(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryLiveStatisticsDataAsync(array $args = [])
* @method \Jdcloud\Result queryLiveStatisticsAreaDataGroupBy(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryLiveStatisticsAreaDataGroupByAsync(array $args = [])
* @method \Jdcloud\Result queryLiveTrafficGroupSum(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryLiveTrafficGroupSumAsync(array $args = [])
* @method \Jdcloud\Result queryStatisticsTopIp(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryStatisticsTopIpAsync(array $args = [])
* @method \Jdcloud\Result queryStatisticsTopUrl(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryStatisticsTopUrlAsync(array $args = [])
* @method \Jdcloud\Result queryDirBandwidth(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryDirBandwidthAsync(array $args = [])
* @method \Jdcloud\Result queryDirStatsData(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryDirStatsDataAsync(array $args = [])
* @method \Jdcloud\Result queryCustomizedDirBandWidth(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryCustomizedDirBandWidthAsync(array $args = [])
* @method \Jdcloud\Result queryStreamInfo(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryStreamInfoAsync(array $args = [])
* @method \Jdcloud\Result queryAvgBandwidthForPCdn(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryAvgBandwidthForPCdnAsync(array $args = [])
* @method \Jdcloud\Result queryDeviceStatusForPCdn(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryDeviceStatusForPCdnAsync(array $args = [])
* @method \Jdcloud\Result queryJDBoxStatisticsData(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryJDBoxStatisticsDataAsync(array $args = [])
* @method \Jdcloud\Result queryJDBoxStatisticsDataWithGroup(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryJDBoxStatisticsDataWithGroupAsync(array $args = [])
* @method \Jdcloud\Result queryJBoxAvgBandwidth(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryJBoxAvgBandwidthAsync(array $args = [])
* @method \Jdcloud\Result queryWafSwitch(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryWafSwitchAsync(array $args = [])
* @method \Jdcloud\Result setWafSwitch(array $args = [])
* @method \GuzzleHttp\Promise\Promise setWafSwitchAsync(array $args = [])
* @method \Jdcloud\Result queryWafWhiteRuleSwitch(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryWafWhiteRuleSwitchAsync(array $args = [])
* @method \Jdcloud\Result setWafWhiteRuleSwitch(array $args = [])
* @method \GuzzleHttp\Promise\Promise setWafWhiteRuleSwitchAsync(array $args = [])
* @method \Jdcloud\Result querywafWhiteRules(array $args = [])
* @method \GuzzleHttp\Promise\Promise querywafWhiteRulesAsync(array $args = [])
* @method \Jdcloud\Result createWafWhiteRule(array $args = [])
* @method \GuzzleHttp\Promise\Promise createWafWhiteRuleAsync(array $args = [])
* @method \Jdcloud\Result updateWafWhiteRule(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateWafWhiteRuleAsync(array $args = [])
* @method \Jdcloud\Result enableWafWhiteRules(array $args = [])
* @method \GuzzleHttp\Promise\Promise enableWafWhiteRulesAsync(array $args = [])
* @method \Jdcloud\Result disableWafWhiteRules(array $args = [])
* @method \GuzzleHttp\Promise\Promise disableWafWhiteRulesAsync(array $args = [])
* @method \Jdcloud\Result deleteWafWhiteRules(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteWafWhiteRulesAsync(array $args = [])
* @method \Jdcloud\Result queryWafBlackRuleSwitch(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryWafBlackRuleSwitchAsync(array $args = [])
* @method \Jdcloud\Result setWafBlackRuleSwitch(array $args = [])
* @method \GuzzleHttp\Promise\Promise setWafBlackRuleSwitchAsync(array $args = [])
* @method \Jdcloud\Result querywafBlackRules(array $args = [])
* @method \GuzzleHttp\Promise\Promise querywafBlackRulesAsync(array $args = [])
* @method \Jdcloud\Result createWafBlackRule(array $args = [])
* @method \GuzzleHttp\Promise\Promise createWafBlackRuleAsync(array $args = [])
* @method \Jdcloud\Result updateWafBlackRule(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateWafBlackRuleAsync(array $args = [])
* @method \Jdcloud\Result enableWafBlackRules(array $args = [])
* @method \GuzzleHttp\Promise\Promise enableWafBlackRulesAsync(array $args = [])
* @method \Jdcloud\Result disableWafBlackRules(array $args = [])
* @method \GuzzleHttp\Promise\Promise disableWafBlackRulesAsync(array $args = [])
* @method \Jdcloud\Result deleteWafBlackRules(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteWafBlackRulesAsync(array $args = [])
* @method \Jdcloud\Result queryCCProtectSwitch(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryCCProtectSwitchAsync(array $args = [])
* @method \Jdcloud\Result setCCProtectSwitch(array $args = [])
* @method \GuzzleHttp\Promise\Promise setCCProtectSwitchAsync(array $args = [])
* @method \Jdcloud\Result queryCCProtectRules(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryCCProtectRulesAsync(array $args = [])
* @method \Jdcloud\Result createCCProtectRule(array $args = [])
* @method \GuzzleHttp\Promise\Promise createCCProtectRuleAsync(array $args = [])
* @method \Jdcloud\Result updateCCProtectRule(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateCCProtectRuleAsync(array $args = [])
* @method \Jdcloud\Result enableCCProtectRule(array $args = [])
* @method \GuzzleHttp\Promise\Promise enableCCProtectRuleAsync(array $args = [])
* @method \Jdcloud\Result disableCCProtectRule(array $args = [])
* @method \GuzzleHttp\Promise\Promise disableCCProtectRuleAsync(array $args = [])
* @method \Jdcloud\Result deleteCCProtectRule(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteCCProtectRuleAsync(array $args = [])
* @method \Jdcloud\Result queryWebProtectSwitch(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryWebProtectSwitchAsync(array $args = [])
* @method \Jdcloud\Result setWebProtectSwitch(array $args = [])
* @method \GuzzleHttp\Promise\Promise setWebProtectSwitchAsync(array $args = [])
* @method \Jdcloud\Result queryWebProtectSettings(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryWebProtectSettingsAsync(array $args = [])
* @method \Jdcloud\Result updateWebProtectSettings(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateWebProtectSettingsAsync(array $args = [])
* @method \Jdcloud\Result queryWafRegions(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryWafRegionsAsync(array $args = [])
* @method \Jdcloud\Result queryIpBlackSettingStatus(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryIpBlackSettingStatusAsync(array $args = [])
* @method \Jdcloud\Result wafQueryPvForAreaAndIp(array $args = [])
* @method \GuzzleHttp\Promise\Promise wafQueryPvForAreaAndIpAsync(array $args = [])
* @method \Jdcloud\Result wafQueryPv(array $args = [])
* @method \GuzzleHttp\Promise\Promise wafQueryPvAsync(array $args = [])
* @method \Jdcloud\Result wafQueryAttackDetails(array $args = [])
* @method \GuzzleHttp\Promise\Promise wafQueryAttackDetailsAsync(array $args = [])
*/
class CdnClient extends JdCloudClient
{
public function __construct(array $args)
{
$args['with_resolved'] = function (array $args) {
$this->getHandlerList()->appendInit(
PresignUrlMiddleware::wrap(
$this,
$args['endpoint_provider'],
[
'operations' => [
],
'service' => 'cdn',
'presign_param' => 'PresignedUrl',
]
),
'cdn'
);
};
parent::__construct($args);
}
}

View File

@@ -0,0 +1,81 @@
# 更新历史 #
API版本0.10.46
| 发布时间 | 版本号 | 更新 | 说明 |
| ---------- | ------ | ---------------------------------------------------------- | ---- |
| 2023-05-06 | 0.10.46 |新增generateDomainTxt接口解决原有接口java sdk格式兼容问题,domainTxtGenerate仅对内使用|
| 2023-04-06 | 0.10.45 |domainTxtGenerate、domainTxtValidate txt生成及校验接口对外开放|
| 2023-02-22 | 0.10.44 |增加域名海外CF状态信息|
| 2023-02-06 | 0.10.43 |控制台增加域名备案检查接口|
| 2023-01-09 | 0.10.42 |批量下发ip黑名单接口可增加入参可指定下发全部域名|
| 2022-12-29 | 0.10.41 |域名列表详情增加海外状态数据|
| 2022-12-19 | 0.10.40 |商城pin维度离线日志查询接口|
| 2022-12-09 | 0.10.39 |SCDN回源配置接口字段调整|
| 2022-12-08 | 0.10.38 |封禁解封接口V2|
| 2022-12-07 | 0.10.37 |增加SCDN回源配置相关接口|
| 2022-10-13 | 0.10.36 |创建单域名时支持指定cnameTag、查询cnameTag|
| 2022-08-22 | 0.10.35 |接口支持ipV4/ipV6查询|
| 2022-08-02 | 0.10.34 |批量下发ip黑名单|
| 2022-07-25 | 0.10.33 |域名归属权验证|
| 2022-06-22 | 0.10.32 |增加域名限速接口|
| 2022-04-08 | 0.10.31 |增加查询、设置回源OSS鉴权定制接口|
| 2022-01-17 | 0.10.29 |设置、查询回源改写批量配置|
| 2021-09-17 | 0.10.28 |设置、删除、查询httpHeader支持区分边缘和回源|
| 2021-06-30 | 0.10.27 |deeplog日志收集接口增加pin参数|
| 2021-02-01 | 0.10.26 |统计查询新增cacheType |
| 2020-12-25 | 0.10.25 |统计查询新增直播流帧率码率观看人数查询接口 |
| 2020-11-05 | 0.10.24 |增加控制台获取地域运行商新接口 |
| 2020-10-14 | 0.10.23 |增加子账号设置与查询刷新预热额度接口 |
| 2020-08-25 | 0.10.22 |点播域名创建支持指定模板 |
| 2020-08-14 | 0.10.21 |增加头条回源鉴权参数配置和dash鉴权参数配置接口|
| 2020-08-06 | 0.10.20 |增加查询用户相关信息接口|
| 2020-07-24 | 0.10.19 |海外配置增加修改加速区域接口,刷新预热任务增加是否包含海外或全球域名字段 |
| 2020-07-22 | 0.10.18 |修改ssl证书详情返回字段修改查询证书列表说明信息 |
| 2020-07-20 | 0.10.17 |增加topIp查询接口 |
| 2020-07-15 | 0.10.16 |增加回源改写、url改写、http2及回源多path的配置与查询接口 |
| 2020-07-08 | 0.10.15 |增加解封任务id返回及状态查询接口 |
| 2020-06-23 | 0.10.14 |增加PCdn带宽查询接口 | |
| 2020-06-15 | 0.10.13 |增加支持Gzip压缩配置 | |
| 2020-06-08 | 0.10.12 |直播通用统计查询接口增加cacheLevel参数 | |
| 2020-05-29 | 0.10.11 |PCdn刷新预热接口 | |
| 2020-05-27 | 0.10.10 |增加自定义错误页面接口 | |
| 2020-05-25 | 0.10.9 |设置源站信息时增加加速区域字段accelerateRegion | |
| 2020-05-14 | 0.10.8 |域名url封禁删除接口入参更改 | |
| 2020-05-13 | 0.10.7 |增加刷新预热封禁余量查询接口 | |
| 2020-05-07 | 0.10.6 |增加异常码缓存时间的设置查询和删除接口 | |
| 2020-04-29 | 0.10.5 |增加报表数据查询及服务通知相关接口 | |
| 2020-04-27 | 0.10.4 |增加视频云查询带宽查询相关接口 | |
| 2020-04-22 | 0.10.3 |增加域名url封禁、封禁查询、封禁删除接口 | |
| 2020-04-03 | 0.10.2 |查询域名组列表接口增加域名组id返回字段 | |
| 2020-03-05 | 0.10.1 |增加目录基本统计数据查询接口 | |
| 2020-03-05 | 0.10.0 |增加域名模板相关接口 | |
| 2020-02-26 | 0.9.9 |增加域名迁移、域名删除恢复、域名配置复制恢复接口 | |
| 2020-02-21 | 0.9.8 |直播点播增加ip白名单设置查询接口 | |
| 2020-01-10 | 0.9.7 | 增加查询域名调度IP接口
| 2019-12-10 | 0.9.6 | 日志删除接口,增加logFileFullPath参数 | |
| 2019-12-10 | 0.9.5 | IP查询接口增加city字段 | |
| 2019-12-10 | 0.9.4 | 移除多余的接口 | |
| 2019-12-10 | 0.9.3 | 增加目录带宽查询功能 | |
| 2019-12-04 | 0.9.2 | 域名一键复制配置接口:查询配置及复制配置 | |
| 2019-12-03 | 0.9.1 | 日志查询接口增加最后修改日期 | |
| 2019-11-18 | 0.9.0 | 增加查询ip是否归属京东云的接口 | |
| 2019-11-08 | 0.8.9 | 1. 修改直播域名创建方式<br/>2. 直播流查询增加查询参数 | |
| 2019-07-16 | 0.8.8 | 1. 增加scdn相关的接口 | |
| 2019-07-16 | 0.8.7 | 1.修复刷新预热go版本bug | |
| 2019-06-12 | 0.8.6 | 1. 对接ssl证书管理 | |
| 2019-03-04 | 0.8.5 | 1. 增加日志收集的接口 | |
| 2019-03-04 | 0.8.4 | 1. 增加YY相关的查询接口 | |
| 2019-03-04 | 0.8.3 | 1. 增加直播预热查询接口 | |
| 2018-01-17 | 0.8.2 | 1. 增加直播预热接口 | |
| 2018-12-17 | 0.8.1 | 修改接口url,规则 | |
| 2018-12-11 | 0.8.0 | 修改域名详情查询接口的返回值 | |
| 2018-12-11 | 0.7.9 | 1.添加直播点播域名创建<br/>2.添加域名配置管理接口 | |
| 2018-11-19 | 0.7.8 | 查询域名列表返回审核状态 修改审核状态为字符串格式 | |
| 2018-11-19 | 0.7.7 | 增加域名启动和停止的接口 | |
| 2018-11-19 | 0.7.6 | 统计接口增加回源参数 | |
| 2018-11-19 | 0.7.5 | 增加统计接口, 增加查询域名详情的接口 | |
| 2018-4-17 | 0.7.4 | 增加列举域名的接口 | |
| 2018-4-17 | 0.7.2 | 1. 修改接口的请求方式。<br/>2.修改modifySource的请求参数。 | |

View File

@@ -0,0 +1,88 @@
<?php
/**
* Censor
*
* @category Jdcloud
* @package Jdcloud\Censor
* @author Jdcloud <jdcloud-api@jd.com>
* @license Apache-2.0 http://www.apache.org/licenses/LICENSE-2.0
* @link https://www.jdcloud.com/help/faq
*/
namespace Jdcloud\Censor;
use Jdcloud\JdCloudClient;
use Jdcloud\Api\Service;
use Jdcloud\Api\DocModel;
use Jdcloud\Api\ApiProvider;
use Jdcloud\PresignUrlMiddleware;
/**
* Client used to interact with censor.
*
* @method \Jdcloud\Result asyncAudioScan(array $args = [])
* @method \GuzzleHttp\Promise\Promise asyncAudioScanAsync(array $args = [])
* @method \Jdcloud\Result audioResults(array $args = [])
* @method \GuzzleHttp\Promise\Promise audioResultsAsync(array $args = [])
* @method \Jdcloud\Result asyncAudioScanV2(array $args = [])
* @method \GuzzleHttp\Promise\Promise asyncAudioScanV2Async(array $args = [])
* @method \Jdcloud\Result audioCallbackV2(array $args = [])
* @method \GuzzleHttp\Promise\Promise audioCallbackV2Async(array $args = [])
* @method \Jdcloud\Result audioResultsV2(array $args = [])
* @method \GuzzleHttp\Promise\Promise audioResultsV2Async(array $args = [])
* @method \Jdcloud\Result deleteCensorLib(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteCensorLibAsync(array $args = [])
* @method \Jdcloud\Result deleteCensorLibItems(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteCensorLibItemsAsync(array $args = [])
* @method \Jdcloud\Result imageScan(array $args = [])
* @method \GuzzleHttp\Promise\Promise imageScanAsync(array $args = [])
* @method \Jdcloud\Result asyncImageScan(array $args = [])
* @method \GuzzleHttp\Promise\Promise asyncImageScanAsync(array $args = [])
* @method \Jdcloud\Result imageResults(array $args = [])
* @method \GuzzleHttp\Promise\Promise imageResultsAsync(array $args = [])
* @method \Jdcloud\Result imageScanV2(array $args = [])
* @method \GuzzleHttp\Promise\Promise imageScanV2Async(array $args = [])
* @method \Jdcloud\Result deleteLimit(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteLimitAsync(array $args = [])
* @method \Jdcloud\Result textScan(array $args = [])
* @method \GuzzleHttp\Promise\Promise textScanAsync(array $args = [])
* @method \Jdcloud\Result innerTextScan(array $args = [])
* @method \GuzzleHttp\Promise\Promise innerTextScanAsync(array $args = [])
* @method \Jdcloud\Result textScanV2(array $args = [])
* @method \GuzzleHttp\Promise\Promise textScanV2Async(array $args = [])
* @method \Jdcloud\Result textResultsV2(array $args = [])
* @method \GuzzleHttp\Promise\Promise textResultsV2Async(array $args = [])
* @method \Jdcloud\Result asyncVideoScan(array $args = [])
* @method \GuzzleHttp\Promise\Promise asyncVideoScanAsync(array $args = [])
* @method \Jdcloud\Result videoResults(array $args = [])
* @method \GuzzleHttp\Promise\Promise videoResultsAsync(array $args = [])
* @method \Jdcloud\Result asyncVideoScanV2(array $args = [])
* @method \GuzzleHttp\Promise\Promise asyncVideoScanV2Async(array $args = [])
* @method \Jdcloud\Result videoCallbackV2(array $args = [])
* @method \GuzzleHttp\Promise\Promise videoCallbackV2Async(array $args = [])
* @method \Jdcloud\Result videoResultsV2(array $args = [])
* @method \GuzzleHttp\Promise\Promise videoResultsV2Async(array $args = [])
*/
class CensorClient extends JdCloudClient
{
public function __construct(array $args)
{
$args['with_resolved'] = function (array $args) {
$this->getHandlerList()->appendInit(
PresignUrlMiddleware::wrap(
$this,
$args['endpoint_provider'],
[
'operations' => [
],
'service' => 'censor',
'presign_param' => 'PresignedUrl',
]
),
'censor'
);
};
parent::__construct($args);
}
}

View File

@@ -0,0 +1,9 @@
# 更新历史 #
API版本1.0.3
|发布时间|版本号|更新|说明|
|---|---|---|---|
|2021-07-30|1.0.3|支持bizType||
|2021-07-02|1.0.2|新增新的检测接口||
|2020-10-10|1.0.1|支持音视频异步检测||
|2019-09-20|1.0.0|初始版本||

View File

@@ -0,0 +1,43 @@
# 更新历史 #
API版本0.2.0
| 发布时间 | 版本号 | 更新 | 说明 |
|------------|-------|------------------------------------------------| ----------- |
| 2020-05-19 | 0.1.3 | 初始版本 | * API定义基础接口 |
| 2020-05-21 | 0.1.4 | 修改创建接口参数 | * API定义基础接口 |
| 2020-05-25 | 0.1.5 | 修改创建接口参数 | * API增加zk规格接口 |
| 2020-05-25 | 0.1.6 | 修改创建接口参数 | * API增加zk推荐规格接口 |
| 2020-05-25 | 0.1.8 | 修改创建接口参数 | * API增加用户az接口 |
| 2020-05-25 | 0.1.8 | 修改创建接口参数 | * API增加用户az接口 |
| 2020-05-25 | 0.1.9 | 修改创建接口参数 | * 创建api增加buyId返回 |
| 2020-06-05 | 0.2.0 | 增加白名单等接口 | * API增加 |
| 2020-06-09 | 0.2.1 | 修改filter | * API修改 |
| 2020-06-23 | 0.2.2 | 增加ClickhouseDB监控服务的内网域名 | * API修改 |
| 2020-06-28 | 0.2.3 | 增加ClickhouseDB监控服务端口 | * API修改 |
| 2020-06-28 | 0.2.4 | 增加ClickhouseDB 列表resourceId参数 | * API修改 |
| 2020-06-28 | 0.2.5 | 增加ClickhouseDB 修改实例名称接口 | * API修改 |
| 2020-07-13 | 0.2.6 | 增加ClickhouseDB selectDetailList接口 | * API修改 |
| 2020-07-15 | 0.2.7 | 增加ClickhouseDB tags过滤支持 | * API修改 |
| 2020-07-16 | 0.2.8 | 增加ClickhouseDB tags bug修复 | * API修改 |
| 2020-07-17 | 0.2.9 | 增加ClickhouseDB tags bug修复 | * API修改 |
| 2020-07-23 | 0.3.0 | 增加ClickhouseDB 包年包月强删除 | * API修改 |
| 2020-07-31 | 0.3.1 | 增加ClickhouseDB 实例变配 | * API增加 |
| 2020-08-04 | 0.3.2 | 修改列表接口增加zk信息 | * API增加 |
| 2020-11-19 | 0.3.3 | 增加规格查询接口 | * API增加 |
| 2021-02-02 | 0.3.4 | 增加云盘控制相关内部接口 | * API增加 |
| 2021-04-14 | 0.3.5 | 修改规格列表接口 | * API修改 |
| 2021-05-12 | 0.3.8 | 修改account查询接口 | * API 修改 |
| 2021-08-24 | 0.3.9 | 开启对外接口支持 | * API 修改 |
| 2022-03-17 | 0.4.0 | 开放对外接口 | * API 修改 |
| 2022-03-21 | 0.5.0 | 增加扩副本接口 | * API 修改 |
| 2022-03-21 | 0.6.0 | 修改tpaas接口为内部开放 | * API 修改 |
| 2022-03-31 | 0.7.0 | 增加枚举文档 | * API 修改 |
| 2022-04-14 | 0.8.0 | describeDomains接口修改 | * API 修改 |
| 2022-04-14 | 0.9.0 | describeDomains接口修改 | * API 修改 |
| 2022-06-28 | 1.0.0 | 增加冷热存储相关接口 | * API 增加 |
| 2022-07-07 | 1.1.0 | 修改冷热存储接口参数说明 | * API 修改 |
| 2022-08-31 | 1.2.0 | 处理tpaas的label | * API 修改 |
| 2022-09-13 | 1.3.0 | 处理tpaas的资源组和tag | * API 修改 |
| 2022-11-09 | 1.4.0 | 处理tpaas的describeAvailableDBInfoInternel增加可用区支持 | * API 修改 |
| 2022-11-29 | 1.5.0 | 规格接口增加archType过滤arm/x86 | * API 修改 |
| 2022-11-30 | 1.6.0 | describeDefaultConfig增加archType过滤arm/x86 | * API 修改 |

View File

@@ -0,0 +1,114 @@
<?php
/**
* Clickhouse
*
* @category Jdcloud
* @package Jdcloud\Clickhouse
* @author Jdcloud <jdcloud-api@jd.com>
* @license Apache-2.0 http://www.apache.org/licenses/LICENSE-2.0
* @link https://www.jdcloud.com/help/faq
*/
namespace Jdcloud\Clickhouse;
use Jdcloud\JdCloudClient;
use Jdcloud\Api\Service;
use Jdcloud\Api\DocModel;
use Jdcloud\Api\ApiProvider;
use Jdcloud\PresignUrlMiddleware;
/**
* Client used to interact with clickhouse.
*
* @method \Jdcloud\Result describeAccounts(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeAccountsAsync(array $args = [])
* @method \Jdcloud\Result createAccount(array $args = [])
* @method \GuzzleHttp\Promise\Promise createAccountAsync(array $args = [])
* @method \Jdcloud\Result deleteAccount(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteAccountAsync(array $args = [])
* @method \Jdcloud\Result modifyPrivilege(array $args = [])
* @method \GuzzleHttp\Promise\Promise modifyPrivilegeAsync(array $args = [])
* @method \Jdcloud\Result resetPassword(array $args = [])
* @method \GuzzleHttp\Promise\Promise resetPasswordAsync(array $args = [])
* @method \Jdcloud\Result azs(array $args = [])
* @method \GuzzleHttp\Promise\Promise azsAsync(array $args = [])
* @method \Jdcloud\Result orderableInstanceType(array $args = [])
* @method \GuzzleHttp\Promise\Promise orderableInstanceTypeAsync(array $args = [])
* @method \Jdcloud\Result createInstance(array $args = [])
* @method \GuzzleHttp\Promise\Promise createInstanceAsync(array $args = [])
* @method \Jdcloud\Result modifyInstanceSpec(array $args = [])
* @method \GuzzleHttp\Promise\Promise modifyInstanceSpecAsync(array $args = [])
* @method \Jdcloud\Result describeInstanceAttributes(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeInstanceAttributesAsync(array $args = [])
* @method \Jdcloud\Result deleteInstance(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteInstanceAsync(array $args = [])
* @method \Jdcloud\Result describeInstances(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeInstancesAsync(array $args = [])
* @method \Jdcloud\Result describeAvailableDBInfoInternel(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeAvailableDBInfoInternelAsync(array $args = [])
* @method \Jdcloud\Result describeNodeClasses(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeNodeClassesAsync(array $args = [])
* @method \Jdcloud\Result describeDefaultConfig(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeDefaultConfigAsync(array $args = [])
* @method \Jdcloud\Result describePodMap(array $args = [])
* @method \GuzzleHttp\Promise\Promise describePodMapAsync(array $args = [])
* @method \Jdcloud\Result describeDomainNames(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeDomainNamesAsync(array $args = [])
* @method \Jdcloud\Result modifyInstanceName(array $args = [])
* @method \GuzzleHttp\Promise\Promise modifyInstanceNameAsync(array $args = [])
* @method \Jdcloud\Result modifyReplicaNum(array $args = [])
* @method \GuzzleHttp\Promise\Promise modifyReplicaNumAsync(array $args = [])
* @method \Jdcloud\Result upgradeEngineVersion(array $args = [])
* @method \GuzzleHttp\Promise\Promise upgradeEngineVersionAsync(array $args = [])
* @method \Jdcloud\Result disableInternetAccess(array $args = [])
* @method \GuzzleHttp\Promise\Promise disableInternetAccessAsync(array $args = [])
* @method \Jdcloud\Result enableInternetAccess(array $args = [])
* @method \GuzzleHttp\Promise\Promise enableInternetAccessAsync(array $args = [])
* @method \Jdcloud\Result describeNodes(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeNodesAsync(array $args = [])
* @method \Jdcloud\Result describeProgress(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeProgressAsync(array $args = [])
* @method \Jdcloud\Result selectDetailList(array $args = [])
* @method \GuzzleHttp\Promise\Promise selectDetailListAsync(array $args = [])
* @method \Jdcloud\Result internalDescribeInstance(array $args = [])
* @method \GuzzleHttp\Promise\Promise internalDescribeInstanceAsync(array $args = [])
* @method \Jdcloud\Result describeAuditResult(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeAuditResultAsync(array $args = [])
* @method \Jdcloud\Result describeSlowlogResult(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeSlowlogResultAsync(array $args = [])
* @method \Jdcloud\Result describeParameters(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeParametersAsync(array $args = [])
* @method \Jdcloud\Result modifyParameters(array $args = [])
* @method \GuzzleHttp\Promise\Promise modifyParametersAsync(array $args = [])
* @method \Jdcloud\Result describeWhiteList(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeWhiteListAsync(array $args = [])
* @method \Jdcloud\Result modifyWhiteList(array $args = [])
* @method \GuzzleHttp\Promise\Promise modifyWhiteListAsync(array $args = [])
* @method \Jdcloud\Result deleteWhiteListGroup(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteWhiteListGroupAsync(array $args = [])
* @method \Jdcloud\Result addWhiteListGroup(array $args = [])
* @method \GuzzleHttp\Promise\Promise addWhiteListGroupAsync(array $args = [])
*/
class ClickhouseClient extends JdCloudClient
{
public function __construct(array $args)
{
$args['with_resolved'] = function (array $args) {
$this->getHandlerList()->appendInit(
PresignUrlMiddleware::wrap(
$this,
$args['endpoint_provider'],
[
'operations' => [
],
'service' => 'clickhouse',
'presign_param' => 'PresignedUrl',
]
),
'clickhouse'
);
};
parent::__construct($args);
}
}

View File

@@ -0,0 +1,666 @@
<?php
namespace Jdcloud;
use Jdcloud\Api\Validator;
use Jdcloud\Api\ApiProvider;
use Jdcloud\Api\Service;
use Jdcloud\Credentials\Credentials;
use Jdcloud\Credentials\CredentialsInterface;
use Jdcloud\Endpoint\PartitionEndpointProvider;
use Jdcloud\Signature\SignatureProvider;
use Jdcloud\Endpoint\EndpointProvider;
use Jdcloud\Credentials\CredentialProvider;
use InvalidArgumentException as IAE;
use Psr\Http\Message\RequestInterface;
/**
* @internal Resolves a hash of client arguments to construct a client.
*/
class ClientResolver
{
/** @var array */
private $argDefinitions;
/** @var array Map of types to a corresponding function */
private static $typeMap = [
'resource' => 'is_resource',
'callable' => 'is_callable',
'int' => 'is_int',
'bool' => 'is_bool',
'string' => 'is_string',
'object' => 'is_object',
'array' => 'is_array',
];
private static $defaultArgs = [
'service' => [
'type' => 'value',
'valid' => ['string'],
'doc' => 'Name of the service to utilize. This value will be supplied by default when using one of the SDK clients (e.g., Jdcloud\\S3\\S3Client).',
'required' => true,
'internal' => true
],
'exception_class' => [
'type' => 'value',
'valid' => ['string'],
'doc' => 'Exception class to create when an error occurs.',
'default' => 'Jdcloud\Exception\JdcloudException',
'internal' => true
],
'scheme' => [
'type' => 'value',
'valid' => ['string'],
'default' => 'https',
'doc' => 'URI scheme to use when connecting connect. The SDK will utilize "https" endpoints (i.e., utilize SSL/TLS connections) by default. You can attempt to connect to a service over an unencrypted "http" endpoint by setting ``scheme`` to "http".',
],
'endpoint' => [
'type' => 'value',
'valid' => ['string'],
'doc' => 'The full URI of the webservice. This is only required when connecting to a custom endpoint (e.g., a local version of S3).',
'fn' => [__CLASS__, '_apply_endpoint'],
],
'region' => [
'type' => 'value',
'valid' => ['string'],
'required' => [__CLASS__, '_missing_region'],
'doc' => 'Region to connect to. ',
],
'version' => [
'type' => 'value',
'valid' => ['string'],
'required' => [__CLASS__, '_missing_version'],
'doc' => 'The version of the webservice to utilize (e.g., 2006-03-01).',
],
'signature_provider' => [
'type' => 'value',
'valid' => ['callable'],
'doc' => 'A callable that accepts a signature version name (e.g., "v4"), a service name, and region, and returns a SignatureInterface object or null. This provider is used to create signers utilized by the client. See Aws\\Signature\\SignatureProvider for a list of built-in providers',
'default' => [__CLASS__, '_default_signature_provider'],
],
'api_provider' => [
'type' => 'value',
'valid' => ['callable'],
'doc' => 'An optional PHP callable that accepts a type, service, and version argument, and returns an array of corresponding configuration data. The type value can be one of api, waiter, or paginator.',
'fn' => [__CLASS__, '_apply_api_provider'],
'default' => [ApiProvider::class, 'defaultProvider'],
],
'endpoint_provider' => [
'type' => 'value',
'valid' => ['callable'],
'fn' => [__CLASS__, '_apply_endpoint_provider'],
'doc' => 'An optional PHP callable that accepts a hash of options including a "service" and "region" key and returns NULL or a hash of endpoint data, of which the "endpoint" key is required. See Jdcloud\\Endpoint\\EndpointProvider for a list of built-in providers.',
'default' => [__CLASS__, '_default_endpoint_provider'],
],
'serializer' => [
'default' => [__CLASS__, '_default_serializer'],
'fn' => [__CLASS__, '_apply_serializer'],
'internal' => true,
'type' => 'value',
'valid' => ['callable'],
],
'signature_version' => [
'type' => 'config',
'valid' => ['string'],
'doc' => 'A string representing a custom signature version to use with a service (e.g., v4). Note that per/operation signature version MAY override this requested signature version.',
'default' => [__CLASS__, '_default_signature_version'],
],
'signing_name' => [
'type' => 'config',
'valid' => ['string'],
'doc' => 'A string representing a custom service name to be used when calculating a request signature.',
'default' => [__CLASS__, '_default_signing_name'],
],
'signing_region' => [
'type' => 'config',
'valid' => ['string'],
'doc' => 'A string representing a custom region name to be used when calculating a request signature.',
'default' => [__CLASS__, '_default_signing_region'],
],
'credentials' => [
'type' => 'value',
'valid' => [CredentialsInterface::class, ],
'doc' => 'Specifies the credentials used to sign requests. Provide an Jdcloud\Credentials\CredentialsInterface object, an associative array of "key", "secret", and an optional "token" key, `false` to use null credentials, or a callable credentials provider used to create credentials or return null. See Jdcloud\\Credentials\\CredentialProvider for a list of built-in credentials providers. If no credentials are provided, the SDK will attempt to load them from the environment.',
'fn' => [__CLASS__, '_apply_credentials'],
'default' => [CredentialProvider::class, 'defaultProvider'],
],
'debug' => [
'type' => 'value',
'valid' => ['bool', 'array'],
'doc' => 'Set to true to display debug information when sending requests. Alternatively, you can provide an associative array with the following keys: logfn: (callable) Function that is invoked with log messages; stream_size: (int) When the size of a stream is greater than this number, the stream data will not be logged (set to "0" to not log any stream data); scrub_auth: (bool) Set to false to disable the scrubbing of auth data from the logged messages; http: (bool) Set to false to disable the "debug" feature of lower level HTTP adapters (e.g., verbose curl output).',
'fn' => [__CLASS__, '_apply_debug'],
],
'http' => [
'type' => 'value',
'valid' => ['array'],
'default' => [],
'doc' => 'Set to an array of SDK request options to apply to each request (e.g., proxy, verify, etc.).',
],
'http_handler' => [
'type' => 'value',
'valid' => ['callable'],
'doc' => 'An HTTP handler is a function that accepts a PSR-7 request object and returns a promise that is fulfilled with a PSR-7 response object or rejected with an array of exception data. NOTE: This option supersedes any provided "handler" option.',
'fn' => [__CLASS__, '_apply_http_handler']
],
'handler' => [
'type' => 'value',
'valid' => ['callable'],
'doc' => 'A handler that accepts a command object, request object and returns a promise that is fulfilled with an Jdcloud\ResultInterface object or rejected with an Jdcloud\Exception\JdcloudException. A handler does not accept a next handler as it is terminal and expected to fulfill a command. If no handler is provided, a default Guzzle handler will be utilized.',
'fn' => [__CLASS__, '_apply_handler'],
'default' => [__CLASS__, '_default_handler']
],
];
/**
* Gets an array of default client arguments, each argument containing a
* hash of the following:
*
* - type: (string, required) option type described as follows:
* - value: The default option type.
* - config: The provided value is made available in the client's
* getConfig() method.
* - valid: (array, required) Valid PHP types or class names. Note: null
* is not an allowed type.
* - required: (bool, callable) Whether or not the argument is required.
* Provide a function that accepts an array of arguments and returns a
* string to provide a custom error message.
* - default: (mixed) The default value of the argument if not provided. If
* a function is provided, then it will be invoked to provide a default
* value. The function is provided the array of options and is expected
* to return the default value of the option. The default value can be a
* closure and can not be a callable string that is not part of the
* defaultArgs array.
* - doc: (string) The argument documentation string.
* - fn: (callable) Function used to apply the argument. The function
* accepts the provided value, array of arguments by reference, and an
* event emitter.
*
* Note: Order is honored and important when applying arguments.
*
* @return array
*/
public static function getDefaultArguments()
{
return self::$defaultArgs;
}
/**
* @param array $argDefinitions Client arguments.
*/
public function __construct(array $argDefinitions)
{
$this->argDefinitions = $argDefinitions;
}
/**
* Resolves client configuration options and attached event listeners.
* Check for missing keys in passed arguments
*
* @param array $args Provided constructor arguments.
* @param HandlerList $list Handler list to augment.
*
* @return array Returns the array of provided options.
* @throws \InvalidArgumentException
* @see Jdcloud\JdcloudClient::__construct for a list of available options.
*/
public function resolve(array $args, HandlerList $list)
{
$args['config'] = [];
foreach ($this->argDefinitions as $key => $a) {
// Add defaults, validate required values, and skip if not set.
if (!isset($args[$key])) {
if (isset($a['default'])) {
// Merge defaults in when not present.
if (is_callable($a['default'])
&& (
is_array($a['default'])
|| $a['default'] instanceof \Closure
)
) {
$args[$key] = $a['default']($args);
} else {
$args[$key] = $a['default'];
}
} elseif (empty($a['required'])) {
continue;
} else {
$this->throwRequired($args);
}
}
// Validate the types against the provided value.
foreach ($a['valid'] as $check) {
if (isset(self::$typeMap[$check])) {
$fn = self::$typeMap[$check];
if ($fn($args[$key])) {
goto is_valid;
}
} elseif ($args[$key] instanceof $check) {
goto is_valid;
}
}
$this->invalidType($key, $args[$key]);
// Apply the value
is_valid:
if (isset($a['fn'])) {
$a['fn']($args[$key], $args, $list);
}
if ($a['type'] === 'config') {
$args['config'][$key] = $args[$key];
}
}
return $args;
}
/**
* Creates a verbose error message for an invalid argument.
*
* @param string $name Name of the argument that is missing.
* @param array $args Provided arguments
* @param bool $useRequired Set to true to show the required fn text if
* available instead of the documentation.
* @return string
*/
private function getArgMessage($name, $args = [], $useRequired = false)
{
$arg = $this->argDefinitions[$name];
$msg = '';
$modifiers = [];
if (isset($arg['valid'])) {
$modifiers[] = implode('|', $arg['valid']);
}
if (isset($arg['choice'])) {
$modifiers[] = 'One of ' . implode(', ', $arg['choice']);
}
if ($modifiers) {
$msg .= '(' . implode('; ', $modifiers) . ')';
}
$msg = wordwrap("{$name}: {$msg}", 75, "\n ");
if ($useRequired && is_callable($arg['required'])) {
$msg .= "\n\n ";
$msg .= str_replace("\n", "\n ", call_user_func($arg['required'], $args));
} elseif (isset($arg['doc'])) {
$msg .= wordwrap("\n\n {$arg['doc']}", 75, "\n ");
}
return $msg;
}
/**
* Throw when an invalid type is encountered.
*
* @param string $name Name of the value being validated.
* @param mixed $provided The provided value.
* @throws \InvalidArgumentException
*/
private function invalidType($name, $provided)
{
$expected = implode('|', $this->argDefinitions[$name]['valid']);
$msg = "Invalid configuration value "
. "provided for \"{$name}\". Expected {$expected}, but got "
. describe_type($provided) . "\n\n"
. $this->getArgMessage($name);
throw new IAE($msg);
}
/**
* Throws an exception for missing required arguments.
*
* @param array $args Passed in arguments.
* @throws \InvalidArgumentException
*/
private function throwRequired(array $args)
{
$missing = [];
foreach ($this->argDefinitions as $k => $a) {
if (empty($a['required'])
|| isset($a['default'])
|| isset($args[$k])
) {
continue;
}
$missing[] = $this->getArgMessage($k, $args, true);
}
$msg = "Missing required client configuration options: \n\n";
$msg .= implode("\n\n", $missing);
throw new IAE($msg);
}
public static function _apply_retries($value, array &$args, HandlerList $list)
{
// if ($value) {
// $decider = RetryMiddleware::createDefaultDecider($value);
// $list->appendSign(
// Middleware::retry($decider, null, $args['stats']['retries']),
// 'retry'
// );
// }
}
public static function _apply_credentials($value, array &$args)
{
if (is_callable($value)) {
return;
}
if ($value instanceof CredentialsInterface) {
$args['credentials'] = CredentialProvider::fromCredentials($value);
} elseif (is_array($value)
&& isset($value['key'])
&& isset($value['secret'])
) {
$args['credentials'] = CredentialProvider::fromCredentials(
new Credentials(
$value['key'],
$value['secret'],
isset($value['token']) ? $value['token'] : null,
isset($value['expires']) ? $value['expires'] : null
)
);
} elseif ($value === false) {
$args['credentials'] = CredentialProvider::fromCredentials(
new Credentials('', '')
);
$args['config']['signature_version'] = 'anonymous';
} elseif ($value instanceof CacheInterface) {
$args['credentials'] = CredentialProvider::defaultProvider($args);
} else {
throw new IAE('Credentials must be an instance of '
. 'Jdcloud\Credentials\CredentialsInterface, an associative '
. 'array that contains "key", "secret", and an optional "token" '
. 'key-value pairs, a credentials provider function, or false.');
}
}
public static function _apply_api_provider(callable $value, array &$args)
{
$api = new Service(
ApiProvider::resolve(
$value,
'api',
$args['service'],
$args['version']
),
$value
);
if (
empty($args['config']['signing_name'])
&& isset($api['metadata']['signingName'])
) {
$args['config']['signing_name'] = $api['metadata']['signingName'];
}
$args['api'] = $api;
$args['parser'] = Service::createParser($api);
$args['error_parser'] = Service::createErrorParser($api->getProtocol());
}
public static function _apply_endpoint_provider(callable $value, array &$args)
{
if (!isset($args['endpoint'])) {
$endpointPrefix = isset($args['api']['metadata']['endpointPrefix'])
? $args['api']['metadata']['endpointPrefix']
: $args['service'];
// Invoke the endpoint provider and throw if it does not resolve.
$result = EndpointProvider::resolve($value, [
'service' => $endpointPrefix,
'region' => $args['region'],
'scheme' => $args['scheme']
]);
$args['endpoint'] = $result['endpoint'];
if (
empty($args['config']['signature_version'])
&& isset($result['signatureVersion'])
) {
$args['config']['signature_version']
= $result['signatureVersion'];
}
if (
empty($args['config']['signing_region'])
&& isset($result['signingRegion'])
) {
$args['config']['signing_region'] = $result['signingRegion'];
}
if (
empty($args['config']['signing_name'])
&& isset($result['signingName'])
) {
$args['config']['signing_name'] = $result['signingName'];
}
}
}
public static function _apply_serializer($value, array &$args, HandlerList $list)
{
$list->prependBuild(Middleware::requestBuilder($value), 'builder');
}
public static function _apply_debug($value, array &$args, HandlerList $list)
{
if ($value !== false) {
$list->interpose(new TraceMiddleware($value === true ? [] : $value));
}
}
public static function _apply_stats($value, array &$args, HandlerList $list)
{
// Create an array of stat collectors that are disabled (set to false)
// by default. If the user has passed in true, enable all stat
// collectors.
$defaults = array_fill_keys(
['http', 'retries', 'timer'],
$value === true
);
}
public static function _apply_profile($_, array &$args)
{
$args['credentials'] = CredentialProvider::ini($args['profile']);
}
public static function _apply_validate($value, array &$args, HandlerList $list)
{
if ($value === false) {
return;
}
$validator = $value === true
? new Validator()
: new Validator($value);
$list->appendValidate(
Middleware::validation($args['api'], $validator),
'validation'
);
}
public static function _apply_handler($value, array &$args, HandlerList $list)
{
$list->setHandler($value);
}
public static function _default_handler(array &$args)
{
return new WrappedHttpHandler(
default_http_handler(),
$args['parser'],
$args['error_parser'],
$args['exception_class']
// $args['stats']['http']
);
}
public static function _apply_http_handler($value, array &$args, HandlerList $list)
{
$args['handler'] = new WrappedHttpHandler(
$value,
$args['parser'],
$args['error_parser'],
$args['exception_class']
// $args['stats']['http']
);
}
public static function _apply_user_agent($value, array &$args, HandlerList $list)
{
if (!is_array($value)) {
$value = [$value];
}
$value = array_map('strval', $value);
if (defined('HHVM_VERSION')) {
array_unshift($value, 'HHVM/' . HHVM_VERSION);
}
array_unshift($value, 'jdcloud-sdk-php/' . Sdk::VERSION);
$args['ua_append'] = $value;
$list->appendBuild(static function (callable $handler) use ($value) {
return function (
CommandInterface $command,
RequestInterface $request
) use ($handler, $value) {
return $handler($command, $request->withHeader(
'User-Agent',
implode(' ', array_merge(
$value,
$request->getHeader('User-Agent')
))
));
};
});
}
public static function _apply_endpoint($value, array &$args, HandlerList $list)
{
$parts = parse_url($value);
if (empty($parts['scheme']) || empty($parts['host'])) {
throw new IAE(
'Endpoints must be full URIs and include a scheme and host'
);
}
$args['endpoint'] = $value;
}
public static function _default_endpoint_provider(array $args)
{
return PartitionEndpointProvider::defaultProvider()
->getPartition($args['region'], $args['service']);
}
public static function _default_serializer(array $args)
{
return Service::createSerializer(
$args['api'],
$args['endpoint']
);
}
public static function _default_signature_provider()
{
return SignatureProvider::defaultProvider();
}
public static function _default_signature_version(array &$args)
{
if (isset($args['config']['signature_version'])) {
return $args['config']['signature_version'];
}
$args['__partition_result'] = isset($args['__partition_result'])
? isset($args['__partition_result'])
: call_user_func(PartitionEndpointProvider::defaultProvider(), [
'service' => $args['service'],
'region' => $args['region'],
]);
return isset($args['__partition_result']['signatureVersion'])
? $args['__partition_result']['signatureVersion']
: $args['api']->getSignatureVersion();
}
public static function _default_signing_name(array &$args)
{
if (isset($args['config']['signing_name'])) {
return $args['config']['signing_name'];
}
$args['__partition_result'] = isset($args['__partition_result'])
? isset($args['__partition_result'])
: call_user_func(PartitionEndpointProvider::defaultProvider(), [
'service' => $args['service'],
'region' => $args['region'],
]);
if (isset($args['__partition_result']['signingName'])) {
return $args['__partition_result']['signingName'];
}
if ($signingName = $args['api']->getSigningName()) {
return $signingName;
}
return $args['service'];
}
public static function _default_signing_region(array &$args)
{
if (isset($args['config']['signing_region'])) {
return $args['config']['signing_region'];
}
$args['__partition_result'] = isset($args['__partition_result'])
? isset($args['__partition_result'])
: call_user_func(PartitionEndpointProvider::defaultProvider(), [
'service' => $args['service'],
'region' => $args['region'],
]);
return isset($args['__partition_result']['signingRegion'])
? $args['__partition_result']['signingRegion']
: $args['region'];
}
public static function _missing_version(array $args)
{
$service = isset($args['service']) ? $args['service'] : '';
$versions = ApiProvider::defaultProvider()->getVersions($service);
$versions = implode("\n", array_map(function ($v) {
return "* \"$v\"";
}, $versions)) ?: '* (none found)';
return <<<EOT
A "version" configuration value is required. Specifying a version constraint
ensures that your code will not be affected by a breaking change made to the
service. For example, when using Amazon S3, you can lock your API version to
"2006-03-01".
Your build of the SDK has the following version(s) of "{$service}": {$versions}
You may provide "latest" to the "version" configuration value to utilize the
most recent available API version that your client's API provider can find.
Note: Using 'latest' in a production application is not recommended.
EOT;
}
public static function _missing_region(array $args)
{
$service = isset($args['service']) ? $args['service'] : '';
return <<<EOT
A "region" configuration value is required for the "{$service}" service
(e.g., "cn-north-1").
EOT;
}
}

View File

@@ -0,0 +1,34 @@
# 更新历史 #
API版本1.0.0
1.0.3:
Date: 2020-07-16
更新: 将打款验证的chekInfo 的 paymentAmount 参数类型由 float 改为 string
1.0.5:
Date: 2023-06-29
更新: 新增运营后台接口
1.0.6:
Date: 2023-09-21
更新: 新增身份证OCR接口去掉代理人认证法人和代理人认证
1.0.7:
Date: 2023-11-01
更新: 新增企业法人详版接口
1.0.8:
Date: 2023-12-12
更新: 增加chargeFlag字段
1.0.9:
Date: 2024-01-19
更新: 增加一键登录、对公打款状态查询接口身份证OCR去掉side参数
1.0.10:
Date: 2024-02-20
更新: 增加银行卡三四要素详版接口,企业二要素去掉组织机构代码
1.0.11:
Date: 2024-03-12
更新: 增加银行卡三四要素非身份证版接口

View File

@@ -0,0 +1,92 @@
<?php
/**
* Cloudauth
*
* @category Jdcloud
* @package Jdcloud\Cloudauth
* @author Jdcloud <jdcloud-api@jd.com>
* @license Apache-2.0 http://www.apache.org/licenses/LICENSE-2.0
* @link https://www.jdcloud.com/help/faq
*/
namespace Jdcloud\Cloudauth;
use Jdcloud\JdCloudClient;
use Jdcloud\Api\Service;
use Jdcloud\Api\DocModel;
use Jdcloud\Api\ApiProvider;
use Jdcloud\PresignUrlMiddleware;
/**
* Client used to interact with cloudauth.
*
* @method \Jdcloud\Result personalAuth(array $args = [])
* @method \GuzzleHttp\Promise\Promise personalAuthAsync(array $args = [])
* @method \Jdcloud\Result personalMobile(array $args = [])
* @method \GuzzleHttp\Promise\Promise personalMobileAsync(array $args = [])
* @method \Jdcloud\Result personalBankcard3Detail(array $args = [])
* @method \GuzzleHttp\Promise\Promise personalBankcard3DetailAsync(array $args = [])
* @method \Jdcloud\Result personalBankcard3Other(array $args = [])
* @method \GuzzleHttp\Promise\Promise personalBankcard3OtherAsync(array $args = [])
* @method \Jdcloud\Result personalBankcard4Detail(array $args = [])
* @method \GuzzleHttp\Promise\Promise personalBankcard4DetailAsync(array $args = [])
* @method \Jdcloud\Result personalBankcard4Other(array $args = [])
* @method \GuzzleHttp\Promise\Promise personalBankcard4OtherAsync(array $args = [])
* @method \Jdcloud\Result companyTransfer(array $args = [])
* @method \GuzzleHttp\Promise\Promise companyTransferAsync(array $args = [])
* @method \Jdcloud\Result checkCompanyTransfer(array $args = [])
* @method \GuzzleHttp\Promise\Promise checkCompanyTransferAsync(array $args = [])
* @method \Jdcloud\Result queryCompanyTransfer(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryCompanyTransferAsync(array $args = [])
* @method \Jdcloud\Result checkCompanyInfo(array $args = [])
* @method \GuzzleHttp\Promise\Promise checkCompanyInfoAsync(array $args = [])
* @method \Jdcloud\Result checkLegalPerson(array $args = [])
* @method \GuzzleHttp\Promise\Promise checkLegalPersonAsync(array $args = [])
* @method \Jdcloud\Result checkLegalPersonDetail(array $args = [])
* @method \GuzzleHttp\Promise\Promise checkLegalPersonDetailAsync(array $args = [])
* @method \Jdcloud\Result checkCompanyInfo3(array $args = [])
* @method \GuzzleHttp\Promise\Promise checkCompanyInfo3Async(array $args = [])
* @method \Jdcloud\Result queryCityList(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryCityListAsync(array $args = [])
* @method \Jdcloud\Result companyTransferSimple(array $args = [])
* @method \GuzzleHttp\Promise\Promise companyTransferSimpleAsync(array $args = [])
* @method \Jdcloud\Result queryProvinceList(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryProvinceListAsync(array $args = [])
* @method \Jdcloud\Result queryBankList(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryBankListAsync(array $args = [])
* @method \Jdcloud\Result queryBankBranchList(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryBankBranchListAsync(array $args = [])
* @method \Jdcloud\Result iDCard(array $args = [])
* @method \GuzzleHttp\Promise\Promise iDCardAsync(array $args = [])
* @method \Jdcloud\Result getAliveUrl(array $args = [])
* @method \GuzzleHttp\Promise\Promise getAliveUrlAsync(array $args = [])
* @method \Jdcloud\Result getAliveResult(array $args = [])
* @method \GuzzleHttp\Promise\Promise getAliveResultAsync(array $args = [])
* @method \Jdcloud\Result oneClick(array $args = [])
* @method \GuzzleHttp\Promise\Promise oneClickAsync(array $args = [])
* @method \Jdcloud\Result describeApplyStatus(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeApplyStatusAsync(array $args = [])
*/
class CloudauthClient extends JdCloudClient
{
public function __construct(array $args)
{
$args['with_resolved'] = function (array $args) {
$this->getHandlerList()->appendInit(
PresignUrlMiddleware::wrap(
$this,
$args['endpoint_provider'],
[
'operations' => [
],
'service' => 'cloudauth',
'presign_param' => 'PresignedUrl',
]
),
'cloudauth'
);
};
parent::__construct($args);
}
}

View File

@@ -0,0 +1,19 @@
# 更新历史 #
API版本1.0.12
|发布时间|版本号|更新|说明|
|---|---|---|---|
|2019-04-01|1.0.12|增加续费获取资源详细信息接口selectDetailList<br>根据domainId获取计费资源ID的接口getResourceId||
|2019-04-01|1.0.11|更改部分接口说明||
|2018-12-05|1.0.10|新增setLb, getLb, setLock内部接口|云解析V2.5版本|
|2018-11-27|1.0.8|批量操作解析记录接口|批量接口测试完毕|
|2018-11-13|1.0.7|时间相关的数据格式改正<br>某些接口参数修正||
|2018-10-09|1.0.6|增加内部接口||
|2018-09-29|1.0.5|增加域名诊断相关的接口<br>增加内部接口|* 四个域名诊断接口|
|2018-09-07|1.0.4|增加自定义线路相关的接口<br>增加查看操作记录的接口|* 六个自定义线路相关的接口|
|2018-08-21|1.0.3|更新文档|* 更新接口文档|
|2018-08-05|1.0.2|解析记录接口|* searchRR接口增加参数|
|2018-07-23|1.0.1|域名统计接口|* 添加getDomainResolveNum接口<br>* 添加getDomainResolveFlow接口|
|2018-07-18|1.0.0|修订与部署|* 上线改版本号|
|2018-05-23|0.1.1|网站监控更新|* 添加getTargets接口<br>* 添加monitorAddTarget接口|
|2018-05-23|0.1.0|初始版本|* API及分组定义基础接口|

View File

@@ -0,0 +1,12 @@
2018-05-23 version: 0.1.0
1. 初始版本
2018-05-23 version: 0.1.1
添加getTargets接口
添加monitorAddTarget接口
2018-07-18 version: 1.0.0
上线改版本号
2018-07-23 version: 1.0.1
添加getDomainQueryCount接口
添加getDomainQueryTraffic接口
2018-08-20 version: 1.0.2
searchRR接口增加参数

View File

@@ -0,0 +1,98 @@
<?php
/**
* Clouddnsservice
*
* @category Jdcloud
* @package Jdcloud\Clouddnsservice
* @author Jdcloud <jdcloud-api@jd.com>
* @license Apache-2.0 http://www.apache.org/licenses/LICENSE-2.0
* @link https://www.jdcloud.com/help/faq
*/
namespace Jdcloud\Clouddnsservice;
use Jdcloud\JdCloudClient;
use Jdcloud\Api\Service;
use Jdcloud\Api\DocModel;
use Jdcloud\Api\ApiProvider;
use Jdcloud\PresignUrlMiddleware;
/**
* Client used to interact with clouddnsservice.
*
* @method \Jdcloud\Result getActionLog(array $args = [])
* @method \GuzzleHttp\Promise\Promise getActionLogAsync(array $args = [])
* @method \Jdcloud\Result getDomains(array $args = [])
* @method \GuzzleHttp\Promise\Promise getDomainsAsync(array $args = [])
* @method \Jdcloud\Result addDomain(array $args = [])
* @method \GuzzleHttp\Promise\Promise addDomainAsync(array $args = [])
* @method \Jdcloud\Result delDomain(array $args = [])
* @method \GuzzleHttp\Promise\Promise delDomainAsync(array $args = [])
* @method \Jdcloud\Result updateDomain(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateDomainAsync(array $args = [])
* @method \Jdcloud\Result getDomainQueryCount(array $args = [])
* @method \GuzzleHttp\Promise\Promise getDomainQueryCountAsync(array $args = [])
* @method \Jdcloud\Result getDomainQueryTraffic(array $args = [])
* @method \GuzzleHttp\Promise\Promise getDomainQueryTrafficAsync(array $args = [])
* @method \Jdcloud\Result searchRR(array $args = [])
* @method \GuzzleHttp\Promise\Promise searchRRAsync(array $args = [])
* @method \Jdcloud\Result getViewTree(array $args = [])
* @method \GuzzleHttp\Promise\Promise getViewTreeAsync(array $args = [])
* @method \Jdcloud\Result addRR(array $args = [])
* @method \GuzzleHttp\Promise\Promise addRRAsync(array $args = [])
* @method \Jdcloud\Result updateRR(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateRRAsync(array $args = [])
* @method \Jdcloud\Result operateRR(array $args = [])
* @method \GuzzleHttp\Promise\Promise operateRRAsync(array $args = [])
* @method \Jdcloud\Result batchSetDnsResolve(array $args = [])
* @method \GuzzleHttp\Promise\Promise batchSetDnsResolveAsync(array $args = [])
* @method \Jdcloud\Result addUserView(array $args = [])
* @method \GuzzleHttp\Promise\Promise addUserViewAsync(array $args = [])
* @method \Jdcloud\Result delUserView(array $args = [])
* @method \GuzzleHttp\Promise\Promise delUserViewAsync(array $args = [])
* @method \Jdcloud\Result getUserView(array $args = [])
* @method \GuzzleHttp\Promise\Promise getUserViewAsync(array $args = [])
* @method \Jdcloud\Result addUserViewIP(array $args = [])
* @method \GuzzleHttp\Promise\Promise addUserViewIPAsync(array $args = [])
* @method \Jdcloud\Result delUserViewIP(array $args = [])
* @method \GuzzleHttp\Promise\Promise delUserViewIPAsync(array $args = [])
* @method \Jdcloud\Result getUserViewIP(array $args = [])
* @method \GuzzleHttp\Promise\Promise getUserViewIPAsync(array $args = [])
* @method \Jdcloud\Result getMonitor(array $args = [])
* @method \GuzzleHttp\Promise\Promise getMonitorAsync(array $args = [])
* @method \Jdcloud\Result addMonitor(array $args = [])
* @method \GuzzleHttp\Promise\Promise addMonitorAsync(array $args = [])
* @method \Jdcloud\Result getTargets(array $args = [])
* @method \GuzzleHttp\Promise\Promise getTargetsAsync(array $args = [])
* @method \Jdcloud\Result addMonitorTarget(array $args = [])
* @method \GuzzleHttp\Promise\Promise addMonitorTargetAsync(array $args = [])
* @method \Jdcloud\Result operateMonitor(array $args = [])
* @method \GuzzleHttp\Promise\Promise operateMonitorAsync(array $args = [])
* @method \Jdcloud\Result updateMonitor(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateMonitorAsync(array $args = [])
* @method \Jdcloud\Result getMonitorAlarmInfo(array $args = [])
* @method \GuzzleHttp\Promise\Promise getMonitorAlarmInfoAsync(array $args = [])
*/
class ClouddnsserviceClient extends JdCloudClient
{
public function __construct(array $args)
{
$args['with_resolved'] = function (array $args) {
$this->getHandlerList()->appendInit(
PresignUrlMiddleware::wrap(
$this,
$args['endpoint_provider'],
[
'operations' => [
],
'service' => 'clouddnsservice',
'presign_param' => 'PresignedUrl',
]
),
'clouddnsservice'
);
};
parent::__construct($args);
}
}

View File

@@ -0,0 +1,15 @@
# 更新历史 #
| 发布时间 | 版本号 | 更新 | 说明 |
| ---------------| -----------|-----------|---------|
| 2024-01-30 | 2.0.7 | 电子签章新版本sdk | |
| 2023-09-22 | 2.0.6 | 增加盖章位置参数 | |
| 2023-06-16 | 2.0.5 | 增加获取存证报告接口 | |
| 2023-05-15 | 2.0.4 | 添加页面签署功能兼容已有api签署接口 | |
| 2023-03-23 | 2.0.3 | 多证据链存取证参数调整 | |
| 2023-02-10 | 2.0.2 | 签署合同增加时间戳参数 | |
| 2022-09-13 | 2.0.0 | 增加存取证接口 | |
| 2021-06-24 | 1.1.1 | 完善合同下载功能 | |
| 2020-08-27 | 1.1.0 | 增加可编辑模板功能 | |
| 2020-08-10 | 1.0.1 | 使用默认章样式 | |
| 2019-08-01 | 1.0.0 | 初始化 | |

View File

@@ -0,0 +1,124 @@
<?php
/**
* Cloudsign
*
* @category Jdcloud
* @package Jdcloud\Cloudsign
* @author Jdcloud <jdcloud-api@jd.com>
* @license Apache-2.0 http://www.apache.org/licenses/LICENSE-2.0
* @link https://www.jdcloud.com/help/faq
*/
namespace Jdcloud\Cloudsign;
use Jdcloud\JdCloudClient;
use Jdcloud\Api\Service;
use Jdcloud\Api\DocModel;
use Jdcloud\Api\ApiProvider;
use Jdcloud\PresignUrlMiddleware;
/**
* Client used to interact with cloudsign.
*
* @method \Jdcloud\Result describeContractList(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeContractListAsync(array $args = [])
* @method \Jdcloud\Result signContract(array $args = [])
* @method \GuzzleHttp\Promise\Promise signContractAsync(array $args = [])
* @method \Jdcloud\Result downloadContracts(array $args = [])
* @method \GuzzleHttp\Promise\Promise downloadContractsAsync(array $args = [])
* @method \Jdcloud\Result verifyContract(array $args = [])
* @method \GuzzleHttp\Promise\Promise verifyContractAsync(array $args = [])
* @method \Jdcloud\Result deleteContract(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteContractAsync(array $args = [])
* @method \Jdcloud\Result describeContractList(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeContractListAsync(array $args = [])
* @method \Jdcloud\Result signContract(array $args = [])
* @method \GuzzleHttp\Promise\Promise signContractAsync(array $args = [])
* @method \Jdcloud\Result verifyContract(array $args = [])
* @method \GuzzleHttp\Promise\Promise verifyContractAsync(array $args = [])
* @method \Jdcloud\Result downloadContracts(array $args = [])
* @method \GuzzleHttp\Promise\Promise downloadContractsAsync(array $args = [])
* @method \Jdcloud\Result deleteContract(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteContractAsync(array $args = [])
* @method \Jdcloud\Result saveEvidence(array $args = [])
* @method \GuzzleHttp\Promise\Promise saveEvidenceAsync(array $args = [])
* @method \Jdcloud\Result saveMultiEvidence(array $args = [])
* @method \GuzzleHttp\Promise\Promise saveMultiEvidenceAsync(array $args = [])
* @method \Jdcloud\Result getEvidence(array $args = [])
* @method \GuzzleHttp\Promise\Promise getEvidenceAsync(array $args = [])
* @method \Jdcloud\Result getMultiEvidence(array $args = [])
* @method \GuzzleHttp\Promise\Promise getMultiEvidenceAsync(array $args = [])
* @method \Jdcloud\Result getSaveReport(array $args = [])
* @method \GuzzleHttp\Promise\Promise getSaveReportAsync(array $args = [])
* @method \Jdcloud\Result describeApplyStatus(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeApplyStatusAsync(array $args = [])
* @method \Jdcloud\Result enableContractSave(array $args = [])
* @method \GuzzleHttp\Promise\Promise enableContractSaveAsync(array $args = [])
* @method \Jdcloud\Result disableContractSave(array $args = [])
* @method \GuzzleHttp\Promise\Promise disableContractSaveAsync(array $args = [])
* @method \Jdcloud\Result setKmsKeyId(array $args = [])
* @method \GuzzleHttp\Promise\Promise setKmsKeyIdAsync(array $args = [])
* @method \Jdcloud\Result describeStampList(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeStampListAsync(array $args = [])
* @method \Jdcloud\Result uploadStamp(array $args = [])
* @method \GuzzleHttp\Promise\Promise uploadStampAsync(array $args = [])
* @method \Jdcloud\Result downloadStamps(array $args = [])
* @method \GuzzleHttp\Promise\Promise downloadStampsAsync(array $args = [])
* @method \Jdcloud\Result deleteStamp(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteStampAsync(array $args = [])
* @method \Jdcloud\Result editStamp(array $args = [])
* @method \GuzzleHttp\Promise\Promise editStampAsync(array $args = [])
* @method \Jdcloud\Result describeStampHistoryList(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeStampHistoryListAsync(array $args = [])
* @method \Jdcloud\Result describeTemplateList(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeTemplateListAsync(array $args = [])
* @method \Jdcloud\Result uploadTemplate(array $args = [])
* @method \GuzzleHttp\Promise\Promise uploadTemplateAsync(array $args = [])
* @method \Jdcloud\Result downloadTemplates(array $args = [])
* @method \GuzzleHttp\Promise\Promise downloadTemplatesAsync(array $args = [])
* @method \Jdcloud\Result deleteTemplate(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteTemplateAsync(array $args = [])
* @method \Jdcloud\Result paddingTemplate(array $args = [])
* @method \GuzzleHttp\Promise\Promise paddingTemplateAsync(array $args = [])
* @method \Jdcloud\Result describeStampList(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeStampListAsync(array $args = [])
* @method \Jdcloud\Result uploadStamp(array $args = [])
* @method \GuzzleHttp\Promise\Promise uploadStampAsync(array $args = [])
* @method \Jdcloud\Result downloadStamps(array $args = [])
* @method \GuzzleHttp\Promise\Promise downloadStampsAsync(array $args = [])
* @method \Jdcloud\Result deleteStamp(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteStampAsync(array $args = [])
* @method \Jdcloud\Result describeTemplateList(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeTemplateListAsync(array $args = [])
* @method \Jdcloud\Result uploadTemplate(array $args = [])
* @method \GuzzleHttp\Promise\Promise uploadTemplateAsync(array $args = [])
* @method \Jdcloud\Result downloadTemplates(array $args = [])
* @method \GuzzleHttp\Promise\Promise downloadTemplatesAsync(array $args = [])
* @method \Jdcloud\Result paddingTemplate(array $args = [])
* @method \GuzzleHttp\Promise\Promise paddingTemplateAsync(array $args = [])
* @method \Jdcloud\Result deleteTemplate(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteTemplateAsync(array $args = [])
*/
class CloudsignClient extends JdCloudClient
{
public function __construct(array $args)
{
$args['with_resolved'] = function (array $args) {
$this->getHandlerList()->appendInit(
PresignUrlMiddleware::wrap(
$this,
$args['endpoint_provider'],
[
'operations' => [
],
'service' => 'cloudsign',
'presign_param' => 'PresignedUrl',
]
),
'cloudsign'
);
};
parent::__construct($args);
}
}

View File

@@ -0,0 +1,62 @@
<?php
namespace Jdcloud;
/**
* Jdcloud command object.
*/
class Command implements CommandInterface
{
use HasDataTrait;
/** @var string */
private $name;
/** @var HandlerList */
private $handlerList;
/**
* Accepts an associative array of command options, including:
*
* - @http: (array) Associative array of transfer options.
*
* @param string $name Name of the command
* @param array $args Arguments to pass to the command
* @param HandlerList $list Handler list
*/
public function __construct($name, array $args = [], HandlerList $list = null)
{
$this->name = $name;
$this->data = $args;
$this->handlerList = $list ?: new HandlerList();
if (!isset($this->data['@http'])) {
$this->data['@http'] = [];
}
}
public function __clone()
{
$this->handlerList = clone $this->handlerList;
}
public function getName()
{
return $this->name;
}
public function hasParam($name)
{
return array_key_exists($name, $this->data);
}
public function getHandlerList()
{
return $this->handlerList;
}
/** @deprecated */
public function get($name)
{
return $this[$name];
}
}

View File

@@ -0,0 +1,42 @@
<?php
namespace Jdcloud;
/**
* A command object encapsulates the input parameters used to control the
* creation of a HTTP request and processing of a HTTP response.
*
* Using the toArray() method will return the input parameters of the command
* as an associative array.
*/
interface CommandInterface extends \ArrayAccess, \Countable, \IteratorAggregate
{
/**
* Converts the command parameters to an array
*
* @return array
*/
public function toArray();
/**
* Get the name of the command
*
* @return string
*/
public function getName();
/**
* Check if the command has a parameter by name.
*
* @param string $name Name of the parameter to check
*
* @return bool
*/
public function hasParam($name);
/**
* Get the handler list used to transfer the command.
*
* @return HandlerList
*/
public function getHandlerList();
}

View File

@@ -0,0 +1,2 @@
2019-04-02 version: 1.0.0
1. api改造 V2

View File

@@ -0,0 +1,70 @@
<?php
/**
* Compile
*
* @category Jdcloud
* @package Jdcloud\Compile
* @author Jdcloud <jdcloud-api@jd.com>
* @license Apache-2.0 http://www.apache.org/licenses/LICENSE-2.0
* @link https://www.jdcloud.com/help/faq
*/
namespace Jdcloud\Compile;
use Jdcloud\JdCloudClient;
use Jdcloud\Api\Service;
use Jdcloud\Api\DocModel;
use Jdcloud\Api\ApiProvider;
use Jdcloud\PresignUrlMiddleware;
/**
* Client used to interact with compile.
*
* @method \Jdcloud\Result createDemo(array $args = [])
* @method \GuzzleHttp\Promise\Promise createDemoAsync(array $args = [])
* @method \Jdcloud\Result getJobs(array $args = [])
* @method \GuzzleHttp\Promise\Promise getJobsAsync(array $args = [])
* @method \Jdcloud\Result createJob(array $args = [])
* @method \GuzzleHttp\Promise\Promise createJobAsync(array $args = [])
* @method \Jdcloud\Result deleteJobs(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteJobsAsync(array $args = [])
* @method \Jdcloud\Result getJob(array $args = [])
* @method \GuzzleHttp\Promise\Promise getJobAsync(array $args = [])
* @method \Jdcloud\Result updateJob(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateJobAsync(array $args = [])
* @method \Jdcloud\Result deleteJob(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteJobAsync(array $args = [])
* @method \Jdcloud\Result startJob(array $args = [])
* @method \GuzzleHttp\Promise\Promise startJobAsync(array $args = [])
* @method \Jdcloud\Result getBuildLog(array $args = [])
* @method \GuzzleHttp\Promise\Promise getBuildLogAsync(array $args = [])
* @method \Jdcloud\Result getBuildStatus(array $args = [])
* @method \GuzzleHttp\Promise\Promise getBuildStatusAsync(array $args = [])
* @method \Jdcloud\Result getExternalLink(array $args = [])
* @method \GuzzleHttp\Promise\Promise getExternalLinkAsync(array $args = [])
* @method \Jdcloud\Result stopBuild(array $args = [])
* @method \GuzzleHttp\Promise\Promise stopBuildAsync(array $args = [])
*/
class CompileClient extends JdCloudClient
{
public function __construct(array $args)
{
$args['with_resolved'] = function (array $args) {
$this->getHandlerList()->appendInit(
PresignUrlMiddleware::wrap(
$this,
$args['endpoint_provider'],
[
'operations' => [
],
'service' => 'compile',
'presign_param' => 'PresignedUrl',
]
),
'compile'
);
};
parent::__construct($args);
}
}

View File

@@ -0,0 +1,11 @@
# 更新历史 #
API版本1.0.0
|发布时间|版本号|更新|说明|
|---|---|---|---|
|2019-02-27|1.0.1|bug 修复|* 修复已知问题|
|2018-11-22|1.0.0|接口完善|* 修复若干问题|
|2018-10-25|0.2.0|bug 修复|* 修复了一些问题|
|2018-09-20|0.1.1|接口完善|* 必传参数标注|
|2018-09-05|0.1.0|bugfix|* 调试并修复相关问题|
|2018-08-29|0.0.1|初始版本|* 初步完成所有接口|

View File

@@ -0,0 +1,76 @@
<?php
/**
* Containerregistry
*
* @category Jdcloud
* @package Jdcloud\Containerregistry
* @author Jdcloud <jdcloud-api@jd.com>
* @license Apache-2.0 http://www.apache.org/licenses/LICENSE-2.0
* @link https://www.jdcloud.com/help/faq
*/
namespace Jdcloud\Containerregistry;
use Jdcloud\JdCloudClient;
use Jdcloud\Api\Service;
use Jdcloud\Api\DocModel;
use Jdcloud\Api\ApiProvider;
use Jdcloud\PresignUrlMiddleware;
/**
* Client used to interact with containerregistry.
*
* @method \Jdcloud\Result getAuthorizationToken(array $args = [])
* @method \GuzzleHttp\Promise\Promise getAuthorizationTokenAsync(array $args = [])
* @method \Jdcloud\Result describeAuthorizationTokens(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeAuthorizationTokensAsync(array $args = [])
* @method \Jdcloud\Result releaseAuthorizationToken(array $args = [])
* @method \GuzzleHttp\Promise\Promise releaseAuthorizationTokenAsync(array $args = [])
* @method \Jdcloud\Result describeImages(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeImagesAsync(array $args = [])
* @method \Jdcloud\Result deleteImage(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteImageAsync(array $args = [])
* @method \Jdcloud\Result describeQuotas(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeQuotasAsync(array $args = [])
* @method \Jdcloud\Result describeRegistries(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeRegistriesAsync(array $args = [])
* @method \Jdcloud\Result createRegistry(array $args = [])
* @method \GuzzleHttp\Promise\Promise createRegistryAsync(array $args = [])
* @method \Jdcloud\Result describeRegistry(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeRegistryAsync(array $args = [])
* @method \Jdcloud\Result deleteRegistry(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteRegistryAsync(array $args = [])
* @method \Jdcloud\Result checkRegistryName(array $args = [])
* @method \GuzzleHttp\Promise\Promise checkRegistryNameAsync(array $args = [])
* @method \Jdcloud\Result createRepository(array $args = [])
* @method \GuzzleHttp\Promise\Promise createRepositoryAsync(array $args = [])
* @method \Jdcloud\Result describeRepositories(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeRepositoriesAsync(array $args = [])
* @method \Jdcloud\Result deleteRepository(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteRepositoryAsync(array $args = [])
* @method \Jdcloud\Result checkRepositoryName(array $args = [])
* @method \GuzzleHttp\Promise\Promise checkRepositoryNameAsync(array $args = [])
*/
class ContainerregistryClient extends JdCloudClient
{
public function __construct(array $args)
{
$args['with_resolved'] = function (array $args) {
$this->getHandlerList()->appendInit(
PresignUrlMiddleware::wrap(
$this,
$args['endpoint_provider'],
[
'operations' => [
],
'service' => 'containerregistry',
'presign_param' => 'PresignedUrl',
]
),
'containerregistry'
);
};
parent::__construct($args);
}
}

View File

@@ -0,0 +1,8 @@
# 更新历史 #
API版本0.1.0
| 发布时间 | 版本号 | 更新 | 说明 |
|------------|-------|------|---------------------------------------|
| 2018-04-23 | 0.1.0 | 初始版本 | * Cooperation Partner 基本接口 |
| 2023-12-07 | 0.2.4 | 新增接口 | * Cooperation Partner 新增接口 |
| 2023-12-07 | 0.2.5 | 变更接口 | * Cooperation Partner 变更接口, 部分接口 对外发布 |

View File

@@ -0,0 +1,68 @@
<?php
/**
* Cp
*
* @category Jdcloud
* @package Jdcloud\Cp
* @author Jdcloud <jdcloud-api@jd.com>
* @license Apache-2.0 http://www.apache.org/licenses/LICENSE-2.0
* @link https://www.jdcloud.com/help/faq
*/
namespace Jdcloud\Cp;
use Jdcloud\JdCloudClient;
use Jdcloud\Api\Service;
use Jdcloud\Api\DocModel;
use Jdcloud\Api\ApiProvider;
use Jdcloud\PresignUrlMiddleware;
/**
* Client used to interact with cp.
*
* @method \Jdcloud\Result createPartner(array $args = [])
* @method \GuzzleHttp\Promise\Promise createPartnerAsync(array $args = [])
* @method \Jdcloud\Result usercpcheck(array $args = [])
* @method \GuzzleHttp\Promise\Promise usercpcheckAsync(array $args = [])
* @method \Jdcloud\Result setUserGrace(array $args = [])
* @method \GuzzleHttp\Promise\Promise setUserGraceAsync(array $args = [])
* @method \Jdcloud\Result getUserGrace(array $args = [])
* @method \GuzzleHttp\Promise\Promise getUserGraceAsync(array $args = [])
* @method \Jdcloud\Result partnerToken(array $args = [])
* @method \GuzzleHttp\Promise\Promise partnerTokenAsync(array $args = [])
* @method \Jdcloud\Result partnerStsToken(array $args = [])
* @method \GuzzleHttp\Promise\Promise partnerStsTokenAsync(array $args = [])
* @method \Jdcloud\Result checkUser(array $args = [])
* @method \GuzzleHttp\Promise\Promise checkUserAsync(array $args = [])
* @method \Jdcloud\Result sendVerificationCode(array $args = [])
* @method \GuzzleHttp\Promise\Promise sendVerificationCodeAsync(array $args = [])
* @method \Jdcloud\Result createUser(array $args = [])
* @method \GuzzleHttp\Promise\Promise createUserAsync(array $args = [])
* @method \Jdcloud\Result listPartnerUsers(array $args = [])
* @method \GuzzleHttp\Promise\Promise listPartnerUsersAsync(array $args = [])
* @method \Jdcloud\Result createUserAuth(array $args = [])
* @method \GuzzleHttp\Promise\Promise createUserAuthAsync(array $args = [])
*/
class CpClient extends JdCloudClient
{
public function __construct(array $args)
{
$args['with_resolved'] = function (array $args) {
$this->getHandlerList()->appendInit(
PresignUrlMiddleware::wrap(
$this,
$args['endpoint_provider'],
[
'operations' => [
],
'service' => 'cp',
'presign_param' => 'PresignedUrl',
]
),
'cp'
);
};
parent::__construct($args);
}
}

View File

@@ -0,0 +1,24 @@
# 更新历史 #
API版本2.4.3
|发布时间|版本号|更新|说明|
|---|---|---|---|
|2021-01-07|2.4.3|接口变更|* 增加EIP和SLB资源标签接口<br> *实例批量开关机<br> *查询云物理服务器监控报警日志信息<br>
|2021-01-07|2.4.2|接口变更|* 创建EIP时校验资源是否可以打标<br> * 创建负载均衡实例时校验资源是否可以打标<br> * 物理机添加批量开机、关机、重启操作接口<br>
|2020-12-30|2.4.1|接口变更|* 创建物理机时支持设置IPV6地址<br> * 创建物理机支持双网口模式<br> * 物理机支持添加别名IP<br> * 私有网络支持开通IPv6网关<br> * 子网支持IPV6网段<br> * 子网支持添加次要CIDR网段|
|2020-05-06|2.3.0|接口变更|* 支持创建实例时添加标签|
|2019-11-29|2.2.1|文档完善|* 整理文档,完善描述|
|2019-08-26|2.2.0|新增接口|* 添加秘钥对相关接口<br> * 支持创建物理机和重装物理机ssh登录|
|2019-08-05|2.1.1|接口变更|* 支持创建物理机时添加可执行脚本<br> * 支持服务随机生成物理机密码|
|2019-08-05|2.1.0|新增接口|* 增加负载均衡相关接口<br> * 增加路由表相关接口<br> * 查询弹性公网IP相关接口instanceType增加返回类型cpslb|
|2019-05-17|2.0.0|新增SDN相关接口|* 增加弹性公网IP相关接口<br> * 增加私有网络相关接口<br> * 查询云物理服务器实例类型接口返回磁盘信息<br> * 完善接口文档|
|2019-03-07|1.1.2|文档完善|* 完善文档描述|
|2019-02-26|1.1.1|接口变更|* 查询云物理服务器地域列表增加网络类型参数|
|2019-02-26|1.1.0|新增接口|* 创建云物理服务器支持vpc网络类型|
|2019-02-26|1.1.0|新增接口|* 增加vpc相关接口|
|2019-01-17|1.0.4|接口变更|* 查询云物理服务器实例类型添加请求参数az<br> * 创建云物理服务器删除softwares参数<br> * 重装云物理服务器删除softwares参数|
|2019-01-17|1.0.3|接口变更|* 创建与重装实例不再支持安装应用软件|
|2018-11-27|1.0.2|接口变更|* 创建实例添加hostname支持<br> * 新增设备规格系列分组|
|2018-11-20|1.0.1|接口变更|* 创建实例添加ipv6支持|
|2018-08-10|1.0.0|初始版本|* 云物理服务器基本操作接口|

View File

@@ -0,0 +1,2 @@
2018-08-10 version: 1.0.0
1. 初始版本,云物理主机基本操作接口

View File

@@ -0,0 +1,236 @@
<?php
/**
* Cps
*
* @category Jdcloud
* @package Jdcloud\Cps
* @author Jdcloud <jdcloud-api@jd.com>
* @license Apache-2.0 http://www.apache.org/licenses/LICENSE-2.0
* @link https://www.jdcloud.com/help/faq
*/
namespace Jdcloud\Cps;
use Jdcloud\JdCloudClient;
use Jdcloud\Api\Service;
use Jdcloud\Api\DocModel;
use Jdcloud\Api\ApiProvider;
use Jdcloud\PresignUrlMiddleware;
/**
* Client used to interact with cps.
*
* @method \Jdcloud\Result describeAliasIps(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeAliasIpsAsync(array $args = [])
* @method \Jdcloud\Result createAliasIp(array $args = [])
* @method \GuzzleHttp\Promise\Promise createAliasIpAsync(array $args = [])
* @method \Jdcloud\Result deleteAliasIp(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteAliasIpAsync(array $args = [])
* @method \Jdcloud\Result describeCerts(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeCertsAsync(array $args = [])
* @method \Jdcloud\Result createCert(array $args = [])
* @method \GuzzleHttp\Promise\Promise createCertAsync(array $args = [])
* @method \Jdcloud\Result describeCert(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeCertAsync(array $args = [])
* @method \Jdcloud\Result removeCert(array $args = [])
* @method \GuzzleHttp\Promise\Promise removeCertAsync(array $args = [])
* @method \Jdcloud\Result modifyCert(array $args = [])
* @method \GuzzleHttp\Promise\Promise modifyCertAsync(array $args = [])
* @method \Jdcloud\Result describeElasticIps(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeElasticIpsAsync(array $args = [])
* @method \Jdcloud\Result applyElasticIps(array $args = [])
* @method \GuzzleHttp\Promise\Promise applyElasticIpsAsync(array $args = [])
* @method \Jdcloud\Result describeElasticIp(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeElasticIpAsync(array $args = [])
* @method \Jdcloud\Result modifyElasticIpBandwidth(array $args = [])
* @method \GuzzleHttp\Promise\Promise modifyElasticIpBandwidthAsync(array $args = [])
* @method \Jdcloud\Result describeElasticIpName(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeElasticIpNameAsync(array $args = [])
* @method \Jdcloud\Result describeDeviceTypes(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeDeviceTypesAsync(array $args = [])
* @method \Jdcloud\Result describeOS(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeOSAsync(array $args = [])
* @method \Jdcloud\Result describeDeviceRaids(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeDeviceRaidsAsync(array $args = [])
* @method \Jdcloud\Result describeInstance(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeInstanceAsync(array $args = [])
* @method \Jdcloud\Result describeInstances(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeInstancesAsync(array $args = [])
* @method \Jdcloud\Result createInstances(array $args = [])
* @method \GuzzleHttp\Promise\Promise createInstancesAsync(array $args = [])
* @method \Jdcloud\Result describeInstanceName(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeInstanceNameAsync(array $args = [])
* @method \Jdcloud\Result assignIpv6Address(array $args = [])
* @method \GuzzleHttp\Promise\Promise assignIpv6AddressAsync(array $args = [])
* @method \Jdcloud\Result modifyInstance(array $args = [])
* @method \GuzzleHttp\Promise\Promise modifyInstanceAsync(array $args = [])
* @method \Jdcloud\Result describeInstanceRaid(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeInstanceRaidAsync(array $args = [])
* @method \Jdcloud\Result describeInstanceStatus(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeInstanceStatusAsync(array $args = [])
* @method \Jdcloud\Result restartInstance(array $args = [])
* @method \GuzzleHttp\Promise\Promise restartInstanceAsync(array $args = [])
* @method \Jdcloud\Result stopInstance(array $args = [])
* @method \GuzzleHttp\Promise\Promise stopInstanceAsync(array $args = [])
* @method \Jdcloud\Result startInstance(array $args = [])
* @method \GuzzleHttp\Promise\Promise startInstanceAsync(array $args = [])
* @method \Jdcloud\Result restartInstances(array $args = [])
* @method \GuzzleHttp\Promise\Promise restartInstancesAsync(array $args = [])
* @method \Jdcloud\Result stopInstances(array $args = [])
* @method \GuzzleHttp\Promise\Promise stopInstancesAsync(array $args = [])
* @method \Jdcloud\Result startInstances(array $args = [])
* @method \GuzzleHttp\Promise\Promise startInstancesAsync(array $args = [])
* @method \Jdcloud\Result reinstallInstance(array $args = [])
* @method \GuzzleHttp\Promise\Promise reinstallInstanceAsync(array $args = [])
* @method \Jdcloud\Result modifyBandwidth(array $args = [])
* @method \GuzzleHttp\Promise\Promise modifyBandwidthAsync(array $args = [])
* @method \Jdcloud\Result associateElasticIp(array $args = [])
* @method \GuzzleHttp\Promise\Promise associateElasticIpAsync(array $args = [])
* @method \Jdcloud\Result disassociateElasticIp(array $args = [])
* @method \GuzzleHttp\Promise\Promise disassociateElasticIpAsync(array $args = [])
* @method \Jdcloud\Result resetPassword(array $args = [])
* @method \GuzzleHttp\Promise\Promise resetPasswordAsync(array $args = [])
* @method \Jdcloud\Result describeAvailablePrivateIp(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeAvailablePrivateIpAsync(array $args = [])
* @method \Jdcloud\Result describeInstanceMonitorInfo(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeInstanceMonitorInfoAsync(array $args = [])
* @method \Jdcloud\Result describeEventLogs(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeEventLogsAsync(array $args = [])
* @method \Jdcloud\Result describeIpv6Address(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeIpv6AddressAsync(array $args = [])
* @method \Jdcloud\Result describeIpv6Addresses(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeIpv6AddressesAsync(array $args = [])
* @method \Jdcloud\Result assignIpv6AddressesBandwidth(array $args = [])
* @method \GuzzleHttp\Promise\Promise assignIpv6AddressesBandwidthAsync(array $args = [])
* @method \Jdcloud\Result modifyIpv6AddressBandwidth(array $args = [])
* @method \GuzzleHttp\Promise\Promise modifyIpv6AddressBandwidthAsync(array $args = [])
* @method \Jdcloud\Result describeIpv6Gateways(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeIpv6GatewaysAsync(array $args = [])
* @method \Jdcloud\Result describeIpv6Gateway(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeIpv6GatewayAsync(array $args = [])
* @method \Jdcloud\Result modifyIpv6Gateway(array $args = [])
* @method \GuzzleHttp\Promise\Promise modifyIpv6GatewayAsync(array $args = [])
* @method \Jdcloud\Result describeKeypairs(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeKeypairsAsync(array $args = [])
* @method \Jdcloud\Result createKeypairs(array $args = [])
* @method \GuzzleHttp\Promise\Promise createKeypairsAsync(array $args = [])
* @method \Jdcloud\Result importKeypairs(array $args = [])
* @method \GuzzleHttp\Promise\Promise importKeypairsAsync(array $args = [])
* @method \Jdcloud\Result describeKeypair(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeKeypairAsync(array $args = [])
* @method \Jdcloud\Result deleteKeypairs(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteKeypairsAsync(array $args = [])
* @method \Jdcloud\Result describeListeners(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeListenersAsync(array $args = [])
* @method \Jdcloud\Result createListener(array $args = [])
* @method \GuzzleHttp\Promise\Promise createListenerAsync(array $args = [])
* @method \Jdcloud\Result modifyListener(array $args = [])
* @method \GuzzleHttp\Promise\Promise modifyListenerAsync(array $args = [])
* @method \Jdcloud\Result describeListener(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeListenerAsync(array $args = [])
* @method \Jdcloud\Result deleteListener(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteListenerAsync(array $args = [])
* @method \Jdcloud\Result startListener(array $args = [])
* @method \GuzzleHttp\Promise\Promise startListenerAsync(array $args = [])
* @method \Jdcloud\Result stopListener(array $args = [])
* @method \GuzzleHttp\Promise\Promise stopListenerAsync(array $args = [])
* @method \Jdcloud\Result describeLoadBalancers(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeLoadBalancersAsync(array $args = [])
* @method \Jdcloud\Result createLoadBalancer(array $args = [])
* @method \GuzzleHttp\Promise\Promise createLoadBalancerAsync(array $args = [])
* @method \Jdcloud\Result modifyLoadBalancer(array $args = [])
* @method \GuzzleHttp\Promise\Promise modifyLoadBalancerAsync(array $args = [])
* @method \Jdcloud\Result describeLoadBalancer(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeLoadBalancerAsync(array $args = [])
* @method \Jdcloud\Result startLoadBalancer(array $args = [])
* @method \GuzzleHttp\Promise\Promise startLoadBalancerAsync(array $args = [])
* @method \Jdcloud\Result stopLoadBalancer(array $args = [])
* @method \GuzzleHttp\Promise\Promise stopLoadBalancerAsync(array $args = [])
* @method \Jdcloud\Result associateElasticIpLB(array $args = [])
* @method \GuzzleHttp\Promise\Promise associateElasticIpLBAsync(array $args = [])
* @method \Jdcloud\Result disassociateElasticIpLB(array $args = [])
* @method \GuzzleHttp\Promise\Promise disassociateElasticIpLBAsync(array $args = [])
* @method \Jdcloud\Result describeSlbsName(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeSlbsNameAsync(array $args = [])
* @method \Jdcloud\Result describeRegiones(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeRegionesAsync(array $args = [])
* @method \Jdcloud\Result describeCPSLBRegions(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeCPSLBRegionsAsync(array $args = [])
* @method \Jdcloud\Result describeRouteTable(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeRouteTableAsync(array $args = [])
* @method \Jdcloud\Result describeRouteTables(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeRouteTablesAsync(array $args = [])
* @method \Jdcloud\Result describeSecondaryCidrs(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeSecondaryCidrsAsync(array $args = [])
* @method \Jdcloud\Result createSecondaryCidr(array $args = [])
* @method \GuzzleHttp\Promise\Promise createSecondaryCidrAsync(array $args = [])
* @method \Jdcloud\Result deleteSecondaryCidr(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteSecondaryCidrAsync(array $args = [])
* @method \Jdcloud\Result describeServers(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeServersAsync(array $args = [])
* @method \Jdcloud\Result addServers(array $args = [])
* @method \GuzzleHttp\Promise\Promise addServersAsync(array $args = [])
* @method \Jdcloud\Result modifyServer(array $args = [])
* @method \GuzzleHttp\Promise\Promise modifyServerAsync(array $args = [])
* @method \Jdcloud\Result removeServer(array $args = [])
* @method \GuzzleHttp\Promise\Promise removeServerAsync(array $args = [])
* @method \Jdcloud\Result describeServerGroups(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeServerGroupsAsync(array $args = [])
* @method \Jdcloud\Result createServerGroup(array $args = [])
* @method \GuzzleHttp\Promise\Promise createServerGroupAsync(array $args = [])
* @method \Jdcloud\Result describeServerGroup(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeServerGroupAsync(array $args = [])
* @method \Jdcloud\Result modifyServerGroup(array $args = [])
* @method \GuzzleHttp\Promise\Promise modifyServerGroupAsync(array $args = [])
* @method \Jdcloud\Result deleteServerGroup(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteServerGroupAsync(array $args = [])
* @method \Jdcloud\Result describeBasicSubnet(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeBasicSubnetAsync(array $args = [])
* @method \Jdcloud\Result describeSubnets(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeSubnetsAsync(array $args = [])
* @method \Jdcloud\Result createSubnet(array $args = [])
* @method \GuzzleHttp\Promise\Promise createSubnetAsync(array $args = [])
* @method \Jdcloud\Result assignIpv6Cidr(array $args = [])
* @method \GuzzleHttp\Promise\Promise assignIpv6CidrAsync(array $args = [])
* @method \Jdcloud\Result describeSubnet(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeSubnetAsync(array $args = [])
* @method \Jdcloud\Result modifySubnet(array $args = [])
* @method \GuzzleHttp\Promise\Promise modifySubnetAsync(array $args = [])
* @method \Jdcloud\Result deleteSubnet(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteSubnetAsync(array $args = [])
* @method \Jdcloud\Result describeVpc(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeVpcAsync(array $args = [])
* @method \Jdcloud\Result modifyVpc(array $args = [])
* @method \GuzzleHttp\Promise\Promise modifyVpcAsync(array $args = [])
* @method \Jdcloud\Result deleteVpc(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteVpcAsync(array $args = [])
* @method \Jdcloud\Result describeVpcs(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeVpcsAsync(array $args = [])
* @method \Jdcloud\Result createVpc(array $args = [])
* @method \GuzzleHttp\Promise\Promise createVpcAsync(array $args = [])
* @method \Jdcloud\Result assignIpv6Gateway(array $args = [])
* @method \GuzzleHttp\Promise\Promise assignIpv6GatewayAsync(array $args = [])
*/
class CpsClient extends JdCloudClient
{
public function __construct(array $args)
{
$args['with_resolved'] = function (array $args) {
$this->getHandlerList()->appendInit(
PresignUrlMiddleware::wrap(
$this,
$args['endpoint_provider'],
[
'operations' => [
],
'service' => 'cps',
'presign_param' => 'PresignedUrl',
]
),
'cps'
);
};
parent::__construct($args);
}
}

View File

@@ -0,0 +1,9 @@
# 更新历史 #
API版本0.0.1
|发布时间|版本号|更新|说明|
|---|---|---|---|
|2018-10-25|0.2.0|bug 修复|* 修复了一些问题|
|2018-09-20|0.1.1|接口完善|* 必传参数标注|
|2018-09-05|0.1.0|bugfix|* 调试并修复相关问题|
|2018-08-29|0.0.1|初始版本|* 初步完成所有接口|

View File

@@ -0,0 +1,76 @@
<?php
/**
* Cr
*
* @category Jdcloud
* @package Jdcloud\Cr
* @author Jdcloud <jdcloud-api@jd.com>
* @license Apache-2.0 http://www.apache.org/licenses/LICENSE-2.0
* @link https://www.jdcloud.com/help/faq
*/
namespace Jdcloud\Cr;
use Jdcloud\JdCloudClient;
use Jdcloud\Api\Service;
use Jdcloud\Api\DocModel;
use Jdcloud\Api\ApiProvider;
use Jdcloud\PresignUrlMiddleware;
/**
* Client used to interact with cr.
*
* @method \Jdcloud\Result getAuthorizationToken(array $args = [])
* @method \GuzzleHttp\Promise\Promise getAuthorizationTokenAsync(array $args = [])
* @method \Jdcloud\Result describeAuthorizationTokens(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeAuthorizationTokensAsync(array $args = [])
* @method \Jdcloud\Result releaseAuthorizationToken(array $args = [])
* @method \GuzzleHttp\Promise\Promise releaseAuthorizationTokenAsync(array $args = [])
* @method \Jdcloud\Result describeImages(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeImagesAsync(array $args = [])
* @method \Jdcloud\Result deleteImage(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteImageAsync(array $args = [])
* @method \Jdcloud\Result describeQuotas(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeQuotasAsync(array $args = [])
* @method \Jdcloud\Result describeRegistries(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeRegistriesAsync(array $args = [])
* @method \Jdcloud\Result createRegistry(array $args = [])
* @method \GuzzleHttp\Promise\Promise createRegistryAsync(array $args = [])
* @method \Jdcloud\Result describeRegistry(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeRegistryAsync(array $args = [])
* @method \Jdcloud\Result deleteRegistry(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteRegistryAsync(array $args = [])
* @method \Jdcloud\Result checkRegistryName(array $args = [])
* @method \GuzzleHttp\Promise\Promise checkRegistryNameAsync(array $args = [])
* @method \Jdcloud\Result createRepository(array $args = [])
* @method \GuzzleHttp\Promise\Promise createRepositoryAsync(array $args = [])
* @method \Jdcloud\Result describeRepositories(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeRepositoriesAsync(array $args = [])
* @method \Jdcloud\Result deleteRepository(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteRepositoryAsync(array $args = [])
* @method \Jdcloud\Result checkRepositoryName(array $args = [])
* @method \GuzzleHttp\Promise\Promise checkRepositoryNameAsync(array $args = [])
*/
class CrClient extends JdCloudClient
{
public function __construct(array $args)
{
$args['with_resolved'] = function (array $args) {
$this->getHandlerList()->appendInit(
PresignUrlMiddleware::wrap(
$this,
$args['endpoint_provider'],
[
'operations' => [
],
'service' => 'cr',
'presign_param' => 'PresignedUrl',
]
),
'cr'
);
};
parent::__construct($args);
}
}

View File

@@ -0,0 +1,377 @@
<?php
namespace Jdcloud\Credentials;
use Jdcloud;
use Jdcloud\CacheInterface;
use Jdcloud\Exception\CredentialsException;
use GuzzleHttp\Promise;
/**
* Credential providers are functions that accept no arguments and return a
* promise that is fulfilled with an {@see \Jdcloud\Credentials\CredentialsInterface}
* or rejected with an {@see \Jdcloud\Exception\CredentialsException}.
*
* <code>
* use Jdcloud\Credentials\CredentialProvider;
* $provider = CredentialProvider::defaultProvider();
* // Returns a CredentialsInterface or throws.
* $creds = $provider()->wait();
* </code>
*
* Credential providers can be composed to create credentials using conditional
* logic that can create different credentials in different environments. You
* can compose multiple providers into a single provider using
* {@see Jdcloud\Credentials\CredentialProvider::chain}. This function accepts
* providers as variadic arguments and returns a new function that will invoke
* each provider until a successful set of credentials is returned.
*
* <code>
* // First try an INI file at this location.
* $a = CredentialProvider::ini(null, '/path/to/file.ini');
* // Then try an INI file at this location.
* $b = CredentialProvider::ini(null, '/path/to/other-file.ini');
* // Then try loading from environment variables.
* $c = CredentialProvider::env();
* // Combine the three providers together.
* $composed = CredentialProvider::chain($a, $b, $c);
* // Returns a promise that is fulfilled with credentials or throws.
* $promise = $composed();
* // Wait on the credentials to resolve.
* $creds = $promise->wait();
* </code>
*/
class CredentialProvider
{
const ENV_KEY = 'JDCLOUD_ACCESS_KEY_ID';
const ENV_SECRET = 'JDCLOUD_SECRET_ACCESS_KEY';
const ENV_SESSION = 'JDCLOUD_SESSION_TOKEN';
const ENV_PROFILE = 'JDCLOUD_PROFILE';
/**
* Create a default credential provider that first checks for environment
* variables.
*
* This provider is automatically wrapped in a memoize function that caches
* previously provided credentials.
*
* @param array $config Optional array of ecs/instance profile credentials
* provider options.
*
* @return callable
*/
public static function defaultProvider(array $config = [])
{
$localCredentialProviders = self::localCredentialProviders();
$remoteCredentialProviders = self::remoteCredentialProviders($config);
return self::memoize(
call_user_func_array(
'self::chain',
array_merge($localCredentialProviders, $remoteCredentialProviders)
)
);
}
/**
* Create a credential provider function from a set of static credentials.
*
* @param CredentialsInterface $creds
*
* @return callable
*/
public static function fromCredentials(CredentialsInterface $creds)
{
$promise = Promise\promise_for($creds);
return function () use ($promise) {
return $promise;
};
}
/**
* Creates an aggregate credentials provider that invokes the provided
* variadic providers one after the other until a provider returns
* credentials.
*
* @return callable
*/
public static function chain()
{
$links = func_get_args();
if (empty($links)) {
throw new \InvalidArgumentException('No providers in chain');
}
return function () use ($links) {
/** @var callable $parent */
$parent = array_shift($links);
$promise = $parent();
while ($next = array_shift($links)) {
$promise = $promise->otherwise($next);
}
return $promise;
};
}
/**
* Wraps a credential provider and caches previously provided credentials.
*
* Ensures that cached credentials are refreshed when they expire.
*
* @param callable $provider Credentials provider function to wrap.
*
* @return callable
*/
public static function memoize(callable $provider)
{
return function () use ($provider) {
static $result;
static $isConstant;
// Constant credentials will be returned constantly.
if ($isConstant) {
return $result;
}
// Create the initial promise that will be used as the cached value
// until it expires.
if (null === $result) {
$result = $provider();
}
// Return credentials that could expire and refresh when needed.
return $result
->then(function (CredentialsInterface $creds) use ($provider, &$isConstant, &$result) {
// Determine if these are constant credentials.
if (!$creds->getExpiration()) {
$isConstant = true;
return $creds;
}
// Refresh expired credentials.
if (!$creds->isExpired()) {
return $creds;
}
// Refresh the result and forward the promise.
return $result = $provider();
});
};
}
/**
* Wraps a credential provider and saves provided credentials in an
* instance of Jdcloud\CacheInterface. Forwards calls when no credentials found
* in cache and updates cache with the results.
*
* Defaults to using a simple file-based cache when none provided.
*
* @param callable $provider Credentials provider function to wrap
* @param CacheInterface $cache Cache to store credentials
* @param string|null $cacheKey (optional) Cache key to use
*
* @return callable
*/
public static function cache(
callable $provider,
CacheInterface $cache,
$cacheKey = null
) {
$cacheKey = $cacheKey ?: 'jdcloud_cached_credentials';
return function () use ($provider, $cache, $cacheKey) {
$found = $cache->get($cacheKey);
if ($found instanceof CredentialsInterface && !$found->isExpired()) {
return Promise\promise_for($found);
}
return $provider()
->then(function (CredentialsInterface $creds) use (
$cache,
$cacheKey
) {
$cache->set(
$cacheKey,
$creds,
null === $creds->getExpiration() ?
0 : $creds->getExpiration() - time()
);
return $creds;
});
};
}
/**
* Provider that creates credentials from environment variables
* JDCLOUD_ACCESS_KEY_ID, JDCLOUD_SECRET_ACCESS_KEY, and JDCLOUD_SESSION_TOKEN.
*
* @return callable
*/
public static function env()
{
return function () {
// Use credentials from environment variables, if available
$key = getenv(self::ENV_KEY);
$secret = getenv(self::ENV_SECRET);
if ($key && $secret) {
return Promise\promise_for(
new Credentials($key, $secret, getenv(self::ENV_SESSION) ?: NULL)
);
}
return self::reject('Could not find environment variable '
. 'credentials in ' . self::ENV_KEY . '/' . self::ENV_SECRET);
};
}
/**
* Credential provider that creates credentials using instance profile
* credentials.
*
* @param array $config Array of configuration data.
*
* @return InstanceProfileProvider
* @see Jdcloud\Credentials\InstanceProfileProvider for $config details.
*/
public static function instanceProfile(array $config = [])
{
return new InstanceProfileProvider($config);
}
/**
* Credential provider that creates credentials using assume role
*
* @param array $config Array of configuration data
* @return callable
* @see Jdcloud\Credentials\AssumeRoleCredentialProvider for $config details.
*/
public static function assumeRole(array $config=[])
{
return new AssumeRoleCredentialProvider($config);
}
/**
* Credentials provider that creates credentials using an ini file stored
* in the current user's home directory.
*
* @param string|null $profile Profile to use. If not specified will use
* the "default" profile in "~/.jdcloud/credentials".
* @param string|null $filename If provided, uses a custom filename rather
* than looking in the home directory.
*
* @return callable
*/
public static function ini($profile = null, $filename = null)
{
$filename = $filename ?: (self::getHomeDir() . '/.jdcloud/credentials');
$profile = $profile ?: (getenv(self::ENV_PROFILE) ?: 'default');
return function () use ($profile, $filename) {
if (!is_readable($filename)) {
return self::reject("Cannot read credentials from $filename");
}
$data = parse_ini_file($filename, true);
if ($data === false) {
return self::reject("Invalid credentials file: $filename");
}
if (!isset($data[$profile])) {
return self::reject("'$profile' not found in credentials file");
}
if (!isset($data[$profile]['jdcloud_access_key_id'])
|| !isset($data[$profile]['jdcloud_secret_access_key'])
) {
return self::reject("No credentials present in INI profile "
. "'$profile' ($filename)");
}
if (empty($data[$profile]['jdcloud_session_token'])) {
$data[$profile]['jdcloud_session_token']
= isset($data[$profile]['jdcloud_security_token'])
? $data[$profile]['jdcloud_security_token']
: null;
}
return Promise\promise_for(
new Credentials(
$data[$profile]['jdcloud_access_key_id'],
$data[$profile]['jdcloud_secret_access_key'],
$data[$profile]['jdcloud_session_token']
)
);
};
}
/**
* Local credential providers returns a list of local credential providers
* in following order:
* - credentials from environment variables
* - 'default' profile in '.jdcloud/credentials' file
* - 'profile default' profile in '.jdcloud/config' file
*
* @return array
*/
private static function localCredentialProviders()
{
return [
self::env(),
self::ini(),
self::ini('profile default', self::getHomeDir() . '/.jdcloud/config')
];
}
/**
* Remote credential providers returns a list of credentials providers
* for the remote endpoints such as EC2 or ECS Roles.
*
* @param array $config Array of configuration data.
*
* @return array
* @see Jdcloud\Credentials\InstanceProfileProvider for $config details.
* @see Jdcloud\Credentials\EcsCredentialProvider for $config details.
*/
private static function remoteCredentialProviders(array $config = [])
{
if (!empty(getenv(EcsCredentialProvider::ENV_URI))) {
$providers['ecs'] = self::ecsCredentials($config);
}
$providers['instance'] = self::instanceProfile($config);
if (isset($config['credentials'])
&& $config['credentials'] instanceof CacheInterface
) {
foreach ($providers as $key => $provider) {
$providers[$key] = self::cache(
$provider,
$config['credentials'],
'jdcloud_cached_' . $key . '_credentials'
);
}
}
return $providers;
}
/**
* Gets the environment's HOME directory if available.
*
* @return null|string
*/
private static function getHomeDir()
{
// On Linux/Unix-like systems, use the HOME environment variable
if ($homeDir = getenv('HOME')) {
return $homeDir;
}
// Get the HOMEDRIVE and HOMEPATH values for Windows hosts
$homeDrive = getenv('HOMEDRIVE');
$homePath = getenv('HOMEPATH');
return ($homeDrive && $homePath) ? $homeDrive . $homePath : null;
}
private static function reject($msg)
{
return new Promise\RejectedPromise(new CredentialsException($msg));
}
}

View File

@@ -0,0 +1,91 @@
<?php
namespace Jdcloud\Credentials;
/**
* Basic implementation of the AWS Credentials interface that allows callers to
* pass in the AWS Access Key and AWS Secret Access Key in the constructor.
*/
class Credentials implements CredentialsInterface, \Serializable
{
private $key;
private $secret;
private $token;
private $expires;
/**
* Constructs a new BasicAWSCredentials object, with the specified AWS
* access key and AWS secret key
*
* @param string $key AWS access key ID
* @param string $secret AWS secret access key
* @param string $token Security token to use
* @param int $expires UNIX timestamp for when credentials expire
*/
public function __construct($key, $secret, $token = null, $expires = null)
{
$this->key = trim($key);
$this->secret = trim($secret);
$this->token = $token;
$this->expires = $expires;
}
public static function __set_state(array $state)
{
return new self(
$state['key'],
$state['secret'],
$state['token'],
$state['expires']
);
}
public function getAccessKeyId()
{
return $this->key;
}
public function getSecretKey()
{
return $this->secret;
}
public function getSecurityToken()
{
return $this->token;
}
public function getExpiration()
{
return $this->expires;
}
public function isExpired()
{
return $this->expires !== null && time() >= $this->expires;
}
public function toArray()
{
return [
'key' => $this->key,
'secret' => $this->secret,
'token' => $this->token,
'expires' => $this->expires
];
}
public function serialize()
{
return json_encode($this->toArray());
}
public function unserialize($serialized)
{
$data = json_decode($serialized, true);
$this->key = $data['key'];
$this->secret = $data['secret'];
$this->token = $data['token'];
$this->expires = $data['expires'];
}
}

View File

@@ -0,0 +1,52 @@
<?php
namespace Jdcloud\Credentials;
/**
* Provides access to the AWS credentials used for accessing AWS services: AWS
* access key ID, secret access key, and security token. These credentials are
* used to securely sign requests to AWS services.
*/
interface CredentialsInterface
{
/**
* Returns the AWS access key ID for this credentials object.
*
* @return string
*/
public function getAccessKeyId();
/**
* Returns the AWS secret access key for this credentials object.
*
* @return string
*/
public function getSecretKey();
/**
* Get the associated security token if available
*
* @return string|null
*/
public function getSecurityToken();
/**
* Get the UNIX timestamp in which the credentials will expire
*
* @return int|null
*/
public function getExpiration();
/**
* Check if the credentials are expired
*
* @return bool
*/
public function isExpired();
/**
* Converts the credentials to an associative array.
*
* @return array
*/
public function toArray();
}

Some files were not shown because too many files have changed in this diff Show More