コード例 #1
0
    def describe_environments (self, application = None, 
                               environment_names = None, environment_ids = None, 
                               include_deleted = None, included_deleted_backto = None, 
                               version_label = None):
        request = Request()
        request.set_operation('DescribeEnvironments')

        if application is not None:        
            request.set_app_name(application)
        if environment_names is not None:
            request.set_env_names(environment_names)
        if environment_ids is not None:
            request.set_env_ids(environment_ids)
        if include_deleted is not None:        
            request.set_include_deleted(include_deleted)
        if included_deleted_backto is not None:        
            request.set_included_deleted_backto(included_deleted_backto)
        if version_label is not None:        
            request.set_version_label(version_label)            
                    
        try:    
            response = self.call(request)
        except:
            raise
        
        # parse message
        results = response['DescribeEnvironmentsResponse']\
            ['DescribeEnvironmentsResult']['Environments']
        request_id = response['DescribeEnvironmentsResponse']\
            ['ResponseMetadata']['RequestId']
                
        environments = []
        for result in results:
            environments.append(EnvironmentDescription.from_json(result))
        return Response(request_id, environments)
コード例 #2
0
ファイル: servicecall.py プロジェクト: basilbeltran/bashitol
    def terminate_environment(self,
                              environment_name,
                              environment_id=None,
                              delete_resource='true'):
        if (environment_name is None and environment_id is None):
            raise AttributeError('Must specify either environment name or ID')

        request = Request()
        request.set_operation('TerminateEnvironment')
        if environment_name is not None:
            request.set_env_name(environment_name)
        if environment_id is not None:
            request.set_env_id(environment_id)
        request.set_terminate_resources(delete_resource)

        try:
            response = self.call(request)
        except:
            raise

        result = response['TerminateEnvironmentResponse']\
            ['TerminateEnvironmentResult']
        request_id = response['TerminateEnvironmentResponse']\
        ['ResponseMetadata']['RequestId']

        return Response(request_id, EnvironmentDescription.from_json(result))
コード例 #3
0
    def describe_environments (self, application = None, 
                               environment_names = None, environment_ids = None, 
                               include_deleted = None, included_deleted_backto = None, 
                               version_label = None):
        request = Request()
        request.set_operation(u'DescribeEnvironments')

        if application is not None:        
            request.set_app_name(application)
        if environment_names is not None:
            request.set_env_names(environment_names)
        if environment_ids is not None:
            request.set_env_ids(environment_ids)
        if include_deleted is not None:        
            request.set_include_deleted(include_deleted)
        if included_deleted_backto is not None:        
            request.set_included_deleted_backto(included_deleted_backto)
        if version_label is not None:        
            request.set_version_label(version_label)            
                    
        try:    
            response = self.call(request)
        except:
            raise
        
        # parse message
        results = response[u'DescribeEnvironmentsResponse']\
            [u'DescribeEnvironmentsResult'][u'Environments']
        request_id = response[u'DescribeEnvironmentsResponse']\
            [u'ResponseMetadata'][u'RequestId']
                
        environments = []
        for result in results:
            environments.append(EnvironmentDescription.from_json(result))
        return Response(request_id, environments)
コード例 #4
0
ファイル: servicecall.py プロジェクト: basilbeltran/bashitol
    def create_environment(self,
                           application,
                           environment,
                           cname_prefix=None,
                           template=None,
                           solution_stack=None,
                           version_label=None,
                           option_settings=None,
                           option_remove=None,
                           template_specification=None,
                           description=None):
        if (template is None and solution_stack is None) \
            or (template is not None and solution_stack is not None):
            raise AttributeError(
                'Must specify either solution stack or template.')

        request = Request()
        request.set_operation('CreateEnvironment')
        request.set_app_name(application)
        request.set_env_name(environment)

        if cname_prefix is not None:
            request.set_cname(cname_prefix)
        if template is not None:
            request.set_template(template)
        if solution_stack is not None:
            request.set_solution_stack(solution_stack)
        if version_label is not None:
            request.set_version_label(version_label)
        if option_settings is not None:
            request.set_option_settings(option_settings)
        if option_remove is not None:
            request.set_options_to_remove(option_remove)
        if template_specification is not None:
            request.set_template_specification(template_specification)
        if description is not None:
            request.set_description(description)

        try:
            response = self.call(request)
        except AwsServiceException as ex:
            if ex.code.lower() == AwsErrorCode.InvalidParameterValue.lower()\
                and _re.search(Strings.ENV_EXIST_RE, ex.message):
                raise AlreadyExistException(ex)
            raise

        result = response['CreateEnvironmentResponse'][
            'CreateEnvironmentResult']
        request_id = response['CreateEnvironmentResponse']\
            ['ResponseMetadata']['RequestId']

        return Response(request_id, EnvironmentDescription.from_json(result))
