parent
14aa3f1668
commit
e7737faf74
@ -0,0 +1,21 @@
|
||||
# The MIT License (MIT)
|
||||
|
||||
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.
|
@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "adbario/php-dot-notation",
|
||||
"description": "PHP dot notation access to arrays",
|
||||
"keywords": ["dotnotation", "arrayaccess"],
|
||||
"homepage": "https://github.com/adbario/php-dot-notation",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Riku Särkinen",
|
||||
"email": "riku@adbar.io"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.5",
|
||||
"ext-json": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^4.0|^5.0|^6.0",
|
||||
"squizlabs/php_codesniffer": "^3.0"
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
"src/helpers.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"Adbar\\": "src"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,601 @@
|
||||
<?php
|
||||
/**
|
||||
* Dot - PHP dot notation access to arrays
|
||||
*
|
||||
* @author Riku Särkinen <riku@adbar.io>
|
||||
* @link https://github.com/adbario/php-dot-notation
|
||||
* @license https://github.com/adbario/php-dot-notation/blob/2.x/LICENSE.md (MIT License)
|
||||
*/
|
||||
namespace Adbar;
|
||||
|
||||
use Countable;
|
||||
use ArrayAccess;
|
||||
use ArrayIterator;
|
||||
use JsonSerializable;
|
||||
use IteratorAggregate;
|
||||
|
||||
/**
|
||||
* Dot
|
||||
*
|
||||
* This class provides a dot notation access and helper functions for
|
||||
* working with arrays of data. Inspired by Laravel Collection.
|
||||
*/
|
||||
class Dot implements ArrayAccess, Countable, IteratorAggregate, JsonSerializable
|
||||
{
|
||||
/**
|
||||
* The stored items
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $items = [];
|
||||
|
||||
/**
|
||||
* Create a new Dot instance
|
||||
*
|
||||
* @param mixed $items
|
||||
*/
|
||||
public function __construct($items = [])
|
||||
{
|
||||
$this->items = $this->getArrayItems($items);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a given key / value pair or pairs
|
||||
* if the key doesn't exist already
|
||||
*
|
||||
* @param array|int|string $keys
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function add($keys, $value = null)
|
||||
{
|
||||
if (is_array($keys)) {
|
||||
foreach ($keys as $key => $value) {
|
||||
$this->add($key, $value);
|
||||
}
|
||||
} elseif (is_null($this->get($keys))) {
|
||||
$this->set($keys, $value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all the stored items
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function all()
|
||||
{
|
||||
return $this->items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the contents of a given key or keys
|
||||
*
|
||||
* @param array|int|string|null $keys
|
||||
*/
|
||||
public function clear($keys = null)
|
||||
{
|
||||
if (is_null($keys)) {
|
||||
$this->items = [];
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$keys = (array) $keys;
|
||||
|
||||
foreach ($keys as $key) {
|
||||
$this->set($key, []);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the given key or keys
|
||||
*
|
||||
* @param array|int|string $keys
|
||||
*/
|
||||
public function delete($keys)
|
||||
{
|
||||
$keys = (array) $keys;
|
||||
|
||||
foreach ($keys as $key) {
|
||||
if ($this->exists($this->items, $key)) {
|
||||
unset($this->items[$key]);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$items = &$this->items;
|
||||
$segments = explode('.', $key);
|
||||
$lastSegment = array_pop($segments);
|
||||
|
||||
foreach ($segments as $segment) {
|
||||
if (!isset($items[$segment]) || !is_array($items[$segment])) {
|
||||
continue 2;
|
||||
}
|
||||
|
||||
$items = &$items[$segment];
|
||||
}
|
||||
|
||||
unset($items[$lastSegment]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the given key exists in the provided array.
|
||||
*
|
||||
* @param array $array Array to validate
|
||||
* @param int|string $key The key to look for
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function exists($array, $key)
|
||||
{
|
||||
return array_key_exists($key, $array);
|
||||
}
|
||||
|
||||
/**
|
||||
* Flatten an array with the given character as a key delimiter
|
||||
*
|
||||
* @param string $delimiter
|
||||
* @param array|null $items
|
||||
* @param string $prepend
|
||||
* @return array
|
||||
*/
|
||||
public function flatten($delimiter = '.', $items = null, $prepend = '')
|
||||
{
|
||||
$flatten = [];
|
||||
|
||||
if (is_null($items)) {
|
||||
$items = $this->items;
|
||||
}
|
||||
|
||||
foreach ($items as $key => $value) {
|
||||
if (is_array($value) && !empty($value)) {
|
||||
$flatten = array_merge(
|
||||
$flatten,
|
||||
$this->flatten($delimiter, $value, $prepend.$key.$delimiter)
|
||||
);
|
||||
} else {
|
||||
$flatten[$prepend.$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $flatten;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the value of a given key
|
||||
*
|
||||
* @param int|string|null $key
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
public function get($key = null, $default = null)
|
||||
{
|
||||
if (is_null($key)) {
|
||||
return $this->items;
|
||||
}
|
||||
|
||||
if ($this->exists($this->items, $key)) {
|
||||
return $this->items[$key];
|
||||
}
|
||||
|
||||
if (strpos($key, '.') === false) {
|
||||
return $default;
|
||||
}
|
||||
|
||||
$items = $this->items;
|
||||
|
||||
foreach (explode('.', $key) as $segment) {
|
||||
if (!is_array($items) || !$this->exists($items, $segment)) {
|
||||
return $default;
|
||||
}
|
||||
|
||||
$items = &$items[$segment];
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the given items as an array
|
||||
*
|
||||
* @param mixed $items
|
||||
* @return array
|
||||
*/
|
||||
protected function getArrayItems($items)
|
||||
{
|
||||
if (is_array($items)) {
|
||||
return $items;
|
||||
} elseif ($items instanceof self) {
|
||||
return $items->all();
|
||||
}
|
||||
|
||||
return (array) $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given key or keys exists
|
||||
*
|
||||
* @param array|int|string $keys
|
||||
* @return bool
|
||||
*/
|
||||
public function has($keys)
|
||||
{
|
||||
$keys = (array) $keys;
|
||||
|
||||
if (!$this->items || $keys === []) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($keys as $key) {
|
||||
$items = $this->items;
|
||||
|
||||
if ($this->exists($items, $key)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach (explode('.', $key) as $segment) {
|
||||
if (!is_array($items) || !$this->exists($items, $segment)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$items = $items[$segment];
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given key or keys are empty
|
||||
*
|
||||
* @param array|int|string|null $keys
|
||||
* @return bool
|
||||
*/
|
||||
public function isEmpty($keys = null)
|
||||
{
|
||||
if (is_null($keys)) {
|
||||
return empty($this->items);
|
||||
}
|
||||
|
||||
$keys = (array) $keys;
|
||||
|
||||
foreach ($keys as $key) {
|
||||
if (!empty($this->get($key))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge a given array or a Dot object with the given key
|
||||
* or with the whole Dot object
|
||||
*
|
||||
* @param array|string|self $key
|
||||
* @param array|self $value
|
||||
*/
|
||||
public function merge($key, $value = [])
|
||||
{
|
||||
if (is_array($key)) {
|
||||
$this->items = array_merge($this->items, $key);
|
||||
} elseif (is_string($key)) {
|
||||
$items = (array) $this->get($key);
|
||||
$value = array_merge($items, $this->getArrayItems($value));
|
||||
|
||||
$this->set($key, $value);
|
||||
} elseif ($key instanceof self) {
|
||||
$this->items = array_merge($this->items, $key->all());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively merge a given array or a Dot object with the given key
|
||||
* or with the whole Dot object.
|
||||
*
|
||||
* Duplicate keys are converted to arrays.
|
||||
*
|
||||
* @param array|string|self $key
|
||||
* @param array|self $value
|
||||
*/
|
||||
public function mergeRecursive($key, $value = [])
|
||||
{
|
||||
if (is_array($key)) {
|
||||
$this->items = array_merge_recursive($this->items, $key);
|
||||
} elseif (is_string($key)) {
|
||||
$items = (array) $this->get($key);
|
||||
$value = array_merge_recursive($items, $this->getArrayItems($value));
|
||||
|
||||
$this->set($key, $value);
|
||||
} elseif ($key instanceof self) {
|
||||
$this->items = array_merge_recursive($this->items, $key->all());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively merge a given array or a Dot object with the given key
|
||||
* or with the whole Dot object.
|
||||
*
|
||||
* Instead of converting duplicate keys to arrays, the value from
|
||||
* given array will replace the value in Dot object.
|
||||
*
|
||||
* @param array|string|self $key
|
||||
* @param array|self $value
|
||||
*/
|
||||
public function mergeRecursiveDistinct($key, $value = [])
|
||||
{
|
||||
if (is_array($key)) {
|
||||
$this->items = $this->arrayMergeRecursiveDistinct($this->items, $key);
|
||||
} elseif (is_string($key)) {
|
||||
$items = (array) $this->get($key);
|
||||
$value = $this->arrayMergeRecursiveDistinct($items, $this->getArrayItems($value));
|
||||
|
||||
$this->set($key, $value);
|
||||
} elseif ($key instanceof self) {
|
||||
$this->items = $this->arrayMergeRecursiveDistinct($this->items, $key->all());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Merges two arrays recursively. In contrast to array_merge_recursive,
|
||||
* duplicate keys are not converted to arrays but rather overwrite the
|
||||
* value in the first array with the duplicate value in the second array.
|
||||
*
|
||||
* @param array $array1 Initial array to merge
|
||||
* @param array $array2 Array to recursively merge
|
||||
* @return array
|
||||
*/
|
||||
protected function arrayMergeRecursiveDistinct(array $array1, array $array2)
|
||||
{
|
||||
$merged = &$array1;
|
||||
|
||||
foreach ($array2 as $key => $value) {
|
||||
if (is_array($value) && isset($merged[$key]) && is_array($merged[$key])) {
|
||||
$merged[$key] = $this->arrayMergeRecursiveDistinct($merged[$key], $value);
|
||||
} else {
|
||||
$merged[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $merged;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the value of a given key and
|
||||
* delete the key
|
||||
*
|
||||
* @param int|string|null $key
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
public function pull($key = null, $default = null)
|
||||
{
|
||||
if (is_null($key)) {
|
||||
$value = $this->all();
|
||||
$this->clear();
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
$value = $this->get($key, $default);
|
||||
$this->delete($key);
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Push a given value to the end of the array
|
||||
* in a given key
|
||||
*
|
||||
* @param mixed $key
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function push($key, $value = null)
|
||||
{
|
||||
if (is_null($value)) {
|
||||
$this->items[] = $key;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$items = $this->get($key);
|
||||
|
||||
if (is_array($items) || is_null($items)) {
|
||||
$items[] = $value;
|
||||
$this->set($key, $items);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace all values or values within the given key
|
||||
* with an array or Dot object
|
||||
*
|
||||
* @param array|string|self $key
|
||||
* @param array|self $value
|
||||
*/
|
||||
public function replace($key, $value = [])
|
||||
{
|
||||
if (is_array($key)) {
|
||||
$this->items = array_replace($this->items, $key);
|
||||
} elseif (is_string($key)) {
|
||||
$items = (array) $this->get($key);
|
||||
$value = array_replace($items, $this->getArrayItems($value));
|
||||
|
||||
$this->set($key, $value);
|
||||
} elseif ($key instanceof self) {
|
||||
$this->items = array_replace($this->items, $key->all());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a given key / value pair or pairs
|
||||
*
|
||||
* @param array|int|string $keys
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function set($keys, $value = null)
|
||||
{
|
||||
if (is_array($keys)) {
|
||||
foreach ($keys as $key => $value) {
|
||||
$this->set($key, $value);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$items = &$this->items;
|
||||
|
||||
foreach (explode('.', $keys) as $key) {
|
||||
if (!isset($items[$key]) || !is_array($items[$key])) {
|
||||
$items[$key] = [];
|
||||
}
|
||||
|
||||
$items = &$items[$key];
|
||||
}
|
||||
|
||||
$items = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace all items with a given array
|
||||
*
|
||||
* @param mixed $items
|
||||
*/
|
||||
public function setArray($items)
|
||||
{
|
||||
$this->items = $this->getArrayItems($items);
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace all items with a given array as a reference
|
||||
*
|
||||
* @param array $items
|
||||
*/
|
||||
public function setReference(array &$items)
|
||||
{
|
||||
$this->items = &$items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the value of a given key or all the values as JSON
|
||||
*
|
||||
* @param mixed $key
|
||||
* @param int $options
|
||||
* @return string
|
||||
*/
|
||||
public function toJson($key = null, $options = 0)
|
||||
{
|
||||
if (is_string($key)) {
|
||||
return json_encode($this->get($key), $options);
|
||||
}
|
||||
|
||||
$options = $key === null ? 0 : $key;
|
||||
|
||||
return json_encode($this->items, $options);
|
||||
}
|
||||
|
||||
/*
|
||||
* --------------------------------------------------------------
|
||||
* ArrayAccess interface
|
||||
* --------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* Check if a given key exists
|
||||
*
|
||||
* @param int|string $key
|
||||
* @return bool
|
||||
*/
|
||||
public function offsetExists($key)
|
||||
{
|
||||
return $this->has($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the value of a given key
|
||||
*
|
||||
* @param int|string $key
|
||||
* @return mixed
|
||||
*/
|
||||
public function offsetGet($key)
|
||||
{
|
||||
return $this->get($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a given value to the given key
|
||||
*
|
||||
* @param int|string|null $key
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function offsetSet($key, $value)
|
||||
{
|
||||
if (is_null($key)) {
|
||||
$this->items[] = $value;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->set($key, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the given key
|
||||
*
|
||||
* @param int|string $key
|
||||
*/
|
||||
public function offsetUnset($key)
|
||||
{
|
||||
$this->delete($key);
|
||||
}
|
||||
|
||||
/*
|
||||
* --------------------------------------------------------------
|
||||
* Countable interface
|
||||
* --------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* Return the number of items in a given key
|
||||
*
|
||||
* @param int|string|null $key
|
||||
* @return int
|
||||
*/
|
||||
public function count($key = null)
|
||||
{
|
||||
return count($this->get($key));
|
||||
}
|
||||
|
||||
/*
|
||||
* --------------------------------------------------------------
|
||||
* IteratorAggregate interface
|
||||
* --------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get an iterator for the stored items
|
||||
*
|
||||
* @return \ArrayIterator
|
||||
*/
|
||||
public function getIterator()
|
||||
{
|
||||
return new ArrayIterator($this->items);
|
||||
}
|
||||
|
||||
/*
|
||||
* --------------------------------------------------------------
|
||||
* JsonSerializable interface
|
||||
* --------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* Return items for JSON serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return $this->items;
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
* Dot - PHP dot notation access to arrays
|
||||
*
|
||||
* @author Riku Särkinen <riku@adbar.io>
|
||||
* @link https://github.com/adbario/php-dot-notation
|
||||
* @license https://github.com/adbario/php-dot-notation/blob/2.x/LICENSE.md (MIT License)
|
||||
*/
|
||||
|
||||
use Adbar\Dot;
|
||||
|
||||
if (! function_exists('dot')) {
|
||||
/**
|
||||
* Create a new Dot object with the given items
|
||||
*
|
||||
* @param mixed $items
|
||||
* @return \Adbar\Dot
|
||||
*/
|
||||
function dot($items)
|
||||
{
|
||||
return new Dot($items);
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
# CHANGELOG
|
||||
|
||||
## 1.1.3 - 2020-12-24
|
||||
|
||||
- Require guzzle ^6.3|^7.0
|
||||
|
||||
## 1.0.2 - 2020-02-14
|
||||
- Update Tea.
|
||||
|
||||
## 1.0.1 - 2019-12-30
|
||||
- Supported get `Role Name` automatically.
|
||||
|
||||
## 1.0.0 - 2019-09-01
|
||||
- Initial release of the Alibaba Cloud Credentials for PHP Version 1.0.0 on Packagist See <https://github.com/aliyun/credentials-php> for more information.
|
@ -0,0 +1,30 @@
|
||||
# CONTRIBUTING
|
||||
|
||||
We work hard to provide a high-quality and useful SDK for Alibaba Cloud, and
|
||||
we greatly value feedback and contributions from our community. Please submit
|
||||
your [issues][issues] or [pull requests][pull-requests] through GitHub.
|
||||
|
||||
## Tips
|
||||
|
||||
- The SDK is released under the [Apache license][license]. Any code you submit
|
||||
will be released under that license. For substantial contributions, we may
|
||||
ask you to sign a [Alibaba Documentation Corporate Contributor License
|
||||
Agreement (CLA)][cla].
|
||||
- We follow all of the relevant PSR recommendations from the [PHP Framework
|
||||
Interop Group][php-fig]. Please submit code that follows these standards.
|
||||
The [PHP CS Fixer][cs-fixer] tool can be helpful for formatting your code.
|
||||
Your can use `composer fixer` to fix code.
|
||||
- We maintain a high percentage of code coverage in our unit tests. If you make
|
||||
changes to the code, please add, update, and/or remove tests as appropriate.
|
||||
- If your code does not conform to the PSR standards, does not include adequate
|
||||
tests, or does not contain a changelog document, we may ask you to update
|
||||
your pull requests before we accept them. We also reserve the right to deny
|
||||
any pull requests that do not align with our standards or goals.
|
||||
|
||||
[issues]: https://github.com/aliyun/credentials-php/issues
|
||||
[pull-requests]: https://github.com/aliyun/credentials-php/pulls
|
||||
[license]: http://www.apache.org/licenses/LICENSE-2.0
|
||||
[cla]: https://alibaba-cla-2018.oss-cn-beijing.aliyuncs.com/Alibaba_Documentation_Open_Source_Corporate_CLA.pdf
|
||||
[php-fig]: http://php-fig.org
|
||||
[cs-fixer]: http://cs.sensiolabs.org/
|
||||
[docs-readme]: https://github.com/aliyun/credentials-php/blob/master/README.md
|
@ -0,0 +1,13 @@
|
||||
Copyright (c) 2009-present, Alibaba Cloud All rights reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
@ -0,0 +1,88 @@
|
||||
# NOTICE
|
||||
|
||||
<https://www.alibabacloud.com/>
|
||||
|
||||
Copyright (c) 2009-present, Alibaba Cloud All rights reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License").
|
||||
You may not use this file except in compliance with the License.
|
||||
A copy of the License is located at
|
||||
|
||||
<http://www.apache.org/licenses/LICENSE-2.0>
|
||||
|
||||
or in the "license" file accompanying this file. This file is distributed
|
||||
on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
express or implied. See the License for the specific language governing
|
||||
permissions and limitations under the License.
|
||||
|
||||
# Guzzle
|
||||
|
||||
<https://github.com/guzzle/guzzle>
|
||||
|
||||
Copyright (c) 2011-2018 Michael Dowling, https://github.com/mtdowling <mtdowling@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
# jmespath.php
|
||||
|
||||
<https://github.com/mtdowling/jmespath.php>
|
||||
|
||||
Copyright (c) 2014 Michael Dowling, https://github.com/mtdowling
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
# Dot
|
||||
|
||||
<https://github.com/adbario/php-dot-notation>
|
||||
|
||||
Copyright (c) 2016-2019 Riku Särkinen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
@ -0,0 +1,21 @@
|
||||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
Use this section to tell people about which versions of your project are
|
||||
currently being supported with security updates.
|
||||
|
||||
| Version | Supported |
|
||||
| ------- | ------------------ |
|
||||
| 5.1.x | :white_check_mark: |
|
||||
| 5.0.x | :x: |
|
||||
| 4.0.x | :white_check_mark: |
|
||||
| < 4.0 | :x: |
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
Use this section to tell people how to report a vulnerability.
|
||||
|
||||
Tell them where to go, how often they can expect to get an update on a
|
||||
reported vulnerability, what to expect if the vulnerability is accepted or
|
||||
declined, etc.
|
@ -0,0 +1,6 @@
|
||||
Upgrading Guide
|
||||
===============
|
||||
|
||||
1.x
|
||||
-----------------------
|
||||
- This is the first version. See <https://github.com/aliyun/credentials-php> for more information.
|
@ -0,0 +1,104 @@
|
||||
{
|
||||
"name": "alibabacloud/credentials",
|
||||
"homepage": "https://www.alibabacloud.com/",
|
||||
"description": "Alibaba Cloud Credentials for PHP",
|
||||
"keywords": [
|
||||
"sdk",
|
||||
"tool",
|
||||
"cloud",
|
||||
"client",
|
||||
"aliyun",
|
||||
"library",
|
||||
"alibaba",
|
||||
"Credentials",
|
||||
"alibabacloud"
|
||||
],
|
||||
"type": "library",
|
||||
"license": "Apache-2.0",
|
||||
"support": {
|
||||
"source": "https://github.com/aliyun/credentials-php",
|
||||
"issues": "https://github.com/aliyun/credentials-php/issues"
|
||||
},
|
||||
"authors": [
|
||||
{
|
||||
"name": "Alibaba Cloud SDK",
|
||||
"email": "sdk-team@alibabacloud.com",
|
||||
"homepage": "http://www.alibabacloud.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.6",
|
||||
"ext-curl": "*",
|
||||
"ext-json": "*",
|
||||
"ext-libxml": "*",
|
||||
"ext-openssl": "*",
|
||||
"ext-mbstring": "*",
|
||||
"ext-simplexml": "*",
|
||||
"ext-xmlwriter": "*",
|
||||
"guzzlehttp/guzzle": "^6.3|^7.0",
|
||||
"adbario/php-dot-notation": "^2.2",
|
||||
"alibabacloud/tea": "^3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-spl": "*",
|
||||
"ext-dom": "*",
|
||||
"ext-pcre": "*",
|
||||
"psr/cache": "^1.0",
|
||||
"ext-sockets": "*",
|
||||
"drupal/coder": "^8.3",
|
||||
"symfony/dotenv": "^3.4",
|
||||
"phpunit/phpunit": "^4.8.35|^5.4.3",
|
||||
"monolog/monolog": "^1.24",
|
||||
"composer/composer": "^1.8",
|
||||
"mikey179/vfsstream": "^1.6",
|
||||
"symfony/var-dumper": "^3.4"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-sockets": "To use client-side monitoring"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"AlibabaCloud\\Credentials\\": "src"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"AlibabaCloud\\Credentials\\Tests\\": "tests/"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"preferred-install": "dist",
|
||||
"optimize-autoloader": true
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true,
|
||||
"scripts-descriptions": {
|
||||
"cs": "Tokenizes PHP, JavaScript and CSS files to detect violations of a defined coding standard.",
|
||||
"cbf": "Automatically correct coding standard violations.",
|
||||
"fixer": "Fixes code to follow standards.",
|
||||
"test": "Run all tests.",
|
||||
"unit": "Run Unit tests.",
|
||||
"feature": "Run Feature tests.",
|
||||
"clearCache": "Clear cache like coverage.",
|
||||
"coverage": "Show Coverage html.",
|
||||
"endpoints": "Update endpoints from OSS."
|
||||
},
|
||||
"scripts": {
|
||||
"cs": "phpcs --standard=PSR2 -n ./",
|
||||
"cbf": "phpcbf --standard=PSR2 -n ./",
|
||||
"fixer": "php-cs-fixer fix ./",
|
||||
"test": [
|
||||
"phpunit --colors=always"
|
||||
],
|
||||
"unit": [
|
||||
"@clearCache",
|
||||
"phpunit --testsuite=Unit --colors=always"
|
||||
],
|
||||
"feature": [
|
||||
"@clearCache",
|
||||
"phpunit --testsuite=Feature --colors=always"
|
||||
],
|
||||
"coverage": "open cache/coverage/index.html",
|
||||
"clearCache": "rm -rf cache/*"
|
||||
}
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials;
|
||||
|
||||
use AlibabaCloud\Credentials\Signature\ShaHmac1Signature;
|
||||
|
||||
/**
|
||||
* Use the AccessKey to complete the authentication.
|
||||
*/
|
||||
class AccessKeyCredential implements CredentialsInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $accessKeyId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $accessKeySecret;
|
||||
|
||||
/**
|
||||
* AccessKeyCredential constructor.
|
||||
*
|
||||
* @param string $access_key_id Access key ID
|
||||
* @param string $access_key_secret Access Key Secret
|
||||
*/
|
||||
public function __construct($access_key_id, $access_key_secret)
|
||||
{
|
||||
Filter::accessKey($access_key_id, $access_key_secret);
|
||||
|
||||
$this->accessKeyId = $access_key_id;
|
||||
$this->accessKeySecret = $access_key_secret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAccessKeyId()
|
||||
{
|
||||
return $this->accessKeyId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAccessKeySecret()
|
||||
{
|
||||
return $this->accessKeySecret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return "$this->accessKeyId#$this->accessKeySecret";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ShaHmac1Signature
|
||||
*/
|
||||
public function getSignature()
|
||||
{
|
||||
return new ShaHmac1Signature();
|
||||
}
|
||||
|
||||
public function getSecurityToken()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials;
|
||||
|
||||
use AlibabaCloud\Credentials\Signature\BearerTokenSignature;
|
||||
|
||||
/**
|
||||
* Class BearerTokenCredential
|
||||
*/
|
||||
class BearerTokenCredential implements CredentialsInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $bearerToken;
|
||||
|
||||
/**
|
||||
* BearerTokenCredential constructor.
|
||||
*
|
||||
* @param $bearerToken
|
||||
*/
|
||||
public function __construct($bearerToken)
|
||||
{
|
||||
Filter::bearerToken($bearerToken);
|
||||
|
||||
$this->bearerToken = $bearerToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getBearerToken()
|
||||
{
|
||||
return $this->bearerToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return "bearerToken#$this->bearerToken";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BearerTokenSignature
|
||||
*/
|
||||
public function getSignature()
|
||||
{
|
||||
return new BearerTokenSignature();
|
||||
}
|
||||
}
|
@ -0,0 +1,182 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials;
|
||||
|
||||
use AlibabaCloud\Credentials\Credential\Config;
|
||||
use InvalidArgumentException;
|
||||
use ReflectionClass;
|
||||
use ReflectionException;
|
||||
use ReflectionParameter;
|
||||
|
||||
/**
|
||||
* Class Credential
|
||||
*
|
||||
* @package AlibabaCloud\Credentials
|
||||
*
|
||||
* @mixin AccessKeyCredential
|
||||
* @mixin BearerTokenCredential
|
||||
* @mixin EcsRamRoleCredential
|
||||
* @mixin RamRoleArnCredential
|
||||
* @mixin RsaKeyPairCredential
|
||||
*/
|
||||
class Credential
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $config = [];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $types = [
|
||||
'access_key' => AccessKeyCredential::class,
|
||||
'sts' => StsCredential::class,
|
||||
'ecs_ram_role' => EcsRamRoleCredential::class,
|
||||
'ram_role_arn' => RamRoleArnCredential::class,
|
||||
'rsa_key_pair' => RsaKeyPairCredential::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* @var AccessKeyCredential|BearerTokenCredential|EcsRamRoleCredential|RamRoleArnCredential|RsaKeyPairCredential
|
||||
*/
|
||||
protected $credential;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $type;
|
||||
|
||||
/**
|
||||
* Credential constructor.
|
||||
*
|
||||
* @param array|Config $config
|
||||
*
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
public function __construct($config = [])
|
||||
{
|
||||
if ($config instanceof Config) {
|
||||
$config = $this->parse($config);
|
||||
}
|
||||
if ($config !== []) {
|
||||
$this->config = array_change_key_case($config);
|
||||
$this->parseConfig();
|
||||
} else {
|
||||
$this->credential = Credentials::get()->getCredential();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Config $config
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function parse($config)
|
||||
{
|
||||
$config = get_object_vars($config);
|
||||
$res = [];
|
||||
foreach ($config as $key => $value) {
|
||||
$res[$this->toUnderScore($key)] = $value;
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
private function toUnderScore($str)
|
||||
{
|
||||
$dstr = preg_replace_callback('/([A-Z]+)/', function ($matchs) {
|
||||
return '_' . strtolower($matchs[0]);
|
||||
}, $str);
|
||||
return trim(preg_replace('/_{2,}/', '_', $dstr), '_');
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
private function parseConfig()
|
||||
{
|
||||
if (!isset($this->config['type'])) {
|
||||
throw new InvalidArgumentException('Missing required type option');
|
||||
}
|
||||
|
||||
$this->type = $this->config['type'];
|
||||
if (!isset($this->types[$this->type])) {
|
||||
throw new InvalidArgumentException(
|
||||
'Invalid type option, support: ' .
|
||||
implode(', ', array_keys($this->types))
|
||||
);
|
||||
}
|
||||
|
||||
$class = new ReflectionClass($this->types[$this->type]);
|
||||
$parameters = [];
|
||||
/**
|
||||
* @var $parameter ReflectionParameter
|
||||
*/
|
||||
foreach ($class->getConstructor()->getParameters() as $parameter) {
|
||||
$parameters[] = $this->getValue($parameter);
|
||||
}
|
||||
|
||||
$this->credential = $class->newInstance(...$parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ReflectionParameter $parameter
|
||||
*
|
||||
* @return string|array
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
protected function getValue(ReflectionParameter $parameter)
|
||||
{
|
||||
if ($parameter->name === 'config' || $parameter->name === 'credential') {
|
||||
return $this->config;
|
||||
}
|
||||
|
||||
foreach ($this->config as $key => $value) {
|
||||
if (strtolower($parameter->name) === $key) {
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
|
||||
if ($parameter->isDefaultValueAvailable()) {
|
||||
return $parameter->getDefaultValue();
|
||||
}
|
||||
|
||||
throw new InvalidArgumentException("Missing required {$parameter->name} option in config for {$this->type}");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return AccessKeyCredential|BearerTokenCredential|EcsRamRoleCredential|RamRoleArnCredential|RsaKeyPairCredential
|
||||
*/
|
||||
public function getCredential()
|
||||
{
|
||||
return $this->credential;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getConfig()
|
||||
{
|
||||
return $this->config;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param array $arguments
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call($name, $arguments)
|
||||
{
|
||||
return $this->credential->$name($arguments);
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials\Credential;
|
||||
|
||||
class Config
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'default';
|
||||
|
||||
public $accessKeyId = "";
|
||||
|
||||
public $accessKeySecret = "";
|
||||
|
||||
public $securityToken = "";
|
||||
|
||||
public $bearerToken = "";
|
||||
|
||||
public $roleName = "";
|
||||
|
||||
public $roleArn = "";
|
||||
|
||||
public $roleSessionName = "";
|
||||
|
||||
public $host = "";
|
||||
|
||||
public $publicKeyId = "";
|
||||
|
||||
public $privateKeyFile = "";
|
||||
|
||||
public $readTimeout = 0;
|
||||
|
||||
public $connectTimeout = 0;
|
||||
|
||||
public $certFile = "";
|
||||
|
||||
public $certPassword = "";
|
||||
|
||||
public $proxy = "";
|
||||
|
||||
public $expiration = 0;
|
||||
|
||||
public function __construct($config)
|
||||
{
|
||||
foreach ($config as $k => $v) {
|
||||
$this->{$k} = $v;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,102 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials;
|
||||
|
||||
use AlibabaCloud\Credentials\Providers\ChainProvider;
|
||||
use ReflectionException;
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* Class Credentials
|
||||
*
|
||||
* @package AlibabaCloud\Credentials
|
||||
*/
|
||||
class Credentials
|
||||
{
|
||||
use MockTrait;
|
||||
|
||||
/**
|
||||
* @var array|CredentialsInterface[] containers of credentials
|
||||
*/
|
||||
protected static $credentials = [];
|
||||
|
||||
/**
|
||||
* Get the credential instance by name.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return Credential
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
public static function get($name = null)
|
||||
{
|
||||
if ($name !== null) {
|
||||
Filter::credentialName($name);
|
||||
} else {
|
||||
$name = ChainProvider::getDefaultName();
|
||||
}
|
||||
|
||||
self::load();
|
||||
|
||||
if (self::has($name)) {
|
||||
return new Credential(self::$credentials[\strtolower($name)]);
|
||||
}
|
||||
|
||||
throw new RuntimeException("Credential '$name' not found");
|
||||
}
|
||||
|
||||
private static function load()
|
||||
{
|
||||
if (self::$credentials) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ChainProvider::hasCustomChain()) {
|
||||
ChainProvider::customProvider(ChainProvider::getDefaultName());
|
||||
} else {
|
||||
ChainProvider::defaultProvider(ChainProvider::getDefaultName());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether there is a credential.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function has($name)
|
||||
{
|
||||
Filter::credentialName($name);
|
||||
|
||||
return isset(self::$credentials[\strtolower($name)]);
|
||||
}
|
||||
|
||||
public static function flush()
|
||||
{
|
||||
self::$credentials = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all credentials.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function all()
|
||||
{
|
||||
self::load();
|
||||
|
||||
return self::$credentials;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param array $credential
|
||||
*/
|
||||
public static function set($name, array $credential)
|
||||
{
|
||||
Filter::credentialName($name);
|
||||
|
||||
self::$credentials[\strtolower($name)] = \array_change_key_case($credential);
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials;
|
||||
|
||||
use AlibabaCloud\Credentials\Signature\SignatureInterface;
|
||||
|
||||
/**
|
||||
* Interface CredentialsInterface
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
interface CredentialsInterface
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function __toString();
|
||||
|
||||
/**
|
||||
* @return SignatureInterface
|
||||
*/
|
||||
public function getSignature();
|
||||
}
|
@ -0,0 +1,151 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials;
|
||||
|
||||
use AlibabaCloud\Credentials\Providers\EcsRamRoleProvider;
|
||||
use AlibabaCloud\Credentials\Request\Request;
|
||||
use AlibabaCloud\Credentials\Signature\ShaHmac1Signature;
|
||||
use Exception;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use InvalidArgumentException;
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* Use the RAM role of an ECS instance to complete the authentication.
|
||||
*/
|
||||
class EcsRamRoleCredential implements CredentialsInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $roleName;
|
||||
|
||||
/**
|
||||
* EcsRamRoleCredential constructor.
|
||||
*
|
||||
* @param $role_name
|
||||
*/
|
||||
public function __construct($role_name = null)
|
||||
{
|
||||
Filter::roleName($role_name);
|
||||
|
||||
$this->roleName = $role_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws GuzzleException
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getRoleName()
|
||||
{
|
||||
if ($this->roleName !== null) {
|
||||
return $this->roleName;
|
||||
}
|
||||
|
||||
$this->roleName = $this->getRoleNameFromMeta();
|
||||
|
||||
return $this->roleName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getRoleNameFromMeta()
|
||||
{
|
||||
$options = [
|
||||
'http_errors' => false,
|
||||
'timeout' => 1,
|
||||
'connect_timeout' => 1,
|
||||
];
|
||||
|
||||
$result = Request::createClient()->request(
|
||||
'GET',
|
||||
'http://100.100.100.200/latest/meta-data/ram/security-credentials/',
|
||||
$options
|
||||
);
|
||||
|
||||
if ($result->getStatusCode() === 404) {
|
||||
throw new InvalidArgumentException('The role name was not found in the instance');
|
||||
}
|
||||
|
||||
if ($result->getStatusCode() !== 200) {
|
||||
throw new RuntimeException('Error retrieving credentials from result: ' . $result->getBody());
|
||||
}
|
||||
|
||||
$role_name = (string)$result;
|
||||
if (!$role_name) {
|
||||
throw new RuntimeException('Error retrieving credentials from result is empty');
|
||||
}
|
||||
|
||||
return $role_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return "roleName#$this->roleName";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ShaHmac1Signature
|
||||
*/
|
||||
public function getSignature()
|
||||
{
|
||||
return new ShaHmac1Signature();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function getAccessKeyId()
|
||||
{
|
||||
return $this->getSessionCredential()->getAccessKeyId();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return StsCredential
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
protected function getSessionCredential()
|
||||
{
|
||||
return (new EcsRamRoleProvider($this))->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function getAccessKeySecret()
|
||||
{
|
||||
return $this->getSessionCredential()->getAccessKeySecret();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function getSecurityToken()
|
||||
{
|
||||
return $this->getSessionCredential()->getSecurityToken();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function getExpiration()
|
||||
{
|
||||
return $this->getSessionCredential()->getExpiration();
|
||||
}
|
||||
}
|
@ -0,0 +1,134 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials;
|
||||
|
||||
use InvalidArgumentException;
|
||||
|
||||
class Filter
|
||||
{
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @return string
|
||||
*/
|
||||
public static function credentialName($name)
|
||||
{
|
||||
if (!is_string($name)) {
|
||||
throw new InvalidArgumentException('Name must be a string');
|
||||
}
|
||||
|
||||
if ($name === '') {
|
||||
throw new InvalidArgumentException('Name cannot be empty');
|
||||
}
|
||||
|
||||
return $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $bearerToken
|
||||
*
|
||||
* @return mixed
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public static function bearerToken($bearerToken)
|
||||
{
|
||||
if (!is_string($bearerToken)) {
|
||||
throw new InvalidArgumentException('Bearer Token must be a string');
|
||||
}
|
||||
|
||||
if ($bearerToken === '') {
|
||||
throw new InvalidArgumentException('Bearer Token cannot be empty');
|
||||
}
|
||||
|
||||
return $bearerToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $publicKeyId
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function publicKeyId($publicKeyId)
|
||||
{
|
||||
if (!is_string($publicKeyId)) {
|
||||
throw new InvalidArgumentException('public_key_id must be a string');
|
||||
}
|
||||
|
||||
if ($publicKeyId === '') {
|
||||
throw new InvalidArgumentException('public_key_id cannot be empty');
|
||||
}
|
||||
|
||||
return $publicKeyId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $privateKeyFile
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function privateKeyFile($privateKeyFile)
|
||||
{
|
||||
if (!is_string($privateKeyFile)) {
|
||||
throw new InvalidArgumentException('private_key_file must be a string');
|
||||
}
|
||||
|
||||
if ($privateKeyFile === '') {
|
||||
throw new InvalidArgumentException('private_key_file cannot be empty');
|
||||
}
|
||||
|
||||
return $privateKeyFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $role_name
|
||||
*/
|
||||
public static function roleName($role_name)
|
||||
{
|
||||
if ($role_name === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!is_string($role_name)) {
|
||||
throw new InvalidArgumentException('role_name must be a string');
|
||||
}
|
||||
|
||||
if ($role_name === '') {
|
||||
throw new InvalidArgumentException('role_name cannot be empty');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $accessKeyId
|
||||
* @param string $accessKeySecret
|
||||
*/
|
||||
public static function accessKey($accessKeyId, $accessKeySecret)
|
||||
{
|
||||
if (!is_string($accessKeyId)) {
|
||||
throw new InvalidArgumentException('access_key_id must be a string');
|
||||
}
|
||||
|
||||
if ($accessKeyId === '') {
|
||||
throw new InvalidArgumentException('access_key_id cannot be empty');
|
||||
}
|
||||
|
||||
if (!is_string($accessKeySecret)) {
|
||||
throw new InvalidArgumentException('access_key_secret must be a string');
|
||||
}
|
||||
|
||||
if ($accessKeySecret === '') {
|
||||
throw new InvalidArgumentException('access_key_secret cannot be empty');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $expiration
|
||||
*/
|
||||
public static function expiration($expiration)
|
||||
{
|
||||
if (!is_int($expiration)) {
|
||||
throw new InvalidArgumentException('expiration must be a int');
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,202 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials;
|
||||
|
||||
use Closure;
|
||||
|
||||
/**
|
||||
* Class Helper
|
||||
*
|
||||
* @package AlibabaCloud\Credentials
|
||||
*/
|
||||
class Helper
|
||||
{
|
||||
/**
|
||||
* @param array $arrays
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function merge(array $arrays)
|
||||
{
|
||||
$result = [];
|
||||
foreach ($arrays as $array) {
|
||||
foreach ($array as $key => $value) {
|
||||
if (is_int($key)) {
|
||||
$result[] = $value;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isset($result[$key]) && is_array($result[$key])) {
|
||||
$result[$key] = self::merge(
|
||||
[$result[$key], $value]
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
$result[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $filename
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function inOpenBasedir($filename)
|
||||
{
|
||||
$open_basedir = ini_get('open_basedir');
|
||||
if (!$open_basedir) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$dirs = explode(PATH_SEPARATOR, $open_basedir);
|
||||
|
||||
return empty($dirs) || self::inDir($filename, $dirs);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $filename
|
||||
* @param array $dirs
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function inDir($filename, array $dirs)
|
||||
{
|
||||
foreach ($dirs as $dir) {
|
||||
if ($dir[strlen($dir) - 1] !== DIRECTORY_SEPARATOR) {
|
||||
$dir .= DIRECTORY_SEPARATOR;
|
||||
}
|
||||
|
||||
if (0 === strpos($filename, $dir)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public static function isWindows()
|
||||
{
|
||||
return PATH_SEPARATOR === ';';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $key
|
||||
*
|
||||
* @return bool|mixed
|
||||
*/
|
||||
public static function envNotEmpty($key)
|
||||
{
|
||||
$value = self::env($key, false);
|
||||
if ($value) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of an environment variable.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $default
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function env($key, $default = null)
|
||||
{
|
||||
$value = getenv($key);
|
||||
|
||||
if ($value === false) {
|
||||
return self::value($default);
|
||||
}
|
||||
|
||||
if (self::envSubstr($value)) {
|
||||
return substr($value, 1, -1);
|
||||
}
|
||||
|
||||
return self::envConversion($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the default value of the given value.
|
||||
*
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function value($value)
|
||||
{
|
||||
return $value instanceof Closure ? $value() : $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function envSubstr($value)
|
||||
{
|
||||
return ($valueLength = strlen($value)) > 1
|
||||
&& strpos($value, '"') === 0
|
||||
&& $value[$valueLength - 1] === '"';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
*
|
||||
* @return bool|string|null
|
||||
*/
|
||||
public static function envConversion($value)
|
||||
{
|
||||
$key = strtolower($value);
|
||||
|
||||
if ($key === 'null' || $key === '(null)') {
|
||||
return null;
|
||||
}
|
||||
|
||||
$list = [
|
||||
'true' => true,
|
||||
'(true)' => true,
|
||||
'false' => false,
|
||||
'(false)' => false,
|
||||
'empty' => '',
|
||||
'(empty)' => '',
|
||||
];
|
||||
|
||||
return isset($list[$key]) ? $list[$key] : $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the environment's HOME directory.
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
public static function getHomeDirectory()
|
||||
{
|
||||
if (getenv('HOME')) {
|
||||
return getenv('HOME');
|
||||
}
|
||||
|
||||
return (getenv('HOMEDRIVE') && getenv('HOMEPATH'))
|
||||
? getenv('HOMEDRIVE') . getenv('HOMEPATH')
|
||||
: null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed ...$parameters
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public static function dd(...$parameters)
|
||||
{
|
||||
dump(...$parameters);
|
||||
exit;
|
||||
}
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials;
|
||||
|
||||
use Exception;
|
||||
use GuzzleHttp\Exception\RequestException;
|
||||
use GuzzleHttp\Handler\MockHandler;
|
||||
use GuzzleHttp\Psr7\Response;
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
/**
|
||||
* Trait MockTrait
|
||||
*
|
||||
* @package AlibabaCloud\Credentials
|
||||
*/
|
||||
trait MockTrait
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private static $mockQueue = [];
|
||||
|
||||
/**
|
||||
* @var MockHandler
|
||||
*/
|
||||
private static $mock;
|
||||
|
||||
/**
|
||||
* @param integer $status
|
||||
* @param array $headers
|
||||
* @param array|string|object $body
|
||||
*/
|
||||
public static function mockResponse($status = 200, array $headers = [], $body = null)
|
||||
{
|
||||
if (is_array($body) || is_object($body)) {
|
||||
$body = json_encode($body);
|
||||
}
|
||||
|
||||
self::$mockQueue[] = new Response($status, $headers, $body);
|
||||
self::createHandlerStack();
|
||||
}
|
||||
|
||||
private static function createHandlerStack()
|
||||
{
|
||||
self::$mock = new MockHandler(self::$mockQueue);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $message
|
||||
* @param RequestInterface $request
|
||||
* @param ResponseInterface|null $response
|
||||
* @param Exception|null $previous
|
||||
* @param array $handlerContext
|
||||
*/
|
||||
public static function mockRequestException(
|
||||
$message,
|
||||
RequestInterface $request,
|
||||
ResponseInterface $response = null,
|
||||
Exception $previous = null,
|
||||
array $handlerContext = []
|
||||
) {
|
||||
self::$mockQueue[] = new RequestException(
|
||||
$message,
|
||||
$request,
|
||||
$response,
|
||||
$previous,
|
||||
$handlerContext
|
||||
);
|
||||
|
||||
self::createHandlerStack();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public static function cancelMock()
|
||||
{
|
||||
self::$mockQueue = [];
|
||||
self::$mock = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public static function hasMock()
|
||||
{
|
||||
return (bool)self::$mockQueue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MockHandler
|
||||
*/
|
||||
public static function getMock()
|
||||
{
|
||||
return self::$mock;
|
||||
}
|
||||
}
|
@ -0,0 +1,187 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials\Providers;
|
||||
|
||||
use AlibabaCloud\Credentials\Credentials;
|
||||
use AlibabaCloud\Credentials\Helper;
|
||||
use Closure;
|
||||
use InvalidArgumentException;
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* Class ChainProvider
|
||||
*
|
||||
* @package AlibabaCloud\Credentials\Providers
|
||||
*/
|
||||
class ChainProvider
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private static $customChains;
|
||||
|
||||
/**
|
||||
* @param callable ...$providers
|
||||
*/
|
||||
public static function set(...$providers)
|
||||
{
|
||||
if (empty($providers)) {
|
||||
throw new InvalidArgumentException('No providers in chain');
|
||||
}
|
||||
|
||||
foreach ($providers as $provider) {
|
||||
if (!$provider instanceof Closure) {
|
||||
throw new InvalidArgumentException('Providers must all be Closures');
|
||||
}
|
||||
}
|
||||
|
||||
self::$customChains = $providers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public static function hasCustomChain()
|
||||
{
|
||||
return (bool)self::$customChains;
|
||||
}
|
||||
|
||||
public static function flush()
|
||||
{
|
||||
self::$customChains = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
*/
|
||||
public static function customProvider($name)
|
||||
{
|
||||
foreach (self::$customChains as $provider) {
|
||||
$provider();
|
||||
|
||||
if (Credentials::has($name)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
*/
|
||||
public static function defaultProvider($name)
|
||||
{
|
||||
$providers = [
|
||||
self::env(),
|
||||
self::ini(),
|
||||
self::instance(),
|
||||
];
|
||||
|
||||
foreach ($providers as $provider) {
|
||||
$provider();
|
||||
|
||||
if (Credentials::has($name)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Closure
|
||||
*/
|
||||
public static function env()
|
||||
{
|
||||
return static function () {
|
||||
$accessKeyId = Helper::envNotEmpty('ALIBABA_CLOUD_ACCESS_KEY_ID');
|
||||
$accessKeySecret = Helper::envNotEmpty('ALIBABA_CLOUD_ACCESS_KEY_SECRET');
|
||||
|
||||
if ($accessKeyId && $accessKeySecret) {
|
||||
Credentials::set(
|
||||
self::getDefaultName(),
|
||||
[
|
||||
'type' => 'access_key',
|
||||
'access_key_id' => $accessKeyId,
|
||||
'access_key_secret' => $accessKeySecret,
|
||||
]
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public static function getDefaultName()
|
||||
{
|
||||
$name = Helper::envNotEmpty('ALIBABA_CLOUD_PROFILE');
|
||||
|
||||
if ($name) {
|
||||
return $name;
|
||||
}
|
||||
|
||||
return 'default';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Closure
|
||||
*/
|
||||
public static function ini()
|
||||
{
|
||||
return static function () {
|
||||
$filename = Helper::envNotEmpty('ALIBABA_CLOUD_CREDENTIALS_FILE');
|
||||
if (!$filename) {
|
||||
$filename = self::getDefaultFile();
|
||||
}
|
||||
|
||||
if (!Helper::inOpenBasedir($filename)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($filename !== self::getDefaultFile() && (!\is_readable($filename) || !\is_file($filename))) {
|
||||
throw new RuntimeException(
|
||||
'Credentials file is not readable: ' . $filename
|
||||
);
|
||||
}
|
||||
|
||||
$file_array = \parse_ini_file($filename, true);
|
||||
|
||||
if (\is_array($file_array) && !empty($file_array)) {
|
||||
foreach (\array_change_key_case($file_array) as $name => $configures) {
|
||||
Credentials::set($name, $configures);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default credential file.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getDefaultFile()
|
||||
{
|
||||
return Helper::getHomeDirectory() .
|
||||
DIRECTORY_SEPARATOR .
|
||||
'.alibabacloud' .
|
||||
DIRECTORY_SEPARATOR .
|
||||
'credentials';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Closure
|
||||
*/
|
||||
public static function instance()
|
||||
{
|
||||
return static function () {
|
||||
$instance = Helper::envNotEmpty('ALIBABA_CLOUD_ECS_METADATA');
|
||||
if ($instance) {
|
||||
Credentials::set(
|
||||
self::getDefaultName(),
|
||||
[
|
||||
'type' => 'ecs_ram_role',
|
||||
'role_name' => $instance,
|
||||
]
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials\Providers;
|
||||
|
||||
use AlibabaCloud\Credentials\Request\Request;
|
||||
use AlibabaCloud\Credentials\StsCredential;
|
||||
use Exception;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use AlibabaCloud\Tea\Response;
|
||||
use InvalidArgumentException;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* Class EcsRamRoleProvider
|
||||
*
|
||||
* @package AlibabaCloud\Credentials\Providers
|
||||
*/
|
||||
class EcsRamRoleProvider extends Provider
|
||||
{
|
||||
|
||||
/**
|
||||
* Expiration time slot for temporary security credentials.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $expirationSlot = 10;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $uri = 'http://100.100.100.200/latest/meta-data/ram/security-credentials/';
|
||||
|
||||
/**
|
||||
* Get credential.
|
||||
*
|
||||
* @return StsCredential
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function get()
|
||||
{
|
||||
$result = $this->getCredentialsInCache();
|
||||
|
||||
if ($result === null) {
|
||||
$result = $this->request();
|
||||
|
||||
if (!isset($result['AccessKeyId'], $result['AccessKeySecret'], $result['SecurityToken'])) {
|
||||
throw new RuntimeException($this->error);
|
||||
}
|
||||
|
||||
$this->cache($result->toArray());
|
||||
}
|
||||
|
||||
return new StsCredential(
|
||||
$result['AccessKeyId'],
|
||||
$result['AccessKeySecret'],
|
||||
strtotime($result['Expiration']),
|
||||
$result['SecurityToken']
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get credentials by request.
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function request()
|
||||
{
|
||||
$credential = $this->credential;
|
||||
$url = $this->uri . $credential->getRoleName();
|
||||
|
||||
$options = [
|
||||
'http_errors' => false,
|
||||
'timeout' => 1,
|
||||
'connect_timeout' => 1,
|
||||
];
|
||||
|
||||
$result = Request::createClient()->request('GET', $url, $options);
|
||||
|
||||
if ($result->getStatusCode() === 404) {
|
||||
$message = 'The role was not found in the instance';
|
||||
throw new InvalidArgumentException($message);
|
||||
}
|
||||
|
||||
if ($result->getStatusCode() !== 200) {
|
||||
throw new RuntimeException('Error retrieving credentials from result: ' . $result->toJson());
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials\Providers;
|
||||
|
||||
use AlibabaCloud\Credentials\CredentialsInterface;
|
||||
use AlibabaCloud\Credentials\EcsRamRoleCredential;
|
||||
use AlibabaCloud\Credentials\RamRoleArnCredential;
|
||||
use AlibabaCloud\Credentials\RsaKeyPairCredential;
|
||||
|
||||
abstract class Provider
|
||||
{
|
||||
/**
|
||||
* For TSC Duration Seconds
|
||||
*/
|
||||
const DURATION_SECONDS = 3600;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $credentialsCache = [];
|
||||
|
||||
/**
|
||||
* Expiration time slot for temporary security credentials.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $expirationSlot = 180;
|
||||
|
||||
/**
|
||||
* @var RamRoleArnCredential|RsaKeyPairCredential|EcsRamRoleCredential
|
||||
*/
|
||||
protected $credential;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $error = 'Result contains no credentials';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $config = [];
|
||||
|
||||
/**
|
||||
* CredentialTrait constructor.
|
||||
*
|
||||
* @param CredentialsInterface $credential
|
||||
* @param array $config
|
||||
*/
|
||||
public function __construct(CredentialsInterface $credential, $config = [])
|
||||
{
|
||||
$this->credential = $credential;
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the credentials from the cache in the validity period.
|
||||
*
|
||||
* @return array|null
|
||||
*/
|
||||
public function getCredentialsInCache()
|
||||
{
|
||||
if (isset(self::$credentialsCache[(string)$this->credential])) {
|
||||
$result = self::$credentialsCache[(string)$this->credential];
|
||||
if (\strtotime($result['Expiration']) - \time() >= $this->expirationSlot) {
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cache credentials.
|
||||
*
|
||||
* @param array $credential
|
||||
*/
|
||||
protected function cache(array $credential)
|
||||
{
|
||||
self::$credentialsCache[(string)$this->credential] = $credential;
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials\Providers;
|
||||
|
||||
use AlibabaCloud\Credentials\Request\AssumeRole;
|
||||
use AlibabaCloud\Credentials\StsCredential;
|
||||
use Exception;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use RuntimeException;
|
||||
|
||||
class RamRoleArnProvider extends Provider
|
||||
{
|
||||
|
||||
/**
|
||||
* Get credential.
|
||||
*
|
||||
* @return StsCredential
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function get()
|
||||
{
|
||||
$credential = $this->getCredentialsInCache();
|
||||
|
||||
if (null === $credential) {
|
||||
$result = (new AssumeRole($this->credential))->request();
|
||||
|
||||
if ($result->getStatusCode() !== 200) {
|
||||
throw new RuntimeException(isset($result['Message']) ? $result['Message'] : (string)$result->getBody());
|
||||
}
|
||||
|
||||
if (!isset($result['Credentials']['AccessKeyId'],
|
||||
$result['Credentials']['AccessKeySecret'],
|
||||
$result['Credentials']['SecurityToken'])) {
|
||||
throw new RuntimeException($this->error);
|
||||
}
|
||||
|
||||
$credential = $result['Credentials'];
|
||||
$this->cache($credential);
|
||||
}
|
||||
|
||||
return new StsCredential(
|
||||
$credential['AccessKeyId'],
|
||||
$credential['AccessKeySecret'],
|
||||
strtotime($credential['Expiration']),
|
||||
$credential['SecurityToken']
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials\Providers;
|
||||
|
||||
use AlibabaCloud\Credentials\Request\GenerateSessionAccessKey;
|
||||
use AlibabaCloud\Credentials\StsCredential;
|
||||
use Exception;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* Class RsaKeyPairProvider
|
||||
*
|
||||
* @package AlibabaCloud\Credentials\Providers
|
||||
*/
|
||||
class RsaKeyPairProvider extends Provider
|
||||
{
|
||||
|
||||
/**
|
||||
* Get credential.
|
||||
*
|
||||
*
|
||||
* @return StsCredential
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function get()
|
||||
{
|
||||
$credential = $this->getCredentialsInCache();
|
||||
|
||||
if ($credential === null) {
|
||||
$result = (new GenerateSessionAccessKey($this->credential))->request();
|
||||
|
||||
if ($result->getStatusCode() !== 200) {
|
||||
throw new RuntimeException(isset($result['Message']) ? $result['Message'] : (string)$result->getBody());
|
||||
}
|
||||
|
||||
if (!isset($result['SessionAccessKey']['SessionAccessKeyId'],
|
||||
$result['SessionAccessKey']['SessionAccessKeySecret'])) {
|
||||
throw new RuntimeException($this->error);
|
||||
}
|
||||
|
||||
$credential = $result['SessionAccessKey'];
|
||||
$this->cache($credential);
|
||||
}
|
||||
|
||||
return new StsCredential(
|
||||
$credential['SessionAccessKeyId'],
|
||||
$credential['SessionAccessKeySecret'],
|
||||
strtotime($credential['Expiration'])
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,218 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials;
|
||||
|
||||
use AlibabaCloud\Credentials\Providers\RamRoleArnProvider;
|
||||
use AlibabaCloud\Credentials\Signature\ShaHmac1Signature;
|
||||
use Exception;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* Use the AssumeRole of the RAM account to complete the authentication.
|
||||
*/
|
||||
class RamRoleArnCredential implements CredentialsInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $accessKeyId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $accessKeySecret;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $roleArn;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $roleSessionName;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $policy;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $config;
|
||||
|
||||
/**
|
||||
* RamRoleArnCredential constructor.
|
||||
*
|
||||
* @param array $credential
|
||||
* @param array $config
|
||||
*/
|
||||
public function __construct(array $credential = [], array $config = [])
|
||||
{
|
||||
$this->filterParameters($credential);
|
||||
$this->filterPolicy($credential);
|
||||
|
||||
Filter::accessKey($credential['access_key_id'], $credential['access_key_secret']);
|
||||
|
||||
$this->config = $config;
|
||||
$this->accessKeyId = $credential['access_key_id'];
|
||||
$this->accessKeySecret = $credential['access_key_secret'];
|
||||
$this->roleArn = $credential['role_arn'];
|
||||
$this->roleSessionName = $credential['role_session_name'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $credential
|
||||
*/
|
||||
private function filterParameters(array $credential)
|
||||
{
|
||||
if (!isset($credential['access_key_id'])) {
|
||||
throw new InvalidArgumentException('Missing required access_key_id option in config for ram_role_arn');
|
||||
}
|
||||
|
||||
if (!isset($credential['access_key_secret'])) {
|
||||
throw new InvalidArgumentException('Missing required access_key_secret option in config for ram_role_arn');
|
||||
}
|
||||
|
||||
if (!isset($credential['role_arn'])) {
|
||||
throw new InvalidArgumentException('Missing required role_arn option in config for ram_role_arn');
|
||||
}
|
||||
|
||||
if (!isset($credential['role_session_name'])) {
|
||||
throw new InvalidArgumentException('Missing required role_session_name option in config for ram_role_arn');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $credential
|
||||
*/
|
||||
private function filterPolicy(array $credential)
|
||||
{
|
||||
if (isset($credential['policy'])) {
|
||||
if (is_string($credential['policy'])) {
|
||||
$this->policy = $credential['policy'];
|
||||
}
|
||||
|
||||
if (is_array($credential['policy'])) {
|
||||
$this->policy = json_encode($credential['policy']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getConfig()
|
||||
{
|
||||
return $this->config;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getRoleArn()
|
||||
{
|
||||
return $this->roleArn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getRoleSessionName()
|
||||
{
|
||||
return $this->roleSessionName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPolicy()
|
||||
{
|
||||
return $this->policy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return "$this->accessKeyId#$this->accessKeySecret#$this->roleArn#$this->roleSessionName";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ShaHmac1Signature
|
||||
*/
|
||||
public function getSignature()
|
||||
{
|
||||
return new ShaHmac1Signature();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getOriginalAccessKeyId()
|
||||
{
|
||||
return $this->accessKeyId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getOriginalAccessKeySecret()
|
||||
{
|
||||
return $this->accessKeySecret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function getAccessKeyId()
|
||||
{
|
||||
return $this->getSessionCredential()->getAccessKeyId();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return StsCredential
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
protected function getSessionCredential()
|
||||
{
|
||||
return (new RamRoleArnProvider($this))->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function getAccessKeySecret()
|
||||
{
|
||||
return $this->getSessionCredential()->getAccessKeySecret();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function getSecurityToken()
|
||||
{
|
||||
return $this->getSessionCredential()->getSecurityToken();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function getExpiration()
|
||||
{
|
||||
return $this->getSessionCredential()->getExpiration();
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials\Request;
|
||||
|
||||
use AlibabaCloud\Credentials\Providers\Provider;
|
||||
use AlibabaCloud\Credentials\RamRoleArnCredential;
|
||||
use AlibabaCloud\Credentials\Signature\ShaHmac1Signature;
|
||||
|
||||
/**
|
||||
* Retrieving assume role credentials.
|
||||
*/
|
||||
class AssumeRole extends Request
|
||||
{
|
||||
/**
|
||||
* AssumeRole constructor.
|
||||
*
|
||||
* @param RamRoleArnCredential $arnCredential
|
||||
*/
|
||||
public function __construct(RamRoleArnCredential $arnCredential)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->signature = new ShaHmac1Signature();
|
||||
$this->credential = $arnCredential;
|
||||
$this->uri = $this->uri->withHost('sts.aliyuncs.com');
|
||||
$this->options['verify'] = false;
|
||||
$this->options['query']['RoleArn'] = $arnCredential->getRoleArn();
|
||||
$this->options['query']['RoleSessionName'] = $arnCredential->getRoleSessionName();
|
||||
$this->options['query']['DurationSeconds'] = Provider::DURATION_SECONDS;
|
||||
$this->options['query']['AccessKeyId'] = $this->credential->getOriginalAccessKeyId();
|
||||
$this->options['query']['Version'] = '2015-04-01';
|
||||
$this->options['query']['Action'] = 'AssumeRole';
|
||||
$this->options['query']['RegionId'] = 'cn-hangzhou';
|
||||
if ($arnCredential->getPolicy()) {
|
||||
$this->options['query']['Policy'] = $arnCredential->getPolicy();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials\Request;
|
||||
|
||||
use AlibabaCloud\Credentials\Providers\Provider;
|
||||
use AlibabaCloud\Credentials\RsaKeyPairCredential;
|
||||
use AlibabaCloud\Credentials\Signature\ShaHmac256WithRsaSignature;
|
||||
|
||||
/**
|
||||
* Use the RSA key pair to complete the authentication (supported only on Japanese site)
|
||||
*/
|
||||
class GenerateSessionAccessKey extends Request
|
||||
{
|
||||
/**
|
||||
* GenerateSessionAccessKey constructor.
|
||||
*
|
||||
* @param RsaKeyPairCredential $credential
|
||||
*/
|
||||
public function __construct(RsaKeyPairCredential $credential)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->signature = new ShaHmac256WithRsaSignature();
|
||||
$this->credential = $credential;
|
||||
$this->uri = $this->uri->withHost('sts.ap-northeast-1.aliyuncs.com');
|
||||
$this->options['verify'] = false;
|
||||
$this->options['query']['Version'] = '2015-04-01';
|
||||
$this->options['query']['Action'] = 'GenerateSessionAccessKey';
|
||||
$this->options['query']['RegionId'] = 'cn-hangzhou';
|
||||
$this->options['query']['AccessKeyId'] = $credential->getPublicKeyId();
|
||||
$this->options['query']['PublicKeyId'] = $credential->getPublicKeyId();
|
||||
$this->options['query']['DurationSeconds'] = Provider::DURATION_SECONDS;
|
||||
}
|
||||
}
|
@ -0,0 +1,155 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials\Request;
|
||||
|
||||
use AlibabaCloud\Credentials\Credentials;
|
||||
use AlibabaCloud\Credentials\EcsRamRoleCredential;
|
||||
use AlibabaCloud\Credentials\Helper;
|
||||
use AlibabaCloud\Credentials\RamRoleArnCredential;
|
||||
use AlibabaCloud\Credentials\Signature\ShaHmac1Signature;
|
||||
use AlibabaCloud\Credentials\Signature\ShaHmac256WithRsaSignature;
|
||||
use Exception;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\HandlerStack;
|
||||
use GuzzleHttp\Middleware;
|
||||
use GuzzleHttp\Psr7\Uri;
|
||||
use AlibabaCloud\Tea\Response;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
/**
|
||||
* RESTful RPC Request.
|
||||
*/
|
||||
class Request
|
||||
{
|
||||
|
||||
/**
|
||||
* Request Connect Timeout
|
||||
*/
|
||||
const CONNECT_TIMEOUT = 5;
|
||||
|
||||
/**
|
||||
* Request Timeout
|
||||
*/
|
||||
const TIMEOUT = 10;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private static $config = [];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $options = [];
|
||||
|
||||
/**
|
||||
* @var Uri
|
||||
*/
|
||||
public $uri;
|
||||
|
||||
/**
|
||||
* @var EcsRamRoleCredential|RamRoleArnCredential
|
||||
*/
|
||||
protected $credential;
|
||||
|
||||
/**
|
||||
* @var ShaHmac256WithRsaSignature|ShaHmac1Signature
|
||||
*/
|
||||
protected $signature;
|
||||
|
||||
/**
|
||||
* Request constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->uri = (new Uri())->withScheme('https');
|
||||
$this->options['http_errors'] = false;
|
||||
$this->options['connect_timeout'] = self::CONNECT_TIMEOUT;
|
||||
$this->options['timeout'] = self::TIMEOUT;
|
||||
|
||||
// Turn on debug mode based on environment variable.
|
||||
if (strtolower(Helper::env('DEBUG')) === 'sdk') {
|
||||
$this->options['debug'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ResponseInterface
|
||||
* @throws Exception
|
||||
*/
|
||||
public function request()
|
||||
{
|
||||
$this->options['query']['Format'] = 'JSON';
|
||||
$this->options['query']['SignatureMethod'] = $this->signature->getMethod();
|
||||
$this->options['query']['SignatureVersion'] = $this->signature->getVersion();
|
||||
$this->options['query']['SignatureNonce'] = self::uuid(json_encode($this->options['query']));
|
||||
$this->options['query']['Timestamp'] = gmdate('Y-m-d\TH:i:s\Z');
|
||||
$this->options['query']['Signature'] = $this->signature->sign(
|
||||
self::signString('GET', $this->options['query']),
|
||||
$this->credential->getOriginalAccessKeySecret() . '&'
|
||||
);
|
||||
return self::createClient()->request('GET', (string)$this->uri, $this->options);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $salt
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function uuid($salt)
|
||||
{
|
||||
return md5($salt . uniqid(md5(microtime(true)), true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $method
|
||||
* @param array $parameters
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function signString($method, array $parameters)
|
||||
{
|
||||
ksort($parameters);
|
||||
$canonicalized = '';
|
||||
foreach ($parameters as $key => $value) {
|
||||
$canonicalized .= '&' . self::percentEncode($key) . '=' . self::percentEncode($value);
|
||||
}
|
||||
|
||||
return $method . '&%2F&' . self::percentEncode(substr($canonicalized, 1));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $string
|
||||
*
|
||||
* @return null|string|string[]
|
||||
*/
|
||||
private static function percentEncode($string)
|
||||
{
|
||||
$result = rawurlencode($string);
|
||||
$result = str_replace(['+', '*'], ['%20', '%2A'], $result);
|
||||
$result = preg_replace('/%7E/', '~', $result);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Client
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function createClient()
|
||||
{
|
||||
if (Credentials::hasMock()) {
|
||||
$stack = HandlerStack::create(Credentials::getMock());
|
||||
} else {
|
||||
$stack = HandlerStack::create();
|
||||
}
|
||||
|
||||
$stack->push(Middleware::mapResponse(static function (ResponseInterface $response) {
|
||||
return new Response($response);
|
||||
}));
|
||||
|
||||
self::$config['handler'] = $stack;
|
||||
|
||||
return new Client(self::$config);
|
||||
}
|
||||
}
|
@ -0,0 +1,158 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials;
|
||||
|
||||
use AlibabaCloud\Credentials\Providers\RsaKeyPairProvider;
|
||||
use AlibabaCloud\Credentials\Signature\ShaHmac1Signature;
|
||||
use Exception;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* Use the RSA key pair to complete the authentication (supported only on Japanese site)
|
||||
*/
|
||||
class RsaKeyPairCredential implements CredentialsInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $publicKeyId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $privateKey;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $config;
|
||||
|
||||
/**
|
||||
* RsaKeyPairCredential constructor.
|
||||
*
|
||||
* @param string $public_key_id
|
||||
* @param string $private_key_file
|
||||
* @param array $config
|
||||
*/
|
||||
public function __construct($public_key_id, $private_key_file, array $config = [])
|
||||
{
|
||||
Filter::publicKeyId($public_key_id);
|
||||
Filter::privateKeyFile($private_key_file);
|
||||
|
||||
$this->publicKeyId = $public_key_id;
|
||||
$this->config = $config;
|
||||
try {
|
||||
$this->privateKey = file_get_contents($private_key_file);
|
||||
} catch (Exception $exception) {
|
||||
throw new InvalidArgumentException($exception->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getConfig()
|
||||
{
|
||||
return $this->config;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getOriginalAccessKeyId()
|
||||
{
|
||||
return $this->getPublicKeyId();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPublicKeyId()
|
||||
{
|
||||
return $this->publicKeyId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getOriginalAccessKeySecret()
|
||||
{
|
||||
return $this->getPrivateKey();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getPrivateKey()
|
||||
{
|
||||
return $this->privateKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return "publicKeyId#$this->publicKeyId";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ShaHmac1Signature
|
||||
*/
|
||||
public function getSignature()
|
||||
{
|
||||
return new ShaHmac1Signature();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function getAccessKeyId()
|
||||
{
|
||||
return $this->getSessionCredential()->getAccessKeyId();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return StsCredential
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
protected function getSessionCredential()
|
||||
{
|
||||
return (new RsaKeyPairProvider($this))->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function getAccessKeySecret()
|
||||
{
|
||||
return $this->getSessionCredential()->getAccessKeySecret();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function getSecurityToken()
|
||||
{
|
||||
return $this->getSessionCredential()->getSecurityToken();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function getExpiration()
|
||||
{
|
||||
return $this->getSessionCredential()->getExpiration();
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials\Signature;
|
||||
|
||||
/**
|
||||
* Class BearerTokenSignature
|
||||
*
|
||||
* @package AlibabaCloud\Credentials\Signature
|
||||
*/
|
||||
class BearerTokenSignature implements SignatureInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getMethod()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return 'BEARERTOKEN';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getVersion()
|
||||
{
|
||||
return '1.0';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $string
|
||||
* @param string $accessKeySecret
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function sign($string, $accessKeySecret)
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials\Signature;
|
||||
|
||||
/**
|
||||
* Class ShaHmac1Signature
|
||||
*
|
||||
* @package AlibabaCloud\Credentials\Signature
|
||||
*/
|
||||
class ShaHmac1Signature implements SignatureInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getMethod()
|
||||
{
|
||||
return 'HMAC-SHA1';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getVersion()
|
||||
{
|
||||
return '1.0';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $string
|
||||
* @param string $accessKeySecret
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function sign($string, $accessKeySecret)
|
||||
{
|
||||
return base64_encode(hash_hmac('sha1', $string, $accessKeySecret, true));
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials\Signature;
|
||||
|
||||
/**
|
||||
* Class ShaHmac256Signature
|
||||
*
|
||||
* @package AlibabaCloud\Credentials\Signature
|
||||
*/
|
||||
class ShaHmac256Signature implements SignatureInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getMethod()
|
||||
{
|
||||
return 'HMAC-SHA256';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getVersion()
|
||||
{
|
||||
return '1.0';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $string
|
||||
* @param string $accessKeySecret
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function sign($string, $accessKeySecret)
|
||||
{
|
||||
return base64_encode(hash_hmac('sha256', $string, $accessKeySecret, true));
|
||||
}
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials\Signature;
|
||||
|
||||
use Exception;
|
||||
use InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* Class ShaHmac256WithRsaSignature
|
||||
*
|
||||
* @package AlibabaCloud\Credentials\Signature
|
||||
*/
|
||||
class ShaHmac256WithRsaSignature implements SignatureInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getMethod()
|
||||
{
|
||||
return 'SHA256withRSA';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return 'PRIVATEKEY';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getVersion()
|
||||
{
|
||||
return '1.0';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $string
|
||||
* @param string $privateKey
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function sign($string, $privateKey)
|
||||
{
|
||||
$binarySignature = '';
|
||||
try {
|
||||
openssl_sign(
|
||||
$string,
|
||||
$binarySignature,
|
||||
$privateKey,
|
||||
\OPENSSL_ALGO_SHA256
|
||||
);
|
||||
} catch (Exception $exception) {
|
||||
throw new InvalidArgumentException(
|
||||
$exception->getMessage()
|
||||
);
|
||||
}
|
||||
|
||||
return base64_encode($binarySignature);
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials\Signature;
|
||||
|
||||
/**
|
||||
* Interface SignatureInterface
|
||||
*
|
||||
* @package AlibabaCloud\Credentials\Signature
|
||||
*/
|
||||
interface SignatureInterface
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getMethod();
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getVersion();
|
||||
|
||||
/**
|
||||
* @param string $string
|
||||
* @param string $accessKeySecret
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function sign($string, $accessKeySecret);
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getType();
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Credentials;
|
||||
|
||||
use AlibabaCloud\Credentials\Signature\ShaHmac1Signature;
|
||||
|
||||
/**
|
||||
* Use the STS Token to complete the authentication.
|
||||
*/
|
||||
class StsCredential implements CredentialsInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $accessKeyId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $accessKeySecret;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $securityToken;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $expiration;
|
||||
|
||||
/**
|
||||
* StsCredential constructor.
|
||||
*
|
||||
* @param string $access_key_id Access key ID
|
||||
* @param string $access_key_secret Access Key Secret
|
||||
* @param int $expiration
|
||||
* @param string $security_token Security Token
|
||||
*/
|
||||
public function __construct($access_key_id, $access_key_secret, $expiration, $security_token = '')
|
||||
{
|
||||
Filter::accessKey($access_key_id, $access_key_secret);
|
||||
Filter::expiration($expiration);
|
||||
$this->accessKeyId = $access_key_id;
|
||||
$this->accessKeySecret = $access_key_secret;
|
||||
$this->expiration = $expiration;
|
||||
$this->securityToken = $security_token;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getExpiration()
|
||||
{
|
||||
return $this->expiration;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAccessKeyId()
|
||||
{
|
||||
return $this->accessKeyId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAccessKeySecret()
|
||||
{
|
||||
return $this->accessKeySecret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getSecurityToken()
|
||||
{
|
||||
return $this->securityToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return "$this->accessKeyId#$this->accessKeySecret#$this->securityToken";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ShaHmac1Signature
|
||||
*/
|
||||
public function getSignature()
|
||||
{
|
||||
return new ShaHmac1Signature();
|
||||
}
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/*
|
||||
* This document has been generated with
|
||||
* https://mlocati.github.io/php-cs-fixer-configurator/#version:2.15|configurator
|
||||
* you can change this configuration by importing this file.
|
||||
*/
|
||||
|
||||
return PhpCsFixer\Config::create()
|
||||
->setRiskyAllowed(true)
|
||||
->setIndent(' ')
|
||||
->setRules([
|
||||
'@PSR2' => true,
|
||||
'@PhpCsFixer' => true,
|
||||
'@Symfony:risky' => true,
|
||||
'concat_space' => ['spacing' => 'one'],
|
||||
'array_syntax' => ['syntax' => 'short'],
|
||||
'array_indentation' => true,
|
||||
'combine_consecutive_unsets' => true,
|
||||
'method_separation' => true,
|
||||
'single_quote' => true,
|
||||
'declare_equal_normalize' => true,
|
||||
'function_typehint_space' => true,
|
||||
'hash_to_slash_comment' => true,
|
||||
'include' => true,
|
||||
'lowercase_cast' => true,
|
||||
'no_multiline_whitespace_before_semicolons' => true,
|
||||
'no_leading_import_slash' => true,
|
||||
'no_multiline_whitespace_around_double_arrow' => true,
|
||||
'no_spaces_around_offset' => true,
|
||||
'no_unneeded_control_parentheses' => true,
|
||||
'no_unused_imports' => true,
|
||||
'no_whitespace_before_comma_in_array' => true,
|
||||
'no_whitespace_in_blank_line' => true,
|
||||
'object_operator_without_whitespace' => true,
|
||||
'single_blank_line_before_namespace' => true,
|
||||
'single_class_element_per_statement' => true,
|
||||
'space_after_semicolon' => true,
|
||||
'standardize_not_equals' => true,
|
||||
'ternary_operator_spaces' => true,
|
||||
'trailing_comma_in_multiline_array' => true,
|
||||
'trim_array_spaces' => true,
|
||||
'unary_operator_spaces' => true,
|
||||
'whitespace_after_comma_in_array' => true,
|
||||
'no_extra_consecutive_blank_lines' => [
|
||||
'curly_brace_block',
|
||||
'extra',
|
||||
'parenthesis_brace_block',
|
||||
'square_brace_block',
|
||||
'throw',
|
||||
'use',
|
||||
],
|
||||
'binary_operator_spaces' => [
|
||||
'align_double_arrow' => true,
|
||||
'align_equals' => true,
|
||||
],
|
||||
'braces' => [
|
||||
'allow_single_line_closure' => true,
|
||||
],
|
||||
])
|
||||
->setFinder(
|
||||
PhpCsFixer\Finder::create()
|
||||
->exclude('vendor')
|
||||
->exclude('tests')
|
||||
->in(__DIR__)
|
||||
);
|
@ -0,0 +1,31 @@
|
||||
[English](README.md) | 简体中文
|
||||
|
||||
![](https://aliyunsdk-pages.alicdn.com/icons/AlibabaCloud.svg)
|
||||
|
||||
## Alibaba Cloud OpenApi Client
|
||||
|
||||
## 安装
|
||||
|
||||
### Composer
|
||||
|
||||
```bash
|
||||
composer require alibabacloud/darabonba-openapi
|
||||
```
|
||||
|
||||
## 问题
|
||||
|
||||
[提交 Issue](https://github.com/aliyun/darabonba-openapi/issues/new),不符合指南的问题可能会立即关闭。
|
||||
|
||||
## 发行说明
|
||||
|
||||
每个版本的详细更改记录在[发行说明](./ChangeLog.txt)中。
|
||||
|
||||
## 相关
|
||||
|
||||
* [最新源码](https://github.com/aliyun/darabonba-openapi)
|
||||
|
||||
## 许可证
|
||||
|
||||
[Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
||||
Copyright (c) 2009-present, Alibaba Cloud All rights reserved.
|
@ -0,0 +1,31 @@
|
||||
English | [简体中文](README-CN.md)
|
||||
|
||||
![](https://aliyunsdk-pages.alicdn.com/icons/AlibabaCloud.svg)
|
||||
|
||||
## Alibaba Cloud OpenApi Client
|
||||
|
||||
## Installation
|
||||
|
||||
### Composer
|
||||
|
||||
```bash
|
||||
composer require alibabacloud/darabonba-openapi
|
||||
```
|
||||
|
||||
## Issues
|
||||
|
||||
[Opening an Issue](https://github.com/aliyun/darabonba-openapi/issues/new), Issues not conforming to the guidelines may be closed immediately.
|
||||
|
||||
## Changelog
|
||||
|
||||
Detailed changes for each release are documented in the [release notes](./ChangeLog.txt).
|
||||
|
||||
## References
|
||||
|
||||
* [Latest Release](https://github.com/aliyun/darabonba-openapi)
|
||||
|
||||
## License
|
||||
|
||||
[Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
||||
Copyright (c) 2009-present, Alibaba Cloud All rights reserved.
|
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
if (file_exists(__DIR__ . \DIRECTORY_SEPARATOR . 'vendor' . \DIRECTORY_SEPARATOR . 'autoload.php')) {
|
||||
require_once __DIR__ . \DIRECTORY_SEPARATOR . 'vendor' . \DIRECTORY_SEPARATOR . 'autoload.php';
|
||||
}
|
||||
|
||||
spl_autoload_register(function ($class) {
|
||||
$name = str_replace('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;
|
||||
});
|
@ -0,0 +1,32 @@
|
||||
{
|
||||
"name": "alibabacloud/darabonba-openapi",
|
||||
"description": "Alibaba Cloud OpenApi Client",
|
||||
"type": "library",
|
||||
"license": "Apache-2.0",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Alibaba Cloud SDK",
|
||||
"email": "sdk-team@alibabacloud.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">5.5",
|
||||
"alibabacloud/tea-utils": "^0.2.0",
|
||||
"alibabacloud/credentials": "^1.1",
|
||||
"alibabacloud/openapi-util": "^0.1.7"
|
||||
},
|
||||
"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
|
||||
}
|
@ -0,0 +1,387 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace Darabonba\OpenApi\Models;
|
||||
|
||||
use AlibabaCloud\Credentials\Credential;
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
/**
|
||||
* Model for initing client.
|
||||
*/
|
||||
class Config extends Model
|
||||
{
|
||||
/**
|
||||
* @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 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 Algorithm
|
||||
*
|
||||
* @example ACS3-HMAC-SHA256
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $signatureAlgorithm;
|
||||
protected $_default = [
|
||||
'accessKeyId' => '',
|
||||
'accessKeySecret' => '',
|
||||
'securityToken' => '',
|
||||
'protocol' => 'http',
|
||||
'regionId' => '',
|
||||
'readTimeout' => '',
|
||||
'connectTimeout' => '',
|
||||
'httpProxy' => '',
|
||||
'httpsProxy' => '',
|
||||
'credential' => '',
|
||||
'endpoint' => '',
|
||||
'noProxy' => '',
|
||||
'maxIdleConns' => '',
|
||||
'network' => '',
|
||||
'userAgent' => '',
|
||||
'suffix' => '',
|
||||
'socks5Proxy' => '',
|
||||
'socks5NetWork' => '',
|
||||
'endpointType' => '',
|
||||
'openPlatformEndpoint' => '',
|
||||
'type' => '',
|
||||
'signatureAlgorithm' => '',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->accessKeyId) {
|
||||
$res['accessKeyId'] = $this->accessKeyId;
|
||||
}
|
||||
if (null !== $this->accessKeySecret) {
|
||||
$res['accessKeySecret'] = $this->accessKeySecret;
|
||||
}
|
||||
if (null !== $this->securityToken) {
|
||||
$res['securityToken'] = $this->securityToken;
|
||||
}
|
||||
if (null !== $this->protocol) {
|
||||
$res['protocol'] = $this->protocol;
|
||||
}
|
||||
if (null !== $this->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->signatureAlgorithm) {
|
||||
$res['signatureAlgorithm'] = $this->signatureAlgorithm;
|
||||
}
|
||||
|
||||
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['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['signatureAlgorithm'])) {
|
||||
$model->signatureAlgorithm = $map['signatureAlgorithm'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace Darabonba\OpenApi\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class OpenApiRequest extends Model
|
||||
{
|
||||
public $headers;
|
||||
|
||||
public $query;
|
||||
|
||||
public $body;
|
||||
|
||||
public $stream;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -0,0 +1,137 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace Darabonba\OpenApi\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class Params extends Model
|
||||
{
|
||||
/**
|
||||
* @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;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
@ -0,0 +1,935 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace Darabonba\OpenApi;
|
||||
|
||||
use AlibabaCloud\Credentials\Credential;
|
||||
use AlibabaCloud\Credentials\Credential\Config;
|
||||
use AlibabaCloud\OpenApiUtil\OpenApiUtilClient;
|
||||
use AlibabaCloud\Tea\Exception\TeaError;
|
||||
use AlibabaCloud\Tea\Exception\TeaUnableRetryError;
|
||||
use AlibabaCloud\Tea\Request;
|
||||
use AlibabaCloud\Tea\Tea;
|
||||
use AlibabaCloud\Tea\Utils\Utils;
|
||||
use AlibabaCloud\Tea\Utils\Utils\RuntimeOptions;
|
||||
use Darabonba\OpenApi\Models\OpenApiRequest;
|
||||
use Darabonba\OpenApi\Models\Params;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* This is for OpenApi SDK.
|
||||
*/
|
||||
class OpenApiClient
|
||||
{
|
||||
protected $_endpoint;
|
||||
|
||||
protected $_regionId;
|
||||
|
||||
protected $_protocol;
|
||||
|
||||
protected $_userAgent;
|
||||
|
||||
protected $_endpointRule;
|
||||
|
||||
protected $_endpointMap;
|
||||
|
||||
protected $_suffix;
|
||||
|
||||
protected $_readTimeout;
|
||||
|
||||
protected $_connectTimeout;
|
||||
|
||||
protected $_httpProxy;
|
||||
|
||||
protected $_httpsProxy;
|
||||
|
||||
protected $_socks5Proxy;
|
||||
|
||||
protected $_socks5NetWork;
|
||||
|
||||
protected $_noProxy;
|
||||
|
||||
protected $_network;
|
||||
|
||||
protected $_productId;
|
||||
|
||||
protected $_maxIdleConns;
|
||||
|
||||
protected $_endpointType;
|
||||
|
||||
protected $_openPlatformEndpoint;
|
||||
|
||||
protected $_credential;
|
||||
|
||||
protected $_signatureAlgorithm;
|
||||
|
||||
protected $_headers;
|
||||
|
||||
/**
|
||||
* Init client with Config.
|
||||
*
|
||||
* @param config config contains the necessary information to create a client
|
||||
* @param mixed $config
|
||||
*/
|
||||
public function __construct($config)
|
||||
{
|
||||
if (Utils::isUnset($config)) {
|
||||
throw new TeaError([
|
||||
'code' => 'ParameterMissing',
|
||||
'message' => "'config' can not be unset",
|
||||
]);
|
||||
}
|
||||
if (!Utils::empty_($config->accessKeyId) && !Utils::empty_($config->accessKeySecret)) {
|
||||
if (!Utils::empty_($config->securityToken)) {
|
||||
$config->type = 'sts';
|
||||
} else {
|
||||
$config->type = 'access_key';
|
||||
}
|
||||
$credentialConfig = new Config([
|
||||
'accessKeyId' => $config->accessKeyId,
|
||||
'type' => $config->type,
|
||||
'accessKeySecret' => $config->accessKeySecret,
|
||||
'securityToken' => $config->securityToken,
|
||||
]);
|
||||
$this->_credential = new Credential($credentialConfig);
|
||||
} elseif (!Utils::isUnset($config->credential)) {
|
||||
$this->_credential = $config->credential;
|
||||
}
|
||||
$this->_endpoint = $config->endpoint;
|
||||
$this->_protocol = $config->protocol;
|
||||
$this->_regionId = $config->regionId;
|
||||
$this->_userAgent = $config->userAgent;
|
||||
$this->_readTimeout = $config->readTimeout;
|
||||
$this->_connectTimeout = $config->connectTimeout;
|
||||
$this->_httpProxy = $config->httpProxy;
|
||||
$this->_httpsProxy = $config->httpsProxy;
|
||||
$this->_noProxy = $config->noProxy;
|
||||
$this->_socks5Proxy = $config->socks5Proxy;
|
||||
$this->_socks5NetWork = $config->socks5NetWork;
|
||||
$this->_maxIdleConns = $config->maxIdleConns;
|
||||
$this->_signatureAlgorithm = $config->signatureAlgorithm;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encapsulate the request and invoke the network.
|
||||
*
|
||||
* @param string $action api name
|
||||
* @param string $version product version
|
||||
* @param string $protocol http or https
|
||||
* @param string $method e.g. GET
|
||||
* @param string $authType authorization type e.g. AK
|
||||
* @param string $bodyType response body type e.g. String
|
||||
* @param OpenApiRequest $request object of OpenApiRequest
|
||||
* @param RuntimeOptions $runtime which controls some details of call api, such as retry times
|
||||
*
|
||||
* @throws TeaError
|
||||
* @throws Exception
|
||||
* @throws TeaUnableRetryError
|
||||
*
|
||||
* @return array the response
|
||||
*/
|
||||
public function doRPCRequest($action, $version, $protocol, $method, $authType, $bodyType, $request, $runtime)
|
||||
{
|
||||
$request->validate();
|
||||
$runtime->validate();
|
||||
$_runtime = [
|
||||
'timeouted' => 'retry',
|
||||
'readTimeout' => Utils::defaultNumber($runtime->readTimeout, $this->_readTimeout),
|
||||
'connectTimeout' => Utils::defaultNumber($runtime->connectTimeout, $this->_connectTimeout),
|
||||
'httpProxy' => Utils::defaultString($runtime->httpProxy, $this->_httpProxy),
|
||||
'httpsProxy' => Utils::defaultString($runtime->httpsProxy, $this->_httpsProxy),
|
||||
'noProxy' => Utils::defaultString($runtime->noProxy, $this->_noProxy),
|
||||
'maxIdleConns' => Utils::defaultNumber($runtime->maxIdleConns, $this->_maxIdleConns),
|
||||
'retry' => [
|
||||
'retryable' => $runtime->autoretry,
|
||||
'maxAttempts' => Utils::defaultNumber($runtime->maxAttempts, 3),
|
||||
],
|
||||
'backoff' => [
|
||||
'policy' => Utils::defaultString($runtime->backoffPolicy, 'no'),
|
||||
'period' => Utils::defaultNumber($runtime->backoffPeriod, 1),
|
||||
],
|
||||
'ignoreSSL' => $runtime->ignoreSSL,
|
||||
];
|
||||
$_lastRequest = null;
|
||||
$_lastException = null;
|
||||
$_now = time();
|
||||
$_retryTimes = 0;
|
||||
while (Tea::allowRetry(@$_runtime['retry'], $_retryTimes, $_now)) {
|
||||
if ($_retryTimes > 0) {
|
||||
$_backoffTime = Tea::getBackoffTime(@$_runtime['backoff'], $_retryTimes);
|
||||
if ($_backoffTime > 0) {
|
||||
Tea::sleep($_backoffTime);
|
||||
}
|
||||
}
|
||||
$_retryTimes = $_retryTimes + 1;
|
||||
|
||||
try {
|
||||
$_request = new Request();
|
||||
$_request->protocol = Utils::defaultString($this->_protocol, $protocol);
|
||||
$_request->method = $method;
|
||||
$_request->pathname = '/';
|
||||
$_request->query = Tea::merge([
|
||||
'Action' => $action,
|
||||
'Format' => 'json',
|
||||
'Version' => $version,
|
||||
'Timestamp' => OpenApiUtilClient::getTimestamp(),
|
||||
'SignatureNonce' => Utils::getNonce(),
|
||||
], $request->query);
|
||||
$headers = $this->getRpcHeaders();
|
||||
if (Utils::isUnset($headers)) {
|
||||
// endpoint is setted in product client
|
||||
$_request->headers = [
|
||||
'host' => $this->_endpoint,
|
||||
'x-acs-version' => $version,
|
||||
'x-acs-action' => $action,
|
||||
'user-agent' => $this->getUserAgent(),
|
||||
];
|
||||
} else {
|
||||
$_request->headers = Tea::merge([
|
||||
'host' => $this->_endpoint,
|
||||
'x-acs-version' => $version,
|
||||
'x-acs-action' => $action,
|
||||
'user-agent' => $this->getUserAgent(),
|
||||
], $headers);
|
||||
}
|
||||
if (!Utils::isUnset($request->body)) {
|
||||
$m = Utils::assertAsMap($request->body);
|
||||
$tmp = Utils::anyifyMapValue(OpenApiUtilClient::query($m));
|
||||
$_request->body = Utils::toFormString($tmp);
|
||||
$_request->headers['content-type'] = 'application/x-www-form-urlencoded';
|
||||
}
|
||||
if (!Utils::equalString($authType, 'Anonymous')) {
|
||||
$accessKeyId = $this->getAccessKeyId();
|
||||
$accessKeySecret = $this->getAccessKeySecret();
|
||||
$securityToken = $this->getSecurityToken();
|
||||
if (!Utils::empty_($securityToken)) {
|
||||
$_request->query['SecurityToken'] = $securityToken;
|
||||
}
|
||||
$_request->query['SignatureMethod'] = 'HMAC-SHA1';
|
||||
$_request->query['SignatureVersion'] = '1.0';
|
||||
$_request->query['AccessKeyId'] = $accessKeyId;
|
||||
$t = null;
|
||||
if (!Utils::isUnset($request->body)) {
|
||||
$t = Utils::assertAsMap($request->body);
|
||||
}
|
||||
$signedParam = Tea::merge($_request->query, OpenApiUtilClient::query($t));
|
||||
$_request->query['Signature'] = OpenApiUtilClient::getRPCSignature($signedParam, $_request->method, $accessKeySecret);
|
||||
}
|
||||
$_lastRequest = $_request;
|
||||
$_response = Tea::send($_request, $_runtime);
|
||||
if (Utils::is4xx($_response->statusCode) || Utils::is5xx($_response->statusCode)) {
|
||||
$_res = Utils::readAsJSON($_response->body);
|
||||
$err = Utils::assertAsMap($_res);
|
||||
|
||||
throw new TeaError([
|
||||
'code' => '' . (string) (self::defaultAny(@$err['Code'], @$err['code'])) . '',
|
||||
'message' => 'code: ' . (string) ($_response->statusCode) . ', ' . (string) (self::defaultAny(@$err['Message'], @$err['message'])) . ' request id: ' . (string) (self::defaultAny(@$err['RequestId'], @$err['requestId'])) . '',
|
||||
'data' => $err,
|
||||
]);
|
||||
}
|
||||
if (Utils::equalString($bodyType, 'binary')) {
|
||||
$resp = [
|
||||
'body' => $_response->body,
|
||||
'headers' => $_response->headers,
|
||||
];
|
||||
|
||||
return $resp;
|
||||
}
|
||||
if (Utils::equalString($bodyType, 'byte')) {
|
||||
$byt = Utils::readAsBytes($_response->body);
|
||||
|
||||
return [
|
||||
'body' => $byt,
|
||||
'headers' => $_response->headers,
|
||||
];
|
||||
}
|
||||
if (Utils::equalString($bodyType, 'string')) {
|
||||
$str = Utils::readAsString($_response->body);
|
||||
|
||||
return [
|
||||
'body' => $str,
|
||||
'headers' => $_response->headers,
|
||||
];
|
||||
}
|
||||
if (Utils::equalString($bodyType, 'json')) {
|
||||
$obj = Utils::readAsJSON($_response->body);
|
||||
$res = Utils::assertAsMap($obj);
|
||||
|
||||
return [
|
||||
'body' => $res,
|
||||
'headers' => $_response->headers,
|
||||
];
|
||||
}
|
||||
if (Utils::equalString($bodyType, 'array')) {
|
||||
$arr = Utils::readAsJSON($_response->body);
|
||||
|
||||
return [
|
||||
'body' => $arr,
|
||||
'headers' => $_response->headers,
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
'headers' => $_response->headers,
|
||||
];
|
||||
} catch (Exception $e) {
|
||||
if (!($e instanceof TeaError)) {
|
||||
$e = new TeaError([], $e->getMessage(), $e->getCode(), $e);
|
||||
}
|
||||
if (Tea::isRetryable($e)) {
|
||||
$_lastException = $e;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
throw new TeaUnableRetryError($_lastRequest, $_lastException);
|
||||
}
|
||||
|
||||
/**
|
||||
* Encapsulate the request and invoke the network.
|
||||
*
|
||||
* @param string $action api name
|
||||
* @param string $version product version
|
||||
* @param string $protocol http or https
|
||||
* @param string $method e.g. GET
|
||||
* @param string $authType authorization type e.g. AK
|
||||
* @param string $pathname pathname of every api
|
||||
* @param string $bodyType response body type e.g. String
|
||||
* @param OpenApiRequest $request object of OpenApiRequest
|
||||
* @param RuntimeOptions $runtime which controls some details of call api, such as retry times
|
||||
*
|
||||
* @throws TeaError
|
||||
* @throws Exception
|
||||
* @throws TeaUnableRetryError
|
||||
*
|
||||
* @return array the response
|
||||
*/
|
||||
public function doROARequest($action, $version, $protocol, $method, $authType, $pathname, $bodyType, $request, $runtime)
|
||||
{
|
||||
$request->validate();
|
||||
$runtime->validate();
|
||||
$_runtime = [
|
||||
'timeouted' => 'retry',
|
||||
'readTimeout' => Utils::defaultNumber($runtime->readTimeout, $this->_readTimeout),
|
||||
'connectTimeout' => Utils::defaultNumber($runtime->connectTimeout, $this->_connectTimeout),
|
||||
'httpProxy' => Utils::defaultString($runtime->httpProxy, $this->_httpProxy),
|
||||
'httpsProxy' => Utils::defaultString($runtime->httpsProxy, $this->_httpsProxy),
|
||||
'noProxy' => Utils::defaultString($runtime->noProxy, $this->_noProxy),
|
||||
'maxIdleConns' => Utils::defaultNumber($runtime->maxIdleConns, $this->_maxIdleConns),
|
||||
'retry' => [
|
||||
'retryable' => $runtime->autoretry,
|
||||
'maxAttempts' => Utils::defaultNumber($runtime->maxAttempts, 3),
|
||||
],
|
||||
'backoff' => [
|
||||
'policy' => Utils::defaultString($runtime->backoffPolicy, 'no'),
|
||||
'period' => Utils::defaultNumber($runtime->backoffPeriod, 1),
|
||||
],
|
||||
'ignoreSSL' => $runtime->ignoreSSL,
|
||||
];
|
||||
$_lastRequest = null;
|
||||
$_lastException = null;
|
||||
$_now = time();
|
||||
$_retryTimes = 0;
|
||||
while (Tea::allowRetry(@$_runtime['retry'], $_retryTimes, $_now)) {
|
||||
if ($_retryTimes > 0) {
|
||||
$_backoffTime = Tea::getBackoffTime(@$_runtime['backoff'], $_retryTimes);
|
||||
if ($_backoffTime > 0) {
|
||||
Tea::sleep($_backoffTime);
|
||||
}
|
||||
}
|
||||
$_retryTimes = $_retryTimes + 1;
|
||||
|
||||
try {
|
||||
$_request = new Request();
|
||||
$_request->protocol = Utils::defaultString($this->_protocol, $protocol);
|
||||
$_request->method = $method;
|
||||
$_request->pathname = $pathname;
|
||||
$_request->headers = Tea::merge([
|
||||
'date' => Utils::getDateUTCString(),
|
||||
'host' => $this->_endpoint,
|
||||
'accept' => 'application/json',
|
||||
'x-acs-signature-nonce' => Utils::getNonce(),
|
||||
'x-acs-signature-method' => 'HMAC-SHA1',
|
||||
'x-acs-signature-version' => '1.0',
|
||||
'x-acs-version' => $version,
|
||||
'x-acs-action' => $action,
|
||||
'user-agent' => Utils::getUserAgent($this->_userAgent),
|
||||
], $request->headers);
|
||||
if (!Utils::isUnset($request->body)) {
|
||||
$_request->body = Utils::toJSONString($request->body);
|
||||
$_request->headers['content-type'] = 'application/json; charset=utf-8';
|
||||
}
|
||||
if (!Utils::isUnset($request->query)) {
|
||||
$_request->query = $request->query;
|
||||
}
|
||||
if (!Utils::equalString($authType, 'Anonymous')) {
|
||||
$accessKeyId = $this->getAccessKeyId();
|
||||
$accessKeySecret = $this->getAccessKeySecret();
|
||||
$securityToken = $this->getSecurityToken();
|
||||
if (!Utils::empty_($securityToken)) {
|
||||
$_request->headers['x-acs-accesskey-id'] = $accessKeyId;
|
||||
$_request->headers['x-acs-security-token'] = $securityToken;
|
||||
}
|
||||
$stringToSign = OpenApiUtilClient::getStringToSign($_request);
|
||||
$_request->headers['authorization'] = 'acs ' . $accessKeyId . ':' . OpenApiUtilClient::getROASignature($stringToSign, $accessKeySecret) . '';
|
||||
}
|
||||
$_lastRequest = $_request;
|
||||
$_response = Tea::send($_request, $_runtime);
|
||||
if (Utils::equalNumber($_response->statusCode, 204)) {
|
||||
return [
|
||||
'headers' => $_response->headers,
|
||||
];
|
||||
}
|
||||
if (Utils::is4xx($_response->statusCode) || Utils::is5xx($_response->statusCode)) {
|
||||
$_res = Utils::readAsJSON($_response->body);
|
||||
$err = Utils::assertAsMap($_res);
|
||||
|
||||
throw new TeaError([
|
||||
'code' => '' . (string) (self::defaultAny(@$err['Code'], @$err['code'])) . '',
|
||||
'message' => 'code: ' . (string) ($_response->statusCode) . ', ' . (string) (self::defaultAny(@$err['Message'], @$err['message'])) . ' request id: ' . (string) (self::defaultAny(@$err['RequestId'], @$err['requestId'])) . '',
|
||||
'data' => $err,
|
||||
]);
|
||||
}
|
||||
if (Utils::equalString($bodyType, 'binary')) {
|
||||
$resp = [
|
||||
'body' => $_response->body,
|
||||
'headers' => $_response->headers,
|
||||
];
|
||||
|
||||
return $resp;
|
||||
}
|
||||
if (Utils::equalString($bodyType, 'byte')) {
|
||||
$byt = Utils::readAsBytes($_response->body);
|
||||
|
||||
return [
|
||||
'body' => $byt,
|
||||
'headers' => $_response->headers,
|
||||
];
|
||||
}
|
||||
if (Utils::equalString($bodyType, 'string')) {
|
||||
$str = Utils::readAsString($_response->body);
|
||||
|
||||
return [
|
||||
'body' => $str,
|
||||
'headers' => $_response->headers,
|
||||
];
|
||||
}
|
||||
if (Utils::equalString($bodyType, 'json')) {
|
||||
$obj = Utils::readAsJSON($_response->body);
|
||||
$res = Utils::assertAsMap($obj);
|
||||
|
||||
return [
|
||||
'body' => $res,
|
||||
'headers' => $_response->headers,
|
||||
];
|
||||
}
|
||||
if (Utils::equalString($bodyType, 'array')) {
|
||||
$arr = Utils::readAsJSON($_response->body);
|
||||
|
||||
return [
|
||||
'body' => $arr,
|
||||
'headers' => $_response->headers,
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
'headers' => $_response->headers,
|
||||
];
|
||||
} catch (Exception $e) {
|
||||
if (!($e instanceof TeaError)) {
|
||||
$e = new TeaError([], $e->getMessage(), $e->getCode(), $e);
|
||||
}
|
||||
if (Tea::isRetryable($e)) {
|
||||
$_lastException = $e;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
throw new TeaUnableRetryError($_lastRequest, $_lastException);
|
||||
}
|
||||
|
||||
/**
|
||||
* Encapsulate the request and invoke the network with form body.
|
||||
*
|
||||
* @param string $action api name
|
||||
* @param string $version product version
|
||||
* @param string $protocol http or https
|
||||
* @param string $method e.g. GET
|
||||
* @param string $authType authorization type e.g. AK
|
||||
* @param string $pathname pathname of every api
|
||||
* @param string $bodyType response body type e.g. String
|
||||
* @param OpenApiRequest $request object of OpenApiRequest
|
||||
* @param RuntimeOptions $runtime which controls some details of call api, such as retry times
|
||||
*
|
||||
* @throws TeaError
|
||||
* @throws Exception
|
||||
* @throws TeaUnableRetryError
|
||||
*
|
||||
* @return array the response
|
||||
*/
|
||||
public function doROARequestWithForm($action, $version, $protocol, $method, $authType, $pathname, $bodyType, $request, $runtime)
|
||||
{
|
||||
$request->validate();
|
||||
$runtime->validate();
|
||||
$_runtime = [
|
||||
'timeouted' => 'retry',
|
||||
'readTimeout' => Utils::defaultNumber($runtime->readTimeout, $this->_readTimeout),
|
||||
'connectTimeout' => Utils::defaultNumber($runtime->connectTimeout, $this->_connectTimeout),
|
||||
'httpProxy' => Utils::defaultString($runtime->httpProxy, $this->_httpProxy),
|
||||
'httpsProxy' => Utils::defaultString($runtime->httpsProxy, $this->_httpsProxy),
|
||||
'noProxy' => Utils::defaultString($runtime->noProxy, $this->_noProxy),
|
||||
'maxIdleConns' => Utils::defaultNumber($runtime->maxIdleConns, $this->_maxIdleConns),
|
||||
'retry' => [
|
||||
'retryable' => $runtime->autoretry,
|
||||
'maxAttempts' => Utils::defaultNumber($runtime->maxAttempts, 3),
|
||||
],
|
||||
'backoff' => [
|
||||
'policy' => Utils::defaultString($runtime->backoffPolicy, 'no'),
|
||||
'period' => Utils::defaultNumber($runtime->backoffPeriod, 1),
|
||||
],
|
||||
'ignoreSSL' => $runtime->ignoreSSL,
|
||||
];
|
||||
$_lastRequest = null;
|
||||
$_lastException = null;
|
||||
$_now = time();
|
||||
$_retryTimes = 0;
|
||||
while (Tea::allowRetry(@$_runtime['retry'], $_retryTimes, $_now)) {
|
||||
if ($_retryTimes > 0) {
|
||||
$_backoffTime = Tea::getBackoffTime(@$_runtime['backoff'], $_retryTimes);
|
||||
if ($_backoffTime > 0) {
|
||||
Tea::sleep($_backoffTime);
|
||||
}
|
||||
}
|
||||
$_retryTimes = $_retryTimes + 1;
|
||||
|
||||
try {
|
||||
$_request = new Request();
|
||||
$_request->protocol = Utils::defaultString($this->_protocol, $protocol);
|
||||
$_request->method = $method;
|
||||
$_request->pathname = $pathname;
|
||||
$_request->headers = Tea::merge([
|
||||
'date' => Utils::getDateUTCString(),
|
||||
'host' => $this->_endpoint,
|
||||
'accept' => 'application/json',
|
||||
'x-acs-signature-nonce' => Utils::getNonce(),
|
||||
'x-acs-signature-method' => 'HMAC-SHA1',
|
||||
'x-acs-signature-version' => '1.0',
|
||||
'x-acs-version' => $version,
|
||||
'x-acs-action' => $action,
|
||||
'user-agent' => Utils::getUserAgent($this->_userAgent),
|
||||
], $request->headers);
|
||||
if (!Utils::isUnset($request->body)) {
|
||||
$m = Utils::assertAsMap($request->body);
|
||||
$_request->body = OpenApiUtilClient::toForm($m);
|
||||
$_request->headers['content-type'] = 'application/x-www-form-urlencoded';
|
||||
}
|
||||
if (!Utils::isUnset($request->query)) {
|
||||
$_request->query = $request->query;
|
||||
}
|
||||
if (!Utils::equalString($authType, 'Anonymous')) {
|
||||
$accessKeyId = $this->getAccessKeyId();
|
||||
$accessKeySecret = $this->getAccessKeySecret();
|
||||
$securityToken = $this->getSecurityToken();
|
||||
if (!Utils::empty_($securityToken)) {
|
||||
$_request->headers['x-acs-accesskey-id'] = $accessKeyId;
|
||||
$_request->headers['x-acs-security-token'] = $securityToken;
|
||||
}
|
||||
$stringToSign = OpenApiUtilClient::getStringToSign($_request);
|
||||
$_request->headers['authorization'] = 'acs ' . $accessKeyId . ':' . OpenApiUtilClient::getROASignature($stringToSign, $accessKeySecret) . '';
|
||||
}
|
||||
$_lastRequest = $_request;
|
||||
$_response = Tea::send($_request, $_runtime);
|
||||
if (Utils::equalNumber($_response->statusCode, 204)) {
|
||||
return [
|
||||
'headers' => $_response->headers,
|
||||
];
|
||||
}
|
||||
if (Utils::is4xx($_response->statusCode) || Utils::is5xx($_response->statusCode)) {
|
||||
$_res = Utils::readAsJSON($_response->body);
|
||||
$err = Utils::assertAsMap($_res);
|
||||
|
||||
throw new TeaError([
|
||||
'code' => '' . (string) (self::defaultAny(@$err['Code'], @$err['code'])) . '',
|
||||
'message' => 'code: ' . (string) ($_response->statusCode) . ', ' . (string) (self::defaultAny(@$err['Message'], @$err['message'])) . ' request id: ' . (string) (self::defaultAny(@$err['RequestId'], @$err['requestId'])) . '',
|
||||
'data' => $err,
|
||||
]);
|
||||
}
|
||||
if (Utils::equalString($bodyType, 'binary')) {
|
||||
$resp = [
|
||||
'body' => $_response->body,
|
||||
'headers' => $_response->headers,
|
||||
];
|
||||
|
||||
return $resp;
|
||||
}
|
||||
if (Utils::equalString($bodyType, 'byte')) {
|
||||
$byt = Utils::readAsBytes($_response->body);
|
||||
|
||||
return [
|
||||
'body' => $byt,
|
||||
'headers' => $_response->headers,
|
||||
];
|
||||
}
|
||||
if (Utils::equalString($bodyType, 'string')) {
|
||||
$str = Utils::readAsString($_response->body);
|
||||
|
||||
return [
|
||||
'body' => $str,
|
||||
'headers' => $_response->headers,
|
||||
];
|
||||
}
|
||||
if (Utils::equalString($bodyType, 'json')) {
|
||||
$obj = Utils::readAsJSON($_response->body);
|
||||
$res = Utils::assertAsMap($obj);
|
||||
|
||||
return [
|
||||
'body' => $res,
|
||||
'headers' => $_response->headers,
|
||||
];
|
||||
}
|
||||
if (Utils::equalString($bodyType, 'array')) {
|
||||
$arr = Utils::readAsJSON($_response->body);
|
||||
|
||||
return [
|
||||
'body' => $arr,
|
||||
'headers' => $_response->headers,
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
'headers' => $_response->headers,
|
||||
];
|
||||
} catch (Exception $e) {
|
||||
if (!($e instanceof TeaError)) {
|
||||
$e = new TeaError([], $e->getMessage(), $e->getCode(), $e);
|
||||
}
|
||||
if (Tea::isRetryable($e)) {
|
||||
$_lastException = $e;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
throw new TeaUnableRetryError($_lastRequest, $_lastException);
|
||||
}
|
||||
|
||||
/**
|
||||
* Encapsulate the request and invoke the network.
|
||||
*
|
||||
* @param Params $params
|
||||
* @param OpenApiRequest $request object of OpenApiRequest
|
||||
* @param RuntimeOptions $runtime which controls some details of call api, such as retry times
|
||||
*
|
||||
* @throws TeaError
|
||||
* @throws Exception
|
||||
* @throws TeaUnableRetryError
|
||||
*
|
||||
* @return array the response
|
||||
*/
|
||||
public function doRequest($params, $request, $runtime)
|
||||
{
|
||||
$params->validate();
|
||||
$request->validate();
|
||||
$runtime->validate();
|
||||
$_runtime = [
|
||||
'timeouted' => 'retry',
|
||||
'readTimeout' => Utils::defaultNumber($runtime->readTimeout, $this->_readTimeout),
|
||||
'connectTimeout' => Utils::defaultNumber($runtime->connectTimeout, $this->_connectTimeout),
|
||||
'httpProxy' => Utils::defaultString($runtime->httpProxy, $this->_httpProxy),
|
||||
'httpsProxy' => Utils::defaultString($runtime->httpsProxy, $this->_httpsProxy),
|
||||
'noProxy' => Utils::defaultString($runtime->noProxy, $this->_noProxy),
|
||||
'maxIdleConns' => Utils::defaultNumber($runtime->maxIdleConns, $this->_maxIdleConns),
|
||||
'retry' => [
|
||||
'retryable' => $runtime->autoretry,
|
||||
'maxAttempts' => Utils::defaultNumber($runtime->maxAttempts, 3),
|
||||
],
|
||||
'backoff' => [
|
||||
'policy' => Utils::defaultString($runtime->backoffPolicy, 'no'),
|
||||
'period' => Utils::defaultNumber($runtime->backoffPeriod, 1),
|
||||
],
|
||||
'ignoreSSL' => $runtime->ignoreSSL,
|
||||
];
|
||||
$_lastRequest = null;
|
||||
$_lastException = null;
|
||||
$_now = time();
|
||||
$_retryTimes = 0;
|
||||
while (Tea::allowRetry(@$_runtime['retry'], $_retryTimes, $_now)) {
|
||||
if ($_retryTimes > 0) {
|
||||
$_backoffTime = Tea::getBackoffTime(@$_runtime['backoff'], $_retryTimes);
|
||||
if ($_backoffTime > 0) {
|
||||
Tea::sleep($_backoffTime);
|
||||
}
|
||||
}
|
||||
$_retryTimes = $_retryTimes + 1;
|
||||
|
||||
try {
|
||||
$_request = new Request();
|
||||
$_request->protocol = Utils::defaultString($this->_protocol, $params->protocol);
|
||||
$_request->method = $params->method;
|
||||
$_request->pathname = OpenApiUtilClient::getEncodePath($params->pathname);
|
||||
$_request->query = $request->query;
|
||||
// endpoint is setted in product client
|
||||
$_request->headers = Tea::merge([
|
||||
'host' => $this->_endpoint,
|
||||
'x-acs-version' => $params->version,
|
||||
'x-acs-action' => $params->action,
|
||||
'user-agent' => $this->getUserAgent(),
|
||||
'x-acs-date' => OpenApiUtilClient::getTimestamp(),
|
||||
'x-acs-signature-nonce' => Utils::getNonce(),
|
||||
'accept' => 'application/json',
|
||||
], $request->headers);
|
||||
$signatureAlgorithm = Utils::defaultString($this->_signatureAlgorithm, 'ACS3-HMAC-SHA256');
|
||||
$hashedRequestPayload = OpenApiUtilClient::hexEncode(OpenApiUtilClient::hash(Utils::toBytes(''), $signatureAlgorithm));
|
||||
if (!Utils::isUnset($request->body)) {
|
||||
if (Utils::equalString($params->reqBodyType, 'json')) {
|
||||
$jsonObj = Utils::toJSONString($request->body);
|
||||
$hashedRequestPayload = OpenApiUtilClient::hexEncode(OpenApiUtilClient::hash(Utils::toBytes($jsonObj), $signatureAlgorithm));
|
||||
$_request->body = $jsonObj;
|
||||
} else {
|
||||
$m = Utils::assertAsMap($request->body);
|
||||
$formObj = OpenApiUtilClient::toForm($m);
|
||||
$hashedRequestPayload = OpenApiUtilClient::hexEncode(OpenApiUtilClient::hash(Utils::toBytes($formObj), $signatureAlgorithm));
|
||||
$_request->body = $formObj;
|
||||
$_request->headers['content-type'] = 'application/x-www-form-urlencoded';
|
||||
}
|
||||
}
|
||||
if (!Utils::isUnset($request->stream)) {
|
||||
$tmp = Utils::readAsBytes($request->stream);
|
||||
$hashedRequestPayload = OpenApiUtilClient::hexEncode(OpenApiUtilClient::hash($tmp, $signatureAlgorithm));
|
||||
$_request->body = $tmp;
|
||||
}
|
||||
$_request->headers['x-acs-content-sha256'] = $hashedRequestPayload;
|
||||
if (!Utils::equalString($params->authType, 'Anonymous')) {
|
||||
$accessKeyId = $this->getAccessKeyId();
|
||||
$accessKeySecret = $this->getAccessKeySecret();
|
||||
$securityToken = $this->getSecurityToken();
|
||||
if (!Utils::empty_($securityToken)) {
|
||||
$_request->headers['x-acs-security-token'] = $securityToken;
|
||||
}
|
||||
$_request->headers['Authorization'] = OpenApiUtilClient::getAuthorization($_request, $signatureAlgorithm, $hashedRequestPayload, $accessKeyId, $accessKeySecret);
|
||||
}
|
||||
$_lastRequest = $_request;
|
||||
$_response = Tea::send($_request, $_runtime);
|
||||
if (Utils::is4xx($_response->statusCode) || Utils::is5xx($_response->statusCode)) {
|
||||
$_res = Utils::readAsJSON($_response->body);
|
||||
$err = Utils::assertAsMap($_res);
|
||||
|
||||
throw new TeaError([
|
||||
'code' => '' . (string) (self::defaultAny(@$err['Code'], @$err['code'])) . '',
|
||||
'message' => 'code: ' . (string) ($_response->statusCode) . ', ' . (string) (self::defaultAny(@$err['Message'], @$err['message'])) . ' request id: ' . (string) (self::defaultAny(@$err['RequestId'], @$err['requestId'])) . '',
|
||||
'data' => $err,
|
||||
]);
|
||||
}
|
||||
if (Utils::equalString($params->bodyType, 'binary')) {
|
||||
$resp = [
|
||||
'body' => $_response->body,
|
||||
'headers' => $_response->headers,
|
||||
];
|
||||
|
||||
return $resp;
|
||||
}
|
||||
if (Utils::equalString($params->bodyType, 'byte')) {
|
||||
$byt = Utils::readAsBytes($_response->body);
|
||||
|
||||
return [
|
||||
'body' => $byt,
|
||||
'headers' => $_response->headers,
|
||||
];
|
||||
}
|
||||
if (Utils::equalString($params->bodyType, 'string')) {
|
||||
$str = Utils::readAsString($_response->body);
|
||||
|
||||
return [
|
||||
'body' => $str,
|
||||
'headers' => $_response->headers,
|
||||
];
|
||||
}
|
||||
if (Utils::equalString($params->bodyType, 'json')) {
|
||||
$obj = Utils::readAsJSON($_response->body);
|
||||
$res = Utils::assertAsMap($obj);
|
||||
|
||||
return [
|
||||
'body' => $res,
|
||||
'headers' => $_response->headers,
|
||||
];
|
||||
}
|
||||
if (Utils::equalString($params->bodyType, 'array')) {
|
||||
$arr = Utils::readAsJSON($_response->body);
|
||||
|
||||
return [
|
||||
'body' => $arr,
|
||||
'headers' => $_response->headers,
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
'headers' => $_response->headers,
|
||||
];
|
||||
} catch (Exception $e) {
|
||||
if (!($e instanceof TeaError)) {
|
||||
$e = new TeaError([], $e->getMessage(), $e->getCode(), $e);
|
||||
}
|
||||
if (Tea::isRetryable($e)) {
|
||||
$_lastException = $e;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
throw new TeaUnableRetryError($_lastRequest, $_lastException);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Params $params
|
||||
* @param OpenApiRequest $request
|
||||
* @param RuntimeOptions $runtime
|
||||
*
|
||||
* @throws TeaError
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function callApi($params, $request, $runtime)
|
||||
{
|
||||
if (Utils::isUnset($params)) {
|
||||
throw new TeaError([
|
||||
'code' => 'ParameterMissing',
|
||||
'message' => "'params' can not be unset",
|
||||
]);
|
||||
}
|
||||
if (Utils::isUnset($this->_signatureAlgorithm) || !Utils::equalString($this->_signatureAlgorithm, 'v2')) {
|
||||
return $this->doRequest($params, $request, $runtime);
|
||||
}
|
||||
if (Utils::equalString($params->style, 'ROA') && Utils::equalString($params->reqBodyType, 'json')) {
|
||||
return $this->doROARequest($params->action, $params->version, $params->protocol, $params->method, $params->authType, $params->pathname, $params->bodyType, $request, $runtime);
|
||||
}
|
||||
if (Utils::equalString($params->style, 'ROA')) {
|
||||
return $this->doROARequestWithForm($params->action, $params->version, $params->protocol, $params->method, $params->authType, $params->pathname, $params->bodyType, $request, $runtime);
|
||||
}
|
||||
|
||||
return $this->doRPCRequest($params->action, $params->version, $params->protocol, $params->method, $params->authType, $params->bodyType, $request, $runtime);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user agent.
|
||||
*
|
||||
* @return string user agent
|
||||
*/
|
||||
public function getUserAgent()
|
||||
{
|
||||
return Utils::getUserAgent($this->_userAgent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get accesskey id by using credential.
|
||||
*
|
||||
* @return string accesskey id
|
||||
*/
|
||||
public function getAccessKeyId()
|
||||
{
|
||||
if (Utils::isUnset($this->_credential)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $this->_credential->getAccessKeyId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get accesskey secret by using credential.
|
||||
*
|
||||
* @return string accesskey secret
|
||||
*/
|
||||
public function getAccessKeySecret()
|
||||
{
|
||||
if (Utils::isUnset($this->_credential)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $this->_credential->getAccessKeySecret();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get security token by using credential.
|
||||
*
|
||||
* @return string security token
|
||||
*/
|
||||
public function getSecurityToken()
|
||||
{
|
||||
if (Utils::isUnset($this->_credential)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $this->_credential->getSecurityToken();
|
||||
}
|
||||
|
||||
/**
|
||||
* If inputValue is not null, return it or return defaultValue.
|
||||
*
|
||||
* @param mixed $inputValue users input value
|
||||
* @param mixed $defaultValue default value
|
||||
*
|
||||
* @return any the final result
|
||||
*/
|
||||
public static function defaultAny($inputValue, $defaultValue)
|
||||
{
|
||||
if (Utils::isUnset($inputValue)) {
|
||||
return $defaultValue;
|
||||
}
|
||||
|
||||
return $inputValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* If the endpointRule and config.endpoint are empty, throw error.
|
||||
*
|
||||
* @param \Darabonba\OpenApi\Models\Config $config config contains the necessary information to create a client
|
||||
*
|
||||
* @throws TeaError
|
||||
*/
|
||||
public function checkConfig($config)
|
||||
{
|
||||
if (Utils::empty_($this->_endpointRule) && Utils::empty_($config->endpoint)) {
|
||||
throw new TeaError([
|
||||
'code' => 'ParameterMissing',
|
||||
'message' => "'config.endpoint' can not be empty",
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* set RPC header for debug.
|
||||
*
|
||||
* @param string[] $headers headers for debug, this header can be used only once
|
||||
*/
|
||||
public function setRpcHeaders($headers)
|
||||
{
|
||||
$this->_headers = $headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* get RPC header for debug.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getRpcHeaders()
|
||||
{
|
||||
$headers = $this->_headers;
|
||||
$this->_headers = null;
|
||||
|
||||
return $headers;
|
||||
}
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/*
|
||||
* This document has been generated with
|
||||
* https://mlocati.github.io/php-cs-fixer-configurator/#version:2.15|configurator
|
||||
* you can change this configuration by importing this file.
|
||||
*/
|
||||
|
||||
return PhpCsFixer\Config::create()
|
||||
->setRiskyAllowed(true)
|
||||
->setIndent(' ')
|
||||
->setRules([
|
||||
'@PSR2' => true,
|
||||
'@PhpCsFixer' => true,
|
||||
'@Symfony:risky' => true,
|
||||
'concat_space' => ['spacing' => 'one'],
|
||||
'array_syntax' => ['syntax' => 'short'],
|
||||
'array_indentation' => true,
|
||||
'combine_consecutive_unsets' => true,
|
||||
'method_separation' => true,
|
||||
'single_quote' => true,
|
||||
'declare_equal_normalize' => true,
|
||||
'function_typehint_space' => true,
|
||||
'hash_to_slash_comment' => true,
|
||||
'include' => true,
|
||||
'lowercase_cast' => true,
|
||||
'no_multiline_whitespace_before_semicolons' => true,
|
||||
'no_leading_import_slash' => true,
|
||||
'no_multiline_whitespace_around_double_arrow' => true,
|
||||
'no_spaces_around_offset' => true,
|
||||
'no_unneeded_control_parentheses' => true,
|
||||
'no_unused_imports' => true,
|
||||
'no_whitespace_before_comma_in_array' => true,
|
||||
'no_whitespace_in_blank_line' => true,
|
||||
'object_operator_without_whitespace' => true,
|
||||
'single_blank_line_before_namespace' => true,
|
||||
'single_class_element_per_statement' => true,
|
||||
'space_after_semicolon' => true,
|
||||
'standardize_not_equals' => true,
|
||||
'ternary_operator_spaces' => true,
|
||||
'trailing_comma_in_multiline_array' => true,
|
||||
'trim_array_spaces' => true,
|
||||
'unary_operator_spaces' => true,
|
||||
'whitespace_after_comma_in_array' => true,
|
||||
'no_extra_consecutive_blank_lines' => [
|
||||
'curly_brace_block',
|
||||
'extra',
|
||||
'parenthesis_brace_block',
|
||||
'square_brace_block',
|
||||
'throw',
|
||||
'use',
|
||||
],
|
||||
'binary_operator_spaces' => [
|
||||
'align_double_arrow' => true,
|
||||
'align_equals' => true,
|
||||
],
|
||||
'braces' => [
|
||||
'allow_single_line_closure' => true,
|
||||
],
|
||||
])
|
||||
->setFinder(
|
||||
PhpCsFixer\Finder::create()
|
||||
->exclude('vendor')
|
||||
->exclude('tests')
|
||||
->in(__DIR__)
|
||||
);
|
@ -0,0 +1,6 @@
|
||||
2021-01-04 Version: 1.0.1
|
||||
- AMP Version Change.
|
||||
|
||||
2020-12-29 Version: 1.0.0
|
||||
- AMP Version Change.
|
||||
|
@ -0,0 +1,35 @@
|
||||
[English](README.md) | 简体中文
|
||||
|
||||
![](https://aliyunsdk-pages.alicdn.com/icons/AlibabaCloud.svg)
|
||||
|
||||
# Alibaba Cloud Dysmsapi SDK for PHP
|
||||
|
||||
## 安装
|
||||
|
||||
### Composer
|
||||
|
||||
```bash
|
||||
composer require alibabacloud/dysmsapi-20170525
|
||||
```
|
||||
|
||||
## 问题
|
||||
|
||||
[提交 Issue](https://github.com/aliyun/alibabacloud-php-sdk/issues/new),不符合指南的问题可能会立即关闭。
|
||||
|
||||
## 使用说明
|
||||
|
||||
[快速使用](https://github.com/aliyun/alibabacloud-php-sdk/blob/master/docs/0-Examples-CN.md#%E5%BF%AB%E9%80%9F%E4%BD%BF%E7%94%A8)
|
||||
|
||||
## 发行说明
|
||||
|
||||
每个版本的详细更改记录在[发行说明](./ChangeLog.txt)中。
|
||||
|
||||
## 相关
|
||||
|
||||
* [最新源码](https://github.com/aliyun/alibabacloud-php-sdk/)
|
||||
|
||||
## 许可证
|
||||
|
||||
[Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
||||
Copyright (c) 2009-present, Alibaba Cloud All rights reserved.
|
@ -0,0 +1,35 @@
|
||||
English | [简体中文](README-CN.md)
|
||||
|
||||
![](https://aliyunsdk-pages.alicdn.com/icons/AlibabaCloud.svg)
|
||||
|
||||
# Alibaba Cloud Dysmsapi SDK for PHP
|
||||
|
||||
## Installation
|
||||
|
||||
### Composer
|
||||
|
||||
```bash
|
||||
composer require alibabacloud/dysmsapi-20170525
|
||||
```
|
||||
|
||||
## Issues
|
||||
|
||||
[Opening an Issue](https://github.com/aliyun/alibabacloud-php-sdk/issues/new), Issues not conforming to the guidelines may be closed immediately.
|
||||
|
||||
## Usage
|
||||
|
||||
[Quick Examples](https://github.com/aliyun/alibabacloud-php-sdk/blob/master/docs/0-Examples-EN.md#quick-examples)
|
||||
|
||||
## Changelog
|
||||
|
||||
Detailed changes for each release are documented in the [release notes](./ChangeLog.txt).
|
||||
|
||||
## References
|
||||
|
||||
* [Latest Release](https://github.com/aliyun/alibabacloud-php-sdk/)
|
||||
|
||||
## License
|
||||
|
||||
[Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
||||
Copyright (c) 2009-present, Alibaba Cloud All rights reserved.
|
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
if (file_exists(__DIR__ . \DIRECTORY_SEPARATOR . 'vendor' . \DIRECTORY_SEPARATOR . 'autoload.php')) {
|
||||
require_once __DIR__ . \DIRECTORY_SEPARATOR . 'vendor' . \DIRECTORY_SEPARATOR . 'autoload.php';
|
||||
}
|
||||
|
||||
spl_autoload_register(function ($class) {
|
||||
$name = str_replace('AlibabaCloud\\SDK\\Dysmsapi\\V20170525\\', '', $class);
|
||||
$file = __DIR__ . \DIRECTORY_SEPARATOR . 'src' . \DIRECTORY_SEPARATOR . str_replace('\\', \DIRECTORY_SEPARATOR, $name) . '.php';
|
||||
if (file_exists($file)) {
|
||||
require_once $file;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
@ -0,0 +1,32 @@
|
||||
{
|
||||
"name": "alibabacloud/dysmsapi-20170525",
|
||||
"description": "Alibaba Cloud Dysmsapi (20170525) SDK Library for PHP",
|
||||
"type": "library",
|
||||
"license": "Apache-2.0",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Alibaba Cloud SDK",
|
||||
"email": "sdk-team@alibabacloud.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">5.5",
|
||||
"alibabacloud/tea-utils": "^0.2.0",
|
||||
"alibabacloud/darabonba-openapi": "^0.1.0",
|
||||
"alibabacloud/endpoint-util": "^0.1.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"AlibabaCloud\\SDK\\Dysmsapi\\V20170525\\": "src"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"fixer": "php-cs-fixer fix ./"
|
||||
},
|
||||
"config": {
|
||||
"sort-packages": true,
|
||||
"preferred-install": "dist",
|
||||
"optimize-autoloader": true
|
||||
},
|
||||
"prefer-stable": true
|
||||
}
|
@ -0,0 +1,512 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dysmsapi\V20170525;
|
||||
|
||||
use AlibabaCloud\Endpoint\Endpoint;
|
||||
use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\AddShortUrlRequest;
|
||||
use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\AddShortUrlResponse;
|
||||
use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\AddSmsSignRequest;
|
||||
use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\AddSmsSignResponse;
|
||||
use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\AddSmsTemplateRequest;
|
||||
use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\AddSmsTemplateResponse;
|
||||
use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\CreateShortParamRequest;
|
||||
use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\CreateShortParamResponse;
|
||||
use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\DeleteShortUrlRequest;
|
||||
use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\DeleteShortUrlResponse;
|
||||
use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\DeleteSmsSignRequest;
|
||||
use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\DeleteSmsSignResponse;
|
||||
use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\DeleteSmsTemplateRequest;
|
||||
use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\DeleteSmsTemplateResponse;
|
||||
use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\ModifySmsSignRequest;
|
||||
use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\ModifySmsSignResponse;
|
||||
use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\ModifySmsTemplateRequest;
|
||||
use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\ModifySmsTemplateResponse;
|
||||
use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\QuerySendDetailsRequest;
|
||||
use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\QuerySendDetailsResponse;
|
||||
use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\QueryShortUrlRequest;
|
||||
use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\QueryShortUrlResponse;
|
||||
use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\QuerySmsSignRequest;
|
||||
use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\QuerySmsSignResponse;
|
||||
use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\QuerySmsTemplateRequest;
|
||||
use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\QuerySmsTemplateResponse;
|
||||
use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\SendBatchSmsRequest;
|
||||
use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\SendBatchSmsResponse;
|
||||
use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\SendSmsRequest;
|
||||
use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\SendSmsResponse;
|
||||
use AlibabaCloud\Tea\Utils\Utils;
|
||||
use AlibabaCloud\Tea\Utils\Utils\RuntimeOptions;
|
||||
use Darabonba\OpenApi\Models\OpenApiRequest;
|
||||
use Darabonba\OpenApi\OpenApiClient;
|
||||
|
||||
class Dysmsapi extends OpenApiClient
|
||||
{
|
||||
public function __construct($config)
|
||||
{
|
||||
parent::__construct($config);
|
||||
$this->_endpointRule = 'central';
|
||||
$this->_endpointMap = [
|
||||
'ap-northeast-1' => 'dysmsapi.ap-southeast-1.aliyuncs.com',
|
||||
'ap-northeast-2-pop' => 'dysmsapi.ap-southeast-1.aliyuncs.com',
|
||||
'ap-south-1' => 'dysmsapi.ap-southeast-1.aliyuncs.com',
|
||||
'ap-southeast-1' => 'dysmsapi.ap-southeast-1.aliyuncs.com',
|
||||
'ap-southeast-2' => 'dysmsapi.ap-southeast-1.aliyuncs.com',
|
||||
'ap-southeast-3' => 'dysmsapi.ap-southeast-1.aliyuncs.com',
|
||||
'ap-southeast-5' => 'dysmsapi.ap-southeast-1.aliyuncs.com',
|
||||
'cn-beijing' => 'dysmsapi-proxy.cn-beijing.aliyuncs.com',
|
||||
'eu-central-1' => 'dysmsapi.ap-southeast-1.aliyuncs.com',
|
||||
'eu-west-1' => 'dysmsapi.ap-southeast-1.aliyuncs.com',
|
||||
'eu-west-1-oxs' => 'dysmsapi.ap-southeast-1.aliyuncs.com',
|
||||
'me-east-1' => 'dysmsapi.ap-southeast-1.aliyuncs.com',
|
||||
'rus-west-1-pop' => 'dysmsapi.ap-southeast-1.aliyuncs.com',
|
||||
'us-east-1' => 'dysmsapi.ap-southeast-1.aliyuncs.com',
|
||||
'us-west-1' => 'dysmsapi.ap-southeast-1.aliyuncs.com',
|
||||
];
|
||||
$this->checkConfig($config);
|
||||
$this->_endpoint = $this->getEndpoint('dysmsapi', $this->_regionId, $this->_endpointRule, $this->_network, $this->_suffix, $this->_endpointMap, $this->_endpoint);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $productId
|
||||
* @param string $regionId
|
||||
* @param string $endpointRule
|
||||
* @param string $network
|
||||
* @param string $suffix
|
||||
* @param string[] $endpointMap
|
||||
* @param string $endpoint
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEndpoint($productId, $regionId, $endpointRule, $network, $suffix, $endpointMap, $endpoint)
|
||||
{
|
||||
if (!Utils::empty_($endpoint)) {
|
||||
return $endpoint;
|
||||
}
|
||||
if (!Utils::isUnset($endpointMap) && !Utils::empty_(@$endpointMap[$regionId])) {
|
||||
return @$endpointMap[$regionId];
|
||||
}
|
||||
|
||||
return Endpoint::getEndpointRules($productId, $regionId, $endpointRule, $network, $suffix);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AddShortUrlRequest $request
|
||||
* @param RuntimeOptions $runtime
|
||||
*
|
||||
* @return AddShortUrlResponse
|
||||
*/
|
||||
public function addShortUrlWithOptions($request, $runtime)
|
||||
{
|
||||
Utils::validateModel($request);
|
||||
$req = new OpenApiRequest([
|
||||
'body' => Utils::toMap($request),
|
||||
]);
|
||||
|
||||
return AddShortUrlResponse::fromMap($this->doRPCRequest('AddShortUrl', '2017-05-25', 'HTTPS', 'POST', 'AK', 'json', $req, $runtime));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AddShortUrlRequest $request
|
||||
*
|
||||
* @return AddShortUrlResponse
|
||||
*/
|
||||
public function addShortUrl($request)
|
||||
{
|
||||
$runtime = new RuntimeOptions([]);
|
||||
|
||||
return $this->addShortUrlWithOptions($request, $runtime);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AddSmsSignRequest $request
|
||||
* @param RuntimeOptions $runtime
|
||||
*
|
||||
* @return AddSmsSignResponse
|
||||
*/
|
||||
public function addSmsSignWithOptions($request, $runtime)
|
||||
{
|
||||
Utils::validateModel($request);
|
||||
$req = new OpenApiRequest([
|
||||
'body' => Utils::toMap($request),
|
||||
]);
|
||||
|
||||
return AddSmsSignResponse::fromMap($this->doRPCRequest('AddSmsSign', '2017-05-25', 'HTTPS', 'POST', 'AK', 'json', $req, $runtime));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AddSmsSignRequest $request
|
||||
*
|
||||
* @return AddSmsSignResponse
|
||||
*/
|
||||
public function addSmsSign($request)
|
||||
{
|
||||
$runtime = new RuntimeOptions([]);
|
||||
|
||||
return $this->addSmsSignWithOptions($request, $runtime);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AddSmsTemplateRequest $request
|
||||
* @param RuntimeOptions $runtime
|
||||
*
|
||||
* @return AddSmsTemplateResponse
|
||||
*/
|
||||
public function addSmsTemplateWithOptions($request, $runtime)
|
||||
{
|
||||
Utils::validateModel($request);
|
||||
$req = new OpenApiRequest([
|
||||
'body' => Utils::toMap($request),
|
||||
]);
|
||||
|
||||
return AddSmsTemplateResponse::fromMap($this->doRPCRequest('AddSmsTemplate', '2017-05-25', 'HTTPS', 'POST', 'AK', 'json', $req, $runtime));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AddSmsTemplateRequest $request
|
||||
*
|
||||
* @return AddSmsTemplateResponse
|
||||
*/
|
||||
public function addSmsTemplate($request)
|
||||
{
|
||||
$runtime = new RuntimeOptions([]);
|
||||
|
||||
return $this->addSmsTemplateWithOptions($request, $runtime);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CreateShortParamRequest $request
|
||||
* @param RuntimeOptions $runtime
|
||||
*
|
||||
* @return CreateShortParamResponse
|
||||
*/
|
||||
public function createShortParamWithOptions($request, $runtime)
|
||||
{
|
||||
Utils::validateModel($request);
|
||||
$req = new OpenApiRequest([
|
||||
'body' => Utils::toMap($request),
|
||||
]);
|
||||
|
||||
return CreateShortParamResponse::fromMap($this->doRPCRequest('CreateShortParam', '2017-05-25', 'HTTPS', 'POST', 'AK', 'json', $req, $runtime));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CreateShortParamRequest $request
|
||||
*
|
||||
* @return CreateShortParamResponse
|
||||
*/
|
||||
public function createShortParam($request)
|
||||
{
|
||||
$runtime = new RuntimeOptions([]);
|
||||
|
||||
return $this->createShortParamWithOptions($request, $runtime);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param DeleteShortUrlRequest $request
|
||||
* @param RuntimeOptions $runtime
|
||||
*
|
||||
* @return DeleteShortUrlResponse
|
||||
*/
|
||||
public function deleteShortUrlWithOptions($request, $runtime)
|
||||
{
|
||||
Utils::validateModel($request);
|
||||
$req = new OpenApiRequest([
|
||||
'body' => Utils::toMap($request),
|
||||
]);
|
||||
|
||||
return DeleteShortUrlResponse::fromMap($this->doRPCRequest('DeleteShortUrl', '2017-05-25', 'HTTPS', 'POST', 'AK', 'json', $req, $runtime));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param DeleteShortUrlRequest $request
|
||||
*
|
||||
* @return DeleteShortUrlResponse
|
||||
*/
|
||||
public function deleteShortUrl($request)
|
||||
{
|
||||
$runtime = new RuntimeOptions([]);
|
||||
|
||||
return $this->deleteShortUrlWithOptions($request, $runtime);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param DeleteSmsSignRequest $request
|
||||
* @param RuntimeOptions $runtime
|
||||
*
|
||||
* @return DeleteSmsSignResponse
|
||||
*/
|
||||
public function deleteSmsSignWithOptions($request, $runtime)
|
||||
{
|
||||
Utils::validateModel($request);
|
||||
$req = new OpenApiRequest([
|
||||
'body' => Utils::toMap($request),
|
||||
]);
|
||||
|
||||
return DeleteSmsSignResponse::fromMap($this->doRPCRequest('DeleteSmsSign', '2017-05-25', 'HTTPS', 'POST', 'AK', 'json', $req, $runtime));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param DeleteSmsSignRequest $request
|
||||
*
|
||||
* @return DeleteSmsSignResponse
|
||||
*/
|
||||
public function deleteSmsSign($request)
|
||||
{
|
||||
$runtime = new RuntimeOptions([]);
|
||||
|
||||
return $this->deleteSmsSignWithOptions($request, $runtime);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param DeleteSmsTemplateRequest $request
|
||||
* @param RuntimeOptions $runtime
|
||||
*
|
||||
* @return DeleteSmsTemplateResponse
|
||||
*/
|
||||
public function deleteSmsTemplateWithOptions($request, $runtime)
|
||||
{
|
||||
Utils::validateModel($request);
|
||||
$req = new OpenApiRequest([
|
||||
'body' => Utils::toMap($request),
|
||||
]);
|
||||
|
||||
return DeleteSmsTemplateResponse::fromMap($this->doRPCRequest('DeleteSmsTemplate', '2017-05-25', 'HTTPS', 'POST', 'AK', 'json', $req, $runtime));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param DeleteSmsTemplateRequest $request
|
||||
*
|
||||
* @return DeleteSmsTemplateResponse
|
||||
*/
|
||||
public function deleteSmsTemplate($request)
|
||||
{
|
||||
$runtime = new RuntimeOptions([]);
|
||||
|
||||
return $this->deleteSmsTemplateWithOptions($request, $runtime);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ModifySmsSignRequest $request
|
||||
* @param RuntimeOptions $runtime
|
||||
*
|
||||
* @return ModifySmsSignResponse
|
||||
*/
|
||||
public function modifySmsSignWithOptions($request, $runtime)
|
||||
{
|
||||
Utils::validateModel($request);
|
||||
$req = new OpenApiRequest([
|
||||
'body' => Utils::toMap($request),
|
||||
]);
|
||||
|
||||
return ModifySmsSignResponse::fromMap($this->doRPCRequest('ModifySmsSign', '2017-05-25', 'HTTPS', 'POST', 'AK', 'json', $req, $runtime));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ModifySmsSignRequest $request
|
||||
*
|
||||
* @return ModifySmsSignResponse
|
||||
*/
|
||||
public function modifySmsSign($request)
|
||||
{
|
||||
$runtime = new RuntimeOptions([]);
|
||||
|
||||
return $this->modifySmsSignWithOptions($request, $runtime);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ModifySmsTemplateRequest $request
|
||||
* @param RuntimeOptions $runtime
|
||||
*
|
||||
* @return ModifySmsTemplateResponse
|
||||
*/
|
||||
public function modifySmsTemplateWithOptions($request, $runtime)
|
||||
{
|
||||
Utils::validateModel($request);
|
||||
$req = new OpenApiRequest([
|
||||
'body' => Utils::toMap($request),
|
||||
]);
|
||||
|
||||
return ModifySmsTemplateResponse::fromMap($this->doRPCRequest('ModifySmsTemplate', '2017-05-25', 'HTTPS', 'POST', 'AK', 'json', $req, $runtime));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ModifySmsTemplateRequest $request
|
||||
*
|
||||
* @return ModifySmsTemplateResponse
|
||||
*/
|
||||
public function modifySmsTemplate($request)
|
||||
{
|
||||
$runtime = new RuntimeOptions([]);
|
||||
|
||||
return $this->modifySmsTemplateWithOptions($request, $runtime);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param QuerySendDetailsRequest $request
|
||||
* @param RuntimeOptions $runtime
|
||||
*
|
||||
* @return QuerySendDetailsResponse
|
||||
*/
|
||||
public function querySendDetailsWithOptions($request, $runtime)
|
||||
{
|
||||
Utils::validateModel($request);
|
||||
$req = new OpenApiRequest([
|
||||
'body' => Utils::toMap($request),
|
||||
]);
|
||||
|
||||
return QuerySendDetailsResponse::fromMap($this->doRPCRequest('QuerySendDetails', '2017-05-25', 'HTTPS', 'POST', 'AK', 'json', $req, $runtime));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param QuerySendDetailsRequest $request
|
||||
*
|
||||
* @return QuerySendDetailsResponse
|
||||
*/
|
||||
public function querySendDetails($request)
|
||||
{
|
||||
$runtime = new RuntimeOptions([]);
|
||||
|
||||
return $this->querySendDetailsWithOptions($request, $runtime);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param QueryShortUrlRequest $request
|
||||
* @param RuntimeOptions $runtime
|
||||
*
|
||||
* @return QueryShortUrlResponse
|
||||
*/
|
||||
public function queryShortUrlWithOptions($request, $runtime)
|
||||
{
|
||||
Utils::validateModel($request);
|
||||
$req = new OpenApiRequest([
|
||||
'body' => Utils::toMap($request),
|
||||
]);
|
||||
|
||||
return QueryShortUrlResponse::fromMap($this->doRPCRequest('QueryShortUrl', '2017-05-25', 'HTTPS', 'POST', 'AK', 'json', $req, $runtime));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param QueryShortUrlRequest $request
|
||||
*
|
||||
* @return QueryShortUrlResponse
|
||||
*/
|
||||
public function queryShortUrl($request)
|
||||
{
|
||||
$runtime = new RuntimeOptions([]);
|
||||
|
||||
return $this->queryShortUrlWithOptions($request, $runtime);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param QuerySmsSignRequest $request
|
||||
* @param RuntimeOptions $runtime
|
||||
*
|
||||
* @return QuerySmsSignResponse
|
||||
*/
|
||||
public function querySmsSignWithOptions($request, $runtime)
|
||||
{
|
||||
Utils::validateModel($request);
|
||||
$req = new OpenApiRequest([
|
||||
'body' => Utils::toMap($request),
|
||||
]);
|
||||
|
||||
return QuerySmsSignResponse::fromMap($this->doRPCRequest('QuerySmsSign', '2017-05-25', 'HTTPS', 'POST', 'AK', 'json', $req, $runtime));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param QuerySmsSignRequest $request
|
||||
*
|
||||
* @return QuerySmsSignResponse
|
||||
*/
|
||||
public function querySmsSign($request)
|
||||
{
|
||||
$runtime = new RuntimeOptions([]);
|
||||
|
||||
return $this->querySmsSignWithOptions($request, $runtime);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param QuerySmsTemplateRequest $request
|
||||
* @param RuntimeOptions $runtime
|
||||
*
|
||||
* @return QuerySmsTemplateResponse
|
||||
*/
|
||||
public function querySmsTemplateWithOptions($request, $runtime)
|
||||
{
|
||||
Utils::validateModel($request);
|
||||
$req = new OpenApiRequest([
|
||||
'body' => Utils::toMap($request),
|
||||
]);
|
||||
|
||||
return QuerySmsTemplateResponse::fromMap($this->doRPCRequest('QuerySmsTemplate', '2017-05-25', 'HTTPS', 'POST', 'AK', 'json', $req, $runtime));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param QuerySmsTemplateRequest $request
|
||||
*
|
||||
* @return QuerySmsTemplateResponse
|
||||
*/
|
||||
public function querySmsTemplate($request)
|
||||
{
|
||||
$runtime = new RuntimeOptions([]);
|
||||
|
||||
return $this->querySmsTemplateWithOptions($request, $runtime);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param SendBatchSmsRequest $request
|
||||
* @param RuntimeOptions $runtime
|
||||
*
|
||||
* @return SendBatchSmsResponse
|
||||
*/
|
||||
public function sendBatchSmsWithOptions($request, $runtime)
|
||||
{
|
||||
Utils::validateModel($request);
|
||||
$req = new OpenApiRequest([
|
||||
'body' => Utils::toMap($request),
|
||||
]);
|
||||
|
||||
return SendBatchSmsResponse::fromMap($this->doRPCRequest('SendBatchSms', '2017-05-25', 'HTTPS', 'POST', 'AK', 'json', $req, $runtime));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param SendBatchSmsRequest $request
|
||||
*
|
||||
* @return SendBatchSmsResponse
|
||||
*/
|
||||
public function sendBatchSms($request)
|
||||
{
|
||||
$runtime = new RuntimeOptions([]);
|
||||
|
||||
return $this->sendBatchSmsWithOptions($request, $runtime);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param SendSmsRequest $request
|
||||
* @param RuntimeOptions $runtime
|
||||
*
|
||||
* @return SendSmsResponse
|
||||
*/
|
||||
public function sendSmsWithOptions($request, $runtime)
|
||||
{
|
||||
Utils::validateModel($request);
|
||||
$req = new OpenApiRequest([
|
||||
'body' => Utils::toMap($request),
|
||||
]);
|
||||
|
||||
return SendSmsResponse::fromMap($this->doRPCRequest('SendSms', '2017-05-25', 'HTTPS', 'POST', 'AK', 'json', $req, $runtime));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param SendSmsRequest $request
|
||||
*
|
||||
* @return SendSmsResponse
|
||||
*/
|
||||
public function sendSms($request)
|
||||
{
|
||||
$runtime = new RuntimeOptions([]);
|
||||
|
||||
return $this->sendSmsWithOptions($request, $runtime);
|
||||
}
|
||||
}
|
@ -0,0 +1,119 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dysmsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class AddShortUrlRequest extends Model
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $ownerId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $resourceOwnerAccount;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $resourceOwnerId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $sourceUrl;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $shortUrlName;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $effectiveDays;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $prodCode;
|
||||
protected $_name = [
|
||||
'ownerId' => 'OwnerId',
|
||||
'resourceOwnerAccount' => 'ResourceOwnerAccount',
|
||||
'resourceOwnerId' => 'ResourceOwnerId',
|
||||
'sourceUrl' => 'SourceUrl',
|
||||
'shortUrlName' => 'ShortUrlName',
|
||||
'effectiveDays' => 'EffectiveDays',
|
||||
'prodCode' => 'ProdCode',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->ownerId) {
|
||||
$res['OwnerId'] = $this->ownerId;
|
||||
}
|
||||
if (null !== $this->resourceOwnerAccount) {
|
||||
$res['ResourceOwnerAccount'] = $this->resourceOwnerAccount;
|
||||
}
|
||||
if (null !== $this->resourceOwnerId) {
|
||||
$res['ResourceOwnerId'] = $this->resourceOwnerId;
|
||||
}
|
||||
if (null !== $this->sourceUrl) {
|
||||
$res['SourceUrl'] = $this->sourceUrl;
|
||||
}
|
||||
if (null !== $this->shortUrlName) {
|
||||
$res['ShortUrlName'] = $this->shortUrlName;
|
||||
}
|
||||
if (null !== $this->effectiveDays) {
|
||||
$res['EffectiveDays'] = $this->effectiveDays;
|
||||
}
|
||||
if (null !== $this->prodCode) {
|
||||
$res['ProdCode'] = $this->prodCode;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return AddShortUrlRequest
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['OwnerId'])) {
|
||||
$model->ownerId = $map['OwnerId'];
|
||||
}
|
||||
if (isset($map['ResourceOwnerAccount'])) {
|
||||
$model->resourceOwnerAccount = $map['ResourceOwnerAccount'];
|
||||
}
|
||||
if (isset($map['ResourceOwnerId'])) {
|
||||
$model->resourceOwnerId = $map['ResourceOwnerId'];
|
||||
}
|
||||
if (isset($map['SourceUrl'])) {
|
||||
$model->sourceUrl = $map['SourceUrl'];
|
||||
}
|
||||
if (isset($map['ShortUrlName'])) {
|
||||
$model->shortUrlName = $map['ShortUrlName'];
|
||||
}
|
||||
if (isset($map['EffectiveDays'])) {
|
||||
$model->effectiveDays = $map['EffectiveDays'];
|
||||
}
|
||||
if (isset($map['ProdCode'])) {
|
||||
$model->prodCode = $map['ProdCode'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dysmsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class AddShortUrlResponse extends Model
|
||||
{
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
public $headers;
|
||||
|
||||
/**
|
||||
* @var AddShortUrlResponseBody
|
||||
*/
|
||||
public $body;
|
||||
protected $_name = [
|
||||
'headers' => 'headers',
|
||||
'body' => 'body',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
Model::validateRequired('headers', $this->headers, true);
|
||||
Model::validateRequired('body', $this->body, true);
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->headers) {
|
||||
$res['headers'] = $this->headers;
|
||||
}
|
||||
if (null !== $this->body) {
|
||||
$res['body'] = null !== $this->body ? $this->body->toMap() : null;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return AddShortUrlResponse
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['headers'])) {
|
||||
$model->headers = $map['headers'];
|
||||
}
|
||||
if (isset($map['body'])) {
|
||||
$model->body = AddShortUrlResponseBody::fromMap($map['body']);
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dysmsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\AddShortUrlResponseBody\data;
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class AddShortUrlResponseBody extends Model
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $message;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $requestId;
|
||||
|
||||
/**
|
||||
* @var data
|
||||
*/
|
||||
public $data;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $code;
|
||||
protected $_name = [
|
||||
'message' => 'Message',
|
||||
'requestId' => 'RequestId',
|
||||
'data' => 'Data',
|
||||
'code' => 'Code',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->message) {
|
||||
$res['Message'] = $this->message;
|
||||
}
|
||||
if (null !== $this->requestId) {
|
||||
$res['RequestId'] = $this->requestId;
|
||||
}
|
||||
if (null !== $this->data) {
|
||||
$res['Data'] = null !== $this->data ? $this->data->toMap() : null;
|
||||
}
|
||||
if (null !== $this->code) {
|
||||
$res['Code'] = $this->code;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return AddShortUrlResponseBody
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['Message'])) {
|
||||
$model->message = $map['Message'];
|
||||
}
|
||||
if (isset($map['RequestId'])) {
|
||||
$model->requestId = $map['RequestId'];
|
||||
}
|
||||
if (isset($map['Data'])) {
|
||||
$model->data = data::fromMap($map['Data']);
|
||||
}
|
||||
if (isset($map['Code'])) {
|
||||
$model->code = $map['Code'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dysmsapi\V20170525\Models\AddShortUrlResponseBody;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class data extends Model
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $sourceUrl;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $expireDate;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $shortUrl;
|
||||
protected $_name = [
|
||||
'sourceUrl' => 'SourceUrl',
|
||||
'expireDate' => 'ExpireDate',
|
||||
'shortUrl' => 'ShortUrl',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->sourceUrl) {
|
||||
$res['SourceUrl'] = $this->sourceUrl;
|
||||
}
|
||||
if (null !== $this->expireDate) {
|
||||
$res['ExpireDate'] = $this->expireDate;
|
||||
}
|
||||
if (null !== $this->shortUrl) {
|
||||
$res['ShortUrl'] = $this->shortUrl;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return data
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['SourceUrl'])) {
|
||||
$model->sourceUrl = $map['SourceUrl'];
|
||||
}
|
||||
if (isset($map['ExpireDate'])) {
|
||||
$model->expireDate = $map['ExpireDate'];
|
||||
}
|
||||
if (isset($map['ShortUrl'])) {
|
||||
$model->shortUrl = $map['ShortUrl'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -0,0 +1,132 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dysmsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\AddSmsSignRequest\signFileList;
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class AddSmsSignRequest extends Model
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $ownerId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $resourceOwnerAccount;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $resourceOwnerId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $signName;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $signSource;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $remark;
|
||||
|
||||
/**
|
||||
* @var signFileList[]
|
||||
*/
|
||||
public $signFileList;
|
||||
protected $_name = [
|
||||
'ownerId' => 'OwnerId',
|
||||
'resourceOwnerAccount' => 'ResourceOwnerAccount',
|
||||
'resourceOwnerId' => 'ResourceOwnerId',
|
||||
'signName' => 'SignName',
|
||||
'signSource' => 'SignSource',
|
||||
'remark' => 'Remark',
|
||||
'signFileList' => 'SignFileList',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->ownerId) {
|
||||
$res['OwnerId'] = $this->ownerId;
|
||||
}
|
||||
if (null !== $this->resourceOwnerAccount) {
|
||||
$res['ResourceOwnerAccount'] = $this->resourceOwnerAccount;
|
||||
}
|
||||
if (null !== $this->resourceOwnerId) {
|
||||
$res['ResourceOwnerId'] = $this->resourceOwnerId;
|
||||
}
|
||||
if (null !== $this->signName) {
|
||||
$res['SignName'] = $this->signName;
|
||||
}
|
||||
if (null !== $this->signSource) {
|
||||
$res['SignSource'] = $this->signSource;
|
||||
}
|
||||
if (null !== $this->remark) {
|
||||
$res['Remark'] = $this->remark;
|
||||
}
|
||||
if (null !== $this->signFileList) {
|
||||
$res['SignFileList'] = [];
|
||||
if (null !== $this->signFileList && \is_array($this->signFileList)) {
|
||||
$n = 0;
|
||||
foreach ($this->signFileList as $item) {
|
||||
$res['SignFileList'][$n++] = null !== $item ? $item->toMap() : $item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return AddSmsSignRequest
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['OwnerId'])) {
|
||||
$model->ownerId = $map['OwnerId'];
|
||||
}
|
||||
if (isset($map['ResourceOwnerAccount'])) {
|
||||
$model->resourceOwnerAccount = $map['ResourceOwnerAccount'];
|
||||
}
|
||||
if (isset($map['ResourceOwnerId'])) {
|
||||
$model->resourceOwnerId = $map['ResourceOwnerId'];
|
||||
}
|
||||
if (isset($map['SignName'])) {
|
||||
$model->signName = $map['SignName'];
|
||||
}
|
||||
if (isset($map['SignSource'])) {
|
||||
$model->signSource = $map['SignSource'];
|
||||
}
|
||||
if (isset($map['Remark'])) {
|
||||
$model->remark = $map['Remark'];
|
||||
}
|
||||
if (isset($map['SignFileList'])) {
|
||||
if (!empty($map['SignFileList'])) {
|
||||
$model->signFileList = [];
|
||||
$n = 0;
|
||||
foreach ($map['SignFileList'] as $item) {
|
||||
$model->signFileList[$n++] = null !== $item ? signFileList::fromMap($item) : $item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dysmsapi\V20170525\Models\AddSmsSignRequest;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class signFileList extends Model
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $fileContents;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $fileSuffix;
|
||||
protected $_name = [
|
||||
'fileContents' => 'FileContents',
|
||||
'fileSuffix' => 'FileSuffix',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->fileContents) {
|
||||
$res['FileContents'] = $this->fileContents;
|
||||
}
|
||||
if (null !== $this->fileSuffix) {
|
||||
$res['FileSuffix'] = $this->fileSuffix;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return signFileList
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['FileContents'])) {
|
||||
$model->fileContents = $map['FileContents'];
|
||||
}
|
||||
if (isset($map['FileSuffix'])) {
|
||||
$model->fileSuffix = $map['FileSuffix'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dysmsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class AddSmsSignResponse extends Model
|
||||
{
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
public $headers;
|
||||
|
||||
/**
|
||||
* @var AddSmsSignResponseBody
|
||||
*/
|
||||
public $body;
|
||||
protected $_name = [
|
||||
'headers' => 'headers',
|
||||
'body' => 'body',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
Model::validateRequired('headers', $this->headers, true);
|
||||
Model::validateRequired('body', $this->body, true);
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->headers) {
|
||||
$res['headers'] = $this->headers;
|
||||
}
|
||||
if (null !== $this->body) {
|
||||
$res['body'] = null !== $this->body ? $this->body->toMap() : null;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return AddSmsSignResponse
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['headers'])) {
|
||||
$model->headers = $map['headers'];
|
||||
}
|
||||
if (isset($map['body'])) {
|
||||
$model->body = AddSmsSignResponseBody::fromMap($map['body']);
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dysmsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class AddSmsSignResponseBody extends Model
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $message;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $requestId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $code;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $signName;
|
||||
protected $_name = [
|
||||
'message' => 'Message',
|
||||
'requestId' => 'RequestId',
|
||||
'code' => 'Code',
|
||||
'signName' => 'SignName',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->message) {
|
||||
$res['Message'] = $this->message;
|
||||
}
|
||||
if (null !== $this->requestId) {
|
||||
$res['RequestId'] = $this->requestId;
|
||||
}
|
||||
if (null !== $this->code) {
|
||||
$res['Code'] = $this->code;
|
||||
}
|
||||
if (null !== $this->signName) {
|
||||
$res['SignName'] = $this->signName;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return AddSmsSignResponseBody
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['Message'])) {
|
||||
$model->message = $map['Message'];
|
||||
}
|
||||
if (isset($map['RequestId'])) {
|
||||
$model->requestId = $map['RequestId'];
|
||||
}
|
||||
if (isset($map['Code'])) {
|
||||
$model->code = $map['Code'];
|
||||
}
|
||||
if (isset($map['SignName'])) {
|
||||
$model->signName = $map['SignName'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -0,0 +1,119 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dysmsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class AddSmsTemplateRequest extends Model
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $ownerId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $resourceOwnerAccount;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $resourceOwnerId;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $templateType;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $templateName;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $templateContent;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $remark;
|
||||
protected $_name = [
|
||||
'ownerId' => 'OwnerId',
|
||||
'resourceOwnerAccount' => 'ResourceOwnerAccount',
|
||||
'resourceOwnerId' => 'ResourceOwnerId',
|
||||
'templateType' => 'TemplateType',
|
||||
'templateName' => 'TemplateName',
|
||||
'templateContent' => 'TemplateContent',
|
||||
'remark' => 'Remark',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->ownerId) {
|
||||
$res['OwnerId'] = $this->ownerId;
|
||||
}
|
||||
if (null !== $this->resourceOwnerAccount) {
|
||||
$res['ResourceOwnerAccount'] = $this->resourceOwnerAccount;
|
||||
}
|
||||
if (null !== $this->resourceOwnerId) {
|
||||
$res['ResourceOwnerId'] = $this->resourceOwnerId;
|
||||
}
|
||||
if (null !== $this->templateType) {
|
||||
$res['TemplateType'] = $this->templateType;
|
||||
}
|
||||
if (null !== $this->templateName) {
|
||||
$res['TemplateName'] = $this->templateName;
|
||||
}
|
||||
if (null !== $this->templateContent) {
|
||||
$res['TemplateContent'] = $this->templateContent;
|
||||
}
|
||||
if (null !== $this->remark) {
|
||||
$res['Remark'] = $this->remark;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return AddSmsTemplateRequest
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['OwnerId'])) {
|
||||
$model->ownerId = $map['OwnerId'];
|
||||
}
|
||||
if (isset($map['ResourceOwnerAccount'])) {
|
||||
$model->resourceOwnerAccount = $map['ResourceOwnerAccount'];
|
||||
}
|
||||
if (isset($map['ResourceOwnerId'])) {
|
||||
$model->resourceOwnerId = $map['ResourceOwnerId'];
|
||||
}
|
||||
if (isset($map['TemplateType'])) {
|
||||
$model->templateType = $map['TemplateType'];
|
||||
}
|
||||
if (isset($map['TemplateName'])) {
|
||||
$model->templateName = $map['TemplateName'];
|
||||
}
|
||||
if (isset($map['TemplateContent'])) {
|
||||
$model->templateContent = $map['TemplateContent'];
|
||||
}
|
||||
if (isset($map['Remark'])) {
|
||||
$model->remark = $map['Remark'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dysmsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class AddSmsTemplateResponse extends Model
|
||||
{
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
public $headers;
|
||||
|
||||
/**
|
||||
* @var AddSmsTemplateResponseBody
|
||||
*/
|
||||
public $body;
|
||||
protected $_name = [
|
||||
'headers' => 'headers',
|
||||
'body' => 'body',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
Model::validateRequired('headers', $this->headers, true);
|
||||
Model::validateRequired('body', $this->body, true);
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->headers) {
|
||||
$res['headers'] = $this->headers;
|
||||
}
|
||||
if (null !== $this->body) {
|
||||
$res['body'] = null !== $this->body ? $this->body->toMap() : null;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return AddSmsTemplateResponse
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['headers'])) {
|
||||
$model->headers = $map['headers'];
|
||||
}
|
||||
if (isset($map['body'])) {
|
||||
$model->body = AddSmsTemplateResponseBody::fromMap($map['body']);
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dysmsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class AddSmsTemplateResponseBody extends Model
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $templateCode;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $message;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $requestId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $code;
|
||||
protected $_name = [
|
||||
'templateCode' => 'TemplateCode',
|
||||
'message' => 'Message',
|
||||
'requestId' => 'RequestId',
|
||||
'code' => 'Code',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->templateCode) {
|
||||
$res['TemplateCode'] = $this->templateCode;
|
||||
}
|
||||
if (null !== $this->message) {
|
||||
$res['Message'] = $this->message;
|
||||
}
|
||||
if (null !== $this->requestId) {
|
||||
$res['RequestId'] = $this->requestId;
|
||||
}
|
||||
if (null !== $this->code) {
|
||||
$res['Code'] = $this->code;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return AddSmsTemplateResponseBody
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['TemplateCode'])) {
|
||||
$model->templateCode = $map['TemplateCode'];
|
||||
}
|
||||
if (isset($map['Message'])) {
|
||||
$model->message = $map['Message'];
|
||||
}
|
||||
if (isset($map['RequestId'])) {
|
||||
$model->requestId = $map['RequestId'];
|
||||
}
|
||||
if (isset($map['Code'])) {
|
||||
$model->code = $map['Code'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dysmsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class CreateShortParamRequest extends Model
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $ownerId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $resourceOwnerAccount;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $resourceOwnerId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $phoneNumbers;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $prodCode;
|
||||
protected $_name = [
|
||||
'ownerId' => 'OwnerId',
|
||||
'resourceOwnerAccount' => 'ResourceOwnerAccount',
|
||||
'resourceOwnerId' => 'ResourceOwnerId',
|
||||
'phoneNumbers' => 'PhoneNumbers',
|
||||
'prodCode' => 'ProdCode',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->ownerId) {
|
||||
$res['OwnerId'] = $this->ownerId;
|
||||
}
|
||||
if (null !== $this->resourceOwnerAccount) {
|
||||
$res['ResourceOwnerAccount'] = $this->resourceOwnerAccount;
|
||||
}
|
||||
if (null !== $this->resourceOwnerId) {
|
||||
$res['ResourceOwnerId'] = $this->resourceOwnerId;
|
||||
}
|
||||
if (null !== $this->phoneNumbers) {
|
||||
$res['PhoneNumbers'] = $this->phoneNumbers;
|
||||
}
|
||||
if (null !== $this->prodCode) {
|
||||
$res['ProdCode'] = $this->prodCode;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return CreateShortParamRequest
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['OwnerId'])) {
|
||||
$model->ownerId = $map['OwnerId'];
|
||||
}
|
||||
if (isset($map['ResourceOwnerAccount'])) {
|
||||
$model->resourceOwnerAccount = $map['ResourceOwnerAccount'];
|
||||
}
|
||||
if (isset($map['ResourceOwnerId'])) {
|
||||
$model->resourceOwnerId = $map['ResourceOwnerId'];
|
||||
}
|
||||
if (isset($map['PhoneNumbers'])) {
|
||||
$model->phoneNumbers = $map['PhoneNumbers'];
|
||||
}
|
||||
if (isset($map['ProdCode'])) {
|
||||
$model->prodCode = $map['ProdCode'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dysmsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class CreateShortParamResponse extends Model
|
||||
{
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
public $headers;
|
||||
|
||||
/**
|
||||
* @var CreateShortParamResponseBody
|
||||
*/
|
||||
public $body;
|
||||
protected $_name = [
|
||||
'headers' => 'headers',
|
||||
'body' => 'body',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
Model::validateRequired('headers', $this->headers, true);
|
||||
Model::validateRequired('body', $this->body, true);
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->headers) {
|
||||
$res['headers'] = $this->headers;
|
||||
}
|
||||
if (null !== $this->body) {
|
||||
$res['body'] = null !== $this->body ? $this->body->toMap() : null;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return CreateShortParamResponse
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['headers'])) {
|
||||
$model->headers = $map['headers'];
|
||||
}
|
||||
if (isset($map['body'])) {
|
||||
$model->body = CreateShortParamResponseBody::fromMap($map['body']);
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dysmsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\CreateShortParamResponseBody\data;
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class CreateShortParamResponseBody extends Model
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $message;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $requestId;
|
||||
|
||||
/**
|
||||
* @var data
|
||||
*/
|
||||
public $data;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $code;
|
||||
protected $_name = [
|
||||
'message' => 'Message',
|
||||
'requestId' => 'RequestId',
|
||||
'data' => 'Data',
|
||||
'code' => 'Code',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->message) {
|
||||
$res['Message'] = $this->message;
|
||||
}
|
||||
if (null !== $this->requestId) {
|
||||
$res['RequestId'] = $this->requestId;
|
||||
}
|
||||
if (null !== $this->data) {
|
||||
$res['Data'] = null !== $this->data ? $this->data->toMap() : null;
|
||||
}
|
||||
if (null !== $this->code) {
|
||||
$res['Code'] = $this->code;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return CreateShortParamResponseBody
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['Message'])) {
|
||||
$model->message = $map['Message'];
|
||||
}
|
||||
if (isset($map['RequestId'])) {
|
||||
$model->requestId = $map['RequestId'];
|
||||
}
|
||||
if (isset($map['Data'])) {
|
||||
$model->data = data::fromMap($map['Data']);
|
||||
}
|
||||
if (isset($map['Code'])) {
|
||||
$model->code = $map['Code'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dysmsapi\V20170525\Models\CreateShortParamResponseBody;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class data extends Model
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $phoneNumbers;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $shortParam;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $paramDetail;
|
||||
protected $_name = [
|
||||
'phoneNumbers' => 'PhoneNumbers',
|
||||
'shortParam' => 'ShortParam',
|
||||
'paramDetail' => 'ParamDetail',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->phoneNumbers) {
|
||||
$res['PhoneNumbers'] = $this->phoneNumbers;
|
||||
}
|
||||
if (null !== $this->shortParam) {
|
||||
$res['ShortParam'] = $this->shortParam;
|
||||
}
|
||||
if (null !== $this->paramDetail) {
|
||||
$res['ParamDetail'] = $this->paramDetail;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return data
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['PhoneNumbers'])) {
|
||||
$model->phoneNumbers = $map['PhoneNumbers'];
|
||||
}
|
||||
if (isset($map['ShortParam'])) {
|
||||
$model->shortParam = $map['ShortParam'];
|
||||
}
|
||||
if (isset($map['ParamDetail'])) {
|
||||
$model->paramDetail = $map['ParamDetail'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dysmsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class DeleteShortUrlRequest extends Model
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $ownerId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $resourceOwnerAccount;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $resourceOwnerId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $sourceUrl;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $prodCode;
|
||||
protected $_name = [
|
||||
'ownerId' => 'OwnerId',
|
||||
'resourceOwnerAccount' => 'ResourceOwnerAccount',
|
||||
'resourceOwnerId' => 'ResourceOwnerId',
|
||||
'sourceUrl' => 'SourceUrl',
|
||||
'prodCode' => 'ProdCode',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->ownerId) {
|
||||
$res['OwnerId'] = $this->ownerId;
|
||||
}
|
||||
if (null !== $this->resourceOwnerAccount) {
|
||||
$res['ResourceOwnerAccount'] = $this->resourceOwnerAccount;
|
||||
}
|
||||
if (null !== $this->resourceOwnerId) {
|
||||
$res['ResourceOwnerId'] = $this->resourceOwnerId;
|
||||
}
|
||||
if (null !== $this->sourceUrl) {
|
||||
$res['SourceUrl'] = $this->sourceUrl;
|
||||
}
|
||||
if (null !== $this->prodCode) {
|
||||
$res['ProdCode'] = $this->prodCode;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return DeleteShortUrlRequest
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['OwnerId'])) {
|
||||
$model->ownerId = $map['OwnerId'];
|
||||
}
|
||||
if (isset($map['ResourceOwnerAccount'])) {
|
||||
$model->resourceOwnerAccount = $map['ResourceOwnerAccount'];
|
||||
}
|
||||
if (isset($map['ResourceOwnerId'])) {
|
||||
$model->resourceOwnerId = $map['ResourceOwnerId'];
|
||||
}
|
||||
if (isset($map['SourceUrl'])) {
|
||||
$model->sourceUrl = $map['SourceUrl'];
|
||||
}
|
||||
if (isset($map['ProdCode'])) {
|
||||
$model->prodCode = $map['ProdCode'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dysmsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class DeleteShortUrlResponse extends Model
|
||||
{
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
public $headers;
|
||||
|
||||
/**
|
||||
* @var DeleteShortUrlResponseBody
|
||||
*/
|
||||
public $body;
|
||||
protected $_name = [
|
||||
'headers' => 'headers',
|
||||
'body' => 'body',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
Model::validateRequired('headers', $this->headers, true);
|
||||
Model::validateRequired('body', $this->body, true);
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->headers) {
|
||||
$res['headers'] = $this->headers;
|
||||
}
|
||||
if (null !== $this->body) {
|
||||
$res['body'] = null !== $this->body ? $this->body->toMap() : null;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return DeleteShortUrlResponse
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['headers'])) {
|
||||
$model->headers = $map['headers'];
|
||||
}
|
||||
if (isset($map['body'])) {
|
||||
$model->body = DeleteShortUrlResponseBody::fromMap($map['body']);
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dysmsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class DeleteShortUrlResponseBody extends Model
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $message;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $requestId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $code;
|
||||
protected $_name = [
|
||||
'message' => 'Message',
|
||||
'requestId' => 'RequestId',
|
||||
'code' => 'Code',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->message) {
|
||||
$res['Message'] = $this->message;
|
||||
}
|
||||
if (null !== $this->requestId) {
|
||||
$res['RequestId'] = $this->requestId;
|
||||
}
|
||||
if (null !== $this->code) {
|
||||
$res['Code'] = $this->code;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return DeleteShortUrlResponseBody
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['Message'])) {
|
||||
$model->message = $map['Message'];
|
||||
}
|
||||
if (isset($map['RequestId'])) {
|
||||
$model->requestId = $map['RequestId'];
|
||||
}
|
||||
if (isset($map['Code'])) {
|
||||
$model->code = $map['Code'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dysmsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class DeleteSmsSignRequest extends Model
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $ownerId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $resourceOwnerAccount;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $resourceOwnerId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $signName;
|
||||
protected $_name = [
|
||||
'ownerId' => 'OwnerId',
|
||||
'resourceOwnerAccount' => 'ResourceOwnerAccount',
|
||||
'resourceOwnerId' => 'ResourceOwnerId',
|
||||
'signName' => 'SignName',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->ownerId) {
|
||||
$res['OwnerId'] = $this->ownerId;
|
||||
}
|
||||
if (null !== $this->resourceOwnerAccount) {
|
||||
$res['ResourceOwnerAccount'] = $this->resourceOwnerAccount;
|
||||
}
|
||||
if (null !== $this->resourceOwnerId) {
|
||||
$res['ResourceOwnerId'] = $this->resourceOwnerId;
|
||||
}
|
||||
if (null !== $this->signName) {
|
||||
$res['SignName'] = $this->signName;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return DeleteSmsSignRequest
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['OwnerId'])) {
|
||||
$model->ownerId = $map['OwnerId'];
|
||||
}
|
||||
if (isset($map['ResourceOwnerAccount'])) {
|
||||
$model->resourceOwnerAccount = $map['ResourceOwnerAccount'];
|
||||
}
|
||||
if (isset($map['ResourceOwnerId'])) {
|
||||
$model->resourceOwnerId = $map['ResourceOwnerId'];
|
||||
}
|
||||
if (isset($map['SignName'])) {
|
||||
$model->signName = $map['SignName'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dysmsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class DeleteSmsSignResponse extends Model
|
||||
{
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
public $headers;
|
||||
|
||||
/**
|
||||
* @var DeleteSmsSignResponseBody
|
||||
*/
|
||||
public $body;
|
||||
protected $_name = [
|
||||
'headers' => 'headers',
|
||||
'body' => 'body',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
Model::validateRequired('headers', $this->headers, true);
|
||||
Model::validateRequired('body', $this->body, true);
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->headers) {
|
||||
$res['headers'] = $this->headers;
|
||||
}
|
||||
if (null !== $this->body) {
|
||||
$res['body'] = null !== $this->body ? $this->body->toMap() : null;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return DeleteSmsSignResponse
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['headers'])) {
|
||||
$model->headers = $map['headers'];
|
||||
}
|
||||
if (isset($map['body'])) {
|
||||
$model->body = DeleteSmsSignResponseBody::fromMap($map['body']);
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dysmsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class DeleteSmsSignResponseBody extends Model
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $message;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $requestId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $code;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $signName;
|
||||
protected $_name = [
|
||||
'message' => 'Message',
|
||||
'requestId' => 'RequestId',
|
||||
'code' => 'Code',
|
||||
'signName' => 'SignName',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->message) {
|
||||
$res['Message'] = $this->message;
|
||||
}
|
||||
if (null !== $this->requestId) {
|
||||
$res['RequestId'] = $this->requestId;
|
||||
}
|
||||
if (null !== $this->code) {
|
||||
$res['Code'] = $this->code;
|
||||
}
|
||||
if (null !== $this->signName) {
|
||||
$res['SignName'] = $this->signName;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return DeleteSmsSignResponseBody
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['Message'])) {
|
||||
$model->message = $map['Message'];
|
||||
}
|
||||
if (isset($map['RequestId'])) {
|
||||
$model->requestId = $map['RequestId'];
|
||||
}
|
||||
if (isset($map['Code'])) {
|
||||
$model->code = $map['Code'];
|
||||
}
|
||||
if (isset($map['SignName'])) {
|
||||
$model->signName = $map['SignName'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dysmsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class DeleteSmsTemplateRequest extends Model
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $ownerId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $resourceOwnerAccount;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $resourceOwnerId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $templateCode;
|
||||
protected $_name = [
|
||||
'ownerId' => 'OwnerId',
|
||||
'resourceOwnerAccount' => 'ResourceOwnerAccount',
|
||||
'resourceOwnerId' => 'ResourceOwnerId',
|
||||
'templateCode' => 'TemplateCode',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->ownerId) {
|
||||
$res['OwnerId'] = $this->ownerId;
|
||||
}
|
||||
if (null !== $this->resourceOwnerAccount) {
|
||||
$res['ResourceOwnerAccount'] = $this->resourceOwnerAccount;
|
||||
}
|
||||
if (null !== $this->resourceOwnerId) {
|
||||
$res['ResourceOwnerId'] = $this->resourceOwnerId;
|
||||
}
|
||||
if (null !== $this->templateCode) {
|
||||
$res['TemplateCode'] = $this->templateCode;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return DeleteSmsTemplateRequest
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['OwnerId'])) {
|
||||
$model->ownerId = $map['OwnerId'];
|
||||
}
|
||||
if (isset($map['ResourceOwnerAccount'])) {
|
||||
$model->resourceOwnerAccount = $map['ResourceOwnerAccount'];
|
||||
}
|
||||
if (isset($map['ResourceOwnerId'])) {
|
||||
$model->resourceOwnerId = $map['ResourceOwnerId'];
|
||||
}
|
||||
if (isset($map['TemplateCode'])) {
|
||||
$model->templateCode = $map['TemplateCode'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dysmsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class DeleteSmsTemplateResponse extends Model
|
||||
{
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
public $headers;
|
||||
|
||||
/**
|
||||
* @var DeleteSmsTemplateResponseBody
|
||||
*/
|
||||
public $body;
|
||||
protected $_name = [
|
||||
'headers' => 'headers',
|
||||
'body' => 'body',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
Model::validateRequired('headers', $this->headers, true);
|
||||
Model::validateRequired('body', $this->body, true);
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->headers) {
|
||||
$res['headers'] = $this->headers;
|
||||
}
|
||||
if (null !== $this->body) {
|
||||
$res['body'] = null !== $this->body ? $this->body->toMap() : null;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return DeleteSmsTemplateResponse
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['headers'])) {
|
||||
$model->headers = $map['headers'];
|
||||
}
|
||||
if (isset($map['body'])) {
|
||||
$model->body = DeleteSmsTemplateResponseBody::fromMap($map['body']);
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dysmsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class DeleteSmsTemplateResponseBody extends Model
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $templateCode;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $message;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $requestId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $code;
|
||||
protected $_name = [
|
||||
'templateCode' => 'TemplateCode',
|
||||
'message' => 'Message',
|
||||
'requestId' => 'RequestId',
|
||||
'code' => 'Code',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->templateCode) {
|
||||
$res['TemplateCode'] = $this->templateCode;
|
||||
}
|
||||
if (null !== $this->message) {
|
||||
$res['Message'] = $this->message;
|
||||
}
|
||||
if (null !== $this->requestId) {
|
||||
$res['RequestId'] = $this->requestId;
|
||||
}
|
||||
if (null !== $this->code) {
|
||||
$res['Code'] = $this->code;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return DeleteSmsTemplateResponseBody
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['TemplateCode'])) {
|
||||
$model->templateCode = $map['TemplateCode'];
|
||||
}
|
||||
if (isset($map['Message'])) {
|
||||
$model->message = $map['Message'];
|
||||
}
|
||||
if (isset($map['RequestId'])) {
|
||||
$model->requestId = $map['RequestId'];
|
||||
}
|
||||
if (isset($map['Code'])) {
|
||||
$model->code = $map['Code'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -0,0 +1,132 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dysmsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\ModifySmsSignRequest\signFileList;
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class ModifySmsSignRequest extends Model
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $ownerId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $resourceOwnerAccount;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $resourceOwnerId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $signName;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $signSource;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $remark;
|
||||
|
||||
/**
|
||||
* @var signFileList[]
|
||||
*/
|
||||
public $signFileList;
|
||||
protected $_name = [
|
||||
'ownerId' => 'OwnerId',
|
||||
'resourceOwnerAccount' => 'ResourceOwnerAccount',
|
||||
'resourceOwnerId' => 'ResourceOwnerId',
|
||||
'signName' => 'SignName',
|
||||
'signSource' => 'SignSource',
|
||||
'remark' => 'Remark',
|
||||
'signFileList' => 'SignFileList',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->ownerId) {
|
||||
$res['OwnerId'] = $this->ownerId;
|
||||
}
|
||||
if (null !== $this->resourceOwnerAccount) {
|
||||
$res['ResourceOwnerAccount'] = $this->resourceOwnerAccount;
|
||||
}
|
||||
if (null !== $this->resourceOwnerId) {
|
||||
$res['ResourceOwnerId'] = $this->resourceOwnerId;
|
||||
}
|
||||
if (null !== $this->signName) {
|
||||
$res['SignName'] = $this->signName;
|
||||
}
|
||||
if (null !== $this->signSource) {
|
||||
$res['SignSource'] = $this->signSource;
|
||||
}
|
||||
if (null !== $this->remark) {
|
||||
$res['Remark'] = $this->remark;
|
||||
}
|
||||
if (null !== $this->signFileList) {
|
||||
$res['SignFileList'] = [];
|
||||
if (null !== $this->signFileList && \is_array($this->signFileList)) {
|
||||
$n = 0;
|
||||
foreach ($this->signFileList as $item) {
|
||||
$res['SignFileList'][$n++] = null !== $item ? $item->toMap() : $item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return ModifySmsSignRequest
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['OwnerId'])) {
|
||||
$model->ownerId = $map['OwnerId'];
|
||||
}
|
||||
if (isset($map['ResourceOwnerAccount'])) {
|
||||
$model->resourceOwnerAccount = $map['ResourceOwnerAccount'];
|
||||
}
|
||||
if (isset($map['ResourceOwnerId'])) {
|
||||
$model->resourceOwnerId = $map['ResourceOwnerId'];
|
||||
}
|
||||
if (isset($map['SignName'])) {
|
||||
$model->signName = $map['SignName'];
|
||||
}
|
||||
if (isset($map['SignSource'])) {
|
||||
$model->signSource = $map['SignSource'];
|
||||
}
|
||||
if (isset($map['Remark'])) {
|
||||
$model->remark = $map['Remark'];
|
||||
}
|
||||
if (isset($map['SignFileList'])) {
|
||||
if (!empty($map['SignFileList'])) {
|
||||
$model->signFileList = [];
|
||||
$n = 0;
|
||||
foreach ($map['SignFileList'] as $item) {
|
||||
$model->signFileList[$n++] = null !== $item ? signFileList::fromMap($item) : $item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dysmsapi\V20170525\Models\ModifySmsSignRequest;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class signFileList extends Model
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $fileContents;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $fileSuffix;
|
||||
protected $_name = [
|
||||
'fileContents' => 'FileContents',
|
||||
'fileSuffix' => 'FileSuffix',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->fileContents) {
|
||||
$res['FileContents'] = $this->fileContents;
|
||||
}
|
||||
if (null !== $this->fileSuffix) {
|
||||
$res['FileSuffix'] = $this->fileSuffix;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return signFileList
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['FileContents'])) {
|
||||
$model->fileContents = $map['FileContents'];
|
||||
}
|
||||
if (isset($map['FileSuffix'])) {
|
||||
$model->fileSuffix = $map['FileSuffix'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dysmsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class ModifySmsSignResponse extends Model
|
||||
{
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
public $headers;
|
||||
|
||||
/**
|
||||
* @var ModifySmsSignResponseBody
|
||||
*/
|
||||
public $body;
|
||||
protected $_name = [
|
||||
'headers' => 'headers',
|
||||
'body' => 'body',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
Model::validateRequired('headers', $this->headers, true);
|
||||
Model::validateRequired('body', $this->body, true);
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->headers) {
|
||||
$res['headers'] = $this->headers;
|
||||
}
|
||||
if (null !== $this->body) {
|
||||
$res['body'] = null !== $this->body ? $this->body->toMap() : null;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return ModifySmsSignResponse
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['headers'])) {
|
||||
$model->headers = $map['headers'];
|
||||
}
|
||||
if (isset($map['body'])) {
|
||||
$model->body = ModifySmsSignResponseBody::fromMap($map['body']);
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dysmsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class ModifySmsSignResponseBody extends Model
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $message;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $requestId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $code;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $signName;
|
||||
protected $_name = [
|
||||
'message' => 'Message',
|
||||
'requestId' => 'RequestId',
|
||||
'code' => 'Code',
|
||||
'signName' => 'SignName',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->message) {
|
||||
$res['Message'] = $this->message;
|
||||
}
|
||||
if (null !== $this->requestId) {
|
||||
$res['RequestId'] = $this->requestId;
|
||||
}
|
||||
if (null !== $this->code) {
|
||||
$res['Code'] = $this->code;
|
||||
}
|
||||
if (null !== $this->signName) {
|
||||
$res['SignName'] = $this->signName;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return ModifySmsSignResponseBody
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['Message'])) {
|
||||
$model->message = $map['Message'];
|
||||
}
|
||||
if (isset($map['RequestId'])) {
|
||||
$model->requestId = $map['RequestId'];
|
||||
}
|
||||
if (isset($map['Code'])) {
|
||||
$model->code = $map['Code'];
|
||||
}
|
||||
if (isset($map['SignName'])) {
|
||||
$model->signName = $map['SignName'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -0,0 +1,131 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dysmsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class ModifySmsTemplateRequest extends Model
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $ownerId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $resourceOwnerAccount;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $resourceOwnerId;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $templateType;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $templateName;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $templateCode;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $templateContent;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $remark;
|
||||
protected $_name = [
|
||||
'ownerId' => 'OwnerId',
|
||||
'resourceOwnerAccount' => 'ResourceOwnerAccount',
|
||||
'resourceOwnerId' => 'ResourceOwnerId',
|
||||
'templateType' => 'TemplateType',
|
||||
'templateName' => 'TemplateName',
|
||||
'templateCode' => 'TemplateCode',
|
||||
'templateContent' => 'TemplateContent',
|
||||
'remark' => 'Remark',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->ownerId) {
|
||||
$res['OwnerId'] = $this->ownerId;
|
||||
}
|
||||
if (null !== $this->resourceOwnerAccount) {
|
||||
$res['ResourceOwnerAccount'] = $this->resourceOwnerAccount;
|
||||
}
|
||||
if (null !== $this->resourceOwnerId) {
|
||||
$res['ResourceOwnerId'] = $this->resourceOwnerId;
|
||||
}
|
||||
if (null !== $this->templateType) {
|
||||
$res['TemplateType'] = $this->templateType;
|
||||
}
|
||||
if (null !== $this->templateName) {
|
||||
$res['TemplateName'] = $this->templateName;
|
||||
}
|
||||
if (null !== $this->templateCode) {
|
||||
$res['TemplateCode'] = $this->templateCode;
|
||||
}
|
||||
if (null !== $this->templateContent) {
|
||||
$res['TemplateContent'] = $this->templateContent;
|
||||
}
|
||||
if (null !== $this->remark) {
|
||||
$res['Remark'] = $this->remark;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return ModifySmsTemplateRequest
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['OwnerId'])) {
|
||||
$model->ownerId = $map['OwnerId'];
|
||||
}
|
||||
if (isset($map['ResourceOwnerAccount'])) {
|
||||
$model->resourceOwnerAccount = $map['ResourceOwnerAccount'];
|
||||
}
|
||||
if (isset($map['ResourceOwnerId'])) {
|
||||
$model->resourceOwnerId = $map['ResourceOwnerId'];
|
||||
}
|
||||
if (isset($map['TemplateType'])) {
|
||||
$model->templateType = $map['TemplateType'];
|
||||
}
|
||||
if (isset($map['TemplateName'])) {
|
||||
$model->templateName = $map['TemplateName'];
|
||||
}
|
||||
if (isset($map['TemplateCode'])) {
|
||||
$model->templateCode = $map['TemplateCode'];
|
||||
}
|
||||
if (isset($map['TemplateContent'])) {
|
||||
$model->templateContent = $map['TemplateContent'];
|
||||
}
|
||||
if (isset($map['Remark'])) {
|
||||
$model->remark = $map['Remark'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dysmsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class ModifySmsTemplateResponse extends Model
|
||||
{
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
public $headers;
|
||||
|
||||
/**
|
||||
* @var ModifySmsTemplateResponseBody
|
||||
*/
|
||||
public $body;
|
||||
protected $_name = [
|
||||
'headers' => 'headers',
|
||||
'body' => 'body',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
Model::validateRequired('headers', $this->headers, true);
|
||||
Model::validateRequired('body', $this->body, true);
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->headers) {
|
||||
$res['headers'] = $this->headers;
|
||||
}
|
||||
if (null !== $this->body) {
|
||||
$res['body'] = null !== $this->body ? $this->body->toMap() : null;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return ModifySmsTemplateResponse
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['headers'])) {
|
||||
$model->headers = $map['headers'];
|
||||
}
|
||||
if (isset($map['body'])) {
|
||||
$model->body = ModifySmsTemplateResponseBody::fromMap($map['body']);
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dysmsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class ModifySmsTemplateResponseBody extends Model
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $templateCode;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $message;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $requestId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $code;
|
||||
protected $_name = [
|
||||
'templateCode' => 'TemplateCode',
|
||||
'message' => 'Message',
|
||||
'requestId' => 'RequestId',
|
||||
'code' => 'Code',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->templateCode) {
|
||||
$res['TemplateCode'] = $this->templateCode;
|
||||
}
|
||||
if (null !== $this->message) {
|
||||
$res['Message'] = $this->message;
|
||||
}
|
||||
if (null !== $this->requestId) {
|
||||
$res['RequestId'] = $this->requestId;
|
||||
}
|
||||
if (null !== $this->code) {
|
||||
$res['Code'] = $this->code;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return ModifySmsTemplateResponseBody
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['TemplateCode'])) {
|
||||
$model->templateCode = $map['TemplateCode'];
|
||||
}
|
||||
if (isset($map['Message'])) {
|
||||
$model->message = $map['Message'];
|
||||
}
|
||||
if (isset($map['RequestId'])) {
|
||||
$model->requestId = $map['RequestId'];
|
||||
}
|
||||
if (isset($map['Code'])) {
|
||||
$model->code = $map['Code'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -0,0 +1,131 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dysmsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class QuerySendDetailsRequest extends Model
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $ownerId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $resourceOwnerAccount;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $resourceOwnerId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $phoneNumber;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $bizId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $sendDate;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $pageSize;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $currentPage;
|
||||
protected $_name = [
|
||||
'ownerId' => 'OwnerId',
|
||||
'resourceOwnerAccount' => 'ResourceOwnerAccount',
|
||||
'resourceOwnerId' => 'ResourceOwnerId',
|
||||
'phoneNumber' => 'PhoneNumber',
|
||||
'bizId' => 'BizId',
|
||||
'sendDate' => 'SendDate',
|
||||
'pageSize' => 'PageSize',
|
||||
'currentPage' => 'CurrentPage',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->ownerId) {
|
||||
$res['OwnerId'] = $this->ownerId;
|
||||
}
|
||||
if (null !== $this->resourceOwnerAccount) {
|
||||
$res['ResourceOwnerAccount'] = $this->resourceOwnerAccount;
|
||||
}
|
||||
if (null !== $this->resourceOwnerId) {
|
||||
$res['ResourceOwnerId'] = $this->resourceOwnerId;
|
||||
}
|
||||
if (null !== $this->phoneNumber) {
|
||||
$res['PhoneNumber'] = $this->phoneNumber;
|
||||
}
|
||||
if (null !== $this->bizId) {
|
||||
$res['BizId'] = $this->bizId;
|
||||
}
|
||||
if (null !== $this->sendDate) {
|
||||
$res['SendDate'] = $this->sendDate;
|
||||
}
|
||||
if (null !== $this->pageSize) {
|
||||
$res['PageSize'] = $this->pageSize;
|
||||
}
|
||||
if (null !== $this->currentPage) {
|
||||
$res['CurrentPage'] = $this->currentPage;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return QuerySendDetailsRequest
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['OwnerId'])) {
|
||||
$model->ownerId = $map['OwnerId'];
|
||||
}
|
||||
if (isset($map['ResourceOwnerAccount'])) {
|
||||
$model->resourceOwnerAccount = $map['ResourceOwnerAccount'];
|
||||
}
|
||||
if (isset($map['ResourceOwnerId'])) {
|
||||
$model->resourceOwnerId = $map['ResourceOwnerId'];
|
||||
}
|
||||
if (isset($map['PhoneNumber'])) {
|
||||
$model->phoneNumber = $map['PhoneNumber'];
|
||||
}
|
||||
if (isset($map['BizId'])) {
|
||||
$model->bizId = $map['BizId'];
|
||||
}
|
||||
if (isset($map['SendDate'])) {
|
||||
$model->sendDate = $map['SendDate'];
|
||||
}
|
||||
if (isset($map['PageSize'])) {
|
||||
$model->pageSize = $map['PageSize'];
|
||||
}
|
||||
if (isset($map['CurrentPage'])) {
|
||||
$model->currentPage = $map['CurrentPage'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dysmsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class QuerySendDetailsResponse extends Model
|
||||
{
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
public $headers;
|
||||
|
||||
/**
|
||||
* @var QuerySendDetailsResponseBody
|
||||
*/
|
||||
public $body;
|
||||
protected $_name = [
|
||||
'headers' => 'headers',
|
||||
'body' => 'body',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
Model::validateRequired('headers', $this->headers, true);
|
||||
Model::validateRequired('body', $this->body, true);
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->headers) {
|
||||
$res['headers'] = $this->headers;
|
||||
}
|
||||
if (null !== $this->body) {
|
||||
$res['body'] = null !== $this->body ? $this->body->toMap() : null;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return QuerySendDetailsResponse
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['headers'])) {
|
||||
$model->headers = $map['headers'];
|
||||
}
|
||||
if (isset($map['body'])) {
|
||||
$model->body = QuerySendDetailsResponseBody::fromMap($map['body']);
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dysmsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\QuerySendDetailsResponseBody\smsSendDetailDTOs;
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class QuerySendDetailsResponseBody extends Model
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $totalCount;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $message;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $requestId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $code;
|
||||
|
||||
/**
|
||||
* @var smsSendDetailDTOs
|
||||
*/
|
||||
public $smsSendDetailDTOs;
|
||||
protected $_name = [
|
||||
'totalCount' => 'TotalCount',
|
||||
'message' => 'Message',
|
||||
'requestId' => 'RequestId',
|
||||
'code' => 'Code',
|
||||
'smsSendDetailDTOs' => 'SmsSendDetailDTOs',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->totalCount) {
|
||||
$res['TotalCount'] = $this->totalCount;
|
||||
}
|
||||
if (null !== $this->message) {
|
||||
$res['Message'] = $this->message;
|
||||
}
|
||||
if (null !== $this->requestId) {
|
||||
$res['RequestId'] = $this->requestId;
|
||||
}
|
||||
if (null !== $this->code) {
|
||||
$res['Code'] = $this->code;
|
||||
}
|
||||
if (null !== $this->smsSendDetailDTOs) {
|
||||
$res['SmsSendDetailDTOs'] = null !== $this->smsSendDetailDTOs ? $this->smsSendDetailDTOs->toMap() : null;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return QuerySendDetailsResponseBody
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['TotalCount'])) {
|
||||
$model->totalCount = $map['TotalCount'];
|
||||
}
|
||||
if (isset($map['Message'])) {
|
||||
$model->message = $map['Message'];
|
||||
}
|
||||
if (isset($map['RequestId'])) {
|
||||
$model->requestId = $map['RequestId'];
|
||||
}
|
||||
if (isset($map['Code'])) {
|
||||
$model->code = $map['Code'];
|
||||
}
|
||||
if (isset($map['SmsSendDetailDTOs'])) {
|
||||
$model->smsSendDetailDTOs = smsSendDetailDTOs::fromMap($map['SmsSendDetailDTOs']);
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dysmsapi\V20170525\Models\QuerySendDetailsResponseBody;
|
||||
|
||||
use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\QuerySendDetailsResponseBody\smsSendDetailDTOs\smsSendDetailDTO;
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class smsSendDetailDTOs extends Model
|
||||
{
|
||||
/**
|
||||
* @var smsSendDetailDTO[]
|
||||
*/
|
||||
public $smsSendDetailDTO;
|
||||
protected $_name = [
|
||||
'smsSendDetailDTO' => 'SmsSendDetailDTO',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->smsSendDetailDTO) {
|
||||
$res['SmsSendDetailDTO'] = [];
|
||||
if (null !== $this->smsSendDetailDTO && \is_array($this->smsSendDetailDTO)) {
|
||||
$n = 0;
|
||||
foreach ($this->smsSendDetailDTO as $item) {
|
||||
$res['SmsSendDetailDTO'][$n++] = null !== $item ? $item->toMap() : $item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return smsSendDetailDTOs
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['SmsSendDetailDTO'])) {
|
||||
if (!empty($map['SmsSendDetailDTO'])) {
|
||||
$model->smsSendDetailDTO = [];
|
||||
$n = 0;
|
||||
foreach ($map['SmsSendDetailDTO'] as $item) {
|
||||
$model->smsSendDetailDTO[$n++] = null !== $item ? smsSendDetailDTO::fromMap($item) : $item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -0,0 +1,131 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dysmsapi\V20170525\Models\QuerySendDetailsResponseBody\smsSendDetailDTOs;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class smsSendDetailDTO extends Model
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $errCode;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $templateCode;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $outId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $receiveDate;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $sendDate;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $phoneNum;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $content;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $sendStatus;
|
||||
protected $_name = [
|
||||
'errCode' => 'ErrCode',
|
||||
'templateCode' => 'TemplateCode',
|
||||
'outId' => 'OutId',
|
||||
'receiveDate' => 'ReceiveDate',
|
||||
'sendDate' => 'SendDate',
|
||||
'phoneNum' => 'PhoneNum',
|
||||
'content' => 'Content',
|
||||
'sendStatus' => 'SendStatus',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->errCode) {
|
||||
$res['ErrCode'] = $this->errCode;
|
||||
}
|
||||
if (null !== $this->templateCode) {
|
||||
$res['TemplateCode'] = $this->templateCode;
|
||||
}
|
||||
if (null !== $this->outId) {
|
||||
$res['OutId'] = $this->outId;
|
||||
}
|
||||
if (null !== $this->receiveDate) {
|
||||
$res['ReceiveDate'] = $this->receiveDate;
|
||||
}
|
||||
if (null !== $this->sendDate) {
|
||||
$res['SendDate'] = $this->sendDate;
|
||||
}
|
||||
if (null !== $this->phoneNum) {
|
||||
$res['PhoneNum'] = $this->phoneNum;
|
||||
}
|
||||
if (null !== $this->content) {
|
||||
$res['Content'] = $this->content;
|
||||
}
|
||||
if (null !== $this->sendStatus) {
|
||||
$res['SendStatus'] = $this->sendStatus;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return smsSendDetailDTO
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['ErrCode'])) {
|
||||
$model->errCode = $map['ErrCode'];
|
||||
}
|
||||
if (isset($map['TemplateCode'])) {
|
||||
$model->templateCode = $map['TemplateCode'];
|
||||
}
|
||||
if (isset($map['OutId'])) {
|
||||
$model->outId = $map['OutId'];
|
||||
}
|
||||
if (isset($map['ReceiveDate'])) {
|
||||
$model->receiveDate = $map['ReceiveDate'];
|
||||
}
|
||||
if (isset($map['SendDate'])) {
|
||||
$model->sendDate = $map['SendDate'];
|
||||
}
|
||||
if (isset($map['PhoneNum'])) {
|
||||
$model->phoneNum = $map['PhoneNum'];
|
||||
}
|
||||
if (isset($map['Content'])) {
|
||||
$model->content = $map['Content'];
|
||||
}
|
||||
if (isset($map['SendStatus'])) {
|
||||
$model->sendStatus = $map['SendStatus'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dysmsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class QueryShortUrlRequest extends Model
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $ownerId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $resourceOwnerAccount;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $resourceOwnerId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $prodCode;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $shortUrl;
|
||||
protected $_name = [
|
||||
'ownerId' => 'OwnerId',
|
||||
'resourceOwnerAccount' => 'ResourceOwnerAccount',
|
||||
'resourceOwnerId' => 'ResourceOwnerId',
|
||||
'prodCode' => 'ProdCode',
|
||||
'shortUrl' => 'ShortUrl',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->ownerId) {
|
||||
$res['OwnerId'] = $this->ownerId;
|
||||
}
|
||||
if (null !== $this->resourceOwnerAccount) {
|
||||
$res['ResourceOwnerAccount'] = $this->resourceOwnerAccount;
|
||||
}
|
||||
if (null !== $this->resourceOwnerId) {
|
||||
$res['ResourceOwnerId'] = $this->resourceOwnerId;
|
||||
}
|
||||
if (null !== $this->prodCode) {
|
||||
$res['ProdCode'] = $this->prodCode;
|
||||
}
|
||||
if (null !== $this->shortUrl) {
|
||||
$res['ShortUrl'] = $this->shortUrl;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return QueryShortUrlRequest
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['OwnerId'])) {
|
||||
$model->ownerId = $map['OwnerId'];
|
||||
}
|
||||
if (isset($map['ResourceOwnerAccount'])) {
|
||||
$model->resourceOwnerAccount = $map['ResourceOwnerAccount'];
|
||||
}
|
||||
if (isset($map['ResourceOwnerId'])) {
|
||||
$model->resourceOwnerId = $map['ResourceOwnerId'];
|
||||
}
|
||||
if (isset($map['ProdCode'])) {
|
||||
$model->prodCode = $map['ProdCode'];
|
||||
}
|
||||
if (isset($map['ShortUrl'])) {
|
||||
$model->shortUrl = $map['ShortUrl'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dysmsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class QueryShortUrlResponse extends Model
|
||||
{
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
public $headers;
|
||||
|
||||
/**
|
||||
* @var QueryShortUrlResponseBody
|
||||
*/
|
||||
public $body;
|
||||
protected $_name = [
|
||||
'headers' => 'headers',
|
||||
'body' => 'body',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
Model::validateRequired('headers', $this->headers, true);
|
||||
Model::validateRequired('body', $this->body, true);
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->headers) {
|
||||
$res['headers'] = $this->headers;
|
||||
}
|
||||
if (null !== $this->body) {
|
||||
$res['body'] = null !== $this->body ? $this->body->toMap() : null;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return QueryShortUrlResponse
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['headers'])) {
|
||||
$model->headers = $map['headers'];
|
||||
}
|
||||
if (isset($map['body'])) {
|
||||
$model->body = QueryShortUrlResponseBody::fromMap($map['body']);
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dysmsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\QueryShortUrlResponseBody\data;
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class QueryShortUrlResponseBody extends Model
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $message;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $requestId;
|
||||
|
||||
/**
|
||||
* @var data
|
||||
*/
|
||||
public $data;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $code;
|
||||
protected $_name = [
|
||||
'message' => 'Message',
|
||||
'requestId' => 'RequestId',
|
||||
'data' => 'Data',
|
||||
'code' => 'Code',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->message) {
|
||||
$res['Message'] = $this->message;
|
||||
}
|
||||
if (null !== $this->requestId) {
|
||||
$res['RequestId'] = $this->requestId;
|
||||
}
|
||||
if (null !== $this->data) {
|
||||
$res['Data'] = null !== $this->data ? $this->data->toMap() : null;
|
||||
}
|
||||
if (null !== $this->code) {
|
||||
$res['Code'] = $this->code;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return QueryShortUrlResponseBody
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['Message'])) {
|
||||
$model->message = $map['Message'];
|
||||
}
|
||||
if (isset($map['RequestId'])) {
|
||||
$model->requestId = $map['RequestId'];
|
||||
}
|
||||
if (isset($map['Data'])) {
|
||||
$model->data = data::fromMap($map['Data']);
|
||||
}
|
||||
if (isset($map['Code'])) {
|
||||
$model->code = $map['Code'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -0,0 +1,131 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dysmsapi\V20170525\Models\QueryShortUrlResponseBody;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class data extends Model
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $uniqueVisitorCount;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $sourceUrl;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $shortUrlStatus;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $pageViewCount;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $expireDate;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $shortUrlName;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $createDate;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $shortUrl;
|
||||
protected $_name = [
|
||||
'uniqueVisitorCount' => 'UniqueVisitorCount',
|
||||
'sourceUrl' => 'SourceUrl',
|
||||
'shortUrlStatus' => 'ShortUrlStatus',
|
||||
'pageViewCount' => 'PageViewCount',
|
||||
'expireDate' => 'ExpireDate',
|
||||
'shortUrlName' => 'ShortUrlName',
|
||||
'createDate' => 'CreateDate',
|
||||
'shortUrl' => 'ShortUrl',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->uniqueVisitorCount) {
|
||||
$res['UniqueVisitorCount'] = $this->uniqueVisitorCount;
|
||||
}
|
||||
if (null !== $this->sourceUrl) {
|
||||
$res['SourceUrl'] = $this->sourceUrl;
|
||||
}
|
||||
if (null !== $this->shortUrlStatus) {
|
||||
$res['ShortUrlStatus'] = $this->shortUrlStatus;
|
||||
}
|
||||
if (null !== $this->pageViewCount) {
|
||||
$res['PageViewCount'] = $this->pageViewCount;
|
||||
}
|
||||
if (null !== $this->expireDate) {
|
||||
$res['ExpireDate'] = $this->expireDate;
|
||||
}
|
||||
if (null !== $this->shortUrlName) {
|
||||
$res['ShortUrlName'] = $this->shortUrlName;
|
||||
}
|
||||
if (null !== $this->createDate) {
|
||||
$res['CreateDate'] = $this->createDate;
|
||||
}
|
||||
if (null !== $this->shortUrl) {
|
||||
$res['ShortUrl'] = $this->shortUrl;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return data
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['UniqueVisitorCount'])) {
|
||||
$model->uniqueVisitorCount = $map['UniqueVisitorCount'];
|
||||
}
|
||||
if (isset($map['SourceUrl'])) {
|
||||
$model->sourceUrl = $map['SourceUrl'];
|
||||
}
|
||||
if (isset($map['ShortUrlStatus'])) {
|
||||
$model->shortUrlStatus = $map['ShortUrlStatus'];
|
||||
}
|
||||
if (isset($map['PageViewCount'])) {
|
||||
$model->pageViewCount = $map['PageViewCount'];
|
||||
}
|
||||
if (isset($map['ExpireDate'])) {
|
||||
$model->expireDate = $map['ExpireDate'];
|
||||
}
|
||||
if (isset($map['ShortUrlName'])) {
|
||||
$model->shortUrlName = $map['ShortUrlName'];
|
||||
}
|
||||
if (isset($map['CreateDate'])) {
|
||||
$model->createDate = $map['CreateDate'];
|
||||
}
|
||||
if (isset($map['ShortUrl'])) {
|
||||
$model->shortUrl = $map['ShortUrl'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dysmsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class QuerySmsSignRequest extends Model
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $ownerId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $resourceOwnerAccount;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $resourceOwnerId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $signName;
|
||||
protected $_name = [
|
||||
'ownerId' => 'OwnerId',
|
||||
'resourceOwnerAccount' => 'ResourceOwnerAccount',
|
||||
'resourceOwnerId' => 'ResourceOwnerId',
|
||||
'signName' => 'SignName',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->ownerId) {
|
||||
$res['OwnerId'] = $this->ownerId;
|
||||
}
|
||||
if (null !== $this->resourceOwnerAccount) {
|
||||
$res['ResourceOwnerAccount'] = $this->resourceOwnerAccount;
|
||||
}
|
||||
if (null !== $this->resourceOwnerId) {
|
||||
$res['ResourceOwnerId'] = $this->resourceOwnerId;
|
||||
}
|
||||
if (null !== $this->signName) {
|
||||
$res['SignName'] = $this->signName;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return QuerySmsSignRequest
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['OwnerId'])) {
|
||||
$model->ownerId = $map['OwnerId'];
|
||||
}
|
||||
if (isset($map['ResourceOwnerAccount'])) {
|
||||
$model->resourceOwnerAccount = $map['ResourceOwnerAccount'];
|
||||
}
|
||||
if (isset($map['ResourceOwnerId'])) {
|
||||
$model->resourceOwnerId = $map['ResourceOwnerId'];
|
||||
}
|
||||
if (isset($map['SignName'])) {
|
||||
$model->signName = $map['SignName'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dysmsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class QuerySmsSignResponse extends Model
|
||||
{
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
public $headers;
|
||||
|
||||
/**
|
||||
* @var QuerySmsSignResponseBody
|
||||
*/
|
||||
public $body;
|
||||
protected $_name = [
|
||||
'headers' => 'headers',
|
||||
'body' => 'body',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
Model::validateRequired('headers', $this->headers, true);
|
||||
Model::validateRequired('body', $this->body, true);
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->headers) {
|
||||
$res['headers'] = $this->headers;
|
||||
}
|
||||
if (null !== $this->body) {
|
||||
$res['body'] = null !== $this->body ? $this->body->toMap() : null;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return QuerySmsSignResponse
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['headers'])) {
|
||||
$model->headers = $map['headers'];
|
||||
}
|
||||
if (isset($map['body'])) {
|
||||
$model->body = QuerySmsSignResponseBody::fromMap($map['body']);
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -0,0 +1,119 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dysmsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class QuerySmsSignResponseBody extends Model
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $requestId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $message;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $signStatus;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $code;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $createDate;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $reason;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $signName;
|
||||
protected $_name = [
|
||||
'requestId' => 'RequestId',
|
||||
'message' => 'Message',
|
||||
'signStatus' => 'SignStatus',
|
||||
'code' => 'Code',
|
||||
'createDate' => 'CreateDate',
|
||||
'reason' => 'Reason',
|
||||
'signName' => 'SignName',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->requestId) {
|
||||
$res['RequestId'] = $this->requestId;
|
||||
}
|
||||
if (null !== $this->message) {
|
||||
$res['Message'] = $this->message;
|
||||
}
|
||||
if (null !== $this->signStatus) {
|
||||
$res['SignStatus'] = $this->signStatus;
|
||||
}
|
||||
if (null !== $this->code) {
|
||||
$res['Code'] = $this->code;
|
||||
}
|
||||
if (null !== $this->createDate) {
|
||||
$res['CreateDate'] = $this->createDate;
|
||||
}
|
||||
if (null !== $this->reason) {
|
||||
$res['Reason'] = $this->reason;
|
||||
}
|
||||
if (null !== $this->signName) {
|
||||
$res['SignName'] = $this->signName;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return QuerySmsSignResponseBody
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['RequestId'])) {
|
||||
$model->requestId = $map['RequestId'];
|
||||
}
|
||||
if (isset($map['Message'])) {
|
||||
$model->message = $map['Message'];
|
||||
}
|
||||
if (isset($map['SignStatus'])) {
|
||||
$model->signStatus = $map['SignStatus'];
|
||||
}
|
||||
if (isset($map['Code'])) {
|
||||
$model->code = $map['Code'];
|
||||
}
|
||||
if (isset($map['CreateDate'])) {
|
||||
$model->createDate = $map['CreateDate'];
|
||||
}
|
||||
if (isset($map['Reason'])) {
|
||||
$model->reason = $map['Reason'];
|
||||
}
|
||||
if (isset($map['SignName'])) {
|
||||
$model->signName = $map['SignName'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dysmsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class QuerySmsTemplateRequest extends Model
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $ownerId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $resourceOwnerAccount;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $resourceOwnerId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $templateCode;
|
||||
protected $_name = [
|
||||
'ownerId' => 'OwnerId',
|
||||
'resourceOwnerAccount' => 'ResourceOwnerAccount',
|
||||
'resourceOwnerId' => 'ResourceOwnerId',
|
||||
'templateCode' => 'TemplateCode',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->ownerId) {
|
||||
$res['OwnerId'] = $this->ownerId;
|
||||
}
|
||||
if (null !== $this->resourceOwnerAccount) {
|
||||
$res['ResourceOwnerAccount'] = $this->resourceOwnerAccount;
|
||||
}
|
||||
if (null !== $this->resourceOwnerId) {
|
||||
$res['ResourceOwnerId'] = $this->resourceOwnerId;
|
||||
}
|
||||
if (null !== $this->templateCode) {
|
||||
$res['TemplateCode'] = $this->templateCode;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return QuerySmsTemplateRequest
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['OwnerId'])) {
|
||||
$model->ownerId = $map['OwnerId'];
|
||||
}
|
||||
if (isset($map['ResourceOwnerAccount'])) {
|
||||
$model->resourceOwnerAccount = $map['ResourceOwnerAccount'];
|
||||
}
|
||||
if (isset($map['ResourceOwnerId'])) {
|
||||
$model->resourceOwnerId = $map['ResourceOwnerId'];
|
||||
}
|
||||
if (isset($map['TemplateCode'])) {
|
||||
$model->templateCode = $map['TemplateCode'];
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
namespace AlibabaCloud\SDK\Dysmsapi\V20170525\Models;
|
||||
|
||||
use AlibabaCloud\Tea\Model;
|
||||
|
||||
class QuerySmsTemplateResponse extends Model
|
||||
{
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
public $headers;
|
||||
|
||||
/**
|
||||
* @var QuerySmsTemplateResponseBody
|
||||
*/
|
||||
public $body;
|
||||
protected $_name = [
|
||||
'headers' => 'headers',
|
||||
'body' => 'body',
|
||||
];
|
||||
|
||||
public function validate()
|
||||
{
|
||||
Model::validateRequired('headers', $this->headers, true);
|
||||
Model::validateRequired('body', $this->body, true);
|
||||
}
|
||||
|
||||
public function toMap()
|
||||
{
|
||||
$res = [];
|
||||
if (null !== $this->headers) {
|
||||
$res['headers'] = $this->headers;
|
||||
}
|
||||
if (null !== $this->body) {
|
||||
$res['body'] = null !== $this->body ? $this->body->toMap() : null;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $map
|
||||
*
|
||||
* @return QuerySmsTemplateResponse
|
||||
*/
|
||||
public static function fromMap($map = [])
|
||||
{
|
||||
$model = new self();
|
||||
if (isset($map['headers'])) {
|
||||
$model->headers = $map['headers'];
|
||||
}
|
||||
if (isset($map['body'])) {
|
||||
$model->body = QuerySmsTemplateResponseBody::fromMap($map['body']);
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue