Beispiel #1
0
    def create_multipart_upload(self, request):
        r"""Initates a multipart upload to S3 for a given object

    Args:
      request: (UploadRequest) input message
    Returns:
      (UploadResponse) The response message.
    """
        try:
            boto_response = self.client.create_multipart_upload(
                Bucket=request.bucket,
                Key=request.object,
                ContentType=request.mime_type)
            response = messages.UploadResponse(boto_response['UploadId'])
        except Exception as e:
            raise messages.S3ClientError(str(e), get_http_error_code(e))
        return response
Beispiel #2
0
    def create_multipart_upload(self, request):
        r"""Initates a multipart upload to S3 for a given object

    Args:
      request: (UploadRequest) input message
    Returns:
      (UploadResponse) The response message.
    """
        try:
            boto_response = self.client.create_multipart_upload(
                Bucket=request.bucket,
                Key=request.object,
                ContentType=request.mime_type)
            response = messages.UploadResponse(boto_response['UploadId'])
        except Exception as e:
            message = e.response['Error']['Message']
            code = e.response['ResponseMetadata']['HTTPStatusCode']
            raise messages.S3ClientError(message, code)
        return response
Beispiel #3
0
 def create_multipart_upload(self, request):
     # Create hash of bucket and key
     # Store upload_id internally
     upload_id = request.bucket + request.object
     self.multipart_uploads[upload_id] = {}
     return messages.UploadResponse(upload_id)