From 848fc48e65d9fd5ca28bf0ba8e72ac9ca4e07128 Mon Sep 17 00:00:00 2001 From: "Filip.Cieslik" Date: Wed, 22 Jan 2025 09:32:14 +0000 Subject: [PATCH 1/2] [AB#38683] added instance software to public sdk. --- src/eCloud/Client.php | 8 ++++++ src/eCloud/Entities/InstanceSoftware.php | 23 ++++++++++++++++ src/eCloud/InstanceSoftwareClient.php | 35 ++++++++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 src/eCloud/Entities/InstanceSoftware.php create mode 100644 src/eCloud/InstanceSoftwareClient.php diff --git a/src/eCloud/Client.php b/src/eCloud/Client.php index a2d0e0bc..b1dd9d3d 100644 --- a/src/eCloud/Client.php +++ b/src/eCloud/Client.php @@ -415,4 +415,12 @@ public function billingHistory() { return (new BillingHistoryClient($this->httpClient))->auth($this->token); } + + /** + * @return BaseClient + */ + public function instanceSoftware() + { + return (new InstanceSoftwareClient($this->httpClient))->auth($this->token); + } } diff --git a/src/eCloud/Entities/InstanceSoftware.php b/src/eCloud/Entities/InstanceSoftware.php new file mode 100644 index 00000000..df2d286f --- /dev/null +++ b/src/eCloud/Entities/InstanceSoftware.php @@ -0,0 +1,23 @@ + 'id', + 'name' => 'name', + 'instance_id' => 'instanceId', + 'software_id' => 'softwareId', + 'sync' => 'sync', + 'task' => 'task', + 'created_at' => 'createdAt', + 'updated_at' => 'updatedAt', + ]; + } + + public function loadEntity($data) + { + return new InstanceSoftware( + $this->apiToFriendly($data, $this->getEntityMap()) + ); + } +} From ff52640622c0ea10c5febe4187246c336f6acd02 Mon Sep 17 00:00:00 2001 From: "Filip.Cieslik" Date: Wed, 22 Jan 2025 12:15:22 +0000 Subject: [PATCH 2/2] [AB#38683] added entity map to instance. --- src/eCloud/Entities/InstanceSoftware.php | 14 +++++++++++--- src/eCloud/InstanceSoftwareClient.php | 11 +---------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/eCloud/Entities/InstanceSoftware.php b/src/eCloud/Entities/InstanceSoftware.php index df2d286f..69616f5a 100644 --- a/src/eCloud/Entities/InstanceSoftware.php +++ b/src/eCloud/Entities/InstanceSoftware.php @@ -16,8 +16,16 @@ */ class InstanceSoftware extends Entity { - /** - * @var array - */ protected $dates = ['createdAt', 'updatedAt']; + + public static $entityMap = [ + 'id' => 'id', + 'name' => 'name', + 'instance_id' => 'instanceId', + 'software_id' => 'softwareId', + 'sync' => 'sync', + 'task' => 'task', + 'created_at' => 'createdAt', + 'updated_at' => 'updatedAt', + ]; } diff --git a/src/eCloud/InstanceSoftwareClient.php b/src/eCloud/InstanceSoftwareClient.php index 3294d8bb..136f05d1 100644 --- a/src/eCloud/InstanceSoftwareClient.php +++ b/src/eCloud/InstanceSoftwareClient.php @@ -14,16 +14,7 @@ class InstanceSoftwareClient extends Client implements ClientEntityInterface public function getEntityMap() { - return [ - 'id' => 'id', - 'name' => 'name', - 'instance_id' => 'instanceId', - 'software_id' => 'softwareId', - 'sync' => 'sync', - 'task' => 'task', - 'created_at' => 'createdAt', - 'updated_at' => 'updatedAt', - ]; + return InstanceSoftware::$entityMap; } public function loadEntity($data)