Creating a VPN User
Function
This API is used to create a VPN user on a specified VPN server.
Calling Method
For details, see Calling APIs.
URI
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. |
Parameter |
Type |
Mandatory |
Description |
---|---|---|---|
X-Client-Token |
String |
No |
|
Request
- Request parameters
Table 3 Request parameters Parameter
Type
Mandatory
Description
user
Yes
Specifies the to-be-created VPN user object.
Table 4 CreateVpnUserRequestBodyContent Parameter
Type
Mandatory
Description
name
String
Yes
- Specifies a username.
- The value is a string of 4 to 32 characters, which can contain letters, digits, periods (.), underscores (_), and hyphens (-)
password
String
Yes
- Specifies a password for the user.
- Constraints:
- The value contains 8 to 32 characters.
- The value must contain at least two types of the following characters: uppercase letters, lowercase letters, digits, and special characters including `~!@#$%^&*()-_=+\|[{}];:'",<.>/? and spaces.
- The password cannot be the username or the reverse of the username.
description
String
No
- Specifies user description.
- The value is a string of 0 to 64 characters, which can contain letters, digits, and underscores (_).
user_group_id
String
No
- Specifies the ID of the user group to which the user belongs.
- The value is a UUID containing 36 characters.
static_ip
String
No
- Specifies the static IP address of a client.
- The value is an IPv4 address in dotted decimal notation (for example, 192.168.0.5) or disable.
- The default value is disable, indicating that a client IP address is randomly allocated.
- Constraints:
- The value must be within the client CIDR block.
- The value cannot be the gateway IP address of the client CIDR block. For example, if the client CIDR block is 192.168.0.0/24, 192.168.0.1 cannot be configured as a client address.
- The value must be the first host address in a CIDR block with a 30-bit mask. For example, for the CIDR block 192.168.10.4/30 with four IP addresses, you can only specify 192.168.10.5 as a client address.
- The value cannot be the same as the IP address of another user.
- Example request
POST https://{Endpoint}/v5/{project_id}/p2c-vpn-gateways/vpn-servers/{vpn_server_id}/users { "user": { "name": "user001", "password": "******", "description": "UserDescription1", "user_group_id": "yWYnJt0R-Q0a7-R4QW-tFXX-QfundEqrR27W" } }
Response
- Response parameters
Returned status code 201: successful operation
Table 5 Parameters in the response body Parameter
Type
Description
user
user object
Specifies the VPN user object.
request_id
String
Specifies a request ID.
- Example response
{ "user": { "id": "41ad472e-d3e4-482b-8f00-7b2c1bfc4b7d" }, "request_id": "b19ba5a0be8f7b7f664b14596f8f35db" }
Status Codes
For details, see Status Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot