1 /*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/
4 var $protobuf = require("protobufjs/minimal");
7 var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
9 // Exported root namespace
10 var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {});
12 $root.grpc = (function() {
21 grpc.gcp = (function() {
30 gcp.ApiConfig = (function() {
33 * Properties of an ApiConfig.
35 * @interface IApiConfig
36 * @property {grpc.gcp.IChannelPoolConfig|null} [channelPool] ApiConfig channelPool
37 * @property {Array.<grpc.gcp.IMethodConfig>|null} [method] ApiConfig method
41 * Constructs a new ApiConfig.
43 * @classdesc Represents an ApiConfig.
44 * @implements IApiConfig
46 * @param {grpc.gcp.IApiConfig=} [properties] Properties to set
48 function ApiConfig(properties) {
51 for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
52 if (properties[keys[i]] != null)
53 this[keys[i]] = properties[keys[i]];
57 * ApiConfig channelPool.
58 * @member {grpc.gcp.IChannelPoolConfig|null|undefined} channelPool
59 * @memberof grpc.gcp.ApiConfig
62 ApiConfig.prototype.channelPool = null;
66 * @member {Array.<grpc.gcp.IMethodConfig>} method
67 * @memberof grpc.gcp.ApiConfig
70 ApiConfig.prototype.method = $util.emptyArray;
73 * Creates a new ApiConfig instance using the specified properties.
75 * @memberof grpc.gcp.ApiConfig
77 * @param {grpc.gcp.IApiConfig=} [properties] Properties to set
78 * @returns {grpc.gcp.ApiConfig} ApiConfig instance
80 ApiConfig.create = function create(properties) {
81 return new ApiConfig(properties);
85 * Encodes the specified ApiConfig message. Does not implicitly {@link grpc.gcp.ApiConfig.verify|verify} messages.
87 * @memberof grpc.gcp.ApiConfig
89 * @param {grpc.gcp.IApiConfig} message ApiConfig message or plain object to encode
90 * @param {$protobuf.Writer} [writer] Writer to encode to
91 * @returns {$protobuf.Writer} Writer
93 ApiConfig.encode = function encode(message, writer) {
95 writer = $Writer.create();
96 if (message.channelPool != null && message.hasOwnProperty("channelPool"))
97 $root.grpc.gcp.ChannelPoolConfig.encode(message.channelPool, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
98 if (message.method != null && message.method.length)
99 for (var i = 0; i < message.method.length; ++i)
100 $root.grpc.gcp.MethodConfig.encode(message.method[i], writer.uint32(/* id 1001, wireType 2 =*/8010).fork()).ldelim();
105 * Encodes the specified ApiConfig message, length delimited. Does not implicitly {@link grpc.gcp.ApiConfig.verify|verify} messages.
106 * @function encodeDelimited
107 * @memberof grpc.gcp.ApiConfig
109 * @param {grpc.gcp.IApiConfig} message ApiConfig message or plain object to encode
110 * @param {$protobuf.Writer} [writer] Writer to encode to
111 * @returns {$protobuf.Writer} Writer
113 ApiConfig.encodeDelimited = function encodeDelimited(message, writer) {
114 return this.encode(message, writer).ldelim();
118 * Decodes an ApiConfig message from the specified reader or buffer.
120 * @memberof grpc.gcp.ApiConfig
122 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
123 * @param {number} [length] Message length if known beforehand
124 * @returns {grpc.gcp.ApiConfig} ApiConfig
125 * @throws {Error} If the payload is not a reader or valid buffer
126 * @throws {$protobuf.util.ProtocolError} If required fields are missing
128 ApiConfig.decode = function decode(reader, length) {
129 if (!(reader instanceof $Reader))
130 reader = $Reader.create(reader);
131 var end = length === undefined ? reader.len : reader.pos + length, message = new $root.grpc.gcp.ApiConfig();
132 while (reader.pos < end) {
133 var tag = reader.uint32();
136 message.channelPool = $root.grpc.gcp.ChannelPoolConfig.decode(reader, reader.uint32());
139 if (!(message.method && message.method.length))
141 message.method.push($root.grpc.gcp.MethodConfig.decode(reader, reader.uint32()));
144 reader.skipType(tag & 7);
152 * Decodes an ApiConfig message from the specified reader or buffer, length delimited.
153 * @function decodeDelimited
154 * @memberof grpc.gcp.ApiConfig
156 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
157 * @returns {grpc.gcp.ApiConfig} ApiConfig
158 * @throws {Error} If the payload is not a reader or valid buffer
159 * @throws {$protobuf.util.ProtocolError} If required fields are missing
161 ApiConfig.decodeDelimited = function decodeDelimited(reader) {
162 if (!(reader instanceof $Reader))
163 reader = new $Reader(reader);
164 return this.decode(reader, reader.uint32());
168 * Verifies an ApiConfig message.
170 * @memberof grpc.gcp.ApiConfig
172 * @param {Object.<string,*>} message Plain object to verify
173 * @returns {string|null} `null` if valid, otherwise the reason why it is not
175 ApiConfig.verify = function verify(message) {
176 if (typeof message !== "object" || message === null)
177 return "object expected";
178 if (message.channelPool != null && message.hasOwnProperty("channelPool")) {
179 var error = $root.grpc.gcp.ChannelPoolConfig.verify(message.channelPool);
181 return "channelPool." + error;
183 if (message.method != null && message.hasOwnProperty("method")) {
184 if (!Array.isArray(message.method))
185 return "method: array expected";
186 for (var i = 0; i < message.method.length; ++i) {
187 var error = $root.grpc.gcp.MethodConfig.verify(message.method[i]);
189 return "method." + error;
196 * Creates an ApiConfig message from a plain object. Also converts values to their respective internal types.
197 * @function fromObject
198 * @memberof grpc.gcp.ApiConfig
200 * @param {Object.<string,*>} object Plain object
201 * @returns {grpc.gcp.ApiConfig} ApiConfig
203 ApiConfig.fromObject = function fromObject(object) {
204 if (object instanceof $root.grpc.gcp.ApiConfig)
206 var message = new $root.grpc.gcp.ApiConfig();
207 if (object.channelPool != null) {
208 if (typeof object.channelPool !== "object")
209 throw TypeError(".grpc.gcp.ApiConfig.channelPool: object expected");
210 message.channelPool = $root.grpc.gcp.ChannelPoolConfig.fromObject(object.channelPool);
213 if (!Array.isArray(object.method))
214 throw TypeError(".grpc.gcp.ApiConfig.method: array expected");
216 for (var i = 0; i < object.method.length; ++i) {
217 if (typeof object.method[i] !== "object")
218 throw TypeError(".grpc.gcp.ApiConfig.method: object expected");
219 message.method[i] = $root.grpc.gcp.MethodConfig.fromObject(object.method[i]);
226 * Creates a plain object from an ApiConfig message. Also converts values to other types if specified.
228 * @memberof grpc.gcp.ApiConfig
230 * @param {grpc.gcp.ApiConfig} message ApiConfig
231 * @param {$protobuf.IConversionOptions} [options] Conversion options
232 * @returns {Object.<string,*>} Plain object
234 ApiConfig.toObject = function toObject(message, options) {
238 if (options.arrays || options.defaults)
240 if (options.defaults)
241 object.channelPool = null;
242 if (message.channelPool != null && message.hasOwnProperty("channelPool"))
243 object.channelPool = $root.grpc.gcp.ChannelPoolConfig.toObject(message.channelPool, options);
244 if (message.method && message.method.length) {
246 for (var j = 0; j < message.method.length; ++j)
247 object.method[j] = $root.grpc.gcp.MethodConfig.toObject(message.method[j], options);
253 * Converts this ApiConfig to JSON.
255 * @memberof grpc.gcp.ApiConfig
257 * @returns {Object.<string,*>} JSON object
259 ApiConfig.prototype.toJSON = function toJSON() {
260 return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
266 gcp.ChannelPoolConfig = (function() {
269 * Properties of a ChannelPoolConfig.
271 * @interface IChannelPoolConfig
272 * @property {number|null} [maxSize] ChannelPoolConfig maxSize
273 * @property {number|Long|null} [idleTimeout] ChannelPoolConfig idleTimeout
274 * @property {number|null} [maxConcurrentStreamsLowWatermark] ChannelPoolConfig maxConcurrentStreamsLowWatermark
278 * Constructs a new ChannelPoolConfig.
280 * @classdesc Represents a ChannelPoolConfig.
281 * @implements IChannelPoolConfig
283 * @param {grpc.gcp.IChannelPoolConfig=} [properties] Properties to set
285 function ChannelPoolConfig(properties) {
287 for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
288 if (properties[keys[i]] != null)
289 this[keys[i]] = properties[keys[i]];
293 * ChannelPoolConfig maxSize.
294 * @member {number} maxSize
295 * @memberof grpc.gcp.ChannelPoolConfig
298 ChannelPoolConfig.prototype.maxSize = 0;
301 * ChannelPoolConfig idleTimeout.
302 * @member {number|Long} idleTimeout
303 * @memberof grpc.gcp.ChannelPoolConfig
306 ChannelPoolConfig.prototype.idleTimeout = $util.Long ? $util.Long.fromBits(0,0,true) : 0;
309 * ChannelPoolConfig maxConcurrentStreamsLowWatermark.
310 * @member {number} maxConcurrentStreamsLowWatermark
311 * @memberof grpc.gcp.ChannelPoolConfig
314 ChannelPoolConfig.prototype.maxConcurrentStreamsLowWatermark = 0;
317 * Creates a new ChannelPoolConfig instance using the specified properties.
319 * @memberof grpc.gcp.ChannelPoolConfig
321 * @param {grpc.gcp.IChannelPoolConfig=} [properties] Properties to set
322 * @returns {grpc.gcp.ChannelPoolConfig} ChannelPoolConfig instance
324 ChannelPoolConfig.create = function create(properties) {
325 return new ChannelPoolConfig(properties);
329 * Encodes the specified ChannelPoolConfig message. Does not implicitly {@link grpc.gcp.ChannelPoolConfig.verify|verify} messages.
331 * @memberof grpc.gcp.ChannelPoolConfig
333 * @param {grpc.gcp.IChannelPoolConfig} message ChannelPoolConfig message or plain object to encode
334 * @param {$protobuf.Writer} [writer] Writer to encode to
335 * @returns {$protobuf.Writer} Writer
337 ChannelPoolConfig.encode = function encode(message, writer) {
339 writer = $Writer.create();
340 if (message.maxSize != null && message.hasOwnProperty("maxSize"))
341 writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.maxSize);
342 if (message.idleTimeout != null && message.hasOwnProperty("idleTimeout"))
343 writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.idleTimeout);
344 if (message.maxConcurrentStreamsLowWatermark != null && message.hasOwnProperty("maxConcurrentStreamsLowWatermark"))
345 writer.uint32(/* id 3, wireType 0 =*/24).uint32(message.maxConcurrentStreamsLowWatermark);
350 * Encodes the specified ChannelPoolConfig message, length delimited. Does not implicitly {@link grpc.gcp.ChannelPoolConfig.verify|verify} messages.
351 * @function encodeDelimited
352 * @memberof grpc.gcp.ChannelPoolConfig
354 * @param {grpc.gcp.IChannelPoolConfig} message ChannelPoolConfig message or plain object to encode
355 * @param {$protobuf.Writer} [writer] Writer to encode to
356 * @returns {$protobuf.Writer} Writer
358 ChannelPoolConfig.encodeDelimited = function encodeDelimited(message, writer) {
359 return this.encode(message, writer).ldelim();
363 * Decodes a ChannelPoolConfig message from the specified reader or buffer.
365 * @memberof grpc.gcp.ChannelPoolConfig
367 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
368 * @param {number} [length] Message length if known beforehand
369 * @returns {grpc.gcp.ChannelPoolConfig} ChannelPoolConfig
370 * @throws {Error} If the payload is not a reader or valid buffer
371 * @throws {$protobuf.util.ProtocolError} If required fields are missing
373 ChannelPoolConfig.decode = function decode(reader, length) {
374 if (!(reader instanceof $Reader))
375 reader = $Reader.create(reader);
376 var end = length === undefined ? reader.len : reader.pos + length, message = new $root.grpc.gcp.ChannelPoolConfig();
377 while (reader.pos < end) {
378 var tag = reader.uint32();
381 message.maxSize = reader.uint32();
384 message.idleTimeout = reader.uint64();
387 message.maxConcurrentStreamsLowWatermark = reader.uint32();
390 reader.skipType(tag & 7);
398 * Decodes a ChannelPoolConfig message from the specified reader or buffer, length delimited.
399 * @function decodeDelimited
400 * @memberof grpc.gcp.ChannelPoolConfig
402 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
403 * @returns {grpc.gcp.ChannelPoolConfig} ChannelPoolConfig
404 * @throws {Error} If the payload is not a reader or valid buffer
405 * @throws {$protobuf.util.ProtocolError} If required fields are missing
407 ChannelPoolConfig.decodeDelimited = function decodeDelimited(reader) {
408 if (!(reader instanceof $Reader))
409 reader = new $Reader(reader);
410 return this.decode(reader, reader.uint32());
414 * Verifies a ChannelPoolConfig message.
416 * @memberof grpc.gcp.ChannelPoolConfig
418 * @param {Object.<string,*>} message Plain object to verify
419 * @returns {string|null} `null` if valid, otherwise the reason why it is not
421 ChannelPoolConfig.verify = function verify(message) {
422 if (typeof message !== "object" || message === null)
423 return "object expected";
424 if (message.maxSize != null && message.hasOwnProperty("maxSize"))
425 if (!$util.isInteger(message.maxSize))
426 return "maxSize: integer expected";
427 if (message.idleTimeout != null && message.hasOwnProperty("idleTimeout"))
428 if (!$util.isInteger(message.idleTimeout) && !(message.idleTimeout && $util.isInteger(message.idleTimeout.low) && $util.isInteger(message.idleTimeout.high)))
429 return "idleTimeout: integer|Long expected";
430 if (message.maxConcurrentStreamsLowWatermark != null && message.hasOwnProperty("maxConcurrentStreamsLowWatermark"))
431 if (!$util.isInteger(message.maxConcurrentStreamsLowWatermark))
432 return "maxConcurrentStreamsLowWatermark: integer expected";
437 * Creates a ChannelPoolConfig message from a plain object. Also converts values to their respective internal types.
438 * @function fromObject
439 * @memberof grpc.gcp.ChannelPoolConfig
441 * @param {Object.<string,*>} object Plain object
442 * @returns {grpc.gcp.ChannelPoolConfig} ChannelPoolConfig
444 ChannelPoolConfig.fromObject = function fromObject(object) {
445 if (object instanceof $root.grpc.gcp.ChannelPoolConfig)
447 var message = new $root.grpc.gcp.ChannelPoolConfig();
448 if (object.maxSize != null)
449 message.maxSize = object.maxSize >>> 0;
450 if (object.idleTimeout != null)
452 (message.idleTimeout = $util.Long.fromValue(object.idleTimeout)).unsigned = true;
453 else if (typeof object.idleTimeout === "string")
454 message.idleTimeout = parseInt(object.idleTimeout, 10);
455 else if (typeof object.idleTimeout === "number")
456 message.idleTimeout = object.idleTimeout;
457 else if (typeof object.idleTimeout === "object")
458 message.idleTimeout = new $util.LongBits(object.idleTimeout.low >>> 0, object.idleTimeout.high >>> 0).toNumber(true);
459 if (object.maxConcurrentStreamsLowWatermark != null)
460 message.maxConcurrentStreamsLowWatermark = object.maxConcurrentStreamsLowWatermark >>> 0;
465 * Creates a plain object from a ChannelPoolConfig message. Also converts values to other types if specified.
467 * @memberof grpc.gcp.ChannelPoolConfig
469 * @param {grpc.gcp.ChannelPoolConfig} message ChannelPoolConfig
470 * @param {$protobuf.IConversionOptions} [options] Conversion options
471 * @returns {Object.<string,*>} Plain object
473 ChannelPoolConfig.toObject = function toObject(message, options) {
477 if (options.defaults) {
480 var long = new $util.Long(0, 0, true);
481 object.idleTimeout = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
483 object.idleTimeout = options.longs === String ? "0" : 0;
484 object.maxConcurrentStreamsLowWatermark = 0;
486 if (message.maxSize != null && message.hasOwnProperty("maxSize"))
487 object.maxSize = message.maxSize;
488 if (message.idleTimeout != null && message.hasOwnProperty("idleTimeout"))
489 if (typeof message.idleTimeout === "number")
490 object.idleTimeout = options.longs === String ? String(message.idleTimeout) : message.idleTimeout;
492 object.idleTimeout = options.longs === String ? $util.Long.prototype.toString.call(message.idleTimeout) : options.longs === Number ? new $util.LongBits(message.idleTimeout.low >>> 0, message.idleTimeout.high >>> 0).toNumber(true) : message.idleTimeout;
493 if (message.maxConcurrentStreamsLowWatermark != null && message.hasOwnProperty("maxConcurrentStreamsLowWatermark"))
494 object.maxConcurrentStreamsLowWatermark = message.maxConcurrentStreamsLowWatermark;
499 * Converts this ChannelPoolConfig to JSON.
501 * @memberof grpc.gcp.ChannelPoolConfig
503 * @returns {Object.<string,*>} JSON object
505 ChannelPoolConfig.prototype.toJSON = function toJSON() {
506 return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
509 return ChannelPoolConfig;
512 gcp.MethodConfig = (function() {
515 * Properties of a MethodConfig.
517 * @interface IMethodConfig
518 * @property {Array.<string>|null} [name] MethodConfig name
519 * @property {grpc.gcp.IAffinityConfig|null} [affinity] MethodConfig affinity
523 * Constructs a new MethodConfig.
525 * @classdesc Represents a MethodConfig.
526 * @implements IMethodConfig
528 * @param {grpc.gcp.IMethodConfig=} [properties] Properties to set
530 function MethodConfig(properties) {
533 for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
534 if (properties[keys[i]] != null)
535 this[keys[i]] = properties[keys[i]];
540 * @member {Array.<string>} name
541 * @memberof grpc.gcp.MethodConfig
544 MethodConfig.prototype.name = $util.emptyArray;
547 * MethodConfig affinity.
548 * @member {grpc.gcp.IAffinityConfig|null|undefined} affinity
549 * @memberof grpc.gcp.MethodConfig
552 MethodConfig.prototype.affinity = null;
555 * Creates a new MethodConfig instance using the specified properties.
557 * @memberof grpc.gcp.MethodConfig
559 * @param {grpc.gcp.IMethodConfig=} [properties] Properties to set
560 * @returns {grpc.gcp.MethodConfig} MethodConfig instance
562 MethodConfig.create = function create(properties) {
563 return new MethodConfig(properties);
567 * Encodes the specified MethodConfig message. Does not implicitly {@link grpc.gcp.MethodConfig.verify|verify} messages.
569 * @memberof grpc.gcp.MethodConfig
571 * @param {grpc.gcp.IMethodConfig} message MethodConfig message or plain object to encode
572 * @param {$protobuf.Writer} [writer] Writer to encode to
573 * @returns {$protobuf.Writer} Writer
575 MethodConfig.encode = function encode(message, writer) {
577 writer = $Writer.create();
578 if (message.name != null && message.name.length)
579 for (var i = 0; i < message.name.length; ++i)
580 writer.uint32(/* id 1, wireType 2 =*/10).string(message.name[i]);
581 if (message.affinity != null && message.hasOwnProperty("affinity"))
582 $root.grpc.gcp.AffinityConfig.encode(message.affinity, writer.uint32(/* id 1001, wireType 2 =*/8010).fork()).ldelim();
587 * Encodes the specified MethodConfig message, length delimited. Does not implicitly {@link grpc.gcp.MethodConfig.verify|verify} messages.
588 * @function encodeDelimited
589 * @memberof grpc.gcp.MethodConfig
591 * @param {grpc.gcp.IMethodConfig} message MethodConfig message or plain object to encode
592 * @param {$protobuf.Writer} [writer] Writer to encode to
593 * @returns {$protobuf.Writer} Writer
595 MethodConfig.encodeDelimited = function encodeDelimited(message, writer) {
596 return this.encode(message, writer).ldelim();
600 * Decodes a MethodConfig message from the specified reader or buffer.
602 * @memberof grpc.gcp.MethodConfig
604 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
605 * @param {number} [length] Message length if known beforehand
606 * @returns {grpc.gcp.MethodConfig} MethodConfig
607 * @throws {Error} If the payload is not a reader or valid buffer
608 * @throws {$protobuf.util.ProtocolError} If required fields are missing
610 MethodConfig.decode = function decode(reader, length) {
611 if (!(reader instanceof $Reader))
612 reader = $Reader.create(reader);
613 var end = length === undefined ? reader.len : reader.pos + length, message = new $root.grpc.gcp.MethodConfig();
614 while (reader.pos < end) {
615 var tag = reader.uint32();
618 if (!(message.name && message.name.length))
620 message.name.push(reader.string());
623 message.affinity = $root.grpc.gcp.AffinityConfig.decode(reader, reader.uint32());
626 reader.skipType(tag & 7);
634 * Decodes a MethodConfig message from the specified reader or buffer, length delimited.
635 * @function decodeDelimited
636 * @memberof grpc.gcp.MethodConfig
638 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
639 * @returns {grpc.gcp.MethodConfig} MethodConfig
640 * @throws {Error} If the payload is not a reader or valid buffer
641 * @throws {$protobuf.util.ProtocolError} If required fields are missing
643 MethodConfig.decodeDelimited = function decodeDelimited(reader) {
644 if (!(reader instanceof $Reader))
645 reader = new $Reader(reader);
646 return this.decode(reader, reader.uint32());
650 * Verifies a MethodConfig message.
652 * @memberof grpc.gcp.MethodConfig
654 * @param {Object.<string,*>} message Plain object to verify
655 * @returns {string|null} `null` if valid, otherwise the reason why it is not
657 MethodConfig.verify = function verify(message) {
658 if (typeof message !== "object" || message === null)
659 return "object expected";
660 if (message.name != null && message.hasOwnProperty("name")) {
661 if (!Array.isArray(message.name))
662 return "name: array expected";
663 for (var i = 0; i < message.name.length; ++i)
664 if (!$util.isString(message.name[i]))
665 return "name: string[] expected";
667 if (message.affinity != null && message.hasOwnProperty("affinity")) {
668 var error = $root.grpc.gcp.AffinityConfig.verify(message.affinity);
670 return "affinity." + error;
676 * Creates a MethodConfig message from a plain object. Also converts values to their respective internal types.
677 * @function fromObject
678 * @memberof grpc.gcp.MethodConfig
680 * @param {Object.<string,*>} object Plain object
681 * @returns {grpc.gcp.MethodConfig} MethodConfig
683 MethodConfig.fromObject = function fromObject(object) {
684 if (object instanceof $root.grpc.gcp.MethodConfig)
686 var message = new $root.grpc.gcp.MethodConfig();
688 if (!Array.isArray(object.name))
689 throw TypeError(".grpc.gcp.MethodConfig.name: array expected");
691 for (var i = 0; i < object.name.length; ++i)
692 message.name[i] = String(object.name[i]);
694 if (object.affinity != null) {
695 if (typeof object.affinity !== "object")
696 throw TypeError(".grpc.gcp.MethodConfig.affinity: object expected");
697 message.affinity = $root.grpc.gcp.AffinityConfig.fromObject(object.affinity);
703 * Creates a plain object from a MethodConfig message. Also converts values to other types if specified.
705 * @memberof grpc.gcp.MethodConfig
707 * @param {grpc.gcp.MethodConfig} message MethodConfig
708 * @param {$protobuf.IConversionOptions} [options] Conversion options
709 * @returns {Object.<string,*>} Plain object
711 MethodConfig.toObject = function toObject(message, options) {
715 if (options.arrays || options.defaults)
717 if (options.defaults)
718 object.affinity = null;
719 if (message.name && message.name.length) {
721 for (var j = 0; j < message.name.length; ++j)
722 object.name[j] = message.name[j];
724 if (message.affinity != null && message.hasOwnProperty("affinity"))
725 object.affinity = $root.grpc.gcp.AffinityConfig.toObject(message.affinity, options);
730 * Converts this MethodConfig to JSON.
732 * @memberof grpc.gcp.MethodConfig
734 * @returns {Object.<string,*>} JSON object
736 MethodConfig.prototype.toJSON = function toJSON() {
737 return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
743 gcp.AffinityConfig = (function() {
746 * Properties of an AffinityConfig.
748 * @interface IAffinityConfig
749 * @property {grpc.gcp.AffinityConfig.Command|null} [command] AffinityConfig command
750 * @property {string|null} [affinityKey] AffinityConfig affinityKey
754 * Constructs a new AffinityConfig.
756 * @classdesc Represents an AffinityConfig.
757 * @implements IAffinityConfig
759 * @param {grpc.gcp.IAffinityConfig=} [properties] Properties to set
761 function AffinityConfig(properties) {
763 for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
764 if (properties[keys[i]] != null)
765 this[keys[i]] = properties[keys[i]];
769 * AffinityConfig command.
770 * @member {grpc.gcp.AffinityConfig.Command} command
771 * @memberof grpc.gcp.AffinityConfig
774 AffinityConfig.prototype.command = 0;
777 * AffinityConfig affinityKey.
778 * @member {string} affinityKey
779 * @memberof grpc.gcp.AffinityConfig
782 AffinityConfig.prototype.affinityKey = "";
785 * Creates a new AffinityConfig instance using the specified properties.
787 * @memberof grpc.gcp.AffinityConfig
789 * @param {grpc.gcp.IAffinityConfig=} [properties] Properties to set
790 * @returns {grpc.gcp.AffinityConfig} AffinityConfig instance
792 AffinityConfig.create = function create(properties) {
793 return new AffinityConfig(properties);
797 * Encodes the specified AffinityConfig message. Does not implicitly {@link grpc.gcp.AffinityConfig.verify|verify} messages.
799 * @memberof grpc.gcp.AffinityConfig
801 * @param {grpc.gcp.IAffinityConfig} message AffinityConfig message or plain object to encode
802 * @param {$protobuf.Writer} [writer] Writer to encode to
803 * @returns {$protobuf.Writer} Writer
805 AffinityConfig.encode = function encode(message, writer) {
807 writer = $Writer.create();
808 if (message.command != null && message.hasOwnProperty("command"))
809 writer.uint32(/* id 2, wireType 0 =*/16).int32(message.command);
810 if (message.affinityKey != null && message.hasOwnProperty("affinityKey"))
811 writer.uint32(/* id 3, wireType 2 =*/26).string(message.affinityKey);
816 * Encodes the specified AffinityConfig message, length delimited. Does not implicitly {@link grpc.gcp.AffinityConfig.verify|verify} messages.
817 * @function encodeDelimited
818 * @memberof grpc.gcp.AffinityConfig
820 * @param {grpc.gcp.IAffinityConfig} message AffinityConfig message or plain object to encode
821 * @param {$protobuf.Writer} [writer] Writer to encode to
822 * @returns {$protobuf.Writer} Writer
824 AffinityConfig.encodeDelimited = function encodeDelimited(message, writer) {
825 return this.encode(message, writer).ldelim();
829 * Decodes an AffinityConfig message from the specified reader or buffer.
831 * @memberof grpc.gcp.AffinityConfig
833 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
834 * @param {number} [length] Message length if known beforehand
835 * @returns {grpc.gcp.AffinityConfig} AffinityConfig
836 * @throws {Error} If the payload is not a reader or valid buffer
837 * @throws {$protobuf.util.ProtocolError} If required fields are missing
839 AffinityConfig.decode = function decode(reader, length) {
840 if (!(reader instanceof $Reader))
841 reader = $Reader.create(reader);
842 var end = length === undefined ? reader.len : reader.pos + length, message = new $root.grpc.gcp.AffinityConfig();
843 while (reader.pos < end) {
844 var tag = reader.uint32();
847 message.command = reader.int32();
850 message.affinityKey = reader.string();
853 reader.skipType(tag & 7);
861 * Decodes an AffinityConfig message from the specified reader or buffer, length delimited.
862 * @function decodeDelimited
863 * @memberof grpc.gcp.AffinityConfig
865 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
866 * @returns {grpc.gcp.AffinityConfig} AffinityConfig
867 * @throws {Error} If the payload is not a reader or valid buffer
868 * @throws {$protobuf.util.ProtocolError} If required fields are missing
870 AffinityConfig.decodeDelimited = function decodeDelimited(reader) {
871 if (!(reader instanceof $Reader))
872 reader = new $Reader(reader);
873 return this.decode(reader, reader.uint32());
877 * Verifies an AffinityConfig message.
879 * @memberof grpc.gcp.AffinityConfig
881 * @param {Object.<string,*>} message Plain object to verify
882 * @returns {string|null} `null` if valid, otherwise the reason why it is not
884 AffinityConfig.verify = function verify(message) {
885 if (typeof message !== "object" || message === null)
886 return "object expected";
887 if (message.command != null && message.hasOwnProperty("command"))
888 switch (message.command) {
890 return "command: enum value expected";
896 if (message.affinityKey != null && message.hasOwnProperty("affinityKey"))
897 if (!$util.isString(message.affinityKey))
898 return "affinityKey: string expected";
903 * Creates an AffinityConfig message from a plain object. Also converts values to their respective internal types.
904 * @function fromObject
905 * @memberof grpc.gcp.AffinityConfig
907 * @param {Object.<string,*>} object Plain object
908 * @returns {grpc.gcp.AffinityConfig} AffinityConfig
910 AffinityConfig.fromObject = function fromObject(object) {
911 if (object instanceof $root.grpc.gcp.AffinityConfig)
913 var message = new $root.grpc.gcp.AffinityConfig();
914 switch (object.command) {
928 if (object.affinityKey != null)
929 message.affinityKey = String(object.affinityKey);
934 * Creates a plain object from an AffinityConfig message. Also converts values to other types if specified.
936 * @memberof grpc.gcp.AffinityConfig
938 * @param {grpc.gcp.AffinityConfig} message AffinityConfig
939 * @param {$protobuf.IConversionOptions} [options] Conversion options
940 * @returns {Object.<string,*>} Plain object
942 AffinityConfig.toObject = function toObject(message, options) {
946 if (options.defaults) {
947 object.command = options.enums === String ? "BOUND" : 0;
948 object.affinityKey = "";
950 if (message.command != null && message.hasOwnProperty("command"))
951 object.command = options.enums === String ? $root.grpc.gcp.AffinityConfig.Command[message.command] : message.command;
952 if (message.affinityKey != null && message.hasOwnProperty("affinityKey"))
953 object.affinityKey = message.affinityKey;
958 * Converts this AffinityConfig to JSON.
960 * @memberof grpc.gcp.AffinityConfig
962 * @returns {Object.<string,*>} JSON object
964 AffinityConfig.prototype.toJSON = function toJSON() {
965 return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
970 * @name grpc.gcp.AffinityConfig.Command
972 * @property {number} BOUND=0 BOUND value
973 * @property {number} BIND=1 BIND value
974 * @property {number} UNBIND=2 UNBIND value
976 AffinityConfig.Command = (function() {
977 var valuesById = {}, values = Object.create(valuesById);
978 values[valuesById[0] = "BOUND"] = 0;
979 values[valuesById[1] = "BIND"] = 1;
980 values[valuesById[2] = "UNBIND"] = 2;
984 return AffinityConfig;
993 module.exports = $root;