Creates a rule.

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 CreateAccessRule

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

AccessGroupName String Yes classic-test

The name of the permission group.

SourceCidrIp String Yes 10.0.0.1/32

An IP address or Classless Inter-Domain Routing (CIDR) block for an authorized object. For example, 12.1.1.1 or 13.1.1.1/25.

Note Only IP addresses are available for permission groups of the Classic type.
RWAccessType String No RDWR

The type of permission that you grant to the authorized object to access a file system. Default value: RDWR.

  • RDWR: specified the read/write permission.
  • RDONLY: specified the read-only permission.
UserAccessType String No no_squash

The type of permission that you grant to the user of the authorized object to access a file system.

  • no_squash: allows access to a file system from root users.
  • root_squash: denies access to a file system from root users. All root users are treated as nobody users.
  • all_squash: denies access to a file system from all users including root users. All users are treated as nobody users.

The nobody user is created by default on Linux. The user has only the most basic permissions and can access only the open content of servers. This feature offers high security.

Priority Integer No 1

If multiple rules are applied to an authorized object, the rule with the highest priority takes effect.

Valid values: 1 to 100, in which 1 indicates the highest priority.

FileSystemType String No standard

The type of file system.

  • Valid values: standard and extreme.
  • Default value: standard.

Response parameters

Parameter Type Example Description
RequestId String A323836B-5BC6-45A6-8048-60675C23EE2A

The ID of the request.

AccessRuleId String 1

The ID of the rule.

Examples

Sample requests

GET https://nas.cn-hangzhou.aliyuncs.com/?Action=CreatAccessRule
&AccessGroupName=classic-test
&SourceCidrIp=10.0.0.1/8
&<Common request parameters>

Sample success responses

XML format

<CreateAccessRuleResponse>
    <AccessRuleId>1</AccessRuleId>
    <RequestId>A323836B-5BC6-45A6-8048-60675C23EE2A</RequestId>
</CreateAccessRuleResponse>

JSON format

{
  "RequestId": "A323836B-5BC6-45A6-8048-60675C23EE2A",
  "AccessRuleId": "1"
}

Error codes

For a list of error codes, visit the API Error Center.