新增阿里云视频直播接口

This commit is contained in:
yaooo 2023-10-16 19:30:11 +08:00
parent 7824b551f7
commit 14b98eefd5
1464 changed files with 11 additions and 134844 deletions
composer.jsoncomposer.lock
vendor/alibabacloud
credentials
darabonba-openapi
endpoint-util
gateway-spi
live-20161101

@ -43,8 +43,7 @@
"workerman/gatewayclient": "^3.0",
"jpush/jpush": "^3.6",
"topthink/think-filesystem": "^2.0",
"alibabacloud/live": "^1.8",
"alibabacloud/live-20161101": "1.1.1"
"alibabacloud/live": "^1.8"
},
"require-dev": {
"symfony/var-dumper": "^4.2",

561
composer.lock generated

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "df2314f832b2603d5d7eb0b31b84ae66",
"content-hash": "0ba9392aaf4e23b4c1f1d571084d8951",
"packages": [
{
"name": "adbario/php-dot-notation",
@ -155,237 +155,6 @@
},
"time": "2022-12-09T04:05:55+00:00"
},
{
"name": "alibabacloud/credentials",
"version": "1.1.5",
"source": {
"type": "git",
"url": "https://github.com/aliyun/credentials-php.git",
"reference": "1d8383ceef695974a88a3859c42e235fd2e3981a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/aliyun/credentials-php/zipball/1d8383ceef695974a88a3859c42e235fd2e3981a",
"reference": "1d8383ceef695974a88a3859c42e235fd2e3981a",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"adbario/php-dot-notation": "^2.2",
"alibabacloud/tea": "^3.0",
"ext-curl": "*",
"ext-json": "*",
"ext-libxml": "*",
"ext-mbstring": "*",
"ext-openssl": "*",
"ext-simplexml": "*",
"ext-xmlwriter": "*",
"guzzlehttp/guzzle": "^6.3|^7.0",
"php": ">=5.6"
},
"require-dev": {
"composer/composer": "^1.8",
"drupal/coder": "^8.3",
"ext-dom": "*",
"ext-pcre": "*",
"ext-sockets": "*",
"ext-spl": "*",
"mikey179/vfsstream": "^1.6",
"monolog/monolog": "^1.24",
"phpunit/phpunit": "^5.7|^6.6|^7.5",
"psr/cache": "^1.0",
"symfony/dotenv": "^3.4",
"symfony/var-dumper": "^3.4"
},
"suggest": {
"ext-sockets": "To use client-side monitoring"
},
"type": "library",
"autoload": {
"psr-4": {
"AlibabaCloud\\Credentials\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Alibaba Cloud SDK",
"email": "sdk-team@alibabacloud.com",
"homepage": "http://www.alibabacloud.com"
}
],
"description": "Alibaba Cloud Credentials for PHP",
"homepage": "https://www.alibabacloud.com/",
"keywords": [
"alibaba",
"alibabacloud",
"aliyun",
"client",
"cloud",
"credentials",
"library",
"sdk",
"tool"
],
"support": {
"issues": "https://github.com/aliyun/credentials-php/issues",
"source": "https://github.com/aliyun/credentials-php"
},
"time": "2023-04-11T02:12:12+00:00"
},
{
"name": "alibabacloud/darabonba-openapi",
"version": "0.2.9",
"source": {
"type": "git",
"url": "https://github.com/alibabacloud-sdk-php/darabonba-openapi.git",
"reference": "4cdfc36615f345786d668dfbaf68d9a301b6dbe2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/alibabacloud-sdk-php/darabonba-openapi/zipball/4cdfc36615f345786d668dfbaf68d9a301b6dbe2",
"reference": "4cdfc36615f345786d668dfbaf68d9a301b6dbe2",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"alibabacloud/credentials": "^1.1",
"alibabacloud/gateway-spi": "^1",
"alibabacloud/openapi-util": "^0.1.10|^0.2.1",
"alibabacloud/tea-utils": "^0.2.17",
"alibabacloud/tea-xml": "^0.2",
"php": ">5.5"
},
"type": "library",
"autoload": {
"psr-4": {
"Darabonba\\OpenApi\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Alibaba Cloud SDK",
"email": "sdk-team@alibabacloud.com"
}
],
"description": "Alibaba Cloud OpenApi Client",
"support": {
"issues": "https://github.com/alibabacloud-sdk-php/darabonba-openapi/issues",
"source": "https://github.com/alibabacloud-sdk-php/darabonba-openapi/tree/0.2.9"
},
"time": "2023-02-06T12:02:21+00:00"
},
{
"name": "alibabacloud/endpoint-util",
"version": "0.1.1",
"source": {
"type": "git",
"url": "https://github.com/alibabacloud-sdk-php/endpoint-util.git",
"reference": "f3fe88a25d8df4faa3b0ae14ff202a9cc094e6c5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/alibabacloud-sdk-php/endpoint-util/zipball/f3fe88a25d8df4faa3b0ae14ff202a9cc094e6c5",
"reference": "f3fe88a25d8df4faa3b0ae14ff202a9cc094e6c5",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">5.5"
},
"require-dev": {
"phpunit/phpunit": "^4.8.35|^5.4.3"
},
"type": "library",
"autoload": {
"psr-4": {
"AlibabaCloud\\Endpoint\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Alibaba Cloud SDK",
"email": "sdk-team@alibabacloud.com"
}
],
"description": "Alibaba Cloud Endpoint Library for PHP",
"support": {
"source": "https://github.com/alibabacloud-sdk-php/endpoint-util/tree/0.1.1"
},
"time": "2020-06-04T10:57:15+00:00"
},
{
"name": "alibabacloud/gateway-spi",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/alibabacloud-sdk-php/alibabacloud-gateway-spi.git",
"reference": "7440f77750c329d8ab252db1d1d967314ccd1fcb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/alibabacloud-sdk-php/alibabacloud-gateway-spi/zipball/7440f77750c329d8ab252db1d1d967314ccd1fcb",
"reference": "7440f77750c329d8ab252db1d1d967314ccd1fcb",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"alibabacloud/credentials": "^1.1",
"php": ">5.5"
},
"type": "library",
"autoload": {
"psr-4": {
"Darabonba\\GatewaySpi\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Alibaba Cloud SDK",
"email": "sdk-team@alibabacloud.com"
}
],
"description": "Alibaba Cloud Gateway SPI Client",
"support": {
"source": "https://github.com/alibabacloud-sdk-php/alibabacloud-gateway-spi/tree/1.0.0"
},
"time": "2022-07-14T05:31:35+00:00"
},
{
"name": "alibabacloud/live",
"version": "1.8.958",
@ -444,274 +213,6 @@
},
"time": "2021-04-29T09:14:45+00:00"
},
{
"name": "alibabacloud/live-20161101",
"version": "1.1.1",
"source": {
"type": "git",
"url": "https://github.com/alibabacloud-sdk-php/live-20161101.git",
"reference": "6aa9436929b8d8d2b5a51daeca7227ebc88e1717"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/alibabacloud-sdk-php/live-20161101/zipball/6aa9436929b8d8d2b5a51daeca7227ebc88e1717",
"reference": "6aa9436929b8d8d2b5a51daeca7227ebc88e1717",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"alibabacloud/darabonba-openapi": "^0.2.8",
"alibabacloud/endpoint-util": "^0.1.0",
"alibabacloud/openapi-util": "^0.1.10|^0.2.0",
"alibabacloud/tea-utils": "^0.2.17",
"php": ">5.5"
},
"type": "library",
"autoload": {
"psr-4": {
"AlibabaCloud\\SDK\\Live\\V20161101\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Alibaba Cloud SDK",
"email": "sdk-team@alibabacloud.com"
}
],
"description": "Alibaba Cloud ApsaraVideo for Live (20161101) SDK Library for PHP",
"support": {
"source": "https://github.com/alibabacloud-sdk-php/live-20161101/tree/1.1.1"
},
"time": "2022-12-05T03:08:45+00:00"
},
{
"name": "alibabacloud/openapi-util",
"version": "0.2.1",
"source": {
"type": "git",
"url": "https://github.com/alibabacloud-sdk-php/openapi-util.git",
"reference": "f31f7bcd835e08ca24b6b8ba33637eb4eceb093a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/alibabacloud-sdk-php/openapi-util/zipball/f31f7bcd835e08ca24b6b8ba33637eb4eceb093a",
"reference": "f31f7bcd835e08ca24b6b8ba33637eb4eceb093a",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"alibabacloud/tea": "^3.1",
"alibabacloud/tea-utils": "^0.2",
"lizhichao/one-sm": "^1.5",
"php": ">5.5"
},
"require-dev": {
"phpunit/phpunit": "*"
},
"type": "library",
"autoload": {
"psr-4": {
"AlibabaCloud\\OpenApiUtil\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Alibaba Cloud SDK",
"email": "sdk-team@alibabacloud.com"
}
],
"description": "Alibaba Cloud OpenApi Util",
"support": {
"issues": "https://github.com/alibabacloud-sdk-php/openapi-util/issues",
"source": "https://github.com/alibabacloud-sdk-php/openapi-util/tree/0.2.1"
},
"time": "2023-01-10T09:10:10+00:00"
},
{
"name": "alibabacloud/tea",
"version": "3.2.1",
"source": {
"type": "git",
"url": "https://github.com/aliyun/tea-php.git",
"reference": "1619cb96c158384f72b873e1f85de8b299c9c367"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/aliyun/tea-php/zipball/1619cb96c158384f72b873e1f85de8b299c9c367",
"reference": "1619cb96c158384f72b873e1f85de8b299c9c367",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"adbario/php-dot-notation": "^2.4",
"ext-curl": "*",
"ext-json": "*",
"ext-libxml": "*",
"ext-mbstring": "*",
"ext-openssl": "*",
"ext-simplexml": "*",
"ext-xmlwriter": "*",
"guzzlehttp/guzzle": "^6.3|^7.0",
"php": ">=5.5"
},
"require-dev": {
"phpunit/phpunit": "*",
"symfony/dotenv": "^3.4",
"symfony/var-dumper": "^3.4"
},
"suggest": {
"ext-sockets": "To use client-side monitoring"
},
"type": "library",
"autoload": {
"psr-4": {
"AlibabaCloud\\Tea\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Alibaba Cloud SDK",
"email": "sdk-team@alibabacloud.com",
"homepage": "http://www.alibabacloud.com"
}
],
"description": "Client of Tea for PHP",
"homepage": "https://www.alibabacloud.com/",
"keywords": [
"alibabacloud",
"client",
"cloud",
"tea"
],
"support": {
"issues": "https://github.com/aliyun/tea-php/issues",
"source": "https://github.com/aliyun/tea-php"
},
"time": "2023-05-16T06:43:41+00:00"
},
{
"name": "alibabacloud/tea-utils",
"version": "0.2.19",
"source": {
"type": "git",
"url": "https://github.com/alibabacloud-sdk-php/tea-utils.git",
"reference": "8dfc1a93e9415818e93a621b644abbb84981aea4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/alibabacloud-sdk-php/tea-utils/zipball/8dfc1a93e9415818e93a621b644abbb84981aea4",
"reference": "8dfc1a93e9415818e93a621b644abbb84981aea4",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"alibabacloud/tea": "^3.1",
"php": ">5.5"
},
"type": "library",
"autoload": {
"psr-4": {
"AlibabaCloud\\Tea\\Utils\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Alibaba Cloud SDK",
"email": "sdk-team@alibabacloud.com"
}
],
"description": "Alibaba Cloud Tea Utils for PHP",
"support": {
"issues": "https://github.com/aliyun/tea-util/issues",
"source": "https://github.com/aliyun/tea-util"
},
"time": "2023-06-26T09:49:19+00:00"
},
{
"name": "alibabacloud/tea-xml",
"version": "0.2.4",
"source": {
"type": "git",
"url": "https://github.com/alibabacloud-sdk-php/tea-xml.git",
"reference": "3e0c000bf536224eebbac913c371bef174c0a16a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/alibabacloud-sdk-php/tea-xml/zipball/3e0c000bf536224eebbac913c371bef174c0a16a",
"reference": "3e0c000bf536224eebbac913c371bef174c0a16a",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">5.5"
},
"require-dev": {
"phpunit/phpunit": "*",
"symfony/var-dumper": "*"
},
"type": "library",
"autoload": {
"psr-4": {
"AlibabaCloud\\Tea\\XML\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Alibaba Cloud SDK",
"email": "sdk-team@alibabacloud.com"
}
],
"description": "Alibaba Cloud Tea XML Library for PHP",
"support": {
"source": "https://github.com/alibabacloud-sdk-php/tea-xml/tree/0.2.4"
},
"time": "2022-08-02T04:12:58+00:00"
},
{
"name": "aliyuncs/oss-sdk-php",
"version": "v2.6.0",
@ -1794,66 +1295,6 @@
],
"time": "2023-08-05T12:09:49+00:00"
},
{
"name": "lizhichao/one-sm",
"version": "1.10",
"source": {
"type": "git",
"url": "https://github.com/lizhichao/sm.git",
"reference": "687a012a44a5bfd4d9143a0234e1060543be455a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/lizhichao/sm/zipball/687a012a44a5bfd4d9143a0234e1060543be455a",
"reference": "687a012a44a5bfd4d9143a0234e1060543be455a",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">=5.6"
},
"type": "library",
"autoload": {
"psr-4": {
"OneSm\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "tanszhe",
"email": "1018595261@qq.com"
}
],
"description": "国密sm3",
"keywords": [
"php",
"sm3"
],
"support": {
"issues": "https://github.com/lizhichao/sm/issues",
"source": "https://github.com/lizhichao/sm/tree/1.10"
},
"funding": [
{
"url": "https://www.vicsdf.com/img/w.jpg",
"type": "custom"
},
{
"url": "https://www.vicsdf.com/img/z.jpg",
"type": "custom"
}
],
"time": "2021-05-26T06:19:22+00:00"
},
{
"name": "maennchen/zipstream-php",
"version": "2.4.0",

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

@ -1,30 +0,0 @@
# 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

@ -1,13 +0,0 @@
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.

@ -1,88 +0,0 @@
# 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.

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

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

@ -1,21 +0,0 @@
# 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.

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

@ -1,107 +0,0 @@
{
"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|^7.5",
"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/*"
}
}

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

