Skip to main content

networks

Creates, updates, deletes, gets or lists a networks resource.

Overview

Namenetworks
TypeResource
Idgoogle.compute.networks

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstring (uint64)Output only. [Output Only] The unique identifier for the resource. This identifier is defined by the server.
namestringName of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply withRFC1035. Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])?. The first character must be a lowercase letter, and all following characters (except for the last character) must be a dash, lowercase letter, or digit. The last character must be a lowercase letter or digit. (pattern: [a-z](?:[-a-z0-9]{0,61}[a-z0-9])?)
IPv4RangestringDeprecated in favor of subnet mode networks. The range of internal addresses that are legal on this network. This range is aCIDR specification, for example:192.168.0.0/16. Provided by the client when the network is created. (pattern: [0-9]{1,3}(?:.[0-9]{1,3}){3}/[0-9]{1,2})
autoCreateSubnetworksbooleanMust be set to create a VPC network. If not set, a legacy network is created. When set to true, the VPC network is created in auto mode. When set to false, the VPC network is created in custom mode. An auto mode VPC network starts with one subnet per region. Each subnet has a predetermined range as described inAuto mode VPC network IP ranges. For custom mode VPC networks, you can add subnets using the subnetworksinsert method.
creationTimestampstringOutput only. [Output Only] Creation timestamp inRFC3339 text format.
descriptionstringAn optional description of this resource. Provide this field when you create the resource.
enableUlaInternalIpv6booleanEnable ULA internal ipv6 on this network. Enabling this feature will assign a /48 from google defined ULA prefix fd20::/20. .
firewallPolicystringOutput only. [Output Only] URL of the firewall policy the network is associated with.
gatewayIPv4string[Output Only] The gateway address for default routing out of the network, selected by Google Cloud. (pattern: [0-9]{1,3}(?:.[0-9]{1,3}){3})
internalIpv6RangestringWhen enabling ula internal ipv6, caller optionally can specify the /48 range they want from the google defined ULA prefix fd20::/20. The input must be a valid /48 ULA IPv6 address and must be within the fd20::/20. Operation will fail if the speficied /48 is already in used by another resource. If the field is not speficied, then a /48 range will be randomly allocated from fd20::/20 and returned via this field. .
kindstringOutput only. [Output Only] Type of the resource. Always compute#network for networks. (default: compute#network)
mtuinteger (int32)Maximum Transmission Unit in bytes. The minimum value for this field is 1300 and the maximum value is 8896. The suggested value is 1500, which is the default MTU used on the Internet, or 8896 if you want to use Jumbo frames. If unspecified, the value defaults to 1460.
networkFirewallPolicyEnforcementOrderstringThe network firewall policy enforcement order. Can be either AFTER_CLASSIC_FIREWALL or BEFORE_CLASSIC_FIREWALL. Defaults to AFTER_CLASSIC_FIREWALL if the field is not specified. (AFTER_CLASSIC_FIREWALL, BEFORE_CLASSIC_FIREWALL)
networkProfilestringA full or partial URL of the network profile to apply to this network. This field can be set only at resource creation time. For example, the following are valid URLs: - https://www.googleapis.com/compute/{api_version}/projects/{project_id}/global/networkProfiles/{network_profile_name} - projects/{project_id}/global/networkProfiles/{network_profile_name}
paramsobjectInput only. [Input Only] Additional params passed with the request, but not persisted as part of resource payload. (id: NetworkParams)
peeringsarrayOutput only. [Output Only] A list of network peerings for the resource.
routingConfigobjectThe network-level routing configuration for this network. Used by Cloud Router to determine what type of network-wide routing behavior to enforce. (id: NetworkRoutingConfig)
selfLinkstring[Output Only] Server-defined URL for the resource.
selfLinkWithIdstringOutput only. [Output Only] Server-defined URL for this resource with the resource id.
subnetworksarray[Output Only] Server-defined fully-qualified URLs for all subnetworks in this VPC network.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectproject, networkReturns the specified network.
listselectprojectreturnPartialSuccess, orderBy, filter, maxResults, pageTokenRetrieves the list of networks available to the specified project.
insertinsertprojectrequestIdCreates a network in the specified project using the data included
in the request.
patchupdateproject, networkrequestIdPatches the specified network with the data included in the request.
Only routingConfig can be modified.
deletedeleteproject, networkrequestIdDeletes the specified network.
cancel_request_remove_peeringexecproject, networkrequestIdCancel requests to remove a peering from the specified network. Applicable
only for PeeringConnection with update_strategy=CONSENSUS. Cancels a
request to remove a peering from the specified network.
switch_to_custom_modeexecproject, networkrequestIdSwitches the network mode from auto subnet mode to custom subnet mode.
request_remove_peeringexecproject, networkrequestIdRequests to remove a peering from the specified network. Applicable only
for PeeringConnection with update_strategy=CONSENSUS.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
networkstring
projectstring
filterstring
maxResultsinteger (uint32)
orderBystring
pageTokenstring
requestIdstring
returnPartialSuccessboolean

