def get_machine_profiles(base_url, group_id, token): """ Get all the Machine Profiles available on Athera """ url = base_url + route_machine_profiles response = requests.get(url, headers=headers(group_id, token)) return response
def rescan_driver(base_url, group_id, token, driver_id, path): """ Response: [403 Forbidden] Incorrect or inaccessible group_id """ body = {"type": "RESCAN", "path": path} url = base_url + route_driver_id.format(driver_id=driver_id) response = requests.post(url, headers=headers(group_id, token), json=body) return response
def delete_driver(base_url, group_id, token, driver_id): """ Get storage driver from driver_id, you will get information such as on its type, its mounts and its indexing-status. Response: [403 Forbidden] Incorrect or inaccessible group_id """ url = base_url + route_driver_id.format(driver_id=driver_id) response = requests.delete(url, headers=headers(group_id, token)) return response
def get_app_families(base_url, group_id, token): """ App Families represent high-level products, eg Nuke. This endpoint only returns app families for which the authenticated user has an active Entitlement. Response: [403 Forbidden] Incorrect or inaccessible group_id """ url = base_url + route_app_families response = requests.get(url, headers=headers(group_id, token)) return response
def get_jobs(base_url, group_id, token): """ Get all Compute Jobs for the provided Group Response: [403 Forbidden] Incorrect or inaccessible group_id """ url = base_url + route_jobs response = requests.get(url, headers=headers(group_id, token)) return response
def get_drivers(base_url, group_id, token): """ Get all user storage drivers. It gets the drivers associated with the active-group-id and the one of its group lineage. eg: If you provide a project-id, you will get as well the drivers for the org-id. Response: [403 Forbidden] Incorrect or inaccessible group_id """ url = base_url + route_drivers response = requests.get(url, headers=headers(group_id, token)) return response
def get_app(base_url, group_id, token, app_id): """ Apps are children of App Families and are either 'interactive' or 'compute'. They normally have a minor version like 11.2v3. Response: [403 Forbidden] Incorrect or inaccessible group_id Response: [404 Not Found] Incorrect app_id """ url = base_url + route_app.format(app_id=app_id) response = requests.get(url, headers=headers(group_id, token)) return response
def dropcache_driver(base_url, group_id, token, driver_id): """ This action should be avoided as much as possible. Use rescan driver if want a reindex. Response: [403 Forbidden] Incorrect or inaccessible group_id """ body = {"type": "DROP"} url = base_url + route_driver_id.format(driver_id=driver_id) response = requests.post(url, headers=headers(group_id, token), json=body) return response
def get_part(base_url, group_id, token, job_id, part_id): """ Get a single Compute Part for the provided Job, which must belong to the provided Group Response: [403 Forbidden] Incorrect or inaccessible group_id Response: [404 Not Found] Incorrect job_id """ url = base_url + route_part.format(job_id=job_id, part_id=part_id) response = requests.get(url, headers=headers(group_id, token)) return response
def stop_job(base_url, group_id, token, job_id): """ Stop a job in the ACTIVE/READY state Response: [403 Forbidden] Incorrect or inaccessible group_id Response: [404 Not Found] Incorrect job_id """ url = base_url + route_job_stop.format(job_id=job_id) response = requests.post(url, headers=headers(group_id, token)) return response
def create_driver(base_url, group_id, token, storage_driver_request): """ storage_driver_request parameter must be generated using the following function: - create_gcs_storage_driver_request() Response: [403 Forbidden] Incorrect or inaccessible group_id """ url = base_url + route_driver response = requests.post(url, headers=headers(group_id, token), json=storage_driver_request) return response
def stop_session(base_url, group_id, token, session_id): """ Stop a Session in the READY state Response: [403 Forbidden] Incorrect or inaccessible group_id Response: [404 Not Found] Incorrect session_id """ url = base_url + route_session_stop.format(session_id=session_id) response = requests.post(url, headers=headers(group_id, token)) return response
def create_job(base_url, group_id, token, payload): """ Start a compute Job with the provided payload description Response: [403 Forbidden] Incorrect or inaccessible group_id Response: [400 Bad Request] Malformed payload """ url = base_url + route_jobs response = requests.post(url, headers=headers(group_id, token), json=payload, allow_redirects=False) return response
def get_session(base_url, group_id, token, session_id): """ Get a single Session Response: [403 Forbidden] Incorrect or inaccessible group_id Response: [404 Not Found] Incorrect session_id """ url = base_url + route_session.format(session_id=session_id) response = requests.get(url, headers=headers(group_id, token)) return response
def get_user_sessions(base_url, group_id, token, user_id): """ Get all Sessions owned by the provided user_id Response: [403 Forbidden] Incorrect or inaccessible group_id Response: [404 Not Found] Incorrect user_id """ url = base_url + route_user_sessions.format(user_id=user_id) response = requests.get(url, headers=headers(group_id, token)) return response
def get_group_users(base_url, group_id, token, target_group_id=None): """ Get users who belong to a single Group, which must be within the context of the main group. Response: [403 Forbidden] Incorrect or inaccessible group_id Response: [404 Not Found] Incorrect target group """ target = target_group_id if target_group_id else group_id url = base_url + route_group_users.format(group_id=target) response = requests.get(url, headers=headers(group_id, token)) return response
def start_session(base_url, group_id, token, payload): """ Start a new Session with the provided payload specification Response: [403 Forbidden] Incorrect or inaccessible group_id Response: [400 Bad Request] Malformed payload """ url = base_url + route_sessions response = requests.post(url, headers=headers(group_id, token), json=payload) return response
def get_group_children(base_url, group_id, token, target_group_id=None): """ Get the child groups of a single Group, which must be within the context of the main group. Response: [403 Forbidden] Incorrect or inaccessible group_id Response: [404 Not Found] Incorrect target group """ # If target_group_id is supplied use that, otherwise use the base group target = target_group_id if target_group_id else group_id url = base_url + route_group_children.format(group_id=target) response = requests.get(url, headers=headers(group_id, token)) return response