@ -1,53 +0,0 @@
<?php
namespace AlibabaCloud\Credentials;
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();
}
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -1,47 +0,0 @@
<?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 '';
}
}

@ -1,47 +0,0 @@
<?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));
}
}

@ -1,47 +0,0 @@
<?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));
}
}

@ -1,64 +0,0 @@
<?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);
}
}

@ -1,34 +0,0 @@
<?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();
}

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

@ -1,15 +0,0 @@
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

@ -1,65 +0,0 @@
<?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__)
);

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

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

@ -1,15 +0,0 @@
<?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;
});

@ -1,34 +0,0 @@
{
"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.17",
"alibabacloud/credentials": "^1.1",
"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
}

@ -1,424 +0,0 @@
<?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' => '',
'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' => '',
];
public function validate()
{
}
public function toMap()
{
$res = [];
if (null !== $this->accessKeyId) {
$res['accessKeyId'] = $this->accessKeyId;
}
if (null !== $this->accessKeySecret) {
$res['accessKeySecret'] = $this->accessKeySecret;
}
if (null !== $this->securityToken) {
$res['securityToken'] = $this->securityToken;
}
if (null !== $this->protocol) {
$res['protocol'] = $this->protocol;
}
if (null !== $this->method) {
$res['method'] = $this->method;
}
if (null !== $this->regionId) {
$res['regionId'] = $this->regionId;
}
if (null !== $this->readTimeout) {
$res['readTimeout'] = $this->readTimeout;
}
if (null !== $this->connectTimeout) {
$res['connectTimeout'] = $this->connectTimeout;
}
if (null !== $this->httpProxy) {
$res['httpProxy'] = $this->httpProxy;
}
if (null !== $this->httpsProxy) {
$res['httpsProxy'] = $this->httpsProxy;
}
if (null !== $this->credential) {
$res['credential'] = null !== $this->credential ? $this->credential->toMap() : null;
}
if (null !== $this->endpoint) {
$res['endpoint'] = $this->endpoint;
}
if (null !== $this->noProxy) {
$res['noProxy'] = $this->noProxy;
}
if (null !== $this->maxIdleConns) {
$res['maxIdleConns'] = $this->maxIdleConns;
}
if (null !== $this->network) {
$res['network'] = $this->network;
}
if (null !== $this->userAgent) {
$res['userAgent'] = $this->userAgent;
}
if (null !== $this->suffix) {
$res['suffix'] = $this->suffix;
}
if (null !== $this->socks5Proxy) {
$res['socks5Proxy'] = $this->socks5Proxy;
}
if (null !== $this->socks5NetWork) {
$res['socks5NetWork'] = $this->socks5NetWork;
}
if (null !== $this->endpointType) {
$res['endpointType'] = $this->endpointType;
}
if (null !== $this->openPlatformEndpoint) {
$res['openPlatformEndpoint'] = $this->openPlatformEndpoint;
}
if (null !== $this->type) {
$res['type'] = $this->type;
}
if (null !== $this->signatureVersion) {
$res['signatureVersion'] = $this->signatureVersion;
}
if (null !== $this->signatureAlgorithm) {
$res['signatureAlgorithm'] = $this->signatureAlgorithm;
}
if (null !== $this->globalParameters) {
$res['globalParameters'] = null !== $this->globalParameters ? $this->globalParameters->toMap() : null;
}
if (null !== $this->key) {
$res['key'] = $this->key;
}
if (null !== $this->cert) {
$res['cert'] = $this->cert;
}
if (null !== $this->ca) {
$res['ca'] = $this->ca;
}
return $res;
}
/**
* @param array $map
* @return Config
*/
public static function fromMap($map = [])
{
$model = new self();
if (isset($map['accessKeyId'])) {
$model->accessKeyId = $map['accessKeyId'];
}
if (isset($map['accessKeySecret'])) {
$model->accessKeySecret = $map['accessKeySecret'];
}
if (isset($map['securityToken'])) {
$model->securityToken = $map['securityToken'];
}
if (isset($map['protocol'])) {
$model->protocol = $map['protocol'];
}
if (isset($map['method'])) {
$model->method = $map['method'];
}
if (isset($map['regionId'])) {
$model->regionId = $map['regionId'];
}
if (isset($map['readTimeout'])) {
$model->readTimeout = $map['readTimeout'];
}
if (isset($map['connectTimeout'])) {
$model->connectTimeout = $map['connectTimeout'];
}
if (isset($map['httpProxy'])) {
$model->httpProxy = $map['httpProxy'];
}
if (isset($map['httpsProxy'])) {
$model->httpsProxy = $map['httpsProxy'];
}
if (isset($map['credential'])) {
$model->credential = Credential::fromMap($map['credential']);
}
if (isset($map['endpoint'])) {
$model->endpoint = $map['endpoint'];
}
if (isset($map['noProxy'])) {
$model->noProxy = $map['noProxy'];
}
if (isset($map['maxIdleConns'])) {
$model->maxIdleConns = $map['maxIdleConns'];
}
if (isset($map['network'])) {
$model->network = $map['network'];
}
if (isset($map['userAgent'])) {
$model->userAgent = $map['userAgent'];
}
if (isset($map['suffix'])) {
$model->suffix = $map['suffix'];
}
if (isset($map['socks5Proxy'])) {
$model->socks5Proxy = $map['socks5Proxy'];
}
if (isset($map['socks5NetWork'])) {
$model->socks5NetWork = $map['socks5NetWork'];
}
if (isset($map['endpointType'])) {
$model->endpointType = $map['endpointType'];
}
if (isset($map['openPlatformEndpoint'])) {
$model->openPlatformEndpoint = $map['openPlatformEndpoint'];
}
if (isset($map['type'])) {
$model->type = $map['type'];
}
if (isset($map['signatureVersion'])) {
$model->signatureVersion = $map['signatureVersion'];
}
if (isset($map['signatureAlgorithm'])) {
$model->signatureAlgorithm = $map['signatureAlgorithm'];
}
if (isset($map['globalParameters'])) {
$model->globalParameters = GlobalParameters::fromMap($map['globalParameters']);
}
if (isset($map['key'])) {
$model->key = $map['key'];
}
if (isset($map['cert'])) {
$model->cert = $map['cert'];
}
if (isset($map['ca'])) {
$model->ca = $map['ca'];
}
return $model;
}
/**
* @description accesskey id
* @var string
*/
public $accessKeyId;
/**
* @description accesskey secret
* @var string
*/
public $accessKeySecret;
/**
* @description security token
* @example a.txt
* @var string
*/
public $securityToken;
/**
* @description http protocol
* @example http
* @var string
*/
public $protocol;
/**
* @description http method
* @example GET
* @var string
*/
public $method;
/**
* @description region id
* @example cn-hangzhou
* @var string
*/
public $regionId;
/**
* @description read timeout
* @example 10
* @var int
*/
public $readTimeout;
/**
* @description connect timeout
* @example 10
* @var int
*/
public $connectTimeout;
/**
* @description http proxy
* @example http://localhost
* @var string
*/
public $httpProxy;
/**
* @description https proxy
* @example https://localhost
* @var string
*/
public $httpsProxy;
/**
* @description credential
* @example
* @var Credential
*/
public $credential;
/**
* @description endpoint
* @example cs.aliyuncs.com
* @var string
*/
public $endpoint;
/**
* @description proxy white list
* @example http://localhost
* @var string
*/
public $noProxy;
/**
* @description max idle conns
* @example 3
* @var int
*/
public $maxIdleConns;
/**
* @description network for endpoint
* @example public
* @var string
*/
public $network;
/**
* @description user agent
* @example Alibabacloud/1
* @var string
*/
public $userAgent;
/**
* @description suffix for endpoint
* @example aliyun
* @var string
*/
public $suffix;
/**
* @description socks5 proxy
* @var string
*/
public $socks5Proxy;
/**
* @description socks5 network
* @example TCP
* @var string
*/
public $socks5NetWork;
/**
* @description endpoint type
* @example internal
* @var string
*/
public $endpointType;
/**
* @description OpenPlatform endpoint
* @example openplatform.aliyuncs.com
* @var string
*/
public $openPlatformEndpoint;
/**
* @description credential type
* @example access_key
* @deprecated
* @var string
*/
public $type;
/**
* @description Signature Version
* @example v1
* @var string
*/
public $signatureVersion;
/**
* @description Signature Algorithm
* @example ACS3-HMAC-SHA256
* @var string
*/
public $signatureAlgorithm;
/**
* @description Global Parameters
* @var GlobalParameters
*/
public $globalParameters;
/**
* @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;
}

@ -1,42 +0,0 @@
<?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;
}

@ -1,74 +0,0 @@
<?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;
}

@ -1,130 +0,0 @@
<?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;
}

File diff suppressed because it is too large Load Diff

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

@ -1,65 +0,0 @@
<?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__)
);

@ -1,13 +0,0 @@
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.

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

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

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

@ -1,32 +0,0 @@
<?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>

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

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

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

@ -1,15 +0,0 @@
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

@ -1,65 +0,0 @@
<?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__)
);

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

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

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

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

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

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

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

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

@ -1,15 +0,0 @@
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

@ -1,65 +0,0 @@
<?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__)
);

@ -1,18 +0,0 @@
2022-12-05 Version: 1.1.1
- Live sdk update.
2022-12-05 Version: 1.1.0
- Live sdk update.
2022-10-31 Version: 1.0.2
- Live pre sdk test.
2021-04-23 Version: 1.0.1
- Generated php 2016-11-01 for live.
2021-01-10 Version: 1.0.0
- Generated php 2016-11-01 for live.
2020-11-16 Version: 0.0.1
- Generated php 2016-11-01 for live.

@ -1,201 +0,0 @@
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.

@ -1,35 +0,0 @@
[English](README.md) | 简体中文
![](https://aliyunsdk-pages.alicdn.com/icons/AlibabaCloud.svg)
# Alibaba Cloud live SDK for PHP
## 安装
### Composer
```bash
composer require alibabacloud/live-20161101
```
## 问题
[提交 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.

@ -1,35 +0,0 @@
English | [简体中文](README-CN.md)
![](https://aliyunsdk-pages.alicdn.com/icons/AlibabaCloud.svg)
# Alibaba Cloud live SDK for PHP
## Installation
### Composer
```bash
composer require alibabacloud/live-20161101
```
## 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.

@ -1,17 +0,0 @@
<?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\\Live\\V20161101\\', '', $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;
});

@ -1,33 +0,0 @@
{
"name": "alibabacloud/live-20161101",
"description": "Alibaba Cloud ApsaraVideo for Live (20161101) 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.17",
"alibabacloud/darabonba-openapi": "^0.2.8",
"alibabacloud/openapi-util": "^0.1.10|^0.2.0",
"alibabacloud/endpoint-util": "^0.1.0"
},
"autoload": {
"psr-4": {
"AlibabaCloud\\SDK\\Live\\V20161101\\": "src"
}
},
"scripts": {
"fixer": "php-cs-fixer fix ./"
},
"config": {
"sort-packages": true,
"preferred-install": "dist",
"optimize-autoloader": true
},
"prefer-stable": true
}

File diff suppressed because it is too large Load Diff

@ -1,179 +0,0 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace AlibabaCloud\SDK\Live\V20161101\Models;
use AlibabaCloud\Tea\Model;
class AddCasterComponentRequest extends Model
{
/**
* @var string
*/
public $captionLayerContent;
/**
* @var string
*/
public $casterId;
/**
* @var string
*/
public $componentLayer;
/**
* @var string
*/
public $componentName;
/**
* @var string
*/
public $componentType;
/**
* @var string
*/
public $effect;
/**
* @var string
*/
public $htmlLayerContent;
/**
* @var string
*/
public $imageLayerContent;
/**
* @var string
*/
public $layerOrder;
/**
* @var string
*/
public $locationId;
/**
* @var int
*/
public $ownerId;
/**
* @var string
*/
public $textLayerContent;
protected $_name = [
'captionLayerContent' => 'CaptionLayerContent',
'casterId' => 'CasterId',
'componentLayer' => 'ComponentLayer',
'componentName' => 'ComponentName',
'componentType' => 'ComponentType',
'effect' => 'Effect',
'htmlLayerContent' => 'HtmlLayerContent',
'imageLayerContent' => 'ImageLayerContent',
'layerOrder' => 'LayerOrder',
'locationId' => 'LocationId',
'ownerId' => 'OwnerId',
'textLayerContent' => 'TextLayerContent',
];
public function validate()
{
}
public function toMap()
{
$res = [];
if (null !== $this->captionLayerContent) {
$res['CaptionLayerContent'] = $this->captionLayerContent;
}
if (null !== $this->casterId) {
$res['CasterId'] = $this->casterId;
}
if (null !== $this->componentLayer) {
$res['ComponentLayer'] = $this->componentLayer;
}
if (null !== $this->componentName) {
$res['ComponentName'] = $this->componentName;
}
if (null !== $this->componentType) {
$res['ComponentType'] = $this->componentType;
}
if (null !== $this->effect) {
$res['Effect'] = $this->effect;
}
if (null !== $this->htmlLayerContent) {
$res['HtmlLayerContent'] = $this->htmlLayerContent;
}
if (null !== $this->imageLayerContent) {
$res['ImageLayerContent'] = $this->imageLayerContent;
}
if (null !== $this->layerOrder) {
$res['LayerOrder'] = $this->layerOrder;
}
if (null !== $this->locationId) {
$res['LocationId'] = $this->locationId;
}
if (null !== $this->ownerId) {
$res['OwnerId'] = $this->ownerId;
}
if (null !== $this->textLayerContent) {
$res['TextLayerContent'] = $this->textLayerContent;
}
return $res;
}
/**
* @param array $map
*
* @return AddCasterComponentRequest
*/
public static function fromMap($map = [])
{
$model = new self();
if (isset($map['CaptionLayerContent'])) {
$model->captionLayerContent = $map['CaptionLayerContent'];
}
if (isset($map['CasterId'])) {
$model->casterId = $map['CasterId'];
}
if (isset($map['ComponentLayer'])) {
$model->componentLayer = $map['ComponentLayer'];
}
if (isset($map['ComponentName'])) {
$model->componentName = $map['ComponentName'];
}
if (isset($map['ComponentType'])) {
$model->componentType = $map['ComponentType'];
}
if (isset($map['Effect'])) {
$model->effect = $map['Effect'];
}
if (isset($map['HtmlLayerContent'])) {
$model->htmlLayerContent = $map['HtmlLayerContent'];
}
if (isset($map['ImageLayerContent'])) {
$model->imageLayerContent = $map['ImageLayerContent'];
}
if (isset($map['LayerOrder'])) {
$model->layerOrder = $map['LayerOrder'];
}
if (isset($map['LocationId'])) {
$model->locationId = $map['LocationId'];
}
if (isset($map['OwnerId'])) {
$model->ownerId = $map['OwnerId'];
}
if (isset($map['TextLayerContent'])) {
$model->textLayerContent = $map['TextLayerContent'];
}
return $model;
}
}

@ -1,74 +0,0 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace AlibabaCloud\SDK\Live\V20161101\Models;
use AlibabaCloud\Tea\Model;
class AddCasterComponentResponse extends Model
{
/**
* @var string[]
*/
public $headers;
/**
* @var int
*/
public $statusCode;
/**
* @var AddCasterComponentResponseBody
*/
public $body;
protected $_name = [
'headers' => 'headers',
'statusCode' => 'statusCode',
'body' => 'body',
];
public function validate()
{
Model::validateRequired('headers', $this->headers, true);
Model::validateRequired('statusCode', $this->statusCode, true);
Model::validateRequired('body', $this->body, true);
}
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 AddCasterComponentResponse
*/
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 = AddCasterComponentResponseBody::fromMap($map['body']);
}
return $model;
}
}

@ -1,59 +0,0 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace AlibabaCloud\SDK\Live\V20161101\Models;
use AlibabaCloud\Tea\Model;
class AddCasterComponentResponseBody extends Model
{
/**
* @var string
*/
public $componentId;
/**
* @var string
*/
public $requestId;
protected $_name = [
'componentId' => 'ComponentId',
'requestId' => 'RequestId',
];
public function validate()
{
}
public function toMap()
{
$res = [];
if (null !== $this->componentId) {
$res['ComponentId'] = $this->componentId;
}
if (null !== $this->requestId) {
$res['RequestId'] = $this->requestId;
}
return $res;
}
/**
* @param array $map
*
* @return AddCasterComponentResponseBody
*/
public static function fromMap($map = [])
{
$model = new self();
if (isset($map['ComponentId'])) {
$model->componentId = $map['ComponentId'];
}
if (isset($map['RequestId'])) {
$model->requestId = $map['RequestId'];
}
return $model;
}
}

