Menu
AWS Certificate Manager
User Guide (Version 1.0)

Resending Validation Email

The following example shows you how to use the ResendValidationEmail function.

Copy
package com.amazonaws.samples; import com.amazonaws.services.certificatemanager.AWSCertificateManagerClientBuilder; import com.amazonaws.services.certificatemanager.AWSCertificateManager; import com.amazonaws.services.certificatemanager.model.ResendValidationEmailRequest; import com.amazonaws.services.certificatemanager.model.ResendValidationEmailResult; import com.amazonaws.services.certificatemanager.model.InvalidDomainValidationOptionsException; import com.amazonaws.services.certificatemanager.model.ResourceNotFoundException; import com.amazonaws.services.certificatemanager.model.InvalidStateException; import com.amazonaws.services.certificatemanager.model.InvalidArnException; import com.amazonaws.AmazonClientException; import com.amazonaws.auth.profile.ProfileCredentialsProvider; import com.amazonaws.auth.AWSStaticCredentialsProvider; import com.amazonaws.auth.AWSCredentials; import com.amazonaws.regions.Regions; /** * This sample demonstrates how to use the ResendValidationEmail function in the AWS Certificate * Manager service. * * Input parameters: * CertificateArn - Amazon Resource Name (ARN) of the certificate request. * Domain - FQDN in the certificate request. * ValidationDomain - The base validation domain that is used to send email. * */ public class AWSCertificateManagerExample { public static void main(String[] args) { // Retrieve your credentials from the C:\Users\name\.aws\credentials file in Windows // or the ~/.aws/credentials file in Linux. AWSCredentials credentials = null; try { credentials = new ProfileCredentialsProvider().getCredentials(); } catch (Exception ex) { throw new AmazonClientException("Cannot load your credentials from file.", ex); } // Create a client. AWSCertificateManager client = AWSCertificateManagerClientBuilder.standard() .withRegion(Regions.US_EAST_1) .withCredentials(new AWSStaticCredentialsProvider(credentials)) .build(); // Create a request object and set the input parameters. ResendValidationEmailRequest req = new ResendValidationEmailRequest(); req.setCertificateArn("arn:aws:acm:region:account:certificate/12345678-1234-1234-1234-123456789012"); req.setDomain("gregpe.io"); req.setValidationDomain("gregpe.io"); // Create a result object. ResendValidationEmailResult result = null; try { result = client.resendValidationEmail(req); } catch(ResourceNotFoundException ex) { throw ex; } catch (InvalidStateException ex) { throw ex; } catch (InvalidArnException ex) { throw ex; } catch (InvalidDomainValidationOptionsException ex) { throw ex; } // Display the result. System.out.println(result.toString()); } }

The preceding sample resends your validation email and displays an empty set.

Copy
{}