|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace AlibabaCloud\Client\Clients; |
|
4
|
|
|
|
|
5
|
|
|
use AlibabaCloud\Client\Request\Request; |
|
6
|
|
|
use AlibabaCloud\Client\Traits\HttpTrait; |
|
7
|
|
|
use AlibabaCloud\Client\Traits\RegionTrait; |
|
8
|
|
|
use AlibabaCloud\Client\Credentials\StsCredential; |
|
9
|
|
|
use AlibabaCloud\Client\Signature\ShaHmac1Signature; |
|
10
|
|
|
use AlibabaCloud\Client\Signature\SignatureInterface; |
|
11
|
|
|
use AlibabaCloud\Client\Signature\ShaHmac256Signature; |
|
12
|
|
|
use AlibabaCloud\Client\Signature\BearerTokenSignature; |
|
13
|
|
|
use AlibabaCloud\Client\Credentials\AccessKeyCredential; |
|
14
|
|
|
use AlibabaCloud\Client\Credentials\CredentialsInterface; |
|
15
|
|
|
use AlibabaCloud\Client\Credentials\EcsRamRoleCredential; |
|
16
|
|
|
use AlibabaCloud\Client\Credentials\RamRoleArnCredential; |
|
17
|
|
|
use AlibabaCloud\Client\Credentials\RsaKeyPairCredential; |
|
18
|
|
|
use AlibabaCloud\Client\Credentials\BearerTokenCredential; |
|
19
|
|
|
use AlibabaCloud\Client\Signature\ShaHmac256WithRsaSignature; |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* Custom Client. |
|
23
|
|
|
* |
|
24
|
|
|
* @package AlibabaCloud\Client\Clients |
|
25
|
|
|
*/ |
|
26
|
|
|
class Client |
|
27
|
|
|
{ |
|
28
|
|
|
use HttpTrait; |
|
29
|
|
|
use RegionTrait; |
|
30
|
|
|
use ManageTrait; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* @var CredentialsInterface|AccessKeyCredential|BearerTokenCredential|StsCredential|EcsRamRoleCredential|RamRoleArnCredential|RsaKeyPairCredential |
|
34
|
|
|
*/ |
|
35
|
|
|
private $credential; |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* @var SignatureInterface |
|
39
|
|
|
*/ |
|
40
|
|
|
private $signature; |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* Self constructor. |
|
44
|
|
|
* |
|
45
|
|
|
* @param CredentialsInterface $credential |
|
46
|
|
|
* @param SignatureInterface $signature |
|
47
|
|
|
*/ |
|
48
|
149 |
|
public function __construct(CredentialsInterface $credential, SignatureInterface $signature) |
|
49
|
|
|
{ |
|
50
|
149 |
|
$this->credential = $credential; |
|
51
|
149 |
|
$this->signature = $signature; |
|
52
|
149 |
|
$this->options['connect_timeout'] = Request::CONNECT_TIMEOUT; |
|
53
|
149 |
|
$this->options['timeout'] = Request::TIMEOUT; |
|
54
|
149 |
|
$this->options['verify'] = false; |
|
55
|
149 |
|
} |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* @return AccessKeyCredential|BearerTokenCredential|CredentialsInterface|EcsRamRoleCredential|RamRoleArnCredential|RsaKeyPairCredential|StsCredential |
|
59
|
|
|
*/ |
|
60
|
64 |
|
public function getCredential() |
|
61
|
|
|
{ |
|
62
|
64 |
|
return $this->credential; |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* @return SignatureInterface|BearerTokenSignature|ShaHmac1Signature|ShaHmac256Signature|ShaHmac256WithRsaSignature |
|
67
|
|
|
*/ |
|
68
|
92 |
|
public function getSignature() |
|
69
|
|
|
{ |
|
70
|
92 |
|
return $this->signature; |
|
71
|
|
|
} |
|
72
|
|
|
} |
|
73
|
|
|
|