|
|
|
@ -79,9 +79,10 @@ except ImportError:
|
|
|
|
|
# Let snippet from module_utils/basic.py return a proper error in this case
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
import urllib
|
|
|
|
|
import time
|
|
|
|
|
|
|
|
|
|
from ansible.module_utils.six.moves.urllib.parse import urlencode
|
|
|
|
|
|
|
|
|
|
API_BASE = "http://api.uptimerobot.com/"
|
|
|
|
|
|
|
|
|
|
API_ACTIONS = dict(
|
|
|
|
@ -97,7 +98,7 @@ SUPPORTS_CHECK_MODE = False
|
|
|
|
|
|
|
|
|
|
def checkID(module, params):
|
|
|
|
|
|
|
|
|
|
data = urllib.urlencode(params)
|
|
|
|
|
data = urlencode(params)
|
|
|
|
|
full_uri = API_BASE + API_ACTIONS['status'] + data
|
|
|
|
|
req, info = fetch_url(module, full_uri)
|
|
|
|
|
result = req.read()
|
|
|
|
@ -109,7 +110,7 @@ def checkID(module, params):
|
|
|
|
|
def startMonitor(module, params):
|
|
|
|
|
|
|
|
|
|
params['monitorStatus'] = 1
|
|
|
|
|
data = urllib.urlencode(params)
|
|
|
|
|
data = urlencode(params)
|
|
|
|
|
full_uri = API_BASE + API_ACTIONS['editMonitor'] + data
|
|
|
|
|
req, info = fetch_url(module, full_uri)
|
|
|
|
|
result = req.read()
|
|
|
|
@ -121,7 +122,7 @@ def startMonitor(module, params):
|
|
|
|
|
def pauseMonitor(module, params):
|
|
|
|
|
|
|
|
|
|
params['monitorStatus'] = 0
|
|
|
|
|
data = urllib.urlencode(params)
|
|
|
|
|
data = urlencode(params)
|
|
|
|
|
full_uri = API_BASE + API_ACTIONS['editMonitor'] + data
|
|
|
|
|
req, info = fetch_url(module, full_uri)
|
|
|
|
|
result = req.read()
|
|
|
|
|