com.pulumi.gcp.spanner.kotlin.SpannerFunctions.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.spanner.kotlin
import com.pulumi.gcp.spanner.SpannerFunctions.getDatabaseIamPolicyPlain
import com.pulumi.gcp.spanner.SpannerFunctions.getInstanceIamPolicyPlain
import com.pulumi.gcp.spanner.SpannerFunctions.getInstancePlain
import com.pulumi.gcp.spanner.kotlin.inputs.GetDatabaseIamPolicyPlainArgs
import com.pulumi.gcp.spanner.kotlin.inputs.GetDatabaseIamPolicyPlainArgsBuilder
import com.pulumi.gcp.spanner.kotlin.inputs.GetInstanceIamPolicyPlainArgs
import com.pulumi.gcp.spanner.kotlin.inputs.GetInstanceIamPolicyPlainArgsBuilder
import com.pulumi.gcp.spanner.kotlin.inputs.GetInstancePlainArgs
import com.pulumi.gcp.spanner.kotlin.inputs.GetInstancePlainArgsBuilder
import com.pulumi.gcp.spanner.kotlin.outputs.GetDatabaseIamPolicyResult
import com.pulumi.gcp.spanner.kotlin.outputs.GetInstanceIamPolicyResult
import com.pulumi.gcp.spanner.kotlin.outputs.GetInstanceResult
import kotlinx.coroutines.future.await
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import com.pulumi.gcp.spanner.kotlin.outputs.GetDatabaseIamPolicyResult.Companion.toKotlin as getDatabaseIamPolicyResultToKotlin
import com.pulumi.gcp.spanner.kotlin.outputs.GetInstanceIamPolicyResult.Companion.toKotlin as getInstanceIamPolicyResultToKotlin
import com.pulumi.gcp.spanner.kotlin.outputs.GetInstanceResult.Companion.toKotlin as getInstanceResultToKotlin
public object SpannerFunctions {
/**
* Retrieves the current IAM policy data for a Spanner database.
* ## example
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const foo = gcp.spanner.getDatabaseIamPolicy({
* project: database.project,
* database: database.name,
* instance: database.instance,
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* foo = gcp.spanner.get_database_iam_policy(project=database["project"],
* database=database["name"],
* instance=database["instance"])
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var foo = Gcp.Spanner.GetDatabaseIamPolicy.Invoke(new()
* {
* Project = database.Project,
* Database = database.Name,
* Instance = database.Instance,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/spanner"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := spanner.GetDatabaseIamPolicy(ctx, &spanner.GetDatabaseIamPolicyArgs{
* Project: pulumi.StringRef(database.Project),
* Database: database.Name,
* Instance: database.Instance,
* }, nil)
* 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.spanner.SpannerFunctions;
* import com.pulumi.gcp.spanner.inputs.GetDatabaseIamPolicyArgs;
* 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 foo = SpannerFunctions.getDatabaseIamPolicy(GetDatabaseIamPolicyArgs.builder()
* .project(database.project())
* .database(database.name())
* .instance(database.instance())
* .build());
* }
* }
* ```
* ```yaml
* variables:
* foo:
* fn::invoke:
* Function: gcp:spanner:getDatabaseIamPolicy
* Arguments:
* project: ${database.project}
* database: ${database.name}
* instance: ${database.instance}
* ```
*
* @param argument A collection of arguments for invoking getDatabaseIamPolicy.
* @return A collection of values returned by getDatabaseIamPolicy.
*/
public suspend fun getDatabaseIamPolicy(argument: GetDatabaseIamPolicyPlainArgs): GetDatabaseIamPolicyResult =
getDatabaseIamPolicyResultToKotlin(getDatabaseIamPolicyPlain(argument.toJava()).await())
/**
* @see [getDatabaseIamPolicy].
* @param database The name of the Spanner database.
* @param instance The name of the Spanner instance the database belongs to.
* @param project The ID of the project in which the resource belongs. If it
* is not provided, the provider project is used.
* @return A collection of values returned by getDatabaseIamPolicy.
*/
public suspend fun getDatabaseIamPolicy(
database: String,
instance: String,
project: String? = null,
): GetDatabaseIamPolicyResult {
val argument = GetDatabaseIamPolicyPlainArgs(
database = database,
instance = instance,
project = project,
)
return getDatabaseIamPolicyResultToKotlin(getDatabaseIamPolicyPlain(argument.toJava()).await())
}
/**
* @see [getDatabaseIamPolicy].
* @param argument Builder for [com.pulumi.gcp.spanner.kotlin.inputs.GetDatabaseIamPolicyPlainArgs].
* @return A collection of values returned by getDatabaseIamPolicy.
*/
public suspend fun getDatabaseIamPolicy(argument: suspend GetDatabaseIamPolicyPlainArgsBuilder.() -> Unit): GetDatabaseIamPolicyResult {
val builder = GetDatabaseIamPolicyPlainArgsBuilder()
builder.argument()
val builtArgument = builder.build()
return getDatabaseIamPolicyResultToKotlin(getDatabaseIamPolicyPlain(builtArgument.toJava()).await())
}
/**
* Get a spanner instance from Google Cloud by its name.
* ## Example Usage
* ```tf
* data "google_spanner_instance" "foo" {
* name = "bar"
* }
* ```
* @param argument A collection of arguments for invoking getInstance.
* @return A collection of values returned by getInstance.
*/
public suspend fun getInstance(argument: GetInstancePlainArgs): GetInstanceResult =
getInstanceResultToKotlin(getInstancePlain(argument.toJava()).await())
/**
* @see [getInstance].
* @param config
* @param displayName
* @param name The name of the spanner instance.
* - - -
* @param project The project in which the resource belongs. If it
* is not provided, the provider project is used.
* @return A collection of values returned by getInstance.
*/
public suspend fun getInstance(
config: String? = null,
displayName: String? = null,
name: String,
project: String? = null,
): GetInstanceResult {
val argument = GetInstancePlainArgs(
config = config,
displayName = displayName,
name = name,
project = project,
)
return getInstanceResultToKotlin(getInstancePlain(argument.toJava()).await())
}
/**
* @see [getInstance].
* @param argument Builder for [com.pulumi.gcp.spanner.kotlin.inputs.GetInstancePlainArgs].
* @return A collection of values returned by getInstance.
*/
public suspend fun getInstance(argument: suspend GetInstancePlainArgsBuilder.() -> Unit): GetInstanceResult {
val builder = GetInstancePlainArgsBuilder()
builder.argument()
val builtArgument = builder.build()
return getInstanceResultToKotlin(getInstancePlain(builtArgument.toJava()).await())
}
/**
* Retrieves the current IAM policy data for a Spanner instance.
* ## example
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const foo = gcp.spanner.getInstanceIamPolicy({
* project: instance.project,
* instance: instance.name,
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* foo = gcp.spanner.get_instance_iam_policy(project=instance["project"],
* instance=instance["name"])
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var foo = Gcp.Spanner.GetInstanceIamPolicy.Invoke(new()
* {
* Project = instance.Project,
* Instance = instance.Name,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/spanner"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := spanner.GetInstanceIamPolicy(ctx, &spanner.GetInstanceIamPolicyArgs{
* Project: pulumi.StringRef(instance.Project),
* Instance: instance.Name,
* }, nil)
* 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.spanner.SpannerFunctions;
* import com.pulumi.gcp.spanner.inputs.GetInstanceIamPolicyArgs;
* 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 foo = SpannerFunctions.getInstanceIamPolicy(GetInstanceIamPolicyArgs.builder()
* .project(instance.project())
* .instance(instance.name())
* .build());
* }
* }
* ```
* ```yaml
* variables:
* foo:
* fn::invoke:
* Function: gcp:spanner:getInstanceIamPolicy
* Arguments:
* project: ${instance.project}
* instance: ${instance.name}
* ```
*
* @param argument A collection of arguments for invoking getInstanceIamPolicy.
* @return A collection of values returned by getInstanceIamPolicy.
*/
public suspend fun getInstanceIamPolicy(argument: GetInstanceIamPolicyPlainArgs): GetInstanceIamPolicyResult =
getInstanceIamPolicyResultToKotlin(getInstanceIamPolicyPlain(argument.toJava()).await())
/**
* @see [getInstanceIamPolicy].
* @param instance The name of the instance.
* @param project The ID of the project in which the resource belongs. If it
* is not provided, the provider project is used.
* @return A collection of values returned by getInstanceIamPolicy.
*/
public suspend fun getInstanceIamPolicy(instance: String, project: String? = null): GetInstanceIamPolicyResult {
val argument = GetInstanceIamPolicyPlainArgs(
instance = instance,
project = project,
)
return getInstanceIamPolicyResultToKotlin(getInstanceIamPolicyPlain(argument.toJava()).await())
}
/**
* @see [getInstanceIamPolicy].
* @param argument Builder for [com.pulumi.gcp.spanner.kotlin.inputs.GetInstanceIamPolicyPlainArgs].
* @return A collection of values returned by getInstanceIamPolicy.
*/
public suspend fun getInstanceIamPolicy(argument: suspend GetInstanceIamPolicyPlainArgsBuilder.() -> Unit): GetInstanceIamPolicyResult {
val builder = GetInstanceIamPolicyPlainArgsBuilder()
builder.argument()
val builtArgument = builder.build()
return getInstanceIamPolicyResultToKotlin(getInstanceIamPolicyPlain(builtArgument.toJava()).await())
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy