Package io.fathom.cloud.openstack.client.dns.model

Examples of io.fathom.cloud.openstack.client.dns.model.Recordset


    @POST
    public WrappedRecordset createRecordset(WrappedRecordset request) throws CloudException {
        DnsZone zone = getZone();

        Recordset recordset = request.recordset;
        DnsRecordsetData.Builder b = DnsRecordsetData.newBuilder();
        b.setFqdn(recordset.name);
        b.setType(recordset.type);

        for (Record record : recordset.records) {
View Full Code Here


        notFoundIfNull(domain);
        return domain;
    }

    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();
View Full Code Here

                if (!sameDomain) {
                    log.debug("Domain name not part of domain: {}", awsRecordsetName);
                    continue;
                }

                Recordset recordset = new Recordset();

                recordset.type = awsRecordset.getType();
                recordset.name = awsRecordsetName;

                recordset.ttl = awsRecordset.getTTL();
View Full Code Here

            for (Recordset recordset : recordsets) {
                String key = recordset.type + ":" + recordset.name;
                if (recordset.weight != null) {
                    key += ":" + recordset.id;
                }
                Recordset existing = unique.get(key);
                if (existing == null) {
                    unique.put(key, recordset);
                } else {
                    Recordset merged = merge(existing, recordset);
                    unique.put(key, merged);
                }
            }
            return Lists.newArrayList(unique.values());
        }
View Full Code Here

                return b;
            }
            if (b.isDeleted()) {
                return a;
            }
            Recordset merged = new Recordset();
            merged.name = a.name;
            merged.type = a.type;
            merged.records = Lists.newArrayList();
            merged.records.addAll(a.records);
            merged.records.addAll(b.records);
View Full Code Here

            for (Recordset desiredRecordset : desired) {
                String key = desiredRecordset.type + ":" + desiredRecordset.name;

                managedNames.add(key);

                Recordset found = null;
                for (Recordset rrs : currentMap.get(key)) {
                    if (!rrs.matches(desiredRecordset)) {
                        continue;
                    }

                    found = rrs;
                    break;
                }

                if (found == null) {
                    // Not found; need to create

                    log.debug("Creating record: {}", desiredRecordset);

                    if (!desiredRecordset.isDeleted()) {
                        changes.create.add(desiredRecordset);
                    }
                } else {
                    log.debug("Matched existing record: {}", found);

                    matches.put(key, found);
                }
            }

            for (Entry<String, Recordset> entry : currentMap.entries()) {
                String key = entry.getKey();

                if (!managedNames.contains(key)) {
                    // Note: we rely on state to keep around deleted records
                    // (currently forever!)
                    // Also, we can't do record rename / retype
                    log.debug("Record not managed by this domain: {}", key);
                    continue;
                }

                Recordset rrs = entry.getValue();

                boolean found = false;

                for (Recordset i : matches.get(entry.getKey())) {
                    if (rrs.matches(i)) {
                        found = true;
                        break;
                    }
                }
View Full Code Here

            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;
                }

                r.records = Lists.newArrayList();
                for (DnsRecord dnsRecord : recordset.getRecords()) {
                    Record record = new Record();
                    DnsRecordData recordData = dnsRecord.getData();
                    record.value = recordData.getTarget();
                    if (recordData.hasWeight()) {
                        record.weight = recordData.getWeight();
                    }
                    if (recordData.hasPort()) {
                        record.port = recordData.getPort();
                    }
                    if (recordData.hasPriority()) {
                        record.priority = recordData.getPriority();
                    }
                    r.records.add(record);
                }

                recordsets.add(r);
            }

            if (createSoa && !hasSoa) {
                Recordset r = new Recordset();
                r.name = zoneName;

                // primary hostmaster serial refresh retry expire default_ttl
                String primary = "ns." + zoneName;
                String hostmaster = "hostmaster@" + zoneName;
View Full Code Here

TOP

Related Classes of io.fathom.cloud.openstack.client.dns.model.Recordset

Copyright © 2018 www.massapicom. 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.