networks
Creates, updates, deletes, gets or lists a networks resource.
Overview
| Name | networks |
| Type | Resource |
| Id | google.compute.networks |
Fields
The following fields are returned by SELECT queries:
- get
- list
| Name | Datatype | Description |
|---|---|---|
id | string (uint64) | Output only. [Output Only] The unique identifier for the resource. This identifier is defined by the server. |
name | string | Name 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])?) |
IPv4Range | string | Deprecated 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}) |
autoCreateSubnetworks | boolean | Must 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. |
creationTimestamp | string | Output only. [Output Only] Creation timestamp inRFC3339 text format. |
description | string | An optional description of this resource. Provide this field when you create the resource. |
enableUlaInternalIpv6 | boolean | Enable ULA internal ipv6 on this network. Enabling this feature will assign a /48 from google defined ULA prefix fd20::/20. . |
firewallPolicy | string | Output only. [Output Only] URL of the firewall policy the network is associated with. |
gatewayIPv4 | string | [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}) |
internalIpv6Range | string | When 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. . |
kind | string | Output only. [Output Only] Type of the resource. Always compute#network for networks. (default: compute#network) |
mtu | integer (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. |
networkFirewallPolicyEnforcementOrder | string | The 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) |
networkProfile | string | A 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} |
params | object | Input only. [Input Only] Additional params passed with the request, but not persisted as part of resource payload. (id: NetworkParams) |
peerings | array | Output only. [Output Only] A list of network peerings for the resource. |
routingConfig | object | The network-level routing configuration for this network. Used by Cloud Router to determine what type of network-wide routing behavior to enforce. (id: NetworkRoutingConfig) |
selfLink | string | [Output Only] Server-defined URL for the resource. |
selfLinkWithId | string | Output only. [Output Only] Server-defined URL for this resource with the resource id. |
subnetworks | array | [Output Only] Server-defined fully-qualified URLs for all subnetworks in this VPC network. |
| Name | Datatype | Description |
|---|---|---|
id | string | [Output Only] Unique identifier for the resource; defined by the server. |
items | array | A list of Network resources. |
kind | string | Output only. [Output Only] Type of resource. Always compute#networkList for lists of networks. (default: compute#networkList) |
nextPageToken | string | [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger thanmaxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. |
selfLink | string | Output only. [Output Only] Server-defined URL for this resource. |
warning | object | [Output Only] Informational warning message. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | project, network | Returns the specified network. | |
list | select | project | returnPartialSuccess, orderBy, filter, maxResults, pageToken | Retrieves the list of networks available to the specified project. |
insert | insert | project | requestId | Creates a network in the specified project using the data included in the request. |
patch | update | project, network | requestId | Patches the specified network with the data included in the request. Only routingConfig can be modified. |
delete | delete | project, network | requestId | Deletes the specified network. |
cancel_request_remove_peering | exec | project, network | requestId | 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. |
switch_to_custom_mode | exec | project, network | requestId | Switches the network mode from auto subnet mode to custom subnet mode. |
request_remove_peering | exec | project, network | requestId | Requests 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.
| Name | Datatype | Description |
|---|---|---|
network | string | |
project | string | |
filter | string | |
maxResults | integer (uint32) | |
orderBy | string | |
pageToken | string | |
requestId | string | |
returnPartialSuccess | boolean |
SELECT examples
- get
- list
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
;
Retrieves the list of networks available to the specified project.
SELECT
id,
items,
kind,
nextPageToken,
selfLink,
warning
FROM google.compute.networks
WHERE project = '{{ project }}' -- required
AND returnPartialSuccess = '{{ returnPartialSuccess }}'
AND orderBy = '{{ orderBy }}'
AND filter = '{{ filter }}'
AND maxResults = '{{ maxResults }}'
AND pageToken = '{{ pageToken }}'
;
INSERT examples
- insert
- Manifest
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
;
# Description fields are for documentation purposes
- name: networks
props:
- name: project
value: "{{ project }}"
description: Required parameter for the networks resource.
- name: routingConfig
description: |
The network-level routing configuration for this network. Used by Cloud
Router to determine what type of network-wide routing behavior to enforce.
value:
bgpInterRegionCost: "{{ bgpInterRegionCost }}"
routingMode: "{{ routingMode }}"
bgpAlwaysCompareMed: {{ bgpAlwaysCompareMed }}
effectiveBgpAlwaysCompareMed: {{ effectiveBgpAlwaysCompareMed }}
effectiveBgpInterRegionCost: "{{ effectiveBgpInterRegionCost }}"
bgpBestPathSelectionMode: "{{ bgpBestPathSelectionMode }}"
- name: networkProfile
value: "{{ networkProfile }}"
description: |
A 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}
- name: networkFirewallPolicyEnforcementOrder
value: "{{ networkFirewallPolicyEnforcementOrder }}"
description: |
The 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.
valid_values: ['AFTER_CLASSIC_FIREWALL', 'BEFORE_CLASSIC_FIREWALL']
- name: gatewayIPv4
value: "{{ gatewayIPv4 }}"
description: |
[Output Only] The gateway address for default routing out of the network,
selected by Google Cloud.
- name: enableUlaInternalIpv6
value: {{ enableUlaInternalIpv6 }}
description: |
Enable ULA internal ipv6 on this network. Enabling this feature will assign
a /48 from google defined ULA prefix fd20::/20.
.
- name: IPv4Range
value: "{{ IPv4Range }}"
description: |
Deprecated 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.
- name: subnetworks
value:
- "{{ subnetworks }}"
description: |
[Output Only] Server-defined fully-qualified URLs for all subnetworks
in this VPC network.
- name: name
value: "{{ name }}"
description: |
Name 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.
- name: autoCreateSubnetworks
value: {{ autoCreateSubnetworks }}
description: |
Must 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.
- name: params
description: |
Input only. [Input Only] Additional params passed with the request, but not persisted
as part of resource payload.
value:
resourceManagerTags: "{{ resourceManagerTags }}"
- name: internalIpv6Range
value: "{{ internalIpv6Range }}"
description: |
When 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.
.
- name: description
value: "{{ description }}"
description: |
An optional description of this resource. Provide this field when you
create the resource.
- name: mtu
value: {{ mtu }}
description: |
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.
- name: selfLink
value: "{{ selfLink }}"
description: |
[Output Only] Server-defined URL for the resource.
- name: requestId
value: "{{ requestId }}"
UPDATE examples
- patch
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
- delete
Deletes the specified network.
DELETE FROM google.compute.networks
WHERE project = '{{ project }}' --required
AND network = '{{ network }}' --required
AND requestId = '{{ requestId }}'
;
Lifecycle Methods
- cancel_request_remove_peering
- switch_to_custom_mode
- request_remove_peering
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 }}"
}'
;
Switches the network mode from auto subnet mode to custom subnet mode.
EXEC google.compute.networks.switch_to_custom_mode
@project='{{ project }}' --required,
@network='{{ network }}' --required,
@requestId='{{ requestId }}'
;
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 }}"
}'
;