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
Successful response
Name | Datatype | Description |
---|---|---|
id | string (uint64) | [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 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?) |
IPv4Range | string | Deprecated 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}) |
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 in Auto mode VPC network IP ranges. For custom mode VPC networks, you can add subnets using the subnetworks insert method. |
creationTimestamp | string | [Output Only] Creation timestamp in RFC3339 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] 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] 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. |
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] 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] 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. |
Successful response
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] 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 than maxResults, 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] 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 | filter , maxResults , orderBy , pageToken , returnPartialSuccess | 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. |
request_remove_peering | exec | project , network | requestId | Requests to remove a peering from the specified network. Applicable only for PeeringConnection with update_strategy=CONSENSUS. |
switch_to_custom_mode | exec | project , network | requestId | Switches 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.
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 filter = '{{ filter }}'
AND maxResults = '{{ maxResults }}'
AND orderBy = '{{ orderBy }}'
AND pageToken = '{{ pageToken }}'
AND returnPartialSuccess = '{{ returnPartialSuccess }}';
INSERT
examples
- insert
- Manifest
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
;
# Description fields are for documentation purposes
- name: networks
props:
- name: project
value: string
description: Required parameter for the networks resource.
- name: kind
value: string
description: >
[Output Only] Type of the resource. Always compute#network for networks.
default: compute#network
- name: id
value: string
description: >
[Output Only] The unique identifier for the resource. This identifier is defined by the server.
- name: creationTimestamp
value: string
description: >
[Output Only] Creation timestamp in RFC3339 text format.
- name: name
value: string
description: >
Name 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.
- name: description
value: string
description: >
An optional description of this resource. Provide this field when you create the resource.
- name: IPv4Range
value: string
description: >
Deprecated 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.
- name: gatewayIPv4
value: string
description: >
[Output Only] The gateway address for default routing out of the network, selected by Google Cloud.
- name: selfLink
value: string
description: >
[Output Only] Server-defined URL for the resource.
- name: selfLinkWithId
value: string
description: >
[Output Only] Server-defined URL for this resource with the resource id.
- name: autoCreateSubnetworks
value: boolean
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 in Auto mode VPC network IP ranges. For custom mode VPC networks, you can add subnets using the subnetworks insert method.
- name: subnetworks
value: array
description: >
[Output Only] Server-defined fully-qualified URLs for all subnetworks in this VPC network.
- name: peerings
value: array
description: >
[Output Only] A list of network peerings for the resource.
- name: routingConfig
value: object
description: >
The network-level routing configuration for this network. Used by Cloud Router to determine what type of network-wide routing behavior to enforce.
- name: mtu
value: integer
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: firewallPolicy
value: string
description: >
[Output Only] URL of the firewall policy the network is associated with.
- name: networkFirewallPolicyEnforcementOrder
value: string
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: enableUlaInternalIpv6
value: boolean
description: >
Enable ULA internal ipv6 on this network. Enabling this feature will assign a /48 from google defined ULA prefix fd20::/20. .
- name: internalIpv6Range
value: string
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: networkProfile
value: string
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: params
value: object
description: >
Input only. [Input Only] Additional params passed with the request, but not persisted as part of resource payload.
- name: requestId
value: string
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__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
- delete
Deletes the specified network.
DELETE FROM google.compute.networks
WHERE project = '{{ project }}' --required
AND network = '{{ network }}' --required
AND requestId = '{{ requestId }}';
Lifecycle Methods
- request_remove_peering
- switch_to_custom_mode
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 }}"
}';
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 }}';