AWSDocAWS SDKGitHub サンプルリポジトリには、さらに多くの SDK サンプルがあります
翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。
AWS SDK を使用して Aurora DB クラスターパラメータグループを削除する
次のコードサンプルは、Aurora DB クラスターパラメータグループを削除する方法を示しています。
- .NET
-
- AWS SDK for .NET
-
注記
他にもありますGitHub。用例一覧を検索し、AWS コード例リポジトリ
での設定と実行の方法を確認してください。 /// <summary> /// Delete a particular parameter group by name. /// </summary> /// <param name="groupName">The name of the parameter group.</param> /// <returns>True if successful.</returns> public async Task<bool> DeleteClusterParameterGroupByNameAsync(string groupName) { var request = new DeleteDBClusterParameterGroupRequest { DBClusterParameterGroupName = groupName, }; var response = await _amazonRDS.DeleteDBClusterParameterGroupAsync(request); return response.HttpStatusCode == System.Net.HttpStatusCode.OK; }
-
API の詳細については、AWS SDK for .NETAPIClusterParameterGroup リファレンスの DeletedB を参照してください。
-
- C++
-
- SDK for C++
-
注記
他にもありますGitHub。用例一覧を検索し、AWS コード例リポジトリ
での設定と実行の方法を確認してください。 Aws::Client::ClientConfiguration clientConfig; // Optional: Set to the AWS Region (overrides config file). // clientConfig.region = "us-east-1"; Aws::RDS::RDSClient client(clientConfig); Aws::RDS::Model::DeleteDBClusterParameterGroupRequest request; request.SetDBClusterParameterGroupName(parameterGroupName); Aws::RDS::Model::DeleteDBClusterParameterGroupOutcome outcome = client.DeleteDBClusterParameterGroup(request); if (outcome.IsSuccess()) { std::cout << "The DB parameter group was successfully deleted." << std::endl; } else { std::cerr << "Error with Aurora::DeleteDBClusterParameterGroup. " << outcome.GetError().GetMessage() << std::endl; result = false; }
-
API の詳細については、AWS SDK for C++APIClusterParameterGroup リファレンスの DeletedB を参照してください。
-
- Java
-
- SDK for Java 2.x
-
注記
他にもありますGitHub。用例一覧を検索し、AWS コード例リポジトリ
での設定と実行の方法を確認してください。 public static void deleteDBClusterGroup( RdsClient rdsClient, String dbClusterGroupName, String clusterDBARN) throws InterruptedException { try { boolean isDataDel = false; boolean didFind; String instanceARN ; // Make sure that the database has been deleted. while (!isDataDel) { DescribeDbInstancesResponse response = rdsClient.describeDBInstances(); List<DBInstance> instanceList = response.dbInstances(); int listSize = instanceList.size(); isDataDel = false ; didFind = false; int index = 1; for (DBInstance instance: instanceList) { instanceARN = instance.dbInstanceArn(); if (instanceARN.compareTo(clusterDBARN) == 0) { System.out.println(clusterDBARN + " still exists"); didFind = true ; } if ((index == listSize) && (!didFind)) { // Went through the entire list and did not find the database ARN. isDataDel = true; } Thread.sleep(sleepTime * 1000); index ++; } } DeleteDbClusterParameterGroupRequest clusterParameterGroupRequest = DeleteDbClusterParameterGroupRequest.builder() .dbClusterParameterGroupName(dbClusterGroupName) .build(); rdsClient.deleteDBClusterParameterGroup(clusterParameterGroupRequest); System.out.println(dbClusterGroupName +" was deleted."); } catch (RdsException e) { System.out.println(e.getLocalizedMessage()); System.exit(1); } }
-
API の詳細については、AWS SDK for Java 2.xAPIClusterParameterGroup リファレンスの DeletedB を参照してください。
-
- Kotlin
-
- SDK for Kotlin
-
注記
これはプレビューリリースの機能に関するプレリリースドキュメントです。このドキュメントは変更される可能性があります。
注記
他にもありますGitHub。用例一覧を検索し、AWS コード例リポジトリ
での設定と実行の方法を確認してください。 @Throws(InterruptedException::class) suspend fun deleteDBClusterGroup(dbClusterGroupName: String, clusterDBARN: String) { var isDataDel = false var didFind: Boolean var instanceARN: String RdsClient { region = "us-west-2" }.use { rdsClient -> // Make sure that the database has been deleted. while (!isDataDel) { val response = rdsClient.describeDbInstances() val instanceList = response.dbInstances val listSize = instanceList?.size isDataDel = false didFind = false var index = 1 if (instanceList != null) { for (instance in instanceList) { instanceARN = instance.dbInstanceArn.toString() if (instanceARN.compareTo(clusterDBARN) == 0) { println("$clusterDBARN still exists") didFind = true } if (index == listSize && !didFind) { // Went through the entire list and did not find the database ARN. isDataDel = true } delay(slTime * 1000) index++ } } } val clusterParameterGroupRequest = DeleteDbClusterParameterGroupRequest { dbClusterParameterGroupName = dbClusterGroupName } rdsClient.deleteDbClusterParameterGroup(clusterParameterGroupRequest) println("$dbClusterGroupName was deleted.") } }
-
API の詳細については、「AWSSDK forClusterParameterGroup
Kotlin API リファレンス」を参照してください。
-
- Python
-
- SDK for Python (Boto3)
-
注記
他にもありますGitHub。用例一覧を検索し、AWS コード例リポジトリ
での設定と実行の方法を確認してください。 class AuroraWrapper: """Encapsulates Aurora DB cluster actions.""" def __init__(self, rds_client): """ :param rds_client: A Boto3 Amazon Relational Database Service (Amazon RDS) client. """ self.rds_client = rds_client @classmethod def from_client(cls): """ Instantiates this class from a Boto3 client. """ rds_client = boto3.client('rds') return cls(rds_client) def delete_parameter_group(self, parameter_group_name): """ Deletes a DB cluster parameter group. :param parameter_group_name: The name of the parameter group to delete. :return: Data about the parameter group. """ try: response = self.rds_client.delete_db_cluster_parameter_group( DBClusterParameterGroupName=parameter_group_name) except ClientError as err: logger.error( "Couldn't delete parameter group %s. Here's why: %s: %s", parameter_group_name, err.response['Error']['Code'], err.response['Error']['Message']) raise else: return response
-
API の詳細については、「AWSSDK for Python for Python (ClusterParameterGroupBoto3) API リファレンス」を参照してください。
-