"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.BitbucketServerConfig = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * BitbucketServerConfig represents the configuration for a Bitbucket Server.
 *
 * To get more information about BitbucketServerConfig, see:
 *
 * * [API documentation](https://cloud.google.com/build/docs/api/reference/rest/v1/projects.locations.bitbucketServerConfigs)
 * * How-to Guides
 *     * [Connect to a Bitbucket Server host](https://cloud.google.com/build/docs/automating-builds/bitbucket/connect-host-bitbucket-server)
 *
 * ## Example Usage
 *
 * ### Cloudbuild Bitbucket Server Config
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const bbs_config = new gcp.cloudbuild.BitbucketServerConfig("bbs-config", {
 *     configId: "bbs-config",
 *     location: "us-central1",
 *     hostUri: "https://bbs.com",
 *     secrets: {
 *         adminAccessTokenVersionName: "projects/myProject/secrets/mybbspat/versions/1",
 *         readAccessTokenVersionName: "projects/myProject/secrets/mybbspat/versions/1",
 *         webhookSecretVersionName: "projects/myProject/secrets/mybbspat/versions/1",
 *     },
 *     username: "test",
 *     apiKey: "<api-key>",
 * });
 * ```
 * ### Cloudbuild Bitbucket Server Config Repositories
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const bbs_config_with_repos = new gcp.cloudbuild.BitbucketServerConfig("bbs-config-with-repos", {
 *     configId: "bbs-config",
 *     location: "us-central1",
 *     hostUri: "https://bbs.com",
 *     secrets: {
 *         adminAccessTokenVersionName: "projects/myProject/secrets/mybbspat/versions/1",
 *         readAccessTokenVersionName: "projects/myProject/secrets/mybbspat/versions/1",
 *         webhookSecretVersionName: "projects/myProject/secrets/mybbspat/versions/1",
 *     },
 *     username: "test",
 *     apiKey: "<api-key>",
 *     connectedRepositories: [
 *         {
 *             projectKey: "DEV",
 *             repoSlug: "repo1",
 *         },
 *         {
 *             projectKey: "PROD",
 *             repoSlug: "repo1",
 *         },
 *     ],
 * });
 * ```
 * ### Cloudbuild Bitbucket Server Config Peered Network
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * import * as std from "@pulumi/std";
 *
 * const project = gcp.organizations.getProject({});
 * const servicenetworking = new gcp.projects.Service("servicenetworking", {service: "servicenetworking.googleapis.com"});
 * const vpcNetwork = new gcp.compute.Network("vpc_network", {name: "vpc-network"}, {
 *     dependsOn: [servicenetworking],
 * });
 * const privateIpAlloc = new gcp.compute.GlobalAddress("private_ip_alloc", {
 *     name: "private-ip-alloc",
 *     purpose: "VPC_PEERING",
 *     addressType: "INTERNAL",
 *     prefixLength: 16,
 *     network: vpcNetwork.id,
 * });
 * const _default = new gcp.servicenetworking.Connection("default", {
 *     network: vpcNetwork.id,
 *     service: "servicenetworking.googleapis.com",
 *     reservedPeeringRanges: [privateIpAlloc.name],
 * }, {
 *     dependsOn: [servicenetworking],
 * });
 * const bbs_config_with_peered_network = new gcp.cloudbuild.BitbucketServerConfig("bbs-config-with-peered-network", {
 *     configId: "bbs-config",
 *     location: "us-central1",
 *     hostUri: "https://bbs.com",
 *     secrets: {
 *         adminAccessTokenVersionName: "projects/myProject/secrets/mybbspat/versions/1",
 *         readAccessTokenVersionName: "projects/myProject/secrets/mybbspat/versions/1",
 *         webhookSecretVersionName: "projects/myProject/secrets/mybbspat/versions/1",
 *     },
 *     username: "test",
 *     apiKey: "<api-key>",
 *     peeredNetwork: pulumi.all([vpcNetwork.id, project, project]).apply(([id, project, project1]) => std.replaceOutput({
 *         text: id,
 *         search: project.name,
 *         replace: project1.number,
 *     })).apply(invoke => invoke.result),
 *     sslCa: `-----BEGIN CERTIFICATE-----
 * -----END CERTIFICATE-----
 * -----BEGIN CERTIFICATE-----
 * -----END CERTIFICATE-----
 * `,
 * }, {
 *     dependsOn: [_default],
 * });
 * ```
 *
 * ## Import
 *
 * BitbucketServerConfig can be imported using any of these accepted formats:
 *
 * * `projects/{{project}}/locations/{{location}}/bitbucketServerConfigs/{{config_id}}`
 *
 * * `{{project}}/{{location}}/{{config_id}}`
 *
 * * `{{location}}/{{config_id}}`
 *
 * When using the `pulumi import` command, BitbucketServerConfig can be imported using one of the formats above. For example:
 *
 * ```sh
 * $ pulumi import gcp:cloudbuild/bitbucketServerConfig:BitbucketServerConfig default projects/{{project}}/locations/{{location}}/bitbucketServerConfigs/{{config_id}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:cloudbuild/bitbucketServerConfig:BitbucketServerConfig default {{project}}/{{location}}/{{config_id}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:cloudbuild/bitbucketServerConfig:BitbucketServerConfig default {{location}}/{{config_id}}
 * ```
 */
class BitbucketServerConfig extends pulumi.CustomResource {
    /**
     * Get an existing BitbucketServerConfig 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 BitbucketServerConfig(name, state, { ...opts, id: id });
    }
    /**
     * Returns true if the given object is an instance of BitbucketServerConfig.  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'] === BitbucketServerConfig.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["apiKey"] = state?.apiKey;
            resourceInputs["configId"] = state?.configId;
            resourceInputs["connectedRepositories"] = state?.connectedRepositories;
            resourceInputs["hostUri"] = state?.hostUri;
            resourceInputs["location"] = state?.location;
            resourceInputs["name"] = state?.name;
            resourceInputs["peeredNetwork"] = state?.peeredNetwork;
            resourceInputs["project"] = state?.project;
            resourceInputs["secrets"] = state?.secrets;
            resourceInputs["sslCa"] = state?.sslCa;
            resourceInputs["username"] = state?.username;
            resourceInputs["webhookKey"] = state?.webhookKey;
        }
        else {
            const args = argsOrState;
            if (args?.apiKey === undefined && !opts.urn) {
                throw new Error("Missing required property 'apiKey'");
            }
            if (args?.configId === undefined && !opts.urn) {
                throw new Error("Missing required property 'configId'");
            }
            if (args?.hostUri === undefined && !opts.urn) {
                throw new Error("Missing required property 'hostUri'");
            }
            if (args?.location === undefined && !opts.urn) {
                throw new Error("Missing required property 'location'");
            }
            if (args?.secrets === undefined && !opts.urn) {
                throw new Error("Missing required property 'secrets'");
            }
            if (args?.username === undefined && !opts.urn) {
                throw new Error("Missing required property 'username'");
            }
            resourceInputs["apiKey"] = args?.apiKey;
            resourceInputs["configId"] = args?.configId;
            resourceInputs["connectedRepositories"] = args?.connectedRepositories;
            resourceInputs["hostUri"] = args?.hostUri;
            resourceInputs["location"] = args?.location;
            resourceInputs["peeredNetwork"] = args?.peeredNetwork;
            resourceInputs["project"] = args?.project;
            resourceInputs["secrets"] = args?.secrets;
            resourceInputs["sslCa"] = args?.sslCa;
            resourceInputs["username"] = args?.username;
            resourceInputs["name"] = undefined /*out*/;
            resourceInputs["webhookKey"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(BitbucketServerConfig.__pulumiType, name, resourceInputs, opts);
    }
}
exports.BitbucketServerConfig = BitbucketServerConfig;
/** @internal */
BitbucketServerConfig.__pulumiType = 'gcp:cloudbuild/bitbucketServerConfig:BitbucketServerConfig';
//# sourceMappingURL=bitbucketServerConfig.js.map