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

com.pulumi.gcp.bigtable.kotlin.AuthorizedView.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.bigtable.kotlin

import com.pulumi.core.Output
import com.pulumi.gcp.bigtable.kotlin.outputs.AuthorizedViewSubsetView
import com.pulumi.gcp.bigtable.kotlin.outputs.AuthorizedViewSubsetView.Companion.toKotlin
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

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

    public var args: AuthorizedViewArgs = AuthorizedViewArgs()

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

/**
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * import * as std from "@pulumi/std";
 * const instance = new gcp.bigtable.Instance("instance", {
 *     name: "tf-instance",
 *     clusters: [{
 *         clusterId: "tf-instance-cluster",
 *         zone: "us-central1-b",
 *         numNodes: 3,
 *         storageType: "HDD",
 *     }],
 * });
 * const table = new gcp.bigtable.Table("table", {
 *     name: "tf-table",
 *     instanceName: instance.name,
 *     splitKeys: [
 *         "a",
 *         "b",
 *         "c",
 *     ],
 *     columnFamilies: [
 *         {
 *             family: "family-first",
 *         },
 *         {
 *             family: "family-second",
 *         },
 *     ],
 *     changeStreamRetention: "24h0m0s",
 * });
 * const authorizedView = new gcp.bigtable.AuthorizedView("authorized_view", {
 *     name: "tf-authorized-view",
 *     instanceName: instance.name,
 *     tableName: table.name,
 *     subsetView: {
 *         rowPrefixes: [std.base64encode({
 *             input: "prefix#",
 *         }).then(invoke => invoke.result)],
 *         familySubsets: [
 *             {
 *                 familyName: "family-first",
 *                 qualifiers: [
 *                     std.base64encode({
 *                         input: "qualifier",
 *                     }).then(invoke => invoke.result),
 *                     std.base64encode({
 *                         input: "qualifier-second",
 *                     }).then(invoke => invoke.result),
 *                 ],
 *             },
 *             {
 *                 familyName: "family-second",
 *                 qualifierPrefixes: [""],
 *             },
 *         ],
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * import pulumi_std as std
 * instance = gcp.bigtable.Instance("instance",
 *     name="tf-instance",
 *     clusters=[{
 *         "cluster_id": "tf-instance-cluster",
 *         "zone": "us-central1-b",
 *         "num_nodes": 3,
 *         "storage_type": "HDD",
 *     }])
 * table = gcp.bigtable.Table("table",
 *     name="tf-table",
 *     instance_name=instance.name,
 *     split_keys=[
 *         "a",
 *         "b",
 *         "c",
 *     ],
 *     column_families=[
 *         {
 *             "family": "family-first",
 *         },
 *         {
 *             "family": "family-second",
 *         },
 *     ],
 *     change_stream_retention="24h0m0s")
 * authorized_view = gcp.bigtable.AuthorizedView("authorized_view",
 *     name="tf-authorized-view",
 *     instance_name=instance.name,
 *     table_name=table.name,
 *     subset_view={
 *         "row_prefixes": [std.base64encode(input="prefix#").result],
 *         "family_subsets": [
 *             {
 *                 "family_name": "family-first",
 *                 "qualifiers": [
 *                     std.base64encode(input="qualifier").result,
 *                     std.base64encode(input="qualifier-second").result,
 *                 ],
 *             },
 *             {
 *                 "family_name": "family-second",
 *                 "qualifier_prefixes": [""],
 *             },
 *         ],
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * using Std = Pulumi.Std;
 * return await Deployment.RunAsync(() =>
 * {
 *     var instance = new Gcp.BigTable.Instance("instance", new()
 *     {
 *         Name = "tf-instance",
 *         Clusters = new[]
 *         {
 *             new Gcp.BigTable.Inputs.InstanceClusterArgs
 *             {
 *                 ClusterId = "tf-instance-cluster",
 *                 Zone = "us-central1-b",
 *                 NumNodes = 3,
 *                 StorageType = "HDD",
 *             },
 *         },
 *     });
 *     var table = new Gcp.BigTable.Table("table", new()
 *     {
 *         Name = "tf-table",
 *         InstanceName = instance.Name,
 *         SplitKeys = new[]
 *         {
 *             "a",
 *             "b",
 *             "c",
 *         },
 *         ColumnFamilies = new[]
 *         {
 *             new Gcp.BigTable.Inputs.TableColumnFamilyArgs
 *             {
 *                 Family = "family-first",
 *             },
 *             new Gcp.BigTable.Inputs.TableColumnFamilyArgs
 *             {
 *                 Family = "family-second",
 *             },
 *         },
 *         ChangeStreamRetention = "24h0m0s",
 *     });
 *     var authorizedView = new Gcp.BigTable.AuthorizedView("authorized_view", new()
 *     {
 *         Name = "tf-authorized-view",
 *         InstanceName = instance.Name,
 *         TableName = table.Name,
 *         SubsetView = new Gcp.BigTable.Inputs.AuthorizedViewSubsetViewArgs
 *         {
 *             RowPrefixes = new[]
 *             {
 *                 Std.Base64encode.Invoke(new()
 *                 {
 *                     Input = "prefix#",
 *                 }).Apply(invoke => invoke.Result),
 *             },
 *             FamilySubsets = new[]
 *             {
 *                 new Gcp.BigTable.Inputs.AuthorizedViewSubsetViewFamilySubsetArgs
 *                 {
 *                     FamilyName = "family-first",
 *                     Qualifiers = new[]
 *                     {
 *                         Std.Base64encode.Invoke(new()
 *                         {
 *                             Input = "qualifier",
 *                         }).Apply(invoke => invoke.Result),
 *                         Std.Base64encode.Invoke(new()
 *                         {
 *                             Input = "qualifier-second",
 *                         }).Apply(invoke => invoke.Result),
 *                     },
 *                 },
 *                 new Gcp.BigTable.Inputs.AuthorizedViewSubsetViewFamilySubsetArgs
 *                 {
 *                     FamilyName = "family-second",
 *                     QualifierPrefixes = new[]
 *                     {
 *                         "",
 *                     },
 *                 },
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/bigtable"
 * 	"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 {
 * 		instance, err := bigtable.NewInstance(ctx, "instance", &bigtable.InstanceArgs{
 * 			Name: pulumi.String("tf-instance"),
 * 			Clusters: bigtable.InstanceClusterArray{
 * 				&bigtable.InstanceClusterArgs{
 * 					ClusterId:   pulumi.String("tf-instance-cluster"),
 * 					Zone:        pulumi.String("us-central1-b"),
 * 					NumNodes:    pulumi.Int(3),
 * 					StorageType: pulumi.String("HDD"),
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		table, err := bigtable.NewTable(ctx, "table", &bigtable.TableArgs{
 * 			Name:         pulumi.String("tf-table"),
 * 			InstanceName: instance.Name,
 * 			SplitKeys: pulumi.StringArray{
 * 				pulumi.String("a"),
 * 				pulumi.String("b"),
 * 				pulumi.String("c"),
 * 			},
 * 			ColumnFamilies: bigtable.TableColumnFamilyArray{
 * 				&bigtable.TableColumnFamilyArgs{
 * 					Family: pulumi.String("family-first"),
 * 				},
 * 				&bigtable.TableColumnFamilyArgs{
 * 					Family: pulumi.String("family-second"),
 * 				},
 * 			},
 * 			ChangeStreamRetention: pulumi.String("24h0m0s"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		invokeBase64encode, err := std.Base64encode(ctx, &std.Base64encodeArgs{
 * 			Input: "prefix#",
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		invokeBase64encode1, err := std.Base64encode(ctx, &std.Base64encodeArgs{
 * 			Input: "qualifier",
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		invokeBase64encode2, err := std.Base64encode(ctx, &std.Base64encodeArgs{
 * 			Input: "qualifier-second",
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = bigtable.NewAuthorizedView(ctx, "authorized_view", &bigtable.AuthorizedViewArgs{
 * 			Name:         pulumi.String("tf-authorized-view"),
 * 			InstanceName: instance.Name,
 * 			TableName:    table.Name,
 * 			SubsetView: &bigtable.AuthorizedViewSubsetViewArgs{
 * 				RowPrefixes: pulumi.StringArray{
 * 					pulumi.String(invokeBase64encode.Result),
 * 				},
 * 				FamilySubsets: bigtable.AuthorizedViewSubsetViewFamilySubsetArray{
 * 					&bigtable.AuthorizedViewSubsetViewFamilySubsetArgs{
 * 						FamilyName: pulumi.String("family-first"),
 * 						Qualifiers: pulumi.StringArray{
 * 							pulumi.String(invokeBase64encode1.Result),
 * 							pulumi.String(invokeBase64encode2.Result),
 * 						},
 * 					},
 * 					&bigtable.AuthorizedViewSubsetViewFamilySubsetArgs{
 * 						FamilyName: pulumi.String("family-second"),
 * 						QualifierPrefixes: pulumi.StringArray{
 * 							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.bigtable.Instance;
 * import com.pulumi.gcp.bigtable.InstanceArgs;
 * import com.pulumi.gcp.bigtable.inputs.InstanceClusterArgs;
 * import com.pulumi.gcp.bigtable.Table;
 * import com.pulumi.gcp.bigtable.TableArgs;
 * import com.pulumi.gcp.bigtable.inputs.TableColumnFamilyArgs;
 * import com.pulumi.gcp.bigtable.AuthorizedView;
 * import com.pulumi.gcp.bigtable.AuthorizedViewArgs;
 * import com.pulumi.gcp.bigtable.inputs.AuthorizedViewSubsetViewArgs;
 * 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 instance = new Instance("instance", InstanceArgs.builder()
 *             .name("tf-instance")
 *             .clusters(InstanceClusterArgs.builder()
 *                 .clusterId("tf-instance-cluster")
 *                 .zone("us-central1-b")
 *                 .numNodes(3)
 *                 .storageType("HDD")
 *                 .build())
 *             .build());
 *         var table = new Table("table", TableArgs.builder()
 *             .name("tf-table")
 *             .instanceName(instance.name())
 *             .splitKeys(
 *                 "a",
 *                 "b",
 *                 "c")
 *             .columnFamilies(
 *                 TableColumnFamilyArgs.builder()
 *                     .family("family-first")
 *                     .build(),
 *                 TableColumnFamilyArgs.builder()
 *                     .family("family-second")
 *                     .build())
 *             .changeStreamRetention("24h0m0s")
 *             .build());
 *         var authorizedView = new AuthorizedView("authorizedView", AuthorizedViewArgs.builder()
 *             .name("tf-authorized-view")
 *             .instanceName(instance.name())
 *             .tableName(table.name())
 *             .subsetView(AuthorizedViewSubsetViewArgs.builder()
 *                 .rowPrefixes(StdFunctions.base64encode(Base64encodeArgs.builder()
 *                     .input("prefix#")
 *                     .build()).result())
 *                 .familySubsets(
 *                     AuthorizedViewSubsetViewFamilySubsetArgs.builder()
 *                         .familyName("family-first")
 *                         .qualifiers(
 *                             StdFunctions.base64encode(Base64encodeArgs.builder()
 *                                 .input("qualifier")
 *                                 .build()).result(),
 *                             StdFunctions.base64encode(Base64encodeArgs.builder()
 *                                 .input("qualifier-second")
 *                                 .build()).result())
 *                         .build(),
 *                     AuthorizedViewSubsetViewFamilySubsetArgs.builder()
 *                         .familyName("family-second")
 *                         .qualifierPrefixes("")
 *                         .build())
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   instance:
 *     type: gcp:bigtable:Instance
 *     properties:
 *       name: tf-instance
 *       clusters:
 *         - clusterId: tf-instance-cluster
 *           zone: us-central1-b
 *           numNodes: 3
 *           storageType: HDD
 *   table:
 *     type: gcp:bigtable:Table
 *     properties:
 *       name: tf-table
 *       instanceName: ${instance.name}
 *       splitKeys:
 *         - a
 *         - b
 *         - c
 *       columnFamilies:
 *         - family: family-first
 *         - family: family-second
 *       changeStreamRetention: 24h0m0s
 *   authorizedView:
 *     type: gcp:bigtable:AuthorizedView
 *     name: authorized_view
 *     properties:
 *       name: tf-authorized-view
 *       instanceName: ${instance.name}
 *       tableName: ${table.name}
 *       subsetView:
 *         rowPrefixes:
 *           - fn::invoke:
 *               Function: std:base64encode
 *               Arguments:
 *                 input: prefix#
 *               Return: result
 *         familySubsets:
 *           - familyName: family-first
 *             qualifiers:
 *               - fn::invoke:
 *                   Function: std:base64encode
 *                   Arguments:
 *                     input: qualifier
 *                   Return: result
 *               - fn::invoke:
 *                   Function: std:base64encode
 *                   Arguments:
 *                     input: qualifier-second
 *                   Return: result
 *           - familyName: family-second
 *             qualifierPrefixes:
 *               -
 * ```
 * 
 * ## Import
 * Bigtable Authorized Views can be imported using any of these accepted formats:
 * * `projects/{{project}}/instances/{{instance_name}}/tables/{{table_name}}/authorizedViews/{{name}}`
 * * `{{project}}/{{instance_name}}/{{table_name}}/{{name}}`
 * * `{{instance_name}}/{{table_name}}/{{name}}`
 * When using the `pulumi import` command, Bigtable Authorized Views can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:bigtable/authorizedView:AuthorizedView default projects/{{project}}/instances/{{instance_name}}/tables/{{table_name}}/authorizedViews/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:bigtable/authorizedView:AuthorizedView default {{project}}/{{instance_name}}/{{table_name}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:bigtable/authorizedView:AuthorizedView default {{instance_name}}/{{table_name}}/{{name}}
 * ```
 */
public class AuthorizedView internal constructor(
    override val javaResource: com.pulumi.gcp.bigtable.AuthorizedView,
) : KotlinCustomResource(javaResource, AuthorizedViewMapper) {
    public val deletionProtection: Output
        get() = javaResource.deletionProtection().applyValue({ args0 -> args0 })

    /**
     * The name of the Bigtable instance in which the authorized view belongs.
     */
    public val instanceName: Output
        get() = javaResource.instanceName().applyValue({ args0 -> args0 })

    /**
     * The name of the authorized view. Must be 1-50 characters and must only contain hyphens, underscores, periods, letters and numbers.
     */
    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 })

    /**
     * An AuthorizedView permitting access to an explicit subset of a Table. Structure is documented below.
     * -----
     */
    public val subsetView: Output?
        get() = javaResource.subsetView().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    toKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * The name of the Bigtable table in which the authorized view belongs.
     */
    public val tableName: Output
        get() = javaResource.tableName().applyValue({ args0 -> args0 })
}

public object AuthorizedViewMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.bigtable.AuthorizedView::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy