Skip to main content

networks

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

Overview

Namenetworks
TypeResource
Idgoogle.compute.networks

Fields

NameDatatypeDescription
idstring[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.
descriptionstringAn optional description of this resource. Provide this field when you create the resource.
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.
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.
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.
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.
mtuintegerMaximum 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.
peeringsarray[Output Only] A list of network peerings for the resource.
routingConfigobjectA routing configuration attached to a network resource. The message includes the list of routers associated with the network, and a flag indicating the type of routing behavior to enforce network-wide.
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

NameAccessible byRequired ParamsDescription
getSELECTnetwork, projectReturns the specified network.
listSELECTprojectRetrieves the list of networks available to the specified project.
insertINSERTprojectCreates a network in the specified project using the data included in the request.
deleteDELETEnetwork, projectDeletes the specified network.
patchUPDATEnetwork, projectPatches the specified network with the data included in the request. Only routingConfig can be modified.
switch_to_custom_modeEXECnetwork, projectSwitches the network mode from auto subnet mode to custom subnet mode.

SELECT examples

Retrieves the list of networks available to the specified project.

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

INSERT example

Use the following StackQL query and manifest file to create a new networks resource.

/*+ create */
INSERT INTO google.compute.networks (
project,
name,
description,
IPv4Range,
gatewayIPv4,
autoCreateSubnetworks,
subnetworks,
peerings,
routingConfig,
mtu,
firewallPolicy,
networkFirewallPolicyEnforcementOrder,
enableUlaInternalIpv6,
internalIpv6Range
)
SELECT
'{{ project }}',
'{{ name }}',
'{{ description }}',
'{{ IPv4Range }}',
'{{ gatewayIPv4 }}',
{{ autoCreateSubnetworks }},
'{{ subnetworks }}',
'{{ peerings }}',
'{{ routingConfig }}',
'{{ mtu }}',
'{{ firewallPolicy }}',
'{{ networkFirewallPolicyEnforcementOrder }}',
{{ enableUlaInternalIpv6 }},
'{{ internalIpv6Range }}'
;

UPDATE example

Updates a networks resource.

/*+ update */
UPDATE google.compute.networks
SET
name = '{{ name }}',
description = '{{ description }}',
IPv4Range = '{{ IPv4Range }}',
gatewayIPv4 = '{{ gatewayIPv4 }}',
autoCreateSubnetworks = true|false,
subnetworks = '{{ subnetworks }}',
peerings = '{{ peerings }}',
routingConfig = '{{ routingConfig }}',
mtu = '{{ mtu }}',
firewallPolicy = '{{ firewallPolicy }}',
networkFirewallPolicyEnforcementOrder = '{{ networkFirewallPolicyEnforcementOrder }}',
enableUlaInternalIpv6 = true|false,
internalIpv6Range = '{{ internalIpv6Range }}'
WHERE
network = '{{ network }}'
AND project = '{{ project }}';

DELETE example

Deletes the specified networks resource.

/*+ delete */
DELETE FROM google.compute.networks
WHERE network = '{{ network }}'
AND project = '{{ project }}';