com.pulumi.gcp.biglake.kotlin.DatabaseArgs.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-gcp-kotlin Show documentation
Show all versions of pulumi-gcp-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.biglake.kotlin
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.gcp.biglake.DatabaseArgs.builder
import com.pulumi.gcp.biglake.kotlin.inputs.DatabaseHiveOptionsArgs
import com.pulumi.gcp.biglake.kotlin.inputs.DatabaseHiveOptionsArgsBuilder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.jvm.JvmName
/**
* Databases are containers of tables.
* To get more information about Database, see:
* * [API documentation](https://cloud.google.com/bigquery/docs/reference/biglake/rest/v1/projects.locations.catalogs.databases)
* * How-to Guides
* * [Manage open source metadata with BigLake Metastore](https://cloud.google.com/bigquery/docs/manage-open-source-metadata#create_databases)
* ## Example Usage
* ### Biglake Database
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const catalog = new gcp.biglake.Catalog("catalog", {
* name: "my_catalog",
* location: "US",
* });
* const bucket = new gcp.storage.Bucket("bucket", {
* name: "my_bucket",
* location: "US",
* forceDestroy: true,
* uniformBucketLevelAccess: true,
* });
* const metadataFolder = new gcp.storage.BucketObject("metadata_folder", {
* name: "metadata/",
* content: " ",
* bucket: bucket.name,
* });
* const database = new gcp.biglake.Database("database", {
* name: "my_database",
* catalog: catalog.id,
* type: "HIVE",
* hiveOptions: {
* locationUri: pulumi.interpolate`gs://${bucket.name}/${metadataFolder.name}`,
* parameters: {
* owner: "John Doe",
* },
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* catalog = gcp.biglake.Catalog("catalog",
* name="my_catalog",
* location="US")
* bucket = gcp.storage.Bucket("bucket",
* name="my_bucket",
* location="US",
* force_destroy=True,
* uniform_bucket_level_access=True)
* metadata_folder = gcp.storage.BucketObject("metadata_folder",
* name="metadata/",
* content=" ",
* bucket=bucket.name)
* database = gcp.biglake.Database("database",
* name="my_database",
* catalog=catalog.id,
* type="HIVE",
* hive_options=gcp.biglake.DatabaseHiveOptionsArgs(
* location_uri=pulumi.Output.all(bucket.name, metadata_folder.name).apply(lambda bucketName, metadataFolderName: f"gs://{bucket_name}/{metadata_folder_name}"),
* parameters={
* "owner": "John Doe",
* },
* ))
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var catalog = new Gcp.BigLake.Catalog("catalog", new()
* {
* Name = "my_catalog",
* Location = "US",
* });
* var bucket = new Gcp.Storage.Bucket("bucket", new()
* {
* Name = "my_bucket",
* Location = "US",
* ForceDestroy = true,
* UniformBucketLevelAccess = true,
* });
* var metadataFolder = new Gcp.Storage.BucketObject("metadata_folder", new()
* {
* Name = "metadata/",
* Content = " ",
* Bucket = bucket.Name,
* });
* var database = new Gcp.BigLake.Database("database", new()
* {
* Name = "my_database",
* Catalog = catalog.Id,
* Type = "HIVE",
* HiveOptions = new Gcp.BigLake.Inputs.DatabaseHiveOptionsArgs
* {
* LocationUri = Output.Tuple(bucket.Name, metadataFolder.Name).Apply(values =>
* {
* var bucketName = values.Item1;
* var metadataFolderName = values.Item2;
* return $"gs://{bucketName}/{metadataFolderName}";
* }),
* Parameters =
* {
* { "owner", "John Doe" },
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "fmt"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/biglake"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/storage"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* catalog, err := biglake.NewCatalog(ctx, "catalog", &biglake.CatalogArgs{
* Name: pulumi.String("my_catalog"),
* Location: pulumi.String("US"),
* })
* if err != nil {
* return err
* }
* bucket, err := storage.NewBucket(ctx, "bucket", &storage.BucketArgs{
* Name: pulumi.String("my_bucket"),
* Location: pulumi.String("US"),
* ForceDestroy: pulumi.Bool(true),
* UniformBucketLevelAccess: pulumi.Bool(true),
* })
* if err != nil {
* return err
* }
* metadataFolder, err := storage.NewBucketObject(ctx, "metadata_folder", &storage.BucketObjectArgs{
* Name: pulumi.String("metadata/"),
* Content: pulumi.String(" "),
* Bucket: bucket.Name,
* })
* if err != nil {
* return err
* }
* _, err = biglake.NewDatabase(ctx, "database", &biglake.DatabaseArgs{
* Name: pulumi.String("my_database"),
* Catalog: catalog.ID(),
* Type: pulumi.String("HIVE"),
* HiveOptions: &biglake.DatabaseHiveOptionsArgs{
* LocationUri: pulumi.All(bucket.Name, metadataFolder.Name).ApplyT(func(_args []interface{}) (string, error) {
* bucketName := _args[0].(string)
* metadataFolderName := _args[1].(string)
* return fmt.Sprintf("gs://%v/%v", bucketName, metadataFolderName), nil
* }).(pulumi.StringOutput),
* Parameters: pulumi.StringMap{
* "owner": pulumi.String("John Doe"),
* },
* },
* })
* 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.biglake.Catalog;
* import com.pulumi.gcp.biglake.CatalogArgs;
* import com.pulumi.gcp.storage.Bucket;
* import com.pulumi.gcp.storage.BucketArgs;
* import com.pulumi.gcp.storage.BucketObject;
* import com.pulumi.gcp.storage.BucketObjectArgs;
* import com.pulumi.gcp.biglake.Database;
* import com.pulumi.gcp.biglake.DatabaseArgs;
* import com.pulumi.gcp.biglake.inputs.DatabaseHiveOptionsArgs;
* 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 catalog = new Catalog("catalog", CatalogArgs.builder()
* .name("my_catalog")
* .location("US")
* .build());
* var bucket = new Bucket("bucket", BucketArgs.builder()
* .name("my_bucket")
* .location("US")
* .forceDestroy(true)
* .uniformBucketLevelAccess(true)
* .build());
* var metadataFolder = new BucketObject("metadataFolder", BucketObjectArgs.builder()
* .name("metadata/")
* .content(" ")
* .bucket(bucket.name())
* .build());
* var database = new Database("database", DatabaseArgs.builder()
* .name("my_database")
* .catalog(catalog.id())
* .type("HIVE")
* .hiveOptions(DatabaseHiveOptionsArgs.builder()
* .locationUri(Output.tuple(bucket.name(), metadataFolder.name()).applyValue(values -> {
* var bucketName = values.t1;
* var metadataFolderName = values.t2;
* return String.format("gs://%s/%s", bucketName,metadataFolderName);
* }))
* .parameters(Map.of("owner", "John Doe"))
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* catalog:
* type: gcp:biglake:Catalog
* properties:
* name: my_catalog
* location: US
* bucket:
* type: gcp:storage:Bucket
* properties:
* name: my_bucket
* location: US
* forceDestroy: true
* uniformBucketLevelAccess: true
* metadataFolder:
* type: gcp:storage:BucketObject
* name: metadata_folder
* properties:
* name: metadata/
* content: ' '
* bucket: ${bucket.name}
* database:
* type: gcp:biglake:Database
* properties:
* name: my_database
* catalog: ${catalog.id}
* type: HIVE
* hiveOptions:
* locationUri: gs://${bucket.name}/${metadataFolder.name}
* parameters:
* owner: John Doe
* ```
*
* ## Import
* Database can be imported using any of these accepted formats:
* * `{{catalog}}/databases/{{name}}`
* When using the `pulumi import` command, Database can be imported using one of the formats above. For example:
* ```sh
* $ pulumi import gcp:biglake/database:Database default {{catalog}}/databases/{{name}}
* ```
* @property catalog The parent catalog.
* @property hiveOptions Options of a Hive database.
* Structure is documented below.
* @property name The name of the database.
* @property type The database type.
*/
public data class DatabaseArgs(
public val catalog: Output? = null,
public val hiveOptions: Output? = null,
public val name: Output? = null,
public val type: Output? = null,
) : ConvertibleToJava {
override fun toJava(): com.pulumi.gcp.biglake.DatabaseArgs =
com.pulumi.gcp.biglake.DatabaseArgs.builder()
.catalog(catalog?.applyValue({ args0 -> args0 }))
.hiveOptions(hiveOptions?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
.name(name?.applyValue({ args0 -> args0 }))
.type(type?.applyValue({ args0 -> args0 })).build()
}
/**
* Builder for [DatabaseArgs].
*/
@PulumiTagMarker
public class DatabaseArgsBuilder internal constructor() {
private var catalog: Output? = null
private var hiveOptions: Output? = null
private var name: Output? = null
private var type: Output? = null
/**
* @param value The parent catalog.
*/
@JvmName("mkdrkcdxxggvoiwy")
public suspend fun catalog(`value`: Output) {
this.catalog = value
}
/**
* @param value Options of a Hive database.
* Structure is documented below.
*/
@JvmName("ovhlpjpopntjesgi")
public suspend fun hiveOptions(`value`: Output) {
this.hiveOptions = value
}
/**
* @param value The name of the database.
*/
@JvmName("bhhhwuomcalrhscy")
public suspend fun name(`value`: Output) {
this.name = value
}
/**
* @param value The database type.
*/
@JvmName("ueadfvqduygwfgee")
public suspend fun type(`value`: Output) {
this.type = value
}
/**
* @param value The parent catalog.
*/
@JvmName("uiargokdsyuphmal")
public suspend fun catalog(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.catalog = mapped
}
/**
* @param value Options of a Hive database.
* Structure is documented below.
*/
@JvmName("nlotlsxrtccjccvr")
public suspend fun hiveOptions(`value`: DatabaseHiveOptionsArgs?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.hiveOptions = mapped
}
/**
* @param argument Options of a Hive database.
* Structure is documented below.
*/
@JvmName("vsygymfyqlknifdr")
public suspend fun hiveOptions(argument: suspend DatabaseHiveOptionsArgsBuilder.() -> Unit) {
val toBeMapped = DatabaseHiveOptionsArgsBuilder().applySuspend { argument() }.build()
val mapped = of(toBeMapped)
this.hiveOptions = mapped
}
/**
* @param value The name of the database.
*/
@JvmName("litflnjrmvudadjj")
public suspend fun name(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.name = mapped
}
/**
* @param value The database type.
*/
@JvmName("avomvaonirgxfnms")
public suspend fun type(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.type = mapped
}
internal fun build(): DatabaseArgs = DatabaseArgs(
catalog = catalog,
hiveOptions = hiveOptions,
name = name,
type = type,
)
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy