| 1 | package VM::EC2::Instance::Status::Event; | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | VM::EC2::Instance::Status::Event - Object describing a scheduled instance maintenance event | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | @status_items = $ec2->describe_instance_status(); | ||
| 10 | for my $i (@status_items) { | ||
| 11 | for my $event ($i->events) { | ||
| 12 | print $i->instance_id,': ', | ||
| 13 | $event->code,' ', | ||
| 14 | $event->description, ' ', | ||
| 15 | $event->notBefore, ' ', | ||
| 16 | $event->notAfter,"\n"; | ||
| 17 | } | ||
| 18 | } | ||
| 19 | |||
| 20 | =head1 DESCRIPTION | ||
| 21 | |||
| 22 | This objects describes a scheduled maintenance event on an instance, | ||
| 23 | and is returned by calling the events() method of one of the status | ||
| 24 | item objects returned by $ec2->describe_instance_status(). | ||
| 25 | |||
| 26 | NOTE: There is an inconsistency in the AWS documentation for this data | ||
| 27 | type. The events field is documented as being a list, but the examples | ||
| 28 | shown show a single object. At release time, I was unable to verify | ||
| 29 | which is correct and have written the code such that it will detect a | ||
| 30 | single value in the response object and return this as a single-element | ||
| 31 | list. | ||
| 32 | |||
| 33 | =head1 METHODS | ||
| 34 | |||
| 35 | code() -- The code for this event, one of "instance-reboot", | ||
| 36 | "system-reboot", "instance-retirement" | ||
| 37 | |||
| 38 | description() -- A description of the event. | ||
| 39 | |||
| 40 | notBefore() -- The earliest scheduled start time for the event. | ||
| 41 | |||
| 42 | notAfter() -- The latest scheduled end time for the event. | ||
| 43 | |||
| 44 | When used in a string context, this object interpolates as a string in | ||
| 45 | the form: | ||
| 46 | |||
| 47 | system-reboot [2011-12-05T13:00:00+0000 - 2011-12-06T13:00:00+000] | ||
| 48 | |||
| 49 | =head1 SEE ALSO | ||
| 50 | |||
| 51 | L<VM::EC2> | ||
| 52 | L<VM::EC2::Generic> | ||
| 53 | L<VM::EC2::Instance> | ||
| 54 | L<VM::EC2::Instance::State> | ||
| 55 | L<VM::EC2::Instance::Status> | ||
| 56 | L<VM::EC2::Instance::StatusItem> | ||
| 57 | L<VM::EC2::Instance::Status::Details> | ||
| 58 | L<VM::EC2::Tag> | ||
| 59 | |||
| 60 | =head1 AUTHOR | ||
| 61 | |||
| 62 | Lincoln Stein E<lt>lincoln.stein@gmail.comE<gt>. | ||
| 63 | |||
| 64 | Copyright (c) 2012 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 | use strict; | ||
| 75 | use base 'VM::EC2::Generic'; | ||
| 76 | |||
| 77 | use strict; | ||
| 78 | |||
| 79 | sub valid_fields { | ||
| 80 | my $self = shift; | ||
| 81 | return qw(code description notBefore notAfter); | ||
| 82 | } | ||
| 83 | |||
| 84 | sub short_name { | ||
| 85 | my $self = shift; | ||
| 86 | return $self->code . '['.$self->notBefore.' - '.$self->notAfter.']';; | ||
| 87 | } | ||
| 88 | |||
| 89 | 1; | ||
| 90 |