1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Axsor\PhpIPAM\Http\Requests; |
4
|
|
|
|
5
|
|
|
class AddressRequest extends Connector |
6
|
|
|
{ |
7
|
|
|
public function show($address) |
8
|
|
|
{ |
9
|
|
|
$id = get_id_from_variable($address); |
10
|
|
|
|
11
|
|
|
return $this->get("addresses/{$id}"); |
12
|
|
|
} |
13
|
|
|
|
14
|
|
|
public function ping($address) |
15
|
|
|
{ |
16
|
|
|
$id = get_id_from_variable($address); |
17
|
|
|
|
18
|
|
|
return $this->get("addresses/{$id}/ping"); |
19
|
|
|
} |
20
|
|
|
|
21
|
|
|
public function byIp(string $ip) |
22
|
|
|
{ |
23
|
|
|
return $this->get("addresses/search/{$ip}"); |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
public function byHostname(string $hostname) |
27
|
|
|
{ |
28
|
|
|
return $this->get("addresses/search_hostname/{$hostname}"); |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
public function customFields() |
32
|
|
|
{ |
33
|
|
|
return $this->get('addresses/custom_fields'); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
public function tags() |
37
|
|
|
{ |
38
|
|
|
return $this->get('addresses/tags'); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
public function tag($tag) |
42
|
|
|
{ |
43
|
|
|
$id = get_id_from_variable($tag); |
44
|
|
|
|
45
|
|
|
return $this->get("addresses/tags/{$id}"); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
public function tagAddresses($tag) |
49
|
|
|
{ |
50
|
|
|
$id = get_id_from_variable($tag); |
51
|
|
|
|
52
|
|
|
return $this->get("addresses/tags/{$id}/addresses"); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
public function create(array $address) |
56
|
|
|
{ |
57
|
|
|
return $this->post('addresses', $address); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
public function update($address, array $newData) |
61
|
|
|
{ |
62
|
|
|
$id = get_id_from_variable($address); |
63
|
|
|
|
64
|
|
|
return $this->patch("addresses/{$id}", standarize_request_body($newData)); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
public function drop($address) |
68
|
|
|
{ |
69
|
|
|
$id = get_id_from_variable($address); |
70
|
|
|
|
71
|
|
|
return $this->delete("addresses/{$id}"); |
72
|
|
|
} |
73
|
|
|
} |
74
|
|
|
|