libcloud.dns.drivers.powerdns module

PowerDNS Driver

class libcloud.dns.drivers.powerdns.PowerDNSDriver(key, secret=None, secure=False, host=None, port=None, api_version='experimental', **kwargs)[source]

Bases: DNSDriver

PowerDNS Driver defaulting to using PowerDNS 3.x API (ie “experimental”).

Parameters:
  • key (str) – API key or username to used (required)

  • secure (bool) – Whether to use HTTPS or HTTP. Note: Off by default for PowerDNS.

  • host (str) – Hostname used for connections.

  • port (int) – Port used for connections.

  • api_version (str) – Specifies the API version to use. experimental and v1 are the only valid options. Defaults to using experimental (optional)

Returns:

None

RECORD_TYPE_MAP: Dict[RecordType, str] = {'A': 'AFSDB', 'AAAA': 'AAAA', 'CERT': 'CERT', 'CNAME': 'CNAME', 'DNSKEY': 'DNSKEY', 'DS': 'DS', 'HINFO': 'HINFO', 'KEY': 'KEY', 'LOC': 'LOC', 'MX': 'MX', 'NAPTR': 'NAPTR', 'NS': 'NS', 'NSEC': 'NSEC', 'OPENPGPKEY': 'OPENPGPKEY', 'PTR': 'PTR', 'RP': 'RP', 'RRSIG': 'RRSIG', 'SOA': 'SOA', 'SPF': 'SPF', 'SRV': 'SRV', 'SSHFP': 'SSHFP', 'TLSA': 'TLSA', 'TXT': 'TXT'}
connectionCls

alias of PowerDNSConnection

create_record(name, zone, type, data, extra=None)[source]

Create a new record.

There are two PowerDNS-specific quirks here. Firstly, this method will silently clobber any pre-existing records that might already exist. For example, if PowerDNS already contains a “test.example.com” A record, and you create that record using this function, then the old A record will be replaced with your new one.

Secondly, PowerDNS requires that you provide a ttl for all new records. In other words, the “extra” parameter must be {'ttl': <some-integer>} at a minimum.

Parameters:
  • name (str) – FQDN of the new record, for example “www.example.com”.

  • zone (Zone) – Zone where the requested record is created.

  • type (RecordType) – DNS record type (A, AAAA, …).

  • data (str) – Data for the record (depends on the record type).

  • extra (dict) – Extra attributes (driver specific, e.g. ‘ttl’). Note that PowerDNS requires a ttl value for every record.

Return type:

Record

create_zone(domain, type=None, ttl=None, extra={})[source]

Create a new zone.

There are two PowerDNS-specific quirks here. Firstly, the “type” and “ttl” parameters are ignored (no-ops). The “type” parameter is simply not implemented, and PowerDNS does not have an ability to set a zone-wide default TTL. (TTLs must be set per-record.)

Secondly, PowerDNS requires that you provide a list of nameservers for the zone upon creation. In other words, the “extra” parameter must be {'nameservers': ['ns1.example.org']} at a minimum.

Parameters:
  • name (str) – Zone domain name (e.g. example.com)

  • domain (Zone) – Zone type (master / slave). (optional). Note that the PowerDNS driver does nothing with this parameter.

  • ttl (int) – TTL for new records. (optional). Note that the PowerDNS driver does nothing with this parameter.

  • extra (dict) – Extra attributes (driver specific). For example, specify extra={'nameservers': ['ns1.example.org']} to set a list of nameservers for this new zone.

Return type:

Zone

delete_record(record)[source]

Use this method to delete a record.

Parameters:

record (Record) – record to delete

Return type:

bool

delete_zone(zone)[source]

Use this method to delete a zone.

Parameters:

zone (Zone) – zone to delete

Return type:

bool

get_zone(zone_id)[source]

Return a Zone instance.

(Note that PowerDNS does not support per-zone TTL defaults, so all Zone objects will have ttl=None.)

Parameters:

zone_id (str) – name of the required zone with the trailing period, for example “example.com.”.

Return type:

Zone

Raises:

ZoneDoesNotExistError: If no zone could be found.

list_records(zone)[source]

Return a list of all records for the provided zone.

Parameters:

zone (Zone) – Zone to list records for.

Returns:

list of Record

list_zones()[source]

Return a list of zones.

Returns:

list of Zone

name: str = 'PowerDNS'
type = 'powerdns'
update_record(record, name, type, data, extra=None)[source]

Update an existing record.

Parameters:
  • record (Record) – Record to update.

  • name (str) – FQDN of the new record, for example “www.example.com”.

  • type (RecordType) – DNS record type (A, AAAA, …).

  • data (str) – Data for the record (depends on the record type).

  • extra (dict) – (optional) Extra attributes (driver specific).

Return type:

Record

website: str = 'https://www.powerdns.com/'