AWS 文档 SDK 示例
将 ResendValidationEmail 与 AWS SDK 或 CLI 配合使用
以下代码示例演示如何使用 ResendValidationEmail。
操作示例是大型程序的代码摘录,必须在上下文中运行。在以下代码示例中,您可以查看此操作的上下文:
- C++
-
- SDK for 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 详细信息,请参阅《适用于 C++ 的 AWS SDK API Reference》中的 ResendValidationEmail。
-
- CLI
-
- AWS CLI
-
重新发送 ACM 证书请求的验证电子邮件
以下
resend-validation-email命令指示 Amazon 证书颁发机构向相应的地址发送验证电子邮件:aws acm resend-validation-email --certificate-arnarn:aws:acm:region:account:certificate/12345678-1234-1234-1234-123456789012--domainwww.example.com--validation-domainexample.com-
有关 API 详细信息,请参阅《AWS CLI 命令参考》中的 ResendValidationEmail
。
-
- PowerShell
-
- Tools for PowerShell V4
-
示例 1:请求发送用于验证“www.example.com”的域所有权的电子邮件。如果 Shell 的 $ConfirmPreference 设置为“Medium”或更低,则 cmdlet 将在继续操作之前提示您进行确认。添加 -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 Cmdlet Reference (V4)》中的 ResendValidationEmail。
-
- Tools for PowerShell V5
-
示例 1:请求发送用于验证“www.example.com”的域所有权的电子邮件。如果 Shell 的 $ConfirmPreference 设置为“Medium”或更低,则 cmdlet 将在继续操作之前提示您进行确认。添加 -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 Cmdlet Reference (V5)》中的 ResendValidationEmail。
-
- Python
-
- 适用于 Python 的 SDK (Boto3)
-
注意
查看 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 详细信息,请参阅《AWS SDK for Python (Boto3) API Reference》中的 ResendValidationEmail。
-