Search in sources :

Example 1 with CreateHostedZoneRequest

use of software.amazon.awssdk.services.route53.model.CreateHostedZoneRequest in project aws-doc-sdk-examples by awsdocs.

the class CreateHostedZone method createZone.

// snippet-start:[route53.java2.create_hosted_zone.main]
public static String createZone(Route53Client route53Client, String domainName) {
    try {
        // You must use a unique CallerReference string every time you submit a CreateHostedZone request
        String callerReference = java.util.UUID.randomUUID().toString();
        CreateHostedZoneRequest zoneRequest = CreateHostedZoneRequest.builder().callerReference(callerReference).name(domainName).build();
        // Create the Hosted Zone
        CreateHostedZoneResponse zoneResponse = route53Client.createHostedZone(zoneRequest);
        return zoneResponse.hostedZone().id();
    } catch (Route53Exception e) {
        System.err.println(e.getMessage());
        System.exit(1);
    }
    return "";
}
Also used : CreateHostedZoneResponse(software.amazon.awssdk.services.route53.model.CreateHostedZoneResponse) Route53Exception(software.amazon.awssdk.services.route53.model.Route53Exception) CreateHostedZoneRequest(software.amazon.awssdk.services.route53.model.CreateHostedZoneRequest)

Aggregations

CreateHostedZoneRequest (software.amazon.awssdk.services.route53.model.CreateHostedZoneRequest)1 CreateHostedZoneResponse (software.amazon.awssdk.services.route53.model.CreateHostedZoneResponse)1 Route53Exception (software.amazon.awssdk.services.route53.model.Route53Exception)1