Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
""" | ||
Manager and serializer for cloud-based storages. | ||
""" | ||
|
||
from galaxy.managers import sharable | ||
|
||
import logging | ||
log = logging.getLogger(__name__) | ||
|
||
|
||
class CloudStoragesManager(sharable.SharableModelManager): | ||
|
||
def __init__(self, app, *args, **kwargs): | ||
super(CloudStoragesManager, self).__init__(app, *args, **kwargs) | ||
|
||
def download(self, provider, container, object): | ||
# TODO: implement the download logic. | ||
pass | ||
|
||
def upload(self, dataset, provider, container, object): | ||
# TODO: implement the upload logic. | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
""" | ||
API operations on Cloud-based storages, such as Amazon Simple Storage Service (S3). | ||
""" | ||
|
||
import logging | ||
|
||
from galaxy import web | ||
from galaxy.web.base.controller import BaseAPIController | ||
from galaxy.managers import cloud_storages | ||
|
||
log = logging.getLogger(__name__) | ||
|
||
|
||
class CloudStorageController(BaseAPIController): | ||
""" | ||
RESTfull controller for interaction with Amazon S3. | ||
""" | ||
|
||
def __init__(self, app): | ||
super(CloudStorageController, self).__init__(app) | ||
|
||
@web.expose_api | ||
def index(self, trans, **kwargs): | ||
""" | ||
* GET /api/cloud_storage | ||
Lists cloud-based containers (e.g., S3 bucket, Azure blob) user has defined. | ||
:param trans: | ||
:param kwargs: | ||
:return: A list of cloud-based containers user has defined. | ||
""" | ||
# TODO: This can be implemented leveraging PluggedMedia objects (part of the user-based object store project) | ||
trans.response.status = 501 | ||
return 'Not Implemented' | ||
|
||
@web.expose_api | ||
def download(self, trans, payload, **kwargs): | ||
""" | ||
* POST /api/cloud_storage/download | ||
Downloads a given object from a given cloud-based container. | ||
:type trans: galaxy.web.framework.webapp.GalaxyWebTransaction | ||
:param trans: Galaxy web transaction | ||
:type payload: dict | ||
:param payload: A dictionary structure containing the following keys: | ||
:param kwargs: | ||
:rtype: boolean | ||
:return: True/False if the given object is successfully downloaded from the cloud-based storage. | ||
""" | ||
pass | ||
|
||
@web.expose_api | ||
def upload(self, trans, payload, **kwargs): | ||
""" | ||
* POST /api/cloud_storage/upload | ||
Uploads a given dataset to a given cloud-based container. | ||
:param trans: | ||
:param payload: | ||
:param kwargs: | ||
:return: | ||
""" | ||
pass |