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