There are more AWS SDK examples available in the AWS Doc SDK Examples
Use UpdateCertificateOptions
with an AWS SDK or CLI
The following code examples show how to use UpdateCertificateOptions
.
- 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
. //! Update an AWS Certificate Manager (ACM) certificate option. /*! \param certificateArn: The Amazon Resource Name (ARN) of a certificate. \param loggingEnabled: Boolean specifying logging enabled. \param clientConfiguration: AWS client configuration. \return bool: Function succeeded. */ bool AwsDoc::ACM::updateCertificateOption(const Aws::String &certificateArn, bool loggingEnabled, const Aws::Client::ClientConfiguration &clientConfiguration) { Aws::ACM::ACMClient acmClient(clientConfiguration); Aws::ACM::Model::UpdateCertificateOptionsRequest request; request.SetCertificateArn(certificateArn); Aws::ACM::Model::CertificateOptions options; if (loggingEnabled) { options.SetCertificateTransparencyLoggingPreference( Aws::ACM::Model::CertificateTransparencyLoggingPreference::ENABLED); } else { options.SetCertificateTransparencyLoggingPreference( Aws::ACM::Model::CertificateTransparencyLoggingPreference::DISABLED); } request.SetOptions(options); Aws::ACM::Model::UpdateCertificateOptionsOutcome outcome = acmClient.UpdateCertificateOptions(request); if (!outcome.IsSuccess()) { std::cerr << "UpdateCertificateOption error: " << outcome.GetError().GetMessage() << std::endl; return false; } else { std::cout << "Success: The option '" << (loggingEnabled ? "enabled" : "disabled") << "' has been set for " "the certificate with the ARN '" << certificateArn << "'." << std::endl; return true; } }
-
For API details, see UpdateCertificateOptions in AWS SDK for C++ API Reference.
-
- CLI
-
- AWS CLI
-
To update the certificate options
The following
update-certificate-options
command opts out of certificate transparency logging:aws acm update-certificate-options --certificate-arn
arn:aws:acm:region:account:certificate/12345678-1234-1234-1234-123456789012
--optionsCertificateTransparencyLoggingPreference=DISABLED
-
For API details, see UpdateCertificateOptions
in AWS CLI Command Reference.
-