v2 dnsimple api uses type vs record_type (#39301)

* v2 dnsimple api uses type vs record_type

https://developer.dnsimple.com/v2/zones/records/#listZoneRecords

* replace prio with priority
This commit is contained in:
styks1987 2018-12-04 07:25:29 -05:00 committed by John R Barker
commit bb6a82d2a9

View file

@ -244,13 +244,13 @@ def main():
if not value: if not value:
module.fail_json(msg="Missing the record value") module.fail_json(msg="Missing the record value")
rr = next((r for r in records if r['name'] == record and r['record_type'] == record_type and r['content'] == value), None) rr = next((r for r in records if r['name'] == record and r['type'] == record_type and r['content'] == value), None)
if state == 'present': if state == 'present':
changed = False changed = False
if is_solo: if is_solo:
# delete any records that have the same name and record type # delete any records that have the same name and record type
same_type = [r['id'] for r in records if r['name'] == record and r['record_type'] == record_type] same_type = [r['id'] for r in records if r['name'] == record and r['type'] == record_type]
if rr: if rr:
same_type = [rid for rid in same_type if rid != rr['id']] same_type = [rid for rid in same_type if rid != rr['id']]
if same_type: if same_type:
@ -260,12 +260,12 @@ def main():
changed = True changed = True
if rr: if rr:
# check if we need to update # check if we need to update
if rr['ttl'] != ttl or rr['prio'] != priority: if rr['ttl'] != ttl or rr['priority'] != priority:
data = {} data = {}
if ttl: if ttl:
data['ttl'] = ttl data['ttl'] = ttl
if priority: if priority:
data['prio'] = priority data['priority'] = priority
if module.check_mode: if module.check_mode:
module.exit_json(changed=True) module.exit_json(changed=True)
else: else:
@ -276,13 +276,13 @@ def main():
# create it # create it
data = { data = {
'name': record, 'name': record,
'record_type': record_type, 'type': record_type,
'content': value, 'content': value,
} }
if ttl: if ttl:
data['ttl'] = ttl data['ttl'] = ttl
if priority: if priority:
data['prio'] = priority data['priority'] = priority
if module.check_mode: if module.check_mode:
module.exit_json(changed=True) module.exit_json(changed=True)
else: else: