Skip to content

Commit 8843224

Browse files
authored
Merge pull request #48 from ukfast/master
Merge in UKFast master
2 parents a1cf8d0 + 3d4a3d8 commit 8843224

File tree

7 files changed

+66
-100
lines changed

7 files changed

+66
-100
lines changed

src/Loadbalancers/CertClient.php

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
3+
namespace UKFast\SDK\Loadbalancers;
4+
5+
use UKFast\SDK\Client as BaseClient;
6+
use UKFast\SDK\Loadbalancers\Entities\Cert;
7+
8+
class CertClient extends BaseClient
9+
{
10+
protected $basePath = 'loadbalancers/';
11+
12+
const MAP = [
13+
'listener_id' => 'listenerId',
14+
'created_at' => 'createdAt',
15+
'updated_at' => 'updatedAt',
16+
'expires_at' => 'expiresAt',
17+
'ca_bundle' => 'caBundle',
18+
];
19+
20+
/**
21+
* Gets a paginated response of all Certs
22+
*
23+
* @param int $page
24+
* @param int $perPage
25+
* @param array $filters
26+
* @return \UKFast\SDK\Page
27+
*/
28+
public function getPage($page = 1, $perPage = 15, $filters = [])
29+
{
30+
$filters = $this->friendlyToApi($filters, self::MAP);
31+
$page = $this->paginatedRequest('v2/certs', $page, $perPage, $filters);
32+
$page->serializeWith(function ($item) {
33+
return $this->serializeCert($item);
34+
});
35+
36+
return $page;
37+
}
38+
39+
/**
40+
* @return \UKFast\SDK\Loadbalancers\Entities\Cert
41+
*/
42+
public function serializeCert($raw)
43+
{
44+
return new Cert($this->apiToFriendly($raw, self::MAP));
45+
}
46+
}

src/Loadbalancers/Client.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ public function vips()
3737
{
3838
return (new VipClient($this->httpClient))->auth($this->token);
3939
}
40+
41+
public function certs()
42+
{
43+
return (new CertClient($this->httpClient))->auth($this->token);
44+
}
4045

4146
public function accessIps()
4247
{

src/Loadbalancers/ListenerClient.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ class ListenerClient extends BaseClient implements ClientEntityInterface
4040

4141
const CERT_MAP = [
4242
'frontend_id' => 'frontendId',
43-
'ca_bundle' => 'caBundle'
43+
'ca_bundle' => 'caBundle',
44+
'expires_at' => 'expiresAt',
4445
];
4546

4647

src/eCloud/Client.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -328,14 +328,6 @@ public function loadBalancers()
328328
return (new LoadBalancerClient($this->httpClient))->auth($this->token);
329329
}
330330

331-
/**
332-
* @return BaseClient
333-
*/
334-
public function monitorings()
335-
{
336-
return (new MonitoringClient($this->httpClient))->auth($this->token);
337-
}
338-
339331
/**
340332
* @return BaseClient
341333
*/

src/eCloud/Entities/FloatingIp.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,23 @@
99
* @property string $vpcId
1010
* @property string $availabilityZoneId
1111
* @property string $ipAddress
12+
* @property string $rdnsHostname
1213
* @property string $resourceId
1314
* @property string $createdAt
1415
* @property string $updatedAt
1516
*/
1617
class FloatingIp extends Entity
1718
{
1819
protected $dates = ['createdAt', 'updatedAt'];
20+
21+
public static $entityMap = [
22+
'id' => 'id',
23+
'vpc_id' => 'vpcId',
24+
'availability_zone_id' => 'availabilityZoneId',
25+
'ip_address' => 'ipAddress',
26+
'rdns_hostname' => 'rdnsHostname',
27+
'resource_id' => 'resourceId',
28+
'created_at' => 'createdAt',
29+
'updated_at' => 'updatedAt',
30+
];
1931
}

src/eCloud/FloatingIpClient.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,7 @@ class FloatingIpClient extends Client implements ClientEntityInterface
1414

1515
public function getEntityMap()
1616
{
17-
return [
18-
'id' => 'id',
19-
'vpc_id' => 'vpcId',
20-
'availability_zone_id' => 'availabilityZoneId',
21-
'ip_address' => 'ipAddress',
22-
'resource_id' => 'resourceId',
23-
'created_at' => 'createdAt',
24-
'updated_at' => 'updatedAt',
25-
];
17+
return FloatingIp::$entityMap;
2618
}
2719

2820
public function loadEntity($data)

src/eCloud/MonitoringClient.php

Lines changed: 0 additions & 82 deletions
This file was deleted.

0 commit comments

Comments
 (0)