UNPKG

@pulumi/gcp

Version:

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

132 lines 6.04 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! *** var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.FirewallPolicyAssociation = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(require("../utilities")); /** * Allows associating hierarchical firewall policies with the target where they are applied. This allows creating policies and rules in a different location than they are applied. * For more information on applying hierarchical firewall policies see the [official documentation](https://cloud.google.com/firewall/docs/firewall-policies#managing_hierarchical_firewall_policy_resources) * * To get more information about FirewallPolicyAssociation, see: * * * [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/firewallPolicies/addAssociation) * * ## Example Usage * * ### Firewall Policy Association * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const folder = new gcp.organizations.Folder("folder", { * displayName: "folder-fpa", * parent: "organizations/123456789", * deletionProtection: false, * }); * const policy = new gcp.compute.FirewallPolicy("policy", { * parent: "organizations/123456789", * shortName: "my-policy", * description: "Example Resource", * }); * const _default = new gcp.compute.FirewallPolicyAssociation("default", { * firewallPolicy: policy.id, * attachmentTarget: folder.name, * name: "my-association", * }); * ``` * ## Import * * FirewallPolicyAssociation can be imported using any of these accepted formats: * * * `locations/global/firewallPolicies/{{firewall_policy}}/associations/{{name}}` * * `{{firewall_policy}}/{{name}}` * * When using the `pulumi import` command, FirewallPolicyAssociation can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:compute/firewallPolicyAssociation:FirewallPolicyAssociation default locations/global/firewallPolicies/{{firewall_policy}}/associations/{{name}} * $ pulumi import gcp:compute/firewallPolicyAssociation:FirewallPolicyAssociation default {{firewall_policy}}/{{name}} * ``` */ class FirewallPolicyAssociation extends pulumi.CustomResource { /** * Get an existing FirewallPolicyAssociation 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 FirewallPolicyAssociation(name, state, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'gcp:compute/firewallPolicyAssociation:FirewallPolicyAssociation'; /** * Returns true if the given object is an instance of FirewallPolicyAssociation. 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'] === FirewallPolicyAssociation.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["attachmentTarget"] = state?.attachmentTarget; resourceInputs["deletionPolicy"] = state?.deletionPolicy; resourceInputs["firewallPolicy"] = state?.firewallPolicy; resourceInputs["name"] = state?.name; resourceInputs["shortName"] = state?.shortName; } else { const args = argsOrState; if (args?.attachmentTarget === undefined && !opts.urn) { throw new Error("Missing required property 'attachmentTarget'"); } if (args?.firewallPolicy === undefined && !opts.urn) { throw new Error("Missing required property 'firewallPolicy'"); } resourceInputs["attachmentTarget"] = args?.attachmentTarget; resourceInputs["deletionPolicy"] = args?.deletionPolicy; resourceInputs["firewallPolicy"] = args?.firewallPolicy; resourceInputs["name"] = args?.name; resourceInputs["shortName"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(FirewallPolicyAssociation.__pulumiType, name, resourceInputs, opts); } } exports.FirewallPolicyAssociation = FirewallPolicyAssociation; //# sourceMappingURL=firewallPolicyAssociation.js.map