UNPKG

@pulumi/digitalocean

Version:

A Pulumi package for creating and managing DigitalOcean cloud resources.

151 lines 5.35 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"); /** * Provides a DigitalOcean Cloud Firewall resource. This can be used to create, * modify, and delete Firewalls. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as digitalocean from "@pulumi/digitalocean"; * * const web = new digitalocean.Droplet("web", { * name: "web-1", * size: digitalocean.DropletSlug.DropletS1VCPU1GB, * image: "ubuntu-18-04-x64", * region: digitalocean.Region.NYC3, * }); * const webFirewall = new digitalocean.Firewall("web", { * name: "only-22-80-and-443", * dropletIds: [web.id], * inboundRules: [ * { * protocol: "tcp", * portRange: "22", * sourceAddresses: [ * "192.168.1.0/24", * "2002:1:2::/48", * ], * }, * { * protocol: "tcp", * portRange: "80", * sourceAddresses: [ * "0.0.0.0/0", * "::/0", * ], * }, * { * protocol: "tcp", * portRange: "443", * sourceAddresses: [ * "0.0.0.0/0", * "::/0", * ], * }, * { * protocol: "icmp", * sourceAddresses: [ * "0.0.0.0/0", * "::/0", * ], * }, * ], * outboundRules: [ * { * protocol: "tcp", * portRange: "53", * destinationAddresses: [ * "0.0.0.0/0", * "::/0", * ], * }, * { * protocol: "udp", * portRange: "53", * destinationAddresses: [ * "0.0.0.0/0", * "::/0", * ], * }, * { * protocol: "icmp", * destinationAddresses: [ * "0.0.0.0/0", * "::/0", * ], * }, * ], * }); * ``` * * ## Import * * Firewalls can be imported using the firewall `id`, e.g. * * ```sh * $ pulumi import digitalocean:index/firewall:Firewall myfirewall b8ecd2ab-2267-4a5e-8692-cbf1d32583e3 * ``` */ 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["createdAt"] = state ? state.createdAt : undefined; resourceInputs["dropletIds"] = state ? state.dropletIds : undefined; resourceInputs["inboundRules"] = state ? state.inboundRules : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["outboundRules"] = state ? state.outboundRules : undefined; resourceInputs["pendingChanges"] = state ? state.pendingChanges : undefined; resourceInputs["status"] = state ? state.status : undefined; resourceInputs["tags"] = state ? state.tags : undefined; } else { const args = argsOrState; resourceInputs["dropletIds"] = args ? args.dropletIds : undefined; resourceInputs["inboundRules"] = args ? args.inboundRules : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["outboundRules"] = args ? args.outboundRules : undefined; resourceInputs["tags"] = args ? args.tags : undefined; resourceInputs["createdAt"] = undefined /*out*/; resourceInputs["pendingChanges"] = undefined /*out*/; resourceInputs["status"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Firewall.__pulumiType, name, resourceInputs, opts); } } exports.Firewall = Firewall; /** @internal */ Firewall.__pulumiType = 'digitalocean:index/firewall:Firewall'; //# sourceMappingURL=firewall.js.map