blib/lib/VM/EC2/BlockDevice/EBS.pm untested

filter: Statementstmt 0.0% 0 / 11 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 17 CC 1 SCAR 6.9
CC
1
Cov
0%
valid_fields
2.0
deleteOnTermination
2.0
BEGIN
2.0
CRAP 2.0
1 package VM::EC2::BlockDevice::EBS;
2  
3 =head1 NAME
4  
5 VM::EC2::BlockDevice::EBS - Object describing how to initialize an Amazon EBS volume from an image
6  
7 =head1 SYNOPSIS
8  
9 use VM::EC2;
10  
11 $image = $ec2->describe_images(-image_id=>'ami-123456');
12 my @devices = $image->blockDeviceMapping;
13 for my $d (@devices) {
14 my $ebs = $d->ebs;
15 my $snapshot_id = $ebs->snapshotId;
16 my $size = $ebs->volumeSize;
17 my $delete = $ebs->deleteOnTermination;
18 }
19  
20 =head1 DESCRIPTION
21  
22 This object is used to describe the parameters used to create an
23 Amazon EBS volume when running an image. Generally you will not call
24 this directly, as all its methods are passed through by the
25 VM::EC2::BlockDevice object returned from the
26 blockDeviceMapping() call.
27  
28 See L<VM::EC2::BlockDevice> for a simpler way to get the
29 information needed.
30  
31 It is easy to confuse this with
32 VM::EC2::BlockDevice::Mapping::EBS, which describes the
33 attachment of an existing EBS volume to an instance. This class is
34 instead used to store the parameters that will be used to generate a
35 new EBS volume when an image is launched.
36  
37 =head1 METHODS
38  
39 The following object methods are supported:
40
41 snapshotId -- ID of the snapshot used to create this EBS when an
42 instance is launched from this image.
43 volumeSize -- Size of the EBS volume (in gigs).
44 deleteOnTermination -- Whether this EBS will be deleted when the
45 instance terminates. Note that this will return
46 perl 0/1 values rather than the strings "false"/"true"
47 volumeType -- The volume type, one of "standard" or "io1"
48 iops -- The number of I/O operations per second that the volume
49 supports, an integer between 100 and 2000. Only valid for
50 volumes of type "io1".
51  
52 =head1 STRING OVERLOADING
53  
54 NONE.
55  
56 =head1 SEE ALSO
57  
58 L<VM::EC2>
59 L<VM::EC2::Generic>
60 L<VM::EC2::Snapshot>
61 L<VM::EC2::BlockDevice>
62  
63 =head1 AUTHOR
64  
65 Lincoln Stein E<lt>lincoln.stein@gmail.comE<gt>.
66  
67 Copyright (c) 2011 Ontario Institute for Cancer Research
68  
69 This package and its accompanying libraries is free software; you can
70 redistribute it and/or modify it under the terms of the GPL (either
71 version 1, or at your option, any later version) or the Artistic
72 License 2.0. Refer to LICENSE for the full license text. In addition,
73 please see DISCLAIMER.txt for disclaimers of warranty.
74  
75 =cut
76  
77 use strict;
78 use base 'VM::EC2::Generic';
79  
80 sub valid_fields {
81 my $self = shift;
82 return qw(snapshotId volumeSize deleteOnTermination volumeType iops);
83 }
84  
85 sub deleteOnTermination {
86 my $self = shift;
87 my $dot = $self->SUPER::deleteOnTermination;
88 return $dot eq 'true';
89 }
90  
91 1;