Skip to main content

routers

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

Overview

Namerouters
TypeResource
Idgoogle.compute.routers

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])? 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.
descriptionstringAn optional description of this resource. Provide this property when you create the resource.
bgpobject
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.
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.
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

NameAccessible byRequired ParamsDescription
aggregated_listSELECTprojectRetrieves an aggregated list of routers. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
getSELECTproject, region, routerReturns the specified Router resource.
listSELECTproject, regionRetrieves a list of Router resources available to the specified project.
insertINSERTproject, regionCreates a Router resource in the specified project and region using the data included in the request.
deleteDELETEproject, region, routerDeletes the specified Router resource.
patchUPDATEproject, region, routerPatches 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.
updateREPLACEproject, region, routerUpdates 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.
previewEXECproject, region, routerPreview fields auto-generated during router create and update operations. Calling this method does NOT create or update the router.

SELECT examples

Retrieves an aggregated list of routers. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.

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

INSERT example

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

/*+ create */
INSERT INTO google.compute.routers (
project,
region,
name,
description,
region,
network,
interfaces,
bgpPeers,
bgp,
nats,
encryptedInterconnectRouter,
md5AuthenticationKeys
)
SELECT
'{{ project }}',
'{{ region }}',
'{{ name }}',
'{{ description }}',
'{{ region }}',
'{{ network }}',
'{{ interfaces }}',
'{{ bgpPeers }}',
'{{ bgp }}',
'{{ nats }}',
{{ encryptedInterconnectRouter }},
'{{ md5AuthenticationKeys }}'
;

UPDATE example

Updates a routers resource.

/*+ update */
UPDATE google.compute.routers
SET
name = '{{ name }}',
description = '{{ description }}',
region = '{{ region }}',
network = '{{ network }}',
interfaces = '{{ interfaces }}',
bgpPeers = '{{ bgpPeers }}',
bgp = '{{ bgp }}',
nats = '{{ nats }}',
encryptedInterconnectRouter = true|false,
md5AuthenticationKeys = '{{ md5AuthenticationKeys }}'
WHERE
project = '{{ project }}'
AND region = '{{ region }}'
AND router = '{{ router }}';

REPLACE example

Replaces all fields in the specified routers resource.

/*+ update */
REPLACE google.compute.routers
SET
name = '{{ name }}',
description = '{{ description }}',
region = '{{ region }}',
network = '{{ network }}',
interfaces = '{{ interfaces }}',
bgpPeers = '{{ bgpPeers }}',
bgp = '{{ bgp }}',
nats = '{{ nats }}',
encryptedInterconnectRouter = true|false,
md5AuthenticationKeys = '{{ md5AuthenticationKeys }}'
WHERE
project = '{{ project }}'
AND region = '{{ region }}'
AND router = '{{ router }}';

DELETE example

Deletes the specified routers resource.

/*+ delete */
DELETE FROM google.compute.routers
WHERE project = '{{ project }}'
AND region = '{{ region }}'
AND router = '{{ router }}';