@ -1,71 +0,0 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace AlibabaCloud\SDK\Live\V20161101\Models;
use AlibabaCloud\Tea\Model;
class AddCasterEpisodeGroupContentRequest extends Model
{
/**
* @var string
*/
public $clientToken;
/**
* @var string
*/
public $content;
/**
* @var int
*/
public $ownerId;
protected $_name = [
'clientToken' => 'ClientToken',
'content' => 'Content',
'ownerId' => 'OwnerId',
];
public function validate()
{
}
public function toMap()
{
$res = [];
if (null !== $this->clientToken) {
$res['ClientToken'] = $this->clientToken;
}
if (null !== $this->content) {
$res['Content'] = $this->content;
}
if (null !== $this->ownerId) {
$res['OwnerId'] = $this->ownerId;
}
return $res;
}
/**
* @param array $map
*
* @return AddCasterEpisodeGroupContentRequest
*/
public static function fromMap($map = [])
{
$model = new self();
if (isset($map['ClientToken'])) {
$model->clientToken = $map['ClientToken'];
}
if (isset($map['Content'])) {
$model->content = $map['Content'];
}
if (isset($map['OwnerId'])) {
$model->ownerId = $map['OwnerId'];
}
return $model;
}
}

@ -1,74 +0,0 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace AlibabaCloud\SDK\Live\V20161101\Models;
use AlibabaCloud\Tea\Model;
class AddCasterEpisodeGroupContentResponse extends Model
{
/**
* @var string[]
*/
public $headers;
/**
* @var int
*/
public $statusCode;
/**
* @var AddCasterEpisodeGroupContentResponseBody
*/
public $body;
protected $_name = [
'headers' => 'headers',
'statusCode' => 'statusCode',
'body' => 'body',
];
public function validate()
{
Model::validateRequired('headers', $this->headers, true);
Model::validateRequired('statusCode', $this->statusCode, true);
Model::validateRequired('body', $this->body, true);
}
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 AddCasterEpisodeGroupContentResponse
*/
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 = AddCasterEpisodeGroupContentResponseBody::fromMap($map['body']);
}
return $model;
}
}

