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