Object Storage offers persistent storage for digital objects that can be files, databases or other datasets which need to be archived. Objects are stored in named locations known as containers. Containers can be nested thus objects can be stored hierarchically.
This section provides the reference documentation of the ObjectStorage API provided by WireCloud that can be uses in your widgets or operators. For being able to use this API you have to add a requirement on this API thought the description file of the widget/operator. See the Using Object Storage tutorial for more detailed documentation (and examples) on how to use this API.
A new KeystoneAPI can be instantiated using the following constructor:
urlis the url of the Keystone server
token(String): is the token to used for authenticating request to the Keystone server. (Optional)
use_user_fiware_token(Boolean): make KeystoneAPI to use the token obtained by WireCloud for the current user from the FIWARE's IdM server. Takes precedence over the
use_user_fiware_token options are optional. When passed to the
KeystoneAPI constructor, these values
are stored internally and used as the default value in the invocation of its methods. In any case, these options can
also be passed to the
KeystoneAPI methods for not using the default values.
List all of the tenants in the Keystone server available for the authenticated user.
onSuccess callback will receive the list of tenants as the first argument.
Gets an authentication token that permits access to the Object Storage API.
tenantName(String): The name of the tenant to be associated to the generated token. Both the tenantId and tenantName attributes are optional, but should not be specified together
tenantId(String): The id of the tenant to be associated to the generated token. Both the
tenantNameattributes are optional, but should not be specified together
onSuccess callback will receive auth token info as the first argument.
ObjectStorageAPI can be instantiated using the following constructor:
urlis the url of the Object Storage server
token(String): is the token to use by default for authenticating requests to the Object Storage server
All the method of
ObjectStorageAPI support at least the following option:
token(String): is the token to used for authenticating the request
and the following callbacks:
onSuccessis called when the request finishes successfully. The parameters passed to this callback depends on the invoked method.
onFailureis called when the request finish with errors
onCompleteis called when the request finish regardless of whether the request is successful or not
Creates a container in which other containers and objects can be stored.
containeris the name of the container to create
Returns a list of the contents of a container.
containeris the name of the container to list
Deletes a specified container from the storage system.
containeris the name of the container to delete
Retrieves a specified object from the storage system.
getFile(container, file_name[, options])
containeris the name of the container where the file is
file_nameis the name of the file to download
response_type(String, default: "blob"): Valid values are all the supported by the
responseTypeoption (see the request option section for more details), except ""
Stores a binary object in the specified location.
uploadFile(container, file[, options])
containeris the name of the container where the file is going to be uploaded
fileis the content to be uploaded. Must be an instance of
file_name: name to use for uploading the file. This option is required when passing a
fileargument. This option is not required when passing a
Fileinstance as the name is obtained from its
nameattribute. Anyway, the name passed with this options has precedence over the
nameattribute of the
Deletes a specified object from the storage system.
deleteFile(container, file_name[, options])
containeris the name of the container where the file is going to be deleted
file_nameis the name of the file to delete