libcloud.dns package

Subpackages

Submodules

libcloud.dns.base module

class libcloud.dns.base.DNSDriver(key, secret=None, secure=True, host=None, port=None, **kwargs)[source]

Bases: libcloud.common.base.BaseDriver

A base DNSDriver class to derive from

This class is always subclassed by a specific driver.

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

  • secret (str) – Secret password to be used (required)

  • secure (bool) – Whether to use HTTPS or HTTP. Note: Some providers only support HTTPS, and it is on by default.

  • host (str) – Override hostname used for connections.

  • port (int) – Override port used for connections.

Returns

None

RECORD_TYPE_MAP = {}
connectionCls

alias of libcloud.common.base.ConnectionUserAndKey

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

Create a new record.

Parameters
  • name (str) – Record name without the domain name (e.g. www). Note: If you want to create a record for a base domain name, you should specify empty string (‘’) for this argument.

  • 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). (optional)

Return type

Record

create_zone(domain, type='master', ttl=None, extra=None)[source]

Create a new zone.

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

  • type (str) – Zone type (master / slave).

  • ttl (int) – TTL for new records. (optional)

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

Return type

Zone

delete_record(record)[source]

Delete a record.

Parameters

record (Record) – Record to delete.

Return type

bool

delete_zone(zone)[source]

Delete a zone.

Note: This will delete all the records belonging to this zone.

Parameters

zone (Zone) – Zone to delete.

Return type

bool

export_zone_to_bind_format(zone)[source]

Export Zone object to the BIND compatible format.

Parameters

zone (Zone) – Zone to export.

Returns

Zone data in BIND compatible format.

Return type

str

export_zone_to_bind_zone_file(zone, file_path)[source]

Export Zone object to the BIND compatible format and write result to a file.

Parameters
  • zone (Zone) – Zone to export.

  • file_path (str) – File path where the output will be saved.

get_record(zone_id, record_id)[source]

Return a Record instance.

Parameters
  • zone_id (str) – ID of the required zone

  • record_id (str) – ID of the required record

Return type

Record

get_zone(zone_id)[source]

Return a Zone instance.

Parameters

zone_id (str) – ID of the required zone

Return type

Zone

iterate_records(zone)[source]

Return a generator to iterate over records for the provided zone.

Parameters

zone (Zone) – Zone to list records for.

Return type

generator of Record

iterate_zones()[source]

Return a generator to iterate over available zones.

Return type

generator of Zone

list_record_types()[source]

Return a list of RecordType objects supported by the provider.

Returns

list of RecordType

list_records(zone)[source]

Return a list of 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 = None
update_record(record, name, type, data, extra=None)[source]

Update an existing record.

Parameters
  • record (Record) – Record to update.

  • name (str) – Record name without the domain name (e.g. www). Note: If you want to create a record for a base domain name, you should specify empty string (‘’) for this argument.

  • 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

update_zone(zone, domain, type='master', ttl=None, extra=None)[source]

Update an existing zone.

Parameters
  • zone (Zone) – Zone to update.

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

  • type (str) – Zone type (master / slave).

  • ttl (int) – TTL for new records. (optional)

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

Return type

Zone

website = None
class libcloud.dns.base.Record(id, name, type, data, zone, driver, ttl=None, extra=None)[source]

Bases: object

Zone record / resource.

Parameters
  • id (str) – Record id

  • name (str) – Hostname or FQDN.

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

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

  • zone (Zone) – Zone instance.

  • driver (DNSDriver) – DNSDriver instance.

  • ttl (int) – Record TTL.

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

delete()[source]
update(name=None, type=None, data=None, extra=None)[source]
class libcloud.dns.base.Zone(id, domain, type, ttl, driver, extra=None)[source]

Bases: object

DNS zone.

Parameters
  • id (str) – Zone id.

  • domain (str) – The name of the domain.

  • type (str) – Zone type (master, slave).

  • ttl (int) – Default TTL for records in this zone (in seconds).

  • driver (DNSDriver) – DNSDriver instance.

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

