mirror of https://github.com/apache/jclouds.git
Merge pull request #1316 from jclouds/dynect-rdata
added initial rdata implementation for DynECT
This commit is contained in:
commit
b0c74083f4
|
@ -18,7 +18,10 @@
|
|||
*/
|
||||
package org.jclouds.dynect.v3;
|
||||
|
||||
import javax.ws.rs.PathParam;
|
||||
|
||||
import org.jclouds.dynect.v3.domain.Job;
|
||||
import org.jclouds.dynect.v3.features.RecordApi;
|
||||
import org.jclouds.dynect.v3.features.SessionApi;
|
||||
import org.jclouds.dynect.v3.features.ZoneApi;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
|
@ -55,4 +58,10 @@ public interface DynECTApi {
|
|||
*/
|
||||
@Delegate
|
||||
ZoneApi getZoneApi();
|
||||
|
||||
/**
|
||||
* Provides synchronous access to Record features
|
||||
*/
|
||||
@Delegate
|
||||
RecordApi getRecordApiForZone(@PathParam("zone") String zone);
|
||||
}
|
|
@ -29,6 +29,7 @@ import javax.ws.rs.Produces;
|
|||
|
||||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.dynect.v3.domain.Job;
|
||||
import org.jclouds.dynect.v3.features.RecordAsyncApi;
|
||||
import org.jclouds.dynect.v3.features.SessionAsyncApi;
|
||||
import org.jclouds.dynect.v3.features.ZoneAsyncApi;
|
||||
import org.jclouds.dynect.v3.filters.SessionManager;
|
||||
|
@ -72,4 +73,10 @@ public interface DynECTAsyncApi {
|
|||
*/
|
||||
@Delegate
|
||||
ZoneAsyncApi getZoneApi();
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to Record features
|
||||
*/
|
||||
@Delegate
|
||||
RecordAsyncApi getRecordApiForZone(@PathParam("zone") String zone);
|
||||
}
|
||||
|
|
|
@ -26,8 +26,12 @@ import javax.inject.Singleton;
|
|||
import org.jclouds.dynect.v3.domain.SessionCredentials;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.primitives.UnsignedInteger;
|
||||
import com.google.gson.JsonDeserializationContext;
|
||||
import com.google.gson.JsonDeserializer;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParseException;
|
||||
import com.google.gson.JsonSerializationContext;
|
||||
import com.google.gson.JsonSerializer;
|
||||
import com.google.inject.AbstractModule;
|
||||
|
@ -47,11 +51,11 @@ public class DynECTParserModule extends AbstractModule {
|
|||
public Map<Type, Object> provideCustomAdapterBindings() {
|
||||
return new ImmutableMap.Builder<Type, Object>()
|
||||
.put(SessionCredentials.class, new SessionCredentialsTypeAdapter())
|
||||
.put(UnsignedInteger.class, new UnsignedIntegerAdapter())
|
||||
.build();
|
||||
}
|
||||
|
||||
private static class SessionCredentialsTypeAdapter implements JsonSerializer<SessionCredentials> {
|
||||
@Override
|
||||
public JsonElement serialize(SessionCredentials src, Type typeOfSrc, JsonSerializationContext context) {
|
||||
JsonObject metadataObject = new JsonObject();
|
||||
metadataObject.addProperty("customer_name", src.getCustomerName());
|
||||
|
@ -60,4 +64,11 @@ public class DynECTParserModule extends AbstractModule {
|
|||
return metadataObject;
|
||||
}
|
||||
}
|
||||
|
||||
private static class UnsignedIntegerAdapter implements JsonDeserializer<UnsignedInteger> {
|
||||
public UnsignedInteger deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context)
|
||||
throws JsonParseException {
|
||||
return UnsignedInteger.fromIntBits(jsonElement.getAsBigInteger().intValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,6 +37,8 @@ import org.jclouds.Constants;
|
|||
import org.jclouds.concurrent.SingleThreaded;
|
||||
import org.jclouds.dynect.v3.DynECTApi;
|
||||
import org.jclouds.dynect.v3.DynECTAsyncApi;
|
||||
import org.jclouds.dynect.v3.features.RecordApi;
|
||||
import org.jclouds.dynect.v3.features.RecordAsyncApi;
|
||||
import org.jclouds.dynect.v3.features.SessionApi;
|
||||
import org.jclouds.dynect.v3.features.SessionAsyncApi;
|
||||
import org.jclouds.dynect.v3.features.ZoneApi;
|
||||
|
@ -78,7 +80,8 @@ public class DynECTRestClientModule extends RestClientModule<DynECTApi, DynECTAs
|
|||
|
||||
public static final Map<Class<?>, Class<?>> DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>> builder()
|
||||
.put(SessionApi.class, SessionAsyncApi.class)
|
||||
.put(ZoneApi.class, ZoneAsyncApi.class).build();
|
||||
.put(ZoneApi.class, ZoneAsyncApi.class)
|
||||
.put(RecordApi.class, RecordAsyncApi.class).build();
|
||||
|
||||
public DynECTRestClientModule() {
|
||||
super(DELEGATE_MAP);
|
||||
|
|
|
@ -0,0 +1,115 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, String 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.dynect.v3.domain;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.beans.ConstructorProperties;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.inject.Named;
|
||||
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public class Record<D extends Map<String, Object>> extends RecordId {
|
||||
|
||||
private final int ttl;
|
||||
@Named("rdata")
|
||||
private final D rdata;
|
||||
|
||||
@ConstructorProperties({ "zone", "fqdn", "record_type", "record_id", "ttl", "rdata" })
|
||||
protected Record(String zone, String fqdn, String type, long id, int ttl, D rdata) {
|
||||
super(zone, fqdn, type, id);
|
||||
this.ttl = checkNotNull(ttl, "ttl of %s", id);
|
||||
this.rdata = checkNotNull(rdata, "rdata of %s", id);
|
||||
}
|
||||
|
||||
/**
|
||||
* The current ttl of the record or zero if default for the zone
|
||||
*/
|
||||
public int getTTL() {
|
||||
return ttl;
|
||||
}
|
||||
|
||||
/**
|
||||
* RData defining the record; corresponds to binary master format. Only
|
||||
* simple data types such as String or Integer are values.
|
||||
*/
|
||||
public D getRData() {
|
||||
return rdata;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ToStringHelper string() {
|
||||
return super.string().add("ttl", ttl).add("rdata", rdata);
|
||||
}
|
||||
|
||||
public static <D extends Map<String, Object>> Builder<D, ?> builder() {
|
||||
return new ConcreteBuilder<D>();
|
||||
}
|
||||
|
||||
public Builder<D, ?> toBuilder() {
|
||||
return new ConcreteBuilder<D>().from(this);
|
||||
}
|
||||
|
||||
public abstract static class Builder<D extends Map<String, Object>, B extends Builder<D, B>> extends RecordId.Builder<B> {
|
||||
|
||||
protected int ttl;
|
||||
protected D rdata;
|
||||
|
||||
/**
|
||||
* @see Record#getTTL()
|
||||
*/
|
||||
public B ttl(int ttl) {
|
||||
this.ttl = ttl;
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Record#getRData()
|
||||
*/
|
||||
public B rdata(D rdata) {
|
||||
this.rdata = rdata;
|
||||
return self();
|
||||
}
|
||||
|
||||
public Record<D> build() {
|
||||
return new Record<D>(zone, fqdn, type, id, ttl, rdata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public B from(RecordId in) {
|
||||
if (in instanceof Record) {
|
||||
@SuppressWarnings("unchecked")
|
||||
Record<D> record = Record.class.cast(in);
|
||||
ttl(record.ttl).rdata(record.rdata);
|
||||
}
|
||||
return super.from(in);
|
||||
}
|
||||
}
|
||||
|
||||
private static class ConcreteBuilder<D extends Map<String, Object>> extends Builder<D, ConcreteBuilder<D>> {
|
||||
protected ConcreteBuilder<D> self() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,166 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, String 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.dynect.v3.domain;
|
||||
|
||||
import static com.google.common.base.Objects.equal;
|
||||
import static com.google.common.base.Objects.toStringHelper;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.beans.ConstructorProperties;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public class RecordId {
|
||||
|
||||
private final long id;
|
||||
private final String zone;
|
||||
private final String fqdn;
|
||||
private final String type;
|
||||
|
||||
@ConstructorProperties({ "zone", "fqdn", "record_type", "record_id" })
|
||||
RecordId(String zone, String fqdn, String type, long id) {
|
||||
this.id = checkNotNull(id, "id");
|
||||
this.fqdn = checkNotNull(fqdn, "fqdn of %s", id);
|
||||
this.zone = checkNotNull(zone, "zone of %s", id);
|
||||
this.type = checkNotNull(type, "type of %s", id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Name of the zone
|
||||
*/
|
||||
public String getZone() {
|
||||
return zone;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fully qualified domain name of a node in the zone
|
||||
*/
|
||||
public String getFQDN() {
|
||||
return fqdn;
|
||||
}
|
||||
|
||||
/**
|
||||
* The RRType of the record
|
||||
*/
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* The record id
|
||||
*/
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(zone, fqdn, type, id);
|
||||
}
|
||||
|
||||
/**
|
||||
* permits equals comparisons with subtypes
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null || !(obj instanceof RecordId))
|
||||
return false;
|
||||
RecordId that = RecordId.class.cast(obj);
|
||||
return equal(this.zone, that.zone) && equal(this.fqdn, that.fqdn) && equal(this.type, that.type)
|
||||
&& equal(this.id, that.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return string().toString();
|
||||
}
|
||||
|
||||
protected ToStringHelper string() {
|
||||
return toStringHelper(this).add("zone", zone).add("fqdn", fqdn).add("type", type).add("id", id);
|
||||
}
|
||||
|
||||
public static Builder<?> builder() {
|
||||
return new ConcreteBuilder();
|
||||
}
|
||||
|
||||
public Builder<?> toBuilder() {
|
||||
return new ConcreteBuilder().from(this);
|
||||
}
|
||||
|
||||
public abstract static class Builder<B extends Builder<B>> {
|
||||
protected abstract B self();
|
||||
|
||||
protected String zone;
|
||||
protected String fqdn;
|
||||
protected String type;
|
||||
protected long id;
|
||||
|
||||
/**
|
||||
* @see RecordId#getZone()
|
||||
*/
|
||||
public B zone(String zone) {
|
||||
this.zone = zone;
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see RecordId#getFQDN()
|
||||
*/
|
||||
public B fqdn(String fqdn) {
|
||||
this.fqdn = fqdn;
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see RecordId#getType()
|
||||
*/
|
||||
public B type(String type) {
|
||||
this.type = type;
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see RecordId#getId()
|
||||
*/
|
||||
public B id(long id) {
|
||||
this.id = id;
|
||||
return self();
|
||||
}
|
||||
|
||||
public RecordId build() {
|
||||
return new RecordId(zone, fqdn, type, id);
|
||||
}
|
||||
|
||||
public B from(RecordId in) {
|
||||
return zone(in.zone).fqdn(in.fqdn).type(in.type).id(in.id);
|
||||
}
|
||||
}
|
||||
|
||||
private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
|
||||
protected ConcreteBuilder self() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,99 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, String 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.dynect.v3.domain;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.beans.ConstructorProperties;
|
||||
|
||||
import javax.inject.Named;
|
||||
|
||||
import org.jclouds.dynect.v3.domain.Zone.SerialStyle;
|
||||
import org.jclouds.dynect.v3.domain.rdata.SOAData;
|
||||
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
|
||||
/**
|
||||
* Start of Authority per RFC 1035
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public final class SOARecord extends Record<SOAData> {
|
||||
|
||||
@Named("serial_style")
|
||||
private final SerialStyle serialStyle;
|
||||
|
||||
@ConstructorProperties({ "zone", "fqdn", "record_type", "record_id", "ttl", "rdata", "serial_style" })
|
||||
private SOARecord(String zone, String fqdn, String type, long id, int ttl, SOAData rdata, SerialStyle serialStyle) {
|
||||
super(zone, fqdn, type, id, ttl, rdata);
|
||||
this.serialStyle = checkNotNull(serialStyle, "serialStyle of %s", id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Zone#getSerialStyle
|
||||
*/
|
||||
public SerialStyle getSerialStyle() {
|
||||
return serialStyle;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ToStringHelper string() {
|
||||
return super.string().add("serialStyle", serialStyle);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public Builder toBuilder() {
|
||||
return builder().from(this);
|
||||
}
|
||||
|
||||
public final static class Builder extends Record.Builder<SOAData, Builder> {
|
||||
|
||||
private SerialStyle serialStyle;
|
||||
|
||||
/**
|
||||
* @see Zone#getSerialStyle()
|
||||
*/
|
||||
public Builder serialStyle(SerialStyle serialStyle) {
|
||||
this.serialStyle = serialStyle;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SOARecord build() {
|
||||
return new SOARecord(zone, fqdn, type, id, ttl, rdata, serialStyle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder from(RecordId in) {
|
||||
if (in instanceof SOARecord) {
|
||||
SOARecord record = SOARecord.class.cast(in);
|
||||
serialStyle(record.serialStyle);
|
||||
}
|
||||
return super.from(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Builder self() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, String 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.dynect.v3.domain.rdata;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.beans.ConstructorProperties;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.ForwardingMap;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
/**
|
||||
* Corresponds to the binary representation of the {@code AAAA} (Address) RData
|
||||
*
|
||||
* <h4>Example</h4>
|
||||
*
|
||||
* <pre>
|
||||
* import static org.jclouds.dynect.v3.domain.rdata.NSData.aaaa;
|
||||
* ...
|
||||
* NSData rdata = aaaa("1234:ab00:ff00::6b14:abcd");
|
||||
* </pre>
|
||||
*
|
||||
* @see <aaaa href="http://www.ietf.org/rfc/rfc3596.txt">RFC 3596</aaaa>
|
||||
*/
|
||||
public class AAAAData extends ForwardingMap<String, Object> {
|
||||
private final ImmutableMap<String, Object> delegate;
|
||||
|
||||
@ConstructorProperties("address")
|
||||
private AAAAData(String address) {
|
||||
this.delegate = ImmutableMap.<String, Object> of("address", checkNotNull(address, "address"));
|
||||
}
|
||||
|
||||
protected Map<String, Object> delegate() {
|
||||
return delegate;
|
||||
}
|
||||
|
||||
/**
|
||||
* a 128 bit IPv6 address
|
||||
*/
|
||||
public String getAddress() {
|
||||
return get("address").toString();
|
||||
}
|
||||
|
||||
public static AAAAData aaaa(String address) {
|
||||
return builder().address(address).build();
|
||||
}
|
||||
|
||||
public static AAAAData.Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public AAAAData.Builder toBuilder() {
|
||||
return builder().from(this);
|
||||
}
|
||||
|
||||
public final static class Builder {
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* @see AAAAData#getAddress()
|
||||
*/
|
||||
public AAAAData.Builder address(String address) {
|
||||
this.address = address;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AAAAData build() {
|
||||
return new AAAAData(address);
|
||||
}
|
||||
|
||||
public AAAAData.Builder from(AAAAData in) {
|
||||
return this.address(in.getAddress());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, String 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.dynect.v3.domain.rdata;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.beans.ConstructorProperties;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.ForwardingMap;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
/**
|
||||
* Corresponds to the binary representation of the {@code A} (Address) RData
|
||||
*
|
||||
* <h4>Example</h4>
|
||||
*
|
||||
* <pre>
|
||||
* import static org.jclouds.dynect.v3.domain.rdata.NSData.a;
|
||||
* ...
|
||||
* NSData rdata = a("ptr.foo.com.");
|
||||
* </pre>
|
||||
*
|
||||
* @see <a href="http://www.ietf.org/rfc/rfc1035.txt">RFC 1035</a>
|
||||
*/
|
||||
public class AData extends ForwardingMap<String, Object> {
|
||||
private final ImmutableMap<String, Object> delegate;
|
||||
|
||||
@ConstructorProperties("address")
|
||||
private AData(String address) {
|
||||
this.delegate = ImmutableMap.<String, Object> of("address", checkNotNull(address, "address"));
|
||||
}
|
||||
|
||||
protected Map<String, Object> delegate() {
|
||||
return delegate;
|
||||
}
|
||||
|
||||
/**
|
||||
* a 32-bit internet address
|
||||
*/
|
||||
public String getAddress() {
|
||||
return get("address").toString();
|
||||
}
|
||||
|
||||
public static AData a(String address) {
|
||||
return builder().address(address).build();
|
||||
}
|
||||
|
||||
public static AData.Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public AData.Builder toBuilder() {
|
||||
return builder().from(this);
|
||||
}
|
||||
|
||||
public final static class Builder {
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* @see AData#getAddress()
|
||||
*/
|
||||
public AData.Builder address(String address) {
|
||||
this.address = address;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AData build() {
|
||||
return new AData(address);
|
||||
}
|
||||
|
||||
public AData.Builder from(AData in) {
|
||||
return this.address(in.getAddress());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, String 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.dynect.v3.domain.rdata;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.beans.ConstructorProperties;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.ForwardingMap;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
/**
|
||||
* Corresponds to the binary representation of the {@code CNAME} (Canonical Name) RData
|
||||
*
|
||||
* <h4>Example</h4>
|
||||
*
|
||||
* <pre>
|
||||
* import static org.jclouds.dynect.v3.domain.rdata.NSData.cname;
|
||||
* ...
|
||||
* NSData rdata = cname("cname.foo.com.");
|
||||
* </pre>
|
||||
*
|
||||
* @see <a href="http://www.ietf.org/rfc/rfc1035.txt">RFC 1035</a>
|
||||
*/
|
||||
public class CNAMEData extends ForwardingMap<String, Object> {
|
||||
private final ImmutableMap<String, Object> delegate;
|
||||
|
||||
@ConstructorProperties("cname")
|
||||
private CNAMEData(String cname) {
|
||||
this.delegate = ImmutableMap.<String, Object> of("cname", checkNotNull(cname, "cname"));
|
||||
}
|
||||
|
||||
protected Map<String, Object> delegate() {
|
||||
return delegate;
|
||||
}
|
||||
|
||||
/**
|
||||
* domain-name which specifies the canonical or primary name for the owner.
|
||||
* The owner name is an alias.
|
||||
*/
|
||||
public String getCname() {
|
||||
return get("cname").toString();
|
||||
}
|
||||
|
||||
public static CNAMEData cname(String cname) {
|
||||
return builder().cname(cname).build();
|
||||
}
|
||||
|
||||
public static CNAMEData.Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public CNAMEData.Builder toBuilder() {
|
||||
return builder().from(this);
|
||||
}
|
||||
|
||||
public final static class Builder {
|
||||
private String cname;
|
||||
|
||||
/**
|
||||
* @see CNAMEData#getCname()
|
||||
*/
|
||||
public CNAMEData.Builder cname(String cname) {
|
||||
this.cname = cname;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CNAMEData build() {
|
||||
return new CNAMEData(cname);
|
||||
}
|
||||
|
||||
public CNAMEData.Builder from(CNAMEData in) {
|
||||
return this.cname(in.getCname());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,121 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, String 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.dynect.v3.domain.rdata;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.beans.ConstructorProperties;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.ForwardingMap;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.primitives.UnsignedInteger;
|
||||
|
||||
/**
|
||||
* Corresponds to the binary representation of the {@code MX} (Mail Exchange)
|
||||
* RData
|
||||
*
|
||||
* <h4>Example</h4>
|
||||
*
|
||||
* <pre>
|
||||
* import static org.jclouds.dynect.v3.domain.rdata.MXData.mx;
|
||||
* ...
|
||||
* MXData rdata = mx(1, "mail.jclouds.org");
|
||||
* </pre>
|
||||
*
|
||||
* @see <a href="http://www.ietf.org/rfc/rfc1035.txt">RFC 1035</a>
|
||||
*/
|
||||
public class MXData extends ForwardingMap<String, Object> {
|
||||
|
||||
@ConstructorProperties({ "preference", "exchange" })
|
||||
private MXData(UnsignedInteger preference, String exchange) {
|
||||
this.delegate = ImmutableMap.<String, Object> builder().put("preference", checkNotNull(preference, "preference"))
|
||||
.put("exchange", checkNotNull(exchange, "exchange")).build();
|
||||
}
|
||||
|
||||
private final ImmutableMap<String, Object> delegate;
|
||||
|
||||
protected Map<String, Object> delegate() {
|
||||
return delegate;
|
||||
}
|
||||
|
||||
/**
|
||||
* specifies the preference given to this RR among others at the same owner.
|
||||
* Lower values are preferred.
|
||||
*/
|
||||
public UnsignedInteger getPreference() {
|
||||
return UnsignedInteger.class.cast(get("preference"));
|
||||
}
|
||||
|
||||
/**
|
||||
* domain-name which specifies a host willing to act as a mail exchange for
|
||||
* the owner name.
|
||||
*/
|
||||
public String getExchange() {
|
||||
return String.class.cast(get("exchange"));
|
||||
}
|
||||
|
||||
public static MXData mx(int preference, String exchange) {
|
||||
return builder().preference(preference).exchange(exchange).build();
|
||||
}
|
||||
|
||||
public static MXData.Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public MXData.Builder toBuilder() {
|
||||
return builder().from(this);
|
||||
}
|
||||
|
||||
public final static class Builder {
|
||||
private UnsignedInteger preference;
|
||||
private String exchange;
|
||||
|
||||
/**
|
||||
* @see MXData#getPreference()
|
||||
*/
|
||||
public MXData.Builder preference(int preference) {
|
||||
return preference(UnsignedInteger.fromIntBits(preference));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see MXData#getPreference()
|
||||
*/
|
||||
public MXData.Builder preference(UnsignedInteger preference) {
|
||||
this.preference = preference;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see MXData#getExchange()
|
||||
*/
|
||||
public MXData.Builder exchange(String exchange) {
|
||||
this.exchange = exchange;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MXData build() {
|
||||
return new MXData(preference, exchange);
|
||||
}
|
||||
|
||||
public MXData.Builder from(MXData in) {
|
||||
return this.preference(in.getPreference()).exchange(in.getExchange());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, String 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.dynect.v3.domain.rdata;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.beans.ConstructorProperties;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.ForwardingMap;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
/**
|
||||
* Corresponds to the binary representation of the {@code NS} (Name Server) RData
|
||||
*
|
||||
* <h4>Example</h4>
|
||||
*
|
||||
* <pre>
|
||||
* import static org.jclouds.dynect.v3.domain.rdata.NSData.ns;
|
||||
* ...
|
||||
* NSData rdata = ns("ns.foo.com.");
|
||||
* </pre>
|
||||
*
|
||||
* @see <a href="http://www.ietf.org/rfc/rfc1035.txt">RFC 1035</a>
|
||||
*/
|
||||
public class NSData extends ForwardingMap<String, Object> {
|
||||
private final ImmutableMap<String, Object> delegate;
|
||||
|
||||
@ConstructorProperties("nsdname")
|
||||
private NSData(String nsdname) {
|
||||
this.delegate = ImmutableMap.<String, Object> of("nsdname", checkNotNull(nsdname, "nsdname"));
|
||||
}
|
||||
|
||||
protected Map<String, Object> delegate() {
|
||||
return delegate;
|
||||
}
|
||||
|
||||
/**
|
||||
* domain-name which specifies a host which should be authoritative for the
|
||||
* specified class and domain.
|
||||
*/
|
||||
public String getNsdname() {
|
||||
return get("nsdname").toString();
|
||||
}
|
||||
|
||||
public static NSData ns(String nsdname) {
|
||||
return builder().nsdname(nsdname).build();
|
||||
}
|
||||
|
||||
public static NSData.Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public NSData.Builder toBuilder() {
|
||||
return builder().from(this);
|
||||
}
|
||||
|
||||
public final static class Builder {
|
||||
private String nsdname;
|
||||
|
||||
/**
|
||||
* @see NSData#getNsdname()
|
||||
*/
|
||||
public NSData.Builder nsdname(String nsdname) {
|
||||
this.nsdname = nsdname;
|
||||
return this;
|
||||
}
|
||||
|
||||
public NSData build() {
|
||||
return new NSData(nsdname);
|
||||
}
|
||||
|
||||
public NSData.Builder from(NSData in) {
|
||||
return this.nsdname(in.getNsdname());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, String 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.dynect.v3.domain.rdata;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.beans.ConstructorProperties;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.ForwardingMap;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
/**
|
||||
* Corresponds to the binary representation of the {@code PTR} (Pointer) RData
|
||||
*
|
||||
* <h4>Example</h4>
|
||||
*
|
||||
* <pre>
|
||||
* import static org.jclouds.dynect.v3.domain.rdata.NSData.ptr;
|
||||
* ...
|
||||
* NSData rdata = ptr("ptr.foo.com.");
|
||||
* </pre>
|
||||
*
|
||||
* @see <a href="http://www.ietf.org/rfc/rfc1035.txt">RFC 1035</a>
|
||||
*/
|
||||
public class PTRData extends ForwardingMap<String, Object> {
|
||||
private final ImmutableMap<String, Object> delegate;
|
||||
|
||||
@ConstructorProperties("ptrdname")
|
||||
private PTRData(String ptrdname) {
|
||||
this.delegate = ImmutableMap.<String, Object> of("ptrdname", checkNotNull(ptrdname, "ptrdname"));
|
||||
}
|
||||
|
||||
protected Map<String, Object> delegate() {
|
||||
return delegate;
|
||||
}
|
||||
|
||||
/**
|
||||
* domain-name which points to some location in the domain name space.
|
||||
*/
|
||||
public String getPtrdname() {
|
||||
return get("ptrdname").toString();
|
||||
}
|
||||
|
||||
public static PTRData ptr(String ptrdname) {
|
||||
return builder().ptrdname(ptrdname).build();
|
||||
}
|
||||
|
||||
public static PTRData.Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public PTRData.Builder toBuilder() {
|
||||
return builder().from(this);
|
||||
}
|
||||
|
||||
public final static class Builder {
|
||||
private String ptrdname;
|
||||
|
||||
/**
|
||||
* @see PTRData#getPtrdname()
|
||||
*/
|
||||
public PTRData.Builder ptrdname(String ptrdname) {
|
||||
this.ptrdname = ptrdname;
|
||||
return this;
|
||||
}
|
||||
|
||||
public PTRData build() {
|
||||
return new PTRData(ptrdname);
|
||||
}
|
||||
|
||||
public PTRData.Builder from(PTRData in) {
|
||||
return this.ptrdname(in.getPtrdname());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,238 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, String 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.dynect.v3.domain.rdata;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.beans.ConstructorProperties;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.ForwardingMap;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.primitives.UnsignedInteger;
|
||||
|
||||
/**
|
||||
* Corresponds to the binary representation of the {@code SOA} (Start of Authority) RData
|
||||
*
|
||||
* <h4>Example</h4>
|
||||
*
|
||||
* <pre>
|
||||
* SOAData rdata = SOAData.builder()
|
||||
* .rname("foo.com.")
|
||||
* .mname("admin.foo.com.")
|
||||
* .serial(1)
|
||||
* .refresh(3600)
|
||||
* .retry(600)
|
||||
* .expire(604800)
|
||||
* .minimum(60).build()
|
||||
* </pre>
|
||||
*
|
||||
* @see <a href="http://www.ietf.org/rfc/rfc1035.txt">RFC 1035</a>
|
||||
*/
|
||||
public class SOAData extends ForwardingMap<String, Object> {
|
||||
|
||||
@ConstructorProperties({ "mname", "rname", "serial", "refresh", "retry", "expire", "minimum" })
|
||||
private SOAData(String mname, String rname, UnsignedInteger serial, UnsignedInteger refresh, UnsignedInteger retry,
|
||||
UnsignedInteger expire, UnsignedInteger minimum) {
|
||||
this.delegate = ImmutableMap.<String, Object> builder()
|
||||
.put("mname", checkNotNull(mname, "mname"))
|
||||
.put("rname", checkNotNull(rname, "rname of %s", mname))
|
||||
.put("serial", checkNotNull(serial, "serial of %s", mname))
|
||||
.put("refresh", checkNotNull(refresh, "refresh of %s", mname))
|
||||
.put("retry", checkNotNull(retry, "retry of %s", mname))
|
||||
.put("expire", checkNotNull(expire, "expire of %s", mname))
|
||||
.put("minimum", checkNotNull(minimum, "minimum of %s", mname)).build();
|
||||
}
|
||||
|
||||
private final ImmutableMap<String, Object> delegate;
|
||||
|
||||
protected Map<String, Object> delegate() {
|
||||
return delegate;
|
||||
}
|
||||
|
||||
/**
|
||||
* domain-name of the name server that was the original or primary source of
|
||||
* data for this zone
|
||||
*/
|
||||
public String getMname() {
|
||||
return String.class.cast(get("mname"));
|
||||
}
|
||||
|
||||
/**
|
||||
* domain-name which specifies the mailbox of the person responsible for this
|
||||
* zone.
|
||||
*/
|
||||
public String getRname() {
|
||||
return String.class.cast(get("rname"));
|
||||
}
|
||||
|
||||
/**
|
||||
* version number of the original copy of the zone.
|
||||
*/
|
||||
public UnsignedInteger getSerial() {
|
||||
return UnsignedInteger.class.cast(get("serial"));
|
||||
}
|
||||
|
||||
/**
|
||||
* time interval before the zone should be refreshed
|
||||
*/
|
||||
public UnsignedInteger getRefresh() {
|
||||
return UnsignedInteger.class.cast(get("refresh"));
|
||||
}
|
||||
|
||||
/**
|
||||
* time interval that should elapse before a failed refresh should be retried
|
||||
*/
|
||||
public UnsignedInteger getRetry() {
|
||||
return UnsignedInteger.class.cast(get("retry"));
|
||||
}
|
||||
|
||||
/**
|
||||
* time value that specifies the upper limit on the time interval that can
|
||||
* elapse before the zone is no longer authoritative.
|
||||
*/
|
||||
public UnsignedInteger getExpire() {
|
||||
return UnsignedInteger.class.cast(get("expire"));
|
||||
}
|
||||
|
||||
/**
|
||||
* minimum TTL field that should be exported with any RR from this zone.
|
||||
*/
|
||||
public UnsignedInteger getMinimum() {
|
||||
return UnsignedInteger.class.cast(get("minimum"));
|
||||
}
|
||||
|
||||
public static SOAData.Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public SOAData.Builder toBuilder() {
|
||||
return builder().from(this);
|
||||
}
|
||||
|
||||
public final static class Builder {
|
||||
private String mname;
|
||||
private String rname;
|
||||
private UnsignedInteger serial;
|
||||
private UnsignedInteger refresh;
|
||||
private UnsignedInteger retry;
|
||||
private UnsignedInteger expire;
|
||||
private UnsignedInteger minimum;
|
||||
|
||||
/**
|
||||
* @see SOAData#getMname()
|
||||
*/
|
||||
public SOAData.Builder mname(String mname) {
|
||||
this.mname = mname;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SOAData#getRname()
|
||||
*/
|
||||
public SOAData.Builder rname(String rname) {
|
||||
this.rname = rname;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SOAData#getSerial()
|
||||
*/
|
||||
public SOAData.Builder serial(UnsignedInteger serial) {
|
||||
this.serial = serial;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SOAData#getSerial()
|
||||
*/
|
||||
public SOAData.Builder serial(int serial) {
|
||||
return serial(UnsignedInteger.fromIntBits(serial));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SOAData#getRefresh()
|
||||
*/
|
||||
public SOAData.Builder refresh(UnsignedInteger refresh) {
|
||||
this.refresh = refresh;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SOAData#getRefresh()
|
||||
*/
|
||||
public SOAData.Builder refresh(int refresh) {
|
||||
return refresh(UnsignedInteger.fromIntBits(refresh));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SOAData#getRetry()
|
||||
*/
|
||||
public SOAData.Builder retry(UnsignedInteger retry) {
|
||||
this.retry = retry;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SOAData#getRetry()
|
||||
*/
|
||||
public SOAData.Builder retry(int retry) {
|
||||
return retry(UnsignedInteger.fromIntBits(retry));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SOAData#getExpire()
|
||||
*/
|
||||
public SOAData.Builder expire(UnsignedInteger expire) {
|
||||
this.expire = expire;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SOAData#getExpire()
|
||||
*/
|
||||
public SOAData.Builder expire(int expire) {
|
||||
return expire(UnsignedInteger.fromIntBits(expire));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SOAData#getMinimum()
|
||||
*/
|
||||
public SOAData.Builder minimum(UnsignedInteger minimum) {
|
||||
this.minimum = minimum;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SOAData#getMinimum()
|
||||
*/
|
||||
public SOAData.Builder minimum(int minimum) {
|
||||
return minimum(UnsignedInteger.fromIntBits(minimum));
|
||||
}
|
||||
|
||||
public SOAData build() {
|
||||
return new SOAData(mname, rname, serial, refresh, retry, expire, minimum);
|
||||
}
|
||||
|
||||
public SOAData.Builder from(SOAData in) {
|
||||
return this.mname(in.getMname()).rname(in.getRname()).serial(in.getSerial()).refresh(in.getRefresh())
|
||||
.expire(in.getExpire()).minimum(in.getMinimum());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,172 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, String 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.dynect.v3.domain.rdata;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.beans.ConstructorProperties;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.ForwardingMap;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.primitives.UnsignedInteger;
|
||||
|
||||
/**
|
||||
* Corresponds to the binary representation of the {@code SRV} (Service) RData
|
||||
*
|
||||
* <h4>Example</h4>
|
||||
*
|
||||
* <pre>
|
||||
* SRVData rdata = SRVData.builder()
|
||||
* .priority(0)
|
||||
* .weight(1)
|
||||
* .port(80)
|
||||
* .target("www.foo.com.").build()
|
||||
* </pre>
|
||||
*
|
||||
* @see <a href="http://www.ietf.org/rfc/rfc2782.txt">RFC 2782</a>
|
||||
*/
|
||||
public class SRVData extends ForwardingMap<String, Object> {
|
||||
|
||||
@ConstructorProperties({ "priority", "weight", "port", "target" })
|
||||
private SRVData(UnsignedInteger priority, UnsignedInteger weight, UnsignedInteger port, String target) {
|
||||
this.delegate = ImmutableMap.<String, Object> builder()
|
||||
.put("priority", checkNotNull(priority, "priority of %s", target))
|
||||
.put("weight", checkNotNull(weight, "weight of %s", target))
|
||||
.put("port", checkNotNull(port, "port of %s", target))
|
||||
.put("target", checkNotNull(target, "target"))
|
||||
.build();
|
||||
}
|
||||
|
||||
private final ImmutableMap<String, Object> delegate;
|
||||
|
||||
protected Map<String, Object> delegate() {
|
||||
return delegate;
|
||||
}
|
||||
|
||||
/**
|
||||
* The priority of this target host. A client MUST attempt to contact the
|
||||
* target host with the lowest-numbered priority it can reach; target hosts
|
||||
* with the same priority SHOULD be tried in an order defined by the weight
|
||||
* field.
|
||||
*/
|
||||
public UnsignedInteger getPriority() {
|
||||
return UnsignedInteger.class.cast(get("priority"));
|
||||
}
|
||||
|
||||
/**
|
||||
* The weight field specifies a relative weight for entries with the same
|
||||
* priority. Larger weights SHOULD be given a proportionately higher
|
||||
* probability of being selected.
|
||||
*/
|
||||
public UnsignedInteger getWeight() {
|
||||
return UnsignedInteger.class.cast(get("weight"));
|
||||
}
|
||||
|
||||
/**
|
||||
* The port on this target host of this service.
|
||||
*/
|
||||
public UnsignedInteger getPort() {
|
||||
return UnsignedInteger.class.cast(get("port"));
|
||||
}
|
||||
|
||||
/**
|
||||
* The domain name of the target host. There MUST be one or more address
|
||||
* records for this name, the name MUST NOT be an alias.
|
||||
*/
|
||||
public String getTarget() {
|
||||
return String.class.cast(get("target"));
|
||||
}
|
||||
|
||||
public static SRVData.Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public SRVData.Builder toBuilder() {
|
||||
return builder().from(this);
|
||||
}
|
||||
|
||||
public final static class Builder {
|
||||
private UnsignedInteger priority;
|
||||
private UnsignedInteger weight;
|
||||
private UnsignedInteger port;
|
||||
private String target;
|
||||
|
||||
/**
|
||||
* @see SRVData#getPriority()
|
||||
*/
|
||||
public SRVData.Builder priority(UnsignedInteger priority) {
|
||||
this.priority = priority;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SRVData#getPriority()
|
||||
*/
|
||||
public SRVData.Builder priority(int priority) {
|
||||
return priority(UnsignedInteger.fromIntBits(priority));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SRVData#getWeight()
|
||||
*/
|
||||
public SRVData.Builder weight(UnsignedInteger weight) {
|
||||
this.weight = weight;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SRVData#getWeight()
|
||||
*/
|
||||
public SRVData.Builder weight(int weight) {
|
||||
return weight(UnsignedInteger.fromIntBits(weight));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SRVData#getPort()
|
||||
*/
|
||||
public SRVData.Builder port(UnsignedInteger port) {
|
||||
this.port = port;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SRVData#getPort()
|
||||
*/
|
||||
public SRVData.Builder port(int port) {
|
||||
return port(UnsignedInteger.fromIntBits(port));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SRVData#getTarget()
|
||||
*/
|
||||
public SRVData.Builder target(String target) {
|
||||
this.target = target;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SRVData build() {
|
||||
return new SRVData(priority, weight, port, target);
|
||||
}
|
||||
|
||||
public SRVData.Builder from(SRVData in) {
|
||||
return this.priority(in.getPriority()).weight(in.getWeight()).port(in.getPort()).target(in.getTarget());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, String 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.dynect.v3.domain.rdata;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.beans.ConstructorProperties;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.ForwardingMap;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
/**
|
||||
* Corresponds to the binary representation of the {@code TXT} (Text) RData
|
||||
*
|
||||
* <h4>Example</h4>
|
||||
*
|
||||
* <pre>
|
||||
* import static org.jclouds.dynect.v3.domain.rdata.NSData.txt;
|
||||
* ...
|
||||
* NSData rdata = txt("=spf1 ip4:1.1.1.1/24 ip4:2.2.2.2/24 -all");
|
||||
* </pre>
|
||||
*
|
||||
* @see <a href="http://www.ietf.org/rfc/rfc1035.txt">RFC 1035</a>
|
||||
*/
|
||||
public class TXTData extends ForwardingMap<String, Object> {
|
||||
private final ImmutableMap<String, Object> delegate;
|
||||
|
||||
@ConstructorProperties("txtdata")
|
||||
private TXTData(String txtdata) {
|
||||
this.delegate = ImmutableMap.<String, Object> of("txtdata", checkNotNull(txtdata, "txtdata"));
|
||||
}
|
||||
|
||||
protected Map<String, Object> delegate() {
|
||||
return delegate;
|
||||
}
|
||||
|
||||
/**
|
||||
* One or more character-strings.
|
||||
*/
|
||||
public String getTxtdata() {
|
||||
return get("txtdata").toString();
|
||||
}
|
||||
|
||||
public static TXTData txt(String txtdata) {
|
||||
return builder().txtdata(txtdata).build();
|
||||
}
|
||||
|
||||
public static TXTData.Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public TXTData.Builder toBuilder() {
|
||||
return builder().from(this);
|
||||
}
|
||||
|
||||
public final static class Builder {
|
||||
private String txtdata;
|
||||
|
||||
/**
|
||||
* @see TXTData#getTxtdata()
|
||||
*/
|
||||
public TXTData.Builder txtdata(String txtdata) {
|
||||
this.txtdata = txtdata;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TXTData build() {
|
||||
return new TXTData(txtdata);
|
||||
}
|
||||
|
||||
public TXTData.Builder from(TXTData in) {
|
||||
return this.txtdata(in.getTxtdata());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,153 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, String 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.dynect.v3.features;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.jclouds.dynect.v3.domain.Record;
|
||||
import org.jclouds.dynect.v3.domain.RecordId;
|
||||
import org.jclouds.dynect.v3.domain.SOARecord;
|
||||
import org.jclouds.dynect.v3.domain.rdata.AAAAData;
|
||||
import org.jclouds.dynect.v3.domain.rdata.AData;
|
||||
import org.jclouds.dynect.v3.domain.rdata.CNAMEData;
|
||||
import org.jclouds.dynect.v3.domain.rdata.MXData;
|
||||
import org.jclouds.dynect.v3.domain.rdata.NSData;
|
||||
import org.jclouds.dynect.v3.domain.rdata.PTRData;
|
||||
import org.jclouds.dynect.v3.domain.rdata.SRVData;
|
||||
import org.jclouds.dynect.v3.domain.rdata.TXTData;
|
||||
|
||||
import com.google.common.collect.FluentIterable;
|
||||
|
||||
/**
|
||||
* @see RecordAsyncApi
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public interface RecordApi {
|
||||
/**
|
||||
* Retrieves a list of resource record ids for all records of any type in the
|
||||
* given zone;
|
||||
*/
|
||||
FluentIterable<RecordId> list();
|
||||
|
||||
/**
|
||||
* retrieves a resource record without regard to type
|
||||
*
|
||||
* @return null if not found
|
||||
*/
|
||||
Record<? extends Map<String, Object>> get(RecordId recordId);
|
||||
|
||||
/**
|
||||
* Gets the {@link AAAARecord} or null if not present.
|
||||
*
|
||||
* @param fqdn
|
||||
* {@link RecordId#getFQDN()}
|
||||
* @param recordId
|
||||
* {@link RecordId#getId()}
|
||||
* @return null if not found
|
||||
*/
|
||||
Record<AAAAData> getAAAA(String fqdn, long recordId);
|
||||
|
||||
/**
|
||||
* Gets the {@link ARecord} or null if not present.
|
||||
*
|
||||
* @param fqdn
|
||||
* {@link RecordId#getFQDN()}
|
||||
* @param recordId
|
||||
* {@link RecordId#getId()}
|
||||
* @return null if not found
|
||||
*/
|
||||
Record<AData> getA(String fqdn, long recordId);
|
||||
|
||||
/**
|
||||
* Gets the {@link CNAMERecord} or null if not present.
|
||||
*
|
||||
* @param fqdn
|
||||
* {@link RecordId#getFQDN()}
|
||||
* @param recordId
|
||||
* {@link RecordId#getId()}
|
||||
* @return null if not found
|
||||
*/
|
||||
Record<CNAMEData> getCNAME(String fqdn, long recordId);
|
||||
|
||||
/**
|
||||
* Gets the {@link MXRecord} or null if not present.
|
||||
*
|
||||
* @param fqdn
|
||||
* {@link RecordId#getFQDN()}
|
||||
* @param recordId
|
||||
* {@link RecordId#getId()}
|
||||
* @return null if not found
|
||||
*/
|
||||
Record<MXData> getMX(String fqdn, long recordId);
|
||||
|
||||
/**
|
||||
* Gets the {@link NSRecord} or null if not present.
|
||||
*
|
||||
* @param fqdn
|
||||
* {@link RecordId#getFQDN()}
|
||||
* @param recordId
|
||||
* {@link RecordId#getId()}
|
||||
* @return null if not found
|
||||
*/
|
||||
Record<NSData> getNS(String fqdn, long recordId);
|
||||
|
||||
/**
|
||||
* Gets the {@link PTRRecord} or null if not present.
|
||||
*
|
||||
* @param fqdn
|
||||
* {@link RecordId#getFQDN()}
|
||||
* @param recordId
|
||||
* {@link RecordId#getId()}
|
||||
* @return null if not found
|
||||
*/
|
||||
Record<PTRData> getPTR(String fqdn, long recordId);
|
||||
|
||||
/**
|
||||
* Gets the {@link SOARecord} or null if not present.
|
||||
*
|
||||
* @param fqdn
|
||||
* {@link RecordId#getFQDN()}
|
||||
* @param recordId
|
||||
* {@link RecordId#getId()}
|
||||
* @return null if not found
|
||||
*/
|
||||
SOARecord getSOA(String fqdn, long recordId);
|
||||
|
||||
/**
|
||||
* Gets the {@link SRVRecord} or null if not present.
|
||||
*
|
||||
* @param fqdn
|
||||
* {@link RecordId#getFQDN()}
|
||||
* @param recordId
|
||||
* {@link RecordId#getId()}
|
||||
* @return null if not found
|
||||
*/
|
||||
Record<SRVData> getSRV(String fqdn, long recordId);
|
||||
|
||||
/**
|
||||
* Gets the {@link TXTRecord} or null if not present.
|
||||
*
|
||||
* @param fqdn
|
||||
* {@link RecordId#getFQDN()}
|
||||
* @param recordId
|
||||
* {@link RecordId#getId()}
|
||||
* @return null if not found
|
||||
*/
|
||||
Record<TXTData> getTXT(String fqdn, long recordId);
|
||||
}
|
|
@ -0,0 +1,197 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, String 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.dynect.v3.features;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
|
||||
import static org.jclouds.http.Uris.uriBuilder;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.inject.Named;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.Produces;
|
||||
|
||||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.dynect.v3.domain.Record;
|
||||
import org.jclouds.dynect.v3.domain.RecordId;
|
||||
import org.jclouds.dynect.v3.domain.SOARecord;
|
||||
import org.jclouds.dynect.v3.domain.rdata.AAAAData;
|
||||
import org.jclouds.dynect.v3.domain.rdata.AData;
|
||||
import org.jclouds.dynect.v3.domain.rdata.CNAMEData;
|
||||
import org.jclouds.dynect.v3.domain.rdata.MXData;
|
||||
import org.jclouds.dynect.v3.domain.rdata.NSData;
|
||||
import org.jclouds.dynect.v3.domain.rdata.PTRData;
|
||||
import org.jclouds.dynect.v3.domain.rdata.SRVData;
|
||||
import org.jclouds.dynect.v3.domain.rdata.TXTData;
|
||||
import org.jclouds.dynect.v3.filters.SessionManager;
|
||||
import org.jclouds.dynect.v3.functions.ToRecordIds;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.rest.Binder;
|
||||
import org.jclouds.rest.annotations.BinderParam;
|
||||
import org.jclouds.rest.annotations.Fallback;
|
||||
import org.jclouds.rest.annotations.Headers;
|
||||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
import org.jclouds.rest.annotations.ResponseParser;
|
||||
import org.jclouds.rest.annotations.SelectJson;
|
||||
|
||||
import com.google.common.collect.FluentIterable;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
*
|
||||
* @see RecordApi
|
||||
* @see <a
|
||||
* href="https://manage.dynect.net/help/docs/api2/rest/resources/AllRecord.html">doc</a>
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
// required for all calls
|
||||
@Produces(APPLICATION_JSON)
|
||||
@Headers(keys = "API-Version", values = "{jclouds.api-version}")
|
||||
@RequestFilters(SessionManager.class)
|
||||
public interface RecordAsyncApi {
|
||||
|
||||
/**
|
||||
* @see RecordApi#list
|
||||
*/
|
||||
@Named("GetAllRecord")
|
||||
@GET
|
||||
@Path("/AllRecord/{zone}")
|
||||
@ResponseParser(ToRecordIds.class)
|
||||
ListenableFuture<FluentIterable<RecordId>> list();
|
||||
|
||||
/**
|
||||
* @see RecordApi#get
|
||||
*/
|
||||
@Named("GetRecord")
|
||||
@GET
|
||||
@SelectJson("data")
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
ListenableFuture<Record<? extends Map<String, Object>>> get(@BinderParam(RecordIdBinder.class) RecordId recordId);
|
||||
|
||||
static class RecordIdBinder implements Binder {
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <R extends HttpRequest> R bindToRequest(R request, Object recordId) {
|
||||
RecordId valueToAppend = RecordId.class.cast(checkNotNull(recordId, "recordId"));
|
||||
URI path = uriBuilder(request.getEndpoint())
|
||||
.appendPath("/{type}Record/{zone}/{fqdn}/{id}")
|
||||
.build(ImmutableMap.<String, Object> builder()
|
||||
.put("type", valueToAppend.getType())
|
||||
.put("zone", valueToAppend.getZone())
|
||||
.put("fqdn", valueToAppend.getFQDN())
|
||||
.put("id", valueToAppend.getId()).build());
|
||||
return (R) request.toBuilder().endpoint(path).build();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see RecordApi#getAAAA
|
||||
*/
|
||||
@Named("GetAAAARecord")
|
||||
@GET
|
||||
@Path("/AAAARecord/{zone}/{fqdn}/{id}")
|
||||
@SelectJson("data")
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
ListenableFuture<Record<AAAAData>> getAAAA(@PathParam("fqdn") String fqdn, @PathParam("id") long recordId);
|
||||
|
||||
/**
|
||||
* @see RecordApi#getA
|
||||
*/
|
||||
@Named("GetARecord")
|
||||
@GET
|
||||
@Path("/ARecord/{zone}/{fqdn}/{id}")
|
||||
@SelectJson("data")
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
ListenableFuture<Record<AData>> getA(@PathParam("fqdn") String fqdn, @PathParam("id") long recordId);
|
||||
|
||||
/**
|
||||
* @see RecordApi#getCNAME
|
||||
*/
|
||||
@Named("GetCNAMERecord")
|
||||
@GET
|
||||
@Path("/CNAMERecord/{zone}/{fqdn}/{id}")
|
||||
@SelectJson("data")
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
ListenableFuture<Record<CNAMEData>> getCNAME(@PathParam("fqdn") String fqdn, @PathParam("id") long recordId);
|
||||
|
||||
/**
|
||||
* @see RecordApi#getMX
|
||||
*/
|
||||
@Named("GetMXRecord")
|
||||
@GET
|
||||
@Path("/MXRecord/{zone}/{fqdn}/{id}")
|
||||
@SelectJson("data")
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
ListenableFuture<Record<MXData>> getMX(@PathParam("fqdn") String fqdn, @PathParam("id") long recordId);
|
||||
|
||||
/**
|
||||
* @see RecordApi#getNS
|
||||
*/
|
||||
@Named("GetNSRecord")
|
||||
@GET
|
||||
@Path("/NSRecord/{zone}/{fqdn}/{id}")
|
||||
@SelectJson("data")
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
ListenableFuture<Record<NSData>> getNS(@PathParam("fqdn") String fqdn, @PathParam("id") long recordId);
|
||||
|
||||
/**
|
||||
* @see RecordApi#getPTR
|
||||
*/
|
||||
@Named("GetPTRRecord")
|
||||
@GET
|
||||
@Path("/PTRRecord/{zone}/{fqdn}/{id}")
|
||||
@SelectJson("data")
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
ListenableFuture<Record<PTRData>> getPTR(@PathParam("fqdn") String fqdn, @PathParam("id") long recordId);
|
||||
|
||||
/**
|
||||
* @see RecordApi#getSOA
|
||||
*/
|
||||
@Named("GetSOARecord")
|
||||
@GET
|
||||
@Path("/SOARecord/{zone}/{fqdn}/{id}")
|
||||
@SelectJson("data")
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
ListenableFuture<SOARecord> getSOA(@PathParam("fqdn") String fqdn, @PathParam("id") long recordId);
|
||||
|
||||
/**
|
||||
* @see RecordApi#getSRV
|
||||
*/
|
||||
@Named("GetSRVRecord")
|
||||
@GET
|
||||
@Path("/SRVRecord/{zone}/{fqdn}/{id}")
|
||||
@SelectJson("data")
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
ListenableFuture<Record<SRVData>> getSRV(@PathParam("fqdn") String fqdn, @PathParam("id") long recordId);
|
||||
|
||||
/**
|
||||
* @see RecordApi#getTXT
|
||||
*/
|
||||
@Named("GetTXTRecord")
|
||||
@GET
|
||||
@Path("/TXTRecord/{zone}/{fqdn}/{id}")
|
||||
@SelectJson("data")
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
ListenableFuture<Record<TXTData>> getTXT(@PathParam("fqdn") String fqdn, @PathParam("id") long recordId);
|
||||
}
|
|
@ -36,7 +36,7 @@ import org.jclouds.dynect.v3.domain.CreatePrimaryZone.ToFQDN;
|
|||
import org.jclouds.dynect.v3.domain.Job;
|
||||
import org.jclouds.dynect.v3.domain.Zone;
|
||||
import org.jclouds.dynect.v3.filters.SessionManager;
|
||||
import org.jclouds.dynect.v3.functions.ExtractNames;
|
||||
import org.jclouds.dynect.v3.functions.ExtractZoneNames;
|
||||
import org.jclouds.rest.annotations.BinderParam;
|
||||
import org.jclouds.rest.annotations.Fallback;
|
||||
import org.jclouds.rest.annotations.Headers;
|
||||
|
@ -71,7 +71,7 @@ public interface ZoneAsyncApi {
|
|||
@Named("ListZones")
|
||||
@GET
|
||||
@SelectJson("data")
|
||||
@Transform(ExtractNames.class)
|
||||
@Transform(ExtractZoneNames.class)
|
||||
ListenableFuture<FluentIterable<String>> list();
|
||||
|
||||
/**
|
||||
|
|
|
@ -28,7 +28,7 @@ import com.google.common.collect.FluentIterable;
|
|||
* @author Adrian Cole
|
||||
*
|
||||
*/
|
||||
public final class ExtractNames implements Function<FluentIterable<String>, FluentIterable<String>> {
|
||||
public final class ExtractZoneNames implements Function<FluentIterable<String>, FluentIterable<String>> {
|
||||
public FluentIterable<String> apply(FluentIterable<String> in) {
|
||||
return in.transform(ExtractNameInPath.INSTANCE);
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, String 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.dynect.v3.functions;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.jclouds.dynect.v3.domain.RecordId;
|
||||
import org.jclouds.http.HttpResponse;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.json.internal.GsonWrapper;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.FluentIterable;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.TypeLiteral;
|
||||
|
||||
/**
|
||||
* Records come back encoded in REST paths, such as
|
||||
* {@code /REST/NSRecord/adrianc.zone.dynecttest.jclouds.org/adrianc.zone.dynecttest.jclouds.org/50976583}
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*
|
||||
*/
|
||||
public final class ToRecordIds implements Function<HttpResponse, FluentIterable<RecordId>> {
|
||||
private final ParseFirstJsonValueNamed<FluentIterable<String>> parser;
|
||||
|
||||
@Inject
|
||||
public ToRecordIds(GsonWrapper gsonView) {
|
||||
this.parser = new ParseFirstJsonValueNamed<FluentIterable<String>>(checkNotNull(gsonView, "gsonView"),
|
||||
new TypeLiteral<FluentIterable<String>>() {
|
||||
}, "data");
|
||||
}
|
||||
|
||||
public FluentIterable<RecordId> apply(HttpResponse response) {
|
||||
checkNotNull(response, "response");
|
||||
return parser.apply(response).transform(ParsePath.INSTANCE);
|
||||
}
|
||||
|
||||
static enum ParsePath implements Function<String, RecordId> {
|
||||
INSTANCE;
|
||||
public static final Pattern DEFAULT_PATTERN = Pattern.compile("/REST/([a-zA-Z]+)Record/(.*)/(.*)/([0-9]+)");
|
||||
|
||||
public RecordId apply(String in) {
|
||||
Matcher matcher = DEFAULT_PATTERN.matcher(in);
|
||||
checkState(matcher.find() && matcher.groupCount() == 4, "%s didn't match %s", in, DEFAULT_PATTERN);
|
||||
return RecordId.builder().type(matcher.group(1)).zone(matcher.group(2)).fqdn(matcher.group(3))
|
||||
.id(Long.parseLong(matcher.group(4))).build();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, String 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.dynect.v3.predicates;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import org.jclouds.dynect.v3.domain.RecordId;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
|
||||
/**
|
||||
* Predicates handy when working with Records
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public class RecordPredicates {
|
||||
|
||||
/**
|
||||
* matches type of the given record
|
||||
*
|
||||
* @param type
|
||||
* @return predicate that matches type
|
||||
*/
|
||||
public static <R extends RecordId> Predicate<R> typeEquals(final String type) {
|
||||
checkNotNull(type, "type must be defined");
|
||||
|
||||
return new Predicate<R>() {
|
||||
@Override
|
||||
public boolean apply(R record) {
|
||||
return type.equals(record.getType());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "typeEquals(" + type + ")";
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
|
@ -0,0 +1,302 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, String 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.dynect.v3.features;
|
||||
|
||||
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertNull;
|
||||
|
||||
import org.jclouds.dynect.v3.DynECTApi;
|
||||
import org.jclouds.dynect.v3.domain.RecordId;
|
||||
import org.jclouds.dynect.v3.internal.BaseDynECTApiExpectTest;
|
||||
import org.jclouds.dynect.v3.parse.GetAAAARecordResponseTest;
|
||||
import org.jclouds.dynect.v3.parse.GetARecordResponseTest;
|
||||
import org.jclouds.dynect.v3.parse.GetCNAMERecordResponseTest;
|
||||
import org.jclouds.dynect.v3.parse.GetMXRecordResponseTest;
|
||||
import org.jclouds.dynect.v3.parse.GetNSRecordResponseTest;
|
||||
import org.jclouds.dynect.v3.parse.GetPTRRecordResponseTest;
|
||||
import org.jclouds.dynect.v3.parse.GetRecordResponseTest;
|
||||
import org.jclouds.dynect.v3.parse.GetSOARecordResponseTest;
|
||||
import org.jclouds.dynect.v3.parse.GetSRVRecordResponseTest;
|
||||
import org.jclouds.dynect.v3.parse.GetTXTRecordResponseTest;
|
||||
import org.jclouds.dynect.v3.parse.ListRecordsResponseTest;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.HttpResponse;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "unit", testName = "RecordApiExpectTest")
|
||||
public class RecordApiExpectTest extends BaseDynECTApiExpectTest {
|
||||
HttpRequest getSOA = HttpRequest.builder().method("GET")
|
||||
.endpoint("https://api2.dynect.net/REST/SOARecord/adrianc.zone.dynecttest.jclouds.org/adrianc.zone.dynecttest.jclouds.org/50976579")
|
||||
.addHeader("API-Version", "3.3.7")
|
||||
.addHeader("Auth-Token", authToken)
|
||||
.payload(emptyJsonPayload()).build();
|
||||
|
||||
HttpResponse soaResponse = HttpResponse.builder().statusCode(200)
|
||||
.payload(payloadFromResourceWithContentType("/get_record_soa.json", APPLICATION_JSON)).build();
|
||||
|
||||
RecordId soaId = RecordId.builder()
|
||||
.zone("adrianc.zone.dynecttest.jclouds.org")
|
||||
.fqdn("adrianc.zone.dynecttest.jclouds.org")
|
||||
.type("SOA")
|
||||
.id(50976579l).build();
|
||||
|
||||
public void testGetWhenResponseIs2xx() {
|
||||
DynECTApi success = requestsSendResponses(createSession, createSessionResponse, getSOA, soaResponse);
|
||||
assertEquals(success.getRecordApiForZone("adrianc.zone.dynecttest.jclouds.org").get(soaId).toString(),
|
||||
new GetRecordResponseTest().expected().toString());
|
||||
}
|
||||
|
||||
public void testGetWhenResponseIs404() {
|
||||
DynECTApi fail = requestsSendResponses(createSession, createSessionResponse, getSOA, notFound);
|
||||
assertNull(fail.getRecordApiForZone("adrianc.zone.dynecttest.jclouds.org").get(soaId));
|
||||
}
|
||||
|
||||
HttpRequest getAAAA = HttpRequest.builder().method("GET")
|
||||
.endpoint("https://api2.dynect.net/REST/AAAARecord/adrianc.zone.dynecttest.jclouds.org/adrianc.zone.dynecttest.jclouds.org/50976579")
|
||||
.addHeader("API-Version", "3.3.7")
|
||||
.addHeader("Auth-Token", authToken)
|
||||
.payload(emptyJsonPayload()).build();
|
||||
|
||||
HttpResponse aaaaResponse = HttpResponse.builder().statusCode(200)
|
||||
.payload(payloadFromResourceWithContentType("/get_record_aaaa.json", APPLICATION_JSON)).build();
|
||||
|
||||
RecordId aaaaId = RecordId.builder()
|
||||
.zone("adrianc.zone.dynecttest.jclouds.org")
|
||||
.fqdn("adrianc.zone.dynecttest.jclouds.org")
|
||||
.type("AAAA")
|
||||
.id(50976579l).build();
|
||||
|
||||
public void testGetAAAAWhenResponseIs2xx() {
|
||||
DynECTApi success = requestsSendResponses(createSession, createSessionResponse, getAAAA, aaaaResponse);
|
||||
assertEquals(success.getRecordApiForZone("adrianc.zone.dynecttest.jclouds.org").getAAAA(aaaaId.getFQDN(), aaaaId.getId()).toString(),
|
||||
new GetAAAARecordResponseTest().expected().toString());
|
||||
}
|
||||
|
||||
public void testGetAAAAWhenResponseIs404() {
|
||||
DynECTApi fail = requestsSendResponses(createSession, createSessionResponse, getAAAA, notFound);
|
||||
assertNull(fail.getRecordApiForZone("adrianc.zone.dynecttest.jclouds.org").getAAAA(aaaaId.getFQDN(), aaaaId.getId()));
|
||||
}
|
||||
|
||||
HttpRequest getA = HttpRequest.builder().method("GET")
|
||||
.endpoint("https://api2.dynect.net/REST/ARecord/adrianc.zone.dynecttest.jclouds.org/adrianc.zone.dynecttest.jclouds.org/50976579")
|
||||
.addHeader("API-Version", "3.3.7")
|
||||
.addHeader("Auth-Token", authToken)
|
||||
.payload(emptyJsonPayload()).build();
|
||||
|
||||
HttpResponse aResponse = HttpResponse.builder().statusCode(200)
|
||||
.payload(payloadFromResourceWithContentType("/get_record_a.json", APPLICATION_JSON)).build();
|
||||
|
||||
RecordId aId = RecordId.builder()
|
||||
.zone("adrianc.zone.dynecttest.jclouds.org")
|
||||
.fqdn("adrianc.zone.dynecttest.jclouds.org")
|
||||
.type("A")
|
||||
.id(50976579l).build();
|
||||
|
||||
public void testGetAWhenResponseIs2xx() {
|
||||
DynECTApi success = requestsSendResponses(createSession, createSessionResponse, getA, aResponse);
|
||||
assertEquals(success.getRecordApiForZone("adrianc.zone.dynecttest.jclouds.org").getA(aId.getFQDN(), aId.getId()).toString(),
|
||||
new GetARecordResponseTest().expected().toString());
|
||||
}
|
||||
|
||||
public void testGetAWhenResponseIs404() {
|
||||
DynECTApi fail = requestsSendResponses(createSession, createSessionResponse, getA, notFound);
|
||||
assertNull(fail.getRecordApiForZone("adrianc.zone.dynecttest.jclouds.org").getA(aId.getFQDN(), aId.getId()));
|
||||
}
|
||||
|
||||
HttpRequest getCNAME = HttpRequest.builder().method("GET")
|
||||
.endpoint("https://api2.dynect.net/REST/CNAMERecord/adrianc.zone.dynecttest.jclouds.org/adrianc.zone.dynecttest.jclouds.org/50976579")
|
||||
.addHeader("API-Version", "3.3.7")
|
||||
.addHeader("Auth-Token", authToken)
|
||||
.payload(emptyJsonPayload()).build();
|
||||
|
||||
HttpResponse cnameResponse = HttpResponse.builder().statusCode(200)
|
||||
.payload(payloadFromResourceWithContentType("/get_record_cname.json", APPLICATION_JSON)).build();
|
||||
|
||||
RecordId cnameId = RecordId.builder()
|
||||
.zone("adrianc.zone.dynecttest.jclouds.org")
|
||||
.fqdn("adrianc.zone.dynecttest.jclouds.org")
|
||||
.type("CNAME")
|
||||
.id(50976579l).build();
|
||||
|
||||
public void testGetCNAMEWhenResponseIs2xx() {
|
||||
DynECTApi success = requestsSendResponses(createSession, createSessionResponse, getCNAME, cnameResponse);
|
||||
assertEquals(success.getRecordApiForZone("adrianc.zone.dynecttest.jclouds.org").getCNAME(cnameId.getFQDN(), cnameId.getId()).toString(),
|
||||
new GetCNAMERecordResponseTest().expected().toString());
|
||||
}
|
||||
|
||||
public void testGetCNAMEWhenResponseIs404() {
|
||||
DynECTApi fail = requestsSendResponses(createSession, createSessionResponse, getCNAME, notFound);
|
||||
assertNull(fail.getRecordApiForZone("adrianc.zone.dynecttest.jclouds.org").getCNAME(cnameId.getFQDN(), cnameId.getId()));
|
||||
}
|
||||
|
||||
HttpRequest getMX = HttpRequest.builder().method("GET")
|
||||
.endpoint("https://api2.dynect.net/REST/MXRecord/adrianc.zone.dynecttest.jclouds.org/adrianc.zone.dynecttest.jclouds.org/50976579")
|
||||
.addHeader("API-Version", "3.3.7")
|
||||
.addHeader("Auth-Token", authToken)
|
||||
.payload(emptyJsonPayload()).build();
|
||||
|
||||
HttpResponse mxResponse = HttpResponse.builder().statusCode(200)
|
||||
.payload(payloadFromResourceWithContentType("/get_record_mx.json", APPLICATION_JSON)).build();
|
||||
|
||||
RecordId mxId = RecordId.builder()
|
||||
.zone("adrianc.zone.dynecttest.jclouds.org")
|
||||
.fqdn("adrianc.zone.dynecttest.jclouds.org")
|
||||
.type("MX")
|
||||
.id(50976579l).build();
|
||||
|
||||
public void testGetMXWhenResponseIs2xx() {
|
||||
DynECTApi success = requestsSendResponses(createSession, createSessionResponse, getMX, mxResponse);
|
||||
assertEquals(success.getRecordApiForZone("adrianc.zone.dynecttest.jclouds.org").getMX(mxId.getFQDN(), mxId.getId()).toString(),
|
||||
new GetMXRecordResponseTest().expected().toString());
|
||||
}
|
||||
|
||||
public void testGetMXWhenResponseIs404() {
|
||||
DynECTApi fail = requestsSendResponses(createSession, createSessionResponse, getMX, notFound);
|
||||
assertNull(fail.getRecordApiForZone("adrianc.zone.dynecttest.jclouds.org").getMX(mxId.getFQDN(), mxId.getId()));
|
||||
}
|
||||
|
||||
HttpRequest getNS = HttpRequest.builder().method("GET")
|
||||
.endpoint("https://api2.dynect.net/REST/NSRecord/adrianc.zone.dynecttest.jclouds.org/adrianc.zone.dynecttest.jclouds.org/50976579")
|
||||
.addHeader("API-Version", "3.3.7")
|
||||
.addHeader("Auth-Token", authToken)
|
||||
.payload(emptyJsonPayload()).build();
|
||||
|
||||
HttpResponse nsResponse = HttpResponse.builder().statusCode(200)
|
||||
.payload(payloadFromResourceWithContentType("/get_record_ns.json", APPLICATION_JSON)).build();
|
||||
|
||||
RecordId nsId = RecordId.builder()
|
||||
.zone("adrianc.zone.dynecttest.jclouds.org")
|
||||
.fqdn("adrianc.zone.dynecttest.jclouds.org")
|
||||
.type("NS")
|
||||
.id(50976579l).build();
|
||||
|
||||
public void testGetNSWhenResponseIs2xx() {
|
||||
DynECTApi success = requestsSendResponses(createSession, createSessionResponse, getNS, nsResponse);
|
||||
assertEquals(success.getRecordApiForZone("adrianc.zone.dynecttest.jclouds.org").getNS(nsId.getFQDN(), nsId.getId()).toString(),
|
||||
new GetNSRecordResponseTest().expected().toString());
|
||||
}
|
||||
|
||||
public void testGetNSWhenResponseIs404() {
|
||||
DynECTApi fail = requestsSendResponses(createSession, createSessionResponse, getNS, notFound);
|
||||
assertNull(fail.getRecordApiForZone("adrianc.zone.dynecttest.jclouds.org").getNS(nsId.getFQDN(), nsId.getId()));
|
||||
}
|
||||
|
||||
HttpRequest getPTR = HttpRequest.builder().method("GET")
|
||||
.endpoint("https://api2.dynect.net/REST/PTRRecord/adrianc.zone.dynecttest.jclouds.org/adrianc.zone.dynecttest.jclouds.org/50976579")
|
||||
.addHeader("API-Version", "3.3.7")
|
||||
.addHeader("Auth-Token", authToken)
|
||||
.payload(emptyJsonPayload()).build();
|
||||
|
||||
HttpResponse ptrResponse = HttpResponse.builder().statusCode(200)
|
||||
.payload(payloadFromResourceWithContentType("/get_record_ptr.json", APPLICATION_JSON)).build();
|
||||
|
||||
RecordId ptrId = RecordId.builder()
|
||||
.zone("adrianc.zone.dynecttest.jclouds.org")
|
||||
.fqdn("adrianc.zone.dynecttest.jclouds.org")
|
||||
.type("PTR")
|
||||
.id(50976579l).build();
|
||||
|
||||
public void testGetPTRWhenResponseIs2xx() {
|
||||
DynECTApi success = requestsSendResponses(createSession, createSessionResponse, getPTR, ptrResponse);
|
||||
assertEquals(success.getRecordApiForZone("adrianc.zone.dynecttest.jclouds.org").getPTR(ptrId.getFQDN(), ptrId.getId()).toString(),
|
||||
new GetPTRRecordResponseTest().expected().toString());
|
||||
}
|
||||
|
||||
public void testGetPTRWhenResponseIs404() {
|
||||
DynECTApi fail = requestsSendResponses(createSession, createSessionResponse, getPTR, notFound);
|
||||
assertNull(fail.getRecordApiForZone("adrianc.zone.dynecttest.jclouds.org").getPTR(ptrId.getFQDN(), ptrId.getId()));
|
||||
}
|
||||
|
||||
public void testGetSOAWhenResponseIs2xx() {
|
||||
DynECTApi success = requestsSendResponses(createSession, createSessionResponse, getSOA, soaResponse);
|
||||
assertEquals(success.getRecordApiForZone("adrianc.zone.dynecttest.jclouds.org").getSOA(soaId.getFQDN(), soaId.getId()).toString(),
|
||||
new GetSOARecordResponseTest().expected().toString());
|
||||
}
|
||||
|
||||
public void testGetSOAWhenResponseIs404() {
|
||||
DynECTApi fail = requestsSendResponses(createSession, createSessionResponse, getSOA, notFound);
|
||||
assertNull(fail.getRecordApiForZone("adrianc.zone.dynecttest.jclouds.org").getSOA(soaId.getFQDN(), soaId.getId()));
|
||||
}
|
||||
|
||||
HttpRequest getSRV = HttpRequest.builder().method("GET")
|
||||
.endpoint("https://api2.dynect.net/REST/SRVRecord/adrianc.zone.dynecttest.jclouds.org/adrianc.zone.dynecttest.jclouds.org/50976579")
|
||||
.addHeader("API-Version", "3.3.7")
|
||||
.addHeader("Auth-Token", authToken)
|
||||
.payload(emptyJsonPayload()).build();
|
||||
|
||||
HttpResponse srvResponse = HttpResponse.builder().statusCode(200)
|
||||
.payload(payloadFromResourceWithContentType("/get_record_srv.json", APPLICATION_JSON)).build();
|
||||
|
||||
RecordId srvId = RecordId.builder()
|
||||
.zone("adrianc.zone.dynecttest.jclouds.org")
|
||||
.fqdn("adrianc.zone.dynecttest.jclouds.org")
|
||||
.type("SRV")
|
||||
.id(50976579l).build();
|
||||
|
||||
public void testGetSRVWhenResponseIs2xx() {
|
||||
DynECTApi success = requestsSendResponses(createSession, createSessionResponse, getSRV, srvResponse);
|
||||
assertEquals(success.getRecordApiForZone("adrianc.zone.dynecttest.jclouds.org").getSRV(srvId.getFQDN(), srvId.getId()).toString(),
|
||||
new GetSRVRecordResponseTest().expected().toString());
|
||||
}
|
||||
|
||||
HttpRequest getTXT = HttpRequest.builder().method("GET")
|
||||
.endpoint("https://api2.dynect.net/REST/TXTRecord/adrianc.zone.dynecttest.jclouds.org/adrianc.zone.dynecttest.jclouds.org/50976579")
|
||||
.addHeader("API-Version", "3.3.7")
|
||||
.addHeader("Auth-Token", authToken)
|
||||
.payload(emptyJsonPayload()).build();
|
||||
|
||||
HttpResponse txtResponse = HttpResponse.builder().statusCode(200)
|
||||
.payload(payloadFromResourceWithContentType("/get_record_txt.json", APPLICATION_JSON)).build();
|
||||
|
||||
RecordId txtId = RecordId.builder()
|
||||
.zone("adrianc.zone.dynecttest.jclouds.org")
|
||||
.fqdn("adrianc.zone.dynecttest.jclouds.org")
|
||||
.type("TXT")
|
||||
.id(50976579l).build();
|
||||
|
||||
public void testGetTXTWhenResponseIs2xx() {
|
||||
DynECTApi success = requestsSendResponses(createSession, createSessionResponse, getTXT, txtResponse);
|
||||
assertEquals(success.getRecordApiForZone("adrianc.zone.dynecttest.jclouds.org").getTXT(txtId.getFQDN(), txtId.getId()).toString(),
|
||||
new GetTXTRecordResponseTest().expected().toString());
|
||||
}
|
||||
|
||||
public void testGetTXTWhenResponseIs404() {
|
||||
DynECTApi fail = requestsSendResponses(createSession, createSessionResponse, getTXT, notFound);
|
||||
assertNull(fail.getRecordApiForZone("adrianc.zone.dynecttest.jclouds.org").getTXT(txtId.getFQDN(), txtId.getId()));
|
||||
}
|
||||
|
||||
HttpRequest list = HttpRequest.builder().method("GET")
|
||||
.endpoint("https://api2.dynect.net/REST/AllRecord/adrianc.zone.dynecttest.jclouds.org")
|
||||
.addHeader("API-Version", "3.3.7")
|
||||
.addHeader("Auth-Token", authToken)
|
||||
.payload(emptyJsonPayload()).build();
|
||||
|
||||
HttpResponse listResponse = HttpResponse.builder().statusCode(200)
|
||||
.payload(payloadFromResourceWithContentType("/list_records.json", APPLICATION_JSON)).build();
|
||||
|
||||
public void testListWhenResponseIs2xx() {
|
||||
DynECTApi success = requestsSendResponses(createSession, createSessionResponse, list, listResponse);
|
||||
assertEquals(success.getRecordApiForZone("adrianc.zone.dynecttest.jclouds.org").list().toString(),
|
||||
new ListRecordsResponseTest().expected().toString());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,165 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, String 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.dynect.v3.features;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static java.util.logging.Logger.getAnonymousLogger;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.jclouds.dynect.v3.domain.Record;
|
||||
import org.jclouds.dynect.v3.domain.RecordId;
|
||||
import org.jclouds.dynect.v3.domain.SOARecord;
|
||||
import org.jclouds.dynect.v3.domain.rdata.AAAAData;
|
||||
import org.jclouds.dynect.v3.domain.rdata.AData;
|
||||
import org.jclouds.dynect.v3.domain.rdata.CNAMEData;
|
||||
import org.jclouds.dynect.v3.domain.rdata.MXData;
|
||||
import org.jclouds.dynect.v3.domain.rdata.NSData;
|
||||
import org.jclouds.dynect.v3.domain.rdata.PTRData;
|
||||
import org.jclouds.dynect.v3.domain.rdata.SOAData;
|
||||
import org.jclouds.dynect.v3.domain.rdata.SRVData;
|
||||
import org.jclouds.dynect.v3.domain.rdata.TXTData;
|
||||
import org.jclouds.dynect.v3.internal.BaseDynECTApiLiveTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live", singleThreaded = true, testName = "RecordApiLiveTest")
|
||||
public class RecordApiLiveTest extends BaseDynECTApiLiveTest {
|
||||
|
||||
private void checkRecordId(RecordId record) {
|
||||
assertTrue(record.getId() > 0, "Id cannot be zero for RecordId: " + record);
|
||||
checkNotNull(record.getType(), "Type cannot be null for RecordId: %s", record);
|
||||
checkNotNull(record.getFQDN(), "FQDN cannot be null for RecordId: %s", record);
|
||||
checkNotNull(record.getZone(), "Serial cannot be null for RecordId: %s", record);
|
||||
}
|
||||
|
||||
private void checkRecord(Record<? extends Map<String, Object>> record) {
|
||||
checkRecordId(record);
|
||||
assertTrue(record.getRData().size() > 0, "RData entries should be present for cannot be zero for Record: "
|
||||
+ record);
|
||||
assertTrue(record.getTTL() > -1, "TTL cannot be negative for RecordId: " + record);
|
||||
}
|
||||
|
||||
@Test
|
||||
protected void testListAndGetRecords() {
|
||||
for (String zone : context.getApi().getZoneApi().list()) {
|
||||
RecordApi api = context.getApi().getRecordApiForZone(zone);
|
||||
ImmutableList<RecordId> records = api.list().toList();
|
||||
getAnonymousLogger().info("zone: " + zone + " record count: " + records.size());
|
||||
|
||||
for (RecordId recordId : records) {
|
||||
Record<? extends Map<String, Object>> record;
|
||||
if ("AAAA".equals(recordId.getType())) {
|
||||
record = checkAAAARecord(api.getAAAA(recordId.getFQDN(), recordId.getId()));
|
||||
} else if ("A".equals(recordId.getType())) {
|
||||
record = checkARecord(api.getA(recordId.getFQDN(), recordId.getId()));
|
||||
} else if ("CNAME".equals(recordId.getType())) {
|
||||
record = checkCNAMERecord(api.getCNAME(recordId.getFQDN(), recordId.getId()));
|
||||
} else if ("MX".equals(recordId.getType())) {
|
||||
record = checkMXRecord(api.getMX(recordId.getFQDN(), recordId.getId()));
|
||||
} else if ("NS".equals(recordId.getType())) {
|
||||
record = checkNSRecord(api.getNS(recordId.getFQDN(), recordId.getId()));
|
||||
} else if ("PTR".equals(recordId.getType())) {
|
||||
record = checkPTRRecord(api.getPTR(recordId.getFQDN(), recordId.getId()));
|
||||
} else if ("SOA".equals(recordId.getType())) {
|
||||
record = checkSOARecord(api.getSOA(recordId.getFQDN(), recordId.getId()));
|
||||
} else if ("SRV".equals(recordId.getType())) {
|
||||
record = checkSRVRecord(api.getSRV(recordId.getFQDN(), recordId.getId()));
|
||||
} else if ("TXT".equals(recordId.getType())) {
|
||||
record = checkTXTRecord(api.getTXT(recordId.getFQDN(), recordId.getId()));
|
||||
} else {
|
||||
record = api.get(recordId);
|
||||
}
|
||||
assertEquals(record, recordId);
|
||||
checkRecord(record);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Record<AAAAData> checkAAAARecord(Record<AAAAData> record) {
|
||||
AAAAData rdata = record.getRData();
|
||||
checkNotNull(rdata.getAddress(), "rdata.address cannot be null for AAAARecord: %s", record);
|
||||
return record;
|
||||
}
|
||||
|
||||
private Record<AData> checkARecord(Record<AData> record) {
|
||||
AData rdata = record.getRData();
|
||||
checkNotNull(rdata.getAddress(), "rdata.address cannot be null for ARecord: %s", record);
|
||||
return record;
|
||||
}
|
||||
|
||||
private Record<CNAMEData> checkCNAMERecord(Record<CNAMEData> record) {
|
||||
CNAMEData rdata = record.getRData();
|
||||
checkNotNull(rdata.getCname(), "rdata.cname cannot be null for CNAMERecord: %s", record);
|
||||
return record;
|
||||
}
|
||||
|
||||
private Record<MXData> checkMXRecord(Record<MXData> record) {
|
||||
MXData rdata = record.getRData();
|
||||
checkNotNull(rdata.getPreference(), "rdata.preference cannot be null for MXRecord: %s", record);
|
||||
checkNotNull(rdata.getExchange(), "rdata.exchange cannot be null for MXRecord: %s", record);
|
||||
return record;
|
||||
}
|
||||
|
||||
private Record<NSData> checkNSRecord(Record<NSData> record) {
|
||||
NSData rdata = record.getRData();
|
||||
checkNotNull(rdata.getNsdname(), "rdata.nsdname cannot be null for NSRecord: %s", record);
|
||||
return record;
|
||||
}
|
||||
|
||||
private Record<PTRData> checkPTRRecord(Record<PTRData> record) {
|
||||
PTRData rdata = record.getRData();
|
||||
checkNotNull(rdata.getPtrdname(), "rdata.ptrdname cannot be null for PTRRecord: %s", record);
|
||||
return record;
|
||||
}
|
||||
|
||||
private SOARecord checkSOARecord(SOARecord record) {
|
||||
checkNotNull(record.getSerialStyle(), "SerialStyle cannot be null for SOARecord: %s", record);
|
||||
SOAData rdata = record.getRData();
|
||||
checkNotNull(rdata.getMname(), "rdata.mname cannot be null for SOARecord: %s", record);
|
||||
checkNotNull(rdata.getRname(), "rdata.rname cannot be null for SOARecord: %s", record);
|
||||
checkNotNull(rdata.getSerial(), "rdata.serial cannot be null for SOARecord: %s", record);
|
||||
checkNotNull(rdata.getRefresh(), "rdata.refresh cannot be null for SOARecord: %s", record);
|
||||
checkNotNull(rdata.getRetry(), "rdata.retry cannot be null for SOARecord: %s", record);
|
||||
checkNotNull(rdata.getExpire(), "rdata.expire cannot be null for SOARecord: %s", record);
|
||||
checkNotNull(rdata.getMinimum(), "rdata.minimum cannot be null for SOARecord: %s", record);
|
||||
return record;
|
||||
}
|
||||
|
||||
private Record<SRVData> checkSRVRecord(Record<SRVData> record) {
|
||||
SRVData rdata = record.getRData();
|
||||
checkNotNull(rdata.getPriority(), "rdata.priority cannot be null for SRVRecord: %s", record);
|
||||
checkNotNull(rdata.getWeight(), "rdata.weight cannot be null for SRVRecord: %s", record);
|
||||
checkNotNull(rdata.getPort(), "rdata.port cannot be null for SRVRecord: %s", record);
|
||||
checkNotNull(rdata.getTarget(), "rdata.target cannot be null for SRVRecord: %s", record);
|
||||
return record;
|
||||
}
|
||||
|
||||
private Record<TXTData> checkTXTRecord(Record<TXTData> record) {
|
||||
TXTData rdata = record.getRData();
|
||||
checkNotNull(rdata.getTxtdata(), "rdata.txtdata cannot be null for TXTRecord: %s", record);
|
||||
return record;
|
||||
}
|
||||
}
|
|
@ -21,7 +21,7 @@ package org.jclouds.dynect.v3.functions;
|
|||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import org.jclouds.dynect.v3.functions.ExtractNames.ExtractNameInPath;
|
||||
import org.jclouds.dynect.v3.functions.ExtractZoneNames.ExtractNameInPath;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.FluentIterable;
|
||||
|
@ -31,14 +31,14 @@ import com.google.common.collect.ImmutableSet;
|
|||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "unit")
|
||||
public class ExtractNamesTest {
|
||||
ExtractNames fn = new ExtractNames();
|
||||
public class ExtractZoneNamesTest {
|
||||
ExtractZoneNames fn = new ExtractZoneNames();
|
||||
|
||||
public void testExtractNameInPath() {
|
||||
assertEquals(ExtractNameInPath.INSTANCE.apply("/REST/Zone/jclouds.org/"), "jclouds.org");
|
||||
}
|
||||
|
||||
public void testExtractNames() {
|
||||
public void testExtractZoneNames() {
|
||||
assertEquals(fn.apply(FluentIterable.from(ImmutableSet.of("/REST/Zone/jclouds.org/"))).toSet(),
|
||||
ImmutableSet.of("jclouds.org"));
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.jclouds.dynect.v3.functions;
|
||||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import org.jclouds.dynect.v3.domain.RecordId;
|
||||
import org.jclouds.dynect.v3.functions.ToRecordIds.ParsePath;
|
||||
import org.jclouds.json.internal.GsonWrapper;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "unit")
|
||||
public class ToRecordIdsTest {
|
||||
ToRecordIds fn = new ToRecordIds(new GsonWrapper(new Gson()));
|
||||
RecordId recordId = RecordId.builder()
|
||||
.id(50976583)
|
||||
.type("NS")
|
||||
.zone("adrianc.zone.dynecttest.jclouds.org")
|
||||
.fqdn("adrianc.zone.dynecttest.jclouds.org")
|
||||
.build();
|
||||
|
||||
public void testParsePath() {
|
||||
assertEquals(
|
||||
ParsePath.INSTANCE
|
||||
.apply("/REST/NSRecord/adrianc.zone.dynecttest.jclouds.org/adrianc.zone.dynecttest.jclouds.org/50976583"),
|
||||
recordId);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, String 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.dynect.v3.parse;
|
||||
import static org.jclouds.dynect.v3.domain.rdata.AAAAData.aaaa;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.jclouds.dynect.v3.domain.Record;
|
||||
import org.jclouds.dynect.v3.domain.rdata.AAAAData;
|
||||
import org.jclouds.dynect.v3.internal.BaseDynECTParseTest;
|
||||
import org.jclouds.rest.annotations.SelectJson;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "unit")
|
||||
public class GetAAAARecordResponseTest extends BaseDynECTParseTest<Record<AAAAData>> {
|
||||
|
||||
@Override
|
||||
public String resource() {
|
||||
return "/get_record_aaaa.json";
|
||||
}
|
||||
|
||||
@Override
|
||||
@SelectJson("data")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
public Record<AAAAData> expected() {
|
||||
return Record.<AAAAData> builder()
|
||||
.zone("egg.org")
|
||||
.fqdn("egg.org")
|
||||
.type("AAAA")
|
||||
.id(50959331)
|
||||
.ttl(86400)
|
||||
.rdata(aaaa("2406:bbbb:ff00::6b14:aaaa"))
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, String 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.dynect.v3.parse;
|
||||
import static org.jclouds.dynect.v3.domain.rdata.AData.a;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.jclouds.dynect.v3.domain.Record;
|
||||
import org.jclouds.dynect.v3.domain.rdata.AData;
|
||||
import org.jclouds.dynect.v3.internal.BaseDynECTParseTest;
|
||||
import org.jclouds.rest.annotations.SelectJson;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "unit")
|
||||
public class GetARecordResponseTest extends BaseDynECTParseTest<Record<AData>> {
|
||||
|
||||
@Override
|
||||
public String resource() {
|
||||
return "/get_record_a.json";
|
||||
}
|
||||
|
||||
@Override
|
||||
@SelectJson("data")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
public Record<AData> expected() {
|
||||
return Record.<AData> builder()
|
||||
.zone("egg.org")
|
||||
.fqdn("egg.org")
|
||||
.type("A")
|
||||
.id(50959331)
|
||||
.ttl(86400)
|
||||
.rdata(a("1.1.1.1"))
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, String 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.dynect.v3.parse;
|
||||
import static org.jclouds.dynect.v3.domain.rdata.CNAMEData.cname;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.jclouds.dynect.v3.domain.Record;
|
||||
import org.jclouds.dynect.v3.domain.rdata.CNAMEData;
|
||||
import org.jclouds.dynect.v3.internal.BaseDynECTParseTest;
|
||||
import org.jclouds.rest.annotations.SelectJson;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "unit")
|
||||
public class GetCNAMERecordResponseTest extends BaseDynECTParseTest<Record<CNAMEData>> {
|
||||
|
||||
@Override
|
||||
public String resource() {
|
||||
return "/get_record_cname.json";
|
||||
}
|
||||
|
||||
@Override
|
||||
@SelectJson("data")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
public Record<CNAMEData> expected() {
|
||||
return Record.<CNAMEData> builder()
|
||||
.zone("egg.org")
|
||||
.fqdn("egg.org")
|
||||
.type("CNAME")
|
||||
.id(50959331)
|
||||
.ttl(86400)
|
||||
.rdata(cname("prod-LB-359594650.us-east-1.elb.amazonaws.com."))
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, String 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.dynect.v3.parse;
|
||||
import static org.jclouds.dynect.v3.domain.rdata.MXData.mx;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.jclouds.dynect.v3.domain.Record;
|
||||
import org.jclouds.dynect.v3.domain.rdata.MXData;
|
||||
import org.jclouds.dynect.v3.internal.BaseDynECTParseTest;
|
||||
import org.jclouds.rest.annotations.SelectJson;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "unit")
|
||||
public class GetMXRecordResponseTest extends BaseDynECTParseTest<Record<MXData>> {
|
||||
|
||||
@Override
|
||||
public String resource() {
|
||||
return "/get_record_mx.json";
|
||||
}
|
||||
|
||||
@Override
|
||||
@SelectJson("data")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
public Record<MXData> expected() {
|
||||
return Record.<MXData> builder()
|
||||
.zone("egg.org")
|
||||
.fqdn("egg.org")
|
||||
.type("MX")
|
||||
.id(50959331)
|
||||
.ttl(86400)
|
||||
.rdata(mx(10, "mail.egg.org."))
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.dynect.v3.parse;
|
||||
import static org.jclouds.dynect.v3.domain.rdata.NSData.ns;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.jclouds.dynect.v3.domain.Record;
|
||||
import org.jclouds.dynect.v3.domain.rdata.NSData;
|
||||
import org.jclouds.dynect.v3.internal.BaseDynECTParseTest;
|
||||
import org.jclouds.rest.annotations.SelectJson;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "unit")
|
||||
public class GetNSRecordResponseTest extends BaseDynECTParseTest<Record<NSData>> {
|
||||
|
||||
@Override
|
||||
public String resource() {
|
||||
return "/get_record_ns.json";
|
||||
}
|
||||
|
||||
@Override
|
||||
@SelectJson("data")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
public Record<NSData> expected() {
|
||||
return Record.<NSData> builder()
|
||||
.zone("egg.org")
|
||||
.fqdn("egg.org")
|
||||
.type("NS")
|
||||
.id(50959331)
|
||||
.ttl(86400)
|
||||
.rdata(ns("ns4.p28.dynect.net."))
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, String 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.dynect.v3.parse;
|
||||
import static org.jclouds.dynect.v3.domain.rdata.PTRData.ptr;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.jclouds.dynect.v3.domain.Record;
|
||||
import org.jclouds.dynect.v3.domain.rdata.PTRData;
|
||||
import org.jclouds.dynect.v3.internal.BaseDynECTParseTest;
|
||||
import org.jclouds.rest.annotations.SelectJson;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "unit")
|
||||
public class GetPTRRecordResponseTest extends BaseDynECTParseTest<Record<PTRData>> {
|
||||
|
||||
@Override
|
||||
public String resource() {
|
||||
return "/get_record_ptr.json";
|
||||
}
|
||||
|
||||
@Override
|
||||
@SelectJson("data")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
public Record<PTRData> expected() {
|
||||
return Record.<PTRData> builder()
|
||||
.zone("egg.org")
|
||||
.fqdn("1.2.3.0.0.0.0.0.0.0.0.0.0.0.0.0.d.9.2.1.4.0.0.7.0.c.6.8.0.0.a.2.ip6.arpa")
|
||||
.type("PTR")
|
||||
.id(50959331)
|
||||
.ttl(86400)
|
||||
.rdata(ptr("egg.org."))
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.dynect.v3.parse;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.jclouds.dynect.v3.domain.Record;
|
||||
import org.jclouds.dynect.v3.internal.BaseDynECTParseTest;
|
||||
import org.jclouds.rest.annotations.SelectJson;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "unit")
|
||||
public class GetRecordResponseTest extends BaseDynECTParseTest<Record<Map<String, Object>>> {
|
||||
|
||||
@Override
|
||||
public String resource() {
|
||||
return "/get_record_soa.json";
|
||||
}
|
||||
|
||||
@Override
|
||||
@SelectJson("data")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
public Record<Map<String, Object>> expected() {
|
||||
return Record.<Map<String, Object>> builder()
|
||||
.zone("adrianc.zone.dynecttest.jclouds.org")
|
||||
.fqdn("adrianc.zone.dynecttest.jclouds.org")
|
||||
.type("SOA")
|
||||
.id(50976579l)
|
||||
.ttl(3600)
|
||||
// TODO: default parse to unsigned
|
||||
.rdata(ImmutableMap.<String, Object> builder()
|
||||
.put("rname", "1\\.5\\.7-SNAPSHOT@jclouds.org.")
|
||||
.put("retry", 600.0)
|
||||
.put("mname", "ns1.p28.dynect.net.")
|
||||
.put("minimum", 60.0)
|
||||
.put("refresh", 3600.0)
|
||||
.put("expire", 604800.0)
|
||||
.put("serial", 1.0).build()).build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.dynect.v3.parse;
|
||||
|
||||
import static org.jclouds.dynect.v3.domain.Zone.SerialStyle.INCREMENT;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.jclouds.dynect.v3.domain.SOARecord;
|
||||
import org.jclouds.dynect.v3.domain.rdata.SOAData;
|
||||
import org.jclouds.dynect.v3.internal.BaseDynECTParseTest;
|
||||
import org.jclouds.rest.annotations.SelectJson;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "unit")
|
||||
public class GetSOARecordResponseTest extends BaseDynECTParseTest<SOARecord> {
|
||||
|
||||
@Override
|
||||
public String resource() {
|
||||
return "/get_record_soa.json";
|
||||
}
|
||||
|
||||
@Override
|
||||
@SelectJson("data")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
public SOARecord expected() {
|
||||
return SOARecord.builder()
|
||||
.zone("adrianc.zone.dynecttest.jclouds.org")
|
||||
.fqdn("adrianc.zone.dynecttest.jclouds.org")
|
||||
.type("SOA")
|
||||
.id(50976579l)
|
||||
.ttl(3600)
|
||||
.serialStyle(INCREMENT)
|
||||
.rdata(SOAData.builder()
|
||||
.rname("1\\.5\\.7-SNAPSHOT@jclouds.org.")
|
||||
.retry(600)
|
||||
.mname("ns1.p28.dynect.net.")
|
||||
.minimum(60)
|
||||
.refresh(3600)
|
||||
.expire(604800)
|
||||
.serial(1).build()).build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.dynect.v3.parse;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.jclouds.dynect.v3.domain.Record;
|
||||
import org.jclouds.dynect.v3.domain.rdata.SRVData;
|
||||
import org.jclouds.dynect.v3.internal.BaseDynECTParseTest;
|
||||
import org.jclouds.rest.annotations.SelectJson;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "unit")
|
||||
public class GetSRVRecordResponseTest extends BaseDynECTParseTest<Record<SRVData>> {
|
||||
|
||||
@Override
|
||||
public String resource() {
|
||||
return "/get_record_srv.json";
|
||||
}
|
||||
|
||||
@Override
|
||||
@SelectJson("data")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
public Record<SRVData> expected() {
|
||||
return Record.<SRVData> builder()
|
||||
.zone("adrianc.zone.dynecttest.jclouds.org")
|
||||
.fqdn("_http._tcp.www.jclouds.org.")
|
||||
.type("SRV")
|
||||
.id(50976579l)
|
||||
.ttl(3600)
|
||||
.rdata(SRVData.builder()
|
||||
.priority(0)
|
||||
.weight(2)
|
||||
.port(80)
|
||||
.target("www.jclouds.org.").build()).build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, String 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.dynect.v3.parse;
|
||||
import static org.jclouds.dynect.v3.domain.rdata.TXTData.txt;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.jclouds.dynect.v3.domain.Record;
|
||||
import org.jclouds.dynect.v3.domain.rdata.TXTData;
|
||||
import org.jclouds.dynect.v3.internal.BaseDynECTParseTest;
|
||||
import org.jclouds.rest.annotations.SelectJson;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "unit")
|
||||
public class GetTXTRecordResponseTest extends BaseDynECTParseTest<Record<TXTData>> {
|
||||
|
||||
@Override
|
||||
public String resource() {
|
||||
return "/get_record_txt.json";
|
||||
}
|
||||
|
||||
@Override
|
||||
@SelectJson("data")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
public Record<TXTData> expected() {
|
||||
return Record.<TXTData> builder()
|
||||
.zone("egg.org")
|
||||
.fqdn("sm._domainkey.email.egg.org")
|
||||
.type("TXT")
|
||||
.id(50959331)
|
||||
.ttl(86400)
|
||||
.rdata(txt("k=rsa\\; p=4KAtUdsUGRtjPHE1rsyFYs8XVzvdke8pXnoo+80Kj5b6C37rnyCmZ0w1R5LY=="))
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.jclouds.dynect.v3.parse;
|
||||
|
||||
import org.jclouds.dynect.v3.domain.RecordId;
|
||||
import org.jclouds.dynect.v3.domain.RecordId.Builder;
|
||||
import org.jclouds.dynect.v3.functions.ToRecordIds;
|
||||
import org.jclouds.dynect.v3.internal.BaseDynECTParseTest;
|
||||
import org.jclouds.rest.annotations.ResponseParser;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.FluentIterable;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "unit")
|
||||
public class ListRecordsResponseTest extends BaseDynECTParseTest<FluentIterable<RecordId>> {
|
||||
|
||||
@Override
|
||||
public String resource() {
|
||||
return "/list_records.json";
|
||||
}
|
||||
|
||||
@Override
|
||||
@ResponseParser(ToRecordIds.class)
|
||||
public FluentIterable<RecordId> expected() {
|
||||
Builder<?> builder = RecordId.builder()
|
||||
.zone("adrianc.zone.dynecttest.jclouds.org")
|
||||
.fqdn("adrianc.zone.dynecttest.jclouds.org");
|
||||
return FluentIterable.from(ImmutableSet.<RecordId> builder()
|
||||
.add(builder.type("SOA").id(50976579l).build())
|
||||
.add(builder.type("NS").id(50976580l).build())
|
||||
.add(builder.type("NS").id(50976581l).build())
|
||||
.add(builder.type("NS").id(50976582l).build())
|
||||
.add(builder.type("NS").id(50976583l).build())
|
||||
.build());
|
||||
}
|
||||
}
|
|
@ -21,7 +21,7 @@ package org.jclouds.dynect.v3.parse;
|
|||
|
||||
import static com.google.common.base.Functions.compose;
|
||||
|
||||
import org.jclouds.dynect.v3.functions.ExtractNames;
|
||||
import org.jclouds.dynect.v3.functions.ExtractZoneNames;
|
||||
import org.jclouds.dynect.v3.internal.BaseDynECTParseTest;
|
||||
import org.jclouds.http.HttpResponse;
|
||||
import org.jclouds.rest.annotations.SelectJson;
|
||||
|
@ -52,6 +52,6 @@ public class ListZonesResponseTest extends BaseDynECTParseTest<FluentIterable<St
|
|||
// TODO: currently our parsing of annotations on expected() ignores @Transform
|
||||
@Override
|
||||
protected Function<HttpResponse, FluentIterable<String>> parser(Injector i) {
|
||||
return compose(new ExtractNames(), super.parser(i));
|
||||
return compose(new ExtractZoneNames(), super.parser(i));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
package org.jclouds.dynect.v3.predicates;
|
||||
|
||||
import static org.jclouds.dynect.v3.predicates.RecordPredicates.typeEquals;
|
||||
|
||||
import org.jclouds.dynect.v3.domain.RecordId;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "unit")
|
||||
public class RecordPredicatesTest {
|
||||
RecordId recordId = RecordId.builder()
|
||||
.zone("adrianc.zone.dynecttest.jclouds.org")
|
||||
.fqdn("adrianc.zone.dynecttest.jclouds.org")
|
||||
.type("SOA")
|
||||
.id(50976579l).build();
|
||||
|
||||
@Test
|
||||
public void testTypeEqualsWhenEqual() {
|
||||
assert typeEquals("SOA").apply(recordId);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTypeEqualsWhenNotEqual() {
|
||||
assert !typeEquals("NS").apply(recordId);
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
{"status": "success", "data": {"zone": "egg.org", "ttl": 86400, "fqdn": "egg.org", "record_type": "A", "rdata": {"address": "1.1.1.1"}, "record_id": 50959331}, "job_id": 274279510, "msgs": [{"INFO": "get: Found the record", "SOURCE": "API-B", "ERR_CD": null, "LVL": "INFO"}]}
|
|
@ -0,0 +1 @@
|
|||
{"status": "success", "data": {"zone": "egg.org", "ttl": 86400, "fqdn": "egg.org", "record_type": "AAAA", "rdata": {"address": "2406:bbbb:ff00::6b14:aaaa"}, "record_id": 50959331}, "job_id": 274279510, "msgs": [{"INFO": "get: Found the record", "SOURCE": "API-B", "ERR_CD": null, "LVL": "INFO"}]}
|
|
@ -0,0 +1 @@
|
|||
{"status": "success", "data": {"zone": "egg.org", "ttl": 86400, "fqdn": "egg.org", "record_type": "CNAME", "rdata": {"cname": "prod-LB-359594650.us-east-1.elb.amazonaws.com."}, "record_id": 50959331}, "job_id": 274279510, "msgs": [{"INFO": "get: Found the record", "SOURCE": "API-B", "ERR_CD": null, "LVL": "INFO"}]}
|
|
@ -0,0 +1 @@
|
|||
{"status": "success", "data": {"zone": "egg.org", "ttl": 86400, "fqdn": "egg.org", "record_type": "MX", "rdata": {"preference": 10, "exchange": "mail.egg.org."}, "record_id": 50959331}, "job_id": 274279510, "msgs": [{"INFO": "get: Found the record", "SOURCE": "API-B", "ERR_CD": null, "LVL": "INFO"}]}
|
|
@ -0,0 +1 @@
|
|||
{"status": "success", "data": {"zone": "egg.org", "ttl": 86400, "fqdn": "egg.org", "record_type": "NS", "rdata": {"nsdname": "ns4.p28.dynect.net."}, "record_id": 50959331}, "job_id": 274279510, "msgs": [{"INFO": "get: Found the record", "SOURCE": "API-B", "ERR_CD": null, "LVL": "INFO"}]}
|
|
@ -0,0 +1 @@
|
|||
{"status": "success", "data": {"zone": "egg.org", "ttl": 86400, "fqdn": "1.2.3.0.0.0.0.0.0.0.0.0.0.0.0.0.d.9.2.1.4.0.0.7.0.c.6.8.0.0.a.2.ip6.arpa", "record_type": "PTR", "rdata": {"ptrdname": "egg.org."}, "record_id": 50959331}, "job_id": 274279510, "msgs": [{"INFO": "get: Found the record", "SOURCE": "API-B", "ERR_CD": null, "LVL": "INFO"}]}
|
|
@ -0,0 +1 @@
|
|||
{"status": "success", "data": {"zone": "adrianc.zone.dynecttest.jclouds.org", "ttl": 3600, "fqdn": "adrianc.zone.dynecttest.jclouds.org", "record_type": "SOA", "rdata": {"rname": "1\\.5\\.7-SNAPSHOT@jclouds.org.", "retry": 600, "mname": "ns1.p28.dynect.net.", "minimum": 60, "refresh": 3600, "expire": 604800, "serial": 1}, "record_id": 50976579, "serial_style": "increment"}, "job_id": 273523378, "msgs": [{"INFO": "get: Found the record", "SOURCE": "API-B", "ERR_CD": null, "LVL": "INFO"}]}
|
|
@ -0,0 +1 @@
|
|||
{"status": "success", "data": {"zone": "adrianc.zone.dynecttest.jclouds.org", "ttl": 3600, "fqdn": "_http._tcp.www.jclouds.org.", "record_type": "SRV", "rdata": {"priority": 0, "weight": 2, "port": 80, "target": "www.jclouds.org."}, "record_id": 50976579}, "job_id": 273523378, "msgs": [{"INFO": "get: Found the record", "SOURCE": "API-B", "ERR_CD": null, "LVL": "INFO"}]}
|
|
@ -0,0 +1 @@
|
|||
{"status": "success", "data": {"zone": "egg.org", "ttl": 86400, "fqdn": "sm._domainkey.email.egg.org", "record_type": "TXT", "rdata": {"txtdata": "k=rsa\\; p=4KAtUdsUGRtjPHE1rsyFYs8XVzvdke8pXnoo+80Kj5b6C37rnyCmZ0w1R5LY=="}, "record_id": 50959331}, "job_id": 274279510, "msgs": [{"INFO": "get: Found the record", "SOURCE": "API-B", "ERR_CD": null, "LVL": "INFO"}]}
|
|
@ -0,0 +1 @@
|
|||
{"status": "success", "data": ["/REST/SOARecord/adrianc.zone.dynecttest.jclouds.org/adrianc.zone.dynecttest.jclouds.org/50976579", "/REST/NSRecord/adrianc.zone.dynecttest.jclouds.org/adrianc.zone.dynecttest.jclouds.org/50976580", "/REST/NSRecord/adrianc.zone.dynecttest.jclouds.org/adrianc.zone.dynecttest.jclouds.org/50976581", "/REST/NSRecord/adrianc.zone.dynecttest.jclouds.org/adrianc.zone.dynecttest.jclouds.org/50976582", "/REST/NSRecord/adrianc.zone.dynecttest.jclouds.org/adrianc.zone.dynecttest.jclouds.org/50976583"], "job_id": 273523368, "msgs": [{"INFO": "get_tree: Here is your zone tree", "SOURCE": "BLL", "ERR_CD": null, "LVL": "INFO"}]}
|
Loading…
Reference in New Issue