Ada lebih banyak AWS SDK contoh yang tersedia di GitHub repo SDKContoh AWS Dokumen
Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.
Gunakan RenewCertificate
dengan AWS SDK
Contoh kode berikut menunjukkan cara menggunakanRenewCertificate
.
- C++
-
- SDKuntuk C ++
-
catatan
Ada lebih banyak tentang GitHub. Temukan contoh lengkapnya dan pelajari cara pengaturan dan menjalankannya di Repositori Contoh Kode AWS
. //! Renew an AWS Certificate Manager (ACM) certificate. /*! \param certificateArn: The Amazon Resource Name (ARN) of a certificate. \param clientConfiguration: AWS client configuration. \return bool: Function succeeded. */ bool AwsDoc::ACM::renewCertificate(const Aws::String &certificateArn, const Aws::Client::ClientConfiguration &clientConfiguration) { Aws::ACM::ACMClient acmClient(clientConfiguration); Aws::ACM::Model::RenewCertificateRequest request; request.SetCertificateArn(certificateArn); Aws::ACM::Model::RenewCertificateOutcome outcome = acmClient.RenewCertificate(request); if (!outcome.IsSuccess()) { std::cerr << "Error: RenewCertificate: " << outcome.GetError().GetMessage() << std::endl; return false; } else { std::cout << "Success: Renewed certificate with ARN '" << certificateArn << "'." << std::endl; return true; } }
-
Untuk API detailnya, lihat RenewCertificatedi AWS SDK for C++ APIReferensi.
-
- Java
-
- SDKuntuk Java 2.x
-
catatan
Ada lebih banyak tentang GitHub. Temukan contoh lengkapnya dan pelajari cara pengaturan dan menjalankannya di Repositori Contoh Kode AWS
. /** * Before running this Java V2 code example, set up your development * environment, including your credentials. * <p> * For more information, see the following documentation topic: * <p> * https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/get-started.html */ public class RenewCert { public static void main(String[] args) { final String usage = """ Usage: <certArn> Where: certArn - the ARN of the certificate. """; if (args.length != 1) { System.out.println(usage); return; } String certArn = args[0]; renewCertificate(certArn); } /** * Renews an existing SSL/TLS certificate in AWS Certificate Manager (ACM). * * @param certArn The Amazon Resource Name (ARN) of the certificate to be renewed. * @throws AcmException If there is an error renewing the certificate. */ public static void renewCertificate(String certArn) { AcmClient acmClient = AcmClient.create(); RenewCertificateRequest certificateRequest = RenewCertificateRequest.builder() .certificateArn(certArn) .build(); try { acmClient.renewCertificate(certificateRequest); System.out.println("The certificate was renewed"); } catch(AcmException e){ System.out.println(e.getMessage()); } } }
-
Untuk API detailnya, lihat RenewCertificatedi AWS SDK for Java 2.x APIReferensi.
-