"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PrivateConnectionServiceClient = exports.PrivateConnectionServiceService = exports.ListPrivateConnectionOperationsResponse = exports.ListPrivateConnectionOperationsRequest = exports.RemoveStaticRouteMetadata = exports.RemoveStaticRouteRequest = exports.UpsertStaticRouteMetadata = exports.UpsertStaticRouteRequest = exports.DeletePrivateConnectionMetadata = exports.DeletePrivateConnectionRequest = exports.UpdatePrivateConnectionMetadata = exports.UpdatePrivateConnectionRequest_LabelsEntry = exports.UpdatePrivateConnectionRequest = exports.CreatePrivateConnectionMetadata = exports.CreatePrivateConnectionRequest_LabelsEntry = exports.CreatePrivateConnectionRequest = exports.ListPrivateConnectionsResponse = exports.ListPrivateConnectionsRequest = exports.GetPrivateConnectionRequest = exports.protobufPackage = void 0;
/* eslint-disable */
const long_1 = __importDefault(require("long"));
const grpc_js_1 = require("@grpc/grpc-js");
const minimal_1 = __importDefault(require("protobufjs/minimal"));
const peering_1 = require("../../../../yandex/cloud/cic/v1/peering");
const field_mask_1 = require("../../../../google/protobuf/field_mask");
const private_connection_1 = require("../../../../yandex/cloud/cic/v1/private_connection");
const operation_1 = require("../../../../yandex/cloud/operation/operation");
const wrappers_1 = require("../../../../google/protobuf/wrappers");
exports.protobufPackage = 'yandex.cloud.cic.v1';
const baseGetPrivateConnectionRequest = { privateConnectionId: '' };
exports.GetPrivateConnectionRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.privateConnectionId !== '') {
            writer.uint32(10).string(message.privateConnectionId);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseGetPrivateConnectionRequest);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.privateConnectionId = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseGetPrivateConnectionRequest);
        message.privateConnectionId =
            object.privateConnectionId !== undefined && object.privateConnectionId !== null
                ? String(object.privateConnectionId)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.privateConnectionId !== undefined &&
            (obj.privateConnectionId = message.privateConnectionId);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseGetPrivateConnectionRequest);
        message.privateConnectionId = (_a = object.privateConnectionId) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
