Yandex Cloud
  • Services
  • Solutions
  • Why Yandex Cloud
  • Pricing
  • Documentation
  • Contact us
Get started
Language / Region
© 2022 Yandex.Cloud LLC
Yandex Virtual Private Cloud
  • Getting started
  • Step-by-step instructions
    • All instructions
    • Cloud network
      • Creating a cloud network
      • Deleting a cloud network
      • Updating a cloud network
    • Subnet
      • Creating a subnet
      • Deleting a subnet
      • Updating a subnet
      • Viewing a list of used addresses
    • IP address
      • Reserving a static public IP address
      • Making a dynamic public IP address static
      • Making a static public IP address dynamic
      • Deleting a static public IP address
    • Static routing
      • Creating a static route
      • Enabling NAT to the internet
    • Security groups
      • Create a security group
      • Update a security group and rules
      • Delete a security group
    • Enable a software-accelerated network
    • Protection from DDoS attacks
      • Enable protection from DDoS attacks
  • Practical guidelines
    • Architecture and protection of a basic internet service
    • DHCP settings for working with a corporate DNS server
  • Concepts
    • Relationship between service resources
    • Cloud networks and subnets
    • Cloud resource addresses
    • Static routes
    • Security groups
    • Public IP address ranges
    • MTU and MSS
    • DHCP settings
    • Software-accelerated network
    • Quotas and limits
  • DDoS Protection
  • Recommendations
    • Using public IP addresses
  • Access management
  • Pricing policy
    • Current pricing policy
    • Archive
      • Before January 1, 2019
  • API reference
    • Authentication in the API
    • REST
      • Overview
      • Address
        • Overview
        • create
        • delete
        • get
        • getByValue
        • list
        • listOperations
        • move
        • update
      • Gateway
        • Overview
        • create
        • delete
        • get
        • list
        • listOperations
        • move
        • update
      • Network
        • Overview
        • create
        • delete
        • get
        • list
        • listOperations
        • listRouteTables
        • listSecurityGroups
        • listSubnets
        • move
        • update
      • RouteTable
        • Overview
        • create
        • delete
        • get
        • list
        • listOperations
        • move
        • update
      • SecurityGroup
        • Overview
        • create
        • delete
        • get
        • list
        • listOperations
        • move
        • update
        • updateRule
        • updateRules
      • Subnet
        • Overview
        • addCidrBlocks
        • create
        • delete
        • get
        • list
        • listOperations
        • move
        • removeCidrBlocks
        • update
      • Operation
        • Overview
        • get
    • gRPC
      • Overview
      • AddressService
      • GatewayService
      • NetworkService
      • RouteTableService
      • SecurityGroupService
      • SubnetService
      • OperationService
  • Questions and answers
  1. API reference
  2. gRPC
  3. NetworkService

NetworkService

Written by
Yandex Cloud
  • Calls NetworkService
  • Get
    • GetNetworkRequest
    • Network
  • List
    • ListNetworksRequest
    • ListNetworksResponse
    • Network
  • Create
    • CreateNetworkRequest
    • Operation
    • CreateNetworkMetadata
    • Network
  • Update
    • UpdateNetworkRequest
    • Operation
    • UpdateNetworkMetadata
    • Network
  • Delete
    • DeleteNetworkRequest
    • Operation
    • DeleteNetworkMetadata
  • ListSubnets
    • ListNetworkSubnetsRequest
    • ListNetworkSubnetsResponse
    • Subnet
    • DhcpOptions
  • ListSecurityGroups
    • ListNetworkSecurityGroupsRequest
    • ListNetworkSecurityGroupsResponse
    • SecurityGroup
    • SecurityGroupRule
    • PortRange
    • CidrBlocks
  • ListRouteTables
    • ListNetworkRouteTablesRequest
    • ListNetworkRouteTablesResponse
    • RouteTable
    • StaticRoute
  • ListOperations
    • ListNetworkOperationsRequest
    • ListNetworkOperationsResponse
    • Operation
  • Move
    • MoveNetworkRequest
    • Operation
    • MoveNetworkMetadata
    • Network

A set of methods for managing Network resources.

Call Description
Get Returns the specified Network resource.
List Retrieves the list of Network resources in the specified folder.
Create Creates a network in the specified folder using the data specified in the request.
Update Updates the specified network.
Delete Deletes the specified network.
ListSubnets Lists subnets from the specified network.
ListSecurityGroups Lists security groups from the specified network.
ListRouteTables Lists route tables from the specified network.
ListOperations Lists operations for the specified network.
Move Move network to another folder.

Calls NetworkService

Get

Returns the specified Network resource.
Get the list of available Network resources by making a List request.

rpc Get (GetNetworkRequest) returns (Network)

GetNetworkRequest

Field Description
network_id string
Required. ID of the Network resource to return. To get the network ID, use a NetworkService.List request. The maximum string length in characters is 50.

Network

Field Description
id string
ID of the network.
folder_id string
ID of the folder that the network belongs to.
created_at google.protobuf.Timestamp
Creation timestamp in RFC3339 text format.
name string
Name of the network. The name is unique within the folder. 3-63 characters long.
description string
Optional description of the network. 0-256 characters long.
labels map<string,string>
Resource labels as key:value pairs. Maximum of 64 per resource.
default_security_group_id string
ID of default security group for network.

List

Retrieves the list of Network resources in the specified folder.

rpc List (ListNetworksRequest) returns (ListNetworksResponse)

ListNetworksRequest

Field Description
folder_id string
Required. ID of the folder to list networks in. To get the folder ID, use a yandex.cloud.resourcemanager.v1.FolderService.List request. The maximum string length in characters is 50.
page_size int64
The maximum number of results per page to return. If the number of available results is larger than page_size, the service returns a ListNetworksResponse.next_page_token that can be used to get the next page of results in subsequent list requests. Default value: 100. The maximum value is 1000.
page_token string
Page token. To get the next page of results, set page_token to the ListNetworksResponse.next_page_token returned by a previous list request. The maximum string length in characters is 100.
filter string
A filter expression that filters resources listed in the response. The expression must specify:
  1. The field name. Currently you can use filtering only on the Network.name field.
  2. An = operator.
  3. The value in double quotes ("). Must be 3-63 characters long and match the regular expression [a-z][-a-z0-9]{1,61}[a-z0-9].
The maximum string length in characters is 1000.

ListNetworksResponse

Field Description
networks[] Network
List of Network resources.
next_page_token string
This token allows you to get the next page of results for list requests. If the number of results is larger than ListNetworksRequest.page_size, use the next_page_token as the value for the ListNetworksRequest.page_token query parameter in the next list request. Subsequent list requests will have their own next_page_token to continue paging through the results.

Network

Field Description
id string
ID of the network.
folder_id string
ID of the folder that the network belongs to.
created_at google.protobuf.Timestamp
Creation timestamp in RFC3339 text format.
name string
Name of the network. The name is unique within the folder. 3-63 characters long.
description string
Optional description of the network. 0-256 characters long.
labels map<string,string>
Resource labels as key:value pairs. Maximum of 64 per resource.
default_security_group_id string
ID of default security group for network.

Create

Creates a network in the specified folder using the data specified in the request. Method starts an asynchronous operation that can be cancelled while it is in progress.

rpc Create (CreateNetworkRequest) returns (operation.Operation)

Metadata and response of Operation:

    Operation.metadata:CreateNetworkMetadata

    Operation.response:Network

CreateNetworkRequest

Field Description
folder_id string
Required. ID of the folder for this request to create a network in. To get the folder ID, use a yandex.cloud.resourcemanager.v1.FolderService.List request. The maximum string length in characters is 50.
name string
Name of the network. The name must be unique within the folder. Value must match the regular expression |[a-z][-a-z0-9]{1,61}[a-z0-9].
description string
Description of the network. The maximum string length in characters is 256.
labels map<string,string>
Resource labels as key:value pairs. No more than 64 per resource. The maximum string length in characters for each value is 63. Each value must match the regular expression [-_0-9a-z]*. The string length in characters for each key must be 1-63. Each key must match the regular expression [a-z][-_0-9a-z]*.

Operation

Field Description
id string
ID of the operation.
description string
Description of the operation. 0-256 characters long.
created_at google.protobuf.Timestamp
Creation timestamp.
created_by string
ID of the user or service account who initiated the operation.
modified_at google.protobuf.Timestamp
The time when the Operation resource was last modified.
done bool
If the value is false, it means the operation is still in progress. If true, the operation is completed, and either error or response is available.
metadata google.protobuf.Any<CreateNetworkMetadata>
Service-specific metadata associated with the operation. It typically contains the ID of the target resource that the operation is performed on. Any method that returns a long-running operation should document the metadata type, if any.
result oneof: error or response
The operation result. If done == false and there was no failure detected, neither error nor response is set. If done == false and there was a failure detected, error is set. If done == true, exactly one of error or response is set.
  error google.rpc.Status
The error result of the operation in case of failure or cancellation.
  response google.protobuf.Any<Network>
if operation finished successfully.

CreateNetworkMetadata

Field Description
network_id string
ID of the Network that is being created.

Network

Field Description
id string
ID of the network.
folder_id string
ID of the folder that the network belongs to.
created_at google.protobuf.Timestamp
Creation timestamp in RFC3339 text format.
name string
Name of the network. The name is unique within the folder. 3-63 characters long.
description string
Optional description of the network. 0-256 characters long.
labels map<string,string>
Resource labels as key:value pairs. Maximum of 64 per resource.
default_security_group_id string
ID of default security group for network.

Update

Updates the specified network. Method starts an asynchronous operation that can be cancelled while it is in progress.

rpc Update (UpdateNetworkRequest) returns (operation.Operation)

Metadata and response of Operation:

    Operation.metadata:UpdateNetworkMetadata

    Operation.response:Network

UpdateNetworkRequest

Field Description
network_id string
Required. ID of the Network resource to update. To get the network ID use a NetworkService.List request. The maximum string length in characters is 50.
update_mask google.protobuf.FieldMask
Field mask that specifies which fields of the Network resource are going to be updated.
name string
Name of the network. The name must be unique within the folder. Value must match the regular expression |[a-z][-a-z0-9]{1,61}[a-z0-9].
description string
Description of the network. The maximum string length in characters is 256.
labels map<string,string>
Resource labels as key:value pairs. No more than 64 per resource. The maximum string length in characters for each value is 63. Each value must match the regular expression [-_0-9a-z]*. The string length in characters for each key must be 1-63. Each key must match the regular expression [a-z][-_0-9a-z]*.

Operation

Field Description
id string
ID of the operation.
description string
Description of the operation. 0-256 characters long.
created_at google.protobuf.Timestamp
Creation timestamp.
created_by string
ID of the user or service account who initiated the operation.
modified_at google.protobuf.Timestamp
The time when the Operation resource was last modified.
done bool
If the value is false, it means the operation is still in progress. If true, the operation is completed, and either error or response is available.
metadata google.protobuf.Any<UpdateNetworkMetadata>
Service-specific metadata associated with the operation. It typically contains the ID of the target resource that the operation is performed on. Any method that returns a long-running operation should document the metadata type, if any.
result oneof: error or response
The operation result. If done == false and there was no failure detected, neither error nor response is set. If done == false and there was a failure detected, error is set. If done == true, exactly one of error or response is set.
  error google.rpc.Status
The error result of the operation in case of failure or cancellation.
  response google.protobuf.Any<Network>
if operation finished successfully.

UpdateNetworkMetadata

Field Description
network_id string
ID of the Network resource that is being updated.

Network

Field Description
id string
ID of the network.
folder_id string
ID of the folder that the network belongs to.
created_at google.protobuf.Timestamp
Creation timestamp in RFC3339 text format.
name string
Name of the network. The name is unique within the folder. 3-63 characters long.
description string
Optional description of the network. 0-256 characters long.
labels map<string,string>
Resource labels as key:value pairs. Maximum of 64 per resource.
default_security_group_id string
ID of default security group for network.

Delete

Deletes the specified network.

rpc Delete (DeleteNetworkRequest) returns (operation.Operation)

Metadata and response of Operation:

    Operation.metadata:DeleteNetworkMetadata

    Operation.response:google.protobuf.Empty

DeleteNetworkRequest

Field Description
network_id string
Required. ID of the Network resource to update. To get the network ID, use a NetworkService.List request. The maximum string length in characters is 50.

Operation

Field Description
id string
ID of the operation.
description string
Description of the operation. 0-256 characters long.
created_at google.protobuf.Timestamp
Creation timestamp.
created_by string
ID of the user or service account who initiated the operation.
modified_at google.protobuf.Timestamp
The time when the Operation resource was last modified.
done bool
If the value is false, it means the operation is still in progress. If true, the operation is completed, and either error or response is available.
metadata google.protobuf.Any<DeleteNetworkMetadata>
Service-specific metadata associated with the operation. It typically contains the ID of the target resource that the operation is performed on. Any method that returns a long-running operation should document the metadata type, if any.
result oneof: error or response
The operation result. If done == false and there was no failure detected, neither error nor response is set. If done == false and there was a failure detected, error is set. If done == true, exactly one of error or response is set.
  error google.rpc.Status
The error result of the operation in case of failure or cancellation.
  response google.protobuf.Any<google.protobuf.Empty>
if operation finished successfully.

DeleteNetworkMetadata

Field Description
network_id string
ID of the network that is being deleted.

ListSubnets

Lists subnets from the specified network.

rpc ListSubnets (ListNetworkSubnetsRequest) returns (ListNetworkSubnetsResponse)

ListNetworkSubnetsRequest

Field Description
network_id string
Required. ID of the Network resource to list subnets for. The maximum string length in characters is 50.
page_size int64
The maximum number of results per page that should be returned. If the number of available results is larger than page_size, the service returns a ListNetworkSubnetsResponse.next_page_token that can be used to get the next page of results in subsequent list requests. Default value: 100. The maximum value is 1000.
page_token string
Page token. Set page_token to the ListNetworkSubnetsResponse.next_page_token returned by a previous list request to get the next page of results. The maximum string length in characters is 100.

ListNetworkSubnetsResponse

Field Description
subnets[] Subnet
List of subnets that belong to the network which is specified in the request.
next_page_token string
This token allows you to get the next page of results for list requests. If the number of results is larger than ListNetworkSubnetsRequest.page_size, use the next_page_token as the value for the ListNetworkSubnetsRequest.page_token query parameter in the next list request. Subsequent list requests will have their own next_page_token to continue paging through the results.

Subnet

Field Description
id string
ID of the subnet.
folder_id string
ID of the folder that the subnet belongs to.
created_at google.protobuf.Timestamp
Creation timestamp in RFC3339 text format.
name string
Name of the subnet. The name is unique within the project. 3-63 characters long.
description string
Optional description of the subnet. 0-256 characters long.
labels map<string,string>
Resource labels as key:value pairs. Maximum of 64 per resource.
network_id string
ID of the network the subnet belongs to.
zone_id string
ID of the availability zone where the subnet resides.
v4_cidr_blocks[] string
CIDR block. The range of internal addresses that are defined for this subnet. This field can be set only at Subnet resource creation time and cannot be changed. For example, 10.0.0.0/22 or 192.168.0.0/24. Minimum subnet size is /28, maximum subnet size is /16.
v6_cidr_blocks[] string
IPv6 not available yet.
route_table_id string
ID of route table the subnet is linked to.
dhcp_options DhcpOptions

DhcpOptions

Field Description
domain_name_servers[] string
domain_name string
ntp_servers[] string

ListSecurityGroups

Lists security groups from the specified network.

rpc ListSecurityGroups (ListNetworkSecurityGroupsRequest) returns (ListNetworkSecurityGroupsResponse)

ListNetworkSecurityGroupsRequest

Field Description
network_id string
Required. ID of the Network resource to list security groups for. The maximum string length in characters is 50.
page_size int64
The maximum number of results per page that should be returned. If the number of available results is larger than page_size, the service returns a ListNetworkSecurityGroupsResponse.next_page_token that can be used to get the next page of results in subsequent list requests. Default value: 100. The maximum value is 1000.
page_token string
Page token. Set page_token to the ListNetworkSecurityGroupsResponse.next_page_token returned by a previous list request to get the next page of results. The maximum string length in characters is 100.

ListNetworkSecurityGroupsResponse

Field Description
security_groups[] SecurityGroup
List of security groups that belong to the network which is specified in the request.
next_page_token string
This token allows you to get the next page of results for list requests. If the number of results is larger than ListNetworkSecurityGroupsRequest.page_size, use the next_page_token as the value for the ListNetworkSecurityGroupsRequest.page_token query parameter in the next list request. Subsequent list requests will have their own next_page_token to continue paging through the results.

SecurityGroup

Field Description
id string
folder_id string
created_at google.protobuf.Timestamp
name string
description string
labels map<string,string>
network_id string
status enum Status
  • UPDATING: updating is a long operation because we must update all instances in SG
rules[] SecurityGroupRule
default_for_network bool

SecurityGroupRule

Field Description
id string
description string
labels map<string,string>
direction enum Direction
Required.
ports PortRange
protocol_name string
null value means any protocol values from https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml
protocol_number int64
target oneof: cidr_blocks, security_group_id or predefined_target
  cidr_blocks CidrBlocks
  security_group_id string
  predefined_target string

PortRange

Field Description
from_port int64
Acceptable values are 0 to 65535, inclusive.
to_port int64
Acceptable values are 0 to 65535, inclusive.

CidrBlocks

Field Description
v4_cidr_blocks[] string
v6_cidr_blocks[] string

ListRouteTables

Lists route tables from the specified network.

rpc ListRouteTables (ListNetworkRouteTablesRequest) returns (ListNetworkRouteTablesResponse)

ListNetworkRouteTablesRequest

Field Description
network_id string
Required. ID of the Network resource to list route tables for. The maximum string length in characters is 50.
page_size int64
The maximum number of results per page that should be returned. If the number of available results is larger than page_size, the service returns a ListNetworkRouteTablesResponse.next_page_token that can be used to get the next page of results in subsequent list requests. Default value: 100. The maximum value is 1000.
page_token string
Page token. Set page_token to the ListNetworkRouteTablesResponse.next_page_token returned by a previous list request to get the next page of results. The maximum string length in characters is 100.

ListNetworkRouteTablesResponse

Field Description
route_tables[] RouteTable
List of route tables that belong to the network which is specified in the request.
next_page_token string
This token allows you to get the next page of results for list requests. If the number of results is larger than ListNetworkRouteTablesRequest.page_size, use the next_page_token as the value for the ListNetworkRouteTablesRequest.page_token query parameter in the next list request. Subsequent list requests will have their own next_page_token to continue paging through the results.

RouteTable

Field Description
id string
ID of the route table.
folder_id string
ID of the folder that the route table belongs to.
created_at google.protobuf.Timestamp
Creation timestamp in RFC3339 text format.
name string
Name of the route table. The name is unique within the project. 3-63 characters long.
description string
Optional description of the route table. 0-256 characters long.
labels map<string,string>
Resource labels as key:value pairs. Maximum of 64 per resource.
network_id string
ID of the network the route table belongs to.
static_routes[] StaticRoute
List of static routes.

StaticRoute

Field Description
destination oneof: destination_prefix
  destination_prefix string
Destination subnet in CIDR notation
next_hop oneof: next_hop_address or gateway_id
  next_hop_address string
Next hop IP address
  gateway_id string
Next hop gateway id
labels map<string,string>
Resource labels as key:value pairs. Maximum of 64 per resource.

ListOperations

Lists operations for the specified network.

rpc ListOperations (ListNetworkOperationsRequest) returns (ListNetworkOperationsResponse)

ListNetworkOperationsRequest

Field Description
network_id string
Required. ID of the Network resource to list operations for. The maximum string length in characters is 50.
page_size int64
The maximum number of results per page that should be returned. If the number of available results is larger than page_size, the service returns a ListNetworkOperationsResponse.next_page_token that can be used to get the next page of results in subsequent list requests. Default value: 100. The maximum value is 1000.
page_token string
Page token. To get the next page of results, set page_token to the ListNetworkOperationsResponse.next_page_token returned by a previous list request. The maximum string length in characters is 100.

ListNetworkOperationsResponse

Field Description
operations[] operation.Operation
List of operations for the specified network.
next_page_token string
This token allows you to get the next page of results for list requests. If the number of results is larger than ListNetworkOperationsRequest.page_size, use the next_page_token as the value for the ListNetworkOperationsRequest.page_token query parameter in the next list request. Each subsequent list request will have its own next_page_token to continue paging through the results.

Operation

Field Description
id string
ID of the operation.
description string
Description of the operation. 0-256 characters long.
created_at google.protobuf.Timestamp
Creation timestamp.
created_by string
ID of the user or service account who initiated the operation.
modified_at google.protobuf.Timestamp
The time when the Operation resource was last modified.
done bool
If the value is false, it means the operation is still in progress. If true, the operation is completed, and either error or response is available.
metadata google.protobuf.Any
Service-specific metadata associated with the operation. It typically contains the ID of the target resource that the operation is performed on. Any method that returns a long-running operation should document the metadata type, if any.
result oneof: error or response
The operation result. If done == false and there was no failure detected, neither error nor response is set. If done == false and there was a failure detected, error is set. If done == true, exactly one of error or response is set.
  error google.rpc.Status
The error result of the operation in case of failure or cancellation.
  response google.protobuf.Any
The normal response of the operation in case of success. If the original method returns no data on success, such as Delete, the response is google.protobuf.Empty. If the original method is the standard Create/Update, the response should be the target resource of the operation. Any method that returns a long-running operation should document the response type, if any.

Move

Move network to another folder.

rpc Move (MoveNetworkRequest) returns (operation.Operation)

Metadata and response of Operation:

    Operation.metadata:MoveNetworkMetadata

    Operation.response:Network

MoveNetworkRequest

Field Description
network_id string
Required. ID of the Network resource to move. The maximum string length in characters is 50.
destination_folder_id string
Required. ID of the destination folder. The maximum string length in characters is 50.

Operation

Field Description
id string
ID of the operation.
description string
Description of the operation. 0-256 characters long.
created_at google.protobuf.Timestamp
Creation timestamp.
created_by string
ID of the user or service account who initiated the operation.
modified_at google.protobuf.Timestamp
The time when the Operation resource was last modified.
done bool
If the value is false, it means the operation is still in progress. If true, the operation is completed, and either error or response is available.
metadata google.protobuf.Any<MoveNetworkMetadata>
Service-specific metadata associated with the operation. It typically contains the ID of the target resource that the operation is performed on. Any method that returns a long-running operation should document the metadata type, if any.
result oneof: error or response
The operation result. If done == false and there was no failure detected, neither error nor response is set. If done == false and there was a failure detected, error is set. If done == true, exactly one of error or response is set.
  error google.rpc.Status
The error result of the operation in case of failure or cancellation.
  response google.protobuf.Any<Network>
if operation finished successfully.

MoveNetworkMetadata

Field Description
network_id string
ID of the network that is being moved.

Network

Field Description
id string
ID of the network.
folder_id string
ID of the folder that the network belongs to.
created_at google.protobuf.Timestamp
Creation timestamp in RFC3339 text format.
name string
Name of the network. The name is unique within the folder. 3-63 characters long.
description string
Optional description of the network. 0-256 characters long.
labels map<string,string>
Resource labels as key:value pairs. Maximum of 64 per resource.
default_security_group_id string
ID of default security group for network.

Was the article helpful?

Language / Region
© 2022 Yandex.Cloud LLC
In this article:
  • Calls NetworkService
  • Get
  • GetNetworkRequest
  • Network
  • List
  • ListNetworksRequest
  • ListNetworksResponse
  • Network
  • Create
  • CreateNetworkRequest
  • Operation
  • CreateNetworkMetadata
  • Network
  • Update
  • UpdateNetworkRequest
  • Operation
  • UpdateNetworkMetadata
  • Network
  • Delete
  • DeleteNetworkRequest
  • Operation
  • DeleteNetworkMetadata
  • ListSubnets
  • ListNetworkSubnetsRequest
  • ListNetworkSubnetsResponse
  • Subnet
  • DhcpOptions
  • ListSecurityGroups
  • ListNetworkSecurityGroupsRequest
  • ListNetworkSecurityGroupsResponse
  • SecurityGroup
  • SecurityGroupRule
  • PortRange
  • CidrBlocks
  • ListRouteTables
  • ListNetworkRouteTablesRequest
  • ListNetworkRouteTablesResponse
  • RouteTable
  • StaticRoute
  • ListOperations
  • ListNetworkOperationsRequest
  • ListNetworkOperationsResponse
  • Operation
  • Move
  • MoveNetworkRequest
  • Operation
  • MoveNetworkMetadata
  • Network