Search in sources :

Example 1 with ResourceRecordSet

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;
}
Also used : ResourceRecordSet(com.google.api.services.dns.model.ResourceRecordSet)

Example 2 with ResourceRecordSet

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);
    }
}
Also used : ResourceRecordSet(com.google.api.services.dns.model.ResourceRecordSet) PageImpl(com.google.cloud.PageImpl) RetryHelper(com.google.cloud.RetryHelper) DnsRpc(com.google.cloud.dns.spi.v1.DnsRpc) ResourceRecordSet(com.google.api.services.dns.model.ResourceRecordSet)

Aggregations

ResourceRecordSet (com.google.api.services.dns.model.ResourceRecordSet)2 PageImpl (com.google.cloud.PageImpl)1 RetryHelper (com.google.cloud.RetryHelper)1 DnsRpc (com.google.cloud.dns.spi.v1.DnsRpc)1