const baseListPrivateConnectionsRequest = {
    folderId: '',
    pageSize: 0,
    pageToken: '',
    filter: '',
};
exports.ListPrivateConnectionsRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.folderId !== '') {
            writer.uint32(10).string(message.folderId);
        }
        if (message.pageSize !== 0) {
            writer.uint32(16).int64(message.pageSize);
        }
        if (message.pageToken !== '') {
            writer.uint32(26).string(message.pageToken);
        }
        if (message.filter !== '') {
            writer.uint32(34).string(message.filter);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseListPrivateConnectionsRequest);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.folderId = reader.string();
                    break;
                case 2:
                    message.pageSize = longToNumber(reader.int64());
                    break;
                case 3:
                    message.pageToken = reader.string();
                    break;
                case 4:
                    message.filter = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseListPrivateConnectionsRequest);
        message.folderId =
            object.folderId !== undefined && object.folderId !== null
                ? String(object.folderId)
                : '';
        message.pageSize =
            object.pageSize !== undefined && object.pageSize !== null ? Number(object.pageSize) : 0;
        message.pageToken =
            object.pageToken !== undefined && object.pageToken !== null
                ? String(object.pageToken)
                : '';
        message.filter =
            object.filter !== undefined && object.filter !== null ? String(object.filter) : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.folderId !== undefined && (obj.folderId = message.folderId);
        message.pageSize !== undefined && (obj.pageSize = Math.round(message.pageSize));
        message.pageToken !== undefined && (obj.pageToken = message.pageToken);
        message.filter !== undefined && (obj.filter = message.filter);
        return obj;
    },
    fromPartial(object) {
        var _a, _b, _c, _d;
        const message = Object.assign({}, baseListPrivateConnectionsRequest);
        message.folderId = (_a = object.folderId) !== null && _a !== void 0 ? _a : '';
        message.pageSize = (_b = object.pageSize) !== null && _b !== void 0 ? _b : 0;
        message.pageToken = (_c = object.pageToken) !== null && _c !== void 0 ? _c : '';
        message.filter = (_d = object.filter) !== null && _d !== void 0 ? _d : '';
        return message;
    },
};
const baseListPrivateConnectionsResponse = { nextPageToken: '' };
exports.ListPrivateConnectionsResponse = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        for (const v of message.privateConnections) {
            private_connection_1.PrivateConnection.encode(v, writer.uint32(10).fork()).ldelim();
        }
        if (message.nextPageToken !== '') {
            writer.uint32(18).string(message.nextPageToken);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseListPrivateConnectionsResponse);
        message.privateConnections = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.privateConnections.push(private_connection_1.PrivateConnection.decode(reader, reader.uint32()));
                    break;
                case 2:
                    message.nextPageToken = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a;
        const message = Object.assign({}, baseListPrivateConnectionsResponse);
        message.privateConnections = ((_a = object.privateConnections) !== null && _a !== void 0 ? _a : []).map((e) => private_connection_1.PrivateConnection.fromJSON(e));
        message.nextPageToken =
            object.nextPageToken !== undefined && object.nextPageToken !== null
                ? String(object.nextPageToken)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        if (message.privateConnections) {
            obj.privateConnections = message.privateConnections.map((e) => e ? private_connection_1.PrivateConnection.toJSON(e) : undefined);
        }
        else {
            obj.privateConnections = [];
        }
        message.nextPageToken !== undefined && (obj.nextPageToken = message.nextPageToken);
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseListPrivateConnectionsResponse);
        message.privateConnections =
            ((_a = object.privateConnections) === null || _a === void 0 ? void 0 : _a.map((e) => private_connection_1.PrivateConnection.fromPartial(e))) || [];
        message.nextPageToken = (_b = object.nextPageToken) !== null && _b !== void 0 ? _b : '';
        return message;
    },
};
const baseCreatePrivateConnectionRequest = {
    name: '',
    description: '',
    folderId: '',
    regionId: '',
    trunkConnectionId: '',
};
exports.CreatePrivateConnectionRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.name !== '') {
            writer.uint32(10).string(message.name);
        }
        if (message.description !== '') {
            writer.uint32(18).string(message.description);
        }
        if (message.folderId !== '') {
            writer.uint32(34).string(message.folderId);
        }
        if (message.regionId !== '') {
            writer.uint32(42).string(message.regionId);
        }
        if (message.trunkConnectionId !== '') {
            writer.uint32(50).string(message.trunkConnectionId);
        }
        if (message.vlanId !== undefined) {
            wrappers_1.Int64Value.encode({ value: message.vlanId }, writer.uint32(58).fork()).ldelim();
        }
        if (message.ipv4Peering !== undefined) {
            peering_1.Peering.encode(message.ipv4Peering, writer.uint32(82).fork()).ldelim();
        }
        for (const v of message.ipv4StaticRoutes) {
            private_connection_1.PrivateConnection_StaticRoute.encode(v, writer.uint32(154).fork()).ldelim();
        }
        Object.entries(message.labels).forEach(([key, value]) => {
            exports.CreatePrivateConnectionRequest_LabelsEntry.encode({ key: key, value }, writer.uint32(210).fork()).ldelim();
        });
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseCreatePrivateConnectionRequest);
        message.ipv4StaticRoutes = [];
        message.labels = {};
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.name = reader.string();
                    break;
                case 2:
                    message.description = reader.string();
                    break;
                case 4:
                    message.folderId = reader.string();
                    break;
                case 5:
                    message.regionId = reader.string();
                    break;
                case 6:
                    message.trunkConnectionId = reader.string();
                    break;
                case 7:
                    message.vlanId = wrappers_1.Int64Value.decode(reader, reader.uint32()).value;
                    break;
                case 10:
                    message.ipv4Peering = peering_1.Peering.decode(reader, reader.uint32());
                    break;
                case 19:
                    message.ipv4StaticRoutes.push(private_connection_1.PrivateConnection_StaticRoute.decode(reader, reader.uint32()));
                    break;
                case 26:
                    const entry26 = exports.CreatePrivateConnectionRequest_LabelsEntry.decode(reader, reader.uint32());
                    if (entry26.value !== undefined) {
                        message.labels[entry26.key] = entry26.value;
                    }
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a, _b;
        const message = Object.assign({}, baseCreatePrivateConnectionRequest);
        message.name = object.name !== undefined && object.name !== null ? String(object.name) : '';
        message.description =
            object.description !== undefined && object.description !== null
                ? String(object.description)
                : '';
        message.folderId =
            object.folderId !== undefined && object.folderId !== null
                ? String(object.folderId)
                : '';
        message.regionId =
            object.regionId !== undefined && object.regionId !== null
                ? String(object.regionId)
                : '';
        message.trunkConnectionId =
            object.trunkConnectionId !== undefined && object.trunkConnectionId !== null
                ? String(object.trunkConnectionId)
                : '';
        message.vlanId =
            object.vlanId !== undefined && object.vlanId !== null
                ? Number(object.vlanId)
                : undefined;
        message.ipv4Peering =
            object.ipv4Peering !== undefined && object.ipv4Peering !== null
                ? peering_1.Peering.fromJSON(object.ipv4Peering)
                : undefined;
        message.ipv4StaticRoutes = ((_a = object.ipv4StaticRoutes) !== null && _a !== void 0 ? _a : []).map((e) => private_connection_1.PrivateConnection_StaticRoute.fromJSON(e));
        message.labels = Object.entries((_b = object.labels) !== null && _b !== void 0 ? _b : {}).reduce((acc, [key, value]) => {
            acc[key] = String(value);
            return acc;
        }, {});
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.name !== undefined && (obj.name = message.name);
        message.description !== undefined && (obj.description = message.description);
        message.folderId !== undefined && (obj.folderId = message.folderId);
        message.regionId !== undefined && (obj.regionId = message.regionId);
        message.trunkConnectionId !== undefined &&
            (obj.trunkConnectionId = message.trunkConnectionId);
        message.vlanId !== undefined && (obj.vlanId = message.vlanId);
        message.ipv4Peering !== undefined &&
            (obj.ipv4Peering = message.ipv4Peering
                ? peering_1.Peering.toJSON(message.ipv4Peering)
                : undefined);
        if (message.ipv4StaticRoutes) {
            obj.ipv4StaticRoutes = message.ipv4StaticRoutes.map((e) => e ? private_connection_1.PrivateConnection_StaticRoute.toJSON(e) : undefined);
        }
        else {
            obj.ipv4StaticRoutes = [];
        }
        obj.labels = {};
        if (message.labels) {
            Object.entries(message.labels).forEach(([k, v]) => {
                obj.labels[k] = v;
            });
        }
        return obj;
    },
    fromPartial(object) {
        var _a, _b, _c, _d, _e, _f, _g, _h;
        const message = Object.assign({}, baseCreatePrivateConnectionRequest);
        message.name = (_a = object.name) !== null && _a !== void 0 ? _a : '';
        message.description = (_b = object.description) !== null && _b !== void 0 ? _b : '';
        message.folderId = (_c = object.folderId) !== null && _c !== void 0 ? _c : '';
        message.regionId = (_d = object.regionId) !== null && _d !== void 0 ? _d : '';
        message.trunkConnectionId = (_e = object.trunkConnectionId) !== null && _e !== void 0 ? _e : '';
        message.vlanId = (_f = object.vlanId) !== null && _f !== void 0 ? _f : undefined;
        message.ipv4Peering =
            object.ipv4Peering !== undefined && object.ipv4Peering !== null
                ? peering_1.Peering.fromPartial(object.ipv4Peering)
                : undefined;
        message.ipv4StaticRoutes =
            ((_g = object.ipv4StaticRoutes) === null || _g === void 0 ? void 0 : _g.map((e) => private_connection_1.PrivateConnection_StaticRoute.fromPartial(e))) || [];
        message.labels = Object.entries((_h = object.labels) !== null && _h !== void 0 ? _h : {}).reduce((acc, [key, value]) => {
            if (value !== undefined) {
                acc[key] = String(value);
            }
            return acc;
        }, {});
        return message;
    },
};
const baseCreatePrivateConnectionRequest_LabelsEntry = { key: '', value: '' };
exports.CreatePrivateConnectionRequest_LabelsEntry = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.key !== '') {
            writer.uint32(10).string(message.key);
        }
        if (message.value !== '') {
            writer.uint32(18).string(message.value);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseCreatePrivateConnectionRequest_LabelsEntry);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.key = reader.string();
                    break;
                case 2:
                    message.value = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseCreatePrivateConnectionRequest_LabelsEntry);
        message.key = object.key !== undefined && object.key !== null ? String(object.key) : '';
        message.value =
            object.value !== undefined && object.value !== null ? String(object.value) : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.key !== undefined && (obj.key = message.key);
        message.value !== undefined && (obj.value = message.value);
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseCreatePrivateConnectionRequest_LabelsEntry);
        message.key = (_a = object.key) !== null && _a !== void 0 ? _a : '';
        message.value = (_b = object.value) !== null && _b !== void 0 ? _b : '';
        return message;
    },
};
const baseCreatePrivateConnectionMetadata = { privateConnectionId: '' };
exports.CreatePrivateConnectionMetadata = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.privateConnectionId !== '') {
            writer.uint32(10).string(message.privateConnectionId);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseCreatePrivateConnectionMetadata);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.privateConnectionId = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseCreatePrivateConnectionMetadata);
        message.privateConnectionId =
            object.privateConnectionId !== undefined && object.privateConnectionId !== null
                ? String(object.privateConnectionId)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.privateConnectionId !== undefined &&
            (obj.privateConnectionId = message.privateConnectionId);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseCreatePrivateConnectionMetadata);
        message.privateConnectionId = (_a = object.privateConnectionId) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
const baseUpdatePrivateConnectionRequest = {
    privateConnectionId: '',
    name: '',
    description: '',
    regionId: '',
    trunkConnectionId: '',
};
exports.UpdatePrivateConnectionRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.privateConnectionId !== '') {
            writer.uint32(10).string(message.privateConnectionId);
        }
        if (message.updateMask !== undefined) {
            field_mask_1.FieldMask.encode(message.updateMask, writer.uint32(18).fork()).ldelim();
        }
        if (message.name !== '') {
            writer.uint32(26).string(message.name);
        }
        if (message.description !== '') {
            writer.uint32(34).string(message.description);
        }
        if (message.regionId !== '') {
            writer.uint32(58).string(message.regionId);
        }
        if (message.trunkConnectionId !== '') {
            writer.uint32(66).string(message.trunkConnectionId);
        }
        if (message.vlanId !== undefined) {
            wrappers_1.Int64Value.encode({ value: message.vlanId }, writer.uint32(74).fork()).ldelim();
        }
        if (message.ipv4Peering !== undefined) {
            peering_1.Peering.encode(message.ipv4Peering, writer.uint32(82).fork()).ldelim();
        }
        for (const v of message.ipv4StaticRoutes) {
            private_connection_1.PrivateConnection_StaticRoute.encode(v, writer.uint32(154).fork()).ldelim();
        }
        Object.entries(message.labels).forEach(([key, value]) => {
            exports.UpdatePrivateConnectionRequest_LabelsEntry.encode({ key: key, value }, writer.uint32(210).fork()).ldelim();
        });
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseUpdatePrivateConnectionRequest);
        message.ipv4StaticRoutes = [];
        message.labels = {};
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.privateConnectionId = reader.string();
                    break;
                case 2:
                    message.updateMask = field_mask_1.FieldMask.decode(reader, reader.uint32());
                    break;
                case 3:
                    message.name = reader.string();
                    break;
                case 4:
                    message.description = reader.string();
                    break;
                case 7:
                    message.regionId = reader.string();
                    break;
                case 8:
                    message.trunkConnectionId = reader.string();
                    break;
                case 9:
                    message.vlanId = wrappers_1.Int64Value.decode(reader, reader.uint32()).value;
                    break;
                case 10:
                    message.ipv4Peering = peering_1.Peering.decode(reader, reader.uint32());
                    break;
                case 19:
                    message.ipv4StaticRoutes.push(private_connection_1.PrivateConnection_StaticRoute.decode(reader, reader.uint32()));
                    break;
                case 26:
                    const entry26 = exports.UpdatePrivateConnectionRequest_LabelsEntry.decode(reader, reader.uint32());
                    if (entry26.value !== undefined) {
                        message.labels[entry26.key] = entry26.value;
                    }
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a, _b;
        const message = Object.assign({}, baseUpdatePrivateConnectionRequest);
        message.privateConnectionId =
            object.privateConnectionId !== undefined && object.privateConnectionId !== null
                ? String(object.privateConnectionId)
                : '';
        message.updateMask =
            object.updateMask !== undefined && object.updateMask !== null
                ? field_mask_1.FieldMask.fromJSON(object.updateMask)
                : undefined;
        message.name = object.name !== undefined && object.name !== null ? String(object.name) : '';
        message.description =
            object.description !== undefined && object.description !== null
                ? String(object.description)
                : '';
        message.regionId =
            object.regionId !== undefined && object.regionId !== null
                ? String(object.regionId)
                : '';
        message.trunkConnectionId =
            object.trunkConnectionId !== undefined && object.trunkConnectionId !== null
                ? String(object.trunkConnectionId)
                : '';
        message.vlanId =
            object.vlanId !== undefined && object.vlanId !== null
                ? Number(object.vlanId)
                : undefined;
        message.ipv4Peering =
            object.ipv4Peering !== undefined && object.ipv4Peering !== null
                ? peering_1.Peering.fromJSON(object.ipv4Peering)
                : undefined;
        message.ipv4StaticRoutes = ((_a = object.ipv4StaticRoutes) !== null && _a !== void 0 ? _a : []).map((e) => private_connection_1.PrivateConnection_StaticRoute.fromJSON(e));
        message.labels = Object.entries((_b = object.labels) !== null && _b !== void 0 ? _b : {}).reduce((acc, [key, value]) => {
            acc[key] = String(value);
            return acc;
        }, {});
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.privateConnectionId !== undefined &&
            (obj.privateConnectionId = message.privateConnectionId);
        message.updateMask !== undefined &&
            (obj.updateMask = message.updateMask
                ? field_mask_1.FieldMask.toJSON(message.updateMask)
                : undefined);
        message.name !== undefined && (obj.name = message.name);
        message.description !== undefined && (obj.description = message.description);
        message.regionId !== undefined && (obj.regionId = message.regionId);
        message.trunkConnectionId !== undefined &&
            (obj.trunkConnectionId = message.trunkConnectionId);
        message.vlanId !== undefined && (obj.vlanId = message.vlanId);
        message.ipv4Peering !== undefined &&
            (obj.ipv4Peering = message.ipv4Peering
                ? peering_1.Peering.toJSON(message.ipv4Peering)
                : undefined);
        if (message.ipv4StaticRoutes) {
            obj.ipv4StaticRoutes = message.ipv4StaticRoutes.map((e) => e ? private_connection_1.PrivateConnection_StaticRoute.toJSON(e) : undefined);
        }
        else {
            obj.ipv4StaticRoutes = [];
        }
        obj.labels = {};
        if (message.labels) {
            Object.entries(message.labels).forEach(([k, v]) => {
                obj.labels[k] = v;
            });
        }
        return obj;
    },
    fromPartial(object) {
        var _a, _b, _c, _d, _e, _f, _g, _h;
        const message = Object.assign({}, baseUpdatePrivateConnectionRequest);
        message.privateConnectionId = (_a = object.privateConnectionId) !== null && _a !== void 0 ? _a : '';
        message.updateMask =
            object.updateMask !== undefined && object.updateMask !== null
                ? field_mask_1.FieldMask.fromPartial(object.updateMask)
                : undefined;
        message.name = (_b = object.name) !== null && _b !== void 0 ? _b : '';
        message.description = (_c = object.description) !== null && _c !== void 0 ? _c : '';
        message.regionId = (_d = object.regionId) !== null && _d !== void 0 ? _d : '';
        message.trunkConnectionId = (_e = object.trunkConnectionId) !== null && _e !== void 0 ? _e : '';
        message.vlanId = (_f = object.vlanId) !== null && _f !== void 0 ? _f : undefined;
        message.ipv4Peering =
            object.ipv4Peering !== undefined && object.ipv4Peering !== null
                ? peering_1.Peering.fromPartial(object.ipv4Peering)
                : undefined;
        message.ipv4StaticRoutes =
            ((_g = object.ipv4StaticRoutes) === null || _g === void 0 ? void 0 : _g.map((e) => private_connection_1.PrivateConnection_StaticRoute.fromPartial(e))) || [];
        message.labels = Object.entries((_h = object.labels) !== null && _h !== void 0 ? _h : {}).reduce((acc, [key, value]) => {
            if (value !== undefined) {
                acc[key] = String(value);
            }
            return acc;
        }, {});
        return message;
    },
};
const baseUpdatePrivateConnectionRequest_LabelsEntry = { key: '', value: '' };
exports.UpdatePrivateConnectionRequest_LabelsEntry = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.key !== '') {
            writer.uint32(10).string(message.key);
        }
        if (message.value !== '') {
            writer.uint32(18).string(message.value);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseUpdatePrivateConnectionRequest_LabelsEntry);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.key = reader.string();
                    break;
                case 2:
                    message.value = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseUpdatePrivateConnectionRequest_LabelsEntry);
        message.key = object.key !== undefined && object.key !== null ? String(object.key) : '';
        message.value =
            object.value !== undefined && object.value !== null ? String(object.value) : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.key !== undefined && (obj.key = message.key);
        message.value !== undefined && (obj.value = message.value);
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseUpdatePrivateConnectionRequest_LabelsEntry);
        message.key = (_a = object.key) !== null && _a !== void 0 ? _a : '';
        message.value = (_b = object.value) !== null && _b !== void 0 ? _b : '';
        return message;
    },
};
const baseUpdatePrivateConnectionMetadata = { privateConnectionId: '' };
exports.UpdatePrivateConnectionMetadata = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.privateConnectionId !== '') {
            writer.uint32(10).string(message.privateConnectionId);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseUpdatePrivateConnectionMetadata);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.privateConnectionId = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseUpdatePrivateConnectionMetadata);
        message.privateConnectionId =
            object.privateConnectionId !== undefined && object.privateConnectionId !== null
                ? String(object.privateConnectionId)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.privateConnectionId !== undefined &&
            (obj.privateConnectionId = message.privateConnectionId);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseUpdatePrivateConnectionMetadata);
        message.privateConnectionId = (_a = object.privateConnectionId) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
