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

com.pulumi.gcp.cloudfunctionsv2.kotlin.Cloudfunctionsv2Functions.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 8.12.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.cloudfunctionsv2.kotlin

import com.pulumi.gcp.cloudfunctionsv2.Cloudfunctionsv2Functions.getFunctionIamPolicyPlain
import com.pulumi.gcp.cloudfunctionsv2.Cloudfunctionsv2Functions.getFunctionPlain
import com.pulumi.gcp.cloudfunctionsv2.kotlin.inputs.GetFunctionIamPolicyPlainArgs
import com.pulumi.gcp.cloudfunctionsv2.kotlin.inputs.GetFunctionIamPolicyPlainArgsBuilder
import com.pulumi.gcp.cloudfunctionsv2.kotlin.inputs.GetFunctionPlainArgs
import com.pulumi.gcp.cloudfunctionsv2.kotlin.inputs.GetFunctionPlainArgsBuilder
import com.pulumi.gcp.cloudfunctionsv2.kotlin.outputs.GetFunctionIamPolicyResult
import com.pulumi.gcp.cloudfunctionsv2.kotlin.outputs.GetFunctionResult
import kotlinx.coroutines.future.await
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import com.pulumi.gcp.cloudfunctionsv2.kotlin.outputs.GetFunctionIamPolicyResult.Companion.toKotlin as getFunctionIamPolicyResultToKotlin
import com.pulumi.gcp.cloudfunctionsv2.kotlin.outputs.GetFunctionResult.Companion.toKotlin as getFunctionResultToKotlin

public object Cloudfunctionsv2Functions {
    /**
     * Get information about a Google Cloud Function (2nd gen). For more information see:
     * * [API documentation](https://cloud.google.com/functions/docs/reference/rest/v2beta/projects.locations.functions).
     * ## Example Usage
     * 
     * ```typescript
     * import * as pulumi from "@pulumi/pulumi";
     * import * as gcp from "@pulumi/gcp";
     * const my-function = gcp.cloudfunctionsv2.getFunction({
     *     name: "function",
     *     location: "us-central1",
     * });
     * ```
     * ```python
     * import pulumi
     * import pulumi_gcp as gcp
     * my_function = gcp.cloudfunctionsv2.get_function(name="function",
     *     location="us-central1")
     * ```
     * ```csharp
     * using System.Collections.Generic;
     * using System.Linq;
     * using Pulumi;
     * using Gcp = Pulumi.Gcp;
     * return await Deployment.RunAsync(() =>
     * {
     *     var my_function = Gcp.CloudFunctionsV2.GetFunction.Invoke(new()
     *     {
     *         Name = "function",
     *         Location = "us-central1",
     *     });
     * });
     * ```
     * ```go
     * package main
     * import (
     * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/cloudfunctionsv2"
     * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
     * )
     * func main() {
     * 	pulumi.Run(func(ctx *pulumi.Context) error {
     * 		_, err := cloudfunctionsv2.LookupFunction(ctx, &cloudfunctionsv2.LookupFunctionArgs{
     * 			Name:     "function",
     * 			Location: "us-central1",
     * 		}, 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.cloudfunctionsv2.Cloudfunctionsv2Functions;
     * import com.pulumi.gcp.cloudfunctionsv2.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 = Cloudfunctionsv2Functions.getFunction(GetFunctionArgs.builder()
     *             .name("function")
     *             .location("us-central1")
     *             .build());
     *     }
     * }
     * ```
     * ```yaml
     * variables:
     *   my-function:
     *     fn::invoke:
     *       Function: gcp:cloudfunctionsv2:getFunction
     *       Arguments:
     *         name: function
     *         location: us-central1
     * ```
     * 
     * @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 location The location in which the resource belongs.
     * - - -
     * @param name The name of a Cloud Function (2nd gen).
     * @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 getFunction.
     */
    public suspend fun getFunction(
        location: String,
        name: String,
        project: String? = null,
    ): GetFunctionResult {
        val argument = GetFunctionPlainArgs(
            location = location,
            name = name,
            project = project,
        )
        return getFunctionResultToKotlin(getFunctionPlain(argument.toJava()).await())
    }

    /**
     * @see [getFunction].
     * @param argument Builder for [com.pulumi.gcp.cloudfunctionsv2.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 function
     * ## example
     * 
     * ```typescript
     * import * as pulumi from "@pulumi/pulumi";
     * import * as gcp from "@pulumi/gcp";
     * const policy = gcp.cloudfunctionsv2.getFunctionIamPolicy({
     *     project: _function.project,
     *     location: _function.location,
     *     cloudFunction: _function.name,
     * });
     * ```
     * ```python
     * import pulumi
     * import pulumi_gcp as gcp
     * policy = gcp.cloudfunctionsv2.get_function_iam_policy(project=function["project"],
     *     location=function["location"],
     *     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.CloudFunctionsV2.GetFunctionIamPolicy.Invoke(new()
     *     {
     *         Project = function.Project,
     *         Location = function.Location,
     *         CloudFunction = function.Name,
     *     });
     * });
     * ```
     * ```go
     * package main
     * import (
     * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/cloudfunctionsv2"
     * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
     * )
     * func main() {
     * 	pulumi.Run(func(ctx *pulumi.Context) error {
     * 		_, err := cloudfunctionsv2.LookupFunctionIamPolicy(ctx, &cloudfunctionsv2.LookupFunctionIamPolicyArgs{
     * 			Project:       pulumi.StringRef(function.Project),
     * 			Location:      pulumi.StringRef(function.Location),
     * 			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.cloudfunctionsv2.Cloudfunctionsv2Functions;
     * import com.pulumi.gcp.cloudfunctionsv2.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 = Cloudfunctionsv2Functions.getFunctionIamPolicy(GetFunctionIamPolicyArgs.builder()
     *             .project(function.project())
     *             .location(function.location())
     *             .cloudFunction(function.name())
     *             .build());
     *     }
     * }
     * ```
     * ```yaml
     * variables:
     *   policy:
     *     fn::invoke:
     *       Function: gcp:cloudfunctionsv2:getFunctionIamPolicy
     *       Arguments:
     *         project: ${function.project}
     *         location: ${function.location}
     *         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 location The location of this cloud function. 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.
     * @return A collection of values returned by getFunctionIamPolicy.
     */
    public suspend fun getFunctionIamPolicy(
        cloudFunction: String,
        location: String? = null,
        project: String? = null,
    ): GetFunctionIamPolicyResult {
        val argument = GetFunctionIamPolicyPlainArgs(
            cloudFunction = cloudFunction,
            location = location,
            project = project,
        )
        return getFunctionIamPolicyResultToKotlin(getFunctionIamPolicyPlain(argument.toJava()).await())
    }

    /**
     * @see [getFunctionIamPolicy].
     * @param argument Builder for [com.pulumi.gcp.cloudfunctionsv2.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