Creates a directory quota for a file system.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes SetDirQuota

The operation that you want to perform. Set the value to SetDirQuota.

FileSystemId String Yes 1ca404****

The ID of the file system.

Path String Yes /data/sub1

The absolute path of a directory.

QuotaType String Yes Accounting

The type of the quota.

Valid values:

  • Accounting: specifies a statistical quota. If you set this parameter to Accounting, NAS calculates only the storage usage of the directory.
  • Enforcement: specifies a restricted quota. If you set this parameter to Enforcement and the storage usage exceeds the quota, you can no longer create files or subdirectories for the directory, or write data to the directory.
UserType String Yes Uid

The type of the user.

Valid values:

  • Uid: user ID
  • Gid: user group ID
  • AllUsers: all users
UserId String No 500

The Uid or Gid of the user for whom you want to set a directory quota.

This parameter is required and valid only if the UserType parameter is set to Uid or Gid.

Examples:

  • If you want to set a directory quota for a user whose UID is 500, set the UserType parameter to Uid and set the UserId parameter to 500.
  • If you want to set a directory quota for a user group whose GID is 100, set the UserType parameter to Gid and set the UserId parameter to 100.
SizeLimit Long No 1024

Limits the size of files that a user can create in the directory.

Unit: GiB.

If you set the QuotaType parameter to Enforcement, you must specify at least one of the SizeLimit and FileCountLimit parameters.

FileCountLimit Long No 10000

Limits the number of files that a user can create in the directory.

This number includes the number of files, subdirectories, and special files.

If you set the QuotaType parameter to Enforcement, you must specify at least one of the SizeLimit and FileCountLimit parameters.

Response parameters

Parameter Type Example Description
RequestId String 5BC5CB97-9F28-42FE-84A4-0CD0DF42****

The ID of the request.

Success Boolean true

Indicates whether the call is successful.

Valid values:

  • true: The call is successful.
  • false: The call fails.

Examples

Sample requests

http(s)://[Endpoint]/?Action=SetDirQuota
&FileSystemId=1ca404****
&Path=/data/sub1
&QuotaType=Accounting
&UserType=Uid
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<RequestId>94CA5264-2C30-4D83-865D-B1CF2BE2****</RequestId>
<Success>true</Success>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "94CA5264-2C30-4D83-865D-B1CF2BE2****",
  "Success" : true
}

Error codes

HTTP status code Error code Error message Description
404 InvalidParameter.DirPathNotExist The Dir Path does not exist The directory path does not exist.

For a list of error codes, see Service error codes.