@pulumi/linode
Version:
A Pulumi package for creating and managing linode cloud resources.
154 lines • 6.26 kB
JavaScript
// *** 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.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, Object.assign(Object.assign({}, 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 ? state.created : undefined;
resourceInputs["devices"] = state ? state.devices : undefined;
resourceInputs["disabled"] = state ? state.disabled : undefined;
resourceInputs["inboundPolicy"] = state ? state.inboundPolicy : undefined;
resourceInputs["inbounds"] = state ? state.inbounds : undefined;
resourceInputs["label"] = state ? state.label : undefined;
resourceInputs["linodes"] = state ? state.linodes : undefined;
resourceInputs["nodebalancers"] = state ? state.nodebalancers : undefined;
resourceInputs["outboundPolicy"] = state ? state.outboundPolicy : undefined;
resourceInputs["outbounds"] = state ? state.outbounds : undefined;
resourceInputs["status"] = state ? state.status : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["updated"] = state ? state.updated : undefined;
}
else {
const args = argsOrState;
if ((!args || args.inboundPolicy === undefined) && !opts.urn) {
throw new Error("Missing required property 'inboundPolicy'");
}
if ((!args || args.label === undefined) && !opts.urn) {
throw new Error("Missing required property 'label'");
}
if ((!args || args.outboundPolicy === undefined) && !opts.urn) {
throw new Error("Missing required property 'outboundPolicy'");
}
resourceInputs["disabled"] = args ? args.disabled : undefined;
resourceInputs["inboundPolicy"] = args ? args.inboundPolicy : undefined;
resourceInputs["inbounds"] = args ? args.inbounds : undefined;
resourceInputs["label"] = args ? args.label : undefined;
resourceInputs["linodes"] = args ? args.linodes : undefined;
resourceInputs["nodebalancers"] = args ? args.nodebalancers : undefined;
resourceInputs["outboundPolicy"] = args ? args.outboundPolicy : undefined;
resourceInputs["outbounds"] = args ? args.outbounds : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
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
;