搭UpdateCertificateOptions配 AWS SDK或使用 CLI - AWS SDK 程式碼範例

AWS 文檔 AWS SDK示例 GitHub 回購中有更多SDK示例

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

UpdateCertificateOptions配 AWS SDK或使用 CLI

下列程式碼範例會示範如何使用UpdateCertificateOptions

C++
SDK對於 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; } }
CLI
AWS CLI

更新憑證選項

下列update-certificate-options命令選擇退出憑證透明度記錄:

aws acm update-certificate-options --certificate-arn arn:aws:acm:region:account:certificate/12345678-1234-1234-1234-123456789012 --options CertificateTransparencyLoggingPreference=DISABLED