添加网站文件
This commit is contained in:
30
vendor/alibabacloud/client/src/Clients/AccessKeyClient.php
vendored
Normal file
30
vendor/alibabacloud/client/src/Clients/AccessKeyClient.php
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Client\Clients;
|
||||
|
||||
use AlibabaCloud\Client\Exception\ClientException;
|
||||
use AlibabaCloud\Client\Signature\ShaHmac1Signature;
|
||||
use AlibabaCloud\Client\Credentials\AccessKeyCredential;
|
||||
|
||||
/**
|
||||
* Use the AccessKey to complete the authentication.
|
||||
*
|
||||
* @package AlibabaCloud\Client\Clients
|
||||
*/
|
||||
class AccessKeyClient extends Client
|
||||
{
|
||||
|
||||
/**
|
||||
* @param string $accessKeyId
|
||||
* @param string $accessKeySecret
|
||||
*
|
||||
* @throws ClientException
|
||||
*/
|
||||
public function __construct($accessKeyId, $accessKeySecret)
|
||||
{
|
||||
parent::__construct(
|
||||
new AccessKeyCredential($accessKeyId, $accessKeySecret),
|
||||
new ShaHmac1Signature()
|
||||
);
|
||||
}
|
||||
}
|
||||
29
vendor/alibabacloud/client/src/Clients/BearerTokenClient.php
vendored
Normal file
29
vendor/alibabacloud/client/src/Clients/BearerTokenClient.php
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Client\Clients;
|
||||
|
||||
use AlibabaCloud\Client\Exception\ClientException;
|
||||
use AlibabaCloud\Client\Signature\BearerTokenSignature;
|
||||
use AlibabaCloud\Client\Credentials\BearerTokenCredential;
|
||||
|
||||
/**
|
||||
* Use the Bearer Token to complete the authentication.
|
||||
*
|
||||
* @package AlibabaCloud\Client\Clients
|
||||
*/
|
||||
class BearerTokenClient extends Client
|
||||
{
|
||||
|
||||
/**
|
||||
* @param string $bearerToken
|
||||
*
|
||||
* @throws ClientException
|
||||
*/
|
||||
public function __construct($bearerToken)
|
||||
{
|
||||
parent::__construct(
|
||||
new BearerTokenCredential($bearerToken),
|
||||
new BearerTokenSignature()
|
||||
);
|
||||
}
|
||||
}
|
||||
72
vendor/alibabacloud/client/src/Clients/Client.php
vendored
Normal file
72
vendor/alibabacloud/client/src/Clients/Client.php
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Client\Clients;
|
||||
|
||||
use AlibabaCloud\Client\Request\Request;
|
||||
use AlibabaCloud\Client\Traits\HttpTrait;
|
||||
use AlibabaCloud\Client\Traits\RegionTrait;
|
||||
use AlibabaCloud\Client\Credentials\StsCredential;
|
||||
use AlibabaCloud\Client\Signature\ShaHmac1Signature;
|
||||
use AlibabaCloud\Client\Signature\SignatureInterface;
|
||||
use AlibabaCloud\Client\Signature\ShaHmac256Signature;
|
||||
use AlibabaCloud\Client\Signature\BearerTokenSignature;
|
||||
use AlibabaCloud\Client\Credentials\AccessKeyCredential;
|
||||
use AlibabaCloud\Client\Credentials\CredentialsInterface;
|
||||
use AlibabaCloud\Client\Credentials\EcsRamRoleCredential;
|
||||
use AlibabaCloud\Client\Credentials\RamRoleArnCredential;
|
||||
use AlibabaCloud\Client\Credentials\RsaKeyPairCredential;
|
||||
use AlibabaCloud\Client\Credentials\BearerTokenCredential;
|
||||
use AlibabaCloud\Client\Signature\ShaHmac256WithRsaSignature;
|
||||
|
||||
/**
|
||||
* Custom Client.
|
||||
*
|
||||
* @package AlibabaCloud\Client\Clients
|
||||
*/
|
||||
class Client
|
||||
{
|
||||
use HttpTrait;
|
||||
use RegionTrait;
|
||||
use ManageTrait;
|
||||
|
||||
/**
|
||||
* @var CredentialsInterface|AccessKeyCredential|BearerTokenCredential|StsCredential|EcsRamRoleCredential|RamRoleArnCredential|RsaKeyPairCredential
|
||||
*/
|
||||
private $credential;
|
||||
|
||||
/**
|
||||
* @var SignatureInterface
|
||||
*/
|
||||
private $signature;
|
||||
|
||||
/**
|
||||
* Self constructor.
|
||||
*
|
||||
* @param CredentialsInterface $credential
|
||||
* @param SignatureInterface $signature
|
||||
*/
|
||||
public function __construct(CredentialsInterface $credential, SignatureInterface $signature)
|
||||
{
|
||||
$this->credential = $credential;
|
||||
$this->signature = $signature;
|
||||
$this->options['connect_timeout'] = Request::CONNECT_TIMEOUT;
|
||||
$this->options['timeout'] = Request::TIMEOUT;
|
||||
$this->options['verify'] = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return AccessKeyCredential|BearerTokenCredential|CredentialsInterface|EcsRamRoleCredential|RamRoleArnCredential|RsaKeyPairCredential|StsCredential
|
||||
*/
|
||||
public function getCredential()
|
||||
{
|
||||
return $this->credential;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return SignatureInterface|BearerTokenSignature|ShaHmac1Signature|ShaHmac256Signature|ShaHmac256WithRsaSignature
|
||||
*/
|
||||
public function getSignature()
|
||||
{
|
||||
return $this->signature;
|
||||
}
|
||||
}
|
||||
26
vendor/alibabacloud/client/src/Clients/EcsRamRoleClient.php
vendored
Normal file
26
vendor/alibabacloud/client/src/Clients/EcsRamRoleClient.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Client\Clients;
|
||||
|
||||
use AlibabaCloud\Client\Exception\ClientException;
|
||||
use AlibabaCloud\Client\Signature\ShaHmac1Signature;
|
||||
use AlibabaCloud\Client\Credentials\EcsRamRoleCredential;
|
||||
|
||||
/**
|
||||
* Use the RAM role of an ECS instance to complete the authentication.
|
||||
*/
|
||||
class EcsRamRoleClient extends Client
|
||||
{
|
||||
/**
|
||||
* @param string $roleName
|
||||
*
|
||||
* @throws ClientException
|
||||
*/
|
||||
public function __construct($roleName)
|
||||
{
|
||||
parent::__construct(
|
||||
new EcsRamRoleCredential($roleName),
|
||||
new ShaHmac1Signature()
|
||||
);
|
||||
}
|
||||
}
|
||||
98
vendor/alibabacloud/client/src/Clients/ManageTrait.php
vendored
Normal file
98
vendor/alibabacloud/client/src/Clients/ManageTrait.php
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Client\Clients;
|
||||
|
||||
use AlibabaCloud\Client\AlibabaCloud;
|
||||
use AlibabaCloud\Client\Filter\Filter;
|
||||
use AlibabaCloud\Client\Request\Request;
|
||||
use AlibabaCloud\Client\Credentials\StsCredential;
|
||||
use AlibabaCloud\Client\Exception\ClientException;
|
||||
use AlibabaCloud\Client\Exception\ServerException;
|
||||
use AlibabaCloud\Client\Credentials\CredentialsInterface;
|
||||
use AlibabaCloud\Client\Credentials\EcsRamRoleCredential;
|
||||
use AlibabaCloud\Client\Credentials\RamRoleArnCredential;
|
||||
use AlibabaCloud\Client\Credentials\RsaKeyPairCredential;
|
||||
use AlibabaCloud\Client\Credentials\Providers\EcsRamRoleProvider;
|
||||
use AlibabaCloud\Client\Credentials\Providers\RamRoleArnProvider;
|
||||
use AlibabaCloud\Client\Credentials\Providers\RsaKeyPairProvider;
|
||||
use AlibabaCloud\Client\Credentials\Providers\CredentialsProvider;
|
||||
|
||||
/**
|
||||
* Trait ManageTrait.
|
||||
*
|
||||
* @mixin Client
|
||||
*/
|
||||
trait ManageTrait
|
||||
{
|
||||
/**
|
||||
* @param int $timeout
|
||||
* @param int $connectTimeout
|
||||
*
|
||||
* @return CredentialsInterface|StsCredential
|
||||
*
|
||||
* @throws ClientException
|
||||
* @throws ServerException
|
||||
*/
|
||||
public function getSessionCredential($timeout = Request::TIMEOUT, $connectTimeout = Request::CONNECT_TIMEOUT)
|
||||
{
|
||||
switch (\get_class($this->credential)) {
|
||||
case EcsRamRoleCredential::class:
|
||||
return (new EcsRamRoleProvider($this))->get();
|
||||
case RamRoleArnCredential::class:
|
||||
return (new RamRoleArnProvider($this))->get($timeout, $connectTimeout);
|
||||
case RsaKeyPairCredential::class:
|
||||
return (new RsaKeyPairProvider($this))->get($timeout, $connectTimeout);
|
||||
default:
|
||||
return $this->credential;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return static
|
||||
* @throws ClientException
|
||||
* @deprecated
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function asGlobalClient()
|
||||
{
|
||||
return $this->asDefaultClient();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the current client as the default client.
|
||||
*
|
||||
* @return static
|
||||
* @throws ClientException
|
||||
*/
|
||||
public function asDefaultClient()
|
||||
{
|
||||
return $this->name(CredentialsProvider::getDefaultName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Naming clients.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return static
|
||||
* @throws ClientException
|
||||
*/
|
||||
public function name($name)
|
||||
{
|
||||
Filter::name($name);
|
||||
|
||||
return AlibabaCloud::set($name, $this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isDebug()
|
||||
{
|
||||
if (isset($this->options['debug'])) {
|
||||
return $this->options['debug'] === true && PHP_SAPI === 'cli';
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
33
vendor/alibabacloud/client/src/Clients/RamRoleArnClient.php
vendored
Normal file
33
vendor/alibabacloud/client/src/Clients/RamRoleArnClient.php
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Client\Clients;
|
||||
|
||||
use AlibabaCloud\Client\Exception\ClientException;
|
||||
use AlibabaCloud\Client\Signature\ShaHmac1Signature;
|
||||
use AlibabaCloud\Client\Credentials\RamRoleArnCredential;
|
||||
|
||||
/**
|
||||
* Use the AssumeRole of the RAM account to complete the authentication.
|
||||
*
|
||||
* @package AlibabaCloud\Client\Clients
|
||||
*/
|
||||
class RamRoleArnClient extends Client
|
||||
{
|
||||
|
||||
/**
|
||||
* @param string $accessKeyId
|
||||
* @param string $accessKeySecret
|
||||
* @param string $roleArn
|
||||
* @param string $roleSessionName
|
||||
* @param string|array $policy
|
||||
*
|
||||
* @throws ClientException
|
||||
*/
|
||||
public function __construct($accessKeyId, $accessKeySecret, $roleArn, $roleSessionName, $policy = '')
|
||||
{
|
||||
parent::__construct(
|
||||
new RamRoleArnCredential($accessKeyId, $accessKeySecret, $roleArn, $roleSessionName, $policy),
|
||||
new ShaHmac1Signature()
|
||||
);
|
||||
}
|
||||
}
|
||||
30
vendor/alibabacloud/client/src/Clients/RsaKeyPairClient.php
vendored
Normal file
30
vendor/alibabacloud/client/src/Clients/RsaKeyPairClient.php
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Client\Clients;
|
||||
|
||||
use AlibabaCloud\Client\Exception\ClientException;
|
||||
use AlibabaCloud\Client\Signature\ShaHmac1Signature;
|
||||
use AlibabaCloud\Client\Credentials\RsaKeyPairCredential;
|
||||
|
||||
/**
|
||||
* Use the RSA key pair to complete the authentication (supported only on Japanese site)
|
||||
*
|
||||
* @package AlibabaCloud\Client\Clients
|
||||
*/
|
||||
class RsaKeyPairClient extends Client
|
||||
{
|
||||
|
||||
/**
|
||||
* @param string $publicKeyId
|
||||
* @param string $privateKeyFile
|
||||
*
|
||||
* @throws ClientException
|
||||
*/
|
||||
public function __construct($publicKeyId, $privateKeyFile)
|
||||
{
|
||||
parent::__construct(
|
||||
new RsaKeyPairCredential($publicKeyId, $privateKeyFile),
|
||||
new ShaHmac1Signature()
|
||||
);
|
||||
}
|
||||
}
|
||||
28
vendor/alibabacloud/client/src/Clients/StsClient.php
vendored
Normal file
28
vendor/alibabacloud/client/src/Clients/StsClient.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Client\Clients;
|
||||
|
||||
use AlibabaCloud\Client\Credentials\StsCredential;
|
||||
use AlibabaCloud\Client\Exception\ClientException;
|
||||
use AlibabaCloud\Client\Signature\ShaHmac1Signature;
|
||||
|
||||
/**
|
||||
* Use the STS Token to complete the authentication.
|
||||
*/
|
||||
class StsClient extends Client
|
||||
{
|
||||
/**
|
||||
* @param string $accessKeyId Access key ID
|
||||
* @param string $accessKeySecret Access Key Secret
|
||||
* @param string $securityToken Security Token
|
||||
*
|
||||
* @throws ClientException
|
||||
*/
|
||||
public function __construct($accessKeyId, $accessKeySecret, $securityToken = '')
|
||||
{
|
||||
parent::__construct(
|
||||
new StsCredential($accessKeyId, $accessKeySecret, $securityToken),
|
||||
new ShaHmac1Signature()
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user