UNPKG

@pulumi/gcp

Version:

A Pulumi package for creating and managing Google Cloud Platform resources.

139 lines 4.9 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.Policy = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * A policy is a collection of DNS rules applied to one or more Virtual * Private Cloud resources. * * To get more information about Policy, see: * * * [API documentation](https://cloud.google.com/dns/docs/reference/v1beta2/policies) * * How-to Guides * * [Using DNS server policies](https://cloud.google.com/dns/zones/#using-dns-server-policies) * * ## Example Usage * * ### Dns Policy Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const network_1 = new gcp.compute.Network("network-1", { * name: "network-1", * autoCreateSubnetworks: false, * }); * const network_2 = new gcp.compute.Network("network-2", { * name: "network-2", * autoCreateSubnetworks: false, * }); * const example_policy = new gcp.dns.Policy("example-policy", { * name: "example-policy", * enableInboundForwarding: true, * enableLogging: true, * alternativeNameServerConfig: { * targetNameServers: [ * { * ipv4Address: "172.16.1.10", * forwardingPath: "private", * }, * { * ipv4Address: "172.16.1.20", * }, * ], * }, * networks: [ * { * networkUrl: network_1.id, * }, * { * networkUrl: network_2.id, * }, * ], * }); * ``` * * ## Import * * Policy can be imported using any of these accepted formats: * * * `projects/{{project}}/policies/{{name}}` * * * `{{project}}/{{name}}` * * * `{{name}}` * * When using the `pulumi import` command, Policy can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:dns/policy:Policy default projects/{{project}}/policies/{{name}} * ``` * * ```sh * $ pulumi import gcp:dns/policy:Policy default {{project}}/{{name}} * ``` * * ```sh * $ pulumi import gcp:dns/policy:Policy default {{name}} * ``` */ class Policy extends pulumi.CustomResource { /** * Get an existing Policy resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name, id, state, opts) { return new Policy(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of Policy. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === Policy.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["alternativeNameServerConfig"] = state?.alternativeNameServerConfig; resourceInputs["description"] = state?.description; resourceInputs["dns64Config"] = state?.dns64Config; resourceInputs["enableInboundForwarding"] = state?.enableInboundForwarding; resourceInputs["enableLogging"] = state?.enableLogging; resourceInputs["name"] = state?.name; resourceInputs["networks"] = state?.networks; resourceInputs["project"] = state?.project; } else { const args = argsOrState; resourceInputs["alternativeNameServerConfig"] = args?.alternativeNameServerConfig; resourceInputs["description"] = args?.description; resourceInputs["dns64Config"] = args?.dns64Config; resourceInputs["enableInboundForwarding"] = args?.enableInboundForwarding; resourceInputs["enableLogging"] = args?.enableLogging; resourceInputs["name"] = args?.name; resourceInputs["networks"] = args?.networks; resourceInputs["project"] = args?.project; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Policy.__pulumiType, name, resourceInputs, opts); } } exports.Policy = Policy; /** @internal */ Policy.__pulumiType = 'gcp:dns/policy:Policy'; //# sourceMappingURL=policy.js.map