UNPKG

@pulumi/gcp

Version:

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

137 lines 5.08 kB
"use strict"; // *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** 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, Object.assign(Object.assign({}, 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 ? state.alternativeNameServerConfig : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["enableInboundForwarding"] = state ? state.enableInboundForwarding : undefined; resourceInputs["enableLogging"] = state ? state.enableLogging : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["networks"] = state ? state.networks : undefined; resourceInputs["project"] = state ? state.project : undefined; } else { const args = argsOrState; resourceInputs["alternativeNameServerConfig"] = args ? args.alternativeNameServerConfig : undefined; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["enableInboundForwarding"] = args ? args.enableInboundForwarding : undefined; resourceInputs["enableLogging"] = args ? args.enableLogging : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["networks"] = args ? args.networks : undefined; resourceInputs["project"] = args ? args.project : undefined; } 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