Amazon-EC2

 view release on metacpan or  search on metacpan

lib/Amazon/EC2.pm  view on Meta::CPAN

		     ModifyLaunchTemplate
		     ModifyNetworkInterfaceAttribute
		     ModifyReservedInstances
		     ModifySnapshotAttribute
		     ModifySpotFleetRequest
		     ModifySubnetAttribute
		     ModifyVolume
		     ModifyVolumeAttribute
		     ModifyVpcAttribute
		     ModifyVpcEndpoint
		     ModifyVpcEndpointConnectionNotification
		     ModifyVpcEndpointServiceConfiguration
		     ModifyVpcEndpointServicePermissions
		     ModifyVpcPeeringConnectionOptions
		     ModifyVpcTenancy
		     MonitorInstances
		     MoveAddressToVpc
		     PurchaseHostReservation
		     PurchaseReservedInstancesOffering
		     PurchaseScheduledInstances
		     RebootInstances
		     RegisterImage
		     RejectVpcEndpointConnections
		     RejectVpcPeeringConnection
		     ReleaseAddress
		     ReleaseHosts
		     ReplaceIamInstanceProfileAssociation
		     ReplaceNetworkAclAssociation
		     ReplaceNetworkAclEntry
		     ReplaceRoute
		     ReplaceRouteTableAssociation
		     ReportInstanceStatus
		     RequestSpotFleet
		     RequestSpotInstances
		     ResetFpgaImageAttribute
		     ResetImageAttribute
		     ResetInstanceAttribute
		     ResetNetworkInterfaceAttribute
		     ResetSnapshotAttribute
		     RestoreAddressToClassic
		     RevokeSecurityGroupEgress
		     RevokeSecurityGroupIngress
		     RunInstances
		     RunScheduledInstances
		     StartInstances
		     StopInstances
		     TerminateInstances
		     UnassignIpv6Addresses
		     UnassignPrivateIpAddresses
		     UnmonitorInstances
		     UpdateSecurityGroupRuleDescriptionsEgress
		     UpdateSecurityGroupRuleDescriptionsIngress
		    /;

our $VERSION = '1.0.1';

sub new {
  my $class = shift;
  my $options = shift || {};

  $class->SUPER::new({
		      %$options,
		      service_url_base => 'ec2',
		      version          => '2016-11-15',
		      api_methods      => \@API_METHODS
		     });
}

=pod

=head2 DescribeInstances

 DescribeInstances(options)

C<options> is a hash of optional parameters to pass to the API.  See
the API description at
L</http://docs.aws.amazon.com/AWSEC2/latest/APIReference/Welcome.html>

To create pass the C<Filter> parameters, pass an array of hash references.

 my $filter [{Name => 'instance-id', Value => 'i-0b91d8e165cf2f41b'}]);
 my $result = $ec2->DescribeInstances(Filter => $filter);
 print to_json($result, { pretty  => 1 });

=cut

sub DescribeInstances {
  my $self = shift;
  my %args = @_;
  my @options;
  
  foreach my $param (keys %args) {
    if ( ref($args{$param}) && reftype($args{$param}) eq 'ARRAY') {
      push @options, _format_filter($args{$param});
    }
    else {
      push @options, sprintf("%s=%s", $param, $args{$param});
    }
  }
    
  return XMLin($self->describe_instances(@options ? \@options : ()));
}


sub CreateSnapshot {
  my $self = shift;
  my %args = @_;
  my @parms = _format_parameters(%args);
  
  return XMLin($self->create_snapshot(\@parms));
}

=pod

=head2 CreateTags

 CreateTags( resources ) 

 CreateTags( $id => { Key => 'Name', Value => 'foo' } );
 CreateTags( $id => [ { Key => 'Name', Value => 'foo' },
                      { Key => 'Environment', Value => 'boo'}



( run in 1.992 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )