All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.gcp.cloudbuild.kotlin.BitbucketServerConfig.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 8.10.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.cloudbuild.kotlin

import com.pulumi.core.Output
import com.pulumi.gcp.cloudbuild.kotlin.outputs.BitbucketServerConfigConnectedRepository
import com.pulumi.gcp.cloudbuild.kotlin.outputs.BitbucketServerConfigSecrets
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import com.pulumi.gcp.cloudbuild.kotlin.outputs.BitbucketServerConfigConnectedRepository.Companion.toKotlin as bitbucketServerConfigConnectedRepositoryToKotlin
import com.pulumi.gcp.cloudbuild.kotlin.outputs.BitbucketServerConfigSecrets.Companion.toKotlin as bitbucketServerConfigSecretsToKotlin

/**
 * Builder for [BitbucketServerConfig].
 */
@PulumiTagMarker
public class BitbucketServerConfigResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: BitbucketServerConfigArgs = BitbucketServerConfigArgs()

    public var opts: CustomResourceOptions = CustomResourceOptions()

    /**
     * @param name The _unique_ name of the resulting resource.
     */
    public fun name(`value`: String) {
        this.name = value
    }

    /**
     * @param block The arguments to use to populate this resource's properties.
     */
    public suspend fun args(block: suspend BitbucketServerConfigArgsBuilder.() -> Unit) {
        val builder = BitbucketServerConfigArgsBuilder()
        block(builder)
        this.args = builder.build()
    }

    /**
     * @param block A bag of options that control this resource's behavior.
     */
    public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
        this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
    }

    internal fun build(): BitbucketServerConfig {
        val builtJavaResource = com.pulumi.gcp.cloudbuild.BitbucketServerConfig(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return BitbucketServerConfig(builtJavaResource)
    }
}

