cleanup
This commit is contained in:
parent
8c7c938c6a
commit
bf5c36b232
|
@ -14,17 +14,6 @@ use Illuminate\Support\Facades\Http;
|
||||||
|
|
||||||
class Pterodactyl
|
class Pterodactyl
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* @return null
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public static function getNests()
|
|
||||||
{
|
|
||||||
$response = self::client()->get('/application/nests');
|
|
||||||
if ($response->failed()) throw self::getException();
|
|
||||||
return $response->json()['data'];
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO: Extend error handling (maybe logger for more errors when debugging)
|
//TODO: Extend error handling (maybe logger for more errors when debugging)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -70,6 +59,17 @@ class Pterodactyl
|
||||||
return $response->json()['data'];
|
return $response->json()['data'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return null
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static function getNests()
|
||||||
|
{
|
||||||
|
$response = self::client()->get('/application/nests');
|
||||||
|
if ($response->failed()) throw self::getException();
|
||||||
|
return $response->json()['data'];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return mixed
|
* @return mixed
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
|
@ -84,10 +84,10 @@ class Pterodactyl
|
||||||
/**
|
/**
|
||||||
* @param Node $node
|
* @param Node $node
|
||||||
* @return mixed
|
* @return mixed
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static function getFreeAllocationId(Node $node)
|
public static function getFreeAllocationId(Node $node)
|
||||||
{
|
{
|
||||||
|
|
||||||
return self::getFreeAllocations($node)[0]['attributes']['id'] ?? null;
|
return self::getFreeAllocations($node)[0]['attributes']['id'] ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,6 +114,7 @@ class Pterodactyl
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Node $node
|
* @param Node $node
|
||||||
|
* @return array|mixed
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static function getAllocations(Node $node)
|
public static function getAllocations(Node $node)
|
||||||
|
@ -142,21 +143,21 @@ class Pterodactyl
|
||||||
public static function createServer(Server $server, Egg $egg, int $allocationId)
|
public static function createServer(Server $server, Egg $egg, int $allocationId)
|
||||||
{
|
{
|
||||||
return self::client()->post("/application/servers", [
|
return self::client()->post("/application/servers", [
|
||||||
"name" => $server->name,
|
"name" => $server->name,
|
||||||
"external_id" => $server->id,
|
"external_id" => $server->id,
|
||||||
"user" => $server->user->pterodactyl_id,
|
"user" => $server->user->pterodactyl_id,
|
||||||
"egg" => $egg->id,
|
"egg" => $egg->id,
|
||||||
"docker_image" => $egg->docker_image,
|
"docker_image" => $egg->docker_image,
|
||||||
"startup" => $egg->startup,
|
"startup" => $egg->startup,
|
||||||
"environment" => $egg->getEnvironmentVariables(),
|
"environment" => $egg->getEnvironmentVariables(),
|
||||||
"limits" => [
|
"limits" => [
|
||||||
"memory" => $server->product->memory,
|
"memory" => $server->product->memory,
|
||||||
"swap" => $server->product->swap,
|
"swap" => $server->product->swap,
|
||||||
"disk" => $server->product->disk,
|
"disk" => $server->product->disk,
|
||||||
"io" => $server->product->io,
|
"io" => $server->product->io,
|
||||||
"cpu" => $server->product->cpu
|
"cpu" => $server->product->cpu
|
||||||
],
|
],
|
||||||
"feature_limits" => [
|
"feature_limits" => [
|
||||||
"databases" => $server->product->databases,
|
"databases" => $server->product->databases,
|
||||||
"backups" => $server->product->backups,
|
"backups" => $server->product->backups,
|
||||||
"allocations" => $server->product->allocations,
|
"allocations" => $server->product->allocations,
|
||||||
|
|
|
@ -50,8 +50,7 @@ class OverViewController extends Controller
|
||||||
'syncLastUpdate' => $syncLastUpdate
|
'syncLastUpdate' => $syncLastUpdate
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description Sync locations,nodes,nests,eggs with the linked pterodactyl panel
|
* @description Sync locations,nodes,nests,eggs with the linked pterodactyl panel
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue