"use strict";
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.ClusterUserCreatedConnections = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * ## Example Usage
 *
 * ### Redis Cluster User Created Connections
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const network1 = new gcp.compute.Network("network1", {
 *     name: "net1",
 *     autoCreateSubnetworks: false,
 * });
 * const subnetNetwork1 = new gcp.compute.Subnetwork("subnet_network1", {
 *     name: "subnet-net1",
 *     ipCidrRange: "10.0.0.248/29",
 *     region: "us-central1",
 *     network: network1.id,
 * });
 * const ip1Network1 = new gcp.compute.Address("ip1_network1", {
 *     name: "ip1-net1",
 *     region: "us-central1",
 *     subnetwork: subnetNetwork1.id,
 *     addressType: "INTERNAL",
 *     purpose: "GCE_ENDPOINT",
 * });
 * // redis cluster without endpoint
 * const cluster_user_connCluster = new gcp.redis.Cluster("cluster-user-conn", {
 *     name: "cluster-user-conn",
 *     shardCount: 3,
 *     region: "us-central1",
 *     replicaCount: 0,
 *     deletionProtectionEnabled: false,
 * });
 * const forwardingRule1Network1 = new gcp.compute.ForwardingRule("forwarding_rule1_network1", {
 *     name: "fwd1-net1",
 *     region: "us-central1",
 *     ipAddress: ip1Network1.id,
 *     loadBalancingScheme: "",
 *     network: network1.id,
 *     target: cluster_user_connCluster.pscServiceAttachments.apply(pscServiceAttachments => pscServiceAttachments[0].serviceAttachment),
 * });
 * const ip2Network1 = new gcp.compute.Address("ip2_network1", {
 *     name: "ip2-net1",
 *     region: "us-central1",
 *     subnetwork: subnetNetwork1.id,
 *     addressType: "INTERNAL",
 *     purpose: "GCE_ENDPOINT",
 * });
 * const forwardingRule2Network1 = new gcp.compute.ForwardingRule("forwarding_rule2_network1", {
 *     name: "fwd2-net1",
 *     region: "us-central1",
 *     ipAddress: ip2Network1.id,
 *     loadBalancingScheme: "",
 *     network: network1.id,
 *     target: cluster_user_connCluster.pscServiceAttachments.apply(pscServiceAttachments => pscServiceAttachments[1].serviceAttachment),
 * });
 * const network2 = new gcp.compute.Network("network2", {
 *     name: "network2",
 *     autoCreateSubnetworks: false,
 * });
 * const subnetNetwork2 = new gcp.compute.Subnetwork("subnet_network2", {
 *     name: "subnet-net2",
 *     ipCidrRange: "10.0.0.248/29",
 *     region: "us-central1",
 *     network: network2.id,
 * });
 * const ip1Network2 = new gcp.compute.Address("ip1_network2", {
 *     name: "ip1-net2",
 *     region: "us-central1",
 *     subnetwork: subnetNetwork2.id,
 *     addressType: "INTERNAL",
 *     purpose: "GCE_ENDPOINT",
 * });
 * const forwardingRule1Network2 = new gcp.compute.ForwardingRule("forwarding_rule1_network2", {
 *     name: "fwd1-net2",
 *     region: "us-central1",
 *     ipAddress: ip1Network2.id,
 *     loadBalancingScheme: "",
 *     network: network2.id,
 *     target: cluster_user_connCluster.pscServiceAttachments.apply(pscServiceAttachments => pscServiceAttachments[0].serviceAttachment),
 * });
 * const ip2Network2 = new gcp.compute.Address("ip2_network2", {
 *     name: "ip2-net2",
 *     region: "us-central1",
 *     subnetwork: subnetNetwork2.id,
 *     addressType: "INTERNAL",
 *     purpose: "GCE_ENDPOINT",
 * });
 * const forwardingRule2Network2 = new gcp.compute.ForwardingRule("forwarding_rule2_network2", {
 *     name: "fwd2-net2",
 *     region: "us-central1",
 *     ipAddress: ip2Network2.id,
 *     loadBalancingScheme: "",
 *     network: network2.id,
 *     target: cluster_user_connCluster.pscServiceAttachments.apply(pscServiceAttachments => pscServiceAttachments[1].serviceAttachment),
 * });
 * const project = gcp.organizations.getProject({});
 * const cluster_user_conn = new gcp.redis.ClusterUserCreatedConnections("cluster-user-conn", {
 *     name: "cluster-user-conn",
 *     region: "us-central1",
 *     clusterEndpoints: [
 *         {
 *             connections: [
 *                 {
 *                     pscConnection: {
 *                         pscConnectionId: forwardingRule1Network1.pscConnectionId,
 *                         address: ip1Network1.address,
 *                         forwardingRule: forwardingRule1Network1.id,
 *                         network: network1.id,
 *                         projectId: project.then(project => project.projectId),
 *                         serviceAttachment: cluster_user_connCluster.pscServiceAttachments.apply(pscServiceAttachments => pscServiceAttachments[0].serviceAttachment),
 *                     },
 *                 },
 *                 {
 *                     pscConnection: {
 *                         pscConnectionId: forwardingRule2Network1.pscConnectionId,
 *                         address: ip2Network1.address,
 *                         forwardingRule: forwardingRule2Network1.id,
 *                         network: network1.id,
 *                         serviceAttachment: cluster_user_connCluster.pscServiceAttachments.apply(pscServiceAttachments => pscServiceAttachments[1].serviceAttachment),
 *                     },
 *                 },
 *             ],
 *         },
 *         {
 *             connections: [
 *                 {
 *                     pscConnection: {
 *                         pscConnectionId: forwardingRule1Network2.pscConnectionId,
 *                         address: ip1Network2.address,
 *                         forwardingRule: forwardingRule1Network2.id,
 *                         network: network2.id,
 *                         serviceAttachment: cluster_user_connCluster.pscServiceAttachments.apply(pscServiceAttachments => pscServiceAttachments[0].serviceAttachment),
 *                     },
 *                 },
 *                 {
 *                     pscConnection: {
 *                         pscConnectionId: forwardingRule2Network2.pscConnectionId,
 *                         address: ip2Network2.address,
 *                         forwardingRule: forwardingRule2Network2.id,
 *                         network: network2.id,
 *                         serviceAttachment: cluster_user_connCluster.pscServiceAttachments.apply(pscServiceAttachments => pscServiceAttachments[1].serviceAttachment),
 *                     },
 *                 },
 *             ],
 *         },
 *     ],
 * });
 * ```
 * ### Redis Cluster User And Auto Created Connections
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const network2 = new gcp.compute.Network("network2", {
 *     name: "network2",
 *     autoCreateSubnetworks: false,
 * });
 * const subnetNetwork2 = new gcp.compute.Subnetwork("subnet_network2", {
 *     name: "subnet-net2",
 *     ipCidrRange: "10.0.0.248/29",
 *     region: "us-central1",
 *     network: network2.id,
 * });
 * const ip1Network2 = new gcp.compute.Address("ip1_network2", {
 *     name: "ip1-net2",
 *     region: "us-central1",
 *     subnetwork: subnetNetwork2.id,
 *     addressType: "INTERNAL",
 *     purpose: "GCE_ENDPOINT",
 * });
 * const network1 = new gcp.compute.Network("network1", {
 *     name: "net1",
 *     autoCreateSubnetworks: false,
 * });
 * const subnetNetwork1 = new gcp.compute.Subnetwork("subnet_network1", {
 *     name: "subnet-net1",
 *     ipCidrRange: "10.0.0.248/29",
 *     region: "us-central1",
 *     network: network1.id,
 * });
 * const _default = new gcp.networkconnectivity.ServiceConnectionPolicy("default", {
 *     name: "scpolicy",
 *     location: "us-central1",
 *     serviceClass: "gcp-memorystore-redis",
 *     description: "my basic service connection policy",
 *     network: network1.id,
 *     pscConfig: {
 *         subnetworks: [subnetNetwork1.id],
 *     },
 * });
 * // redis cluster without endpoint
 * const cluster_user_auto_connCluster = new gcp.redis.Cluster("cluster-user-auto-conn", {
 *     name: "cluster-user-auto-conn",
 *     shardCount: 3,
 *     region: "us-central1",
 *     replicaCount: 0,
 *     deletionProtectionEnabled: false,
 *     pscConfigs: [{
 *         network: network1.id,
 *     }],
 * }, {
 *     dependsOn: [_default],
 * });
 * const forwardingRule1Network2 = new gcp.compute.ForwardingRule("forwarding_rule1_network2", {
 *     name: "fwd1-net2",
 *     region: "us-central1",
 *     ipAddress: ip1Network2.id,
 *     loadBalancingScheme: "",
 *     network: network2.id,
 *     target: cluster_user_auto_connCluster.pscServiceAttachments.apply(pscServiceAttachments => pscServiceAttachments[0].serviceAttachment),
 * });
 * const ip2Network2 = new gcp.compute.Address("ip2_network2", {
 *     name: "ip2-net2",
 *     region: "us-central1",
 *     subnetwork: subnetNetwork2.id,
 *     addressType: "INTERNAL",
 *     purpose: "GCE_ENDPOINT",
 * });
 * const forwardingRule2Network2 = new gcp.compute.ForwardingRule("forwarding_rule2_network2", {
 *     name: "fwd2-net2",
 *     region: "us-central1",
 *     ipAddress: ip2Network2.id,
 *     loadBalancingScheme: "",
 *     network: network2.id,
 *     target: cluster_user_auto_connCluster.pscServiceAttachments.apply(pscServiceAttachments => pscServiceAttachments[1].serviceAttachment),
 * });
 * const cluster_user_auto_conn = new gcp.redis.ClusterUserCreatedConnections("cluster-user-auto-conn", {
 *     name: "cluster-user-auto-conn",
 *     region: "us-central1",
 *     clusterEndpoints: [{
 *         connections: [
 *             {
 *                 pscConnection: {
 *                     pscConnectionId: forwardingRule1Network2.pscConnectionId,
 *                     address: ip1Network2.address,
 *                     forwardingRule: forwardingRule1Network2.id,
 *                     network: network2.id,
 *                     serviceAttachment: cluster_user_auto_connCluster.pscServiceAttachments.apply(pscServiceAttachments => pscServiceAttachments[0].serviceAttachment),
 *                 },
 *             },
 *             {
 *                 pscConnection: {
 *                     pscConnectionId: forwardingRule2Network2.pscConnectionId,
 *                     address: ip2Network2.address,
 *                     forwardingRule: forwardingRule2Network2.id,
 *                     network: network2.id,
 *                     serviceAttachment: cluster_user_auto_connCluster.pscServiceAttachments.apply(pscServiceAttachments => pscServiceAttachments[1].serviceAttachment),
 *                 },
 *             },
 *         ],
 *     }],
 * });
 * ```
 *
 * ## Import
 *
 * ClusterUserCreatedConnections can be imported using any of these accepted formats:
 *
 * * `projects/{{project}}/locations/{{region}}/clusters/{{name}}`
 *
 * * `{{project}}/{{region}}/{{name}}`
 *
 * * `{{region}}/{{name}}`
 *
 * * `{{name}}`
 *
 * When using the `pulumi import` command, ClusterUserCreatedConnections can be imported using one of the formats above. For example:
 *
 * ```sh
 * $ pulumi import gcp:redis/clusterUserCreatedConnections:ClusterUserCreatedConnections default projects/{{project}}/locations/{{region}}/clusters/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:redis/clusterUserCreatedConnections:ClusterUserCreatedConnections default {{project}}/{{region}}/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:redis/clusterUserCreatedConnections:ClusterUserCreatedConnections default {{region}}/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:redis/clusterUserCreatedConnections:ClusterUserCreatedConnections default {{name}}
 * ```
 */