create_record(name, type, data, extra=None)[source]
delete()[source]
export_to_bind_format()[source]
export_to_bind_zone_file(file_path)[source]
list_records()[source]
update(domain=None, type=None, ttl=None, extra=None)[source]

libcloud.dns.providers module

libcloud.dns.providers.get_driver(provider)[source]
libcloud.dns.providers.set_driver(provider, module, klass)[source]

libcloud.dns.types module

class libcloud.dns.types.Provider[source]

Bases: object

Defines for each of the supported providers

Non-Dummy drivers are sorted in alphabetical order. Please preserve this ordering when adding new drivers.

AURORADNS = 'auroradns'
BUDDYNS = 'buddyns'
CLOUDFLARE = 'cloudflare'
DIGITAL_OCEAN = 'digitalocean'
DNSIMPLE = 'dnsimple'
DNSPOD = 'dnspod'
DUMMY = 'dummy'
DURABLEDNS = 'durabledns'
GANDI = 'gandi'
GANDI_LIVE = 'gandi_live'
GODADDY = 'godaddy'
GOOGLE = 'google'
HOSTVIRTUAL = 'hostvirtual'
LINODE = 'linode'
LIQUIDWEB = 'liquidweb'
LUADNS = 'luadns'
NFSN = 'nfsn'
NSONE = 'nsone'
ONAPP = 'onapp'
POINTDNS = 'pointdns'
POWERDNS = 'powerdns'
RACKSPACE = 'rackspace'
RACKSPACE_UK = 'rackspace_uk'
RACKSPACE_US = 'rackspace_us'
RCODEZERO = 'rcodezero'
ROUTE53 = 'route53'
SOFTLAYER = 'softlayer'
VULTR = 'vultr'
WORLDWIDEDNS = 'worldwidedns'
ZERIGO = 'zerigo'
ZONOMI = 'zonomi'
exception libcloud.dns.types.RecordAlreadyExistsError(value, driver, record_id)[source]

Bases: libcloud.dns.types.RecordError

error_type = 'RecordAlreadyExistsError'
exception libcloud.dns.types.RecordDoesNotExistError(value, driver, record_id)[source]

Bases: libcloud.dns.types.RecordError

error_type = 'RecordDoesNotExistError'
exception libcloud.dns.types.RecordError(value, driver, record_id)[source]

Bases: libcloud.common.types.LibcloudError

error_type = 'RecordError'
class libcloud.dns.types.RecordType[source]

Bases: object

DNS record type.

A = 'A'
AAAA = 'AAAA'
AFSDB = 'A'
ALIAS = 'ALIAS'
CAA = 'CAA'
CERT = 'CERT'
CNAME = 'CNAME'
DNAME = 'DNAME'
DNSKEY = 'DNSKEY'
DS = 'DS'
GEO = 'GEO'
HINFO = 'HINFO'
KEY = 'KEY'
LOC = 'LOC'
MX = 'MX'
NAPTR = 'NAPTR'
NS = 'NS'
NSEC = 'NSEC'
OPENPGPKEY = 'OPENPGPKEY'
PTR = 'PTR'
REDIRECT = 'REDIRECT'
RP = 'RP'
RRSIG = 'RRSIG'
SOA = 'SOA'
SPF = 'SPF'
SRV = 'SRV'
SSHFP = 'SSHFP'
TLSA = 'TLSA'
TXT = 'TXT'
URL = 'URL'
WKS = 'WKS'
exception libcloud.dns.types.ZoneAlreadyExistsError(value, driver, zone_id)[source]

Bases: libcloud.dns.types.ZoneError

error_type = 'ZoneAlreadyExistsError'
exception libcloud.dns.types.ZoneDoesNotExistError(value, driver, zone_id)[source]

Bases: libcloud.dns.types.ZoneError

error_type = 'ZoneDoesNotExistError'
exception libcloud.dns.types.ZoneError(value, driver, zone_id)[source]

Bases: libcloud.common.types.LibcloudError

error_type = 'ZoneError'
kwargs = ('zone_id',)

Module contents