@ -1,72 +0,0 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace AlibabaCloud\SDK\Live\V20161101\Models;
use AlibabaCloud\SDK\Live\V20161101\Models\AddCasterEpisodeGroupContentResponseBody\itemIds;
use AlibabaCloud\Tea\Model;
class AddCasterEpisodeGroupContentResponseBody extends Model
{
/**
* @var itemIds
*/
public $itemIds;
/**
* @var string
*/
public $programId;
/**
* @var string
*/
public $requestId;
protected $_name = [
'itemIds' => 'ItemIds',
'programId' => 'ProgramId',
'requestId' => 'RequestId',
];
public function validate()
{
}
public function toMap()
{
$res = [];
if (null !== $this->itemIds) {
$res['ItemIds'] = null !== $this->itemIds ? $this->itemIds->toMap() : null;
}
if (null !== $this->programId) {
$res['ProgramId'] = $this->programId;
}
if (null !== $this->requestId) {
$res['RequestId'] = $this->requestId;
}
return $res;
}
/**
* @param array $map
*
* @return AddCasterEpisodeGroupContentResponseBody
*/
public static function fromMap($map = [])
{
$model = new self();
if (isset($map['ItemIds'])) {
$model->itemIds = itemIds::fromMap($map['ItemIds']);
}
if (isset($map['ProgramId'])) {
$model->programId = $map['ProgramId'];
}
if (isset($map['RequestId'])) {
$model->requestId = $map['RequestId'];
}
return $model;
}
}

@ -1,49 +0,0 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace AlibabaCloud\SDK\Live\V20161101\Models\AddCasterEpisodeGroupContentResponseBody;
use AlibabaCloud\Tea\Model;
class itemIds extends Model
{
/**
* @var string[]
*/
public $itemId;
protected $_name = [
'itemId' => 'ItemId',
];
public function validate()
{
}
public function toMap()
{
$res = [];
if (null !== $this->itemId) {
$res['ItemId'] = $this->itemId;
}
return $res;
}
/**
* @param array $map
*
* @return itemIds
*/
public static function fromMap($map = [])
{
$model = new self();
if (isset($map['ItemId'])) {
if (!empty($map['ItemId'])) {
$model->itemId = $map['ItemId'];
}
}
return $model;
}
}

@ -1,144 +0,0 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace AlibabaCloud\SDK\Live\V20161101\Models;
use AlibabaCloud\SDK\Live\V20161101\Models\AddCasterEpisodeGroupRequest\item;
use AlibabaCloud\Tea\Model;
class AddCasterEpisodeGroupRequest extends Model
{
/**
* @var string
*/
public $callbackUrl;
/**
* @var string
*/
public $clientToken;
/**
* @var string
*/
public $domainName;
/**
* @var item[]
*/
public $item;
/**
* @var int
*/
public $ownerId;
/**
* @var int
*/
public $repeatNum;
/**
* @var string
*/
public $sideOutputUrl;
/**
* @var string
*/
public $startTime;
protected $_name = [
'callbackUrl' => 'CallbackUrl',
'clientToken' => 'ClientToken',
'domainName' => 'DomainName',
'item' => 'Item',
'ownerId' => 'OwnerId',
'repeatNum' => 'RepeatNum',
'sideOutputUrl' => 'SideOutputUrl',
'startTime' => 'StartTime',
];
public function validate()
{
}
public function toMap()
{
$res = [];
if (null !== $this->callbackUrl) {
$res['CallbackUrl'] = $this->callbackUrl;
}
if (null !== $this->clientToken) {
$res['ClientToken'] = $this->clientToken;
}
if (null !== $this->domainName) {
$res['DomainName'] = $this->domainName;
}
if (null !== $this->item) {
$res['Item'] = [];
if (null !== $this->item && \is_array($this->item)) {
$n = 0;
foreach ($this->item as $item) {
$res['Item'][$n++] = null !== $item ? $item->toMap() : $item;
}
}
}
if (null !== $this->ownerId) {
$res['OwnerId'] = $this->ownerId;
}
if (null !== $this->repeatNum) {
$res['RepeatNum'] = $this->repeatNum;
}
if (null !== $this->sideOutputUrl) {
$res['SideOutputUrl'] = $this->sideOutputUrl;
}
if (null !== $this->startTime) {
$res['StartTime'] = $this->startTime;
}
return $res;
}
/**
* @param array $map
*
* @return AddCasterEpisodeGroupRequest
*/
public static function fromMap($map = [])
{
$model = new self();
if (isset($map['CallbackUrl'])) {
$model->callbackUrl = $map['CallbackUrl'];
}
if (isset($map['ClientToken'])) {
$model->clientToken = $map['ClientToken'];
}
if (isset($map['DomainName'])) {
$model->domainName = $map['DomainName'];
}
if (isset($map['Item'])) {
if (!empty($map['Item'])) {
$model->item = [];
$n = 0;
foreach ($map['Item'] as $item) {
$model->item[$n++] = null !== $item ? item::fromMap($item) : $item;
}
}
}
if (isset($map['OwnerId'])) {
$model->ownerId = $map['OwnerId'];
}
if (isset($map['RepeatNum'])) {
$model->repeatNum = $map['RepeatNum'];
}
if (isset($map['SideOutputUrl'])) {
$model->sideOutputUrl = $map['SideOutputUrl'];
}
if (isset($map['StartTime'])) {
$model->startTime = $map['StartTime'];
}
return $model;
}
}