コード例 #5
0
ファイル: servicecall.py プロジェクト: mark-lester/Gee
    def create_environment(self,
                           application,
                           environment,
                           cname_prefix=None,
                           template=None,
                           solution_stack=None,
                           version_label=None,
                           option_settings=None,
                           option_remove=None,
                           template_specification=None,
                           description=None,
                           tier=None):
        request = Request()
        request.set_operation('CreateEnvironment')
        request.set_app_name(application)
        request.set_env_name(environment)

        if cname_prefix is not None:
            request.set_cname(cname_prefix)
        if template is not None:
            request.set_template(template)
        if solution_stack is not None:
            request.set_solution_stack(solution_stack)
        if version_label is not None:
            request.set_version_label(version_label)
        if option_settings is not None:
            request.set_option_settings(option_settings)
        if option_remove is not None:
            request.set_options_to_remove(option_remove)
        if template_specification is not None:
            request.set_template_specification(template_specification)
        if description is not None:
            request.set_description(description)
        if tier is not None:
            request.set_tier(tier)

        try:
            response = self.call(request)
        except AwsServiceException as ex:
            if ex.code.lower() == AwsErrorCode.InvalidParameterValue.lower()\
                and _re.search(Strings.ENV_EXIST_RE, ex.message):
                raise AlreadyExistException(ex)
            raise

        result = response['CreateEnvironmentResponse'][
            'CreateEnvironmentResult']
        request_id = response['CreateEnvironmentResponse']\
            ['ResponseMetadata']['RequestId']

        return Response(request_id, EnvironmentDescription.from_json(result))
コード例 #6
0
ファイル: servicecall.py プロジェクト: basilbeltran/bashitol
    def update_environment(self,
                           env_name=None,
                           env_id=None,
                           template=None,
                           version_label=None,
                           option_settings=None,
                           option_remove=None,
                           template_specification=None,
                           description=None):
        if (env_name is None and env_id is None):
            raise AttributeError(
                'Must specify either environment name or environment id.')

        request = Request()
        request.set_operation('UpdateEnvironment')
        if env_name is not None:
            request.set_env_name(env_name)
        if env_id is not None:
            request.set_env_id(env_id)
        if template is not None:
            request.set_template(template)
        if version_label is not None:
            request.set_version_label(version_label)
        if option_settings is not None:
            request.set_option_settings(option_settings)
        if option_remove is not None:
            request.set_options_to_remove(option_remove)
        if template_specification is not None:
            request.set_template_specification(template_specification)
        if description is not None:
            request.set_description(description)

        try:
            response = self.call(request)
        except AwsServiceException as ex:
            if ex.code.lower() == AwsErrorCode.InvalidParameterValue.lower():
                raise InvalidParameterValueException(ex)
            raise

        result = response['UpdateEnvironmentResponse'][
            'UpdateEnvironmentResult']
        request_id = response['UpdateEnvironmentResponse']\
            ['ResponseMetadata']['RequestId']

        return Response(request_id, EnvironmentDescription.from_json(result))
コード例 #7
0
ファイル: servicecall.py プロジェクト: cpdean/cpd.dotfiles
    def terminate_environment(self, environment_name, environment_id=None, delete_resource=u"true"):
        request = Request()
        request.set_operation(u"TerminateEnvironment")
        if environment_name is not None:
            request.set_env_name(environment_name)
        if environment_id is not None:
            request.set_env_id(environment_id)
        request.set_terminate_resources(delete_resource)

        try:
            response = self.call(request)
        except:
            raise

        result = response[u"TerminateEnvironmentResponse"][u"TerminateEnvironmentResult"]
        request_id = response[u"TerminateEnvironmentResponse"][u"ResponseMetadata"][u"RequestId"]

        return Response(request_id, EnvironmentDescription.from_json(result))
