in src/ansible_collections/alibaba/apsarastack/plugins/modules/ali_eip.py [0:0]
def find_eip(conn, module, ip_address, instance_id, allocation_id):
try:
eip = None
eips = conn.describe_eip_addresses()
for e in eips:
if instance_id and e.instance_id != instance_id:
continue
if ip_address and e.ip_address != ip_address:
continue
if allocation_id and e.allocation_id != allocation_id:
continue
eip = e
return eip, eips
except Exception as e:
module.fail_json(msg="Failed to describe EIPs: {0}".format(e))