public static function getAllGatewayProfilesData() { if (Session::has("super-admin")) { $gateways = Airavata::getAllGateways(Session::get('authz-token')); } else { $gateways[0] = Airavata::getGateway(Session::get('authz-token'), Session::get("gateway_id")); } $gatewayProfiles = Airavata::getAllGatewayResourceProfiles(Session::get('authz-token')); //var_dump( $gatewayProfiles); exit; //$gatewayProfileIds = array("GatewayTest3_57726e98-313f-4e7c-87a5-18e69928afb5", "GatewayTest4_4fd9fb28-4ced-4149-bdbd-1f276077dad8"); foreach ($gateways as $key => $gw) { $gateways[$key]->profile = array(); foreach ((array) $gatewayProfiles as $index => $gp) { if ($gw->gatewayId == $gp->gatewayID) { foreach ((array) $gp->computeResourcePreferences as $i => $crp) { $gatewayProfiles[$index]->computeResourcePreferences[$i]->crDetails = Airavata::getComputeResource(Session::get('authz-token'), $crp->computeResourceId); } foreach ((array) $gp->storagePreferences as $j => $srp) { $gatewayProfiles[$index]->storagePreferences[$j]->srDetails = Airavata::getStorageResource(Session::get('authz-token'), $srp->storageResourceId); } $gateways[$key]->profile = $gatewayProfiles[$index]; } } } //var_dump( $gatewayProfiles[0]->computeResourcePreferences[0]->crDetails); exit; return $gateways; }
/** * Get the ComputeResourceDescription with the given ID * @param $id * @return null */ public static function get_storage_resource($id) { $computeResource = null; try { /* if (Config::get('pga_config.airavata')['enable-app-catalog-cache']) { if (Cache::has('CR-' . $id)) { return Cache::get('CR-' . $id); } else { $computeResource = Airavata::getComputeResource(Session::get('authz-token'), $id); Cache::put('CR-' . $id, $computeResource, Config::get('pga_config.airavata')['app-catalog-cache-duration']); return $computeResource; } } else { */ return Airavata::getStorageResource(Session::get('authz-token'), $id); /* } */ } catch (InvalidRequestException $ire) { CommonUtilities::print_error_message('<p>There was a problem getting the storage resource. Please try again later or submit a bug report using the link in the Help menu.</p>' . '<p>InvalidRequestException: ' . $ire->getMessage() . '</p>'); } catch (AiravataClientException $ace) { CommonUtilities::print_error_message('<p>There was a problem getting the storage resource. Please try again later or submit a bug report using the link in the Help menu.</p>' . '<p>Airavata Client Exception: ' . $ace->getMessage() . '</p>'); } catch (AiravataSystemException $ase) { CommonUtilities::print_error_message('<p>There was a problem getting the storage resource. Please try again later or submit a bug report using the link in the Help menu.</p>' . '<p>Airavata System Exception: ' . $ase->getMessage() . '</p>'); } }