| 1 | package VM::EC2::ReservationSet; | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | VM::EC2::Reservation - Object describing an instance reservation set | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | use VM::EC2; | ||
| 10 | |||
| 11 | $ec2 = VM::EC2->new(...); | ||
| 12 | @instances = $ec2->describe_instances(); | ||
| 13 | for my $i (@instances) { | ||
| 14 | $res = $i->reservationId; | ||
| 15 | $req = $i->requesterId; | ||
| 16 | $owner = $i->ownerId; | ||
| 17 | @groups = $i->groups; | ||
| 18 | } | ||
| 19 | |||
| 20 | =head1 DESCRIPTION | ||
| 21 | |||
| 22 | This object is used internally to manage the output of | ||
| 23 | VM::EC2->describe_instances(). Because reservations are infrequently | ||
| 24 | used, this object is not used directly; instead the reservation and | ||
| 25 | requester IDs contained within it are stored in the | ||
| 26 | VM::EC2::Instance objects returned by describe_instances(). | ||
| 27 | |||
| 28 | =head1 METHODS | ||
| 29 | |||
| 30 | One object method is supported: | ||
| 31 | |||
| 32 | =head2 @instances = $reservation_set->instances() | ||
| 33 | |||
| 34 | This will return the instances contained within the reservation set. | ||
| 35 | |||
| 36 | =head1 SEE ALSO | ||
| 37 | |||
| 38 | L<VM::EC2> | ||
| 39 | L<VM::EC2::Generic> | ||
| 40 | L<VM::EC2::Instance> | ||
| 41 | |||
| 42 | =head1 AUTHOR | ||
| 43 | |||
| 44 | Lincoln Stein E<lt>lincoln.stein@gmail.comE<gt>. | ||
| 45 | |||
| 46 | Copyright (c) 2011 Ontario Institute for Cancer Research | ||
| 47 | |||
| 48 | This package and its accompanying libraries is free software; you can | ||
| 49 | redistribute it and/or modify it under the terms of the GPL (either | ||
| 50 | version 1, or at your option, any later version) or the Artistic | ||
| 51 | License 2.0. Refer to LICENSE for the full license text. In addition, | ||
| 52 | please see DISCLAIMER.txt for disclaimers of warranty. | ||
| 53 | |||
| 54 | =cut | ||
| 55 | |||
| 56 | use strict; | ||
| 57 | use base 'VM::EC2::Generic'; | ||
| 58 | use VM::EC2::Instance::Set; | ||
| 59 | use VM::EC2::Group; | ||
| 60 | |||
| 61 | sub instances { | ||
| 62 | my $self = shift; | ||
| 63 | my $r = $self->payload->{reservationSet}{item} or return; | ||
| 64 | return map {VM::EC2::Instance::Set->new($_,$self->aws,$self->xmlns,$self->requestId)->instances} @$r; | ||
| 65 | } | ||
| 66 | |||
| 67 | 1; |