UNPKG

@pulumi/gcp

Version:

A Pulumi package for creating and managing Google Cloud Platform resources.

278 lines • 9.88 kB
"use strict"; // *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.Runtime = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * A Cloud AI Platform Notebook runtime. * * > **Note:** Due to limitations of the Notebooks Runtime API, many fields * in this resource do not properly detect drift. These fields will also not * appear in state once imported. * * To get more information about Runtime, 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 Runtime Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const runtime = new gcp.notebooks.Runtime("runtime", { * name: "notebooks-runtime", * location: "us-central1", * accessConfig: { * accessType: "SINGLE_USER", * runtimeOwner: "admin@hashicorptest.com", * }, * virtualMachine: { * virtualMachineConfig: { * machineType: "n1-standard-4", * dataDisk: { * initializeParams: { * diskSizeGb: 100, * diskType: "PD_STANDARD", * }, * }, * }, * }, * }); * ``` * ### Notebook Runtime Basic Gpu * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const runtimeGpu = new gcp.notebooks.Runtime("runtime_gpu", { * name: "notebooks-runtime-gpu", * location: "us-central1", * accessConfig: { * accessType: "SINGLE_USER", * runtimeOwner: "admin@hashicorptest.com", * }, * softwareConfig: { * installGpuDriver: true, * }, * virtualMachine: { * virtualMachineConfig: { * machineType: "n1-standard-4", * dataDisk: { * initializeParams: { * diskSizeGb: 100, * diskType: "PD_STANDARD", * }, * }, * acceleratorConfig: { * coreCount: 1, * type: "NVIDIA_TESLA_V100", * }, * }, * }, * }); * ``` * ### Notebook Runtime Basic Container * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const runtimeContainer = new gcp.notebooks.Runtime("runtime_container", { * name: "notebooks-runtime-container", * location: "us-central1", * accessConfig: { * accessType: "SINGLE_USER", * runtimeOwner: "admin@hashicorptest.com", * }, * virtualMachine: { * virtualMachineConfig: { * machineType: "n1-standard-4", * dataDisk: { * initializeParams: { * diskSizeGb: 100, * diskType: "PD_STANDARD", * }, * }, * containerImages: [ * { * repository: "gcr.io/deeplearning-platform-release/base-cpu", * tag: "latest", * }, * { * repository: "gcr.io/deeplearning-platform-release/beam-notebooks", * tag: "latest", * }, * ], * }, * }, * }); * ``` * ### Notebook Runtime Kernels * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const runtimeContainer = new gcp.notebooks.Runtime("runtime_container", { * name: "notebooks-runtime-kernel", * location: "us-central1", * accessConfig: { * accessType: "SINGLE_USER", * runtimeOwner: "admin@hashicorptest.com", * }, * softwareConfig: { * kernels: [{ * repository: "gcr.io/deeplearning-platform-release/base-cpu", * tag: "latest", * }], * }, * virtualMachine: { * virtualMachineConfig: { * machineType: "n1-standard-4", * dataDisk: { * initializeParams: { * diskSizeGb: 100, * diskType: "PD_STANDARD", * }, * }, * }, * }, * labels: { * k: "val", * }, * }); * ``` * ### Notebook Runtime Script * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const runtimeContainer = new gcp.notebooks.Runtime("runtime_container", { * name: "notebooks-runtime-script", * location: "us-central1", * accessConfig: { * accessType: "SINGLE_USER", * runtimeOwner: "admin@hashicorptest.com", * }, * softwareConfig: { * postStartupScriptBehavior: "RUN_EVERY_START", * }, * virtualMachine: { * virtualMachineConfig: { * machineType: "n1-standard-4", * dataDisk: { * initializeParams: { * diskSizeGb: 100, * diskType: "PD_STANDARD", * }, * }, * }, * }, * labels: { * k: "val", * }, * }); * ``` * * ## Import * * Runtime can be imported using any of these accepted formats: * * * `projects/{{project}}/locations/{{location}}/runtimes/{{name}}` * * * `{{project}}/{{location}}/{{name}}` * * * `{{location}}/{{name}}` * * When using the `pulumi import` command, Runtime can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:notebooks/runtime:Runtime default projects/{{project}}/locations/{{location}}/runtimes/{{name}} * ``` * * ```sh * $ pulumi import gcp:notebooks/runtime:Runtime default {{project}}/{{location}}/{{name}} * ``` * * ```sh * $ pulumi import gcp:notebooks/runtime:Runtime default {{location}}/{{name}} * ``` */ class Runtime extends pulumi.CustomResource { /** * Get an existing Runtime resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name, id, state, opts) { return new Runtime(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of Runtime. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === Runtime.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["accessConfig"] = state ? state.accessConfig : undefined; resourceInputs["effectiveLabels"] = state ? state.effectiveLabels : undefined; resourceInputs["healthState"] = state ? state.healthState : undefined; resourceInputs["labels"] = state ? state.labels : undefined; resourceInputs["location"] = state ? state.location : undefined; resourceInputs["metrics"] = state ? state.metrics : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["project"] = state ? state.project : undefined; resourceInputs["pulumiLabels"] = state ? state.pulumiLabels : undefined; resourceInputs["softwareConfig"] = state ? state.softwareConfig : undefined; resourceInputs["state"] = state ? state.state : undefined; resourceInputs["virtualMachine"] = state ? state.virtualMachine : undefined; } else { const args = argsOrState; if ((!args || args.location === undefined) && !opts.urn) { throw new Error("Missing required property 'location'"); } resourceInputs["accessConfig"] = args ? args.accessConfig : undefined; resourceInputs["labels"] = args ? args.labels : undefined; resourceInputs["location"] = args ? args.location : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["project"] = args ? args.project : undefined; resourceInputs["softwareConfig"] = args ? args.softwareConfig : undefined; resourceInputs["virtualMachine"] = args ? args.virtualMachine : undefined; resourceInputs["effectiveLabels"] = undefined /*out*/; resourceInputs["healthState"] = undefined /*out*/; resourceInputs["metrics"] = undefined /*out*/; resourceInputs["pulumiLabels"] = undefined /*out*/; resourceInputs["state"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(Runtime.__pulumiType, name, resourceInputs, opts); } } exports.Runtime = Runtime; /** @internal */ Runtime.__pulumiType = 'gcp:notebooks/runtime:Runtime'; //# sourceMappingURL=runtime.js.map