@google-cloud/workflows
Version:
785 lines (728 loc) • 1.96 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_workflows_protos || ($protobuf.roots._google_cloud_workflows_protos = {});
$root.google = (function() {
/**
* Namespace google.
* @exports google
* @namespace
*/
var google = {};
google.cloud = (function() {
/**
* Namespace cloud.
* @memberof google
* @namespace
*/
var cloud = {};
cloud.workflows = (function() {
/**
* Namespace workflows.
* @memberof google.cloud
* @namespace
*/
var workflows = {};
workflows.executions = (function() {
/**
* Namespace executions.
* @memberof google.cloud.workflows
* @namespace
*/
var executions = {};
executions.v1 = (function() {
/**
* Namespace v1.
* @memberof google.cloud.workflows.executions
* @namespace
*/
var v1 = {};
v1.Executions = (function() {
/**
* Constructs a new Executions service.
* @memberof google.cloud.workflows.executions.v1
* @classdesc Represents an Executions
* @extends $protobuf.rpc.Service
* @constructor
* @param {$protobuf.RPCImpl} rpcImpl RPC implementation
* @param {boolean} [requestDelimited=false] Whether requests are length-delimited
* @param {boolean} [responseDelimited=false] Whether responses are length-delimited
*/
function Executions(rpcImpl, requestDelimited, responseDelimited) {
$protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited);
}
(Executions.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Executions;
/**
* Creates new Executions service using the specified rpc implementation.
* @function create
* @memberof google.cloud.workflows.executions.v1.Executions
* @static
* @param {$protobuf.RPCImpl} rpcImpl RPC implementation
* @param {boolean} [requestDelimited=false] Whether requests are length-delimited
* @param {boolean} [responseDelimited=false] Whether responses are length-delimited
* @returns {Executions} RPC service. Useful where requests and/or responses are streamed.
*/
Executions.create = function create(rpcImpl, requestDelimited, responseDelimited) {
return new this(rpcImpl, requestDelimited, responseDelimited);
};
/**
* Callback as used by {@link google.cloud.workflows.executions.v1.Executions|listExecutions}.
* @memberof google.cloud.workflows.executions.v1.Executions
* @typedef ListExecutionsCallback
* @type {function}
* @param {Error|null} error Error, if any
* @param {google.cloud.workflows.executions.v1.ListExecutionsResponse} [response] ListExecutionsResponse
*/
/**
* Calls ListExecutions.
* @function listExecutions
* @memberof google.cloud.workflows.executions.v1.Executions
* @instance
* @param {google.cloud.workflows.executions.v1.IListExecutionsRequest} request ListExecutionsRequest message or plain object
* @param {google.cloud.workflows.executions.v1.Executions.ListExecutionsCallback} callback Node-style callback called with the error, if any, and ListExecutionsResponse
* @returns {undefined}
* @variation 1
*/
Object.defineProperty(Executions.prototype.listExecutions = function listExecutions(request, callback) {
return this.rpcCall(listExecutions, $root.google.cloud.workflows.executions.v1.ListExecutionsRequest, $root.google.cloud.workflows.executions.v1.ListExecutionsResponse, request, callback);
}, "name", { value: "ListExecutions" });
/**
* Calls ListExecutions.
* @function listExecutions
* @memberof google.cloud.workflows.executions.v1.Executions
* @instance
* @param {google.cloud.workflows.executions.v1.IListExecutionsRequest} request ListExecutionsRequest message or plain object
* @returns {Promise<google.cloud.workflows.executions.v1.ListExecutionsResponse>} Promise
* @variation 2
*/
/**
* Callback as used by {@link google.cloud.workflows.executions.v1.Executions|createExecution}.
* @memberof google.cloud.workflows.executions.v1.Executions
* @typedef CreateExecutionCallback
* @type {function}
* @param {Error|null} error Error, if any
* @param {google.cloud.workflows.executions.v1.Execution} [response] Execution
*/
/**
* Calls CreateExecution.
* @function createExecution
* @memberof google.cloud.workflows.executions.v1.Executions
* @instance
* @param {google.cloud.workflows.executions.v1.ICreateExecutionRequest} request CreateExecutionRequest message or plain object
* @param {google.cloud.workflows.executions.v1.Executions.CreateExecutionCallback} callback Node-style callback called with the error, if any, and Execution
* @returns {undefined}
* @variation 1
*/
Object.defineProperty(Executions.prototype.createExecution = function createExecution(request, callback) {
return this.rpcCall(createExecution, $root.google.cloud.workflows.executions.v1.CreateExecutionRequest, $root.google.cloud.workflows.executions.v1.Execution, request, callback);
}, "name", { value: "CreateExecution" });
/**
* Calls CreateExecution.
* @function createExecution
* @memberof google.cloud.workflows.executions.v1.Executions
* @instance
* @param {google.cloud.workflows.executions.v1.ICreateExecutionRequest} request CreateExecutionRequest message or plain object
* @returns {Promise<google.cloud.workflows.executions.v1.Execution>} Promise
* @variation 2
*/
/**
* Callback as used by {@link google.cloud.workflows.executions.v1.Executions|getExecution}.
* @memberof google.cloud.workflows.executions.v1.Executions
* @typedef GetExecutionCallback
* @type {function}
* @param {Error|null} error Error, if any
* @param {google.cloud.workflows.executions.v1.Execution} [response] Execution
*/
/**
* Calls GetExecution.
* @function getExecution
* @memberof google.cloud.workflows.executions.v1.Executions
* @instance
* @param {google.cloud.workflows.executions.v1.IGetExecutionRequest} request GetExecutionRequest message or plain object
* @param {google.cloud.workflows.executions.v1.Executions.GetExecutionCallback} callback Node-style callback called with the error, if any, and Execution
* @returns {undefined}
* @variation 1
*/
Object.defineProperty(Executions.prototype.getExecution = function getExecution(request, callback) {
return this.rpcCall(getExecution, $root.google.cloud.workflows.executions.v1.GetExecutionRequest, $root.google.cloud.workflows.executions.v1.Execution, request, callback);
}, "name", { value: "GetExecution" });
/**
* Calls GetExecution.
* @function getExecution
* @memberof google.cloud.workflows.executions.v1.Executions
* @instance
* @param {google.cloud.workflows.executions.v1.IGetExecutionRequest} request GetExecutionRequest message or plain object
* @returns {Promise<google.cloud.workflows.executions.v1.Execution>} Promise
* @variation 2
*/
/**
* Callback as used by {@link google.cloud.workflows.executions.v1.Executions|cancelExecution}.
* @memberof google.cloud.workflows.executions.v1.Executions
* @typedef CancelExecutionCallback
* @type {function}
* @param {Error|null} error Error, if any
* @param {google.cloud.workflows.executions.v1.Execution} [response] Execution
*/
/**
* Calls CancelExecution.
* @function cancelExecution
* @memberof google.cloud.workflows.executions.v1.Executions
* @instance
* @param {google.cloud.workflows.executions.v1.ICancelExecutionRequest} request CancelExecutionRequest message or plain object
* @param {google.cloud.workflows.executions.v1.Executions.CancelExecutionCallback} callback Node-style callback called with the error, if any, and Execution
* @returns {undefined}
* @variation 1
*/
Object.defineProperty(Executions.prototype.cancelExecution = function cancelExecution(request, callback) {
return this.rpcCall(cancelExecution, $root.google.cloud.workflows.executions.v1.CancelExecutionRequest, $root.google.cloud.workflows.executions.v1.Execution, request, callback);
}, "name", { value: "CancelExecution" });
/**
* Calls CancelExecution.
* @function cancelExecution
* @memberof google.cloud.workflows.executions.v1.Executions
* @instance
* @param {google.cloud.workflows.executions.v1.ICancelExecutionRequest} request CancelExecutionRequest message or plain object
* @returns {Promise<google.cloud.workflows.executions.v1.Execution>} Promise
* @variation 2
*/
return Executions;
})();
v1.Execution = (function() {
/**
* Properties of an Execution.
* @memberof google.cloud.workflows.executions.v1
* @interface IExecution
* @property {string|null} [name] Execution name
* @property {google.protobuf.ITimestamp|null} [startTime] Execution startTime
* @property {google.protobuf.ITimestamp|null} [endTime] Execution endTime
* @property {google.protobuf.IDuration|null} [duration] Execution duration
* @property {google.cloud.workflows.executions.v1.Execution.State|null} [state] Execution state
* @property {string|null} [argument] Execution argument
* @property {string|null} [result] Execution result
* @property {google.cloud.workflows.executions.v1.Execution.IError|null} [error] Execution error
* @property {string|null} [workflowRevisionId] Execution workflowRevisionId
* @property {google.cloud.workflows.executions.v1.Execution.CallLogLevel|null} [callLogLevel] Execution callLogLevel
* @property {google.cloud.workflows.executions.v1.Execution.IStatus|null} [status] Execution status
* @property {Object.<string,string>|null} [labels] Execution labels
* @property {google.cloud.workflows.executions.v1.Execution.IStateError|null} [stateError] Execution stateError
*/
/**
* Constructs a new Execution.
* @memberof google.cloud.workflows.executions.v1
* @classdesc Represents an Execution.
* @implements IExecution
* @constructor
* @param {google.cloud.workflows.executions.v1.IExecution=} [properties] Properties to set
*/
function Execution(properties) {
this.labels = {};
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]];
}
/**
* Execution name.
* @member {string} name
* @memberof google.cloud.workflows.executions.v1.Execution
* @instance
*/
Execution.prototype.name = "";
/**
* Execution startTime.
* @member {google.protobuf.ITimestamp|null|undefined} startTime
* @memberof google.cloud.workflows.executions.v1.Execution
* @instance
*/
Execution.prototype.startTime = null;
/**
* Execution endTime.
* @member {google.protobuf.ITimestamp|null|undefined} endTime
* @memberof google.cloud.workflows.executions.v1.Execution
* @instance
*/
Execution.prototype.endTime = null;
/**
* Execution duration.
* @member {google.protobuf.IDuration|null|undefined} duration
* @memberof google.cloud.workflows.executions.v1.Execution
* @instance
*/
Execution.prototype.duration = null;
/**
* Execution state.
* @member {google.cloud.workflows.executions.v1.Execution.State} state
* @memberof google.cloud.workflows.executions.v1.Execution
* @instance
*/
Execution.prototype.state = 0;
/**
* Execution argument.
* @member {string} argument
* @memberof google.cloud.workflows.executions.v1.Execution
* @instance
*/
Execution.prototype.argument = "";
/**
* Execution result.
* @member {string} result
* @memberof google.cloud.workflows.executions.v1.Execution
* @instance
*/
Execution.prototype.result = "";
/**
* Execution error.
* @member {google.cloud.workflows.executions.v1.Execution.IError|null|undefined} error
* @memberof google.cloud.workflows.executions.v1.Execution
* @instance
*/
Execution.prototype.error = null;
/**
* Execution workflowRevisionId.
* @member {string} workflowRevisionId
* @memberof google.cloud.workflows.executions.v1.Execution
* @instance
*/
Execution.prototype.workflowRevisionId = "";
/**
* Execution callLogLevel.
* @member {google.cloud.workflows.executions.v1.Execution.CallLogLevel} callLogLevel
* @memberof google.cloud.workflows.executions.v1.Execution
* @instance
*/
Execution.prototype.callLogLevel = 0;
/**
* Execution status.
* @member {google.cloud.workflows.executions.v1.Execution.IStatus|null|undefined} status
* @memberof google.cloud.workflows.executions.v1.Execution
* @instance
*/
Execution.prototype.status = null;
/**
* Execution labels.
* @member {Object.<string,string>} labels
* @memberof google.cloud.workflows.executions.v1.Execution
* @instance
*/
Execution.prototype.labels = $util.emptyObject;
/**
* Execution stateError.
* @member {google.cloud.workflows.executions.v1.Execution.IStateError|null|undefined} stateError
* @memberof google.cloud.workflows.executions.v1.Execution
* @instance
*/
Execution.prototype.stateError = null;
/**
* Creates a new Execution instance using the specified properties.
* @function create
* @memberof google.cloud.workflows.executions.v1.Execution
* @static
* @param {google.cloud.workflows.executions.v1.IExecution=} [properties] Properties to set
* @returns {google.cloud.workflows.executions.v1.Execution} Execution instance
*/
Execution.create = function create(properties) {
return new Execution(properties);
};
/**
* Encodes the specified Execution message. Does not implicitly {@link google.cloud.workflows.executions.v1.Execution.verify|verify} messages.
* @function encode
* @memberof google.cloud.workflows.executions.v1.Execution
* @static
* @param {google.cloud.workflows.executions.v1.IExecution} message Execution message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
Execution.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.startTime != null && Object.hasOwnProperty.call(message, "startTime"))
$root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime"))
$root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();
if (message.state != null && Object.hasOwnProperty.call(message, "state"))
writer.uint32(/* id 4, wireType 0 =*/32).int32(message.state);
if (message.argument != null && Object.hasOwnProperty.call(message, "argument"))
writer.uint32(/* id 5, wireType 2 =*/42).string(message.argument);
if (message.result != null && Object.hasOwnProperty.call(message, "result"))
writer.uint32(/* id 6, wireType 2 =*/50).string(message.result);
if (message.error != null && Object.hasOwnProperty.call(message, "error"))
$root.google.cloud.workflows.executions.v1.Execution.Error.encode(message.error, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim();
if (message.workflowRevisionId != null && Object.hasOwnProperty.call(message, "workflowRevisionId"))
writer.uint32(/* id 8, wireType 2 =*/66).string(message.workflowRevisionId);
if (message.callLogLevel != null && Object.hasOwnProperty.call(message, "callLogLevel"))
writer.uint32(/* id 9, wireType 0 =*/72).int32(message.callLogLevel);
if (message.status != null && Object.hasOwnProperty.call(message, "status"))
$root.google.cloud.workflows.executions.v1.Execution.Status.encode(message.status, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim();
if (message.labels != null && Object.hasOwnProperty.call(message, "labels"))
for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i)
writer.uint32(/* id 11, wireType 2 =*/90).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim();
if (message.duration != null && Object.hasOwnProperty.call(message, "duration"))
$root.google.protobuf.Duration.encode(message.duration, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim();
if (message.stateError != null && Object.hasOwnProperty.call(message, "stateError"))
$root.google.cloud.workflows.executions.v1.Execution.StateError.encode(message.stateError, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim();
return writer;
};
/**
* Encodes the specified Execution message, length delimited. Does not implicitly {@link google.cloud.workflows.executions.v1.Execution.verify|verify} messages.
* @function encodeDelimited
* @memberof google.cloud.workflows.executions.v1.Execution
* @static
* @param {google.cloud.workflows.executions.v1.IExecution} message Execution message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
Execution.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes an Execution message from the specified reader or buffer.
* @function decode
* @memberof google.cloud.workflows.executions.v1.Execution
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {google.cloud.workflows.executions.v1.Execution} Execution
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
Execution.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.workflows.executions.v1.Execution(), key, value;
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.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32());
break;
}
case 3: {
message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32());
break;
}
case 12: {
message.duration = $root.google.protobuf.Duration.decode(reader, reader.uint32());
break;
}
case 4: {
message.state = reader.int32();
break;
}
case 5: {
message.argument = reader.string();
break;
}
case 6: {
message.result = reader.string();
break;
}
case 7: {
message.error = $root.google.cloud.workflows.executions.v1.Execution.Error.decode(reader, reader.uint32());
break;
}
case 8: {
message.workflowRevisionId = reader.string();
break;
}
case 9: {
message.callLogLevel = reader.int32();
break;
}
case 10: {
message.status = $root.google.cloud.workflows.executions.v1.Execution.Status.decode(reader, reader.uint32());
break;
}
case 11: {
if (message.labels === $util.emptyObject)
message.labels = {};
var end2 = reader.uint32() + reader.pos;
key = "";
value = "";
while (reader.pos < end2) {
var tag2 = reader.uint32();
switch (tag2 >>> 3) {
case 1:
key = reader.string();
break;
case 2:
value = reader.string();
break;
default:
reader.skipType(tag2 & 7);
break;
}
}
message.labels[key] = value;
break;
}
case 13: {
message.stateError = $root.google.cloud.workflows.executions.v1.Execution.StateError.decode(reader, reader.uint32());
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes an Execution message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof google.cloud.workflows.executions.v1.Execution
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {google.cloud.workflows.executions.v1.Execution} Execution
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
Execution.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies an Execution message.
* @function verify
* @memberof google.cloud.workflows.executions.v1.Execution
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
Execution.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.name != null && message.hasOwnProperty("name"))
if (!$util.isString(message.name))
return "name: string expected";
if (message.startTime != null && message.hasOwnProperty("startTime")) {
var error = $root.google.protobuf.Timestamp.verify(message.startTime);
if (error)
return "startTime." + error;
}
if (message.endTime != null && message.hasOwnProperty("endTime")) {
var error = $root.google.protobuf.Timestamp.verify(message.endTime);
if (error)
return "endTime." + error;
}
if (message.duration != null && message.hasOwnProperty("duration")) {
var error = $root.google.protobuf.Duration.verify(message.duration);
if (error)
return "duration." + error;
}
if (message.state != null && message.hasOwnProperty("state"))
switch (message.state) {
default:
return "state: enum value expected";
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
break;
}
if (message.argument != null && message.hasOwnProperty("argument"))
if (!$util.isString(message.argument))
return "argument: string expected";
if (message.result != null && message.hasOwnProperty("result"))
if (!$util.isString(message.result))
return "result: string expected";
if (message.error != null && message.hasOwnProperty("error")) {
var error = $root.google.cloud.workflows.executions.v1.Execution.Error.verify(message.error);
if (error)
return "error." + error;
}
if (message.workflowRevisionId != null && message.hasOwnProperty("workflowRevisionId"))
if (!$util.isString(message.workflowRevisionId))
return "workflowRevisionId: string expected";
if (message.callLogLevel != null && message.hasOwnProperty("callLogLevel"))
switch (message.callLogLevel) {
default:
return "callLogLevel: enum value expected";
case 0:
case 1:
case 2:
case 3:
break;
}
if (message.status != null && message.hasOwnProperty("status")) {
var error = $root.google.cloud.workflows.executions.v1.Execution.Status.verify(message.status);
if (error)
return "status." + error;
}
if (message.labels != null && message.hasOwnProperty("labels")) {
if (!$util.isObject(message.labels))
return "labels: object expected";
var key = Object.keys(message.labels);
for (var i = 0; i < key.length; ++i)
if (!$util.isString(message.labels[key[i]]))
return "labels: string{k:string} expected";
}
if (message.stateError != null && message.hasOwnProperty("stateError")) {
var error = $root.google.cloud.workflows.executions.v1.Execution.StateError.verify(message.stateError);
if (error)
return "stateError." + error;
}
return null;
};
/**
* Creates an Execution message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof google.cloud.workflows.executions.v1.Execution
* @static
* @param {Object.<string,*>} object Plain object
* @returns {google.cloud.workflows.executions.v1.Execution} Execution
*/
Execution.fromObject = function fromObject(object) {
if (object instanceof $root.google.cloud.workflows.executions.v1.Execution)
return object;
var message = new $root.google.cloud.workflows.executions.v1.Execution();
if (object.name != null)
message.name = String(object.name);
if (object.startTime != null) {
if (typeof object.startTime !== "object")
throw TypeError(".google.cloud.workflows.executions.v1.Execution.startTime: object expected");
message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime);
}
if (object.endTime != null) {
if (typeof object.endTime !== "object")
throw TypeError(".google.cloud.workflows.executions.v1.Execution.endTime: object expected");
message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime);
}
if (object.duration != null) {
if (typeof object.duration !== "object")
throw TypeError(".google.cloud.workflows.executions.v1.Execution.duration: object expected");
message.duration = $root.google.protobuf.Duration.fromObject(object.duration);
}
switch (object.state) {
default:
if (typeof object.state === "number") {
message.state = object.state;
break;
}
break;
case "STATE_UNSPECIFIED":
case 0:
message.state = 0;
break;
case "ACTIVE":
case 1:
message.state = 1;
break;
case "SUCCEEDED":
case 2:
message.state = 2;
break;
case "FAILED":
case 3:
message.state = 3;
break;
case "CANCELLED":
case 4:
message.state = 4;
break;
case "UNAVAILABLE":
case 5:
message.state = 5;
break;
case "QUEUED":
case 6:
message.state = 6;
break;
}
if (object.argument != null)
message.argument = String(object.argument);
if (object.result != null)
message.result = String(object.result);
if (object.error != null) {
if (typeof object.error !== "object")
throw TypeError(".google.cloud.workflows.executions.v1.Execution.error: object expected");
message.error = $root.google.cloud.workflows.executions.v1.Execution.Error.fromObject(object.error);
}
if (object.workflowRevisionId != null)
message.workflowRevisionId = String(object.workflowRevisionId);
switch (object.callLogLevel) {
default:
if (typeof object.callLogLevel === "number") {
message.callLogLevel = object.callLogLevel;
break;
}
break;
case "CALL_LOG_LEVEL_UNSPECIFIED":
case 0:
message.callLogLevel = 0;
break;
case "LOG_ALL_CALLS":
case 1:
message.callLogLevel = 1;
break;
case "LOG_ERRORS_ONLY":
case 2:
message.callLogLevel = 2;
break;
case "LOG_NONE":
case 3:
message.callLogLevel = 3;
break;
}
if (object.status != null) {
if (typeof object.status !== "object")
throw TypeError(".google.cloud.workflows.executions.v1.Execution.status: object expected");
message.status = $root.google.cloud.workflows.executions.v1.Execution.Status.fromObject(object.status);
}
if (object.labels) {
if (typeof object.labels !== "object")
throw TypeError(".google.cloud.workflows.executions.v1.Execution.labels: object expected");
message.labels = {};
for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i)
message.labels[keys[i]] = String(object.labels[keys[i]]);
}
if (object.stateError != null) {
if (typeof object.stateError !== "object")
throw TypeError(".google.cloud.workflows.executions.v1.Execution.stateError: object expected");
message.stateError = $root.google.cloud.workflows.executions.v1.Execution.StateError.fromObject(object.stateError);
}
return message;
};
/**
* Creates a plain object from an Execution message. Also converts values to other types if specified.
* @function toObject
* @memberof google.cloud.workflows.executions.v1.Execution
* @static
* @param {google.cloud.workflows.executions.v1.Execution} message Execution
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
Execution.toObject = function toObject(message, options) {
if (!options