| @@ 189-200 (lines=12) @@ | ||
| 186 | * @Parameter("id", type="integer", required=true, description="The ID of the user to delete.") |
|
| 187 | * }) |
|
| 188 | */ |
|
| 189 | public function delete(Request $request, $id) |
|
| 190 | { |
|
| 191 | try { |
|
| 192 | $user = new UserRepository; |
|
| 193 | $user->delete($id); |
|
| 194 | ||
| 195 | return $this->response->noContent(); |
|
| 196 | } catch (DisplayException $ex) { |
|
| 197 | throw new ResourceException($ex->getMessage()); |
|
| 198 | } catch (\Exception $ex) { |
|
| 199 | throw new ServiceUnavailableHttpException('Unable to delete this user due to an error.'); |
|
| 200 | } |
|
| 201 | } |
|
| 202 | } |
|
| 203 | ||
| @@ 203-214 (lines=12) @@ | ||
| 200 | * }) |
|
| 201 | * @Response(204) |
|
| 202 | */ |
|
| 203 | public function delete(Request $request, $id) |
|
| 204 | { |
|
| 205 | try { |
|
| 206 | $node = new NodeRepository; |
|
| 207 | $node->delete($id); |
|
| 208 | ||
| 209 | return $this->response->noContent(); |
|
| 210 | } catch (DisplayException $ex) { |
|
| 211 | throw new ResourceException($ex->getMessage()); |
|
| 212 | } catch (\Exception $e) { |
|
| 213 | throw new ServiceUnavailableHttpException('An error occured while attempting to delete this node.'); |
|
| 214 | } |
|
| 215 | } |
|
| 216 | } |
|
| 217 | ||
| @@ 234-245 (lines=12) @@ | ||
| 231 | * }) |
|
| 232 | * @Response(204) |
|
| 233 | */ |
|
| 234 | public function suspend(Request $request, $id) |
|
| 235 | { |
|
| 236 | try { |
|
| 237 | $server = new ServerRepository; |
|
| 238 | $server->suspend($id); |
|
| 239 | ||
| 240 | return $this->response->noContent(); |
|
| 241 | } catch (DisplayException $ex) { |
|
| 242 | throw new ResourceException($ex->getMessage()); |
|
| 243 | } catch (\Exception $ex) { |
|
| 244 | throw new ServiceUnavailableHttpException('An error occured while attempting to suspend this server instance.'); |
|
| 245 | } |
|
| 246 | } |
|
| 247 | ||
| 248 | /** |
|
| @@ 258-269 (lines=12) @@ | ||
| 255 | * }) |
|
| 256 | * @Response(204) |
|
| 257 | */ |
|
| 258 | public function unsuspend(Request $request, $id) |
|
| 259 | { |
|
| 260 | try { |
|
| 261 | $server = new ServerRepository; |
|
| 262 | $server->unsuspend($id); |
|
| 263 | ||
| 264 | return $this->response->noContent(); |
|
| 265 | } catch (DisplayException $ex) { |
|
| 266 | throw new ResourceException($ex->getMessage()); |
|
| 267 | } catch (\Exception $ex) { |
|
| 268 | throw new ServiceUnavailableHttpException('An error occured while attempting to unsuspend this server instance.'); |
|
| 269 | } |
|
| 270 | } |
|
| 271 | ||
| 272 | /** |
|
| @@ 283-294 (lines=12) @@ | ||
| 280 | * }) |
|
| 281 | * @Response(204) |
|
| 282 | */ |
|
| 283 | public function delete(Request $request, $id, $force = null) |
|
| 284 | { |
|
| 285 | try { |
|
| 286 | $server = new ServerRepository; |
|
| 287 | $server->deleteServer($id, $force); |
|
| 288 | ||
| 289 | return $this->response->noContent(); |
|
| 290 | } catch (DisplayException $ex) { |
|
| 291 | throw new ResourceException($ex->getMessage()); |
|
| 292 | } catch (\Exception $e) { |
|
| 293 | throw new ServiceUnavailableHttpException('An error occured while attempting to delete this server.'); |
|
| 294 | } |
|
| 295 | } |
|
| 296 | } |
|
| 297 | ||