U
    3d.                     @   sH   d dl Z d dlZ d dlmZ d dlmZ d dlmZ G dd deZdS )    N)json)
RegionInfo)AWSQueryConnectionc                       sd  e Zd ZdZdZdZdO fdd		Zd
d Zdd ZdPddZ	dd Z
dQddZdRddZdSddZdTddZdd ZdUddZdVd d!Zd"d# Zd$d% ZdWd&d'ZdXd(d)ZdYd*d+ZdZd,d-Zd[d.d/Zd\d0d1Zd]d2d3Zd4d5 Zd^d6d7Zd_d9d:Zd`d;d<Zdad=d>Zdbd?d@Z dcdAdBZ!dddCdDZ"dedEdFZ#dfdGdHZ$dgdIdJZ%dhdKdLZ&dMdN Z'  Z(S )iLayer1z
2010-12-01z	us-east-1z(elasticbeanstalk.us-east-1.amazonaws.comNTr   /c                    sN   |st | | j| j}|| _tt| j||||||||| jj|	|
|||d d S )N)profile_name)r   DefaultRegionNameDefaultRegionEndpointregionsuperr   __init__Zendpoint)selfZaws_access_key_idZaws_secret_access_keyZ	is_secureportproxyZ
proxy_portZ
proxy_userZ
proxy_passdebugZhttps_connection_factoryr
   pathapi_versionZsecurity_tokenr   	__class__ 9/tmp/pip-unpacked-wheel-d7dsrkjd/boto/beanstalk/layer1.pyr   &   s(           zLayer1.__init__c                 C   s   dgS )Nzhmac-v4r   r   r   r   r   _required_auth_capability8   s    z Layer1._required_auth_capabilityc                 C   s   t |}ddd| S )Ntruefalse)TF)bool)r   vr   r   r   _encode_bool;   s    zLayer1._encode_boolGETc                 C   s\   d|d< |  ||||}| d}tj| |jdkrFt|S | 	|j|j
|d S )NZJSONZContentTypezutf-8   )Zmake_requestreaddecodebotologr   statusr   loadsResponseErrorreason)r   actionparamsr   Zverbresponsebodyr   r   r   _get_response?   s    

zLayer1._get_responsec                 C   s   d|i}|  d|S )zChecks if the specified CNAME is available.

        :type cname_prefix: string
        :param cname_prefix: The prefix used when this CNAME is
            reserved.
        CNAMEPrefixZCheckDNSAvailabilityr,   )r   cname_prefixr)   r   r   r   check_dns_availabilityI   s    zLayer1.check_dns_availabilityc                 C   s    d|i}|r||d< |  d|S )a%  
        Creates an application that has one configuration template
        named default and no application versions.

        :type application_name: string
        :param application_name: The name of the application.
            Constraint: This name must be unique within your account. If the
            specified name already exists, the action returns an
            InvalidParameterValue error.

        :type description: string
        :param description: Describes the application.

        :raises: TooManyApplicationsException
        ApplicationNameDescriptionZCreateApplicationr.   r   application_namedescriptionr)   r   r   r   create_applicationS   s    zLayer1.create_applicationc                 C   sL   ||d}|r||d< |r.|r.||d< ||d< |r@|  ||d< | d|S )aA  Creates an application version for the specified application.

        :type application_name: string
        :param application_name: The name of the application. If no
            application is found with this name, and AutoCreateApplication is
            false, returns an InvalidParameterValue error.

        :type version_label: string
        :param version_label: A label identifying this version. Constraint:
            Must be unique per application. If an application version already
            exists with this label for the specified application, AWS Elastic
            Beanstalk returns an InvalidParameterValue error.

        :type description: string
        :param description: Describes this version.

        :type s3_bucket: string
        :param s3_bucket: The Amazon S3 bucket where the data is located.

        :type s3_key: string
        :param s3_key: The Amazon S3 key where the data is located.  Both
            s3_bucket and s3_key must be specified in order to use a specific
            source bundle.  If both of these values are not specified the
            sample application will be used.

        :type auto_create_application: boolean
        :param auto_create_application: Determines how the system behaves if
            the specified application for this version does not already exist:
            true: Automatically creates the specified application for this
            version if it does not already exist.  false: Returns an
            InvalidParameterValue if the specified application for this version
            does not already exist.  Default: false  Valid Values: true | false

        :raises: TooManyApplicationsException,
                 TooManyApplicationVersionsException,
                 InsufficientPrivilegesException,
                 S3LocationNotInServiceRegionException

        r1   VersionLabelr2   zSourceBundle.S3BucketzSourceBundle.S3KeyZAutoCreateApplicationZCreateApplicationVersionr   r,   )r   r4   version_labelr5   Z	s3_bucketZs3_keyZauto_create_applicationr)   r   r   r   create_application_versionh   s    *z!Layer1.create_application_versionc	           
      C   sf   ||d}	|r||	d< |r"||	d< |r.||	d< |r:||	d< |rF||	d< |rZ|  |	|dd | d	|	S )
a
  Creates a configuration template.

        Templates are associated with a specific application and are used to
        deploy different versions of the application with the same
        configuration settings.

        :type application_name: string
        :param application_name: The name of the application to associate with
            this configuration template. If no application is found with this
            name, AWS Elastic Beanstalk returns an InvalidParameterValue error.

        :type template_name: string
        :param template_name: The name of the configuration template.
            Constraint: This name must be unique per application.  Default: If
            a configuration template already exists with this name, AWS Elastic
            Beanstalk returns an InvalidParameterValue error.

        :type solution_stack_name: string
        :param solution_stack_name: The name of the solution stack used by this
            configuration. The solution stack specifies the operating system,
            architecture, and application server for a configuration template.
            It determines the set of configuration options as well as the
            possible and default values.  Use ListAvailableSolutionStacks to
            obtain a list of available solution stacks.  Default: If the
            SolutionStackName is not specified and the source configuration
            parameter is blank, AWS Elastic Beanstalk uses the default solution
            stack. If not specified and the source configuration parameter is
            specified, AWS Elastic Beanstalk uses the same solution stack as
            the source configuration template.

        :type source_configuration_application_name: string
        :param source_configuration_application_name: The name of the
            application associated with the configuration.

        :type source_configuration_template_name: string
        :param source_configuration_template_name: The name of the
            configuration template.

        :type environment_id: string
        :param environment_id: The ID of the environment used with this
            configuration template.

        :type description: string
        :param description: Describes this configuration.

        :type option_settings: list
        :param option_settings: If specified, AWS Elastic Beanstalk sets the
            specified configuration option to the requested value. The new
            value overrides the value obtained from the solution stack or the
            source configuration template.

        :raises: InsufficientPrivilegesException,
                 TooManyConfigurationTemplatesException
        r1   TemplateNameSolutionStackNamez#SourceConfiguration.ApplicationNamez SourceConfiguration.TemplateNameEnvironmentIdr2   OptionSettings.member	NamespaceZ
OptionNameValueZCreateConfigurationTemplate_build_list_paramsr,   )
r   r4   template_namesolution_stack_nameZ%source_configuration_application_nameZ"source_configuration_template_nameenvironment_idr5   option_settingsr)   r   r   r   create_configuration_template   s&    <z$Layer1.create_configuration_template1.0c                 C   s   ||d}|r||d< |r"||d< |r.||d< |r:||d< |rF||d< |rZ|  ||dd |	rl| ||	d	 |
r|r|r|
|d
< ||d< ||d< | d|S )aO  Launches an environment for the application using a configuration.

        :type application_name: string
        :param application_name: The name of the application that contains the
            version to be deployed.  If no application is found with this name,
            CreateEnvironment returns an InvalidParameterValue error.

        :type environment_name: string
        :param environment_name: A unique name for the deployment environment.
            Used in the application URL. Constraint: Must be from 4 to 23
            characters in length. The name can contain only letters, numbers,
            and hyphens. It cannot start or end with a hyphen. This name must
            be unique in your account. If the specified name already exists,
            AWS Elastic Beanstalk returns an InvalidParameterValue error.
            Default: If the CNAME parameter is not specified, the environment
            name becomes part of the CNAME, and therefore part of the visible
            URL for your application.

        :type version_label: string
        :param version_label: The name of the application version to deploy. If
            the specified application has no associated application versions,
            AWS Elastic Beanstalk UpdateEnvironment returns an
            InvalidParameterValue error.  Default: If not specified, AWS
            Elastic Beanstalk attempts to launch the most recently created
            application version.

        :type template_name: string
        :param template_name: The name of the configuration template to
            use in deployment. If no configuration template is found with this
            name, AWS Elastic Beanstalk returns an InvalidParameterValue error.
            Condition: You must specify either this parameter or a
            SolutionStackName, but not both. If you specify both, AWS Elastic
            Beanstalk returns an InvalidParameterCombination error. If you do
            not specify either, AWS Elastic Beanstalk returns a
            MissingRequiredParameter error.

        :type solution_stack_name: string
        :param solution_stack_name: This is an alternative to specifying a
            configuration name. If specified, AWS Elastic Beanstalk sets the
            configuration values to the default values associated with the
            specified solution stack.  Condition: You must specify either this
            or a TemplateName, but not both. If you specify both, AWS Elastic
            Beanstalk returns an InvalidParameterCombination error. If you do
            not specify either, AWS Elastic Beanstalk returns a
            MissingRequiredParameter error.

        :type cname_prefix: string
        :param cname_prefix: If specified, the environment attempts to use this
            value as the prefix for the CNAME. If not specified, the
            environment uses the environment name.

        :type description: string
        :param description: Describes this environment.

        :type option_settings: list
        :param option_settings: If specified, AWS Elastic Beanstalk sets the
            specified configuration options to the requested value in the
            configuration set for the new environment. These override the
            values obtained from the solution stack or the configuration
            template.  Each element in the list is a tuple of (Namespace,
            OptionName, Value), for example::

                [('aws:autoscaling:launchconfiguration',
                    'Ec2KeyName', 'mykeypair')]

        :type options_to_remove: list
        :param options_to_remove: A list of custom user-defined configuration
            options to remove from the configuration set for this new
            environment.

        :type tier_name: string
        :param tier_name: The name of the tier.  Valid values are
            "WebServer" and "Worker". Defaults to "WebServer".
            The ``tier_name`` and a ``tier_type`` parameters are
            related and the values provided must be valid.
            The possible combinations are:

              * "WebServer" and "Standard" (the default)
              * "Worker" and "SQS/HTTP"

        :type tier_type: string
        :param tier_type: The type of the tier.  Valid values are
            "Standard" if ``tier_name`` is "WebServer" and "SQS/HTTP"
            if ``tier_name`` is "Worker". Defaults to "Standard".

        :type tier_version: string
        :type tier_version: The version of the tier.  Valid values
            currently are "1.0". Defaults to "1.0".

        :raises: TooManyEnvironmentsException, InsufficientPrivilegesException

        r1   EnvironmentNamer8   r=   r>   r-   r2   r@   rA   OptionsToRemove.member	Tier.Name	Tier.TypeTier.VersionZCreateEnvironmentrE   build_list_paramsr,   )r   r4   environment_namer:   rF   rG   r/   r5   rI   options_to_remove	tier_name	tier_typetier_versionr)   r   r   r   create_environment   s6    bzLayer1.create_environmentc                 C   s   | j di dS )a  
        Creates the Amazon S3 storage location for the account.  This
        location is used to store user log files.

        :raises: TooManyBucketsException,
                 S3SubscriptionRequiredException,
                 InsufficientPrivilegesException

        ZCreateStorageLocationr)   r.   r   r   r   r   create_storage_locationg  s    
zLayer1.create_storage_locationc                 C   s&   d|i}|r|  ||d< | d|S )a   
        Deletes the specified application along with all associated
        versions and configurations. The application versions will not
        be deleted from your Amazon S3 bucket.

        :type application_name: string
        :param application_name: The name of the application to delete.

        :type terminate_env_by_force: boolean
        :param terminate_env_by_force: When set to true, running
            environments will be terminated before deleting the application.

        :raises: OperationInProgressException

        r1   ZTerminateEnvByForceZDeleteApplicationr9   )r   r4   Zterminate_env_by_forcer)   r   r   r   delete_applications  s    zLayer1.delete_applicationc                 C   s(   ||d}|r|  ||d< | d|S )a  Deletes the specified version from the specified application.

        :type application_name: string
        :param application_name: The name of the application to delete
            releases from.

        :type version_label: string
        :param version_label: The label of the version to delete.

        :type delete_source_bundle: boolean
        :param delete_source_bundle: Indicates whether to delete the
            associated source bundle from Amazon S3.  Valid Values: true |
            false

        :raises: SourceBundleDeletionException,
                 InsufficientPrivilegesException,
                 OperationInProgressException,
                 S3LocationNotInServiceRegionException
        r7   ZDeleteSourceBundleZDeleteApplicationVersionr9   )r   r4   r:   Zdelete_source_bundler)   r   r   r   delete_application_version  s    z!Layer1.delete_application_versionc                 C   s   ||d}|  d|S )a  Deletes the specified configuration template.

        :type application_name: string
        :param application_name: The name of the application to delete
            the configuration template from.

        :type template_name: string
        :param template_name: The name of the configuration template to
            delete.

        :raises: OperationInProgressException

        r<   ZDeleteConfigurationTemplater.   )r   r4   rF   r)   r   r   r   delete_configuration_template  s    z$Layer1.delete_configuration_templatec                 C   s   ||d}|  d|S )am  
        Deletes the draft configuration associated with the running
        environment.  Updating a running environment with any
        configuration changes creates a draft configuration set. You can
        get the draft configuration using DescribeConfigurationSettings
        while the update is in progress or if the update fails. The
        DeploymentStatus for the draft configuration indicates whether
        the deployment is in process or has failed. The draft
        configuration remains in existence until it is deleted with this
        action.

        :type application_name: string
        :param application_name: The name of the application the
            environment is associated with.

        :type environment_name: string
        :param environment_name: The name of the environment to delete
            the draft configuration from.

        rL   ZDeleteEnvironmentConfigurationr.   )r   r4   rT   r)   r   r   r    delete_environment_configuration  s    z'Layer1.delete_environment_configurationc                 C   s.   i }|r||d< |r"|  ||d | d|S )a  Returns descriptions for existing application versions.

        :type application_name: string
        :param application_name: If specified, AWS Elastic Beanstalk restricts
            the returned descriptions to only include ones that are associated
            with the specified application.

        :type version_labels: list
        :param version_labels: If specified, restricts the returned
            descriptions to only include ones that have the specified version
            labels.

        r1   zVersionLabels.memberZDescribeApplicationVersionsrS   r,   )r   r4   Zversion_labelsr)   r   r   r   describe_application_versions  s    z$Layer1.describe_application_versionsc                 C   s"   i }|r|  ||d | d|S )a  Returns the descriptions of existing applications.

        :type application_names: list
        :param application_names: If specified, AWS Elastic Beanstalk restricts
            the returned descriptions to only include those with the specified
            names.

        zApplicationNames.memberZDescribeApplicationsr`   )r   Zapplication_namesr)   r   r   r   describe_applications  s    	zLayer1.describe_applicationsc                 C   sR   i }|r||d< |r||d< |r(||d< |r4||d< |rF|  ||d | d|S )a}  Describes configuration options used in a template or environment.

        Describes the configuration options that are used in a
        particular configuration template or environment, or that a
        specified solution stack defines. The description includes the
        values the options, their default values, and an indication of
        the required action on a running environment if an option value
        is changed.

        :type application_name: string
        :param application_name: The name of the application associated with
            the configuration template or environment. Only needed if you want
            to describe the configuration options associated with either the
            configuration template or environment.

        :type template_name: string
        :param template_name: The name of the configuration template whose
            configuration options you want to describe.

        :type environment_name: string
        :param environment_name: The name of the environment whose
            configuration options you want to describe.

        :type solution_stack_name: string
        :param solution_stack_name: The name of the solution stack whose
            configuration options you want to describe.

        :type options: list
        :param options: If specified, restricts the descriptions to only
            the specified options.
        r1   r=   rM   r>   zOptions.memberZDescribeConfigurationOptionsr`   )r   r4   rF   rT   rG   optionsr)   r   r   r   describe_configuration_options  s    #z%Layer1.describe_configuration_optionsc                 C   s,   d|i}|r||d< |r ||d< |  d|S )a>  
        Returns a description of the settings for the specified
        configuration set, that is, either a configuration template or
        the configuration set associated with a running environment.
        When describing the settings for the configuration set
        associated with a running environment, it is possible to receive
        two sets of setting descriptions. One is the deployed
        configuration set, and the other is a draft configuration of an
        environment that is either in the process of deployment or that
        failed to deploy.

        :type application_name: string
        :param application_name: The application for the environment or
            configuration template.

        :type template_name: string
        :param template_name: The name of the configuration template to
            describe.  Conditional: You must specify either this parameter or
            an EnvironmentName, but not both. If you specify both, AWS Elastic
            Beanstalk returns an InvalidParameterCombination error.  If you do
            not specify either, AWS Elastic Beanstalk returns a
            MissingRequiredParameter error.

        :type environment_name: string
        :param environment_name: The name of the environment to describe.
            Condition: You must specify either this or a TemplateName, but not
            both. If you specify both, AWS Elastic Beanstalk returns an
            InvalidParameterCombination error. If you do not specify either,
            AWS Elastic Beanstalk returns MissingRequiredParameter error.
        r1   r=   rM   ZDescribeConfigurationSettingsr.   )r   r4   rF   rT   r)   r   r   r   describe_configuration_settings(  s    !z&Layer1.describe_configuration_settingsc                 C   s(   i }|r||d< |r||d< |  d|S )a  Returns AWS resources for this environment.

        :type environment_id: string
        :param environment_id: The ID of the environment to retrieve AWS
            resource usage data.  Condition: You must specify either this or an
            EnvironmentName, or both. If you do not specify either, AWS Elastic
            Beanstalk returns MissingRequiredParameter error.

        :type environment_name: string
        :param environment_name: The name of the environment to retrieve
            AWS resource usage data.  Condition: You must specify either this
            or an EnvironmentId, or both. If you do not specify either, AWS
            Elastic Beanstalk returns MissingRequiredParameter error.

        :raises: InsufficientPrivilegesException
        r?   rM   ZDescribeEnvironmentResourcesr.   r   rH   rT   r)   r   r   r   describe_environment_resourcesP  s    z%Layer1.describe_environment_resourcesc                 C   sj   i }|r||d< |r||d< |r.|  ||d |r@|  ||d |rR| ||d< |r^||d< | d|S )a  Returns descriptions for existing environments.

        :type application_name: string
        :param application_name: If specified, AWS Elastic Beanstalk restricts
            the returned descriptions to include only those that are associated
            with this application.

        :type version_label: string
        :param version_label: If specified, AWS Elastic Beanstalk restricts the
            returned descriptions to include only those that are associated
            with this application version.

        :type environment_ids: list
        :param environment_ids: If specified, AWS Elastic Beanstalk restricts
            the returned descriptions to include only those that have the
            specified IDs.

        :type environment_names: list
        :param environment_names: If specified, AWS Elastic Beanstalk restricts
            the returned descriptions to include only those that have the
            specified names.

        :type include_deleted: boolean
        :param include_deleted: Indicates whether to include deleted
            environments:  true: Environments that have been deleted after
            IncludedDeletedBackTo are displayed.  false: Do not include deleted
            environments.

        :type included_deleted_back_to: timestamp
        :param included_deleted_back_to: If specified when IncludeDeleted is
            set to true, then environments deleted after this date are
            displayed.
        r1   r8   zEnvironmentIds.memberzEnvironmentNames.memberZIncludeDeletedZIncludedDeletedBackToZDescribeEnvironments)rS   r   r,   )r   r4   r:   Zenvironment_idsZenvironment_namesZinclude_deletedZincluded_deleted_back_tor)   r   r   r   describe_environmentsi  s$    %zLayer1.describe_environmentsc                 C   s   i }|r||d< |r||d< |r(||d< |r4||d< |r@||d< |rL||d< |rX||d< |rd||d< |	rp|	|d	< |
r||
|d
< |r||d< |  d|S )a  Returns event descriptions matching criteria up to the last 6 weeks.

        :type application_name: string
        :param application_name: If specified, AWS Elastic Beanstalk restricts
            the returned descriptions to include only those associated with
            this application.

        :type version_label: string
        :param version_label: If specified, AWS Elastic Beanstalk restricts the
            returned descriptions to those associated with this application
            version.

        :type template_name: string
        :param template_name: If specified, AWS Elastic Beanstalk restricts the
            returned descriptions to those that are associated with this
            environment configuration.

        :type environment_id: string
        :param environment_id: If specified, AWS Elastic Beanstalk restricts
            the returned descriptions to those associated with this
            environment.

        :type environment_name: string
        :param environment_name: If specified, AWS Elastic Beanstalk restricts
            the returned descriptions to those associated with this
            environment.

        :type request_id: string
        :param request_id: If specified, AWS Elastic Beanstalk restricts the
            described events to include only those associated with this request
            ID.

        :type severity: string
        :param severity: If specified, limits the events returned from this
            call to include only those with the specified severity or higher.

        :type start_time: timestamp
        :param start_time: If specified, AWS Elastic Beanstalk restricts the
            returned descriptions to those that occur on or after this time.

        :type end_time: timestamp
        :param end_time: If specified, AWS Elastic Beanstalk restricts the
            returned descriptions to those that occur up to, but not including,
            the EndTime.

        :type max_records: integer
        :param max_records: Specifies the maximum number of events that can be
            returned, beginning with the most recent event.

        :type next_token: string
        :param next_token: Pagination token. If specified, the events return
            the next batch of results.
        r1   r8   r=   r?   rM   Z	RequestIdZSeverityZ	StartTimeZEndTimeZ