@ -1,59 +0,0 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace AlibabaCloud\SDK\Live\V20161101\Models\AddCasterEpisodeGroupRequest;
use AlibabaCloud\Tea\Model;
class item extends Model
{
/**
* @var string
*/
public $itemName;
/**
* @var string
*/
public $vodUrl;
protected $_name = [
'itemName' => 'ItemName',
'vodUrl' => 'VodUrl',
];
public function validate()
{
}
public function toMap()
{
$res = [];
if (null !== $this->itemName) {
$res['ItemName'] = $this->itemName;
}
if (null !== $this->vodUrl) {
$res['VodUrl'] = $this->vodUrl;
}
return $res;
}
/**
* @param array $map
*
* @return item
*/
public static function fromMap($map = [])
{
$model = new self();
if (isset($map['ItemName'])) {
$model->itemName = $map['ItemName'];
}
if (isset($map['VodUrl'])) {
$model->vodUrl = $map['VodUrl'];
}
return $model;
}
}

@ -1,74 +0,0 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace AlibabaCloud\SDK\Live\V20161101\Models;
use AlibabaCloud\Tea\Model;
class AddCasterEpisodeGroupResponse extends Model
{
/**
* @var string[]
*/
public $headers;
/**
* @var int
*/
public $statusCode;
/**
* @var AddCasterEpisodeGroupResponseBody
*/
public $body;
protected $_name = [
'headers' => 'headers',
'statusCode' => 'statusCode',
'body' => 'body',
];
public function validate()
{
Model::validateRequired('headers', $this->headers, true);
Model::validateRequired('statusCode', $this->statusCode, true);
Model::validateRequired('body', $this->body, true);
}
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 AddCasterEpisodeGroupResponse
*/
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 = AddCasterEpisodeGroupResponseBody::fromMap($map['body']);
}
return $model;
}
}

@ -1,72 +0,0 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace AlibabaCloud\SDK\Live\V20161101\Models;
use AlibabaCloud\SDK\Live\V20161101\Models\AddCasterEpisodeGroupResponseBody\itemIds;
use AlibabaCloud\Tea\Model;
class AddCasterEpisodeGroupResponseBody extends Model
{
/**
* @var itemIds
*/
public $itemIds;
/**
* @var string
*/
public $programId;
/**
* @var string
*/
public $requestId;
protected $_name = [
'itemIds' => 'ItemIds',
'programId' => 'ProgramId',
'requestId' => 'RequestId',
];
public function validate()
{
}
public function toMap()
{
$res = [];
if (null !== $this->itemIds) {
$res['ItemIds'] = null !== $this->itemIds ? $this->itemIds->toMap() : null;
}
if (null !== $this->programId) {
$res['ProgramId'] = $this->programId;
}
if (null !== $this->requestId) {
$res['RequestId'] = $this->requestId;
}
return $res;
}
/**
* @param array $map
*
* @return AddCasterEpisodeGroupResponseBody
*/
public static function fromMap($map = [])
{
$model = new self();
if (isset($map['ItemIds'])) {
$model->itemIds = itemIds::fromMap($map['ItemIds']);
}
if (isset($map['ProgramId'])) {
$model->programId = $map['ProgramId'];
}
if (isset($map['RequestId'])) {
$model->requestId = $map['RequestId'];
}
return $model;
}
}

@ -1,49 +0,0 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace AlibabaCloud\SDK\Live\V20161101\Models\AddCasterEpisodeGroupResponseBody;
use AlibabaCloud\Tea\Model;
class itemIds extends Model
{
/**
* @var string[]
*/
public $itemId;
protected $_name = [
'itemId' => 'ItemId',
];
public function validate()
{
}
public function toMap()
{
$res = [];
if (null !== $this->itemId) {
$res['ItemId'] = $this->itemId;
}
return $res;
}
/**
* @param array $map
*
* @return itemIds
*/
public static function fromMap($map = [])
{
$model = new self();
if (isset($map['ItemId'])) {
if (!empty($map['ItemId'])) {
$model->itemId = $map['ItemId'];
}
}
return $model;
}
}

@ -1,145 +0,0 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace AlibabaCloud\SDK\Live\V20161101\Models;
use AlibabaCloud\Tea\Model;
class AddCasterEpisodeRequest extends Model
{
/**
* @var string
*/
public $casterId;
/**
* @var string[]
*/
public $componentId;
/**
* @var string
*/
public $endTime;
/**
* @var string
*/
public $episodeName;
/**
* @var string
*/
public $episodeType;
/**
* @var int
*/
public $ownerId;
/**
* @var string
*/
public $resourceId;
/**
* @var string
*/
public $startTime;
/**
* @var string
*/
public $switchType;
protected $_name = [
'casterId' => 'CasterId',
'componentId' => 'ComponentId',
'endTime' => 'EndTime',
'episodeName' => 'EpisodeName',
'episodeType' => 'EpisodeType',
'ownerId' => 'OwnerId',
'resourceId' => 'ResourceId',
'startTime' => 'StartTime',
'switchType' => 'SwitchType',
];
public function validate()
{
}
public function toMap()
{
$res = [];
if (null !== $this->casterId) {
$res['CasterId'] = $this->casterId;
}
if (null !== $this->componentId) {
$res['ComponentId'] = $this->componentId;
}
if (null !== $this->endTime) {
$res['EndTime'] = $this->endTime;
}
if (null !== $this->episodeName) {
$res['EpisodeName'] = $this->episodeName;
}
if (null !== $this->episodeType) {
$res['EpisodeType'] = $this->episodeType;
}
if (null !== $this->ownerId) {
$res['OwnerId'] = $this->ownerId;
}
if (null !== $this->resourceId) {
$res['ResourceId'] = $this->resourceId;
}
if (null !== $this->startTime) {
$res['StartTime'] = $this->startTime;
}
if (null !== $this->switchType) {
$res['SwitchType'] = $this->switchType;
}
return $res;
}
/**
* @param array $map
*
* @return AddCasterEpisodeRequest
*/
public static function fromMap($map = [])
{
$model = new self();
if (isset($map['CasterId'])) {
$model->casterId = $map['CasterId'];
}
if (isset($map['ComponentId'])) {
if (!empty($map['ComponentId'])) {
$model->componentId = $map['ComponentId'];
}
}
if (isset($map['EndTime'])) {
$model->endTime = $map['EndTime'];
}
if (isset($map['EpisodeName'])) {
$model->episodeName = $map['EpisodeName'];
}
if (isset($map['EpisodeType'])) {
$model->episodeType = $map['EpisodeType'];
}
if (isset($map['OwnerId'])) {
$model->ownerId = $map['OwnerId'];
}
if (isset($map['ResourceId'])) {
$model->resourceId = $map['ResourceId'];
}
if (isset($map['StartTime'])) {
$model->startTime = $map['StartTime'];
}
if (isset($map['SwitchType'])) {
$model->switchType = $map['SwitchType'];
}
return $model;
}
}

