1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Axsor\PhpIPAM\Http\Requests; |
4
|
|
|
|
5
|
|
|
class SubnetRequest extends Connector |
6
|
|
|
{ |
7
|
|
|
public function show($subnet) |
8
|
|
|
{ |
9
|
|
|
$id = get_id_from_variable($subnet); |
10
|
|
|
|
11
|
|
|
return $this->get("subnets/{$id}"); |
12
|
|
|
} |
13
|
|
|
|
14
|
|
|
public function usage($subnet) |
15
|
|
|
{ |
16
|
|
|
$id = get_id_from_variable($subnet); |
17
|
|
|
|
18
|
|
|
return $this->get("subnets/{$id}/usage"); |
19
|
|
|
} |
20
|
|
|
|
21
|
|
|
public function freeAddress($subnet) |
22
|
|
|
{ |
23
|
|
|
$id = get_id_from_variable($subnet); |
24
|
|
|
|
25
|
|
|
return $this->get("subnets/{$id}/first_free"); |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
public function slaves($subnet) |
29
|
|
|
{ |
30
|
|
|
$id = get_id_from_variable($subnet); |
31
|
|
|
|
32
|
|
|
return $this->get("subnets/{$id}/slaves"); |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
public function slavesRecursive($subnet) |
36
|
|
|
{ |
37
|
|
|
$id = get_id_from_variable($subnet); |
38
|
|
|
|
39
|
|
|
return $this->get("subnets/{$id}/slaves_recursive"); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
public function addresses($subnet) |
43
|
|
|
{ |
44
|
|
|
$id = get_id_from_variable($subnet); |
45
|
|
|
|
46
|
|
|
return $this->get("subnets/{$id}/addresses"); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
public function ip($subnet, string $ip) |
50
|
|
|
{ |
51
|
|
|
$id = get_id_from_variable($subnet); |
52
|
|
|
|
53
|
|
|
return $this->get("subnets/{$id}/addresses/{$ip}"); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
public function freeSubnet($subnet, int $mask) |
57
|
|
|
{ |
58
|
|
|
$id = get_id_from_variable($subnet); |
59
|
|
|
|
60
|
|
|
return $this->get("subnets/{$id}/first_subnet/{$mask}"); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
public function freeSubnets($subnet, int $mask) |
64
|
|
|
{ |
65
|
|
|
$id = get_id_from_variable($subnet); |
66
|
|
|
|
67
|
|
|
return $this->get("subnets/{$id}/all_subnets/{$mask}"); |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
public function customFields() |
71
|
|
|
{ |
72
|
|
|
return $this->get("subnets/custom_fields"); |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
public function byCidr(string $cidr) |
76
|
|
|
{ |
77
|
|
|
return $this->get("subnets/cidr/{$cidr}"); |
78
|
|
|
} |
79
|
|
|
} |
80
|
|
|
|