Creating Network Resources
Function
This API is used to create network resources.
Debugging
You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.
URI
POST /v1/{project_id}/networks
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. For details, see Obtaining a Project ID and Name. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
apiVersion |
Yes |
String |
API version. Options: |
kind |
Yes |
String |
Resource type. Options: |
metadata |
Yes |
NetworkMetadataCreation object |
Metadata of network resources. |
spec |
Yes |
NetworkSpec object |
Description of network resources. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
labels |
Yes |
NetworkMetadataLabels object |
Indicates the label information of a network resource. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
os.modelarts/name |
Yes |
String |
Definition: Display name of a resource pool. Constraints: N/A *Range: The value can contain 4 to 32 characters. It must start with a lowercase letter and cannot end with a hyphen (-). Digits and hyphens (-) are allowed. Default Value: N/A |
os.modelarts/workspace.id |
No |
String |
Definition: Workspace ID. [For details about how to obtain the ID, see Querying the Workspace List. Constraints: N/A Range: N/A Default Value: 0 |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
cidr |
Yes |
String |
Definition: CIDR value of a network. Constraints: N/A Range: Default Value: N/A |
connection |
No |
NetworkConnection object |
Definition: Connection information between the current network and other resources. Constraints: N/A Range: N/A Default Value: N/A |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
peerConnectionList |
No |
Array of peerConnectionList objects |
Definition: Peering connections. Constraints: N/A Range: N/A Default Value: N/A |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
peerVpcId |
Yes |
String |
Definition: Peer network ID. Constraints: N/A Range: N/A Default Value: N/A |
peerSubnetId |
Yes |
String |
Definition: Peer subnet ID. Constraints: N/A Range: N/A Default Value: N/A |
defaultGateWay |
No |
Boolean |
Definition: Specifies whether to create a default route. Constraints: N/A Range: Default Value: false |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
apiVersion |
String |
Definition: API version of a resource. Constraints: N/A Range: Default Value: N/A |
kind |
String |
Definition: Resource type. Constraints: N/A Range: Default Value: N/A |
metadata |
NeworkMetadata object |
Definition: Metadata of a network resource. Constraints: N/A Range: N/A Default Value: N/A |
spec |
NetworkSpec object |
Definition: Specifications of a network resource. Constraints: N/A Range: N/A Default Value: N/A |
status |
NetworkStatus object |
Definition: Status of a network resource. Constraints: N/A Range: N/A Default Value: N/A |
Parameter |
Type |
Description |
---|---|---|
name |
String |
Definition: Network resource ID. Constraints: N/A Range: N/A Default Value: N/A |
creationTimestamp |
String |
Definition: Network creation time. Example: 2025-11-01T03:49:41Z. Constraints: N/A Range: N/A Default Value: N/A |
labels |
NetworkMetadataLabels object |
Definition: Network labels. Constraints: N/A Range: N/A Default Value: N/A |
annotations |
NetworkMetadataAnnotations object |
Definition: Network annotations. Constraints: N/A Range: N/A Default Value: N/A |
Parameter |
Type |
Description |
---|---|---|
os.modelarts/name |
String |
Definition: Display name of a resource pool. Constraints: N/A *Range: The value can contain 4 to 32 characters. It must start with a lowercase letter and cannot end with a hyphen (-). Digits and hyphens (-) are allowed. Default Value: N/A |
os.modelarts/workspace.id |
String |
Definition: Workspace ID. For details about how to obtain the ID, see Querying the Workspace List. Constraints: N/A Range: N/A Default Value: 0 |
Parameter |
Type |
Description |
---|---|---|
os.modelarts/description |
String |
Definition: Network description. Constraints: N/A Range: The value cannot contain these characters: !<>=&"'. Default Value: N/A |
Parameter |
Type |
Description |
---|---|---|
cidr |
String |
Definition: CIDR value of a network. Constraints: N/A Range: Default Value: N/A |
connection |
NetworkConnection object |
Definition: Connection information between the current network and other resources. Constraints: N/A Range: N/A Default Value: N/A |
Parameter |
Type |
Description |
---|---|---|
peerConnectionList |
Array of peerConnectionList objects |
Definition: Peering connections. Constraints: N/A Range: N/A Default Value: N/A |
Parameter |
Type |
Description |
---|---|---|
peerVpcId |
String |
Definition: Peer network ID. Constraints: N/A Range: N/A Default Value: N/A |
peerSubnetId |
String |
Definition: Peer subnet ID. Constraints: N/A Range: N/A Default Value: N/A |
defaultGateWay |
Boolean |
Definition: Specifies whether to create a default route. Constraints: N/A Range: Default Value: false |
Parameter |
Type |
Description |
---|---|---|
phase |
String |
Definition: Current status of a network resource. Constraints: N/A Range: Default Value: N/A |
connectionStatus |
NetworkConnectionStatus object |
Definition: Connection status between the network and other cloud services. Constraints: N/A Range: N/A Default Value: N/A |
Parameter |
Type |
Description |
---|---|---|
peerConnectionStatus |
Array of peerConnectionStatus objects |
Definition: Peering connection statuses Constraints: N/A Range: N/A Default Value: N/A |
sfsTurboStatus |
Array of sfsTurboStatus objects |
Definition: Statuses of network connection to SFS Turbo. Constraints: N/A Range: N/A Default Value: N/A |
Parameter |
Type |
Description |
---|---|---|
peerVpcId |
String |
Definition: Peer network ID. Constraints: N/A Range: N/A Default Value: N/A |
peerSubnetId |
String |
Definition: Peer subnet ID. Constraints: N/A Range: N/A Default Value: N/A |
defaultGateWay |
Boolean |
Definition: Specifies whether to create a default route. Constraints: N/A Range: Default Value: false |
phase |
String |
Definition: Peer connection status. Constraints: N/A Range: Default Value: N/A |
Parameter |
Type |
Description |
---|---|---|
sfsId |
String |
Definition: ID of the connected SFS Turbo file system. Constraints: N/A Range: N/A Default Value: N/A |
name |
String |
Definition: Name of the connected SFS Turbo file system. Constraints: N/A Range: N/A Default Value: N/A |
status |
String |
Definition: Connection status of the SFS Turbo file system. Constraints: N/A Range: Default Value: N/A |
ipAddr |
String |
Definition: Access address of the connected SFS Turbo file system. Constraints: N/A Range: N/A Default Value: N/A |
Status code: 400
Example Requests
The following is an example of how to create a network whose resource type is Network, network name is network-7a03, and CIDR block is 192.168.128.0/17.
POST {endpoint}/v2/{project_id}/pools { "apiVersion" : "v1", "kind" : "Network", "metadata" : { "labels" : { "os.modelarts/name" : "network-7a03", "os.modelarts/workspace.id" : "0" } }, "spec" : { "cidr" : "192.168.128.0/17" } }
Example Responses
Status code: 200
OK
{ "kind" : "Network", "apiVersion" : "v1", "metadata" : { "name" : "network-7a03-86c13962597848eeb29c5861153a391f", "creationTimestamp" : "2022-09-16T09:44:59Z", "labels" : { "os.modelarts/name" : "network-7a03", "os.modelarts/workspace.id" : "0" }, "annotations" : { } }, "spec" : { "cidr" : "192.168.128.0/17", "connection" : { } }, "status" : { "phase" : "" } }
Status code: 400
Bad request.
{ "error_code" : "ModelArts.50004000", "error_msg" : "Bad request." }
Status Codes
Status Code |
Description |
---|---|
200 |
OK |
400 |
Bad request. |
Error Codes
See Error 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