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:

Successful response

NameDatatypeDescription
idstring (uint64)[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 with RFC1035. 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?)
IPv4RangestringDeprecated in favor of subnet mode networks. The range of internal addresses that are legal on this network. This range is a CIDR 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 in Auto mode VPC network IP ranges. For custom mode VPC networks, you can add subnets using the subnetworks insert method.
creationTimestampstring[Output Only] Creation timestamp in RFC3339 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. .
firewallPolicystring[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. .
kindstring[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.
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)
peeringsarray[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.
selfLinkWithIdstring[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.
listselectprojectfilter, maxResults, orderBy, pageToken, returnPartialSuccessRetrieves 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.
request_remove_peeringexecproject, networkrequestIdRequests to remove a peering from the specified network. Applicable only for PeeringConnection with update_strategy=CONSENSUS.
switch_to_custom_modeexecproject, networkrequestIdSwitches the network mode from auto subnet mode to custom subnet mode.

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__kind,
data__id,
data__creationTimestamp,
data__name,
data__description,
data__IPv4Range,
data__gatewayIPv4,
data__selfLink,
data__selfLinkWithId,
data__autoCreateSubnetworks,
data__subnetworks,
data__peerings,
data__routingConfig,
data__mtu,
data__firewallPolicy,
data__networkFirewallPolicyEnforcementOrder,
data__enableUlaInternalIpv6,
data__internalIpv6Range,
data__networkProfile,
data__params,
project,
requestId
)
SELECT
'{{ kind }}',
'{{ id }}',
'{{ creationTimestamp }}',
'{{ name }}',
'{{ description }}',
'{{ IPv4Range }}',
'{{ gatewayIPv4 }}',
'{{ selfLink }}',
'{{ selfLinkWithId }}',
{{ autoCreateSubnetworks }},
'{{ subnetworks }}',
'{{ peerings }}',
'{{ routingConfig }}',
{{ mtu }},
'{{ firewallPolicy }}',
'{{ networkFirewallPolicyEnforcementOrder }}',
{{ enableUlaInternalIpv6 }},
'{{ internalIpv6Range }}',
'{{ networkProfile }}',
'{{ params }}',
'{{ project }}',
'{{ requestId }}'
RETURNING
id,
name,
clientOperationId,
creationTimestamp,
description,
endTime,
error,
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__kind = '{{ kind }}',
data__id = '{{ id }}',
data__creationTimestamp = '{{ creationTimestamp }}',
data__name = '{{ name }}',
data__description = '{{ description }}',
data__IPv4Range = '{{ IPv4Range }}',
data__gatewayIPv4 = '{{ gatewayIPv4 }}',
data__selfLink = '{{ selfLink }}',
data__selfLinkWithId = '{{ selfLinkWithId }}',
data__autoCreateSubnetworks = {{ autoCreateSubnetworks }},
data__subnetworks = '{{ subnetworks }}',
data__peerings = '{{ peerings }}',
data__routingConfig = '{{ routingConfig }}',
data__mtu = {{ mtu }},
data__firewallPolicy = '{{ firewallPolicy }}',
data__networkFirewallPolicyEnforcementOrder = '{{ networkFirewallPolicyEnforcementOrder }}',
data__enableUlaInternalIpv6 = {{ enableUlaInternalIpv6 }},
data__internalIpv6Range = '{{ internalIpv6Range }}',
data__networkProfile = '{{ networkProfile }}',
data__params = '{{ params }}'
WHERE
project = '{{ project }}' --required
AND network = '{{ network }}' --required
AND requestId = '{{ requestId}}'
RETURNING
id,
name,
clientOperationId,
creationTimestamp,
description,
endTime,
error,
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

Requests to remove a peering from the specified network. Applicable only for PeeringConnection with update_strategy=CONSENSUS.

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