1 /* 2 * Copyright 2016 Google LLC 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 /** 18 * A client for Cloud DNS - A highly available global DNS network. 19 * 20 * <p>Here are two simple usage examples from within Compute/App Engine. 21 * 22 * <p>The first snippet shows how to create a zone resource. The complete source code can be found 23 * on <a href= 24 * "https://github.com/googleapis/google-cloud-java/blob/main/google-cloud-examples/src/main/java/com/google/cloud/examples/dns/snippets/CreateZone.java"> 25 * CreateZone.java</a>. Note that you need to replace the {@code domainName} with a domain name that 26 * you own and the ownership of which you verified with Google. 27 * 28 * <pre>{@code 29 * Dns dns = DnsOptions.getDefaultInstance().getService(); 30 * String zoneName = "my-unique-zone"; 31 * String domainName = "someexampledomain.com."; 32 * String description = "This is a google-cloud-dns sample zone."; 33 * ZoneInfo zoneInfo = ZoneInfo.of(zoneName, domainName, description); 34 * Zone createdZone = dns.create(zoneInfo); 35 * }</pre> 36 * 37 * <p>The second example shows how to create records inside a zone. The complete code can be found 38 * on <a href= 39 * "https://github.com/googleapis/google-cloud-java/blob/main/google-cloud-examples/src/main/java/com/google/cloud/examples/dns/snippets/CreateOrUpdateRecordSets.java"> 40 * CreateOrUpdateRecordSets.java</a>. 41 * 42 * <pre>{@code 43 * Dns dns = DnsOptions.getDefaultInstance().getService(); 44 * String zoneName = "my-unique-zone"; 45 * Zone zone = dns.getZone(zoneName); 46 * String ip = "12.13.14.15"; 47 * RecordSet toCreate = RecordSet.newBuilder("www.someexampledomain.com.", RecordSet.Type.A) 48 * .setTtl(24, TimeUnit.HOURS) 49 * .addRecord(ip) 50 * .build(); 51 * ChangeRequestInfo changeRequest = ChangeRequestInfo.newBuilder().add(toCreate).build(); 52 * zone.applyChangeRequest(changeRequest); 53 * }</pre> 54 * 55 * <p>When using google-cloud from outside of App/Compute Engine, you have to <a 56 * href="https://github.com/googleapis/google-cloud-java#specifying-a-project-id">specify a project 57 * ID</a> and <a href="https://github.com/googleapis/google-cloud-java#authentication">provide 58 * credentials</a>. 59 * 60 * @see <a href="https://cloud.google.com/dns/">Google Cloud DNS</a> 61 */ 62 package com.google.cloud.dns; 63