コード例 #1
0
    def create_application_version(self, application, version_label, 
                                   s3bucket = None, s3key = None, 
                                   auto_create_app = u'false', description = None):
        if (s3bucket is None and s3key is not None) \
            or (s3bucket is not None and s3key is None):
            raise AttributeError(u'Must specify both s3 bucket and key')
        
        request = Request()
        request.set_operation(u'CreateApplicationVersion')
        request.set_app_name(application)
        request.set_version_label(version_label)
        if s3bucket is not None:
            request.set_s3bucket(s3bucket) 
            request.set_s3key(s3key) 
        request.set_auto_create_app(auto_create_app)
        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.VER_EXIST_RE, ex.message):
                raise AlreadyExistException(ex)
            raise    
        # TODO: take care of too many application and/or version exception

        result = response[u'CreateApplicationVersionResponse']\
            [u'CreateApplicationVersionResult'][u'ApplicationVersion']
        request_id = response[u'CreateApplicationVersionResponse']\
            [u'ResponseMetadata'][u'RequestId']
                
        return Response(request_id, ApplicationVersionDescription.from_json(result))
コード例 #2
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))
コード例 #3
0
ファイル: servicecall.py プロジェクト: mark-lester/Gee
    def create_application(self, name, description=None):
        request = Request()
        request.set_operation('CreateApplication')
        request.set_app_name(name)
        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.APP_EXIST_RE, ex.message):
                raise AlreadyExistException(ex)
            raise

        # TODO: take care of too many application exception?
        result = response['CreateApplicationResponse']\
            ['CreateApplicationResult']['Application']
        request_id = response['CreateApplicationResponse']\
            ['ResponseMetadata']['RequestId']

        return Response(request_id, ApplicationDescription.from_json(result))