UNPKG

@huaweicloudos/pulumi

Version:

A Pulumi package for creating and managing Huaweicloud cloud resources.

200 lines 8.73 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.Firewall = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Manages a CFW firewall resource within HuaweiCloud. * * ## Example Usage * ### Basic Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as huaweicloud from "@pulumi/huaweicloud"; * * const test = new huaweicloud.Cfw.Firewall("test", { * flavor: { * version: "Professional", * }, * tags: { * foo: "bar", * key: "value", * }, * }); * ``` * ### PrePaid firewall * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as huaweicloud from "@pulumi/huaweicloud"; * * const test = new huaweicloud.Cfw.Firewall("test", { * autoRenew: "false", * chargingMode: "prePaid", * flavor: { * version: "Professional", * }, * period: 1, * periodUnit: "month", * tags: { * foo: "bar", * key: "value", * }, * }); * ``` * ### firewall with east-west firewall * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const test = new huaweicloud.cfw.Firewall("test", { * eastWestFirewallInspectionCidr: "172.16.1.0/24", * eastWestFirewallErId: huaweicloud_er_instance.test.id, * eastWestFirewallMode: "er", * flavor: { * version: "Professional", * }, * tags: { * key: "value", * foo: "bar", * }, * }); * ``` * ### firewall with IPS switch and IPS protection mode * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as huaweicloud from "@pulumi/huaweicloud"; * * const test = new huaweicloud.Cfw.Firewall("test", { * autoRenew: "false", * chargingMode: "prePaid", * flavor: { * version: "Professional", * }, * ipsProtectionMode: 1, * ipsSwitchStatus: 1, * period: 1, * periodUnit: "month", * tags: { * foo: "bar", * key: "value", * }, * }); * ``` * * ## Import * * The firewall can be imported using the `id`, e.g. bash * * ```sh * $ pulumi import huaweicloud:Cfw/firewall:Firewall test 6cb1ce47-9990-447e-b071-d167c5393871 * ``` * * Note that the imported state may not be identical to your resource definition, due to some attributes missing from the API response, security or some other reason. The missing attributes include`period_unit`, `period` and `auto_renew`. It is generally recommended running `terraform plan` after importing an CFW firewall. You can then decide if changes should be applied to the firewall, or the resource definition should be updated to align with the firewall. Also you can ignore changes as below. hcl resource "huaweicloud_cfw_firewall" "test" { * * ... * * lifecycle { * * ignore_changes = [ * * period_unit, period, auto_renew * * ] * * } } */ 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["autoRenew"] = state ? state.autoRenew : undefined; resourceInputs["chargingMode"] = state ? state.chargingMode : undefined; resourceInputs["eastWestFirewallErAttachmentId"] = state ? state.eastWestFirewallErAttachmentId : undefined; resourceInputs["eastWestFirewallErId"] = state ? state.eastWestFirewallErId : undefined; resourceInputs["eastWestFirewallInspectionCidr"] = state ? state.eastWestFirewallInspectionCidr : undefined; resourceInputs["eastWestFirewallInspectionVpcId"] = state ? state.eastWestFirewallInspectionVpcId : undefined; resourceInputs["eastWestFirewallMode"] = state ? state.eastWestFirewallMode : undefined; resourceInputs["eastWestFirewallStatus"] = state ? state.eastWestFirewallStatus : undefined; resourceInputs["engineType"] = state ? state.engineType : undefined; resourceInputs["enterpriseProjectId"] = state ? state.enterpriseProjectId : undefined; resourceInputs["flavor"] = state ? state.flavor : undefined; resourceInputs["haType"] = state ? state.haType : undefined; resourceInputs["ipsProtectionMode"] = state ? state.ipsProtectionMode : undefined; resourceInputs["ipsSwitchStatus"] = state ? state.ipsSwitchStatus : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["period"] = state ? state.period : undefined; resourceInputs["periodUnit"] = state ? state.periodUnit : undefined; resourceInputs["protectObjects"] = state ? state.protectObjects : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["serviceType"] = state ? state.serviceType : undefined; resourceInputs["status"] = state ? state.status : undefined; resourceInputs["supportIpv6"] = state ? state.supportIpv6 : undefined; resourceInputs["tags"] = state ? state.tags : undefined; } else { const args = argsOrState; if ((!args || args.flavor === undefined) && !opts.urn) { throw new Error("Missing required property 'flavor'"); } resourceInputs["autoRenew"] = args ? args.autoRenew : undefined; resourceInputs["chargingMode"] = args ? args.chargingMode : undefined; resourceInputs["eastWestFirewallErId"] = args ? args.eastWestFirewallErId : undefined; resourceInputs["eastWestFirewallInspectionCidr"] = args ? args.eastWestFirewallInspectionCidr : undefined; resourceInputs["eastWestFirewallMode"] = args ? args.eastWestFirewallMode : undefined; resourceInputs["eastWestFirewallStatus"] = args ? args.eastWestFirewallStatus : undefined; resourceInputs["enterpriseProjectId"] = args ? args.enterpriseProjectId : undefined; resourceInputs["flavor"] = args ? args.flavor : undefined; resourceInputs["ipsProtectionMode"] = args ? args.ipsProtectionMode : undefined; resourceInputs["ipsSwitchStatus"] = args ? args.ipsSwitchStatus : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["period"] = args ? args.period : undefined; resourceInputs["periodUnit"] = args ? args.periodUnit : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["tags"] = args ? args.tags : undefined; resourceInputs["eastWestFirewallErAttachmentId"] = undefined /*out*/; resourceInputs["eastWestFirewallInspectionVpcId"] = undefined /*out*/; resourceInputs["engineType"] = undefined /*out*/; resourceInputs["haType"] = undefined /*out*/; resourceInputs["protectObjects"] = undefined /*out*/; resourceInputs["serviceType"] = undefined /*out*/; resourceInputs["status"] = undefined /*out*/; resourceInputs["supportIpv6"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Firewall.__pulumiType, name, resourceInputs, opts); } } exports.Firewall = Firewall; /** @internal */ Firewall.__pulumiType = 'huaweicloud:Cfw/firewall:Firewall'; //# sourceMappingURL=firewall.js.map