com.pulumi.gcp.cloudfunctions.kotlin.CloudfunctionsFunctions.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.cloudfunctions.kotlin
import com.pulumi.gcp.cloudfunctions.CloudfunctionsFunctions.getFunctionIamPolicyPlain
import com.pulumi.gcp.cloudfunctions.CloudfunctionsFunctions.getFunctionPlain
import com.pulumi.gcp.cloudfunctions.kotlin.inputs.GetFunctionIamPolicyPlainArgs
import com.pulumi.gcp.cloudfunctions.kotlin.inputs.GetFunctionIamPolicyPlainArgsBuilder
import com.pulumi.gcp.cloudfunctions.kotlin.inputs.GetFunctionPlainArgs
import com.pulumi.gcp.cloudfunctions.kotlin.inputs.GetFunctionPlainArgsBuilder
import com.pulumi.gcp.cloudfunctions.kotlin.outputs.GetFunctionIamPolicyResult
import com.pulumi.gcp.cloudfunctions.kotlin.outputs.GetFunctionResult
import kotlinx.coroutines.future.await
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import com.pulumi.gcp.cloudfunctions.kotlin.outputs.GetFunctionIamPolicyResult.Companion.toKotlin as getFunctionIamPolicyResultToKotlin
import com.pulumi.gcp.cloudfunctions.kotlin.outputs.GetFunctionResult.Companion.toKotlin as getFunctionResultToKotlin
public object CloudfunctionsFunctions {
/**
* Get information about a Google Cloud Function. For more information see
* the [official documentation](https://cloud.google.com/functions/docs/)
* and [API](https://cloud.google.com/functions/docs/apis).
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const my-function = gcp.cloudfunctions.getFunction({
* name: "function",
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* my_function = gcp.cloudfunctions.get_function(name="function")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var my_function = Gcp.CloudFunctions.GetFunction.Invoke(new()
* {
* Name = "function",
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/cloudfunctions"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := cloudfunctions.LookupFunction(ctx, &cloudfunctions.LookupFunctionArgs{
* Name: "function",
* }, 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.cloudfunctions.CloudfunctionsFunctions;
* import com.pulumi.gcp.cloudfunctions.inputs.GetFunctionArgs;
* 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 my-function = CloudfunctionsFunctions.getFunction(GetFunctionArgs.builder()
* .name("function")
* .build());
* }
* }
* ```
* ```yaml
* variables:
* my-function:
* fn::invoke:
* Function: gcp:cloudfunctions:getFunction
* Arguments:
* name: function
* ```
*
* @param argument A collection of arguments for invoking getFunction.
* @return A collection of values returned by getFunction.
*/
public suspend fun getFunction(argument: GetFunctionPlainArgs): GetFunctionResult =
getFunctionResultToKotlin(getFunctionPlain(argument.toJava()).await())
/**
* @see [getFunction].
* @param name The name of a Cloud Function.
* - - -
* @param project The project in which the resource belongs. If it
* is not provided, the provider project is used.
* @param region The region in which the resource belongs. If it
* is not provided, the provider region is used.
* @return A collection of values returned by getFunction.
*/
public suspend fun getFunction(
name: String,
project: String? = null,
region: String? = null,
): GetFunctionResult {
val argument = GetFunctionPlainArgs(
name = name,
project = project,
region = region,
)
return getFunctionResultToKotlin(getFunctionPlain(argument.toJava()).await())
}
/**
* @see [getFunction].
* @param argument Builder for [com.pulumi.gcp.cloudfunctions.kotlin.inputs.GetFunctionPlainArgs].
* @return A collection of values returned by getFunction.
*/
public suspend fun getFunction(argument: suspend GetFunctionPlainArgsBuilder.() -> Unit): GetFunctionResult {
val builder = GetFunctionPlainArgsBuilder()
builder.argument()
val builtArgument = builder.build()
return getFunctionResultToKotlin(getFunctionPlain(builtArgument.toJava()).await())
}
/**
* Retrieves the current IAM policy data for cloudfunction
* ## example
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const policy = gcp.cloudfunctions.getFunctionIamPolicy({
* project: _function.project,
* region: _function.region,
* cloudFunction: _function.name,
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* policy = gcp.cloudfunctions.get_function_iam_policy(project=function["project"],
* region=function["region"],
* cloud_function=function["name"])
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var policy = Gcp.CloudFunctions.GetFunctionIamPolicy.Invoke(new()
* {
* Project = function.Project,
* Region = function.Region,
* CloudFunction = function.Name,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/cloudfunctions"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := cloudfunctions.LookupFunctionIamPolicy(ctx, &cloudfunctions.LookupFunctionIamPolicyArgs{
* Project: pulumi.StringRef(function.Project),
* Region: pulumi.StringRef(function.Region),
* CloudFunction: function.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.cloudfunctions.CloudfunctionsFunctions;
* import com.pulumi.gcp.cloudfunctions.inputs.GetFunctionIamPolicyArgs;
* 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 = CloudfunctionsFunctions.getFunctionIamPolicy(GetFunctionIamPolicyArgs.builder()
* .project(function.project())
* .region(function.region())
* .cloudFunction(function.name())
* .build());
* }
* }
* ```
* ```yaml
* variables:
* policy:
* fn::invoke:
* Function: gcp:cloudfunctions:getFunctionIamPolicy
* Arguments:
* project: ${function.project}
* region: ${function.region}
* cloudFunction: ${function.name}
* ```
*
* @param argument A collection of arguments for invoking getFunctionIamPolicy.
* @return A collection of values returned by getFunctionIamPolicy.
*/
public suspend fun getFunctionIamPolicy(argument: GetFunctionIamPolicyPlainArgs): GetFunctionIamPolicyResult =
getFunctionIamPolicyResultToKotlin(getFunctionIamPolicyPlain(argument.toJava()).await())
/**
* @see [getFunctionIamPolicy].
* @param cloudFunction Used to find the parent resource to bind the IAM policy to
* @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 region The location of this cloud function. Used to find the parent resource to bind the IAM policy to. If not specified,
* the value will be parsed from the identifier of the parent resource. If no region is provided in the parent identifier and no
* region is specified, it is taken from the provider configuration.
* @return A collection of values returned by getFunctionIamPolicy.
*/
public suspend fun getFunctionIamPolicy(
cloudFunction: String,
project: String? = null,
region: String? = null,
): GetFunctionIamPolicyResult {
val argument = GetFunctionIamPolicyPlainArgs(
cloudFunction = cloudFunction,
project = project,
region = region,
)
return getFunctionIamPolicyResultToKotlin(getFunctionIamPolicyPlain(argument.toJava()).await())
}
/**
* @see [getFunctionIamPolicy].
* @param argument Builder for [com.pulumi.gcp.cloudfunctions.kotlin.inputs.GetFunctionIamPolicyPlainArgs].
* @return A collection of values returned by getFunctionIamPolicy.
*/
public suspend fun getFunctionIamPolicy(argument: suspend GetFunctionIamPolicyPlainArgsBuilder.() -> Unit): GetFunctionIamPolicyResult {
val builder = GetFunctionIamPolicyPlainArgsBuilder()
builder.argument()
val builtArgument = builder.build()
return getFunctionIamPolicyResultToKotlin(getFunctionIamPolicyPlain(builtArgument.toJava()).await())
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy