Implement server creation though the API.
Also implements auto-deployment to specific locations and ports.
This commit is contained in:
parent
97ee95b4da
commit
5ed164e13e
24 changed files with 927 additions and 223 deletions
78
app/Models/Objects/DeploymentObject.php
Normal file
78
app/Models/Objects/DeploymentObject.php
Normal file
|
@ -0,0 +1,78 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Models\Objects;
|
||||
|
||||
class DeploymentObject
|
||||
{
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $dedicated = false;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $locations = [];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $ports = [];
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isDedicated(): bool
|
||||
{
|
||||
return $this->dedicated;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $dedicated
|
||||
* @return $this
|
||||
*/
|
||||
public function setDedicated(bool $dedicated)
|
||||
{
|
||||
$this->dedicated = $dedicated;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getLocations(): array
|
||||
{
|
||||
return $this->locations;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $locations
|
||||
* @return $this
|
||||
*/
|
||||
public function setLocations(array $locations)
|
||||
{
|
||||
$this->locations = $locations;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getPorts(): array
|
||||
{
|
||||
return $this->ports;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $ports
|
||||
* @return $this
|
||||
*/
|
||||
public function setPorts(array $ports)
|
||||
{
|
||||
$this->ports = $ports;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
|
@ -66,13 +66,15 @@ class Server extends Model implements CleansAttributes, ValidableContract
|
|||
'allocation_id' => 'required',
|
||||
'pack_id' => 'sometimes',
|
||||
'skip_scripts' => 'sometimes',
|
||||
'image' => 'required',
|
||||
'startup' => 'required',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $dataIntegrityRules = [
|
||||
'owner_id' => 'exists:users,id',
|
||||
'owner_id' => 'integer|exists:users,id',
|
||||
'name' => 'string|min:1|max:255',
|
||||
'node_id' => 'exists:nodes,id',
|
||||
'description' => 'string',
|
||||
|
@ -85,8 +87,9 @@ class Server extends Model implements CleansAttributes, ValidableContract
|
|||
'nest_id' => 'exists:nests,id',
|
||||
'egg_id' => 'exists:eggs,id',
|
||||
'pack_id' => 'nullable|numeric|min:0',
|
||||
'startup' => 'nullable|string',
|
||||
'startup' => 'string',
|
||||
'skip_scripts' => 'boolean',
|
||||
'image' => 'string|max:255',
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue