ydb-sdk-proto
Version:
Node.js YDB SDK compiled protobufs
1,085 lines (1,003 loc) • 7 MB
JavaScript
/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/
"use strict";
var $protobuf = require("protobufjs/minimal");
// Common aliases
var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
// Exported root namespace
var $root = $protobuf.roots["ydb-sdk"] || ($protobuf.roots["ydb-sdk"] = {});
$root.Ydb = (function() {
/**
* Namespace Ydb.
* @exports Ydb
* @namespace
*/
var Ydb = {};
Ydb.Auth = (function() {
/**
* Namespace Auth.
* @memberof Ydb
* @namespace
*/
var Auth = {};
Auth.V1 = (function() {
/**
* Namespace V1.
* @memberof Ydb.Auth
* @namespace
*/
var V1 = {};
V1.AuthService = (function() {
/**
* Constructs a new AuthService service.
* @memberof Ydb.Auth.V1
* @classdesc Represents an AuthService
* @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 AuthService(rpcImpl, requestDelimited, responseDelimited) {
$protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited);
}
(AuthService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = AuthService;
/**
* Creates new AuthService service using the specified rpc implementation.
* @function create
* @memberof Ydb.Auth.V1.AuthService
* @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 {AuthService} RPC service. Useful where requests and/or responses are streamed.
*/
AuthService.create = function create(rpcImpl, requestDelimited, responseDelimited) {
return new this(rpcImpl, requestDelimited, responseDelimited);
};
/**
* Callback as used by {@link Ydb.Auth.V1.AuthService#login}.
* @memberof Ydb.Auth.V1.AuthService
* @typedef LoginCallback
* @type {function}
* @param {Error|null} error Error, if any
* @param {Ydb.Auth.LoginResponse} [response] LoginResponse
*/
/**
* Calls Login.
* @function login
* @memberof Ydb.Auth.V1.AuthService
* @instance
* @param {Ydb.Auth.ILoginRequest} request LoginRequest message or plain object
* @param {Ydb.Auth.V1.AuthService.LoginCallback} callback Node-style callback called with the error, if any, and LoginResponse
* @returns {undefined}
* @variation 1
*/
Object.defineProperty(AuthService.prototype.login = function login(request, callback) {
return this.rpcCall(login, $root.Ydb.Auth.LoginRequest, $root.Ydb.Auth.LoginResponse, request, callback);
}, "name", { value: "Login" });
/**
* Calls Login.
* @function login
* @memberof Ydb.Auth.V1.AuthService
* @instance
* @param {Ydb.Auth.ILoginRequest} request LoginRequest message or plain object
* @returns {Promise<Ydb.Auth.LoginResponse>} Promise
* @variation 2
*/
return AuthService;
})();
return V1;
})();
Auth.LoginRequest = (function() {
/**
* Properties of a LoginRequest.
* @memberof Ydb.Auth
* @interface ILoginRequest
* @property {Ydb.Operations.IOperationParams|null} [operationParams] LoginRequest operationParams
* @property {string|null} [user] LoginRequest user
* @property {string|null} [password] LoginRequest password
*/
/**
* Constructs a new LoginRequest.
* @memberof Ydb.Auth
* @classdesc Represents a LoginRequest.
* @implements ILoginRequest
* @constructor
* @param {Ydb.Auth.ILoginRequest=} [properties] Properties to set
*/
function LoginRequest(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]];
}
/**
* LoginRequest operationParams.
* @member {Ydb.Operations.IOperationParams|null|undefined} operationParams
* @memberof Ydb.Auth.LoginRequest
* @instance
*/
LoginRequest.prototype.operationParams = null;
/**
* LoginRequest user.
* @member {string} user
* @memberof Ydb.Auth.LoginRequest
* @instance
*/
LoginRequest.prototype.user = "";
/**
* LoginRequest password.
* @member {string} password
* @memberof Ydb.Auth.LoginRequest
* @instance
*/
LoginRequest.prototype.password = "";
/**
* Creates a new LoginRequest instance using the specified properties.
* @function create
* @memberof Ydb.Auth.LoginRequest
* @static
* @param {Ydb.Auth.ILoginRequest=} [properties] Properties to set
* @returns {Ydb.Auth.LoginRequest} LoginRequest instance
*/
LoginRequest.create = function create(properties) {
return new LoginRequest(properties);
};
/**
* Encodes the specified LoginRequest message. Does not implicitly {@link Ydb.Auth.LoginRequest.verify|verify} messages.
* @function encode
* @memberof Ydb.Auth.LoginRequest
* @static
* @param {Ydb.Auth.ILoginRequest} message LoginRequest message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
LoginRequest.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.operationParams != null && Object.hasOwnProperty.call(message, "operationParams"))
$root.Ydb.Operations.OperationParams.encode(message.operationParams, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
if (message.user != null && Object.hasOwnProperty.call(message, "user"))
writer.uint32(/* id 2, wireType 2 =*/18).string(message.user);
if (message.password != null && Object.hasOwnProperty.call(message, "password"))
writer.uint32(/* id 3, wireType 2 =*/26).string(message.password);
return writer;
};
/**
* Encodes the specified LoginRequest message, length delimited. Does not implicitly {@link Ydb.Auth.LoginRequest.verify|verify} messages.
* @function encodeDelimited
* @memberof Ydb.Auth.LoginRequest
* @static
* @param {Ydb.Auth.ILoginRequest} message LoginRequest message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
LoginRequest.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a LoginRequest message from the specified reader or buffer.
* @function decode
* @memberof Ydb.Auth.LoginRequest
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {Ydb.Auth.LoginRequest} LoginRequest
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
LoginRequest.decode = function decode(reader, length) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.Ydb.Auth.LoginRequest();
while (reader.pos < end) {
var tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.operationParams = $root.Ydb.Operations.OperationParams.decode(reader, reader.uint32());
break;
case 2:
message.user = reader.string();
break;
case 3:
message.password = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a LoginRequest message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof Ydb.Auth.LoginRequest
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {Ydb.Auth.LoginRequest} LoginRequest
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
LoginRequest.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a LoginRequest message.
* @function verify
* @memberof Ydb.Auth.LoginRequest
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
LoginRequest.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.operationParams != null && message.hasOwnProperty("operationParams")) {
var error = $root.Ydb.Operations.OperationParams.verify(message.operationParams);
if (error)
return "operationParams." + error;
}
if (message.user != null && message.hasOwnProperty("user"))
if (!$util.isString(message.user))
return "user: string expected";
if (message.password != null && message.hasOwnProperty("password"))
if (!$util.isString(message.password))
return "password: string expected";
return null;
};
/**
* Creates a LoginRequest message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof Ydb.Auth.LoginRequest
* @static
* @param {Object.<string,*>} object Plain object
* @returns {Ydb.Auth.LoginRequest} LoginRequest
*/
LoginRequest.fromObject = function fromObject(object) {
if (object instanceof $root.Ydb.Auth.LoginRequest)
return object;
var message = new $root.Ydb.Auth.LoginRequest();
if (object.operationParams != null) {
if (typeof object.operationParams !== "object")
throw TypeError(".Ydb.Auth.LoginRequest.operationParams: object expected");
message.operationParams = $root.Ydb.Operations.OperationParams.fromObject(object.operationParams);
}
if (object.user != null)
message.user = String(object.user);
if (object.password != null)
message.password = String(object.password);
return message;
};
/**
* Creates a plain object from a LoginRequest message. Also converts values to other types if specified.
* @function toObject
* @memberof Ydb.Auth.LoginRequest
* @static
* @param {Ydb.Auth.LoginRequest} message LoginRequest
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
LoginRequest.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.defaults) {
object.operationParams = null;
object.user = "";
object.password = "";
}
if (message.operationParams != null && message.hasOwnProperty("operationParams"))
object.operationParams = $root.Ydb.Operations.OperationParams.toObject(message.operationParams, options);
if (message.user != null && message.hasOwnProperty("user"))
object.user = message.user;
if (message.password != null && message.hasOwnProperty("password"))
object.password = message.password;
return object;
};
/**
* Converts this LoginRequest to JSON.
* @function toJSON
* @memberof Ydb.Auth.LoginRequest
* @instance
* @returns {Object.<string,*>} JSON object
*/
LoginRequest.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
return LoginRequest;
})();
Auth.LoginResponse = (function() {
/**
* Properties of a LoginResponse.
* @memberof Ydb.Auth
* @interface ILoginResponse
* @property {Ydb.Operations.IOperation|null} [operation] LoginResponse operation
*/
/**
* Constructs a new LoginResponse.
* @memberof Ydb.Auth
* @classdesc Represents a LoginResponse.
* @implements ILoginResponse
* @constructor
* @param {Ydb.Auth.ILoginResponse=} [properties] Properties to set
*/
function LoginResponse(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]];
}
/**
* LoginResponse operation.
* @member {Ydb.Operations.IOperation|null|undefined} operation
* @memberof Ydb.Auth.LoginResponse
* @instance
*/
LoginResponse.prototype.operation = null;
/**
* Creates a new LoginResponse instance using the specified properties.
* @function create
* @memberof Ydb.Auth.LoginResponse
* @static
* @param {Ydb.Auth.ILoginResponse=} [properties] Properties to set
* @returns {Ydb.Auth.LoginResponse} LoginResponse instance
*/
LoginResponse.create = function create(properties) {
return new LoginResponse(properties);
};
/**
* Encodes the specified LoginResponse message. Does not implicitly {@link Ydb.Auth.LoginResponse.verify|verify} messages.
* @function encode
* @memberof Ydb.Auth.LoginResponse
* @static
* @param {Ydb.Auth.ILoginResponse} message LoginResponse message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
LoginResponse.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.operation != null && Object.hasOwnProperty.call(message, "operation"))
$root.Ydb.Operations.Operation.encode(message.operation, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
return writer;
};
/**
* Encodes the specified LoginResponse message, length delimited. Does not implicitly {@link Ydb.Auth.LoginResponse.verify|verify} messages.
* @function encodeDelimited
* @memberof Ydb.Auth.LoginResponse
* @static
* @param {Ydb.Auth.ILoginResponse} message LoginResponse message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
LoginResponse.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a LoginResponse message from the specified reader or buffer.
* @function decode
* @memberof Ydb.Auth.LoginResponse
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {Ydb.Auth.LoginResponse} LoginResponse
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
LoginResponse.decode = function decode(reader, length) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.Ydb.Auth.LoginResponse();
while (reader.pos < end) {
var tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.operation = $root.Ydb.Operations.Operation.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a LoginResponse message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof Ydb.Auth.LoginResponse
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {Ydb.Auth.LoginResponse} LoginResponse
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
LoginResponse.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a LoginResponse message.
* @function verify
* @memberof Ydb.Auth.LoginResponse
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
LoginResponse.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.operation != null && message.hasOwnProperty("operation")) {
var error = $root.Ydb.Operations.Operation.verify(message.operation);
if (error)
return "operation." + error;
}
return null;
};
/**
* Creates a LoginResponse message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof Ydb.Auth.LoginResponse
* @static
* @param {Object.<string,*>} object Plain object
* @returns {Ydb.Auth.LoginResponse} LoginResponse
*/
LoginResponse.fromObject = function fromObject(object) {
if (object instanceof $root.Ydb.Auth.LoginResponse)
return object;
var message = new $root.Ydb.Auth.LoginResponse();
if (object.operation != null) {
if (typeof object.operation !== "object")
throw TypeError(".Ydb.Auth.LoginResponse.operation: object expected");
message.operation = $root.Ydb.Operations.Operation.fromObject(object.operation);
}
return message;
};
/**
* Creates a plain object from a LoginResponse message. Also converts values to other types if specified.
* @function toObject
* @memberof Ydb.Auth.LoginResponse
* @static
* @param {Ydb.Auth.LoginResponse} message LoginResponse
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
LoginResponse.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.defaults)
object.operation = null;
if (message.operation != null && message.hasOwnProperty("operation"))
object.operation = $root.Ydb.Operations.Operation.toObject(message.operation, options);
return object;
};
/**
* Converts this LoginResponse to JSON.
* @function toJSON
* @memberof Ydb.Auth.LoginResponse
* @instance
* @returns {Object.<string,*>} JSON object
*/
LoginResponse.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
return LoginResponse;
})();
Auth.LoginResult = (function() {
/**
* Properties of a LoginResult.
* @memberof Ydb.Auth
* @interface ILoginResult
* @property {string|null} [token] LoginResult token
*/
/**
* Constructs a new LoginResult.
* @memberof Ydb.Auth
* @classdesc Represents a LoginResult.
* @implements ILoginResult
* @constructor
* @param {Ydb.Auth.ILoginResult=} [properties] Properties to set
*/
function LoginResult(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]];
}
/**
* LoginResult token.
* @member {string} token
* @memberof Ydb.Auth.LoginResult
* @instance
*/
LoginResult.prototype.token = "";
/**
* Creates a new LoginResult instance using the specified properties.
* @function create
* @memberof Ydb.Auth.LoginResult
* @static
* @param {Ydb.Auth.ILoginResult=} [properties] Properties to set
* @returns {Ydb.Auth.LoginResult} LoginResult instance
*/
LoginResult.create = function create(properties) {
return new LoginResult(properties);
};
/**
* Encodes the specified LoginResult message. Does not implicitly {@link Ydb.Auth.LoginResult.verify|verify} messages.
* @function encode
* @memberof Ydb.Auth.LoginResult
* @static
* @param {Ydb.Auth.ILoginResult} message LoginResult message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
LoginResult.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.token != null && Object.hasOwnProperty.call(message, "token"))
writer.uint32(/* id 1, wireType 2 =*/10).string(message.token);
return writer;
};
/**
* Encodes the specified LoginResult message, length delimited. Does not implicitly {@link Ydb.Auth.LoginResult.verify|verify} messages.
* @function encodeDelimited
* @memberof Ydb.Auth.LoginResult
* @static
* @param {Ydb.Auth.ILoginResult} message LoginResult message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
LoginResult.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a LoginResult message from the specified reader or buffer.
* @function decode
* @memberof Ydb.Auth.LoginResult
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {Ydb.Auth.LoginResult} LoginResult
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
LoginResult.decode = function decode(reader, length) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.Ydb.Auth.LoginResult();
while (reader.pos < end) {
var tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.token = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a LoginResult message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof Ydb.Auth.LoginResult
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {Ydb.Auth.LoginResult} LoginResult
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
LoginResult.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a LoginResult message.
* @function verify
* @memberof Ydb.Auth.LoginResult
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
LoginResult.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.token != null && message.hasOwnProperty("token"))
if (!$util.isString(message.token))
return "token: string expected";
return null;
};
/**
* Creates a LoginResult message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof Ydb.Auth.LoginResult
* @static
* @param {Object.<string,*>} object Plain object
* @returns {Ydb.Auth.LoginResult} LoginResult
*/
LoginResult.fromObject = function fromObject(object) {
if (object instanceof $root.Ydb.Auth.LoginResult)
return object;
var message = new $root.Ydb.Auth.LoginResult();
if (object.token != null)
message.token = String(object.token);
return message;
};
/**
* Creates a plain object from a LoginResult message. Also converts values to other types if specified.
* @function toObject
* @memberof Ydb.Auth.LoginResult
* @static
* @param {Ydb.Auth.LoginResult} message LoginResult
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
LoginResult.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.defaults)
object.token = "";
if (message.token != null && message.hasOwnProperty("token"))
object.token = message.token;
return object;
};
/**
* Converts this LoginResult to JSON.
* @function toJSON
* @memberof Ydb.Auth.LoginResult
* @instance
* @returns {Object.<string,*>} JSON object
*/
LoginResult.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
return LoginResult;
})();
return Auth;
})();
Ydb.Operations = (function() {
/**
* Namespace Operations.
* @memberof Ydb
* @namespace
*/
var Operations = {};
Operations.OperationParams = (function() {
/**
* Properties of an OperationParams.
* @memberof Ydb.Operations
* @interface IOperationParams
* @property {Ydb.Operations.OperationParams.OperationMode|null} [operationMode] OperationParams operationMode
* @property {google.protobuf.IDuration|null} [operationTimeout] OperationParams operationTimeout
* @property {google.protobuf.IDuration|null} [cancelAfter] OperationParams cancelAfter
* @property {Object.<string,string>|null} [labels] OperationParams labels
* @property {Ydb.FeatureFlag.Status|null} [reportCostInfo] OperationParams reportCostInfo
*/
/**
* Constructs a new OperationParams.
* @memberof Ydb.Operations
* @classdesc Represents an OperationParams.
* @implements IOperationParams
* @constructor
* @param {Ydb.Operations.IOperationParams=} [properties] Properties to set
*/
function OperationParams(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]];
}
/**
* OperationParams operationMode.
* @member {Ydb.Operations.OperationParams.OperationMode} operationMode
* @memberof Ydb.Operations.OperationParams
* @instance
*/
OperationParams.prototype.operationMode = 0;
/**
* OperationParams operationTimeout.
* @member {google.protobuf.IDuration|null|undefined} operationTimeout
* @memberof Ydb.Operations.OperationParams
* @instance
*/
OperationParams.prototype.operationTimeout = null;
/**
* OperationParams cancelAfter.
* @member {google.protobuf.IDuration|null|undefined} cancelAfter
* @memberof Ydb.Operations.OperationParams
* @instance
*/
OperationParams.prototype.cancelAfter = null;
/**
* OperationParams labels.
* @member {Object.<string,string>} labels
* @memberof Ydb.Operations.OperationParams
* @instance
*/
OperationParams.prototype.labels = $util.emptyObject;
/**
* OperationParams reportCostInfo.
* @member {Ydb.FeatureFlag.Status} reportCostInfo
* @memberof Ydb.Operations.OperationParams
* @instance
*/
OperationParams.prototype.reportCostInfo = 0;
/**
* Creates a new OperationParams instance using the specified properties.
* @function create
* @memberof Ydb.Operations.OperationParams
* @static
* @param {Ydb.Operations.IOperationParams=} [properties] Properties to set
* @returns {Ydb.Operations.OperationParams} OperationParams instance
*/
OperationParams.create = function create(properties) {
return new OperationParams(properties);
};
/**
* Encodes the specified OperationParams message. Does not implicitly {@link Ydb.Operations.OperationParams.verify|verify} messages.
* @function encode
* @memberof Ydb.Operations.OperationParams
* @static
* @param {Ydb.Operations.IOperationParams} message OperationParams message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
OperationParams.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.operationMode != null && Object.hasOwnProperty.call(message, "operationMode"))
writer.uint32(/* id 1, wireType 0 =*/8).int32(message.operationMode);
if (message.operationTimeout != null && Object.hasOwnProperty.call(message, "operationTimeout"))
$root.google.protobuf.Duration.encode(message.operationTimeout, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
if (message.cancelAfter != null && Object.hasOwnProperty.call(message, "cancelAfter"))
$root.google.protobuf.Duration.encode(message.cancelAfter, writer.uint32(/* id 3, wireType 2 =*/26).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 4, wireType 2 =*/34).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim();
if (message.reportCostInfo != null && Object.hasOwnProperty.call(message, "reportCostInfo"))
writer.uint32(/* id 5, wireType 0 =*/40).int32(message.reportCostInfo);
return writer;
};
/**
* Encodes the specified OperationParams message, length delimited. Does not implicitly {@link Ydb.Operations.OperationParams.verify|verify} messages.
* @function encodeDelimited
* @memberof Ydb.Operations.OperationParams
* @static
* @param {Ydb.Operations.IOperationParams} message OperationParams message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
OperationParams.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes an OperationParams message from the specified reader or buffer.
* @function decode
* @memberof Ydb.Operations.OperationParams
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {Ydb.Operations.OperationParams} OperationParams
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
OperationParams.decode = function decode(reader, length) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.Ydb.Operations.OperationParams(), key, value;
while (reader.pos < end) {
var tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.operationMode = reader.int32();
break;
case 2:
message.operationTimeout = $root.google.protobuf.Duration.decode(reader, reader.uint32());
break;
case 3:
message.cancelAfter = $root.google.protobuf.Duration.decode(reader, reader.uint32());
break;
case 4:
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 5:
message.reportCostInfo = reader.int32();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes an OperationParams message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof Ydb.Operations.OperationParams
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {Ydb.Operations.OperationParams} OperationParams
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
OperationParams.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies an OperationParams message.
* @function verify
* @memberof Ydb.Operations.OperationParams
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
OperationParams.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.operationMode != null && message.hasOwnProperty("operationMode"))
switch (message.operationMode) {
default:
return "operationMode: enum value expected";
case 0:
case 1:
case 2:
break;
}
if (message.operationTimeout != null && message.hasOwnProperty("operationTimeout")) {
var error = $root.google.protobuf.Duration.verify(message.operationTimeout);
if (error)
return "operationTimeout." + error;
}
if (message.cancelAfter != null && message.hasOwnProperty("cancelAfter")) {
var error = $root.google.protobuf.Duration.verify(message.cancelAfter);
if (error)
return "cancelAfter." + 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.reportCostInfo != null && message.hasOwnProperty("reportCostInfo"))
switch (message.reportCostInfo) {
default:
return "reportCostInfo: enum value expected";
case 0:
case 1:
case 2:
break;
}
return null;
};
/**
* Creates an OperationParams message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof Ydb.Operations.OperationParams
* @static
* @param {Object.<string,*>} object Plain object
* @returns {Ydb.Operations.OperationParams} OperationParams
*/
OperationParams.fromObject = function fromObject(object) {
if (object instanceof $root.Ydb.Operations.OperationParams)
return object;
var message = new $root.Ydb.Operations.OperationParams();
switch (object.operationMode) {
case "OPERATION_MODE_UNSPECIFIED":
case 0:
message.operationMode = 0;
break;
case "SYNC":
case 1:
message.operationMode = 1;
break;
case "ASYNC":
case 2:
message.operationMode = 2;
break;
}
if (object.operationTimeout != null) {
if (typeof object.operationTimeout !== "object")
throw TypeError(".Ydb.Operations.OperationParams.operationTimeout: object expected");
message.operationTimeout = $root.google.protobuf.Duration.fromObject(object.operationTimeout);
}
if (object.cancelAfter != null) {
if (typeof object.cancelAfter !== "object")
throw TypeError(".Ydb.Operations.OperationParams.cancelAfter: object expected");
message.cancelAfter = $root.google.protobuf.Duration.fromObject(object.cancelAfter);
}
if (object.labels) {
if (typeof object.labels !== "object")
throw TypeError(".Ydb.Operations.OperationParams.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]]);
}
switch (object.reportCostInfo) {
case "STATUS_UNSPECIFIED":
case 0:
message.reportCostInfo = 0;
break;
case "ENABLED":
case 1:
message.reportCostInfo = 1;
break;
case "DISABLED":
case 2:
message.reportCostInfo = 2;
break;
}
return message;
};
/**
* Creates a plain object from an OperationParams message. Also converts values to other types if specified.
* @function toObject
* @memberof Ydb.Operations.OperationParams
* @static
* @param {Ydb.Operations.OperationParams} message OperationParams
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
OperationParams.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.objects || options.defaults)
object.labels = {};
if (options.defaults) {
object.operationMode = options.enums === String ? "OPERATION_MODE_UNSPECIFIED" : 0;
object.operationTimeout = null;
object.cancelAfter = null;
object.reportCostInfo = options.enums === String ? "STATUS_UNSPECIFIED" : 0;
}
if (message.operationMode != null && message.hasOwnProperty("operationMode"))
object.operationMode = options.enums === String ? $root.Ydb.Operations.OperationParams.OperationMode[message.operationMode] : message.operationMode;
if (message.operationTimeout != null && message.hasOwnProperty("operationTimeout"))
object.operationTimeout = $root.google.protobuf.Duration.toObject(message.operationTimeout, options);
if (message.cancelAfter != null && message.hasOwnProperty("cancelAfter"))
object.cancelAfter = $root.google.protobuf.Duration.toObject(message.cancelAfter, options);
var keys2;
if (message.labels && (keys2 = Object.keys(message.labels)).length) {
object.labels = {};
for (var j = 0; j < keys2.length; ++j)
object.labels[keys2[j]] = message.labels[keys2[j]];
}
if (message.reportCostInfo != null && message.hasOwnProperty("reportCostInfo"))
object.reportCostInfo = options.enums === String ? $root.Ydb.FeatureFlag.Status[message.reportCostInfo] : message.reportCostInfo;
return object;
};
/**
* Converts this OperationParams to JSON.
* @function toJSON
* @me