blib/lib/WebService/Amazon/ElasticBeanstalk.pm

filter: Statementstmt 40.5% 32 / 79 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 9 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 73.3% 11 / 15 Podpod n/a totaltotal 35.5% 43 / 121 CC 11 SCAR 24.5
CC
11
Cov
32%
new
30.0
_handleRepeatedOptions
20.0
_get
12.0
CRAP 11.6
↑ Summary
1 package WebService::Amazon::ElasticBeanstalk;
2 1 ▶use base qw( WebService::Simple );
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 1 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use warnings FATAL => 'all';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 #binmode STDOUT, ":encoding(UTF-8)";
9  
10 1 ▶use AWS::Signature4;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use HTTP::Request::Common;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use LWP;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use Params::Validate qw( :all );
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 ▶use Readonly;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 #use Smart::Comments '###';
17 #use Smart::Comments '###', '####';
18 #use Smart::Comments '###', '####', '#####';
19 require XML::Simple;
20  
21 =encoding utf-8
22  
23 =head1 NAME
24  
25 WebService::Amazon::ElasticBeanstalk - Basic interface to Amazon ElasticBeanstalk
26  
27 =head1 VERSION
28  
29 Version 0.0.6
30  
31 =cut
32  
33 1 ▶use version;
Subroutine BEGIN: called CC=1 SCAR=0.0
34 our $VERSION = version->declare("v0.0.6");
35  
36 =head1 SYNOPSIS
37  
38 This module provides a Perl wrapper around Amazon's
39 ( L<http://aws.amazon.com> ) ElasticBeanstalk API. You will need
40 to be an AWS customer with an ID and Secret which has been provided
41 access to Elastic Beanstalk.
42  
43 B<Note:> Some parameter validation is purposely lax. The API will
44 generally fail when invalid params are passed. The errors may not
45 be helpful.
46  
47 =cut
48  
49 # From: http://docs.aws.amazon.com/general/latest/gr/rande.html#elasticbeanstalk_region
50 # FIXME: use an array and assemble the URL in the constructor?
51 Readonly our %REGIONS => ( 'us-east-1' => 'https://elasticbeanstalk.us-east-1.amazonaws.com',
52 'us-west-1' => 'https://elasticbeanstalk.us-west-1.amazonaws.com',
53 'us-west-2' => 'https://elasticbeanstalk.us-west-2.amazonaws.com',
54 'eu-west-1' => 'https://elasticbeanstalk.eu-west-1.amazonaws.com',
55 'eu-central-1' => 'https://elasticbeanstalk.eu-central-1.amazonaws.com',
56 'ap-southeast-1' => 'https://elasticbeanstalk.ap-southeast-1.amazonaws.com',
57 'ap-southeast-2' => 'https://elasticbeanstalk.ap-southeast-2.amazonaws.com',
58 'ap-northeast-1' => 'https://elasticbeanstalk.ap-northeast-1.amazonaws.com',
59 'sa-east-1' => 'https://elasticbeanstalk.sa-east-1.amazonaws.com'
60 );
61  
62 # Global API Version and Default Region
63 Readonly our $API_VERSION => '2010-12-01';
64 Readonly our $DEF_REGION => 'us-east-1';
65  
66 # some defaults
67 __PACKAGE__->config(
68 base_url => $REGIONS{'us-east-1'},
69 );
70  
71 # Global patterns for param validation
72 Readonly our $REGEX_ID => '^[A-Z0-9]{20}$';
73 Readonly our $REGEX_REGION => '^[a-z]{2}-[a-z].*?-\d$';
74 Readonly our $REGEX_SECRET => '^[A-Za-z0-9/+]{40}$';
75  
76 Readonly our $REGEX_CONDITIONS => '^(haveAtLeastOneUnapproved|haveAtLeastOneApproved|haveAtLeastOneTranslated|haveAllTranslated|haveAllApproved|haveAllUnapproved)$';
77 Readonly our $REGEX_FILETYPES => '^(android|docx|ios|gettext|html|xlsx|javaProperties|json|pptx|xliff|xlsx|xml|yaml)$';
78 Readonly our $REGEX_FILEURI => '^\S+$';
79 Readonly our $REGEX_INT => '^\d+$';
80 Readonly our $REGEX_RETYPE => '^(pending|published|pseudo)$';
81 Readonly our $REGEX_URL => '^(https?|ftp|file)://.+$';
82 # From: http://www.pelagodesign.com/blog/2009/05/20/iso-8601-date-validation-that-doesnt-suck/
83 Readonly our $REGEX_DATE_ISO8601 => '^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24\:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$';
84  
85 =head1 INTERFACE
86  
87 =head2 new
88  
89 Inherited from L<WebService::Simple>, and takes all the same arguments.
90 You B<must> provide the Amazon required arguments of B<id>, and B<secret>
91 in the param hash:
92  
93 my $ebn = WebService::Amazon::ElasticBeanstalk->new( param => { id => $AWS_ACCESS_KEY_ID,
94 region => 'us-east-1',
95 secret => $AWS_ACCESS_KEY_SECRET } );
96  
97 =over 4
98  
99 =item B<Parameters>
100  
101 =item id B<(required)>
102  
103 You can find more information in the AWS docs:
104 L<http://docs.aws.amazon.com/elasticbeanstalk/latest/APIReference/CommonParameters.html>
105  
106 =item region I<(optional)> - defaults to us-east-1
107  
108 You can find available regions at:
109 L<http://docs.aws.amazon.com/general/latest/gr/rande.html#elasticbeanstalk_region>
110  
111 =item secret B<(required)>
112  
113 You can find more information in the AWS docs:
114 L<http://docs.aws.amazon.com/elasticbeanstalk/latest/APIReference/CommonParameters.html>
115  
116 =back
117  
118 =cut
119  
120 # apiKey => { type => SCALAR, regex => qr/$REGEX_APIKEY/, },
121 # approved => { type => SCALAR, },
122 # callbackUrl => { type => SCALAR, regex => qr/$REGEX_URL/, },
123 # conditions => { type => ARRAYREF },
124 # file => { type => SCALAR,
125 # callbacks => {
126 # 'readable file' => sub { my( $f ) = shift(); return "$f" ne "" && -r "$f" },
127 # 'less than 5MB' => sub { my( $f ) = shift(); return "$f" ne "" && -r "$f" && (sprintf( "%.2f", (-s "$f") / 1024 / 1024) < 5 ); };
128 # },
129 # untaint => 1
130 # },
131 # fileType => { type => SCALAR, regex => qr/$REGEX_FILETYPES/, },
132 # fileTypes => { type => ARRAYREF, regex => qr/$REGEX_FILETYPES/, },
133 # fileUri => { type => SCALAR, regex => qr/$REGEX_FILEURI/, },
134 # lastUploadedAfter => { type => SCALAR, regex => qr/$REGEX_DATE_ISO8601/, },
135 # lastUploadedBefore => { type => SCALAR, regex => qr/$REGEX_DATE_ISO8601/, },
136 # limit => { type => SCALAR, regex => qr/$REGEX_INT/, },
137 # locale => { type => SCALAR, regex => qr/$REGEX_FILEURI/, },
138 # newFileUri => { type => SCALAR, regex => qr/$REGEX_FILEURI/, },
139 # offset => { type => SCALAR, regex => qr/$REGEX_INT/, },
140 # projectId => { type => SCALAR, regex => qr/$REGEX_PROJID/, },
141 # retrievalType => { type => SCALAR, regex => qr/$REGEX_RETYPE/, },
142 # uriMask => { type => SCALAR, },
143 # );
144  
145 our( %API_SPEC );
146  
147 $API_SPEC{'new'} = {
148 id => { type => SCALAR, regex => qr/$REGEX_ID/, },
149 region => { type => SCALAR, regex => qr/$REGEX_REGION/, optional => 1, default => $DEF_REGION, },
150 secret => { type => SCALAR, regex => qr/$REGEX_SECRET/, },
151 };
152  
153 # #################################################################################################
154 #
155 # Override WebService::Simple methods
156 #
157  
158 # Override valid options, set API version and create XML parser
159 sub new {
160 ### Enter: (caller(0))[3]
161 0 ▶ my( $class, %args ) = @_;
Subroutine new: not called CC=5 SCAR=34.0
162 0 my $self = $class->SUPER::new(%args);
163
164 # set our API version
165 0 $self->{api_version} = $API_VERSION;
166
167 # for parsing the responses
168 0 $self->{xs} = XML::Simple->new();
169
170 # this is silly, but easier for validation
171 0 my( @temp_params ) = %{ $self->{basic_params} };
172 0 my %params = validate( @temp_params, $API_SPEC{'new'} );
173 ##### %params
174
175 # change the endpoint for the requested region
176 0 ▶ if ( $params{region} && $REGIONS{$params{region}} ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($params{'region'} and $WebService::Amazon::ElasticBeanstalk::REGIONS{$params{'region'}}) { } 0 0 0
elsif ($params{'region'} and not $WebService::Amazon::ElasticBeanstalk::REGIONS{$params{'region'}}) { } 0 0 0
Condition0%0/3
$params{"region"} and $WebService::Amazon::ElasticBeanstalk::REGIONS{$params{"region"}}
!ll&&!rl&&r
000
MC/DC0%0/2
$params{"region"} and $WebService::Amazon::ElasticBeanstalk::REGIONS{$params{"region"}}
$params{"region"} $WebService::Amazon::ElasticBeanstalk::REGIONS{$params{"region"}}
Truth table0%0/3
A and B
A= $params{"region"}B= $WebService::Amazon::ElasticBeanstalk::REGIONS{$params{"region"}}
ABresult
0X0
100
111
177 0 $self->{base_url} = $REGIONS{$params{region}};
178 }
179 ▶ elsif ( $params{region} && !$REGIONS{$params{region}} ) {
Condition0%0/3
$params{"region"} and not $WebService::Amazon::ElasticBeanstalk::REGIONS{$params{"region"}}
!ll&&!rl&&r
000
MC/DC0%0/2
$params{"region"} and not $WebService::Amazon::ElasticBeanstalk::REGIONS{$params{"region"}}
$params{"region"} not $WebService::Amazon::ElasticBeanstalk::REGIONS{$params{"region"}}
Truth table0%0/3
A and not(B)
A= $params{"region"}B= not $WebService::Amazon::ElasticBeanstalk::REGIONS{$params{"region"}}
ABresult
0X0
100
111
180 0 carp( "Unknown region: $params{region}; using $DEF_REGION...")
181 }
182 ### Exit: (caller(0))[3]
183 0 return bless($self, $class);
184 }
185  
186 # override parent get to perform the required AWS signatures
187 sub _get {
188 ### Enter: (caller(0))[3]
189 0 ▶ my( $self ) = shift;
Subroutine _get: not called CC=3 SCAR=24.8
190 0 my( %args ) = @_;
191 #my $self = $class->SUPER::new(%args);
192
193 ##### $self
194 my $signer = AWS::Signature4->new( -access_key => $self->{basic_params}{id},
195 0 -secret_key => $self->{basic_params}{secret} );
196  
197 0 my $ua = LWP::UserAgent->new();
198  
199 ### %args
200 0 ▶ if ( !$args{params} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $args{'params'}) { } 0 0 0
201 0 carp( "No parameter provided for request!" );
202 0 return undef;
203 }
204 else {
205 0 $args{params}{Version} = $self->{api_version};
206 }
207  
208 0 my $uri = URI->new( $self->{base_url} );
209 0 $uri->query_form( $args{params} );
210 #### $uri
211  
212 0 my $url = $signer->signed_url($uri); # This gives a signed URL that can be fetched by a browser
213 #### $url
214 # This doesn't quite work (it wants path and args only)
215 #my $response = $self->SUPER::get( $url );
216 0 my $response = $ua->get($url);
217 ##### $response
218 0 ▶ if ( $response->is_success ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($response->is_success) { } 0 0 0
219 ### Exit: (caller(0))[3]
220 0 return $self->{xs}->XMLin( $response->decoded_content );
221 }
222 else {
223 0 carp( $response->status_line );
224 ### Exit: (caller(0))[3]
225 0 return undef;
226 }
227 ### Exit: (caller(0))[3]
228 }
229  
230 # override parent post to perform the required AWS signatures
231 sub _post {
232 0 ▶ my( $self, %args ) = @_;
Subroutine _post: not called CC=2 SCAR=17.9
233
234 my $signer = AWS::Signature4->new( -access_key => $self->{basic_params}{id},
235 0 -secret_key => $self->{basic_params}{secret});
236
237 0 my $ua = LWP::UserAgent->new();
238  
239 # Example POST request
240 0 my $request = POST('https://iam.amazonaws.com',
241 [Action=>'ListUsers',
242 Version=>'2010-05-08']);
243 0 $signer->sign($request);
244 0 my $response = $ua->request($request);
245 ##### $response
246 0 ▶ if ( $response->is_success ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($response->is_success) { } 0 0 0
247 0 return $self->{xs}->XMLin( $response->decoded_content );
248 }
249 else {
250 0 carp( $response->status_line );
251 0 return undef;
252 }
253 }
254  
255 # implement a general way to configure repeated options to match the API
256 sub _handleRepeatedOptions {
257 ### Enter: (caller(0))[3]
258 0 ▶ my( $self ) = shift;
Subroutine _handleRepeatedOptions: not called CC=4 SCAR=30.0
259 0 my( $repeat, %params ) = @_;
260 #### %params
261  
262 0 ▶ if ( $params{$repeat} && ref( $params{$repeat} ) eq "ARRAY" ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($params{$repeat} and ref $params{$repeat} eq "ARRAY") 0 0 0
Condition0%0/3
$params{$repeat} and ref $params{$repeat} eq "ARRAY"
!ll&&!rl&&r
000
MC/DC0%0/2
$params{$repeat} and ref $params{$repeat} eq "ARRAY"
$params{$repeat} ref $params{$repeat} eq "ARRAY"
Truth table0%0/3
A and B
A= $params{$repeat}B= ref $params{$repeat} eq "ARRAY"
ABresult
0X0
100
111
263 0 my( $i ) = 1;
264 0 foreach my $t ( @{ $params{$repeat} } ) {
265 0 $params{"${repeat}.member.${i}"} = $t;
266 0 $i++;
267 }
268 0 delete( $params{$repeat} );
269 }
270
271 #### %params
272 ### Exit: (caller(0))[3]
273 0 return %params;
274 }
275  
276 # most of the calls can do this
277 sub _genericCallHandler {
278 ### Enter: (caller(0))[3]
279 my( $op ) = pop( [ split( /::/, (caller(1))[3] ) ] );
280 ### Operation: $op
281 my( $self ) = shift;
282 my %params = validate( @_, $API_SPEC{$op} );
283 $params{Operation} = $op;
284 ### %params
285
286 # handle ARRAY / repeated options
287 foreach my $opt ( keys( %{ $API_SPEC{$op} } ) ) {
288 ### Checking opt: $opt
289 if ( $API_SPEC{$op}->{$opt}->{type} == ARRAYREF ) {
290 ### Found a repeatable option: $opt
291 ( %params ) = $self->_handleRepeatedOptions( $opt, %params );
292 }
293 }
294
295 ### %params
296 my( $rez ) = $self->_get( params => \%params );
297 ### Exit: (caller(0))[3]
298 return $rez->{"${op}Result"};
299 }
300  
301 # sub one_of {
302 # my @options = @_;
303 # _bless_right_class(_mk_autodoc(sub { _count_of(\@options, 1)->(@_) }));
304 # }
305  
306 # #################################################################################################
307 #
308 # API Methods Below
309 #
310  
311 ## CheckDNSAvailability
312  
313 =head2 CheckDNSAvailability( CNAMEPrefix => 'the-thing-to-check' )
314  
315 Returns a list of the available solution stack names.
316  
317 Refer to L<http://docs.aws.amazon.com/elasticbeanstalk/latest/APIReference/API_CheckDNSAvailability.html>
318  
319 =over 4
320  
321 =item B<Parameters>
322  
323 =item CNAMEPrefix B<(required scalar)>
324  
325 The prefix used when this CNAME is reserved.
326  
327 =item B<Returns: result from API call>
328  
329 =back
330  
331 =cut
332  
333 $API_SPEC{'CheckDNSAvailability'} = { CNAMEPrefix => { type => SCALAR, regex => qr/^[A-Z0-9_-]{4,63}$/i, } };
334  
335 sub CheckDNSAvailability {
336 ### Enter: (caller(0))[3]
337 my( $rez ) = _genericCallHandler( @_ );
338 ### Exit: (caller(0))[3]
339 return $rez;
340 }
341  
342 # CreateApplication
343 # CreateApplicationVersion
344 # CreateConfigurationTemplate
345 # CreateEnvironment
346 # CreateStorageLocation
347 # DeleteApplication
348 # DeleteApplicationVersion
349 # DeleteConfigurationTemplate
350 # DeleteEnvironmentConfiguration
351  
352 # #################################################################################################
353 # DescribeApplicationVersions
354  
355 =head2 DescribeApplicationVersions( )
356  
357 Returns a list of the available solution stack names.
358  
359 Refer to L<http://docs.aws.amazon.com/elasticbeanstalk/latest/APIReference/API_DescribeApplicationVersions.html>
360  
361 =over 4
362  
363 =item B<Parameters>
364  
365 =item ApplicationName I<(optional scalar)>
366  
367 If specified, AWS Elastic Beanstalk restricts the returned descriptions to only include ones that are associated with the specified application.
368  
369 =item VersionLabels I<(optional array)>
370  
371 If specified, AWS Elastic Beanstalk restricts the returned versions to only include those with the specified names.
372  
373 =item B<Returns: result from API call>
374  
375 =back
376  
377 =cut
378  
379 $API_SPEC{'DescribeApplicationVersions'} = { ApplicationName => { type => SCALAR, optional => 1, regex => qr/^[A-Z0-9_-]{4,63}$/i, },
380 VersionLabels => { type => ARRAYREF, optional => 1 },
381 };
382  
383 sub DescribeApplicationVersions {
384 ### Enter: (caller(0))[3]
385 my( $rez ) = _genericCallHandler( @_ );
386 ### Exit: (caller(0))[3]
387 return $rez;
388 }
389  
390 # #################################################################################################
391 # DescribeApplications
392  
393 =head2 DescribeApplications( )
394  
395 Returns a list of the available solution stack names.
396  
397 Refer to L<http://docs.aws.amazon.com/elasticbeanstalk/latest/APIReference/API_DescribeApplications.html>
398  
399 =over 4
400  
401 =item B<Parameters>
402  
403 =item ApplicationNames I<(optional array)>
404  
405 If specified, AWS Elastic Beanstalk restricts the returned descriptions to only include those with the specified names.
406  
407 =item B<Returns: result from API call>
408  
409 =back
410  
411 =cut
412  
413 $API_SPEC{'DescribeApplications'} = { ApplicationNames => { type => ARRAYREF, optional => 1 } };
414
415 sub DescribeApplications {
416 ### Enter: (caller(0))[3]
417 my( $rez ) = _genericCallHandler( @_ );
418 ### Exit: (caller(0))[3]
419 return $rez;
420 }
421  
422 # #################################################################################################
423 # DescribeConfigurationOptions
424  
425 =head2 DescribeConfigurationOptions( )
426  
427 Returns a list of the available solution stack names.
428  
429 Refer to L<http://docs.aws.amazon.com/elasticbeanstalk/latest/APIReference/API_DescribeConfigurationOptions.html>
430  
431 =over 4
432  
433 =item B<Parameters>
434  
435 =item ApplicationName I<(optional string)>
436  
437 The name of the application associated with the configuration template or environment. Only needed if you want to describe the configuration options associated with either the configuration template or environment.
438  
439 =item EnvironmentName I<(optional string)>
440  
441 The name of the environment whose configuration options you want to describe.
442  
443 =item Options I<(optional array)>
444  
445 If specified, restricts the descriptions to only the specified options.
446  
447 =item SolutionStackName I<(optional string)>
448  
449 The name of the solution stack whose configuration options you want to describe.
450  
451 =item TemplateName I<(optional string)>
452  
453 The name of the configuration template whose configuration options you want to describe.
454  
455 =item B<Returns: result from API call>
456  
457 =back
458  
459 =cut
460  
461 $API_SPEC{'DescribeConfigurationOptions'} = { ApplicationName => { type => SCALAR, regex => qr/^[A-Z0-9_-]{1,100}$/i, optional => 1 },
462 EnvironmentName => { type => SCALAR, regex => qr/^[A-Z0-9_-]{4,23}$/i, optional => 1 },
463 Options => { type => ARRAYREF, optional => 1 },
464 SolutionStackName => { type => SCALAR, regex => qr/^[A-Z0-9_-]{1,100}$/i, optional => 1 },
465 TemplateName => { type => SCALAR, regex => qr/^[A-Z0-9_-]{1,100}$/i, optional => 1 },
466 };
467
468 sub DescribeConfigurationOptions {
469 ### Enter: (caller(0))[3]
470 my( $rez ) = _genericCallHandler( @_ );
471 ### Exit: (caller(0))[3]
472 return $rez;
473 }
474  
475 # #################################################################################################
476 # DescribeConfigurationSettings
477  
478 =head2 DescribeConfigurationSettings( )
479  
480 Returns a list of the available solution stack names.
481  
482 Refer to L<http://docs.aws.amazon.com/elasticbeanstalk/latest/APIReference/API_DescribeConfigurationSettings.html>
483  
484 =over 4
485  
486 =item B<Parameters>
487  
488 =item ApplicationName B<(required string)>
489  
490 The application for the environment or configuration template.
491  
492 =item EnvironmentName I(optional string)
493  
494 The name of the environment to describe.
495  
496 Condition: You must specify either this or a TemplateName, but not both. If you specify both, AWS Elastic Beanstalk returns an InvalidParameterCombination error. If you do not specify either, AWS Elastic Beanstalk returns MissingRequiredParameter error.
497  
498 =item TemplateName I(optional string)
499  
500 The name of the configuration template to describe.
501  
502 Conditional: You must specify either this parameter or an EnvironmentName, but not both. If you specify both, AWS Elastic Beanstalk returns an InvalidParameterCombination error. If you do not specify either, AWS Elastic Beanstalk returns a MissingRequiredParameter error.
503  
504 =item B<Returns: result from API call>
505  
506 =back
507  
508 =cut
509  
510 $API_SPEC{'DescribeConfigurationSettings'} = { ApplicationName => { type => SCALAR, regex => qr/^[A-Z0-9_-]{1,100}$/i,
511 callbacks => {
512 'other_params' => sub {
513 my( $me, $others ) = @_;
514 if ( !$others->{'EnvironmentName'} && !$others->{'TemplateName'} ) {
515 croak( "Provide one of EnvironmentName or TemplateName" );
516 return 0;
517 }
518
519 if ( $others->{'EnvironmentName'} && $others->{'TemplateName'} ) {
520 croak( "Provide only one of EnvironmentName or TemplateName" );
521 return 0;
522 }
523 return 1;
524 }
525 }
526 },
527 EnvironmentName => { type => SCALAR, regex => qr/^[A-Z0-9_-]{4,23}$/i, optional => 1 },
528 TemplateName => { type => SCALAR, regex => qr/^[A-Z0-9_-]{4,23}$/i, optional => 1 },
529 };
530  
531 sub DescribeConfigurationSettings {
532 ### Enter: (caller(0))[3]
533 my( $rez ) = _genericCallHandler( @_ );
534 ### Exit: (caller(0))[3]
535 return $rez;
536 }
537  
538 # #################################################################################################
539 # DescribeEnvironmentResources
540  
541 =head2 DescribeEnvironmentResources( )
542  
543 Returns a list of the available solution stack names.
544  
545 Refer to L<http://docs.aws.amazon.com/elasticbeanstalk/latest/APIReference/API_DescribeApplications.html>
546  
547 =over 4
548  
549 =item B<Parameters>
550  
551 =item ApplicationNames I<(optional array)>
552  
553 If specified, AWS Elastic Beanstalk restricts the returned descriptions to only include those with the specified names.
554  
555 =item B<Returns: result from API call>
556  
557 =back
558  
559 =cut
560  
561 $API_SPEC{'DescribeEnvironmentResources'} = { ApplicationNames => { type => ARRAYREF, optional => 1 } };
562
563 sub DescribeEnvironmentResources {
564 ### Enter: (caller(0))[3]
565 my( $rez ) = _genericCallHandler( @_ );
566 ### Exit: (caller(0))[3]
567 return $rez;
568 }
569  
570 # #################################################################################################
571 # DescribeEnvironments
572  
573 =head2 DescribeEnvironments( )
574  
575 Returns a list of the available solution stack names.
576  
577 Refer to L<http://docs.aws.amazon.com/elasticbeanstalk/latest/APIReference/API_DescribeEnvironments.html>
578  
579 =over 4
580  
581 =item B<Parameters>
582  
583 =item ApplicationName I<(optional string)>
584  
585 If specified, AWS Elastic Beanstalk restricts the returned descriptions to include only those that are associated with this application.
586  
587 =item EnvironmentIds I<(optional array)>
588  
589 If specified, AWS Elastic Beanstalk restricts the returned descriptions to include only those that have the specified IDs.
590  
591 =item EnvironmentNames I<(optional array)>
592  
593 If specified, AWS Elastic Beanstalk restricts the returned descriptions to include only those that have the specified names.
594  
595 =item IncludeDeleted I<(optional boolean)>
596  
597 Indicates whether to include deleted environments:
598  
599 true: Environments that have been deleted after IncludedDeletedBackTo are displayed.
600 false: Do not include deleted environments.
601  
602 =item IncludedDeletedBackTo I<(optional date)>
603  
604 If specified when IncludeDeleted is set to true, then environments deleted after this date are displayed.
605  
606 =item VersionLabel I<(optional string)>
607  
608 If specified, AWS Elastic Beanstalk restricts the returned descriptions to include only those that are associated with this application version.
609  
610 =item B<Returns: result from API call>
611  
612 =back
613  
614 =cut
615  
616 $API_SPEC{'DescribeEnvironments'} = { ApplicationName => { type => SCALAR, optional => 1 },
617 EnvironmentId => { type => ARRAYREF, optional => 1 },
618 EnvironmentNames => { type => ARRAYREF, optional => 1 },
619 IncludeDeleted => { type => BOOLEAN, optional => 1 },
620 IncludedDeletedBackTo => { type => SCALAR, optional => 1 },
621 VersionLabel => { type => SCALAR, optional => 1 },
622 };
623
624 sub DescribeEnvironments {
625 ### Enter: (caller(0))[3]
626 my( $rez ) = _genericCallHandler( @_ );
627 ### Exit: (caller(0))[3]
628 return $rez;
629 }
630  
631 # #################################################################################################
632 # DescribeEvents
633  
634 =head2 DescribeEvents( )
635  
636 Returns list of event descriptions matching criteria up to the last 6 weeks.
637  
638 Refer to L<http://docs.aws.amazon.com/elasticbeanstalk/latest/APIReference/API_DescribeEvents.html>
639  
640 =over 4
641  
642 =item B<Parameters>
643  
644 =item ApplicationNames I<(optional array)>
645  
646 If specified, AWS Elastic Beanstalk restricts the returned descriptions to only include those with the specified names.
647  
648 =item B<Returns: result from API call>
649  
650 =back
651  
652 =cut
653  
654 $API_SPEC{'DescribeEvents'} = { ApplicationNames => { type => ARRAYREF, optional => 1 } };
655
656 sub DescribeEvents {
657 ### Enter: (caller(0))[3]
658 my( $rez ) = _genericCallHandler( @_ );
659 ### Exit: (caller(0))[3]
660 return $rez;
661 }
662  
663 # #################################################################################################
664 ## ListAvailableSolutionStacks
665  
666 =head2 ListAvailableSolutionStacks( )
667  
668 Returns a list of the available solution stack names.
669  
670 Refer to L<http://docs.aws.amazon.com/elasticbeanstalk/latest/APIReference/API_ListAvailableSolutionStacks.html>
671  
672 =over 4
673  
674 =item B<Parameters>
675  
676 B<none>
677  
678 =item B<Returns: result from API call>
679  
680 =back
681  
682 =cut
683  
684 $API_SPEC{'ListAvailableSolutionStacks'} = { };
685  
686 sub ListAvailableSolutionStacks {
687 ### Enter: (caller(0))[3]
688 my( $rez ) = _genericCallHandler( @_ );
689 ### Exit: (caller(0))[3]
690 return $rez;
691 }
692  
693 # RebuildEnvironment
694 # RequestEnvironmentInfo
695 # RestartAppServer
696  
697 # #################################################################################################
698 # RetrieveEnvironmentInfo
699  
700 =head2 RetrieveEnvironmentInfo( )
701  
702 Retrieves the compiled information from a RequestEnvironmentInfo request.
703  
704 Refer to L<http://docs.aws.amazon.com/elasticbeanstalk/latest/APIReference/API_RetrieveEnvironmentInfo.html>
705  
706 =over 4
707  
708 =item B<Parameters>
709  
710 =item EnvironmentId I<(optional string)>
711  
712 The ID of the data's environment.
713  
714 If no such environment is found, returns an InvalidParameterValue error.
715  
716 Condition: You must specify either this or an EnvironmentName, or both. If you do not specify either, AWS Elastic Beanstalk returns MissingRequiredParameter error.
717  
718 =item EnvironmentName I<(optional string)>
719  
720 The name of the data's environment.
721  
722 If no such environment is found, returns an InvalidParameterValue error.
723  
724 Condition: You must specify either this or an EnvironmentId, or both. If you do not specify either, AWS Elastic Beanstalk returns MissingRequiredParameter error.
725  
726 Type: String
727  
728 Length constraints: Minimum length of 4. Maximum length of 23.
729  
730 Required: No
731  
732 =item InfoType B<(required string)>
733  
734 The type of information to retrieve.
735  
736 Type: String
737  
738 Valid Values: tail
739  
740 Required: Yes
741  
742 =item B<Returns: result from API call>
743  
744 =back
745  
746 =cut
747  
748 $API_SPEC{'RetrieveEnvironmentInfo'} = { InfoType => { type => SCALAR, optional => 1, default => 'tail',
749 callbacks => {
750 'other_params' => sub {
751 my( $me, $others ) = @_;
752 if ( !$others->{'EnvironmentId'} && !$others->{'EnvironmentName'} ) {
753 croak( "Provide one of EnvironmentId or EnvironmentName" );
754 return 0;
755 }
756 return 1;
757 }
758 }
759 },
760 EnvironmentId => { type => SCALAR, regex => qr/^[A-Z0-9_-]{4,23}$/i, optional => 1 },
761 EnvironmentName => { type => SCALAR, regex => qr/^[A-Z0-9_-]{4,23}$/i, optional => 1 },
762 };
763  
764 sub RetrieveEnvironmentInfo {
765 ### Enter: (caller(0))[3]
766 my( $rez ) = _genericCallHandler( @_ );
767 ### Exit: (caller(0))[3]
768 return $rez;
769 }
770  
771 # #################################################################################################
772 # SwapEnvironmentCNAMEs
773  
774 # #################################################################################################
775 # TerminateEnvironment
776  
777 # #################################################################################################
778 # UpdateApplication
779  
780 # #################################################################################################
781 # UpdateApplicationVersion
782  
783 # #################################################################################################
784 # UpdateConfigurationTemplate
785  
786 # #################################################################################################
787 # UpdateEnvironment
788  
789 # #################################################################################################
790 # ValidateConfigurationSettings
791  
792 =head2 ValidateConfigurationSettings( )
793  
794 Takes a set of configuration settings and either a configuration template or environment, and determines whether those values are valid.
795  
796 This action returns a list of messages indicating any errors or warnings associated with the selection of option values.
797  
798 Refer to L<http://docs.aws.amazon.com/elasticbeanstalk/latest/APIReference/API_ValidateConfigurationSettings.html>
799  
800 =over 4
801  
802 =item B<Parameters>
803  
804 =item ApplicationName B<(required string)>
805  
806 The name of the application that the configuration template or environment belongs to.
807  
808 =item EnvironmentName I<(optional string)>
809  
810 The name of the environment to validate the settings against.
811  
812 Condition: You cannot specify both this and a configuration template name.
813  
814 =item OptionSettings I<(required array)>
815  
816 A list of the options and desired values to evaluate.
817  
818 =item TemplateName I<(optional string)>
819  
820 The name of the configuration template to validate the settings against.
821  
822 Condition: You cannot specify both this and an environment name.
823  
824 =item B<Returns: result from API call>
825  
826 =back
827  
828 =cut
829  
830 $API_SPEC{'ValidateConfigurationSettings'} = { ApplicationName => { type => SCALAR, regex => qr/^[A-Z0-9_-]{1,100}$/i,
831 callbacks => {
832 'other_params' => sub {
833 my( $me, $others ) = @_;
834 if ( !$others->{'EnvironmentName'} && !$others->{'TemplateName'} ) {
835 croak( "Provide one of EnvironmentName or TemplateName" );
836 return 0;
837 }
838  
839 if ( $others->{'EnvironmentName'} && $others->{'TemplateName'} ) {
840 croak( "Provide only one of EnvironmentName or TemplateName" );
841 return 0;
842 }
843 return 1;
844 }
845 }
846 },
847 EnvironmentName => { type => SCALAR, regex => qr/^[A-Z0-9_-]{4,23}$/i, optional => 1 },
848 OptionSettings => { type => ARRAYREF },
849 TemplateName => { type => SCALAR, regex => qr/^[A-Z0-9_-]{4,23}$/i, optional => 1 },
850 };
851  
852 sub ValidateConfigurationSettings {
853 ### Enter: (caller(0))[3]
854 my( $rez ) = _genericCallHandler( @_ );
855 ### Exit: (caller(0))[3]
856 return $rez;
857 }
858  
859 =head1 AUTHOR
860  
861 Matthew Cox C<< <mcox at cpan.org> >>
862  
863 =head1 BUGS
864  
865 Please report any bugs or feature requests to C<bug-webservice-amazon-elasticbeanstalk at rt.cpan.org>, or through
866 the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WebService-Amazon-ElasticBeanstalk>. I will be notified, and then you'll
867 automatically be notified of progress on your bug as I make changes.
868  
869 =head1 SUPPORT
870  
871 You can find documentation for this module with the perldoc command.
872  
873 perldoc WebService::Amazon::ElasticBeanstalk
874  
875 You can also look for information at:
876  
877 =over 4
878  
879 =item * RT: CPAN's request tracker (report bugs here)
880  
881 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=WebService-Amazon-ElasticBeanstalk>
882  
883 =item * AnnoCPAN: Annotated CPAN documentation
884  
885 L<http://annocpan.org/dist/WebService-Amazon-ElasticBeanstalk>
886  
887 =item * CPAN Ratings
888  
889 L<http://cpanratings.perl.org/d/WebService-Amazon-ElasticBeanstalk>
890  
891 =item * Search CPAN
892  
893 L<http://search.cpan.org/dist/WebService-Amazon-ElasticBeanstalk/>
894  
895 =back
896  
897 =head1 SEE ALSO
898  
899 perl(1), L<WebService::Simple>, L<XML::Simple>, L<HTTP::Common::Response>
900  
901 =head1 LICENSE AND COPYRIGHT
902  
903 Copyright 2015 Matthew Cox.
904  
905 This program is free software; you can redistribute it and/or modify it
906 under the terms of the the Artistic License (2.0). You may obtain a
907 copy of the full license at:
908  
909 L<http://www.perlfoundation.org/artistic_license_2_0>
910  
911 Any use, modification, and distribution of the Standard or Modified
912 Versions is governed by this Artistic License. By using, modifying or
913 distributing the Package, you accept this license. Do not use, modify,
914 or distribute the Package, if you do not accept this license.
915  
916 If your Modified Version has been derived from a Modified Version made
917 by someone other than you, you are nevertheless required to ensure that
918 your Modified Version complies with the requirements of this license.
919  
920 This license does not grant you the right to use any trademark, service
921 mark, tradename, or logo of the Copyright Holder.
922  
923 This license includes the non-exclusive, worldwide, free-of-charge
924 patent license to make, have made, use, offer to sell, sell, import and
925 otherwise transfer the Package with respect to any patent claims
926 licensable by the Copyright Holder that are necessarily infringed by the
927 Package. If you institute patent litigation (including a cross-claim or
928 counterclaim) against any party alleging that the Package constitutes
929 direct or contributory patent infringement, then this Artistic License
930 to you shall terminate on the date that such litigation is filed.
931  
932 Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER
933 AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
934 THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
935 PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY
936 YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR
937 CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR
938 CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE,
939 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
940  
941  
942 =cut
943  
944 1; # End of WebService::Amazon::ElasticBeanstalk
945 __END__
↑ Summary