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:

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 withRFC1035. 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](?:[-a-z0-9]{0,61}[a-z0-9])?)
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 toRFC4273.
creationTimestampstringOutput only. [Output Only] Creation timestamp inRFC3339 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.
kindstringOutput only. [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.
nccGatewaystringURI of the ncc_gateway to which this router associated.
networkstringURI of the network to which this router belongs.
paramsobjectInput only. [Input Only] Additional params passed with the request, but not persisted as part of resource payload. (id: RouterParams)
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, regionmaxResults, pageToken, filter, orderBy, returnPartialSuccessRetrieves a list of Router resources available to the specified project.
aggregated_listselectprojectreturnPartialSuccess, filter, serviceProjectNumber, maxResults, pageToken, includeAllScopes, orderByRetrieves 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 supportsPATCH
semantics and usesJSON merge
patch format and processing rules.
patch_named_setupdateproject, region, routerrequestIdPatches Named Set
patch_route_policyupdateproject, region, routerrequestIdPatches Route Policy
updatereplaceproject, region, routerrequestIdUpdates the specified Router resource with the data included in the
request. This method conforms toPUT 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 andupdate 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,
nccGateway,
network,
params,
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__bgp,
data__region,
data__md5AuthenticationKeys,
data__network,
data__params,
data__bgpPeers,
data__name,
data__interfaces,
data__nccGateway,
data__description,
data__nats,
data__selfLink,
data__id,
data__encryptedInterconnectRouter,
project,
region,
requestId
)
SELECT
'{{ bgp }}',
'{{ region }}',
'{{ md5AuthenticationKeys }}',
'{{ network }}',
'{{ params }}',
'{{ bgpPeers }}',
'{{ name }}',
'{{ interfaces }}',
'{{ nccGateway }}',
'{{ description }}',
'{{ nats }}',
'{{ selfLink }}',
'{{ id }}',
{{ encryptedInterconnectRouter }},
'{{ project }}',
'{{ region }}',
'{{ 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
;

UPDATE examples

Patches the specified Router resource with the data included in the
request. This method supportsPATCH
semantics and usesJSON merge
patch format and processing rules.

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

REPLACE examples

Updates the specified Router resource with the data included in the
request. This method conforms toPUT 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__bgp = '{{ bgp }}',
data__region = '{{ region }}',
data__md5AuthenticationKeys = '{{ md5AuthenticationKeys }}',
data__network = '{{ network }}',
data__params = '{{ params }}',
data__bgpPeers = '{{ bgpPeers }}',
data__name = '{{ name }}',
data__interfaces = '{{ interfaces }}',
data__nccGateway = '{{ nccGateway }}',
data__description = '{{ description }}',
data__nats = '{{ nats }}',
data__selfLink = '{{ selfLink }}',
data__id = '{{ id }}',
data__encryptedInterconnectRouter = {{ encryptedInterconnectRouter }}
WHERE
project = '{{ project }}' --required
AND region = '{{ region }}' --required
AND router = '{{ router }}' --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

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 andupdate 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=
'{
"bgp": "{{ bgp }}",
"region": "{{ region }}",
"md5AuthenticationKeys": "{{ md5AuthenticationKeys }}",
"network": "{{ network }}",
"params": "{{ params }}",
"bgpPeers": "{{ bgpPeers }}",
"name": "{{ name }}",
"interfaces": "{{ interfaces }}",
"nccGateway": "{{ nccGateway }}",
"description": "{{ description }}",
"nats": "{{ nats }}",
"selfLink": "{{ selfLink }}",
"id": "{{ id }}",
"encryptedInterconnectRouter": {{ encryptedInterconnectRouter }}
}'
;