UNPKG

@pulumi/linode

Version:

A Pulumi package for creating and managing linode cloud resources.

154 lines 5.78 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.Firewall = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * Manages a Linode Firewall. * For more information, see the [Linode APIv4 docs](https://techdocs.akamai.com/linode-api/reference/post-firewalls). * * ## Example Usage * * Accept only inbound HTTP(s) requests and drop outbound HTTP(s) requests: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as linode from "@pulumi/linode"; * * const myInstance = new linode.Instance("my_instance", { * label: "my_instance", * image: "linode/ubuntu22.04", * region: "us-southeast", * type: "g6-standard-1", * rootPass: "bogusPassword$", * swapSize: 256, * }); * const myFirewall = new linode.Firewall("my_firewall", { * label: "my_firewall", * inbounds: [ * { * label: "allow-http", * action: "ACCEPT", * protocol: "TCP", * ports: "80", * ipv4s: ["0.0.0.0/0"], * ipv6s: ["::/0"], * }, * { * label: "allow-https", * action: "ACCEPT", * protocol: "TCP", * ports: "443", * ipv4s: ["0.0.0.0/0"], * ipv6s: ["::/0"], * }, * ], * inboundPolicy: "DROP", * outbounds: [ * { * label: "reject-http", * action: "DROP", * protocol: "TCP", * ports: "80", * ipv4s: ["0.0.0.0/0"], * ipv6s: ["::/0"], * }, * { * label: "reject-https", * action: "DROP", * protocol: "TCP", * ports: "443", * ipv4s: ["0.0.0.0/0"], * ipv6s: ["::/0"], * }, * ], * outboundPolicy: "ACCEPT", * linodes: [myInstance.id], * }); * ``` * * ## Import * * Firewalls can be imported using the `id`, e.g. * * ```sh * $ pulumi import linode:index/firewall:Firewall my_firewall 12345 * ``` */ class Firewall extends pulumi.CustomResource { /** * Get an existing Firewall 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 Firewall(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of Firewall. 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'] === Firewall.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["created"] = state?.created; resourceInputs["devices"] = state?.devices; resourceInputs["disabled"] = state?.disabled; resourceInputs["inboundPolicy"] = state?.inboundPolicy; resourceInputs["inbounds"] = state?.inbounds; resourceInputs["label"] = state?.label; resourceInputs["linodes"] = state?.linodes; resourceInputs["nodebalancers"] = state?.nodebalancers; resourceInputs["outboundPolicy"] = state?.outboundPolicy; resourceInputs["outbounds"] = state?.outbounds; resourceInputs["status"] = state?.status; resourceInputs["tags"] = state?.tags; resourceInputs["updated"] = state?.updated; } else { const args = argsOrState; if (args?.inboundPolicy === undefined && !opts.urn) { throw new Error("Missing required property 'inboundPolicy'"); } if (args?.label === undefined && !opts.urn) { throw new Error("Missing required property 'label'"); } if (args?.outboundPolicy === undefined && !opts.urn) { throw new Error("Missing required property 'outboundPolicy'"); } resourceInputs["disabled"] = args?.disabled; resourceInputs["inboundPolicy"] = args?.inboundPolicy; resourceInputs["inbounds"] = args?.inbounds; resourceInputs["label"] = args?.label; resourceInputs["linodes"] = args?.linodes; resourceInputs["nodebalancers"] = args?.nodebalancers; resourceInputs["outboundPolicy"] = args?.outboundPolicy; resourceInputs["outbounds"] = args?.outbounds; resourceInputs["tags"] = args?.tags; resourceInputs["created"] = undefined /*out*/; resourceInputs["devices"] = undefined /*out*/; resourceInputs["status"] = undefined /*out*/; resourceInputs["updated"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Firewall.__pulumiType, name, resourceInputs, opts); } } exports.Firewall = Firewall; /** @internal */ Firewall.__pulumiType = 'linode:index/firewall:Firewall'; //# sourceMappingURL=firewall.js.map