Filesystems/{filesystemName}/owner/{path}: PUT

Sets owner for a file or directory.

Availability

Available on all IBM Spectrum Scale™ editions.

Description

The PUT filesystems/filesystemName/owner/path request sets owner for files or directories within a particular file system.

The file and directory ownership can be controlled by Linux commands such as stat and chown. You can use either ID or name of the user or group to define the ownership. If you use both ID and name, the ID takes precedence. Only the user with DataAccess role can change the owner of a file or a non-empty directory. Empty directories can be changed by other roles such as Administrator,ProtocolAdmin, StorageAdmin, and SecurityAdmin.

Request URL

https://<IP address of API server>:<port>/scalemgmt/v2/filesystems/FileSystemName/owner/path
where
filesystems/filesystemName
Specifies the file system to which the file or directory belongs. Required.
owner/path
The path of the file or directory for which you want to set the owner. Required.

Request headers

Accept: application/json

Request parameters

The following parameters can be used in the request URL to customize the request:
Table 1. List of request parameters
Parameter name Description and applicable keywords Required/optional
filesystemName The file system name. You can also use keywords such as :all:, :all_local:, or :all_remote: Required.
path The file path relative to file system's mount point. The path of the file or directory is specified with forward slashes (/). For example: mnt/gpfs0/rest01. The forward slashes in the path are encoded to "%2F" in the request URL. Required.
body Body of the request that contains the required parameters to be passed on to theIBM Spectrum Scale system to perform the requested operation. Required.

Request data

{
                 "path":"Path",
                "user":"User name",
                "uid":"User ID",
                "group":"Group name",
                "gid":"Group ID",
}
For more information about the fields in the following data structures, see the links at the end of this topic.
"path":"Path"
The path of the file or directory.
"user":"User name"
Name of the owner.
"uid":"User ID"
Unique identifier of the owner.
"group":"Group name"
Name of the user group that owns the file or directory.
"gid":"Group ID"
Unique identifier of the user group that owns the file or directory.

Response data

{
      "status": {
          "code":ReturnCode,
          "message":"ReturnMessage"
       },
         "owner": [
               "path":"Path",
                "user":"User name",
                "uid":"User ID",
                "group":"Group name",
                "gid":"Group ID",
          ],
 }
For more information about the fields in the following data structures, see the links at the end of this topic.
"status":
Return status.
"message": "ReturnMessage",
The return message.
"code": ReturnCode
The return code.
"Owner":"Owner details"
"path":"Path"
The path of the file or directory.
"user":"User name"
Name of the owner.
"uid":"User ID"
Unique identifier of the owner.
"group":"Group name"
Name of the user group that owns the file or directory.
"gid":"Group ID"
Unique identifier of the user group that owns the file or directory.

Examples

The following example sets owner for the files and directories of the file system gpfs0.

Request data:
curl -k -u admin:admin001 -X PUT --header 'content-type:application/json' --header 'accept:application/json' 
-d '{
  "path": "/mnt/gpfs0/xaz",
  "user": "testuser55",
  "uid": "1234",
  "group": "mygroup",
  "gid": "4711"
}' "https://198.51.100.1:443/scalemgmt/v2/filesystems/gpfs0/owner/%2Fmnt%2Fgpfs0%2Fxaz"
Response data:
Note: In the JSON data that is returned, the return code indicates whether the command is successful. The response code 200 indicates that the command successfully retrieved the information. Error code 400 represents an invalid request and 500 represents internal server error.
{
  "status": {
    "code": "200",
    "message": "..."
  },
  "job": [
    {
      "result": {},
      "request": {
        "type": "POST",
        "url": "/scalemgmt/v2/filesystems/gpfs0/owner",
        "data": "{ 
          "path": "/mnt/gpfs0/xaz",
          "user": "testuser55",
          "uid": "1234",
          "group": "mygroup",
          "gid": "4711"}"
      },
      "jobId": "12345",
      "submitted": "2016-11-14 10.35.56",
      "completed": "2016-11-14 10.35.56",
      "status": "COMPLETED"
    }
  ]
}