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

com.pulumi.gcp.cloudrun.kotlin.CloudrunFunctions.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.cloudrun.kotlin

import com.pulumi.gcp.cloudrun.CloudrunFunctions.getLocationsPlain
import com.pulumi.gcp.cloudrun.CloudrunFunctions.getServiceIamPolicyPlain
import com.pulumi.gcp.cloudrun.CloudrunFunctions.getServicePlain
import com.pulumi.gcp.cloudrun.kotlin.inputs.GetLocationsPlainArgs
import com.pulumi.gcp.cloudrun.kotlin.inputs.GetLocationsPlainArgsBuilder
import com.pulumi.gcp.cloudrun.kotlin.inputs.GetServiceIamPolicyPlainArgs
import com.pulumi.gcp.cloudrun.kotlin.inputs.GetServiceIamPolicyPlainArgsBuilder
import com.pulumi.gcp.cloudrun.kotlin.inputs.GetServicePlainArgs
import com.pulumi.gcp.cloudrun.kotlin.inputs.GetServicePlainArgsBuilder
import com.pulumi.gcp.cloudrun.kotlin.outputs.GetLocationsResult
import com.pulumi.gcp.cloudrun.kotlin.outputs.GetServiceIamPolicyResult
import com.pulumi.gcp.cloudrun.kotlin.outputs.GetServiceResult
import kotlinx.coroutines.future.await
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import com.pulumi.gcp.cloudrun.kotlin.outputs.GetLocationsResult.Companion.toKotlin as getLocationsResultToKotlin
import com.pulumi.gcp.cloudrun.kotlin.outputs.GetServiceIamPolicyResult.Companion.toKotlin as getServiceIamPolicyResultToKotlin
import com.pulumi.gcp.cloudrun.kotlin.outputs.GetServiceResult.Companion.toKotlin as getServiceResultToKotlin

public object CloudrunFunctions {
    /**
     * Get Cloud Run locations available for a project.
     * To get more information about Cloud Run, see:
     * * [API documentation](https://cloud.google.com/run/docs/reference/rest/v1/projects.locations)
     * * How-to Guides
     *     * [Official Documentation](https://cloud.google.com/run/docs/)
     * ## Example Usage
     * 
     * ```typescript
     * import * as pulumi from "@pulumi/pulumi";
     * import * as gcp from "@pulumi/gcp";
     * const available = gcp.cloudrun.getLocations({});
     * ```
     * ```python
     * import pulumi
     * import pulumi_gcp as gcp
     * available = gcp.cloudrun.get_locations()
     * ```
     * ```csharp
     * using System.Collections.Generic;
     * using System.Linq;
     * using Pulumi;
     * using Gcp = Pulumi.Gcp;
     * return await Deployment.RunAsync(() =>
     * {
     *     var available = Gcp.CloudRun.GetLocations.Invoke();
     * });
     * ```
     * ```go
     * package main
     * import (
     * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/cloudrun"
     * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
     * )
     * func main() {
     * 	pulumi.Run(func(ctx *pulumi.Context) error {
     * 		_, err := cloudrun.GetLocations(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.cloudrun.CloudrunFunctions;
     * import com.pulumi.gcp.cloudrun.inputs.GetLocationsArgs;
     * 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 available = CloudrunFunctions.getLocations();
     *     }
     * }
     * ```
     * ```yaml
     * variables:
     *   available:
     *     fn::invoke:
     *       Function: gcp:cloudrun:getLocations
     *       Arguments: {}
     * ```
     * 
     * @param argument A collection of arguments for invoking getLocations.
     * @return A collection of values returned by getLocations.
     */
    public suspend fun getLocations(argument: GetLocationsPlainArgs): GetLocationsResult =
        getLocationsResultToKotlin(getLocationsPlain(argument.toJava()).await())

    /**
     * @see [getLocations].
     * @param project The project to list versions for. If it
     * is not provided, the provider project is used.
     * @return A collection of values returned by getLocations.
     */
    public suspend fun getLocations(project: String? = null): GetLocationsResult {
        val argument = GetLocationsPlainArgs(
            project = project,
        )
        return getLocationsResultToKotlin(getLocationsPlain(argument.toJava()).await())
    }

    /**
     * @see [getLocations].
     * @param argument Builder for [com.pulumi.gcp.cloudrun.kotlin.inputs.GetLocationsPlainArgs].
     * @return A collection of values returned by getLocations.
     */
    public suspend fun getLocations(argument: suspend GetLocationsPlainArgsBuilder.() -> Unit): GetLocationsResult {
        val builder = GetLocationsPlainArgsBuilder()
        builder.argument()
        val builtArgument = builder.build()
        return getLocationsResultToKotlin(getLocationsPlain(builtArgument.toJava()).await())
    }

    /**
     * Get information about a Google Cloud Run Service. For more information see
     * the [official documentation](https://cloud.google.com/run/docs/)
     * and [API](https://cloud.google.com/run/docs/apis).
     * ## Example Usage
     * 
     * ```typescript
     * import * as pulumi from "@pulumi/pulumi";
     * import * as gcp from "@pulumi/gcp";
     * const run-service = gcp.cloudrun.getService({
     *     name: "my-service",
     *     location: "us-central1",
     * });
     * ```
     * ```python
     * import pulumi
     * import pulumi_gcp as gcp
     * run_service = gcp.cloudrun.get_service(name="my-service",
     *     location="us-central1")
     * ```
     * ```csharp
     * using System.Collections.Generic;
     * using System.Linq;
     * using Pulumi;
     * using Gcp = Pulumi.Gcp;
     * return await Deployment.RunAsync(() =>
     * {
     *     var run_service = Gcp.CloudRun.GetService.Invoke(new()
     *     {
     *         Name = "my-service",
     *         Location = "us-central1",
     *     });
     * });
     * ```
     * ```go
     * package main
     * import (
     * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/cloudrun"
     * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
     * )
     * func main() {
     * 	pulumi.Run(func(ctx *pulumi.Context) error {
     * 		_, err := cloudrun.LookupService(ctx, &cloudrun.LookupServiceArgs{
     * 			Name:     "my-service",
     * 			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.cloudrun.CloudrunFunctions;
     * import com.pulumi.gcp.cloudrun.inputs.GetServiceArgs;
     * 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 run-service = CloudrunFunctions.getService(GetServiceArgs.builder()
     *             .name("my-service")
     *             .location("us-central1")
     *             .build());
     *     }
     * }
     * ```
     * ```yaml
     * variables:
     *   run-service:
     *     fn::invoke:
     *       Function: gcp:cloudrun:getService
     *       Arguments:
     *         name: my-service
     *         location: us-central1
     * ```
     * 
     * @param argument A collection of arguments for invoking getService.
     * @return A collection of values returned by getService.
     */
    public suspend fun getService(argument: GetServicePlainArgs): GetServiceResult =
        getServiceResultToKotlin(getServicePlain(argument.toJava()).await())

    /**
     * @see [getService].
     * @param location The location of the cloud run instance. eg us-central1
     * - - -
     * @param name The name of the Cloud Run Service.
     * @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 getService.
     */
    public suspend fun getService(
        location: String,
        name: String,
        project: String? = null,
    ): GetServiceResult {
        val argument = GetServicePlainArgs(
            location = location,
            name = name,
            project = project,
        )
        return getServiceResultToKotlin(getServicePlain(argument.toJava()).await())
    }

    /**
     * @see [getService].
     * @param argument Builder for [com.pulumi.gcp.cloudrun.kotlin.inputs.GetServicePlainArgs].
     * @return A collection of values returned by getService.
     */
    public suspend fun getService(argument: suspend GetServicePlainArgsBuilder.() -> Unit): GetServiceResult {
        val builder = GetServicePlainArgsBuilder()
        builder.argument()
        val builtArgument = builder.build()
        return getServiceResultToKotlin(getServicePlain(builtArgument.toJava()).await())
    }

