k8s_client.views.users.files

Module Contents

Functions

get_user_files([username, filename])

Get user files list

get_user_file_content([username, filename])

Get user file content

get_user_folder_content([username, foldername])

Get user folder content

upload_file_for_user_full([username])

Upload a file for a user

upload_file_part_for_user([username])

Upload a part of a file for a user

delete_file_for_user([username, file_full_path])

Delete a file for an user

delete_folder_for_user([username, file_full_path])

Delete a folder for an user

k8s_client.views.users.files.get_user_files(username=None, filename=None)

Get user files list

Parameters

"username": string

Name of the owner user for which to get the files list

Query line parameters

  • "cluster_uri"string

    Name of the cluster where to look for the files. It corresponds to a folder on the main machine where file are synchronized

  • "relative_path"string, optional

    The relative path from the root folder of the cluster to be used

  • "filename"string

    The name of the file to view the details

  • "foldername"string

    The name of the folder to list the details

Returns

  • [code: 404] Error message if:
    • username is NOT inside the DB

  • [code: 406] Error message if:
    • cluster_uri is NOT provided

  • [code: 200] list [dict], otherwise

    Each dict items contains: - "name" : string

    Name of the item of the dir list

    • "is_dir"boolean

      Indicates if the path refers to a file or to a folder

    • "size"int

      Indicates the size if the item is a file. If the item is a folder it is always 0.

    • "content"int

      Always 0.

    • "creation_time"datetime

      Datetime of file/folder creation

    • "modified_time"datetime

      Datetime of file/folder update

k8s_client.views.users.files.get_user_file_content(username=None, filename=None)

Get user file content

Parameters

"username": string

Name of the owner user for which to get the file content

Query line parameters

  • "cluster_uri"string

    Name of the cluster from where download the files content It corresponds to a folder on the main machine where file are synchronized

  • "relative_path"string, optional

    The relative path from the root folder of the cluster to be used

  • "filename"string

    The name of the file to download

Returns

  • [code: 404] Error message if:
    • username is NOT inside the DB

    • The file has not been found

  • [code: 406] Error message if:
    • cluster_uri is NOT provided

    • relative_path is NOT provided

    • filename is NOT provided or contains not allowed chars

  • [code: 200] bytes otherwise

    the content of the file

k8s_client.views.users.files.get_user_folder_content(username=None, foldername=None)

Get user folder content

Parameters

"username": string

Name of the owner user

Query line parameters

  • "cluster_uri"string

    Name of the cluster from where download the folder. It corresponds to a folder on the main machine where file are synchronized

  • "relative_path"string, optional

    The relative path from the root folder of the cluster to be used

  • "foldername"string

    The name of the folder to download

Returns

  • [code: 404] Error message if:
    • username is NOT inside the DB

  • [code: 406] Error message if:
    • cluster_uri is NOT provided

    • relative_path is NOT provided

    • foldername is NOT provided or contains not allowed chars

  • [code: 200] bytes otherwise

    the zipped content of the folder

k8s_client.views.users.files.upload_file_for_user_full(username=None)

Upload a file for a user

NOT USED

k8s_client.views.users.files.upload_file_part_for_user(username=None)

Upload a part of a file for a user

Parameters

"username": string

Name of the owner user

Body payload parameters

The endpoint is used for 3 cases:

1) speed-test "command" : speed-test "data" : blob

Data to be sent

"cluster-uri"string

Name of the cluster on which upload the data

2) Upload part "command" : upload-part "relative-path" : string

The path where to upload the file

"file-name"string

Name of the uploading file

"chunk-number": int

Counter of the chunk to be uploaded

"chunk-size"int

Size of the chunk

"chunk-data"blob

Data to be sent

"cluster-uri"string

Name of the cluster on which upload the data

3) Join parts "command" : join-parts "relative-path" : string

The path where to upload the file

"file-name"string

Name of the uploading file

"chunks-count": int

Total number the uploaded chunks

"cluster-uri"string

Name of the cluster on which upload the data

Returns

  • [code: 404] Error message if:
    • username is NOT inside the DB

  • [code: 406] Error message if:
    • cluster_uri is NOT provided

    • relative_path is NOT provided

  • [code: 200] list otherwise

    The result of the command

k8s_client.views.users.files.delete_file_for_user(username=None, file_full_path=None)

Delete a file for an user

Parameters

"username": string

Name of the owner user

Query line parameters

  • "cluster_uri"string

    Name of the cluster from where delete the file. It corresponds to a folder on the main machine where file are synchronized

  • "file_full_path"string

    The full relative path of the file to delete

Returns

  • [code: 404] Error message if:
    • username is NOT inside the DB

  • [code: 406] Error message if:
    • cluster_uri is NOT provided

    • file_full_path is NOT provided

  • [code: 200] list otherwise

    Deleted file

k8s_client.views.users.files.delete_folder_for_user(username=None, file_full_path=None)

Delete a folder for an user

Parameters

"username": string

Name of the owner user

Query line parameters

  • "cluster_uri"string

    Name of the cluster from where delete. It corresponds to a folder on the main machine where file are synchronized

  • "file_full_path"string

    The full relative path of the folder to delete

Returns

  • [code: 404] Error message if:
    • username is NOT inside the DB

  • [code: 406] Error message if:
    • cluster_uri is NOT provided

    • file_full_path is NOT provided

  • [code: 200] list otherwise

    Deleted folder