Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 26 additions & 14 deletions src/main/java/io/vinyldns/java/VinylDNSClient.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
/**
/*
* Copyright 2018 Comcast Cable Communications Management, LLC
*
* <p>Licensed 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
* Licensed 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
*
* <p>http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* <p>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
* 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 io.vinyldns.java;
Expand Down Expand Up @@ -87,7 +89,7 @@ public interface VinylDNSClient {
* Retrieves up to 100 (default) zone changes sorted by most recent. This call will return a
* subset of the full information in each change, as detailed in the attributes section.
*
* @param request See {@link ListZoneChangesRequest ListBatchChangesRequest Model}
* @param request See {@link ListZoneChangesRequest ListZoneChangesRequest Model}
* @return {@link VinylDNSSuccessResponse VinylDNSSuccessResponse&lt;ListZoneChangesResponse&gt;}
* in case of success and {@link VinylDNSFailureResponse
* VinylDNSFailureResponse&lt;ListZoneChangesResponse&gt;} in case of failure
Expand Down Expand Up @@ -364,11 +366,21 @@ VinylDNSResponse<ListRecordSetChangesResponse> listRecordSetChanges(
* minimum of two alpha-numeric characters is required.
*
* @param request See {@link SearchRecordSetsRequest SearchRecordSetsRequest Model}
* @return {@link VinylDNSSuccessResponse
* VinylDNSSuccessResponse&lt;SearchRecordSetsResponse&gt;} in case of success and {@link
* VinylDNSFailureResponse VinylDNSFailureResponse&lt;SearchRecordSetsResponse&gt;} in case
* of failure
* @return {@link VinylDNSSuccessResponse VinylDNSSuccessResponse&lt;SearchRecordSetsResponse&gt;}
* in case of success and {@link VinylDNSFailureResponse
* VinylDNSFailureResponse&lt;SearchRecordSetsResponse&gt;} in case of failure
*/
VinylDNSResponse<SearchRecordSetsResponse> searchRecordSets(SearchRecordSetsRequest request);

/**
* Retrieves up to 100 (default) abandoned zones sorted by most recent. This call will return a
* subset of the full information in each change, as detailed in the attributes section.
*
* @param request See {@link ListAbandonedZonesRequest ListAbandonedZonesRequest Model}
* @return {@link VinylDNSSuccessResponse VinylDNSSuccessResponse&lt;ListAbandonedZonesResponse&gt;}
* in case of success and {@link VinylDNSFailureResponse
* VinylDNSFailureResponse&lt;ListAbandonedZonesResponse&gt;} in case of failure
*/
VinylDNSResponse<SearchRecordSetsResponse> searchRecordSets(
SearchRecordSetsRequest request);
VinylDNSResponse<ListAbandonedZonesResponse> listAbandonedZones(
ListAbandonedZonesRequest request);
}
48 changes: 36 additions & 12 deletions src/main/java/io/vinyldns/java/VinylDNSClientImpl.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
/**
/*
* Copyright 2018 Comcast Cable Communications Management, LLC
*
* <p>Licensed 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
* Licensed 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
*
* <p>http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* <p>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
* 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 io.vinyldns.java;
Expand Down Expand Up @@ -135,6 +137,29 @@ public VinylDNSResponse<ListZoneChangesResponse> listZoneChanges(ListZoneChanges
return executeRequest(vinylDNSRequest, ListZoneChangesResponse.class);
}

@Override
public VinylDNSResponse<ListAbandonedZonesResponse> listAbandonedZones(
ListAbandonedZonesRequest request) {
String path = "zones/deleted/changes";

VinylDNSRequest<Void> vinylDNSRequest =
new VinylDNSRequest<>(Methods.GET.name(), getBaseUrl(), path, null);

if (request.getNameFilter() != null) {
vinylDNSRequest.addParameter("nameFilter", request.getNameFilter());
}

if (request.getStartFrom() != null) {
vinylDNSRequest.addParameter("startFrom", request.getStartFrom());
}

if (request.getMaxItems() != null) {
vinylDNSRequest.addParameter("maxItems", request.getMaxItems().toString());
}

return executeRequest(vinylDNSRequest, ListAbandonedZonesResponse.class);
}

@Override
public VinylDNSResponse<ZoneResponse> syncZone(ZoneRequest request) {
String path = "zones/" + request.getZoneId() + "/sync";
Expand Down Expand Up @@ -410,11 +435,11 @@ public VinylDNSResponse<BatchResponse> cancelBatchChanges(String id) {

@Override
public VinylDNSResponse<SearchRecordSetsResponse> searchRecordSets(
SearchRecordSetsRequest request) {
SearchRecordSetsRequest request) {
String path = "recordsets";

VinylDNSRequest<Void> vinylDNSRequest =
new VinylDNSRequest<>(Methods.GET.name(), getBaseUrl(), path, null);
new VinylDNSRequest<>(Methods.GET.name(), getBaseUrl(), path, null);

if (request.getStartFrom() != null) {
vinylDNSRequest.addParameter("startFrom", request.getStartFrom());
Expand All @@ -429,12 +454,11 @@ public VinylDNSResponse<SearchRecordSetsResponse> searchRecordSets(
}

if (request.getNameSort() != null) {
vinylDNSRequest.addParameter( "nameSort", request.getNameSort().name());
vinylDNSRequest.addParameter("nameSort", request.getNameSort().name());
}

if (request.getRecordOwnerGroupFilter() != null) {
vinylDNSRequest.addParameter( "recordOwnerGroupFilter",
request.getRecordOwnerGroupFilter());
vinylDNSRequest.addParameter("recordOwnerGroupFilter", request.getRecordOwnerGroupFilter());
}

return executeRequest(vinylDNSRequest, SearchRecordSetsResponse.class);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/*
* Copyright 2018 Comcast Cable Communications Management, LLC
*
* Licensed 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 io.vinyldns.java.model.zone;

import java.util.Objects;

public class AbandonedZoneChangeResponse {
private final ZoneResponse zoneChange;
private final String adminGroupName;
private final String userName;
private final Boolean accessLevel;

public AbandonedZoneChangeResponse(
ZoneResponse zoneChange, String adminGroupName, String userName, Boolean accessLevel) {
this.zoneChange = zoneChange;
this.adminGroupName = adminGroupName;
this.userName = userName;
this.accessLevel = accessLevel;
}

public ZoneResponse getZoneChange() {
return zoneChange;
}

public String getAdminGroupName() {
return adminGroupName;
}

public String getUserName() {
return userName;
}

public Boolean getAccessLevel() {
return accessLevel;
}

@Override
public String toString() {
return "zoneChange{"
+ "zoneChange="
+ zoneChange
+ ", adminGroupName='"
+ adminGroupName
+ '\''
+ ", userName="
+ userName
+ ", accessLevel="
+ accessLevel
+ '\''
+ '}';
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof AbandonedZoneChangeResponse)) return false;
AbandonedZoneChangeResponse that = (AbandonedZoneChangeResponse) o;
return Objects.equals(getZoneChange(), that.getZoneChange())
&& Objects.equals(getAdminGroupName(), that.getAdminGroupName())
&& getUserName() == that.getUserName()
&& getAccessLevel() == that.getAccessLevel();
}

@Override
public int hashCode() {
int result = zoneChange.hashCode();
result = 31 * result + (adminGroupName != null ? adminGroupName.hashCode() : 0);
result = 31 * result + (userName != null ? userName.hashCode() : 0);
result = 31 * result + (accessLevel != null ? accessLevel.hashCode() : 0);
return result;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
/*
* Copyright 2018 Comcast Cable Communications Management, LLC
*
* Licensed 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 io.vinyldns.java.model.zone;

import java.util.List;

public class ListAbandonedZonesResponse {
private final List<AbandonedZoneChangeResponse> zonesDeletedInfo;

/**
* (optional) The startFrom parameter that was sent in on the HTTP request. Will not be present if
* the startFrom parameter was not sent
*/
private String startFrom;

/**
* (optional) The identifier to be passed in as the startFrom parameter to retrieve the next page
* of results. If there are no results left, this field will not be present.
*/
private String nextId;

/** The maxItems parameter that was sent in on the HTTP request. This will be 100 if not sent. */
private final Integer maxItems;

private Boolean ignoreAccess;

public ListAbandonedZonesResponse(
List<AbandonedZoneChangeResponse> zonesDeletedInfo, Integer maxItems) {
this.zonesDeletedInfo = zonesDeletedInfo;
this.maxItems = maxItems;
}

public ListAbandonedZonesResponse(
List<AbandonedZoneChangeResponse> zonesDeletedInfo,
String startFrom,
String nextId,
Integer maxItems,
Boolean ignoreAccess) {
this.zonesDeletedInfo = zonesDeletedInfo;
this.startFrom = startFrom;
this.nextId = nextId;
this.maxItems = maxItems;
this.ignoreAccess = ignoreAccess;
}

public List<AbandonedZoneChangeResponse> getAbandonedZones() {
return zonesDeletedInfo;
}

public String getStartFrom() {
return startFrom;
}

public void setStartFrom(String startFrom) {
this.startFrom = startFrom;
}

public String getNextId() {
return nextId;
}

public Integer getMaxItems() {
return maxItems;
}

public Boolean getIgnoreAccess() {
return ignoreAccess;
}

@Override
public String toString() {
return "abandonedZoneChangeResponse{"
+ "zonesDeletedInfo="
+ zonesDeletedInfo
+ ", startFrom='"
+ startFrom
+ '\''
+ ", nextId='"
+ nextId
+ '\''
+ ", maxItems="
+ maxItems
+ '\''
+ ", ignoreAccess="
+ ignoreAccess
+ '\''
+ '}';
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;

ListAbandonedZonesResponse that = (ListAbandonedZonesResponse) o;

if (!zonesDeletedInfo.equals(that.zonesDeletedInfo)) return false;
if (startFrom != null ? !startFrom.equals(that.startFrom) : that.startFrom != null)
return false;
if (nextId != null ? !nextId.equals(that.nextId) : that.nextId != null) return false;
return maxItems != null ? maxItems.equals(that.maxItems) : that.maxItems == null;
}

@Override
public int hashCode() {
int result = zonesDeletedInfo.hashCode();
result = 31 * result + (startFrom != null ? startFrom.hashCode() : 0);
result = 31 * result + (nextId != null ? nextId.hashCode() : 0);
result = 31 * result + (maxItems != null ? maxItems.hashCode() : 0);
result = 31 * result + (ignoreAccess != null ? ignoreAccess.hashCode() : 0);
return result;
}
}
Loading