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

com.pulumi.gcp.dataform.kotlin.RepositoryReleaseConfig.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.RepositoryReleaseConfigCodeCompilationConfig
import com.pulumi.gcp.dataform.kotlin.outputs.RepositoryReleaseConfigRecentScheduledReleaseRecord
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.dataform.kotlin.outputs.RepositoryReleaseConfigCodeCompilationConfig.Companion.toKotlin as repositoryReleaseConfigCodeCompilationConfigToKotlin
import com.pulumi.gcp.dataform.kotlin.outputs.RepositoryReleaseConfigRecentScheduledReleaseRecord.Companion.toKotlin as repositoryReleaseConfigRecentScheduledReleaseRecordToKotlin

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

    public var args: RepositoryReleaseConfigArgs = RepositoryReleaseConfigArgs()

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

/**
 * ## Example Usage
 * ### Dataform Repository Release Config
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const gitRepository = new gcp.sourcerepo.Repository("git_repository", {name: "my/repository"});
 * 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 repository = new gcp.dataform.Repository("repository", {
 *     name: "dataform_repository",
 *     region: "us-central1",
 *     gitRemoteSettings: {
 *         url: gitRepository.url,
 *         defaultBranch: "main",
 *         authenticationTokenSecretVersion: secretVersion.id,
 *     },
 *     workspaceCompilationOverrides: {
 *         defaultDatabase: "database",
 *         schemaSuffix: "_suffix",
 *         tablePrefix: "prefix_",
 *     },
 * });
 * const release = new gcp.dataform.RepositoryReleaseConfig("release", {
 *     project: repository.project,
 *     region: repository.region,
 *     repository: repository.name,
 *     name: "my_release",
 *     gitCommitish: "main",
 *     cronSchedule: "0 7 * * *",
 *     timeZone: "America/New_York",
 *     codeCompilationConfig: {
 *         defaultDatabase: "gcp-example-project",
 *         defaultSchema: "example-dataset",
 *         defaultLocation: "us-central1",
 *         assertionSchema: "example-assertion-dataset",
 *         databaseSuffix: "",
 *         schemaSuffix: "",
 *         tablePrefix: "",
 *         vars: {
 *             var1: "value",
 *         },
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * git_repository = gcp.sourcerepo.Repository("git_repository", name="my/repository")
 * 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")
 * repository = gcp.dataform.Repository("repository",
 *     name="dataform_repository",
 *     region="us-central1",
 *     git_remote_settings=gcp.dataform.RepositoryGitRemoteSettingsArgs(
 *         url=git_repository.url,
 *         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_",
 *     ))
 * release = gcp.dataform.RepositoryReleaseConfig("release",
 *     project=repository.project,
 *     region=repository.region,
 *     repository=repository.name,
 *     name="my_release",
 *     git_commitish="main",
 *     cron_schedule="0 7 * * *",
 *     time_zone="America/New_York",
 *     code_compilation_config=gcp.dataform.RepositoryReleaseConfigCodeCompilationConfigArgs(
 *         default_database="gcp-example-project",
 *         default_schema="example-dataset",
 *         default_location="us-central1",
 *         assertion_schema="example-assertion-dataset",
 *         database_suffix="",
 *         schema_suffix="",
 *         table_prefix="",
 *         vars={
 *             "var1": "value",
 *         },
 *     ))
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var gitRepository = new Gcp.SourceRepo.Repository("git_repository", new()
 *     {
 *         Name = "my/repository",
 *     });
 *     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 repository = new Gcp.Dataform.Repository("repository", new()
 *     {
 *         Name = "dataform_repository",
 *         Region = "us-central1",
 *         GitRemoteSettings = new Gcp.Dataform.Inputs.RepositoryGitRemoteSettingsArgs
 *         {
 *             Url = gitRepository.Url,
 *             DefaultBranch = "main",
 *             AuthenticationTokenSecretVersion = secretVersion.Id,
 *         },
 *         WorkspaceCompilationOverrides = new Gcp.Dataform.Inputs.RepositoryWorkspaceCompilationOverridesArgs
 *         {
 *             DefaultDatabase = "database",
 *             SchemaSuffix = "_suffix",
 *             TablePrefix = "prefix_",
 *         },
 *     });
 *     var release = new Gcp.Dataform.RepositoryReleaseConfig("release", new()
 *     {
 *         Project = repository.Project,
 *         Region = repository.Region,
 *         Repository = repository.Name,
 *         Name = "my_release",
 *         GitCommitish = "main",
 *         CronSchedule = "0 7 * * *",
 *         TimeZone = "America/New_York",
 *         CodeCompilationConfig = new Gcp.Dataform.Inputs.RepositoryReleaseConfigCodeCompilationConfigArgs
 *         {
 *             DefaultDatabase = "gcp-example-project",
 *             DefaultSchema = "example-dataset",
 *             DefaultLocation = "us-central1",
 *             AssertionSchema = "example-assertion-dataset",
 *             DatabaseSuffix = "",
 *             SchemaSuffix = "",
 *             TablePrefix = "",
 *             Vars =
 *             {
 *                 { "var1", "value" },
 *             },
 *         },
 *     });
 * });
 * ```
 * ```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-gcp/sdk/v7/go/gcp/sourcerepo"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		gitRepository, err := sourcerepo.NewRepository(ctx, "git_repository", &sourcerepo.RepositoryArgs{
 * 			Name: pulumi.String("my/repository"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		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
 * 		}
 * 		repository, err := dataform.NewRepository(ctx, "repository", &dataform.RepositoryArgs{
 * 			Name:   pulumi.String("dataform_repository"),
 * 			Region: pulumi.String("us-central1"),
 * 			GitRemoteSettings: &dataform.RepositoryGitRemoteSettingsArgs{
 * 				Url:                              gitRepository.Url,
 * 				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
 * 		}
 * 		_, err = dataform.NewRepositoryReleaseConfig(ctx, "release", &dataform.RepositoryReleaseConfigArgs{
 * 			Project:      repository.Project,
 * 			Region:       repository.Region,
 * 			Repository:   repository.Name,
 * 			Name:         pulumi.String("my_release"),
 * 			GitCommitish: pulumi.String("main"),
 * 			CronSchedule: pulumi.String("0 7 * * *"),
 * 			TimeZone:     pulumi.String("America/New_York"),
 * 			CodeCompilationConfig: &dataform.RepositoryReleaseConfigCodeCompilationConfigArgs{
 * 				DefaultDatabase: pulumi.String("gcp-example-project"),
 * 				DefaultSchema:   pulumi.String("example-dataset"),
 * 				DefaultLocation: pulumi.String("us-central1"),
 * 				AssertionSchema: pulumi.String("example-assertion-dataset"),
 * 				DatabaseSuffix:  pulumi.String(""),
 * 				SchemaSuffix:    pulumi.String(""),
 * 				TablePrefix:     pulumi.String(""),
 * 				Vars: pulumi.StringMap{
 * 					"var1": pulumi.String("value"),
 * 				},
 * 			},
 * 		})
 * 		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.sourcerepo.Repository;
 * import com.pulumi.gcp.sourcerepo.RepositoryArgs;
 * 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 com.pulumi.gcp.dataform.RepositoryReleaseConfig;
 * import com.pulumi.gcp.dataform.RepositoryReleaseConfigArgs;
 * import com.pulumi.gcp.dataform.inputs.RepositoryReleaseConfigCodeCompilationConfigArgs;
 * 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 gitRepository = new Repository("gitRepository", RepositoryArgs.builder()
 *             .name("my/repository")
 *             .build());
 *         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 repository = new Repository("repository", RepositoryArgs.builder()
 *             .name("dataform_repository")
 *             .region("us-central1")
 *             .gitRemoteSettings(RepositoryGitRemoteSettingsArgs.builder()
 *                 .url(gitRepository.url())
 *                 .defaultBranch("main")
 *                 .authenticationTokenSecretVersion(secretVersion.id())
 *                 .build())
 *             .workspaceCompilationOverrides(RepositoryWorkspaceCompilationOverridesArgs.builder()
 *                 .defaultDatabase("database")
 *                 .schemaSuffix("_suffix")
 *                 .tablePrefix("prefix_")
 *                 .build())
 *             .build());
 *         var release = new RepositoryReleaseConfig("release", RepositoryReleaseConfigArgs.builder()
 *             .project(repository.project())
 *             .region(repository.region())
 *             .repository(repository.name())
 *             .name("my_release")
 *             .gitCommitish("main")
 *             .cronSchedule("0 7 * * *")
 *             .timeZone("America/New_York")
 *             .codeCompilationConfig(RepositoryReleaseConfigCodeCompilationConfigArgs.builder()
 *                 .defaultDatabase("gcp-example-project")
 *                 .defaultSchema("example-dataset")
 *                 .defaultLocation("us-central1")
 *                 .assertionSchema("example-assertion-dataset")
 *                 .databaseSuffix("")
 *                 .schemaSuffix("")
 *                 .tablePrefix("")
 *                 .vars(Map.of("var1", "value"))
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   gitRepository:
 *     type: gcp:sourcerepo:Repository
 *     name: git_repository
 *     properties:
 *       name: my/repository
 *   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
 *   repository:
 *     type: gcp:dataform:Repository
 *     properties:
 *       name: dataform_repository
 *       region: us-central1
 *       gitRemoteSettings:
 *         url: ${gitRepository.url}
 *         defaultBranch: main
 *         authenticationTokenSecretVersion: ${secretVersion.id}
 *       workspaceCompilationOverrides:
 *         defaultDatabase: database
 *         schemaSuffix: _suffix
 *         tablePrefix: prefix_
 *   release:
 *     type: gcp:dataform:RepositoryReleaseConfig
 *     properties:
 *       project: ${repository.project}
 *       region: ${repository.region}
 *       repository: ${repository.name}
 *       name: my_release
 *       gitCommitish: main
 *       cronSchedule: 0 7 * * *
 *       timeZone: America/New_York
 *       codeCompilationConfig:
 *         defaultDatabase: gcp-example-project
 *         defaultSchema: example-dataset
 *         defaultLocation: us-central1
 *         assertionSchema: example-assertion-dataset
 *         databaseSuffix:
 *         schemaSuffix:
 *         tablePrefix:
 *         vars:
 *           var1: value
 * ```
 * 
 * ## Import
 * RepositoryReleaseConfig can be imported using any of these accepted formats:
 * * `projects/{{project}}/locations/{{region}}/repositories/{{repository}}/releaseConfigs/{{name}}`
 * * `{{project}}/{{region}}/{{repository}}/{{name}}`
 * * `{{region}}/{{repository}}/{{name}}`
 * * `{{repository}}/{{name}}`
 * When using the `pulumi import` command, RepositoryReleaseConfig can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:dataform/repositoryReleaseConfig:RepositoryReleaseConfig default projects/{{project}}/locations/{{region}}/repositories/{{repository}}/releaseConfigs/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:dataform/repositoryReleaseConfig:RepositoryReleaseConfig default {{project}}/{{region}}/{{repository}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:dataform/repositoryReleaseConfig:RepositoryReleaseConfig default {{region}}/{{repository}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:dataform/repositoryReleaseConfig:RepositoryReleaseConfig default {{repository}}/{{name}}
 * ```
 */
