| 1 | package Amazon::EC2; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use parent qw/Amazon::API/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use Amazon::Credentials; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use JSON qw/from_json to_json/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use Scalar::Util qw/reftype/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use XML::Simple; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | =pod | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | =head1 NAME | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | C<Amazon::EC2> | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | use strict; | ||||||||||||||||||||||||||||
| 23 | use warnings; | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | use Amazon::EC2; | ||||||||||||||||||||||||||||
| 26 | use Amazon::Credentials; | ||||||||||||||||||||||||||||
| 27 | use Data::Dumper; | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | my $ec2 = new Amazon::EC2({credentials => new Amazon::Credentials}); | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | my $result = $ec2->DescribeInstances(); | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | print Dumper($result); | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | Perl interface to the Amazon EC2 API | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | =head1 METHODS | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | See the Amazon EC2 API documentation for method | ||||||||||||||||||||||||||||
| 42 | arguments. L</http://docs.aws.amazon.com/AWSEC2/latest/APIReference/Welcome.html> | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | =cut | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | =pod | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | =head2 new | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | new( options ) | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | =over 5 | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | =item region | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | AWS region. default: us-east-1 | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | =item credentials | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | An C<Amazon::Credentials> object. You can specify your credentials | ||||||||||||||||||||||||||||
| 62 | using this object or by setting your access keys and optional token | ||||||||||||||||||||||||||||
| 63 | directly. | ||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | =item aws_secret_access_key | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | Your AWS secret access key. | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | =item aws_access_key_id | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | Your AWS access key id. | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | =item token | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | Optional token if your credentials were temporary (from the role or assumed role). | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | =back | ||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | I<Note that if no credentials are given, the constructor will behave as if you had done:> | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | new Amazon::EC2({credentials => new Amazon::Credentials}); | ||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | I<...which will use your default credentials. See C<Amazon::Credentials>.> | ||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | =cut | ||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | 1 | my @API_METHODS = qw/AcceptReservedInstancesExchangeQuote | |||||||||||||||||||||||||||
| 88 | AcceptVpcEndpointConnections | ||||||||||||||||||||||||||||
| 89 | AcceptVpcPeeringConnection | ||||||||||||||||||||||||||||
| 90 | AllocateAddress | ||||||||||||||||||||||||||||
| 91 | AllocateHosts | ||||||||||||||||||||||||||||
| 92 | AssignIpv6Addresses | ||||||||||||||||||||||||||||
| 93 | AssignPrivateIpAddresses | ||||||||||||||||||||||||||||
| 94 | AssociateAddress | ||||||||||||||||||||||||||||
| 95 | AssociateDhcpOptions | ||||||||||||||||||||||||||||
| 96 | AssociateIamInstanceProfile | ||||||||||||||||||||||||||||
| 97 | AssociateRouteTable | ||||||||||||||||||||||||||||
| 98 | AssociateSubnetCidrBlock | ||||||||||||||||||||||||||||
| 99 | AssociateVpcCidrBlock | ||||||||||||||||||||||||||||
| 100 | AttachClassicLinkVpc | ||||||||||||||||||||||||||||
| 101 | AttachInternetGateway | ||||||||||||||||||||||||||||
| 102 | AttachNetworkInterface | ||||||||||||||||||||||||||||
| 103 | AttachVolume | ||||||||||||||||||||||||||||
| 104 | AttachVpnGateway | ||||||||||||||||||||||||||||
| 105 | AuthorizeSecurityGroupEgress | ||||||||||||||||||||||||||||
| 106 | AuthorizeSecurityGroupIngress | ||||||||||||||||||||||||||||
| 107 | BundleInstance | ||||||||||||||||||||||||||||
| 108 | CancelBundleTask | ||||||||||||||||||||||||||||
| 109 | CancelConversionTask | ||||||||||||||||||||||||||||
| 110 | CancelExportTask | ||||||||||||||||||||||||||||
| 111 | CancelImportTask | ||||||||||||||||||||||||||||
| 112 | CancelReservedInstancesListing | ||||||||||||||||||||||||||||
| 113 | CancelSpotFleetRequests | ||||||||||||||||||||||||||||
| 114 | CancelSpotInstanceRequests | ||||||||||||||||||||||||||||
| 115 | ConfirmProductInstance | ||||||||||||||||||||||||||||
| 116 | CopyFpgaImage | ||||||||||||||||||||||||||||
| 117 | CopyImage | ||||||||||||||||||||||||||||
| 118 | CopySnapshot | ||||||||||||||||||||||||||||
| 119 | CreateCustomerGateway | ||||||||||||||||||||||||||||
| 120 | CreateDefaultSubnet | ||||||||||||||||||||||||||||
| 121 | CreateDefaultVpc | ||||||||||||||||||||||||||||
| 122 | CreateDhcpOptions | ||||||||||||||||||||||||||||
| 123 | CreateEgressOnlyInternetGateway | ||||||||||||||||||||||||||||
| 124 | CreateFlowLogs | ||||||||||||||||||||||||||||
| 125 | CreateFpgaImage | ||||||||||||||||||||||||||||
| 126 | CreateImage | ||||||||||||||||||||||||||||
| 127 | CreateInstanceExportTask | ||||||||||||||||||||||||||||
| 128 | CreateInternetGateway | ||||||||||||||||||||||||||||
| 129 | CreateKeyPair | ||||||||||||||||||||||||||||
| 130 | CreateLaunchTemplate | ||||||||||||||||||||||||||||
| 131 | CreateLaunchTemplateVersion | ||||||||||||||||||||||||||||
| 132 | CreateNatGateway | ||||||||||||||||||||||||||||
| 133 | CreateNetworkAcl | ||||||||||||||||||||||||||||
| 134 | CreateNetworkAclEntry | ||||||||||||||||||||||||||||
| 135 | CreateNetworkInterface | ||||||||||||||||||||||||||||
| 136 | CreateNetworkInterfacePermission | ||||||||||||||||||||||||||||
| 137 | CreatePlacementGroup | ||||||||||||||||||||||||||||
| 138 | CreateReservedInstancesListing | ||||||||||||||||||||||||||||
| 139 | CreateRoute | ||||||||||||||||||||||||||||
| 140 | CreateRouteTable | ||||||||||||||||||||||||||||
| 141 | CreateSecurityGroup | ||||||||||||||||||||||||||||
| 142 | CreateSnapshot | ||||||||||||||||||||||||||||
| 143 | CreateSpotDatafeedSubscription | ||||||||||||||||||||||||||||
| 144 | CreateSubnet | ||||||||||||||||||||||||||||
| 145 | CreateTags | ||||||||||||||||||||||||||||
| 146 | CreateVolume | ||||||||||||||||||||||||||||
| 147 | CreateVpc | ||||||||||||||||||||||||||||
| 148 | CreateVpcEndpoint | ||||||||||||||||||||||||||||
| 149 | CreateVpcEndpointConnectionNotification | ||||||||||||||||||||||||||||
| 150 | CreateVpcEndpointServiceConfiguration | ||||||||||||||||||||||||||||
| 151 | CreateVpcPeeringConnection | ||||||||||||||||||||||||||||
| 152 | CreateVpnConnection | ||||||||||||||||||||||||||||
| 153 | CreateVpnConnectionRoute | ||||||||||||||||||||||||||||
| 154 | CreateVpnGateway | ||||||||||||||||||||||||||||
| 155 | DeleteCustomerGateway | ||||||||||||||||||||||||||||
| 156 | DeleteDhcpOptions | ||||||||||||||||||||||||||||
| 157 | DeleteEgressOnlyInternetGateway | ||||||||||||||||||||||||||||
| 158 | DeleteFlowLogs | ||||||||||||||||||||||||||||
| 159 | DeleteFpgaImage | ||||||||||||||||||||||||||||
| 160 | DeleteInternetGateway | ||||||||||||||||||||||||||||
| 161 | DeleteKeyPair | ||||||||||||||||||||||||||||
| 162 | DeleteLaunchTemplate | ||||||||||||||||||||||||||||
| 163 | DeleteLaunchTemplateVersions | ||||||||||||||||||||||||||||
| 164 | DeleteNatGateway | ||||||||||||||||||||||||||||
| 165 | DeleteNetworkAcl | ||||||||||||||||||||||||||||
| 166 | DeleteNetworkAclEntry | ||||||||||||||||||||||||||||
| 167 | DeleteNetworkInterface | ||||||||||||||||||||||||||||
| 168 | DeleteNetworkInterfacePermission | ||||||||||||||||||||||||||||
| 169 | DeletePlacementGroup | ||||||||||||||||||||||||||||
| 170 | DeleteRoute | ||||||||||||||||||||||||||||
| 171 | DeleteRouteTable | ||||||||||||||||||||||||||||
| 172 | DeleteSecurityGroup | ||||||||||||||||||||||||||||
| 173 | DeleteSnapshot | ||||||||||||||||||||||||||||
| 174 | DeleteSpotDatafeedSubscription | ||||||||||||||||||||||||||||
| 175 | DeleteSubnet | ||||||||||||||||||||||||||||
| 176 | DeleteTags | ||||||||||||||||||||||||||||
| 177 | DeleteVolume | ||||||||||||||||||||||||||||
| 178 | DeleteVpc | ||||||||||||||||||||||||||||
| 179 | DeleteVpcEndpointConnectionNotifications | ||||||||||||||||||||||||||||
| 180 | DeleteVpcEndpoints | ||||||||||||||||||||||||||||
| 181 | DeleteVpcEndpointServiceConfigurations | ||||||||||||||||||||||||||||
| 182 | DeleteVpcPeeringConnection | ||||||||||||||||||||||||||||
| 183 | DeleteVpnConnection | ||||||||||||||||||||||||||||
| 184 | DeleteVpnConnectionRoute | ||||||||||||||||||||||||||||
| 185 | DeleteVpnGateway | ||||||||||||||||||||||||||||
| 186 | DeregisterImage | ||||||||||||||||||||||||||||
| 187 | DescribeAccountAttributes | ||||||||||||||||||||||||||||
| 188 | DescribeAddresses | ||||||||||||||||||||||||||||
| 189 | DescribeAggregateIdFormat | ||||||||||||||||||||||||||||
| 190 | DescribeAvailabilityZones | ||||||||||||||||||||||||||||
| 191 | DescribeBundleTasks | ||||||||||||||||||||||||||||
| 192 | DescribeClassicLinkInstances | ||||||||||||||||||||||||||||
| 193 | DescribeConversionTasks | ||||||||||||||||||||||||||||
| 194 | DescribeCustomerGateways | ||||||||||||||||||||||||||||
| 195 | DescribeDhcpOptions | ||||||||||||||||||||||||||||
| 196 | DescribeEgressOnlyInternetGateways | ||||||||||||||||||||||||||||
| 197 | DescribeElasticGpus | ||||||||||||||||||||||||||||
| 198 | DescribeExportTasks | ||||||||||||||||||||||||||||
| 199 | DescribeFlowLogs | ||||||||||||||||||||||||||||
| 200 | DescribeFpgaImageAttribute | ||||||||||||||||||||||||||||
| 201 | DescribeFpgaImages | ||||||||||||||||||||||||||||
| 202 | DescribeHostReservationOfferings | ||||||||||||||||||||||||||||
| 203 | DescribeHostReservations | ||||||||||||||||||||||||||||
| 204 | DescribeHosts | ||||||||||||||||||||||||||||
| 205 | DescribeIamInstanceProfileAssociations | ||||||||||||||||||||||||||||
| 206 | DescribeIdentityIdFormat | ||||||||||||||||||||||||||||
| 207 | DescribeIdFormat | ||||||||||||||||||||||||||||
| 208 | DescribeImageAttribute | ||||||||||||||||||||||||||||
| 209 | DescribeImages | ||||||||||||||||||||||||||||
| 210 | DescribeImportImageTasks | ||||||||||||||||||||||||||||
| 211 | DescribeImportSnapshotTasks | ||||||||||||||||||||||||||||
| 212 | DescribeInstanceAttribute | ||||||||||||||||||||||||||||
| 213 | DescribeInstanceCreditSpecifications | ||||||||||||||||||||||||||||
| 214 | DescribeInstances | ||||||||||||||||||||||||||||
| 215 | DescribeInstanceStatus | ||||||||||||||||||||||||||||
| 216 | DescribeInternetGateways | ||||||||||||||||||||||||||||
| 217 | DescribeKeyPairs | ||||||||||||||||||||||||||||
| 218 | DescribeLaunchTemplates | ||||||||||||||||||||||||||||
| 219 | DescribeLaunchTemplateVersions | ||||||||||||||||||||||||||||
| 220 | DescribeMovingAddresses | ||||||||||||||||||||||||||||
| 221 | DescribeNatGateways | ||||||||||||||||||||||||||||
| 222 | DescribeNetworkAcls | ||||||||||||||||||||||||||||
| 223 | DescribeNetworkInterfaceAttribute | ||||||||||||||||||||||||||||
| 224 | DescribeNetworkInterfacePermissions | ||||||||||||||||||||||||||||
| 225 | DescribeNetworkInterfaces | ||||||||||||||||||||||||||||
| 226 | DescribePlacementGroups | ||||||||||||||||||||||||||||
| 227 | DescribePrefixLists | ||||||||||||||||||||||||||||
| 228 | DescribePrincipalIdFormat | ||||||||||||||||||||||||||||
| 229 | DescribeRegions | ||||||||||||||||||||||||||||
| 230 | DescribeReservedInstances | ||||||||||||||||||||||||||||
| 231 | DescribeReservedInstancesListings | ||||||||||||||||||||||||||||
| 232 | DescribeReservedInstancesModifications | ||||||||||||||||||||||||||||
| 233 | DescribeReservedInstancesOfferings | ||||||||||||||||||||||||||||
| 234 | DescribeRouteTables | ||||||||||||||||||||||||||||
| 235 | DescribeScheduledInstanceAvailability | ||||||||||||||||||||||||||||
| 236 | DescribeScheduledInstances | ||||||||||||||||||||||||||||
| 237 | DescribeSecurityGroupReferences | ||||||||||||||||||||||||||||
| 238 | DescribeSecurityGroups | ||||||||||||||||||||||||||||
| 239 | DescribeSnapshotAttribute | ||||||||||||||||||||||||||||
| 240 | DescribeSnapshots | ||||||||||||||||||||||||||||
| 241 | DescribeSpotDatafeedSubscription | ||||||||||||||||||||||||||||
| 242 | DescribeSpotFleetInstances | ||||||||||||||||||||||||||||
| 243 | DescribeSpotFleetRequestHistory | ||||||||||||||||||||||||||||
| 244 | DescribeSpotFleetRequests | ||||||||||||||||||||||||||||
| 245 | DescribeSpotInstanceRequests | ||||||||||||||||||||||||||||
| 246 | DescribeSpotPriceHistory | ||||||||||||||||||||||||||||
| 247 | DescribeStaleSecurityGroups | ||||||||||||||||||||||||||||
| 248 | DescribeSubnets | ||||||||||||||||||||||||||||
| 249 | DescribeTags | ||||||||||||||||||||||||||||
| 250 | DescribeVolumeAttribute | ||||||||||||||||||||||||||||
| 251 | DescribeVolumes | ||||||||||||||||||||||||||||
| 252 | DescribeVolumesModifications | ||||||||||||||||||||||||||||
| 253 | DescribeVolumeStatus | ||||||||||||||||||||||||||||
| 254 | DescribeVpcAttribute | ||||||||||||||||||||||||||||
| 255 | DescribeVpcClassicLink | ||||||||||||||||||||||||||||
| 256 | DescribeVpcClassicLinkDnsSupport | ||||||||||||||||||||||||||||
| 257 | DescribeVpcEndpointConnectionNotifications | ||||||||||||||||||||||||||||
| 258 | DescribeVpcEndpointConnections | ||||||||||||||||||||||||||||
| 259 | DescribeVpcEndpoints | ||||||||||||||||||||||||||||
| 260 | DescribeVpcEndpointServiceConfigurations | ||||||||||||||||||||||||||||
| 261 | DescribeVpcEndpointServicePermissions | ||||||||||||||||||||||||||||
| 262 | DescribeVpcEndpointServices | ||||||||||||||||||||||||||||
| 263 | DescribeVpcPeeringConnections | ||||||||||||||||||||||||||||
| 264 | DescribeVpcs | ||||||||||||||||||||||||||||
| 265 | DescribeVpnConnections | ||||||||||||||||||||||||||||
| 266 | DescribeVpnGateways | ||||||||||||||||||||||||||||
| 267 | DetachClassicLinkVpc | ||||||||||||||||||||||||||||
| 268 | DetachInternetGateway | ||||||||||||||||||||||||||||
| 269 | DetachNetworkInterface | ||||||||||||||||||||||||||||
| 270 | DetachVolume | ||||||||||||||||||||||||||||
| 271 | DetachVpnGateway | ||||||||||||||||||||||||||||
| 272 | DisableVgwRoutePropagation | ||||||||||||||||||||||||||||
| 273 | DisableVpcClassicLink | ||||||||||||||||||||||||||||
| 274 | DisableVpcClassicLinkDnsSupport | ||||||||||||||||||||||||||||
| 275 | DisassociateAddress | ||||||||||||||||||||||||||||
| 276 | DisassociateIamInstanceProfile | ||||||||||||||||||||||||||||
| 277 | DisassociateRouteTable | ||||||||||||||||||||||||||||
| 278 | DisassociateSubnetCidrBlock | ||||||||||||||||||||||||||||
| 279 | DisassociateVpcCidrBlock | ||||||||||||||||||||||||||||
| 280 | EnableVgwRoutePropagation | ||||||||||||||||||||||||||||
| 281 | EnableVolumeIO | ||||||||||||||||||||||||||||
| 282 | EnableVpcClassicLink | ||||||||||||||||||||||||||||
| 283 | EnableVpcClassicLinkDnsSupport | ||||||||||||||||||||||||||||
| 284 | GetConsoleOutput | ||||||||||||||||||||||||||||
| 285 | GetConsoleScreenshot | ||||||||||||||||||||||||||||
| 286 | GetHostReservationPurchasePreview | ||||||||||||||||||||||||||||
| 287 | GetLaunchTemplateData | ||||||||||||||||||||||||||||
| 288 | GetPasswordData | ||||||||||||||||||||||||||||
| 289 | GetReservedInstancesExchangeQuote | ||||||||||||||||||||||||||||
| 290 | ImportImage | ||||||||||||||||||||||||||||
| 291 | ImportInstance | ||||||||||||||||||||||||||||
| 292 | ImportKeyPair | ||||||||||||||||||||||||||||
| 293 | ImportSnapshot | ||||||||||||||||||||||||||||
| 294 | ImportVolume | ||||||||||||||||||||||||||||
| 295 | ModifyFpgaImageAttribute | ||||||||||||||||||||||||||||
| 296 | ModifyHosts | ||||||||||||||||||||||||||||
| 297 | ModifyIdentityIdFormat | ||||||||||||||||||||||||||||
| 298 | ModifyIdFormat | ||||||||||||||||||||||||||||
| 299 | ModifyImageAttribute | ||||||||||||||||||||||||||||
| 300 | ModifyInstanceAttribute | ||||||||||||||||||||||||||||
| 301 | ModifyInstanceCreditSpecification | ||||||||||||||||||||||||||||
| 302 | ModifyInstancePlacement | ||||||||||||||||||||||||||||
| 303 | ModifyLaunchTemplate | ||||||||||||||||||||||||||||
| 304 | ModifyNetworkInterfaceAttribute | ||||||||||||||||||||||||||||
| 305 | ModifyReservedInstances | ||||||||||||||||||||||||||||
| 306 | ModifySnapshotAttribute | ||||||||||||||||||||||||||||
| 307 | ModifySpotFleetRequest | ||||||||||||||||||||||||||||
| 308 | ModifySubnetAttribute | ||||||||||||||||||||||||||||
| 309 | ModifyVolume | ||||||||||||||||||||||||||||
| 310 | ModifyVolumeAttribute | ||||||||||||||||||||||||||||
| 311 | ModifyVpcAttribute | ||||||||||||||||||||||||||||
| 312 | ModifyVpcEndpoint | ||||||||||||||||||||||||||||
| 313 | ModifyVpcEndpointConnectionNotification | ||||||||||||||||||||||||||||
| 314 | ModifyVpcEndpointServiceConfiguration | ||||||||||||||||||||||||||||
| 315 | ModifyVpcEndpointServicePermissions | ||||||||||||||||||||||||||||
| 316 | ModifyVpcPeeringConnectionOptions | ||||||||||||||||||||||||||||
| 317 | ModifyVpcTenancy | ||||||||||||||||||||||||||||
| 318 | MonitorInstances | ||||||||||||||||||||||||||||
| 319 | MoveAddressToVpc | ||||||||||||||||||||||||||||
| 320 | PurchaseHostReservation | ||||||||||||||||||||||||||||
| 321 | PurchaseReservedInstancesOffering | ||||||||||||||||||||||||||||
| 322 | PurchaseScheduledInstances | ||||||||||||||||||||||||||||
| 323 | RebootInstances | ||||||||||||||||||||||||||||
| 324 | RegisterImage | ||||||||||||||||||||||||||||
| 325 | RejectVpcEndpointConnections | ||||||||||||||||||||||||||||
| 326 | RejectVpcPeeringConnection | ||||||||||||||||||||||||||||
| 327 | ReleaseAddress | ||||||||||||||||||||||||||||
| 328 | ReleaseHosts | ||||||||||||||||||||||||||||
| 329 | ReplaceIamInstanceProfileAssociation | ||||||||||||||||||||||||||||
| 330 | ReplaceNetworkAclAssociation | ||||||||||||||||||||||||||||
| 331 | ReplaceNetworkAclEntry | ||||||||||||||||||||||||||||
| 332 | ReplaceRoute | ||||||||||||||||||||||||||||
| 333 | ReplaceRouteTableAssociation | ||||||||||||||||||||||||||||
| 334 | ReportInstanceStatus | ||||||||||||||||||||||||||||
| 335 | RequestSpotFleet | ||||||||||||||||||||||||||||
| 336 | RequestSpotInstances | ||||||||||||||||||||||||||||
| 337 | ResetFpgaImageAttribute | ||||||||||||||||||||||||||||
| 338 | ResetImageAttribute | ||||||||||||||||||||||||||||
| 339 | ResetInstanceAttribute | ||||||||||||||||||||||||||||
| 340 | ResetNetworkInterfaceAttribute | ||||||||||||||||||||||||||||
| 341 | ResetSnapshotAttribute | ||||||||||||||||||||||||||||
| 342 | RestoreAddressToClassic | ||||||||||||||||||||||||||||
| 343 | RevokeSecurityGroupEgress | ||||||||||||||||||||||||||||
| 344 | RevokeSecurityGroupIngress | ||||||||||||||||||||||||||||
| 345 | RunInstances | ||||||||||||||||||||||||||||
| 346 | RunScheduledInstances | ||||||||||||||||||||||||||||
| 347 | StartInstances | ||||||||||||||||||||||||||||
| 348 | StopInstances | ||||||||||||||||||||||||||||
| 349 | TerminateInstances | ||||||||||||||||||||||||||||
| 350 | UnassignIpv6Addresses | ||||||||||||||||||||||||||||
| 351 | UnassignPrivateIpAddresses | ||||||||||||||||||||||||||||
| 352 | UnmonitorInstances | ||||||||||||||||||||||||||||
| 353 | UpdateSecurityGroupRuleDescriptionsEgress | ||||||||||||||||||||||||||||
| 354 | UpdateSecurityGroupRuleDescriptionsIngress | ||||||||||||||||||||||||||||
| 355 | /; | ||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||
| 357 | 1 | our $VERSION = '1.0.1'; | |||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||
| 359 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 360 | 0 | my $class = shift; | |||||||||||||||||||||||||||
| 361 | 0 | ▶ | my $options = shift || {}; | ||||||||||||||||||||||||||
|
Condition0%0/2
shift() || {}
MC/DC0%0/1
shift() || {}
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||
| 363 | 0 | $class->SUPER::new({ | |||||||||||||||||||||||||||
| 364 | %$options, | ||||||||||||||||||||||||||||
| 365 | service_url_base => 'ec2', | ||||||||||||||||||||||||||||
| 366 | version => '2016-11-15', | ||||||||||||||||||||||||||||
| 367 | api_methods => \@API_METHODS | ||||||||||||||||||||||||||||
| 368 | }); | ||||||||||||||||||||||||||||
| 369 | } | ||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||
| 371 | =pod | ||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||
| 373 | =head2 DescribeInstances | ||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||
| 375 | DescribeInstances(options) | ||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||
| 377 | C<options> is a hash of optional parameters to pass to the API. See | ||||||||||||||||||||||||||||
| 378 | the API description at | ||||||||||||||||||||||||||||
| 379 | L</http://docs.aws.amazon.com/AWSEC2/latest/APIReference/Welcome.html> | ||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||
| 381 | To create pass the C<Filter> parameters, pass an array of hash references. | ||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||
| 383 | my $filter [{Name => 'instance-id', Value => 'i-0b91d8e165cf2f41b'}]); | ||||||||||||||||||||||||||||
| 384 | my $result = $ec2->DescribeInstances(Filter => $filter); | ||||||||||||||||||||||||||||
| 385 | print to_json($result, { pretty => 1 }); | ||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||
| 387 | =cut | ||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||
| 389 | 0 | ▶ | sub DescribeInstances { | ||||||||||||||||||||||||||
|
Subroutine
DescribeInstances: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||
| 390 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 391 | 0 | my %args = @_; | |||||||||||||||||||||||||||
| 392 | 0 | my @options; | |||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||
| 394 | 0 | foreach my $param (keys %args) { | |||||||||||||||||||||||||||
| 395 | 0 | ▶ | if ( ref($args{$param}) && reftype($args{$param}) eq 'ARRAY') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $args{$param} and builtin::reftype($args{$param}) eq "ARRAY"
MC/DC0%0/2
ref $args{$param} and builtin::reftype($args{$param}) eq "ARRAY"
ref $args{$param}
builtin::reftype($args{$param}) eq "ARRAY"
Truth table0%0/3
A and B
A= ref $args{$param}B= builtin::reftype($args{$param}) eq "ARRAY"
| |||||||||||||||||||||||||||||
| 396 | 0 | push @options, _format_filter($args{$param}); | |||||||||||||||||||||||||||
| 397 | } | ||||||||||||||||||||||||||||
| 398 | else { | ||||||||||||||||||||||||||||
| 399 | 0 | push @options, sprintf("%s=%s", $param, $args{$param}); | |||||||||||||||||||||||||||
| 400 | } | ||||||||||||||||||||||||||||
| 401 | } | ||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||
| 403 | 0 | ▶ | return XMLin($self->describe_instances(@options ? \@options : ())); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 404 | } | ||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||
| 407 | 0 | ▶ | sub CreateSnapshot { | ||||||||||||||||||||||||||
|
Subroutine
CreateSnapshot: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 408 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 409 | 0 | my %args = @_; | |||||||||||||||||||||||||||
| 410 | 0 | my @parms = _format_parameters(%args); | |||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||
| 412 | 0 | return XMLin($self->create_snapshot(\@parms)); | |||||||||||||||||||||||||||
| 413 | } | ||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||
| 415 | =pod | ||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||
| 417 | =head2 CreateTags | ||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||
| 419 | CreateTags( resources ) | ||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||
| 421 | CreateTags( $id => { Key => 'Name', Value => 'foo' } ); | ||||||||||||||||||||||||||||
| 422 | CreateTags( $id => [ { Key => 'Name', Value => 'foo' }, | ||||||||||||||||||||||||||||
| 423 | { Key => 'Environment', Value => 'boo'} | ||||||||||||||||||||||||||||
| 424 | ]); | ||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||
| 426 | =cut | ||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||
| 428 | 0 | ▶ | sub CreateTags { | ||||||||||||||||||||||||||
|
Subroutine
CreateTags: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 429 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 430 | 0 | my %resources = @_; | |||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||
| 432 | 0 | my @params; | |||||||||||||||||||||||||||
| 433 | 0 | my $idx=1; | |||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||
| 435 | 0 | foreach my $r (keys %resources) { | |||||||||||||||||||||||||||
| 436 | 0 | ▶ | if ( reftype($resources{$r}) ne 'ARRAY' ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 437 | 0 | $resources{$r} = [ $resources{$r} ]; | |||||||||||||||||||||||||||
| 438 | } | ||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||
| 440 | 0 | foreach (@{$resources{$r}}) { | |||||||||||||||||||||||||||
| 441 | 0 | push @params, sprintf("ResourceId.%d=%s", $idx, $r); | |||||||||||||||||||||||||||
| 442 | 0 | push @params, sprintf("Tag.%d.Key=%s", $idx, $_->{Key}); | |||||||||||||||||||||||||||
| 443 | 0 | push @params, sprintf("Tag.%d.Value=%s", $idx, $_->{Value}); | |||||||||||||||||||||||||||
| 444 | 0 | $idx++; | |||||||||||||||||||||||||||
| 445 | } | ||||||||||||||||||||||||||||
| 446 | } | ||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||
| 448 | 0 | return XMLin($self->create_tags(\@params)); | |||||||||||||||||||||||||||
| 449 | } | ||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||
| 451 | 0 | ▶ | sub _format_parameters { | ||||||||||||||||||||||||||
|
Subroutine
_format_parameters: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 452 | 0 | my %args = @_; | |||||||||||||||||||||||||||
| 453 | 0 | my @options; | |||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||
| 455 | 0 | foreach (keys %args) { | |||||||||||||||||||||||||||
| 456 | 0 | push @options, sprintf("%s=%s", $_, $args{$_}); | |||||||||||||||||||||||||||
| 457 | } | ||||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||
| 459 | 0 | return @options; | |||||||||||||||||||||||||||
| 460 | } | ||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||
| 462 | 0 | ▶ | sub _format_filter { | ||||||||||||||||||||||||||
|
Subroutine
_format_filter: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 463 | 0 | my $filter = shift; | |||||||||||||||||||||||||||
| 464 | |||||||||||||||||||||||||||||
| 465 | 0 | my @options; | |||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||
| 467 | 0 | ▶ | for (my $idx=0; $idx<@{$filter}; $idx++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 468 | push @options, sprintf("Filter.%d.Name=%s&Filter.%d.Value=%s", | ||||||||||||||||||||||||||||
| 469 | $idx+1, $filter->[$idx]->{Name}, | ||||||||||||||||||||||||||||
| 470 | 0 | $idx+1, $filter->[$idx]->{Value}); | |||||||||||||||||||||||||||
| 471 | } | ||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||
| 473 | 0 | return @options; | |||||||||||||||||||||||||||
| 474 | } | ||||||||||||||||||||||||||||
| 475 | |||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||
| 477 | =pod | ||||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||
| 479 | =head1 NOTES | ||||||||||||||||||||||||||||
| 480 | |||||||||||||||||||||||||||||
| 481 | This is a work-in-progress. I'll add API methods as I need them and | ||||||||||||||||||||||||||||
| 482 | B<pull requests> gladly accepted. ;-) | ||||||||||||||||||||||||||||
| 483 | |||||||||||||||||||||||||||||
| 484 | Why another Perl module for the EC2 API when there are already a | ||||||||||||||||||||||||||||
| 485 | couple candidates out there and the C<PAWS> project is tracking the | ||||||||||||||||||||||||||||
| 486 | Python B<boto> library? | ||||||||||||||||||||||||||||
| 487 | |||||||||||||||||||||||||||||
| 488 | Well, probably for no good reason other than those others are, | ||||||||||||||||||||||||||||
| 489 | generally speaking, fairly heavy with lot's of dependencies. This | ||||||||||||||||||||||||||||
| 490 | module is designed to be light and require few additional Perl | ||||||||||||||||||||||||||||
| 491 | modules. Hopefully, that means it will be relatively fast compared to | ||||||||||||||||||||||||||||
| 492 | using something like the AWS CLI or C<Paws> (which seems to rely on | ||||||||||||||||||||||||||||
| 493 | Moose, which seems to rely on, well most of the known CPAN universe). | ||||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||
| 495 | YMMV, but if you find this useful, good. If not, try C<PAWS>, | ||||||||||||||||||||||||||||
| 496 | C<Net::Amazon::EC2>, or C<VM::EC2>. | ||||||||||||||||||||||||||||
| 497 | |||||||||||||||||||||||||||||
| 498 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 499 | |||||||||||||||||||||||||||||
| 500 | Rob Lauer - <rlauer6@comcast.net> | ||||||||||||||||||||||||||||
| 501 | |||||||||||||||||||||||||||||
| 502 | =head1 SEE ALSO | ||||||||||||||||||||||||||||
| 503 | |||||||||||||||||||||||||||||
| 504 | C<Amazon::API>, C<Amazon::Credentials>, C<PAWS>, C<Net::Amazon::EC2>, | ||||||||||||||||||||||||||||
| 505 | C<VM::EC2> | ||||||||||||||||||||||||||||
| 506 | |||||||||||||||||||||||||||||
| 507 | =cut | ||||||||||||||||||||||||||||
| 508 | |||||||||||||||||||||||||||||
| 509 | 1 | 1; | |||||||||||||||||||||||||||