UNPKG

@huaweicloudos/pulumi

Version:

A Pulumi package for creating and managing Huaweicloud cloud resources.

158 lines 7.37 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.Notebook = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Manages ModelArts notebook resource within HuaweiCloud. * * ## Example Usage * ### Create a notebook with the EVS storage type * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const notebookName = config.requireObject("notebookName"); * const keyPairName = config.requireObject("keyPairName"); * const imageId = config.requireObject("imageId"); * const allowedIpAddresses = config.requireObject("allowedIpAddresses"); * const keyPairNameInput = config.requireObject("keyPairNameInput"); * const test = new huaweicloud.modelarts.Notebook("test", { * flavorId: "modelarts.vm.cpu.2u", * imageId: imageId, * allowedAccessIps: allowedIpAddresses, * keyPair: keyPairName, * volume: { * type: "EVS", * size: 5, * }, * }); * ``` * ### Create a notebook with the EFS storage type * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const notebookName = config.requireObject("notebookName"); * const imageId = config.requireObject("imageId"); * const resourcePoolId = config.requireObject("resourcePoolId"); * const sfsExportLocation = config.requireObject("sfsExportLocation"); * const sfsTurboId = config.requireObject("sfsTurboId"); * const test = new huaweicloud.modelarts.Notebook("test", { * flavorId: "modelarts.vm.cpu.2u", * imageId: imageId, * poolId: resourcePoolId, * volume: { * type: "EFS", * ownership: "DEDICATED", * uri: sfsExportLocation, * id: sfsTurboId, * }, * }); * ``` * * ## Import * * The notebook can be imported by `id`. bash * * ```sh * $ pulumi import huaweicloud:ModelArts/notebook:Notebook test b11b407c-e604-4e8d-8bc4-92398320b847 * ``` */ class Notebook extends pulumi.CustomResource { /** * Get an existing Notebook 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 Notebook(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of Notebook. 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'] === Notebook.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["allowedAccessIps"] = state ? state.allowedAccessIps : undefined; resourceInputs["autoStopEnabled"] = state ? state.autoStopEnabled : undefined; resourceInputs["createdAt"] = state ? state.createdAt : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["flavorId"] = state ? state.flavorId : undefined; resourceInputs["imageId"] = state ? state.imageId : undefined; resourceInputs["imageName"] = state ? state.imageName : undefined; resourceInputs["imageSwrPath"] = state ? state.imageSwrPath : undefined; resourceInputs["imageType"] = state ? state.imageType : undefined; resourceInputs["keyPair"] = state ? state.keyPair : undefined; resourceInputs["mountStorages"] = state ? state.mountStorages : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["poolId"] = state ? state.poolId : undefined; resourceInputs["poolName"] = state ? state.poolName : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["sshUri"] = state ? state.sshUri : undefined; resourceInputs["status"] = state ? state.status : undefined; resourceInputs["updatedAt"] = state ? state.updatedAt : undefined; resourceInputs["url"] = state ? state.url : undefined; resourceInputs["volume"] = state ? state.volume : undefined; resourceInputs["workspaceId"] = state ? state.workspaceId : undefined; } else { const args = argsOrState; if ((!args || args.flavorId === undefined) && !opts.urn) { throw new Error("Missing required property 'flavorId'"); } if ((!args || args.imageId === undefined) && !opts.urn) { throw new Error("Missing required property 'imageId'"); } if ((!args || args.volume === undefined) && !opts.urn) { throw new Error("Missing required property 'volume'"); } resourceInputs["allowedAccessIps"] = args ? args.allowedAccessIps : undefined; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["flavorId"] = args ? args.flavorId : undefined; resourceInputs["imageId"] = args ? args.imageId : undefined; resourceInputs["keyPair"] = args ? args.keyPair : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["poolId"] = args ? args.poolId : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["volume"] = args ? args.volume : undefined; resourceInputs["workspaceId"] = args ? args.workspaceId : undefined; resourceInputs["autoStopEnabled"] = undefined /*out*/; resourceInputs["createdAt"] = undefined /*out*/; resourceInputs["imageName"] = undefined /*out*/; resourceInputs["imageSwrPath"] = undefined /*out*/; resourceInputs["imageType"] = undefined /*out*/; resourceInputs["mountStorages"] = undefined /*out*/; resourceInputs["poolName"] = undefined /*out*/; resourceInputs["sshUri"] = undefined /*out*/; resourceInputs["status"] = undefined /*out*/; resourceInputs["updatedAt"] = undefined /*out*/; resourceInputs["url"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Notebook.__pulumiType, name, resourceInputs, opts); } } exports.Notebook = Notebook; /** @internal */ Notebook.__pulumiType = 'huaweicloud:ModelArts/notebook:Notebook'; //# sourceMappingURL=notebook.js.map