/**
 * 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: "",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * bbs_config = gcp.cloudbuild.BitbucketServerConfig("bbs-config",
 *     config_id="bbs-config",
 *     location="us-central1",
 *     host_uri="https://bbs.com",
 *     secrets=gcp.cloudbuild.BitbucketServerConfigSecretsArgs(
 *         admin_access_token_version_name="projects/myProject/secrets/mybbspat/versions/1",
 *         read_access_token_version_name="projects/myProject/secrets/mybbspat/versions/1",
 *         webhook_secret_version_name="projects/myProject/secrets/mybbspat/versions/1",
 *     ),
 *     username="test",
 *     api_key="")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var bbs_config = new Gcp.CloudBuild.BitbucketServerConfig("bbs-config", new()
 *     {
 *         ConfigId = "bbs-config",
 *         Location = "us-central1",
 *         HostUri = "https://bbs.com",
 *         Secrets = new Gcp.CloudBuild.Inputs.BitbucketServerConfigSecretsArgs
 *         {
 *             AdminAccessTokenVersionName = "projects/myProject/secrets/mybbspat/versions/1",
 *             ReadAccessTokenVersionName = "projects/myProject/secrets/mybbspat/versions/1",
 *             WebhookSecretVersionName = "projects/myProject/secrets/mybbspat/versions/1",
 *         },
 *         Username = "test",
 *         ApiKey = "",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/cloudbuild"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := cloudbuild.NewBitbucketServerConfig(ctx, "bbs-config", &cloudbuild.BitbucketServerConfigArgs{
 * 			ConfigId: pulumi.String("bbs-config"),
 * 			Location: pulumi.String("us-central1"),
 * 			HostUri:  pulumi.String("https://bbs.com"),
 * 			Secrets: &cloudbuild.BitbucketServerConfigSecretsArgs{
 * 				AdminAccessTokenVersionName: pulumi.String("projects/myProject/secrets/mybbspat/versions/1"),
 * 				ReadAccessTokenVersionName:  pulumi.String("projects/myProject/secrets/mybbspat/versions/1"),
 * 				WebhookSecretVersionName:    pulumi.String("projects/myProject/secrets/mybbspat/versions/1"),
 * 			},
 * 			Username: pulumi.String("test"),
 * 			ApiKey:   pulumi.String(""),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.gcp.cloudbuild.BitbucketServerConfig;
 * import com.pulumi.gcp.cloudbuild.BitbucketServerConfigArgs;
 * import com.pulumi.gcp.cloudbuild.inputs.BitbucketServerConfigSecretsArgs;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 *     public static void stack(Context ctx) {
 *         var bbs_config = new BitbucketServerConfig("bbs-config", BitbucketServerConfigArgs.builder()
 *             .configId("bbs-config")
 *             .location("us-central1")
 *             .hostUri("https://bbs.com")
 *             .secrets(BitbucketServerConfigSecretsArgs.builder()
 *                 .adminAccessTokenVersionName("projects/myProject/secrets/mybbspat/versions/1")
 *                 .readAccessTokenVersionName("projects/myProject/secrets/mybbspat/versions/1")
 *                 .webhookSecretVersionName("projects/myProject/secrets/mybbspat/versions/1")
 *                 .build())
 *             .username("test")
 *             .apiKey("")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   bbs-config:
 *     type: gcp:cloudbuild:BitbucketServerConfig
 *     properties:
 *       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: 
 * ```
 * 
 * ### 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: "",
 *     connectedRepositories: [
 *         {
 *             projectKey: "DEV",
 *             repoSlug: "repo1",
 *         },
 *         {
 *             projectKey: "PROD",
 *             repoSlug: "repo1",
 *         },
 *     ],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * bbs_config_with_repos = gcp.cloudbuild.BitbucketServerConfig("bbs-config-with-repos",
 *     config_id="bbs-config",
 *     location="us-central1",
 *     host_uri="https://bbs.com",
 *     secrets=gcp.cloudbuild.BitbucketServerConfigSecretsArgs(
 *         admin_access_token_version_name="projects/myProject/secrets/mybbspat/versions/1",
 *         read_access_token_version_name="projects/myProject/secrets/mybbspat/versions/1",
 *         webhook_secret_version_name="projects/myProject/secrets/mybbspat/versions/1",
 *     ),
 *     username="test",
 *     api_key="",
 *     connected_repositories=[
 *         gcp.cloudbuild.BitbucketServerConfigConnectedRepositoryArgs(
 *             project_key="DEV",
 *             repo_slug="repo1",
 *         ),
 *         gcp.cloudbuild.BitbucketServerConfigConnectedRepositoryArgs(
 *             project_key="PROD",
 *             repo_slug="repo1",
 *         ),
 *     ])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var bbs_config_with_repos = new Gcp.CloudBuild.BitbucketServerConfig("bbs-config-with-repos", new()
 *     {
 *         ConfigId = "bbs-config",
 *         Location = "us-central1",
 *         HostUri = "https://bbs.com",
 *         Secrets = new Gcp.CloudBuild.Inputs.BitbucketServerConfigSecretsArgs
 *         {
 *             AdminAccessTokenVersionName = "projects/myProject/secrets/mybbspat/versions/1",
 *             ReadAccessTokenVersionName = "projects/myProject/secrets/mybbspat/versions/1",
 *             WebhookSecretVersionName = "projects/myProject/secrets/mybbspat/versions/1",
 *         },
 *         Username = "test",
 *         ApiKey = "",
 *         ConnectedRepositories = new[]
 *         {
 *             new Gcp.CloudBuild.Inputs.BitbucketServerConfigConnectedRepositoryArgs
 *             {
 *                 ProjectKey = "DEV",
 *                 RepoSlug = "repo1",
 *             },
 *             new Gcp.CloudBuild.Inputs.BitbucketServerConfigConnectedRepositoryArgs
 *             {
 *                 ProjectKey = "PROD",
 *                 RepoSlug = "repo1",
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/cloudbuild"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := cloudbuild.NewBitbucketServerConfig(ctx, "bbs-config-with-repos", &cloudbuild.BitbucketServerConfigArgs{
 * 			ConfigId: pulumi.String("bbs-config"),
 * 			Location: pulumi.String("us-central1"),
 * 			HostUri:  pulumi.String("https://bbs.com"),
 * 			Secrets: &cloudbuild.BitbucketServerConfigSecretsArgs{
 * 				AdminAccessTokenVersionName: pulumi.String("projects/myProject/secrets/mybbspat/versions/1"),
 * 				ReadAccessTokenVersionName:  pulumi.String("projects/myProject/secrets/mybbspat/versions/1"),
 * 				WebhookSecretVersionName:    pulumi.String("projects/myProject/secrets/mybbspat/versions/1"),
 * 			},
 * 			Username: pulumi.String("test"),
 * 			ApiKey:   pulumi.String(""),
 * 			ConnectedRepositories: cloudbuild.BitbucketServerConfigConnectedRepositoryArray{
 * 				&cloudbuild.BitbucketServerConfigConnectedRepositoryArgs{
 * 					ProjectKey: pulumi.String("DEV"),
 * 					RepoSlug:   pulumi.String("repo1"),
 * 				},
 * 				&cloudbuild.BitbucketServerConfigConnectedRepositoryArgs{
 * 					ProjectKey: pulumi.String("PROD"),
 * 					RepoSlug:   pulumi.String("repo1"),
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.gcp.cloudbuild.BitbucketServerConfig;
 * import com.pulumi.gcp.cloudbuild.BitbucketServerConfigArgs;
 * import com.pulumi.gcp.cloudbuild.inputs.BitbucketServerConfigSecretsArgs;
 * import com.pulumi.gcp.cloudbuild.inputs.BitbucketServerConfigConnectedRepositoryArgs;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 *     public static void stack(Context ctx) {
 *         var bbs_config_with_repos = new BitbucketServerConfig("bbs-config-with-repos", BitbucketServerConfigArgs.builder()
 *             .configId("bbs-config")
 *             .location("us-central1")
 *             .hostUri("https://bbs.com")
 *             .secrets(BitbucketServerConfigSecretsArgs.builder()
 *                 .adminAccessTokenVersionName("projects/myProject/secrets/mybbspat/versions/1")
 *                 .readAccessTokenVersionName("projects/myProject/secrets/mybbspat/versions/1")
 *                 .webhookSecretVersionName("projects/myProject/secrets/mybbspat/versions/1")
 *                 .build())
 *             .username("test")
 *             .apiKey("")
 *             .connectedRepositories(
 *                 BitbucketServerConfigConnectedRepositoryArgs.builder()
 *                     .projectKey("DEV")
 *                     .repoSlug("repo1")
 *                     .build(),
 *                 BitbucketServerConfigConnectedRepositoryArgs.builder()
 *                     .projectKey("PROD")
 *                     .repoSlug("repo1")
 *                     .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   bbs-config-with-repos:
 *     type: gcp:cloudbuild:BitbucketServerConfig
 *     properties:
 *       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: 
 *       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",
 *     disableOnDestroy: false,
 * });
 * const vpcNetwork = new gcp.compute.Network("vpc_network", {name: "vpc-network"});
 * 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],
 * });
 * 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: "",
 *     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-----
 * `,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * import pulumi_std as std
 * project = gcp.organizations.get_project()
 * servicenetworking = gcp.projects.Service("servicenetworking",
 *     service="servicenetworking.googleapis.com",
 *     disable_on_destroy=False)
 * vpc_network = gcp.compute.Network("vpc_network", name="vpc-network")
 * private_ip_alloc = gcp.compute.GlobalAddress("private_ip_alloc",
 *     name="private-ip-alloc",
 *     purpose="VPC_PEERING",
 *     address_type="INTERNAL",
 *     prefix_length=16,
 *     network=vpc_network.id)
 * default = gcp.servicenetworking.Connection("default",
 *     network=vpc_network.id,
 *     service="servicenetworking.googleapis.com",
 *     reserved_peering_ranges=[private_ip_alloc.name])
 * bbs_config_with_peered_network = gcp.cloudbuild.BitbucketServerConfig("bbs-config-with-peered-network",
 *     config_id="bbs-config",
 *     location="us-central1",
 *     host_uri="https://bbs.com",
 *     secrets=gcp.cloudbuild.BitbucketServerConfigSecretsArgs(
 *         admin_access_token_version_name="projects/myProject/secrets/mybbspat/versions/1",
 *         read_access_token_version_name="projects/myProject/secrets/mybbspat/versions/1",
 *         webhook_secret_version_name="projects/myProject/secrets/mybbspat/versions/1",
 *     ),
 *     username="test",
 *     api_key="",
 *     peered_network=vpc_network.id.apply(lambda id: std.replace_output(text=id,
 *         search=project.name,
 *         replace=project.number)).apply(lambda invoke: invoke.result),
 *     ssl_ca="""-----BEGIN CERTIFICATE-----
 * -----END CERTIFICATE-----
 * -----BEGIN CERTIFICATE-----
 * -----END CERTIFICATE-----
 * """)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * using Std = Pulumi.Std;
 * return await Deployment.RunAsync(() =>
 * {
 *     var project = Gcp.Organizations.GetProject.Invoke();
 *     var servicenetworking = new Gcp.Projects.Service("servicenetworking", new()
 *     {
 *         ServiceName = "servicenetworking.googleapis.com",
 *         DisableOnDestroy = false,
 *     });
 *     var vpcNetwork = new Gcp.Compute.Network("vpc_network", new()
 *     {
 *         Name = "vpc-network",
 *     });
 *     var privateIpAlloc = new Gcp.Compute.GlobalAddress("private_ip_alloc", new()
 *     {
 *         Name = "private-ip-alloc",
 *         Purpose = "VPC_PEERING",
 *         AddressType = "INTERNAL",
 *         PrefixLength = 16,
 *         Network = vpcNetwork.Id,
 *     });
 *     var @default = new Gcp.ServiceNetworking.Connection("default", new()
 *     {
 *         Network = vpcNetwork.Id,
 *         Service = "servicenetworking.googleapis.com",
 *         ReservedPeeringRanges = new[]
 *         {
 *             privateIpAlloc.Name,
 *         },
 *     });
 *     var bbs_config_with_peered_network = new Gcp.CloudBuild.BitbucketServerConfig("bbs-config-with-peered-network", new()
 *     {
 *         ConfigId = "bbs-config",
 *         Location = "us-central1",
 *         HostUri = "https://bbs.com",
 *         Secrets = new Gcp.CloudBuild.Inputs.BitbucketServerConfigSecretsArgs
 *         {
 *             AdminAccessTokenVersionName = "projects/myProject/secrets/mybbspat/versions/1",
 *             ReadAccessTokenVersionName = "projects/myProject/secrets/mybbspat/versions/1",
 *             WebhookSecretVersionName = "projects/myProject/secrets/mybbspat/versions/1",
 *         },
 *         Username = "test",
 *         ApiKey = "",
 *         PeeredNetwork = Output.Tuple(vpcNetwork.Id, project, project).Apply(values =>
 *         {
 *             var id = values.Item1;
 *             var project = values.Item2;
 *             var project1 = values.Item3;
 *             return Std.Replace.Invoke(new()
 *             {
 *                 Text = id,
 *                 Search = project.Apply(getProjectResult => getProjectResult.Name),
 *                 Replace = project1.Number,
 *             });
 *         }).Apply(invoke => invoke.Result),
 *         SslCa = @"-----BEGIN CERTIFICATE-----
 * -----END CERTIFICATE-----
 * -----BEGIN CERTIFICATE-----
 * -----END CERTIFICATE-----
 * ",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/cloudbuild"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/projects"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/servicenetworking"
 * 	"github.com/pulumi/pulumi-std/sdk/go/std"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		project, err := organizations.LookupProject(ctx, nil, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = projects.NewService(ctx, "servicenetworking", &projects.ServiceArgs{
 * 			Service:          pulumi.String("servicenetworking.googleapis.com"),
 * 			DisableOnDestroy: pulumi.Bool(false),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		vpcNetwork, err := compute.NewNetwork(ctx, "vpc_network", &compute.NetworkArgs{
 * 			Name: pulumi.String("vpc-network"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		privateIpAlloc, err := compute.NewGlobalAddress(ctx, "private_ip_alloc", &compute.GlobalAddressArgs{
 * 			Name:         pulumi.String("private-ip-alloc"),
 * 			Purpose:      pulumi.String("VPC_PEERING"),
 * 			AddressType:  pulumi.String("INTERNAL"),
 * 			PrefixLength: pulumi.Int(16),
 * 			Network:      vpcNetwork.ID(),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = servicenetworking.NewConnection(ctx, "default", &servicenetworking.ConnectionArgs{
 * 			Network: vpcNetwork.ID(),
 * 			Service: pulumi.String("servicenetworking.googleapis.com"),
 * 			ReservedPeeringRanges: pulumi.StringArray{
 * 				privateIpAlloc.Name,
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = cloudbuild.NewBitbucketServerConfig(ctx, "bbs-config-with-peered-network", &cloudbuild.BitbucketServerConfigArgs{
 * 			ConfigId: pulumi.String("bbs-config"),
 * 			Location: pulumi.String("us-central1"),
 * 			HostUri:  pulumi.String("https://bbs.com"),
 * 			Secrets: &cloudbuild.BitbucketServerConfigSecretsArgs{
 * 				AdminAccessTokenVersionName: pulumi.String("projects/myProject/secrets/mybbspat/versions/1"),
 * 				ReadAccessTokenVersionName:  pulumi.String("projects/myProject/secrets/mybbspat/versions/1"),
 * 				WebhookSecretVersionName:    pulumi.String("projects/myProject/secrets/mybbspat/versions/1"),
 * 			},
 * 			Username: pulumi.String("test"),
 * 			ApiKey:   pulumi.String(""),
 * 			PeeredNetwork: vpcNetwork.ID().ApplyT(func(id string) (std.ReplaceResult, error) {
 * 				return std.ReplaceOutput(ctx, std.ReplaceOutputArgs{
 * 					Text:    id,
 * 					Search:  project.Name,
 * 					Replace: project.Number,
 * 				}, nil), nil
 * 			}).(std.ReplaceResultOutput).ApplyT(func(invoke std.ReplaceResult) (*string, error) {
 * 				return invoke.Result, nil
 * 			}).(pulumi.StringPtrOutput),
 * 			SslCa: pulumi.String("-----BEGIN CERTIFICATE-----\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\n-----END CERTIFICATE-----\n"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.gcp.organizations.OrganizationsFunctions;
 * import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
 * import com.pulumi.gcp.projects.Service;
 * import com.pulumi.gcp.projects.ServiceArgs;
 * import com.pulumi.gcp.compute.Network;
 * import com.pulumi.gcp.compute.NetworkArgs;
 * import com.pulumi.gcp.compute.GlobalAddress;
 * import com.pulumi.gcp.compute.GlobalAddressArgs;
 * import com.pulumi.gcp.servicenetworking.Connection;
 * import com.pulumi.gcp.servicenetworking.ConnectionArgs;
 * import com.pulumi.gcp.cloudbuild.BitbucketServerConfig;
 * import com.pulumi.gcp.cloudbuild.BitbucketServerConfigArgs;
 * import com.pulumi.gcp.cloudbuild.inputs.BitbucketServerConfigSecretsArgs;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 *     public static void stack(Context ctx) {
 *         final var project = OrganizationsFunctions.getProject();
 *         var servicenetworking = new Service("servicenetworking", ServiceArgs.builder()
 *             .service("servicenetworking.googleapis.com")
 *             .disableOnDestroy(false)
 *             .build());
 *         var vpcNetwork = new Network("vpcNetwork", NetworkArgs.builder()
 *             .name("vpc-network")
 *             .build());
 *         var privateIpAlloc = new GlobalAddress("privateIpAlloc", GlobalAddressArgs.builder()
 *             .name("private-ip-alloc")
 *             .purpose("VPC_PEERING")
 *             .addressType("INTERNAL")
 *             .prefixLength(16)
 *             .network(vpcNetwork.id())
 *             .build());
 *         var default_ = new Connection("default", ConnectionArgs.builder()
 *             .network(vpcNetwork.id())
 *             .service("servicenetworking.googleapis.com")
 *             .reservedPeeringRanges(privateIpAlloc.name())
 *             .build());
 *         var bbs_config_with_peered_network = new BitbucketServerConfig("bbs-config-with-peered-network", BitbucketServerConfigArgs.builder()
 *             .configId("bbs-config")
 *             .location("us-central1")
 *             .hostUri("https://bbs.com")
 *             .secrets(BitbucketServerConfigSecretsArgs.builder()
 *                 .adminAccessTokenVersionName("projects/myProject/secrets/mybbspat/versions/1")
 *                 .readAccessTokenVersionName("projects/myProject/secrets/mybbspat/versions/1")
 *                 .webhookSecretVersionName("projects/myProject/secrets/mybbspat/versions/1")
 *                 .build())
 *             .username("test")
 *             .apiKey("")
 *             .peeredNetwork(vpcNetwork.id().applyValue(id -> StdFunctions.replace()).applyValue(invoke -> invoke.result()))
 *             .sslCa("""
 * -----BEGIN CERTIFICATE-----
 * -----END CERTIFICATE-----
 * -----BEGIN CERTIFICATE-----
 * -----END CERTIFICATE-----
 *             """)
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   servicenetworking:
 *     type: gcp:projects:Service
 *     properties:
 *       service: servicenetworking.googleapis.com
 *       disableOnDestroy: false
 *   vpcNetwork:
 *     type: gcp:compute:Network
 *     name: vpc_network
 *     properties:
 *       name: vpc-network
 *   privateIpAlloc:
 *     type: gcp:compute:GlobalAddress
 *     name: private_ip_alloc
 *     properties:
 *       name: private-ip-alloc
 *       purpose: VPC_PEERING
 *       addressType: INTERNAL
 *       prefixLength: 16
 *       network: ${vpcNetwork.id}
 *   default:
 *     type: gcp:servicenetworking:Connection
 *     properties:
 *       network: ${vpcNetwork.id}
 *       service: servicenetworking.googleapis.com
 *       reservedPeeringRanges:
 *         - ${privateIpAlloc.name}
 *   bbs-config-with-peered-network:
 *     type: gcp:cloudbuild:BitbucketServerConfig
 *     properties:
 *       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: 
 *       peeredNetwork:
 *         fn::invoke:
 *           Function: std:replace
 *           Arguments:
 *             text: ${vpcNetwork.id}
 *             search: ${project.name}
 *             replace: ${project.number}
 *           Return: result
 *       sslCa: |
 *         -----BEGIN CERTIFICATE-----
 *         -----END CERTIFICATE-----
 *         -----BEGIN CERTIFICATE-----
 *         -----END CERTIFICATE-----
 * variables:
 *   project:
 *     fn::invoke:
 *       Function: gcp:organizations:getProject
 *       Arguments: {}
 * ```
 * 
 * ## 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}}
 * ```
 */
public class BitbucketServerConfig internal constructor(
    override val javaResource: com.pulumi.gcp.cloudbuild.BitbucketServerConfig,
) : KotlinCustomResource(javaResource, BitbucketServerConfigMapper) {
    /**
     * Immutable. API Key that will be attached to webhook. Once this field has been set, it cannot be changed.
     * Changing this field will result in deleting/ recreating the resource.
     */
    public val apiKey: Output
        get() = javaResource.apiKey().applyValue({ args0 -> args0 })

    /**
     * The ID to use for the BitbucketServerConfig, which will become the final component of the BitbucketServerConfig's resource name.
     */
    public val configId: Output
        get() = javaResource.configId().applyValue({ args0 -> args0 })

    /**
     * Connected Bitbucket Server repositories for this config.
     */
    public val connectedRepositories: Output>?
        get() = javaResource.connectedRepositories().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        bitbucketServerConfigConnectedRepositoryToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

    /**
     * Immutable. The URI of the Bitbucket Server host. Once this field has been set, it cannot be changed.
     * If you need to change it, please create another BitbucketServerConfig.
     */
    public val hostUri: Output
        get() = javaResource.hostUri().applyValue({ args0 -> args0 })

    /**
     * The location of this bitbucket server config.
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * The resource name for the config.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The network to be used when reaching out to the Bitbucket Server instance. The VPC network must be enabled for private
     * service connection. This should be set if the Bitbucket Server instance is hosted on-premises and not reachable by
     * public internet. If this field is left empty, no network peering will occur and calls to the Bitbucket Server instance
     * will be made over the public internet. Must be in the format projects/{project}/global/networks/{network}, where
     * {project} is a project number or id and {network} is the name of a VPC network in the project.
     */
    public val peeredNetwork: Output?
        get() = javaResource.peeredNetwork().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    public val project: Output
        get() = javaResource.project().applyValue({ args0 -> args0 })

    /**
     * Secret Manager secrets needed by the config.
     * Structure is documented below.
     */
    public val secrets: Output
        get() = javaResource.secrets().applyValue({ args0 ->
            args0.let({ args0 ->
                bitbucketServerConfigSecretsToKotlin(args0)
            })
        })

    /**
     * SSL certificate to use for requests to Bitbucket Server. The format should be PEM format but the extension can be one of
     * .pem, .cer, or .crt.
     */
    public val sslCa: Output?
        get() = javaResource.sslCa().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Username of the account Cloud Build will use on Bitbucket Server.
     */
    public val username: Output
        get() = javaResource.username().applyValue({ args0 -> args0 })

    /**
     * Output only. UUID included in webhook requests. The UUID is used to look up the corresponding config.
     */
    public val webhookKey: Output
        get() = javaResource.webhookKey().applyValue({ args0 -> args0 })
}

public object BitbucketServerConfigMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.cloudbuild.BitbucketServerConfig::class == javaResource::class

    override fun map(javaResource: Resource): BitbucketServerConfig =
        BitbucketServerConfig(javaResource as com.pulumi.gcp.cloudbuild.BitbucketServerConfig)
}

/**
 * @see [BitbucketServerConfig].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [BitbucketServerConfig].
 */
public suspend fun bitbucketServerConfig(
    name: String,
    block: suspend BitbucketServerConfigResourceBuilder.() -> Unit,
): BitbucketServerConfig {
    val builder = BitbucketServerConfigResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [BitbucketServerConfig].
 * @param name The _unique_ name of the resulting resource.
 */
public fun bitbucketServerConfig(name: String): BitbucketServerConfig {
    val builder = BitbucketServerConfigResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy