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

com.pulumi.gcp.notebooks.kotlin.Environment.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.notebooks.kotlin

import com.pulumi.core.Output
import com.pulumi.gcp.notebooks.kotlin.outputs.EnvironmentContainerImage
import com.pulumi.gcp.notebooks.kotlin.outputs.EnvironmentVmImage
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import com.pulumi.gcp.notebooks.kotlin.outputs.EnvironmentContainerImage.Companion.toKotlin as environmentContainerImageToKotlin
import com.pulumi.gcp.notebooks.kotlin.outputs.EnvironmentVmImage.Companion.toKotlin as environmentVmImageToKotlin

/**
 * Builder for [Environment].
 */
@PulumiTagMarker
public class EnvironmentResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: EnvironmentArgs = EnvironmentArgs()

    public var opts: CustomResourceOptions = CustomResourceOptions()

    /**
     * @param name The _unique_ name of the resulting resource.
     */
    public fun name(`value`: String) {
        this.name = value
    }

    /**
     * @param block The arguments to use to populate this resource's properties.
     */
    public suspend fun args(block: suspend EnvironmentArgsBuilder.() -> Unit) {
        val builder = EnvironmentArgsBuilder()
        block(builder)
        this.args = builder.build()
    }

    /**
     * @param block A bag of options that control this resource's behavior.
     */
    public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
        this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
    }

    internal fun build(): Environment {
        val builtJavaResource = com.pulumi.gcp.notebooks.Environment(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return Environment(builtJavaResource)
    }
}

/**
 * A Cloud AI Platform Notebook environment.
 * To get more information about Environment, see:
 * * [API documentation](https://cloud.google.com/ai-platform/notebooks/docs/reference/rest)
 * * How-to Guides
 *     * [Official Documentation](https://cloud.google.com/ai-platform-notebooks)
 * ## Example Usage
 * ### Notebook Environment Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const environment = new gcp.notebooks.Environment("environment", {
 *     name: "notebooks-environment",
 *     location: "us-west1-a",
 *     containerImage: {
 *         repository: "gcr.io/deeplearning-platform-release/base-cpu",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * environment = gcp.notebooks.Environment("environment",
 *     name="notebooks-environment",
 *     location="us-west1-a",
 *     container_image=gcp.notebooks.EnvironmentContainerImageArgs(
 *         repository="gcr.io/deeplearning-platform-release/base-cpu",
 *     ))
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var environment = new Gcp.Notebooks.Environment("environment", new()
 *     {
 *         Name = "notebooks-environment",
 *         Location = "us-west1-a",
 *         ContainerImage = new Gcp.Notebooks.Inputs.EnvironmentContainerImageArgs
 *         {
 *             Repository = "gcr.io/deeplearning-platform-release/base-cpu",
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/notebooks"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := notebooks.NewEnvironment(ctx, "environment", ¬ebooks.EnvironmentArgs{
 * 			Name:     pulumi.String("notebooks-environment"),
 * 			Location: pulumi.String("us-west1-a"),
 * 			ContainerImage: ¬ebooks.EnvironmentContainerImageArgs{
 * 				Repository: pulumi.String("gcr.io/deeplearning-platform-release/base-cpu"),
 * 			},
 * 		})
 * 		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.notebooks.Environment;
 * import com.pulumi.gcp.notebooks.EnvironmentArgs;
 * import com.pulumi.gcp.notebooks.inputs.EnvironmentContainerImageArgs;
 * 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 environment = new Environment("environment", EnvironmentArgs.builder()
 *             .name("notebooks-environment")
 *             .location("us-west1-a")
 *             .containerImage(EnvironmentContainerImageArgs.builder()
 *                 .repository("gcr.io/deeplearning-platform-release/base-cpu")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   environment:
 *     type: gcp:notebooks:Environment
 *     properties:
 *       name: notebooks-environment
 *       location: us-west1-a
 *       containerImage:
 *         repository: gcr.io/deeplearning-platform-release/base-cpu
 * ```
 * 
 * ## Import
 * Environment can be imported using any of these accepted formats:
 * * `projects/{{project}}/locations/{{location}}/environments/{{name}}`
 * * `{{project}}/{{location}}/{{name}}`
 * * `{{location}}/{{name}}`
 * When using the `pulumi import` command, Environment can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:notebooks/environment:Environment default projects/{{project}}/locations/{{location}}/environments/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:notebooks/environment:Environment default {{project}}/{{location}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:notebooks/environment:Environment default {{location}}/{{name}}
 * ```
 */
public class Environment internal constructor(
    override val javaResource: com.pulumi.gcp.notebooks.Environment,
) : KotlinCustomResource(javaResource, EnvironmentMapper) {
    /**
     * Use a container image to start the notebook instance.
     * Structure is documented below.
     */
    public val containerImage: Output?
        get() = javaResource.containerImage().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> environmentContainerImageToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * Instance creation time
     */
    public val createTime: Output
        get() = javaResource.createTime().applyValue({ args0 -> args0 })

    /**
     * A brief description of this environment.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Display name of this environment for the UI.
     */
    public val displayName: Output?
        get() = javaResource.displayName().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A reference to the zone where the machine resides.
     * - - -
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * The name specified for the Environment instance.
     * Format: projects/{project_id}/locations/{location}/environments/{environmentId}
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * Path to a Bash script that automatically runs after a notebook instance fully boots up.
     * The path must be a URL or Cloud Storage path. Example: "gs://path-to-file/file-name"
     */
    public val postStartupScript: Output?
        get() = javaResource.postStartupScript().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The ID of the project in which the resource belongs.
     * If it is not provided, the provider project is used.
     */
    public val project: Output
        get() = javaResource.project().applyValue({ args0 -> args0 })

    /**
     * Use a Compute Engine VM image to start the notebook instance.
     * Structure is documented below.
     */
    public val vmImage: Output?
        get() = javaResource.vmImage().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    environmentVmImageToKotlin(args0)
                })
            }).orElse(null)
        })
}

public object EnvironmentMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.notebooks.Environment::class == javaResource::class

    override fun map(javaResource: Resource): Environment = Environment(
        javaResource as
            com.pulumi.gcp.notebooks.Environment,
    )
}

/**
 * @see [Environment].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [Environment].
 */
public suspend fun environment(name: String, block: suspend EnvironmentResourceBuilder.() -> Unit): Environment {
    val builder = EnvironmentResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [Environment].
 * @param name The _unique_ name of the resulting resource.
 */
public fun environment(name: String): Environment {
    val builder = EnvironmentResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy