更新
This commit is contained in:
18
vendor/alibabacloud/credentials/CHANGELOG.md
vendored
Normal file
18
vendor/alibabacloud/credentials/CHANGELOG.md
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
# CHANGELOG
|
||||
|
||||
## 1.2.0 - 2024-10-17
|
||||
|
||||
- Refactor all credentials providers.
|
||||
|
||||
## 1.1.3 - 2020-12-24
|
||||
|
||||
- Require guzzle ^6.3|^7.0
|
||||
|
||||
## 1.0.2 - 2020-02-14
|
||||
- Update Tea.
|
||||
|
||||
## 1.0.1 - 2019-12-30
|
||||
- Supported get `Role Name` automatically.
|
||||
|
||||
## 1.0.0 - 2019-09-01
|
||||
- Initial release of the Alibaba Cloud Credentials for PHP Version 1.0.0 on Packagist See <https://github.com/aliyun/credentials-php> for more information.
|
||||
30
vendor/alibabacloud/credentials/CONTRIBUTING.md
vendored
Normal file
30
vendor/alibabacloud/credentials/CONTRIBUTING.md
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
# CONTRIBUTING
|
||||
|
||||
We work hard to provide a high-quality and useful SDK for Alibaba Cloud, and
|
||||
we greatly value feedback and contributions from our community. Please submit
|
||||
your [issues][issues] or [pull requests][pull-requests] through GitHub.
|
||||
|
||||
## Tips
|
||||
|
||||
- The SDK is released under the [Apache license][license]. Any code you submit
|
||||
will be released under that license. For substantial contributions, we may
|
||||
ask you to sign a [Alibaba Documentation Corporate Contributor License
|
||||
Agreement (CLA)][cla].
|
||||
- We follow all of the relevant PSR recommendations from the [PHP Framework
|
||||
Interop Group][php-fig]. Please submit code that follows these standards.
|
||||
The [PHP CS Fixer][cs-fixer] tool can be helpful for formatting your code.
|
||||
Your can use `composer fixer` to fix code.
|
||||
- We maintain a high percentage of code coverage in our unit tests. If you make
|
||||
changes to the code, please add, update, and/or remove tests as appropriate.
|
||||
- If your code does not conform to the PSR standards, does not include adequate
|
||||
tests, or does not contain a changelog document, we may ask you to update
|
||||
your pull requests before we accept them. We also reserve the right to deny
|
||||
any pull requests that do not align with our standards or goals.
|
||||
|
||||
[issues]: https://github.com/aliyun/credentials-php/issues
|
||||
[pull-requests]: https://github.com/aliyun/credentials-php/pulls
|
||||
[license]: http://www.apache.org/licenses/LICENSE-2.0
|
||||
[cla]: https://alibaba-cla-2018.oss-cn-beijing.aliyuncs.com/Alibaba_Documentation_Open_Source_Corporate_CLA.pdf
|
||||
[php-fig]: http://php-fig.org
|
||||
[cs-fixer]: http://cs.sensiolabs.org/
|
||||
[docs-readme]: https://github.com/aliyun/credentials-php/blob/master/README.md
|
||||
13
vendor/alibabacloud/credentials/LICENSE.md
vendored
Normal file
13
vendor/alibabacloud/credentials/LICENSE.md
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
Copyright (c) 2009-present, Alibaba Cloud All rights reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
88
vendor/alibabacloud/credentials/NOTICE.md
vendored
Normal file
88
vendor/alibabacloud/credentials/NOTICE.md
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
# NOTICE
|
||||
|
||||
<https://www.alibabacloud.com/>
|
||||
|
||||
Copyright (c) 2009-present, Alibaba Cloud All rights reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License").
|
||||
You may not use this file except in compliance with the License.
|
||||
A copy of the License is located at
|
||||
|
||||
<http://www.apache.org/licenses/LICENSE-2.0>
|
||||
|
||||
or in the "license" file accompanying this file. This file is distributed
|
||||
on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
express or implied. See the License for the specific language governing
|
||||
permissions and limitations under the License.
|
||||
|
||||
# Guzzle
|
||||
|
||||
<https://github.com/guzzle/guzzle>
|
||||
|
||||
Copyright (c) 2011-2018 Michael Dowling, https://github.com/mtdowling <mtdowling@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
# jmespath.php
|
||||
|
||||
<https://github.com/mtdowling/jmespath.php>
|
||||
|
||||
Copyright (c) 2014 Michael Dowling, https://github.com/mtdowling
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
# Dot
|
||||
|
||||
<https://github.com/adbario/php-dot-notation>
|
||||
|
||||
Copyright (c) 2016-2019 Riku Särkinen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
423
vendor/alibabacloud/credentials/README-zh-CN.md
vendored
Normal file
423
vendor/alibabacloud/credentials/README-zh-CN.md
vendored
Normal file
@@ -0,0 +1,423 @@
|
||||
[English](/README.md) | 简体中文
|
||||
|
||||

|
||||
|
||||
# Alibaba Cloud Credentials for PHP
|
||||
|
||||
[](https://github.com/aliyun/credentials-php/actions/workflows/ci.yml)
|
||||
[](https://codecov.io/gh/aliyun/credentials-php)
|
||||
[](https://packagist.org/packages/alibabacloud/credentials)
|
||||
[](https://packagist.org/packages/alibabacloud/credentials)
|
||||
[](https://packagist.org/packages/alibabacloud/credentials)
|
||||
[](https://packagist.org/packages/alibabacloud/credentials)
|
||||
|
||||
Alibaba Cloud Credentials for PHP 是帮助 PHP 开发者管理凭据的工具。
|
||||
|
||||
## 先决条件
|
||||
|
||||
您的系统需要满足[先决条件](/docs/zh-CN/0-Prerequisites.md),包括 PHP> = 5.6。 我们强烈建议使用cURL扩展,并使用TLS后端编译cURL 7.16.2+。
|
||||
|
||||
## 安装依赖
|
||||
|
||||
如果已在系统上[全局安装 Composer](https://getcomposer.org/doc/00-intro.md#globally),请直接在项目目录中运行以下内容来安装 Alibaba Cloud Credentials for PHP 作为依赖项:
|
||||
|
||||
```sh
|
||||
composer require alibabacloud/credentials
|
||||
```
|
||||
|
||||
> 一些用户可能由于网络问题无法安装,可以使用[阿里云 Composer 全量镜像](https://developer.aliyun.com/composer)。
|
||||
|
||||
请看[安装](/docs/zh-CN/1-Installation.md)有关通过 Composer 和其他方式安装的详细信息。
|
||||
|
||||
## 快速使用
|
||||
|
||||
在您开始之前,您需要注册阿里云帐户并获取您的[凭证](https://usercenter.console.aliyun.com/#/manage/ak)。
|
||||
|
||||
### 凭证类型
|
||||
|
||||
#### 使用默认凭据链
|
||||
当您在初始化凭据客户端不传入任何参数时,Credentials工具会使用默认凭据链方式初始化客户端。默认凭据的读取逻辑请参见[默认凭据链](#默认凭证提供程序链)。
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
use AlibabaCloud\Credentials\Credential;
|
||||
|
||||
// Chain Provider if no Parameter
|
||||
$client = new Credential();
|
||||
|
||||
$credential = $client->getCredential();
|
||||
$credential->getAccessKeyId();
|
||||
$credential->getAccessKeySecret();
|
||||
$credential->getSecurityToken();
|
||||
```
|
||||
|
||||
#### AccessKey
|
||||
|
||||
通过[用户信息管理][ak]设置 access_key,它们具有该账户完全的权限,请妥善保管。有时出于安全考虑,您不能把具有完全访问权限的主账户 AccessKey 交于一个项目的开发者使用,您可以[创建RAM子账户][ram]并为子账户[授权][permissions],使用RAM子用户的 AccessKey 来进行API调用。
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
use AlibabaCloud\Credentials\Credential;
|
||||
use AlibabaCloud\Credentials\Credential\Config;
|
||||
|
||||
// Access Key
|
||||
$config = new Config([
|
||||
'type' => 'access_key',
|
||||
'accessKeyId' => '<access_key_id>',
|
||||
'accessKeySecret' => '<access_key_secret>',
|
||||
]);
|
||||
$client = new Credential($config);
|
||||
|
||||
$credential = $client->getCredential();
|
||||
$credential->getAccessKeyId();
|
||||
$credential->getAccessKeySecret();
|
||||
```
|
||||
|
||||
#### STS
|
||||
|
||||
通过安全令牌服务(Security Token Service,简称 STS),申请临时安全凭证(Temporary Security Credentials,简称 TSC),创建临时安全凭证。
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
use AlibabaCloud\Credentials\Credential;
|
||||
use AlibabaCloud\Credentials\Credential\Config;
|
||||
|
||||
$config = new Config([
|
||||
'type' => 'sts',
|
||||
'accessKeyId' => '<access_key_id>',
|
||||
'accessKeySecret' => '<access_key_secret>',
|
||||
'securityToken' => '<security_token>',
|
||||
]);
|
||||
$client = new Credential($config);
|
||||
|
||||
$credential = $client->getCredential();
|
||||
$credential->getAccessKeyId();
|
||||
$credential->getAccessKeySecret();
|
||||
$credential->getSecurityToken();
|
||||
```
|
||||
|
||||
#### RamRoleArn
|
||||
|
||||
通过指定RAM角色的ARN(Alibabacloud Resource Name),Credentials工具可以帮助开发者前往STS换取STS Token。您也可以通过为 `Policy` 赋值来限制RAM角色到一个更小的权限集合。
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
use AlibabaCloud\Credentials\Credential;
|
||||
use AlibabaCloud\Credentials\Credential\Config;
|
||||
|
||||
$config = new Config([
|
||||
'type' => 'ram_role_arn',
|
||||
'accessKeyId' => '<access_key_id>',
|
||||
'accessKeySecret' => '<access_key_secret>',
|
||||
// 要扮演的RAM角色ARN,示例值:acs:ram::123456789012****:role/adminrole,可以通过环境变量ALIBABA_CLOUD_ROLE_ARN设置role_arn
|
||||
'roleArn' => '<role_arn>',
|
||||
// 角色会话名称,可以通过环境变量ALIBABA_CLOUD_ROLE_SESSION_NAME设置role_session_name
|
||||
'roleSessionName' => '<role_session_name>',
|
||||
// 设置更小的权限策略,非必填。示例值:{"Statement": [{"Action": ["*"],"Effect": "Allow","Resource": ["*"]}],"Version":"1"}
|
||||
'policy' => '',
|
||||
// 设置session过期时间,非必填。
|
||||
'roleSessionExpiration' => 3600,
|
||||
]);
|
||||
$client = new Credential($config);
|
||||
|
||||
$credential = $client->getCredential();
|
||||
$credential->getAccessKeyId();
|
||||
$credential->getAccessKeySecret();
|
||||
$credential->getSecurityToken();
|
||||
```
|
||||
|
||||
#### EcsRamRole
|
||||
|
||||
ECS和ECI实例均支持绑定实例RAM角色,当在实例中使用Credentials工具时,将自动获取实例绑定的RAM角色,并通过访问元数据服务获取RAM角色的STS Token,以完成凭据客户端的初始化。
|
||||
|
||||
实例元数据服务器支持加固模式和普通模式两种访问方式,Credentials工具默认使用加固模式(IMDSv2)获取访问凭据。若使用加固模式时发生异常,您可以通过设置disableIMDSv1来执行不同的异常处理逻辑:
|
||||
|
||||
- 当值为false(默认值)时,会使用普通模式继续获取访问凭据。
|
||||
|
||||
- 当值为true时,表示只能使用加固模式获取访问凭据,会抛出异常。
|
||||
|
||||
服务端是否支持IMDSv2,取决于您在服务器的配置。
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
use AlibabaCloud\Credentials\Credential;
|
||||
use AlibabaCloud\Credentials\Credential\Config;
|
||||
|
||||
$config = new Config([
|
||||
'type' => 'ecs_ram_role',
|
||||
// 选填,该ECS角色的角色名称,不填会自动获取,但是建议加上以减少请求次数,可以通过环境变量ALIBABA_CLOUD_ECS_METADATA设置role_name
|
||||
'roleName' => '<role_name>',
|
||||
// 选填,是否强制关闭IMDSv1,即必须使用IMDSv2加固模式,可以通过环境变量ALIBABA_CLOUD_IMDSV1_DISABLED设置
|
||||
'disableIMDSv1' => true,
|
||||
]);
|
||||
$client = new Credential($config);
|
||||
|
||||
$credential = $client->getCredential();
|
||||
$credential->getAccessKeyId();
|
||||
$credential->getAccessKeySecret();
|
||||
$credential->getSecurityToken();
|
||||
```
|
||||
|
||||
#### OIDCRoleArn
|
||||
|
||||
在容器服务 Kubernetes 版中设置了Worker节点RAM角色后,对应节点内的Pod中的应用也就可以像ECS上部署的应用一样,通过元数据服务(Meta Data Server)获取关联角色的STS Token。但如果容器集群上部署的是不可信的应用(比如部署您的客户提交的应用,代码也没有对您开放),您可能并不希望它们能通过元数据服务获取Worker节点关联实例RAM角色的STS Token。为了避免影响云上资源的安全,同时又能让这些不可信的应用安全地获取所需的 STS Token,实现应用级别的权限最小化,您可以使用RRSA(RAM Roles for Service Account)功能。阿里云容器集群会为不同的应用Pod创建和挂载相应的服务账户OIDC Token文件,并将相关配置信息注入到环境变量中,Credentials工具通过获取环境变量的配置信息,调用STS服务的AssumeRoleWithOIDC - OIDC角色SSO时获取扮演角色的临时身份凭证接口换取绑定角色的STS Token。详情请参见[通过RRSA配置ServiceAccount的RAM权限实现Pod权限隔离](https://help.aliyun.com/zh/ack/ack-managed-and-ack-dedicated/user-guide/use-rrsa-to-authorize-pods-to-access-different-cloud-services#task-2142941)。
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
use AlibabaCloud\Credentials\Credential;
|
||||
use AlibabaCloud\Credentials\Credential\Config;
|
||||
|
||||
$config = new Config([
|
||||
'type' => 'oidc_role_arn',
|
||||
// OIDC提供商ARN,可以通过环境变量ALIBABA_CLOUD_OIDC_PROVIDER_ARN设置oidc_provider_arn
|
||||
'oidcProviderArn' => '<oidc_provider_arn>',
|
||||
// OIDC Token文件路径,可以通过环境变量ALIBABA_CLOUD_OIDC_TOKEN_FILE设置oidc_token_file_path
|
||||
'oidcTokenFilePath' => '<oidc_token_file_path>',
|
||||
// 要扮演的RAM角色ARN,示例值:acs:ram::123456789012****:role/adminrole,可以通过环境变量ALIBABA_CLOUD_ROLE_ARN设置role_arn
|
||||
'roleArn' => '<role_arn>',
|
||||
// 角色会话名称,可以通过环境变量ALIBABA_CLOUD_ROLE_SESSION_NAME设置role_session_name
|
||||
'roleSessionName' => '<role_session_name>',
|
||||
// 设置更小的权限策略,非必填。示例值:{"Statement": [{"Action": ["*"],"Effect": "Allow","Resource": ["*"]}],"Version":"1"}
|
||||
'policy' => '',
|
||||
# 设置session过期时间
|
||||
'roleSessionExpiration' => 3600,
|
||||
]);
|
||||
$client = new Credential($config);
|
||||
|
||||
$credential = $client->getCredential();
|
||||
$credential->getAccessKeyId();
|
||||
$credential->getAccessKeySecret();
|
||||
$credential->getSecurityToken();
|
||||
```
|
||||
|
||||
#### Credentials URI
|
||||
|
||||
通过指定提供凭证的自定义网络服务地址,让凭证自动申请维护 STS Token。
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
use AlibabaCloud\Credentials\Credential;
|
||||
use AlibabaCloud\Credentials\Credential\Config;
|
||||
|
||||
$config = new Config([
|
||||
'type' => 'credentials_uri',
|
||||
// 凭证的 URI,格式为http://local_or_remote_uri/,可以通过环境变量ALIBABA_CLOUD_CREDENTIALS_URI设置credentials_uri
|
||||
'credentialsURI' => '<credentials_uri>',
|
||||
]);
|
||||
$client = new Credential($config);
|
||||
|
||||
$credential = $client->getCredential();
|
||||
$credential->getAccessKeyId();
|
||||
$credential->getAccessKeySecret();
|
||||
$credential->getSecurityToken();
|
||||
```
|
||||
|
||||
#### Bearer Token
|
||||
|
||||
目前只有云呼叫中心 CCC 这款产品支持 Bearer Token 的凭据初始化方式。
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
use AlibabaCloud\Credentials\Credential;
|
||||
use AlibabaCloud\Credentials\Credential\Config;
|
||||
|
||||
$config = new Config([
|
||||
'type' => 'bearer',
|
||||
// 填入您的Bearer Token
|
||||
'bearerToken' => '<bearer_token>',
|
||||
]);
|
||||
$client = new Credential($config);
|
||||
|
||||
$credential = $client->getCredential();
|
||||
$credential->getBearerToken();
|
||||
```
|
||||
|
||||
## 默认凭证提供程序链
|
||||
|
||||
当您的程序开发环境和生产环境采用不同的凭据类型,常见做法是在代码中获取当前环境信息,编写获取不同凭据的分支代码。借助Credentials工具的默认凭据链,您可以用同一套代码,通过程序之外的配置来控制不同环境下的凭据获取方式。当您在不传入参数的情况下,直接使用$credential = new Credential();初始化凭据客户端时,阿里云SDK将会尝试按照如下顺序查找相关凭据信息。
|
||||
|
||||
### 1. 使用环境变量
|
||||
|
||||
Credentials工具会优先在环境变量中获取凭据信息。
|
||||
|
||||
- 如果系统环境变量 `ALIBABA_CLOUD_ACCESS_KEY_ID`(密钥Key) 和 `ALIBABA_CLOUD_ACCESS_KEY_SECRET`(密钥Value) 不为空,Credentials工具会优先使用它们作为默认凭据。
|
||||
|
||||
- 如果系统环境变量 `ALIBABA_CLOUD_ACCESS_KEY_ID`(密钥Key)、`ALIBABA_CLOUD_ACCESS_KEY_SECRET`(密钥Value)、`ALIBABA_CLOUD_SECURITY_TOKEN`(Token)均不为空,Credentials工具会优先使用STS Token作为默认凭据。
|
||||
|
||||
### 2. 使用OIDC RAM角色
|
||||
若不存在优先级更高的凭据信息,Credentials工具会在环境变量中获取如下内容:
|
||||
|
||||
`ALIBABA_CLOUD_ROLE_ARN`:RAM角色名称ARN;
|
||||
|
||||
`ALIBABA_CLOUD_OIDC_PROVIDER_ARN`:OIDC提供商ARN;
|
||||
|
||||
`ALIBABA_CLOUD_OIDC_TOKEN_FILE`:OIDC Token文件路径;
|
||||
|
||||
若以上三个环境变量都已设置内容,Credentials将会使用变量内容调用STS服务的[AssumeRoleWithOIDC - OIDC角色SSO时获取扮演角色的临时身份凭证](https://help.aliyun.com/zh/ram/developer-reference/api-sts-2015-04-01-assumerolewithoidc)接口换取STS Token作为默认凭据。
|
||||
|
||||
### 3. 使用 Aliyun CLI 工具的 config.json 配置文件
|
||||
|
||||
若不存在优先级更高的凭据信息,Credentials工具会优先在如下位置查找 `config.json` 文件是否存在:
|
||||
Linux系统:`~/.aliyun/config.json`
|
||||
Windows系统: `C:\Users\USER_NAME\.aliyun\config.json`
|
||||
如果文件存在,程序将会使用配置文件中 `current` 指定的凭据信息初始化凭据客户端。当然,您也可以通过环境变量 `ALIBABA_CLOUD_PROFILE` 来指定凭据信息,例如设置 `ALIBABA_CLOUD_PROFILE` 的值为 `AK`。
|
||||
|
||||
在config.json配置文件中每个module的值代表了不同的凭据信息获取方式:
|
||||
|
||||
- AK:使用用户的Access Key作为凭据信息;
|
||||
- RamRoleArn:使用RAM角色的ARN来获取凭据信息;
|
||||
- EcsRamRole:利用ECS绑定的RAM角色来获取凭据信息;
|
||||
- OIDC:通过OIDC ARN和OIDC Token来获取凭据信息;
|
||||
- ChainableRamRoleArn:采用角色链的方式,通过指定JSON文件中的其他凭据,以重新获取新的凭据信息。
|
||||
|
||||
配置示例信息如下:
|
||||
|
||||
```json
|
||||
{
|
||||
"current": "AK",
|
||||
"profiles": [
|
||||
{
|
||||
"name": "AK",
|
||||
"mode": "AK",
|
||||
"access_key_id": "access_key_id",
|
||||
"access_key_secret": "access_key_secret"
|
||||
},
|
||||
{
|
||||
"name": "RamRoleArn",
|
||||
"mode": "RamRoleArn",
|
||||
"access_key_id": "access_key_id",
|
||||
"access_key_secret": "access_key_secret",
|
||||
"ram_role_arn": "ram_role_arn",
|
||||
"ram_session_name": "ram_session_name",
|
||||
"expired_seconds": 3600,
|
||||
"sts_region": "cn-hangzhou"
|
||||
},
|
||||
{
|
||||
"name": "EcsRamRole",
|
||||
"mode": "EcsRamRole",
|
||||
"ram_role_name": "ram_role_name"
|
||||
},
|
||||
{
|
||||
"name": "OIDC",
|
||||
"mode": "OIDC",
|
||||
"ram_role_arn": "ram_role_arn",
|
||||
"oidc_token_file": "path/to/oidc/file",
|
||||
"oidc_provider_arn": "oidc_provider_arn",
|
||||
"ram_session_name": "ram_session_name",
|
||||
"expired_seconds": 3600,
|
||||
"sts_region": "cn-hangzhou"
|
||||
},
|
||||
{
|
||||
"name": "ChainableRamRoleArn",
|
||||
"mode": "ChainableRamRoleArn",
|
||||
"source_profile": "AK",
|
||||
"ram_role_arn": "ram_role_arn",
|
||||
"ram_session_name": "ram_session_name",
|
||||
"expired_seconds": 3600,
|
||||
"sts_region": "cn-hangzhou"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### 4. 使用配置文件
|
||||
>
|
||||
> 如果用户主目录存在默认文件 `~/.alibabacloud/credentials` (Windows 为 `C:\Users\USER_NAME\.alibabacloud\credentials`),程序会自动创建指定类型和名称的凭证。您也可通过环境变量 `ALIBABA_CLOUD_CREDENTIALS_FILE` 指定配置文件路径。如果文件存在,程序将会使用配置文件中 default 指定的凭据信息初始化凭据客户端。当然,您也可以通过环境变量 `ALIBABA_CLOUD_PROFILE` 来指定凭据信息,例如设置 `ALIBABA_CLOUD_PROFILE` 的值为 `client1`。
|
||||
|
||||
配置示例信息如下:
|
||||
|
||||
```ini
|
||||
[default]
|
||||
type = access_key # 认证方式为 access_key
|
||||
access_key_id = foo # Key
|
||||
access_key_secret = bar # Secret
|
||||
|
||||
[project1]
|
||||
type = ecs_ram_role # 认证方式为 ecs_ram_role
|
||||
role_name = EcsRamRoleTest # Role Name,非必填,不填则自动获取,建议设置,可以减少网络请求。
|
||||
|
||||
[project2]
|
||||
type = ram_role_arn # 认证方式为 ram_role_arn
|
||||
access_key_id = foo
|
||||
access_key_secret = bar
|
||||
role_arn = role_arn
|
||||
role_session_name = session_name
|
||||
|
||||
[project3]
|
||||
type=oidc_role_arn # 认证方式为 oidc_role_arn
|
||||
oidc_provider_arn=oidc_provider_arn
|
||||
oidc_token_file_path=oidc_token_file_path
|
||||
role_arn=role_arn
|
||||
role_session_name=session_name
|
||||
```
|
||||
|
||||
### 5. 使用 ECS 实例RAM角色
|
||||
|
||||
若不存在优先级更高的凭据信息,Credentials工具将通过环境变量获取ALIBABA_CLOUD_ECS_METADATA(ECS实例RAM角色名称)的值。若该变量的值存在,程序将采用加固模式(IMDSv2)访问ECS的元数据服务(Meta Data Server),以获取ECS实例RAM角色的STS Token作为默认凭据信息。在使用加固模式时若发生异常,将使用普通模式兜底来获取访问凭据。您也可以通过设置环境变量ALIBABA_CLOUD_IMDSV1_DISABLED,执行不同的异常处理逻辑:
|
||||
|
||||
- 当值为false时,会使用普通模式继续获取访问凭据。
|
||||
|
||||
- 当值为true时,表示只能使用加固模式获取访问凭据,会抛出异常。
|
||||
|
||||
服务端是否支持IMDSv2,取决于您在服务器的配置。
|
||||
|
||||
### 6. 使用外部服务 Credentials URI
|
||||
|
||||
若不存在优先级更高的凭据信息,Credentials工具会在环境变量中获取ALIBABA_CLOUD_CREDENTIALS_URI,若存在,程序将请求该URI地址,获取临时安全凭证作为默认凭据信息。
|
||||
|
||||
外部服务响应结构应如下:
|
||||
|
||||
```json
|
||||
{
|
||||
"Code": "Success",
|
||||
"AccessKeyId": "AccessKeyId",
|
||||
"AccessKeySecret": "AccessKeySecret",
|
||||
"SecurityToken": "SecurityToken",
|
||||
"Expiration": "2024-10-26T03:46:38Z"
|
||||
}
|
||||
```
|
||||
|
||||
## 文档
|
||||
|
||||
* [先决条件](/docs/zh-CN/0-Prerequisites.md)
|
||||
* [安装](/docs/zh-CN/1-Installation.md)
|
||||
|
||||
## 问题
|
||||
|
||||
[提交 Issue](https://github.com/aliyun/credentials-php/issues/new/choose),不符合指南的问题可能会立即关闭。
|
||||
|
||||
## 发行说明
|
||||
|
||||
每个版本的详细更改记录在[发行说明](/CHANGELOG.md)中。
|
||||
|
||||
## 贡献
|
||||
|
||||
提交 Pull Request 之前请阅读[贡献指南](/CONTRIBUTING.md)。
|
||||
|
||||
## 相关
|
||||
|
||||
* [OpenAPI 开发者门户][open-api]
|
||||
* [Packagist][packagist]
|
||||
* [Composer][composer]
|
||||
* [Guzzle中文文档][guzzle-docs]
|
||||
* [最新源码][latest-release]
|
||||
|
||||
## 许可证
|
||||
|
||||
[Apache-2.0](/LICENSE.md)
|
||||
|
||||
Copyright (c) 2009-present, Alibaba Cloud All rights reserved.
|
||||
|
||||
[open-api]: https://api.aliyun.com
|
||||
[latest-release]: https://github.com/aliyun/credentials-php
|
||||
[guzzle-docs]: https://guzzle-cn.readthedocs.io/zh_CN/latest/request-options.html
|
||||
[composer]: https://getcomposer.org
|
||||
[packagist]: https://packagist.org/packages/alibabacloud/credentials
|
||||
422
vendor/alibabacloud/credentials/README.md
vendored
Normal file
422
vendor/alibabacloud/credentials/README.md
vendored
Normal file
@@ -0,0 +1,422 @@
|
||||
English | [简体中文](/README-zh-CN.md)
|
||||
|
||||

|
||||
|
||||
# Alibaba Cloud Credentials for PHP
|
||||
|
||||
[](https://github.com/aliyun/credentials-php/actions/workflows/ci.yml)
|
||||
[](https://codecov.io/gh/aliyun/credentials-php)
|
||||
[](https://packagist.org/packages/alibabacloud/credentials)
|
||||
[](https://packagist.org/packages/alibabacloud/credentials)
|
||||
[](https://packagist.org/packages/alibabacloud/credentials)
|
||||
[](https://packagist.org/packages/alibabacloud/credentials)
|
||||
|
||||
Alibaba Cloud Credentials for PHP is a tool that helps PHP developers manage their credentials.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Your system needs to meet [Prerequisites](/docs/zh-CN/0-Prerequisites.md), including PHP> = 5.6. We strongly recommend using the cURL extension and compiling cURL 7.16.2+ using the TLS backend.
|
||||
|
||||
## Installation
|
||||
|
||||
If you have [Globally Install Composer](https://getcomposer.org/doc/00-intro.md#globally) on your system, install Alibaba Cloud Credentials for PHP as a dependency by running the following directly in the project directory:
|
||||
|
||||
```sh
|
||||
composer require alibabacloud/credentials
|
||||
```
|
||||
|
||||
> Some users may not be able to install due to network problems, you can switch to the [Alibaba Cloud Composer Mirror](https://developer.aliyun.com/composer).
|
||||
|
||||
See [Installation](/docs/zh-CN/1-Installation.md) for details on installing through Composer and other means.
|
||||
|
||||
## Quick Examples
|
||||
|
||||
Before you begin, you need to sign up for an Alibaba Cloud account and retrieve your [Credentials](https://usercenter.console.aliyun.com/#/manage/ak).
|
||||
|
||||
### Credential Type
|
||||
|
||||
#### Default credential provider chain
|
||||
|
||||
If you do not specify a method to initialize a Credentials client, the default credential provider chain is used. For more information, see the Default credential provider chain section of this topic.
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
use AlibabaCloud\Credentials\Credential;
|
||||
|
||||
// Chain Provider if no Parameter
|
||||
// Do not specify a method to initialize a Credentials client.
|
||||
$client = new Credential();
|
||||
|
||||
$credential = $client->getCredential();
|
||||
$credential->getAccessKeyId();
|
||||
$credential->getAccessKeySecret();
|
||||
$credential->getSecurityToken();
|
||||
```
|
||||
|
||||
#### AccessKey
|
||||
|
||||
Setup access_key credential through [User Information Management][ak], it have full authority over the account, please keep it safe. Sometimes for security reasons, you cannot hand over a primary account AccessKey with full access to the developer of a project. You may create a sub-account [RAM Sub-account][ram] , grant its [authorization][permissions],and use the AccessKey of RAM Sub-account.
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
use AlibabaCloud\Credentials\Credential;
|
||||
use AlibabaCloud\Credentials\Credential\Config;
|
||||
|
||||
// Access Key
|
||||
$config = new Config([
|
||||
'type' => 'access_key',
|
||||
'accessKeyId' => '<access_key_id>',
|
||||
'accessKeySecret' => '<access_key_secret>',
|
||||
]);
|
||||
$client = new Credential($config);
|
||||
|
||||
$credential = $client->getCredential();
|
||||
$credential->getAccessKeyId();
|
||||
$credential->getAccessKeySecret();
|
||||
```
|
||||
|
||||
#### STS
|
||||
|
||||
Create a temporary security credential by applying Temporary Security Credentials (TSC) through the Security Token Service (STS).
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
use AlibabaCloud\Credentials\Credential;
|
||||
use AlibabaCloud\Credentials\Credential\Config;
|
||||
|
||||
$config = new Config([
|
||||
'type' => 'sts',
|
||||
'accessKeyId' => '<access_key_id>',
|
||||
'accessKeySecret' => '<access_key_secret>',
|
||||
'securityToken' => '<security_token>',
|
||||
]);
|
||||
$client = new Credential($config);
|
||||
|
||||
$credential = $client->getCredential();
|
||||
$credential->getAccessKeyId();
|
||||
$credential->getAccessKeySecret();
|
||||
$credential->getSecurityToken();
|
||||
```
|
||||
|
||||
#### RamRoleArn
|
||||
|
||||
By specifying [RAM Role][RAM Role], the credential will be able to automatically request maintenance of STS Token. If you want to limit the permissions([How to make a policy][policy]) of STS Token, you can assign value for `Policy`.
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
use AlibabaCloud\Credentials\Credential;
|
||||
use AlibabaCloud\Credentials\Credential\Config;
|
||||
|
||||
$config = new Config([
|
||||
'type' => 'ram_role_arn',
|
||||
'accessKeyId' => '<access_key_id>',
|
||||
'accessKeySecret' => '<access_key_secret>',
|
||||
// Specify the ARN of the RAM role to be assumed. Example: acs:ram::123456789012****:role/adminrole.
|
||||
'roleArn' => '<role_arn>',
|
||||
// Specify the name of the role session.
|
||||
'roleSessionName' => '<role_session_name>',
|
||||
// Optional. Specify limited permissions for the RAM role. Example: {"Statement": [{"Action": ["*"],"Effect": "Allow","Resource": ["*"]}],"Version":"1"}.
|
||||
'policy' => '',
|
||||
// Optional. Specify the expiration of the session
|
||||
'roleSessionExpiration' => 3600,
|
||||
]);
|
||||
$client = new Credential($config);
|
||||
|
||||
$credential = $client->getCredential();
|
||||
$credential->getAccessKeyId();
|
||||
$credential->getAccessKeySecret();
|
||||
$credential->getSecurityToken();
|
||||
```
|
||||
|
||||
#### EcsRamRole
|
||||
|
||||
Both ECS and ECI instances support binding instance RAM roles. When the Credentials tool is used in an instance, the RAM role bound to the instance will be automatically obtained, and the STS Token of the RAM role will be obtained by accessing the metadata service to complete the initialization of the credential client.
|
||||
|
||||
The instance metadata server supports two access modes: hardened mode and normal mode. The Credentials tool uses hardened mode (IMDSv2) by default to obtain access credentials. If an exception occurs when using hardened mode, you can set disableIMDSv1 to perform different exception handling logic:
|
||||
|
||||
- When the value is false (default value), the normal mode will continue to be used to obtain access credentials.
|
||||
|
||||
- When the value is true, it means that only hardened mode can be used to obtain access credentials, and an exception will be thrown.
|
||||
|
||||
Whether the server supports IMDSv2 depends on your configuration on the server.
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
use AlibabaCloud\Credentials\Credential;
|
||||
use AlibabaCloud\Credentials\Credential\Config;
|
||||
|
||||
$config = new Config([
|
||||
'type' => 'ecs_ram_role',
|
||||
// Optional. Specify the name of the RAM role of the ECS instance. If you do not specify this parameter, its value is automatically obtained. To reduce the number of requests, we recommend that you specify this parameter.
|
||||
'roleName' => '<role_name>',
|
||||
//Optional, whether to forcibly disable IMDSv1, that is, to use IMDSv2 hardening mode, which can be set by the environment variable ALIBABA_CLOUD_IMDSV1_DISABLED
|
||||
'disableIMDSv1' => true,
|
||||
]);
|
||||
$client = new Credential($config);
|
||||
|
||||
$credential = $client->getCredential();
|
||||
$credential->getAccessKeyId();
|
||||
$credential->getAccessKeySecret();
|
||||
$credential->getSecurityToken();
|
||||
```
|
||||
|
||||
#### OIDCRoleArn
|
||||
|
||||
After you attach a RAM role to a worker node in an Container Service for Kubernetes, applications in the pods on the worker node can use the metadata server to obtain an STS token the same way in which applications on ECS instances do. However, if an untrusted application is deployed on the worker node, such as an application that is submitted by your customer and whose code is unavailable to you, you may not want the application to use the metadata server to obtain an STS token of the RAM role attached to the worker node. To ensure the security of cloud resources and enable untrusted applications to securely obtain required STS tokens, you can use the RAM Roles for Service Accounts (RRSA) feature to grant minimum necessary permissions to an application. In this case, the ACK cluster creates a service account OpenID Connect (OIDC) token file, associates the token file with a pod, and then injects relevant environment variables into the pod. Then, the Credentials tool uses the environment variables to call the AssumeRoleWithOIDC operation of STS and obtains an STS token of the RAM role. For more information about the RRSA feature, see [Use RRSA to authorize different pods to access different cloud services](https://www.alibabacloud.com/help/en/ack/ack-managed-and-ack-dedicated/user-guide/use-rrsa-to-authorize-pods-to-access-different-cloud-services#task-2142941).
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
use AlibabaCloud\Credentials\Credential;
|
||||
use AlibabaCloud\Credentials\Credential\Config;
|
||||
|
||||
$config = new Config([
|
||||
'type' => 'oidc_role_arn',
|
||||
// Specify the ARN of the OIDC IdP by specifying the ALIBABA_CLOUD_OIDC_PROVIDER_ARN environment variable.
|
||||
'oidcProviderArn' => '<oidc_provider_arn>',
|
||||
// Specify the path of the OIDC token file by specifying the ALIBABA_CLOUD_OIDC_TOKEN_FILE environment variable.
|
||||
'oidcTokenFilePath' => '<oidc_token_file_path>',
|
||||
// Specify the ARN of the RAM role by specifying the ALIBABA_CLOUD_ROLE_ARN environment variable.
|
||||
'roleArn' => '<role_arn>',
|
||||
// Specify the role session name by specifying the ALIBABA_CLOUD_ROLE_SESSION_NAME environment variable.
|
||||
'roleSessionName' => '<role_session_name>',
|
||||
// Optional. Specify limited permissions for the RAM role. Example: {"Statement": [{"Action": ["*"],"Effect": "Allow","Resource": ["*"]}],"Version":"1"}.
|
||||
'policy' => '',
|
||||
// Optional. Specify the validity period of the session.
|
||||
'roleSessionExpiration' => 3600,
|
||||
]);
|
||||
$client = new Credential($config);
|
||||
|
||||
$credential = $client->getCredential();
|
||||
$credential->getAccessKeyId();
|
||||
$credential->getAccessKeySecret();
|
||||
$credential->getSecurityToken();
|
||||
```
|
||||
|
||||
#### Credentials URI
|
||||
|
||||
By specifying the url, the credential will be able to automatically request maintenance of STS Token.
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
use AlibabaCloud\Credentials\Credential;
|
||||
use AlibabaCloud\Credentials\Credential\Config;
|
||||
|
||||
$config = new Config([
|
||||
'type' => 'credentials_uri',
|
||||
// Format: http url. `credentialsURI` can be replaced by setting environment variable: ALIBABA_CLOUD_CREDENTIALS_URI
|
||||
'credentialsURI' => '<credentials_uri>',
|
||||
]);
|
||||
$client = new Credential($config);
|
||||
|
||||
$credential = $client->getCredential();
|
||||
$credential->getAccessKeyId();
|
||||
$credential->getAccessKeySecret();
|
||||
$credential->getSecurityToken();
|
||||
```
|
||||
|
||||
#### Bearer Token
|
||||
|
||||
If credential is required by the Cloud Call Centre (CCC), please apply for Bearer Token maintenance by yourself.
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
use AlibabaCloud\Credentials\Credential;
|
||||
use AlibabaCloud\Credentials\Credential\Config;
|
||||
|
||||
$config = new Config([
|
||||
'type' => 'bearer',
|
||||
'bearerToken' => '<bearer_token>',
|
||||
]);
|
||||
$client = new Credential($config);
|
||||
|
||||
$credential = $client->getCredential();
|
||||
$credential->getBearerToken();
|
||||
```
|
||||
|
||||
## Default credential provider chain
|
||||
|
||||
If you want to use different types of credentials in the development and production environments of your application, you generally need to obtain the environment information from the code and write code branches to obtain different credentials for the development and production environments. The default credential provider chain of the Credentials tool allows you to use the same code to obtain credentials for different environments based on configurations independent of the application. If you use $credential = new Credential(); to initialize a Credentials client without specifying an initialization method, the Credentials tool obtains the credential information in the following order:
|
||||
|
||||
### 1. Environmental certificate
|
||||
|
||||
Look for environment credentials in environment variable.
|
||||
- If the `ALIBABA_CLOUD_ACCESS_KEY_ID` and `ALIBABA_CLOUD_ACCESS_KEY_SECRET` environment variables are defined and are not empty, the program will use them to create default credentials.
|
||||
- If the `ALIBABA_CLOUD_ACCESS_KEY_ID`, `ALIBABA_CLOUD_ACCESS_KEY_SECRET` and `ALIBABA_CLOUD_SECURITY_TOKEN` environment variables are defined and are not empty, the program will use them to create temporary security credentials(STS). Note: This token has an expiration time, it is recommended to use it in a temporary environment.
|
||||
|
||||
### 2. The RAM role of an OIDC IdP
|
||||
|
||||
If no credentials are found in the previous step, the Credentials tool obtains the values of the following environment variables:
|
||||
|
||||
`ALIBABA_CLOUD_ROLE_ARN`: the ARN of the RAM role.
|
||||
|
||||
`ALIBABA_CLOUD_OIDC_PROVIDER_ARN`: the ARN of the OIDC IdP.
|
||||
|
||||
`ALIBABA_CLOUD_OIDC_TOKEN_FILE`: the path of the OIDC token file.
|
||||
|
||||
If the preceding three environment variables are specified, the Credentials tool uses the environment variables to call the [AssumeRoleWithOIDC](https://www.alibabacloud.com/help/en/ram/developer-reference/api-sts-2015-04-01-assumerolewithoidc) operation of STS to obtain an STS token as the default credential.
|
||||
|
||||
### 3. Using the config.json Configuration File of Aliyun CLI Tool
|
||||
If there is no higher-priority credential information, the Credentials tool will first check the following locations to see if the config.json file exists:
|
||||
|
||||
Linux system: `~/.aliyun/config.json`
|
||||
Windows system: `C:\Users\USER_NAME\.aliyun\config.json`
|
||||
If the file exists, the program will use the credential information specified by `current` in the configuration file to initialize the credentials client. Of course, you can also use the environment variable `ALIBABA_CLOUD_PROFILE` to specify the credential information, for example by setting the value of `ALIBABA_CLOUD_PROFILE` to `AK`.
|
||||
|
||||
In the config.json configuration file, the value of each module represents different ways to obtain credential information:
|
||||
|
||||
- AK: Use the Access Key of the user as credential information;
|
||||
- RamRoleArn: Use the ARN of the RAM role to obtain credential information;
|
||||
- EcsRamRole: Use the RAM role bound to the ECS to obtain credential information;
|
||||
- OIDC: Obtain credential information through OIDC ARN and OIDC Token;
|
||||
- ChainableRamRoleArn: Use the role chaining method to obtain new credential information by specifying other credentials in the JSON file.
|
||||
|
||||
The configuration example information is as follows:
|
||||
|
||||
```json
|
||||
{
|
||||
"current": "AK",
|
||||
"profiles": [
|
||||
{
|
||||
"name": "AK",
|
||||
"mode": "AK",
|
||||
"access_key_id": "access_key_id",
|
||||
"access_key_secret": "access_key_secret"
|
||||
},
|
||||
{
|
||||
"name": "RamRoleArn",
|
||||
"mode": "RamRoleArn",
|
||||
"access_key_id": "access_key_id",
|
||||
"access_key_secret": "access_key_secret",
|
||||
"ram_role_arn": "ram_role_arn",
|
||||
"ram_session_name": "ram_session_name",
|
||||
"expired_seconds": 3600,
|
||||
"sts_region": "cn-hangzhou"
|
||||
},
|
||||
{
|
||||
"name": "EcsRamRole",
|
||||
"mode": "EcsRamRole",
|
||||
"ram_role_name": "ram_role_name"
|
||||
},
|
||||
{
|
||||
"name": "OIDC",
|
||||
"mode": "OIDC",
|
||||
"ram_role_arn": "ram_role_arn",
|
||||
"oidc_token_file": "path/to/oidc/file",
|
||||
"oidc_provider_arn": "oidc_provider_arn",
|
||||
"ram_session_name": "ram_session_name",
|
||||
"expired_seconds": 3600,
|
||||
"sts_region": "cn-hangzhou"
|
||||
},
|
||||
{
|
||||
"name": "ChainableRamRoleArn",
|
||||
"mode": "ChainableRamRoleArn",
|
||||
"source_profile": "AK",
|
||||
"ram_role_arn": "ram_role_arn",
|
||||
"ram_session_name": "ram_session_name",
|
||||
"expired_seconds": 3600,
|
||||
"sts_region": "cn-hangzhou"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### 4. Configuration file
|
||||
>
|
||||
> If the user's home directory has the default file `~/.alibabacloud/credentials` (Windows is `C:\Users\USER_NAME\.alibabacloud\credentials`), the program will automatically create credentials with the specified type and name. You can also specify the configuration file path by configuring the `ALIBABA_CLOUD_CREDENTIALS_FILE` environment variable. If the configuration file exists, the application initializes a Credentials client by using the credential information that is specified by default in the configuration file. You can also configure the `ALIBABA_CLOUD_PROFILE` environment variable to modify the default credential information that is read.
|
||||
|
||||
Configuration example:
|
||||
```ini
|
||||
[default]
|
||||
type = access_key # Authentication method is access_key
|
||||
access_key_id = foo # Key
|
||||
access_key_secret = bar # Secret
|
||||
|
||||
[project1]
|
||||
type = ecs_ram_role # Authentication method is ecs_ram_role
|
||||
role_name = EcsRamRoleTest # Role name, optional. It will be retrieved automatically if not set. It is highly recommended to set it up to reduce requests.
|
||||
|
||||
[project2]
|
||||
type = ram_role_arn # Authentication method is ram_role_arn
|
||||
access_key_id = foo
|
||||
access_key_secret = bar
|
||||
role_arn = role_arn
|
||||
role_session_name = session_name
|
||||
|
||||
[project3]
|
||||
type=oidc_role_arn # Authentication method is oidc_role_arn
|
||||
oidc_provider_arn=oidc_provider_arn
|
||||
oidc_token_file_path=oidc_token_file_path
|
||||
role_arn=role_arn
|
||||
role_session_name=session_name
|
||||
```
|
||||
|
||||
### 5. Instance RAM role
|
||||
|
||||
If there is no credential information with a higher priority, the Credentials tool will obtain the value of ALIBABA_CLOUD_ECS_METADATA (ECS instance RAM role name) through the environment variable. If the value of this variable exists, the program will use the hardened mode (IMDSv2) to access the metadata service (Meta Data Server) of ECS to obtain the STS Token of the ECS instance RAM role as the default credential information. If an exception occurs when using the hardened mode, the normal mode will be used as a fallback to obtain access credentials. You can also set the environment variable ALIBABA_CLOUD_IMDSV1_DISABLED to perform different exception handling logic:
|
||||
|
||||
- When the value is false, the normal mode will continue to obtain access credentials.
|
||||
|
||||
- When the value is true, it means that only the hardened mode can be used to obtain access credentials, and an exception will be thrown.
|
||||
|
||||
Whether the server supports IMDSv2 depends on your configuration on the server.
|
||||
|
||||
### 6. Using External Service Credentials URI
|
||||
|
||||
If there are no higher-priority credential information, the Credentials tool will obtain the `ALIBABA_CLOUD_CREDENTIALS_URI` from the environment variables. If it exists, the program will request the URI address to obtain temporary security credentials as the default credential information.
|
||||
|
||||
The external service response structure should be as follows:
|
||||
|
||||
```json
|
||||
{
|
||||
"Code": "Success",
|
||||
"AccessKeyId": "AccessKeyId",
|
||||
"AccessKeySecret": "AccessKeySecret",
|
||||
"SecurityToken": "SecurityToken",
|
||||
"Expiration": "2024-10-26T03:46:38Z"
|
||||
}
|
||||
```
|
||||
|
||||
## Documentation
|
||||
|
||||
* [Prerequisites](/docs/zh-CN/0-Prerequisites.md)
|
||||
* [Installation](/docs/zh-CN/1-Installation.md)
|
||||
|
||||
## Issue
|
||||
|
||||
[Submit Issue](https://github.com/aliyun/credentials-php/issues/new/choose), Problems that do not meet the guidelines may close immediately.
|
||||
|
||||
## Release notes
|
||||
|
||||
Detailed changes for each version are recorded in the [Release Notes](/CHANGELOG.md).
|
||||
|
||||
## Contribution
|
||||
|
||||
Please read the [Contribution Guide](/CONTRIBUTING.md) before submitting a Pull Request.
|
||||
|
||||
## Related
|
||||
|
||||
* [OpenAPI Developer Portal][open-api]
|
||||
* [Packagist][packagist]
|
||||
* [Composer][composer]
|
||||
* [Guzzle Doc][guzzle-docs]
|
||||
* [Latest Release][latest-release]
|
||||
|
||||
## License
|
||||
|
||||
[Apache-2.0](/LICENSE.md)
|
||||
|
||||
Copyright (c) 2009-present, Alibaba Cloud All rights reserved.
|
||||
|
||||
[open-api]: https://api.alibabacloud.com
|
||||
[latest-release]: https://github.com/aliyun/credentials-php
|
||||
[guzzle-docs]: http://docs.guzzlephp.org/en/stable/request-options.html
|
||||
[composer]: https://getcomposer.org
|
||||
[packagist]: https://packagist.org/packages/alibabacloud/credentials
|
||||
21
vendor/alibabacloud/credentials/SECURITY.md
vendored
Normal file
21
vendor/alibabacloud/credentials/SECURITY.md
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
Use this section to tell people about which versions of your project are
|
||||
currently being supported with security updates.
|
||||
|
||||
| Version | Supported |
|
||||
| ------- | ------------------ |
|
||||
| 5.1.x | :white_check_mark: |
|
||||
| 5.0.x | :x: |
|
||||
| 4.0.x | :white_check_mark: |
|
||||
| < 4.0 | :x: |
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
Use this section to tell people how to report a vulnerability.
|
||||
|
||||
Tell them where to go, how often they can expect to get an update on a
|
||||
reported vulnerability, what to expect if the vulnerability is accepted or
|
||||
declined, etc.
|
||||
6
vendor/alibabacloud/credentials/UPGRADING.md
vendored
Normal file
6
vendor/alibabacloud/credentials/UPGRADING.md
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
Upgrading Guide
|
||||
===============
|
||||
|
||||
1.x
|
||||
-----------------------
|
||||
- This is the first version. See <https://github.com/aliyun/credentials-php> for more information.
|
||||
107
vendor/alibabacloud/credentials/composer.json
vendored
Normal file
107
vendor/alibabacloud/credentials/composer.json
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
{
|
||||
"name": "alibabacloud/credentials",
|
||||
"homepage": "https://www.alibabacloud.com/",
|
||||
"description": "Alibaba Cloud Credentials for PHP",
|
||||
"keywords": [
|
||||
"sdk",
|
||||
"tool",
|
||||
"cloud",
|
||||
"client",
|
||||
"aliyun",
|
||||
"library",
|
||||
"alibaba",
|
||||
"Credentials",
|
||||
"alibabacloud"
|
||||
],
|
||||
"type": "library",
|
||||
"license": "Apache-2.0",
|
||||
"support": {
|
||||
"source": "https://github.com/aliyun/credentials-php",
|
||||
"issues": "https://github.com/aliyun/credentials-php/issues"
|
||||
},
|
||||
"authors": [
|
||||
{
|
||||
"name": "Alibaba Cloud SDK",
|
||||
"email": "sdk-team@alibabacloud.com",
|
||||
"homepage": "http://www.alibabacloud.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.6",
|
||||
"ext-curl": "*",
|
||||
"ext-json": "*",
|
||||
"ext-libxml": "*",
|
||||
"ext-openssl": "*",
|
||||
"ext-mbstring": "*",
|
||||
"ext-simplexml": "*",
|
||||
"ext-xmlwriter": "*",
|
||||
"guzzlehttp/guzzle": "^6.3|^7.0",
|
||||
"adbario/php-dot-notation": "^2.2",
|
||||
"alibabacloud/tea": "^3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-spl": "*",
|
||||
"ext-dom": "*",
|
||||
"ext-pcre": "*",
|
||||
"psr/cache": "^1.0",
|
||||
"ext-sockets": "*",
|
||||
"drupal/coder": "^8.3",
|
||||
"symfony/dotenv": "^3.4",
|
||||
"phpunit/phpunit": "^5.7|^6.6|^9.3",
|
||||
"monolog/monolog": "^1.24",
|
||||
"composer/composer": "^1.8",
|
||||
"mikey179/vfsstream": "^1.6",
|
||||
"symfony/var-dumper": "^3.4"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-sockets": "To use client-side monitoring"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"AlibabaCloud\\Credentials\\": "src"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"AlibabaCloud\\Credentials\\Tests\\": "tests/"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"preferred-install": "dist",
|
||||
"optimize-autoloader": true,
|
||||
"allow-plugins": {
|
||||
"dealerdirect/phpcodesniffer-composer-installer": true
|
||||
}
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true,
|
||||
"scripts-descriptions": {
|
||||
"cs": "Tokenizes PHP, JavaScript and CSS files to detect violations of a defined coding standard.",
|
||||
"cbf": "Automatically correct coding standard violations.",
|
||||
"fixer": "Fixes code to follow standards.",
|
||||
"test": "Run all tests.",
|
||||
"unit": "Run Unit tests.",
|
||||
"feature": "Run Feature tests.",
|
||||
"clearCache": "Clear cache like coverage.",
|
||||
"coverage": "Show Coverage html.",
|
||||
"endpoints": "Update endpoints from OSS."
|
||||
},
|
||||
"scripts": {
|
||||
"cs": "phpcs --standard=PSR2 -n ./",
|
||||
"cbf": "phpcbf --standard=PSR2 -n ./",
|
||||
"fixer": "php-cs-fixer fix ./",
|
||||
"test": [
|
||||
"phpunit --colors=always"
|
||||
],
|
||||
"unit": [
|
||||
"@clearCache",
|
||||
"phpunit --testsuite=Unit --colors=always"
|
||||
],
|
||||
"feature": [
|
||||
"@clearCache",
|
||||
"phpunit --testsuite=Feature --colors=always"
|
||||
],
|
||||
"coverage": "open cache/coverage/index.html",
|
||||
"clearCache": "rm -rf cache/*"
|
||||
}
|
||||
}
|
||||
86
vendor/alibabacloud/credentials/src/AccessKeyCredential.php
vendored
Normal file
86
vendor/alibabacloud/credentials/src/AccessKeyCredential.php
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials;
|
||||
|
||||
use AlibabaCloud\Credentials\Utils\Filter;
|
||||
use AlibabaCloud\Credentials\Credential\CredentialModel;
|
||||
use AlibabaCloud\Credentials\Signature\ShaHmac1Signature;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* Use the AccessKey to complete the authentication.
|
||||
*/
|
||||
class AccessKeyCredential implements CredentialsInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $accessKeyId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $accessKeySecret;
|
||||
|
||||
/**
|
||||
* AccessKeyCredential constructor.
|
||||
*
|
||||
* @param string $access_key_id Access key ID
|
||||
* @param string $access_key_secret Access Key Secret
|
||||
*/
|
||||
public function __construct($access_key_id, $access_key_secret)
|
||||
{
|
||||
Filter::accessKey($access_key_id, $access_key_secret);
|
||||
|
||||
$this->accessKeyId = $access_key_id;
|
||||
$this->accessKeySecret = $access_key_secret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAccessKeyId()
|
||||
{
|
||||
return $this->accessKeyId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAccessKeySecret()
|
||||
{
|
||||
return $this->accessKeySecret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return "$this->accessKeyId#$this->accessKeySecret";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ShaHmac1Signature
|
||||
*/
|
||||
public function getSignature()
|
||||
{
|
||||
return new ShaHmac1Signature();
|
||||
}
|
||||
|
||||
public function getSecurityToken()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getCredential()
|
||||
{
|
||||
return new CredentialModel([
|
||||
'accessKeyId' => $this->accessKeyId,
|
||||
'accessKeySecret' => $this->accessKeySecret,
|
||||
'type' => 'access_key',
|
||||
]);
|
||||
}
|
||||
}
|
||||
67
vendor/alibabacloud/credentials/src/BearerTokenCredential.php
vendored
Normal file
67
vendor/alibabacloud/credentials/src/BearerTokenCredential.php
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials;
|
||||
|
||||
use AlibabaCloud\Credentials\Utils\Filter;
|
||||
use AlibabaCloud\Credentials\Credential\CredentialModel;
|
||||
use AlibabaCloud\Credentials\Signature\BearerTokenSignature;
|
||||
|
||||
/**
|
||||
* Class BearerTokenCredential
|
||||
*/
|
||||
class BearerTokenCredential implements CredentialsInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $bearerToken;
|
||||
|
||||
/**
|
||||
* BearerTokenCredential constructor.
|
||||
*
|
||||
* @param $bearer_token
|
||||
*/
|
||||
public function __construct($bearer_token)
|
||||
{
|
||||
Filter::bearerToken($bearer_token);
|
||||
|
||||
$this->bearerToken = $bearer_token;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getBearerToken()
|
||||
{
|
||||
return $this->bearerToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return "bearerToken#$this->bearerToken";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BearerTokenSignature
|
||||
*/
|
||||
public function getSignature()
|
||||
{
|
||||
return new BearerTokenSignature();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getCredential()
|
||||
{
|
||||
return new CredentialModel([
|
||||
'bearerToken' => $this->bearerToken,
|
||||
'type' => 'bearer',
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
268
vendor/alibabacloud/credentials/src/Credential.php
vendored
Normal file
268
vendor/alibabacloud/credentials/src/Credential.php
vendored
Normal file
@@ -0,0 +1,268 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials;
|
||||
|
||||
use AlibabaCloud\Credentials\Credential\Config;
|
||||
use AlibabaCloud\Credentials\Credential\CredentialModel;
|
||||
use AlibabaCloud\Credentials\Providers\DefaultCredentialsProvider;
|
||||
use AlibabaCloud\Credentials\Providers\EcsRamRoleCredentialsProvider;
|
||||
use AlibabaCloud\Credentials\Providers\OIDCRoleArnCredentialsProvider;
|
||||
use AlibabaCloud\Credentials\Providers\RamRoleArnCredentialsProvider;
|
||||
use AlibabaCloud\Credentials\Providers\RsaKeyPairCredentialsProvider;
|
||||
use AlibabaCloud\Credentials\Providers\StaticAKCredentialsProvider;
|
||||
use AlibabaCloud\Credentials\Providers\StaticSTSCredentialsProvider;
|
||||
use AlibabaCloud\Credentials\Providers\URLCredentialsProvider;
|
||||
use AlibabaCloud\Credentials\Utils\Helper;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use InvalidArgumentException;
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* Class Credential
|
||||
*
|
||||
* @package AlibabaCloud\Credentials
|
||||
*
|
||||
*/
|
||||
class Credential
|
||||
{
|
||||
|
||||
/**
|
||||
* Version of the Client
|
||||
*/
|
||||
const VERSION = '1.1.5';
|
||||
|
||||
/**
|
||||
* @var Config
|
||||
*/
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* @var CredentialsInterface
|
||||
*/
|
||||
protected $credential;
|
||||
|
||||
/**
|
||||
* Credential constructor.
|
||||
*
|
||||
* @param array|Config $config
|
||||
*/
|
||||
public function __construct($config = [])
|
||||
{
|
||||
if (\is_array($config)) {
|
||||
if (empty($config)) {
|
||||
$this->config = null;
|
||||
} else {
|
||||
$this->config = new Config($this->parseConfig($config));
|
||||
}
|
||||
} else {
|
||||
$this->config = $config;
|
||||
}
|
||||
$this->credential = $this->getCredentials($this->config);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $config
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function parseConfig($config)
|
||||
{
|
||||
$res = [];
|
||||
foreach (\array_change_key_case($config) as $key => $value) {
|
||||
$res[Helper::snakeToCamelCase($key)] = $value;
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Credentials getter.
|
||||
*
|
||||
* @param Config $config
|
||||
* @return CredentialsInterface
|
||||
*
|
||||
*/
|
||||
private function getCredentials($config)
|
||||
{
|
||||
if (is_null($config)) {
|
||||
return new CredentialsProviderWrap('default', new DefaultCredentialsProvider());
|
||||
}
|
||||
switch ($config->type) {
|
||||
case 'access_key':
|
||||
$provider = new StaticAKCredentialsProvider([
|
||||
'accessKeyId' => $config->accessKeyId,
|
||||
'accessKeySecret' => $config->accessKeySecret,
|
||||
]);
|
||||
return new CredentialsProviderWrap('access_key', $provider);
|
||||
case 'sts':
|
||||
$provider = new StaticSTSCredentialsProvider([
|
||||
'accessKeyId' => $config->accessKeyId,
|
||||
'accessKeySecret' => $config->accessKeySecret,
|
||||
'securityToken' => $config->securityToken,
|
||||
]);
|
||||
return new CredentialsProviderWrap('sts', $provider);
|
||||
case 'bearer':
|
||||
return new BearerTokenCredential($config->bearerToken);
|
||||
case 'ram_role_arn':
|
||||
if (!is_null($config->securityToken) && $config->securityToken !== '') {
|
||||
$innerProvider = new StaticSTSCredentialsProvider([
|
||||
'accessKeyId' => $config->accessKeyId,
|
||||
'accessKeySecret' => $config->accessKeySecret,
|
||||
'securityToken' => $config->securityToken,
|
||||
]);
|
||||
} else {
|
||||
$innerProvider = new StaticAKCredentialsProvider([
|
||||
'accessKeyId' => $config->accessKeyId,
|
||||
'accessKeySecret' => $config->accessKeySecret,
|
||||
]);
|
||||
}
|
||||
$provider = new RamRoleArnCredentialsProvider([
|
||||
'credentialsProvider' => $innerProvider,
|
||||
'roleArn' => $config->roleArn,
|
||||
'roleSessionName' => $config->roleSessionName,
|
||||
'policy' => $config->policy,
|
||||
'durationSeconds' => $config->roleSessionExpiration,
|
||||
'externalId' => $config->externalId,
|
||||
'stsEndpoint' => $config->STSEndpoint,
|
||||
], [
|
||||
'connectTimeout' => $config->connectTimeout,
|
||||
'readTimeout' => $config->readTimeout,
|
||||
]);
|
||||
return new CredentialsProviderWrap('ram_role_arn', $provider);
|
||||
case 'rsa_key_pair':
|
||||
$provider = new RsaKeyPairCredentialsProvider([
|
||||
'publicKeyId' => $config->publicKeyId,
|
||||
'privateKeyFile' => $config->privateKeyFile,
|
||||
'durationSeconds' => $config->roleSessionExpiration,
|
||||
'stsEndpoint' => $config->STSEndpoint,
|
||||
], [
|
||||
'connectTimeout' => $config->connectTimeout,
|
||||
'readTimeout' => $config->readTimeout,
|
||||
]);
|
||||
return new CredentialsProviderWrap('rsa_key_pair', $provider);
|
||||
case 'ecs_ram_role':
|
||||
$provider = new EcsRamRoleCredentialsProvider([
|
||||
'roleName' => $config->roleName,
|
||||
'disableIMDSv1' => $config->disableIMDSv1,
|
||||
], [
|
||||
'connectTimeout' => $config->connectTimeout,
|
||||
'readTimeout' => $config->readTimeout,
|
||||
]);
|
||||
return new CredentialsProviderWrap('ecs_ram_role', $provider);
|
||||
case 'oidc_role_arn':
|
||||
$provider = new OIDCRoleArnCredentialsProvider([
|
||||
'roleArn' => $config->roleArn,
|
||||
'oidcProviderArn' => $config->oidcProviderArn,
|
||||
'oidcTokenFilePath' => $config->oidcTokenFilePath,
|
||||
'roleSessionName' => $config->roleSessionName,
|
||||
'policy' => $config->policy,
|
||||
'durationSeconds' => $config->roleSessionExpiration,
|
||||
'stsEndpoint' => $config->STSEndpoint,
|
||||
], [
|
||||
'connectTimeout' => $config->connectTimeout,
|
||||
'readTimeout' => $config->readTimeout,
|
||||
]);
|
||||
return new CredentialsProviderWrap('oidc_role_arn', $provider);
|
||||
case "credentials_uri":
|
||||
$provider = new URLCredentialsProvider([
|
||||
'credentialsURI' => $config->credentialsURI,
|
||||
], [
|
||||
'connectTimeout' => $config->connectTimeout,
|
||||
'readTimeout' => $config->readTimeout,
|
||||
]);
|
||||
return new CredentialsProviderWrap('credentials_uri', $provider);
|
||||
default:
|
||||
throw new InvalidArgumentException('Unsupported credential type option: ' . $config->type . ', support: access_key, sts, bearer, ecs_ram_role, ram_role_arn, rsa_key_pair, oidc_role_arn, credentials_uri');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return CredentialModel
|
||||
* @throws RuntimeException
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function getCredential()
|
||||
{
|
||||
return $this->credential->getCredential();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getConfig()
|
||||
{
|
||||
return $this->config->toMap();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use getCredential() instead
|
||||
*
|
||||
* @return string
|
||||
* @throws RuntimeException
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->credential->getCredential()->getType();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use getCredential() instead
|
||||
*
|
||||
* @return string
|
||||
* @throws RuntimeException
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function getAccessKeyId()
|
||||
{
|
||||
return $this->credential->getCredential()->getAccessKeyId();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use getCredential() instead
|
||||
*
|
||||
* @return string
|
||||
* @throws RuntimeException
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function getAccessKeySecret()
|
||||
{
|
||||
return $this->credential->getCredential()->getAccessKeySecret();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use getCredential() instead
|
||||
*
|
||||
* @return string
|
||||
* @throws RuntimeException
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function getSecurityToken()
|
||||
{
|
||||
return $this->credential->getCredential()->getSecurityToken();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use getCredential() instead
|
||||
*
|
||||
* @return string
|
||||
* @throws RuntimeException
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function getBearerToken()
|
||||
{
|
||||
return $this->credential->getCredential()->getBearerToken();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param array $arguments
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call($name, $arguments)
|
||||
{
|
||||
return $this->credential->$name($arguments);
|
||||
}
|
||||
}
|
||||
270
vendor/alibabacloud/credentials/src/Credential/Config.php
vendored
Normal file
270
vendor/alibabacloud/credentials/src/Credential/Config.php
vendored
Normal file
@@ -0,0 +1,270 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials\Credential;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class Config extends Model
|
||||
{
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->accessKeyId) {
|
||||
$res['accessKeyId'] = $this->accessKeyId;
|
||||
}
|
||||
if (null !== $this->accessKeySecret) {
|
||||
$res['accessKeySecret'] = $this->accessKeySecret;
|
||||
}
|
||||
if (null !== $this->securityToken) {
|
||||
$res['securityToken'] = $this->securityToken;
|
||||
}
|
||||
if (null !== $this->bearerToken) {
|
||||
$res['bearerToken'] = $this->bearerToken;
|
||||
}
|
||||
if (null !== $this->durationSeconds) {
|
||||
$res['durationSeconds'] = $this->durationSeconds;
|
||||
}
|
||||
if (null !== $this->roleArn) {
|
||||
$res['roleArn'] = $this->roleArn;
|
||||
}
|
||||
if (null !== $this->policy) {
|
||||
$res['policy'] = $this->policy;
|
||||
}
|
||||
if (null !== $this->roleSessionExpiration) {
|
||||
$res['roleSessionExpiration'] = $this->roleSessionExpiration;
|
||||
}
|
||||
if (null !== $this->roleSessionName) {
|
||||
$res['roleSessionName'] = $this->roleSessionName;
|
||||
}
|
||||
if (null !== $this->publicKeyId) {
|
||||
$res['publicKeyId'] = $this->publicKeyId;
|
||||
}
|
||||
if (null !== $this->privateKeyFile) {
|
||||
$res['privateKeyFile'] = $this->privateKeyFile;
|
||||
}
|
||||
if (null !== $this->roleName) {
|
||||
$res['roleName'] = $this->roleName;
|
||||
}
|
||||
if (null !== $this->credentialsURI) {
|
||||
$res['credentialsURI'] = $this->credentialsURI;
|
||||
}
|
||||
if (null !== $this->type) {
|
||||
$res['type'] = $this->type;
|
||||
}
|
||||
if (null !== $this->STSEndpoint) {
|
||||
$res['STSEndpoint'] = $this->STSEndpoint;
|
||||
}
|
||||
if (null !== $this->externalId) {
|
||||
$res['externalId'] = $this->externalId;
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
/**
|
||||
* @param array $map
|
||||
* @return Config
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['accessKeyId'])) {
|
||||
$model->accessKeyId = $map['accessKeyId'];
|
||||
}
|
||||
if (isset($map['accessKeySecret'])) {
|
||||
$model->accessKeySecret = $map['accessKeySecret'];
|
||||
}
|
||||
if (isset($map['securityToken'])) {
|
||||
$model->securityToken = $map['securityToken'];
|
||||
}
|
||||
if (isset($map['bearerToken'])) {
|
||||
$model->bearerToken = $map['bearerToken'];
|
||||
}
|
||||
if (isset($map['durationSeconds'])) {
|
||||
$model->durationSeconds = $map['durationSeconds'];
|
||||
}
|
||||
if (isset($map['roleArn'])) {
|
||||
$model->roleArn = $map['roleArn'];
|
||||
}
|
||||
if (isset($map['policy'])) {
|
||||
$model->policy = $map['policy'];
|
||||
}
|
||||
if (isset($map['roleSessionExpiration'])) {
|
||||
$model->roleSessionExpiration = $map['roleSessionExpiration'];
|
||||
}
|
||||
if (isset($map['roleSessionName'])) {
|
||||
$model->roleSessionName = $map['roleSessionName'];
|
||||
}
|
||||
if (isset($map['publicKeyId'])) {
|
||||
$model->publicKeyId = $map['publicKeyId'];
|
||||
}
|
||||
if (isset($map['privateKeyFile'])) {
|
||||
$model->privateKeyFile = $map['privateKeyFile'];
|
||||
}
|
||||
if (isset($map['roleName'])) {
|
||||
$model->roleName = $map['roleName'];
|
||||
}
|
||||
if (isset($map['credentialsURI'])) {
|
||||
$model->credentialsURI = $map['credentialsURI'];
|
||||
}
|
||||
if (isset($map['type'])) {
|
||||
$model->type = $map['type'];
|
||||
}
|
||||
if (isset($map['STSEndpoint'])) {
|
||||
$model->STSEndpoint = $map['STSEndpoint'];
|
||||
}
|
||||
if (isset($map['externalId'])) {
|
||||
$model->externalId = $map['externalId'];
|
||||
}
|
||||
return $model;
|
||||
}
|
||||
/**
|
||||
* @description credential type
|
||||
* @example access_key
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'default';
|
||||
|
||||
/**
|
||||
* @description accesskey id
|
||||
* @var string
|
||||
*/
|
||||
public $accessKeyId;
|
||||
|
||||
/**
|
||||
* @description accesskey secret
|
||||
* @var string
|
||||
*/
|
||||
public $accessKeySecret;
|
||||
|
||||
/**
|
||||
* @description security token
|
||||
* @var string
|
||||
*/
|
||||
public $securityToken;
|
||||
|
||||
/**
|
||||
* @description bearer token
|
||||
* @var string
|
||||
*/
|
||||
public $bearerToken;
|
||||
|
||||
/**
|
||||
* @description role name
|
||||
* @var string
|
||||
*/
|
||||
public $roleName;
|
||||
|
||||
/**
|
||||
* @description role arn
|
||||
* @var string
|
||||
*/
|
||||
public $roleArn;
|
||||
|
||||
/**
|
||||
* @description oidc provider arn
|
||||
* @var string
|
||||
*/
|
||||
public $oidcProviderArn;
|
||||
|
||||
/**
|
||||
* @description oidc token file path
|
||||
* @var string
|
||||
*/
|
||||
public $oidcTokenFilePath;
|
||||
|
||||
/**
|
||||
* @description role session expiration
|
||||
* @example 3600
|
||||
* @var int
|
||||
*/
|
||||
public $roleSessionExpiration;
|
||||
|
||||
/**
|
||||
* @description role session name
|
||||
* @var string
|
||||
*/
|
||||
public $roleSessionName;
|
||||
|
||||
/**
|
||||
* @description role arn policy
|
||||
* @var string
|
||||
*/
|
||||
public $policy;
|
||||
|
||||
/**
|
||||
* @description external id for ram role arn
|
||||
* @var string
|
||||
*/
|
||||
public $externalId;
|
||||
|
||||
/**
|
||||
* @description sts endpoint
|
||||
* @var string
|
||||
*/
|
||||
public $STSEndpoint;
|
||||
|
||||
public $publicKeyId;
|
||||
|
||||
public $privateKeyFile;
|
||||
|
||||
/**
|
||||
* @description read timeout
|
||||
* @var int
|
||||
*/
|
||||
public $readTimeout;
|
||||
|
||||
/**
|
||||
* @description connection timeout
|
||||
* @var int
|
||||
*/
|
||||
public $connectTimeout;
|
||||
|
||||
/**
|
||||
* @description disable IMDS v1
|
||||
* @var bool
|
||||
*/
|
||||
public $disableIMDSv1;
|
||||
|
||||
/**
|
||||
* @description credentials URI
|
||||
* @var string
|
||||
*/
|
||||
public $credentialsURI;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public $metadataTokenDuration;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public $durationSeconds;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public $host;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public $expiration;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public $certFile = "";
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public $certPassword = "";
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public $proxy;
|
||||
}
|
||||
143
vendor/alibabacloud/credentials/src/Credential/CredentialModel.php
vendored
Normal file
143
vendor/alibabacloud/credentials/src/Credential/CredentialModel.php
vendored
Normal file
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
namespace AlibabaCloud\Credentials\Credential;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class CredentialModel extends Model
|
||||
{
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->accessKeyId) {
|
||||
$res['accessKeyId'] = $this->accessKeyId;
|
||||
}
|
||||
if (null !== $this->accessKeySecret) {
|
||||
$res['accessKeySecret'] = $this->accessKeySecret;
|
||||
}
|
||||
if (null !== $this->securityToken) {
|
||||
$res['securityToken'] = $this->securityToken;
|
||||
}
|
||||
if (null !== $this->bearerToken) {
|
||||
$res['bearerToken'] = $this->bearerToken;
|
||||
}
|
||||
if (null !== $this->type) {
|
||||
$res['type'] = $this->type;
|
||||
}
|
||||
if (null !== $this->providerName) {
|
||||
$res['providerName'] = $this->providerName;
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
/**
|
||||
* @param array $map
|
||||
* @return CredentialModel
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['accessKeyId'])) {
|
||||
$model->accessKeyId = $map['accessKeyId'];
|
||||
}
|
||||
if (isset($map['accessKeySecret'])) {
|
||||
$model->accessKeySecret = $map['accessKeySecret'];
|
||||
}
|
||||
if (isset($map['securityToken'])) {
|
||||
$model->securityToken = $map['securityToken'];
|
||||
}
|
||||
if (isset($map['bearerToken'])) {
|
||||
$model->bearerToken = $map['bearerToken'];
|
||||
}
|
||||
if (isset($map['type'])) {
|
||||
$model->type = $map['type'];
|
||||
}
|
||||
if(isset($map['providerName'])){
|
||||
$model->providerName = $map['providerName'];
|
||||
}
|
||||
return $model;
|
||||
}
|
||||
/**
|
||||
* @description accesskey id
|
||||
* @var string
|
||||
*/
|
||||
public $accessKeyId;
|
||||
|
||||
/**
|
||||
* @description accesskey secret
|
||||
* @var string
|
||||
*/
|
||||
public $accessKeySecret;
|
||||
|
||||
/**
|
||||
* @description security token
|
||||
* @var string
|
||||
*/
|
||||
public $securityToken;
|
||||
|
||||
/**
|
||||
* @description bearer token
|
||||
* @var string
|
||||
*/
|
||||
public $bearerToken;
|
||||
|
||||
/**
|
||||
* @description type
|
||||
* @example access_key
|
||||
* @var string
|
||||
*/
|
||||
public $type;
|
||||
|
||||
/**
|
||||
* @description provider name
|
||||
* @example cli_profile/static_ak
|
||||
* @var string
|
||||
*/
|
||||
public $providerName;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAccessKeyId()
|
||||
{
|
||||
return $this->accessKeyId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAccessKeySecret()
|
||||
{
|
||||
return $this->accessKeySecret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getSecurityToken()
|
||||
{
|
||||
return $this->securityToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getBearerToken()
|
||||
{
|
||||
return $this->bearerToken;
|
||||
}
|
||||
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
public function getProviderName()
|
||||
{
|
||||
return $this->providerName;
|
||||
}
|
||||
|
||||
}
|
||||
97
vendor/alibabacloud/credentials/src/Credential/RefreshResult.php
vendored
Normal file
97
vendor/alibabacloud/credentials/src/Credential/RefreshResult.php
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials\Credential;
|
||||
|
||||
use AlibabaCloud\Credentials\Providers\Credentials;
|
||||
|
||||
class RefreshResult
|
||||
{
|
||||
|
||||
/**
|
||||
* RefreshResult constructor.
|
||||
* @param Credentials $params
|
||||
* @param int $staleTime
|
||||
* @param int $prefetchTime
|
||||
*/
|
||||
public function __construct($credentials = null, $staleTime = PHP_INT_MAX, $prefetchTime = PHP_INT_MAX)
|
||||
{
|
||||
$this->credentials = $credentials;
|
||||
$this->staleTime = $staleTime;
|
||||
$this->prefetchTime = $prefetchTime;
|
||||
}
|
||||
public function validate() {}
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->staleTime) {
|
||||
$res['staleTime'] = $this->staleTime;
|
||||
}
|
||||
if (null !== $this->prefetchTime) {
|
||||
$res['prefetchTime'] = $this->prefetchTime;
|
||||
}
|
||||
if (null !== $this->credentials) {
|
||||
$res['credentials'] = $this->credentials;
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
/**
|
||||
* @param array $map
|
||||
* @return RefreshResult
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['staleTime'])) {
|
||||
$model->staleTime = $map['staleTime'];
|
||||
}
|
||||
if (isset($map['prefetchTime'])) {
|
||||
$model->staleTime = $map['prefetchTime'];
|
||||
}
|
||||
if (isset($map['credentials'])) {
|
||||
$model->staleTime = $map['credentials'];
|
||||
}
|
||||
return $model;
|
||||
}
|
||||
/**
|
||||
* @description staleTime
|
||||
* @var int
|
||||
*/
|
||||
public $staleTime;
|
||||
|
||||
/**
|
||||
* @description prefetchTime
|
||||
* @var int
|
||||
*/
|
||||
public $prefetchTime;
|
||||
|
||||
/**
|
||||
* @description credentials
|
||||
* @var Credentials
|
||||
*/
|
||||
public $credentials;
|
||||
|
||||
|
||||
/**
|
||||
* @return Credentials
|
||||
*/
|
||||
public function credentials()
|
||||
{
|
||||
return $this->credentials;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public function staleTime()
|
||||
{
|
||||
return $this->staleTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public function prefetchTime()
|
||||
{
|
||||
return $this->prefetchTime;
|
||||
}
|
||||
}
|
||||
104
vendor/alibabacloud/credentials/src/Credentials.php
vendored
Normal file
104
vendor/alibabacloud/credentials/src/Credentials.php
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials;
|
||||
|
||||
use AlibabaCloud\Credentials\Providers\ChainProvider;
|
||||
use AlibabaCloud\Credentials\Utils\Filter;
|
||||
use AlibabaCloud\Credentials\Utils\MockTrait;
|
||||
use ReflectionException;
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* Class Credentials
|
||||
*
|
||||
* @package AlibabaCloud\Credentials
|
||||
*/
|
||||
class Credentials
|
||||
{
|
||||
use MockTrait;
|
||||
|
||||
/**
|
||||
* @var array|CredentialsInterface[] containers of credentials
|
||||
*/
|
||||
protected static $credentials = [];
|
||||
|
||||
/**
|
||||
* Get the credential instance by name.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return Credential
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
public static function get($name = null)
|
||||
{
|
||||
if ($name !== null) {
|
||||
Filter::credentialName($name);
|
||||
} else {
|
||||
$name = ChainProvider::getDefaultName();
|
||||
}
|
||||
|
||||
self::load();
|
||||
|
||||
if (self::has($name)) {
|
||||
return new Credential(self::$credentials[\strtolower($name)]);
|
||||
}
|
||||
|
||||
throw new RuntimeException("Credential '$name' not found");
|
||||
}
|
||||
|
||||
private static function load()
|
||||
{
|
||||
if (self::$credentials) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ChainProvider::hasCustomChain()) {
|
||||
ChainProvider::customProvider(ChainProvider::getDefaultName());
|
||||
} else {
|
||||
ChainProvider::defaultProvider(ChainProvider::getDefaultName());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether there is a credential.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function has($name)
|
||||
{
|
||||
Filter::credentialName($name);
|
||||
|
||||
return isset(self::$credentials[\strtolower($name)]);
|
||||
}
|
||||
|
||||
public static function flush()
|
||||
{
|
||||
self::$credentials = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all credentials.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function all()
|
||||
{
|
||||
self::load();
|
||||
|
||||
return self::$credentials;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param array $credential
|
||||
*/
|
||||
public static function set($name, array $credential)
|
||||
{
|
||||
Filter::credentialName($name);
|
||||
|
||||
self::$credentials[\strtolower($name)] = \array_change_key_case($credential);
|
||||
}
|
||||
}
|
||||
32
vendor/alibabacloud/credentials/src/CredentialsInterface.php
vendored
Normal file
32
vendor/alibabacloud/credentials/src/CredentialsInterface.php
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials;
|
||||
|
||||
use AlibabaCloud\Credentials\Credential\CredentialModel;
|
||||
use AlibabaCloud\Credentials\Signature\SignatureInterface;
|
||||
|
||||
/**
|
||||
* @internal This class is intended for internal use within the package.
|
||||
* Interface CredentialsInterface
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
interface CredentialsInterface
|
||||
{
|
||||
/**
|
||||
* @deprecated
|
||||
* @return string
|
||||
*/
|
||||
public function __toString();
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @return SignatureInterface
|
||||
*/
|
||||
public function getSignature();
|
||||
|
||||
/**
|
||||
* @return CredentialModel
|
||||
*/
|
||||
public function getCredential();
|
||||
}
|
||||
76
vendor/alibabacloud/credentials/src/CredentialsProviderWrap.php
vendored
Normal file
76
vendor/alibabacloud/credentials/src/CredentialsProviderWrap.php
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials;
|
||||
|
||||
use AlibabaCloud\Credentials\Credential\CredentialModel;
|
||||
use AlibabaCloud\Credentials\Providers\CredentialsProvider;
|
||||
|
||||
/**
|
||||
* @internal This class is intended for internal use within the package.
|
||||
* Class CredentialsProviderWrap
|
||||
*
|
||||
* @package AlibabaCloud\Credentials
|
||||
*/
|
||||
class CredentialsProviderWrap implements CredentialsInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $typeName;
|
||||
|
||||
/**
|
||||
* @var CredentialsProvider
|
||||
*/
|
||||
private $credentialsProvider;
|
||||
|
||||
/**
|
||||
* CLIProfileCredentialsProvider constructor.
|
||||
*
|
||||
* @param string $typeName
|
||||
* @param CredentialsProvider $credentialsProvider
|
||||
*/
|
||||
public function __construct($typeName, $credentialsProvider)
|
||||
{
|
||||
$this->typeName = $typeName;
|
||||
$this->credentialsProvider = $credentialsProvider;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getCredential()
|
||||
{
|
||||
$credentials = $this->credentialsProvider->getCredentials();
|
||||
return new CredentialModel([
|
||||
'accessKeyId' => $credentials->getAccessKeyId(),
|
||||
'accessKeySecret' => $credentials->getAccessKeySecret(),
|
||||
'securityToken' => $credentials->getSecurityToken(),
|
||||
'type' => $this->typeName,
|
||||
'providerName' => $credentials->getProviderName(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param array $arguments
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call($name, $arguments)
|
||||
{
|
||||
return $this->credentialsProvider->$name($arguments);
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
return "credentialsProviderWrap#$this->typeName";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ShaHmac1Signature
|
||||
*/
|
||||
public function getSignature()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
199
vendor/alibabacloud/credentials/src/EcsRamRoleCredential.php
vendored
Normal file
199
vendor/alibabacloud/credentials/src/EcsRamRoleCredential.php
vendored
Normal file
@@ -0,0 +1,199 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials;
|
||||
|
||||
use AlibabaCloud\Credentials\Providers\EcsRamRoleCredentialsProvider;
|
||||
use AlibabaCloud\Credentials\Credential\CredentialModel;
|
||||
use AlibabaCloud\Credentials\Signature\ShaHmac1Signature;
|
||||
use AlibabaCloud\Credentials\Request\Request;
|
||||
use AlibabaCloud\Credentials\Utils\Filter;
|
||||
use Exception;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use InvalidArgumentException;
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* Use the RAM role of an ECS instance to complete the authentication.
|
||||
*/
|
||||
class EcsRamRoleCredential implements CredentialsInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $roleName;
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
*/
|
||||
private $disableIMDSv1;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $metadataTokenDuration;
|
||||
|
||||
|
||||
/**
|
||||
* EcsRamRoleCredential constructor.
|
||||
*
|
||||
* @param $role_name
|
||||
*/
|
||||
public function __construct($role_name = null, $disable_imdsv1 = false, $metadata_token_duration = 21600)
|
||||
{
|
||||
Filter::roleName($role_name);
|
||||
|
||||
$this->roleName = $role_name;
|
||||
|
||||
Filter::disableIMDSv1($disable_imdsv1);
|
||||
|
||||
$this->disableIMDSv1 = $disable_imdsv1;
|
||||
|
||||
$this->metadataTokenDuration = $metadata_token_duration;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws GuzzleException
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getRoleName()
|
||||
{
|
||||
if ($this->roleName !== null) {
|
||||
return $this->roleName;
|
||||
}
|
||||
|
||||
$this->roleName = $this->getRoleNameFromMeta();
|
||||
|
||||
return $this->roleName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getRoleNameFromMeta()
|
||||
{
|
||||
$options = [
|
||||
'http_errors' => false,
|
||||
'timeout' => 1,
|
||||
'connect_timeout' => 1,
|
||||
];
|
||||
|
||||
$result = Request::createClient()->request(
|
||||
'GET',
|
||||
'http://100.100.100.200/latest/meta-data/ram/security-credentials/',
|
||||
$options
|
||||
);
|
||||
|
||||
if ($result->getStatusCode() === 404) {
|
||||
throw new InvalidArgumentException('The role name was not found in the instance');
|
||||
}
|
||||
|
||||
if ($result->getStatusCode() !== 200) {
|
||||
throw new RuntimeException('Error retrieving credentials from result: ' . $result->getBody());
|
||||
}
|
||||
|
||||
$role_name = (string) $result;
|
||||
if (!$role_name) {
|
||||
throw new RuntimeException('Error retrieving credentials from result is empty');
|
||||
}
|
||||
|
||||
return $role_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return "roleName#$this->roleName";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ShaHmac1Signature
|
||||
*/
|
||||
public function getSignature()
|
||||
{
|
||||
return new ShaHmac1Signature();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function getAccessKeyId()
|
||||
{
|
||||
return $this->getSessionCredential()->getAccessKeyId();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return AlibabaCloud\Credentials\Providers\Credentials
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
protected function getSessionCredential()
|
||||
{
|
||||
$params = [
|
||||
"roleName" => $this->roleName,
|
||||
'disableIMDSv1' => $this->disableIMDSv1,
|
||||
'metadataTokenDuration' => $this->metadataTokenDuration,
|
||||
];
|
||||
return (new EcsRamRoleCredentialsProvider($params))->getCredentials();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function getAccessKeySecret()
|
||||
{
|
||||
return $this->getSessionCredential()->getAccessKeySecret();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function getSecurityToken()
|
||||
{
|
||||
return $this->getSessionCredential()->getSecurityToken();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function getExpiration()
|
||||
{
|
||||
return $this->getSessionCredential()->getExpiration();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isDisableIMDSv1()
|
||||
{
|
||||
return $this->disableIMDSv1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getCredential()
|
||||
{
|
||||
$credentials = $this->getSessionCredential();
|
||||
return new CredentialModel([
|
||||
'accessKeyId' => $credentials->getAccessKeyId(),
|
||||
'accessKeySecret' => $credentials->getAccessKeySecret(),
|
||||
'securityToken' => $credentials->getSecurityToken(),
|
||||
'type' => 'ecs_ram_role',
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
193
vendor/alibabacloud/credentials/src/Providers/CLIProfileCredentialsProvider.php
vendored
Normal file
193
vendor/alibabacloud/credentials/src/Providers/CLIProfileCredentialsProvider.php
vendored
Normal file
@@ -0,0 +1,193 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials\Providers;
|
||||
|
||||
use AlibabaCloud\Credentials\Utils\Helper;
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* @internal This class is intended for internal use within the package.
|
||||
* Class CLIProfileCredentialsProvider
|
||||
*
|
||||
* @package AlibabaCloud\Credentials\Providers
|
||||
*/
|
||||
class CLIProfileCredentialsProvider implements CredentialsProvider
|
||||
{
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $profileName;
|
||||
|
||||
/**
|
||||
* @var CredentialsProvider
|
||||
*/
|
||||
private $credentialsProvider;
|
||||
|
||||
|
||||
/**
|
||||
* CLIProfileCredentialsProvider constructor.
|
||||
*
|
||||
* @param array $params
|
||||
*/
|
||||
public function __construct(array $params = [])
|
||||
{
|
||||
$this->filterProfileName($params);
|
||||
}
|
||||
|
||||
private function filterProfileName(array $params)
|
||||
{
|
||||
if (Helper::envNotEmpty('ALIBABA_CLOUD_PROFILE')) {
|
||||
$this->profileName = Helper::env('ALIBABA_CLOUD_PROFILE');
|
||||
}
|
||||
|
||||
if (isset($params['profileName'])) {
|
||||
$this->profileName = $params['profileName'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
private function shouldReloadCredentialsProvider()
|
||||
{
|
||||
if (is_null($this->credentialsProvider)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return CredentialsProvider
|
||||
*/
|
||||
protected function reloadCredentialsProvider($profileFile, $profileName)
|
||||
{
|
||||
if (!Helper::inOpenBasedir($profileFile)) {
|
||||
throw new RuntimeException('Unable to open credentials file: ' . $profileFile);
|
||||
}
|
||||
|
||||
if (!\is_readable($profileFile) || !\is_file($profileFile)) {
|
||||
throw new RuntimeException('Credentials file is not readable: ' . $profileFile);
|
||||
}
|
||||
|
||||
$jsonContent = \file_get_contents($profileFile);
|
||||
$fileArray = json_decode($jsonContent, true);
|
||||
|
||||
if (\is_array($fileArray) && !empty($fileArray)) {
|
||||
if (is_null($profileName) || $profileName === '') {
|
||||
$profileName = $fileArray['current'];
|
||||
}
|
||||
if (isset($fileArray['profiles'])) {
|
||||
foreach ($fileArray['profiles'] as $profile) {
|
||||
if (Helper::unsetReturnNull($profile, 'name') === $profileName) {
|
||||
switch (Helper::unsetReturnNull($profile, 'mode')) {
|
||||
case 'AK':
|
||||
return new StaticAKCredentialsProvider([
|
||||
'accessKeyId' => Helper::unsetReturnNull($profile, 'access_key_id'),
|
||||
'accessKeySecret' => Helper::unsetReturnNull($profile, 'access_key_secret'),
|
||||
]);
|
||||
case 'StsToken':
|
||||
return new StaticSTSCredentialsProvider([
|
||||
'accessKeyId' => Helper::unsetReturnNull($profile, 'access_key_id'),
|
||||
'accessKeySecret' => Helper::unsetReturnNull($profile, 'access_key_secret'),
|
||||
'securityToken' => Helper::unsetReturnNull($profile, 'sts_token'),
|
||||
]);
|
||||
case 'RamRoleArn':
|
||||
$innerProvider = new StaticAKCredentialsProvider([
|
||||
'accessKeyId' => Helper::unsetReturnNull($profile, 'access_key_id'),
|
||||
'accessKeySecret' => Helper::unsetReturnNull($profile, 'access_key_secret'),
|
||||
]);
|
||||
return new RamRoleArnCredentialsProvider([
|
||||
'credentialsProvider' => $innerProvider,
|
||||
'roleArn' => Helper::unsetReturnNull($profile, 'ram_role_arn'),
|
||||
'roleSessionName' => Helper::unsetReturnNull($profile, 'ram_session_name'),
|
||||
'durationSeconds' => Helper::unsetReturnNull($profile, 'expired_seconds'),
|
||||
'policy' => Helper::unsetReturnNull($profile, 'policy'),
|
||||
'externalId' => Helper::unsetReturnNull($profile, 'external_id'),
|
||||
'stsRegionId' => Helper::unsetReturnNull($profile, 'sts_region'),
|
||||
'enableVpc' => Helper::unsetReturnNull($profile, 'enable_vpc'),
|
||||
]);
|
||||
case 'EcsRamRole':
|
||||
return new EcsRamRoleCredentialsProvider([
|
||||
'roleName' => Helper::unsetReturnNull($profile, 'ram_role_name'),
|
||||
]);
|
||||
case 'OIDC':
|
||||
return new OIDCRoleArnCredentialsProvider([
|
||||
'roleArn' => Helper::unsetReturnNull($profile, 'ram_role_arn'),
|
||||
'oidcProviderArn' => Helper::unsetReturnNull($profile, 'oidc_provider_arn'),
|
||||
'oidcTokenFilePath' => Helper::unsetReturnNull($profile, 'oidc_token_file'),
|
||||
'roleSessionName' => Helper::unsetReturnNull($profile, 'ram_session_name'),
|
||||
'durationSeconds' => Helper::unsetReturnNull($profile, 'expired_seconds'),
|
||||
'policy' => Helper::unsetReturnNull($profile, 'policy'),
|
||||
'stsRegionId' => Helper::unsetReturnNull($profile, 'sts_region'),
|
||||
'enableVpc' => Helper::unsetReturnNull($profile, 'enable_vpc'),
|
||||
]);
|
||||
case 'ChainableRamRoleArn':
|
||||
$previousProvider = $this->reloadCredentialsProvider($profileFile, Helper::unsetReturnNull($profile, 'source_profile'));
|
||||
return new RamRoleArnCredentialsProvider([
|
||||
'credentialsProvider' => $previousProvider,
|
||||
'roleArn' => Helper::unsetReturnNull($profile, 'ram_role_arn'),
|
||||
'roleSessionName' => Helper::unsetReturnNull($profile, 'ram_session_name'),
|
||||
'durationSeconds' => Helper::unsetReturnNull($profile, 'expired_seconds'),
|
||||
'policy' => Helper::unsetReturnNull($profile, 'policy'),
|
||||
'externalId' => Helper::unsetReturnNull($profile, 'external_id'),
|
||||
'stsRegionId' => Helper::unsetReturnNull($profile, 'sts_region'),
|
||||
'enableVpc' => Helper::unsetReturnNull($profile, 'enable_vpc'),
|
||||
]);
|
||||
default:
|
||||
throw new RuntimeException('Unsupported credential mode from CLI credentials file: ' . Helper::unsetReturnNull($profile, 'mode'));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new RuntimeException('Failed to get credential from CLI credentials file: ' . $profileFile);
|
||||
}
|
||||
/**
|
||||
* Get credential.
|
||||
*
|
||||
* @return Credentials
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public function getCredentials()
|
||||
{
|
||||
if (Helper::envNotEmpty('ALIBABA_CLOUD_CLI_PROFILE_DISABLED') && Helper::env('ALIBABA_CLOUD_CLI_PROFILE_DISABLED') === true) {
|
||||
throw new RuntimeException('CLI credentials file is disabled');
|
||||
}
|
||||
$cliProfileFile = self::getDefaultFile();
|
||||
if ($this->shouldReloadCredentialsProvider()) {
|
||||
$this->credentialsProvider = $this->reloadCredentialsProvider($cliProfileFile, $this->profileName);
|
||||
}
|
||||
|
||||
$credentials = $this->credentialsProvider->getCredentials();
|
||||
return new Credentials([
|
||||
'accessKeyId' => $credentials->getAccessKeyId(),
|
||||
'accessKeySecret' => $credentials->getAccessKeySecret(),
|
||||
'securityToken' => $credentials->getSecurityToken(),
|
||||
'providerName' => $this->getProviderName() . '/' . $this->credentialsProvider->getProviderName(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default credential file.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function getDefaultFile()
|
||||
{
|
||||
return Helper::getHomeDirectory() .
|
||||
DIRECTORY_SEPARATOR .
|
||||
'.aliyun' .
|
||||
DIRECTORY_SEPARATOR .
|
||||
'config.json';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getProviderName()
|
||||
{
|
||||
return 'cli_profile';
|
||||
}
|
||||
}
|
||||
188
vendor/alibabacloud/credentials/src/Providers/ChainProvider.php
vendored
Normal file
188
vendor/alibabacloud/credentials/src/Providers/ChainProvider.php
vendored
Normal file
@@ -0,0 +1,188 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials\Providers;
|
||||
|
||||
use AlibabaCloud\Credentials\Credentials;
|
||||
use AlibabaCloud\Credentials\Utils\Helper;
|
||||
use Closure;
|
||||
use InvalidArgumentException;
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* Class ChainProvider
|
||||
*
|
||||
* @package AlibabaCloud\Credentials\Providers
|
||||
*/
|
||||
class ChainProvider
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private static $customChains;
|
||||
|
||||
/**
|
||||
* @param callable ...$providers
|
||||
*/
|
||||
public static function set(...$providers)
|
||||
{
|
||||
if (empty($providers)) {
|
||||
throw new InvalidArgumentException('No providers in chain');
|
||||
}
|
||||
|
||||
foreach ($providers as $provider) {
|
||||
if (!$provider instanceof Closure) {
|
||||
throw new InvalidArgumentException('Providers must all be Closures');
|
||||
}
|
||||
}
|
||||
|
||||
self::$customChains = $providers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public static function hasCustomChain()
|
||||
{
|
||||
return (bool)self::$customChains;
|
||||
}
|
||||
|
||||
public static function flush()
|
||||
{
|
||||
self::$customChains = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
*/
|
||||
public static function customProvider($name)
|
||||
{
|
||||
foreach (self::$customChains as $provider) {
|
||||
$provider();
|
||||
|
||||
if (Credentials::has($name)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
*/
|
||||
public static function defaultProvider($name)
|
||||
{
|
||||
$providers = [
|
||||
self::env(),
|
||||
self::ini(),
|
||||
self::instance(),
|
||||
];
|
||||
|
||||
foreach ($providers as $provider) {
|
||||
$provider();
|
||||
|
||||
if (Credentials::has($name)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Closure
|
||||
*/
|
||||
public static function env()
|
||||
{
|
||||
return static function () {
|
||||
$accessKeyId = Helper::envNotEmpty('ALIBABA_CLOUD_ACCESS_KEY_ID');
|
||||
$accessKeySecret = Helper::envNotEmpty('ALIBABA_CLOUD_ACCESS_KEY_SECRET');
|
||||
|
||||
if ($accessKeyId && $accessKeySecret) {
|
||||
Credentials::set(
|
||||
self::getDefaultName(),
|
||||
[
|
||||
'type' => 'access_key',
|
||||
'access_key_id' => $accessKeyId,
|
||||
'access_key_secret' => $accessKeySecret,
|
||||
]
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public static function getDefaultName()
|
||||
{
|
||||
$name = Helper::envNotEmpty('ALIBABA_CLOUD_PROFILE');
|
||||
|
||||
if ($name) {
|
||||
return $name;
|
||||
}
|
||||
|
||||
return 'default';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Closure
|
||||
*/
|
||||
public static function ini()
|
||||
{
|
||||
return static function () {
|
||||
$filename = Helper::envNotEmpty('ALIBABA_CLOUD_CREDENTIALS_FILE');
|
||||
if (!$filename) {
|
||||
$filename = self::getDefaultFile();
|
||||
}
|
||||
|
||||
if (!Helper::inOpenBasedir($filename)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($filename !== self::getDefaultFile() && (!\is_readable($filename) || !\is_file($filename))) {
|
||||
throw new RuntimeException(
|
||||
'Credentials file is not readable: ' . $filename
|
||||
);
|
||||
}
|
||||
|
||||
$file_array = \parse_ini_file($filename, true);
|
||||
|
||||
if (\is_array($file_array) && !empty($file_array)) {
|
||||
foreach (\array_change_key_case($file_array) as $name => $configures) {
|
||||
Credentials::set($name, $configures);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default credential file.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getDefaultFile()
|
||||
{
|
||||
return Helper::getHomeDirectory() .
|
||||
DIRECTORY_SEPARATOR .
|
||||
'.alibabacloud' .
|
||||
DIRECTORY_SEPARATOR .
|
||||
'credentials';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Closure
|
||||
*/
|
||||
public static function instance()
|
||||
{
|
||||
return static function () {
|
||||
$instance = Helper::envNotEmpty('ALIBABA_CLOUD_ECS_METADATA');
|
||||
if ($instance) {
|
||||
Credentials::set(
|
||||
self::getDefaultName(),
|
||||
[
|
||||
'type' => 'ecs_ram_role',
|
||||
'role_name' => $instance,
|
||||
]
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
87
vendor/alibabacloud/credentials/src/Providers/Credentials.php
vendored
Normal file
87
vendor/alibabacloud/credentials/src/Providers/Credentials.php
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials\Providers;
|
||||
|
||||
/**
|
||||
* @internal This class is intended for internal use within the package.
|
||||
* Class Credentials
|
||||
*
|
||||
* @package AlibabaCloud\Credentials\Providers
|
||||
*/
|
||||
class Credentials
|
||||
{
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $accessKeyId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $accessKeySecret;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $securityToken;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $expiration;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $providerName;
|
||||
|
||||
public function __construct($config = [])
|
||||
{
|
||||
if (!empty($config)) {
|
||||
foreach ($config as $k => $v) {
|
||||
$this->{$k} = $v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAccessKeyId()
|
||||
{
|
||||
return $this->accessKeyId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAccessKeySecret()
|
||||
{
|
||||
return $this->accessKeySecret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getSecurityToken()
|
||||
{
|
||||
return $this->securityToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getExpiration()
|
||||
{
|
||||
return $this->expiration;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getProviderName()
|
||||
{
|
||||
return $this->providerName;
|
||||
}
|
||||
}
|
||||
24
vendor/alibabacloud/credentials/src/Providers/CredentialsProvider.php
vendored
Normal file
24
vendor/alibabacloud/credentials/src/Providers/CredentialsProvider.php
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials\Providers;
|
||||
|
||||
|
||||
/**
|
||||
* @internal This class is intended for internal use within the package.
|
||||
* Interface CredentialsInterface
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
interface CredentialsProvider
|
||||
{
|
||||
|
||||
/**
|
||||
* @return Credentials
|
||||
*/
|
||||
public function getCredentials();
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getProviderName();
|
||||
}
|
||||
175
vendor/alibabacloud/credentials/src/Providers/DefaultCredentialsProvider.php
vendored
Normal file
175
vendor/alibabacloud/credentials/src/Providers/DefaultCredentialsProvider.php
vendored
Normal file
@@ -0,0 +1,175 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials\Providers;
|
||||
|
||||
use AlibabaCloud\Credentials\Utils\Filter;
|
||||
use AlibabaCloud\Credentials\Utils\Helper;
|
||||
use InvalidArgumentException;
|
||||
use RuntimeException;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* @internal This class is intended for internal use within the package.
|
||||
* Class DefaultCredentialsProvider
|
||||
*
|
||||
* @package AlibabaCloud\Credentials\Providers
|
||||
*/
|
||||
class DefaultCredentialsProvider implements CredentialsProvider
|
||||
{
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private static $defaultProviders = [];
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $reuseLastProviderEnabled;
|
||||
|
||||
/**
|
||||
* @var CredentialsProvider
|
||||
*/
|
||||
private $lastUsedCredentialsProvider;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private static $customChain = [];
|
||||
|
||||
/**
|
||||
* DefaultCredentialsProvider constructor.
|
||||
* @param array $params
|
||||
*/
|
||||
public function __construct(array $params = [])
|
||||
{
|
||||
$this->filterReuseLastProviderEnabled($params);
|
||||
$this->createDefaultChain();
|
||||
Filter::reuseLastProviderEnabled($this->reuseLastProviderEnabled);
|
||||
}
|
||||
|
||||
private function filterReuseLastProviderEnabled(array $params)
|
||||
{
|
||||
$this->reuseLastProviderEnabled = true;
|
||||
if (isset($params['reuseLastProviderEnabled'])) {
|
||||
$this->reuseLastProviderEnabled = $params['reuseLastProviderEnabled'];
|
||||
}
|
||||
}
|
||||
|
||||
private function createDefaultChain()
|
||||
{
|
||||
self::$defaultProviders = [
|
||||
new EnvironmentVariableCredentialsProvider(),
|
||||
];
|
||||
if (
|
||||
Helper::envNotEmpty('ALIBABA_CLOUD_ROLE_ARN')
|
||||
&& Helper::envNotEmpty('ALIBABA_CLOUD_OIDC_PROVIDER_ARN')
|
||||
&& Helper::envNotEmpty('ALIBABA_CLOUD_OIDC_TOKEN_FILE')
|
||||
) {
|
||||
array_push(
|
||||
self::$defaultProviders,
|
||||
new OIDCRoleArnCredentialsProvider()
|
||||
);
|
||||
}
|
||||
array_push(
|
||||
self::$defaultProviders,
|
||||
new CLIProfileCredentialsProvider()
|
||||
);
|
||||
array_push(
|
||||
self::$defaultProviders,
|
||||
new ProfileCredentialsProvider()
|
||||
);
|
||||
array_push(
|
||||
self::$defaultProviders,
|
||||
new EcsRamRoleCredentialsProvider()
|
||||
);
|
||||
if (Helper::envNotEmpty('ALIBABA_CLOUD_CREDENTIALS_URI')) {
|
||||
array_push(
|
||||
self::$defaultProviders,
|
||||
new URLCredentialsProvider()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CredentialsProvider ...$providers
|
||||
*/
|
||||
public static function set(...$providers)
|
||||
{
|
||||
if (empty($providers)) {
|
||||
throw new InvalidArgumentException('No providers in chain');
|
||||
}
|
||||
|
||||
foreach ($providers as $provider) {
|
||||
if (!$provider instanceof CredentialsProvider) {
|
||||
throw new InvalidArgumentException('Providers must all be CredentialsProvider');
|
||||
}
|
||||
}
|
||||
|
||||
self::$customChain = $providers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public static function hasCustomChain()
|
||||
{
|
||||
return (bool) self::$customChain;
|
||||
}
|
||||
|
||||
public static function flush()
|
||||
{
|
||||
self::$customChain = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get credential.
|
||||
*
|
||||
* @return Credentials
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public function getCredentials()
|
||||
{
|
||||
if ($this->reuseLastProviderEnabled && !is_null($this->lastUsedCredentialsProvider)) {
|
||||
$credentials = $this->lastUsedCredentialsProvider->getCredentials();
|
||||
return new Credentials([
|
||||
'accessKeyId' => $credentials->getAccessKeyId(),
|
||||
'accessKeySecret' => $credentials->getAccessKeySecret(),
|
||||
'securityToken' => $credentials->getSecurityToken(),
|
||||
'providerName' => $this->getProviderName() . '/' . $this->lastUsedCredentialsProvider->getProviderName(),
|
||||
]);
|
||||
}
|
||||
|
||||
$providerChain = array_merge(
|
||||
self::$customChain,
|
||||
self::$defaultProviders
|
||||
);
|
||||
|
||||
$exceptionMessages = [];
|
||||
|
||||
foreach ($providerChain as $provider) {
|
||||
try {
|
||||
$credentials = $provider->getCredentials();
|
||||
$this->lastUsedCredentialsProvider = $provider;
|
||||
return new Credentials([
|
||||
'accessKeyId' => $credentials->getAccessKeyId(),
|
||||
'accessKeySecret' => $credentials->getAccessKeySecret(),
|
||||
'securityToken' => $credentials->getSecurityToken(),
|
||||
'providerName' => $this->getProviderName() . '/' . $provider->getProviderName(),
|
||||
]);
|
||||
} catch (Exception $exception) {
|
||||
array_push($exceptionMessages, basename(str_replace('\\', '/', get_class($provider))) . ': ' . $exception->getMessage());
|
||||
}
|
||||
}
|
||||
throw new RuntimeException('Unable to load credentials from any of the providers in the chain: ' . implode(', ', $exceptionMessages));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getProviderName()
|
||||
{
|
||||
return "default";
|
||||
}
|
||||
}
|
||||
276
vendor/alibabacloud/credentials/src/Providers/EcsRamRoleCredentialsProvider.php
vendored
Normal file
276
vendor/alibabacloud/credentials/src/Providers/EcsRamRoleCredentialsProvider.php
vendored
Normal file
@@ -0,0 +1,276 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials\Providers;
|
||||
|
||||
use AlibabaCloud\Credentials\Utils\Helper;
|
||||
use AlibabaCloud\Credentials\Utils\Filter;
|
||||
use AlibabaCloud\Credentials\Request\Request;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use InvalidArgumentException;
|
||||
use RuntimeException;
|
||||
use AlibabaCloud\Credentials\Credential\RefreshResult;
|
||||
|
||||
/**
|
||||
* @internal This class is intended for internal use within the package.
|
||||
* Class EcsRamRoleCredentialsProvider
|
||||
*
|
||||
* @package AlibabaCloud\Credentials\Providers
|
||||
*/
|
||||
class EcsRamRoleCredentialsProvider extends SessionCredentialsProvider
|
||||
{
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $metadataHost = 'http://100.100.100.200';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $ecsUri = '/latest/meta-data/ram/security-credentials/';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $metadataTokenUri = '/latest/api/token';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $roleName;
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
*/
|
||||
private $disableIMDSv1 = false;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $metadataTokenDuration = 21600;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $connectTimeout = 1;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $readTimeout = 1;
|
||||
|
||||
|
||||
/**
|
||||
* EcsRamRoleCredentialsProvider constructor.
|
||||
*
|
||||
* @param array $params
|
||||
* @param array $options
|
||||
*/
|
||||
public function __construct(array $params = [], array $options = [])
|
||||
{
|
||||
$this->filterOptions($options);
|
||||
$this->filterRoleName($params);
|
||||
$this->filterDisableECSIMDSv1($params);
|
||||
Filter::roleName($this->roleName);
|
||||
Filter::disableIMDSv1($this->disableIMDSv1);
|
||||
}
|
||||
|
||||
private function filterOptions(array $options)
|
||||
{
|
||||
if (isset($options['connectTimeout'])) {
|
||||
$this->connectTimeout = $options['connectTimeout'];
|
||||
}
|
||||
|
||||
if (isset($options['readTimeout'])) {
|
||||
$this->readTimeout = $options['readTimeout'];
|
||||
}
|
||||
|
||||
Filter::timeout($this->connectTimeout, $this->readTimeout);
|
||||
}
|
||||
|
||||
private function filterRoleName(array $params)
|
||||
{
|
||||
if (Helper::envNotEmpty('ALIBABA_CLOUD_ECS_METADATA')) {
|
||||
$this->roleName = Helper::env('ALIBABA_CLOUD_ECS_METADATA');
|
||||
}
|
||||
|
||||
if (isset($params['roleName'])) {
|
||||
$this->roleName = $params['roleName'];
|
||||
}
|
||||
}
|
||||
|
||||
private function filterDisableECSIMDSv1($params)
|
||||
{
|
||||
if (Helper::envNotEmpty('ALIBABA_CLOUD_IMDSV1_DISABLED')) {
|
||||
$this->disableIMDSv1 = Helper::env('ALIBABA_CLOUD_IMDSV1_DISABLED') === true ? true : false;
|
||||
}
|
||||
|
||||
if (isset($params['disableIMDSv1'])) {
|
||||
$this->disableIMDSv1 = $params['disableIMDSv1'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get credentials by request.
|
||||
*
|
||||
* @return RefreshResult
|
||||
* @throws InvalidArgumentException
|
||||
* @throws RuntimeException
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function refreshCredentials()
|
||||
{
|
||||
if (Helper::envNotEmpty('ALIBABA_CLOUD_ECS_METADATA_DISABLED') && Helper::env('ALIBABA_CLOUD_ECS_METADATA_DISABLED') === true) {
|
||||
throw new RuntimeException('IMDS credentials is disabled');
|
||||
}
|
||||
|
||||
if (is_null($this->roleName) || $this->roleName === '') {
|
||||
$this->roleName = $this->getRoleNameFromMeta();
|
||||
}
|
||||
|
||||
$url = $this->metadataHost . $this->ecsUri . $this->roleName;
|
||||
$options = Request::commonOptions();
|
||||
$options['read_timeout'] = $this->readTimeout;
|
||||
$options['connect_timeout'] = $this->connectTimeout;
|
||||
|
||||
$metadataToken = $this->getMetadataToken();
|
||||
if (!is_null($metadataToken)) {
|
||||
$options['headers']['X-aliyun-ecs-metadata-token'] = $metadataToken;
|
||||
}
|
||||
|
||||
$result = Request::createClient()->request('GET', $url, $options);
|
||||
|
||||
if ($result->getStatusCode() === 404) {
|
||||
throw new InvalidArgumentException('The role was not found in the instance' . (string) $result);
|
||||
}
|
||||
|
||||
if ($result->getStatusCode() !== 200) {
|
||||
throw new RuntimeException('Error refreshing credentials from IMDS, statusCode: ' . $result->getStatusCode() . ', result: ' . (string) $result);
|
||||
}
|
||||
|
||||
$credentials = $result->toArray();
|
||||
|
||||
if (!isset($credentials['AccessKeyId']) || !isset($credentials['AccessKeySecret']) || !isset($credentials['SecurityToken'])) {
|
||||
throw new RuntimeException('Error retrieving credentials from IMDS result:' . $result->toJson());
|
||||
}
|
||||
|
||||
if (!isset($credentials['Code']) || $credentials['Code'] !== 'Success') {
|
||||
throw new RuntimeException('Error retrieving credentials from IMDS result, Code is not Success:' . $result->toJson());
|
||||
}
|
||||
|
||||
return new RefreshResult(new Credentials([
|
||||
'accessKeyId' => $credentials['AccessKeyId'],
|
||||
'accessKeySecret' => $credentials['AccessKeySecret'],
|
||||
'securityToken' => $credentials['SecurityToken'],
|
||||
'expiration' => \strtotime($credentials['Expiration']),
|
||||
'providerName' => $this->getProviderName(),
|
||||
]), $this->getStaleTime(strtotime($credentials["Expiration"])), $this->getPrefetchTime(strtotime($credentials["Expiration"])));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws InvalidArgumentException
|
||||
* @throws RuntimeException
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
private function getRoleNameFromMeta()
|
||||
{
|
||||
$options = Request::commonOptions();
|
||||
$options['read_timeout'] = $this->readTimeout;
|
||||
$options['connect_timeout'] = $this->connectTimeout;
|
||||
|
||||
$metadataToken = $this->getMetadataToken();
|
||||
if (!is_null($metadataToken)) {
|
||||
$options['headers']['X-aliyun-ecs-metadata-token'] = $metadataToken;
|
||||
}
|
||||
|
||||
$result = Request::createClient()->request(
|
||||
'GET',
|
||||
'http://100.100.100.200/latest/meta-data/ram/security-credentials/',
|
||||
$options
|
||||
);
|
||||
|
||||
if ($result->getStatusCode() === 404) {
|
||||
throw new InvalidArgumentException('The role name was not found in the instance' . (string) $result);
|
||||
}
|
||||
|
||||
if ($result->getStatusCode() !== 200) {
|
||||
throw new RuntimeException('Error retrieving role name from result: ' . (string) $result);
|
||||
}
|
||||
|
||||
$role_name = (string) $result;
|
||||
if (!$role_name) {
|
||||
throw new RuntimeException('Error retrieving role name from result is empty');
|
||||
}
|
||||
|
||||
return $role_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get metadata token by request.
|
||||
*
|
||||
* @return string
|
||||
* @throws RuntimeException
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
private function getMetadataToken()
|
||||
{
|
||||
$url = $this->metadataHost . $this->metadataTokenUri;
|
||||
$options = Request::commonOptions();
|
||||
$options['read_timeout'] = $this->readTimeout;
|
||||
$options['connect_timeout'] = $this->connectTimeout;
|
||||
$options['headers']['X-aliyun-ecs-metadata-token-ttl-seconds'] = $this->metadataTokenDuration;
|
||||
|
||||
$result = Request::createClient()->request('PUT', $url, $options);
|
||||
|
||||
if ($result->getStatusCode() != 200) {
|
||||
if ($this->disableIMDSv1) {
|
||||
throw new RuntimeException('Failed to get token from ECS Metadata Service. HttpCode= ' . $result->getStatusCode());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return (string) $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public function getPrefetchTime($expiration)
|
||||
{
|
||||
return $expiration <= 0 ?
|
||||
time() + (5 * 60) :
|
||||
time() + (60 * 60);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function key()
|
||||
{
|
||||
return 'ecs_ram_role#roleName#' . $this->roleName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getProviderName()
|
||||
{
|
||||
return 'ecs_ram_role';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getRoleName()
|
||||
{
|
||||
return $this->roleName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isDisableIMDSv1()
|
||||
{
|
||||
return $this->disableIMDSv1;
|
||||
}
|
||||
}
|
||||
65
vendor/alibabacloud/credentials/src/Providers/EnvironmentVariableCredentialsProvider.php
vendored
Normal file
65
vendor/alibabacloud/credentials/src/Providers/EnvironmentVariableCredentialsProvider.php
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials\Providers;
|
||||
|
||||
use AlibabaCloud\Credentials\Utils\Helper;
|
||||
use InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* @internal This class is intended for internal use within the package.
|
||||
* Class EnvironmentVariableCredentialsProvider
|
||||
*
|
||||
* @package AlibabaCloud\Credentials\Providers
|
||||
*/
|
||||
class EnvironmentVariableCredentialsProvider implements CredentialsProvider
|
||||
{
|
||||
/**
|
||||
* EnvironmentVariableCredentialsProvider constructor.
|
||||
*/
|
||||
public function __construct() {}
|
||||
|
||||
/**
|
||||
* Get credential.
|
||||
*
|
||||
* @return Credentials
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function getCredentials()
|
||||
{
|
||||
if (Helper::envNotEmpty('ALIBABA_CLOUD_ACCESS_KEY_ID')) {
|
||||
$accessKeyId = Helper::env('ALIBABA_CLOUD_ACCESS_KEY_ID');
|
||||
} else {
|
||||
throw new InvalidArgumentException('Access key ID must be specified via environment variable (ALIBABA_CLOUD_ACCESS_KEY_ID)');
|
||||
}
|
||||
|
||||
if (Helper::envNotEmpty('ALIBABA_CLOUD_ACCESS_KEY_SECRET')) {
|
||||
$accessKeySecret = Helper::env('ALIBABA_CLOUD_ACCESS_KEY_SECRET');
|
||||
} else {
|
||||
throw new InvalidArgumentException('Access key Secret must be specified via environment variable (ALIBABA_CLOUD_ACCESS_KEY_SECRET)');
|
||||
}
|
||||
|
||||
if (Helper::envNotEmpty('ALIBABA_CLOUD_SECURITY_TOKEN')) {
|
||||
$securityToken = Helper::env('ALIBABA_CLOUD_SECURITY_TOKEN');
|
||||
return new Credentials([
|
||||
'accessKeyId' => $accessKeyId,
|
||||
'accessKeySecret' => $accessKeySecret,
|
||||
'securityToken' => $securityToken,
|
||||
'providerName' => $this->getProviderName(),
|
||||
]);
|
||||
}
|
||||
|
||||
return new Credentials([
|
||||
'accessKeyId' => $accessKeyId,
|
||||
'accessKeySecret' => $accessKeySecret,
|
||||
'providerName' => $this->getProviderName(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getProviderName()
|
||||
{
|
||||
return "env";
|
||||
}
|
||||
}
|
||||
268
vendor/alibabacloud/credentials/src/Providers/OIDCRoleArnCredentialsProvider.php
vendored
Normal file
268
vendor/alibabacloud/credentials/src/Providers/OIDCRoleArnCredentialsProvider.php
vendored
Normal file
@@ -0,0 +1,268 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials\Providers;
|
||||
|
||||
use AlibabaCloud\Credentials\Utils\Helper;
|
||||
use AlibabaCloud\Credentials\Utils\Filter;
|
||||
use AlibabaCloud\Credentials\Request\Request;
|
||||
use GuzzleHttp\Psr7\Uri;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use InvalidArgumentException;
|
||||
use RuntimeException;
|
||||
use Exception;
|
||||
use AlibabaCloud\Credentials\Credential\RefreshResult;
|
||||
|
||||
/**
|
||||
* @internal This class is intended for internal use within the package.
|
||||
* Class OIDCRoleArnCredentialsProvider
|
||||
*
|
||||
* @package AlibabaCloud\Credentials\Providers
|
||||
*/
|
||||
class OIDCRoleArnCredentialsProvider extends SessionCredentialsProvider
|
||||
{
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $roleArn;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $oidcProviderArn;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $oidcTokenFilePath;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $roleSessionName;
|
||||
|
||||
/**
|
||||
* @description role session expiration
|
||||
* @example 3600
|
||||
* @var int
|
||||
*/
|
||||
private $durationSeconds = 3600;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $policy;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $stsEndpoint;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $connectTimeout = 5;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $readTimeout = 5;
|
||||
|
||||
/**
|
||||
* OIDCRoleArnCredentialsProvider constructor.
|
||||
*
|
||||
* @param array $params
|
||||
* @param array $options
|
||||
*/
|
||||
public function __construct(array $params = [], array $options = [])
|
||||
{
|
||||
$this->filterOptions($options);
|
||||
$this->filterRoleArn($params);
|
||||
$this->filterOIDCProviderArn($params);
|
||||
$this->filterOIDCTokenFilePath($params);
|
||||
$this->filterRoleSessionName($params);
|
||||
$this->filterDurationSeconds($params);
|
||||
$this->filterPolicy($params);
|
||||
$this->filterSTSEndpoint($params);
|
||||
}
|
||||
|
||||
private function filterRoleArn(array $params)
|
||||
{
|
||||
if (Helper::envNotEmpty('ALIBABA_CLOUD_ROLE_ARN')) {
|
||||
$this->roleArn = Helper::env('ALIBABA_CLOUD_ROLE_ARN');
|
||||
}
|
||||
|
||||
if (isset($params['roleArn'])) {
|
||||
$this->roleArn = $params['roleArn'];
|
||||
}
|
||||
|
||||
Filter::roleArn($this->roleArn);
|
||||
}
|
||||
|
||||
private function filterOIDCProviderArn(array $params)
|
||||
{
|
||||
if (Helper::envNotEmpty('ALIBABA_CLOUD_OIDC_PROVIDER_ARN')) {
|
||||
$this->oidcProviderArn = Helper::env('ALIBABA_CLOUD_OIDC_PROVIDER_ARN');
|
||||
}
|
||||
|
||||
if (isset($params['oidcProviderArn'])) {
|
||||
$this->oidcProviderArn = $params['oidcProviderArn'];
|
||||
}
|
||||
|
||||
Filter::oidcProviderArn($this->oidcProviderArn);
|
||||
}
|
||||
|
||||
private function filterOIDCTokenFilePath(array $params)
|
||||
{
|
||||
if (Helper::envNotEmpty('ALIBABA_CLOUD_OIDC_TOKEN_FILE')) {
|
||||
$this->oidcTokenFilePath = Helper::env('ALIBABA_CLOUD_OIDC_TOKEN_FILE');
|
||||
}
|
||||
|
||||
if (isset($params['oidcTokenFilePath'])) {
|
||||
$this->oidcTokenFilePath = $params['oidcTokenFilePath'];
|
||||
}
|
||||
|
||||
Filter::oidcTokenFilePath($this->oidcTokenFilePath);
|
||||
}
|
||||
|
||||
private function filterRoleSessionName(array $params)
|
||||
{
|
||||
if (Helper::envNotEmpty('ALIBABA_CLOUD_ROLE_SESSION_NAME')) {
|
||||
$this->roleSessionName = Helper::env('ALIBABA_CLOUD_ROLE_SESSION_NAME');
|
||||
}
|
||||
|
||||
if (isset($params['roleSessionName'])) {
|
||||
$this->roleSessionName = $params['roleSessionName'];
|
||||
}
|
||||
|
||||
if (is_null($this->roleSessionName) || $this->roleSessionName === '') {
|
||||
$this->roleSessionName = 'phpSdkRoleSessionName';
|
||||
}
|
||||
}
|
||||
|
||||
private function filterDurationSeconds(array $params)
|
||||
{
|
||||
if (isset($params['durationSeconds'])) {
|
||||
if (is_int($params['durationSeconds'])) {
|
||||
$this->durationSeconds = $params['durationSeconds'];
|
||||
}
|
||||
}
|
||||
if ($this->durationSeconds < 900) {
|
||||
throw new InvalidArgumentException('Role session expiration should be in the range of 900s - max session duration');
|
||||
}
|
||||
}
|
||||
|
||||
private function filterPolicy(array $params)
|
||||
{
|
||||
if (isset($params['policy'])) {
|
||||
if (is_string($params['policy'])) {
|
||||
$this->policy = $params['policy'];
|
||||
}
|
||||
|
||||
if (is_array($params['policy'])) {
|
||||
$this->policy = json_encode($params['policy']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function filterSTSEndpoint(array $params)
|
||||
{
|
||||
$prefix = 'sts';
|
||||
if (Helper::envNotEmpty('ALIBABA_CLOUD_VPC_ENDPOINT_ENABLED') || (isset($params['enableVpc']) && $params['enableVpc'] === true)) {
|
||||
$prefix = 'sts-vpc';
|
||||
}
|
||||
if (Helper::envNotEmpty('ALIBABA_CLOUD_STS_REGION')) {
|
||||
$this->stsEndpoint = $prefix . '.' . Helper::env('ALIBABA_CLOUD_STS_REGION') . '.aliyuncs.com';
|
||||
}
|
||||
|
||||
if (isset($params['stsRegionId'])) {
|
||||
$this->stsEndpoint = $prefix . '.' . $params['stsRegionId'] . '.aliyuncs.com';
|
||||
}
|
||||
|
||||
if (isset($params['stsEndpoint'])) {
|
||||
$this->stsEndpoint = $params['stsEndpoint'];
|
||||
}
|
||||
|
||||
if (is_null($this->stsEndpoint) || $this->stsEndpoint === '') {
|
||||
$this->stsEndpoint = 'sts.aliyuncs.com';
|
||||
}
|
||||
}
|
||||
|
||||
private function filterOptions(array $options)
|
||||
{
|
||||
if (isset($options['connectTimeout'])) {
|
||||
$this->connectTimeout = $options['connectTimeout'];
|
||||
}
|
||||
|
||||
if (isset($options['readTimeout'])) {
|
||||
$this->readTimeout = $options['readTimeout'];
|
||||
}
|
||||
|
||||
Filter::timeout($this->connectTimeout, $this->readTimeout);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get credentials by request.
|
||||
*
|
||||
* @return RefreshResult
|
||||
* @throws RuntimeException
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function refreshCredentials()
|
||||
{
|
||||
$options = Request::commonOptions();
|
||||
$options['read_timeout'] = $this->readTimeout;
|
||||
$options['connect_timeout'] = $this->connectTimeout;
|
||||
|
||||
$options['query']['Action'] = 'AssumeRoleWithOIDC';
|
||||
$options['query']['Version'] = '2015-04-01';
|
||||
$options['query']['Format'] = 'JSON';
|
||||
$options['query']['Timestamp'] = gmdate('Y-m-d\TH:i:s\Z');
|
||||
$options['query']['RoleArn'] = $this->roleArn;
|
||||
$options['query']['OIDCProviderArn'] = $this->oidcProviderArn;
|
||||
try {
|
||||
$oidcToken = file_get_contents($this->oidcTokenFilePath);
|
||||
$options['query']['OIDCToken'] = $oidcToken;
|
||||
} catch (Exception $exception) {
|
||||
throw new InvalidArgumentException($exception->getMessage());
|
||||
}
|
||||
$options['query']['RoleSessionName'] = $this->roleSessionName;
|
||||
$options['query']['DurationSeconds'] = (string) $this->durationSeconds;
|
||||
if (!is_null($this->policy)) {
|
||||
$options['query']['Policy'] = $this->policy;
|
||||
}
|
||||
|
||||
$url = (new Uri())->withScheme('https')->withHost($this->stsEndpoint);
|
||||
|
||||
$result = Request::createClient()->request('POST', $url, $options);
|
||||
|
||||
if ($result->getStatusCode() !== 200) {
|
||||
throw new RuntimeException('Error refreshing credentials from OIDC, statusCode: ' . $result->getStatusCode() . ', result: ' . (string) $result);
|
||||
}
|
||||
|
||||
$json = $result->toArray();
|
||||
$credentials = $json['Credentials'];
|
||||
|
||||
if (!isset($credentials['AccessKeyId']) || !isset($credentials['AccessKeySecret']) || !isset($credentials['SecurityToken'])) {
|
||||
throw new RuntimeException('Error retrieving credentials from OIDC result:' . $result->toJson());
|
||||
}
|
||||
|
||||
return new RefreshResult(new Credentials([
|
||||
'accessKeyId' => $credentials['AccessKeyId'],
|
||||
'accessKeySecret' => $credentials['AccessKeySecret'],
|
||||
'securityToken' => $credentials['SecurityToken'],
|
||||
'expiration' => \strtotime($credentials['Expiration']),
|
||||
'providerName' => $this->getProviderName(),
|
||||
]), $this->getStaleTime(strtotime($credentials['Expiration'])));
|
||||
}
|
||||
|
||||
public function key()
|
||||
{
|
||||
return 'oidc_role_arn#roleArn#' . $this->roleArn . '#oidcProviderArn#' . $this->oidcProviderArn . '#roleSessionName#' . $this->roleSessionName;
|
||||
}
|
||||
|
||||
public function getProviderName()
|
||||
{
|
||||
return 'oidc_role_arn';
|
||||
}
|
||||
}
|
||||
188
vendor/alibabacloud/credentials/src/Providers/ProfileCredentialsProvider.php
vendored
Normal file
188
vendor/alibabacloud/credentials/src/Providers/ProfileCredentialsProvider.php
vendored
Normal file
@@ -0,0 +1,188 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials\Providers;
|
||||
|
||||
use AlibabaCloud\Credentials\Utils\Helper;
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* @internal This class is intended for internal use within the package.
|
||||
* Class ProfileCredentialsProvider
|
||||
*
|
||||
* @package AlibabaCloud\Credentials\Providers
|
||||
*/
|
||||
class ProfileCredentialsProvider implements CredentialsProvider
|
||||
{
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $profileName;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $profileFile;
|
||||
|
||||
/**
|
||||
* @var CredentialsProvider
|
||||
*/
|
||||
private $credentialsProvider;
|
||||
|
||||
|
||||
/**
|
||||
* ProfileCredentialsProvider constructor.
|
||||
*
|
||||
* @param array $params
|
||||
*/
|
||||
public function __construct(array $params = [])
|
||||
{
|
||||
$this->filterProfileName($params);
|
||||
$this->filterProfileFile();
|
||||
}
|
||||
|
||||
private function filterProfileName(array $params)
|
||||
{
|
||||
if (Helper::envNotEmpty('ALIBABA_CLOUD_PROFILE')) {
|
||||
$this->profileName = Helper::env('ALIBABA_CLOUD_PROFILE');
|
||||
}
|
||||
|
||||
if (isset($params['profileName'])) {
|
||||
$this->profileName = $params['profileName'];
|
||||
}
|
||||
|
||||
if (is_null($this->profileName) || $this->profileName === '') {
|
||||
$this->profileName = 'default';
|
||||
}
|
||||
}
|
||||
|
||||
private function filterProfileFile()
|
||||
{
|
||||
$this->profileFile = Helper::envNotEmpty('ALIBABA_CLOUD_CREDENTIALS_FILE');
|
||||
|
||||
if (!$this->profileFile) {
|
||||
$this->profileFile = self::getDefaultFile();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
private function shouldReloadCredentialsProvider()
|
||||
{
|
||||
if (is_null($this->credentialsProvider)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return CredentialsProvider
|
||||
*/
|
||||
private function reloadCredentialsProvider($profileFile, $profileName)
|
||||
{
|
||||
if (!Helper::inOpenBasedir($profileFile)) {
|
||||
throw new RuntimeException('Unable to open credentials file: ' . $profileFile);
|
||||
}
|
||||
|
||||
if (!\is_readable($profileFile) || !\is_file($profileFile)) {
|
||||
throw new RuntimeException('Credentials file is not readable: ' . $profileFile);
|
||||
}
|
||||
|
||||
$fileArray = \parse_ini_file($profileFile, true);
|
||||
|
||||
if (\is_array($fileArray) && !empty($fileArray)) {
|
||||
$credentialsConfigures = [];
|
||||
foreach (\array_change_key_case($fileArray) as $name => $configures) {
|
||||
if ($name === $profileName) {
|
||||
$credentialsConfigures = $configures;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (\is_array($credentialsConfigures) && !empty($credentialsConfigures)) {
|
||||
switch (Helper::unsetReturnNull($credentialsConfigures, 'type')) {
|
||||
case 'access_key':
|
||||
return new StaticAKCredentialsProvider([
|
||||
'accessKeyId' => Helper::unsetReturnNull($credentialsConfigures, 'access_key_id'),
|
||||
'accessKeySecret' => Helper::unsetReturnNull($credentialsConfigures, 'access_key_secret'),
|
||||
]);
|
||||
case 'ram_role_arn':
|
||||
$innerProvider = new StaticAKCredentialsProvider([
|
||||
'accessKeyId' => Helper::unsetReturnNull($credentialsConfigures, 'access_key_id'),
|
||||
'accessKeySecret' => Helper::unsetReturnNull($credentialsConfigures, 'access_key_secret'),
|
||||
]);
|
||||
return new RamRoleArnCredentialsProvider([
|
||||
'credentialsProvider' => $innerProvider,
|
||||
'roleArn' => Helper::unsetReturnNull($credentialsConfigures, 'role_arn'),
|
||||
'roleSessionName' => Helper::unsetReturnNull($credentialsConfigures, 'role_session_name'),
|
||||
'policy' => Helper::unsetReturnNull($credentialsConfigures, 'policy'),
|
||||
]);
|
||||
case 'ecs_ram_role':
|
||||
return new EcsRamRoleCredentialsProvider([
|
||||
'roleName' => Helper::unsetReturnNull($credentialsConfigures, 'role_name'),
|
||||
]);
|
||||
case 'oidc_role_arn':
|
||||
return new OIDCRoleArnCredentialsProvider([
|
||||
'roleArn' => Helper::unsetReturnNull($credentialsConfigures, 'role_arn'),
|
||||
'oidcProviderArn' => Helper::unsetReturnNull($credentialsConfigures, 'oidc_provider_arn'),
|
||||
'oidcTokenFilePath' => Helper::unsetReturnNull($credentialsConfigures, 'oidc_token_file_path'),
|
||||
'roleSessionName' => Helper::unsetReturnNull($credentialsConfigures, 'role_session_name'),
|
||||
'policy' => Helper::unsetReturnNull($credentialsConfigures, 'policy'),
|
||||
]);
|
||||
case 'rsa_key_pair':
|
||||
return new RsaKeyPairCredentialsProvider([
|
||||
'publicKeyId' => Helper::unsetReturnNull($credentialsConfigures, 'public_key_id'),
|
||||
'privateKeyFile' => Helper::unsetReturnNull($credentialsConfigures, 'private_key_file'),
|
||||
]);
|
||||
default:
|
||||
throw new RuntimeException('Unsupported credential type from credentials file: ' . Helper::unsetReturnNull($credentialsConfigures, 'type'));
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new RuntimeException('Failed to get credential from credentials file: ' . $profileFile);
|
||||
}
|
||||
/**
|
||||
* Get credential.
|
||||
*
|
||||
* @return Credentials
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public function getCredentials()
|
||||
{
|
||||
if ($this->shouldReloadCredentialsProvider()) {
|
||||
$this->credentialsProvider = $this->reloadCredentialsProvider($this->profileFile, $this->profileName);
|
||||
}
|
||||
|
||||
$credentials = $this->credentialsProvider->getCredentials();
|
||||
return new Credentials([
|
||||
'accessKeyId' => $credentials->getAccessKeyId(),
|
||||
'accessKeySecret' => $credentials->getAccessKeySecret(),
|
||||
'securityToken' => $credentials->getSecurityToken(),
|
||||
'providerName' => $this->getProviderName() . '/' . $this->credentialsProvider->getProviderName(),
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default credential file.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function getDefaultFile()
|
||||
{
|
||||
return Helper::getHomeDirectory() .
|
||||
DIRECTORY_SEPARATOR .
|
||||
'.alibabacloud' .
|
||||
DIRECTORY_SEPARATOR .
|
||||
'credentials';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getProviderName()
|
||||
{
|
||||
return 'profile';
|
||||
}
|
||||
}
|
||||
321
vendor/alibabacloud/credentials/src/Providers/RamRoleArnCredentialsProvider.php
vendored
Normal file
321
vendor/alibabacloud/credentials/src/Providers/RamRoleArnCredentialsProvider.php
vendored
Normal file
@@ -0,0 +1,321 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials\Providers;
|
||||
|
||||
use AlibabaCloud\Credentials\Utils\Helper;
|
||||
use AlibabaCloud\Credentials\Utils\Filter;
|
||||
use AlibabaCloud\Credentials\Request\Request;
|
||||
use GuzzleHttp\Psr7\Uri;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use InvalidArgumentException;
|
||||
use RuntimeException;
|
||||
use AlibabaCloud\Credentials\Credential\RefreshResult;
|
||||
|
||||
/**
|
||||
* @internal This class is intended for internal use within the package.
|
||||
* Class RamRoleArnCredentialsProvider
|
||||
*
|
||||
* @package AlibabaCloud\Credentials\Providers
|
||||
*/
|
||||
class RamRoleArnCredentialsProvider extends SessionCredentialsProvider
|
||||
{
|
||||
|
||||
/**
|
||||
* @var CredentialsProvider
|
||||
*/
|
||||
private $credentialsProvider;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $roleArn;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $roleSessionName;
|
||||
|
||||
/**
|
||||
* @description role session expiration
|
||||
* @example 3600
|
||||
* @var int
|
||||
*/
|
||||
private $durationSeconds = 3600;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $externalId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $policy;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $stsEndpoint;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $connectTimeout = 5;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $readTimeout = 5;
|
||||
|
||||
/**
|
||||
* RamRoleArnCredentialsProvider constructor.
|
||||
*
|
||||
* @param array $params
|
||||
* @param array $options
|
||||
*/
|
||||
public function __construct(array $params = [], array $options = [])
|
||||
{
|
||||
$this->filterOptions($options);
|
||||
$this->filterCredentials($params);
|
||||
$this->filterRoleArn($params);
|
||||
$this->filterRoleSessionName($params);
|
||||
$this->filterDurationSeconds($params);
|
||||
$this->filterPolicy($params);
|
||||
$this->filterExternalId($params);
|
||||
$this->filterSTSEndpoint($params);
|
||||
}
|
||||
|
||||
private function filterRoleArn(array $params)
|
||||
{
|
||||
if (Helper::envNotEmpty('ALIBABA_CLOUD_ROLE_ARN')) {
|
||||
$this->roleArn = Helper::env('ALIBABA_CLOUD_ROLE_ARN');
|
||||
}
|
||||
|
||||
if (isset($params['roleArn'])) {
|
||||
$this->roleArn = $params['roleArn'];
|
||||
}
|
||||
|
||||
Filter::roleArn($this->roleArn);
|
||||
}
|
||||
|
||||
private function filterRoleSessionName(array $params)
|
||||
{
|
||||
if (Helper::envNotEmpty('ALIBABA_CLOUD_ROLE_SESSION_NAME')) {
|
||||
$this->roleSessionName = Helper::env('ALIBABA_CLOUD_ROLE_SESSION_NAME');
|
||||
}
|
||||
|
||||
if (isset($params['roleSessionName'])) {
|
||||
$this->roleSessionName = $params['roleSessionName'];
|
||||
}
|
||||
|
||||
if (is_null($this->roleSessionName) || $this->roleSessionName === '') {
|
||||
$this->roleSessionName = 'phpSdkRoleSessionName';
|
||||
}
|
||||
}
|
||||
|
||||
private function filterDurationSeconds(array $params)
|
||||
{
|
||||
if (isset($params['durationSeconds'])) {
|
||||
if (is_int($params['durationSeconds'])) {
|
||||
$this->durationSeconds = $params['durationSeconds'];
|
||||
}
|
||||
}
|
||||
if ($this->durationSeconds < 900) {
|
||||
throw new InvalidArgumentException('Role session expiration should be in the range of 900s - max session duration');
|
||||
}
|
||||
}
|
||||
|
||||
private function filterPolicy(array $params)
|
||||
{
|
||||
if (isset($params['policy'])) {
|
||||
if (is_string($params['policy'])) {
|
||||
$this->policy = $params['policy'];
|
||||
}
|
||||
|
||||
if (is_array($params['policy'])) {
|
||||
$this->policy = json_encode($params['policy']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function filterExternalId(array $params)
|
||||
{
|
||||
if (isset($params['externalId'])) {
|
||||
if (is_string($params['externalId'])) {
|
||||
$this->externalId = $params['externalId'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function filterSTSEndpoint(array $params)
|
||||
{
|
||||
$prefix = 'sts';
|
||||
if (Helper::envNotEmpty('ALIBABA_CLOUD_VPC_ENDPOINT_ENABLED') || (isset($params['enableVpc']) && $params['enableVpc'] === true)) {
|
||||
$prefix = 'sts-vpc';
|
||||
}
|
||||
if (Helper::envNotEmpty('ALIBABA_CLOUD_STS_REGION')) {
|
||||
$this->stsEndpoint = $prefix . '.' . Helper::env('ALIBABA_CLOUD_STS_REGION') . '.aliyuncs.com';
|
||||
}
|
||||
|
||||
if (isset($params['stsRegionId'])) {
|
||||
$this->stsEndpoint = $prefix . '.' . $params['stsRegionId'] . '.aliyuncs.com';
|
||||
}
|
||||
|
||||
if (isset($params['stsEndpoint'])) {
|
||||
$this->stsEndpoint = $params['stsEndpoint'];
|
||||
}
|
||||
|
||||
if (is_null($this->stsEndpoint) || $this->stsEndpoint === '') {
|
||||
$this->stsEndpoint = 'sts.aliyuncs.com';
|
||||
}
|
||||
}
|
||||
|
||||
private function filterCredentials(array $params)
|
||||
{
|
||||
if (isset($params['credentialsProvider'])) {
|
||||
if (!($params['credentialsProvider'] instanceof CredentialsProvider)) {
|
||||
throw new InvalidArgumentException('Invalid credentialsProvider option for ram_role_arn');
|
||||
}
|
||||
$this->credentialsProvider = $params['credentialsProvider'];
|
||||
} else if (isset($params['accessKeyId']) && isset($params['accessKeySecret']) && isset($params['securityToken'])) {
|
||||
Filter::accessKey($params['accessKeyId'], $params['accessKeySecret']);
|
||||
Filter::securityToken($params['securityToken']);
|
||||
$this->credentialsProvider = new StaticSTSCredentialsProvider($params);
|
||||
} else if (isset($params['accessKeyId']) && isset($params['accessKeySecret'])) {
|
||||
Filter::accessKey($params['accessKeyId'], $params['accessKeySecret']);
|
||||
$this->credentialsProvider = new StaticAKCredentialsProvider($params);
|
||||
} else {
|
||||
throw new InvalidArgumentException('Missing required credentials option for ram_role_arn');
|
||||
}
|
||||
}
|
||||
|
||||
private function filterOptions(array $options)
|
||||
{
|
||||
if (isset($options['connectTimeout'])) {
|
||||
$this->connectTimeout = $options['connectTimeout'];
|
||||
}
|
||||
|
||||
if (isset($options['readTimeout'])) {
|
||||
$this->readTimeout = $options['readTimeout'];
|
||||
}
|
||||
|
||||
Filter::timeout($this->connectTimeout, $this->readTimeout);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get credentials by request.
|
||||
*
|
||||
* @return RefreshResult
|
||||
* @throws RuntimeException
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function refreshCredentials()
|
||||
{
|
||||
$options = Request::commonOptions();
|
||||
$options['read_timeout'] = $this->readTimeout;
|
||||
$options['connect_timeout'] = $this->connectTimeout;
|
||||
|
||||
$options['query']['Action'] = 'AssumeRole';
|
||||
$options['query']['Version'] = '2015-04-01';
|
||||
$options['query']['Format'] = 'JSON';
|
||||
$options['query']['Timestamp'] = gmdate('Y-m-d\TH:i:s\Z');
|
||||
$options['query']['SignatureMethod'] = 'HMAC-SHA1';
|
||||
$options['query']['SignatureVersion'] = '1.0';
|
||||
$options['query']['SignatureNonce'] = Request::uuid(json_encode($options['query']));
|
||||
$options['query']['RoleArn'] = $this->roleArn;
|
||||
$options['query']['RoleSessionName'] = $this->roleSessionName;
|
||||
$options['query']['DurationSeconds'] = (string) $this->durationSeconds;
|
||||
if (!is_null($this->policy) && $this->policy !== '') {
|
||||
$options['query']['Policy'] = $this->policy;
|
||||
}
|
||||
if (!is_null($this->externalId) && $this->externalId !== '') {
|
||||
$options['query']['ExternalId'] = $this->externalId;
|
||||
}
|
||||
|
||||
$sessionCredentials = $this->credentialsProvider->getCredentials();
|
||||
$options['query']['AccessKeyId'] = $sessionCredentials->getAccessKeyId();
|
||||
if (!is_null($sessionCredentials->getSecurityToken())) {
|
||||
$options['query']['SecurityToken'] = $sessionCredentials->getSecurityToken();
|
||||
}
|
||||
$options['query']['Signature'] = Request::shaHmac1sign(
|
||||
Request::signString('GET', $options['query']),
|
||||
$sessionCredentials->getAccessKeySecret() . '&'
|
||||
);
|
||||
|
||||
$url = (new Uri())->withScheme('https')->withHost($this->stsEndpoint);
|
||||
|
||||
$result = Request::createClient()->request('GET', $url, $options);
|
||||
|
||||
if ($result->getStatusCode() !== 200) {
|
||||
throw new RuntimeException('Error refreshing credentials from RamRoleArn, statusCode: ' . $result->getStatusCode() . ', result: ' . (string) $result);
|
||||
}
|
||||
|
||||
$json = $result->toArray();
|
||||
$credentials = $json['Credentials'];
|
||||
|
||||
if (!isset($credentials['AccessKeyId']) || !isset($credentials['AccessKeySecret']) || !isset($credentials['SecurityToken'])) {
|
||||
throw new RuntimeException('Error retrieving credentials from RamRoleArn result:' . $result->toJson());
|
||||
}
|
||||
|
||||
return new RefreshResult(new Credentials([
|
||||
'accessKeyId' => $credentials['AccessKeyId'],
|
||||
'accessKeySecret' => $credentials['AccessKeySecret'],
|
||||
'securityToken' => $credentials['SecurityToken'],
|
||||
'expiration' => \strtotime($credentials['Expiration']),
|
||||
'providerName' => $this->getProviderName(),
|
||||
]), $this->getStaleTime(strtotime($credentials['Expiration'])));
|
||||
}
|
||||
|
||||
public function key()
|
||||
{
|
||||
$credentials = $this->credentialsProvider->getCredentials();
|
||||
return 'ram_role_arn#credential#' . $credentials->getAccessKeyId() . '#roleArn#' . $this->roleArn . '#roleSessionName#' . $this->roleSessionName;
|
||||
}
|
||||
|
||||
public function getProviderName()
|
||||
{
|
||||
return 'ram_role_arn/' . $this->credentialsProvider->getProviderName();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getRoleArn()
|
||||
{
|
||||
return $this->roleArn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getRoleSessionName()
|
||||
{
|
||||
return $this->roleSessionName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPolicy()
|
||||
{
|
||||
return $this->policy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @return string
|
||||
*/
|
||||
public function getOriginalAccessKeyId()
|
||||
{
|
||||
return $this->credentialsProvider->getCredentials()->getAccessKeyId();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @return string
|
||||
*/
|
||||
public function getOriginalAccessKeySecret()
|
||||
{
|
||||
return $this->credentialsProvider->getCredentials()->getAccessKeySecret();
|
||||
}
|
||||
}
|
||||
200
vendor/alibabacloud/credentials/src/Providers/RsaKeyPairCredentialsProvider.php
vendored
Normal file
200
vendor/alibabacloud/credentials/src/Providers/RsaKeyPairCredentialsProvider.php
vendored
Normal file
@@ -0,0 +1,200 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials\Providers;
|
||||
|
||||
use AlibabaCloud\Credentials\Utils\Helper;
|
||||
use AlibabaCloud\Credentials\Utils\Filter;
|
||||
use AlibabaCloud\Credentials\Request\Request;
|
||||
use GuzzleHttp\Psr7\Uri;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use AlibabaCloud\Credentials\Credential\RefreshResult;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use RuntimeException;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* @internal This class is intended for internal use within the package.
|
||||
* Class RsaKeyPairCredentialsProvider
|
||||
*
|
||||
* @package AlibabaCloud\Credentials\Providers
|
||||
*/
|
||||
class RsaKeyPairCredentialsProvider extends SessionCredentialsProvider
|
||||
{
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $publicKeyId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $privateKey;
|
||||
|
||||
/**
|
||||
* @description role session expiration
|
||||
* @example 3600
|
||||
* @var int
|
||||
*/
|
||||
private $durationSeconds = 3600;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $stsEndpoint;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $connectTimeout = 5;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $readTimeout = 5;
|
||||
|
||||
/**
|
||||
* RsaKeyPairCredentialsProvider constructor.
|
||||
*
|
||||
* @param array $params
|
||||
* @param array $options
|
||||
*/
|
||||
public function __construct(array $params = [], array $options = [])
|
||||
{
|
||||
$this->filterOptions($options);
|
||||
$this->filterDurationSeconds($params);
|
||||
$this->filterSTSEndpoint($params);
|
||||
$this->publicKeyId = isset($params['publicKeyId']) ? $params['publicKeyId'] : null;
|
||||
$privateKeyFile = isset($params['privateKeyFile']) ? $params['privateKeyFile'] : null;
|
||||
Filter::publicKeyId($this->publicKeyId);
|
||||
Filter::privateKeyFile($privateKeyFile);
|
||||
|
||||
try {
|
||||
$this->privateKey = file_get_contents($privateKeyFile);
|
||||
} catch (Exception $exception) {
|
||||
throw new InvalidArgumentException($exception->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private function filterOptions(array $options)
|
||||
{
|
||||
if (isset($options['connectTimeout'])) {
|
||||
$this->connectTimeout = $options['connectTimeout'];
|
||||
}
|
||||
|
||||
if (isset($options['readTimeout'])) {
|
||||
$this->readTimeout = $options['readTimeout'];
|
||||
}
|
||||
|
||||
Filter::timeout($this->connectTimeout, $this->readTimeout);
|
||||
}
|
||||
|
||||
private function filterDurationSeconds(array $params)
|
||||
{
|
||||
if (isset($params['durationSeconds'])) {
|
||||
if (is_int($params['durationSeconds'])) {
|
||||
$this->durationSeconds = $params['durationSeconds'];
|
||||
}
|
||||
}
|
||||
if ($this->durationSeconds < 900) {
|
||||
throw new InvalidArgumentException('Role session expiration should be in the range of 900s - max session duration');
|
||||
}
|
||||
}
|
||||
|
||||
private function filterSTSEndpoint(array $params)
|
||||
{
|
||||
if (isset($params['stsEndpoint'])) {
|
||||
$this->stsEndpoint = $params['stsEndpoint'];
|
||||
}
|
||||
|
||||
if (is_null($this->stsEndpoint) || $this->stsEndpoint === '') {
|
||||
$this->stsEndpoint = 'sts.ap-northeast-1.aliyuncs.com';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get credentials by request.
|
||||
*
|
||||
* @return RefreshResult
|
||||
* @throws RuntimeException
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function refreshCredentials()
|
||||
{
|
||||
$options = Request::commonOptions();
|
||||
$options['read_timeout'] = $this->readTimeout;
|
||||
$options['connect_timeout'] = $this->connectTimeout;
|
||||
|
||||
$options['query']['Action'] = 'GenerateSessionAccessKey';
|
||||
$options['query']['Version'] = '2015-04-01';
|
||||
$options['query']['Format'] = 'JSON';
|
||||
$options['query']['Timestamp'] = gmdate('Y-m-d\TH:i:s\Z');
|
||||
$options['query']['SignatureMethod'] = 'SHA256withRSA';
|
||||
$options['query']['SignatureType'] = 'PRIVATEKEY';
|
||||
$options['query']['SignatureVersion'] = '1.0';
|
||||
$options['query']['SignatureNonce'] = Request::uuid(json_encode($options['query']));
|
||||
$options['query']['DurationSeconds'] = (string) $this->durationSeconds;
|
||||
$options['query']['AccessKeyId'] = $this->publicKeyId;
|
||||
$options['query']['Signature'] = Request::shaHmac256WithRsasign(
|
||||
Request::signString('GET', $options['query']),
|
||||
$this->privateKey
|
||||
);
|
||||
|
||||
$url = (new Uri())->withScheme('https')->withHost($this->stsEndpoint);
|
||||
|
||||
$result = Request::createClient()->request('GET', $url, $options);
|
||||
|
||||
if ($result->getStatusCode() !== 200) {
|
||||
throw new RuntimeException('Error refreshing credentials from RsaKeyPair, statusCode: ' . $result->getStatusCode() . ', result: ' . (string) $result);
|
||||
}
|
||||
|
||||
$json = $result->toArray();
|
||||
|
||||
if (!isset($json['SessionAccessKey']['SessionAccessKeyId']) || !isset($json['SessionAccessKey']['SessionAccessKeySecret'])) {
|
||||
throw new RuntimeException('Error retrieving credentials from RsaKeyPair result:' . $result->toJson());
|
||||
}
|
||||
|
||||
$credentials = [];
|
||||
$credentials['AccessKeyId'] = $json['SessionAccessKey']['SessionAccessKeyId'];
|
||||
$credentials['AccessKeySecret'] = $json['SessionAccessKey']['SessionAccessKeySecret'];
|
||||
$credentials['Expiration'] = $json['SessionAccessKey']['Expiration'];
|
||||
$credentials['SecurityToken'] = null;
|
||||
|
||||
|
||||
return new RefreshResult(new Credentials([
|
||||
'accessKeyId' => $credentials['AccessKeyId'],
|
||||
'accessKeySecret' => $credentials['AccessKeySecret'],
|
||||
'securityToken' => $credentials['SecurityToken'],
|
||||
'expiration' => \strtotime($credentials['Expiration']),
|
||||
'providerName' => $this->getProviderName(),
|
||||
]), $this->getStaleTime(strtotime($credentials['Expiration'])));
|
||||
}
|
||||
|
||||
public function key()
|
||||
{
|
||||
return 'rsa_key_pair#publicKeyId#' . $this->publicKeyId;
|
||||
}
|
||||
|
||||
public function getProviderName()
|
||||
{
|
||||
return 'rsa_key_pair';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPublicKeyId()
|
||||
{
|
||||
return $this->publicKeyId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getPrivateKey()
|
||||
{
|
||||
return $this->privateKey;
|
||||
}
|
||||
}
|
||||
161
vendor/alibabacloud/credentials/src/Providers/SessionCredentialsProvider.php
vendored
Normal file
161
vendor/alibabacloud/credentials/src/Providers/SessionCredentialsProvider.php
vendored
Normal file
@@ -0,0 +1,161 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials\Providers;
|
||||
|
||||
use AlibabaCloud\Credentials\Credential\RefreshResult;
|
||||
|
||||
abstract class SessionCredentialsProvider implements CredentialsProvider
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $credentialsCache = [];
|
||||
|
||||
/**
|
||||
* Expiration time slot for temporary security credentials.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $expirationSlot = 180;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $error = 'Result contains no credentials';
|
||||
|
||||
/**
|
||||
* Get the credentials from the cache in the validity period.
|
||||
*
|
||||
* @return RefreshResult|null
|
||||
*/
|
||||
protected function getCredentialsInCache()
|
||||
{
|
||||
if (isset(self::$credentialsCache[$this->key()])) {
|
||||
$result = self::$credentialsCache[$this->key()];
|
||||
return $result;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cache credentials.
|
||||
*
|
||||
* @param RefreshResult $credential
|
||||
*/
|
||||
protected function cache(RefreshResult $credential)
|
||||
{
|
||||
self::$credentialsCache[$this->key()] = $credential;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get credential.
|
||||
*
|
||||
* @return Credentials
|
||||
*/
|
||||
public function getCredentials()
|
||||
{
|
||||
if ($this->cacheIsStale() || $this->shouldInitiateCachePrefetch()) {
|
||||
$result = $this->refreshCache();
|
||||
$this->cache($result);
|
||||
}
|
||||
|
||||
$result = $this->getCredentialsInCache();
|
||||
|
||||
return $result->credentials();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return RefreshResult
|
||||
*/
|
||||
protected function refreshCache()
|
||||
{
|
||||
try {
|
||||
return $this->handleFetchedSuccess($this->refreshCredentials());
|
||||
} catch (\Exception $e) {
|
||||
return $this->handleFetchedFailure($e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return RefreshResult
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function handleFetchedFailure(\Exception $e)
|
||||
{
|
||||
$currentCachedValue = $this->getCredentialsInCache();
|
||||
if (is_null($currentCachedValue)) {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
if (time() < $currentCachedValue->staleTime()) {
|
||||
return $currentCachedValue;
|
||||
}
|
||||
|
||||
throw $e;
|
||||
}
|
||||
/**
|
||||
* @return RefreshResult
|
||||
*/
|
||||
protected function handleFetchedSuccess(RefreshResult $value)
|
||||
{
|
||||
$now = time();
|
||||
// 过期时间大于15分钟,不用管
|
||||
if ($now < $value->staleTime()) {
|
||||
return $value;
|
||||
}
|
||||
// 不足或等于15分钟,但未过期,下次会再次刷新
|
||||
if ($now < $value->staleTime() + 15 * 60) {
|
||||
$value->staleTime = $now;
|
||||
return $value;
|
||||
}
|
||||
// 已过期,看缓存,缓存若大于15分钟,返回缓存,若小于15分钟,则稍后重试
|
||||
if (is_null($this->getCredentialsInCache())) {
|
||||
throw new \Exception("The fetched credentials have expired and no cache is available.");
|
||||
} else if ($now < $this->getCredentialsInCache()->staleTime()) {
|
||||
return $this->getCredentialsInCache();
|
||||
} else {
|
||||
// 返回成功,延长有效期 1 分钟
|
||||
$expectation = mt_rand(50, 70);
|
||||
$value->staleTime = time() + $expectation;
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function cacheIsStale()
|
||||
{
|
||||
return is_null($this->getCredentialsInCache()) || time() >= $this->getCredentialsInCache()->staleTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function shouldInitiateCachePrefetch()
|
||||
{
|
||||
return is_null($this->getCredentialsInCache()) || time() >= $this->getCredentialsInCache()->prefetchTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getStaleTime($expiration)
|
||||
{
|
||||
return $expiration <= 0 ?
|
||||
time() + (60 * 60) :
|
||||
$expiration - (15 * 60);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return RefreshResult
|
||||
*/
|
||||
abstract function refreshCredentials();
|
||||
|
||||
/**
|
||||
* Get the toString of the credentials provider as the key.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
abstract function key();
|
||||
}
|
||||
78
vendor/alibabacloud/credentials/src/Providers/StaticAKCredentialsProvider.php
vendored
Normal file
78
vendor/alibabacloud/credentials/src/Providers/StaticAKCredentialsProvider.php
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials\Providers;
|
||||
|
||||
use AlibabaCloud\Credentials\Utils\Helper;
|
||||
use AlibabaCloud\Credentials\Utils\Filter;
|
||||
|
||||
/**
|
||||
* @internal This class is intended for internal use within the package.
|
||||
* Class StaticAKCredentialsProvider
|
||||
*
|
||||
* @package AlibabaCloud\Credentials\Providers
|
||||
*/
|
||||
class StaticAKCredentialsProvider implements CredentialsProvider
|
||||
{
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $accessKeyId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $accessKeySecret;
|
||||
|
||||
/**
|
||||
* StaticAKCredentialsProvider constructor.
|
||||
*
|
||||
* @param array $params
|
||||
*/
|
||||
public function __construct(array $params = [])
|
||||
{
|
||||
$this->filterAK($params);
|
||||
}
|
||||
|
||||
private function filterAK(array $params)
|
||||
{
|
||||
if (Helper::envNotEmpty('ALIBABA_CLOUD_ACCESS_KEY_ID')) {
|
||||
$this->accessKeyId = Helper::env('ALIBABA_CLOUD_ACCESS_KEY_ID');
|
||||
}
|
||||
|
||||
if (Helper::envNotEmpty('ALIBABA_CLOUD_ACCESS_KEY_SECRET')) {
|
||||
$this->accessKeySecret = Helper::env('ALIBABA_CLOUD_ACCESS_KEY_SECRET');
|
||||
}
|
||||
|
||||
if (isset($params['accessKeyId'])) {
|
||||
$this->accessKeyId = $params['accessKeyId'];
|
||||
}
|
||||
if (isset($params['accessKeySecret'])) {
|
||||
$this->accessKeySecret = $params['accessKeySecret'];
|
||||
}
|
||||
|
||||
Filter::accessKey($this->accessKeyId, $this->accessKeySecret);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get credential.
|
||||
*
|
||||
* @return Credentials
|
||||
*/
|
||||
public function getCredentials()
|
||||
{
|
||||
return new Credentials([
|
||||
'accessKeyId' => $this->accessKeyId,
|
||||
'accessKeySecret' => $this->accessKeySecret,
|
||||
'providerName' => $this->getProviderName(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getProviderName()
|
||||
{
|
||||
return "static_ak";
|
||||
}
|
||||
}
|
||||
92
vendor/alibabacloud/credentials/src/Providers/StaticSTSCredentialsProvider.php
vendored
Normal file
92
vendor/alibabacloud/credentials/src/Providers/StaticSTSCredentialsProvider.php
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials\Providers;
|
||||
|
||||
use AlibabaCloud\Credentials\Utils\Helper;
|
||||
use AlibabaCloud\Credentials\Utils\Filter;
|
||||
|
||||
/**
|
||||
* @internal This class is intended for internal use within the package.
|
||||
* Class StaticSTSCredentialsProvider
|
||||
*
|
||||
* @package AlibabaCloud\Credentials\Providers
|
||||
*/
|
||||
class StaticSTSCredentialsProvider implements CredentialsProvider
|
||||
{
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $accessKeyId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $accessKeySecret;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $securityToken;
|
||||
|
||||
/**
|
||||
* StaticSTSCredentialsProvider constructor.
|
||||
*
|
||||
* @param array $params
|
||||
*/
|
||||
public function __construct(array $params = [])
|
||||
{
|
||||
$this->filterSTS($params);
|
||||
}
|
||||
|
||||
private function filterSTS(array $params)
|
||||
{
|
||||
if (Helper::envNotEmpty('ALIBABA_CLOUD_ACCESS_KEY_ID')) {
|
||||
$this->accessKeyId = Helper::env('ALIBABA_CLOUD_ACCESS_KEY_ID');
|
||||
}
|
||||
|
||||
if (Helper::envNotEmpty('ALIBABA_CLOUD_ACCESS_KEY_SECRET')) {
|
||||
$this->accessKeySecret = Helper::env('ALIBABA_CLOUD_ACCESS_KEY_SECRET');
|
||||
}
|
||||
|
||||
if (Helper::envNotEmpty('ALIBABA_CLOUD_SECURITY_TOKEN')) {
|
||||
$this->securityToken = Helper::env('ALIBABA_CLOUD_SECURITY_TOKEN');
|
||||
}
|
||||
|
||||
if (isset($params['accessKeyId'])) {
|
||||
$this->accessKeyId = $params['accessKeyId'];
|
||||
}
|
||||
if (isset($params['accessKeySecret'])) {
|
||||
$this->accessKeySecret = $params['accessKeySecret'];
|
||||
}
|
||||
if (isset($params['securityToken'])) {
|
||||
$this->securityToken = $params['securityToken'];
|
||||
}
|
||||
|
||||
Filter::accessKey($this->accessKeyId, $this->accessKeySecret);
|
||||
Filter::securityToken($this->securityToken);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get credential.
|
||||
*
|
||||
* @return Credentials
|
||||
*/
|
||||
public function getCredentials()
|
||||
{
|
||||
return new Credentials([
|
||||
'accessKeyId' => $this->accessKeyId,
|
||||
'accessKeySecret' => $this->accessKeySecret,
|
||||
'securityToken' => $this->securityToken,
|
||||
'providerName' => $this->getProviderName(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getProviderName()
|
||||
{
|
||||
return "static_sts";
|
||||
}
|
||||
}
|
||||
126
vendor/alibabacloud/credentials/src/Providers/URLCredentialsProvider.php
vendored
Normal file
126
vendor/alibabacloud/credentials/src/Providers/URLCredentialsProvider.php
vendored
Normal file
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials\Providers;
|
||||
|
||||
use AlibabaCloud\Credentials\Utils\Helper;
|
||||
use AlibabaCloud\Credentials\Utils\Filter;
|
||||
use AlibabaCloud\Credentials\Request\Request;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use InvalidArgumentException;
|
||||
use RuntimeException;
|
||||
use AlibabaCloud\Credentials\Credential\RefreshResult;
|
||||
|
||||
/**
|
||||
* @internal This class is intended for internal use within the package.
|
||||
* Class URLCredentialsProvider
|
||||
*
|
||||
* @package AlibabaCloud\Credentials\Providers
|
||||
*/
|
||||
class URLCredentialsProvider extends SessionCredentialsProvider
|
||||
{
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $credentialsURI;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $connectTimeout = 5;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $readTimeout = 5;
|
||||
|
||||
/**
|
||||
* URLCredentialsProvider constructor.
|
||||
*
|
||||
* @param array $params
|
||||
* @param array $options
|
||||
*/
|
||||
public function __construct(array $params = [], array $options = [])
|
||||
{
|
||||
$this->filterOptions($options);
|
||||
$this->filterCredentialsURI($params);
|
||||
}
|
||||
|
||||
private function filterOptions(array $options)
|
||||
{
|
||||
if (isset($options['connectTimeout'])) {
|
||||
$this->connectTimeout = $options['connectTimeout'];
|
||||
}
|
||||
|
||||
if (isset($options['readTimeout'])) {
|
||||
$this->readTimeout = $options['readTimeout'];
|
||||
}
|
||||
|
||||
Filter::timeout($this->connectTimeout, $this->readTimeout);
|
||||
}
|
||||
|
||||
private function filterCredentialsURI(array $params)
|
||||
{
|
||||
if (Helper::envNotEmpty('ALIBABA_CLOUD_CREDENTIALS_URI')) {
|
||||
$this->credentialsURI = Helper::env('ALIBABA_CLOUD_CREDENTIALS_URI');
|
||||
}
|
||||
|
||||
if (isset($params['credentialsURI'])) {
|
||||
$this->credentialsURI = $params['credentialsURI'];
|
||||
}
|
||||
|
||||
Filter::credentialsURI($this->credentialsURI);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get credentials by request.
|
||||
*
|
||||
* @return RefreshResult
|
||||
* @throws InvalidArgumentException
|
||||
* @throws RuntimeException
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function refreshCredentials()
|
||||
{
|
||||
$options = Request::commonOptions();
|
||||
$options['read_timeout'] = $this->readTimeout;
|
||||
$options['connect_timeout'] = $this->connectTimeout;
|
||||
|
||||
$result = Request::createClient()->request('GET', $this->credentialsURI, $options);
|
||||
|
||||
if ($result->getStatusCode() !== 200) {
|
||||
throw new RuntimeException('Error refreshing credentials from credentialsURI, statusCode: ' . $result->getStatusCode() . ', result: ' . (string) $result);
|
||||
}
|
||||
|
||||
$credentials = $result->toArray();
|
||||
|
||||
if (!isset($credentials['AccessKeyId']) || !isset($credentials['AccessKeySecret']) || !isset($credentials['SecurityToken']) || !isset($credentials['Expiration'])) {
|
||||
throw new RuntimeException('Error retrieving credentials from credentialsURI result:' . $result->toJson());
|
||||
}
|
||||
|
||||
return new RefreshResult(new Credentials([
|
||||
'accessKeyId' => $credentials['AccessKeyId'],
|
||||
'accessKeySecret' => $credentials['AccessKeySecret'],
|
||||
'securityToken' => $credentials['SecurityToken'],
|
||||
'expiration' => \strtotime($credentials['Expiration']),
|
||||
'providerName' => $this->getProviderName(),
|
||||
]), $this->getStaleTime(strtotime($credentials['Expiration'])));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function key()
|
||||
{
|
||||
return 'credential_uri#' . $this->credentialsURI;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getProviderName()
|
||||
{
|
||||
return 'credential_uri';
|
||||
}
|
||||
}
|
||||
242
vendor/alibabacloud/credentials/src/RamRoleArnCredential.php
vendored
Normal file
242
vendor/alibabacloud/credentials/src/RamRoleArnCredential.php
vendored
Normal file
@@ -0,0 +1,242 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials;
|
||||
|
||||
use AlibabaCloud\Credentials\Providers\RamRoleArnCredentialsProvider;
|
||||
use AlibabaCloud\Credentials\Credential\CredentialModel;
|
||||
use AlibabaCloud\Credentials\Signature\ShaHmac1Signature;
|
||||
use AlibabaCloud\Credentials\Utils\Filter;
|
||||
use Exception;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* Use the AssumeRole of the RAM account to complete the authentication.
|
||||
*/
|
||||
class RamRoleArnCredential implements CredentialsInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $accessKeyId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $accessKeySecret;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $roleArn;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $roleSessionName;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $policy;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $config;
|
||||
|
||||
/**
|
||||
* RamRoleArnCredential constructor.
|
||||
*
|
||||
* @param array $credential
|
||||
* @param array $config
|
||||
*/
|
||||
public function __construct(array $credential = [], array $config = [])
|
||||
{
|
||||
$this->filterParameters($credential);
|
||||
$this->filterPolicy($credential);
|
||||
|
||||
Filter::accessKey($credential['access_key_id'], $credential['access_key_secret']);
|
||||
|
||||
$this->config = $config;
|
||||
$this->accessKeyId = $credential['access_key_id'];
|
||||
$this->accessKeySecret = $credential['access_key_secret'];
|
||||
$this->roleArn = $credential['role_arn'];
|
||||
$this->roleSessionName = $credential['role_session_name'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $credential
|
||||
*/
|
||||
private function filterParameters(array $credential)
|
||||
{
|
||||
if (!isset($credential['access_key_id'])) {
|
||||
throw new InvalidArgumentException('Missing required access_key_id option in config for ram_role_arn');
|
||||
}
|
||||
|
||||
if (!isset($credential['access_key_secret'])) {
|
||||
throw new InvalidArgumentException('Missing required access_key_secret option in config for ram_role_arn');
|
||||
}
|
||||
|
||||
if (!isset($credential['role_arn'])) {
|
||||
throw new InvalidArgumentException('Missing required role_arn option in config for ram_role_arn');
|
||||
}
|
||||
|
||||
if (!isset($credential['role_session_name'])) {
|
||||
throw new InvalidArgumentException('Missing required role_session_name option in config for ram_role_arn');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $credential
|
||||
*/
|
||||
private function filterPolicy(array $credential)
|
||||
{
|
||||
if (isset($credential['policy'])) {
|
||||
if (is_string($credential['policy'])) {
|
||||
$this->policy = $credential['policy'];
|
||||
}
|
||||
|
||||
if (is_array($credential['policy'])) {
|
||||
$this->policy = json_encode($credential['policy']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getConfig()
|
||||
{
|
||||
return $this->config;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getRoleArn()
|
||||
{
|
||||
return $this->roleArn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getRoleSessionName()
|
||||
{
|
||||
return $this->roleSessionName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPolicy()
|
||||
{
|
||||
return $this->policy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return "$this->accessKeyId#$this->accessKeySecret#$this->roleArn#$this->roleSessionName";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ShaHmac1Signature
|
||||
*/
|
||||
public function getSignature()
|
||||
{
|
||||
return new ShaHmac1Signature();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getOriginalAccessKeyId()
|
||||
{
|
||||
return $this->accessKeyId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getOriginalAccessKeySecret()
|
||||
{
|
||||
return $this->accessKeySecret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function getAccessKeyId()
|
||||
{
|
||||
return $this->getSessionCredential()->getAccessKeyId();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return AlibabaCloud\Credentials\Providers\Credentials
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
protected function getSessionCredential()
|
||||
{
|
||||
$params = [
|
||||
'accessKeyId' => $this->accessKeyId,
|
||||
'accessKeySecret' => $this->accessKeyId,
|
||||
'roleArn' => $this->roleArn,
|
||||
'roleSessionName' => $this->roleSessionName,
|
||||
'policy' => $this->policy,
|
||||
];
|
||||
return (new RamRoleArnCredentialsProvider($params))->getCredentials();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function getAccessKeySecret()
|
||||
{
|
||||
return $this->getSessionCredential()->getAccessKeySecret();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function getSecurityToken()
|
||||
{
|
||||
return $this->getSessionCredential()->getSecurityToken();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function getExpiration()
|
||||
{
|
||||
return $this->getSessionCredential()->getExpiration();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getCredential()
|
||||
{
|
||||
$credentials = $this->getSessionCredential();
|
||||
return new CredentialModel([
|
||||
'accessKeyId' => $credentials->getAccessKeyId(),
|
||||
'accessKeySecret' => $credentials->getAccessKeySecret(),
|
||||
'securityToken' => $credentials->getSecurityToken(),
|
||||
'type' => 'ram_role_arn',
|
||||
]);
|
||||
}
|
||||
}
|
||||
167
vendor/alibabacloud/credentials/src/Request/Request.php
vendored
Normal file
167
vendor/alibabacloud/credentials/src/Request/Request.php
vendored
Normal file
@@ -0,0 +1,167 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials\Request;
|
||||
|
||||
use AlibabaCloud\Credentials\Credentials;
|
||||
use AlibabaCloud\Credentials\Utils\Helper;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\HandlerStack;
|
||||
use GuzzleHttp\Middleware;
|
||||
use AlibabaCloud\Tea\Response;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
use Exception;
|
||||
use InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* RESTful RPC Request.
|
||||
*/
|
||||
class Request
|
||||
{
|
||||
|
||||
/**
|
||||
* Request Connect Timeout
|
||||
*/
|
||||
const CONNECT_TIMEOUT = 5;
|
||||
|
||||
/**
|
||||
* Request Read Timeout
|
||||
*/
|
||||
const READ_TIMEOUT = 5;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private static $config = [];
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function commonOptions()
|
||||
{
|
||||
$options = [];
|
||||
$options['http_errors'] = false;
|
||||
$options['connect_timeout'] = self::CONNECT_TIMEOUT;
|
||||
$options['read_timeout'] = self::READ_TIMEOUT;
|
||||
$options['headers']['User-Agent'] = Helper::getUserAgent();
|
||||
|
||||
// Turn on debug mode based on environment variable.
|
||||
if (strtolower(Helper::env('DEBUG')) === 'sdk') {
|
||||
$options['debug'] = true;
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $salt
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function uuid($salt)
|
||||
{
|
||||
return md5($salt . uniqid(md5(microtime(true)), true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $method
|
||||
* @param array $parameters
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function signString($method, array $parameters)
|
||||
{
|
||||
ksort($parameters);
|
||||
$canonicalized = '';
|
||||
foreach ($parameters as $key => $value) {
|
||||
$canonicalized .= '&' . self::percentEncode($key) . '=' . self::percentEncode($value);
|
||||
}
|
||||
|
||||
return $method . '&%2F&' . self::percentEncode(substr($canonicalized, 1));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $string
|
||||
* @param string $accessKeySecret
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function shaHmac1sign($string, $accessKeySecret)
|
||||
{
|
||||
return base64_encode(hash_hmac('sha1', $string, $accessKeySecret, true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $string
|
||||
* @param string $accessKeySecret
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function shaHmac256sign($string, $accessKeySecret)
|
||||
{
|
||||
return base64_encode(hash_hmac('sha256', $string, $accessKeySecret, true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $string
|
||||
* @param string $privateKey
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function shaHmac256WithRsasign($string, $privateKey)
|
||||
{
|
||||
$binarySignature = '';
|
||||
try {
|
||||
openssl_sign(
|
||||
$string,
|
||||
$binarySignature,
|
||||
$privateKey,
|
||||
\OPENSSL_ALGO_SHA256
|
||||
);
|
||||
} catch (Exception $exception) {
|
||||
throw new InvalidArgumentException(
|
||||
$exception->getMessage()
|
||||
);
|
||||
}
|
||||
|
||||
return base64_encode($binarySignature);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $string
|
||||
*
|
||||
* @return null|string|string[]
|
||||
*/
|
||||
private static function percentEncode($string)
|
||||
{
|
||||
$result = rawurlencode($string);
|
||||
$result = str_replace(['+', '*'], ['%20', '%2A'], $result);
|
||||
$result = preg_replace('/%7E/', '~', $result);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Client
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function createClient()
|
||||
{
|
||||
if (Credentials::hasMock()) {
|
||||
$stack = HandlerStack::create(Credentials::getMock());
|
||||
$history = Credentials::getHandlerHistory();
|
||||
$stack->push($history);
|
||||
} else {
|
||||
$stack = HandlerStack::create();
|
||||
}
|
||||
|
||||
$stack->push(Middleware::mapResponse(static function (ResponseInterface $response) {
|
||||
return new Response($response);
|
||||
}));
|
||||
|
||||
self::$config['handler'] = $stack;
|
||||
|
||||
return new Client(self::$config);
|
||||
}
|
||||
}
|
||||
185
vendor/alibabacloud/credentials/src/RsaKeyPairCredential.php
vendored
Normal file
185
vendor/alibabacloud/credentials/src/RsaKeyPairCredential.php
vendored
Normal file
@@ -0,0 +1,185 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials;
|
||||
|
||||
use AlibabaCloud\Credentials\Providers\RsaKeyPairCredentialsProvider;
|
||||
use AlibabaCloud\Credentials\Credential\CredentialModel;
|
||||
use AlibabaCloud\Credentials\Signature\ShaHmac1Signature;
|
||||
use AlibabaCloud\Credentials\Utils\Filter;
|
||||
use Exception;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* Use the RSA key pair to complete the authentication (supported only on Japanese site)
|
||||
*/
|
||||
class RsaKeyPairCredential implements CredentialsInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $publicKeyId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $privateKeyFile;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $privateKey;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $config;
|
||||
|
||||
/**
|
||||
* RsaKeyPairCredential constructor.
|
||||
*
|
||||
* @param string $public_key_id
|
||||
* @param string $private_key_file
|
||||
* @param array $config
|
||||
*/
|
||||
public function __construct($public_key_id, $private_key_file, array $config = [])
|
||||
{
|
||||
Filter::publicKeyId($public_key_id);
|
||||
Filter::privateKeyFile($private_key_file);
|
||||
|
||||
$this->publicKeyId = $public_key_id;
|
||||
$this->privateKeyFile = $private_key_file;
|
||||
$this->config = $config;
|
||||
try {
|
||||
$this->privateKey = file_get_contents($private_key_file);
|
||||
} catch (Exception $exception) {
|
||||
throw new InvalidArgumentException($exception->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getConfig()
|
||||
{
|
||||
return $this->config;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getOriginalAccessKeyId()
|
||||
{
|
||||
return $this->getPublicKeyId();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPublicKeyId()
|
||||
{
|
||||
return $this->publicKeyId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getOriginalAccessKeySecret()
|
||||
{
|
||||
return $this->getPrivateKey();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getPrivateKey()
|
||||
{
|
||||
return $this->privateKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return "publicKeyId#$this->publicKeyId";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ShaHmac1Signature
|
||||
*/
|
||||
public function getSignature()
|
||||
{
|
||||
return new ShaHmac1Signature();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function getAccessKeyId()
|
||||
{
|
||||
return $this->getSessionCredential()->getAccessKeyId();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return AlibabaCloud\Credentials\Providers\Credentials
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
protected function getSessionCredential()
|
||||
{
|
||||
$params = [
|
||||
'publicKeyId' => $this->publicKeyId,
|
||||
'privateKeyFile' => $this->privateKeyFile,
|
||||
];
|
||||
return (new RsaKeyPairCredentialsProvider($params))->getCredentials();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function getAccessKeySecret()
|
||||
{
|
||||
return $this->getSessionCredential()->getAccessKeySecret();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function getSecurityToken()
|
||||
{
|
||||
return $this->getSessionCredential()->getSecurityToken();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function getExpiration()
|
||||
{
|
||||
return $this->getSessionCredential()->getExpiration();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getCredential()
|
||||
{
|
||||
$credentials = $this->getSessionCredential();
|
||||
return new CredentialModel([
|
||||
'accessKeyId' => $credentials->getAccessKeyId(),
|
||||
'accessKeySecret' => $credentials->getAccessKeySecret(),
|
||||
'securityToken' => $credentials->getSecurityToken(),
|
||||
'type' => 'rsa_key_pair',
|
||||
]);
|
||||
}
|
||||
}
|
||||
47
vendor/alibabacloud/credentials/src/Signature/BearerTokenSignature.php
vendored
Normal file
47
vendor/alibabacloud/credentials/src/Signature/BearerTokenSignature.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials\Signature;
|
||||
|
||||
/**
|
||||
* Class BearerTokenSignature
|
||||
*
|
||||
* @package AlibabaCloud\Credentials\Signature
|
||||
*/
|
||||
class BearerTokenSignature implements SignatureInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getMethod()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return 'BEARERTOKEN';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getVersion()
|
||||
{
|
||||
return '1.0';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $string
|
||||
* @param string $accessKeySecret
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function sign($string, $accessKeySecret)
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
47
vendor/alibabacloud/credentials/src/Signature/ShaHmac1Signature.php
vendored
Normal file
47
vendor/alibabacloud/credentials/src/Signature/ShaHmac1Signature.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials\Signature;
|
||||
|
||||
/**
|
||||
* Class ShaHmac1Signature
|
||||
*
|
||||
* @package AlibabaCloud\Credentials\Signature
|
||||
*/
|
||||
class ShaHmac1Signature implements SignatureInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getMethod()
|
||||
{
|
||||
return 'HMAC-SHA1';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getVersion()
|
||||
{
|
||||
return '1.0';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $string
|
||||
* @param string $accessKeySecret
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function sign($string, $accessKeySecret)
|
||||
{
|
||||
return base64_encode(hash_hmac('sha1', $string, $accessKeySecret, true));
|
||||
}
|
||||
}
|
||||
47
vendor/alibabacloud/credentials/src/Signature/ShaHmac256Signature.php
vendored
Normal file
47
vendor/alibabacloud/credentials/src/Signature/ShaHmac256Signature.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials\Signature;
|
||||
|
||||
/**
|
||||
* Class ShaHmac256Signature
|
||||
*
|
||||
* @package AlibabaCloud\Credentials\Signature
|
||||
*/
|
||||
class ShaHmac256Signature implements SignatureInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getMethod()
|
||||
{
|
||||
return 'HMAC-SHA256';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getVersion()
|
||||
{
|
||||
return '1.0';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $string
|
||||
* @param string $accessKeySecret
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function sign($string, $accessKeySecret)
|
||||
{
|
||||
return base64_encode(hash_hmac('sha256', $string, $accessKeySecret, true));
|
||||
}
|
||||
}
|
||||
64
vendor/alibabacloud/credentials/src/Signature/ShaHmac256WithRsaSignature.php
vendored
Normal file
64
vendor/alibabacloud/credentials/src/Signature/ShaHmac256WithRsaSignature.php
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials\Signature;
|
||||
|
||||
use Exception;
|
||||
use InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* Class ShaHmac256WithRsaSignature
|
||||
*
|
||||
* @package AlibabaCloud\Credentials\Signature
|
||||
*/
|
||||
class ShaHmac256WithRsaSignature implements SignatureInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getMethod()
|
||||
{
|
||||
return 'SHA256withRSA';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return 'PRIVATEKEY';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getVersion()
|
||||
{
|
||||
return '1.0';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $string
|
||||
* @param string $privateKey
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function sign($string, $privateKey)
|
||||
{
|
||||
$binarySignature = '';
|
||||
try {
|
||||
openssl_sign(
|
||||
$string,
|
||||
$binarySignature,
|
||||
$privateKey,
|
||||
\OPENSSL_ALGO_SHA256
|
||||
);
|
||||
} catch (Exception $exception) {
|
||||
throw new InvalidArgumentException(
|
||||
$exception->getMessage()
|
||||
);
|
||||
}
|
||||
|
||||
return base64_encode($binarySignature);
|
||||
}
|
||||
}
|
||||
34
vendor/alibabacloud/credentials/src/Signature/SignatureInterface.php
vendored
Normal file
34
vendor/alibabacloud/credentials/src/Signature/SignatureInterface.php
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials\Signature;
|
||||
|
||||
/**
|
||||
* Interface SignatureInterface
|
||||
*
|
||||
* @package AlibabaCloud\Credentials\Signature
|
||||
*/
|
||||
interface SignatureInterface
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getMethod();
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getVersion();
|
||||
|
||||
/**
|
||||
* @param string $string
|
||||
* @param string $accessKeySecret
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function sign($string, $accessKeySecret);
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getType();
|
||||
}
|
||||
115
vendor/alibabacloud/credentials/src/StsCredential.php
vendored
Normal file
115
vendor/alibabacloud/credentials/src/StsCredential.php
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials;
|
||||
|
||||
use AlibabaCloud\Credentials\Utils\Filter;
|
||||
use AlibabaCloud\Credentials\Credential\CredentialModel;
|
||||
use AlibabaCloud\Credentials\Signature\ShaHmac1Signature;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* Use the STS Token to complete the authentication.
|
||||
*/
|
||||
class StsCredential implements CredentialsInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $accessKeyId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $accessKeySecret;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $securityToken;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $expiration;
|
||||
|
||||
/**
|
||||
* StsCredential constructor.
|
||||
*
|
||||
* @param string $access_key_id Access key ID
|
||||
* @param string $access_key_secret Access Key Secret
|
||||
* @param int $expiration
|
||||
* @param string $security_token Security Token
|
||||
*/
|
||||
public function __construct($access_key_id, $access_key_secret, $expiration, $security_token = '')
|
||||
{
|
||||
Filter::accessKey($access_key_id, $access_key_secret);
|
||||
Filter::expiration($expiration);
|
||||
$this->accessKeyId = $access_key_id;
|
||||
$this->accessKeySecret = $access_key_secret;
|
||||
$this->expiration = $expiration;
|
||||
$this->securityToken = $security_token;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getExpiration()
|
||||
{
|
||||
return $this->expiration;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAccessKeyId()
|
||||
{
|
||||
return $this->accessKeyId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAccessKeySecret()
|
||||
{
|
||||
return $this->accessKeySecret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getSecurityToken()
|
||||
{
|
||||
return $this->securityToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return "$this->accessKeyId#$this->accessKeySecret#$this->securityToken";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ShaHmac1Signature
|
||||
*/
|
||||
public function getSignature()
|
||||
{
|
||||
return new ShaHmac1Signature();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getCredential()
|
||||
{
|
||||
return new CredentialModel([
|
||||
'accessKeyId' => $this->accessKeyId,
|
||||
'accessKeySecret' => $this->accessKeySecret,
|
||||
'securityToken' => $this->securityToken,
|
||||
'type' => 'sts',
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
233
vendor/alibabacloud/credentials/src/Utils/Filter.php
vendored
Normal file
233
vendor/alibabacloud/credentials/src/Utils/Filter.php
vendored
Normal file
@@ -0,0 +1,233 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials\Utils;
|
||||
|
||||
use InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* Class Filter
|
||||
*
|
||||
* @package AlibabaCloud\Credentials\Utils
|
||||
*/
|
||||
class Filter
|
||||
{
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @return string
|
||||
*/
|
||||
public static function credentialName($name)
|
||||
{
|
||||
if (!is_string($name)) {
|
||||
throw new InvalidArgumentException('Name must be a string');
|
||||
}
|
||||
|
||||
if ($name === '') {
|
||||
throw new InvalidArgumentException('Name cannot be empty');
|
||||
}
|
||||
|
||||
return $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $bearerToken
|
||||
*
|
||||
* @return mixed
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public static function bearerToken($bearerToken)
|
||||
{
|
||||
if (!is_string($bearerToken)) {
|
||||
throw new InvalidArgumentException('bearerToken must be a string');
|
||||
}
|
||||
|
||||
if ($bearerToken === '') {
|
||||
throw new InvalidArgumentException('bearerToken cannot be empty');
|
||||
}
|
||||
|
||||
return $bearerToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $publicKeyId
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function publicKeyId($publicKeyId)
|
||||
{
|
||||
if (!is_string($publicKeyId)) {
|
||||
throw new InvalidArgumentException('publicKeyId must be a string');
|
||||
}
|
||||
|
||||
if ($publicKeyId === '') {
|
||||
throw new InvalidArgumentException('publicKeyId cannot be empty');
|
||||
}
|
||||
|
||||
return $publicKeyId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $privateKeyFile
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function privateKeyFile($privateKeyFile)
|
||||
{
|
||||
if (!is_string($privateKeyFile)) {
|
||||
throw new InvalidArgumentException('privateKeyFile must be a string');
|
||||
}
|
||||
|
||||
if ($privateKeyFile === '') {
|
||||
throw new InvalidArgumentException('privateKeyFile cannot be empty');
|
||||
}
|
||||
|
||||
return $privateKeyFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $roleName
|
||||
*/
|
||||
public static function roleName($roleName)
|
||||
{
|
||||
if ($roleName === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!is_string($roleName)) {
|
||||
throw new InvalidArgumentException('roleName must be a string');
|
||||
}
|
||||
|
||||
if ($roleName === '') {
|
||||
throw new InvalidArgumentException('roleName cannot be empty');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param boolean|null $disableIMDSv1
|
||||
*/
|
||||
public static function disableIMDSv1($disableIMDSv1)
|
||||
{
|
||||
if (!is_bool($disableIMDSv1)) {
|
||||
throw new InvalidArgumentException('disableIMDSv1 must be a boolean');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string|null $roleArn
|
||||
*/
|
||||
public static function roleArn($roleArn)
|
||||
{
|
||||
if (is_null($roleArn) || $roleArn === '') {
|
||||
throw new InvalidArgumentException('roleArn cannot be empty');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $roleArn
|
||||
*/
|
||||
public static function oidcProviderArn($oidcProviderArn)
|
||||
{
|
||||
if (is_null($oidcProviderArn) || $oidcProviderArn === '') {
|
||||
throw new InvalidArgumentException('oidcProviderArn cannot be empty');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $roleArn
|
||||
*/
|
||||
public static function oidcTokenFilePath($oidcTokenFilePath)
|
||||
{
|
||||
if (is_null($oidcTokenFilePath) || $oidcTokenFilePath === '') {
|
||||
throw new InvalidArgumentException('oidcTokenFilePath cannot be empty');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $accessKeyId
|
||||
* @param string $accessKeySecret
|
||||
*/
|
||||
public static function accessKey($accessKeyId, $accessKeySecret)
|
||||
{
|
||||
if (!is_string($accessKeyId)) {
|
||||
throw new InvalidArgumentException('accessKeyId must be a string');
|
||||
}
|
||||
|
||||
if ($accessKeyId === '') {
|
||||
throw new InvalidArgumentException('accessKeyId cannot be empty');
|
||||
}
|
||||
|
||||
if (!is_string($accessKeySecret)) {
|
||||
throw new InvalidArgumentException('accessKeySecret must be a string');
|
||||
}
|
||||
|
||||
if ($accessKeySecret === '') {
|
||||
throw new InvalidArgumentException('accessKeySecret cannot be empty');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $securityToken
|
||||
*/
|
||||
public static function securityToken($securityToken)
|
||||
{
|
||||
if (!is_string($securityToken)) {
|
||||
throw new InvalidArgumentException('securityToken must be a string');
|
||||
}
|
||||
|
||||
if ($securityToken === '') {
|
||||
throw new InvalidArgumentException('securityToken cannot be empty');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $expiration
|
||||
*/
|
||||
public static function expiration($expiration)
|
||||
{
|
||||
if (!is_int($expiration)) {
|
||||
throw new InvalidArgumentException('expiration must be a int');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $connectTimeout
|
||||
* @param int $readTimeout
|
||||
*/
|
||||
public static function timeout($connectTimeout, $readTimeout)
|
||||
{
|
||||
if (!is_int($connectTimeout)) {
|
||||
throw new InvalidArgumentException('connectTimeout must be a int');
|
||||
}
|
||||
|
||||
if (!is_int($readTimeout)) {
|
||||
throw new InvalidArgumentException('readTimeout must be a int');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $credentialsURI
|
||||
*/
|
||||
public static function credentialsURI($credentialsURI)
|
||||
{
|
||||
if (!is_string($credentialsURI)) {
|
||||
throw new InvalidArgumentException('credentialsURI must be a string');
|
||||
}
|
||||
|
||||
if ($credentialsURI === '') {
|
||||
throw new InvalidArgumentException('credentialsURI cannot be empty');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param boolean|null $reuseLastProviderEnabled
|
||||
*/
|
||||
public static function reuseLastProviderEnabled($reuseLastProviderEnabled)
|
||||
{
|
||||
if (!is_bool($reuseLastProviderEnabled)) {
|
||||
throw new InvalidArgumentException('reuseLastProviderEnabled must be a boolean');
|
||||
}
|
||||
}
|
||||
}
|
||||
251
vendor/alibabacloud/credentials/src/Utils/Helper.php
vendored
Normal file
251
vendor/alibabacloud/credentials/src/Utils/Helper.php
vendored
Normal file
@@ -0,0 +1,251 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials\Utils;
|
||||
|
||||
use AlibabaCloud\Credentials\Credential;
|
||||
use org\bovigo\vfs\vfsStream;
|
||||
use Closure;
|
||||
|
||||
/**
|
||||
* Class Helper
|
||||
*
|
||||
* @package AlibabaCloud\Credentials\Utils
|
||||
*/
|
||||
class Helper
|
||||
{
|
||||
/**
|
||||
* @param array $arrays
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function merge(array $arrays)
|
||||
{
|
||||
$result = [];
|
||||
foreach ($arrays as $array) {
|
||||
foreach ($array as $key => $value) {
|
||||
if (is_int($key)) {
|
||||
$result[] = $value;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isset($result[$key]) && is_array($result[$key])) {
|
||||
$result[$key] = self::merge(
|
||||
[$result[$key], $value]
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
$result[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $filename
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function inOpenBasedir($filename)
|
||||
{
|
||||
$open_basedir = ini_get('open_basedir');
|
||||
if (!$open_basedir) {
|
||||
return true;
|
||||
}
|
||||
if (0 === strpos($filename, vfsStream::SCHEME)) {
|
||||
// 虚拟文件忽略
|
||||
return true;
|
||||
}
|
||||
|
||||
$dirs = explode(PATH_SEPARATOR, $open_basedir);
|
||||
|
||||
return empty($dirs) || self::inDir($filename, $dirs);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $filename
|
||||
* @param array $dirs
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function inDir($filename, array $dirs)
|
||||
{
|
||||
foreach ($dirs as $dir) {
|
||||
if ($dir[strlen($dir) - 1] !== DIRECTORY_SEPARATOR) {
|
||||
$dir .= DIRECTORY_SEPARATOR;
|
||||
}
|
||||
|
||||
if (0 === strpos($filename, $dir)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public static function isWindows()
|
||||
{
|
||||
return PATH_SEPARATOR === ';';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $key
|
||||
*
|
||||
* @return bool|mixed
|
||||
*/
|
||||
public static function envNotEmpty($key)
|
||||
{
|
||||
$value = self::env($key, false);
|
||||
if ($value) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of an environment variable.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $default
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function env($key, $default = null)
|
||||
{
|
||||
$value = getenv($key);
|
||||
|
||||
if ($value === false) {
|
||||
return self::value($default);
|
||||
}
|
||||
|
||||
if (self::envSubstr($value)) {
|
||||
return substr($value, 1, -1);
|
||||
}
|
||||
|
||||
return self::envConversion($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the default value of the given value.
|
||||
*
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function value($value)
|
||||
{
|
||||
return $value instanceof Closure ? $value() : $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function envSubstr($value)
|
||||
{
|
||||
return ($valueLength = strlen($value)) > 1
|
||||
&& strpos($value, '"') === 0
|
||||
&& $value[$valueLength - 1] === '"';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
*
|
||||
* @return bool|string|null
|
||||
*/
|
||||
public static function envConversion($value)
|
||||
{
|
||||
$key = strtolower($value);
|
||||
|
||||
if ($key === 'null' || $key === '(null)') {
|
||||
return null;
|
||||
}
|
||||
|
||||
$list = [
|
||||
'true' => true,
|
||||
'(true)' => true,
|
||||
'false' => false,
|
||||
'(false)' => false,
|
||||
'empty' => '',
|
||||
'(empty)' => '',
|
||||
];
|
||||
|
||||
return isset($list[$key]) ? $list[$key] : $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the environment's HOME directory.
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
public static function getHomeDirectory()
|
||||
{
|
||||
if (getenv('HOME')) {
|
||||
return getenv('HOME');
|
||||
}
|
||||
|
||||
return (getenv('HOMEDRIVE') && getenv('HOMEPATH'))
|
||||
? getenv('HOMEDRIVE') . getenv('HOMEPATH')
|
||||
: null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed ...$parameters
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public static function dd(...$parameters)
|
||||
{
|
||||
dump(...$parameters);
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Snake to camel case.
|
||||
*
|
||||
* @param string $str
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function snakeToCamelCase($str)
|
||||
{
|
||||
$components = explode('_', $str);
|
||||
$camelCaseStr = $components[0];
|
||||
for ($i = 1; $i < count($components); $i++) {
|
||||
$camelCaseStr .= ucfirst($components[$i]);
|
||||
}
|
||||
return $camelCaseStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user agent.
|
||||
*
|
||||
* @param string $userAgent
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getUserAgent()
|
||||
{
|
||||
return sprintf('AlibabaCloud (%s; %s) PHP/%s Credentials/%s TeaDSL/1', PHP_OS, \PHP_SAPI, PHP_VERSION, Credential::VERSION);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $arrays
|
||||
* @param string $key
|
||||
*
|
||||
* @return mix
|
||||
*/
|
||||
public static function unsetReturnNull(array $arrays, $key)
|
||||
{
|
||||
if(isset($arrays[$key])) {
|
||||
return $arrays[$key];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
120
vendor/alibabacloud/credentials/src/Utils/MockTrait.php
vendored
Normal file
120
vendor/alibabacloud/credentials/src/Utils/MockTrait.php
vendored
Normal file
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials\Utils;
|
||||
|
||||
use Exception;
|
||||
use GuzzleHttp\Exception\RequestException;
|
||||
use GuzzleHttp\Handler\MockHandler;
|
||||
use GuzzleHttp\Psr7\Response;
|
||||
use GuzzleHttp\Middleware;
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
/**
|
||||
* Trait MockTrait
|
||||
*
|
||||
* @package AlibabaCloud\Credentials\Utils
|
||||
*/
|
||||
trait MockTrait
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private static $mockQueue = [];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private static $history = [];
|
||||
|
||||
/**
|
||||
* @var MockHandler
|
||||
*/
|
||||
private static $mock;
|
||||
|
||||
/**
|
||||
* @param integer $status
|
||||
* @param array $headers
|
||||
* @param array|string|object $body
|
||||
*/
|
||||
public static function mockResponse($status = 200, array $headers = [], $body = null)
|
||||
{
|
||||
if (is_array($body) || is_object($body)) {
|
||||
$body = json_encode($body);
|
||||
}
|
||||
|
||||
self::$mockQueue[] = new Response($status, $headers, $body);
|
||||
self::createHandlerStack();
|
||||
}
|
||||
|
||||
private static function createHandlerStack()
|
||||
{
|
||||
self::$mock = new MockHandler(self::$mockQueue);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MockHandler
|
||||
*/
|
||||
public static function getHandlerHistory()
|
||||
{
|
||||
return Middleware::history(self::$history);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $message
|
||||
* @param RequestInterface $request
|
||||
* @param ResponseInterface|null $response
|
||||
* @param Exception|null $previous
|
||||
* @param array $handlerContext
|
||||
*/
|
||||
public static function mockRequestException(
|
||||
$message,
|
||||
RequestInterface $request,
|
||||
ResponseInterface $response = null,
|
||||
Exception $previous = null,
|
||||
array $handlerContext = []
|
||||
) {
|
||||
self::$mockQueue[] = new RequestException(
|
||||
$message,
|
||||
$request,
|
||||
$response,
|
||||
$previous,
|
||||
$handlerContext
|
||||
);
|
||||
|
||||
self::createHandlerStack();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public static function cancelMock()
|
||||
{
|
||||
self::$mockQueue = [];
|
||||
self::$mock = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public static function hasMock()
|
||||
{
|
||||
return (bool)self::$mockQueue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MockHandler
|
||||
*/
|
||||
public static function getMock()
|
||||
{
|
||||
return self::$mock;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public static function getHistroy()
|
||||
{
|
||||
return self::$history;
|
||||
}
|
||||
}
|
||||
15
vendor/alibabacloud/darabonba-openapi/.gitignore
vendored
Normal file
15
vendor/alibabacloud/darabonba-openapi/.gitignore
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
composer.phar
|
||||
/vendor/
|
||||
|
||||
# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
|
||||
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
|
||||
composer.lock
|
||||
|
||||
.vscode/
|
||||
.idea
|
||||
.DS_Store
|
||||
|
||||
cache/
|
||||
*.cache
|
||||
runtime/
|
||||
.php_cs.cache
|
||||
65
vendor/alibabacloud/darabonba-openapi/.php_cs.dist
vendored
Normal file
65
vendor/alibabacloud/darabonba-openapi/.php_cs.dist
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/*
|
||||
* This document has been generated with
|
||||
* https://mlocati.github.io/php-cs-fixer-configurator/#version:2.15|configurator
|
||||
* you can change this configuration by importing this file.
|
||||
*/
|
||||
|
||||
return PhpCsFixer\Config::create()
|
||||
->setRiskyAllowed(true)
|
||||
->setIndent(' ')
|
||||
->setRules([
|
||||
'@PSR2' => true,
|
||||
'@PhpCsFixer' => true,
|
||||
'@Symfony:risky' => true,
|
||||
'concat_space' => ['spacing' => 'one'],
|
||||
'array_syntax' => ['syntax' => 'short'],
|
||||
'array_indentation' => true,
|
||||
'combine_consecutive_unsets' => true,
|
||||
'method_separation' => true,
|
||||
'single_quote' => true,
|
||||
'declare_equal_normalize' => true,
|
||||
'function_typehint_space' => true,
|
||||
'hash_to_slash_comment' => true,
|
||||
'include' => true,
|
||||
'lowercase_cast' => true,
|
||||
'no_multiline_whitespace_before_semicolons' => true,
|
||||
'no_leading_import_slash' => true,
|
||||
'no_multiline_whitespace_around_double_arrow' => true,
|
||||
'no_spaces_around_offset' => true,
|
||||
'no_unneeded_control_parentheses' => true,
|
||||
'no_unused_imports' => true,
|
||||
'no_whitespace_before_comma_in_array' => true,
|
||||
'no_whitespace_in_blank_line' => true,
|
||||
'object_operator_without_whitespace' => true,
|
||||
'single_blank_line_before_namespace' => true,
|
||||
'single_class_element_per_statement' => true,
|
||||
'space_after_semicolon' => true,
|
||||
'standardize_not_equals' => true,
|
||||
'ternary_operator_spaces' => true,
|
||||
'trailing_comma_in_multiline_array' => true,
|
||||
'trim_array_spaces' => true,
|
||||
'unary_operator_spaces' => true,
|
||||
'whitespace_after_comma_in_array' => true,
|
||||
'no_extra_consecutive_blank_lines' => [
|
||||
'curly_brace_block',
|
||||
'extra',
|
||||
'parenthesis_brace_block',
|
||||
'square_brace_block',
|
||||
'throw',
|
||||
'use',
|
||||
],
|
||||
'binary_operator_spaces' => [
|
||||
'align_double_arrow' => true,
|
||||
'align_equals' => true,
|
||||
],
|
||||
'braces' => [
|
||||
'allow_single_line_closure' => true,
|
||||
],
|
||||
])
|
||||
->setFinder(
|
||||
PhpCsFixer\Finder::create()
|
||||
->exclude('vendor')
|
||||
->exclude('tests')
|
||||
->in(__DIR__)
|
||||
);
|
||||
31
vendor/alibabacloud/darabonba-openapi/README-CN.md
vendored
Normal file
31
vendor/alibabacloud/darabonba-openapi/README-CN.md
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
[English](README.md) | 简体中文
|
||||
|
||||

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

|
||||
|
||||
## Alibaba Cloud OpenApi Client
|
||||
|
||||
## Installation
|
||||
|
||||
### Composer
|
||||
|
||||
```bash
|
||||
composer require alibabacloud/darabonba-openapi
|
||||
```
|
||||
|
||||
## Issues
|
||||
|
||||
[Opening an Issue](https://github.com/aliyun/darabonba-openapi/issues/new), Issues not conforming to the guidelines may be closed immediately.
|
||||
|
||||
## Changelog
|
||||
|
||||
Detailed changes for each release are documented in the [release notes](./ChangeLog.txt).
|
||||
|
||||
## References
|
||||
|
||||
* [Latest Release](https://github.com/aliyun/darabonba-openapi)
|
||||
|
||||
## License
|
||||
|
||||
[Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
||||
Copyright (c) 2009-present, Alibaba Cloud All rights reserved.
|
||||
15
vendor/alibabacloud/darabonba-openapi/autoload.php
vendored
Normal file
15
vendor/alibabacloud/darabonba-openapi/autoload.php
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
if (file_exists(__DIR__ . \DIRECTORY_SEPARATOR . 'vendor' . \DIRECTORY_SEPARATOR . 'autoload.php')) {
|
||||
require_once __DIR__ . \DIRECTORY_SEPARATOR . 'vendor' . \DIRECTORY_SEPARATOR . 'autoload.php';
|
||||
}
|
||||
|
||||
spl_autoload_register(function ($class) {
|
||||
$name = str_replace('Darabonba\\OpenApi\\', '', $class);
|
||||
$file = __DIR__ . \DIRECTORY_SEPARATOR . 'src' . \DIRECTORY_SEPARATOR . str_replace('\\', \DIRECTORY_SEPARATOR, $name) . '.php';
|
||||
if (file_exists($file)) {
|
||||
require_once $file;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
34
vendor/alibabacloud/darabonba-openapi/composer.json
vendored
Normal file
34
vendor/alibabacloud/darabonba-openapi/composer.json
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "alibabacloud/darabonba-openapi",
|
||||
"description": "Alibaba Cloud OpenApi Client",
|
||||
"type": "library",
|
||||
"license": "Apache-2.0",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Alibaba Cloud SDK",
|
||||
"email": "sdk-team@alibabacloud.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">5.5",
|
||||
"alibabacloud/tea-utils": "^0.2.21",
|
||||
"alibabacloud/credentials": "^1.2.2",
|
||||
"alibabacloud/openapi-util": "^0.1.10|^0.2.1",
|
||||
"alibabacloud/gateway-spi": "^1",
|
||||
"alibabacloud/tea-xml": "^0.2"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Darabonba\\OpenApi\\": "src"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"fixer": "php-cs-fixer fix ./"
|
||||
},
|
||||
"config": {
|
||||
"sort-packages": true,
|
||||
"preferred-install": "dist",
|
||||
"optimize-autoloader": true
|
||||
},
|
||||
"prefer-stable": true
|
||||
}
|
||||
31
vendor/alibabacloud/darabonba-openapi/phpunit.xml
vendored
Normal file
31
vendor/alibabacloud/darabonba-openapi/phpunit.xml
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit bootstrap="./tests/bootstrap.php" colors="true" processIsolation="false" stopOnFailure="false"
|
||||
convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true"
|
||||
testSuiteLoaderFile="phpunit/src/Runner/StandardTestSuiteLoader.php">
|
||||
|
||||
<testsuites>
|
||||
<testsuite name="All">
|
||||
<directory>tests</directory>
|
||||
</testsuite>
|
||||
<testsuite name="Unit">
|
||||
<directory suffix="Test.php">./tests/Unit</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
||||
<groups>
|
||||
<exclude>
|
||||
<group>integration</group>
|
||||
</exclude>
|
||||
</groups>
|
||||
|
||||
<logging>
|
||||
<log type="coverage-html" target="cache/coverage" lowUpperBound="35" highLowerBound="70"/>
|
||||
<log type="coverage-clover" target="cache/coverage.clover"/>
|
||||
</logging>
|
||||
|
||||
<filter>
|
||||
<whitelist processUncoveredFilesFromWhitelist="true">
|
||||
<directory suffix=".php">./src</directory>
|
||||
</whitelist>
|
||||
</filter>
|
||||
</phpunit>
|
||||
463
vendor/alibabacloud/darabonba-openapi/src/Models/Config.php
vendored
Normal file
463
vendor/alibabacloud/darabonba-openapi/src/Models/Config.php
vendored
Normal file
@@ -0,0 +1,463 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
namespace Darabonba\OpenApi\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
use AlibabaCloud\Credentials\Credential;
|
||||
|
||||
use Darabonba\OpenApi\Models\GlobalParameters;
|
||||
|
||||
/**
|
||||
* Model for initing client
|
||||
*/
|
||||
class Config extends Model
|
||||
{
|
||||
protected $_default = [
|
||||
'accessKeyId' => '',
|
||||
'accessKeySecret' => '',
|
||||
'securityToken' => '',
|
||||
'bearerToken' => '',
|
||||
'protocol' => 'http',
|
||||
'method' => '',
|
||||
'regionId' => '',
|
||||
'readTimeout' => '',
|
||||
'connectTimeout' => '',
|
||||
'httpProxy' => '',
|
||||
'httpsProxy' => '',
|
||||
'credential' => '',
|
||||
'endpoint' => '',
|
||||
'noProxy' => '',
|
||||
'maxIdleConns' => '',
|
||||
'network' => '',
|
||||
'userAgent' => '',
|
||||
'suffix' => '',
|
||||
'socks5Proxy' => '',
|
||||
'socks5NetWork' => '',
|
||||
'endpointType' => '',
|
||||
'openPlatformEndpoint' => '',
|
||||
'type' => '',
|
||||
'signatureVersion' => '',
|
||||
'signatureAlgorithm' => '',
|
||||
'key' => '',
|
||||
'cert' => '',
|
||||
'ca' => '',
|
||||
'tlsMinVersion' => '',
|
||||
];
|
||||
public function validate() {}
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->accessKeyId) {
|
||||
$res['accessKeyId'] = $this->accessKeyId;
|
||||
}
|
||||
if (null !== $this->accessKeySecret) {
|
||||
$res['accessKeySecret'] = $this->accessKeySecret;
|
||||
}
|
||||
if (null !== $this->securityToken) {
|
||||
$res['securityToken'] = $this->securityToken;
|
||||
}
|
||||
if (null !== $this->bearerToken) {
|
||||
$res['bearerToken'] = $this->bearerToken;
|
||||
}
|
||||
if (null !== $this->protocol) {
|
||||
$res['protocol'] = $this->protocol;
|
||||
}
|
||||
if (null !== $this->method) {
|
||||
$res['method'] = $this->method;
|
||||
}
|
||||
if (null !== $this->regionId) {
|
||||
$res['regionId'] = $this->regionId;
|
||||
}
|
||||
if (null !== $this->readTimeout) {
|
||||
$res['readTimeout'] = $this->readTimeout;
|
||||
}
|
||||
if (null !== $this->connectTimeout) {
|
||||
$res['connectTimeout'] = $this->connectTimeout;
|
||||
}
|
||||
if (null !== $this->httpProxy) {
|
||||
$res['httpProxy'] = $this->httpProxy;
|
||||
}
|
||||
if (null !== $this->httpsProxy) {
|
||||
$res['httpsProxy'] = $this->httpsProxy;
|
||||
}
|
||||
if (null !== $this->credential) {
|
||||
$res['credential'] = null !== $this->credential ? $this->credential->toMap() : null;
|
||||
}
|
||||
if (null !== $this->endpoint) {
|
||||
$res['endpoint'] = $this->endpoint;
|
||||
}
|
||||
if (null !== $this->noProxy) {
|
||||
$res['noProxy'] = $this->noProxy;
|
||||
}
|
||||
if (null !== $this->maxIdleConns) {
|
||||
$res['maxIdleConns'] = $this->maxIdleConns;
|
||||
}
|
||||
if (null !== $this->network) {
|
||||
$res['network'] = $this->network;
|
||||
}
|
||||
if (null !== $this->userAgent) {
|
||||
$res['userAgent'] = $this->userAgent;
|
||||
}
|
||||
if (null !== $this->suffix) {
|
||||
$res['suffix'] = $this->suffix;
|
||||
}
|
||||
if (null !== $this->socks5Proxy) {
|
||||
$res['socks5Proxy'] = $this->socks5Proxy;
|
||||
}
|
||||
if (null !== $this->socks5NetWork) {
|
||||
$res['socks5NetWork'] = $this->socks5NetWork;
|
||||
}
|
||||
if (null !== $this->endpointType) {
|
||||
$res['endpointType'] = $this->endpointType;
|
||||
}
|
||||
if (null !== $this->openPlatformEndpoint) {
|
||||
$res['openPlatformEndpoint'] = $this->openPlatformEndpoint;
|
||||
}
|
||||
if (null !== $this->type) {
|
||||
$res['type'] = $this->type;
|
||||
}
|
||||
if (null !== $this->signatureVersion) {
|
||||
$res['signatureVersion'] = $this->signatureVersion;
|
||||
}
|
||||
if (null !== $this->signatureAlgorithm) {
|
||||
$res['signatureAlgorithm'] = $this->signatureAlgorithm;
|
||||
}
|
||||
if (null !== $this->globalParameters) {
|
||||
$res['globalParameters'] = null !== $this->globalParameters ? $this->globalParameters->toMap() : null;
|
||||
}
|
||||
if (null !== $this->key) {
|
||||
$res['key'] = $this->key;
|
||||
}
|
||||
if (null !== $this->cert) {
|
||||
$res['cert'] = $this->cert;
|
||||
}
|
||||
if (null !== $this->ca) {
|
||||
$res['ca'] = $this->ca;
|
||||
}
|
||||
if (null !== $this->disableHttp2) {
|
||||
$res['disableHttp2'] = $this->disableHttp2;
|
||||
}
|
||||
if (null !== $this->tlsMinVersion) {
|
||||
$res['tlsMinVersion'] = $this->tlsMinVersion;
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
/**
|
||||
* @param array $map
|
||||
* @return Config
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['accessKeyId'])) {
|
||||
$model->accessKeyId = $map['accessKeyId'];
|
||||
}
|
||||
if (isset($map['accessKeySecret'])) {
|
||||
$model->accessKeySecret = $map['accessKeySecret'];
|
||||
}
|
||||
if (isset($map['securityToken'])) {
|
||||
$model->securityToken = $map['securityToken'];
|
||||
}
|
||||
if (isset($map['bearerToken'])) {
|
||||
$model->bearerToken = $map['bearerToken'];
|
||||
}
|
||||
if (isset($map['protocol'])) {
|
||||
$model->protocol = $map['protocol'];
|
||||
}
|
||||
if (isset($map['method'])) {
|
||||
$model->method = $map['method'];
|
||||
}
|
||||
if (isset($map['regionId'])) {
|
||||
$model->regionId = $map['regionId'];
|
||||
}
|
||||
if (isset($map['readTimeout'])) {
|
||||
$model->readTimeout = $map['readTimeout'];
|
||||
}
|
||||
if (isset($map['connectTimeout'])) {
|
||||
$model->connectTimeout = $map['connectTimeout'];
|
||||
}
|
||||
if (isset($map['httpProxy'])) {
|
||||
$model->httpProxy = $map['httpProxy'];
|
||||
}
|
||||
if (isset($map['httpsProxy'])) {
|
||||
$model->httpsProxy = $map['httpsProxy'];
|
||||
}
|
||||
if (isset($map['credential'])) {
|
||||
$model->credential = Credential::fromMap($map['credential']);
|
||||
}
|
||||
if (isset($map['endpoint'])) {
|
||||
$model->endpoint = $map['endpoint'];
|
||||
}
|
||||
if (isset($map['noProxy'])) {
|
||||
$model->noProxy = $map['noProxy'];
|
||||
}
|
||||
if (isset($map['maxIdleConns'])) {
|
||||
$model->maxIdleConns = $map['maxIdleConns'];
|
||||
}
|
||||
if (isset($map['network'])) {
|
||||
$model->network = $map['network'];
|
||||
}
|
||||
if (isset($map['userAgent'])) {
|
||||
$model->userAgent = $map['userAgent'];
|
||||
}
|
||||
if (isset($map['suffix'])) {
|
||||
$model->suffix = $map['suffix'];
|
||||
}
|
||||
if (isset($map['socks5Proxy'])) {
|
||||
$model->socks5Proxy = $map['socks5Proxy'];
|
||||
}
|
||||
if (isset($map['socks5NetWork'])) {
|
||||
$model->socks5NetWork = $map['socks5NetWork'];
|
||||
}
|
||||
if (isset($map['endpointType'])) {
|
||||
$model->endpointType = $map['endpointType'];
|
||||
}
|
||||
if (isset($map['openPlatformEndpoint'])) {
|
||||
$model->openPlatformEndpoint = $map['openPlatformEndpoint'];
|
||||
}
|
||||
if (isset($map['type'])) {
|
||||
$model->type = $map['type'];
|
||||
}
|
||||
if (isset($map['signatureVersion'])) {
|
||||
$model->signatureVersion = $map['signatureVersion'];
|
||||
}
|
||||
if (isset($map['signatureAlgorithm'])) {
|
||||
$model->signatureAlgorithm = $map['signatureAlgorithm'];
|
||||
}
|
||||
if (isset($map['globalParameters'])) {
|
||||
$model->globalParameters = GlobalParameters::fromMap($map['globalParameters']);
|
||||
}
|
||||
if (isset($map['key'])) {
|
||||
$model->key = $map['key'];
|
||||
}
|
||||
if (isset($map['cert'])) {
|
||||
$model->cert = $map['cert'];
|
||||
}
|
||||
if (isset($map['ca'])) {
|
||||
$model->ca = $map['ca'];
|
||||
}
|
||||
if (isset($map['disableHttp2'])) {
|
||||
$model->disableHttp2 = $map['disableHttp2'];
|
||||
}
|
||||
if (isset($map['tlsMinVersion'])) {
|
||||
$model->tlsMinVersion = $map['tlsMinVersion'];
|
||||
}
|
||||
return $model;
|
||||
}
|
||||
/**
|
||||
* @description accesskey id
|
||||
* @var string
|
||||
*/
|
||||
public $accessKeyId;
|
||||
|
||||
/**
|
||||
* @description accesskey secret
|
||||
* @var string
|
||||
*/
|
||||
public $accessKeySecret;
|
||||
|
||||
/**
|
||||
* @description security token
|
||||
* @example a.txt
|
||||
* @var string
|
||||
*/
|
||||
public $securityToken;
|
||||
|
||||
/**
|
||||
* @description bearer token
|
||||
* @example the-bearer-token
|
||||
* @var string
|
||||
*/
|
||||
public $bearerToken;
|
||||
|
||||
/**
|
||||
* @description http protocol
|
||||
* @example http
|
||||
* @var string
|
||||
*/
|
||||
public $protocol;
|
||||
|
||||
/**
|
||||
* @description http method
|
||||
* @example GET
|
||||
* @var string
|
||||
*/
|
||||
public $method;
|
||||
|
||||
/**
|
||||
* @description region id
|
||||
* @example cn-hangzhou
|
||||
* @var string
|
||||
*/
|
||||
public $regionId;
|
||||
|
||||
/**
|
||||
* @description read timeout
|
||||
* @example 10
|
||||
* @var int
|
||||
*/
|
||||
public $readTimeout;
|
||||
|
||||
/**
|
||||
* @description connect timeout
|
||||
* @example 10
|
||||
* @var int
|
||||
*/
|
||||
public $connectTimeout;
|
||||
|
||||
/**
|
||||
* @description http proxy
|
||||
* @example http://localhost
|
||||
* @var string
|
||||
*/
|
||||
public $httpProxy;
|
||||
|
||||
/**
|
||||
* @description https proxy
|
||||
* @example https://localhost
|
||||
* @var string
|
||||
*/
|
||||
public $httpsProxy;
|
||||
|
||||
/**
|
||||
* @description credential
|
||||
* @example
|
||||
* @var Credential
|
||||
*/
|
||||
public $credential;
|
||||
|
||||
/**
|
||||
* @description endpoint
|
||||
* @example cs.aliyuncs.com
|
||||
* @var string
|
||||
*/
|
||||
public $endpoint;
|
||||
|
||||
/**
|
||||
* @description proxy white list
|
||||
* @example http://localhost
|
||||
* @var string
|
||||
*/
|
||||
public $noProxy;
|
||||
|
||||
/**
|
||||
* @description max idle conns
|
||||
* @example 3
|
||||
* @var int
|
||||
*/
|
||||
public $maxIdleConns;
|
||||
|
||||
/**
|
||||
* @description network for endpoint
|
||||
* @example public
|
||||
* @var string
|
||||
*/
|
||||
public $network;
|
||||
|
||||
/**
|
||||
* @description user agent
|
||||
* @example Alibabacloud/1
|
||||
* @var string
|
||||
*/
|
||||
public $userAgent;
|
||||
|
||||
/**
|
||||
* @description suffix for endpoint
|
||||
* @example aliyun
|
||||
* @var string
|
||||
*/
|
||||
public $suffix;
|
||||
|
||||
/**
|
||||
* @description socks5 proxy
|
||||
* @var string
|
||||
*/
|
||||
public $socks5Proxy;
|
||||
|
||||
/**
|
||||
* @description socks5 network
|
||||
* @example TCP
|
||||
* @var string
|
||||
*/
|
||||
public $socks5NetWork;
|
||||
|
||||
/**
|
||||
* @description endpoint type
|
||||
* @example internal
|
||||
* @var string
|
||||
*/
|
||||
public $endpointType;
|
||||
|
||||
/**
|
||||
* @description OpenPlatform endpoint
|
||||
* @example openplatform.aliyuncs.com
|
||||
* @var string
|
||||
*/
|
||||
public $openPlatformEndpoint;
|
||||
|
||||
/**
|
||||
* @description credential type
|
||||
* @example access_key
|
||||
* @deprecated
|
||||
* @var string
|
||||
*/
|
||||
public $type;
|
||||
|
||||
/**
|
||||
* @description Signature Version
|
||||
* @example v1
|
||||
* @var string
|
||||
*/
|
||||
public $signatureVersion;
|
||||
|
||||
/**
|
||||
* @description Signature Algorithm
|
||||
* @example ACS3-HMAC-SHA256
|
||||
* @var string
|
||||
*/
|
||||
public $signatureAlgorithm;
|
||||
|
||||
/**
|
||||
* @description Global Parameters
|
||||
* @var GlobalParameters
|
||||
*/
|
||||
public $globalParameters;
|
||||
|
||||
/**
|
||||
* @description privite key for client certificate
|
||||
* @example MIIEvQ
|
||||
* @var string
|
||||
*/
|
||||
public $key;
|
||||
|
||||
/**
|
||||
* @description client certificate
|
||||
* @example -----BEGIN CERTIFICATE-----
|
||||
xxx-----END CERTIFICATE-----
|
||||
* @var string
|
||||
*/
|
||||
public $cert;
|
||||
|
||||
/**
|
||||
* @description server certificate
|
||||
* @example -----BEGIN CERTIFICATE-----
|
||||
xxx-----END CERTIFICATE-----
|
||||
* @var string
|
||||
*/
|
||||
public $ca;
|
||||
|
||||
/**
|
||||
* @description disable HTTP/2
|
||||
* @example false
|
||||
* @var bool
|
||||
*/
|
||||
public $disableHttp2;
|
||||
|
||||
/**
|
||||
* @description TLS Minimum Version
|
||||
* @example TLSv1, TLSv1.1, TLSv1.2, TLSv1.3
|
||||
* @var string
|
||||
*/
|
||||
public $tlsMinVersion;
|
||||
}
|
||||
40
vendor/alibabacloud/darabonba-openapi/src/Models/GlobalParameters.php
vendored
Normal file
40
vendor/alibabacloud/darabonba-openapi/src/Models/GlobalParameters.php
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
namespace Darabonba\OpenApi\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class GlobalParameters extends Model
|
||||
{
|
||||
public function validate() {}
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->headers) {
|
||||
$res['headers'] = $this->headers;
|
||||
}
|
||||
if (null !== $this->queries) {
|
||||
$res['queries'] = $this->queries;
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
/**
|
||||
* @param array $map
|
||||
* @return GlobalParameters
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['headers'])) {
|
||||
$model->headers = $map['headers'];
|
||||
}
|
||||
if (isset($map['queries'])) {
|
||||
$model->queries = $map['queries'];
|
||||
}
|
||||
return $model;
|
||||
}
|
||||
public $headers;
|
||||
|
||||
public $queries;
|
||||
}
|
||||
72
vendor/alibabacloud/darabonba-openapi/src/Models/OpenApiRequest.php
vendored
Normal file
72
vendor/alibabacloud/darabonba-openapi/src/Models/OpenApiRequest.php
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
namespace Darabonba\OpenApi\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class OpenApiRequest extends Model
|
||||
{
|
||||
public function validate() {}
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->headers) {
|
||||
$res['headers'] = $this->headers;
|
||||
}
|
||||
if (null !== $this->query) {
|
||||
$res['query'] = $this->query;
|
||||
}
|
||||
if (null !== $this->body) {
|
||||
$res['body'] = $this->body;
|
||||
}
|
||||
if (null !== $this->stream) {
|
||||
$res['stream'] = $this->stream;
|
||||
}
|
||||
if (null !== $this->hostMap) {
|
||||
$res['hostMap'] = $this->hostMap;
|
||||
}
|
||||
if (null !== $this->endpointOverride) {
|
||||
$res['endpointOverride'] = $this->endpointOverride;
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
/**
|
||||
* @param array $map
|
||||
* @return OpenApiRequest
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['headers'])) {
|
||||
$model->headers = $map['headers'];
|
||||
}
|
||||
if (isset($map['query'])) {
|
||||
$model->query = $map['query'];
|
||||
}
|
||||
if (isset($map['body'])) {
|
||||
$model->body = $map['body'];
|
||||
}
|
||||
if (isset($map['stream'])) {
|
||||
$model->stream = $map['stream'];
|
||||
}
|
||||
if (isset($map['hostMap'])) {
|
||||
$model->hostMap = $map['hostMap'];
|
||||
}
|
||||
if (isset($map['endpointOverride'])) {
|
||||
$model->endpointOverride = $map['endpointOverride'];
|
||||
}
|
||||
return $model;
|
||||
}
|
||||
public $headers;
|
||||
|
||||
public $query;
|
||||
|
||||
public $body;
|
||||
|
||||
public $stream;
|
||||
|
||||
public $hostMap;
|
||||
|
||||
public $endpointOverride;
|
||||
}
|
||||
130
vendor/alibabacloud/darabonba-openapi/src/Models/Params.php
vendored
Normal file
130
vendor/alibabacloud/darabonba-openapi/src/Models/Params.php
vendored
Normal file
@@ -0,0 +1,130 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
namespace Darabonba\OpenApi\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class Params extends Model
|
||||
{
|
||||
public function validate()
|
||||
{
|
||||
Model::validateRequired('action', $this->action, true);
|
||||
Model::validateRequired('version', $this->version, true);
|
||||
Model::validateRequired('protocol', $this->protocol, true);
|
||||
Model::validateRequired('pathname', $this->pathname, true);
|
||||
Model::validateRequired('method', $this->method, true);
|
||||
Model::validateRequired('authType', $this->authType, true);
|
||||
Model::validateRequired('bodyType', $this->bodyType, true);
|
||||
Model::validateRequired('reqBodyType', $this->reqBodyType, true);
|
||||
}
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->action) {
|
||||
$res['action'] = $this->action;
|
||||
}
|
||||
if (null !== $this->version) {
|
||||
$res['version'] = $this->version;
|
||||
}
|
||||
if (null !== $this->protocol) {
|
||||
$res['protocol'] = $this->protocol;
|
||||
}
|
||||
if (null !== $this->pathname) {
|
||||
$res['pathname'] = $this->pathname;
|
||||
}
|
||||
if (null !== $this->method) {
|
||||
$res['method'] = $this->method;
|
||||
}
|
||||
if (null !== $this->authType) {
|
||||
$res['authType'] = $this->authType;
|
||||
}
|
||||
if (null !== $this->bodyType) {
|
||||
$res['bodyType'] = $this->bodyType;
|
||||
}
|
||||
if (null !== $this->reqBodyType) {
|
||||
$res['reqBodyType'] = $this->reqBodyType;
|
||||
}
|
||||
if (null !== $this->style) {
|
||||
$res['style'] = $this->style;
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
/**
|
||||
* @param array $map
|
||||
* @return Params
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['action'])) {
|
||||
$model->action = $map['action'];
|
||||
}
|
||||
if (isset($map['version'])) {
|
||||
$model->version = $map['version'];
|
||||
}
|
||||
if (isset($map['protocol'])) {
|
||||
$model->protocol = $map['protocol'];
|
||||
}
|
||||
if (isset($map['pathname'])) {
|
||||
$model->pathname = $map['pathname'];
|
||||
}
|
||||
if (isset($map['method'])) {
|
||||
$model->method = $map['method'];
|
||||
}
|
||||
if (isset($map['authType'])) {
|
||||
$model->authType = $map['authType'];
|
||||
}
|
||||
if (isset($map['bodyType'])) {
|
||||
$model->bodyType = $map['bodyType'];
|
||||
}
|
||||
if (isset($map['reqBodyType'])) {
|
||||
$model->reqBodyType = $map['reqBodyType'];
|
||||
}
|
||||
if (isset($map['style'])) {
|
||||
$model->style = $map['style'];
|
||||
}
|
||||
return $model;
|
||||
}
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $action;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $version;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $protocol;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $pathname;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $method;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $authType;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $bodyType;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $reqBodyType;
|
||||
|
||||
public $style;
|
||||
}
|
||||
1345
vendor/alibabacloud/darabonba-openapi/src/OpenApiClient.php
vendored
Normal file
1345
vendor/alibabacloud/darabonba-openapi/src/OpenApiClient.php
vendored
Normal file
File diff suppressed because it is too large
Load Diff
329
vendor/alibabacloud/darabonba-openapi/tests/OpenApiClientTest.php
vendored
Normal file
329
vendor/alibabacloud/darabonba-openapi/tests/OpenApiClientTest.php
vendored
Normal file
@@ -0,0 +1,329 @@
|
||||
<?php
|
||||
|
||||
namespace Darabonba\OpenApi\Tests;
|
||||
|
||||
use Darabonba\OpenApi\OpenApiClient;
|
||||
use AlibabaCloud\Tea\Model;
|
||||
use AlibabaCloud\Tea\Request;
|
||||
use AlibabaCloud\Tea\Utils\Utils;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
class OpenApiClientTest extends TestCase
|
||||
{
|
||||
public function testConfig(){
|
||||
$globalParameters = new GlobalParameters([
|
||||
"headers" => [
|
||||
"global-key" => "global-value"
|
||||
],
|
||||
"queries" => [
|
||||
"global-query" => "global-value"
|
||||
]
|
||||
]);
|
||||
$config = new Config([
|
||||
"endpoint" => "config.endpoint",
|
||||
"endpointType" => "regional",
|
||||
"network" => "config.network",
|
||||
"suffix" => "config.suffix",
|
||||
"protocol" => "config.protocol",
|
||||
"method" => "config.method",
|
||||
"regionId" => "config.regionId",
|
||||
"userAgent" => "config.userAgent",
|
||||
"readTimeout" => 3000,
|
||||
"connectTimeout" => 3000,
|
||||
"httpProxy" => "config.httpProxy",
|
||||
"httpsProxy" => "config.httpsProxy",
|
||||
"noProxy" => "config.noProxy",
|
||||
"socks5Proxy" => "config.socks5Proxy",
|
||||
"socks5NetWork" => "config.socks5NetWork",
|
||||
"maxIdleConns" => 128,
|
||||
"signatureVersion" => "config.signatureVersion",
|
||||
"signatureAlgorithm" => "config.signatureAlgorithm",
|
||||
"globalParameters" => $globalParameters
|
||||
]);
|
||||
$creConfig = new \AlibabaCloud\Credentials\Credential\Config([
|
||||
"accessKeyId" => "accessKeyId",
|
||||
"accessKeySecret" => "accessKeySecret",
|
||||
"securityToken" => "securityToken",
|
||||
"type" => "sts"
|
||||
]);
|
||||
$credential = new Credential($creConfig);
|
||||
$config->credential = $credential;
|
||||
$client = new OpenApiClient($config);
|
||||
$config->accessKeyId = "ak";
|
||||
$config->accessKeySecret = "secret";
|
||||
$config->securityToken = "token";
|
||||
$config->type = "sts";
|
||||
$client = new OpenApiClient($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Config
|
||||
*/
|
||||
public static function createConfig(){
|
||||
$globalParameters = new GlobalParameters([
|
||||
"headers" => [
|
||||
"global-key" => "global-value"
|
||||
],
|
||||
"queries" => [
|
||||
"global-query" => "global-value"
|
||||
]
|
||||
]);
|
||||
$config = new Config([
|
||||
"accessKeyId" => "ak",
|
||||
"accessKeySecret" => "secret",
|
||||
"securityToken" => "token",
|
||||
"type" => "sts",
|
||||
"userAgent" => "config.userAgent",
|
||||
"readTimeout" => 3000,
|
||||
"connectTimeout" => 3000,
|
||||
"maxIdleConns" => 128,
|
||||
"signatureVersion" => "config.signatureVersion",
|
||||
"signatureAlgorithm" => "ACS3-HMAC-SHA256",
|
||||
"globalParameters" => $globalParameters,
|
||||
"tlsMinVersion" => "TLSv1.2"
|
||||
]);
|
||||
return $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return RuntimeOptions
|
||||
*/
|
||||
public static function createRuntimeOptions(){
|
||||
$runtime = new RuntimeOptions([
|
||||
"readTimeout" => 4000,
|
||||
"connectTimeout" => 4000,
|
||||
"maxIdleConns" => 100,
|
||||
"autoretry" => true,
|
||||
"maxAttempts" => 1,
|
||||
"backoffPolicy" => "no",
|
||||
"backoffPeriod" => 1,
|
||||
"ignoreSSL" => true
|
||||
]);
|
||||
return $runtime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return OpenApiRequest
|
||||
*/
|
||||
public static function createOpenApiRequest(){
|
||||
$query = [];
|
||||
$query["key1"] = "value";
|
||||
$query["key2"] = 1;
|
||||
$query["key3"] = true;
|
||||
$body = [];
|
||||
$body["key1"] = "value";
|
||||
$body["key2"] = 1;
|
||||
$body["key3"] = true;
|
||||
$headers = [
|
||||
"for-test" => "sdk"
|
||||
];
|
||||
$req = new OpenApiRequest([
|
||||
"headers" => $headers,
|
||||
"query" => OpenApiUtilClient::query($query),
|
||||
"body" => OpenApiUtilClient::parseToMap($body)
|
||||
]);
|
||||
return $req;
|
||||
}
|
||||
|
||||
public function testCallApiForRPCWithV2Sign_AK_Form(){
|
||||
$config = self::createConfig();
|
||||
$runtime = self::createRuntimeOptions();
|
||||
$config->protocol = "HTTP";
|
||||
$config->signatureAlgorithm = "v2";
|
||||
$config->endpoint = "test.aliyuncs.com";
|
||||
$client = new OpenApiClient($config);
|
||||
$request = self::createOpenApiRequest();
|
||||
$params = new Params([
|
||||
"action" => "TestAPI",
|
||||
"version" => "2022-06-01",
|
||||
"protocol" => "HTTPS",
|
||||
"pathname" => "/",
|
||||
"method" => "POST",
|
||||
"authType" => "AK",
|
||||
"style" => "RPC",
|
||||
"reqBodyType" => "formData",
|
||||
"bodyType" => "json"
|
||||
]);
|
||||
$client->callApi($params, $request, $runtime);
|
||||
}
|
||||
|
||||
public function testCallApiForRPCWithV2Sign_Anonymous_JSON(){
|
||||
$config = self::createConfig();
|
||||
$runtime = self::createRuntimeOptions();
|
||||
$config->protocol = "HTTP";
|
||||
$config->signatureAlgorithm = "v2";
|
||||
$config->endpoint = "test.aliyuncs.com";
|
||||
$client = new OpenApiClient($config);
|
||||
$request = self::createOpenApiRequest();
|
||||
$params = new Params([
|
||||
"action" => "TestAPI",
|
||||
"version" => "2022-06-01",
|
||||
"protocol" => "HTTPS",
|
||||
"pathname" => "/",
|
||||
"method" => "POST",
|
||||
"authType" => "Anonymous",
|
||||
"style" => "RPC",
|
||||
"reqBodyType" => "json",
|
||||
"bodyType" => "json"
|
||||
]);
|
||||
$client->callApi($params, $request, $runtime);
|
||||
}
|
||||
|
||||
public function testCallApiForROAWithV2Sign_HTTPS_AK_Form(){
|
||||
$config = self::createConfig();
|
||||
$runtime = self::createRuntimeOptions();
|
||||
$config->signatureAlgorithm = "v2";
|
||||
$config->endpoint = "test.aliyuncs.com";
|
||||
$client = new OpenApiClient($config);
|
||||
$request = self::createOpenApiRequest();
|
||||
$params = new Params([
|
||||
"action" => "TestAPI",
|
||||
"version" => "2022-06-01",
|
||||
"protocol" => "HTTPS",
|
||||
"pathname" => "/test",
|
||||
"method" => "POST",
|
||||
"authType" => "AK",
|
||||
"style" => "ROA",
|
||||
"reqBodyType" => "formData",
|
||||
"bodyType" => "json"
|
||||
]);
|
||||
$client->callApi($params, $request, $runtime);
|
||||
}
|
||||
|
||||
public function testCallApiForROAWithV2Sign_Anonymous_JSON(){
|
||||
$config = self::createConfig();
|
||||
$runtime = self::createRuntimeOptions();
|
||||
$config->protocol = "HTTP";
|
||||
$config->signatureAlgorithm = "v2";
|
||||
$config->endpoint = "test.aliyuncs.com";
|
||||
$client = new OpenApiClient($config);
|
||||
$request = self::createOpenApiRequest();
|
||||
$params = new Params([
|
||||
"action" => "TestAPI",
|
||||
"version" => "2022-06-01",
|
||||
"protocol" => "HTTPS",
|
||||
"pathname" => "/test",
|
||||
"method" => "POST",
|
||||
"authType" => "Anonymous",
|
||||
"style" => "ROA",
|
||||
"reqBodyType" => "json",
|
||||
"bodyType" => "json"
|
||||
]);
|
||||
$client->callApi($params, $request, $runtime);
|
||||
}
|
||||
|
||||
public function testCallApiForRPCWithV3Sign_AK_Form(){
|
||||
$config = self::createConfig();
|
||||
$runtime = self::createRuntimeOptions();
|
||||
$config->protocol = "HTTP";
|
||||
$config->endpoint = "test.aliyuncs.com";
|
||||
$client = new OpenApiClient($config);
|
||||
$request = self::createOpenApiRequest();
|
||||
$params = new Params([
|
||||
"action" => "TestAPI",
|
||||
"version" => "2022-06-01",
|
||||
"protocol" => "HTTPS",
|
||||
"pathname" => "/",
|
||||
"method" => "POST",
|
||||
"authType" => "AK",
|
||||
"style" => "RPC",
|
||||
"reqBodyType" => "formData",
|
||||
"bodyType" => "json"
|
||||
]);
|
||||
$client->callApi($params, $request, $runtime);
|
||||
}
|
||||
|
||||
public function testCallApiForRPCWithV3Sign_Anonymous_JSON(){
|
||||
$config = self::createConfig();
|
||||
$runtime = self::createRuntimeOptions();
|
||||
$config->protocol = "HTTP";
|
||||
$config->endpoint = "test.aliyuncs.com";
|
||||
$client = new OpenApiClient($config);
|
||||
$request = self::createOpenApiRequest();
|
||||
$params = new Params([
|
||||
"action" => "TestAPI",
|
||||
"version" => "2022-06-01",
|
||||
"protocol" => "HTTPS",
|
||||
"pathname" => "/",
|
||||
"method" => "POST",
|
||||
"authType" => "Anonymous",
|
||||
"style" => "RPC",
|
||||
"reqBodyType" => "json",
|
||||
"bodyType" => "json"
|
||||
]);
|
||||
$client->callApi($params, $request, $runtime);
|
||||
}
|
||||
|
||||
public function testCallApiForROAWithV3Sign_AK_Form(){
|
||||
$config = self::createConfig();
|
||||
$runtime = self::createRuntimeOptions();
|
||||
$config->protocol = "HTTP";
|
||||
$config->endpoint = "test.aliyuncs.com";
|
||||
$client = new OpenApiClient($config);
|
||||
$request = self::createOpenApiRequest();
|
||||
$params = new Params([
|
||||
"action" => "TestAPI",
|
||||
"version" => "2022-06-01",
|
||||
"protocol" => "HTTPS",
|
||||
"pathname" => "/test",
|
||||
"method" => "POST",
|
||||
"authType" => "AK",
|
||||
"style" => "ROA",
|
||||
"reqBodyType" => "formData",
|
||||
"bodyType" => "json"
|
||||
]);
|
||||
$client->callApi($params, $request, $runtime);
|
||||
}
|
||||
|
||||
public function testCallApiForROAWithV3Sign_Anonymous_JSON(){
|
||||
$config = self::createConfig();
|
||||
$runtime = self::createRuntimeOptions();
|
||||
$config->protocol = "HTTP";
|
||||
$config->endpoint = "test.aliyuncs.com";
|
||||
$client = new OpenApiClient($config);
|
||||
$request = self::createOpenApiRequest();
|
||||
$params = new Params([
|
||||
"action" => "TestAPI",
|
||||
"version" => "2022-06-01",
|
||||
"protocol" => "HTTPS",
|
||||
"pathname" => "/test",
|
||||
"method" => "POST",
|
||||
"authType" => "Anonymous",
|
||||
"style" => "ROA",
|
||||
"reqBodyType" => "json",
|
||||
"bodyType" => "json"
|
||||
]);
|
||||
$client->callApi($params, $request, $runtime);
|
||||
}
|
||||
|
||||
public function testResponseBodyType(){
|
||||
$config = self::createConfig();
|
||||
$runtime = self::createRuntimeOptions();
|
||||
$config->protocol = "HTTP";
|
||||
$config->endpoint = "test.aliyuncs.com";
|
||||
$client = new OpenApiClient($config);
|
||||
$request = self::createOpenApiRequest();
|
||||
$params = new Params([
|
||||
"action" => "TestAPI",
|
||||
"version" => "2022-06-01",
|
||||
"protocol" => "HTTPS",
|
||||
"pathname" => "/test",
|
||||
"method" => "POST",
|
||||
"authType" => "AK",
|
||||
"style" => "ROA",
|
||||
"reqBodyType" => "formData",
|
||||
"bodyType" => "json"
|
||||
]);
|
||||
$client->callApi($params, $request, $runtime);
|
||||
$params->bodyType = "array";
|
||||
$client->callApi($params, $request, $runtime);
|
||||
$params->bodyType = "string";
|
||||
$client->callApi($params, $request, $runtime);
|
||||
$params->bodyType = "byte";
|
||||
$client->callApi($params, $request, $runtime);
|
||||
}
|
||||
}
|
||||
3
vendor/alibabacloud/darabonba-openapi/tests/bootstrap.php
vendored
Normal file
3
vendor/alibabacloud/darabonba-openapi/tests/bootstrap.php
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
|
||||
require dirname(__DIR__) . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
|
||||
15
vendor/alibabacloud/dypnsapi-20170525/.gitignore
vendored
Normal file
15
vendor/alibabacloud/dypnsapi-20170525/.gitignore
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
composer.phar
|
||||
/vendor/
|
||||
|
||||
# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
|
||||
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
|
||||
composer.lock
|
||||
|
||||
.vscode/
|
||||
.idea
|
||||
.DS_Store
|
||||
|
||||
cache/
|
||||
*.cache
|
||||
runtime/
|
||||
.php_cs.cache
|
||||
65
vendor/alibabacloud/dypnsapi-20170525/.php_cs.dist
vendored
Normal file
65
vendor/alibabacloud/dypnsapi-20170525/.php_cs.dist
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/*
|
||||
* This document has been generated with
|
||||
* https://mlocati.github.io/php-cs-fixer-configurator/#version:2.15|configurator
|
||||
* you can change this configuration by importing this file.
|
||||
*/
|
||||
|
||||
return PhpCsFixer\Config::create()
|
||||
->setRiskyAllowed(true)
|
||||
->setIndent(' ')
|
||||
->setRules([
|
||||
'@PSR2' => true,
|
||||
'@PhpCsFixer' => true,
|
||||
'@Symfony:risky' => true,
|
||||
'concat_space' => ['spacing' => 'one'],
|
||||
'array_syntax' => ['syntax' => 'short'],
|
||||
'array_indentation' => true,
|
||||
'combine_consecutive_unsets' => true,
|
||||
'method_separation' => true,
|
||||
'single_quote' => true,
|
||||
'declare_equal_normalize' => true,
|
||||
'function_typehint_space' => true,
|
||||
'hash_to_slash_comment' => true,
|
||||
'include' => true,
|
||||
'lowercase_cast' => true,
|
||||
'no_multiline_whitespace_before_semicolons' => true,
|
||||
'no_leading_import_slash' => true,
|
||||
'no_multiline_whitespace_around_double_arrow' => true,
|
||||
'no_spaces_around_offset' => true,
|
||||
'no_unneeded_control_parentheses' => true,
|
||||
'no_unused_imports' => true,
|
||||
'no_whitespace_before_comma_in_array' => true,
|
||||
'no_whitespace_in_blank_line' => true,
|
||||
'object_operator_without_whitespace' => true,
|
||||
'single_blank_line_before_namespace' => true,
|
||||
'single_class_element_per_statement' => true,
|
||||
'space_after_semicolon' => true,
|
||||
'standardize_not_equals' => true,
|
||||
'ternary_operator_spaces' => true,
|
||||
'trailing_comma_in_multiline_array' => true,
|
||||
'trim_array_spaces' => true,
|
||||
'unary_operator_spaces' => true,
|
||||
'whitespace_after_comma_in_array' => true,
|
||||
'no_extra_consecutive_blank_lines' => [
|
||||
'curly_brace_block',
|
||||
'extra',
|
||||
'parenthesis_brace_block',
|
||||
'square_brace_block',
|
||||
'throw',
|
||||
'use',
|
||||
],
|
||||
'binary_operator_spaces' => [
|
||||
'align_double_arrow' => true,
|
||||
'align_equals' => true,
|
||||
],
|
||||
'braces' => [
|
||||
'allow_single_line_closure' => true,
|
||||
],
|
||||
])
|
||||
->setFinder(
|
||||
PhpCsFixer\Finder::create()
|
||||
->exclude('vendor')
|
||||
->exclude('tests')
|
||||
->in(__DIR__)
|
||||
);
|
||||
59
vendor/alibabacloud/dypnsapi-20170525/ChangeLog.md
vendored
Normal file
59
vendor/alibabacloud/dypnsapi-20170525/ChangeLog.md
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
2024-10-24 Version: 1.1.3
|
||||
- Update API CreateVerifyScheme: add param HmAppIdentifier.
|
||||
- Update API CreateVerifyScheme: add param HmPackageName.
|
||||
- Update API CreateVerifyScheme: add param HmSignName.
|
||||
- Update API GetAuthToken: add param BizType.
|
||||
- Update API GetAuthToken: add param CmApiCode.
|
||||
- Update API GetAuthToken: add param CtApiCode.
|
||||
- Update API GetAuthToken: add param CuApiCode.
|
||||
- Update API GetAuthToken: add param Version.
|
||||
|
||||
|
||||
2024-10-18 Version: 1.1.3
|
||||
- Update API CreateVerifyScheme: add param HmAppIdentifier.
|
||||
- Update API CreateVerifyScheme: add param HmPackageName.
|
||||
- Update API CreateVerifyScheme: add param HmSignName.
|
||||
|
||||
|
||||
2024-01-04 Version: 1.1.2
|
||||
- Generated php 2017-05-25 for Dypnsapi.
|
||||
|
||||
2023-12-29 Version: 1.2.0
|
||||
- Generated php 2017-05-25 for Dypnsapi.
|
||||
|
||||
2023-09-21 Version: 1.1.0
|
||||
- Generated php 2017-05-25 for Dypnsapi.
|
||||
|
||||
2023-04-14 Version: 1.0.10
|
||||
- Supported Fusion Auth.
|
||||
|
||||
2022-12-27 Version: 1.0.9
|
||||
- Support Sms Verification for Dypnsapi.
|
||||
|
||||
2022-11-30 Version: 1.0.8
|
||||
- Support Sms Verification for Dypnsapi.
|
||||
|
||||
2022-02-08 Version: 1.0.7
|
||||
- Supported New Features.
|
||||
|
||||
2022-01-19 Version: 1.0.6
|
||||
- Supported New Features.
|
||||
|
||||
2022-01-13 Version: 1.0.5
|
||||
- Supported New Features.
|
||||
|
||||
2022-01-07 Version: 1.0.4
|
||||
- Supported New Features.
|
||||
|
||||
2021-09-22 Version: 1.0.3
|
||||
- Support Sms Verification for Dypnsapi.
|
||||
|
||||
2021-09-22 Version: 1.0.2
|
||||
- Support Sms Verification for Dypnsapi.
|
||||
|
||||
2021-03-17 Version: 1.0.1
|
||||
- Generated php 2017-05-25 for Dypnsapi.
|
||||
|
||||
2020-12-30 Version: 1.0.0
|
||||
- AMP Version Change.
|
||||
|
||||
201
vendor/alibabacloud/dypnsapi-20170525/LICENSE
vendored
Normal file
201
vendor/alibabacloud/dypnsapi-20170525/LICENSE
vendored
Normal 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 (c) 2009-present, Alibaba Cloud All rights reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
35
vendor/alibabacloud/dypnsapi-20170525/README-CN.md
vendored
Normal file
35
vendor/alibabacloud/dypnsapi-20170525/README-CN.md
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
[English](README.md) | 简体中文
|
||||
|
||||

|
||||
|
||||
# Alibaba Cloud Dypnsapi SDK for PHP
|
||||
|
||||
## 安装
|
||||
|
||||
### Composer
|
||||
|
||||
```bash
|
||||
composer require alibabacloud/dypnsapi-20170525
|
||||
```
|
||||
|
||||
## 问题
|
||||
|
||||
[提交 Issue](https://github.com/aliyun/alibabacloud-php-sdk/issues/new),不符合指南的问题可能会立即关闭。
|
||||
|
||||
## 使用说明
|
||||
|
||||
[快速使用](https://github.com/aliyun/alibabacloud-php-sdk/blob/master/docs/0-Examples-CN.md#%E5%BF%AB%E9%80%9F%E4%BD%BF%E7%94%A8)
|
||||
|
||||
## 发行说明
|
||||
|
||||
每个版本的详细更改记录在[发行说明](./ChangeLog.txt)中。
|
||||
|
||||
## 相关
|
||||
|
||||
* [最新源码](https://github.com/aliyun/alibabacloud-php-sdk/)
|
||||
|
||||
## 许可证
|
||||
|
||||
[Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
||||
Copyright (c) 2009-present, Alibaba Cloud All rights reserved.
|
||||
35
vendor/alibabacloud/dypnsapi-20170525/README.md
vendored
Normal file
35
vendor/alibabacloud/dypnsapi-20170525/README.md
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
English | [简体中文](README-CN.md)
|
||||
|
||||

|
||||
|
||||
# Alibaba Cloud Dypnsapi SDK for PHP
|
||||
|
||||
## Installation
|
||||
|
||||
### Composer
|
||||
|
||||
```bash
|
||||
composer require alibabacloud/dypnsapi-20170525
|
||||
```
|
||||
|
||||
## Issues
|
||||
|
||||
[Opening an Issue](https://github.com/aliyun/alibabacloud-php-sdk/issues/new), Issues not conforming to the guidelines may be closed immediately.
|
||||
|
||||
## Usage
|
||||
|
||||
[Quick Examples](https://github.com/aliyun/alibabacloud-php-sdk/blob/master/docs/0-Examples-EN.md#quick-examples)
|
||||
|
||||
## Changelog
|
||||
|
||||
Detailed changes for each release are documented in the [release notes](./ChangeLog.txt).
|
||||
|
||||
## References
|
||||
|
||||
* [Latest Release](https://github.com/aliyun/alibabacloud-php-sdk/)
|
||||
|
||||
## License
|
||||
|
||||
[Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
||||
Copyright (c) 2009-present, Alibaba Cloud All rights reserved.
|
||||
17
vendor/alibabacloud/dypnsapi-20170525/autoload.php
vendored
Normal file
17
vendor/alibabacloud/dypnsapi-20170525/autoload.php
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
if (file_exists(__DIR__ . \DIRECTORY_SEPARATOR . 'vendor' . \DIRECTORY_SEPARATOR . 'autoload.php')) {
|
||||
require_once __DIR__ . \DIRECTORY_SEPARATOR . 'vendor' . \DIRECTORY_SEPARATOR . 'autoload.php';
|
||||
}
|
||||
|
||||
spl_autoload_register(function ($class) {
|
||||
$name = str_replace('AlibabaCloud\\SDK\\Dypnsapi\\V20170525\\', '', $class);
|
||||
$file = __DIR__ . \DIRECTORY_SEPARATOR . 'src' . \DIRECTORY_SEPARATOR . str_replace('\\', \DIRECTORY_SEPARATOR, $name) . '.php';
|
||||
if (file_exists($file)) {
|
||||
require_once $file;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
33
vendor/alibabacloud/dypnsapi-20170525/composer.json
vendored
Normal file
33
vendor/alibabacloud/dypnsapi-20170525/composer.json
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "alibabacloud/dypnsapi-20170525",
|
||||
"description": "Alibaba Cloud Dypnsapi (20170525) SDK Library for PHP",
|
||||
"type": "library",
|
||||
"license": "Apache-2.0",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Alibaba Cloud SDK",
|
||||
"email": "sdk-team@alibabacloud.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">5.5",
|
||||
"alibabacloud/tea-utils": "^0.2.21",
|
||||
"alibabacloud/darabonba-openapi": "^0.2.13",
|
||||
"alibabacloud/openapi-util": "^0.1.10|^0.2.1",
|
||||
"alibabacloud/endpoint-util": "^0.1.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"AlibabaCloud\\SDK\\Dypnsapi\\V20170525\\": "src"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"fixer": "php-cs-fixer fix ./"
|
||||
},
|
||||
"config": {
|
||||
"sort-packages": true,
|
||||
"preferred-install": "dist",
|
||||
"optimize-autoloader": true
|
||||
},
|
||||
"prefer-stable": true
|
||||
}
|
||||
1658
vendor/alibabacloud/dypnsapi-20170525/src/Dypnsapi.php
vendored
Normal file
1658
vendor/alibabacloud/dypnsapi-20170525/src/Dypnsapi.php
vendored
Normal file
File diff suppressed because it is too large
Load Diff
172
vendor/alibabacloud/dypnsapi-20170525/src/Models/CheckSmsVerifyCodeRequest.php
vendored
Normal file
172
vendor/alibabacloud/dypnsapi-20170525/src/Models/CheckSmsVerifyCodeRequest.php
vendored
Normal file
@@ -0,0 +1,172 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dypnsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class CheckSmsVerifyCodeRequest extends Model
|
||||
{
|
||||
/**
|
||||
* @description The verification policy for uppercase and lowercase letters of the verification code. Valid values:
|
||||
*
|
||||
* 1: The verification policy does not distinguish uppercase and lowercase letters.
|
||||
* 2: The verification policy distinguishes uppercase and lowercase letters.
|
||||
*
|
||||
* @example 1
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $caseAuthPolicy;
|
||||
|
||||
/**
|
||||
* @description The country code of the phone number. Default value: 86.
|
||||
*
|
||||
* @example 86
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $countryCode;
|
||||
|
||||
/**
|
||||
* @description The external ID.
|
||||
*
|
||||
* @example 12123231
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $outId;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $ownerId;
|
||||
|
||||
/**
|
||||
* @description The phone number.
|
||||
*
|
||||
* This parameter is required.
|
||||
* @example 18653529399
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $phoneNumber;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $resourceOwnerAccount;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $resourceOwnerId;
|
||||
|
||||
/**
|
||||
* @description The verification service name. If this parameter is not specified, the default service is used. The name can be up to 20 characters in length.
|
||||
*
|
||||
* @example Aliyun
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $schemeName;
|
||||
|
||||
/**
|
||||
* @description The verification code.
|
||||
*
|
||||
* This parameter is required.
|
||||
* @example 1231
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $verifyCode;
|
||||
protected $_name = [
|
||||
'caseAuthPolicy' => 'CaseAuthPolicy',
|
||||
'countryCode' => 'CountryCode',
|
||||
'outId' => 'OutId',
|
||||
'ownerId' => 'OwnerId',
|
||||
'phoneNumber' => 'PhoneNumber',
|
||||
'resourceOwnerAccount' => 'ResourceOwnerAccount',
|
||||
'resourceOwnerId' => 'ResourceOwnerId',
|
||||
'schemeName' => 'SchemeName',
|
||||
'verifyCode' => 'VerifyCode',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->caseAuthPolicy) {
|
||||
$res['CaseAuthPolicy'] = $this->caseAuthPolicy;
|
||||
}
|
||||
if (null !== $this->countryCode) {
|
||||
$res['CountryCode'] = $this->countryCode;
|
||||
}
|
||||
if (null !== $this->outId) {
|
||||
$res['OutId'] = $this->outId;
|
||||
}
|
||||
if (null !== $this->ownerId) {
|
||||
$res['OwnerId'] = $this->ownerId;
|
||||
}
|
||||
if (null !== $this->phoneNumber) {
|
||||
$res['PhoneNumber'] = $this->phoneNumber;
|
||||
}
|
||||
if (null !== $this->resourceOwnerAccount) {
|
||||
$res['ResourceOwnerAccount'] = $this->resourceOwnerAccount;
|
||||
}
|
||||
if (null !== $this->resourceOwnerId) {
|
||||
$res['ResourceOwnerId'] = $this->resourceOwnerId;
|
||||
}
|
||||
if (null !== $this->schemeName) {
|
||||
$res['SchemeName'] = $this->schemeName;
|
||||
}
|
||||
if (null !== $this->verifyCode) {
|
||||
$res['VerifyCode'] = $this->verifyCode;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return CheckSmsVerifyCodeRequest
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['CaseAuthPolicy'])) {
|
||||
$model->caseAuthPolicy = $map['CaseAuthPolicy'];
|
||||
}
|
||||
if (isset($map['CountryCode'])) {
|
||||
$model->countryCode = $map['CountryCode'];
|
||||
}
|
||||
if (isset($map['OutId'])) {
|
||||
$model->outId = $map['OutId'];
|
||||
}
|
||||
if (isset($map['OwnerId'])) {
|
||||
$model->ownerId = $map['OwnerId'];
|
||||
}
|
||||
if (isset($map['PhoneNumber'])) {
|
||||
$model->phoneNumber = $map['PhoneNumber'];
|
||||
}
|
||||
if (isset($map['ResourceOwnerAccount'])) {
|
||||
$model->resourceOwnerAccount = $map['ResourceOwnerAccount'];
|
||||
}
|
||||
if (isset($map['ResourceOwnerId'])) {
|
||||
$model->resourceOwnerId = $map['ResourceOwnerId'];
|
||||
}
|
||||
if (isset($map['SchemeName'])) {
|
||||
$model->schemeName = $map['SchemeName'];
|
||||
}
|
||||
if (isset($map['VerifyCode'])) {
|
||||
$model->verifyCode = $map['VerifyCode'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
||||
71
vendor/alibabacloud/dypnsapi-20170525/src/Models/CheckSmsVerifyCodeResponse.php
vendored
Normal file
71
vendor/alibabacloud/dypnsapi-20170525/src/Models/CheckSmsVerifyCodeResponse.php
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dypnsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class CheckSmsVerifyCodeResponse extends Model
|
||||
{
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
public $headers;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $statusCode;
|
||||
|
||||
/**
|
||||
* @var CheckSmsVerifyCodeResponseBody
|
||||
*/
|
||||
public $body;
|
||||
protected $_name = [
|
||||
'headers' => 'headers',
|
||||
'statusCode' => 'statusCode',
|
||||
'body' => 'body',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->headers) {
|
||||
$res['headers'] = $this->headers;
|
||||
}
|
||||
if (null !== $this->statusCode) {
|
||||
$res['statusCode'] = $this->statusCode;
|
||||
}
|
||||
if (null !== $this->body) {
|
||||
$res['body'] = null !== $this->body ? $this->body->toMap() : null;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return CheckSmsVerifyCodeResponse
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['headers'])) {
|
||||
$model->headers = $map['headers'];
|
||||
}
|
||||
if (isset($map['statusCode'])) {
|
||||
$model->statusCode = $map['statusCode'];
|
||||
}
|
||||
if (isset($map['body'])) {
|
||||
$model->body = CheckSmsVerifyCodeResponseBody::fromMap($map['body']);
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
||||
120
vendor/alibabacloud/dypnsapi-20170525/src/Models/CheckSmsVerifyCodeResponseBody.php
vendored
Normal file
120
vendor/alibabacloud/dypnsapi-20170525/src/Models/CheckSmsVerifyCodeResponseBody.php
vendored
Normal file
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dypnsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\SDK\Dypnsapi\V20170525\Models\CheckSmsVerifyCodeResponseBody\model_;
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class CheckSmsVerifyCodeResponseBody extends Model
|
||||
{
|
||||
/**
|
||||
* @description The details about the access denial.
|
||||
*
|
||||
* @example None
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $accessDeniedDetail;
|
||||
|
||||
/**
|
||||
* @description The response code.
|
||||
*
|
||||
* If OK is returned, the request is successful.
|
||||
* For more information about other error codes, see [Response codes](https://help.aliyun.com/zh/pnvs/developer-reference/api-return-code?spm=a2c4g.11174283.0.0.70c5616bkj38Wa).
|
||||
*
|
||||
* @example OK
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $code;
|
||||
|
||||
/**
|
||||
* @description The returned message.
|
||||
*
|
||||
* @example Success
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $message;
|
||||
|
||||
/**
|
||||
* @description The returned data.
|
||||
*
|
||||
* @var model_
|
||||
*/
|
||||
public $model;
|
||||
|
||||
/**
|
||||
* @description Indicates whether the request is successful. Valid values:
|
||||
*
|
||||
* true
|
||||
* false
|
||||
*
|
||||
* @example false
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $success;
|
||||
protected $_name = [
|
||||
'accessDeniedDetail' => 'AccessDeniedDetail',
|
||||
'code' => 'Code',
|
||||
'message' => 'Message',
|
||||
'model' => 'Model',
|
||||
'success' => 'Success',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->accessDeniedDetail) {
|
||||
$res['AccessDeniedDetail'] = $this->accessDeniedDetail;
|
||||
}
|
||||
if (null !== $this->code) {
|
||||
$res['Code'] = $this->code;
|
||||
}
|
||||
if (null !== $this->message) {
|
||||
$res['Message'] = $this->message;
|
||||
}
|
||||
if (null !== $this->model) {
|
||||
$res['Model'] = null !== $this->model ? $this->model->toMap() : null;
|
||||
}
|
||||
if (null !== $this->success) {
|
||||
$res['Success'] = $this->success;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return CheckSmsVerifyCodeResponseBody
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['AccessDeniedDetail'])) {
|
||||
$model->accessDeniedDetail = $map['AccessDeniedDetail'];
|
||||
}
|
||||
if (isset($map['Code'])) {
|
||||
$model->code = $map['Code'];
|
||||
}
|
||||
if (isset($map['Message'])) {
|
||||
$model->message = $map['Message'];
|
||||
}
|
||||
if (isset($map['Model'])) {
|
||||
$model->model = model_::fromMap($map['Model']);
|
||||
}
|
||||
if (isset($map['Success'])) {
|
||||
$model->success = $map['Success'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
||||
70
vendor/alibabacloud/dypnsapi-20170525/src/Models/CheckSmsVerifyCodeResponseBody/model_.php
vendored
Normal file
70
vendor/alibabacloud/dypnsapi-20170525/src/Models/CheckSmsVerifyCodeResponseBody/model_.php
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dypnsapi\V20170525\Models\CheckSmsVerifyCodeResponseBody;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class model_ extends Model
|
||||
{
|
||||
/**
|
||||
* @description The external ID.
|
||||
*
|
||||
* @example 1212312
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $outId;
|
||||
|
||||
/**
|
||||
* @description The verification results. Valid values:
|
||||
*
|
||||
* PASS: The verification is successful.
|
||||
* UNKNOWN: The verification failed.
|
||||
*
|
||||
* @example PASS
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $verifyResult;
|
||||
protected $_name = [
|
||||
'outId' => 'OutId',
|
||||
'verifyResult' => 'VerifyResult',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->outId) {
|
||||
$res['OutId'] = $this->outId;
|
||||
}
|
||||
if (null !== $this->verifyResult) {
|
||||
$res['VerifyResult'] = $this->verifyResult;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return model_
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['OutId'])) {
|
||||
$model->outId = $map['OutId'];
|
||||
}
|
||||
if (isset($map['VerifyResult'])) {
|
||||
$model->verifyResult = $map['VerifyResult'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
||||
206
vendor/alibabacloud/dypnsapi-20170525/src/Models/CreateSchemeConfigRequest.php
vendored
Normal file
206
vendor/alibabacloud/dypnsapi-20170525/src/Models/CreateSchemeConfigRequest.php
vendored
Normal file
@@ -0,0 +1,206 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dypnsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class CreateSchemeConfigRequest extends Model
|
||||
{
|
||||
/**
|
||||
* @description The package name. This parameter is required when Platform is set to Android. The name must be 1 to 128 characters in length and can contain digits, letters, hyphens (-), underscores (_), and periods (.).
|
||||
*
|
||||
* @example com.aliyun.android
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $androidPackageName;
|
||||
|
||||
/**
|
||||
* @description The package signature. This parameter is required when Platform is set to Android. The signature must be 32 characters in length and can contain digits and letters.
|
||||
*
|
||||
* @example dfsfaawklll1****olkweklk***
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $androidPackageSign;
|
||||
|
||||
/**
|
||||
* @description The app name, which can be up to 20 characters in length and can contain letters.
|
||||
*
|
||||
* @example Alibaba Cloud Communications
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $appName;
|
||||
|
||||
/**
|
||||
* @description The reserved field. HTML5 apps are not supported.
|
||||
*
|
||||
* @example -
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $h5Origin;
|
||||
|
||||
/**
|
||||
* @description The reserved field. HTML5 apps are not supported.
|
||||
*
|
||||
* @example -
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $h5Url;
|
||||
|
||||
/**
|
||||
* @description The bundle ID. This parameter is required when OsType is set to iOS. The bundle ID must be 1 to 128 characters in length and can contain digits, letters, hyphens (-), underscores (_), and periods (.).
|
||||
*
|
||||
* @example com.aliyun.ios
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $iosBundleId;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $ownerId;
|
||||
|
||||
/**
|
||||
* @description The app platform.
|
||||
*
|
||||
* Valid values:
|
||||
*
|
||||
* Android
|
||||
* iOS
|
||||
*
|
||||
* This parameter is required.
|
||||
* @example Android
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $platform;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $resourceOwnerAccount;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $resourceOwnerId;
|
||||
|
||||
/**
|
||||
* @description The service name, which can be up to 10 characters in length and can contain letters.
|
||||
*
|
||||
* This parameter is required.
|
||||
* @example Aliyun
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $schemeName;
|
||||
protected $_name = [
|
||||
'androidPackageName' => 'AndroidPackageName',
|
||||
'androidPackageSign' => 'AndroidPackageSign',
|
||||
'appName' => 'AppName',
|
||||
'h5Origin' => 'H5Origin',
|
||||
'h5Url' => 'H5Url',
|
||||
'iosBundleId' => 'IosBundleId',
|
||||
'ownerId' => 'OwnerId',
|
||||
'platform' => 'Platform',
|
||||
'resourceOwnerAccount' => 'ResourceOwnerAccount',
|
||||
'resourceOwnerId' => 'ResourceOwnerId',
|
||||
'schemeName' => 'SchemeName',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->androidPackageName) {
|
||||
$res['AndroidPackageName'] = $this->androidPackageName;
|
||||
}
|
||||
if (null !== $this->androidPackageSign) {
|
||||
$res['AndroidPackageSign'] = $this->androidPackageSign;
|
||||
}
|
||||
if (null !== $this->appName) {
|
||||
$res['AppName'] = $this->appName;
|
||||
}
|
||||
if (null !== $this->h5Origin) {
|
||||
$res['H5Origin'] = $this->h5Origin;
|
||||
}
|
||||
if (null !== $this->h5Url) {
|
||||
$res['H5Url'] = $this->h5Url;
|
||||
}
|
||||
if (null !== $this->iosBundleId) {
|
||||
$res['IosBundleId'] = $this->iosBundleId;
|
||||
}
|
||||
if (null !== $this->ownerId) {
|
||||
$res['OwnerId'] = $this->ownerId;
|
||||
}
|
||||
if (null !== $this->platform) {
|
||||
$res['Platform'] = $this->platform;
|
||||
}
|
||||
if (null !== $this->resourceOwnerAccount) {
|
||||
$res['ResourceOwnerAccount'] = $this->resourceOwnerAccount;
|
||||
}
|
||||
if (null !== $this->resourceOwnerId) {
|
||||
$res['ResourceOwnerId'] = $this->resourceOwnerId;
|
||||
}
|
||||
if (null !== $this->schemeName) {
|
||||
$res['SchemeName'] = $this->schemeName;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return CreateSchemeConfigRequest
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['AndroidPackageName'])) {
|
||||
$model->androidPackageName = $map['AndroidPackageName'];
|
||||
}
|
||||
if (isset($map['AndroidPackageSign'])) {
|
||||
$model->androidPackageSign = $map['AndroidPackageSign'];
|
||||
}
|
||||
if (isset($map['AppName'])) {
|
||||
$model->appName = $map['AppName'];
|
||||
}
|
||||
if (isset($map['H5Origin'])) {
|
||||
$model->h5Origin = $map['H5Origin'];
|
||||
}
|
||||
if (isset($map['H5Url'])) {
|
||||
$model->h5Url = $map['H5Url'];
|
||||
}
|
||||
if (isset($map['IosBundleId'])) {
|
||||
$model->iosBundleId = $map['IosBundleId'];
|
||||
}
|
||||
if (isset($map['OwnerId'])) {
|
||||
$model->ownerId = $map['OwnerId'];
|
||||
}
|
||||
if (isset($map['Platform'])) {
|
||||
$model->platform = $map['Platform'];
|
||||
}
|
||||
if (isset($map['ResourceOwnerAccount'])) {
|
||||
$model->resourceOwnerAccount = $map['ResourceOwnerAccount'];
|
||||
}
|
||||
if (isset($map['ResourceOwnerId'])) {
|
||||
$model->resourceOwnerId = $map['ResourceOwnerId'];
|
||||
}
|
||||
if (isset($map['SchemeName'])) {
|
||||
$model->schemeName = $map['SchemeName'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
||||
71
vendor/alibabacloud/dypnsapi-20170525/src/Models/CreateSchemeConfigResponse.php
vendored
Normal file
71
vendor/alibabacloud/dypnsapi-20170525/src/Models/CreateSchemeConfigResponse.php
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dypnsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class CreateSchemeConfigResponse extends Model
|
||||
{
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
public $headers;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $statusCode;
|
||||
|
||||
/**
|
||||
* @var CreateSchemeConfigResponseBody
|
||||
*/
|
||||
public $body;
|
||||
protected $_name = [
|
||||
'headers' => 'headers',
|
||||
'statusCode' => 'statusCode',
|
||||
'body' => 'body',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->headers) {
|
||||
$res['headers'] = $this->headers;
|
||||
}
|
||||
if (null !== $this->statusCode) {
|
||||
$res['statusCode'] = $this->statusCode;
|
||||
}
|
||||
if (null !== $this->body) {
|
||||
$res['body'] = null !== $this->body ? $this->body->toMap() : null;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return CreateSchemeConfigResponse
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['headers'])) {
|
||||
$model->headers = $map['headers'];
|
||||
}
|
||||
if (isset($map['statusCode'])) {
|
||||
$model->statusCode = $map['statusCode'];
|
||||
}
|
||||
if (isset($map['body'])) {
|
||||
$model->body = CreateSchemeConfigResponseBody::fromMap($map['body']);
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
||||
120
vendor/alibabacloud/dypnsapi-20170525/src/Models/CreateSchemeConfigResponseBody.php
vendored
Normal file
120
vendor/alibabacloud/dypnsapi-20170525/src/Models/CreateSchemeConfigResponseBody.php
vendored
Normal file
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dypnsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\SDK\Dypnsapi\V20170525\Models\CreateSchemeConfigResponseBody\model_;
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class CreateSchemeConfigResponseBody extends Model
|
||||
{
|
||||
/**
|
||||
* @description The response code.
|
||||
*
|
||||
* If OK is returned, the request is successful.
|
||||
* For more information about other error codes, see [API response codes](https://help.aliyun.com/zh/pnvs/developer-reference/api-return-code?spm=a2c4g.11186623.0.0.5c3a662fbgeAuk).
|
||||
*
|
||||
* @example OK
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $code;
|
||||
|
||||
/**
|
||||
* @description The returned message.
|
||||
*
|
||||
* @example Success
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $message;
|
||||
|
||||
/**
|
||||
* @description The returned results.
|
||||
*
|
||||
* @var model_
|
||||
*/
|
||||
public $model;
|
||||
|
||||
/**
|
||||
* @description The request ID.
|
||||
*
|
||||
* @example B95B36EC-8108-4479-D3AA-2BB27F9B155A
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $requestId;
|
||||
|
||||
/**
|
||||
* @description Indicates whether the request is successful. Valid values:
|
||||
*
|
||||
* **true**
|
||||
* **false**
|
||||
*
|
||||
* @example false
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $success;
|
||||
protected $_name = [
|
||||
'code' => 'Code',
|
||||
'message' => 'Message',
|
||||
'model' => 'Model',
|
||||
'requestId' => 'RequestId',
|
||||
'success' => 'Success',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->code) {
|
||||
$res['Code'] = $this->code;
|
||||
}
|
||||
if (null !== $this->message) {
|
||||
$res['Message'] = $this->message;
|
||||
}
|
||||
if (null !== $this->model) {
|
||||
$res['Model'] = null !== $this->model ? $this->model->toMap() : null;
|
||||
}
|
||||
if (null !== $this->requestId) {
|
||||
$res['RequestId'] = $this->requestId;
|
||||
}
|
||||
if (null !== $this->success) {
|
||||
$res['Success'] = $this->success;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return CreateSchemeConfigResponseBody
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['Code'])) {
|
||||
$model->code = $map['Code'];
|
||||
}
|
||||
if (isset($map['Message'])) {
|
||||
$model->message = $map['Message'];
|
||||
}
|
||||
if (isset($map['Model'])) {
|
||||
$model->model = model_::fromMap($map['Model']);
|
||||
}
|
||||
if (isset($map['RequestId'])) {
|
||||
$model->requestId = $map['RequestId'];
|
||||
}
|
||||
if (isset($map['Success'])) {
|
||||
$model->success = $map['Success'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
||||
51
vendor/alibabacloud/dypnsapi-20170525/src/Models/CreateSchemeConfigResponseBody/model_.php
vendored
Normal file
51
vendor/alibabacloud/dypnsapi-20170525/src/Models/CreateSchemeConfigResponseBody/model_.php
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dypnsapi\V20170525\Models\CreateSchemeConfigResponseBody;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class model_ extends Model
|
||||
{
|
||||
/**
|
||||
* @description The service code.
|
||||
*
|
||||
* @example FA100000168468035
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $schemeCode;
|
||||
protected $_name = [
|
||||
'schemeCode' => 'SchemeCode',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->schemeCode) {
|
||||
$res['SchemeCode'] = $this->schemeCode;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return model_
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['SchemeCode'])) {
|
||||
$model->schemeCode = $map['SchemeCode'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
||||
369
vendor/alibabacloud/dypnsapi-20170525/src/Models/CreateVerifySchemeRequest.php
vendored
Normal file
369
vendor/alibabacloud/dypnsapi-20170525/src/Models/CreateVerifySchemeRequest.php
vendored
Normal file
@@ -0,0 +1,369 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dypnsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class CreateVerifySchemeRequest extends Model
|
||||
{
|
||||
/**
|
||||
* @description The app name.
|
||||
*
|
||||
* This parameter is required.
|
||||
* @example Alibaba Cloud Communications
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $appName;
|
||||
|
||||
/**
|
||||
* @description The verification type. You can select multiple types only when the phone number verification is supported. Separate multiple types with commas (,).
|
||||
*
|
||||
* **1**: phone number verification
|
||||
* **2**: SMS verification
|
||||
*
|
||||
* @example 1,2
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $authType;
|
||||
|
||||
/**
|
||||
* @description The bundle ID. This parameter is required when OsType is set to iOS. The bundle ID must be 1 to 128 characters in length and can contain digits, letters, hyphens (-), underscores (_), and periods (.).
|
||||
*
|
||||
* @example example.aliyundoc.com
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $bundleId;
|
||||
|
||||
/**
|
||||
* @description The channel code of China Mobile.
|
||||
*
|
||||
* @example 1
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $cmApiCode;
|
||||
|
||||
/**
|
||||
* @description The channel code of China Telecom.
|
||||
*
|
||||
* @example 3
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $ctApiCode;
|
||||
|
||||
/**
|
||||
* @description The channel code of China Unicom.
|
||||
*
|
||||
* @example 2
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $cuApiCode;
|
||||
|
||||
/**
|
||||
* @description The email address that receives the key.
|
||||
*
|
||||
* @example username@aliyundoc.com
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $email;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $hmAppIdentifier;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $hmPackageName;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $hmSignName;
|
||||
|
||||
/**
|
||||
* @description The IP address whitelist.
|
||||
*
|
||||
* @example 139.9.167.181
|
||||
* 139.9.172.0/24
|
||||
* @var string
|
||||
*/
|
||||
public $ipWhiteList;
|
||||
|
||||
/**
|
||||
* @description The source URL of the HTML5 app page. We recommend that you specify this parameter as a domain name.
|
||||
*
|
||||
* @example https://h5.minexiot.com
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $origin;
|
||||
|
||||
/**
|
||||
* @description The type of the operating system for the terminal. Valid values: iOS and Android.
|
||||
*
|
||||
* This parameter is required.
|
||||
* @example iOS
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $osType;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $ownerId;
|
||||
|
||||
/**
|
||||
* @description The package name. This parameter is required when OsType is set to Android. The name must be 1 to 128 characters in length and can contain digits, letters, hyphens (-), underscores (_), and periods (.).
|
||||
*
|
||||
* @example com.aliyun
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $packName;
|
||||
|
||||
/**
|
||||
* @description The package signature. This parameter is required when OsType is set to Android. The signature must be 32 characters in length and can contain digits and letters.
|
||||
*
|
||||
* @example 123aliyun
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $packSign;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $resourceOwnerAccount;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $resourceOwnerId;
|
||||
|
||||
/**
|
||||
* @description The service type.
|
||||
*
|
||||
* @example 0
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $sceneType;
|
||||
|
||||
/**
|
||||
* @description The service name.
|
||||
*
|
||||
* This parameter is required.
|
||||
* @example Aliyun
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $schemeName;
|
||||
|
||||
/**
|
||||
* @description The bound SMS signature. This parameter is valid only when AuthType is set to 2. The signature must be approved.
|
||||
*
|
||||
* @example Aliyun Test
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $smsSignName;
|
||||
|
||||
/**
|
||||
* @description The URL of the HTML5 app page.
|
||||
*
|
||||
* @example https://h5.minexiot.com/index.html
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $url;
|
||||
protected $_name = [
|
||||
'appName' => 'AppName',
|
||||
'authType' => 'AuthType',
|
||||
'bundleId' => 'BundleId',
|
||||
'cmApiCode' => 'CmApiCode',
|
||||
'ctApiCode' => 'CtApiCode',
|
||||
'cuApiCode' => 'CuApiCode',
|
||||
'email' => 'Email',
|
||||
'hmAppIdentifier' => 'HmAppIdentifier',
|
||||
'hmPackageName' => 'HmPackageName',
|
||||
'hmSignName' => 'HmSignName',
|
||||
'ipWhiteList' => 'IpWhiteList',
|
||||
'origin' => 'Origin',
|
||||
'osType' => 'OsType',
|
||||
'ownerId' => 'OwnerId',
|
||||
'packName' => 'PackName',
|
||||
'packSign' => 'PackSign',
|
||||
'resourceOwnerAccount' => 'ResourceOwnerAccount',
|
||||
'resourceOwnerId' => 'ResourceOwnerId',
|
||||
'sceneType' => 'SceneType',
|
||||
'schemeName' => 'SchemeName',
|
||||
'smsSignName' => 'SmsSignName',
|
||||
'url' => 'Url',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->appName) {
|
||||
$res['AppName'] = $this->appName;
|
||||
}
|
||||
if (null !== $this->authType) {
|
||||
$res['AuthType'] = $this->authType;
|
||||
}
|
||||
if (null !== $this->bundleId) {
|
||||
$res['BundleId'] = $this->bundleId;
|
||||
}
|
||||
if (null !== $this->cmApiCode) {
|
||||
$res['CmApiCode'] = $this->cmApiCode;
|
||||
}
|
||||
if (null !== $this->ctApiCode) {
|
||||
$res['CtApiCode'] = $this->ctApiCode;
|
||||
}
|
||||
if (null !== $this->cuApiCode) {
|
||||
$res['CuApiCode'] = $this->cuApiCode;
|
||||
}
|
||||
if (null !== $this->email) {
|
||||
$res['Email'] = $this->email;
|
||||
}
|
||||
if (null !== $this->hmAppIdentifier) {
|
||||
$res['HmAppIdentifier'] = $this->hmAppIdentifier;
|
||||
}
|
||||
if (null !== $this->hmPackageName) {
|
||||
$res['HmPackageName'] = $this->hmPackageName;
|
||||
}
|
||||
if (null !== $this->hmSignName) {
|
||||
$res['HmSignName'] = $this->hmSignName;
|
||||
}
|
||||
if (null !== $this->ipWhiteList) {
|
||||
$res['IpWhiteList'] = $this->ipWhiteList;
|
||||
}
|
||||
if (null !== $this->origin) {
|
||||
$res['Origin'] = $this->origin;
|
||||
}
|
||||
if (null !== $this->osType) {
|
||||
$res['OsType'] = $this->osType;
|
||||
}
|
||||
if (null !== $this->ownerId) {
|
||||
$res['OwnerId'] = $this->ownerId;
|
||||
}
|
||||
if (null !== $this->packName) {
|
||||
$res['PackName'] = $this->packName;
|
||||
}
|
||||
if (null !== $this->packSign) {
|
||||
$res['PackSign'] = $this->packSign;
|
||||
}
|
||||
if (null !== $this->resourceOwnerAccount) {
|
||||
$res['ResourceOwnerAccount'] = $this->resourceOwnerAccount;
|
||||
}
|
||||
if (null !== $this->resourceOwnerId) {
|
||||
$res['ResourceOwnerId'] = $this->resourceOwnerId;
|
||||
}
|
||||
if (null !== $this->sceneType) {
|
||||
$res['SceneType'] = $this->sceneType;
|
||||
}
|
||||
if (null !== $this->schemeName) {
|
||||
$res['SchemeName'] = $this->schemeName;
|
||||
}
|
||||
if (null !== $this->smsSignName) {
|
||||
$res['SmsSignName'] = $this->smsSignName;
|
||||
}
|
||||
if (null !== $this->url) {
|
||||
$res['Url'] = $this->url;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return CreateVerifySchemeRequest
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['AppName'])) {
|
||||
$model->appName = $map['AppName'];
|
||||
}
|
||||
if (isset($map['AuthType'])) {
|
||||
$model->authType = $map['AuthType'];
|
||||
}
|
||||
if (isset($map['BundleId'])) {
|
||||
$model->bundleId = $map['BundleId'];
|
||||
}
|
||||
if (isset($map['CmApiCode'])) {
|
||||
$model->cmApiCode = $map['CmApiCode'];
|
||||
}
|
||||
if (isset($map['CtApiCode'])) {
|
||||
$model->ctApiCode = $map['CtApiCode'];
|
||||
}
|
||||
if (isset($map['CuApiCode'])) {
|
||||
$model->cuApiCode = $map['CuApiCode'];
|
||||
}
|
||||
if (isset($map['Email'])) {
|
||||
$model->email = $map['Email'];
|
||||
}
|
||||
if (isset($map['HmAppIdentifier'])) {
|
||||
$model->hmAppIdentifier = $map['HmAppIdentifier'];
|
||||
}
|
||||
if (isset($map['HmPackageName'])) {
|
||||
$model->hmPackageName = $map['HmPackageName'];
|
||||
}
|
||||
if (isset($map['HmSignName'])) {
|
||||
$model->hmSignName = $map['HmSignName'];
|
||||
}
|
||||
if (isset($map['IpWhiteList'])) {
|
||||
$model->ipWhiteList = $map['IpWhiteList'];
|
||||
}
|
||||
if (isset($map['Origin'])) {
|
||||
$model->origin = $map['Origin'];
|
||||
}
|
||||
if (isset($map['OsType'])) {
|
||||
$model->osType = $map['OsType'];
|
||||
}
|
||||
if (isset($map['OwnerId'])) {
|
||||
$model->ownerId = $map['OwnerId'];
|
||||
}
|
||||
if (isset($map['PackName'])) {
|
||||
$model->packName = $map['PackName'];
|
||||
}
|
||||
if (isset($map['PackSign'])) {
|
||||
$model->packSign = $map['PackSign'];
|
||||
}
|
||||
if (isset($map['ResourceOwnerAccount'])) {
|
||||
$model->resourceOwnerAccount = $map['ResourceOwnerAccount'];
|
||||
}
|
||||
if (isset($map['ResourceOwnerId'])) {
|
||||
$model->resourceOwnerId = $map['ResourceOwnerId'];
|
||||
}
|
||||
if (isset($map['SceneType'])) {
|
||||
$model->sceneType = $map['SceneType'];
|
||||
}
|
||||
if (isset($map['SchemeName'])) {
|
||||
$model->schemeName = $map['SchemeName'];
|
||||
}
|
||||
if (isset($map['SmsSignName'])) {
|
||||
$model->smsSignName = $map['SmsSignName'];
|
||||
}
|
||||
if (isset($map['Url'])) {
|
||||
$model->url = $map['Url'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
||||
71
vendor/alibabacloud/dypnsapi-20170525/src/Models/CreateVerifySchemeResponse.php
vendored
Normal file
71
vendor/alibabacloud/dypnsapi-20170525/src/Models/CreateVerifySchemeResponse.php
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dypnsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class CreateVerifySchemeResponse extends Model
|
||||
{
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
public $headers;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $statusCode;
|
||||
|
||||
/**
|
||||
* @var CreateVerifySchemeResponseBody
|
||||
*/
|
||||
public $body;
|
||||
protected $_name = [
|
||||
'headers' => 'headers',
|
||||
'statusCode' => 'statusCode',
|
||||
'body' => 'body',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->headers) {
|
||||
$res['headers'] = $this->headers;
|
||||
}
|
||||
if (null !== $this->statusCode) {
|
||||
$res['statusCode'] = $this->statusCode;
|
||||
}
|
||||
if (null !== $this->body) {
|
||||
$res['body'] = null !== $this->body ? $this->body->toMap() : null;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return CreateVerifySchemeResponse
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['headers'])) {
|
||||
$model->headers = $map['headers'];
|
||||
}
|
||||
if (isset($map['statusCode'])) {
|
||||
$model->statusCode = $map['statusCode'];
|
||||
}
|
||||
if (isset($map['body'])) {
|
||||
$model->body = CreateVerifySchemeResponseBody::fromMap($map['body']);
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
||||
136
vendor/alibabacloud/dypnsapi-20170525/src/Models/CreateVerifySchemeResponseBody.php
vendored
Normal file
136
vendor/alibabacloud/dypnsapi-20170525/src/Models/CreateVerifySchemeResponseBody.php
vendored
Normal file
@@ -0,0 +1,136 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dypnsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\SDK\Dypnsapi\V20170525\Models\CreateVerifySchemeResponseBody\gateVerifySchemeDTO;
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class CreateVerifySchemeResponseBody extends Model
|
||||
{
|
||||
/**
|
||||
* @description The response code.
|
||||
*
|
||||
* If OK is returned, the request is successful.
|
||||
* For more information about other error codes, see [API response codes](https://help.aliyun.com/document_detail/85198.html).
|
||||
*
|
||||
* @example OK
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $code;
|
||||
|
||||
/**
|
||||
* @description The response parameters.
|
||||
*
|
||||
* @var gateVerifySchemeDTO
|
||||
*/
|
||||
public $gateVerifySchemeDTO;
|
||||
|
||||
/**
|
||||
* @description The HTTP status code.
|
||||
*
|
||||
* @example 200
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $httpStatusCode;
|
||||
|
||||
/**
|
||||
* @description The returned message.
|
||||
*
|
||||
* @example OK
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $message;
|
||||
|
||||
/**
|
||||
* @description The request ID.
|
||||
*
|
||||
* @example A1E75E69-3049-5FDB-A376-D745837CD2B1
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $requestId;
|
||||
|
||||
/**
|
||||
* @description Indicates whether the request is successful. Valid values:
|
||||
*
|
||||
* **true**
|
||||
* **false**
|
||||
*
|
||||
* @example true
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $success;
|
||||
protected $_name = [
|
||||
'code' => 'Code',
|
||||
'gateVerifySchemeDTO' => 'GateVerifySchemeDTO',
|
||||
'httpStatusCode' => 'HttpStatusCode',
|
||||
'message' => 'Message',
|
||||
'requestId' => 'RequestId',
|
||||
'success' => 'Success',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->code) {
|
||||
$res['Code'] = $this->code;
|
||||
}
|
||||
if (null !== $this->gateVerifySchemeDTO) {
|
||||
$res['GateVerifySchemeDTO'] = null !== $this->gateVerifySchemeDTO ? $this->gateVerifySchemeDTO->toMap() : null;
|
||||
}
|
||||
if (null !== $this->httpStatusCode) {
|
||||
$res['HttpStatusCode'] = $this->httpStatusCode;
|
||||
}
|
||||
if (null !== $this->message) {
|
||||
$res['Message'] = $this->message;
|
||||
}
|
||||
if (null !== $this->requestId) {
|
||||
$res['RequestId'] = $this->requestId;
|
||||
}
|
||||
if (null !== $this->success) {
|
||||
$res['Success'] = $this->success;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return CreateVerifySchemeResponseBody
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['Code'])) {
|
||||
$model->code = $map['Code'];
|
||||
}
|
||||
if (isset($map['GateVerifySchemeDTO'])) {
|
||||
$model->gateVerifySchemeDTO = gateVerifySchemeDTO::fromMap($map['GateVerifySchemeDTO']);
|
||||
}
|
||||
if (isset($map['HttpStatusCode'])) {
|
||||
$model->httpStatusCode = $map['HttpStatusCode'];
|
||||
}
|
||||
if (isset($map['Message'])) {
|
||||
$model->message = $map['Message'];
|
||||
}
|
||||
if (isset($map['RequestId'])) {
|
||||
$model->requestId = $map['RequestId'];
|
||||
}
|
||||
if (isset($map['Success'])) {
|
||||
$model->success = $map['Success'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dypnsapi\V20170525\Models\CreateVerifySchemeResponseBody;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class gateVerifySchemeDTO extends Model
|
||||
{
|
||||
/**
|
||||
* @description The service code.
|
||||
*
|
||||
* @example FC10001287****
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $schemeCode;
|
||||
protected $_name = [
|
||||
'schemeCode' => 'SchemeCode',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->schemeCode) {
|
||||
$res['SchemeCode'] = $this->schemeCode;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return gateVerifySchemeDTO
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['SchemeCode'])) {
|
||||
$model->schemeCode = $map['SchemeCode'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
||||
104
vendor/alibabacloud/dypnsapi-20170525/src/Models/DeleteVerifySchemeRequest.php
vendored
Normal file
104
vendor/alibabacloud/dypnsapi-20170525/src/Models/DeleteVerifySchemeRequest.php
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dypnsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class DeleteVerifySchemeRequest extends Model
|
||||
{
|
||||
/**
|
||||
* @description The user ID.
|
||||
*
|
||||
* @example 12345678
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $customerId;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $ownerId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $resourceOwnerAccount;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $resourceOwnerId;
|
||||
|
||||
/**
|
||||
* @description The service code.
|
||||
*
|
||||
* This parameter is required.
|
||||
* @example FC10000014164****
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $schemeCode;
|
||||
protected $_name = [
|
||||
'customerId' => 'CustomerId',
|
||||
'ownerId' => 'OwnerId',
|
||||
'resourceOwnerAccount' => 'ResourceOwnerAccount',
|
||||
'resourceOwnerId' => 'ResourceOwnerId',
|
||||
'schemeCode' => 'SchemeCode',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->customerId) {
|
||||
$res['CustomerId'] = $this->customerId;
|
||||
}
|
||||
if (null !== $this->ownerId) {
|
||||
$res['OwnerId'] = $this->ownerId;
|
||||
}
|
||||
if (null !== $this->resourceOwnerAccount) {
|
||||
$res['ResourceOwnerAccount'] = $this->resourceOwnerAccount;
|
||||
}
|
||||
if (null !== $this->resourceOwnerId) {
|
||||
$res['ResourceOwnerId'] = $this->resourceOwnerId;
|
||||
}
|
||||
if (null !== $this->schemeCode) {
|
||||
$res['SchemeCode'] = $this->schemeCode;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return DeleteVerifySchemeRequest
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['CustomerId'])) {
|
||||
$model->customerId = $map['CustomerId'];
|
||||
}
|
||||
if (isset($map['OwnerId'])) {
|
||||
$model->ownerId = $map['OwnerId'];
|
||||
}
|
||||
if (isset($map['ResourceOwnerAccount'])) {
|
||||
$model->resourceOwnerAccount = $map['ResourceOwnerAccount'];
|
||||
}
|
||||
if (isset($map['ResourceOwnerId'])) {
|
||||
$model->resourceOwnerId = $map['ResourceOwnerId'];
|
||||
}
|
||||
if (isset($map['SchemeCode'])) {
|
||||
$model->schemeCode = $map['SchemeCode'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
||||
71
vendor/alibabacloud/dypnsapi-20170525/src/Models/DeleteVerifySchemeResponse.php
vendored
Normal file
71
vendor/alibabacloud/dypnsapi-20170525/src/Models/DeleteVerifySchemeResponse.php
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dypnsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class DeleteVerifySchemeResponse extends Model
|
||||
{
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
public $headers;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $statusCode;
|
||||
|
||||
/**
|
||||
* @var DeleteVerifySchemeResponseBody
|
||||
*/
|
||||
public $body;
|
||||
protected $_name = [
|
||||
'headers' => 'headers',
|
||||
'statusCode' => 'statusCode',
|
||||
'body' => 'body',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->headers) {
|
||||
$res['headers'] = $this->headers;
|
||||
}
|
||||
if (null !== $this->statusCode) {
|
||||
$res['statusCode'] = $this->statusCode;
|
||||
}
|
||||
if (null !== $this->body) {
|
||||
$res['body'] = null !== $this->body ? $this->body->toMap() : null;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return DeleteVerifySchemeResponse
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['headers'])) {
|
||||
$model->headers = $map['headers'];
|
||||
}
|
||||
if (isset($map['statusCode'])) {
|
||||
$model->statusCode = $map['statusCode'];
|
||||
}
|
||||
if (isset($map['body'])) {
|
||||
$model->body = DeleteVerifySchemeResponseBody::fromMap($map['body']);
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
||||
102
vendor/alibabacloud/dypnsapi-20170525/src/Models/DeleteVerifySchemeResponseBody.php
vendored
Normal file
102
vendor/alibabacloud/dypnsapi-20170525/src/Models/DeleteVerifySchemeResponseBody.php
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dypnsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class DeleteVerifySchemeResponseBody extends Model
|
||||
{
|
||||
/**
|
||||
* @description The request is successful. For more information about other error codes, see [API response codes](https://help.aliyun.com/document_detail/85198.html).
|
||||
*
|
||||
* @example OK
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $code;
|
||||
|
||||
/**
|
||||
* @description The returned message.
|
||||
*
|
||||
* @example OK
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $message;
|
||||
|
||||
/**
|
||||
* @description The request ID.
|
||||
*
|
||||
* @example E3754956-D0B1-5947-962A-AE767D354F01
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $requestId;
|
||||
|
||||
/**
|
||||
* @description The result of the operation. Valid values:
|
||||
*
|
||||
* **true**: The verification service is deleted.
|
||||
* **false**: The verification service failed to be deleted.
|
||||
*
|
||||
* @example true
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $result;
|
||||
protected $_name = [
|
||||
'code' => 'Code',
|
||||
'message' => 'Message',
|
||||
'requestId' => 'RequestId',
|
||||
'result' => 'Result',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->code) {
|
||||
$res['Code'] = $this->code;
|
||||
}
|
||||
if (null !== $this->message) {
|
||||
$res['Message'] = $this->message;
|
||||
}
|
||||
if (null !== $this->requestId) {
|
||||
$res['RequestId'] = $this->requestId;
|
||||
}
|
||||
if (null !== $this->result) {
|
||||
$res['Result'] = $this->result;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return DeleteVerifySchemeResponseBody
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['Code'])) {
|
||||
$model->code = $map['Code'];
|
||||
}
|
||||
if (isset($map['Message'])) {
|
||||
$model->message = $map['Message'];
|
||||
}
|
||||
if (isset($map['RequestId'])) {
|
||||
$model->requestId = $map['RequestId'];
|
||||
}
|
||||
if (isset($map['Result'])) {
|
||||
$model->result = $map['Result'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
||||
104
vendor/alibabacloud/dypnsapi-20170525/src/Models/DescribeVerifySchemeRequest.php
vendored
Normal file
104
vendor/alibabacloud/dypnsapi-20170525/src/Models/DescribeVerifySchemeRequest.php
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dypnsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class DescribeVerifySchemeRequest extends Model
|
||||
{
|
||||
/**
|
||||
* @description The user ID.
|
||||
*
|
||||
* @example 1234****
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $customerId;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $ownerId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $resourceOwnerAccount;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $resourceOwnerId;
|
||||
|
||||
/**
|
||||
* @description The service code.
|
||||
*
|
||||
* This parameter is required.
|
||||
* @example FC10000010643****
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $schemeCode;
|
||||
protected $_name = [
|
||||
'customerId' => 'CustomerId',
|
||||
'ownerId' => 'OwnerId',
|
||||
'resourceOwnerAccount' => 'ResourceOwnerAccount',
|
||||
'resourceOwnerId' => 'ResourceOwnerId',
|
||||
'schemeCode' => 'SchemeCode',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->customerId) {
|
||||
$res['CustomerId'] = $this->customerId;
|
||||
}
|
||||
if (null !== $this->ownerId) {
|
||||
$res['OwnerId'] = $this->ownerId;
|
||||
}
|
||||
if (null !== $this->resourceOwnerAccount) {
|
||||
$res['ResourceOwnerAccount'] = $this->resourceOwnerAccount;
|
||||
}
|
||||
if (null !== $this->resourceOwnerId) {
|
||||
$res['ResourceOwnerId'] = $this->resourceOwnerId;
|
||||
}
|
||||
if (null !== $this->schemeCode) {
|
||||
$res['SchemeCode'] = $this->schemeCode;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return DescribeVerifySchemeRequest
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['CustomerId'])) {
|
||||
$model->customerId = $map['CustomerId'];
|
||||
}
|
||||
if (isset($map['OwnerId'])) {
|
||||
$model->ownerId = $map['OwnerId'];
|
||||
}
|
||||
if (isset($map['ResourceOwnerAccount'])) {
|
||||
$model->resourceOwnerAccount = $map['ResourceOwnerAccount'];
|
||||
}
|
||||
if (isset($map['ResourceOwnerId'])) {
|
||||
$model->resourceOwnerId = $map['ResourceOwnerId'];
|
||||
}
|
||||
if (isset($map['SchemeCode'])) {
|
||||
$model->schemeCode = $map['SchemeCode'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
||||
71
vendor/alibabacloud/dypnsapi-20170525/src/Models/DescribeVerifySchemeResponse.php
vendored
Normal file
71
vendor/alibabacloud/dypnsapi-20170525/src/Models/DescribeVerifySchemeResponse.php
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dypnsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class DescribeVerifySchemeResponse extends Model
|
||||
{
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
public $headers;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $statusCode;
|
||||
|
||||
/**
|
||||
* @var DescribeVerifySchemeResponseBody
|
||||
*/
|
||||
public $body;
|
||||
protected $_name = [
|
||||
'headers' => 'headers',
|
||||
'statusCode' => 'statusCode',
|
||||
'body' => 'body',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->headers) {
|
||||
$res['headers'] = $this->headers;
|
||||
}
|
||||
if (null !== $this->statusCode) {
|
||||
$res['statusCode'] = $this->statusCode;
|
||||
}
|
||||
if (null !== $this->body) {
|
||||
$res['body'] = null !== $this->body ? $this->body->toMap() : null;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return DescribeVerifySchemeResponse
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['headers'])) {
|
||||
$model->headers = $map['headers'];
|
||||
}
|
||||
if (isset($map['statusCode'])) {
|
||||
$model->statusCode = $map['statusCode'];
|
||||
}
|
||||
if (isset($map['body'])) {
|
||||
$model->body = DescribeVerifySchemeResponseBody::fromMap($map['body']);
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
||||
98
vendor/alibabacloud/dypnsapi-20170525/src/Models/DescribeVerifySchemeResponseBody.php
vendored
Normal file
98
vendor/alibabacloud/dypnsapi-20170525/src/Models/DescribeVerifySchemeResponseBody.php
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dypnsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\SDK\Dypnsapi\V20170525\Models\DescribeVerifySchemeResponseBody\schemeQueryResultDTO;
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class DescribeVerifySchemeResponseBody extends Model
|
||||
{
|
||||
/**
|
||||
* @description The response code. OK indicates that the request is successful. For more information about other error codes, see [API response codes](https://help.aliyun.com/document_detail/85198.html).
|
||||
*
|
||||
* @example OK
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $code;
|
||||
|
||||
/**
|
||||
* @description The returned message.
|
||||
*
|
||||
* @example OK
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $message;
|
||||
|
||||
/**
|
||||
* @description The request ID.
|
||||
*
|
||||
* @example 0C5380A7-2032-5F7D-9614-1BF8B54D16CB
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $requestId;
|
||||
|
||||
/**
|
||||
* @description The response parameters.
|
||||
*
|
||||
* @var schemeQueryResultDTO
|
||||
*/
|
||||
public $schemeQueryResultDTO;
|
||||
protected $_name = [
|
||||
'code' => 'Code',
|
||||
'message' => 'Message',
|
||||
'requestId' => 'RequestId',
|
||||
'schemeQueryResultDTO' => 'SchemeQueryResultDTO',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->code) {
|
||||
$res['Code'] = $this->code;
|
||||
}
|
||||
if (null !== $this->message) {
|
||||
$res['Message'] = $this->message;
|
||||
}
|
||||
if (null !== $this->requestId) {
|
||||
$res['RequestId'] = $this->requestId;
|
||||
}
|
||||
if (null !== $this->schemeQueryResultDTO) {
|
||||
$res['SchemeQueryResultDTO'] = null !== $this->schemeQueryResultDTO ? $this->schemeQueryResultDTO->toMap() : null;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return DescribeVerifySchemeResponseBody
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['Code'])) {
|
||||
$model->code = $map['Code'];
|
||||
}
|
||||
if (isset($map['Message'])) {
|
||||
$model->message = $map['Message'];
|
||||
}
|
||||
if (isset($map['RequestId'])) {
|
||||
$model->requestId = $map['RequestId'];
|
||||
}
|
||||
if (isset($map['SchemeQueryResultDTO'])) {
|
||||
$model->schemeQueryResultDTO = schemeQueryResultDTO::fromMap($map['SchemeQueryResultDTO']);
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dypnsapi\V20170525\Models\DescribeVerifySchemeResponseBody;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class schemeQueryResultDTO extends Model
|
||||
{
|
||||
/**
|
||||
* @description The key generated when you create a service in the console.
|
||||
*
|
||||
* @example ZDMARqPkyQzWVJjB/sB/+fCp5TA4lNsRnY7rEC+HfGsOIOk1Brj8UyXFW2RBYIWqLieCSo8ZypEaEj+h9rLd3FgpXAjGYDfmOperod6jPUUwFHhBObxK+HuKVoi2jOqN7aDOlyPyGcATyq3BDdlf922JmnFLT8Hvnu4qgzzCZk0LXWTb0XVPnm5/fHUGHEA2Q+aTrGkaWcHjmTDqQ7BtvrAIIcJJkCJu4i1aeU++/0EzGWap4mcb2VhKROBs****
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $appEncryptInfo;
|
||||
protected $_name = [
|
||||
'appEncryptInfo' => 'AppEncryptInfo',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->appEncryptInfo) {
|
||||
$res['AppEncryptInfo'] = $this->appEncryptInfo;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return schemeQueryResultDTO
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['AppEncryptInfo'])) {
|
||||
$model->appEncryptInfo = $map['AppEncryptInfo'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
||||
177
vendor/alibabacloud/dypnsapi-20170525/src/Models/GetAuthTokenRequest.php
vendored
Normal file
177
vendor/alibabacloud/dypnsapi-20170525/src/Models/GetAuthTokenRequest.php
vendored
Normal file
@@ -0,0 +1,177 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dypnsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class GetAuthTokenRequest extends Model
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $bizType;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $cmApiCode;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $ctApiCode;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $cuApiCode;
|
||||
|
||||
/**
|
||||
* @description The requested domain name.
|
||||
*
|
||||
* This parameter is required.
|
||||
* @example https://www.aliyundoc.com
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $origin;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $ownerId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $resourceOwnerAccount;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $resourceOwnerId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $sceneCode;
|
||||
|
||||
/**
|
||||
* @description The URL of the requested web page.
|
||||
*
|
||||
* This parameter is required.
|
||||
* @example https://www.aliyundoc.com/
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $url;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $version;
|
||||
protected $_name = [
|
||||
'bizType' => 'BizType',
|
||||
'cmApiCode' => 'CmApiCode',
|
||||
'ctApiCode' => 'CtApiCode',
|
||||
'cuApiCode' => 'CuApiCode',
|
||||
'origin' => 'Origin',
|
||||
'ownerId' => 'OwnerId',
|
||||
'resourceOwnerAccount' => 'ResourceOwnerAccount',
|
||||
'resourceOwnerId' => 'ResourceOwnerId',
|
||||
'sceneCode' => 'SceneCode',
|
||||
'url' => 'Url',
|
||||
'version' => 'Version',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->bizType) {
|
||||
$res['BizType'] = $this->bizType;
|
||||
}
|
||||
if (null !== $this->cmApiCode) {
|
||||
$res['CmApiCode'] = $this->cmApiCode;
|
||||
}
|
||||
if (null !== $this->ctApiCode) {
|
||||
$res['CtApiCode'] = $this->ctApiCode;
|
||||
}
|
||||
if (null !== $this->cuApiCode) {
|
||||
$res['CuApiCode'] = $this->cuApiCode;
|
||||
}
|
||||
if (null !== $this->origin) {
|
||||
$res['Origin'] = $this->origin;
|
||||
}
|
||||
if (null !== $this->ownerId) {
|
||||
$res['OwnerId'] = $this->ownerId;
|
||||
}
|
||||
if (null !== $this->resourceOwnerAccount) {
|
||||
$res['ResourceOwnerAccount'] = $this->resourceOwnerAccount;
|
||||
}
|
||||
if (null !== $this->resourceOwnerId) {
|
||||
$res['ResourceOwnerId'] = $this->resourceOwnerId;
|
||||
}
|
||||
if (null !== $this->sceneCode) {
|
||||
$res['SceneCode'] = $this->sceneCode;
|
||||
}
|
||||
if (null !== $this->url) {
|
||||
$res['Url'] = $this->url;
|
||||
}
|
||||
if (null !== $this->version) {
|
||||
$res['Version'] = $this->version;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return GetAuthTokenRequest
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['BizType'])) {
|
||||
$model->bizType = $map['BizType'];
|
||||
}
|
||||
if (isset($map['CmApiCode'])) {
|
||||
$model->cmApiCode = $map['CmApiCode'];
|
||||
}
|
||||
if (isset($map['CtApiCode'])) {
|
||||
$model->ctApiCode = $map['CtApiCode'];
|
||||
}
|
||||
if (isset($map['CuApiCode'])) {
|
||||
$model->cuApiCode = $map['CuApiCode'];
|
||||
}
|
||||
if (isset($map['Origin'])) {
|
||||
$model->origin = $map['Origin'];
|
||||
}
|
||||
if (isset($map['OwnerId'])) {
|
||||
$model->ownerId = $map['OwnerId'];
|
||||
}
|
||||
if (isset($map['ResourceOwnerAccount'])) {
|
||||
$model->resourceOwnerAccount = $map['ResourceOwnerAccount'];
|
||||
}
|
||||
if (isset($map['ResourceOwnerId'])) {
|
||||
$model->resourceOwnerId = $map['ResourceOwnerId'];
|
||||
}
|
||||
if (isset($map['SceneCode'])) {
|
||||
$model->sceneCode = $map['SceneCode'];
|
||||
}
|
||||
if (isset($map['Url'])) {
|
||||
$model->url = $map['Url'];
|
||||
}
|
||||
if (isset($map['Version'])) {
|
||||
$model->version = $map['Version'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
||||
71
vendor/alibabacloud/dypnsapi-20170525/src/Models/GetAuthTokenResponse.php
vendored
Normal file
71
vendor/alibabacloud/dypnsapi-20170525/src/Models/GetAuthTokenResponse.php
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dypnsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class GetAuthTokenResponse extends Model
|
||||
{
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
public $headers;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $statusCode;
|
||||
|
||||
/**
|
||||
* @var GetAuthTokenResponseBody
|
||||
*/
|
||||
public $body;
|
||||
protected $_name = [
|
||||
'headers' => 'headers',
|
||||
'statusCode' => 'statusCode',
|
||||
'body' => 'body',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->headers) {
|
||||
$res['headers'] = $this->headers;
|
||||
}
|
||||
if (null !== $this->statusCode) {
|
||||
$res['statusCode'] = $this->statusCode;
|
||||
}
|
||||
if (null !== $this->body) {
|
||||
$res['body'] = null !== $this->body ? $this->body->toMap() : null;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return GetAuthTokenResponse
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['headers'])) {
|
||||
$model->headers = $map['headers'];
|
||||
}
|
||||
if (isset($map['statusCode'])) {
|
||||
$model->statusCode = $map['statusCode'];
|
||||
}
|
||||
if (isset($map['body'])) {
|
||||
$model->body = GetAuthTokenResponseBody::fromMap($map['body']);
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
||||
101
vendor/alibabacloud/dypnsapi-20170525/src/Models/GetAuthTokenResponseBody.php
vendored
Normal file
101
vendor/alibabacloud/dypnsapi-20170525/src/Models/GetAuthTokenResponseBody.php
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dypnsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\SDK\Dypnsapi\V20170525\Models\GetAuthTokenResponseBody\tokenInfo;
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class GetAuthTokenResponseBody extends Model
|
||||
{
|
||||
/**
|
||||
* @description The response code.
|
||||
*
|
||||
* If OK is returned, the request is successful.
|
||||
* For more information about other error codes, see [API response codes](https://help.aliyun.com/document_detail/85198.html).
|
||||
*
|
||||
* @example OK
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $code;
|
||||
|
||||
/**
|
||||
* @description The returned message.
|
||||
*
|
||||
* @example Success
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $message;
|
||||
|
||||
/**
|
||||
* @description The request ID.
|
||||
*
|
||||
* @example 8906582E-6722
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $requestId;
|
||||
|
||||
/**
|
||||
* @description The response parameters.
|
||||
*
|
||||
* @var tokenInfo
|
||||
*/
|
||||
public $tokenInfo;
|
||||
protected $_name = [
|
||||
'code' => 'Code',
|
||||
'message' => 'Message',
|
||||
'requestId' => 'RequestId',
|
||||
'tokenInfo' => 'TokenInfo',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->code) {
|
||||
$res['Code'] = $this->code;
|
||||
}
|
||||
if (null !== $this->message) {
|
||||
$res['Message'] = $this->message;
|
||||
}
|
||||
if (null !== $this->requestId) {
|
||||
$res['RequestId'] = $this->requestId;
|
||||
}
|
||||
if (null !== $this->tokenInfo) {
|
||||
$res['TokenInfo'] = null !== $this->tokenInfo ? $this->tokenInfo->toMap() : null;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return GetAuthTokenResponseBody
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['Code'])) {
|
||||
$model->code = $map['Code'];
|
||||
}
|
||||
if (isset($map['Message'])) {
|
||||
$model->message = $map['Message'];
|
||||
}
|
||||
if (isset($map['RequestId'])) {
|
||||
$model->requestId = $map['RequestId'];
|
||||
}
|
||||
if (isset($map['TokenInfo'])) {
|
||||
$model->tokenInfo = tokenInfo::fromMap($map['TokenInfo']);
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
||||
69
vendor/alibabacloud/dypnsapi-20170525/src/Models/GetAuthTokenResponseBody/tokenInfo.php
vendored
Normal file
69
vendor/alibabacloud/dypnsapi-20170525/src/Models/GetAuthTokenResponseBody/tokenInfo.php
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dypnsapi\V20170525\Models\GetAuthTokenResponseBody;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class tokenInfo extends Model
|
||||
{
|
||||
/**
|
||||
* @description The business authentication token.
|
||||
*
|
||||
* > AccessToken is valid for 10 minutes and can be used repeatedly within its validity period.
|
||||
* @example agag****
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $accessToken;
|
||||
|
||||
/**
|
||||
* @description The API authentication token.
|
||||
*
|
||||
* > JwtToken is valid for 1 hour and can be used repeatedly within its validity period.
|
||||
* @example aweghd****
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $jwtToken;
|
||||
protected $_name = [
|
||||
'accessToken' => 'AccessToken',
|
||||
'jwtToken' => 'JwtToken',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->accessToken) {
|
||||
$res['AccessToken'] = $this->accessToken;
|
||||
}
|
||||
if (null !== $this->jwtToken) {
|
||||
$res['JwtToken'] = $this->jwtToken;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return tokenInfo
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['AccessToken'])) {
|
||||
$model->accessToken = $map['AccessToken'];
|
||||
}
|
||||
if (isset($map['JwtToken'])) {
|
||||
$model->jwtToken = $map['JwtToken'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
||||
121
vendor/alibabacloud/dypnsapi-20170525/src/Models/GetAuthorizationUrlRequest.php
vendored
Normal file
121
vendor/alibabacloud/dypnsapi-20170525/src/Models/GetAuthorizationUrlRequest.php
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dypnsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class GetAuthorizationUrlRequest extends Model
|
||||
{
|
||||
/**
|
||||
* @description The authorization end date, which is in the yyyy-MM-dd format. This parameter is required for services of contract type.
|
||||
*
|
||||
* @example 2020–12–28
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $endDate;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $ownerId;
|
||||
|
||||
/**
|
||||
* @description The phone number.
|
||||
*
|
||||
* This parameter is required.
|
||||
* @example 1390000****
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $phoneNo;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $resourceOwnerAccount;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $resourceOwnerId;
|
||||
|
||||
/**
|
||||
* @description The ID of the authorization scenario. You can view the ID of the authorization scenario on the **Authorization Scenario Management** page in the **Phone Number Verification Service console**.
|
||||
*
|
||||
* This parameter is required.
|
||||
* @example 234****
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $schemeId;
|
||||
protected $_name = [
|
||||
'endDate' => 'EndDate',
|
||||
'ownerId' => 'OwnerId',
|
||||
'phoneNo' => 'PhoneNo',
|
||||
'resourceOwnerAccount' => 'ResourceOwnerAccount',
|
||||
'resourceOwnerId' => 'ResourceOwnerId',
|
||||
'schemeId' => 'SchemeId',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->endDate) {
|
||||
$res['EndDate'] = $this->endDate;
|
||||
}
|
||||
if (null !== $this->ownerId) {
|
||||
$res['OwnerId'] = $this->ownerId;
|
||||
}
|
||||
if (null !== $this->phoneNo) {
|
||||
$res['PhoneNo'] = $this->phoneNo;
|
||||
}
|
||||
if (null !== $this->resourceOwnerAccount) {
|
||||
$res['ResourceOwnerAccount'] = $this->resourceOwnerAccount;
|
||||
}
|
||||
if (null !== $this->resourceOwnerId) {
|
||||
$res['ResourceOwnerId'] = $this->resourceOwnerId;
|
||||
}
|
||||
if (null !== $this->schemeId) {
|
||||
$res['SchemeId'] = $this->schemeId;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return GetAuthorizationUrlRequest
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['EndDate'])) {
|
||||
$model->endDate = $map['EndDate'];
|
||||
}
|
||||
if (isset($map['OwnerId'])) {
|
||||
$model->ownerId = $map['OwnerId'];
|
||||
}
|
||||
if (isset($map['PhoneNo'])) {
|
||||
$model->phoneNo = $map['PhoneNo'];
|
||||
}
|
||||
if (isset($map['ResourceOwnerAccount'])) {
|
||||
$model->resourceOwnerAccount = $map['ResourceOwnerAccount'];
|
||||
}
|
||||
if (isset($map['ResourceOwnerId'])) {
|
||||
$model->resourceOwnerId = $map['ResourceOwnerId'];
|
||||
}
|
||||
if (isset($map['SchemeId'])) {
|
||||
$model->schemeId = $map['SchemeId'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
||||
71
vendor/alibabacloud/dypnsapi-20170525/src/Models/GetAuthorizationUrlResponse.php
vendored
Normal file
71
vendor/alibabacloud/dypnsapi-20170525/src/Models/GetAuthorizationUrlResponse.php
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dypnsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class GetAuthorizationUrlResponse extends Model
|
||||
{
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
public $headers;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $statusCode;
|
||||
|
||||
/**
|
||||
* @var GetAuthorizationUrlResponseBody
|
||||
*/
|
||||
public $body;
|
||||
protected $_name = [
|
||||
'headers' => 'headers',
|
||||
'statusCode' => 'statusCode',
|
||||
'body' => 'body',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->headers) {
|
||||
$res['headers'] = $this->headers;
|
||||
}
|
||||
if (null !== $this->statusCode) {
|
||||
$res['statusCode'] = $this->statusCode;
|
||||
}
|
||||
if (null !== $this->body) {
|
||||
$res['body'] = null !== $this->body ? $this->body->toMap() : null;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return GetAuthorizationUrlResponse
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['headers'])) {
|
||||
$model->headers = $map['headers'];
|
||||
}
|
||||
if (isset($map['statusCode'])) {
|
||||
$model->statusCode = $map['statusCode'];
|
||||
}
|
||||
if (isset($map['body'])) {
|
||||
$model->body = GetAuthorizationUrlResponseBody::fromMap($map['body']);
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
||||
101
vendor/alibabacloud/dypnsapi-20170525/src/Models/GetAuthorizationUrlResponseBody.php
vendored
Normal file
101
vendor/alibabacloud/dypnsapi-20170525/src/Models/GetAuthorizationUrlResponseBody.php
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dypnsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\SDK\Dypnsapi\V20170525\Models\GetAuthorizationUrlResponseBody\data;
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class GetAuthorizationUrlResponseBody extends Model
|
||||
{
|
||||
/**
|
||||
* @description The response code.
|
||||
*
|
||||
* If OK is returned, the request is successful.
|
||||
* For more information about other error codes, see [API response codes](https://help.aliyun.com/document_detail/85198.html).
|
||||
*
|
||||
* @example OK
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $code;
|
||||
|
||||
/**
|
||||
* @description The response parameters.
|
||||
*
|
||||
* @var data
|
||||
*/
|
||||
public $data;
|
||||
|
||||
/**
|
||||
* @description The returned message.
|
||||
*
|
||||
* @example Success
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $message;
|
||||
|
||||
/**
|
||||
* @description The request ID.
|
||||
*
|
||||
* @example 8906582E-6722
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $requestId;
|
||||
protected $_name = [
|
||||
'code' => 'Code',
|
||||
'data' => 'Data',
|
||||
'message' => 'Message',
|
||||
'requestId' => 'RequestId',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->code) {
|
||||
$res['Code'] = $this->code;
|
||||
}
|
||||
if (null !== $this->data) {
|
||||
$res['Data'] = null !== $this->data ? $this->data->toMap() : null;
|
||||
}
|
||||
if (null !== $this->message) {
|
||||
$res['Message'] = $this->message;
|
||||
}
|
||||
if (null !== $this->requestId) {
|
||||
$res['RequestId'] = $this->requestId;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return GetAuthorizationUrlResponseBody
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['Code'])) {
|
||||
$model->code = $map['Code'];
|
||||
}
|
||||
if (isset($map['Data'])) {
|
||||
$model->data = data::fromMap($map['Data']);
|
||||
}
|
||||
if (isset($map['Message'])) {
|
||||
$model->message = $map['Message'];
|
||||
}
|
||||
if (isset($map['RequestId'])) {
|
||||
$model->requestId = $map['RequestId'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
||||
51
vendor/alibabacloud/dypnsapi-20170525/src/Models/GetAuthorizationUrlResponseBody/data.php
vendored
Normal file
51
vendor/alibabacloud/dypnsapi-20170525/src/Models/GetAuthorizationUrlResponseBody/data.php
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dypnsapi\V20170525\Models\GetAuthorizationUrlResponseBody;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class data extends Model
|
||||
{
|
||||
/**
|
||||
* @description The authorization URL.
|
||||
*
|
||||
* @example https://render.****.com/p/s/web-call-minapp/auth-bao?page=commauth/index&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJiaXpUeXBlIjoiQ29tbUF1dGgiLCJiaXpJZCI6IjVmNWZjNjAzZDQzMTQ0MWZiYTZiNjYzM2QyMjIyNzU0IiwiZXhwIjoxNjA4MTkxODQxfQ.5IvBj2nKgr60APtotaIB13vtPVrdsPQ6avIfWxte1pA&_env=prod
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $authorizationUrl;
|
||||
protected $_name = [
|
||||
'authorizationUrl' => 'AuthorizationUrl',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->authorizationUrl) {
|
||||
$res['AuthorizationUrl'] = $this->authorizationUrl;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return data
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['AuthorizationUrl'])) {
|
||||
$model->authorizationUrl = $map['AuthorizationUrl'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
||||
170
vendor/alibabacloud/dypnsapi-20170525/src/Models/GetFusionAuthTokenRequest.php
vendored
Normal file
170
vendor/alibabacloud/dypnsapi-20170525/src/Models/GetFusionAuthTokenRequest.php
vendored
Normal file
@@ -0,0 +1,170 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dypnsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class GetFusionAuthTokenRequest extends Model
|
||||
{
|
||||
/**
|
||||
* @description The bundle ID of the app. This parameter is required when Platform is set to iOS.
|
||||
*
|
||||
* @example com.example.test
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $bundleId;
|
||||
|
||||
/**
|
||||
* @description The validity period of the token. Unit: seconds. Valid values: 900 to 43200.
|
||||
*
|
||||
* This parameter is required.
|
||||
* @example 900
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $durationSeconds;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $ownerId;
|
||||
|
||||
/**
|
||||
* @description The package name of the app. This parameter is required when Platform is set to Android.
|
||||
*
|
||||
* @example com.example.test
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $packageName;
|
||||
|
||||
/**
|
||||
* @description The package signature of the app. This parameter is required when Platform is set to Android.
|
||||
*
|
||||
* @example 47fcc************************278
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $packageSign;
|
||||
|
||||
/**
|
||||
* @description The platform type. Valid values: Android and iOS.
|
||||
*
|
||||
* This parameter is required.
|
||||
* @example Android
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $platform;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $resourceOwnerAccount;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $resourceOwnerId;
|
||||
|
||||
/**
|
||||
* @description The service code.
|
||||
*
|
||||
* This parameter is required.
|
||||
* @example FA1000*************201
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $schemeCode;
|
||||
protected $_name = [
|
||||
'bundleId' => 'BundleId',
|
||||
'durationSeconds' => 'DurationSeconds',
|
||||
'ownerId' => 'OwnerId',
|
||||
'packageName' => 'PackageName',
|
||||
'packageSign' => 'PackageSign',
|
||||
'platform' => 'Platform',
|
||||
'resourceOwnerAccount' => 'ResourceOwnerAccount',
|
||||
'resourceOwnerId' => 'ResourceOwnerId',
|
||||
'schemeCode' => 'SchemeCode',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->bundleId) {
|
||||
$res['BundleId'] = $this->bundleId;
|
||||
}
|
||||
if (null !== $this->durationSeconds) {
|
||||
$res['DurationSeconds'] = $this->durationSeconds;
|
||||
}
|
||||
if (null !== $this->ownerId) {
|
||||
$res['OwnerId'] = $this->ownerId;
|
||||
}
|
||||
if (null !== $this->packageName) {
|
||||
$res['PackageName'] = $this->packageName;
|
||||
}
|
||||
if (null !== $this->packageSign) {
|
||||
$res['PackageSign'] = $this->packageSign;
|
||||
}
|
||||
if (null !== $this->platform) {
|
||||
$res['Platform'] = $this->platform;
|
||||
}
|
||||
if (null !== $this->resourceOwnerAccount) {
|
||||
$res['ResourceOwnerAccount'] = $this->resourceOwnerAccount;
|
||||
}
|
||||
if (null !== $this->resourceOwnerId) {
|
||||
$res['ResourceOwnerId'] = $this->resourceOwnerId;
|
||||
}
|
||||
if (null !== $this->schemeCode) {
|
||||
$res['SchemeCode'] = $this->schemeCode;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return GetFusionAuthTokenRequest
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['BundleId'])) {
|
||||
$model->bundleId = $map['BundleId'];
|
||||
}
|
||||
if (isset($map['DurationSeconds'])) {
|
||||
$model->durationSeconds = $map['DurationSeconds'];
|
||||
}
|
||||
if (isset($map['OwnerId'])) {
|
||||
$model->ownerId = $map['OwnerId'];
|
||||
}
|
||||
if (isset($map['PackageName'])) {
|
||||
$model->packageName = $map['PackageName'];
|
||||
}
|
||||
if (isset($map['PackageSign'])) {
|
||||
$model->packageSign = $map['PackageSign'];
|
||||
}
|
||||
if (isset($map['Platform'])) {
|
||||
$model->platform = $map['Platform'];
|
||||
}
|
||||
if (isset($map['ResourceOwnerAccount'])) {
|
||||
$model->resourceOwnerAccount = $map['ResourceOwnerAccount'];
|
||||
}
|
||||
if (isset($map['ResourceOwnerId'])) {
|
||||
$model->resourceOwnerId = $map['ResourceOwnerId'];
|
||||
}
|
||||
if (isset($map['SchemeCode'])) {
|
||||
$model->schemeCode = $map['SchemeCode'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
||||
71
vendor/alibabacloud/dypnsapi-20170525/src/Models/GetFusionAuthTokenResponse.php
vendored
Normal file
71
vendor/alibabacloud/dypnsapi-20170525/src/Models/GetFusionAuthTokenResponse.php
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dypnsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class GetFusionAuthTokenResponse extends Model
|
||||
{
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
public $headers;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $statusCode;
|
||||
|
||||
/**
|
||||
* @var GetFusionAuthTokenResponseBody
|
||||
*/
|
||||
public $body;
|
||||
protected $_name = [
|
||||
'headers' => 'headers',
|
||||
'statusCode' => 'statusCode',
|
||||
'body' => 'body',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->headers) {
|
||||
$res['headers'] = $this->headers;
|
||||
}
|
||||
if (null !== $this->statusCode) {
|
||||
$res['statusCode'] = $this->statusCode;
|
||||
}
|
||||
if (null !== $this->body) {
|
||||
$res['body'] = null !== $this->body ? $this->body->toMap() : null;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return GetFusionAuthTokenResponse
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['headers'])) {
|
||||
$model->headers = $map['headers'];
|
||||
}
|
||||
if (isset($map['statusCode'])) {
|
||||
$model->statusCode = $map['statusCode'];
|
||||
}
|
||||
if (isset($map['body'])) {
|
||||
$model->body = GetFusionAuthTokenResponseBody::fromMap($map['body']);
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
||||
115
vendor/alibabacloud/dypnsapi-20170525/src/Models/GetFusionAuthTokenResponseBody.php
vendored
Normal file
115
vendor/alibabacloud/dypnsapi-20170525/src/Models/GetFusionAuthTokenResponseBody.php
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dypnsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class GetFusionAuthTokenResponseBody extends Model
|
||||
{
|
||||
/**
|
||||
* @description The response code. If OK is returned, the request is successful. Other values indicate that the request failed. For more information, see Error codes.
|
||||
*
|
||||
* @example OK
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $code;
|
||||
|
||||
/**
|
||||
* @description The returned message.
|
||||
*
|
||||
* @example Success
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $message;
|
||||
|
||||
/**
|
||||
* @description The authentication code. The value of this parameter is a string.
|
||||
*
|
||||
* @example FKcksloqk***********jalEc+
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $model;
|
||||
|
||||
/**
|
||||
* @description The request ID, which is used to locate and troubleshoot issues.
|
||||
*
|
||||
* @example CC3BB6D2-2FDF-4321-9DCE-B38165CE4C47
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $requestId;
|
||||
|
||||
/**
|
||||
* @description Indicates whether the request is successful. Valid values: true false
|
||||
*
|
||||
* @example false
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $success;
|
||||
protected $_name = [
|
||||
'code' => 'Code',
|
||||
'message' => 'Message',
|
||||
'model' => 'Model',
|
||||
'requestId' => 'RequestId',
|
||||
'success' => 'Success',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->code) {
|
||||
$res['Code'] = $this->code;
|
||||
}
|
||||
if (null !== $this->message) {
|
||||
$res['Message'] = $this->message;
|
||||
}
|
||||
if (null !== $this->model) {
|
||||
$res['Model'] = $this->model;
|
||||
}
|
||||
if (null !== $this->requestId) {
|
||||
$res['RequestId'] = $this->requestId;
|
||||
}
|
||||
if (null !== $this->success) {
|
||||
$res['Success'] = $this->success;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return GetFusionAuthTokenResponseBody
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['Code'])) {
|
||||
$model->code = $map['Code'];
|
||||
}
|
||||
if (isset($map['Message'])) {
|
||||
$model->message = $map['Message'];
|
||||
}
|
||||
if (isset($map['Model'])) {
|
||||
$model->model = $map['Model'];
|
||||
}
|
||||
if (isset($map['RequestId'])) {
|
||||
$model->requestId = $map['RequestId'];
|
||||
}
|
||||
if (isset($map['Success'])) {
|
||||
$model->success = $map['Success'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
||||
104
vendor/alibabacloud/dypnsapi-20170525/src/Models/GetMobileRequest.php
vendored
Normal file
104
vendor/alibabacloud/dypnsapi-20170525/src/Models/GetMobileRequest.php
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dypnsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class GetMobileRequest extends Model
|
||||
{
|
||||
/**
|
||||
* @description The logon token obtained by the SDK for your app.
|
||||
*
|
||||
* This parameter is required.
|
||||
* @example Dfafdafad5422****
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $accessToken;
|
||||
|
||||
/**
|
||||
* @description The external ID.
|
||||
*
|
||||
* @example 22345****
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $outId;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $ownerId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $resourceOwnerAccount;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $resourceOwnerId;
|
||||
protected $_name = [
|
||||
'accessToken' => 'AccessToken',
|
||||
'outId' => 'OutId',
|
||||
'ownerId' => 'OwnerId',
|
||||
'resourceOwnerAccount' => 'ResourceOwnerAccount',
|
||||
'resourceOwnerId' => 'ResourceOwnerId',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->accessToken) {
|
||||
$res['AccessToken'] = $this->accessToken;
|
||||
}
|
||||
if (null !== $this->outId) {
|
||||
$res['OutId'] = $this->outId;
|
||||
}
|
||||
if (null !== $this->ownerId) {
|
||||
$res['OwnerId'] = $this->ownerId;
|
||||
}
|
||||
if (null !== $this->resourceOwnerAccount) {
|
||||
$res['ResourceOwnerAccount'] = $this->resourceOwnerAccount;
|
||||
}
|
||||
if (null !== $this->resourceOwnerId) {
|
||||
$res['ResourceOwnerId'] = $this->resourceOwnerId;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return GetMobileRequest
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['AccessToken'])) {
|
||||
$model->accessToken = $map['AccessToken'];
|
||||
}
|
||||
if (isset($map['OutId'])) {
|
||||
$model->outId = $map['OutId'];
|
||||
}
|
||||
if (isset($map['OwnerId'])) {
|
||||
$model->ownerId = $map['OwnerId'];
|
||||
}
|
||||
if (isset($map['ResourceOwnerAccount'])) {
|
||||
$model->resourceOwnerAccount = $map['ResourceOwnerAccount'];
|
||||
}
|
||||
if (isset($map['ResourceOwnerId'])) {
|
||||
$model->resourceOwnerId = $map['ResourceOwnerId'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user