Skip to main content

routers

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

Overview

Namerouters
TypeResource
Idgoogle.compute.routers

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])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. (pattern: a-z?)
bgpobjectBGP information specific to this router. (id: RouterBgp)
bgpPeersarrayBGP information that must be configured into the routing stack to establish BGP peering. This information must specify the peer ASN and either the interface name, IP address, or peer IP address. Please refer to RFC4273.
creationTimestampstring[Output Only] Creation timestamp in RFC3339 text format.
descriptionstringAn optional description of this resource. Provide this property when you create the resource.
encryptedInterconnectRouterbooleanIndicates if a router is dedicated for use with encrypted VLAN attachments (interconnectAttachments).
interfacesarrayRouter interfaces. To create a BGP peer that uses a router interface, the interface must have one of the following fields specified: - linkedVpnTunnel - linkedInterconnectAttachment - subnetwork You can create a router interface without any of these fields specified. However, you cannot create a BGP peer that uses that interface.
kindstring[Output Only] Type of resource. Always compute#router for routers. (default: compute#router)
md5AuthenticationKeysarrayKeys used for MD5 authentication.
natsarrayA list of NAT services created in this router.
networkstringURI of the network to which this router belongs.
regionstring[Output Only] URI of the region where the router resides. You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body.
selfLinkstring[Output Only] Server-defined URL for the resource.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectproject, region, routerReturns the specified Router resource.
listselectproject, regionfilter, maxResults, orderBy, pageToken, returnPartialSuccessRetrieves a list of Router resources available to the specified project.
aggregated_listselectprojectfilter, includeAllScopes, maxResults, orderBy, pageToken, returnPartialSuccess, serviceProjectNumberRetrieves an aggregated list of routers. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
insertinsertproject, regionrequestIdCreates a Router resource in the specified project and region using the data included in the request.
patchupdateproject, region, routerrequestIdPatches the specified Router resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules.
patch_route_policyupdateproject, region, routerrequestIdPatches Route Policy
updatereplaceproject, region, routerrequestIdUpdates the specified Router resource with the data included in the request. This method conforms to PUT semantics, which requests that the state of the target resource be created or replaced with the state defined by the representation enclosed in the request message payload.
deletedeleteproject, region, routerrequestIdDeletes the specified Router resource.
previewexecproject, region, routerPreview fields auto-generated during router create and update operations. Calling this method does NOT create or update the router.

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
projectstring
regionstring
routerstring
filterstring
includeAllScopesboolean
maxResultsinteger (uint32)
orderBystring
pageTokenstring
requestIdstring
returnPartialSuccessboolean
serviceProjectNumberstring (int64)

SELECT examples

Returns the specified Router resource.

SELECT
id,
name,
bgp,
bgpPeers,
creationTimestamp,
description,
encryptedInterconnectRouter,
interfaces,
kind,
md5AuthenticationKeys,
nats,
network,
region,
selfLink
FROM google.compute.routers
WHERE project = '{{ project }}' -- required
AND region = '{{ region }}' -- required
AND router = '{{ router }}' -- required;

INSERT examples

Creates a Router resource in the specified project and region using the data included in the request.

INSERT INTO google.compute.routers (
data__kind,
data__id,
data__creationTimestamp,
data__name,
data__description,
data__region,
data__network,
data__interfaces,
data__bgpPeers,
data__bgp,
data__selfLink,
data__nats,
data__encryptedInterconnectRouter,
data__md5AuthenticationKeys,
project,
region,
requestId
)
SELECT
'{{ kind }}',
'{{ id }}',
'{{ creationTimestamp }}',
'{{ name }}',
'{{ description }}',
'{{ region }}',
'{{ network }}',
'{{ interfaces }}',
'{{ bgpPeers }}',
'{{ bgp }}',
'{{ selfLink }}',
'{{ nats }}',
{{ encryptedInterconnectRouter }},
'{{ md5AuthenticationKeys }}',
'{{ project }}',
'{{ region }}',
'{{ 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 Router resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules.

UPDATE google.compute.routers
SET
data__kind = '{{ kind }}',
data__id = '{{ id }}',
data__creationTimestamp = '{{ creationTimestamp }}',
data__name = '{{ name }}',
data__description = '{{ description }}',
data__region = '{{ region }}',
data__network = '{{ network }}',
data__interfaces = '{{ interfaces }}',
data__bgpPeers = '{{ bgpPeers }}',
data__bgp = '{{ bgp }}',
data__selfLink = '{{ selfLink }}',
data__nats = '{{ nats }}',
data__encryptedInterconnectRouter = {{ encryptedInterconnectRouter }},
data__md5AuthenticationKeys = '{{ md5AuthenticationKeys }}'
WHERE
project = '{{ project }}' --required
AND region = '{{ region }}' --required
AND router = '{{ router }}' --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;

REPLACE examples

Updates the specified Router resource with the data included in the request. This method conforms to PUT semantics, which requests that the state of the target resource be created or replaced with the state defined by the representation enclosed in the request message payload.

REPLACE google.compute.routers
SET
data__kind = '{{ kind }}',
data__id = '{{ id }}',
data__creationTimestamp = '{{ creationTimestamp }}',
data__name = '{{ name }}',
data__description = '{{ description }}',
data__region = '{{ region }}',
data__network = '{{ network }}',
data__interfaces = '{{ interfaces }}',
data__bgpPeers = '{{ bgpPeers }}',
data__bgp = '{{ bgp }}',
data__selfLink = '{{ selfLink }}',
data__nats = '{{ nats }}',
data__encryptedInterconnectRouter = {{ encryptedInterconnectRouter }},
data__md5AuthenticationKeys = '{{ md5AuthenticationKeys }}'
WHERE
project = '{{ project }}' --required
AND region = '{{ region }}' --required
AND router = '{{ router }}' --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 Router resource.

DELETE FROM google.compute.routers
WHERE project = '{{ project }}' --required
AND region = '{{ region }}' --required
AND router = '{{ router }}' --required
AND requestId = '{{ requestId }}';

Lifecycle Methods

Preview fields auto-generated during router create and update operations. Calling this method does NOT create or update the router.

EXEC google.compute.routers.preview 
@project='{{ project }}' --required,
@region='{{ region }}' --required,
@router='{{ router }}' --required
@@json=
'{
"kind": "{{ kind }}",
"id": "{{ id }}",
"creationTimestamp": "{{ creationTimestamp }}",
"name": "{{ name }}",
"description": "{{ description }}",
"region": "{{ region }}",
"network": "{{ network }}",
"interfaces": "{{ interfaces }}",
"bgpPeers": "{{ bgpPeers }}",
"bgp": "{{ bgp }}",
"selfLink": "{{ selfLink }}",
"nats": "{{ nats }}",
"encryptedInterconnectRouter": {{ encryptedInterconnectRouter }},
"md5AuthenticationKeys": "{{ md5AuthenticationKeys }}"
}';