• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

bin/H06-Aug-2015-148104

examples/H06-Aug-2015-667455

lib/H06-Aug-2015-282,55643,475

old_t/H06-Aug-2015-4226

t/H06-Aug-2015-45,51444,756

ChangesH A D06-Aug-20156 KiB133116

LICENSEH A D06-Aug-201542 KiB850685

META.ymlH A D06-Aug-20151.2 KiB5049

Makefile.PLH A D06-Aug-20152.5 KiB10997

README.mdH A D06-Aug-20159.8 KiB292202

TODOH A D06-Aug-20151.1 KiB2625

cpanfileH A D06-Aug-20151.2 KiB4644

dist.iniH A D06-Aug-2015703 3929

gen_classes.plH A D06-Aug-20151.5 KiB6546

README.md

1aws-sdk-perl
2============
3
4Attempt to build a complete AWS SDK in Perl
5
6This project is attempting to build an entire AWS SDK from the information
7that is stored in other AWS SDKs. Other AWS SDKs have a "data-driven" approach,
8meaning that the definitions for the method calls are stored in a data structure
9describing input and output parameters.
10
11The project is actually generating all of it's classes from botocore
12
13[![Build Status](https://travis-ci.org/pplu/aws-sdk-perl.svg?branch=master)](https://travis-ci.org/pplu/aws-sdk-perl)
14
15Installation
16============
17
18If you want to install and use Paws then just install it via cpan, cpanm, carton or the likes. If you want to contribute code: read on
19
20Development setup
21============
22
23If you want to develop a feature, or contribute code in some way, you need a development setup. This is done by cloning
24the repo into a local directory.
25
26```
27# Clone the repo. For what it's worth, you can clone from a fork too :)
28git clone https://github.com/pplu/aws-sdk-perl.git
29cd aws-sdk-perl
30```
31
32With carton you can install all the dependencies needed in a local environment, so you can play around with dependencies without
33affecting the system libraries. The cpanfile is used to track the dependencies needed.
34
35It's possible that you need -dev libraries for compiling some of these modules. In Debian/Ubuntu these packages are
36
37```
38sudo apt-get install libxml2-dev libssl-dev
39```
40
41And now tell carton to install the dependecies in a local lib
42
43```
44carton install
45# drop into a shell so perl can always find the local libraries
46carton exec $SHELL -l
47```
48
49Now we'll pull the paws-maintained fork of boto (so we can generate the SDK)
50
51```
52make pull-other-sdks
53```
54
55Now we're ready to code away! Happy hacking.
56
57Organization
58============
59
60build-lib: Contains classes that convert the botocore definitions into perl classes.
61
62auto-lib: Contains the auto-generated classes. Changes to code in this directory
63will be overwritten, so only commit autogenerated code; never handwritten code (see "Generating API").
64
65lib: Contains roles and classes that the auto-generated classes use to call the API,
66sign requests, handle responses, etc.
67
68Generating API
69============
70
71Note: This step is not necessary if you want to try out the SDK. We commit in "auto-lib"
72the classes generated by the definitions to which the "botocore" submodule points to. If you're
73not developing the SDK, go directly to the "Trying it out" step :)
74
75Execute command make pull-other-sdks This will do a git pull of some official AWS sdks
76that are data-driven, and used to generate the SDK.
77
78To generate the API for a given API call:
79```
80./gen_classes.pl botocore/botocore/data/SERVICE/DATE/service-2.json
81```
82
83This will generate file(s) in auto-lib.
84
85To generate all the APIs:
86
87```
88make gen-classes
89```
90
91Perl versions
92============
93
94The SDK is targeted at modern Perl versions (in support as per: http://perldoc.perl.org/perlpolicy.html#MAINTENANCE-AND-SUPPORT.
95Old versions may work, but no intention to support them is made. You can always install a modern version of perl with perlbrew or
96plenv in a breeze. We're running the test cases on Travis for all "supported" perl versions. If you want to support a lower version,
97you can contribute back. Acceptance of patches for older versions of Perl won't mean that the compatibility will be maintained
98long-term, although it will be tried :).
99
100Dependencies
101============
102
103Dependencies are versioned in a cpanfile. If you have carton, just execute 'carton install' in the sdk directory, and all dependencies
104will be pulled in automatically into a local library path. After that use 'carton exec ...' to execute your scripts.
105
106If you add a dependency, just add it to the cpanfile file. There are three sections:
107
108 - the general section is for dependencies that are needed only in runtime
109 - the test section is for dependecies needed to run the test suite
110 - the develop section is for dependencies needed for developers
111
112carton install installs all dependencies in all sections (after all, we're in developer mode here)
113
114Packaging
115============
116
117Packaging is managed with Dist::Zilla. running dzil build will make a tar.gz suitable for uploading to CPAN
118
119Trying it out
120============
121
122Each class for each API can be constructed in the following way:
123
124Create a Perl script (myscript.pl)
125
126```
127#!/usr/bin/env perl
128
129use Paws;
130use Data::Printer;
131
132my $iam = Paws->service('IAM');
133
134my $summary = $iam->GetAccountSummary;
135p $summary->SummaryMap;
136```
137
138also take a look at the CLI utility (see below) for fast testing)
139
140Credentials
141============
142
143There are various ways of transmitting credentials to the SDK. By default a
144ProviderChain is used. This chain tries to use the Environment, later the
145File, and later the InstanceProfile credential modules until it finds credentials.
146Other credential providers have to be passed explicitly when requesting a service.
147
148```
149my $svc = Paws->service('IAM', credentials => ...CredentialProvider...->new(...));
150```
151
152These Credential providers work as follows:
153
154Paws::Credential::Environment
155
156tries to find credentials in the process environment variables
157 - Access Key in AWS_ACCESS_KEY or AWS_ACCESS_KEY_ID
158 - Secret Key in AWS_SECRET_KEY or AWS_SECRET_ACCESS_KEY
159 - Session Token [optional] in AWS_SESSION_TOKEN
160
161Paws::Credential::File
162
163tries to find credentials in ~/.aws/credentials. This file is an ini formatted file
164as specified in http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#cli-config-files.
165
166it will try to find keys aws_access_key_id, aws_secret_access_key and aws_session_token in the default profile,
167or in the profile specified by ENV variable AWS_DEFAULT_PROFILE.
168
169Paws::Credential::InstanceProfile
170
171Instance Profiles (Roles) are also supported, so if you're running on an
172instance with a Role, the SDK will automatically pick up credentials.
173
174Paws::Credential::STS
175
176With the STS Credential provider, you can use temporary federated credentials with
177optionally restricted permissions, obtained via the AWS STS service.
178
179```
180my $cred_provider = Paws::Credential::STS->new(
181  Name => 'MyName',
182  DurationSeconds => 900,
183  Policy => '{"Version":"2012-10-17","Statement":[{"Effect": "Allow","Action":["ec2:DescribeInstances"],"Resource":"*"}]}'
184);
185my $ec2 = Paws->service('EC2', credentials => $cred_provider, region => 'eu-west-1');
186$ec2->DescribeInstances;
187```
188
189Paws::Credential::AssumeRole
190
191With the AssumeRole provider you can enable cross account access (call other accounts
192APIs without needing them to provide you with access keys and secret keys.
193
194```
195my $ec2 = Paws->service('EC2',
196  region => 'eu-west-1',
197  credentials => Paws::Credential::AssumeRole->new(
198    RoleArn => 'arn:aws:iam::123456789012:role/AdminRole',
199    RoleSessionName => 'CrossAccountTest',
200    ExternalId => 'MyExternalId',
201  )
202);
203# get security groups from account 123456789012
204$ec2->DescribeSecurityGroups();
205```
206
207Status
208================
209
210Don't consider the SDK as "stable" code. There is a lot of experimenting going on. That said,
211I'm using it in production, so changes to the way you call APIs, although not guaranteed, are
212not prone to change because they are autogenerated. Expect changes around the way you obtain
213service classes, transmit credentials, etc. Look at the TODO for expected changes to come.
214
215As of 2015-02 I'm documenting breaking changes in the Changes file. API changes that break stuff
216will be documented there. Please read the Changes file before updating your git clone.
217
218Using the SDK in your code
219================
220
221Although the code isn't considered stable yet, it works, and more than one person is using it
222already. I recommend you to use a fixed checkout of the repo, via a git submodule, for example.
223Try to keep up-to-date by updating frequently, but read the Changes file before, so you can see
224if there is any before-seen breakage in the process.
225
226Supported AWS Services
227================
228
229Just load a class (via Paws->service). (note that there is also a method in Paws that lists all
230loadable service classes (the cli uses it, so try out the CLI!). If a service is not supported,
231it will warn on construction with an explicit "non supported API" message. Basically all query and
232json services are supported. RestXML and RestJSON services are in the coming.
233
234Documentation
235================
236All services get auto-generated POD documentation. perldoc a file to take a look at the documentation.
237
238CLI utility
239================
240Paws comes with a command-line utility to exercise the SDK. Just like Paws is the namespace
241for the SDK, "paws" (in /bin) is the cli utility. It's quite rudimentary, but think of it as
242a quick way to try out calling services. Just call:
243
244```
245paws
246```
247
248to list all services. If a service isn't supported yet, it will die explicitly advising you that
249Paws doesn't support that service yet.
250
251```
252paws EC2 --region eu-west-1 DescribeInstances
253```
254
255Parameters needed in for DescribeInstances can be passed as a list of parameters (see https://metacpan.org/pod/ARGV::Struct) for complete
256documentation of how to pass parameters via command line.
257
258```
259paws EC2 --region eu-west-1 DescribeInstances Parameter1: ValueForParameter1 ListParameter: [ V1 V2 ] ComplexParam { Key1 Value1 Key2 Value 2 }
260```
261
262License
263================
264
265This code is distributed under the GNU Lesser General Public License, Version 3
266
267Thanks
268================
269Luis Alberto Gimenez (@agimenez) for
270 - The git-fu cleaning up the "pull other sdks" code
271 - Credential Providers code
272
273Srinvas (@kidambisrinivas) for testing, bug reporting and fixing
274
275juair10 for corrections and testing
276
277CHORNY for CPAN and cpanfile packaging corrections
278
279Iñigo Tejedor for service endpoint resolution based on rules
280
281codehead for helping fix SQS Queue Maps
282
283mbartold for helping fix SQS MessageBatch functionality
284
285coreymayer for reporting bug in RestXmlCaller
286
287arc (Aaron Crane) for documentation patches
288
289dtikhonov for LWP Caller and bug reporting/fixing
290
291vivus-ignis for DynamoDB bug reporting and test scripts for DynamoDB
292