Updated on 2024-06-13 GMT+08:00

Updating a Network Resource

Function

This API is used to update a specified network resource.

URI

PATCH /v1/{project_id}/networks/{network_name}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

network_name

Yes

String

Network resource name.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Application/merge-patch + JSON.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

metadata

No

NetworkMetadataUpdate object

Updated network resource metadata.

spec

No

NetworkSpecUpdate object

Updated network resource description.

Table 4 NetworkMetadataUpdate

Parameter

Mandatory

Type

Description

annotations

No

NetworkMetadataAnnotations object

Resource annotations.

labels

No

NetworkUpdateLabels object

Labels of network resources

Table 5 NetworkMetadataAnnotations

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: !<>=&"'

Minimum: 0

Maximum: 100

Table 6 NetworkUpdateLabels

Parameter

Mandatory

Type

Description

os.modelarts/workspace.id

No

String

ID of the workspace to which network belongs

Table 7 NetworkSpecUpdate

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.

Table 8 NetworkConnection

Parameter

Mandatory

Type

Description

peerConnectionList

No

Array of peerConnectionList objects

Peering connections

sfsTurboConnectionList

No

Array of sfsTurboConnectionList objects

SFS Turbo connections through attached NICs

Table 9 peerConnectionList

Parameter

Mandatory

Type

Description

peerVpcId

Yes

String

VPC ID of the peer end

peerSubnetId

Yes

String

Subnet ID of the peer end

Table 10 sfsTurboConnectionList

Parameter

Mandatory

Type

Description

sfsId

Yes

String

ID of an SFS Turbo instance

name

Yes

String

Name of an SFS Turbo instance

Response Parameters

Status code: 200

Table 11 Response body parameters

Parameter

Type

Description

apiVersion

String

API version. Options:

  • v1

kind

String

Resource type. Options:

  • Network

metadata

NeworkMetadata object

Metadata of network resources.

spec

NetworkSpec object

Description of network resources.

status

NetworkStatus object

Status of network resources.

Table 12 NeworkMetadata

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.

Table 13 NetworkMetadataLabels

Parameter

Type

Description

os.modelarts/name

String

Specified network name.

Minimum: 4

Maximum: 32

Table 14 NetworkMetadataAnnotations

Parameter

Type

Description

os.modelarts/description

String

Network resource description, which is used to describe a scenario. The following special characters are not allowed: !<>=&"'

Minimum: 0

Maximum: 100

Table 15 NetworkSpec

Parameter

Type

Description

ipv6enable

Boolean

Whether to enable IPv6. Once IPv6 is enabled, it cannot be disabled.

cidr

String

Network CIDR. Value range:

  • 172.16.0.0/12-172.16.0.0/24

  • 192.168.0.0/16-192.168.0.0/24

connection

NetworkConnection object

Automatically interconnected endpoint.

Table 16 NetworkConnection

Parameter

Type

Description

peerConnectionList

Array of peerConnectionList objects

Peering connections

sfsTurboConnectionList

Array of sfsTurboConnectionList objects

SFS Turbo connections through attached NICs

Table 17 peerConnectionList

Parameter

Type

Description

peerVpcId

String

VPC ID of the peer end

peerSubnetId

String

Subnet ID of the peer end

Table 18 sfsTurboConnectionList

Parameter

Type

Description

sfsId

String

ID of an SFS Turbo instance

name

String

Name of an SFS Turbo instance

Table 19 NetworkStatus

Parameter

Type

Description

phase

String

Current network status. Options:

  • Creating: The network is being created.

  • Active: The network is functional.

  • Abnormal: The network malfunctions.

connectionStatus

NetworkConnectionStatus object

Network connection status.

Table 20 NetworkConnectionStatus

Parameter

Type

Description

peerConnectionStatus

Array of peerConnectionStatus objects

Peering connection status

sfsTurboStatus

Array of sfsTurboStatus objects

Status of SFS Turbo accessible to the network

Table 21 peerConnectionStatus

Parameter

Type

Description

peerVpcId

String

VPC ID of the peer end

peerSubnetId

String

Subnet ID of the peer end

phase

String

Network connection status. Options:

  • Connecting: The network is being connected.

  • Active: The network is connected properly.

  • Abnormal: The network connection is abnormal.

Table 22 sfsTurboStatus

Parameter

Type

Description

sfsId

String

SFS Turbo ID

name

String

SFS Turbo name

status

String

Status of the connection to SFS Turbo. Options:

  • Active: The SFS connection is normal.

  • Abnormal: The SFS connection is abnormal.

  • Creating: The SFS connection is being set up.

  • Deleting: The SFS connection is being deleted.

ipAddr

String

SFS Turbo access address

connectionType

String

Connection type. Options:

  • VpcPort: passthrough through attached NICs

  • Peering: connection through VPC peering

Status code: 400

Table 23 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 404

Table 24 Response body parameters

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" : "03e4f4d7-fc62-409b-9c52-df885525e30b",
        "peerSubnetId" : "42aeebc3-f7c7-45aa-b884-e6e9ac2f841d"
      } ],
      "sfsTurboConnectionList" : [ {
        "sfsId" : "97beb2bb-1a5b-41dd-b7fb-65a9c7954517",
        "name" : "mulVpc-02"
      } ]
    }
  }
}

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" : {
      "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.