/
cloud_storage.py
64 lines (51 loc) · 1.84 KB
/
cloud_storage.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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