1package VM::EC2::Volume::StatusItem; 2 3=head1 NAME 4 5VM::EC2::Volume::StatusItem - Object describing a volume status event 6 7=head1 SYNOPSIS 8 9 @status_items = $ec2->describe_volume_status(); 10 for my $i (@status_items) { 11 print $i->volume_id,': ',$i->status,"\n"; 12 if (my $e = $i->events) { 13 print $i->volume_id,' event = ',$e; 14 } 15 } 16 17=head1 DESCRIPTION 18 19This object represents an volume status returned by 20$ec2->describe_volume_status(). 21 22=head1 METHODS 23 24These object methods are supported: 25 26 volumeId -- The ID of the affected volume. 27 volume -- The VM::EC2::Volume object corresponding to the volume_id. 28 29 availability_zone -- The availability zone of this volume. 30 31 volumeStatus -- A VM::EC2::Volume::Status object indicating the status of the volume. 32 status -- Shorter version of the above. 33 34 actionsSet -- The list of actions that you might wish to take 35 in response to this status, represented as 36 VM::EC2::Volume::Status::Action objects. 37 actions -- Shorter version of the above. 38 39 eventsSet -- A list of VM::EC2::Volume::Status::Event objects 40 which provide information about the nature and time 41 of the event. 42 events -- Shorter version of the above. 43 44 45NOTE: There are a number of inconsistencies in the AWS documentation 46for this data type. The event and action fields are described as being 47named eventSet and actionSet, but the XML example and practical 48experience show the fields being named eventsSet and actionsSet. The 49volumeStatus is documented as being a list, but practice shows that it 50is a single value only. 51 52=head1 SEE ALSO 53 54L<VM::EC2> 55L<VM::EC2::Generic> 56L<VM::EC2::Instance> 57L<VM::EC2::Tag> 58 59=head1 AUTHOR 60 61Lincoln Stein E<lt>lincoln.stein@gmail.comE<gt>. 62 63Copyright (c) 2012 Ontario Institute for Cancer Research 64 65This package and its accompanying libraries is free software; you can 66redistribute it and/or modify it under the terms of the GPL (either 67version 1, or at your option, any later version) or the Artistic 68License 2.0. Refer to LICENSE for the full license text. In addition, 69please see DISCLAIMER.txt for disclaimers of warranty. 70 71=cut 72 73use strict; 74use base 'VM::EC2::Generic'; 75use VM::EC2::Volume::Status; 76use VM::EC2::Volume::Status::Event; 77use VM::EC2::Volume::Status::Action; 78 79sub valid_fields { 80 my $self = shift; 81 return qw(volumeId availabilityZone volumeStatus eventsSet actionsSet); 82} 83 84sub volume { 85 my $self = shift; 86 return $self->ec2->describe_volumes($self->volumeId); 87} 88 89sub volumeStatus { 90 my $self = shift; 91 my $s = $self->SUPER::volumeStatus or return; 92 return VM::EC2::Volume::Status->new($s,$self->ec2); 93} 94 95sub status { shift->volumeStatus } 96 97sub eventsSet { 98 my $self = shift; 99 my $e = $self->SUPER::eventsSet or return; 100 return map {VM::EC2::Volume::Status::Event->new($_,$self->ec2)} @{$e->{item}}; 101} 102 103sub events { shift->eventsSet } 104 105sub actionsSet { 106 my $self = shift; 107 my $e = $self->SUPER::actionsSet or return; 108 return map {VM::EC2::Volume::Status::Action->new($_,$self->ec2)} @{$e->{item}}; 109} 110 111sub actions { shift->actionsSet } 112 113sub short_name { 114 my $self = shift; 115 my $volume = $self->volumeId; 116 my $status = ($self->status)[0]; 117 return "$volume: $status"; 118} 119 120 1211; 122 123