| 1 | package Zabbix::API::Proxy; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | use 5.010; | ||
| 6 | use Carp; | ||
| 7 | |||
| 8 | use parent qw/Zabbix::API::CRUDE/; | ||
| 9 | |||
| 10 | sub id { | ||
| 11 | |||
| 12 | ## mutator for id | ||
| 13 | |||
| 14 | my ($self, $value) = @_; | ||
| 15 | |||
| 16 | if (defined $value) { | ||
| 17 | |||
| 18 | $self->data->{proxyid} = $value; | ||
| 19 | return $self->data->{proxyid}; | ||
| 20 | |||
| 21 | } else { | ||
| 22 | |||
| 23 | return $self->data->{proxyid}; | ||
| 24 | |||
| 25 | } | ||
| 26 | |||
| 27 | } | ||
| 28 | |||
| 29 | sub prefix { | ||
| 30 | |||
| 31 | my (undef, $suffix) = @_; | ||
| 32 | |||
| 33 | if ($suffix) { | ||
| 34 | |||
| 35 | return 'proxy'.$suffix; | ||
| 36 | |||
| 37 | } else { | ||
| 38 | |||
| 39 | return 'proxy'; | ||
| 40 | |||
| 41 | } | ||
| 42 | |||
| 43 | } | ||
| 44 | |||
| 45 | sub extension { | ||
| 46 | |||
| 47 | return ( output => 'extend' ); | ||
| 48 | |||
| 49 | } | ||
| 50 | |||
| 51 | sub collides { | ||
| 52 | |||
| 53 | my $self = shift; | ||
| 54 | |||
| 55 | return @{$self->{root}->query(method => $self->prefix('.get'), | ||
| 56 | params => { filter => { host => $self->data->{host} }, | ||
| 57 | $self->extension })}; | ||
| 58 | |||
| 59 | } | ||
| 60 | |||
| 61 | sub name { | ||
| 62 | |||
| 63 | my $self = shift; | ||
| 64 | |||
| 65 | return $self->data->{host} || ''; | ||
| 66 | |||
| 67 | } | ||
| 68 | |||
| 69 | sub push { | ||
| 70 | |||
| 71 | die 'Operations that need push (create, update) are not implemented in the current web API.'; | ||
| 72 | |||
| 73 | } | ||
| 74 | |||
| 75 | 1; | ||
| 76 | __END__ |