Bulk copy
Runtime Server Data API allows deploying a single file to the data volume. You can deploy a collection of files organized in a directory structure included in a zip file which gets extracted under data volume. Bulk copy requires a special action header, rs-action: unpack, be included when invoking Data API.
Examples using curl command to deploy a single or a collection of files to the data volume are as following:
- Deploy a single compiled map file to the data volume
under maps
sub-directory:
curl -F “data=@/mydir/mymap.mmc” http://CONTAINER_HOSTNAME:8080/tx-rest/v1/itx/data/maps
- Deploy a collection of files in a zip file under data volume under maps
sub-directory:
curl -F “data=@/mydir/myfiles.zip” -H “rs-action: unpack” “http://CONTAINER_HOSTNAME:8080/tx-rest/v1/itx/data/maps”
If your myfiles.zip has the following directory structure:
hipaa
|- validate.mmc
|- compliance.mmc
|- inputs
|- input1.txt
|- input2.xml
|- config
|- hipaaconfig.txt
All the files in the zip file are extracted under /data/maps volume retaining the same directory structure as it is in the zip file once deployed through the Data API. It is a POST operation to create a single file or multiple files on the data volume. The Data API can be used to transfer a single file or multiple files under any directory level within the data volume.
If secure transport is enabled for the Runtime Server, then http:// should be replaced with https:// in the request URL and the port number should be changed from 8080 to 8443. You can map the default 8080 and 8443 default ports for HTTP and HTTPS with -p command line option for standalone container execution or through Helm Charts deployed under a Kubernetes cluster environment.
Transferring a single file or multiple files to the data volume is required before running a map under Runtime Server container unless the volume is prepopulated with the required files. This feature of copying a single file or multiple files in a zip file to a data volume is helpful to users running maps under cluster environments.
Runtime Server Helm Charts include provisions to enable either Ingress or Route for the Runtime Server to be accessible from external HTTP clients. Port is not mentioned in the URL when using route in OpenShift.
curl -F “data=@/mydir/myfiles.zip” -H “rs-action: unpack” “http://ROUTE_NAME/tx-rest/v1/itx/data/maps”
Executing the example command above results in unpacking the myfles.zip file after it is deployed to the ITX Runtime Server. ITX Runtime Server retains the same directory structure as in the zip file under target directory, /data/maps , while unpacking the contents of the zip file.
There are other ways to copy files to data volume, for example, oc cp command for OpenShift allows copying the file from a local machine to the container by using the pod name and vice-versa. Using Data API provides a consistent and easy to use mechanism for copying single or multiple files to the data volume.