@ -1,74 +0,0 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace AlibabaCloud\SDK\Live\V20161101\Models;
use AlibabaCloud\Tea\Model;
class AddCasterEpisodeResponse extends Model
{
/**
* @var string[]
*/
public $headers;
/**
* @var int
*/
public $statusCode;
/**
* @var AddCasterEpisodeResponseBody
*/
public $body;
protected $_name = [
'headers' => 'headers',
'statusCode' => 'statusCode',
'body' => 'body',
];
public function validate()
{
Model::validateRequired('headers', $this->headers, true);
Model::validateRequired('statusCode', $this->statusCode, true);
Model::validateRequired('body', $this->body, true);
}
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 AddCasterEpisodeResponse
*/
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 = AddCasterEpisodeResponseBody::fromMap($map['body']);
}
return $model;
}
}

@ -1,59 +0,0 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace AlibabaCloud\SDK\Live\V20161101\Models;
use AlibabaCloud\Tea\Model;
class AddCasterEpisodeResponseBody extends Model
{
/**
* @var string
*/
public $episodeId;
/**
* @var string
*/
public $requestId;
protected $_name = [
'episodeId' => 'EpisodeId',
'requestId' => 'RequestId',
];
public function validate()
{
}
public function toMap()
{
$res = [];
if (null !== $this->episodeId) {
$res['EpisodeId'] = $this->episodeId;
}
if (null !== $this->requestId) {
$res['RequestId'] = $this->requestId;
}
return $res;
}
/**
* @param array $map
*
* @return AddCasterEpisodeResponseBody
*/
public static function fromMap($map = [])
{
$model = new self();
if (isset($map['EpisodeId'])) {
$model->episodeId = $map['EpisodeId'];
}
if (isset($map['RequestId'])) {
$model->requestId = $map['RequestId'];
}
return $model;
}
}

@ -1,137 +0,0 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace AlibabaCloud\SDK\Live\V20161101\Models;
use AlibabaCloud\SDK\Live\V20161101\Models\AddCasterLayoutRequest\audioLayer;
use AlibabaCloud\SDK\Live\V20161101\Models\AddCasterLayoutRequest\videoLayer;
use AlibabaCloud\Tea\Model;
class AddCasterLayoutRequest extends Model
{
/**
* @var audioLayer[]
*/
public $audioLayer;
/**
* @var string[]
*/
public $blendList;
/**
* @var string
*/
public $casterId;
/**
* @var string[]
*/
public $mixList;
/**
* @var int
*/
public $ownerId;
/**
* @var videoLayer[]
*/
public $videoLayer;
protected $_name = [
'audioLayer' => 'AudioLayer',
'blendList' => 'BlendList',
'casterId' => 'CasterId',
'mixList' => 'MixList',
'ownerId' => 'OwnerId',
'videoLayer' => 'VideoLayer',
];
public function validate()
{
}
public function toMap()
{
$res = [];
if (null !== $this->audioLayer) {
$res['AudioLayer'] = [];
if (null !== $this->audioLayer && \is_array($this->audioLayer)) {
$n = 0;
foreach ($this->audioLayer as $item) {
$res['AudioLayer'][$n++] = null !== $item ? $item->toMap() : $item;
}
}
}
if (null !== $this->blendList) {
$res['BlendList'] = $this->blendList;
}
if (null !== $this->casterId) {
$res['CasterId'] = $this->casterId;
}
if (null !== $this->mixList) {
$res['MixList'] = $this->mixList;
}
if (null !== $this->ownerId) {
$res['OwnerId'] = $this->ownerId;
}
if (null !== $this->videoLayer) {
$res['VideoLayer'] = [];
if (null !== $this->videoLayer && \is_array($this->videoLayer)) {
$n = 0;
foreach ($this->videoLayer as $item) {
$res['VideoLayer'][$n++] = null !== $item ? $item->toMap() : $item;
}
}
}
return $res;
}
/**
* @param array $map
*
* @return AddCasterLayoutRequest
*/
public static function fromMap($map = [])
{
$model = new self();
if (isset($map['AudioLayer'])) {
if (!empty($map['AudioLayer'])) {
$model->audioLayer = [];
$n = 0;
foreach ($map['AudioLayer'] as $item) {
$model->audioLayer[$n++] = null !== $item ? audioLayer::fromMap($item) : $item;
}
}
}
if (isset($map['BlendList'])) {
if (!empty($map['BlendList'])) {
$model->blendList = $map['BlendList'];
}
}
if (isset($map['CasterId'])) {
$model->casterId = $map['CasterId'];
}
if (isset($map['MixList'])) {
if (!empty($map['MixList'])) {
$model->mixList = $map['MixList'];
}
}
if (isset($map['OwnerId'])) {
$model->ownerId = $map['OwnerId'];
}
if (isset($map['VideoLayer'])) {
if (!empty($map['VideoLayer'])) {
$model->videoLayer = [];
$n = 0;
foreach ($map['VideoLayer'] as $item) {
$model->videoLayer[$n++] = null !== $item ? videoLayer::fromMap($item) : $item;
}
}
}
return $model;
}
}

@ -1,71 +0,0 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace AlibabaCloud\SDK\Live\V20161101\Models\AddCasterLayoutRequest;
use AlibabaCloud\Tea\Model;
class audioLayer extends Model
{
/**
* @var int
*/
public $fixedDelayDuration;
/**
* @var string
*/
public $validChannel;
/**
* @var float
*/
public $volumeRate;
protected $_name = [
'fixedDelayDuration' => 'FixedDelayDuration',
'validChannel' => 'ValidChannel',
'volumeRate' => 'VolumeRate',
];
public function validate()
{
}
public function toMap()
{
$res = [];
if (null !== $this->fixedDelayDuration) {
$res['FixedDelayDuration'] = $this->fixedDelayDuration;
}
if (null !== $this->validChannel) {
$res['ValidChannel'] = $this->validChannel;
}
if (null !== $this->volumeRate) {
$res['VolumeRate'] = $this->volumeRate;
}
return $res;
}
/**
* @param array $map
*
* @return audioLayer
*/
public static function fromMap($map = [])
{
$model = new self();
if (isset($map['FixedDelayDuration'])) {
$model->fixedDelayDuration = $map['FixedDelayDuration'];
}
if (isset($map['ValidChannel'])) {
$model->validChannel = $map['ValidChannel'];
}
if (isset($map['VolumeRate'])) {
$model->volumeRate = $map['VolumeRate'];
}
return $model;
}
}

@ -1,109 +0,0 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace AlibabaCloud\SDK\Live\V20161101\Models\AddCasterLayoutRequest;
use AlibabaCloud\Tea\Model;
class videoLayer extends Model
{
/**
* @var string
*/
public $fillMode;
/**
* @var int
*/
public $fixedDelayDuration;
/**
* @var float
*/
public $heightNormalized;
/**
* @var float[]
*/
public $positionNormalized;
/**
* @var string
*/
public $positionRefer;
/**
* @var float
*/
public $widthNormalized;
protected $_name = [
'fillMode' => 'FillMode',
'fixedDelayDuration' => 'FixedDelayDuration',
'heightNormalized' => 'HeightNormalized',
'positionNormalized' => 'PositionNormalized',
'positionRefer' => 'PositionRefer',
'widthNormalized' => 'WidthNormalized',
];
public function validate()
{
}
public function toMap()
{
$res = [];
if (null !== $this->fillMode) {
$res['FillMode'] = $this->fillMode;
}
if (null !== $this->fixedDelayDuration) {
$res['FixedDelayDuration'] = $this->fixedDelayDuration;
}
if (null !== $this->heightNormalized) {
$res['HeightNormalized'] = $this->heightNormalized;
}
if (null !== $this->positionNormalized) {
$res['PositionNormalized'] = $this->positionNormalized;
}
if (null !== $this->positionRefer) {
$res['PositionRefer'] = $this->positionRefer;
}
if (null !== $this->widthNormalized) {
$res['WidthNormalized'] = $this->widthNormalized;
}
return $res;
}
/**
* @param array $map
*
* @return videoLayer
*/
public static function fromMap($map = [])
{
$model = new self();
if (isset($map['FillMode'])) {
$model->fillMode = $map['FillMode'];
}
if (isset($map['FixedDelayDuration'])) {
$model->fixedDelayDuration = $map['FixedDelayDuration'];
}
if (isset($map['HeightNormalized'])) {
$model->heightNormalized = $map['HeightNormalized'];
}
if (isset($map['PositionNormalized'])) {
if (!empty($map['PositionNormalized'])) {
$model->positionNormalized = $map['PositionNormalized'];
}
}
if (isset($map['PositionRefer'])) {
$model->positionRefer = $map['PositionRefer'];
}
if (isset($map['WidthNormalized'])) {
$model->widthNormalized = $map['WidthNormalized'];
}
return $model;
}
}

