blib/lib/VM/EC2/Instance/State/Reason.pm untested

filter: Statementstmt 0.0% 0 / 16 Branchbran n/a Conditioncond 0.0% 0 / 3 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 28 CC 1 SCAR 6.9
CC
1
Cov
0%
new
2.0
code
2.0
message
2.0
CRAP 2.0
1 package VM::EC2::Instance::State::Reason;
2  
3 =head1 NAME
4  
5 VM::EC2::State::Reason - Object describing the reason for an EC2 instance state change
6  
7 =head1 SYNOPSIS
8  
9 use VM::EC2;
10  
11 $ec2 = VM::EC2->new(...);
12 $instance = $ec2->describe_instances(-instance_id=>'i-12345');
13 $reason = $instance->reason;
14 $code = $reason->code;
15 $message = $reason->message;
16  
17 =head1 DESCRIPTION
18  
19 This object represents the reason that an Amazon EC2 instance
20 underwent a state change. It is returned by calling the reason()
21 method of VM::EC2::Instance.
22  
23 =head1 METHODS
24  
25 These object methods are supported:
26
27 code -- The state change reason code.
28 message -- The state change reason method.
29  
30 The following table lists the codes and messages (source:
31 http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-ItemType-StateReasonType.html):
32  
33 Code Message
34 ---- -------
35 Server.SpotInstanceTermination A Spot Instance was terminated due
36 to an increase in the market price.
37  
38 Server.InternalError An internal error occurred during
39 instance launch, resulting in termination.
40  
41 Server.InsufficientInstanceCapacity There was insufficient instance capacity
42 to satisfy the launch request.
43  
44 Client.InternalError A client error caused the instance to
45 terminate on launch.
46  
47 Client.InstanceInitiatedShutdown The instance initiated shutdown by a shutdown -h
48 command issued from inside the instance.
49  
50 Client.UserInitiatedShutdown The instance was shutdown by a user via an
51 API call.
52  
53 Client.VolumeLimitExceeded The volume limit was exceeded.
54  
55 Client.InvalidSnapshot.NotFound The specified snapshot was not found.
56  
57 =head1 STRING OVERLOADING
58  
59 When used in a string context, this object will interpolate the
60 message.
61  
62 =head1 SEE ALSO
63  
64 L<VM::EC2>
65 L<VM::EC2::Generic>
66 L<VM::EC2::State>
67 L<VM::EC2::Instance>
68  
69 =head1 AUTHOR
70  
71 Lincoln Stein E<lt>lincoln.stein@gmail.comE<gt>.
72  
73 Copyright (c) 2011 Ontario Institute for Cancer Research
74  
75 This package and its accompanying libraries is free software; you can
76 redistribute it and/or modify it under the terms of the GPL (either
77 version 1, or at your option, any later version) or the Artistic
78 License 2.0. Refer to LICENSE for the full license text. In addition,
79 please see DISCLAIMER.txt for disclaimers of warranty.
80  
81 =cut
82  
83 use strict;
84 use base 'VM::EC2::Generic';
85  
86 use overload '""' => 'message',
87 fallback => 1;
88  
89 sub new {
90 my $self = shift;
91 my $state = shift;
92 return bless \$state,ref $self || $self;
93 }
94  
95 sub code { ${shift()}->{code} }
96 sub message { ${shift()}->{message} }
97  
98 1;