コード例 #8
0
ファイル: servicecall.py プロジェクト: mark-lester/Gee
    def update_environment(self,
                           env_name=None,
                           env_id=None,
                           template=None,
                           version_label=None,
                           option_settings=None,
                           option_remove=None,
                           template_specification=None,
                           description=None,
                           tier=None):
        request = Request()
        request.set_operation('UpdateEnvironment')
        if env_name is not None:
            request.set_env_name(env_name)
        if env_id is not None:
            request.set_env_id(env_id)
        if template is not None:
            request.set_template(template)
        if version_label is not None:
            request.set_version_label(version_label)
        if option_settings is not None:
            request.set_option_settings(option_settings)
        if option_remove is not None:
            request.set_options_to_remove(option_remove)
        if template_specification is not None:
            request.set_template_specification(template_specification)
        if description is not None:
            request.set_description(description)
        if tier is not None:
            request.set_tier(tier)

        try:
            response = self.call(request)
        except AwsServiceException as ex:
            if ex.code.lower() == AwsErrorCode.InvalidParameterValue.lower():
                raise InvalidParameterValueException(ex)
            raise

        result = response['UpdateEnvironmentResponse'][
            'UpdateEnvironmentResult']
        request_id = response['UpdateEnvironmentResponse']\
            ['ResponseMetadata']['RequestId']

        return Response(request_id, EnvironmentDescription.from_json(result))
コード例 #9
0
ファイル: servicecall.py プロジェクト: cpdean/cpd.dotfiles
    def update_environment(
        self,
        env_name=None,
        env_id=None,
        template=None,
        version_label=None,
        option_settings=None,
        option_remove=None,
        template_specification=None,
        description=None,
    ):
        request = Request()
        request.set_operation(u"UpdateEnvironment")
        if env_name is not None:
            request.set_env_name(env_name)
        if env_id is not None:
            request.set_env_id(env_id)
        if template is not None:
            request.set_template(template)
        if version_label is not None:
            request.set_version_label(version_label)
        if option_settings is not None:
            request.set_option_settings(option_settings)
        if option_remove is not None:
            request.set_options_to_remove(option_remove)
        if template_specification is not None:
            request.set_template_specification(template_specification)
        if description is not None:
            request.set_description(description)

        try:
            response = self.call(request)
        except AwsServiceException as ex:
            if ex.code.lower() == AwsErrorCode.InvalidParameterValue.lower():
                raise InvalidParameterValueException(ex)
            raise

        result = response[u"UpdateEnvironmentResponse"][u"UpdateEnvironmentResult"]
        request_id = response[u"UpdateEnvironmentResponse"][u"ResponseMetadata"][u"RequestId"]

        return Response(request_id, EnvironmentDescription.from_json(result))
コード例 #10
0
ファイル: servicecall.py プロジェクト: basilbeltran/bashitol
    def terminate_environment(self, environment_name, environment_id=None, delete_resource="true"):
        if environment_name is None and environment_id is None:
            raise AttributeError("Must specify either environment name or ID")

        request = Request()
        request.set_operation("TerminateEnvironment")
        if environment_name is not None:
            request.set_env_name(environment_name)
        if environment_id is not None:
            request.set_env_id(environment_id)
        request.set_terminate_resources(delete_resource)

        try:
            response = self.call(request)
        except:
            raise

        result = response["TerminateEnvironmentResponse"]["TerminateEnvironmentResult"]
        request_id = response["TerminateEnvironmentResponse"]["ResponseMetadata"]["RequestId"]

        return Response(request_id, EnvironmentDescription.from_json(result))
コード例 #11
0
    def terminate_environment(self, environment_name, 
                              environment_id = None, delete_resource = u'true'):
        request = Request()
        request.set_operation(u'TerminateEnvironment')
        if environment_name is not None:        
            request.set_env_name(environment_name)
        if environment_id is not None:        
            request.set_env_id(environment_id)
        request.set_terminate_resources(delete_resource)
            
        try:    
            response = self.call(request)
        except:
            raise        

        result = response[u'TerminateEnvironmentResponse']\
            [u'TerminateEnvironmentResult']
        request_id = response[u'TerminateEnvironmentResponse']\
        [u'ResponseMetadata'][u'RequestId']
                
        return Response(request_id, EnvironmentDescription.from_json(result))