Skip to content

Latest commit

 

History

History
88 lines (72 loc) · 2.51 KB

gslb.rst

File metadata and controls

88 lines (72 loc) · 2.51 KB

Monitor

dyn.tm.services.gslb.Monitor

GSLBRegionPoolEntry

dyn.tm.services.gslb.GSLBRegionPoolEntry

GSLBRegion

dyn.tm.services.gslb.GSLBRegion

GSLB

dyn.tm.services.gslb.GSLB

GSLB Examples

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

Creating a new GSLB Service

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

>>> from dyn.tm.services.gslb import Monitor, GSLBRegionPoolEntry, \
...    GSLBRegion, GSLB
>>> # Create a dyn.tmSession
>>> # Assuming you own the zone 'example.com'
>>> zone = 'example.com'
>>> fqdn = zone + '.'
>>> pool = GSLBRegionPoolEntry(zone, fqdn, 'global', '8.8.4.4', None,
...                            label='APIv2 GSLB')
>>> region = GSLBRegion(zone, fqdn, 'mycontactnickname', pool=[pool])
>>> monitor = Monitor('HTTP', 5, expected='Example')
>>> gslb = GSLB(zone, fqdn, 'mycontactname', region=[region], monitor=monitor)

Getting an Existing GSLB Service

The following example shows how to get an existing GSLB from the dyn.tm System and how to edit some of the same fields mentioned above. :

>>> from dyn.tm.services.gslb import GSLB
>>> # Create a dyn.tmSession
>>> # Once again, assuming you own 'example.com'
>>> zone = 'example.com'
>>> fqdn = zone + '.'
>>> gslb = GSLB(zone, fqdn)

Replacing a GSLB Monitor

If you'd like to create a brand new Monitor for your GSLB service, rather than update your existing one, the following example shows how simple it is to accomplish this task :

>>> from dyn.tm.services.gslb import GSLB, Monitor
>>> zone = 'example.com'
>>> fqdn = zone + '.'
>>> gslb = GSLB(zone, fqdn)
>>> gslb.monitor.protocol
'HTTP'
>>> expected_text = "This is the text you're looking for."
>>> new_monitor = Monitor('HTTPS', 10, timeout=500, port=5005,
                          expected=expected_text)
>>> gslb.monitor = new_monitor
>>> gslb.monitor.protocol
'HTTPS'