com.pulumi.gcp.composer.kotlin.ComposerFunctions.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.composer.kotlin
import com.pulumi.gcp.composer.ComposerFunctions.getEnvironmentPlain
import com.pulumi.gcp.composer.ComposerFunctions.getImageVersionsPlain
import com.pulumi.gcp.composer.kotlin.inputs.GetEnvironmentPlainArgs
import com.pulumi.gcp.composer.kotlin.inputs.GetEnvironmentPlainArgsBuilder
import com.pulumi.gcp.composer.kotlin.inputs.GetImageVersionsPlainArgs
import com.pulumi.gcp.composer.kotlin.inputs.GetImageVersionsPlainArgsBuilder
import com.pulumi.gcp.composer.kotlin.outputs.GetEnvironmentResult
import com.pulumi.gcp.composer.kotlin.outputs.GetImageVersionsResult
import kotlinx.coroutines.future.await
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import com.pulumi.gcp.composer.kotlin.outputs.GetEnvironmentResult.Companion.toKotlin as getEnvironmentResultToKotlin
import com.pulumi.gcp.composer.kotlin.outputs.GetImageVersionsResult.Companion.toKotlin as getImageVersionsResultToKotlin
public object ComposerFunctions {
/**
* Provides access to Cloud Composer environment configuration in a region for a given project.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const composerEnvEnvironment = new gcp.composer.Environment("composer_env", {name: "composer-environment"});
* const composerEnv = gcp.composer.getEnvironment({
* name: test.name,
* });
* export const debug = composerEnv.then(composerEnv => composerEnv.configs);
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* composer_env_environment = gcp.composer.Environment("composer_env", name="composer-environment")
* composer_env = gcp.composer.get_environment(name=test["name"])
* pulumi.export("debug", composer_env.configs)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var composerEnvEnvironment = new Gcp.Composer.Environment("composer_env", new()
* {
* Name = "composer-environment",
* });
* var composerEnv = Gcp.Composer.GetEnvironment.Invoke(new()
* {
* Name = test.Name,
* });
* return new Dictionary
* {
* ["debug"] = composerEnv.Apply(getEnvironmentResult => getEnvironmentResult.Configs),
* };
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/composer"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := composer.NewEnvironment(ctx, "composer_env", &composer.EnvironmentArgs{
* Name: pulumi.String("composer-environment"),
* })
* if err != nil {
* return err
* }
* composerEnv, err := composer.LookupEnvironment(ctx, &composer.LookupEnvironmentArgs{
* Name: test.Name,
* }, nil)
* if err != nil {
* return err
* }
* ctx.Export("debug", composerEnv.Configs)
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.composer.Environment;
* import com.pulumi.gcp.composer.EnvironmentArgs;
* import com.pulumi.gcp.composer.ComposerFunctions;
* import com.pulumi.gcp.composer.inputs.GetEnvironmentArgs;
* 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) {
* var composerEnvEnvironment = new Environment("composerEnvEnvironment", EnvironmentArgs.builder()
* .name("composer-environment")
* .build());
* final var composerEnv = ComposerFunctions.getEnvironment(GetEnvironmentArgs.builder()
* .name(test.name())
* .build());
* ctx.export("debug", composerEnv.applyValue(getEnvironmentResult -> getEnvironmentResult.configs()));
* }
* }
* ```
* ```yaml
* resources:
* composerEnvEnvironment:
* type: gcp:composer:Environment
* name: composer_env
* properties:
* name: composer-environment
* variables:
* composerEnv:
* fn::invoke:
* Function: gcp:composer:getEnvironment
* Arguments:
* name: ${test.name}
* outputs:
* debug: ${composerEnv.configs}
* ```
*
* @param argument A collection of arguments for invoking getEnvironment.
* @return A collection of values returned by getEnvironment.
*/
public suspend fun getEnvironment(argument: GetEnvironmentPlainArgs): GetEnvironmentResult =
getEnvironmentResultToKotlin(getEnvironmentPlain(argument.toJava()).await())
/**
* @see [getEnvironment].
* @param name Name of the environment.
* @param project The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
* @param region The location or Compute Engine region of the environment.
* @return A collection of values returned by getEnvironment.
*/
public suspend fun getEnvironment(
name: String,
project: String? = null,
region: String? = null,
): GetEnvironmentResult {
val argument = GetEnvironmentPlainArgs(
name = name,
project = project,
region = region,
)
return getEnvironmentResultToKotlin(getEnvironmentPlain(argument.toJava()).await())
}
/**
* @see [getEnvironment].
* @param argument Builder for [com.pulumi.gcp.composer.kotlin.inputs.GetEnvironmentPlainArgs].
* @return A collection of values returned by getEnvironment.
*/
public suspend fun getEnvironment(argument: suspend GetEnvironmentPlainArgsBuilder.() -> Unit): GetEnvironmentResult {
val builder = GetEnvironmentPlainArgsBuilder()
builder.argument()
val builtArgument = builder.build()
return getEnvironmentResultToKotlin(getEnvironmentPlain(builtArgument.toJava()).await())
}
/**
* Provides access to available Cloud Composer versions in a region for a given project.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const all = gcp.composer.getImageVersions({});
* const test = new gcp.composer.Environment("test", {
* name: "test-env",
* region: "us-central1",
* config: {
* softwareConfig: {
* imageVersion: all.then(all => all.imageVersions?.[0]?.imageVersionId),
* },
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* all = gcp.composer.get_image_versions()
* test = gcp.composer.Environment("test",
* name="test-env",
* region="us-central1",
* config=gcp.composer.EnvironmentConfigArgs(
* software_config=gcp.composer.EnvironmentConfigSoftwareConfigArgs(
* image_version=all.image_versions[0].image_version_id,
* ),
* ))
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var all = Gcp.Composer.GetImageVersions.Invoke();
* var test = new Gcp.Composer.Environment("test", new()
* {
* Name = "test-env",
* Region = "us-central1",
* Config = new Gcp.Composer.Inputs.EnvironmentConfigArgs
* {
* SoftwareConfig = new Gcp.Composer.Inputs.EnvironmentConfigSoftwareConfigArgs
* {
* ImageVersion = all.Apply(getImageVersionsResult => getImageVersionsResult.ImageVersions[0]?.ImageVersionId),
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/composer"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* all, err := composer.GetImageVersions(ctx, nil, nil)
* if err != nil {
* return err
* }
* _, err = composer.NewEnvironment(ctx, "test", &composer.EnvironmentArgs{
* Name: pulumi.String("test-env"),
* Region: pulumi.String("us-central1"),
* Config: &composer.EnvironmentConfigArgs{
* SoftwareConfig: &composer.EnvironmentConfigSoftwareConfigArgs{
* ImageVersion: pulumi.String(all.ImageVersions[0].ImageVersionId),
* },
* },
* })
* 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.composer.ComposerFunctions;
* import com.pulumi.gcp.composer.inputs.GetImageVersionsArgs;
* import com.pulumi.gcp.composer.Environment;
* import com.pulumi.gcp.composer.EnvironmentArgs;
* import com.pulumi.gcp.composer.inputs.EnvironmentConfigArgs;
* import com.pulumi.gcp.composer.inputs.EnvironmentConfigSoftwareConfigArgs;
* 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 all = ComposerFunctions.getImageVersions();
* var test = new Environment("test", EnvironmentArgs.builder()
* .name("test-env")
* .region("us-central1")
* .config(EnvironmentConfigArgs.builder()
* .softwareConfig(EnvironmentConfigSoftwareConfigArgs.builder()
* .imageVersion(all.applyValue(getImageVersionsResult -> getImageVersionsResult.imageVersions()[0].imageVersionId()))
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* test:
* type: gcp:composer:Environment
* properties:
* name: test-env
* region: us-central1
* config:
* softwareConfig:
* imageVersion: ${all.imageVersions[0].imageVersionId}
* variables:
* all:
* fn::invoke:
* Function: gcp:composer:getImageVersions
* Arguments: {}
* ```
*
* @param argument A collection of arguments for invoking getImageVersions.
* @return A collection of values returned by getImageVersions.
*/
public suspend fun getImageVersions(argument: GetImageVersionsPlainArgs): GetImageVersionsResult =
getImageVersionsResultToKotlin(getImageVersionsPlain(argument.toJava()).await())
/**
* @see [getImageVersions].
* @param project The ID of the project to list versions in.
* If it is not provided, the provider project is used.
* @param region The location to list versions in.
* If it is not provider, the provider region is used.
* @return A collection of values returned by getImageVersions.
*/
public suspend fun getImageVersions(project: String? = null, region: String? = null): GetImageVersionsResult {
val argument = GetImageVersionsPlainArgs(
project = project,
region = region,
)
return getImageVersionsResultToKotlin(getImageVersionsPlain(argument.toJava()).await())
}
/**
* @see [getImageVersions].
* @param argument Builder for [com.pulumi.gcp.composer.kotlin.inputs.GetImageVersionsPlainArgs].
* @return A collection of values returned by getImageVersions.
*/
public suspend fun getImageVersions(argument: suspend GetImageVersionsPlainArgsBuilder.() -> Unit): GetImageVersionsResult {
val builder = GetImageVersionsPlainArgsBuilder()
builder.argument()
val builtArgument = builder.build()
return getImageVersionsResultToKotlin(getImageVersionsPlain(builtArgument.toJava()).await())
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy