4.2.2.2. Secondary Zone

class dyn.tm.zones.SecondaryZone(zone, *args, **kwargs)[source]

A class representing DynECT Secondary zones

__init__(zone, *args, **kwargs)[source]

Create a SecondaryZone object

Parameters:
  • zone – The name of this secondary zone
  • masters – A list of IPv4 or IPv6 addresses of the master nameserver(s) for this zone.
  • contact_nickname – Name of the Contact that will receive notifications for this zone
  • tsig_key_name – Name of the TSIG key that will be used to sign transfer requests to this zone’s master
activate()[source]

Activates this secondary zone

active

Reports the status of SecondaryZone Y, L or N

contact_nickname

Name of the Contact that will receive notifications for this zone

deactivate()[source]

Deactivates this secondary zone

delete()[source]

Delete this SecondaryZone

masters

A list of IPv4 or IPv6 addresses of the master nameserver(s) for this zone.

retransfer()[source]

Retransfers this secondary zone from its original provider into Dyn’s Managed DNS

serial

Reports the serial of SecondaryZone

task

Task for most recent system action on this SecondaryZone.

tsig_key_name

Name of the TSIG key that will be used to sign transfer requests to this zone’s master

zone

The name of this SecondaryZone

4.2.2.2.1. Secondary Zone Examples

The following examples highlight how to use the SecondaryZone class to get/create SecondaryZone‘s on the dyn.tm System and how to edit these objects from within a Python script.

4.2.2.2.1.1. Creating a new Secondary Zone

The following example shows how to create a new SecondaryZone on the dyn.tm System and how to edit some of the fields using the returned SecondaryZone object.

>>> from dyn.tm.zones import SecondaryZone
>>> # Create a dyn.tmSession
>>> new_zone = SecondaryZone('myzone.com', '127.0.0.1', 'mynickame')
>>> new_zone.active
'Y'
>>> new_zone.retransfer()
>>> new_zone.serial
1

4.2.2.2.1.2. Getting an Existing Secondary Zone

The following example shows how to get an existing SecondaryZone from the dyn.tm System.

>>> from dyn.tm.zones import SecondaryZone
>>> # Create a dyn.tmSession
>>> my_zone = SecondaryZone('myzone.com')
>>> my_zone.serial
5
>>> my_zone.contact_nickname
u'mynickname'
>>> my_zone.deactivate()
>>> my_zone.active
'N'

4.2.2.2.1.3. Using lists of Secondary Zones

The following example shows how to use the results of a call to the get_all_secondary_zones() functions

>>> from dyn.tm.zones import get_all_secondary_zones
>>> my_sec_zones = get_all_secondary_zones()
>>> for zone in my_sec_zones:
...     zone.activate()