/** * Displays the form for cloud account creation * */ public function getCreate($id = false) { $mode = $id !== false ? 'edit' : 'create'; $account = $id !== false ? CloudAccountHelper::findAndDecrypt($id) : null; $providers = Config::get('account_schema'); return View::make('site/account/create_edit', compact('mode', 'account', 'providers')); }
public function exportByAccount() { $id = Input::get('id'); $accountId = Input::get('accountId'); $account = CloudAccountHelper::findAndDecrypt($accountId); Log::info('Logs for ' . $account->name); $result = json_decode($account->credentials); $ret = RemoteAPI::export($id, $result->host, $result->port); Log::info('Logs for Container '); echo '<pre>'; print_r($ret); }
public function postTerminate($id) { $this->check(); $deployment = Deployment::where('user_id', Auth::id())->find($id); $account = CloudAccountHelper::findAndDecrypt($deployment->cloudAccountId); $instanceId = Input::get('instanceID'); Log::error('Terminating Instance :' . $instanceId); $response = $this->executeAction(Input::get('instanceAction'), $account, $deployment, $instanceId); if ($response['status'] == 'OK') { return Redirect::to('/')->with('success', 'Instance Terminated Successfully!'); } else { return Redirect::to('/')->with('error', 'Error while terminating the instance!'); } }
public static function getState($cloudAccountId, $instanceID) { $account = CloudAccountHelper::findAndDecrypt($cloudAccountId); $data = self::executeAction('describeInstances', $account, $instanceID); if ($data['status'] == 'OK') { if (!empty($data['message']['Reservations'][0]['Instances'][0]['State']['Name'])) { return UIHelper::getLabel($data['message']['Reservations'][0]['Instances'][0]['State']['Name']); } else { return UIHelper::getLabel('NA'); } } else { if ($data['status'] == 'error') { return UIHelper::getLabel($data['status']); } else { return UIHelper::getLabel('NA'); } } }