@ -1,74 +0,0 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace AlibabaCloud\SDK\Live\V20161101\Models;
use AlibabaCloud\Tea\Model;
class AddCasterLayoutResponse extends Model
{
/**
* @var string[]
*/
public $headers;
/**
* @var int
*/
public $statusCode;
/**
* @var AddCasterLayoutResponseBody
*/
public $body;
protected $_name = [
'headers' => 'headers',
'statusCode' => 'statusCode',
'body' => 'body',
];
public function validate()
{
Model::validateRequired('headers', $this->headers, true);
Model::validateRequired('statusCode', $this->statusCode, true);
Model::validateRequired('body', $this->body, true);
}
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 AddCasterLayoutResponse
*/
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 = AddCasterLayoutResponseBody::fromMap($map['body']);
}
return $model;
}
}

@ -1,59 +0,0 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace AlibabaCloud\SDK\Live\V20161101\Models;
use AlibabaCloud\Tea\Model;
class AddCasterLayoutResponseBody extends Model
{
/**
* @var string
*/
public $layoutId;
/**
* @var string
*/
public $requestId;
protected $_name = [
'layoutId' => 'LayoutId',
'requestId' => 'RequestId',
];
public function validate()
{
}
public function toMap()
{
$res = [];
if (null !== $this->layoutId) {
$res['LayoutId'] = $this->layoutId;
}
if (null !== $this->requestId) {
$res['RequestId'] = $this->requestId;
}
return $res;
}
/**
* @param array $map
*
* @return AddCasterLayoutResponseBody
*/
public static function fromMap($map = [])
{
$model = new self();
if (isset($map['LayoutId'])) {
$model->layoutId = $map['LayoutId'];
}
if (isset($map['RequestId'])) {
$model->requestId = $map['RequestId'];
}
return $model;
}
}

@ -1,84 +0,0 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace AlibabaCloud\SDK\Live\V20161101\Models;
use AlibabaCloud\SDK\Live\V20161101\Models\AddCasterProgramRequest\episode;
use AlibabaCloud\Tea\Model;
class AddCasterProgramRequest extends Model
{
/**
* @var string
*/
public $casterId;
/**
* @var episode[]
*/
public $episode;
/**
* @var int
*/
public $ownerId;
protected $_name = [
'casterId' => 'CasterId',
'episode' => 'Episode',
'ownerId' => 'OwnerId',
];
public function validate()
{
}
public function toMap()
{
$res = [];
if (null !== $this->casterId) {
$res['CasterId'] = $this->casterId;
}
if (null !== $this->episode) {
$res['Episode'] = [];
if (null !== $this->episode && \is_array($this->episode)) {
$n = 0;
foreach ($this->episode as $item) {
$res['Episode'][$n++] = null !== $item ? $item->toMap() : $item;
}
}
}
if (null !== $this->ownerId) {
$res['OwnerId'] = $this->ownerId;
}
return $res;
}
/**
* @param array $map
*
* @return AddCasterProgramRequest
*/
public static function fromMap($map = [])
{
$model = new self();
if (isset($map['CasterId'])) {
$model->casterId = $map['CasterId'];
}
if (isset($map['Episode'])) {
if (!empty($map['Episode'])) {
$model->episode = [];
$n = 0;
foreach ($map['Episode'] as $item) {
$model->episode[$n++] = null !== $item ? episode::fromMap($item) : $item;
}
}
}
if (isset($map['OwnerId'])) {
$model->ownerId = $map['OwnerId'];
}
return $model;
}
}

@ -1,121 +0,0 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace AlibabaCloud\SDK\Live\V20161101\Models\AddCasterProgramRequest;
use AlibabaCloud\Tea\Model;
class episode extends Model
{
/**
* @var string[]
*/
public $componentId;
/**
* @var string
*/
public $endTime;
/**
* @var string
*/
public $episodeName;
/**
* @var string
*/
public $episodeType;
/**
* @var string
*/
public $resourceId;
/**
* @var string
*/
public $startTime;
/**
* @var string
*/
public $switchType;
protected $_name = [
'componentId' => 'ComponentId',
'endTime' => 'EndTime',
'episodeName' => 'EpisodeName',
'episodeType' => 'EpisodeType',
'resourceId' => 'ResourceId',
'startTime' => 'StartTime',
'switchType' => 'SwitchType',
];
public function validate()
{
}
public function toMap()
{
$res = [];
if (null !== $this->componentId) {
$res['ComponentId'] = $this->componentId;
}
if (null !== $this->endTime) {
$res['EndTime'] = $this->endTime;
}
if (null !== $this->episodeName) {
$res['EpisodeName'] = $this->episodeName;
}
if (null !== $this->episodeType) {
$res['EpisodeType'] = $this->episodeType;
}
if (null !== $this->resourceId) {
$res['ResourceId'] = $this->resourceId;
}
if (null !== $this->startTime) {
$res['StartTime'] = $this->startTime;
}
if (null !== $this->switchType) {
$res['SwitchType'] = $this->switchType;
}
return $res;
}
/**
* @param array $map
*
* @return episode
*/
public static function fromMap($map = [])
{
$model = new self();
if (isset($map['ComponentId'])) {
if (!empty($map['ComponentId'])) {
$model->componentId = $map['ComponentId'];
}
}
if (isset($map['EndTime'])) {
$model->endTime = $map['EndTime'];
}
if (isset($map['EpisodeName'])) {
$model->episodeName = $map['EpisodeName'];
}
if (isset($map['EpisodeType'])) {
$model->episodeType = $map['EpisodeType'];
}
if (isset($map['ResourceId'])) {
$model->resourceId = $map['ResourceId'];
}
if (isset($map['StartTime'])) {
$model->startTime = $map['StartTime'];
}
if (isset($map['SwitchType'])) {
$model->switchType = $map['SwitchType'];
}
return $model;
}
}

@ -1,74 +0,0 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace AlibabaCloud\SDK\Live\V20161101\Models;
use AlibabaCloud\Tea\Model;
class AddCasterProgramResponse extends Model
{
/**
* @var string[]
*/
public $headers;
/**
* @var int
*/
public $statusCode;
/**
* @var AddCasterProgramResponseBody
*/
public $body;
protected $_name = [
'headers' => 'headers',
'statusCode' => 'statusCode',
'body' => 'body',
];
public function validate()
{
Model::validateRequired('headers', $this->headers, true);
Model::validateRequired('statusCode', $this->statusCode, true);
Model::validateRequired('body', $this->body, true);
}
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 AddCasterProgramResponse
*/
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 = AddCasterProgramResponseBody::fromMap($map['body']);
}
return $model;
}
}

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