use of software.amazon.awssdk.services.route53.Route53Client in project aws-doc-sdk-examples by awsdocs.
the class DeleteHostedZone method delHostedZone.
// snippet-start:[route53.java2.delete_hosted_zone.main]
public static void delHostedZone(Route53Client route53Client, String hostedZoneId) {
try {
DeleteHostedZoneRequest deleteHostedZoneRequestRequest = DeleteHostedZoneRequest.builder().id(hostedZoneId).build();
route53Client.deleteHostedZone(deleteHostedZoneRequestRequest);
System.out.println("The hosted zone was deleted");
} catch (Route53Exception e) {
System.err.println(e.getMessage());
System.exit(1);
}
}
use of software.amazon.awssdk.services.route53.Route53Client in project aws-doc-sdk-examples by awsdocs.
the class DeleteHostedZone method main.
public static void main(String[] args) {
final String USAGE = "\n" + "Usage:\n" + " <hostedZoneId> \n\n" + "Where:\n" + " hostedZoneId - the hosted zone id. \n";
if (args.length < 1) {
System.out.println(USAGE);
System.exit(1);
}
String hostedZoneId = args[0];
Region region = Region.AWS_GLOBAL;
Route53Client route53Client = Route53Client.builder().region(region).build();
delHostedZone(route53Client, hostedZoneId);
route53Client.close();
}
use of software.amazon.awssdk.services.route53.Route53Client in project aws-doc-sdk-examples by awsdocs.
the class ListHealthChecks method listAllHealthChecks.
// snippet-start:[route53.java2.list_health_checks.main]
public static void listAllHealthChecks(Route53Client route53Client) {
try {
ListHealthChecksResponse checksResponse = route53Client.listHealthChecks();
List<HealthCheck> checklist = checksResponse.healthChecks();
for (HealthCheck check : checklist) {
System.out.println("The health check id is: " + check.id());
System.out.println("The health threshold is: " + check.healthCheckConfig().healthThreshold());
System.out.println("The type is: " + check.healthCheckConfig().typeAsString());
}
} catch (Route53Exception e) {
System.err.println(e.getMessage());
System.exit(1);
}
}
use of software.amazon.awssdk.services.route53.Route53Client in project aws-doc-sdk-examples by awsdocs.
the class ListResourceRecordSets method listResourceRecord.
// snippet-start:[route.java2.list_records.main]
public static void listResourceRecord(Route53Client route53Client, String hostedZoneId) {
try {
ListResourceRecordSetsRequest request = ListResourceRecordSetsRequest.builder().hostedZoneId(hostedZoneId).maxItems("12").build();
ListResourceRecordSetsResponse listResourceRecordSets = route53Client.listResourceRecordSets(request);
List<ResourceRecordSet> records = listResourceRecordSets.resourceRecordSets();
for (ResourceRecordSet record : records) {
System.out.println("The Record name is: " + record.name());
}
} catch (Route53Exception e) {
System.err.println(e.getMessage());
System.exit(1);
}
}
use of software.amazon.awssdk.services.route53.Route53Client in project aws-doc-sdk-examples by awsdocs.
the class UpdateHealthCheck method updateSpecificHealthCheck.
// snippet-start:[route53.java2.update_health_check.main]
public static void updateSpecificHealthCheck(Route53Client route53Client, String id) {
try {
UpdateHealthCheckRequest checkRequest = UpdateHealthCheckRequest.builder().healthCheckId(id).disabled(true).build();
// Update the Health Check
UpdateHealthCheckResponse healthResponse = route53Client.updateHealthCheck(checkRequest);
System.out.println("The health check with id " + healthResponse.healthCheck().id() + " was updated!");
} catch (Route53Exception e) {
System.err.println(e.getMessage());
System.exit(1);
}
}
Aggregations