public class RepositoryReleaseConfig internal constructor(
    override val javaResource: com.pulumi.gcp.dataform.RepositoryReleaseConfig,
) : KotlinCustomResource(javaResource, RepositoryReleaseConfigMapper) {
    /**
     * Optional. If set, fields of codeCompilationConfig override the default compilation settings that are specified in dataform.json.
     * Structure is documented below.
     */
    public val codeCompilationConfig: Output?
        get() = javaResource.codeCompilationConfig().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    repositoryReleaseConfigCodeCompilationConfigToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * Optional. Optional schedule (in cron format) for automatic creation of compilation results.
     */
    public val cronSchedule: Output?
        get() = javaResource.cronSchedule().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Git commit/tag/branch name at which the repository should be compiled. Must exist in the remote repository.
     * - - -
     */
    public val gitCommitish: Output
        get() = javaResource.gitCommitish().applyValue({ args0 -> args0 })

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

    /**
     * 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 })

    /**
     * Records of the 10 most recent scheduled release attempts, ordered in in descending order of releaseTime. Updated whenever automatic creation of a compilation result is triggered by cronSchedule.
     * Structure is documented below.
     */
    public val recentScheduledReleaseRecords:
        Output>
        get() = javaResource.recentScheduledReleaseRecords().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> repositoryReleaseConfigRecentScheduledReleaseRecordToKotlin(args0) })
            })
        })

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

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

    /**
     * Optional. Specifies the time zone to be used when interpreting cronSchedule. Must be a time zone name from the time zone database (https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). If left unspecified, the default is UTC.
     */
    public val timeZone: Output?
        get() = javaResource.timeZone().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
}

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy