Region
Functions
- wrapica.region.coerce_region_id_or_city_name_to_region_id(region_id_or_city_name)
Given either a region id or a region city name, coerce to region id
- wrapica.region.coerce_region_id_or_city_name_to_region_obj(region_id_or_city_name)
Given either a region id or a region city name, coerce to region object
- wrapica.region.get_default_region()
Get the default region, if no region is set, invocate set_default_region and assign global variable Used by bundle and project functions to get the default region when no region is provided
- Returns:
The default region object
- Return type:
Region <https://umccr.github.io/libica/openapi/v3/docs/Region/>
- wrapica.region.get_region_from_bundle_id(bundle_id)
Get the region object from the bundle id
- Parameters:
- Returns:
The region object
- Return type:
- Examples:
1from wrapica.region import get_region_from_bundle_id 2 3bundle_id = "bundle-1234" 4region = get_region_from_bundle_id(bundle_id)
- wrapica.region.get_region_obj_from_city_name(city_name)
Get the region id from the city name
- Parameters:
city_name (
str) – The city name- Return type:
Region- Returns:
The region object
- Examples:
1from wrapica.region import get_region_obj_from_city_name 2 3city_name = "Sydney" 4region = get_region_obj_from_city_name(city_name) 5 6print(f"Region ID: {region.id}, City Name: {region.city_name}")
- wrapica.region.get_region_obj_from_project_id(project_id)
Collect the region object from the project id
- Parameters:
- Returns:
The region object
- Return type:
- Examples:
1from wrapica.region import get_region_obj_from_project_id 2 3project_id = "project-1234" 4region = get_region_obj_from_project_id(project_id)
- wrapica.region.get_region_obj_from_region_id(region_id)
Get region object from the region id
- Parameters:
- Returns:
The region object
- Return type:
Region <https://umccr.github.io/libica/openapi/v3/docs/Region/>
- Examples:
1from wrapica.region import get_region_obj_from_region_id 2 3region_id = "region-1234" 4region = get_region_obj_from_region_id(region_id) 5 6print(f"Region ID: {region.id}, City Name: {region.city_name}")
- wrapica.region.get_regions()
Return a list of regions
- Returns:
The list of regions available to the user in this tenant
- Return type:
List[Region]
- Raises:
ApiException – If an error occurs while retrieving the regions
- Example:
1from wrapica.region import get_regions 2 3regions = get_regions() 4 5if len(regions) == 0: 6 print("No regions found") 7else: 8 print(f"Found {len(regions)} region(s)") 9 for region in regions: 10 print(f"Region ID: {region.id}, City Name: {region.city_name}")
- wrapica.region.set_default_region()
Set the default region Assumes only one region is available to the user This is used by get_default_region, region is stored as a global python variable and is available for the rest of the session.