const baseDeletePrivateConnectionRequest = { privateConnectionId: '' };
exports.DeletePrivateConnectionRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.privateConnectionId !== '') {
            writer.uint32(10).string(message.privateConnectionId);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseDeletePrivateConnectionRequest);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.privateConnectionId = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseDeletePrivateConnectionRequest);
        message.privateConnectionId =
            object.privateConnectionId !== undefined && object.privateConnectionId !== null
                ? String(object.privateConnectionId)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.privateConnectionId !== undefined &&
            (obj.privateConnectionId = message.privateConnectionId);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseDeletePrivateConnectionRequest);
        message.privateConnectionId = (_a = object.privateConnectionId) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
const baseDeletePrivateConnectionMetadata = { privateConnectionId: '' };
exports.DeletePrivateConnectionMetadata = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.privateConnectionId !== '') {
            writer.uint32(10).string(message.privateConnectionId);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseDeletePrivateConnectionMetadata);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.privateConnectionId = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseDeletePrivateConnectionMetadata);
        message.privateConnectionId =
            object.privateConnectionId !== undefined && object.privateConnectionId !== null
                ? String(object.privateConnectionId)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.privateConnectionId !== undefined &&
            (obj.privateConnectionId = message.privateConnectionId);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseDeletePrivateConnectionMetadata);
        message.privateConnectionId = (_a = object.privateConnectionId) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
