Cloudian Adapter

Cloudian HyperStore is an Amazon S3 compatible object storage service that is provided by Cloudian Inc. The Cloudian service on Quantum Fabric connects to the specified S3 bucket on a HyperStore, and also performs supported operations, such as uploading and downloading files.

You can use the service in scenarios where you want to store the data for your app (such as archives, website data, or data lakes) on a Cloudian HyperStore.

Configure an object service for Cloudian

To configure an S3 File Storage adapter, follow these steps:

  1. While selecting an endpoint for an object service, from the Endpoint Type list, select Cloudian.
  2. In the Name field, provide a unique name for your service.

    NOTE: If you have an existing service with the same name, you can select a different Version for the service.

  3. Under Connection Parameters, provide the following details.
    FieldsDescription
    Upload Type

    The type of data that you want to upload to the HyperStore.

    This parameter is optional.

    Access Key

    The access key ID of the Cloudian HyperStore.

    Access SecretThe secret access key of the Cloudian HyperStore.
    Backend URLThe URL of the service endpoint the Cloudian HyperStore.
    RegionThe region code of the service endpoint.
    Bucket PathThe path of the bucket that you want to use on the Cloudian HyperStore.
    Service NamespaceThe namespace of the resource that you want to use on the Cloudian HyperStore.
    Advanced Settings

    Additional settings that are configured for the Cloudian HyperStore.

    This parameter is optional.

  4. NOTE:
    Options in the Advanced section are optional.

  5. Enter the Description for the service.
  6. Click SAVE to save your service definition.

Cloudian Operations

After you create an object service for the Cloudian, Quantum Fabric creates a default object for the service. Fabric also creates operations for the service.

The operations are REST APIs that are mapped to back-end methods, such as GET and CREATE. For more information about these operations, refer to File Storage Adapter APIs.

You can invoke the operations from a Quantum Visualizer project by using the Quantum Fabric SDKs. For example, to upload an image file from the client app to the S3 bucket on the Cloudian HyperStore, you can use the following code:

//Function to upload a file to the bucket
function uploadFile()
{
	currentObj = kony.sdk.getCurrentInstance();
	objSvc = currentObj.getObjectService("<Object-Service>", {"access" : "online"});
	
	headers = {};
	headers["Content-Type"] = "application/json";
	
	fileMap = {};
	fileMap["rawBytes"] = kony.convertToBase64(<Form>.<Image-Widget>.rawBytes); 
	
	metadata = {};
	metadata["file_name"] = <Form>.<TextBox-Widget>.text + ".jpg";
	metadata["security_key"] =  <Form>.<TextBox-Widget_Secure>.text;
	metadata["file_namespace"] = "review";
	
	uploadEntityType = "UploadInputTypeRawBytes";
	
	uploadParams = {};
	uploadParams["headers"] = headers;
	uploadParams["metadata"] = metadata;
	uploadParams["file"] = fileMap;
	
	function successCallback(response)
	{
		alert("Upload successful for " + metadata["file_name"] + " : " + JSON.stringify(response));
	}
	
	function failureCallback(error)
	{
		alert("Upload Error " + JSON.stringify(error));
	}

	options =
	{
		disableIntegrityCheck: true
	};
	
	objSvc.getFileStorage().upload(uploadEntityType, uploadParams, successCallback, failureCallback, options);
}

In the code snippet, the rawBytes of the image are fetched from an Image Widget on a form. The rawBytes are then uploaded to the S3 bucket by using the upload API.