BigIP-iControl
view release on metacpan or search on metacpan
lib/BigIP/iControl.pm view on Meta::CPAN
sub get_event_subscription {
my ($self, $id)=@_;
return $self->_request(module => 'Management', interface => 'EventSubscription', method => 'query', data => { id_list => [$id] })
}
=head3 remove_event_subscription
=cut
sub remove_event_subscription {
my ($self, $id)=@_;
return $self->_request(module => 'Management', interface => 'EventSubscription', method => 'remove', data => { id_list => [$id] })
}
=head3 get_event_subscription_state
=cut
sub _get_event_subscription_state {
my ($self,$id) = @_;
return @{$self->_request(module => 'Management', interface => 'EventSubscription', method => 'get_state', data => { id_list => [$id] })}[0]
}
=head3 get_event_subscription_url
=cut
sub get_event_subscription_url {
my ($self,$id) = @_;
return @{$self->_request(module => 'Management', interface => 'EventSubscription', method => 'get_url', data => { id_list => [$id] })}[0]
}
sub _get_event_subscription_proxy_url {
my ($self,$id) = @_;
return @{$self->_request(module => 'Management', interface => 'EventSubscription', method => 'get_proxy_url', data => { id_list => [$id] })}[0]
}
sub _get_event_subscription_authentication {
my ($self,$id) = @_;
return @{$self->_request(module => 'Management', interface => 'EventSubscription', method => 'get_proxy_url', data => { id_list => [$id] })}[0]
}
sub get_subscription_list {
my $self = shift;
my @subs;
foreach (@{$self->_request(module => 'Management', interface => 'EventSubscription', method => 'get_list')}){push @subs, $_}
return @subs
}
=head3 get_subscription_list
This method is an analog of B<get_event_subscription>
=cut
=head3 create_subscription_list (%args)
my $subscription = $ic->create_subscription_list (
name => 'my_subscription_name',
url => 'http://company.com/my/eventnotification/endpoint,
username => 'username',
password => 'password',
ttl => -1,
min_events_per_timeslice => 10,
max_timeslice => 10
);
Creates an event subscription with the target system. This method requires the following parameters:
=over 3
=item name
A user-friendly name for the subscription.
=item url
The target URL endpoint for the event notification interface to send event notifications.
=item username
The basic authentication username required to access the URL endpoint.
=item password
The basic authentication password required to access the URL endpoint.
=item ttl
The time to live (in seconds) for this subscription. After the ttl is reached, the subscription
will be removed from the system. A value of -1 indicates an infinite life time.
=item min_events_per_timeslice
The minimum number of events needed to trigger a notification. If this value is 50, then this
means that when 50 events are queued up they will be sent to the notification endpoint no matter
what the max_timeslice is set to.
=item max_timeslice
This maximum time to wait (in seconds) before event notifications are sent to the notification
endpoint. If this value is 30, then after 30 seconds a notification will be sent with the events
in the subscription queue.
=back
=cut
sub create_subscription_list {
my ($self, %args)=@_;
$args{name} or return 'Request error: missing "name" parameter';
$args{url} or return 'Request error: missing "url" parameter';
#$args{username} or return 'Request error: missing "username" parameter';
#$args{password} or return 'Request error: missing "password" parameter';
$args{ttl} =~ /^(-)?\d+$/ or return 'Request error: missing or incorrect "ttl" parameter';
$args{min_events_per_timeslice} =~ /^(-)?\d+$/ or return 'Request error: missing or incorrect "min_events_per_timeslice" parameter';
$args{max_timeslice} =~ /^(-)?\d+$/ or return 'Request error: missing or incorrect "max_timeslice" parameter';
@{$args{event_type}} > 0 or return 'Request error: missing "event_type" parameter';
foreach my $event (@{$args{event_type}}) {
exists $event_types->{$event} or return "Request error: unknown \"event_type\" parameter \"$event\"";
}
my $sub_detail_list= {
name => $args{name},
event_type_list => [@{$args{event_type}}],
url => $args{url},
url_credentials => {
auth_mode => 'AUTHMODE_NONE',
#username => $args{username},
#password => $args{password}
},
ttl => $args{ttl},
min_events_per_timeslice => $args{min_events_per_timeslice},
max_timeslice => $args{max_timeslice},
enabled_state => 'STATE_ENABLED'
};
return $self->_request(module => 'Management', interface => 'EventSubscription', method => 'create', data => {sub_detail_list => [$sub_detail_list]});
}
=head1 NOTES
=head3 Statistic Methods
Within iControl, statistical values are a 64-bit unsigned integer represented as a B<Common::ULong64> object.
The ULong64 object is a stuct of two 32-bit values. This representation is used as there is no native
support for the encoding of 64-bit numbers in SOAP.
The ULong object has the following structure;
({
STATISTIC_NAME => {
high => long
low => long
}
}, bless Common::ULong64)
Where high is the unsigned 32-bit integer value of the high-order portion of the measured value and low is
the unsigned 32-bit integer value of the low-order portion of the measured value.
In non-stringified statistic methods, these return values are ULong64 objects as returned by the iControl API.
In stringified statistic method calls, the values are processed on the client side into a local 64-bit representation
( run in 2.072 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )