Updated on 2026-10-22 GMT+08:00

Creating a VPN Access Policy

Function

This API is used to create an access policy on a specified VPN server.

Calling Method

For details, see Calling APIs.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

Action

Access Level

Resource Type (*: required)

Condition Key

Alias

Dependencies

vpn:p2cVpnGateway:createAccessPolicy

write

p2cVpnGateway

g:ResourceTag/<tag-key>

-

-

URI

POST /v5/{project_id}/p2c-vpn-gateways/vpn-servers/{vpn_server_id}/access-policies

Table 1 Parameter description

Parameter

Type

Mandatory

Description

project_id

String

Yes

Specifies a project ID. You can obtain the project ID by referring to Obtaining the Project ID.

vpn_server_id

String

Yes

Specifies the ID of a VPN server.

Table 2 Parameters in the request header

Parameter

Type

Mandatory

Description

X-Client-Token

String

No

  • Specifies the ID of an idempotent request.
  • The value is a UUID containing 36 characters.

Request

  • Request parameters
    Table 3 Request parameters

    Parameter

    Type

    Mandatory

    Description

    access_policy

    CreateVpnAccessPolicyRequestBodyContent object

    Yes

    Specifies the to-be-created VPN access policy object.

    Table 4 CreateVpnAccessPolicyRequestBodyContent

    Parameter

    Type

    Mandatory

    Description

    name

    String

    Yes

    • Specifies the name of an access policy.

    user_group_id

    String

    Yes

    • Specifies the ID of a VPN user group.
    • The value is a UUID containing 36 characters.

    description

    String

    No

    Specifies access policy description.

    dest_ip_cidrs

    Array of strings

    Yes

    • Specifies the list of destination CIDR blocks.
    • The value is in the format of dotted decimal notation/mask, for example, 192.168.1.0/24.
    • There must be at least one CIDR block. A maximum of 10 CIDR blocks are supported.
    • Example request
      POST https://{Endpoint}/v5/{project_id}/p2c-vpn-gateways/vpn-servers/{vpn_server_id}/access-policies
      
      {
          "access_policy": {
              "name": "policy-001",
              "user_group_id": "7625fd92-2e20-4e4d-8c56-66f110fbfaa8",
              "description": "AccessPolicy1",
              "dest_ip_cidrs": [
                "172.16.0.0/24",
                "172.16.1.0/24"
              ]
          }
      }

Response

  • Response parameters

    Returned status code 201: successful operation

    Table 5 Parameters in the response body

    Parameter

    Type

    Description

    access_policy

    access_policy object

    Specifies the access policy object.

    request_id

    String

    Specifies a request ID.

    Table 6 access_policy

    Parameter

    Type

    Description

    id

    String

    • Specifies the ID of an access policy.
    • The value is a UUID containing 36 characters.
  • Example response
    {
        "access_policy": {
            "id": "4f746482-a575-4e1f-9e80-5f6f69ff8588"
        },
        "request_id": "1663cd8cacbb3497ebc88877e5a3ad89"
    }

Status Codes

For details, see Status Codes.