comparison env/lib/python3.9/site-packages/boto/beanstalk/layer1.py @ 0:4f3585e2f14b draft default tip

"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
author shellac
date Mon, 22 Mar 2021 18:12:50 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4f3585e2f14b
1 # Copyright (c) 2012 Mitch Garnaat http://garnaat.org/
2 # Copyright (c) 2012 Amazon.com, Inc. or its affiliates.
3 # All Rights Reserved
4 #
5 # Permission is hereby granted, free of charge, to any person obtaining a
6 # copy of this software and associated documentation files (the
7 # "Software"), to deal in the Software without restriction, including
8 # without limitation the rights to use, copy, modify, merge, publish, dis-
9 # tribute, sublicense, and/or sell copies of the Software, and to permit
10 # persons to whom the Software is furnished to do so, subject to the fol-
11 # lowing conditions:
12 #
13 # The above copyright notice and this permission notice shall be included
14 # in all copies or substantial portions of the Software.
15 #
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
18 # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
19 # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20 # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22 # IN THE SOFTWARE.
23 #
24
25 import boto
26 import boto.jsonresponse
27 from boto.compat import json
28 from boto.regioninfo import RegionInfo
29 from boto.connection import AWSQueryConnection
30
31
32 class Layer1(AWSQueryConnection):
33
34 APIVersion = '2010-12-01'
35 DefaultRegionName = 'us-east-1'
36 DefaultRegionEndpoint = 'elasticbeanstalk.us-east-1.amazonaws.com'
37
38 def __init__(self, aws_access_key_id=None, aws_secret_access_key=None,
39 is_secure=True, port=None,
40 proxy=None, proxy_port=None,
41 proxy_user=None, proxy_pass=None, debug=0,
42 https_connection_factory=None, region=None, path='/',
43 api_version=None, security_token=None, profile_name=None):
44 if not region:
45 region = RegionInfo(self, self.DefaultRegionName,
46 self.DefaultRegionEndpoint)
47 self.region = region
48 super(Layer1, self).__init__(aws_access_key_id,
49 aws_secret_access_key,
50 is_secure, port, proxy, proxy_port,
51 proxy_user, proxy_pass,
52 self.region.endpoint, debug,
53 https_connection_factory, path,
54 security_token, profile_name=profile_name)
55
56 def _required_auth_capability(self):
57 return ['hmac-v4']
58
59 def _encode_bool(self, v):
60 v = bool(v)
61 return {True: "true", False: "false"}[v]
62
63 def _get_response(self, action, params, path='/', verb='GET'):
64 params['ContentType'] = 'JSON'
65 response = self.make_request(action, params, path, verb)
66 body = response.read().decode('utf-8')
67 boto.log.debug(body)
68 if response.status == 200:
69 return json.loads(body)
70 else:
71 raise self.ResponseError(response.status, response.reason, body)
72
73 def check_dns_availability(self, cname_prefix):
74 """Checks if the specified CNAME is available.
75
76 :type cname_prefix: string
77 :param cname_prefix: The prefix used when this CNAME is
78 reserved.
79 """
80 params = {'CNAMEPrefix': cname_prefix}
81 return self._get_response('CheckDNSAvailability', params)
82
83 def create_application(self, application_name, description=None):
84 """
85 Creates an application that has one configuration template
86 named default and no application versions.
87
88 :type application_name: string
89 :param application_name: The name of the application.
90 Constraint: This name must be unique within your account. If the
91 specified name already exists, the action returns an
92 InvalidParameterValue error.
93
94 :type description: string
95 :param description: Describes the application.
96
97 :raises: TooManyApplicationsException
98 """
99 params = {'ApplicationName': application_name}
100 if description:
101 params['Description'] = description
102 return self._get_response('CreateApplication', params)
103
104 def create_application_version(self, application_name, version_label,
105 description=None, s3_bucket=None,
106 s3_key=None, auto_create_application=None):
107 """Creates an application version for the specified application.
108
109 :type application_name: string
110 :param application_name: The name of the application. If no
111 application is found with this name, and AutoCreateApplication is
112 false, returns an InvalidParameterValue error.
113
114 :type version_label: string
115 :param version_label: A label identifying this version. Constraint:
116 Must be unique per application. If an application version already
117 exists with this label for the specified application, AWS Elastic
118 Beanstalk returns an InvalidParameterValue error.
119
120 :type description: string
121 :param description: Describes this version.
122
123 :type s3_bucket: string
124 :param s3_bucket: The Amazon S3 bucket where the data is located.
125
126 :type s3_key: string
127 :param s3_key: The Amazon S3 key where the data is located. Both
128 s3_bucket and s3_key must be specified in order to use a specific
129 source bundle. If both of these values are not specified the
130 sample application will be used.
131
132 :type auto_create_application: boolean
133 :param auto_create_application: Determines how the system behaves if
134 the specified application for this version does not already exist:
135 true: Automatically creates the specified application for this
136 version if it does not already exist. false: Returns an
137 InvalidParameterValue if the specified application for this version
138 does not already exist. Default: false Valid Values: true | false
139
140 :raises: TooManyApplicationsException,
141 TooManyApplicationVersionsException,
142 InsufficientPrivilegesException,
143 S3LocationNotInServiceRegionException
144
145 """
146 params = {'ApplicationName': application_name,
147 'VersionLabel': version_label}
148 if description:
149 params['Description'] = description
150 if s3_bucket and s3_key:
151 params['SourceBundle.S3Bucket'] = s3_bucket
152 params['SourceBundle.S3Key'] = s3_key
153 if auto_create_application:
154 params['AutoCreateApplication'] = self._encode_bool(
155 auto_create_application)
156 return self._get_response('CreateApplicationVersion', params)
157
158 def create_configuration_template(self, application_name, template_name,
159 solution_stack_name=None,
160 source_configuration_application_name=None,
161 source_configuration_template_name=None,
162 environment_id=None, description=None,
163 option_settings=None):
164 """Creates a configuration template.
165
166 Templates are associated with a specific application and are used to
167 deploy different versions of the application with the same
168 configuration settings.
169
170 :type application_name: string
171 :param application_name: The name of the application to associate with
172 this configuration template. If no application is found with this
173 name, AWS Elastic Beanstalk returns an InvalidParameterValue error.
174
175 :type template_name: string
176 :param template_name: The name of the configuration template.
177 Constraint: This name must be unique per application. Default: If
178 a configuration template already exists with this name, AWS Elastic
179 Beanstalk returns an InvalidParameterValue error.
180
181 :type solution_stack_name: string
182 :param solution_stack_name: The name of the solution stack used by this
183 configuration. The solution stack specifies the operating system,
184 architecture, and application server for a configuration template.
185 It determines the set of configuration options as well as the
186 possible and default values. Use ListAvailableSolutionStacks to
187 obtain a list of available solution stacks. Default: If the
188 SolutionStackName is not specified and the source configuration
189 parameter is blank, AWS Elastic Beanstalk uses the default solution
190 stack. If not specified and the source configuration parameter is
191 specified, AWS Elastic Beanstalk uses the same solution stack as
192 the source configuration template.
193
194 :type source_configuration_application_name: string
195 :param source_configuration_application_name: The name of the
196 application associated with the configuration.
197
198 :type source_configuration_template_name: string
199 :param source_configuration_template_name: The name of the
200 configuration template.
201
202 :type environment_id: string
203 :param environment_id: The ID of the environment used with this
204 configuration template.
205
206 :type description: string
207 :param description: Describes this configuration.
208
209 :type option_settings: list
210 :param option_settings: If specified, AWS Elastic Beanstalk sets the
211 specified configuration option to the requested value. The new
212 value overrides the value obtained from the solution stack or the
213 source configuration template.
214
215 :raises: InsufficientPrivilegesException,
216 TooManyConfigurationTemplatesException
217 """
218 params = {'ApplicationName': application_name,
219 'TemplateName': template_name}
220 if solution_stack_name:
221 params['SolutionStackName'] = solution_stack_name
222 if source_configuration_application_name:
223 params['SourceConfiguration.ApplicationName'] = source_configuration_application_name
224 if source_configuration_template_name:
225 params['SourceConfiguration.TemplateName'] = source_configuration_template_name
226 if environment_id:
227 params['EnvironmentId'] = environment_id
228 if description:
229 params['Description'] = description
230 if option_settings:
231 self._build_list_params(params, option_settings,
232 'OptionSettings.member',
233 ('Namespace', 'OptionName', 'Value'))
234 return self._get_response('CreateConfigurationTemplate', params)
235
236 def create_environment(self, application_name, environment_name,
237 version_label=None, template_name=None,
238 solution_stack_name=None, cname_prefix=None,
239 description=None, option_settings=None,
240 options_to_remove=None, tier_name=None,
241 tier_type=None, tier_version='1.0'):
242 """Launches an environment for the application using a configuration.
243
244 :type application_name: string
245 :param application_name: The name of the application that contains the
246 version to be deployed. If no application is found with this name,
247 CreateEnvironment returns an InvalidParameterValue error.
248
249 :type environment_name: string
250 :param environment_name: A unique name for the deployment environment.
251 Used in the application URL. Constraint: Must be from 4 to 23
252 characters in length. The name can contain only letters, numbers,
253 and hyphens. It cannot start or end with a hyphen. This name must
254 be unique in your account. If the specified name already exists,
255 AWS Elastic Beanstalk returns an InvalidParameterValue error.
256 Default: If the CNAME parameter is not specified, the environment
257 name becomes part of the CNAME, and therefore part of the visible
258 URL for your application.
259
260 :type version_label: string
261 :param version_label: The name of the application version to deploy. If
262 the specified application has no associated application versions,
263 AWS Elastic Beanstalk UpdateEnvironment returns an
264 InvalidParameterValue error. Default: If not specified, AWS
265 Elastic Beanstalk attempts to launch the most recently created
266 application version.
267
268 :type template_name: string
269 :param template_name: The name of the configuration template to
270 use in deployment. If no configuration template is found with this
271 name, AWS Elastic Beanstalk returns an InvalidParameterValue error.
272 Condition: You must specify either this parameter or a
273 SolutionStackName, but not both. If you specify both, AWS Elastic
274 Beanstalk returns an InvalidParameterCombination error. If you do
275 not specify either, AWS Elastic Beanstalk returns a
276 MissingRequiredParameter error.
277
278 :type solution_stack_name: string
279 :param solution_stack_name: This is an alternative to specifying a
280 configuration name. If specified, AWS Elastic Beanstalk sets the
281 configuration values to the default values associated with the
282 specified solution stack. Condition: You must specify either this
283 or a TemplateName, but not both. If you specify both, AWS Elastic
284 Beanstalk returns an InvalidParameterCombination error. If you do
285 not specify either, AWS Elastic Beanstalk returns a
286 MissingRequiredParameter error.
287
288 :type cname_prefix: string
289 :param cname_prefix: If specified, the environment attempts to use this
290 value as the prefix for the CNAME. If not specified, the
291 environment uses the environment name.
292
293 :type description: string
294 :param description: Describes this environment.
295
296 :type option_settings: list
297 :param option_settings: If specified, AWS Elastic Beanstalk sets the
298 specified configuration options to the requested value in the
299 configuration set for the new environment. These override the
300 values obtained from the solution stack or the configuration
301 template. Each element in the list is a tuple of (Namespace,
302 OptionName, Value), for example::
303
304 [('aws:autoscaling:launchconfiguration',
305 'Ec2KeyName', 'mykeypair')]
306
307 :type options_to_remove: list
308 :param options_to_remove: A list of custom user-defined configuration
309 options to remove from the configuration set for this new
310 environment.
311
312 :type tier_name: string
313 :param tier_name: The name of the tier. Valid values are
314 "WebServer" and "Worker". Defaults to "WebServer".
315 The ``tier_name`` and a ``tier_type`` parameters are
316 related and the values provided must be valid.
317 The possible combinations are:
318
319 * "WebServer" and "Standard" (the default)
320 * "Worker" and "SQS/HTTP"
321
322 :type tier_type: string
323 :param tier_type: The type of the tier. Valid values are
324 "Standard" if ``tier_name`` is "WebServer" and "SQS/HTTP"
325 if ``tier_name`` is "Worker". Defaults to "Standard".
326
327 :type tier_version: string
328 :type tier_version: The version of the tier. Valid values
329 currently are "1.0". Defaults to "1.0".
330
331 :raises: TooManyEnvironmentsException, InsufficientPrivilegesException
332
333 """
334 params = {'ApplicationName': application_name,
335 'EnvironmentName': environment_name}
336 if version_label:
337 params['VersionLabel'] = version_label
338 if template_name:
339 params['TemplateName'] = template_name
340 if solution_stack_name:
341 params['SolutionStackName'] = solution_stack_name
342 if cname_prefix:
343 params['CNAMEPrefix'] = cname_prefix
344 if description:
345 params['Description'] = description
346 if option_settings:
347 self._build_list_params(params, option_settings,
348 'OptionSettings.member',
349 ('Namespace', 'OptionName', 'Value'))
350 if options_to_remove:
351 self.build_list_params(params, options_to_remove,
352 'OptionsToRemove.member')
353 if tier_name and tier_type and tier_version:
354 params['Tier.Name'] = tier_name
355 params['Tier.Type'] = tier_type
356 params['Tier.Version'] = tier_version
357 return self._get_response('CreateEnvironment', params)
358
359 def create_storage_location(self):
360 """
361 Creates the Amazon S3 storage location for the account. This
362 location is used to store user log files.
363
364 :raises: TooManyBucketsException,
365 S3SubscriptionRequiredException,
366 InsufficientPrivilegesException
367
368 """
369 return self._get_response('CreateStorageLocation', params={})
370
371 def delete_application(self, application_name,
372 terminate_env_by_force=None):
373 """
374 Deletes the specified application along with all associated
375 versions and configurations. The application versions will not
376 be deleted from your Amazon S3 bucket.
377
378 :type application_name: string
379 :param application_name: The name of the application to delete.
380
381 :type terminate_env_by_force: boolean
382 :param terminate_env_by_force: When set to true, running
383 environments will be terminated before deleting the application.
384
385 :raises: OperationInProgressException
386
387 """
388 params = {'ApplicationName': application_name}
389 if terminate_env_by_force:
390 params['TerminateEnvByForce'] = self._encode_bool(
391 terminate_env_by_force)
392 return self._get_response('DeleteApplication', params)
393
394 def delete_application_version(self, application_name, version_label,
395 delete_source_bundle=None):
396 """Deletes the specified version from the specified application.
397
398 :type application_name: string
399 :param application_name: The name of the application to delete
400 releases from.
401
402 :type version_label: string
403 :param version_label: The label of the version to delete.
404
405 :type delete_source_bundle: boolean
406 :param delete_source_bundle: Indicates whether to delete the
407 associated source bundle from Amazon S3. Valid Values: true |
408 false
409
410 :raises: SourceBundleDeletionException,
411 InsufficientPrivilegesException,
412 OperationInProgressException,
413 S3LocationNotInServiceRegionException
414 """
415 params = {'ApplicationName': application_name,
416 'VersionLabel': version_label}
417 if delete_source_bundle:
418 params['DeleteSourceBundle'] = self._encode_bool(
419 delete_source_bundle)
420 return self._get_response('DeleteApplicationVersion', params)
421
422 def delete_configuration_template(self, application_name, template_name):
423 """Deletes the specified configuration template.
424
425 :type application_name: string
426 :param application_name: The name of the application to delete
427 the configuration template from.
428
429 :type template_name: string
430 :param template_name: The name of the configuration template to
431 delete.
432
433 :raises: OperationInProgressException
434
435 """
436 params = {'ApplicationName': application_name,
437 'TemplateName': template_name}
438 return self._get_response('DeleteConfigurationTemplate', params)
439
440 def delete_environment_configuration(self, application_name,
441 environment_name):
442 """
443 Deletes the draft configuration associated with the running
444 environment. Updating a running environment with any
445 configuration changes creates a draft configuration set. You can
446 get the draft configuration using DescribeConfigurationSettings
447 while the update is in progress or if the update fails. The
448 DeploymentStatus for the draft configuration indicates whether
449 the deployment is in process or has failed. The draft
450 configuration remains in existence until it is deleted with this
451 action.
452
453 :type application_name: string
454 :param application_name: The name of the application the
455 environment is associated with.
456
457 :type environment_name: string
458 :param environment_name: The name of the environment to delete
459 the draft configuration from.
460
461 """
462 params = {'ApplicationName': application_name,
463 'EnvironmentName': environment_name}
464 return self._get_response('DeleteEnvironmentConfiguration', params)
465
466 def describe_application_versions(self, application_name=None,
467 version_labels=None):
468 """Returns descriptions for existing application versions.
469
470 :type application_name: string
471 :param application_name: If specified, AWS Elastic Beanstalk restricts
472 the returned descriptions to only include ones that are associated
473 with the specified application.
474
475 :type version_labels: list
476 :param version_labels: If specified, restricts the returned
477 descriptions to only include ones that have the specified version
478 labels.
479
480 """
481 params = {}
482 if application_name:
483 params['ApplicationName'] = application_name
484 if version_labels:
485 self.build_list_params(params, version_labels,
486 'VersionLabels.member')
487 return self._get_response('DescribeApplicationVersions', params)
488
489 def describe_applications(self, application_names=None):
490 """Returns the descriptions of existing applications.
491
492 :type application_names: list
493 :param application_names: If specified, AWS Elastic Beanstalk restricts
494 the returned descriptions to only include those with the specified
495 names.
496
497 """
498 params = {}
499 if application_names:
500 self.build_list_params(params, application_names,
501 'ApplicationNames.member')
502 return self._get_response('DescribeApplications', params)
503
504 def describe_configuration_options(self, application_name=None,
505 template_name=None,
506 environment_name=None,
507 solution_stack_name=None, options=None):
508 """Describes configuration options used in a template or environment.
509
510 Describes the configuration options that are used in a
511 particular configuration template or environment, or that a
512 specified solution stack defines. The description includes the
513 values the options, their default values, and an indication of
514 the required action on a running environment if an option value
515 is changed.
516
517 :type application_name: string
518 :param application_name: The name of the application associated with
519 the configuration template or environment. Only needed if you want
520 to describe the configuration options associated with either the
521 configuration template or environment.
522
523 :type template_name: string
524 :param template_name: The name of the configuration template whose
525 configuration options you want to describe.
526
527 :type environment_name: string
528 :param environment_name: The name of the environment whose
529 configuration options you want to describe.
530
531 :type solution_stack_name: string
532 :param solution_stack_name: The name of the solution stack whose
533 configuration options you want to describe.
534
535 :type options: list
536 :param options: If specified, restricts the descriptions to only
537 the specified options.
538 """
539 params = {}
540 if application_name:
541 params['ApplicationName'] = application_name
542 if template_name:
543 params['TemplateName'] = template_name
544 if environment_name:
545 params['EnvironmentName'] = environment_name
546 if solution_stack_name:
547 params['SolutionStackName'] = solution_stack_name
548 if options:
549 self.build_list_params(params, options, 'Options.member')
550 return self._get_response('DescribeConfigurationOptions', params)
551
552 def describe_configuration_settings(self, application_name,
553 template_name=None,
554 environment_name=None):
555 """
556 Returns a description of the settings for the specified
557 configuration set, that is, either a configuration template or
558 the configuration set associated with a running environment.
559 When describing the settings for the configuration set
560 associated with a running environment, it is possible to receive
561 two sets of setting descriptions. One is the deployed
562 configuration set, and the other is a draft configuration of an
563 environment that is either in the process of deployment or that
564 failed to deploy.
565
566 :type application_name: string
567 :param application_name: The application for the environment or
568 configuration template.
569
570 :type template_name: string
571 :param template_name: The name of the configuration template to
572 describe. Conditional: You must specify either this parameter or
573 an EnvironmentName, but not both. If you specify both, AWS Elastic
574 Beanstalk returns an InvalidParameterCombination error. If you do
575 not specify either, AWS Elastic Beanstalk returns a
576 MissingRequiredParameter error.
577
578 :type environment_name: string
579 :param environment_name: The name of the environment to describe.
580 Condition: You must specify either this or a TemplateName, but not
581 both. If you specify both, AWS Elastic Beanstalk returns an
582 InvalidParameterCombination error. If you do not specify either,
583 AWS Elastic Beanstalk returns MissingRequiredParameter error.
584 """
585 params = {'ApplicationName': application_name}
586 if template_name:
587 params['TemplateName'] = template_name
588 if environment_name:
589 params['EnvironmentName'] = environment_name
590 return self._get_response('DescribeConfigurationSettings', params)
591
592 def describe_environment_resources(self, environment_id=None,
593 environment_name=None):
594 """Returns AWS resources for this environment.
595
596 :type environment_id: string
597 :param environment_id: The ID of the environment to retrieve AWS
598 resource usage data. Condition: You must specify either this or an
599 EnvironmentName, or both. If you do not specify either, AWS Elastic
600 Beanstalk returns MissingRequiredParameter error.
601
602 :type environment_name: string
603 :param environment_name: The name of the environment to retrieve
604 AWS resource usage data. Condition: You must specify either this
605 or an EnvironmentId, or both. If you do not specify either, AWS
606 Elastic Beanstalk returns MissingRequiredParameter error.
607
608 :raises: InsufficientPrivilegesException
609 """
610 params = {}
611 if environment_id:
612 params['EnvironmentId'] = environment_id
613 if environment_name:
614 params['EnvironmentName'] = environment_name
615 return self._get_response('DescribeEnvironmentResources', params)
616
617 def describe_environments(self, application_name=None, version_label=None,
618 environment_ids=None, environment_names=None,
619 include_deleted=None,
620 included_deleted_back_to=None):
621 """Returns descriptions for existing environments.
622
623 :type application_name: string
624 :param application_name: If specified, AWS Elastic Beanstalk restricts
625 the returned descriptions to include only those that are associated
626 with this application.
627
628 :type version_label: string
629 :param version_label: If specified, AWS Elastic Beanstalk restricts the
630 returned descriptions to include only those that are associated
631 with this application version.
632
633 :type environment_ids: list
634 :param environment_ids: If specified, AWS Elastic Beanstalk restricts
635 the returned descriptions to include only those that have the
636 specified IDs.
637
638 :type environment_names: list
639 :param environment_names: If specified, AWS Elastic Beanstalk restricts
640 the returned descriptions to include only those that have the
641 specified names.
642
643 :type include_deleted: boolean
644 :param include_deleted: Indicates whether to include deleted
645 environments: true: Environments that have been deleted after
646 IncludedDeletedBackTo are displayed. false: Do not include deleted
647 environments.
648
649 :type included_deleted_back_to: timestamp
650 :param included_deleted_back_to: If specified when IncludeDeleted is
651 set to true, then environments deleted after this date are
652 displayed.
653 """
654 params = {}
655 if application_name:
656 params['ApplicationName'] = application_name
657 if version_label:
658 params['VersionLabel'] = version_label
659 if environment_ids:
660 self.build_list_params(params, environment_ids,
661 'EnvironmentIds.member')
662 if environment_names:
663 self.build_list_params(params, environment_names,
664 'EnvironmentNames.member')
665 if include_deleted:
666 params['IncludeDeleted'] = self._encode_bool(include_deleted)
667 if included_deleted_back_to:
668 params['IncludedDeletedBackTo'] = included_deleted_back_to
669 return self._get_response('DescribeEnvironments', params)
670
671 def describe_events(self, application_name=None, version_label=None,
672 template_name=None, environment_id=None,
673 environment_name=None, request_id=None, severity=None,
674 start_time=None, end_time=None, max_records=None,
675 next_token=None):
676 """Returns event descriptions matching criteria up to the last 6 weeks.
677
678 :type application_name: string
679 :param application_name: If specified, AWS Elastic Beanstalk restricts
680 the returned descriptions to include only those associated with
681 this application.
682
683 :type version_label: string
684 :param version_label: If specified, AWS Elastic Beanstalk restricts the
685 returned descriptions to those associated with this application
686 version.
687
688 :type template_name: string
689 :param template_name: If specified, AWS Elastic Beanstalk restricts the
690 returned descriptions to those that are associated with this
691 environment configuration.
692
693 :type environment_id: string
694 :param environment_id: If specified, AWS Elastic Beanstalk restricts
695 the returned descriptions to those associated with this
696 environment.
697
698 :type environment_name: string
699 :param environment_name: If specified, AWS Elastic Beanstalk restricts
700 the returned descriptions to those associated with this
701 environment.
702
703 :type request_id: string
704 :param request_id: If specified, AWS Elastic Beanstalk restricts the
705 described events to include only those associated with this request
706 ID.
707
708 :type severity: string
709 :param severity: If specified, limits the events returned from this
710 call to include only those with the specified severity or higher.
711
712 :type start_time: timestamp
713 :param start_time: If specified, AWS Elastic Beanstalk restricts the
714 returned descriptions to those that occur on or after this time.
715
716 :type end_time: timestamp
717 :param end_time: If specified, AWS Elastic Beanstalk restricts the
718 returned descriptions to those that occur up to, but not including,
719 the EndTime.
720
721 :type max_records: integer
722 :param max_records: Specifies the maximum number of events that can be
723 returned, beginning with the most recent event.
724
725 :type next_token: string
726 :param next_token: Pagination token. If specified, the events return
727 the next batch of results.
728 """
729 params = {}
730 if application_name:
731 params['ApplicationName'] = application_name
732 if version_label:
733 params['VersionLabel'] = version_label
734 if template_name:
735 params['TemplateName'] = template_name
736 if environment_id:
737 params['EnvironmentId'] = environment_id
738 if environment_name:
739 params['EnvironmentName'] = environment_name
740 if request_id:
741 params['RequestId'] = request_id
742 if severity:
743 params['Severity'] = severity
744 if start_time:
745 params['StartTime'] = start_time
746 if end_time:
747 params['EndTime'] = end_time
748 if max_records:
749 params['MaxRecords'] = max_records
750 if next_token:
751 params['NextToken'] = next_token
752 return self._get_response('DescribeEvents', params)
753
754 def list_available_solution_stacks(self):
755 """Returns a list of the available solution stack names."""
756 return self._get_response('ListAvailableSolutionStacks', params={})
757
758 def rebuild_environment(self, environment_id=None, environment_name=None):
759 """
760 Deletes and recreates all of the AWS resources (for example:
761 the Auto Scaling group, load balancer, etc.) for a specified
762 environment and forces a restart.
763
764 :type environment_id: string
765 :param environment_id: The ID of the environment to rebuild.
766 Condition: You must specify either this or an EnvironmentName, or
767 both. If you do not specify either, AWS Elastic Beanstalk returns
768 MissingRequiredParameter error.
769
770 :type environment_name: string
771 :param environment_name: The name of the environment to rebuild.
772 Condition: You must specify either this or an EnvironmentId, or
773 both. If you do not specify either, AWS Elastic Beanstalk returns
774 MissingRequiredParameter error.
775
776 :raises InvalidParameterValue: If environment_name doesn't refer to a currently active environment
777 :raises: InsufficientPrivilegesException
778 """
779 params = {}
780 if environment_id:
781 params['EnvironmentId'] = environment_id
782 if environment_name:
783 params['EnvironmentName'] = environment_name
784 return self._get_response('RebuildEnvironment', params)
785
786 def request_environment_info(self, info_type='tail', environment_id=None,
787 environment_name=None):
788 """
789 Initiates a request to compile the specified type of
790 information of the deployed environment. Setting the InfoType
791 to tail compiles the last lines from the application server log
792 files of every Amazon EC2 instance in your environment. Use
793 RetrieveEnvironmentInfo to access the compiled information.
794
795 :type info_type: string
796 :param info_type: The type of information to request.
797
798 :type environment_id: string
799 :param environment_id: The ID of the environment of the
800 requested data. If no such environment is found,
801 RequestEnvironmentInfo returns an InvalidParameterValue error.
802 Condition: You must specify either this or an EnvironmentName, or
803 both. If you do not specify either, AWS Elastic Beanstalk returns
804 MissingRequiredParameter error.
805
806 :type environment_name: string
807 :param environment_name: The name of the environment of the
808 requested data. If no such environment is found,
809 RequestEnvironmentInfo returns an InvalidParameterValue error.
810 Condition: You must specify either this or an EnvironmentId, or
811 both. If you do not specify either, AWS Elastic Beanstalk returns
812 MissingRequiredParameter error.
813 """
814 params = {'InfoType': info_type}
815 if environment_id:
816 params['EnvironmentId'] = environment_id
817 if environment_name:
818 params['EnvironmentName'] = environment_name
819 return self._get_response('RequestEnvironmentInfo', params)
820
821 def restart_app_server(self, environment_id=None, environment_name=None):
822 """
823 Causes the environment to restart the application container
824 server running on each Amazon EC2 instance.
825
826 :type environment_id: string
827 :param environment_id: The ID of the environment to restart the server
828 for. Condition: You must specify either this or an
829 EnvironmentName, or both. If you do not specify either, AWS Elastic
830 Beanstalk returns MissingRequiredParameter error.
831
832 :type environment_name: string
833 :param environment_name: The name of the environment to restart the
834 server for. Condition: You must specify either this or an
835 EnvironmentId, or both. If you do not specify either, AWS Elastic
836 Beanstalk returns MissingRequiredParameter error.
837 """
838 params = {}
839 if environment_id:
840 params['EnvironmentId'] = environment_id
841 if environment_name:
842 params['EnvironmentName'] = environment_name
843 return self._get_response('RestartAppServer', params)
844
845 def retrieve_environment_info(self, info_type='tail', environment_id=None,
846 environment_name=None):
847 """
848 Retrieves the compiled information from a RequestEnvironmentInfo
849 request.
850
851 :type info_type: string
852 :param info_type: The type of information to retrieve.
853
854 :type environment_id: string
855 :param environment_id: The ID of the data's environment. If no such
856 environment is found, returns an InvalidParameterValue error.
857 Condition: You must specify either this or an EnvironmentName, or
858 both. If you do not specify either, AWS Elastic Beanstalk returns
859 MissingRequiredParameter error.
860
861 :type environment_name: string
862 :param environment_name: The name of the data's environment. If no such
863 environment is found, returns an InvalidParameterValue error.
864 Condition: You must specify either this or an EnvironmentId, or
865 both. If you do not specify either, AWS Elastic Beanstalk returns
866 MissingRequiredParameter error.
867 """
868 params = {'InfoType': info_type}
869 if environment_id:
870 params['EnvironmentId'] = environment_id
871 if environment_name:
872 params['EnvironmentName'] = environment_name
873 return self._get_response('RetrieveEnvironmentInfo', params)
874
875 def swap_environment_cnames(self, source_environment_id=None,
876 source_environment_name=None,
877 destination_environment_id=None,
878 destination_environment_name=None):
879 """Swaps the CNAMEs of two environments.
880
881 :type source_environment_id: string
882 :param source_environment_id: The ID of the source environment.
883 Condition: You must specify at least the SourceEnvironmentID or the
884 SourceEnvironmentName. You may also specify both. If you specify
885 the SourceEnvironmentId, you must specify the
886 DestinationEnvironmentId.
887
888 :type source_environment_name: string
889 :param source_environment_name: The name of the source environment.
890 Condition: You must specify at least the SourceEnvironmentID or the
891 SourceEnvironmentName. You may also specify both. If you specify
892 the SourceEnvironmentName, you must specify the
893 DestinationEnvironmentName.
894
895 :type destination_environment_id: string
896 :param destination_environment_id: The ID of the destination
897 environment. Condition: You must specify at least the
898 DestinationEnvironmentID or the DestinationEnvironmentName. You may
899 also specify both. You must specify the SourceEnvironmentId with
900 the DestinationEnvironmentId.
901
902 :type destination_environment_name: string
903 :param destination_environment_name: The name of the destination
904 environment. Condition: You must specify at least the
905 DestinationEnvironmentID or the DestinationEnvironmentName. You may
906 also specify both. You must specify the SourceEnvironmentName with
907 the DestinationEnvironmentName.
908 """
909 params = {}
910 if source_environment_id:
911 params['SourceEnvironmentId'] = source_environment_id
912 if source_environment_name:
913 params['SourceEnvironmentName'] = source_environment_name
914 if destination_environment_id:
915 params['DestinationEnvironmentId'] = destination_environment_id
916 if destination_environment_name:
917 params['DestinationEnvironmentName'] = destination_environment_name
918 return self._get_response('SwapEnvironmentCNAMEs', params)
919
920 def terminate_environment(self, environment_id=None, environment_name=None,
921 terminate_resources=None):
922 """Terminates the specified environment.
923
924 :type environment_id: string
925 :param environment_id: The ID of the environment to terminate.
926 Condition: You must specify either this or an EnvironmentName, or
927 both. If you do not specify either, AWS Elastic Beanstalk returns
928 MissingRequiredParameter error.
929
930 :type environment_name: string
931 :param environment_name: The name of the environment to terminate.
932 Condition: You must specify either this or an EnvironmentId, or
933 both. If you do not specify either, AWS Elastic Beanstalk returns
934 MissingRequiredParameter error.
935
936 :type terminate_resources: boolean
937 :param terminate_resources: Indicates whether the associated AWS
938 resources should shut down when the environment is terminated:
939 true: (default) The user AWS resources (for example, the Auto
940 Scaling group, LoadBalancer, etc.) are terminated along with the
941 environment. false: The environment is removed from the AWS
942 Elastic Beanstalk but the AWS resources continue to operate. For
943 more information, see the AWS Elastic Beanstalk User Guide.
944 Default: true Valid Values: true | false
945
946 :raises: InsufficientPrivilegesException
947 """
948 params = {}
949 if environment_id:
950 params['EnvironmentId'] = environment_id
951 if environment_name:
952 params['EnvironmentName'] = environment_name
953 if terminate_resources:
954 params['TerminateResources'] = self._encode_bool(
955 terminate_resources)
956 return self._get_response('TerminateEnvironment', params)
957
958 def update_application(self, application_name, description=None):
959 """
960 Updates the specified application to have the specified
961 properties.
962
963 :type application_name: string
964 :param application_name: The name of the application to update.
965 If no such application is found, UpdateApplication returns an
966 InvalidParameterValue error.
967
968 :type description: string
969 :param description: A new description for the application. Default: If
970 not specified, AWS Elastic Beanstalk does not update the
971 description.
972 """
973 params = {'ApplicationName': application_name}
974 if description:
975 params['Description'] = description
976 return self._get_response('UpdateApplication', params)
977
978 def update_application_version(self, application_name, version_label,
979 description=None):
980 """Updates the application version to have the properties.
981
982 :type application_name: string
983 :param application_name: The name of the application associated with
984 this version. If no application is found with this name,
985 UpdateApplication returns an InvalidParameterValue error.
986
987 :type version_label: string
988 :param version_label: The name of the version to update. If no
989 application version is found with this label, UpdateApplication
990 returns an InvalidParameterValue error.
991
992 :type description: string
993 :param description: A new description for this release.
994 """
995 params = {'ApplicationName': application_name,
996 'VersionLabel': version_label}
997 if description:
998 params['Description'] = description
999 return self._get_response('UpdateApplicationVersion', params)
1000
1001 def update_configuration_template(self, application_name, template_name,
1002 description=None, option_settings=None,
1003 options_to_remove=None):
1004 """
1005 Updates the specified configuration template to have the
1006 specified properties or configuration option values.
1007
1008 :type application_name: string
1009 :param application_name: The name of the application associated with
1010 the configuration template to update. If no application is found
1011 with this name, UpdateConfigurationTemplate returns an
1012 InvalidParameterValue error.
1013
1014 :type template_name: string
1015 :param template_name: The name of the configuration template to update.
1016 If no configuration template is found with this name,
1017 UpdateConfigurationTemplate returns an InvalidParameterValue error.
1018
1019 :type description: string
1020 :param description: A new description for the configuration.
1021
1022 :type option_settings: list
1023 :param option_settings: A list of configuration option settings to
1024 update with the new specified option value.
1025
1026 :type options_to_remove: list
1027 :param options_to_remove: A list of configuration options to remove
1028 from the configuration set. Constraint: You can remove only
1029 UserDefined configuration options.
1030
1031 :raises: InsufficientPrivilegesException
1032 """
1033 params = {'ApplicationName': application_name,
1034 'TemplateName': template_name}
1035 if description:
1036 params['Description'] = description
1037 if option_settings:
1038 self._build_list_params(params, option_settings,
1039 'OptionSettings.member',
1040 ('Namespace', 'OptionName', 'Value'))
1041 if options_to_remove:
1042 self.build_list_params(params, options_to_remove,
1043 'OptionsToRemove.member')
1044 return self._get_response('UpdateConfigurationTemplate', params)
1045
1046 def update_environment(self, environment_id=None, environment_name=None,
1047 version_label=None, template_name=None,
1048 description=None, option_settings=None,
1049 options_to_remove=None, tier_name=None,
1050 tier_type=None, tier_version='1.0'):
1051 """
1052 Updates the environment description, deploys a new application
1053 version, updates the configuration settings to an entirely new
1054 configuration template, or updates select configuration option
1055 values in the running environment. Attempting to update both
1056 the release and configuration is not allowed and AWS Elastic
1057 Beanstalk returns an InvalidParameterCombination error. When
1058 updating the configuration settings to a new template or
1059 individual settings, a draft configuration is created and
1060 DescribeConfigurationSettings for this environment returns two
1061 setting descriptions with different DeploymentStatus values.
1062
1063 :type environment_id: string
1064 :param environment_id: The ID of the environment to update. If no
1065 environment with this ID exists, AWS Elastic Beanstalk returns an
1066 InvalidParameterValue error. Condition: You must specify either
1067 this or an EnvironmentName, or both. If you do not specify either,
1068 AWS Elastic Beanstalk returns MissingRequiredParameter error.
1069
1070 :type environment_name: string
1071 :param environment_name: The name of the environment to update. If no
1072 environment with this name exists, AWS Elastic Beanstalk returns an
1073 InvalidParameterValue error. Condition: You must specify either
1074 this or an EnvironmentId, or both. If you do not specify either,
1075 AWS Elastic Beanstalk returns MissingRequiredParameter error.
1076
1077 :type version_label: string
1078 :param version_label: If this parameter is specified, AWS Elastic
1079 Beanstalk deploys the named application version to the environment.
1080 If no such application version is found, returns an
1081 InvalidParameterValue error.
1082
1083 :type template_name: string
1084 :param template_name: If this parameter is specified, AWS Elastic
1085 Beanstalk deploys this configuration template to the environment.
1086 If no such configuration template is found, AWS Elastic Beanstalk
1087 returns an InvalidParameterValue error.
1088
1089 :type description: string
1090 :param description: If this parameter is specified, AWS Elastic
1091 Beanstalk updates the description of this environment.
1092
1093 :type option_settings: list
1094 :param option_settings: If specified, AWS Elastic Beanstalk updates the
1095 configuration set associated with the running environment and sets
1096 the specified configuration options to the requested value.
1097
1098 :type options_to_remove: list
1099 :param options_to_remove: A list of custom user-defined configuration
1100 options to remove from the configuration set for this environment.
1101
1102 :type tier_name: string
1103 :param tier_name: The name of the tier. Valid values are
1104 "WebServer" and "Worker". Defaults to "WebServer".
1105 The ``tier_name`` and a ``tier_type`` parameters are
1106 related and the values provided must be valid.
1107 The possible combinations are:
1108
1109 * "WebServer" and "Standard" (the default)
1110 * "Worker" and "SQS/HTTP"
1111
1112 :type tier_type: string
1113 :param tier_type: The type of the tier. Valid values are
1114 "Standard" if ``tier_name`` is "WebServer" and "SQS/HTTP"
1115 if ``tier_name`` is "Worker". Defaults to "Standard".
1116
1117 :type tier_version: string
1118 :type tier_version: The version of the tier. Valid values
1119 currently are "1.0". Defaults to "1.0".
1120
1121 :raises: InsufficientPrivilegesException
1122 """
1123 params = {}
1124 if environment_id:
1125 params['EnvironmentId'] = environment_id
1126 if environment_name:
1127 params['EnvironmentName'] = environment_name
1128 if version_label:
1129 params['VersionLabel'] = version_label
1130 if template_name:
1131 params['TemplateName'] = template_name
1132 if description:
1133 params['Description'] = description
1134 if option_settings:
1135 self._build_list_params(params, option_settings,
1136 'OptionSettings.member',
1137 ('Namespace', 'OptionName', 'Value'))
1138 if options_to_remove:
1139 self.build_list_params(params, options_to_remove,
1140 'OptionsToRemove.member')
1141 if tier_name and tier_type and tier_version:
1142 params['Tier.Name'] = tier_name
1143 params['Tier.Type'] = tier_type
1144 params['Tier.Version'] = tier_version
1145 return self._get_response('UpdateEnvironment', params)
1146
1147 def validate_configuration_settings(self, application_name,
1148 option_settings, template_name=None,
1149 environment_name=None):
1150 """
1151 Takes a set of configuration settings and either a
1152 configuration template or environment, and determines whether
1153 those values are valid. This action returns a list of messages
1154 indicating any errors or warnings associated with the selection
1155 of option values.
1156
1157 :type application_name: string
1158 :param application_name: The name of the application that the
1159 configuration template or environment belongs to.
1160
1161 :type template_name: string
1162 :param template_name: The name of the configuration template to
1163 validate the settings against. Condition: You cannot specify both
1164 this and an environment name.
1165
1166 :type environment_name: string
1167 :param environment_name: The name of the environment to validate the
1168 settings against. Condition: You cannot specify both this and a
1169 configuration template name.
1170
1171 :type option_settings: list
1172 :param option_settings: A list of the options and desired values to
1173 evaluate.
1174
1175 :raises: InsufficientPrivilegesException
1176 """
1177 params = {'ApplicationName': application_name}
1178 self._build_list_params(params, option_settings,
1179 'OptionSettings.member',
1180 ('Namespace', 'OptionName', 'Value'))
1181 if template_name:
1182 params['TemplateName'] = template_name
1183 if environment_name:
1184 params['EnvironmentName'] = environment_name
1185 return self._get_response('ValidateConfigurationSettings', params)
1186
1187 def _build_list_params(self, params, user_values, prefix, tuple_names):
1188 # For params such as the ConfigurationOptionSettings,
1189 # they can specify a list of tuples where each tuple maps to a specific
1190 # arg. For example:
1191 # user_values = [('foo', 'bar', 'baz']
1192 # prefix=MyOption.member
1193 # tuple_names=('One', 'Two', 'Three')
1194 # would result in:
1195 # MyOption.member.1.One = foo
1196 # MyOption.member.1.Two = bar
1197 # MyOption.member.1.Three = baz
1198 for i, user_value in enumerate(user_values, 1):
1199 current_prefix = '%s.%s' % (prefix, i)
1200 for key, value in zip(tuple_names, user_value):
1201 full_key = '%s.%s' % (current_prefix, key)
1202 params[full_key] = value