const baseUpsertStaticRouteRequest = { privateConnectionId: '' };
exports.UpsertStaticRouteRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.privateConnectionId !== '') {
            writer.uint32(10).string(message.privateConnectionId);
        }
        for (const v of message.ipv4StaticRoutes) {
            private_connection_1.PrivateConnection_StaticRoute.encode(v, writer.uint32(18).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseUpsertStaticRouteRequest);
        message.ipv4StaticRoutes = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.privateConnectionId = reader.string();
                    break;
                case 2:
                    message.ipv4StaticRoutes.push(private_connection_1.PrivateConnection_StaticRoute.decode(reader, reader.uint32()));
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a;
        const message = Object.assign({}, baseUpsertStaticRouteRequest);
        message.privateConnectionId =
            object.privateConnectionId !== undefined && object.privateConnectionId !== null
                ? String(object.privateConnectionId)
                : '';
        message.ipv4StaticRoutes = ((_a = object.ipv4StaticRoutes) !== null && _a !== void 0 ? _a : []).map((e) => private_connection_1.PrivateConnection_StaticRoute.fromJSON(e));
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.privateConnectionId !== undefined &&
            (obj.privateConnectionId = message.privateConnectionId);
        if (message.ipv4StaticRoutes) {
            obj.ipv4StaticRoutes = message.ipv4StaticRoutes.map((e) => e ? private_connection_1.PrivateConnection_StaticRoute.toJSON(e) : undefined);
        }
        else {
            obj.ipv4StaticRoutes = [];
        }
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseUpsertStaticRouteRequest);
        message.privateConnectionId = (_a = object.privateConnectionId) !== null && _a !== void 0 ? _a : '';
        message.ipv4StaticRoutes =
            ((_b = object.ipv4StaticRoutes) === null || _b === void 0 ? void 0 : _b.map((e) => private_connection_1.PrivateConnection_StaticRoute.fromPartial(e))) || [];
        return message;
    },
};
const baseUpsertStaticRouteMetadata = { privateConnectionId: '' };
exports.UpsertStaticRouteMetadata = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.privateConnectionId !== '') {
            writer.uint32(10).string(message.privateConnectionId);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseUpsertStaticRouteMetadata);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.privateConnectionId = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseUpsertStaticRouteMetadata);
        message.privateConnectionId =
            object.privateConnectionId !== undefined && object.privateConnectionId !== null
                ? String(object.privateConnectionId)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.privateConnectionId !== undefined &&
            (obj.privateConnectionId = message.privateConnectionId);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseUpsertStaticRouteMetadata);
        message.privateConnectionId = (_a = object.privateConnectionId) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
const baseRemoveStaticRouteRequest = { privateConnectionId: '' };
exports.RemoveStaticRouteRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.privateConnectionId !== '') {
            writer.uint32(10).string(message.privateConnectionId);
        }
        for (const v of message.ipv4StaticRoutes) {
            private_connection_1.PrivateConnection_StaticRoute.encode(v, writer.uint32(18).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseRemoveStaticRouteRequest);
        message.ipv4StaticRoutes = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.privateConnectionId = reader.string();
                    break;
                case 2:
                    message.ipv4StaticRoutes.push(private_connection_1.PrivateConnection_StaticRoute.decode(reader, reader.uint32()));
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a;
        const message = Object.assign({}, baseRemoveStaticRouteRequest);
        message.privateConnectionId =
            object.privateConnectionId !== undefined && object.privateConnectionId !== null
                ? String(object.privateConnectionId)
                : '';
        message.ipv4StaticRoutes = ((_a = object.ipv4StaticRoutes) !== null && _a !== void 0 ? _a : []).map((e) => private_connection_1.PrivateConnection_StaticRoute.fromJSON(e));
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.privateConnectionId !== undefined &&
            (obj.privateConnectionId = message.privateConnectionId);
        if (message.ipv4StaticRoutes) {
            obj.ipv4StaticRoutes = message.ipv4StaticRoutes.map((e) => e ? private_connection_1.PrivateConnection_StaticRoute.toJSON(e) : undefined);
        }
        else {
            obj.ipv4StaticRoutes = [];
        }
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseRemoveStaticRouteRequest);
        message.privateConnectionId = (_a = object.privateConnectionId) !== null && _a !== void 0 ? _a : '';
        message.ipv4StaticRoutes =
            ((_b = object.ipv4StaticRoutes) === null || _b === void 0 ? void 0 : _b.map((e) => private_connection_1.PrivateConnection_StaticRoute.fromPartial(e))) || [];
        return message;
    },
};
const baseRemoveStaticRouteMetadata = { privateConnectionId: '' };
exports.RemoveStaticRouteMetadata = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.privateConnectionId !== '') {
            writer.uint32(10).string(message.privateConnectionId);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseRemoveStaticRouteMetadata);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.privateConnectionId = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseRemoveStaticRouteMetadata);
        message.privateConnectionId =
            object.privateConnectionId !== undefined && object.privateConnectionId !== null
                ? String(object.privateConnectionId)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.privateConnectionId !== undefined &&
            (obj.privateConnectionId = message.privateConnectionId);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseRemoveStaticRouteMetadata);
        message.privateConnectionId = (_a = object.privateConnectionId) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
