"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.Endpoint = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * Provides a resource to manage mongodb endpoint
 * ## 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 fooAddress: volcengine.eip.Address[] = [];
 * for (const range = {value: 0}; range.value < 2; range.value++) {
 *     fooAddress.push(new volcengine.eip.Address(`fooAddress-${range.value}`, {
 *         billingType: "PostPaidByBandwidth",
 *         bandwidth: 1,
 *         isp: "ChinaUnicom",
 *         description: "acc-test",
 *         projectName: "default",
 *     }));
 * }
 * const replica_set = new volcengine.mongodb.Instance("replica-set", {
 *     dbEngineVersion: "MongoDB_4_0",
 *     instanceType: "ReplicaSet",
 *     superAccountPassword: "@acc-test-123",
 *     nodeSpec: "mongo.2c4g",
 *     mongosNodeSpec: "mongo.mongos.2c4g",
 *     instanceName: "acc-test-mongo-replica",
 *     chargeType: "PostPaid",
 *     projectName: "default",
 *     mongosNodeNumber: 2,
 *     shardNumber: 3,
 *     storageSpaceGb: 20,
 *     subnetId: fooSubnet.id,
 *     zoneId: fooZones.then(fooZones => fooZones.zones?.[0]?.id),
 *     tags: [{
 *         key: "k1",
 *         value: "v1",
 *     }],
 * });
 * const replica_set_public_endpoint = new volcengine.mongodb.Endpoint("replica-set-public-endpoint", {
 *     instanceId: replica_set.id,
 *     networkType: "Public",
 *     eipIds: fooAddress.map(__item => __item.id),
 * });
 * const sharded_cluster = new volcengine.mongodb.Instance("sharded-cluster", {
 *     dbEngineVersion: "MongoDB_4_0",
 *     instanceType: "ShardedCluster",
 *     superAccountPassword: "@acc-test-123",
 *     nodeSpec: "mongo.shard.1c2g",
 *     mongosNodeSpec: "mongo.mongos.1c2g",
 *     instanceName: "acc-test-mongo-shard",
 *     chargeType: "PostPaid",
 *     projectName: "default",
 *     mongosNodeNumber: 2,
 *     shardNumber: 2,
 *     storageSpaceGb: 20,
 *     subnetId: fooSubnet.id,
 *     zoneId: fooZones.then(fooZones => fooZones.zones?.[0]?.id),
 *     tags: [{
 *         key: "k1",
 *         value: "v1",
 *     }],
 * });
 * const sharded_cluster_private_endpoint = new volcengine.mongodb.Endpoint("sharded-cluster-private-endpoint", {
 *     instanceId: sharded_cluster.id,
 *     networkType: "Private",
 *     objectId: sharded_cluster.shards.apply(shards => shards[0].shardId),
 * });
 * ```
 *
 * ## Import
 *
 * mongodb endpoint can be imported using the instanceId:endpointId
 * `instanceId`: represents the instance that endpoint related to.
 * `endpointId`: the id of endpoint.
 * e.g.
 *
 * ```sh
 * $ pulumi import volcengine:mongodb/endpoint:Endpoint default mongo-replica-e405f8e2****:BRhFA0pDAk0XXkxCZQ
 * ```
 */
class Endpoint extends pulumi.CustomResource {
    /**
     * Get an existing Endpoint 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 Endpoint(name, state, Object.assign(Object.assign({}, opts), { id: id }));
    }
    /**
     * Returns true if the given object is an instance of Endpoint.  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'] === Endpoint.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["eipIds"] = state ? state.eipIds : undefined;
            resourceInputs["endpointId"] = state ? state.endpointId : undefined;
            resourceInputs["instanceId"] = state ? state.instanceId : undefined;
            resourceInputs["mongosNodeIds"] = state ? state.mongosNodeIds : undefined;
            resourceInputs["networkType"] = state ? state.networkType : undefined;
            resourceInputs["objectId"] = state ? state.objectId : undefined;
        }
        else {
            const args = argsOrState;
            if ((!args || args.instanceId === undefined) && !opts.urn) {
                throw new Error("Missing required property 'instanceId'");
            }
            resourceInputs["eipIds"] = args ? args.eipIds : undefined;
            resourceInputs["instanceId"] = args ? args.instanceId : undefined;
            resourceInputs["mongosNodeIds"] = args ? args.mongosNodeIds : undefined;
            resourceInputs["networkType"] = args ? args.networkType : undefined;
            resourceInputs["objectId"] = args ? args.objectId : undefined;
            resourceInputs["endpointId"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(Endpoint.__pulumiType, name, resourceInputs, opts);
    }
}
exports.Endpoint = Endpoint;
/** @internal */
Endpoint.__pulumiType = 'volcengine:mongodb/endpoint:Endpoint';
//# sourceMappingURL=endpoint.js.map