| 1 | package VM::EC2::Instance::Status::Details; | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | VM::EC2::Instance::Status::Details - Object describing the details of an instance status check | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | @status_items = $ec2->describe_instance_status(); | ||
| 10 | for my $i (@status_items) { | ||
| 11 | print $i->instance_id, | ||
| 12 | ': instance check=',$i->instance_status, | ||
| 13 | ', system check=',$i->system_status,"\n"; | ||
| 14 | if ($i->instance_status ne 'ok') { | ||
| 15 | my @details = $i->instance_status->details; | ||
| 16 | for my $d (@details) { | ||
| 17 | print $d->name,"\n"; | ||
| 18 | print $d->status,"\n"; | ||
| 19 | print $d->impaired_since,"\n"; | ||
| 20 | } | ||
| 21 | } | ||
| 22 | } | ||
| 23 | |||
| 24 | =head1 DESCRIPTION | ||
| 25 | |||
| 26 | This object represents additional details about a failed system or | ||
| 27 | instance status check. | ||
| 28 | |||
| 29 | =head1 METHODS | ||
| 30 | |||
| 31 | These methods are supported: | ||
| 32 | |||
| 33 | name() -- The type of instance status detail, such as "reachability". | ||
| 34 | status() -- The status of the check, "passed", "failed" or "insufficient-data". | ||
| 35 | impaired_since() -- The time when a status check failed as a DateTime string. | ||
| 36 | |||
| 37 | In a string context, this object interpolates as the name(). | ||
| 38 | |||
| 39 | =head1 SEE ALSO | ||
| 40 | |||
| 41 | L<VM::EC2> | ||
| 42 | L<VM::EC2::Generic> | ||
| 43 | L<VM::EC2::Instance> | ||
| 44 | L<VM::EC2::Instance::State> | ||
| 45 | L<VM::EC2::Instance::StatusItem> | ||
| 46 | L<VM::EC2::Instance::Status> | ||
| 47 | L<VM::EC2::Instance::Status::Event> | ||
| 48 | L<VM::EC2::Tag> | ||
| 49 | |||
| 50 | =head1 AUTHOR | ||
| 51 | |||
| 52 | Lincoln Stein E<lt>lincoln.stein@gmail.comE<gt>. | ||
| 53 | |||
| 54 | Copyright (c) 2012 Ontario Institute for Cancer Research | ||
| 55 | |||
| 56 | This package and its accompanying libraries is free software; you can | ||
| 57 | redistribute it and/or modify it under the terms of the GPL (either | ||
| 58 | version 1, or at your option, any later version) or the Artistic | ||
| 59 | License 2.0. Refer to LICENSE for the full license text. In addition, | ||
| 60 | please see DISCLAIMER.txt for disclaimers of warranty. | ||
| 61 | |||
| 62 | =cut | ||
| 63 | |||
| 64 | use strict; | ||
| 65 | use base 'VM::EC2::Generic'; | ||
| 66 | |||
| 67 | use strict; | ||
| 68 | |||
| 69 | sub valid_fields { | ||
| 70 | my $self = shift; | ||
| 71 | return qw(name status impairedSince); | ||
| 72 | } | ||
| 73 | |||
| 74 | sub short_name { | ||
| 75 | my $self = shift; | ||
| 76 | my $status = $self->status; | ||
| 77 | my $name = $self->name; | ||
| 78 | my $since = $self->impairedSince; | ||
| 79 | if ($since) { | ||
| 80 | return "$name $status since $since"; | ||
| 81 | } else { | ||
| 82 | return "$name $status"; | ||
| 83 | } | ||
| 84 | } | ||
| 85 | |||
| 86 | 1; | ||
| 87 |