Skip to content

Commit

Permalink
Merge pull request #541 from ans-group/feat/38273/38683
Browse files Browse the repository at this point in the history
[AB#38683] added instance software to public sdk.
  • Loading branch information
filipcieslikans authored Jan 22, 2025
2 parents 4d93795 + ff52640 commit 715d558
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/eCloud/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
31 changes: 31 additions & 0 deletions src/eCloud/Entities/InstanceSoftware.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace UKFast\SDK\eCloud\Entities;

use UKFast\SDK\Entity;

/**
* @property string $id
* @property string $name
* @property string $instanceId
* @property string $softwareId
* @property string $sync
* @property string $task
* @property \DateTime $createdAt
* @property \DateTime $updatedAt
*/
class InstanceSoftware extends Entity
{
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',
];
}
26 changes: 26 additions & 0 deletions src/eCloud/InstanceSoftwareClient.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace UKFast\SDK\eCloud;

use UKFast\SDK\Entities\ClientEntityInterface;
use UKFast\SDK\Traits\PageItems;
use UKFast\SDK\eCloud\Entities\InstanceSoftware;

class InstanceSoftwareClient extends Client implements ClientEntityInterface
{
use PageItems;

protected $collectionPath = 'v2/instance-software';

public function getEntityMap()
{
return InstanceSoftware::$entityMap;
}

public function loadEntity($data)
{
return new InstanceSoftware(
$this->apiToFriendly($data, $this->getEntityMap())
);
}
}

0 comments on commit 715d558

Please sign in to comment.