SELECT examples

Returns the specified network.

SELECT
id,
name,
IPv4Range,
autoCreateSubnetworks,
creationTimestamp,
description,
enableUlaInternalIpv6,
firewallPolicy,
gatewayIPv4,
internalIpv6Range,
kind,
mtu,
networkFirewallPolicyEnforcementOrder,
networkProfile,
params,
peerings,
routingConfig,
selfLink,
selfLinkWithId,
subnetworks
FROM google.compute.networks
WHERE project = '{{ project }}' -- required
AND network = '{{ network }}' -- required
;

INSERT examples

Creates a network in the specified project using the data included
in the request.

INSERT INTO google.compute.networks (
data__routingConfig,
data__networkProfile,
data__networkFirewallPolicyEnforcementOrder,
data__gatewayIPv4,
data__enableUlaInternalIpv6,
data__IPv4Range,
data__subnetworks,
data__name,
data__autoCreateSubnetworks,
data__params,
data__internalIpv6Range,
data__description,
data__mtu,
data__selfLink,
project,
requestId
)
SELECT
'{{ routingConfig }}',
'{{ networkProfile }}',
'{{ networkFirewallPolicyEnforcementOrder }}',
'{{ gatewayIPv4 }}',
{{ enableUlaInternalIpv6 }},
'{{ IPv4Range }}',
'{{ subnetworks }}',
'{{ name }}',
{{ autoCreateSubnetworks }},
'{{ params }}',
'{{ internalIpv6Range }}',
'{{ description }}',
{{ mtu }},
'{{ selfLink }}',
'{{ project }}',
'{{ requestId }}'
RETURNING
id,
name,
clientOperationId,
creationTimestamp,
description,
endTime,
error,
getVersionOperationMetadata,
httpErrorMessage,
httpErrorStatusCode,
insertTime,
instancesBulkInsertOperationMetadata,
kind,
operationGroupId,
operationType,
progress,
region,
selfLink,
setCommonInstanceMetadataOperationMetadata,
startTime,
status,
statusMessage,
targetId,
targetLink,
user,
warnings,
zone
;

UPDATE examples

Patches the specified network with the data included in the request.
Only routingConfig can be modified.

UPDATE google.compute.networks
SET
data__routingConfig = '{{ routingConfig }}',
data__networkProfile = '{{ networkProfile }}',
data__networkFirewallPolicyEnforcementOrder = '{{ networkFirewallPolicyEnforcementOrder }}',
data__gatewayIPv4 = '{{ gatewayIPv4 }}',
data__enableUlaInternalIpv6 = {{ enableUlaInternalIpv6 }},
data__IPv4Range = '{{ IPv4Range }}',
data__subnetworks = '{{ subnetworks }}',
data__name = '{{ name }}',
data__autoCreateSubnetworks = {{ autoCreateSubnetworks }},
data__params = '{{ params }}',
data__internalIpv6Range = '{{ internalIpv6Range }}',
data__description = '{{ description }}',
data__mtu = {{ mtu }},
data__selfLink = '{{ selfLink }}'
WHERE
project = '{{ project }}' --required
AND network = '{{ network }}' --required
AND requestId = '{{ requestId}}'
RETURNING
id,
name,
clientOperationId,
creationTimestamp,
description,
endTime,
error,
getVersionOperationMetadata,
httpErrorMessage,
httpErrorStatusCode,
insertTime,
instancesBulkInsertOperationMetadata,
kind,
operationGroupId,
operationType,
progress,
region,
selfLink,
setCommonInstanceMetadataOperationMetadata,
startTime,
status,
statusMessage,
targetId,
targetLink,
user,
warnings,
zone;

DELETE examples

Deletes the specified network.

DELETE FROM google.compute.networks
WHERE project = '{{ project }}' --required
AND network = '{{ network }}' --required
AND requestId = '{{ requestId }}'
;

Lifecycle Methods

Cancel requests to remove a peering from the specified network. Applicable
only for PeeringConnection with update_strategy=CONSENSUS. Cancels a
request to remove a peering from the specified network.

EXEC google.compute.networks.cancel_request_remove_peering
@project='{{ project }}' --required,
@network='{{ network }}' --required,
@requestId='{{ requestId }}'
@@json=
'{
"name": "{{ name }}"
}'
;