@volcengine/pulumi
Version:
A Pulumi package for creating and managing volcengine cloud resources.
181 lines • 7.24 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");
/**
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as volcengine from "@pulumi/volcengine";
* import * as volcengine from "@volcengine/pulumi";
*
* const fooZones = volcengine.ecs.getZones({});
* const fooVpc = new volcengine.vpc.Vpc("fooVpc", {
* vpcName: "acc-test-vpc",
* cidrBlock: "172.16.0.0/16",
* });
* const fooSubnet = new volcengine.vpc.Subnet("fooSubnet", {
* subnetName: "acc-test-subnet",
* cidrBlock: "172.16.0.0/24",
* zoneId: fooZones.then(fooZones => fooZones.zones?.[0]?.id),
* vpcId: fooVpc.id,
* });
* // create internet nat gateway and snat entry and dnat entry
* const internetNatGateway = new volcengine.nat.Gateway("internetNatGateway", {
* vpcId: fooVpc.id,
* subnetId: fooSubnet.id,
* spec: "Small",
* natGatewayName: "acc-test-internet_ng",
* description: "acc-test",
* billingType: "PostPaid",
* projectName: "default",
* tags: [{
* key: "k1",
* value: "v1",
* }],
* });
* const fooAddress = new volcengine.eip.Address("fooAddress", {
* description: "acc-test",
* bandwidth: 1,
* billingType: "PostPaidByBandwidth",
* isp: "BGP",
* });
* const fooAssociate = new volcengine.eip.Associate("fooAssociate", {
* allocationId: fooAddress.id,
* instanceId: internetNatGateway.id,
* instanceType: "Nat",
* });
* const fooSnatEntry = new volcengine.nat.SnatEntry("fooSnatEntry", {
* snatEntryName: "acc-test-snat-entry",
* natGatewayId: internetNatGateway.id,
* eipId: fooAddress.id,
* sourceCidr: "172.16.0.0/24",
* }, {
* dependsOn: [fooAssociate],
* });
* const fooDnatEntry = new volcengine.nat.DnatEntry("fooDnatEntry", {
* dnatEntryName: "acc-test-dnat-entry",
* externalIp: fooAddress.eipAddress,
* externalPort: "80",
* internalIp: "172.16.0.10",
* internalPort: "80",
* natGatewayId: internetNatGateway.id,
* protocol: "tcp",
* }, {
* dependsOn: [fooAssociate],
* });
* // create intranet nat gateway and snat entry and dnat entry
* const intranetNatGateway = new volcengine.nat.Gateway("intranetNatGateway", {
* vpcId: fooVpc.id,
* subnetId: fooSubnet.id,
* natGatewayName: "acc-test-intranet_ng",
* description: "acc-test",
* networkType: "intranet",
* billingType: "PostPaidByUsage",
* projectName: "default",
* tags: [{
* key: "k1",
* value: "v1",
* }],
* });
* const fooIp = new volcengine.nat.Ip("fooIp", {
* natGatewayId: intranetNatGateway.id,
* natIpName: "acc-test-nat-ip",
* natIpDescription: "acc-test",
* natIp: "172.16.0.3",
* });
* const foo_intranetSnatEntry = new volcengine.nat.SnatEntry("foo-intranetSnatEntry", {
* snatEntryName: "acc-test-snat-entry-intranet",
* natGatewayId: intranetNatGateway.id,
* natIpId: fooIp.id,
* sourceCidr: "172.16.0.0/24",
* });
* const foo_intranetDnatEntry = new volcengine.nat.DnatEntry("foo-intranetDnatEntry", {
* natGatewayId: intranetNatGateway.id,
* dnatEntryName: "acc-test-dnat-entry-intranet",
* protocol: "tcp",
* internalIp: "172.16.0.5",
* internalPort: "82",
* externalIp: fooIp.natIp,
* externalPort: "87",
* });
* ```
*
* ## Import
*
* NatGateway can be imported using the id, e.g.
*
* ```sh
* $ pulumi import volcengine:nat/gateway:Gateway default ngw-vv3t043k05sm****
* ```
*/
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["billingType"] = state ? state.billingType : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["natGatewayName"] = state ? state.natGatewayName : undefined;
resourceInputs["networkType"] = state ? state.networkType : undefined;
resourceInputs["period"] = state ? state.period : undefined;
resourceInputs["projectName"] = state ? state.projectName : undefined;
resourceInputs["spec"] = state ? state.spec : 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.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["billingType"] = args ? args.billingType : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["natGatewayName"] = args ? args.natGatewayName : undefined;
resourceInputs["networkType"] = args ? args.networkType : undefined;
resourceInputs["period"] = args ? args.period : undefined;
resourceInputs["projectName"] = args ? args.projectName : 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;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Gateway.__pulumiType, name, resourceInputs, opts);
}
}
exports.Gateway = Gateway;
/** @internal */
Gateway.__pulumiType = 'volcengine:nat/gateway:Gateway';
//# sourceMappingURL=gateway.js.map