Skip to content

Commit

Permalink
Merge pull request #111 from Marchowes/tsig_external
Browse files Browse the repository at this point in the history
Adding tsig names.
  • Loading branch information
Marchowes committed Nov 28, 2016
2 parents 3bc2b14 + 3781253 commit 533c965
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 9 deletions.
4 changes: 4 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Release History
---------------

1.7.10 (2016-12-08)
++++++++++++++++++
*TSIG names can now be attached to `dyn.tm.zones.ExternalNamserver`
1.7.9 (2016-11-28)
++++++++++++++++++
*Add publish parameter to delete methods
Expand Down
2 changes: 1 addition & 1 deletion dyn/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Requires Python 2.6 or higher, or the "simplejson" package.
"""
version_info = (1, 7, 9)
version_info = (1, 7, 10)
__name__ = 'dyn'
__doc__ = 'A python wrapper for the DynDNS and DynEmail APIs'
__author__ = 'Jonathan Nappi, Cole Tuininga, Marc Howes, Philip Andrews'
Expand Down
32 changes: 24 additions & 8 deletions dyn/tm/zones.py
Original file line number Diff line number Diff line change
Expand Up @@ -1224,13 +1224,16 @@ def __init__(self, zone, *args, **kwargs):
:param deny: does this block requests or add them
:param hosts: list of :class:`ExternalNameserverEntry`
:param active: active? Y/N
:param tsig_key_name: Name of TSIG to associate with this
:class:`ExternalNameserver`
"""
self._zone = zone
self.uri = '/ExtNameserver/{}/'.format(self._zone)
self._deny = None
self._hosts = None
self._active = None
self._tsig_key_name = None

if len(args) == 0 and len(kwargs) == 0:
self._get()
Expand All @@ -1252,6 +1255,10 @@ def _post(self, *args, **kwargs):
if self._deny:
api_args['deny'] = self._deny

self._tsig_key_name = kwargs.get('tsig_key_name', None)
if self._tsig_key_name:
api_args['tsig_key_name'] = self._tsig_key_name

self._active = kwargs.get('active', None)
if self._active:
api_args['active'] = self._active
Expand Down Expand Up @@ -1299,10 +1306,22 @@ def deny(self, deny):
:param deny: Y/N
"""
api_args = {'zone': self._zone, 'deny': deny}
response = DynectSession.get_session().execute(self.uri, 'PUT',
api_args)
for key, val in response['data'].items():
setattr(self, '_' + key, val)
self._update(api_args=api_args)

@property
def tsig_key_name(self):
"""Gets tsig_key_name value :class:`ExternalNameserver` object"""
self._get()
return self._tsig_key_name

@tsig_key_name.setter
def tsig_key_name(self, tsig_key_name):
"""
Sets deny value of :class:`ExternalNameserver` object
:param deny: Y/N
"""
api_args = {'zone': self._zone, 'tsig_key_name': tsig_key_name}
self._update(api_args=api_args)

@property
def hosts(self):
Expand Down Expand Up @@ -1336,10 +1355,7 @@ def active(self, active):
:param active: Y/N
"""
api_args = {'zone': self._zone, 'active': active}
response = DynectSession.get_session().execute(self.uri, 'PUT',
api_args)
for key, val in response['data'].items():
setattr(self, '_' + key, val)
self._update(api_args=api_args)

@property
def zone(self):
Expand Down

0 comments on commit 533c965

Please sign in to comment.