mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
uptimerobot.py: added missing api actions
This commit is contained in:
parent
f1c9b56646
commit
cd23d61e69
2 changed files with 21 additions and 5 deletions
|
@ -0,0 +1,2 @@
|
|||
major_changes:
|
||||
- added all missing actions offered by the uptimerobot api (v2)
|
|
@ -99,7 +99,7 @@ if __name__ == '__main__':
|
|||
def main():
|
||||
module = AnsibleModule(
|
||||
argument_spec=dict(
|
||||
api_key=dict(type='str', required=True),
|
||||
api_key=dict(type='str', required=True, aliases=['apikey']),
|
||||
action=dict(
|
||||
type='str',
|
||||
required=True,
|
||||
|
@ -121,20 +121,34 @@ if __name__ == '__main__':
|
|||
'getPSPs',
|
||||
'newPSP',
|
||||
'editPSP',
|
||||
'deletePSP'
|
||||
]
|
||||
'deletePSP',
|
||||
# for backwards compatibility
|
||||
'started',
|
||||
'paused'
|
||||
],
|
||||
aliases=['state']
|
||||
),
|
||||
params=dict(type='dict', required=False)
|
||||
params=dict(type='dict', required=False),
|
||||
# for backwards compatibility
|
||||
state=dict(type='str', required=False),
|
||||
monitorid=dict(type='str', required=False)
|
||||
),
|
||||
supports_check_mode=SUPPORTS_CHECK_MODE
|
||||
)
|
||||
|
||||
action = module.params['action']
|
||||
# collect necessary information for the api call
|
||||
params = module.params['params'] or dict()
|
||||
action = module.params['action']
|
||||
params['api_key'] = module.params['api_key']
|
||||
params['format'] = API_FORMAT
|
||||
params['noJsonCallback'] = API_NOJSONCALLBACK
|
||||
|
||||
# test for backwards compatibility
|
||||
if module.params['action'] in ['started', 'paused']:
|
||||
action = 'editMonitor'
|
||||
params['status'] = 1 if module.params['action'] == 'started' else 0
|
||||
params['id'] = module.params['monitorid']
|
||||
|
||||
try:
|
||||
result = uptimerobot_api_call(action, params, module=module)
|
||||
module.exit_json(changed=True, result=result)
|
||||
|
|
Loading…
Reference in a new issue