@@ -6,7 +6,7 @@ |
||
| 6 | 6 | |
| 7 | 7 | class MissingServerKeyException extends CSFCloudException { |
| 8 | 8 | |
| 9 | - public function __construct() { |
|
| 9 | + public function __construct () { |
|
| 10 | 10 | parent::__construct("Missing server key"); |
| 11 | 11 | } |
| 12 | 12 | |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | private $client_id = null; |
| 11 | 11 | private $client_secret = null; |
| 12 | 12 | |
| 13 | - public function __construct(array $options) { |
|
| 13 | + public function __construct (array $options) { |
|
| 14 | 14 | $options = array_merge([ |
| 15 | 15 | "key" => null, |
| 16 | 16 | "client_id" => null, |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | $this->client_secret = $options["client_secret"]; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - public function GetServerKey() : string { |
|
| 25 | + public function GetServerKey () : string { |
|
| 26 | 26 | if (!$this->server_key) { |
| 27 | 27 | throw new MissingServerKeyException(); |
| 28 | 28 | } |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | |
| 9 | 9 | protected $keymanager; |
| 10 | 10 | |
| 11 | - public function __construct(KeyManager $km) { |
|
| 11 | + public function __construct (KeyManager $km) { |
|
| 12 | 12 | $this->keymanager = $km; |
| 13 | 13 | } |
| 14 | 14 | |
@@ -9,18 +9,18 @@ |
||
| 9 | 9 | |
| 10 | 10 | class Manager extends Resource { |
| 11 | 11 | |
| 12 | - public function ListContainers() : array { |
|
| 12 | + public function ListContainers () : array { |
|
| 13 | 13 | $request = Request::get("https://api.csfcloud.com/container?key=" . urlencode($this->keymanager->GetServerKey())) |
| 14 | 14 | ->expectsText()->send(); |
| 15 | 15 | $cntlist = json_decode($request->body, true); |
| 16 | 16 | return $cntlist; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | - public function GetContainer(string $id) : Container { |
|
| 19 | + public function GetContainer (string $id) : Container { |
|
| 20 | 20 | return new Container($this->keymanager, $id); |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - public function NewContainer(string $template = '') : Container { |
|
| 23 | + public function NewContainer (string $template = '') : Container { |
|
| 24 | 24 | $response = Request::post("https://api.csfcloud.com/container?key=" . urlencode($this->keymanager->GetServerKey())) |
| 25 | 25 | ->sendsJson()->expectsJson()->body(json_encode(["template"=>$template]))->send(); |
| 26 | 26 | return new Container($this->keymanager, $response->body->id); |
@@ -11,47 +11,47 @@ |
||
| 11 | 11 | private $containerId; |
| 12 | 12 | private $statusCache; |
| 13 | 13 | |
| 14 | - public function __construct(KeyManager $km, string $id) { |
|
| 14 | + public function __construct (KeyManager $km, string $id) { |
|
| 15 | 15 | parent::__construct($km); |
| 16 | 16 | $this->containerId = $id; |
| 17 | 17 | $this->UpdateStatus(); |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - private function UpdateStatus() { |
|
| 20 | + private function UpdateStatus () { |
|
| 21 | 21 | $request = Request::get("https://api.csfcloud.com/container/" . urlencode($this->containerId) . "?key=" . urlencode($this->keymanager->GetServerKey()))->expectsText()->send(); |
| 22 | 22 | $this->statusCache = json_decode($request->body, true); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - public function GetId() : string { |
|
| 25 | + public function GetId () : string { |
|
| 26 | 26 | return $this->containerId; |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - public function GetConfiguration() : array { |
|
| 29 | + public function GetConfiguration () : array { |
|
| 30 | 30 | return $this->statusCache["configuration"]; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - public function SetConfiguration(array $cnf) { |
|
| 33 | + public function SetConfiguration (array $cnf) { |
|
| 34 | 34 | $this->statusCache["configuration"] = $cnf; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - public function UpdateChanges() { |
|
| 37 | + public function UpdateChanges () { |
|
| 38 | 38 | Request::put("https://api.csfcloud.com/container/" . urlencode($this->containerId) . "?key=" . urlencode($this->keymanager->GetServerKey())) |
| 39 | 39 | ->sendsJson()->body(json_encode($this->statusCache["configuration"]))->send(); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - public function GetContainerName() : string { |
|
| 42 | + public function GetContainerName () : string { |
|
| 43 | 43 | return $this->statusCache["configuration"]["name"]; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - public function SetContainerName(string $newname) { |
|
| 46 | + public function SetContainerName (string $newname) { |
|
| 47 | 47 | $this->statusCache["configuration"]["name"] = $newname; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - public function IsRunning() : bool { |
|
| 50 | + public function IsRunning () : bool { |
|
| 51 | 51 | return $this->statusCache["running"]; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - public function GetLastLogId() : ?string { |
|
| 54 | + public function GetLastLogId () : ?string { |
|
| 55 | 55 | return $this->statusCache["last_log"]; |
| 56 | 56 | } |
| 57 | 57 | |