1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
// --------------------------------------------------------------------- |
4
|
|
|
// |
5
|
|
|
// Copyright (C) 2018-2024 Artem Rodygin |
6
|
|
|
// |
7
|
|
|
// You should have received a copy of the MIT License along with |
8
|
|
|
// this file. If not, see <https://opensource.org/licenses/MIT>. |
9
|
|
|
// |
10
|
|
|
// --------------------------------------------------------------------- |
11
|
|
|
|
12
|
|
|
namespace Linode\Networking\Repository; |
13
|
|
|
|
14
|
|
|
use Linode\Entity; |
15
|
|
|
use Linode\Internal\AbstractRepository; |
16
|
|
|
use Linode\Networking\IPv6Range; |
17
|
|
|
use Linode\Networking\IPv6RangeRepositoryInterface; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @codeCoverageIgnore This class was autogenerated. |
21
|
|
|
*/ |
22
|
|
|
class IPv6RangeRepository extends AbstractRepository implements IPv6RangeRepositoryInterface |
23
|
|
|
{ |
24
|
|
|
public function postIPv6Range(array $parameters = []): IPv6Range |
25
|
|
|
{ |
26
|
|
|
$response = $this->client->post($this->getBaseUri(), $parameters); |
27
|
|
|
$contents = $response->getBody()->getContents(); |
28
|
|
|
$json = json_decode($contents, true); |
29
|
|
|
|
30
|
|
|
return new IPv6Range($this->client, $json); |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
public function deleteIPv6Range(string $range): void |
34
|
|
|
{ |
35
|
|
|
$this->client->delete(sprintf('%s/%s', $this->getBaseUri(), $range)); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
protected function getBaseUri(): string |
39
|
|
|
{ |
40
|
|
|
return '/networking/ipv6/ranges'; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
protected function getSupportedFields(): array |
44
|
|
|
{ |
45
|
|
|
return [ |
46
|
|
|
IPv6Range::FIELD_RANGE, |
47
|
|
|
IPv6Range::FIELD_PREFIX, |
48
|
|
|
IPv6Range::FIELD_REGION, |
49
|
|
|
IPv6Range::FIELD_ROUTE_TARGET, |
50
|
|
|
]; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
protected function jsonToEntity(array $json): Entity |
54
|
|
|
{ |
55
|
|
|
return new IPv6Range($this->client, $json); |
56
|
|
|
} |
57
|
|
|
} |
58
|
|
|
|