Examples of DnsRecordsetData


Examples of io.fathom.cloud.protobuf.DnsModel.DnsRecordsetData

    static Recordset toModel(DnsZone domain, DnsRecordset recordset, boolean details) {
        Recordset model = new Recordset();

        // zone.id = domain.getData().getDomain();
        DnsRecordsetData data = recordset.getData();
        model.id = "" + data.getId();
        model.type = data.getType();
        model.zone_id = "" + domain.getData().getId();

        model.name = recordset.getFqdn();
        if (data.hasTtl()) {
            model.ttl = data.getTtl();
        }
        if (data.hasWeight()) {
            model.weight = data.getWeight();
        }
        model.status = "ACTIVE";
        model.version = 1L;

        if (data.hasState()) {
            model.created_at = Clock.toDate(data.getState().getCreatedAt());
            model.updated_at = Clock.toDate(data.getState().getUpdatedAt());
            model.deleted_at = Clock.toDate(data.getState().getDeletedAt());
        }

        if (details) {
            model.records = Lists.newArrayList();
            for (DnsRecord record : recordset.getRecords()) {
View Full Code Here

Examples of io.fathom.cloud.protobuf.DnsModel.DnsRecordsetData

            throw new IllegalArgumentException("Cannot find matching zone");
        }

        List<DnsRecordsetData> matches = Lists.newArrayList();
        for (DnsRecordset recordset : dns.listRecordsets(project, zone)) {
            DnsRecordsetData data = recordset.getData();
            if (!fqdn.equals(data.getFqdn())) {
                continue;
            }
            if (id != null) {
                String idString = "" + data.getId();
                if (!idString.equals(id)) {
                    continue;
                }
            }
            matches.add(data);
        }

        if (matches.isEmpty()) {
            throw new IllegalArgumentException("No matching record found");
        }

        if (matches.size() > 1) {
            for (DnsRecordsetData match : matches) {
                println("\t" + match.getId() + "\t" + match.getFqdn());
            }

            throw new IllegalArgumentException("Multiple matching records found");
        }

        DnsRecordsetData data = Iterables.getOnlyElement(matches);

        dns.deleteRecordset(project, zone, data.getId());

        return data;
    }
View Full Code Here

Examples of io.fathom.cloud.protobuf.DnsModel.DnsRecordsetData

        return new DnsZone(data);
    }

    @Override
    public Recordset findRecordset(Project project, Zone zone, long recordsetId) throws CloudException {
        DnsRecordsetData data = repository.getDnsRecordsets(project.getId(), zone.getId()).find(recordsetId);
        if (data == null) {
            return null;
        }
        return new DnsRecordset((DnsZone) zone, data);
    }
View Full Code Here

Examples of io.fathom.cloud.protobuf.DnsModel.DnsRecordsetData

        DnsBackend backend = findBackend(zone);

        data.getStateBuilder().setCreatedAt(Clock.getTimestamp());

        DnsRecordsetData created = repository.getDnsRecordsets(projectId, zone.getId()).create(data);
        backend.updateDomain(project, zone);
        return new DnsRecordset(zone, created);
    }
View Full Code Here

Examples of io.fathom.cloud.protobuf.DnsModel.DnsRecordsetData

    }

    public boolean deleteRecordset(Project project, DnsZone zone, long recordsetId) throws CloudException {
        NumberedItemCollection<DnsRecordsetData> store = repository.getDnsRecordsets(project.getId(), zone.getId());

        DnsRecordsetData found = store.find(recordsetId);
        if (found == null) {
            return false;
        }

        DnsBackend backend = findBackend(zone);
View Full Code Here

Examples of io.fathom.cloud.protobuf.DnsModel.DnsRecordsetData

            boolean hasSoa = false;

            Set<String> ids = Sets.newHashSet();

            for (DnsRecordset recordset : records) {
                DnsRecordsetData data = recordset.getData();

                Recordset r = new Recordset();

                String fqdn = recordset.getFqdn();

                r.name = fqdn;
                r.id = "" + data.getId();
                if (ids.contains(r.id)) {
                    throw new IllegalStateException();
                }
                ids.add(r.id);

                r.zone_id = "" + data.getZoneId();

                r.weight = null;
                r.ttl = null;
                r.type = data.getType();

                if (data.hasState()) {
                    r.deleted_at = Clock.toDate(data.getState().getDeletedAt());
                }

                if (DnsService.TYPE_SOA.equalsIgnoreCase(r.type)) {
                    hasSoa = true;
                }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.