@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
252 lines • 9.45 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Runtime = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(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}}
* $ pulumi import gcp:colab/runtime:Runtime default {{project}}/{{location}}/{{name}}
* $ 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, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'gcp:colab/runtime:Runtime';
/**
* 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?.autoUpgrade;
resourceInputs["deletionPolicy"] = state?.deletionPolicy;
resourceInputs["description"] = state?.description;
resourceInputs["desiredState"] = state?.desiredState;
resourceInputs["displayName"] = state?.displayName;
resourceInputs["expirationTime"] = state?.expirationTime;
resourceInputs["isUpgradable"] = state?.isUpgradable;
resourceInputs["location"] = state?.location;
resourceInputs["name"] = state?.name;
resourceInputs["notebookRuntimeTemplateRef"] = state?.notebookRuntimeTemplateRef;
resourceInputs["notebookRuntimeType"] = state?.notebookRuntimeType;
resourceInputs["project"] = state?.project;
resourceInputs["runtimeUser"] = state?.runtimeUser;
resourceInputs["state"] = state?.state;
}
else {
const args = argsOrState;
if (args?.displayName === undefined && !opts.urn) {
throw new Error("Missing required property 'displayName'");
}
if (args?.location === undefined && !opts.urn) {
throw new Error("Missing required property 'location'");
}
if (args?.runtimeUser === undefined && !opts.urn) {
throw new Error("Missing required property 'runtimeUser'");
}
resourceInputs["autoUpgrade"] = args?.autoUpgrade;
resourceInputs["deletionPolicy"] = args?.deletionPolicy;
resourceInputs["description"] = args?.description;
resourceInputs["desiredState"] = args?.desiredState;
resourceInputs["displayName"] = args?.displayName;
resourceInputs["location"] = args?.location;
resourceInputs["name"] = args?.name;
resourceInputs["notebookRuntimeTemplateRef"] = args?.notebookRuntimeTemplateRef;
resourceInputs["project"] = args?.project;
resourceInputs["runtimeUser"] = args?.runtimeUser;
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;
//# sourceMappingURL=runtime.js.map