@huaweicloudos/pulumi
Version:
A Pulumi package for creating and managing Huaweicloud cloud resources.
165 lines • 7.87 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.Gateway = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages a gateway resource of the **public** NAT within HuaweiCloud.
*
* ## Example Usage
* ### Creating a postpaid NAT gateway
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const gatewayName = config.requireObject("gatewayName");
* const vpcId = config.requireObject("vpcId");
* const networkId = config.requireObject("networkId");
* const gatewaySpecification = config.requireObject("gatewaySpecification");
* const test = new huaweicloud.nat.Gateway("test", {
* description: "test for terraform",
* spec: gatewaySpecification,
* vpcId: vpcId,
* subnetId: networkId,
* });
* ```
* ### Creating a prepaid NAT gateway
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const gatewayName = config.requireObject("gatewayName");
* const vpcId = config.requireObject("vpcId");
* const networkId = config.requireObject("networkId");
* const gatewaySpecification = config.requireObject("gatewaySpecification");
* const test = new huaweicloud.nat.Gateway("test", {
* description: "test for terraform",
* spec: gatewaySpecification,
* vpcId: vpcId,
* subnetId: networkId,
* chargingMode: "prePaid",
* periodUnit: "month",
* period: 1,
* autoRenew: "true",
* });
* ```
*
* ## Import
*
* NAT gateways can be imported using their `id`, e.g. bash
*
* ```sh
* $ pulumi import huaweicloud:Nat/gateway:Gateway test <id>
* ```
*
* 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`charging_mode`, `period_unit`, `period` and `auto_renew`. It is generally recommended running `terraform plan` after importing a resource. You can then decide if changes should be applied to the resource, or the resource definition should be updated to align with the resource. Also, you can ignore changes as below. hcl resource "huaweicloud_nat_gateway" "test" {
*
* ...
*
* lifecycle {
*
* ignore_changes = [
*
* charging_mode, period_unit, period, auto_renew,
*
* ]
*
* } }
*/
class Gateway extends pulumi.CustomResource {
/**
* Get an existing Gateway 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 Gateway(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Gateway. 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'] === Gateway.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["autoRenew"] = state ? state.autoRenew : undefined;
resourceInputs["billingInfo"] = state ? state.billingInfo : undefined;
resourceInputs["bpsMax"] = state ? state.bpsMax : undefined;
resourceInputs["chargingMode"] = state ? state.chargingMode : undefined;
resourceInputs["createdAt"] = state ? state.createdAt : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["dnatRulesLimit"] = state ? state.dnatRulesLimit : undefined;
resourceInputs["enterpriseProjectId"] = state ? state.enterpriseProjectId : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["ngportIpAddress"] = state ? state.ngportIpAddress : undefined;
resourceInputs["period"] = state ? state.period : undefined;
resourceInputs["periodUnit"] = state ? state.periodUnit : undefined;
resourceInputs["ppsMax"] = state ? state.ppsMax : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["sessionConf"] = state ? state.sessionConf : undefined;
resourceInputs["snatRulePublicIpLimit"] = state ? state.snatRulePublicIpLimit : undefined;
resourceInputs["spec"] = state ? state.spec : undefined;
resourceInputs["status"] = state ? state.status : undefined;
resourceInputs["subnetId"] = state ? state.subnetId : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["vpcId"] = state ? state.vpcId : undefined;
}
else {
const args = argsOrState;
if ((!args || args.spec === undefined) && !opts.urn) {
throw new Error("Missing required property 'spec'");
}
if ((!args || args.subnetId === undefined) && !opts.urn) {
throw new Error("Missing required property 'subnetId'");
}
if ((!args || args.vpcId === undefined) && !opts.urn) {
throw new Error("Missing required property 'vpcId'");
}
resourceInputs["autoRenew"] = args ? args.autoRenew : undefined;
resourceInputs["chargingMode"] = args ? args.chargingMode : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["enterpriseProjectId"] = args ? args.enterpriseProjectId : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["ngportIpAddress"] = args ? args.ngportIpAddress : undefined;
resourceInputs["period"] = args ? args.period : undefined;
resourceInputs["periodUnit"] = args ? args.periodUnit : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["sessionConf"] = args ? args.sessionConf : undefined;
resourceInputs["spec"] = args ? args.spec : undefined;
resourceInputs["subnetId"] = args ? args.subnetId : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["vpcId"] = args ? args.vpcId : undefined;
resourceInputs["billingInfo"] = undefined /*out*/;
resourceInputs["bpsMax"] = undefined /*out*/;
resourceInputs["createdAt"] = undefined /*out*/;
resourceInputs["dnatRulesLimit"] = undefined /*out*/;
resourceInputs["ppsMax"] = undefined /*out*/;
resourceInputs["snatRulePublicIpLimit"] = undefined /*out*/;
resourceInputs["status"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Gateway.__pulumiType, name, resourceInputs, opts);
}
}
exports.Gateway = Gateway;
/** @internal */
Gateway.__pulumiType = 'huaweicloud:Nat/gateway:Gateway';
//# sourceMappingURL=gateway.js.map