文件 AWS SDK AWS 範例 SDK 儲存庫中有更多可用的
本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
DescribeAccountAttributes
搭配 a AWS SDK 或 CLI 使用
下列程式碼範例示範如何使用 DescribeAccountAttributes
。
- CLI
-
- AWS CLI
-
描述帳戶屬性
下列
describe-account-attributes
範例會擷取目前 AWS 帳戶的屬性。aws rds describe-account-attributes
輸出:
{ "AccountQuotas": [ { "Max": 40, "Used": 4, "AccountQuotaName": "DBInstances" }, { "Max": 40, "Used": 0, "AccountQuotaName": "ReservedDBInstances" }, { "Max": 100000, "Used": 40, "AccountQuotaName": "AllocatedStorage" }, { "Max": 25, "Used": 0, "AccountQuotaName": "DBSecurityGroups" }, { "Max": 20, "Used": 0, "AccountQuotaName": "AuthorizationsPerDBSecurityGroup" }, { "Max": 50, "Used": 1, "AccountQuotaName": "DBParameterGroups" }, { "Max": 100, "Used": 3, "AccountQuotaName": "ManualSnapshots" }, { "Max": 20, "Used": 0, "AccountQuotaName": "EventSubscriptions" }, { "Max": 50, "Used": 1, "AccountQuotaName": "DBSubnetGroups" }, { "Max": 20, "Used": 1, "AccountQuotaName": "OptionGroups" }, { "Max": 20, "Used": 6, "AccountQuotaName": "SubnetsPerDBSubnetGroup" }, { "Max": 5, "Used": 0, "AccountQuotaName": "ReadReplicasPerMaster" }, { "Max": 40, "Used": 1, "AccountQuotaName": "DBClusters" }, { "Max": 50, "Used": 0, "AccountQuotaName": "DBClusterParameterGroups" }, { "Max": 5, "Used": 0, "AccountQuotaName": "DBClusterRoles" } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 DescribeAccountAttributes
。
-
- Java
-
- Java 2.x 的 SDK
-
注意
還有更多 on GitHub。尋找完整範例,並了解如何在 AWS 程式碼範例儲存庫
中設定和執行。 import software.amazon.awssdk.regions.Region; import software.amazon.awssdk.services.rds.RdsClient; import software.amazon.awssdk.services.rds.model.AccountQuota; import software.amazon.awssdk.services.rds.model.RdsException; import software.amazon.awssdk.services.rds.model.DescribeAccountAttributesResponse; import java.util.List; /** * Before running this Java V2 code example, set up your development * environment, including your credentials. * * For more information, see the following documentation topic: * * https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/get-started.html */ public class DescribeAccountAttributes { public static void main(String[] args) { Region region = Region.US_WEST_2; RdsClient rdsClient = RdsClient.builder() .region(region) .build(); getAccountAttributes(rdsClient); rdsClient.close(); } public static void getAccountAttributes(RdsClient rdsClient) { try { DescribeAccountAttributesResponse response = rdsClient.describeAccountAttributes(); List<AccountQuota> quotasList = response.accountQuotas(); for (AccountQuota quotas : quotasList) { System.out.println("Name is: " + quotas.accountQuotaName()); System.out.println("Max value is " + quotas.max()); } } catch (RdsException e) { System.out.println(e.getLocalizedMessage()); System.exit(1); } } }
-
如需 API 詳細資訊,請參閱 DescribeAccountAttributes AWS SDK for Java 2.x 參考中的 API。
-
- Kotlin
-
- Kotlin 的 SDK
-
注意
還有更多 on GitHub。尋找完整範例,並了解如何在 AWS 程式碼範例儲存庫
中設定和執行。 suspend fun getAccountAttributes() { RdsClient { region = "us-west-2" }.use { rdsClient -> val response = rdsClient.describeAccountAttributes(DescribeAccountAttributesRequest {}) response.accountQuotas?.forEach { quotas -> val response = response.accountQuotas println("Name is: ${quotas.accountQuotaName}") println("Max value is ${quotas.max}") } } }
-
如需 API 詳細資訊,請參閱 DescribeAccountAttributes
AWS for Kotlin SDK 參考中的 API。
-
DeleteDBParameterGroup
DescribeDBEngineVersions