Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
devel:languages:perl:CPAN-V
perl-VM-EC2
perl-VM-EC2.spec
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File perl-VM-EC2.spec of Package perl-VM-EC2
# # spec file for package perl-VM-EC2 # # Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via https://bugs.opensuse.org/ # Name: perl-VM-EC2 Version: 1.28 Release: 0 %define cpan_name VM-EC2 Summary: Perl interface to Amazon EC2, Virtual Private Cloud, Elastic Load Balanc[cut] License: Artistic-1.0 OR GPL-1.0-or-later Group: Development/Libraries/Perl Url: https://metacpan.org/release/%{cpan_name} Source0: https://cpan.metacpan.org/authors/id/L/LD/LDS/%{cpan_name}-%{version}.tar.gz BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: perl BuildRequires: perl-macros BuildRequires: perl(AnyEvent) >= 7.04 BuildRequires: perl(AnyEvent::CacheDNS) >= 0.08 BuildRequires: perl(AnyEvent::HTTP) >= 2.15 BuildRequires: perl(Digest::SHA) >= 5.47 BuildRequires: perl(File::Path) >= 2.080000 BuildRequires: perl(JSON) BuildRequires: perl(LWP) >= 5.835 BuildRequires: perl(MIME::Base64) >= 3.08 BuildRequires: perl(Module::Build) BuildRequires: perl(String::Approx) >= 3.26 BuildRequires: perl(URI::URL) >= 5.03 BuildRequires: perl(XML::Simple) >= 2.18 Requires: perl(AnyEvent) >= 7.04 Requires: perl(AnyEvent::CacheDNS) >= 0.08 Requires: perl(AnyEvent::HTTP) >= 2.15 Requires: perl(Digest::SHA) >= 5.47 Requires: perl(File::Path) >= 2.080000 Requires: perl(JSON) Requires: perl(LWP) >= 5.835 Requires: perl(MIME::Base64) >= 3.08 Requires: perl(String::Approx) >= 3.26 Requires: perl(URI::URL) >= 5.03 Requires: perl(XML::Simple) >= 2.18 Recommends: perl(AWS::Signature4) >= 1.00 %{perl_requires} %description This is an interface to the 2014-05-01 version of the Amazon AWS API (http://aws.amazon.com/ec2). It was written provide access to the new tag and metadata interface that is not currently supported by Net::Amazon::EC2, as well as to provide developers with an extension mechanism for the API. This library will also support the Open Stack open source cloud (http://www.openstack.org/). The main interface is the VM::EC2 object, which provides methods for interrogating the Amazon EC2, launching instances, and managing instance lifecycle. These methods return the following major object classes which act as specialized interfaces to AWS: VM::EC2::BlockDevice -- A block device VM::EC2::BlockDevice::Attachment -- Attachment of a block device to an EC2 instance VM::EC2::BlockDevice::EBS -- An elastic block device VM::EC2::BlockDevice::Mapping -- Mapping of a virtual storage device to a block device VM::EC2::BlockDevice::Mapping::EBS -- Mapping of a virtual storage device to an EBS block device VM::EC2::Group -- Security groups VM::EC2::Image -- Amazon Machine Images (AMIs) VM::EC2::Instance -- Virtual machine instances VM::EC2::Instance::Metadata -- Access to runtime metadata from running instances VM::EC2::Region -- Availability regions VM::EC2::Snapshot -- EBS snapshots VM::EC2::Tag -- Metadata tags In addition, there is a high level interface for interacting with EC2 servers and volumes, including file transfer and remote shell facilities: VM::EC2::Staging::Manager -- Manage a set of servers and volumes. VM::EC2::Staging::Server -- A staging server, with remote shell and file transfer facilities. VM::EC2::Staging::Volume -- A staging volume with the ability to copy itself between availability zones and regions. and a few specialty classes: VM::EC2::Security::Token -- Temporary security tokens for granting EC2 access to non-AWS account holders. VM::EC2::Security::Credentials -- Credentials for use by temporary account holders. VM::EC2::Security::Policy -- Policies that restrict what temporary account holders can do with EC2 resources. VM::EC2::Security::FederatedUser -- Account name information for temporary account holders. Lastly, there are several utility classes: VM::EC2::Generic -- Base class for all AWS objects VM::EC2::Error -- Error messages VM::EC2::Dispatch -- Maps AWS XML responses onto perl object classes VM::EC2::ReservationSet -- Hidden class used for describe_instances() request; The reservation Ids are copied into the Instance object. There is also a high-level API called "VM::EC2::Staging::Manager" for managing groups of staging servers and volumes which greatly simplifies the task of creating and updating instances that mount multiple volumes. The API also provides a one-line command for migrating EBS-backed AMIs from one zone to another. See VM::EC2::Staging::Manager. The interface provided by these modules is based on that described at http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/. The following caveats apply: 1) Not all of the Amazon API is currently implemented. Specifically, a handful calls dealing with cluster management and VM importing are missing. See L</MISSING METHODS> for a list of all the unimplemented API calls. Volunteers to fill in these gaps are most welcome! 2) For consistency with common Perl coding practices, method calls are lowercase and words in long method names are separated by underscores. The Amazon API prefers mixed case. So in the Amazon API the call to fetch instance information is "DescribeInstances", while in VM::EC2, the method is "describe_instances". To avoid annoyance, if you use the mixed case form for a method name, the Perl autoloader will automatically translate it to underscores for you, and vice-versa; this means you can call either $ec2->describe_instances() or $ec2->DescribeInstances(). 3) Named arguments passed to methods are all lowercase, use underscores to separate words and start with hyphens. In other words, if the AWS API calls for an argument named "InstanceId" to be passed to the "DescribeInstances" call, then the corresponding Perl function will look like: $instance = $ec2->describe_instances(-instance_id=>'i-12345') In most cases automatic case translation will be performed for you on arguments. So in the previous example, you could use -InstanceId as well as -instance_id. The exception is when an absurdly long argument name was replaced with an abbreviated one as described below. In this case, you must use the documented argument name. In a small number of cases, when the parameter name was absurdly long, it has been abbreviated. For example, the "Placement.AvailabilityZone" parameter has been represented as -placement_zone and not -placement_availability_zone. See the documentation for these cases. 4) For each of the describe_foo() methods (where "foo" is a type of resource such as "instance"), you can fetch the resource by using their IDs either with the long form: $ec2->describe_foo(-foo_id=>['a','b','c']), or a shortcut form: $ec2->describe_foo('a','b','c'); Both forms are listed in the headings in the documentation. 5) When the API calls for a list of arguments named Arg.1, Arg.2, then the Perl interface allows you to use an anonymous array for the consecutive values. For example to call describe_instances() with multiple instance IDs, use: @i = $ec2->describe_instances(-instance_id=>['i-12345','i-87654']) 6) All Filter arguments are represented as a -filter argument whose value is an anonymous hash: @i = $ec2->describe_instances(-filter=>{architecture=>'i386', 'tag:Name' =>'WebServer'}) If there are no other arguments you wish to pass, you can omit the -filter argument and just pass a hashref: @i = $ec2->describe_instances({architecture=>'i386', 'tag:Name' =>'WebServer'}) For any filter, you may represent multiple OR arguments as an arrayref: @i = $ec2->describe-instances({'instance-state-name'=>['stopped','terminated']}) When adding or removing tags, the -tag argument uses the same syntax. 7) The tagnames of each XML object returned from AWS are converted into methods with the same name and typography. So the <privateIpAddress> tag in a DescribeInstancesResponse, becomes: $instance->privateIpAddress You can also use the more Perlish form -- this is equivalent: $instance->private_ip_address Methods that correspond to complex objects in the XML hierarchy return the appropriate Perl object. For example, an instance's blockDeviceMapping() method returns an object of type VM::EC2::BlockDevice::Mapping. All objects have a fields() method that will return the XML tagnames listed in the AWS specifications. @fields = sort $instance->fields; # 'amiLaunchIndex', 'architecture', 'blockDeviceMapping', ... 8) Whenever an object has a unique ID, string overloading is used so that the object interpolates the ID into the string. For example, when you print a VM::EC2::Volume object, or use it in another string context, then it will appear as the string "vol-123456". Nevertheless, it will continue to be usable for method calls. ($v) = $ec2->describe_volumes(); print $v,"\n"; # prints as "vol-123456" $zone = $v->availabilityZone; # acts like an object 9) Many objects have convenience methods that invoke the AWS API on your behalf. For example, instance objects have a current_status() method that returns the run status of the object, as well as start(), stop() and terminate() methods that control the instance's lifecycle. if ($instance->current_status eq 'running') { $instance->stop; } 10) Calls to AWS that have failed for one reason or another (invalid arguments, communications problems, service interruptions) will return undef and set the VM::EC2->is_error() method to true. The error message and its code can then be recovered by calling VM::EC2->error. $i = $ec2->describe_instance('i-123456'); unless ($i) { warn 'Got no instance. Message was: ',$ec2->error; } You may also elect to raise an exception when an error occurs. See the new() method for details. %prep %setup -q -n %{cpan_name}-%{version} %build perl Build.PL installdirs=vendor ./Build build flags=%{?_smp_mflags} %check ./Build test %install ./Build install destdir=%{buildroot} create_packlist=0 %perl_gen_filelist %files -f %{name}.files %defattr(-,root,root,755) %doc Changes DISCLAIMER.txt README %license LICENSE %changelog
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor