use of com.google.api.services.dns.model.ResourceRecordSet in project google-cloud-java by GoogleCloudPlatform.
the class RecordSet method toPb.
ResourceRecordSet toPb() {
ResourceRecordSet pb = new ResourceRecordSet();
pb.setName(this.getName());
pb.setRrdatas(this.getRecords());
pb.setTtl(this.getTtl());
pb.setType(this.getType().name());
return pb;
}
use of com.google.api.services.dns.model.ResourceRecordSet in project google-cloud-java by GoogleCloudPlatform.
the class DnsImpl method listRecordSets.
private static Page<RecordSet> listRecordSets(final String zoneName, final DnsOptions serviceOptions, final Map<DnsRpc.Option, ?> optionsMap) {
try {
// get a list of record sets
final DnsRpc rpc = serviceOptions.getDnsRpcV1();
DnsRpc.ListResult<ResourceRecordSet> result = runWithRetries(new Callable<DnsRpc.ListResult<ResourceRecordSet>>() {
@Override
public DnsRpc.ListResult<ResourceRecordSet> call() {
return rpc.listRecordSets(zoneName, optionsMap);
}
}, serviceOptions.getRetrySettings(), EXCEPTION_HANDLER, serviceOptions.getClock());
String cursor = result.pageToken();
// transform that list into record sets
Iterable<RecordSet> recordSets = result.results() == null ? ImmutableList.<RecordSet>of() : Iterables.transform(result.results(), RecordSet.FROM_PB_FUNCTION);
return new PageImpl<>(new RecordSetPageFetcher(zoneName, serviceOptions, cursor, optionsMap), cursor, recordSets);
} catch (RetryHelper.RetryHelperException e) {
throw DnsException.translateAndThrow(e);
}
}
Aggregations