There are more AWS SDK examples available in the AWS Doc SDK Examples
Use RenewCertificate
with an AWS SDK
The following code examples show how to use RenewCertificate
.
- C++
-
- SDK for C++
-
Note
There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository
. //! 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; } }
-
For API details, see RenewCertificate in AWS SDK for C++ API Reference.
-
- Java
-
- SDK for Java 2.x
-
Note
There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository
. /** * 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()); } } }
-
For API details, see RenewCertificate in AWS SDK for Java 2.x API Reference.
-