-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #67 from AlibabaCloudLandingZone/solution-ack-sts-…
…token/0.0.3 solution-ack-sts-token/0.0.3
- Loading branch information
Showing
7 changed files
with
44 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 5 additions & 8 deletions
13
solution/solution-ack-sts-token/code-example/python/sdk2_0/credentials_default_sample.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,20 @@ | ||
from alibabacloud_vpc20160428.client import Client as Vpc20160428Client | ||
from alibabacloud_sts20150401.client import Client as Sts20150401Client | ||
from alibabacloud_tea_openapi import models as open_api_models | ||
from alibabacloud_vpc20160428 import models as vpc_20160428_models | ||
from alibabacloud_tea_util import models as util_models | ||
from alibabacloud_credentials.client import Client as CredentialsClient | ||
|
||
# 使用默认凭据链 | ||
cred = CredentialsClient() | ||
|
||
config = open_api_models.Config() | ||
config.endpoint = f'vpc-vpc.cn-hangzhou.aliyuncs.com' | ||
config.endpoint = f'sts.cn-hangzhou.aliyuncs.com' | ||
config.credential = cred | ||
vpcClient = Vpc20160428Client(config) | ||
|
||
describeVpcsRequest = vpc_20160428_models.DescribeVpcsRequest(region_id='cn-hangzhou') | ||
stsClient = Sts20150401Client(config) | ||
|
||
try: | ||
runtime = util_models.RuntimeOptions() | ||
# 复制代码运行请自行打印 API 的返回值 | ||
describeVpcsResponse = vpcClient.describe_vpcs(describeVpcsRequest, runtime) | ||
print(describeVpcsResponse.body.vpcs.vpc) | ||
response = stsClient.get_caller_identity_with_options(runtime) | ||
print(response) | ||
except Exception as error: | ||
print(error) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters