"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.DatabaseEndpoint = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * Provides a resource to manage rds postgresql database endpoint
 * ## Example Usage
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as volcengine from "@volcengine/pulumi";
 *
 * const cluster = new volcengine.rds_postgresql.DatabaseEndpoint("cluster", {
 *     endpointId: "postgres-72715e0d9f58-cluster",
 *     endpointName: "默认终端",
 *     endpointType: "Cluster",
 *     instanceId: "postgres-72715e0d9f58",
 *     readOnlyNodeDistributionType: "Custom",
 *     readOnlyNodeMaxDelayTime: 40,
 *     readWriteMode: "ReadWrite",
 *     readWriteProxyConnection: 20,
 *     writeNodeHaltWriting: false,
 *     readWriteSplitting: true,
 *     readOnlyNodeWeights: [{
 *         nodeId: undefined,
 *         nodeType: "Primary",
 *         weight: 200,
 *     }],
 *     dnsVisibility: true,
 *     port: "5432",
 * });
 * const example = new volcengine.rds_postgresql.DatabaseEndpoint("example", {
 *     instanceId: "postgres-72715e0d9f58",
 *     endpointName: "tf-test",
 *     endpointType: "Custom",
 *     nodes: "Primary",
 *     readWriteMode: "ReadWrite",
 * });
 * ```
 *
 * ## Import
 *
 * RdsPostgresqlDatabaseEndpoint can be imported using the id, e.g.
 *
 * ```sh
 * $ pulumi import volcengine:rds_postgresql/databaseEndpoint:DatabaseEndpoint default resource_id
 * ```
 */
class DatabaseEndpoint extends pulumi.CustomResource {
    /**
     * Get an existing DatabaseEndpoint 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 DatabaseEndpoint(name, state, Object.assign(Object.assign({}, opts), { id: id }));
    }
    /**
     * Returns true if the given object is an instance of DatabaseEndpoint.  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'] === DatabaseEndpoint.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["dnsVisibility"] = state ? state.dnsVisibility : undefined;
            resourceInputs["domainPrefix"] = state ? state.domainPrefix : undefined;
            resourceInputs["endpointId"] = state ? state.endpointId : undefined;
            resourceInputs["endpointName"] = state ? state.endpointName : undefined;
            resourceInputs["endpointType"] = state ? state.endpointType : undefined;
            resourceInputs["globalReadOnly"] = state ? state.globalReadOnly : undefined;
            resourceInputs["instanceId"] = state ? state.instanceId : undefined;
            resourceInputs["nodes"] = state ? state.nodes : undefined;
            resourceInputs["port"] = state ? state.port : undefined;
            resourceInputs["readOnlyNodeDistributionType"] = state ? state.readOnlyNodeDistributionType : undefined;
            resourceInputs["readOnlyNodeMaxDelayTime"] = state ? state.readOnlyNodeMaxDelayTime : undefined;
            resourceInputs["readOnlyNodeWeights"] = state ? state.readOnlyNodeWeights : undefined;
            resourceInputs["readWriteMode"] = state ? state.readWriteMode : undefined;
            resourceInputs["readWriteProxyConnection"] = state ? state.readWriteProxyConnection : undefined;
            resourceInputs["readWriteSplitting"] = state ? state.readWriteSplitting : undefined;
            resourceInputs["writeNodeHaltWriting"] = state ? state.writeNodeHaltWriting : undefined;
        }
        else {
            const args = argsOrState;
            if ((!args || args.endpointName === undefined) && !opts.urn) {
                throw new Error("Missing required property 'endpointName'");
            }
            if ((!args || args.instanceId === undefined) && !opts.urn) {
                throw new Error("Missing required property 'instanceId'");
            }
            resourceInputs["dnsVisibility"] = args ? args.dnsVisibility : undefined;
            resourceInputs["domainPrefix"] = args ? args.domainPrefix : undefined;
            resourceInputs["endpointId"] = args ? args.endpointId : undefined;
            resourceInputs["endpointName"] = args ? args.endpointName : undefined;
            resourceInputs["endpointType"] = args ? args.endpointType : undefined;
            resourceInputs["globalReadOnly"] = args ? args.globalReadOnly : undefined;
            resourceInputs["instanceId"] = args ? args.instanceId : undefined;
            resourceInputs["nodes"] = args ? args.nodes : undefined;
            resourceInputs["port"] = args ? args.port : undefined;
            resourceInputs["readOnlyNodeDistributionType"] = args ? args.readOnlyNodeDistributionType : undefined;
            resourceInputs["readOnlyNodeMaxDelayTime"] = args ? args.readOnlyNodeMaxDelayTime : undefined;
            resourceInputs["readOnlyNodeWeights"] = args ? args.readOnlyNodeWeights : undefined;
            resourceInputs["readWriteMode"] = args ? args.readWriteMode : undefined;
            resourceInputs["readWriteProxyConnection"] = args ? args.readWriteProxyConnection : undefined;
            resourceInputs["readWriteSplitting"] = args ? args.readWriteSplitting : undefined;
            resourceInputs["writeNodeHaltWriting"] = args ? args.writeNodeHaltWriting : undefined;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(DatabaseEndpoint.__pulumiType, name, resourceInputs, opts);
    }
}
exports.DatabaseEndpoint = DatabaseEndpoint;
/** @internal */
DatabaseEndpoint.__pulumiType = 'volcengine:rds_postgresql/databaseEndpoint:DatabaseEndpoint';
//# sourceMappingURL=databaseEndpoint.js.map