| 1 | package Net::Amazon::EC2::RunningInstances; | ||||||||||||||||||||||||||||
| 2 | 2 | $Net::Amazon::EC2::RunningInstances::VERSION = '0.36'; | |||||||||||||||||||||||||||
| 3 | 2 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | =head1 NAME | ||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | Net::Amazon::EC2::RunningInstances | ||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | A class representing a running instance. | ||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | =head1 ATTRIBUTES | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | =over | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | =item ami_launch_index (optional) | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | The AMI launch index, which can be used to find | ||||||||||||||||||||||||||||
| 20 | this instance within the launch group. | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | =item dns_name (optional) | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | The public DNS name assigned to the instance. This DNS | ||||||||||||||||||||||||||||
| 25 | name is contactable from outside the Amazon EC2 network. | ||||||||||||||||||||||||||||
| 26 | This element remains empty until the instance enters a | ||||||||||||||||||||||||||||
| 27 | running state. | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | =item image_id (required) | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | The image id of the AMI currently running in this instance. | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | =item kernel_id (required) | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | The kernel id of the AKI currently running in this instance. | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | =item ramdisk_id (required) | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | The ramdisk id of the ARI loaded in this instance. | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | =item instance_id (required) | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | The instance id of the launched instance. | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | =item instance_state (required) | ||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | An Net::Amazon::EC2::InstanceState object. | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | =item instance_type (required) | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | The type of instance launched. | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | =item key_name (optional) | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | The key pair name the instance was launched with. | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | =item launch_time (required) | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | The time the instance was started. | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | =item placement (required) | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | A Net::Amazon::EC2::PlacementResponse object. | ||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | =item private_dns_name (optional) | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | The private DNS name assigned to the instance. This DNS | ||||||||||||||||||||||||||||
| 68 | name can only be used inside the Amazon EC2 network. | ||||||||||||||||||||||||||||
| 69 | This element remains empty until the instance enters a | ||||||||||||||||||||||||||||
| 70 | running state. | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | =item product_codes (optional) | ||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | An array ref of Net::Amazon::EC2::ProductCode objects. | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | =item reason (optional) | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | The reason for the most recent state transition. | ||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | =item platform (optional) | ||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | The operating system for this instance. | ||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | =item monitoring (optional) | ||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | The state of monitoring on this instance. | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | =item subnet_id (optional) | ||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | Specifies the subnet ID in which the instance is running (Amazon Virtual Private Cloud). | ||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | =item vpc_id (optional) | ||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | Specifies the VPC in which the instance is running (Amazon Virtual Private Cloud). | ||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | =item private_ip_address (optional) | ||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||
| 98 | Specifies the private IP address that is assigned to the instance (Amazon VPC). | ||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | =item ip_address (optional) | ||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | Specifies the IP address of the instance. | ||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | =item state_reason (optional) | ||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | The reason for the state change. | ||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | A Net::Amazon::EC2::StateReason object. | ||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||
| 110 | =item architecture (optional) | ||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | The architecture of the image. | ||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | =item root_device_name (optional) | ||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | The root device name (e.g., /dev/sda1). | ||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||
| 118 | =item root_device_type (optional) | ||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | The root device type used by the AMI. The AMI can use an Amazon EBS or instance store root device. | ||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | =item block_device_mapping (optional) | ||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||
| 124 | An array ref of Net::Amazon::EC2::BlockDeviceMapping objects. | ||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | =item tag_set (optional) | ||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||
| 128 | An array ref of Net::Amazon::EC2::TagSet objects. | ||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||
| 130 | =item name (optional) | ||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||
| 132 | The instance name from tags. | ||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||
| 134 | =cut | ||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||
| 136 | 2 | has 'ami_launch_index' => ( is => 'ro', isa => 'Str', required => 0 ); | |||||||||||||||||||||||||||
| 137 | 2 | has 'dns_name' => ( is => 'ro', isa => 'Maybe[Str]', required => 0 ); | |||||||||||||||||||||||||||
| 138 | 2 | has 'image_id' => ( is => 'ro', isa => 'Str', required => 1 ); | |||||||||||||||||||||||||||
| 139 | 2 | has 'kernel_id' => ( is => 'ro', isa => 'Maybe[Str]', required => 1 ); | |||||||||||||||||||||||||||
| 140 | 2 | has 'ramdisk_id' => ( is => 'ro', isa => 'Maybe[Str]', required => 1 ); | |||||||||||||||||||||||||||
| 141 | 2 | has 'instance_id' => ( is => 'ro', isa => 'Str', required => 1 ); | |||||||||||||||||||||||||||
| 142 | 2 | has 'instance_state' => ( | |||||||||||||||||||||||||||
| 143 | is => 'ro', | ||||||||||||||||||||||||||||
| 144 | isa => 'Net::Amazon::EC2::InstanceState', | ||||||||||||||||||||||||||||
| 145 | required => 1 | ||||||||||||||||||||||||||||
| 146 | ); | ||||||||||||||||||||||||||||
| 147 | 2 | has 'instance_type' => ( is => 'ro', isa => 'Str', required => 1 ); | |||||||||||||||||||||||||||
| 148 | 2 | has 'key_name' => ( is => 'ro', isa => 'Maybe[Str]', required => 0 ); | |||||||||||||||||||||||||||
| 149 | 2 | has 'launch_time' => ( is => 'ro', isa => 'Str', required => 1 ); | |||||||||||||||||||||||||||
| 150 | 2 | has 'placement' => ( is => 'ro', isa => 'Net::Amazon::EC2::PlacementResponse', required => 1 ); | |||||||||||||||||||||||||||
| 151 | 2 | has 'private_dns_name' => ( is => 'ro', isa => 'Maybe[Str]', required => 0 ); | |||||||||||||||||||||||||||
| 152 | 2 | has 'product_codes' => ( | |||||||||||||||||||||||||||
| 153 | is => 'rw', | ||||||||||||||||||||||||||||
| 154 | isa => 'ArrayRef[Net::Amazon::EC2::ProductCode]', | ||||||||||||||||||||||||||||
| 155 | auto_deref => 1, | ||||||||||||||||||||||||||||
| 156 | required => 0, | ||||||||||||||||||||||||||||
| 157 | ); | ||||||||||||||||||||||||||||
| 158 | 2 | has 'reason' => ( is => 'ro', isa => 'Maybe[Str]', required => 0 ); | |||||||||||||||||||||||||||
| 159 | 2 | has 'platform' => ( is => 'ro', isa => 'Maybe[Str]', required => 0 ); | |||||||||||||||||||||||||||
| 160 | 2 | has 'monitoring' => ( is => 'ro', isa => 'Maybe[Str]', required => 0 ); | |||||||||||||||||||||||||||
| 161 | 2 | has 'subnet_id' => ( is => 'ro', isa => 'Maybe[Str]', required => 0 ); | |||||||||||||||||||||||||||
| 162 | 2 | has 'vpc_id' => ( is => 'ro', isa => 'Maybe[Str]', required => 0 ); | |||||||||||||||||||||||||||
| 163 | 2 | has 'private_ip_address' => ( is => 'ro', isa => 'Maybe[Str]', required => 0 ); | |||||||||||||||||||||||||||
| 164 | 2 | has 'ip_address' => ( is => 'ro', isa => 'Maybe[Str]', required => 0 ); | |||||||||||||||||||||||||||
| 165 | 2 | has 'state_reason' => ( is => 'ro', isa => 'Maybe[Net::Amazon::EC2::StateReason]', required => 0 ); | |||||||||||||||||||||||||||
| 166 | 2 | has 'architecture' => ( is => 'ro', isa => 'Maybe[Str]', required => 0 ); | |||||||||||||||||||||||||||
| 167 | 2 | has 'root_device_name' => ( is => 'ro', isa => 'Maybe[Str]', required => 0 ); | |||||||||||||||||||||||||||
| 168 | 2 | has 'root_device_type' => ( is => 'ro', isa => 'Maybe[Str]', required => 0 ); | |||||||||||||||||||||||||||
| 169 | 2 | has 'block_device_mapping' => ( is => 'ro', isa => 'Maybe[ArrayRef[Net::Amazon::EC2::BlockDeviceMapping]]', required => 0 ); | |||||||||||||||||||||||||||
| 170 | 2 | has 'network_interface_set' => ( is => 'ro', isa => 'Maybe[ArrayRef[Net::Amazon::EC2::NetworkInterfaceSet]]', required => 0 ); | |||||||||||||||||||||||||||
| 171 | 2 | has 'tag_set' => ( is => 'ro', isa => 'Maybe[ArrayRef[Net::Amazon::EC2::TagSet]]', required => 0 ); | |||||||||||||||||||||||||||
| 172 | has 'name' => ( | ||||||||||||||||||||||||||||
| 173 | is => 'ro', | ||||||||||||||||||||||||||||
| 174 | lazy => 1, | ||||||||||||||||||||||||||||
| 175 | 0 | ▶ | default => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||
| 176 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 177 | 0 | ▶ | return '' if !$self->tag_set || scalar @{$self->tag_set} == 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $self->tag_set or scalar @{$self->tag_set;} == 0
MC/DC0%0/2
not $self->tag_set or scalar @{$self->tag_set;} == 0
not $self->tag_set
scalar @{$self->tag_set;} == 0
Truth table0%0/3
not(A) or B
A= not $self->tag_setB= scalar @{$self->tag_set;} == 0
| |||||||||||||||||||||||||||||
| 178 | 0 | my $name = (grep {$_->{key} eq 'Name'} @{$self->tag_set})[0]; | |||||||||||||||||||||||||||
| 179 | 0 | ▶ | return $name->{value} || ''; | ||||||||||||||||||||||||||
|
Condition0%0/2
$name->{'value'} || ''
MC/DC0%0/1
$name->{'value'} || ''
$name->{'value'}
Truth table0%0/2
A
A= $name->{'value'}
| |||||||||||||||||||||||||||||
| 180 | }, | ||||||||||||||||||||||||||||
| 181 | 2 | ); | |||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||
| 184 | 2 | __PACKAGE__->meta->make_immutable(); | |||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||
| 186 | =back | ||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||
| 188 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||
| 190 | Jeff Kim <cpan@chosec.com> | ||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||
| 192 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||
| 194 | Copyright (c) 2006-2010 Jeff Kim. This program is free software; you can redistribute it and/or modify it | ||||||||||||||||||||||||||||
| 195 | under the same terms as Perl itself. | ||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||
| 197 | =cut | ||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||
| 199 | 2 | ▶ | no Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 200 | 2 | 1; | |||||||||||||||||||||||||||