MaxRecordsZ	NextTokenZDescribeEventsr.   )r   r4   r:   rF   rH   rT   Z
request_idZseverity
start_timeZend_timeZmax_recordsZ
next_tokenr)   r   r   r   describe_events  s0    :zLayer1.describe_eventsc                 C   s   | j di dS )z5Returns a list of the available solution stack names.ZListAvailableSolutionStacksrZ   r.   r   r   r   r   list_available_solution_stacks  s    z%Layer1.list_available_solution_stacksc                 C   s(   i }|r||d< |r||d< |  d|S )a  
        Deletes and recreates all of the AWS resources (for example:
        the Auto Scaling group, load balancer, etc.) for a specified
        environment and forces a restart.

        :type environment_id: string
        :param environment_id: The ID of the environment to rebuild.
            Condition: You must specify either this or an EnvironmentName, or
            both.  If you do not specify either, AWS Elastic Beanstalk returns
            MissingRequiredParameter error.

        :type environment_name: string
        :param environment_name: The name of the environment to rebuild.
            Condition: You must specify either this or an EnvironmentId, or
            both.  If you do not specify either, AWS Elastic Beanstalk returns
            MissingRequiredParameter error.

        :raises InvalidParameterValue: If environment_name doesn't refer to a currently active environment
        :raises: InsufficientPrivilegesException
        r?   rM   ZRebuildEnvironmentr.   rf   r   r   r   rebuild_environment  s    zLayer1.rebuild_environmenttailc                 C   s,   d|i}|r||d< |r ||d< |  d|S )a,  
        Initiates a request to compile the specified type of
        information of the deployed environment.  Setting the InfoType
        to tail compiles the last lines from the application server log
        files of every Amazon EC2 instance in your environment. Use
        RetrieveEnvironmentInfo to access the compiled information.

        :type info_type: string
        :param info_type: The type of information to request.

        :type environment_id: string
        :param environment_id: The ID of the environment of the
            requested data. If no such environment is found,
            RequestEnvironmentInfo returns an InvalidParameterValue error.
            Condition: You must specify either this or an EnvironmentName, or
            both. If you do not specify either, AWS Elastic Beanstalk returns
            MissingRequiredParameter error.

        :type environment_name: string
        :param environment_name: The name of the environment of the
            requested data. If no such environment is found,
            RequestEnvironmentInfo returns an InvalidParameterValue error.
            Condition: You must specify either this or an EnvironmentId, or
            both. If you do not specify either, AWS Elastic Beanstalk returns
            MissingRequiredParameter error.
        InfoTyper?   rM   ZRequestEnvironmentInfor.   r   Z	info_typerH   rT   r)   r   r   r   request_environment_info  s    zLayer1.request_environment_infoc                 C   s(   i }|r||d< |r||d< |  d|S )a  
        Causes the environment to restart the application container
        server running on each Amazon EC2 instance.

        :type environment_id: string
        :param environment_id: The ID of the environment to restart the server
            for.  Condition: You must specify either this or an
            EnvironmentName, or both. If you do not specify either, AWS Elastic
            Beanstalk returns MissingRequiredParameter error.

        :type environment_name: string
        :param environment_name: The name of the environment to restart the
            server for.  Condition: You must specify either this or an
            EnvironmentId, or both. If you do not specify either, AWS Elastic
            Beanstalk returns MissingRequiredParameter error.
        r?   rM   ZRestartAppServerr.   rf   r   r   r   restart_app_server5  s    zLayer1.restart_app_serverc                 C   s,   d|i}|r||d< |r ||d< |  d|S )a  
        Retrieves the compiled information from a RequestEnvironmentInfo
        request.

        :type info_type: string
        :param info_type: The type of information to retrieve.

        :type environment_id: string
        :param environment_id: The ID of the data's environment. If no such
            environment is found, returns an InvalidParameterValue error.
            Condition: You must specify either this or an EnvironmentName, or
            both.  If you do not specify either, AWS Elastic Beanstalk returns
            MissingRequiredParameter error.

        :type environment_name: string
        :param environment_name: The name of the data's environment. If no such
            environment is found, returns an InvalidParameterValue error.
            Condition: You must specify either this or an EnvironmentId, or
            both.  If you do not specify either, AWS Elastic Beanstalk returns
            MissingRequiredParameter error.
        rn   r?   rM   ZRetrieveEnvironmentInfor.   ro   r   r   r   retrieve_environment_infoM  s    z Layer1.retrieve_environment_infoc                 C   s@   i }|r||d< |r||d< |r(||d< |r4||d< |  d|S )a(  Swaps the CNAMEs of two environments.

        :type source_environment_id: string
        :param source_environment_id: The ID of the source environment.
            Condition: You must specify at least the SourceEnvironmentID or the
            SourceEnvironmentName. You may also specify both. If you specify
            the SourceEnvironmentId, you must specify the
            DestinationEnvironmentId.

        :type source_environment_name: string
        :param source_environment_name: The name of the source environment.
            Condition: You must specify at least the SourceEnvironmentID or the
            SourceEnvironmentName. You may also specify both. If you specify
            the SourceEnvironmentName, you must specify the
            DestinationEnvironmentName.

        :type destination_environment_id: string
        :param destination_environment_id: The ID of the destination
            environment.  Condition: You must specify at least the
            DestinationEnvironmentID or the DestinationEnvironmentName. You may
            also specify both. You must specify the SourceEnvironmentId with
            the DestinationEnvironmentId.

        :type destination_environment_name: string
        :param destination_environment_name: The name of the destination
            environment.  Condition: You must specify at least the
            DestinationEnvironmentID or the DestinationEnvironmentName. You may
            also specify both. You must specify the SourceEnvironmentName with
            the DestinationEnvironmentName.
        ZSourceEnvironmentIdZSourceEnvironmentNameZDestinationEnvironmentIdZDestinationEnvironmentNameZSwapEnvironmentCNAMEsr.   )r   Zsource_environment_idZsource_environment_nameZdestination_environment_idZdestination_environment_namer)   r   r   r   swap_environment_cnamesk  s    "zLayer1.swap_environment_cnamesc                 C   s:   i }|r||d< |r||d< |r.|  ||d< | d|S )a=  Terminates the specified environment.

        :type environment_id: string
        :param environment_id: The ID of the environment to terminate.
            Condition: You must specify either this or an EnvironmentName, or
            both.  If you do not specify either, AWS Elastic Beanstalk returns
            MissingRequiredParameter error.

        :type environment_name: string
        :param environment_name: The name of the environment to terminate.
            Condition: You must specify either this or an EnvironmentId, or
            both.  If you do not specify either, AWS Elastic Beanstalk returns
            MissingRequiredParameter error.

        :type terminate_resources: boolean
        :param terminate_resources: Indicates whether the associated AWS
            resources should shut down when the environment is terminated:
            true: (default) The user AWS resources (for example, the Auto
            Scaling group, LoadBalancer, etc.) are terminated along with the
            environment.  false: The environment is removed from the AWS
            Elastic Beanstalk but the AWS resources continue to operate.  For
            more information, see the  AWS Elastic Beanstalk User Guide.
            Default: true  Valid Values: true | false

        :raises: InsufficientPrivilegesException
        r?   rM   ZTerminateResourcesZTerminateEnvironmentr9   )r   rH   rT   Zterminate_resourcesr)   r   r   r   terminate_environment  s    zLayer1.terminate_environmentc                 C   s    d|i}|r||d< |  d|S )a  
        Updates the specified application to have the specified
        properties.

        :type application_name: string
        :param application_name: The name of the application to update.
            If no such application is found, UpdateApplication returns an
            InvalidParameterValue error.

        :type description: string
        :param description: A new description for the application.  Default: If
            not specified, AWS Elastic Beanstalk does not update the
            description.
        r1   r2   ZUpdateApplicationr.   r3   r   r   r   update_application  s    zLayer1.update_applicationc                 C   s"   ||d}|r||d< |  d|S )a  Updates the application version to have the properties.

        :type application_name: string
        :param application_name: The name of the application associated with
            this version.  If no application is found with this name,
            UpdateApplication returns an InvalidParameterValue error.

        :type version_label: string
        :param version_label: The name of the version to update. If no
            application version is found with this label, UpdateApplication
            returns an InvalidParameterValue error.

        :type description: string
        :param description: A new description for this release.
        r7   r2   ZUpdateApplicationVersionr.   )r   r4   r:   r5   r)   r   r   r   update_application_version  s    z!Layer1.update_application_versionc                 C   sH   ||d}|r||d< |r*|  ||dd |r<| ||d | d|S )a  
        Updates the specified configuration template to have the
        specified properties or configuration option values.

        :type application_name: string
        :param application_name: The name of the application associated with
            the configuration template to update. If no application is found
            with this name, UpdateConfigurationTemplate returns an
            InvalidParameterValue error.

        :type template_name: string
        :param template_name: The name of the configuration template to update.
            If no configuration template is found with this name,
            UpdateConfigurationTemplate returns an InvalidParameterValue error.

        :type description: string
        :param description: A new description for the configuration.

        :type option_settings: list
        :param option_settings: A list of configuration option settings to
            update with the new specified option value.

        :type options_to_remove: list
        :param options_to_remove: A list of configuration options to remove
            from the configuration set.  Constraint: You can remove only
            UserDefined configuration options.

        :raises: InsufficientPrivilegesException
        r<   r2   r@   rA   rN   ZUpdateConfigurationTemplaterR   )r   r4   rF   r5   rI   rU   r)   r   r   r   update_configuration_template  s     z$Layer1.update_configuration_templatec                 C   s   i }|r||d< |r||d< |r(||d< |r4||d< |r@||d< |rT|  ||dd |rf| ||d |r|	r|
r||d	< |	|d
< |
|d< | d|S )aU  
        Updates the environment description, deploys a new application
        version, updates the configuration settings to an entirely new
        configuration template, or updates select configuration option
        values in the running environment.  Attempting to update both
        the release and configuration is not allowed and AWS Elastic
        Beanstalk returns an InvalidParameterCombination error.  When
        updating the configuration settings to a new template or
        individual settings, a draft configuration is created and
        DescribeConfigurationSettings for this environment returns two
        setting descriptions with different DeploymentStatus values.

        :type environment_id: string
        :param environment_id: The ID of the environment to update. If no
            environment with this ID exists, AWS Elastic Beanstalk returns an
            InvalidParameterValue error.  Condition: You must specify either
            this or an EnvironmentName, or both. If you do not specify either,
            AWS Elastic Beanstalk returns MissingRequiredParameter error.

        :type environment_name: string
        :param environment_name: The name of the environment to update.  If no
            environment with this name exists, AWS Elastic Beanstalk returns an
            InvalidParameterValue error.  Condition: You must specify either
            this or an EnvironmentId, or both. If you do not specify either,
            AWS Elastic Beanstalk returns MissingRequiredParameter error.

        :type version_label: string
        :param version_label: If this parameter is specified, AWS Elastic
            Beanstalk deploys the named application version to the environment.
            If no such application version is found, returns an
            InvalidParameterValue error.

        :type template_name: string
        :param template_name: If this parameter is specified, AWS Elastic
            Beanstalk deploys this configuration template to the environment.
            If no such configuration template is found, AWS Elastic Beanstalk
            returns an InvalidParameterValue error.

        :type description: string
        :param description: If this parameter is specified, AWS Elastic
            Beanstalk updates the description of this environment.

        :type option_settings: list
        :param option_settings: If specified, AWS Elastic Beanstalk updates the
            configuration set associated with the running environment and sets
            the specified configuration options to the requested value.

        :type options_to_remove: list
        :param options_to_remove: A list of custom user-defined configuration
            options to remove from the configuration set for this environment.

        :type tier_name: string
        :param tier_name: The name of the tier.  Valid values are
            "WebServer" and "Worker". Defaults to "WebServer".
            The ``tier_name`` and a ``tier_type`` parameters are
            related and the values provided must be valid.
            The possible combinations are:

              * "WebServer" and "Standard" (the default)
              * "Worker" and "SQS/HTTP"

        :type tier_type: string
        :param tier_type: The type of the tier.  Valid values are
            "Standard" if ``tier_name`` is "WebServer" and "SQS/HTTP"
            if ``tier_name`` is "Worker". Defaults to "Standard".

        :type tier_version: string
        :type tier_version: The version of the tier.  Valid values
            currently are "1.0". Defaults to "1.0".

        :raises: InsufficientPrivilegesException
        r?   rM   r8   r=   r2   r@   rA   rN   rO   rP   rQ   ZUpdateEnvironmentrR   )r   rH   rT   r:   rF   r5   rI   rU   rV   rW   rX   r)   r   r   r   update_environment  s2    MzLayer1.update_environmentc                 C   s<   d|i}|  ||dd |r$||d< |r0||d< | d|S )aj  
        Takes a set of configuration settings and either a
        configuration template or environment, and determines whether
        those values are valid.  This action returns a list of messages
        indicating any errors or warnings associated with the selection
        of option values.

        :type application_name: string
        :param application_name: The name of the application that the
            configuration template or environment belongs to.

        :type template_name: string
        :param template_name: The name of the configuration template to
            validate the settings against.  Condition: You cannot specify both
            this and an environment name.

        :type environment_name: string
        :param environment_name: The name of the environment to validate the
            settings against.  Condition: You cannot specify both this and a
            configuration template name.

        :type option_settings: list
        :param option_settings: A list of the options and desired values to
            evaluate.

        :raises: InsufficientPrivilegesException
        r1   r@   rA   r=   rM   ZValidateConfigurationSettingsrD   )r   r4   rI   rF   rT   r)   r   r   r   validate_configuration_settings{  s    z&Layer1.validate_configuration_settingsc                 C   sL   t |dD ]<\}}d||f }t||D ]\}}	d||f }
|	||
< q(q
d S )N   z%s.%s)	enumeratezip)r   r)   Zuser_valuesprefixZtuple_namesiZ
user_valueZcurrent_prefixkeyvalueZfull_keyr   r   r   rE     s
    zLayer1._build_list_params)NNTNNNNNr   NNr   NNN)r   r   )N)NNNN)NNNNNN)
NNNNNNNNNrK   )N)N)NN)N)NNNNN)NN)NN)NNNNNN)NNNNNNNNNNN)NN)rm   NN)NN)rm   NN)NNNN)NNN)N)N)NNN)
NNNNNNNNNrK   )NN))__name__
__module____qualname__Z
APIVersionr   r	   r   r   r   r,   r0   r6   r;   rJ   rY   r[   r\   r]   r^   r_   ra   rb   rd   re   rg   rh   rj   rk   rl   rp   rq   rr   rs   rt   ru   rv   rw   rx   ry   rE   __classcell__r   r   r   r   r       s                         



      
7       
O               
{ 
 
  

      
1  
(  
      
6               
S
  
#
  
    
-  
&
 
    
-             
f  
(r   )	r"   Zboto.jsonresponseZboto.compatr   Zboto.regioninfor   Zboto.connectionr   r   r   r   r   r   <module>   s
   