const baseListPrivateConnectionOperationsRequest = {
    privateConnectionId: '',
    pageSize: 0,
    pageToken: '',
};
exports.ListPrivateConnectionOperationsRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.privateConnectionId !== '') {
            writer.uint32(10).string(message.privateConnectionId);
        }
        if (message.pageSize !== 0) {
            writer.uint32(16).int64(message.pageSize);
        }
        if (message.pageToken !== '') {
            writer.uint32(26).string(message.pageToken);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseListPrivateConnectionOperationsRequest);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.privateConnectionId = reader.string();
                    break;
                case 2:
                    message.pageSize = longToNumber(reader.int64());
                    break;
                case 3:
                    message.pageToken = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseListPrivateConnectionOperationsRequest);
        message.privateConnectionId =
            object.privateConnectionId !== undefined && object.privateConnectionId !== null
                ? String(object.privateConnectionId)
                : '';
        message.pageSize =
            object.pageSize !== undefined && object.pageSize !== null ? Number(object.pageSize) : 0;
        message.pageToken =
            object.pageToken !== undefined && object.pageToken !== null
                ? String(object.pageToken)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.privateConnectionId !== undefined &&
            (obj.privateConnectionId = message.privateConnectionId);
        message.pageSize !== undefined && (obj.pageSize = Math.round(message.pageSize));
        message.pageToken !== undefined && (obj.pageToken = message.pageToken);
        return obj;
    },
    fromPartial(object) {
        var _a, _b, _c;
        const message = Object.assign({}, baseListPrivateConnectionOperationsRequest);
        message.privateConnectionId = (_a = object.privateConnectionId) !== null && _a !== void 0 ? _a : '';
        message.pageSize = (_b = object.pageSize) !== null && _b !== void 0 ? _b : 0;
        message.pageToken = (_c = object.pageToken) !== null && _c !== void 0 ? _c : '';
        return message;
    },
};
const baseListPrivateConnectionOperationsResponse = { nextPageToken: '' };
exports.ListPrivateConnectionOperationsResponse = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        for (const v of message.operations) {
            operation_1.Operation.encode(v, writer.uint32(10).fork()).ldelim();
        }
        if (message.nextPageToken !== '') {
            writer.uint32(18).string(message.nextPageToken);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseListPrivateConnectionOperationsResponse);
        message.operations = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.operations.push(operation_1.Operation.decode(reader, reader.uint32()));
                    break;
                case 2:
                    message.nextPageToken = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a;
        const message = Object.assign({}, baseListPrivateConnectionOperationsResponse);
        message.operations = ((_a = object.operations) !== null && _a !== void 0 ? _a : []).map((e) => operation_1.Operation.fromJSON(e));
        message.nextPageToken =
            object.nextPageToken !== undefined && object.nextPageToken !== null
                ? String(object.nextPageToken)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        if (message.operations) {
            obj.operations = message.operations.map((e) => (e ? operation_1.Operation.toJSON(e) : undefined));
        }
        else {
            obj.operations = [];
        }
        message.nextPageToken !== undefined && (obj.nextPageToken = message.nextPageToken);
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseListPrivateConnectionOperationsResponse);
        message.operations = ((_a = object.operations) === null || _a === void 0 ? void 0 : _a.map((e) => operation_1.Operation.fromPartial(e))) || [];
        message.nextPageToken = (_b = object.nextPageToken) !== null && _b !== void 0 ? _b : '';
        return message;
    },
};
/** A set of methods for managing PrivateConnection resources. */
exports.PrivateConnectionServiceService = {
    /**
     * Returns the specified PrivateConnection resource.
     *
     * To get the list of available PrivateConnection resources, make a [List] request.
     */
    get: {
        path: '/yandex.cloud.cic.v1.PrivateConnectionService/Get',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.GetPrivateConnectionRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.GetPrivateConnectionRequest.decode(value),
        responseSerialize: (value) => Buffer.from(private_connection_1.PrivateConnection.encode(value).finish()),
        responseDeserialize: (value) => private_connection_1.PrivateConnection.decode(value),
    },
    /** Retrieves the list of PrivateConnection resources in the specified folder. */
    list: {
        path: '/yandex.cloud.cic.v1.PrivateConnectionService/List',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.ListPrivateConnectionsRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.ListPrivateConnectionsRequest.decode(value),
        responseSerialize: (value) => Buffer.from(exports.ListPrivateConnectionsResponse.encode(value).finish()),
        responseDeserialize: (value) => exports.ListPrivateConnectionsResponse.decode(value),
    },
    /**
     * Creates a PrivateConnection resource in the specified folder using the data specified in the request.
     * Method starts an asynchronous operation that can be cancelled while it is in progress.
     */
    create: {
        path: '/yandex.cloud.cic.v1.PrivateConnectionService/Create',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.CreatePrivateConnectionRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.CreatePrivateConnectionRequest.decode(value),
        responseSerialize: (value) => Buffer.from(operation_1.Operation.encode(value).finish()),
        responseDeserialize: (value) => operation_1.Operation.decode(value),
    },
    /**
     * Updates a PrivateConnection resource using the data specified in the request.
     * Method starts an asynchronous operation that can be cancelled while it is in progress.
     */
    update: {
        path: '/yandex.cloud.cic.v1.PrivateConnectionService/Update',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.UpdatePrivateConnectionRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.UpdatePrivateConnectionRequest.decode(value),
        responseSerialize: (value) => Buffer.from(operation_1.Operation.encode(value).finish()),
        responseDeserialize: (value) => operation_1.Operation.decode(value),
    },
    /**
     * Deletes a PrivateConnection resource.
     * Method starts an asynchronous operation that can be cancelled while it is in progress.
     */
    delete: {
        path: '/yandex.cloud.cic.v1.PrivateConnectionService/Delete',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.DeletePrivateConnectionRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.DeletePrivateConnectionRequest.decode(value),
        responseSerialize: (value) => Buffer.from(operation_1.Operation.encode(value).finish()),
        responseDeserialize: (value) => operation_1.Operation.decode(value),
    },
    /**
     * Upserts specified static routes to a PrivateConnection resource.
     * Method starts an asynchronous operation that can be cancelled while it is in progress.
     */
    upsertStaticRoute: {
        path: '/yandex.cloud.cic.v1.PrivateConnectionService/UpsertStaticRoute',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.UpsertStaticRouteRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.UpsertStaticRouteRequest.decode(value),
        responseSerialize: (value) => Buffer.from(operation_1.Operation.encode(value).finish()),
        responseDeserialize: (value) => operation_1.Operation.decode(value),
    },
    /**
     * Removes specified static routes to a PrivateConnection resource.
     * Method starts an asynchronous operation that can be cancelled while it is in progress.
     */
    removeStaticRoute: {
        path: '/yandex.cloud.cic.v1.PrivateConnectionService/RemoveStaticRoute',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.RemoveStaticRouteRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.RemoveStaticRouteRequest.decode(value),
        responseSerialize: (value) => Buffer.from(operation_1.Operation.encode(value).finish()),
        responseDeserialize: (value) => operation_1.Operation.decode(value),
    },
    /** Lists operations for the specified PrivateConnection. */
    listOperations: {
        path: '/yandex.cloud.cic.v1.PrivateConnectionService/ListOperations',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.ListPrivateConnectionOperationsRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.ListPrivateConnectionOperationsRequest.decode(value),
        responseSerialize: (value) => Buffer.from(exports.ListPrivateConnectionOperationsResponse.encode(value).finish()),
        responseDeserialize: (value) => exports.ListPrivateConnectionOperationsResponse.decode(value),
    },
};
exports.PrivateConnectionServiceClient = (0, grpc_js_1.makeGenericClientConstructor)(exports.PrivateConnectionServiceService, 'yandex.cloud.cic.v1.PrivateConnectionService');
var globalThis = (() => {
    if (typeof globalThis !== 'undefined')
        return globalThis;
    if (typeof self !== 'undefined')
        return self;
    if (typeof window !== 'undefined')
        return window;
    if (typeof global !== 'undefined')
        return global;
    throw 'Unable to locate global object';
})();
function longToNumber(long) {
    if (long.gt(Number.MAX_SAFE_INTEGER)) {
        throw new globalThis.Error('Value is larger than Number.MAX_SAFE_INTEGER');
    }
    return long.toNumber();
}
if (minimal_1.default.util.Long !== long_1.default) {
    minimal_1.default.util.Long = long_1.default;
    minimal_1.default.configure();
}
