com.pulumi.gcp.secretmanager.kotlin.SecretmanagerFunctions.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.secretmanager.kotlin
import com.pulumi.gcp.secretmanager.SecretmanagerFunctions.getSecretIamPolicyPlain
import com.pulumi.gcp.secretmanager.SecretmanagerFunctions.getSecretPlain
import com.pulumi.gcp.secretmanager.SecretmanagerFunctions.getSecretVersionAccessPlain
import com.pulumi.gcp.secretmanager.SecretmanagerFunctions.getSecretVersionPlain
import com.pulumi.gcp.secretmanager.SecretmanagerFunctions.getSecretsPlain
import com.pulumi.gcp.secretmanager.kotlin.inputs.GetSecretIamPolicyPlainArgs
import com.pulumi.gcp.secretmanager.kotlin.inputs.GetSecretIamPolicyPlainArgsBuilder
import com.pulumi.gcp.secretmanager.kotlin.inputs.GetSecretPlainArgs
import com.pulumi.gcp.secretmanager.kotlin.inputs.GetSecretPlainArgsBuilder
import com.pulumi.gcp.secretmanager.kotlin.inputs.GetSecretVersionAccessPlainArgs
import com.pulumi.gcp.secretmanager.kotlin.inputs.GetSecretVersionAccessPlainArgsBuilder
import com.pulumi.gcp.secretmanager.kotlin.inputs.GetSecretVersionPlainArgs
import com.pulumi.gcp.secretmanager.kotlin.inputs.GetSecretVersionPlainArgsBuilder
import com.pulumi.gcp.secretmanager.kotlin.inputs.GetSecretsPlainArgs
import com.pulumi.gcp.secretmanager.kotlin.inputs.GetSecretsPlainArgsBuilder
import com.pulumi.gcp.secretmanager.kotlin.outputs.GetSecretIamPolicyResult
import com.pulumi.gcp.secretmanager.kotlin.outputs.GetSecretResult
import com.pulumi.gcp.secretmanager.kotlin.outputs.GetSecretVersionAccessResult
import com.pulumi.gcp.secretmanager.kotlin.outputs.GetSecretVersionResult
import com.pulumi.gcp.secretmanager.kotlin.outputs.GetSecretsResult
import kotlinx.coroutines.future.await
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import com.pulumi.gcp.secretmanager.kotlin.outputs.GetSecretIamPolicyResult.Companion.toKotlin as getSecretIamPolicyResultToKotlin
import com.pulumi.gcp.secretmanager.kotlin.outputs.GetSecretResult.Companion.toKotlin as getSecretResultToKotlin
import com.pulumi.gcp.secretmanager.kotlin.outputs.GetSecretVersionAccessResult.Companion.toKotlin as getSecretVersionAccessResultToKotlin
import com.pulumi.gcp.secretmanager.kotlin.outputs.GetSecretVersionResult.Companion.toKotlin as getSecretVersionResultToKotlin
import com.pulumi.gcp.secretmanager.kotlin.outputs.GetSecretsResult.Companion.toKotlin as getSecretsResultToKotlin
public object SecretmanagerFunctions {
/**
* Use this data source to get information about a Secret Manager Secret
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const qa = gcp.secretmanager.getSecret({
* secretId: "foobar",
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* qa = gcp.secretmanager.get_secret(secret_id="foobar")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var qa = Gcp.SecretManager.GetSecret.Invoke(new()
* {
* SecretId = "foobar",
* });
* });
* ```
* ```go
* package main
* import (
* "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 {
* _, err := secretmanager.LookupSecret(ctx, &secretmanager.LookupSecretArgs{
* SecretId: "foobar",
* }, 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.secretmanager.SecretmanagerFunctions;
* import com.pulumi.gcp.secretmanager.inputs.GetSecretArgs;
* 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 qa = SecretmanagerFunctions.getSecret(GetSecretArgs.builder()
* .secretId("foobar")
* .build());
* }
* }
* ```
* ```yaml
* variables:
* qa:
* fn::invoke:
* Function: gcp:secretmanager:getSecret
* Arguments:
* secretId: foobar
* ```
*
* @param argument A collection of arguments for invoking getSecret.
* @return A collection of values returned by getSecret.
*/
public suspend fun getSecret(argument: GetSecretPlainArgs): GetSecretResult =
getSecretResultToKotlin(getSecretPlain(argument.toJava()).await())
/**
* @see [getSecret].
* @param project The ID of the project in which the resource belongs.
* @param secretId The name of the secret.
* @return A collection of values returned by getSecret.
*/
public suspend fun getSecret(project: String? = null, secretId: String): GetSecretResult {
val argument = GetSecretPlainArgs(
project = project,
secretId = secretId,
)
return getSecretResultToKotlin(getSecretPlain(argument.toJava()).await())
}
/**
* @see [getSecret].
* @param argument Builder for [com.pulumi.gcp.secretmanager.kotlin.inputs.GetSecretPlainArgs].
* @return A collection of values returned by getSecret.
*/
public suspend fun getSecret(argument: suspend GetSecretPlainArgsBuilder.() -> Unit): GetSecretResult {
val builder = GetSecretPlainArgsBuilder()
builder.argument()
val builtArgument = builder.build()
return getSecretResultToKotlin(getSecretPlain(builtArgument.toJava()).await())
}
/**
* Retrieves the current IAM policy data for secret
* ## example
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const policy = gcp.secretmanager.getSecretIamPolicy({
* project: secret_basic.project,
* secretId: secret_basic.secretId,
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* policy = gcp.secretmanager.get_secret_iam_policy(project=secret_basic["project"],
* secret_id=secret_basic["secretId"])
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var policy = Gcp.SecretManager.GetSecretIamPolicy.Invoke(new()
* {
* Project = secret_basic.Project,
* SecretId = secret_basic.SecretId,
* });
* });
* ```
* ```go
* package main
* import (
* "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 {
* _, err := secretmanager.LookupSecretIamPolicy(ctx, &secretmanager.LookupSecretIamPolicyArgs{
* Project: pulumi.StringRef(secret_basic.Project),
* SecretId: secret_basic.SecretId,
* }, 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.secretmanager.SecretmanagerFunctions;
* import com.pulumi.gcp.secretmanager.inputs.GetSecretIamPolicyArgs;
* 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 policy = SecretmanagerFunctions.getSecretIamPolicy(GetSecretIamPolicyArgs.builder()
* .project(secret_basic.project())
* .secretId(secret_basic.secretId())
* .build());
* }
* }
* ```
* ```yaml
* variables:
* policy:
* fn::invoke:
* Function: gcp:secretmanager:getSecretIamPolicy
* Arguments:
* project: ${["secret-basic"].project}
* secretId: ${["secret-basic"].secretId}
* ```
*
* @param argument A collection of arguments for invoking getSecretIamPolicy.
* @return A collection of values returned by getSecretIamPolicy.
*/
public suspend fun getSecretIamPolicy(argument: GetSecretIamPolicyPlainArgs): GetSecretIamPolicyResult =
getSecretIamPolicyResultToKotlin(getSecretIamPolicyPlain(argument.toJava()).await())
/**
* @see [getSecretIamPolicy].
* @param project The ID of the project in which the resource belongs.
* If it is not provided, the project will be parsed from the identifier of the parent resource. If no project is provided in the parent identifier and no project is specified, the provider project is used.
* @param secretId
* @return A collection of values returned by getSecretIamPolicy.
*/
public suspend fun getSecretIamPolicy(project: String? = null, secretId: String): GetSecretIamPolicyResult {
val argument = GetSecretIamPolicyPlainArgs(
project = project,
secretId = secretId,
)
return getSecretIamPolicyResultToKotlin(getSecretIamPolicyPlain(argument.toJava()).await())
}
/**
* @see [getSecretIamPolicy].
* @param argument Builder for [com.pulumi.gcp.secretmanager.kotlin.inputs.GetSecretIamPolicyPlainArgs].
* @return A collection of values returned by getSecretIamPolicy.
*/
public suspend fun getSecretIamPolicy(argument: suspend GetSecretIamPolicyPlainArgsBuilder.() -> Unit): GetSecretIamPolicyResult {
val builder = GetSecretIamPolicyPlainArgsBuilder()
builder.argument()
val builtArgument = builder.build()
return getSecretIamPolicyResultToKotlin(getSecretIamPolicyPlain(builtArgument.toJava()).await())
}
/**
* Get the value and metadata from a Secret Manager secret version. For more information see the official documentation datasource.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const basic = gcp.secretmanager.getSecretVersion({
* secret: "my-secret",
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* basic = gcp.secretmanager.get_secret_version(secret="my-secret")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var basic = Gcp.SecretManager.GetSecretVersion.Invoke(new()
* {
* Secret = "my-secret",
* });
* });
* ```
* ```go
* package main
* import (
* "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 {
* _, err := secretmanager.LookupSecretVersion(ctx, &secretmanager.LookupSecretVersionArgs{
* Secret: "my-secret",
* }, 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.secretmanager.SecretmanagerFunctions;
* import com.pulumi.gcp.secretmanager.inputs.GetSecretVersionArgs;
* 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 basic = SecretmanagerFunctions.getSecretVersion(GetSecretVersionArgs.builder()
* .secret("my-secret")
* .build());
* }
* }
* ```
* ```yaml
* variables:
* basic:
* fn::invoke:
* Function: gcp:secretmanager:getSecretVersion
* Arguments:
* secret: my-secret
* ```
*
* @param argument A collection of arguments for invoking getSecretVersion.
* @return A collection of values returned by getSecretVersion.
*/
public suspend fun getSecretVersion(argument: GetSecretVersionPlainArgs): GetSecretVersionResult =
getSecretVersionResultToKotlin(getSecretVersionPlain(argument.toJava()).await())
/**
* @see [getSecretVersion].
* @param project The project to get the secret version for. If it
* is not provided, the provider project is used.
* @param secret The secret to get the secret version for.
* @param version The version of the secret to get. If it
* is not provided, the latest version is retrieved.
* @return A collection of values returned by getSecretVersion.
*/
public suspend fun getSecretVersion(
project: String? = null,
secret: String,
version: String? = null,
): GetSecretVersionResult {
val argument = GetSecretVersionPlainArgs(
project = project,
secret = secret,
version = version,
)
return getSecretVersionResultToKotlin(getSecretVersionPlain(argument.toJava()).await())
}
/**
* @see [getSecretVersion].
* @param argument Builder for [com.pulumi.gcp.secretmanager.kotlin.inputs.GetSecretVersionPlainArgs].
* @return A collection of values returned by getSecretVersion.
*/
public suspend fun getSecretVersion(argument: suspend GetSecretVersionPlainArgsBuilder.() -> Unit): GetSecretVersionResult {
val builder = GetSecretVersionPlainArgsBuilder()
builder.argument()
val builtArgument = builder.build()
return getSecretVersionResultToKotlin(getSecretVersionPlain(builtArgument.toJava()).await())
}
/**
* Get the value from a Secret Manager secret version. This is similar to the gcp.secretmanager.SecretVersion datasource, but it only requires the [Secret Manager Secret Accessor](https://cloud.google.com/secret-manager/docs/access-control#secretmanager.secretAccessor) role. For more information see the [official documentation](https://cloud.google.com/secret-manager/docs/) and [API](https://cloud.google.com/secret-manager/docs/reference/rest/v1/projects.secrets.versions/access).
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const basic = gcp.secretmanager.getSecretVersionAccess({
* secret: "my-secret",
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* basic = gcp.secretmanager.get_secret_version_access(secret="my-secret")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var basic = Gcp.SecretManager.GetSecretVersionAccess.Invoke(new()
* {
* Secret = "my-secret",
* });
* });
* ```
* ```go
* package main
* import (
* "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 {
* _, err := secretmanager.GetSecretVersionAccess(ctx, &secretmanager.GetSecretVersionAccessArgs{
* Secret: "my-secret",
* }, 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.secretmanager.SecretmanagerFunctions;
* import com.pulumi.gcp.secretmanager.inputs.GetSecretVersionAccessArgs;
* 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 basic = SecretmanagerFunctions.getSecretVersionAccess(GetSecretVersionAccessArgs.builder()
* .secret("my-secret")
* .build());
* }
* }
* ```
* ```yaml
* variables:
* basic:
* fn::invoke:
* Function: gcp:secretmanager:getSecretVersionAccess
* Arguments:
* secret: my-secret
* ```
*
* @param argument A collection of arguments for invoking getSecretVersionAccess.
* @return A collection of values returned by getSecretVersionAccess.
*/
public suspend fun getSecretVersionAccess(argument: GetSecretVersionAccessPlainArgs): GetSecretVersionAccessResult =
getSecretVersionAccessResultToKotlin(getSecretVersionAccessPlain(argument.toJava()).await())
/**
* @see [getSecretVersionAccess].
* @param project The project to get the secret version for. If it
* is not provided, the provider project is used.
* @param secret The secret to get the secret version for.
* @param version The version of the secret to get. If it
* is not provided, the latest version is retrieved.
* @return A collection of values returned by getSecretVersionAccess.
*/
public suspend fun getSecretVersionAccess(
project: String? = null,
secret: String,
version: String? = null,
): GetSecretVersionAccessResult {
val argument = GetSecretVersionAccessPlainArgs(
project = project,
secret = secret,
version = version,
)
return getSecretVersionAccessResultToKotlin(getSecretVersionAccessPlain(argument.toJava()).await())
}
/**
* @see [getSecretVersionAccess].
* @param argument Builder for [com.pulumi.gcp.secretmanager.kotlin.inputs.GetSecretVersionAccessPlainArgs].
* @return A collection of values returned by getSecretVersionAccess.
*/
public suspend fun getSecretVersionAccess(argument: suspend GetSecretVersionAccessPlainArgsBuilder.() -> Unit): GetSecretVersionAccessResult {
val builder = GetSecretVersionAccessPlainArgsBuilder()
builder.argument()
val builtArgument = builder.build()
return getSecretVersionAccessResultToKotlin(getSecretVersionAccessPlain(builtArgument.toJava()).await())
}
/**
* Use this data source to list the Secret Manager Secrets
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const secrets = gcp.secretmanager.getSecrets({});
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* secrets = gcp.secretmanager.get_secrets()
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var secrets = Gcp.SecretManager.GetSecrets.Invoke();
* });
* ```
* ```go
* package main
* import (
* "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 {
* _, err := secretmanager.GetSecrets(ctx, nil, 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.secretmanager.SecretmanagerFunctions;
* import com.pulumi.gcp.secretmanager.inputs.GetSecretsArgs;
* 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 secrets = SecretmanagerFunctions.getSecrets();
* }
* }
* ```
* ```yaml
* variables:
* secrets:
* fn::invoke:
* Function: gcp:secretmanager:getSecrets
* Arguments: {}
* ```
*
* @param argument A collection of arguments for invoking getSecrets.
* @return A collection of values returned by getSecrets.
*/
public suspend fun getSecrets(argument: GetSecretsPlainArgs): GetSecretsResult =
getSecretsResultToKotlin(getSecretsPlain(argument.toJava()).await())
/**
* @see [getSecrets].
* @param filter Filter string, adhering to the rules in [List-operation filtering](https://cloud.google.com/secret-manager/docs/filtering). List only secrets matching the filter. If filter is empty, all secrets are listed.
* @param project The ID of the project.
* @return A collection of values returned by getSecrets.
*/
public suspend fun getSecrets(filter: String? = null, project: String? = null): GetSecretsResult {
val argument = GetSecretsPlainArgs(
filter = filter,
project = project,
)
return getSecretsResultToKotlin(getSecretsPlain(argument.toJava()).await())
}
/**
* @see [getSecrets].
* @param argument Builder for [com.pulumi.gcp.secretmanager.kotlin.inputs.GetSecretsPlainArgs].
* @return A collection of values returned by getSecrets.
*/
public suspend fun getSecrets(argument: suspend GetSecretsPlainArgsBuilder.() -> Unit): GetSecretsResult {
val builder = GetSecretsPlainArgsBuilder()
builder.argument()
val builtArgument = builder.build()
return getSecretsResultToKotlin(getSecretsPlain(builtArgument.toJava()).await())
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy