|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace AlibabaCloud\Client\Profile; |
|
4
|
|
|
|
|
5
|
|
|
use AlibabaCloud\Client\AlibabaCloud; |
|
6
|
|
|
use AlibabaCloud\Client\Clients\Client; |
|
7
|
|
|
use AlibabaCloud\Client\Exception\ClientException; |
|
8
|
|
|
|
|
9
|
|
|
/** |
|
10
|
|
|
* Class DefaultProfile |
|
11
|
|
|
* |
|
12
|
|
|
* @package AlibabaCloud\Client\Profile |
|
13
|
|
|
* @codeCoverageIgnore |
|
14
|
|
|
* @deprecated deprecated since version 2.0, Use AlibabaCloud instead. |
|
15
|
|
|
*/ |
|
16
|
|
|
class DefaultProfile |
|
17
|
|
|
{ |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* @param string $regionId |
|
21
|
|
|
* @param string $accessKeyId |
|
22
|
|
|
* @param string $accessKeySecret |
|
23
|
|
|
* |
|
24
|
|
|
* @return Client |
|
25
|
|
|
* @throws ClientException |
|
26
|
|
|
*/ |
|
27
|
|
|
public static function getProfile($regionId, $accessKeyId, $accessKeySecret) |
|
28
|
|
|
{ |
|
29
|
|
|
return AlibabaCloud::accessKeyClient($accessKeyId, $accessKeySecret) |
|
30
|
|
|
->regionId($regionId); |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* @param string $regionId |
|
35
|
|
|
* @param string $accessKeyId |
|
36
|
|
|
* @param string $accessKeySecret |
|
37
|
|
|
* @param string $roleArn |
|
38
|
|
|
* @param string $roleSessionName |
|
39
|
|
|
* |
|
40
|
|
|
* @return Client |
|
41
|
|
|
* @throws ClientException |
|
42
|
|
|
*/ |
|
43
|
|
|
public static function getRamRoleArnProfile($regionId, $accessKeyId, $accessKeySecret, $roleArn, $roleSessionName) |
|
44
|
|
|
{ |
|
45
|
|
|
return AlibabaCloud::ramRoleArnClient($accessKeyId, $accessKeySecret, $roleArn, $roleSessionName) |
|
46
|
|
|
->regionId($regionId); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* @param string $regionId |
|
51
|
|
|
* @param string $roleName |
|
52
|
|
|
* |
|
53
|
|
|
* @return Client |
|
54
|
|
|
* @throws ClientException |
|
55
|
|
|
*/ |
|
56
|
|
|
public static function getEcsRamRoleProfile($regionId, $roleName) |
|
57
|
|
|
{ |
|
58
|
|
|
return AlibabaCloud::ecsRamRoleClient($roleName) |
|
59
|
|
|
->regionId($regionId); |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* @param string $regionId |
|
64
|
|
|
* @param string $bearerToken |
|
65
|
|
|
* |
|
66
|
|
|
* @return Client |
|
67
|
|
|
* @throws ClientException |
|
68
|
|
|
*/ |
|
69
|
|
|
public static function getBearerTokenProfile($regionId, $bearerToken) |
|
70
|
|
|
{ |
|
71
|
|
|
return AlibabaCloud::bearerTokenClient($bearerToken) |
|
72
|
|
|
->regionId($regionId); |
|
73
|
|
|
} |
|
74
|
|
|
} |
|
75
|
|
|
|