Add a user quota

NAS File Storage REST API v7 Reference

Version
14.7.x
14.6.x
Audience
anonymous
Part Number
MK-92HNAS088-05

Adds a user quota by file system ID.

HTTP request syntax (URI)

POST <base_URI>/v7/storage/filesystems/{id}/user-quota

Parameters

Name Type Required Values Description
id URI_PARAM Y string Either the object ID or the HNAS file system ID
diskUsageThreshold BODY Y object quotaThresholdPercentages object of the disk space to be added to the virtual volume.
fileCountThreshold BODY Y object quotaThresholdPercentages object of the file count to be added to the virtual volume.
logEvent BODY Y boolean Indicates whether to log an event.
userId BODY Y string User can be either a NFS user or a CIFS user. For an NFS user, it can be NFS v2/3 format with its UNIX user ID optionally registered in the HNAS user mappings. For example, if user NFSuser with its UNIX user ID 501 is added to User Mappings, then you can add a user quota with the user named “NFSuser.” For an NFS v4 format, the user must attach its host name in format of user@host (NFSv4User@deb5010-57-75). A CIFS user can be discovered from The Windows Domain Controller or input by an HNAS user. Usually the user is in format of Domain\user, such as BUILTIN\Current User.
virtualServerId BODY N number Virtual server ID where the file system resides. This parameter is ignored, as the virtual server ID can be derived from the filesystem ID. It is maintained for backward compatability.

Return codes

Code Data Description
201 userQuota User quota successfully added
400 No Data Missing or invalid request contents.
404 Error Message Requested resource not found.
500 Error message Error associated with the storage system.
501 No Data Server has not implemented the request operation on the resource.

Any HTTP status code other than 201 indicates that the API did not complete successfully.

Request example of a NFS user

curl -vk -H "X-Api-Key: zrxvSDAv9x.RIP4gkmKarG3beF.or.4Tc2im7oeqYN88C9XPGHxbXC" https://172.17.57.75:8444/v7/storage/filesystems/864553F647F8647D0000000000000000/user-quota -d ‘{"diskUsageThreshold":{"limit":1234567890,"isHard":true,"reset":65,"warning":75,"severe":95}, "fileCountThreshold":{"limit":1000,"isHard":false,"reset":85,"warning":90, "severe":95},"logEvent":true, "userId":"xyz", "virtualServerId":3}’ -X POST

Response example

HTTP/1.1 201 Created
{
                   "userQuota" :
        {
                "filesystemId" : "864553F647F8647D0000000000000000",
                "quota" :
                {
                        "diskUsage" : 0,
                        "diskUsageThreshold" :
                        {
                                "isHard" : true,
                                "limit" : 1234567890,
                                "reset" : 65,
                                "severe" : 95,
                                "warning" : 75
                        },
                        "fileCountThreshold" :
                        {
                                "isHard" : false,
                                "limit" : 1000,
                                "reset" : 85,
                                "severe" : 95,
                                "warning" : 90
                        },
                        "fileUsage" : 0,
                        "logEvent" : true,
                        "targetDomain" : "",
                        "targetName" : "xyz",
                        "targetType" : "USER"
                },
                "virtualServerId" : 3
        }
}

Request example of a CIFS user

curl -vk -H "X-Api-Key: Td5qNSpXX4.732uVwjjuN1Wgmxw7yJwL5nygQk79k6pbVg.wvMFqH2" https://172.27.250.210:8444/v7/storage/filesystems/864553F647F8647D0000000000000000/user-quota -X POST -d’{"diskUsageThreshold": {"limit":1234567890, "isHard":true,"reset":65,"warning":75,"severe":95},"fileCountThreshold":{"limit":1000,"isHard":false,"reset":85,"warning":90,"severe":95}, "userId": "BUILTIN\\current owner","virtualVolumeName":"nickvvol-test1","logEvent":true}’

Response example of a CIFS user

HTTP/1.1 201 Created
{
   "uri" : "https://172.27.250.210:8444/v7/storage/virtual-volumes/323a3a3a41463042464544433143463342434337303030303030303030303030303030303a3a3a323a3a3a303a3a3a4f49445f24232140255f56/user-quotas",
   "userQuota" : {
      "filesystemId" : "AF0BFEDC1CF3BCC70000000000000000",
      "objectId" : "nickvvol-test1",
      "quota" : {
         "diskUsage" : 0,
         "diskUsageThreshold" : {
            "isHard" : true,
            "limit" : 1234567890,
            "reset" : 65,
            "severe" : 95,
            "warning" : 75
         },
         "fileCountThreshold" : {
            "isHard" : false,
            "limit" : 1000,
            "reset" : 85,
            "severe" : 95,
            "warning" : 90
         },
         "fileUsage" : 0,
         "logEvent" : true,
         "targetDomain" : "BUILTIN",
         "targetName" : "Current Owner",
         "targetType" : "USER"
      },
      "userId" : "BUILTIN\\current owner",
      "virtualServerId" : 2,
      "virtualVolumeId" : 2,
      "virtualVolumeName" : "nickvvol-test1"
   }
}