    /**
     * Retrieves the current IAM policy data for service
     * ## example
     * 
     * ```typescript
     * import * as pulumi from "@pulumi/pulumi";
     * import * as gcp from "@pulumi/gcp";
     * const policy = gcp.cloudrun.getServiceIamPolicy({
     *     location: _default.location,
     *     project: _default.project,
     *     service: _default.name,
     * });
     * ```
     * ```python
     * import pulumi
     * import pulumi_gcp as gcp
     * policy = gcp.cloudrun.get_service_iam_policy(location=default["location"],
     *     project=default["project"],
     *     service=default["name"])
     * ```
     * ```csharp
     * using System.Collections.Generic;
     * using System.Linq;
     * using Pulumi;
     * using Gcp = Pulumi.Gcp;
     * return await Deployment.RunAsync(() =>
     * {
     *     var policy = Gcp.CloudRun.GetServiceIamPolicy.Invoke(new()
     *     {
     *         Location = @default.Location,
     *         Project = @default.Project,
     *         Service = @default.Name,
     *     });
     * });
     * ```
     * ```go
     * package main
     * import (
     * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/cloudrun"
     * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
     * )
     * func main() {
     * 	pulumi.Run(func(ctx *pulumi.Context) error {
     * 		_, err := cloudrun.GetServiceIamPolicy(ctx, &cloudrun.GetServiceIamPolicyArgs{
     * 			Location: pulumi.StringRef(_default.Location),
     * 			Project:  pulumi.StringRef(_default.Project),
     * 			Service:  _default.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.cloudrun.CloudrunFunctions;
     * import com.pulumi.gcp.cloudrun.inputs.GetServiceIamPolicyArgs;
     * 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 = CloudrunFunctions.getServiceIamPolicy(GetServiceIamPolicyArgs.builder()
     *             .location(default_.location())
     *             .project(default_.project())
     *             .service(default_.name())
     *             .build());
     *     }
     * }
     * ```
     * ```yaml
     * variables:
     *   policy:
     *     fn::invoke:
     *       Function: gcp:cloudrun:getServiceIamPolicy
     *       Arguments:
     *         location: ${default.location}
     *         project: ${default.project}
     *         service: ${default.name}
     * ```
     * 
     * @param argument A collection of arguments for invoking getServiceIamPolicy.
     * @return A collection of values returned by getServiceIamPolicy.
     */
    public suspend fun getServiceIamPolicy(argument: GetServiceIamPolicyPlainArgs): GetServiceIamPolicyResult =
        getServiceIamPolicyResultToKotlin(getServiceIamPolicyPlain(argument.toJava()).await())

    /**
     * @see [getServiceIamPolicy].
     * @param location The location of the cloud run instance. eg us-central1 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 service Used to find the parent resource to bind the IAM policy to
     * @return A collection of values returned by getServiceIamPolicy.
     */
    public suspend fun getServiceIamPolicy(
        location: String? = null,
        project: String? = null,
        service: String,
    ): GetServiceIamPolicyResult {
        val argument = GetServiceIamPolicyPlainArgs(
            location = location,
            project = project,
            service = service,
        )
        return getServiceIamPolicyResultToKotlin(getServiceIamPolicyPlain(argument.toJava()).await())
    }

    /**
     * @see [getServiceIamPolicy].
     * @param argument Builder for [com.pulumi.gcp.cloudrun.kotlin.inputs.GetServiceIamPolicyPlainArgs].
     * @return A collection of values returned by getServiceIamPolicy.
     */
    public suspend fun getServiceIamPolicy(argument: suspend GetServiceIamPolicyPlainArgsBuilder.() -> Unit): GetServiceIamPolicyResult {
        val builder = GetServiceIamPolicyPlainArgsBuilder()
        builder.argument()
        val builtArgument = builder.build()
        return getServiceIamPolicyResultToKotlin(getServiceIamPolicyPlain(builtArgument.toJava()).await())
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy