4.5.2. Dynamic DNS¶
-
class
dyn.tm.services.ddns.DynamicDNS(zone, fqdn, *args, **kwargs)[source]¶ DynamicDNS is a service which aliases a dynamic IP Address to a static hostname
-
__init__(zone, fqdn, *args, **kwargs)[source]¶ Create a new
DynamicDNSservice objectParameters: - zone – The zone to attach this DDNS Service to
- fqdn – The FQDN of the node where this service will be attached
- record_type – Either A, for IPv4, or AAAA, for IPv6
- address – IPv4 or IPv6 address for the service
- full_setup – Flag to indicate a user is specified
- user – Name of the user to create, or the name of an existing update user to allow access to this service
-
active¶ Returns whether or not this
DynamicDNSService is currently active. When setting directly, rather than using activate/deactivate valid arguments are ‘Y’ or True to activate, or ‘N’ or False to deactivate. Note: If your service is already active and you try to activate it, nothing will happen. And vice versa for deactivation.Returns: An Activeobject representing the current state of thisDynamicDNSService
-
address¶ IPv4 or IPv6 address for this DynamicDNS service
-
fqdn¶ The fqdn that this DynamicDNS Service is attached to is a read-only attribute
-
record_type¶ The record_type of a DDNS Service is a read-only attribute
-
user¶ The
Userattribute of a DDNS Service is a read-only attribute
-
zone¶ The zone that this DynamicDNS Service is attached to is a read-only attribute
-
4.5.2.1. Dynamic DNS Examples¶
The following examples highlight how to use the DynamicDNS class to
get/create DynamicDNS’s on the dyn.tm System and how to edit these
objects from within a Python script.
4.5.2.1.1. Creating a new Dynamic DNS Service¶
The following example shows how to create a new DynamicDNS on the
dyn.tm System and how to edit some of the fields using the returned
DynamicDNS object.
>>> from dyn.tm.services.ddns import DynamicDNS
>>> # Create a dyn.tmSession
>>> # Assuming you own the zone 'example.com'
>>> dyndns = DynamicDNS('example.com', 'example.com.', 'A', '127.0.0.1')
>>> dyndns.ttl = 180
>>> dyndns.ttl
180
>>> dyndns.record_type
u'A'
4.5.2.1.2. Getting an Existing Dynamic DNS Service¶
The following example shows how to get an existing DynamicDNS from
the dyn.tm System and how to edit some of the same fields mentioned above.
>>> from dyn.tm.services.ddns import DynamicDNS
>>> # Create a dyn.tmSession
>>> # Once again, assuming you own 'example.com'
>>> dyndns = DynamicDNS('example.com', 'example.com.', record_type='A')
>>> dyndns.active
u'Y'
>>> dyndns.deactivate()
>>> dyndns.active
u'N'