| @@ 159-170 (lines=12) @@ | ||
| 156 | * @param int $id |
|
| 157 | * @return void |
|
| 158 | */ |
|
| 159 | public function delete(Request $request, $id) |
|
| 160 | { |
|
| 161 | $repo = new NodeRepository; |
|
| 162 | try { |
|
| 163 | $repo->delete($id); |
|
| 164 | ||
| 165 | return $this->response->noContent(); |
|
| 166 | } catch (DisplayException $ex) { |
|
| 167 | throw new ResourceException($ex->getMessage()); |
|
| 168 | } catch (\Exception $e) { |
|
| 169 | throw new ServiceUnavailableHttpException('An error occured while attempting to delete this node.'); |
|
| 170 | } |
|
| 171 | } |
|
| 172 | } |
|
| 173 | ||
| @@ 175-186 (lines=12) @@ | ||
| 172 | * @param int $id |
|
| 173 | * @return void |
|
| 174 | */ |
|
| 175 | public function suspend(Request $request, $id) |
|
| 176 | { |
|
| 177 | try { |
|
| 178 | $repo = new ServerRepository; |
|
| 179 | $repo->suspend($id); |
|
| 180 | ||
| 181 | return $this->response->noContent(); |
|
| 182 | } catch (DisplayException $ex) { |
|
| 183 | throw new ResourceException($ex->getMessage()); |
|
| 184 | } catch (\Exception $ex) { |
|
| 185 | throw new ServiceUnavailableHttpException('An error occured while attempting to suspend this server instance.'); |
|
| 186 | } |
|
| 187 | } |
|
| 188 | ||
| 189 | /** |
|
| @@ 196-207 (lines=12) @@ | ||
| 193 | * @param int $id |
|
| 194 | * @return void |
|
| 195 | */ |
|
| 196 | public function unsuspend(Request $request, $id) |
|
| 197 | { |
|
| 198 | try { |
|
| 199 | $repo = new ServerRepository; |
|
| 200 | $repo->unsuspend($id); |
|
| 201 | ||
| 202 | return $this->response->noContent(); |
|
| 203 | } catch (DisplayException $ex) { |
|
| 204 | throw new ResourceException($ex->getMessage()); |
|
| 205 | } catch (\Exception $ex) { |
|
| 206 | throw new ServiceUnavailableHttpException('An error occured while attempting to unsuspend this server instance.'); |
|
| 207 | } |
|
| 208 | } |
|
| 209 | ||
| 210 | /** |
|
| @@ 218-229 (lines=12) @@ | ||
| 215 | * @param string|null $force |
|
| 216 | * @return void |
|
| 217 | */ |
|
| 218 | public function delete(Request $request, $id, $force = null) |
|
| 219 | { |
|
| 220 | $repo = new ServerRepository; |
|
| 221 | ||
| 222 | try { |
|
| 223 | $repo->deleteServer($id, $force); |
|
| 224 | ||
| 225 | return $this->response->noContent(); |
|
| 226 | } catch (DisplayException $ex) { |
|
| 227 | throw new ResourceException($ex->getMessage()); |
|
| 228 | } catch (\Exception $e) { |
|
| 229 | throw new ServiceUnavailableHttpException('An error occured while attempting to delete this server.'); |
|
| 230 | } |
|
| 231 | } |
|
| 232 | } |
|
| @@ 138-149 (lines=12) @@ | ||
| 135 | * @param int $id |
|
| 136 | * @return void |
|
| 137 | */ |
|
| 138 | public function delete(Request $request, $id) |
|
| 139 | { |
|
| 140 | $repo = new UserRepository; |
|
| 141 | ||
| 142 | try { |
|
| 143 | $repo->delete($id); |
|
| 144 | ||
| 145 | return $this->response->noContent(); |
|
| 146 | } catch (DisplayException $ex) { |
|
| 147 | throw new ResourceException($ex->getMessage()); |
|
| 148 | } catch (\Exception $ex) { |
|
| 149 | throw new ServiceUnavailableHttpException('Unable to delete this user due to an error.'); |
|
| 150 | } |
|
| 151 | } |
|
| 152 | } |
|