| 1 | package VM::EC2::REST::monitoring; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use VM::EC2 ''; # important not to import anything! | ||
| 5 | package VM::EC2; # add methods to VM::EC2 | ||
| 6 | |||
| 7 | VM::EC2::Dispatch->register( | ||
| 8 | MonitorInstances => 'fetch_items,instancesSet,VM::EC2::Instance::MonitoringState', | ||
| 9 | UnmonitorInstances => 'fetch_items,instancesSet,VM::EC2::Instance::MonitoringState', | ||
| 10 | ); | ||
| 11 | |||
| 12 | =head1 NAME VM::EC2::REST::monitoring | ||
| 13 | |||
| 14 | =head1 SYNOPSIS | ||
| 15 | |||
| 16 | use VM::EC2 ':misc'; | ||
| 17 | |||
| 18 | =head1 METHODS | ||
| 19 | |||
| 20 | These methods enable the monitoring/unmonitoring of instances. | ||
| 21 | |||
| 22 | =head2 @monitoring_state = $ec2->monitor_instances(@list_of_instanceIds) | ||
| 23 | |||
| 24 | =head2 @monitoring_state = $ec2->monitor_instances(-instance_id=>\@instanceIds) | ||
| 25 | |||
| 26 | This method enables monitoring for the listed instances and returns a | ||
| 27 | list of VM::EC2::Instance::MonitoringState objects. You can | ||
| 28 | later use these objects to activate and inactivate monitoring. | ||
| 29 | |||
| 30 | =cut | ||
| 31 | |||
| 32 | sub monitor_instances { | ||
| 33 | my $self = shift; | ||
| 34 | my %args = $self->args('-instance_id',@_); | ||
| 35 | my @params = $self->list_parm('InstanceId',\%args); | ||
| 36 | return $self->call('MonitorInstances',@params); | ||
| 37 | } | ||
| 38 | |||
| 39 | =head2 @monitoring_state = $ec2->unmonitor_instances(@list_of_instanceIds) | ||
| 40 | |||
| 41 | =head2 @monitoring_state = $ec2->unmonitor_instances(-instance_id=>\@instanceIds) | ||
| 42 | |||
| 43 | This method disables monitoring for the listed instances and returns a | ||
| 44 | list of VM::EC2::Instance::MonitoringState objects. You can | ||
| 45 | later use these objects to activate and inactivate monitoring. | ||
| 46 | |||
| 47 | =cut | ||
| 48 | |||
| 49 | sub unmonitor_instances { | ||
| 50 | my $self = shift; | ||
| 51 | my %args = $self->args('-instance_id',@_); | ||
| 52 | my @params = $self->list_parm('InstanceId',\%args); | ||
| 53 | return $self->call('UnmonitorInstances',@params); | ||
| 54 | } | ||
| 55 | |||
| 56 | =head1 SEE ALSO | ||
| 57 | |||
| 58 | L<VM::EC2> | ||
| 59 | |||
| 60 | =head1 AUTHOR | ||
| 61 | |||
| 62 | Lincoln Stein E<lt>lincoln.stein@gmail.comE<gt>. | ||
| 63 | |||
| 64 | Copyright (c) 2011 Ontario Institute for Cancer Research | ||
| 65 | |||
| 66 | This package and its accompanying libraries is free software; you can | ||
| 67 | redistribute it and/or modify it under the terms of the GPL (either | ||
| 68 | version 1, or at your option, any later version) or the Artistic | ||
| 69 | License 2.0. Refer to LICENSE for the full license text. In addition, | ||
| 70 | please see DISCLAIMER.txt for disclaimers of warranty. | ||
| 71 | |||
| 72 | =cut | ||
| 73 | |||
| 74 | |||
| 75 | 1; |