@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
235 lines • 8.78 kB
JavaScript
;
// *** 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 runtime is a Google-provisioned virtual machine (VM) that can run the code in your notebook (IPYNB file).'
*
* To get more information about Runtime, see:
*
* * [API documentation](https://cloud.google.com/vertex-ai/docs/reference/rest/v1/projects.locations.notebookRuntimes)
* * How-to Guides
* * [Create a runtime](https://cloud.google.com/colab/docs/create-runtime)
*
* ## Example Usage
*
* ### Colab Runtime Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const myTemplate = new gcp.colab.RuntimeTemplate("my_template", {
* name: "colab-runtime",
* displayName: "Runtime template basic",
* location: "us-central1",
* machineSpec: {
* machineType: "e2-standard-4",
* },
* networkSpec: {
* enableInternetAccess: true,
* },
* });
* const runtime = new gcp.colab.Runtime("runtime", {
* name: "colab-runtime",
* location: "us-central1",
* notebookRuntimeTemplateRef: {
* notebookRuntimeTemplate: myTemplate.id,
* },
* displayName: "Runtime basic",
* runtimeUser: "gterraformtestuser@gmail.com",
* }, {
* dependsOn: [myTemplate],
* });
* ```
* ### Colab Runtime Stopped
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const myTemplate = new gcp.colab.RuntimeTemplate("my_template", {
* name: "colab-runtime",
* displayName: "Runtime template basic",
* location: "us-central1",
* machineSpec: {
* machineType: "e2-standard-4",
* },
* networkSpec: {
* enableInternetAccess: true,
* },
* });
* const runtime = new gcp.colab.Runtime("runtime", {
* name: "colab-runtime",
* location: "us-central1",
* notebookRuntimeTemplateRef: {
* notebookRuntimeTemplate: myTemplate.id,
* },
* desiredState: "STOPPED",
* displayName: "Runtime stopped",
* runtimeUser: "gterraformtestuser@gmail.com",
* }, {
* dependsOn: [myTemplate],
* });
* ```
* ### Colab Runtime Full
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const myTemplate = new gcp.colab.RuntimeTemplate("my_template", {
* name: "colab-runtime",
* displayName: "Runtime template full",
* location: "us-central1",
* description: "Full runtime template",
* machineSpec: {
* machineType: "n1-standard-2",
* acceleratorType: "NVIDIA_TESLA_T4",
* acceleratorCount: 1,
* },
* dataPersistentDiskSpec: {
* diskType: "pd-standard",
* diskSizeGb: "200",
* },
* networkSpec: {
* enableInternetAccess: true,
* },
* labels: {
* k: "val",
* },
* idleShutdownConfig: {
* idleTimeout: "3600s",
* },
* eucConfig: {
* eucDisabled: true,
* },
* shieldedVmConfig: {
* enableSecureBoot: true,
* },
* networkTags: [
* "abc",
* "def",
* ],
* encryptionSpec: {
* kmsKeyName: "my-crypto-key",
* },
* });
* const runtime = new gcp.colab.Runtime("runtime", {
* name: "colab-runtime",
* location: "us-central1",
* notebookRuntimeTemplateRef: {
* notebookRuntimeTemplate: myTemplate.id,
* },
* displayName: "Runtime full",
* runtimeUser: "gterraformtestuser@gmail.com",
* description: "Full runtime",
* desiredState: "ACTIVE",
* autoUpgrade: true,
* }, {
* dependsOn: [myTemplate],
* });
* ```
*
* ## Import
*
* Runtime can be imported using any of these accepted formats:
*
* * `projects/{{project}}/locations/{{location}}/notebookRuntimes/{{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:colab/runtime:Runtime default projects/{{project}}/locations/{{location}}/notebookRuntimes/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:colab/runtime:Runtime default {{project}}/{{location}}/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:colab/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["autoUpgrade"] = state ? state.autoUpgrade : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["desiredState"] = state ? state.desiredState : undefined;
resourceInputs["displayName"] = state ? state.displayName : undefined;
resourceInputs["expirationTime"] = state ? state.expirationTime : undefined;
resourceInputs["isUpgradable"] = state ? state.isUpgradable : undefined;
resourceInputs["location"] = state ? state.location : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["notebookRuntimeTemplateRef"] = state ? state.notebookRuntimeTemplateRef : undefined;
resourceInputs["notebookRuntimeType"] = state ? state.notebookRuntimeType : undefined;
resourceInputs["project"] = state ? state.project : undefined;
resourceInputs["runtimeUser"] = state ? state.runtimeUser : undefined;
resourceInputs["state"] = state ? state.state : undefined;
}
else {
const args = argsOrState;
if ((!args || args.displayName === undefined) && !opts.urn) {
throw new Error("Missing required property 'displayName'");
}
if ((!args || args.location === undefined) && !opts.urn) {
throw new Error("Missing required property 'location'");
}
if ((!args || args.runtimeUser === undefined) && !opts.urn) {
throw new Error("Missing required property 'runtimeUser'");
}
resourceInputs["autoUpgrade"] = args ? args.autoUpgrade : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["desiredState"] = args ? args.desiredState : undefined;
resourceInputs["displayName"] = args ? args.displayName : undefined;
resourceInputs["location"] = args ? args.location : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["notebookRuntimeTemplateRef"] = args ? args.notebookRuntimeTemplateRef : undefined;
resourceInputs["project"] = args ? args.project : undefined;
resourceInputs["runtimeUser"] = args ? args.runtimeUser : undefined;
resourceInputs["expirationTime"] = undefined /*out*/;
resourceInputs["isUpgradable"] = undefined /*out*/;
resourceInputs["notebookRuntimeType"] = undefined /*out*/;
resourceInputs["state"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Runtime.__pulumiType, name, resourceInputs, opts);
}
}
exports.Runtime = Runtime;
/** @internal */
Runtime.__pulumiType = 'gcp:colab/runtime:Runtime';
//# sourceMappingURL=runtime.js.map