class ClusterUserCreatedConnections extends pulumi.CustomResource {
    /**
     * Get an existing ClusterUserCreatedConnections 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 ClusterUserCreatedConnections(name, state, { ...opts, id: id });
    }
    /**
     * Returns true if the given object is an instance of ClusterUserCreatedConnections.  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'] === ClusterUserCreatedConnections.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["clusterEndpoints"] = state?.clusterEndpoints;
            resourceInputs["name"] = state?.name;
            resourceInputs["project"] = state?.project;
            resourceInputs["region"] = state?.region;
        }
        else {
            const args = argsOrState;
            if (args?.region === undefined && !opts.urn) {
                throw new Error("Missing required property 'region'");
            }
            resourceInputs["clusterEndpoints"] = args?.clusterEndpoints;
            resourceInputs["name"] = args?.name;
            resourceInputs["project"] = args?.project;
            resourceInputs["region"] = args?.region;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(ClusterUserCreatedConnections.__pulumiType, name, resourceInputs, opts);
    }
}
exports.ClusterUserCreatedConnections = ClusterUserCreatedConnections;
/** @internal */
ClusterUserCreatedConnections.__pulumiType = 'gcp:redis/clusterUserCreatedConnections:ClusterUserCreatedConnections';
//# sourceMappingURL=clusterUserCreatedConnections.js.map