"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.Connection = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * A connection allows BigQuery connections to external data sources..
 *
 * To get more information about Connection, see:
 *
 * * [API documentation](https://cloud.google.com/bigquery/docs/reference/bigqueryconnection/rest/v1/projects.locations.connections/create)
 * * How-to Guides
 *     * [Cloud SQL federated queries](https://cloud.google.com/bigquery/docs/cloud-sql-federated-queries)
 *
 * ## Example Usage
 *
 * ### Bigquery Connection Cloud Resource
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const connection = new gcp.bigquery.Connection("connection", {
 *     connectionId: "my-connection",
 *     location: "US",
 *     friendlyName: "👋",
 *     description: "a riveting description",
 *     cloudResource: {},
 * });
 * ```
 * ### Bigquery Connection Basic
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * import * as random from "@pulumi/random";
 *
 * const instance = new gcp.sql.DatabaseInstance("instance", {
 *     name: "my-database-instance",
 *     databaseVersion: "POSTGRES_11",
 *     region: "us-central1",
 *     settings: {
 *         tier: "db-f1-micro",
 *     },
 *     deletionProtection: true,
 * });
 * const db = new gcp.sql.Database("db", {
 *     instance: instance.name,
 *     name: "db",
 * });
 * const pwd = new random.index.Password("pwd", {
 *     length: 16,
 *     special: false,
 * });
 * const user = new gcp.sql.User("user", {
 *     name: "user",
 *     instance: instance.name,
 *     password: pwd.result,
 * });
 * const connection = new gcp.bigquery.Connection("connection", {
 *     friendlyName: "👋",
 *     description: "a riveting description",
 *     location: "US",
 *     cloudSql: {
 *         instanceId: instance.connectionName,
 *         database: db.name,
 *         type: "POSTGRES",
 *         credential: {
 *             username: user.name,
 *             password: user.password,
 *         },
 *     },
 * });
 * ```
 * ### Bigquery Connection Full
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * import * as random from "@pulumi/random";
 *
 * const instance = new gcp.sql.DatabaseInstance("instance", {
 *     name: "my-database-instance",
 *     databaseVersion: "POSTGRES_11",
 *     region: "us-central1",
 *     settings: {
 *         tier: "db-f1-micro",
 *     },
 *     deletionProtection: true,
 * });
 * const db = new gcp.sql.Database("db", {
 *     instance: instance.name,
 *     name: "db",
 * });
 * const pwd = new random.index.Password("pwd", {
 *     length: 16,
 *     special: false,
 * });
 * const user = new gcp.sql.User("user", {
 *     name: "user",
 *     instance: instance.name,
 *     password: pwd.result,
 * });
 * const connection = new gcp.bigquery.Connection("connection", {
 *     connectionId: "my-connection",
 *     location: "US",
 *     friendlyName: "👋",
 *     description: "a riveting description",
 *     cloudSql: {
 *         instanceId: instance.connectionName,
 *         database: db.name,
 *         type: "POSTGRES",
 *         credential: {
 *             username: user.name,
 *             password: user.password,
 *         },
 *     },
 * });
 * ```
 * ### Bigquery Connection Aws
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const connection = new gcp.bigquery.Connection("connection", {
 *     connectionId: "my-connection",
 *     location: "aws-us-east-1",
 *     friendlyName: "👋",
 *     description: "a riveting description",
 *     aws: {
 *         accessRole: {
 *             iamRoleId: "arn:aws:iam::999999999999:role/omnirole",
 *         },
 *     },
 * });
 * ```
 * ### Bigquery Connection Azure
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const connection = new gcp.bigquery.Connection("connection", {
 *     connectionId: "my-connection",
 *     location: "azure-eastus2",
 *     friendlyName: "👋",
 *     description: "a riveting description",
 *     azure: {
 *         customerTenantId: "customer-tenant-id",
 *         federatedApplicationClientId: "b43eeeee-eeee-eeee-eeee-a480155501ce",
 *     },
 * });
 * ```
 * ### Bigquery Connection Cloudspanner
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const connection = new gcp.bigquery.Connection("connection", {
 *     connectionId: "my-connection",
 *     location: "US",
 *     friendlyName: "👋",
 *     description: "a riveting description",
 *     cloudSpanner: {
 *         database: "projects/project/instances/instance/databases/database",
 *         databaseRole: "database_role",
 *     },
 * });
 * ```
 * ### Bigquery Connection Cloudspanner Databoost
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const connection = new gcp.bigquery.Connection("connection", {
 *     connectionId: "my-connection",
 *     location: "US",
 *     friendlyName: "👋",
 *     description: "a riveting description",
 *     cloudSpanner: {
 *         database: "projects/project/instances/instance/databases/database",
 *         useParallelism: true,
 *         useDataBoost: true,
 *         maxParallelism: 100,
 *     },
 * });
 * ```
 * ### Bigquery Connection Spark
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const basic = new gcp.dataproc.Cluster("basic", {
 *     name: "my-connection",
 *     region: "us-central1",
 *     clusterConfig: {
 *         softwareConfig: {
 *             overrideProperties: {
 *                 "dataproc:dataproc.allow.zero.workers": "true",
 *             },
 *         },
 *         masterConfig: {
 *             numInstances: 1,
 *             machineType: "e2-standard-2",
 *             diskConfig: {
 *                 bootDiskSizeGb: 35,
 *             },
 *         },
 *     },
 * });
 * const connection = new gcp.bigquery.Connection("connection", {
 *     connectionId: "my-connection",
 *     location: "US",
 *     friendlyName: "👋",
 *     description: "a riveting description",
 *     spark: {
 *         sparkHistoryServerConfig: {
 *             dataprocCluster: basic.id,
 *         },
 *     },
 * });
 * ```
 * ### Bigquery Connection Sql With Cmek
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const instance = new gcp.sql.DatabaseInstance("instance", {
 *     name: "my-database-instance",
 *     region: "us-central1",
 *     databaseVersion: "POSTGRES_11",
 *     settings: {
 *         tier: "db-f1-micro",
 *     },
 *     deletionProtection: true,
 * });
 * const db = new gcp.sql.Database("db", {
 *     instance: instance.name,
 *     name: "db",
 * });
 * const user = new gcp.sql.User("user", {
 *     name: "user",
 *     instance: instance.name,
 *     password: "tf-test-my-password_15222",
 * });
 * const bq_connection_cmek = new gcp.bigquery.Connection("bq-connection-cmek", {
 *     friendlyName: "👋",
 *     description: "a riveting description",
 *     location: "US",
 *     kmsKeyName: "projects/project/locations/us-central1/keyRings/us-central1/cryptoKeys/bq-key",
 *     cloudSql: {
 *         instanceId: instance.connectionName,
 *         database: db.name,
 *         type: "POSTGRES",
 *         credential: {
 *             username: user.name,
 *             password: user.password,
 *         },
 *     },
 * });
 * ```
 *
 * ## Import
 *
 * Connection can be imported using any of these accepted formats:
 *
 * * `projects/{{project}}/locations/{{location}}/connections/{{connection_id}}`
 *
 * * `{{project}}/{{location}}/{{connection_id}}`
 *
 * * `{{location}}/{{connection_id}}`
 *
 * When using the `pulumi import` command, Connection can be imported using one of the formats above. For example:
 *
 * ```sh
 * $ pulumi import gcp:bigquery/connection:Connection default projects/{{project}}/locations/{{location}}/connections/{{connection_id}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:bigquery/connection:Connection default {{project}}/{{location}}/{{connection_id}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:bigquery/connection:Connection default {{location}}/{{connection_id}}
 * ```
 */
class Connection extends pulumi.CustomResource {
    /**
     * Get an existing Connection 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 Connection(name, state, { ...opts, id: id });
    }
    /**
     * Returns true if the given object is an instance of Connection.  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'] === Connection.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["aws"] = state?.aws;
            resourceInputs["azure"] = state?.azure;
            resourceInputs["cloudResource"] = state?.cloudResource;
            resourceInputs["cloudSpanner"] = state?.cloudSpanner;
            resourceInputs["cloudSql"] = state?.cloudSql;
            resourceInputs["connectionId"] = state?.connectionId;
            resourceInputs["description"] = state?.description;
            resourceInputs["friendlyName"] = state?.friendlyName;
            resourceInputs["hasCredential"] = state?.hasCredential;
            resourceInputs["kmsKeyName"] = state?.kmsKeyName;
            resourceInputs["location"] = state?.location;
            resourceInputs["name"] = state?.name;
            resourceInputs["project"] = state?.project;
            resourceInputs["spark"] = state?.spark;
        }
        else {
            const args = argsOrState;
            resourceInputs["aws"] = args?.aws;
            resourceInputs["azure"] = args?.azure;
            resourceInputs["cloudResource"] = args?.cloudResource;
            resourceInputs["cloudSpanner"] = args?.cloudSpanner;
            resourceInputs["cloudSql"] = args?.cloudSql;
            resourceInputs["connectionId"] = args?.connectionId;
            resourceInputs["description"] = args?.description;
            resourceInputs["friendlyName"] = args?.friendlyName;
            resourceInputs["kmsKeyName"] = args?.kmsKeyName;
            resourceInputs["location"] = args?.location;
            resourceInputs["project"] = args?.project;
            resourceInputs["spark"] = args?.spark;
            resourceInputs["hasCredential"] = undefined /*out*/;
            resourceInputs["name"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(Connection.__pulumiType, name, resourceInputs, opts);
    }
}
exports.Connection = Connection;
/** @internal */
Connection.__pulumiType = 'gcp:bigquery/connection:Connection';
//# sourceMappingURL=connection.js.map