AWS 文檔 AWS SDK示例 GitHub 回購中有更多SDK示例
本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
搭ResendValidationEmail
配 AWS SDK或使用 CLI
下列程式碼範例會示範如何使用ResendValidationEmail
。
動作範例是大型程式的程式碼摘錄,必須在內容中執行。您可以在下列程式碼範例的內容中看到此動作:
- C++
-
- SDK對於 C ++
-
注意
還有更多關於 GitHub。尋找完整範例,並了解如何在 AWS 程式碼範例儲存庫
中設定和執行。 //! Resend the email that requests domain ownership validation. /*! \param certificateArn: The Amazon Resource Name (ARN) of a certificate. \param domainName: A fully qualified domain name. \param validationDomain: The base validation domain that will act as the suffix of the email addresses. \param clientConfiguration: AWS client configuration. \return bool: Function succeeded. */ bool AwsDoc::ACM::resendValidationEmail(const Aws::String &certificateArn, const Aws::String &domainName, const Aws::String &validationDomain, const Aws::Client::ClientConfiguration &clientConfiguration) { Aws::ACM::ACMClient acmClient(clientConfiguration); Aws::ACM::Model::ResendValidationEmailRequest request; request.WithCertificateArn(certificateArn) .WithDomain(domainName) .WithValidationDomain(validationDomain); Aws::ACM::Model::ResendValidationEmailOutcome outcome = acmClient.ResendValidationEmail(request); if (!outcome.IsSuccess()) { std::cerr << "ResendValidationEmail error: " << outcome.GetError().GetMessage() << std::endl; return false; } else { std::cout << "Success: The validation email has been resent." << std::endl; return true; } }
-
如需詳API細資訊,請參閱AWS SDK for C++ API參考ResendValidationEmail中的。
-
- CLI
-
- AWS CLI
-
若要重新傳送憑證要求的驗ACM證電子郵件
下列
resend-validation-email
命令告訴 Amazon 憑證授權單位將驗證電子郵件傳送到適當的地址:aws acm resend-validation-email --certificate-arn
arn:aws:acm:region:account:certificate/12345678-1234-1234-1234-123456789012
--domainwww.example.com
--validation-domainexample.com
-
如需詳API細資訊,請參閱AWS CLI 指令參考ResendValidationEmail
中的。
-
- PowerShell
-
- 適用的工具 PowerShell
-
範例 1:要求傳送驗證「www.example.com」網域擁有權的電子郵件。如果您的命令介面 $ 設定ConfirmPreference 為「中」或更低,指令程式會在繼續執行之前提示確認。加入-Force 開關以抑制確認提示。
$params = @{ CertificateArn="arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012" Domain="www.example.com" ValidationDomain="example.com" } Send-ACMValidationEmail @params
-
如需詳API細資訊,請參閱AWS Tools for PowerShell 指令程ResendValidationEmail式參考中的。
-
- Python
-
- SDK對於 Python(肉毒桿菌 3)
-
注意
還有更多關於 GitHub。尋找完整範例,並了解如何在 AWS 程式碼範例儲存庫
中設定和執行。 class AcmCertificate: """ Encapsulates ACM functions. """ def __init__(self, acm_client): """ :param acm_client: A Boto3 ACM client. """ self.acm_client = acm_client def resend_validation_email(self, certificate_arn, domain, validation_domain): """ Request that validation email is sent again, for a certificate that was previously requested with email validation. :param certificate_arn: The ARN of the certificate. :param domain: The primary domain of the certificate. :param validation_domain: Alternate domain to use for determining email addresses to use for validation. """ try: self.acm_client.resend_validation_email( CertificateArn=certificate_arn, Domain=domain, ValidationDomain=validation_domain, ) logger.info( "Validation email resent to validation domain %s.", validation_domain ) except ClientError: logger.exception( "Couldn't resend validation email to %s.", validation_domain ) raise
-
如需詳API細資訊,請參閱ResendValidationEmail中AWS SDK的〈〉以取得 Python (Boto3) API 參考資料。
-
RequestCertificate
UpdateCertificateOptions