AWS 文档 SDK 示例
将 UpdateCertificateOptions 与 AWS SDK 或 CLI 配合使用
以下代码示例演示如何使用 UpdateCertificateOptions。
- C++
-
- SDK for C++
-
注意
查看 GitHub,了解更多信息。在 AWS 代码示例存储库
中查找完整示例,了解如何进行设置和运行。 //! 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; } }-
有关 API 详细信息,请参阅《适用于 C++ 的 AWS SDK API Reference》中的 UpdateCertificateOptions。
-
- CLI
-
- AWS CLI
-
更新证书选项
以下
update-certificate-options命令选择退出证书透明度日志:aws acm update-certificate-options --certificate-arnarn:aws:acm:region:account:certificate/12345678-1234-1234-1234-123456789012--optionsCertificateTransparencyLoggingPreference=DISABLED-
有关 API 详细信息,请参阅《AWS CLI 命令参考》中的 UpdateCertificateOptions
。
-
ResendValidationEmail
API Gateway