Ejemplo n.º 1
0
    def delete_application_version(self,
                                   application,
                                   version_label,
                                   delete_bundle='false'):

        request = Request()
        request.set_operation('DeleteApplicationVersion')
        request.set_app_name(application)
        request.set_version_label(version_label)
        request.set_delete_source_bundle(delete_bundle)

        try:
            response = self.call(request)
        except AwsServiceException as ex:
            if ex.code.lower() == EBErrorCode.SourceBundleDeletion:
                raise SourceBundleDeletionException(ex)
            if ex.code.lower() == EBErrorCode.S3LocationNotInServiceRegion:
                raise S3LocationNotInServiceRegionException(ex)
            if ex.code.lower() == EBErrorCode.OperationInProgress:
                raise OperationInProgressException(ex)
            raise

        request_id = response['DeleteApplicationVersionResponse']\
            ['ResponseMetadata']['RequestId']
        return Response(request_id)
Ejemplo n.º 2
0
    def delete_application(self, name, terminate_env='false'):
        request = Request()
        request.set_operation('DeleteApplication')
        request.set_app_name(name)
        request.set_terminate_env(terminate_env)

        try:
            response = self.call(request)
        except AwsServiceException as ex:
            if ex.code.lower() == AwsErrorCode.InvalidParameterValue.lower()\
                and _re.search(Strings.APP_HAS_RUNNING_ENV, ex.message):
                raise ApplicationHasRunningEnvException(ex)
            if ex.code.lower() == EBErrorCode.OperationInProgress.lower():
                raise OperationInProgressException(ex)
            raise

        request_id = response['DeleteApplicationResponse']\
            ['ResponseMetadata']['RequestId']

        return Response(request_id)