In [1]:
import StringIO
from qumulo.rest_client import RestClient

In [2]:
# login to the API
rc = RestClient("<qumulo-cluster>", 8000)
rc.login("<qumulo-user>", "<qumulo-password>");

Create a file


In [3]:
file_meta = rc.fs.create_file(dir_path = "/", name="test-file.txt")

Write 'Test ' to the new file 10 times


In [4]:
file_data = StringIO.StringIO()
file_data.write("Test " * 10)
file_meta = rc.fs.write_file(id_ = file_meta["id"], data_file = file_data)
file_data.close()

Read data from file


In [5]:
file_data = StringIO.StringIO()
rc.fs.read_file(id_ = file_meta["id"], file_ = file_data)
print(file_data.getvalue())


Test Test Test Test Test Test Test Test Test Test 

Delete file


In [6]:
rc.fs.delete(id_ = file_meta["id"])

In [ ]: