Skip to main content

policies

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

Overview

Namepolicies
TypeResource
Idgoogle.dns.policies

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
idstring (uint64)Unique identifier for the resource; defined by the server (output only).
namestringUser-assigned name for this policy.
alternativeNameServerConfigobjectSets an alternative name server for the associated networks. When specified, all DNS queries are forwarded to a name server that you choose. Names such as .internal are not available when an alternative name server is specified. (id: PolicyAlternativeNameServerConfig)
descriptionstringA mutable string of at most 1024 characters associated with this resource for the user's convenience. Has no effect on the policy's function.
dns64ConfigobjectConfigurations related to DNS64 for this Policy. (id: PolicyDns64Config)
enableInboundForwardingbooleanAllows networks bound to this policy to receive DNS queries sent by VMs or applications over VPN connections. When enabled, a virtual IP address is allocated from each of the subnetworks that are bound to this policy.
enableLoggingbooleanControls whether logging is enabled for the networks bound to this policy. Defaults to no logging if not set.
kindstring (default: dns#policy)
networksarrayList of network names specifying networks to which this policy is applied.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectproject, policyclientOperationIdFetches the representation of an existing Policy.
listselectprojectmaxResults, pageTokenEnumerates all Policies associated with a project.
createinsertprojectclientOperationIdCreates a new Policy.
patchupdateproject, policyclientOperationIdApplies a partial update to an existing Policy.
updatereplaceproject, policyclientOperationIdUpdates an existing Policy.
deletedeleteproject, policyclientOperationIdDeletes a previously created Policy. Fails if the policy is still being referenced by a network.

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
policystring
projectstring
clientOperationIdstring
maxResultsinteger (int32)
pageTokenstring

SELECT examples

Fetches the representation of an existing Policy.

SELECT
id,
name,
alternativeNameServerConfig,
description,
dns64Config,
enableInboundForwarding,
enableLogging,
kind,
networks
FROM google.dns.policies
WHERE project = '{{ project }}' -- required
AND policy = '{{ policy }}' -- required
AND clientOperationId = '{{ clientOperationId }}';

INSERT examples

Creates a new Policy.

INSERT INTO google.dns.policies (
data__id,
data__name,
data__enableInboundForwarding,
data__description,
data__networks,
data__alternativeNameServerConfig,
data__enableLogging,
data__dns64Config,
data__kind,
project,
clientOperationId
)
SELECT
'{{ id }}',
'{{ name }}',
{{ enableInboundForwarding }},
'{{ description }}',
'{{ networks }}',
'{{ alternativeNameServerConfig }}',
{{ enableLogging }},
'{{ dns64Config }}',
'{{ kind }}',
'{{ project }}',
'{{ clientOperationId }}'
RETURNING
id,
name,
alternativeNameServerConfig,
description,
dns64Config,
enableInboundForwarding,
enableLogging,
kind,
networks
;

UPDATE examples

Applies a partial update to an existing Policy.

UPDATE google.dns.policies
SET
data__id = '{{ id }}',
data__name = '{{ name }}',
data__enableInboundForwarding = {{ enableInboundForwarding }},
data__description = '{{ description }}',
data__networks = '{{ networks }}',
data__alternativeNameServerConfig = '{{ alternativeNameServerConfig }}',
data__enableLogging = {{ enableLogging }},
data__dns64Config = '{{ dns64Config }}',
data__kind = '{{ kind }}'
WHERE
project = '{{ project }}' --required
AND policy = '{{ policy }}' --required
AND clientOperationId = '{{ clientOperationId}}'
RETURNING
policy;

REPLACE examples

Updates an existing Policy.

REPLACE google.dns.policies
SET
data__id = '{{ id }}',
data__name = '{{ name }}',
data__enableInboundForwarding = {{ enableInboundForwarding }},
data__description = '{{ description }}',
data__networks = '{{ networks }}',
data__alternativeNameServerConfig = '{{ alternativeNameServerConfig }}',
data__enableLogging = {{ enableLogging }},
data__dns64Config = '{{ dns64Config }}',
data__kind = '{{ kind }}'
WHERE
project = '{{ project }}' --required
AND policy = '{{ policy }}' --required
AND clientOperationId = '{{ clientOperationId}}'
RETURNING
policy;

DELETE examples

Deletes a previously created Policy. Fails if the policy is still being referenced by a network.

DELETE FROM google.dns.policies
WHERE project = '{{ project }}' --required
AND policy = '{{ policy }}' --required
AND clientOperationId = '{{ clientOperationId }}';