"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.DnatEntry = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * Provides a resource to manage dnat entry
 * ## 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,
 * });
 * const fooGateway = new volcengine.nat.Gateway("fooGateway", {
 *     vpcId: fooVpc.id,
 *     subnetId: fooSubnet.id,
 *     spec: "Small",
 *     natGatewayName: "acc-test-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: fooGateway.id,
 *     instanceType: "Nat",
 * });
 * 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: fooGateway.id,
 *     protocol: "tcp",
 * }, {
 *     dependsOn: [fooAssociate],
 * });
 * ```
 *
 * ## Import
 *
 * Dnat entry can be imported using the id, e.g.
 *
 * ```sh
 * $ pulumi import volcengine:nat/dnatEntry:DnatEntry default dnat-3fvhk47kf56****
 * ```
 */
class DnatEntry extends pulumi.CustomResource {
    /**
     * Get an existing DnatEntry 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 DnatEntry(name, state, Object.assign(Object.assign({}, opts), { id: id }));
    }
    /**
     * Returns true if the given object is an instance of DnatEntry.  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'] === DnatEntry.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["dnatEntryId"] = state ? state.dnatEntryId : undefined;
            resourceInputs["dnatEntryName"] = state ? state.dnatEntryName : undefined;
            resourceInputs["externalIp"] = state ? state.externalIp : undefined;
            resourceInputs["externalPort"] = state ? state.externalPort : undefined;
            resourceInputs["internalIp"] = state ? state.internalIp : undefined;
            resourceInputs["internalPort"] = state ? state.internalPort : undefined;
            resourceInputs["natGatewayId"] = state ? state.natGatewayId : undefined;
            resourceInputs["protocol"] = state ? state.protocol : undefined;
        }
        else {
            const args = argsOrState;
            if ((!args || args.externalIp === undefined) && !opts.urn) {
                throw new Error("Missing required property 'externalIp'");
            }
            if ((!args || args.externalPort === undefined) && !opts.urn) {
                throw new Error("Missing required property 'externalPort'");
            }
            if ((!args || args.internalIp === undefined) && !opts.urn) {
                throw new Error("Missing required property 'internalIp'");
            }
            if ((!args || args.internalPort === undefined) && !opts.urn) {
                throw new Error("Missing required property 'internalPort'");
            }
            if ((!args || args.natGatewayId === undefined) && !opts.urn) {
                throw new Error("Missing required property 'natGatewayId'");
            }
            if ((!args || args.protocol === undefined) && !opts.urn) {
                throw new Error("Missing required property 'protocol'");
            }
            resourceInputs["dnatEntryName"] = args ? args.dnatEntryName : undefined;
            resourceInputs["externalIp"] = args ? args.externalIp : undefined;
            resourceInputs["externalPort"] = args ? args.externalPort : undefined;
            resourceInputs["internalIp"] = args ? args.internalIp : undefined;
            resourceInputs["internalPort"] = args ? args.internalPort : undefined;
            resourceInputs["natGatewayId"] = args ? args.natGatewayId : undefined;
            resourceInputs["protocol"] = args ? args.protocol : undefined;
            resourceInputs["dnatEntryId"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(DnatEntry.__pulumiType, name, resourceInputs, opts);
    }
}
exports.DnatEntry = DnatEntry;
/** @internal */
DnatEntry.__pulumiType = 'volcengine:nat/dnatEntry:DnatEntry';
//# sourceMappingURL=dnatEntry.js.map