1 | <?php |
||
25 | class Ip extends HttpApi |
||
26 | { |
||
27 | /** |
||
28 | * Returns a list of IPs. |
||
29 | * |
||
30 | * @return IndexResponse|ResponseInterface |
||
31 | */ |
||
32 | public function index(?bool $dedicated = null) |
||
33 | { |
||
34 | $params = []; |
||
35 | if (null !== $dedicated) { |
||
36 | Assert::boolean($dedicated); |
||
37 | $params['dedicated'] = $dedicated; |
||
38 | } |
||
39 | |||
40 | $response = $this->httpGet('/v3/ips', $params); |
||
41 | |||
42 | return $this->hydrateResponse($response, IndexResponse::class); |
||
43 | } |
||
44 | |||
45 | /** |
||
46 | * Returns a list of IPs assigned to a domain. |
||
47 | * |
||
48 | * @return IndexResponse|ResponseInterface |
||
49 | */ |
||
50 | public function domainIndex(string $domain) |
||
58 | |||
59 | /** |
||
60 | * Returns a single ip. |
||
61 | * |
||
62 | * @return ShowResponse|ResponseInterface |
||
63 | */ |
||
64 | public function show(string $ip) |
||
72 | |||
73 | /** |
||
74 | * Assign a dedicated IP to the domain specified. |
||
75 | * |
||
76 | * @return UpdateResponse|ResponseInterface |
||
77 | */ |
||
78 | 1 | public function assign(string $domain, string $ip) |
|
79 | { |
||
80 | 1 | Assert::stringNotEmpty($domain); |
|
81 | 1 | Assert::ip($ip); |
|
82 | |||
83 | $params = [ |
||
84 | 1 | 'ip' => $ip, |
|
85 | ]; |
||
86 | |||
87 | 1 | $response = $this->httpPost(sprintf('/v3/domains/%s/ips', $domain), $params); |
|
88 | |||
89 | 1 | return $this->hydrateResponse($response, UpdateResponse::class); |
|
90 | } |
||
91 | |||
92 | /** |
||
93 | * Unassign an IP from the domain specified. |
||
94 | * |
||
95 | * @return UpdateResponse|ResponseInterface |
||
96 | */ |
||
97 | public function unassign(string $domain, string $ip) |
||
106 | } |
||
107 |