@google-cloud/notebooks
Version:
Notebooks client for Node.js
845 lines (779 loc) • 4.12 MB
JavaScript
// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/
(function(global, factory) { /* global define, require, module */
/* AMD */ if (typeof define === 'function' && define.amd)
define(["protobufjs/minimal"], factory);
/* CommonJS */ else if (typeof require === 'function' && typeof module === 'object' && module && module.exports)
module.exports = factory(require("google-gax/build/src/protobuf").protobufMinimal);
})(this, function($protobuf) {
"use strict";
// Common aliases
var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
// Exported root namespace
var $root = $protobuf.roots._google_cloud_notebooks_protos || ($protobuf.roots._google_cloud_notebooks_protos = {});
$root.google = (function() {
/**
* Namespace google.
* @exports google
* @namespace
*/
var google = {};
google.cloud = (function() {
/**
* Namespace cloud.
* @memberof google
* @namespace
*/
var cloud = {};
cloud.notebooks = (function() {
/**
* Namespace notebooks.
* @memberof google.cloud
* @namespace
*/
var notebooks = {};
notebooks.v1 = (function() {
/**
* Namespace v1.
* @memberof google.cloud.notebooks
* @namespace
*/
var v1 = {};
v1.DiagnosticConfig = (function() {
/**
* Properties of a DiagnosticConfig.
* @memberof google.cloud.notebooks.v1
* @interface IDiagnosticConfig
* @property {string|null} [gcsBucket] DiagnosticConfig gcsBucket
* @property {string|null} [relativePath] DiagnosticConfig relativePath
* @property {boolean|null} [repairFlagEnabled] DiagnosticConfig repairFlagEnabled
* @property {boolean|null} [packetCaptureFlagEnabled] DiagnosticConfig packetCaptureFlagEnabled
* @property {boolean|null} [copyHomeFilesFlagEnabled] DiagnosticConfig copyHomeFilesFlagEnabled
*/
/**
* Constructs a new DiagnosticConfig.
* @memberof google.cloud.notebooks.v1
* @classdesc Represents a DiagnosticConfig.
* @implements IDiagnosticConfig
* @constructor
* @param {google.cloud.notebooks.v1.IDiagnosticConfig=} [properties] Properties to set
*/
function DiagnosticConfig(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* DiagnosticConfig gcsBucket.
* @member {string} gcsBucket
* @memberof google.cloud.notebooks.v1.DiagnosticConfig
* @instance
*/
DiagnosticConfig.prototype.gcsBucket = "";
/**
* DiagnosticConfig relativePath.
* @member {string} relativePath
* @memberof google.cloud.notebooks.v1.DiagnosticConfig
* @instance
*/
DiagnosticConfig.prototype.relativePath = "";
/**
* DiagnosticConfig repairFlagEnabled.
* @member {boolean} repairFlagEnabled
* @memberof google.cloud.notebooks.v1.DiagnosticConfig
* @instance
*/
DiagnosticConfig.prototype.repairFlagEnabled = false;
/**
* DiagnosticConfig packetCaptureFlagEnabled.
* @member {boolean} packetCaptureFlagEnabled
* @memberof google.cloud.notebooks.v1.DiagnosticConfig
* @instance
*/
DiagnosticConfig.prototype.packetCaptureFlagEnabled = false;
/**
* DiagnosticConfig copyHomeFilesFlagEnabled.
* @member {boolean} copyHomeFilesFlagEnabled
* @memberof google.cloud.notebooks.v1.DiagnosticConfig
* @instance
*/
DiagnosticConfig.prototype.copyHomeFilesFlagEnabled = false;
/**
* Creates a new DiagnosticConfig instance using the specified properties.
* @function create
* @memberof google.cloud.notebooks.v1.DiagnosticConfig
* @static
* @param {google.cloud.notebooks.v1.IDiagnosticConfig=} [properties] Properties to set
* @returns {google.cloud.notebooks.v1.DiagnosticConfig} DiagnosticConfig instance
*/
DiagnosticConfig.create = function create(properties) {
return new DiagnosticConfig(properties);
};
/**
* Encodes the specified DiagnosticConfig message. Does not implicitly {@link google.cloud.notebooks.v1.DiagnosticConfig.verify|verify} messages.
* @function encode
* @memberof google.cloud.notebooks.v1.DiagnosticConfig
* @static
* @param {google.cloud.notebooks.v1.IDiagnosticConfig} message DiagnosticConfig message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
DiagnosticConfig.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.gcsBucket != null && Object.hasOwnProperty.call(message, "gcsBucket"))
writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsBucket);
if (message.relativePath != null && Object.hasOwnProperty.call(message, "relativePath"))
writer.uint32(/* id 2, wireType 2 =*/18).string(message.relativePath);
if (message.repairFlagEnabled != null && Object.hasOwnProperty.call(message, "repairFlagEnabled"))
writer.uint32(/* id 3, wireType 0 =*/24).bool(message.repairFlagEnabled);
if (message.packetCaptureFlagEnabled != null && Object.hasOwnProperty.call(message, "packetCaptureFlagEnabled"))
writer.uint32(/* id 4, wireType 0 =*/32).bool(message.packetCaptureFlagEnabled);
if (message.copyHomeFilesFlagEnabled != null && Object.hasOwnProperty.call(message, "copyHomeFilesFlagEnabled"))
writer.uint32(/* id 5, wireType 0 =*/40).bool(message.copyHomeFilesFlagEnabled);
return writer;
};
/**
* Encodes the specified DiagnosticConfig message, length delimited. Does not implicitly {@link google.cloud.notebooks.v1.DiagnosticConfig.verify|verify} messages.
* @function encodeDelimited
* @memberof google.cloud.notebooks.v1.DiagnosticConfig
* @static
* @param {google.cloud.notebooks.v1.IDiagnosticConfig} message DiagnosticConfig message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
DiagnosticConfig.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a DiagnosticConfig message from the specified reader or buffer.
* @function decode
* @memberof google.cloud.notebooks.v1.DiagnosticConfig
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {google.cloud.notebooks.v1.DiagnosticConfig} DiagnosticConfig
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
DiagnosticConfig.decode = function decode(reader, length, error) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.notebooks.v1.DiagnosticConfig();
while (reader.pos < end) {
var tag = reader.uint32();
if (tag === error)
break;
switch (tag >>> 3) {
case 1: {
message.gcsBucket = reader.string();
break;
}
case 2: {
message.relativePath = reader.string();
break;
}
case 3: {
message.repairFlagEnabled = reader.bool();
break;
}
case 4: {
message.packetCaptureFlagEnabled = reader.bool();
break;
}
case 5: {
message.copyHomeFilesFlagEnabled = reader.bool();
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a DiagnosticConfig message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof google.cloud.notebooks.v1.DiagnosticConfig
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {google.cloud.notebooks.v1.DiagnosticConfig} DiagnosticConfig
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
DiagnosticConfig.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a DiagnosticConfig message.
* @function verify
* @memberof google.cloud.notebooks.v1.DiagnosticConfig
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
DiagnosticConfig.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.gcsBucket != null && message.hasOwnProperty("gcsBucket"))
if (!$util.isString(message.gcsBucket))
return "gcsBucket: string expected";
if (message.relativePath != null && message.hasOwnProperty("relativePath"))
if (!$util.isString(message.relativePath))
return "relativePath: string expected";
if (message.repairFlagEnabled != null && message.hasOwnProperty("repairFlagEnabled"))
if (typeof message.repairFlagEnabled !== "boolean")
return "repairFlagEnabled: boolean expected";
if (message.packetCaptureFlagEnabled != null && message.hasOwnProperty("packetCaptureFlagEnabled"))
if (typeof message.packetCaptureFlagEnabled !== "boolean")
return "packetCaptureFlagEnabled: boolean expected";
if (message.copyHomeFilesFlagEnabled != null && message.hasOwnProperty("copyHomeFilesFlagEnabled"))
if (typeof message.copyHomeFilesFlagEnabled !== "boolean")
return "copyHomeFilesFlagEnabled: boolean expected";
return null;
};
/**
* Creates a DiagnosticConfig message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof google.cloud.notebooks.v1.DiagnosticConfig
* @static
* @param {Object.<string,*>} object Plain object
* @returns {google.cloud.notebooks.v1.DiagnosticConfig} DiagnosticConfig
*/
DiagnosticConfig.fromObject = function fromObject(object) {
if (object instanceof $root.google.cloud.notebooks.v1.DiagnosticConfig)
return object;
var message = new $root.google.cloud.notebooks.v1.DiagnosticConfig();
if (object.gcsBucket != null)
message.gcsBucket = String(object.gcsBucket);
if (object.relativePath != null)
message.relativePath = String(object.relativePath);
if (object.repairFlagEnabled != null)
message.repairFlagEnabled = Boolean(object.repairFlagEnabled);
if (object.packetCaptureFlagEnabled != null)
message.packetCaptureFlagEnabled = Boolean(object.packetCaptureFlagEnabled);
if (object.copyHomeFilesFlagEnabled != null)
message.copyHomeFilesFlagEnabled = Boolean(object.copyHomeFilesFlagEnabled);
return message;
};
/**
* Creates a plain object from a DiagnosticConfig message. Also converts values to other types if specified.
* @function toObject
* @memberof google.cloud.notebooks.v1.DiagnosticConfig
* @static
* @param {google.cloud.notebooks.v1.DiagnosticConfig} message DiagnosticConfig
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
DiagnosticConfig.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.defaults) {
object.gcsBucket = "";
object.relativePath = "";
object.repairFlagEnabled = false;
object.packetCaptureFlagEnabled = false;
object.copyHomeFilesFlagEnabled = false;
}
if (message.gcsBucket != null && message.hasOwnProperty("gcsBucket"))
object.gcsBucket = message.gcsBucket;
if (message.relativePath != null && message.hasOwnProperty("relativePath"))
object.relativePath = message.relativePath;
if (message.repairFlagEnabled != null && message.hasOwnProperty("repairFlagEnabled"))
object.repairFlagEnabled = message.repairFlagEnabled;
if (message.packetCaptureFlagEnabled != null && message.hasOwnProperty("packetCaptureFlagEnabled"))
object.packetCaptureFlagEnabled = message.packetCaptureFlagEnabled;
if (message.copyHomeFilesFlagEnabled != null && message.hasOwnProperty("copyHomeFilesFlagEnabled"))
object.copyHomeFilesFlagEnabled = message.copyHomeFilesFlagEnabled;
return object;
};
/**
* Converts this DiagnosticConfig to JSON.
* @function toJSON
* @memberof google.cloud.notebooks.v1.DiagnosticConfig
* @instance
* @returns {Object.<string,*>} JSON object
*/
DiagnosticConfig.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* Gets the default type url for DiagnosticConfig
* @function getTypeUrl
* @memberof google.cloud.notebooks.v1.DiagnosticConfig
* @static
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns {string} The default type url
*/
DiagnosticConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
if (typeUrlPrefix === undefined) {
typeUrlPrefix = "type.googleapis.com";
}
return typeUrlPrefix + "/google.cloud.notebooks.v1.DiagnosticConfig";
};
return DiagnosticConfig;
})();
v1.Environment = (function() {
/**
* Properties of an Environment.
* @memberof google.cloud.notebooks.v1
* @interface IEnvironment
* @property {string|null} [name] Environment name
* @property {string|null} [displayName] Environment displayName
* @property {string|null} [description] Environment description
* @property {google.cloud.notebooks.v1.IVmImage|null} [vmImage] Environment vmImage
* @property {google.cloud.notebooks.v1.IContainerImage|null} [containerImage] Environment containerImage
* @property {string|null} [postStartupScript] Environment postStartupScript
* @property {google.protobuf.ITimestamp|null} [createTime] Environment createTime
*/
/**
* Constructs a new Environment.
* @memberof google.cloud.notebooks.v1
* @classdesc Represents an Environment.
* @implements IEnvironment
* @constructor
* @param {google.cloud.notebooks.v1.IEnvironment=} [properties] Properties to set
*/
function Environment(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* Environment name.
* @member {string} name
* @memberof google.cloud.notebooks.v1.Environment
* @instance
*/
Environment.prototype.name = "";
/**
* Environment displayName.
* @member {string} displayName
* @memberof google.cloud.notebooks.v1.Environment
* @instance
*/
Environment.prototype.displayName = "";
/**
* Environment description.
* @member {string} description
* @memberof google.cloud.notebooks.v1.Environment
* @instance
*/
Environment.prototype.description = "";
/**
* Environment vmImage.
* @member {google.cloud.notebooks.v1.IVmImage|null|undefined} vmImage
* @memberof google.cloud.notebooks.v1.Environment
* @instance
*/
Environment.prototype.vmImage = null;
/**
* Environment containerImage.
* @member {google.cloud.notebooks.v1.IContainerImage|null|undefined} containerImage
* @memberof google.cloud.notebooks.v1.Environment
* @instance
*/
Environment.prototype.containerImage = null;
/**
* Environment postStartupScript.
* @member {string} postStartupScript
* @memberof google.cloud.notebooks.v1.Environment
* @instance
*/
Environment.prototype.postStartupScript = "";
/**
* Environment createTime.
* @member {google.protobuf.ITimestamp|null|undefined} createTime
* @memberof google.cloud.notebooks.v1.Environment
* @instance
*/
Environment.prototype.createTime = null;
// OneOf field names bound to virtual getters and setters
var $oneOfFields;
/**
* Environment imageType.
* @member {"vmImage"|"containerImage"|undefined} imageType
* @memberof google.cloud.notebooks.v1.Environment
* @instance
*/
Object.defineProperty(Environment.prototype, "imageType", {
get: $util.oneOfGetter($oneOfFields = ["vmImage", "containerImage"]),
set: $util.oneOfSetter($oneOfFields)
});
/**
* Creates a new Environment instance using the specified properties.
* @function create
* @memberof google.cloud.notebooks.v1.Environment
* @static
* @param {google.cloud.notebooks.v1.IEnvironment=} [properties] Properties to set
* @returns {google.cloud.notebooks.v1.Environment} Environment instance
*/
Environment.create = function create(properties) {
return new Environment(properties);
};
/**
* Encodes the specified Environment message. Does not implicitly {@link google.cloud.notebooks.v1.Environment.verify|verify} messages.
* @function encode
* @memberof google.cloud.notebooks.v1.Environment
* @static
* @param {google.cloud.notebooks.v1.IEnvironment} message Environment message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
Environment.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.name != null && Object.hasOwnProperty.call(message, "name"))
writer.uint32(/* id 1, wireType 2 =*/10).string(message.name);
if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName"))
writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName);
if (message.description != null && Object.hasOwnProperty.call(message, "description"))
writer.uint32(/* id 3, wireType 2 =*/26).string(message.description);
if (message.vmImage != null && Object.hasOwnProperty.call(message, "vmImage"))
$root.google.cloud.notebooks.v1.VmImage.encode(message.vmImage, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim();
if (message.containerImage != null && Object.hasOwnProperty.call(message, "containerImage"))
$root.google.cloud.notebooks.v1.ContainerImage.encode(message.containerImage, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim();
if (message.postStartupScript != null && Object.hasOwnProperty.call(message, "postStartupScript"))
writer.uint32(/* id 8, wireType 2 =*/66).string(message.postStartupScript);
if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime"))
$root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim();
return writer;
};
/**
* Encodes the specified Environment message, length delimited. Does not implicitly {@link google.cloud.notebooks.v1.Environment.verify|verify} messages.
* @function encodeDelimited
* @memberof google.cloud.notebooks.v1.Environment
* @static
* @param {google.cloud.notebooks.v1.IEnvironment} message Environment message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
Environment.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes an Environment message from the specified reader or buffer.
* @function decode
* @memberof google.cloud.notebooks.v1.Environment
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {google.cloud.notebooks.v1.Environment} Environment
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
Environment.decode = function decode(reader, length, error) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.notebooks.v1.Environment();
while (reader.pos < end) {
var tag = reader.uint32();
if (tag === error)
break;
switch (tag >>> 3) {
case 1: {
message.name = reader.string();
break;
}
case 2: {
message.displayName = reader.string();
break;
}
case 3: {
message.description = reader.string();
break;
}
case 6: {
message.vmImage = $root.google.cloud.notebooks.v1.VmImage.decode(reader, reader.uint32());
break;
}
case 7: {
message.containerImage = $root.google.cloud.notebooks.v1.ContainerImage.decode(reader, reader.uint32());
break;
}
case 8: {
message.postStartupScript = reader.string();
break;
}
case 9: {
message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32());
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes an Environment message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof google.cloud.notebooks.v1.Environment
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {google.cloud.notebooks.v1.Environment} Environment
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
Environment.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies an Environment message.
* @function verify
* @memberof google.cloud.notebooks.v1.Environment
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
Environment.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
var properties = {};
if (message.name != null && message.hasOwnProperty("name"))
if (!$util.isString(message.name))
return "name: string expected";
if (message.displayName != null && message.hasOwnProperty("displayName"))
if (!$util.isString(message.displayName))
return "displayName: string expected";
if (message.description != null && message.hasOwnProperty("description"))
if (!$util.isString(message.description))
return "description: string expected";
if (message.vmImage != null && message.hasOwnProperty("vmImage")) {
properties.imageType = 1;
{
var error = $root.google.cloud.notebooks.v1.VmImage.verify(message.vmImage);
if (error)
return "vmImage." + error;
}
}
if (message.containerImage != null && message.hasOwnProperty("containerImage")) {
if (properties.imageType === 1)
return "imageType: multiple values";
properties.imageType = 1;
{
var error = $root.google.cloud.notebooks.v1.ContainerImage.verify(message.containerImage);
if (error)
return "containerImage." + error;
}
}
if (message.postStartupScript != null && message.hasOwnProperty("postStartupScript"))
if (!$util.isString(message.postStartupScript))
return "postStartupScript: string expected";
if (message.createTime != null && message.hasOwnProperty("createTime")) {
var error = $root.google.protobuf.Timestamp.verify(message.createTime);
if (error)
return "createTime." + error;
}
return null;
};
/**
* Creates an Environment message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof google.cloud.notebooks.v1.Environment
* @static
* @param {Object.<string,*>} object Plain object
* @returns {google.cloud.notebooks.v1.Environment} Environment
*/
Environment.fromObject = function fromObject(object) {
if (object instanceof $root.google.cloud.notebooks.v1.Environment)
return object;
var message = new $root.google.cloud.notebooks.v1.Environment();
if (object.name != null)
message.name = String(object.name);
if (object.displayName != null)
message.displayName = String(object.displayName);
if (object.description != null)
message.description = String(object.description);
if (object.vmImage != null) {
if (typeof object.vmImage !== "object")
throw TypeError(".google.cloud.notebooks.v1.Environment.vmImage: object expected");
message.vmImage = $root.google.cloud.notebooks.v1.VmImage.fromObject(object.vmImage);
}
if (object.containerImage != null) {
if (typeof object.containerImage !== "object")
throw TypeError(".google.cloud.notebooks.v1.Environment.containerImage: object expected");
message.containerImage = $root.google.cloud.notebooks.v1.ContainerImage.fromObject(object.containerImage);
}
if (object.postStartupScript != null)
message.postStartupScript = String(object.postStartupScript);
if (object.createTime != null) {
if (typeof object.createTime !== "object")
throw TypeError(".google.cloud.notebooks.v1.Environment.createTime: object expected");
message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime);
}
return message;
};
/**
* Creates a plain object from an Environment message. Also converts values to other types if specified.
* @function toObject
* @memberof google.cloud.notebooks.v1.Environment
* @static
* @param {google.cloud.notebooks.v1.Environment} message Environment
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
Environment.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.defaults) {
object.name = "";
object.displayName = "";
object.description = "";
object.postStartupScript = "";
object.createTime = null;
}
if (message.name != null && message.hasOwnProperty("name"))
object.name = message.name;
if (message.displayName != null && message.hasOwnProperty("displayName"))
object.displayName = message.displayName;
if (message.description != null && message.hasOwnProperty("description"))
object.description = message.description;
if (message.vmImage != null && message.hasOwnProperty("vmImage")) {
object.vmImage = $root.google.cloud.notebooks.v1.VmImage.toObject(message.vmImage, options);
if (options.oneofs)
object.imageType = "vmImage";
}
if (message.containerImage != null && message.hasOwnProperty("containerImage")) {
object.containerImage = $root.google.cloud.notebooks.v1.ContainerImage.toObject(message.containerImage, options);
if (options.oneofs)
object.imageType = "containerImage";
}
if (message.postStartupScript != null && message.hasOwnProperty("postStartupScript"))
object.postStartupScript = message.postStartupScript;
if (message.createTime != null && message.hasOwnProperty("createTime"))
object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options);
return object;
};
/**
* Converts this Environment to JSON.
* @function toJSON
* @memberof google.cloud.notebooks.v1.Environment
* @instance
* @returns {Object.<string,*>} JSON object
*/
Environment.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* Gets the default type url for Environment
* @function getTypeUrl
* @memberof google.cloud.notebooks.v1.Environment
* @static
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns {string} The default type url
*/
Environment.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
if (typeUrlPrefix === undefined) {
typeUrlPrefix = "type.googleapis.com";
}
return typeUrlPrefix + "/google.cloud.notebooks.v1.Environment";
};
return Environment;
})();
v1.VmImage = (function() {
/**
* Properties of a VmImage.
* @memberof google.cloud.notebooks.v1
* @interface IVmImage
* @property {string|null} [project] VmImage project
* @property {string|null} [imageName] VmImage imageName
* @property {string|null} [imageFamily] VmImage imageFamily
*/
/**
* Constructs a new VmImage.
* @memberof google.cloud.notebooks.v1
* @classdesc Represents a VmImage.
* @implements IVmImage
* @constructor
* @param {google.cloud.notebooks.v1.IVmImage=} [properties] Properties to set
*/
function VmImage(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* VmImage project.
* @member {string} project
* @memberof google.cloud.notebooks.v1.VmImage
* @instance
*/
VmImage.prototype.project = "";
/**
* VmImage imageName.
* @member {string|null|undefined} imageName
* @memberof google.cloud.notebooks.v1.VmImage
* @instance
*/
VmImage.prototype.imageName = null;
/**
* VmImage imageFamily.
* @member {string|null|undefined} imageFamily
* @memberof google.cloud.notebooks.v1.VmImage
* @instance
*/
VmImage.prototype.imageFamily = null;
// OneOf field names bound to virtual getters and setters
var $oneOfFields;
/**
* VmImage image.
* @member {"imageName"|"imageFamily"|undefined} image
* @memberof google.cloud.notebooks.v1.VmImage
* @instance
*/
Object.defineProperty(VmImage.prototype, "image", {
get: $util.oneOfGetter($oneOfFields = ["imageName", "imageFamily"]),
set: $util.oneOfSetter($oneOfFields)
});
/**
* Creates a new VmImage instance using the specified properties.
* @function create
* @memberof google.cloud.notebooks.v1.VmImage
* @static
* @param {google.cloud.notebooks.v1.IVmImage=} [properties] Properties to set
* @returns {google.cloud.notebooks.v1.VmImage} VmImage instance
*/
VmImage.create = function create(properties) {
return new VmImage(properties);
};
/**
* Encodes the specified VmImage message. Does not implicitly {@link google.cloud.notebooks.v1.VmImage.verify|verify} messages.
* @function encode
* @memberof google.cloud.notebooks.v1.VmImage
* @static
* @param {google.cloud.notebooks.v1.IVmImage} message VmImage message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
VmImage.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.project != null && Object.hasOwnProperty.call(message, "project"))
writer.uint32(/* id 1, wireType 2 =*/10).string(message.project);
if (message.imageName != null && Object.hasOwnProperty.call(message, "imageName"))
writer.uint32(/* id 2, wireType 2 =*/18).string(message.imageName);
if (messa