| @@ 246-257 (lines=12) @@ | ||
| 243 | * }) |
|
| 244 | * @Response(204) |
|
| 245 | */ |
|
| 246 | public function suspend(Request $request, $id) |
|
| 247 | { |
|
| 248 | try { |
|
| 249 | $server = new ServerRepository; |
|
| 250 | $server->suspend($id); |
|
| 251 | ||
| 252 | return $this->response->noContent(); |
|
| 253 | } catch (DisplayException $ex) { |
|
| 254 | throw new ResourceException($ex->getMessage()); |
|
| 255 | } catch (\Exception $ex) { |
|
| 256 | throw new ServiceUnavailableHttpException('An error occured while attempting to suspend this server instance.'); |
|
| 257 | } |
|
| 258 | } |
|
| 259 | ||
| 260 | /** |
|
| @@ 270-281 (lines=12) @@ | ||
| 267 | * }) |
|
| 268 | * @Response(204) |
|
| 269 | */ |
|
| 270 | public function unsuspend(Request $request, $id) |
|
| 271 | { |
|
| 272 | try { |
|
| 273 | $server = new ServerRepository; |
|
| 274 | $server->unsuspend($id); |
|
| 275 | ||
| 276 | return $this->response->noContent(); |
|
| 277 | } catch (DisplayException $ex) { |
|
| 278 | throw new ResourceException($ex->getMessage()); |
|
| 279 | } catch (\Exception $ex) { |
|
| 280 | throw new ServiceUnavailableHttpException('An error occured while attempting to unsuspend this server instance.'); |
|
| 281 | } |
|
| 282 | } |
|
| 283 | ||
| 284 | /** |
|
| @@ 295-306 (lines=12) @@ | ||
| 292 | * }) |
|
| 293 | * @Response(204) |
|
| 294 | */ |
|
| 295 | public function delete(Request $request, $id, $force = null) |
|
| 296 | { |
|
| 297 | try { |
|
| 298 | $server = new ServerRepository; |
|
| 299 | $server->deleteServer($id, $force); |
|
| 300 | ||
| 301 | return $this->response->noContent(); |
|
| 302 | } catch (DisplayException $ex) { |
|
| 303 | throw new ResourceException($ex->getMessage()); |
|
| 304 | } catch (\Exception $e) { |
|
| 305 | throw new ServiceUnavailableHttpException('An error occured while attempting to delete this server.'); |
|
| 306 | } |
|
| 307 | } |
|
| 308 | } |
|
| 309 | ||
| @@ 265-276 (lines=12) @@ | ||
| 262 | * }) |
|
| 263 | * @Response(204) |
|
| 264 | */ |
|
| 265 | public function delete(Request $request, $id) |
|
| 266 | { |
|
| 267 | try { |
|
| 268 | $node = new NodeRepository; |
|
| 269 | $node->delete($id); |
|
| 270 | ||
| 271 | return $this->response->noContent(); |
|
| 272 | } catch (DisplayException $ex) { |
|
| 273 | throw new ResourceException($ex->getMessage()); |
|
| 274 | } catch (\Exception $e) { |
|
| 275 | throw new ServiceUnavailableHttpException('An error occured while attempting to delete this node.'); |
|
| 276 | } |
|
| 277 | } |
|
| 278 | } |
|
| 279 | ||
| @@ 185-196 (lines=12) @@ | ||
| 182 | * @Parameter("id", type="integer", required=true, description="The ID of the user to delete.") |
|
| 183 | * }) |
|
| 184 | */ |
|
| 185 | public function delete(Request $request, $id) |
|
| 186 | { |
|
| 187 | try { |
|
| 188 | $user = new UserRepository; |
|
| 189 | $user->delete($id); |
|
| 190 | ||
| 191 | return $this->response->noContent(); |
|
| 192 | } catch (DisplayException $ex) { |
|
| 193 | throw new ResourceException($ex->getMessage()); |
|
| 194 | } catch (\Exception $ex) { |
|
| 195 | throw new ServiceUnavailableHttpException('Unable to delete this user due to an error.'); |
|
| 196 | } |
|
| 197 | } |
|
| 198 | } |
|
| 199 | ||