A storage component is an abstraction layer for cloud based file storage such as AWS S3 or Azure Cloud Storage.
A storage component describes a file storage connectivity settings and bucket/container name. An instance of a SAGA storage API has the ability to list, retrieve, delete and create new files, all within a single bucket/container. See javascript object.
Important: Always make sure your connection_settings
credentials are limited to the operations needed for the used bucket/container.
REST Resources
GET /storages
Lists the configured storages. Each storage has the following
- name - the name you can use in scripts and jobs to retrieve it
- container_name - the name of the container
- service_provider_name - name of the cloud vendor, possible values: ['aws-s3'] - more to comes
- connection_settings - the values supplied when connecting and authenticating with the vendor system
POST
[
{
"service_provider_name": "aws-s3",
"name": "skins",
"container_name": "skins",
"connection_settings": {
"region": "us-east-1",
"credentials": {
"accessKeyId": "12324124",
"secretAccessKey": "abcdef"
}
}
},
{
"service_provider_name": "aws-s3",
"name": "videos",
"container_name": "skins",
"connection_settings": {
"region": "us-east-1",
"credentials": {
"accessKeyId": "67890",
"secretAccessKey": "ghijklmn"
}
}
}
]
POST /storages
Create a new storage definition. Will respond with a validation error if the connection_settings do not authenticate with the vendor.
POST
{
"service_provider_name": "aws-s3",
"name": "skins",
"container_name": "skins",
"connection_settings": {
"region": "us-east-1",
"credentials": {
"accessKeyId": "12324124",
"secretAccessKey": "abcdef"
}
}
}
RESPONSE
{
"_id":"60f75920bfbf860419597581",
"name": "skins",
"container_name": "skins",
"connection_settings": {
"region": "us-east-1",
"credentials": {
"accessKeyId": "12324124",
"secretAccessKey": "abcdef"
}
}
}
PUT /storages/:id
Update a storage definition. Will respond with a validation error if the connection_settings do not authenticate with the vendor.
POST
{
"name": "skin"
}
RESPONSE
{
"_id":"60f75920bfbf860419597581",
"name": "skin",
"container_name": "skins",
"connection_settings": {
"region": "us-east-1",
"credentials": {
"accessKeyId": "12324124",
"secretAccessKey": "abcdef"
}
}
}
DELETE /storages/:id
Delete a package.
File Operations
Any vendor errors will appear as Saga HTTP Errors Code and Names. An embedded message can contain a vendor specific error message.
GET /storages/:id/get_object/:path
Retrieve the file with the given path
in the storage with the given id
. Response output will contain raw file.
GET /storages/:id/list_objects/:prefix?
Retrieve a list files with the given optional prefix
filter in the storage with the given id
.
RESPONSE
[
{
"path": "1650658315045",
"lastModified": "2022-05-05T16:49:09.000Z",
"size": 4607
},
{
"path": "1650658315045/1650658315045",
"lastModified": "2022-05-05T15:19:33.000Z",
"size": 4607
},
{
"path": "1650659069902",
"lastModified": "2022-04-22T20:24:31.000Z",
"size": 4597
},
{
"path": "1650659091193",
"lastModified": "2022-04-22T20:24:52.000Z",
"size": 4597
},
{
"path": "1650659178520",
"lastModified": "2022-04-22T20:26:19.000Z",
"size": 4634
}
]
GET /storages/:id/get_signed_url_for_object/:path
Responds with a URL that can be used without authentication to retrieve the content of the file with the given path
DELETE /storages/:id/delete_object/:path
Delete the file with the given path
in the storage with the given id
.
POST /storages/:id/put_object/:path
Create a file named path
with the given http request data. Vendor-specific options can be
passed as query parameters.
POST /storages/:id/upload_object/:path
Create a file named path
with the given uploaded file data.