Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.
Gunakan DescribeDBClusterParameterGroups
dengan AWS SDK
Contoh kode berikut menunjukkan cara menggunakanDescribeDBClusterParameterGroups
.
Contoh tindakan adalah kutipan kode dari program yang lebih besar dan harus dijalankan dalam konteks. Anda dapat melihat tindakan ini dalam konteks dalam contoh kode berikut:
- .NET
-
- AWS SDK for .NET
-
catatan
Ada lebih banyak tentang GitHub. Temukan contoh lengkapnya dan pelajari cara pengaturan dan menjalankannya di Repositori Contoh Kode AWS
. /// <summary> /// Get the description of a DB cluster parameter group by name. /// </summary> /// <param name="name">The name of the DB parameter group to describe.</param> /// <returns>The parameter group description.</returns> public async Task<DBClusterParameterGroup?> DescribeCustomDBClusterParameterGroupAsync(string name) { var response = await _amazonRDS.DescribeDBClusterParameterGroupsAsync( new DescribeDBClusterParameterGroupsRequest() { DBClusterParameterGroupName = name }); return response.DBClusterParameterGroups.FirstOrDefault(); }
-
Untuk detail API, lihat Menjelaskan DBCluster ParameterGroups di Referensi AWS SDK for .NET API.
-
- C++
-
- SDK untuk C++
-
catatan
Ada lebih banyak tentang GitHub. Temukan contoh lengkapnya dan pelajari cara pengaturan dan menjalankannya di Repositori Contoh Kode 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::DescribeDBClusterParameterGroupsRequest request; request.SetDBClusterParameterGroupName(CLUSTER_PARAMETER_GROUP_NAME); Aws::RDS::Model::DescribeDBClusterParameterGroupsOutcome outcome = client.DescribeDBClusterParameterGroups(request); if (outcome.IsSuccess()) { std::cout << "DB cluster parameter group named '" << CLUSTER_PARAMETER_GROUP_NAME << "' already exists." << std::endl; dbParameterGroupFamily = outcome.GetResult().GetDBClusterParameterGroups()[0].GetDBParameterGroupFamily(); } else { std::cerr << "Error with Aurora::DescribeDBClusterParameterGroups. " << outcome.GetError().GetMessage() << std::endl; return false; }
-
Untuk detail API, lihat Menjelaskan DBCluster ParameterGroups di Referensi AWS SDK for C++ API.
-
- Go
-
- SDK untuk Go V2
-
catatan
Ada lebih banyak tentang GitHub. Temukan contoh lengkapnya dan pelajari cara pengaturan dan menjalankannya di Repositori Contoh Kode AWS
. import ( "context" "errors" "log" "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/service/rds" "github.com/aws/aws-sdk-go-v2/service/rds/types" ) type DbClusters struct { AuroraClient *rds.Client } // GetParameterGroup gets a DB cluster parameter group by name. func (clusters *DbClusters) GetParameterGroup(ctx context.Context, parameterGroupName string) ( *types.DBClusterParameterGroup, error) { output, err := clusters.AuroraClient.DescribeDBClusterParameterGroups( ctx, &rds.DescribeDBClusterParameterGroupsInput{ DBClusterParameterGroupName: aws.String(parameterGroupName), }) if err != nil { var notFoundError *types.DBParameterGroupNotFoundFault if errors.As(err, ¬FoundError) { log.Printf("Parameter group %v does not exist.\n", parameterGroupName) err = nil } else { log.Printf("Error getting parameter group %v: %v\n", parameterGroupName, err) } return nil, err } else { return &output.DBClusterParameterGroups[0], err } }
-
Untuk detail API, lihat Menjelaskan DBCluster ParameterGroups
di Referensi AWS SDK untuk Go API.
-
- Java
-
- SDK untuk Java 2.x
-
catatan
Ada lebih banyak tentang GitHub. Temukan contoh lengkapnya dan pelajari cara pengaturan dan menjalankannya di Repositori Contoh Kode AWS
. public static void describeDbClusterParameterGroups(RdsClient rdsClient, String dbClusterGroupName) { try { DescribeDbClusterParameterGroupsRequest groupsRequest = DescribeDbClusterParameterGroupsRequest.builder() .dbClusterParameterGroupName(dbClusterGroupName) .maxRecords(20) .build(); List<DBClusterParameterGroup> groups = rdsClient.describeDBClusterParameterGroups(groupsRequest) .dbClusterParameterGroups(); for (DBClusterParameterGroup group : groups) { System.out.println("The group name is " + group.dbClusterParameterGroupName()); System.out.println("The group ARN is " + group.dbClusterParameterGroupArn()); } } catch (RdsException e) { System.out.println(e.getLocalizedMessage()); System.exit(1); } }
-
Untuk detail API, lihat Menjelaskan DBCluster ParameterGroups di Referensi AWS SDK for Java 2.x API.
-
- Kotlin
-
- SDK untuk Kotlin
-
catatan
Ada lebih banyak tentang GitHub. Temukan contoh lengkapnya dan pelajari cara pengaturan dan menjalankannya di Repositori Contoh Kode AWS
. suspend fun describeDbClusterParameterGroups(dbClusterGroupName: String?) { val groupsRequest = DescribeDbClusterParameterGroupsRequest { dbClusterParameterGroupName = dbClusterGroupName maxRecords = 20 } RdsClient { region = "us-west-2" }.use { rdsClient -> val response = rdsClient.describeDbClusterParameterGroups(groupsRequest) response.dbClusterParameterGroups?.forEach { group -> println("The group name is ${group.dbClusterParameterGroupName}") println("The group ARN is ${group.dbClusterParameterGroupArn}") } } }
-
Untuk detail API, lihat Menjelaskan DBCluster ParameterGroups
di AWS SDK untuk referensi API Kotlin.
-
- Python
-
- SDK untuk Python (Boto3)
-
catatan
Ada lebih banyak tentang GitHub. Temukan contoh lengkapnya dan pelajari cara pengaturan dan menjalankannya di Repositori Contoh Kode 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 get_parameter_group(self, parameter_group_name): """ Gets a DB cluster parameter group. :param parameter_group_name: The name of the parameter group to retrieve. :return: The requested parameter group. """ try: response = self.rds_client.describe_db_cluster_parameter_groups( DBClusterParameterGroupName=parameter_group_name ) parameter_group = response["DBClusterParameterGroups"][0] except ClientError as err: if err.response["Error"]["Code"] == "DBParameterGroupNotFound": logger.info("Parameter group %s does not exist.", parameter_group_name) else: logger.error( "Couldn't get parameter group %s. Here's why: %s: %s", parameter_group_name, err.response["Error"]["Code"], err.response["Error"]["Message"], ) raise else: return parameter_group
-
Untuk detail API, lihat Menjelaskan DBCluster ParameterGroups dalam AWS SDK for Python (Boto3) Referensi API.
-
Untuk daftar lengkap panduan pengembang AWS SDK dan contoh kode, lihatMenggunakan layanan ini dengan AWS SDK. Topik ini juga mencakup informasi tentang memulai dan detail tentang versi SDK sebelumnya.