Updating a Network Resource¶
Function¶
This API is used to update a specified network resource.
URI¶
PATCH /v1/{project_id}/networks/{network_name}
Parameter | Mandatory | Type | Description |
---|---|---|---|
project_id | Yes | String | Project ID. For details, see Obtaining a Project ID and Name. |
network_name | Yes | String | Network resource name. |
Request Parameters¶
Parameter | Mandatory | Type | Description |
---|---|---|---|
Content-Type | Yes | String | Application/merge-patch + JSON. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
metadata | No | NetworkMetadataUpdate object | Updated network resource metadata. |
spec | No | NetworkSpecUpdate object | Updated network resource description. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
annotations | No | NetworkMetadataAnnotations object | Resource annotations. |
labels | No | NetworkUpdateLabels object | Labels of network resources |
Parameter | Mandatory | Type | Description |
---|---|---|---|
os.modelarts/description | No | String | Network resource description, which is used to describe a scenario. The following special characters are not allowed: !<>=&"' |
Parameter | Mandatory | Type | Description |
---|---|---|---|
os.modelarts/workspace.id | No | String | ID of the workspace to which network belongs |
Parameter | Mandatory | Type | Description |
---|---|---|---|
ipv6enable | No | Boolean | Whether to enable IPv6. Once IPv6 is enabled, it cannot be disabled. |
connection | No | NetworkConnection object | Updated network connection. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
peerConnectionList | No | Array of PeerConnectionItem objects | Peering connections |
sfsTurboConnectionList | No | Array of SfsTurboConnectionItem objects | SFS Turbo connections through attached NICs |
Parameter | Mandatory | Type | Description |
---|---|---|---|
peerVpcId | Yes | String | VPC ID of the peer end. |
peerSubnetId | Yes | String | Subnet ID of the peer end. |
defaultGateWay | No | Boolean | Whether to create a default route. The default value is false. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
name | Yes | String | Name of an SFS Turbo instance. |
sfsId | Yes | String | ID of an SFS Turbo instance. |
Response Parameters¶
Status code: 200
Parameter | Type | Description |
---|---|---|
apiVersion | String | API version. Options:
|
kind | String | Resource type. Options:
|
metadata | NetworkMetadata object | Metadata of network resources. |
spec | NetworkSpec object | Description of network resources. |
status | NetworkStatus object | Status of network resources. |
Parameter | Type | Description |
---|---|---|
name | String | Automatically generated network name, which is equivalent to networkId. |
creationTimestamp | String | Timestamp, for example, 2021-11-01T03:49:41Z. |
labels | NetworkMetadataLabels object | Labels of network resources. |
annotations | NetworkMetadataAnnotations object | Annotations of network resources. |
Parameter | Type | Description |
---|---|---|
os.modelarts/name | String | Specified network name. |
os.modelarts/workspace.id | String | Workspace ID. The default value is 0. |
Parameter | Type | Description |
---|---|---|
os.modelarts/description | String | Network resource description, which is used to describe a scenario. The following special characters are not allowed: !<>=&"' |
Parameter | Type | Description |
---|---|---|
ipv6enable | Boolean | Whether to enable IPv6. Once IPv6 is enabled, it cannot be disabled. |
cidr | String | Network CIDR. |
connection | NetworkConnection object | Automatically interconnected endpoint. |
Parameter | Type | Description |
---|---|---|
peerConnectionList | Array of PeerConnectionItem objects | Peering connections |
sfsTurboConnectionList | Array of SfsTurboConnectionItem objects | SFS Turbo connections through attached NICs |
Parameter | Type | Description |
---|---|---|
peerVpcId | String | VPC ID of the peer end. |
peerSubnetId | String | Subnet ID of the peer end. |
defaultGateWay | Boolean | Whether to create a default route. The default value is false. |
Parameter | Type | Description |
---|---|---|
name | String | Name of an SFS Turbo instance. |
sfsId | String | ID of an SFS Turbo instance. |
Parameter | Type | Description |
---|---|---|
phase | String | Current network status. Options:
|
connectionStatus | NetworkConnectionStatus object | Network connection status. |
Parameter | Type | Description |
---|---|---|
peerConnectionStatus | Array of PeerConnectionStatus objects | Peering connection status |
sfsTurboStatus | Array of SfsTurboConnectionStatus objects | Status of SFS Turbo accessible to the network |
Parameter | Type | Description |
---|---|---|
peerVpcId | String | VPC ID of the peer end. |
peerSubnetId | String | Subnet ID of the peer end. |
defaultGateWay | Boolean | Whether to create a default route. The default value is false. |
phase | String | Network connection status. The options are as follows:
|
Parameter | Type | Description |
---|---|---|
name | String | Name of an SFS Turbo instance. |
sfsId | String | ID of an SFS Turbo instance. |
connectionType | String | Connection type. The options are as follows:
|
ipAddr | String | SFS Turbo access address. |
status | String | Status of the connection to SFS Turbo. The options are as follows:
|
Status code: 400
Parameter | Type | Description |
---|---|---|
error_code | String | Error code. |
error_msg | String | Error message. |
Status code: 404
Parameter | Type | Description |
---|---|---|
error_code | String | Error code. |
error_msg | String | Error message. |
Example Requests¶
Interconnect with a VPC.
PATCH https://{endpoint}/v1/{project_id}/networks/{network_name} { "spec" : { "connection" : { "peerConnectionList" : [ { "peerVpcId" : "359668f4-fbef-4404-b9bc-781142518d3b", "peerSubnetId" : "8f21dbea-df13-4669-8a17-0efba195997b", "defaultGateWay" : false } ] } } }
Associate SFS Turbo.
PATCH https://{endpoint}/v1/{project_id}/networks/{network_name} { "spec" : { "connection" : { "sfsTurboConnectionList" : [ { "sfsId" : "2a220ce2-936c-4041-8478-c731bf934b11", "name" : "sfs-turbo-a066-bbb" } ] } } }
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"
},
"annotations" : { }
},
"spec" : {
"cidr" : "192.168.128.0/17",
"connection" : {
"peerConnectionList" : [ {
"peerVpcId" : "03e4f4d7-fc62-409b-9c52-df885525e30b",
"peerSubnetId" : "42aeebc3-f7c7-45aa-b884-e6e9ac2f841d"
} ],
"sfsTurboConnectionList" : [ {
"sfsId" : "97beb2bb-1a5b-41dd-b7fb-65a9c7954517",
"name" : "mulVpc-02"
} ]
}
},
"status" : {
"phase" : "Active",
"connectionStatus" : { }
}
}
Status code: 400
Bad request
{
"error_code" : "ModelArts.50004000",
"error_msg" : "Bad request."
}
Status code: 404
Not found.
{
"error_code" : "ModelArts.50025001",
"error_msg" : "Network not exist."
}
Status Codes¶
Status Code | Description |
---|---|
200 | OK |
400 | Bad request |
404 | Not found. |
Error Codes¶
See Error Codes.