Skip to content

Latest commit

 

History

History
59 lines (49 loc) · 1.61 KB

secondary.rst

File metadata and controls

59 lines (49 loc) · 1.61 KB

Secondary Zone

dyn.tm.zones.SecondaryZone

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.

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

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'

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()