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

com.pulumi.gcp.dataform.kotlin.Repository.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.dataform.kotlin

import com.pulumi.core.Output
import com.pulumi.gcp.dataform.kotlin.outputs.RepositoryGitRemoteSettings
import com.pulumi.gcp.dataform.kotlin.outputs.RepositoryWorkspaceCompilationOverrides
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.Map
import com.pulumi.gcp.dataform.kotlin.outputs.RepositoryGitRemoteSettings.Companion.toKotlin as repositoryGitRemoteSettingsToKotlin
import com.pulumi.gcp.dataform.kotlin.outputs.RepositoryWorkspaceCompilationOverrides.Companion.toKotlin as repositoryWorkspaceCompilationOverridesToKotlin

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

    public var args: RepositoryArgs = RepositoryArgs()

    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 RepositoryArgsBuilder.() -> Unit) {
        val builder = RepositoryArgsBuilder()
        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(): Repository {
        val builtJavaResource = com.pulumi.gcp.dataform.Repository(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return Repository(builtJavaResource)
    }
}

/**
 * ## Example Usage
 * ### Dataform Repository
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const secret = new gcp.secretmanager.Secret("secret", {
 *     secretId: "my-secret",
 *     replication: {
 *         auto: {},
 *     },
 * });
 * const secretVersion = new gcp.secretmanager.SecretVersion("secret_version", {
 *     secret: secret.id,
 *     secretData: "secret-data",
 * });
 * const dataformRepository = new gcp.dataform.Repository("dataform_repository", {
 *     name: "dataform_repository",
 *     displayName: "dataform_repository",
 *     npmrcEnvironmentVariablesSecretVersion: secretVersion.id,
 *     labels: {
 *         label_foo1: "label-bar1",
 *     },
 *     gitRemoteSettings: {
 *         url: "https://github.com/OWNER/REPOSITORY.git",
 *         defaultBranch: "main",
 *         authenticationTokenSecretVersion: secretVersion.id,
 *     },
 *     workspaceCompilationOverrides: {
 *         defaultDatabase: "database",
 *         schemaSuffix: "_suffix",
 *         tablePrefix: "prefix_",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * secret = gcp.secretmanager.Secret("secret",
 *     secret_id="my-secret",
 *     replication=gcp.secretmanager.SecretReplicationArgs(
 *         auto=gcp.secretmanager.SecretReplicationAutoArgs(),
 *     ))
 * secret_version = gcp.secretmanager.SecretVersion("secret_version",
 *     secret=secret.id,
 *     secret_data="secret-data")
 * dataform_repository = gcp.dataform.Repository("dataform_repository",
 *     name="dataform_repository",
 *     display_name="dataform_repository",
 *     npmrc_environment_variables_secret_version=secret_version.id,
 *     labels={
 *         "label_foo1": "label-bar1",
 *     },
 *     git_remote_settings=gcp.dataform.RepositoryGitRemoteSettingsArgs(
 *         url="https://github.com/OWNER/REPOSITORY.git",
 *         default_branch="main",
 *         authentication_token_secret_version=secret_version.id,
 *     ),
 *     workspace_compilation_overrides=gcp.dataform.RepositoryWorkspaceCompilationOverridesArgs(
 *         default_database="database",
 *         schema_suffix="_suffix",
 *         table_prefix="prefix_",
 *     ))
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var secret = new Gcp.SecretManager.Secret("secret", new()
 *     {
 *         SecretId = "my-secret",
 *         Replication = new Gcp.SecretManager.Inputs.SecretReplicationArgs
 *         {
 *             Auto = null,
 *         },
 *     });
 *     var secretVersion = new Gcp.SecretManager.SecretVersion("secret_version", new()
 *     {
 *         Secret = secret.Id,
 *         SecretData = "secret-data",
 *     });
 *     var dataformRepository = new Gcp.Dataform.Repository("dataform_repository", new()
 *     {
 *         Name = "dataform_repository",
 *         DisplayName = "dataform_repository",
 *         NpmrcEnvironmentVariablesSecretVersion = secretVersion.Id,
 *         Labels =
 *         {
 *             { "label_foo1", "label-bar1" },
 *         },
 *         GitRemoteSettings = new Gcp.Dataform.Inputs.RepositoryGitRemoteSettingsArgs
 *         {
 *             Url = "https://github.com/OWNER/REPOSITORY.git",
 *             DefaultBranch = "main",
 *             AuthenticationTokenSecretVersion = secretVersion.Id,
 *         },
 *         WorkspaceCompilationOverrides = new Gcp.Dataform.Inputs.RepositoryWorkspaceCompilationOverridesArgs
 *         {
 *             DefaultDatabase = "database",
 *             SchemaSuffix = "_suffix",
 *             TablePrefix = "prefix_",
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/dataform"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/secretmanager"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		secret, err := secretmanager.NewSecret(ctx, "secret", &secretmanager.SecretArgs{
 * 			SecretId: pulumi.String("my-secret"),
 * 			Replication: &secretmanager.SecretReplicationArgs{
 * 				Auto: nil,
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		secretVersion, err := secretmanager.NewSecretVersion(ctx, "secret_version", &secretmanager.SecretVersionArgs{
 * 			Secret:     secret.ID(),
 * 			SecretData: pulumi.String("secret-data"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = dataform.NewRepository(ctx, "dataform_repository", &dataform.RepositoryArgs{
 * 			Name:                                   pulumi.String("dataform_repository"),
 * 			DisplayName:                            pulumi.String("dataform_repository"),
 * 			NpmrcEnvironmentVariablesSecretVersion: secretVersion.ID(),
 * 			Labels: pulumi.StringMap{
 * 				"label_foo1": pulumi.String("label-bar1"),
 * 			},
 * 			GitRemoteSettings: &dataform.RepositoryGitRemoteSettingsArgs{
 * 				Url:                              pulumi.String("https://github.com/OWNER/REPOSITORY.git"),
 * 				DefaultBranch:                    pulumi.String("main"),
 * 				AuthenticationTokenSecretVersion: secretVersion.ID(),
 * 			},
 * 			WorkspaceCompilationOverrides: &dataform.RepositoryWorkspaceCompilationOverridesArgs{
 * 				DefaultDatabase: pulumi.String("database"),
 * 				SchemaSuffix:    pulumi.String("_suffix"),
 * 				TablePrefix:     pulumi.String("prefix_"),
 * 			},
 * 		})
 * 		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.secretmanager.Secret;
 * import com.pulumi.gcp.secretmanager.SecretArgs;
 * import com.pulumi.gcp.secretmanager.inputs.SecretReplicationArgs;
 * import com.pulumi.gcp.secretmanager.inputs.SecretReplicationAutoArgs;
 * import com.pulumi.gcp.secretmanager.SecretVersion;
 * import com.pulumi.gcp.secretmanager.SecretVersionArgs;
 * import com.pulumi.gcp.dataform.Repository;
 * import com.pulumi.gcp.dataform.RepositoryArgs;
 * import com.pulumi.gcp.dataform.inputs.RepositoryGitRemoteSettingsArgs;
 * import com.pulumi.gcp.dataform.inputs.RepositoryWorkspaceCompilationOverridesArgs;
 * 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 secret = new Secret("secret", SecretArgs.builder()
 *             .secretId("my-secret")
 *             .replication(SecretReplicationArgs.builder()
 *                 .auto()
 *                 .build())
 *             .build());
 *         var secretVersion = new SecretVersion("secretVersion", SecretVersionArgs.builder()
 *             .secret(secret.id())
 *             .secretData("secret-data")
 *             .build());
 *         var dataformRepository = new Repository("dataformRepository", RepositoryArgs.builder()
 *             .name("dataform_repository")
 *             .displayName("dataform_repository")
 *             .npmrcEnvironmentVariablesSecretVersion(secretVersion.id())
 *             .labels(Map.of("label_foo1", "label-bar1"))
 *             .gitRemoteSettings(RepositoryGitRemoteSettingsArgs.builder()
 *                 .url("https://github.com/OWNER/REPOSITORY.git")
 *                 .defaultBranch("main")
 *                 .authenticationTokenSecretVersion(secretVersion.id())
 *                 .build())
 *             .workspaceCompilationOverrides(RepositoryWorkspaceCompilationOverridesArgs.builder()
 *                 .defaultDatabase("database")
 *                 .schemaSuffix("_suffix")
 *                 .tablePrefix("prefix_")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   secret:
 *     type: gcp:secretmanager:Secret
 *     properties:
 *       secretId: my-secret
 *       replication:
 *         auto: {}
 *   secretVersion:
 *     type: gcp:secretmanager:SecretVersion
 *     name: secret_version
 *     properties:
 *       secret: ${secret.id}
 *       secretData: secret-data
 *   dataformRepository:
 *     type: gcp:dataform:Repository
 *     name: dataform_repository
 *     properties:
 *       name: dataform_repository
 *       displayName: dataform_repository
 *       npmrcEnvironmentVariablesSecretVersion: ${secretVersion.id}
 *       labels:
 *         label_foo1: label-bar1
 *       gitRemoteSettings:
 *         url: https://github.com/OWNER/REPOSITORY.git
 *         defaultBranch: main
 *         authenticationTokenSecretVersion: ${secretVersion.id}
 *       workspaceCompilationOverrides:
 *         defaultDatabase: database
 *         schemaSuffix: _suffix
 *         tablePrefix: prefix_
 * ```
 * 
 * ## Import
 * Repository can be imported using any of these accepted formats:
 * * `projects/{{project}}/locations/{{region}}/repositories/{{name}}`
 * * `{{project}}/{{region}}/{{name}}`
 * * `{{region}}/{{name}}`
 * * `{{name}}`
 * When using the `pulumi import` command, Repository can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:dataform/repository:Repository default projects/{{project}}/locations/{{region}}/repositories/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:dataform/repository:Repository default {{project}}/{{region}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:dataform/repository:Repository default {{region}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:dataform/repository:Repository default {{name}}
 * ```
 */
public class Repository internal constructor(
    override val javaResource: com.pulumi.gcp.dataform.Repository,
) : KotlinCustomResource(javaResource, RepositoryMapper) {
    /**
     * Optional. The repository's user-friendly name.
     */
    public val displayName: Output?
        get() = javaResource.displayName().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
     */
    public val effectiveLabels: Output>
        get() = javaResource.effectiveLabels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * Optional. If set, configures this repository to be linked to a Git remote.
     * Structure is documented below.
     */
    public val gitRemoteSettings: Output?
        get() = javaResource.gitRemoteSettings().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> repositoryGitRemoteSettingsToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * Optional. Repository user labels.
     * An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.
     * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration.
     * Please refer to the field `effective_labels` for all of the labels present on the resource.
     */
    public val labels: Output>?
        get() = javaResource.labels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * The repository's name.
     * - - -
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * Optional. The name of the Secret Manager secret version to be used to interpolate variables into the .npmrc file for package installation operations. Must be in the format projects/*/secrets/*/versions/*. The file itself must be in a JSON format.
     * */*/*/
     */
    public val npmrcEnvironmentVariablesSecretVersion: Output?
        get() = javaResource.npmrcEnvironmentVariablesSecretVersion().applyValue({ args0 ->
            args0.map({ args0 -> args0 }).orElse(null)
        })

    /**
     * The ID of the project in which the resource belongs.
     * If it is not provided, the provider project is used.
     */
    public val project: Output
        get() = javaResource.project().applyValue({ args0 -> args0 })

    /**
     * The combination of labels configured directly on the resource
     * and default labels configured on the provider.
     */
    public val pulumiLabels: Output>
        get() = javaResource.pulumiLabels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * A reference to the region
     */
    public val region: Output?
        get() = javaResource.region().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The service account to run workflow invocations under.
     */
    public val serviceAccount: Output?
        get() = javaResource.serviceAccount().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * If set, fields of workspaceCompilationOverrides override the default compilation settings that are specified in dataform.json when creating workspace-scoped compilation results.
     * Structure is documented below.
     */
    public val workspaceCompilationOverrides: Output?
        get() = javaResource.workspaceCompilationOverrides().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    repositoryWorkspaceCompilationOverridesToKotlin(args0)
                })
            }).orElse(null)
        })
}

public object RepositoryMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.dataform.Repository::class == javaResource::class

    override fun map(javaResource: Resource): Repository = Repository(
        javaResource as
            com.pulumi.gcp.dataform.Repository,
    )
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy