UNPKG

@pulumi/hcloud

Version:

A Pulumi package for creating and managing hcloud cloud resources.

104 lines 4.11 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.FirewallAttachment = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * Attaches resource to a Hetzner Cloud Firewall. * * _Note_: only one `hcloud.FirewallAttachment` per Firewall is allowed. * Any resources that should be attached to that Firewall need to be * specified in that `hcloud.FirewallAttachment`. * * ## Example Usage * * ### Attach Servers * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as hcloud from "@pulumi/hcloud"; * * const testServer = new hcloud.Server("test_server", { * name: "test-server", * serverType: "cx22", * image: "ubuntu-20.04", * }); * const basicFirewall = new hcloud.Firewall("basic_firewall", {name: "basic_firewall"}); * const fwRef = new hcloud.FirewallAttachment("fw_ref", { * firewallId: basicFirewall.id, * serverIds: [testServer.id], * }); * ``` * * ### Attach Label Selectors * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as hcloud from "@pulumi/hcloud"; * * const testServer = new hcloud.Server("test_server", { * name: "test-server", * serverType: "cx22", * image: "ubuntu-20.04", * labels: { * "firewall-attachment": "test-server", * }, * }); * const basicFirewall = new hcloud.Firewall("basic_firewall", {name: "basic_firewall"}); * const fwRef = new hcloud.FirewallAttachment("fw_ref", { * firewallId: basicFirewall.id, * labelSelectors: ["firewall-attachment=test-server"], * }); * ``` */ class FirewallAttachment extends pulumi.CustomResource { /** * Get an existing FirewallAttachment 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 FirewallAttachment(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of FirewallAttachment. 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'] === FirewallAttachment.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["firewallId"] = state ? state.firewallId : undefined; resourceInputs["labelSelectors"] = state ? state.labelSelectors : undefined; resourceInputs["serverIds"] = state ? state.serverIds : undefined; } else { const args = argsOrState; if ((!args || args.firewallId === undefined) && !opts.urn) { throw new Error("Missing required property 'firewallId'"); } resourceInputs["firewallId"] = args ? args.firewallId : undefined; resourceInputs["labelSelectors"] = args ? args.labelSelectors : undefined; resourceInputs["serverIds"] = args ? args.serverIds : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(FirewallAttachment.__pulumiType, name, resourceInputs, opts); } } exports.FirewallAttachment = FirewallAttachment; /** @internal */ FirewallAttachment.__pulumiType = 'hcloud:index/firewallAttachment:FirewallAttachment'; //# sourceMappingURL=firewallAttachment.js.map