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:

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__alternativeNameServerConfig,
data__description,
data__dns64Config,
data__enableInboundForwarding,
data__enableLogging,
data__id,
data__kind,
data__name,
data__networks,
project,
clientOperationId
)
SELECT
'{{ alternativeNameServerConfig }}',
'{{ description }}',
'{{ dns64Config }}',
{{ enableInboundForwarding }},
{{ enableLogging }},
'{{ id }}',
'{{ kind }}',
'{{ name }}',
'{{ networks }}',
'{{ 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__alternativeNameServerConfig = '{{ alternativeNameServerConfig }}',
data__description = '{{ description }}',
data__dns64Config = '{{ dns64Config }}',
data__enableInboundForwarding = {{ enableInboundForwarding }},
data__enableLogging = {{ enableLogging }},
data__id = '{{ id }}',
data__kind = '{{ kind }}',
data__name = '{{ name }}',
data__networks = '{{ networks }}'
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__alternativeNameServerConfig = '{{ alternativeNameServerConfig }}',
data__description = '{{ description }}',
data__dns64Config = '{{ dns64Config }}',
data__enableInboundForwarding = {{ enableInboundForwarding }},
data__enableLogging = {{ enableLogging }},
data__id = '{{ id }}',
data__kind = '{{ kind }}',
data__name = '{{ name }}',
data__networks = '{{ networks }}'
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 }}'
;