DNSManager

class SoftLayer.managers.DNSManager(client)[source]

Manage SoftLayer DNS.

See product information here: https://www.ibm.com/cloud/dns

Parameters:

client (SoftLayer.API.BaseClient) – the client instance

__init__(client)[source]

Methods

__init__(client)

create_record(zone_id, record, record_type, data)

Create a resource record on a domain.

create_record_mx(zone_id, record, data[, ...])

Create a mx resource record on a domain.

create_record_ptr(record, data[, ttl])

Create a reverse record.

create_record_srv(zone_id, record, data, ...)

Create a resource record on a domain.

create_zone(zone[, serial])

Create a zone for the specified zone.

delete_record(record_id)

Delete a resource record by its ID.

delete_zone(zone_id)

Delete a zone by its ID.

dump_zone(zone_id)

Retrieve a zone dump in BIND format.

edit_record(record)

Update an existing record with the options provided.

edit_zone(zone)

Update an existing zone with the options provided.

get_record(record_id)

Get a DNS record.

get_records(zone_id[, ttl, data, host, ...])

List, and optionally filter, records within a zone.

get_zone(zone_id[, records])

Get a zone and its records.

list_zones(**kwargs)

Retrieve a list of all DNS zones.

resolve_ids(identifier)

Takes a string and tries to resolve to a list of matching ids.

sync_host_record(zone_id, hostname, ip_address)

For a given zone_id, will set hostname's A record to ip_address

sync_ptr_record(ptr_domains, ip_address, fqdn)

Sync PTR record.

Attributes

resolvers

create_record(zone_id, record, record_type, data, ttl=60)[source]

Create a resource record on a domain.

Parameters:
  • id (integer) – the zone’s ID

  • record – the name of the record to add

  • record_type – the type of record (A, AAAA, CNAME, TXT, etc.)

  • data – the record’s value

  • ttl (integer) – the TTL or time-to-live value (default: 60)

create_record_mx(zone_id, record, data, ttl=60, priority=10)[source]

Create a mx resource record on a domain.

Parameters:
  • id (integer) – the zone’s ID

  • record – the name of the record to add

  • data – the record’s value

  • ttl (integer) – the TTL or time-to-live value (default: 60)

  • priority (integer) – the priority of the target host

create_record_ptr(record, data, ttl=60)[source]

Create a reverse record.

Parameters:
  • record – the public ip address of device for which you would like to manage reverse DNS.

  • data – the record’s value

  • ttl (integer) – the TTL or time-to-live value (default: 60)

create_record_srv(zone_id, record, data, protocol, port, service, ttl=60, priority=20, weight=10)[source]

Create a resource record on a domain.

Parameters:
  • id (integer) – the zone’s ID

  • record – the name of the record to add

  • data – the record’s value

  • protocol (string) – the protocol of the service, usually either TCP or UDP.

  • port (integer) – the TCP or UDP port on which the service is to be found.

  • service (string) – the symbolic name of the desired service.

  • ttl (integer) – the TTL or time-to-live value (default: 60)

  • priority (integer) – the priority of the target host (default: 20)

  • weight (integer) – relative weight for records with same priority (default: 10)

create_zone(zone, serial=None)[source]

Create a zone for the specified zone.

Parameters:
  • zone – the zone name to create

  • serial – serial value on the zone (default: strftime(%Y%m%d01))

delete_record(record_id)[source]

Delete a resource record by its ID.

Parameters:

id (integer) – the record’s ID

delete_zone(zone_id)[source]

Delete a zone by its ID.

Parameters:

zone_id (integer) – the zone ID to delete

dump_zone(zone_id)[source]

Retrieve a zone dump in BIND format.

Parameters:

id (integer) – The zone ID to dump

edit_record(record)[source]

Update an existing record with the options provided.

The provided dict must include an ‘id’ key and value corresponding to the record that should be updated.

Parameters:

record (dict) – the record to update

edit_zone(zone)[source]

Update an existing zone with the options provided.

The provided dict must include an ‘id’ key and value corresponding to the zone that should be updated.

Parameters:

zone (dict) – the zone to update

get_record(record_id)[source]

Get a DNS record.

Parameters:

id (integer) – the record’s ID

get_records(zone_id, ttl=None, data=None, host=None, record_type=None)[source]

List, and optionally filter, records within a zone.

Parameters:
  • zone – the zone name in which to search.

  • ttl (int) – time in seconds

  • data (str) – the records data

  • host (str) – record’s host

  • record_type (str) – the type of record

Returns:

A list of dictionaries representing the matching records within the specified zone.

get_zone(zone_id, records=True)[source]

Get a zone and its records.

Parameters:

zone – the zone name

Returns:

A dictionary containing a large amount of information about the specified zone.

list_zones(**kwargs)[source]

Retrieve a list of all DNS zones.

Parameters:

**kwargs (dict) – response-level options (mask, limit, etc.)

Returns:

A list of dictionaries representing the matching zones.

resolve_ids(identifier)

Takes a string and tries to resolve to a list of matching ids.

What exactly ‘identifier’ can be depends on the resolvers

Parameters:

identifier (string) – identifying string

Returns list:

sync_host_record(zone_id, hostname, ip_address, record_type='a', ttl=7200)[source]

For a given zone_id, will set hostname’s A record to ip_address

Parameters:
  • zone_id (integer) – The zone id for the domain

  • hostname (string) – host part of the record

  • ip_address (string) – data part of the record

  • ttl (integer) – TTL for the record

  • record_type (string) – ‘a’ or ‘aaaa’

sync_ptr_record(ptr_domains, ip_address, fqdn, ttl=7200)[source]

Sync PTR record.

Parameters:
  • ptr_domains (dict) – result from SoftLayer_Virtual_Guest.getReverseDomainRecords or SoftLayer_Hardware_Server.getReverseDomainRecords

  • ip_address (string) – ip address to sync with

  • fqdn (string) – Fully Qualified Domain Name

  • ttl (integer) – TTL for the record