in src/ansible_collections/alibaba/apsarastack/plugins/modules/ali_route_entry.py [0:0]
def do_get_route_entry(module, route_table_id, destination_cidrblock):
try:
page = 1
page_size = 50
route_entry = None
route_tables = []
route_table = None
destination_cidrblock = module.params['destination_cidrblock']
while not route_table and len(route_tables) < page_size:
route_tables = get_all_route_tables(module, route_table_id=route_table_id, page=page, page_size=page_size)
for rt in route_tables:
if rt.get("RouteTableId") == route_table_id:
route_table = rt
page + 1
for re in route_table["RouteEntrys"]["RouteEntry"]:
if re.get("DestinationCidrBlock") == destination_cidrblock:
route_entry = get_route_entry_detail(re)
break
return route_entry
except AttributeError as e:
module.fail_json(msg='Failed to create route entry, error: {0}, route_tables: {1}'.format(e, route_tables))
except VPCResponseError as e:
module.fail_json(msg='Failed to create route entry, error: {0}'.format(e))