Copy File to Cloud API

Use the Qicc_copy_file_to_cloud API to copy a file from the IFS to the cloud. If the file exists it is updated. If the file does not exist it is created.

You cannot use Cloud Storage Solutions to work with files in the /QSYS.LIB file system.

The size of files that you can copy to a resource is determined by the cloud service provider.

Required Parameter Group:
1 Resource name Input Char(10)
2 IFS file name Input Path name structure
3 Cloud file name Input Path name structure
4 User data Input Char(52)
5 Asynchronous flag Input Byte(4)
6 Handle Output Byte(4)
7 Error code I/O Error code structure
Threadsafe: No

Required Parameter Group

Resource name
INPUT; CHAR(10)

Specify the unique name of the resource. The name is between 1 and 10 characters long and must be left-justified and padded with spaces.

IFS file name
INPUT; Path name structure

The path and name of the file to copy to the cloud. In C++ programs, this is the Qlg_Path_Name_T structure. The path must begin with a forward slash (/). You must have Read (*R) authority on the file, and Execute (*X) authority on all directories in the path leading to the file. For example, to copy /home/user/jdoe/file.txt, you must have Execute authority on the home, user, and jdoe directories, and Read authority on file.txt. For information on authorities, see Planning integrated file system security in the IBM Knowledge Center. For information on the path name structure, see Path name format in the IBM Knowledge Center.

Cloud file name
INPUT; Path name structure

The path and name that the file should have in the cloud. In C++ programs, this is the Qlg_Path_Name_T structure. Do not include the container or bucket node specified in the resource. If the path directories do not exist, they are created. With most resources, if you are overwriting an existing file, the directory and file names are case-sensitive. For example if you had already copied the file example above, and then specified dir1/dir2/FILE.txt, Cloud Storage Solutions would create a second file named FILE.txt next to the original file.txt. FTP resources are not case-sensitive when copying to an IFS directory on an IBM i computer. For information on the path name structure, see Path name format in the IBM Knowledge Center.

User data
INPUT; CHAR(52)

Data provided by the caller and passed to the exit programs to help the caller identify which upload completed.

Asynchronous flag
INPUT; BYTE(4)

Specifies whether the copy operation is run in the same job as the command, or run asynchronously in its own separate batch job. When you copy files asynchronously, you do not have to wait for large files to finish copying before running other commands, which can take a long time. You can also use the IBM i facilities to work with asynchronous jobs, for example by scheduling when the job runs.

If zero, the function will wait for the copy to finish before returning to the caller. If non-zero, the function will initiate the copy and return without waiting for the copy to finish.

Handle
OUTPUT; BYTE(4)

An ID that uniquely identifies this file transfer. It will be passed to exit programs that are registered with the Cloud Connect exit point to uniquely identify which file transfer completed.

Error code
I/O; Error code structure

The error code information structure in the ERRC0100 format. For information, see the Error code parameter topic in the IBM Knowledge Center.