"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PrivateEndpointServiceClient = exports.PrivateEndpointServiceService = exports.ListPrivateEndpointOperationsResponse = exports.ListPrivateEndpointOperationsRequest = exports.ListPrivateEndpointsResponse = exports.ListPrivateEndpointsRequest = exports.DeletePrivateEndpointMetadata = exports.DeletePrivateEndpointRequest = exports.UpdatePrivateEndpointMetadata = exports.UpdatePrivateEndpointRequest_LabelsEntry = exports.UpdatePrivateEndpointRequest = exports.CreatePrivateEndpointMetadata = exports.CreatePrivateEndpointRequest_LabelsEntry = exports.CreatePrivateEndpointRequest = exports.AddressSpec = exports.InternalIpv4AddressSpec = exports.GetPrivateEndpointRequest = 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 private_endpoint_1 = require("../../../../../yandex/cloud/vpc/v1/privatelink/private_endpoint");
const field_mask_1 = require("../../../../../google/protobuf/field_mask");
const operation_1 = require("../../../../../yandex/cloud/operation/operation");
exports.protobufPackage = 'yandex.cloud.vpc.v1.privatelink';
const baseGetPrivateEndpointRequest = { privateEndpointId: '' };
exports.GetPrivateEndpointRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.privateEndpointId !== '') {
            writer.uint32(10).string(message.privateEndpointId);
        }
        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({}, baseGetPrivateEndpointRequest);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.privateEndpointId = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseGetPrivateEndpointRequest);
        message.privateEndpointId =
            object.privateEndpointId !== undefined && object.privateEndpointId !== null
                ? String(object.privateEndpointId)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.privateEndpointId !== undefined &&
            (obj.privateEndpointId = message.privateEndpointId);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseGetPrivateEndpointRequest);
        message.privateEndpointId = (_a = object.privateEndpointId) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
const baseInternalIpv4AddressSpec = { subnetId: '', address: '' };
exports.InternalIpv4AddressSpec = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.subnetId !== '') {
            writer.uint32(10).string(message.subnetId);
        }
        if (message.address !== '') {
            writer.uint32(18).string(message.address);
        }
        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({}, baseInternalIpv4AddressSpec);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.subnetId = reader.string();
                    break;
                case 2:
                    message.address = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseInternalIpv4AddressSpec);
        message.subnetId =
            object.subnetId !== undefined && object.subnetId !== null
                ? String(object.subnetId)
                : '';
        message.address =
            object.address !== undefined && object.address !== null ? String(object.address) : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.subnetId !== undefined && (obj.subnetId = message.subnetId);
        message.address !== undefined && (obj.address = message.address);
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseInternalIpv4AddressSpec);
        message.subnetId = (_a = object.subnetId) !== null && _a !== void 0 ? _a : '';
        message.address = (_b = object.address) !== null && _b !== void 0 ? _b : '';
        return message;
    },
};
const baseAddressSpec = {};
exports.AddressSpec = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.addressId !== undefined) {
            writer.uint32(10).string(message.addressId);
        }
        if (message.internalIpv4AddressSpec !== undefined) {
            exports.InternalIpv4AddressSpec.encode(message.internalIpv4AddressSpec, 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({}, baseAddressSpec);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.addressId = reader.string();
                    break;
                case 2:
                    message.internalIpv4AddressSpec = exports.InternalIpv4AddressSpec.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseAddressSpec);
        message.addressId =
            object.addressId !== undefined && object.addressId !== null
                ? String(object.addressId)
                : undefined;
        message.internalIpv4AddressSpec =
            object.internalIpv4AddressSpec !== undefined && object.internalIpv4AddressSpec !== null
                ? exports.InternalIpv4AddressSpec.fromJSON(object.internalIpv4AddressSpec)
                : undefined;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.addressId !== undefined && (obj.addressId = message.addressId);
        message.internalIpv4AddressSpec !== undefined &&
            (obj.internalIpv4AddressSpec = message.internalIpv4AddressSpec
                ? exports.InternalIpv4AddressSpec.toJSON(message.internalIpv4AddressSpec)
                : undefined);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseAddressSpec);
        message.addressId = (_a = object.addressId) !== null && _a !== void 0 ? _a : undefined;
        message.internalIpv4AddressSpec =
            object.internalIpv4AddressSpec !== undefined && object.internalIpv4AddressSpec !== null
                ? exports.InternalIpv4AddressSpec.fromPartial(object.internalIpv4AddressSpec)
                : undefined;
        return message;
    },
};
const baseCreatePrivateEndpointRequest = {
    folderId: '',
    name: '',
    description: '',
    networkId: '',
};
exports.CreatePrivateEndpointRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.folderId !== '') {
            writer.uint32(10).string(message.folderId);
        }
        if (message.name !== '') {
            writer.uint32(18).string(message.name);
        }
        if (message.description !== '') {
            writer.uint32(26).string(message.description);
        }
        Object.entries(message.labels).forEach(([key, value]) => {
            exports.CreatePrivateEndpointRequest_LabelsEntry.encode({ key: key, value }, writer.uint32(34).fork()).ldelim();
        });
        if (message.networkId !== '') {
            writer.uint32(42).string(message.networkId);
        }
        if (message.addressSpec !== undefined) {
            exports.AddressSpec.encode(message.addressSpec, writer.uint32(50).fork()).ldelim();
        }
        if (message.dnsOptions !== undefined) {
            private_endpoint_1.PrivateEndpoint_DnsOptions.encode(message.dnsOptions, writer.uint32(66).fork()).ldelim();
        }
        if (message.objectStorage !== undefined) {
            private_endpoint_1.PrivateEndpoint_ObjectStorage.encode(message.objectStorage, writer.uint32(74).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({}, baseCreatePrivateEndpointRequest);
        message.labels = {};
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.folderId = reader.string();
                    break;
                case 2:
                    message.name = reader.string();
                    break;
                case 3:
                    message.description = reader.string();
                    break;
                case 4:
                    const entry4 = exports.CreatePrivateEndpointRequest_LabelsEntry.decode(reader, reader.uint32());
                    if (entry4.value !== undefined) {
                        message.labels[entry4.key] = entry4.value;
                    }
                    break;
                case 5:
                    message.networkId = reader.string();
                    break;
                case 6:
                    message.addressSpec = exports.AddressSpec.decode(reader, reader.uint32());
                    break;
                case 8:
                    message.dnsOptions = private_endpoint_1.PrivateEndpoint_DnsOptions.decode(reader, reader.uint32());
                    break;
                case 9:
                    message.objectStorage = private_endpoint_1.PrivateEndpoint_ObjectStorage.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a;
        const message = Object.assign({}, baseCreatePrivateEndpointRequest);
        message.folderId =
            object.folderId !== undefined && object.folderId !== null
                ? String(object.folderId)
                : '';
        message.name = object.name !== undefined && object.name !== null ? String(object.name) : '';
        message.description =
            object.description !== undefined && object.description !== null
                ? String(object.description)
                : '';
        message.labels = Object.entries((_a = object.labels) !== null && _a !== void 0 ? _a : {}).reduce((acc, [key, value]) => {
            acc[key] = String(value);
            return acc;
        }, {});
        message.networkId =
            object.networkId !== undefined && object.networkId !== null
                ? String(object.networkId)
                : '';
        message.addressSpec =
            object.addressSpec !== undefined && object.addressSpec !== null
                ? exports.AddressSpec.fromJSON(object.addressSpec)
                : undefined;
        message.dnsOptions =
            object.dnsOptions !== undefined && object.dnsOptions !== null
                ? private_endpoint_1.PrivateEndpoint_DnsOptions.fromJSON(object.dnsOptions)
                : undefined;
        message.objectStorage =
            object.objectStorage !== undefined && object.objectStorage !== null
                ? private_endpoint_1.PrivateEndpoint_ObjectStorage.fromJSON(object.objectStorage)
                : undefined;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.folderId !== undefined && (obj.folderId = message.folderId);
        message.name !== undefined && (obj.name = message.name);
        message.description !== undefined && (obj.description = message.description);
        obj.labels = {};
        if (message.labels) {
            Object.entries(message.labels).forEach(([k, v]) => {
                obj.labels[k] = v;
            });
        }
        message.networkId !== undefined && (obj.networkId = message.networkId);
        message.addressSpec !== undefined &&
            (obj.addressSpec = message.addressSpec
                ? exports.AddressSpec.toJSON(message.addressSpec)
                : undefined);
        message.dnsOptions !== undefined &&
            (obj.dnsOptions = message.dnsOptions
                ? private_endpoint_1.PrivateEndpoint_DnsOptions.toJSON(message.dnsOptions)
                : undefined);
        message.objectStorage !== undefined &&
            (obj.objectStorage = message.objectStorage
                ? private_endpoint_1.PrivateEndpoint_ObjectStorage.toJSON(message.objectStorage)
                : undefined);
        return obj;
    },
    fromPartial(object) {
        var _a, _b, _c, _d, _e;
        const message = Object.assign({}, baseCreatePrivateEndpointRequest);
        message.folderId = (_a = object.folderId) !== null && _a !== void 0 ? _a : '';
        message.name = (_b = object.name) !== null && _b !== void 0 ? _b : '';
        message.description = (_c = object.description) !== null && _c !== void 0 ? _c : '';
        message.labels = Object.entries((_d = object.labels) !== null && _d !== void 0 ? _d : {}).reduce((acc, [key, value]) => {
            if (value !== undefined) {
                acc[key] = String(value);
            }
            return acc;
        }, {});
        message.networkId = (_e = object.networkId) !== null && _e !== void 0 ? _e : '';
        message.addressSpec =
            object.addressSpec !== undefined && object.addressSpec !== null
                ? exports.AddressSpec.fromPartial(object.addressSpec)
                : undefined;
        message.dnsOptions =
            object.dnsOptions !== undefined && object.dnsOptions !== null
                ? private_endpoint_1.PrivateEndpoint_DnsOptions.fromPartial(object.dnsOptions)
                : undefined;
        message.objectStorage =
            object.objectStorage !== undefined && object.objectStorage !== null
                ? private_endpoint_1.PrivateEndpoint_ObjectStorage.fromPartial(object.objectStorage)
                : undefined;
        return message;
    },
};
const baseCreatePrivateEndpointRequest_LabelsEntry = { key: '', value: '' };
exports.CreatePrivateEndpointRequest_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({}, baseCreatePrivateEndpointRequest_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({}, baseCreatePrivateEndpointRequest_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({}, baseCreatePrivateEndpointRequest_LabelsEntry);
        message.key = (_a = object.key) !== null && _a !== void 0 ? _a : '';
        message.value = (_b = object.value) !== null && _b !== void 0 ? _b : '';
        return message;
    },
};
const baseCreatePrivateEndpointMetadata = { privateEndpointId: '' };
exports.CreatePrivateEndpointMetadata = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.privateEndpointId !== '') {
            writer.uint32(10).string(message.privateEndpointId);
        }
        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({}, baseCreatePrivateEndpointMetadata);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.privateEndpointId = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseCreatePrivateEndpointMetadata);
        message.privateEndpointId =
            object.privateEndpointId !== undefined && object.privateEndpointId !== null
                ? String(object.privateEndpointId)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.privateEndpointId !== undefined &&
            (obj.privateEndpointId = message.privateEndpointId);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseCreatePrivateEndpointMetadata);
        message.privateEndpointId = (_a = object.privateEndpointId) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
const baseUpdatePrivateEndpointRequest = {
    privateEndpointId: '',
    name: '',
    description: '',
};
exports.UpdatePrivateEndpointRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.privateEndpointId !== '') {
            writer.uint32(10).string(message.privateEndpointId);
        }
        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);
        }
        Object.entries(message.labels).forEach(([key, value]) => {
            exports.UpdatePrivateEndpointRequest_LabelsEntry.encode({ key: key, value }, writer.uint32(42).fork()).ldelim();
        });
        if (message.addressSpec !== undefined) {
            exports.AddressSpec.encode(message.addressSpec, writer.uint32(50).fork()).ldelim();
        }
        if (message.dnsOptions !== undefined) {
            private_endpoint_1.PrivateEndpoint_DnsOptions.encode(message.dnsOptions, writer.uint32(66).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({}, baseUpdatePrivateEndpointRequest);
        message.labels = {};
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.privateEndpointId = 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 5:
                    const entry5 = exports.UpdatePrivateEndpointRequest_LabelsEntry.decode(reader, reader.uint32());
                    if (entry5.value !== undefined) {
                        message.labels[entry5.key] = entry5.value;
                    }
                    break;
                case 6:
                    message.addressSpec = exports.AddressSpec.decode(reader, reader.uint32());
                    break;
                case 8:
                    message.dnsOptions = private_endpoint_1.PrivateEndpoint_DnsOptions.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a;
        const message = Object.assign({}, baseUpdatePrivateEndpointRequest);
        message.privateEndpointId =
            object.privateEndpointId !== undefined && object.privateEndpointId !== null
                ? String(object.privateEndpointId)
                : '';
        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.labels = Object.entries((_a = object.labels) !== null && _a !== void 0 ? _a : {}).reduce((acc, [key, value]) => {
            acc[key] = String(value);
            return acc;
        }, {});
        message.addressSpec =
            object.addressSpec !== undefined && object.addressSpec !== null
                ? exports.AddressSpec.fromJSON(object.addressSpec)
                : undefined;
        message.dnsOptions =
            object.dnsOptions !== undefined && object.dnsOptions !== null
                ? private_endpoint_1.PrivateEndpoint_DnsOptions.fromJSON(object.dnsOptions)
                : undefined;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.privateEndpointId !== undefined &&
            (obj.privateEndpointId = message.privateEndpointId);
        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);
        obj.labels = {};
        if (message.labels) {
            Object.entries(message.labels).forEach(([k, v]) => {
                obj.labels[k] = v;
            });
        }
        message.addressSpec !== undefined &&
            (obj.addressSpec = message.addressSpec
                ? exports.AddressSpec.toJSON(message.addressSpec)
                : undefined);
        message.dnsOptions !== undefined &&
            (obj.dnsOptions = message.dnsOptions
                ? private_endpoint_1.PrivateEndpoint_DnsOptions.toJSON(message.dnsOptions)
                : undefined);
        return obj;
    },
    fromPartial(object) {
        var _a, _b, _c, _d;
        const message = Object.assign({}, baseUpdatePrivateEndpointRequest);
        message.privateEndpointId = (_a = object.privateEndpointId) !== 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.labels = Object.entries((_d = object.labels) !== null && _d !== void 0 ? _d : {}).reduce((acc, [key, value]) => {
            if (value !== undefined) {
                acc[key] = String(value);
            }
            return acc;
        }, {});
        message.addressSpec =
            object.addressSpec !== undefined && object.addressSpec !== null
                ? exports.AddressSpec.fromPartial(object.addressSpec)
                : undefined;
        message.dnsOptions =
            object.dnsOptions !== undefined && object.dnsOptions !== null
                ? private_endpoint_1.PrivateEndpoint_DnsOptions.fromPartial(object.dnsOptions)
                : undefined;
        return message;
    },
};
const baseUpdatePrivateEndpointRequest_LabelsEntry = { key: '', value: '' };
exports.UpdatePrivateEndpointRequest_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({}, baseUpdatePrivateEndpointRequest_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({}, baseUpdatePrivateEndpointRequest_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({}, baseUpdatePrivateEndpointRequest_LabelsEntry);
        message.key = (_a = object.key) !== null && _a !== void 0 ? _a : '';
        message.value = (_b = object.value) !== null && _b !== void 0 ? _b : '';
        return message;
    },
};
const baseUpdatePrivateEndpointMetadata = { privateEndpointId: '' };
exports.UpdatePrivateEndpointMetadata = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.privateEndpointId !== '') {
            writer.uint32(10).string(message.privateEndpointId);
        }
        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({}, baseUpdatePrivateEndpointMetadata);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.privateEndpointId = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseUpdatePrivateEndpointMetadata);
        message.privateEndpointId =
            object.privateEndpointId !== undefined && object.privateEndpointId !== null
                ? String(object.privateEndpointId)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.privateEndpointId !== undefined &&
            (obj.privateEndpointId = message.privateEndpointId);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseUpdatePrivateEndpointMetadata);
        message.privateEndpointId = (_a = object.privateEndpointId) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
const baseDeletePrivateEndpointRequest = { privateEndpointId: '' };
exports.DeletePrivateEndpointRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.privateEndpointId !== '') {
            writer.uint32(10).string(message.privateEndpointId);
        }
        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({}, baseDeletePrivateEndpointRequest);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.privateEndpointId = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseDeletePrivateEndpointRequest);
        message.privateEndpointId =
            object.privateEndpointId !== undefined && object.privateEndpointId !== null
                ? String(object.privateEndpointId)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.privateEndpointId !== undefined &&
            (obj.privateEndpointId = message.privateEndpointId);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseDeletePrivateEndpointRequest);
        message.privateEndpointId = (_a = object.privateEndpointId) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
const baseDeletePrivateEndpointMetadata = { privateEndpointId: '' };
exports.DeletePrivateEndpointMetadata = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.privateEndpointId !== '') {
            writer.uint32(10).string(message.privateEndpointId);
        }
        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({}, baseDeletePrivateEndpointMetadata);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.privateEndpointId = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseDeletePrivateEndpointMetadata);
        message.privateEndpointId =
            object.privateEndpointId !== undefined && object.privateEndpointId !== null
                ? String(object.privateEndpointId)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.privateEndpointId !== undefined &&
            (obj.privateEndpointId = message.privateEndpointId);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseDeletePrivateEndpointMetadata);
        message.privateEndpointId = (_a = object.privateEndpointId) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
const baseListPrivateEndpointsRequest = { pageSize: 0, pageToken: '', filter: '' };
exports.ListPrivateEndpointsRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.folderId !== undefined) {
            writer.uint32(10).string(message.folderId);
        }
        if (message.pageSize !== 0) {
            writer.uint32(24).int64(message.pageSize);
        }
        if (message.pageToken !== '') {
            writer.uint32(34).string(message.pageToken);
        }
        if (message.filter !== '') {
            writer.uint32(42).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({}, baseListPrivateEndpointsRequest);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.folderId = reader.string();
                    break;
                case 3:
                    message.pageSize = longToNumber(reader.int64());
                    break;
                case 4:
                    message.pageToken = reader.string();
                    break;
                case 5:
                    message.filter = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseListPrivateEndpointsRequest);
        message.folderId =
            object.folderId !== undefined && object.folderId !== null
                ? String(object.folderId)
                : undefined;
        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({}, baseListPrivateEndpointsRequest);
        message.folderId = (_a = object.folderId) !== null && _a !== void 0 ? _a : undefined;
        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 baseListPrivateEndpointsResponse = { nextPageToken: '' };
exports.ListPrivateEndpointsResponse = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        for (const v of message.privateEndpoints) {
            private_endpoint_1.PrivateEndpoint.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({}, baseListPrivateEndpointsResponse);
        message.privateEndpoints = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.privateEndpoints.push(private_endpoint_1.PrivateEndpoint.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({}, baseListPrivateEndpointsResponse);
        message.privateEndpoints = ((_a = object.privateEndpoints) !== null && _a !== void 0 ? _a : []).map((e) => private_endpoint_1.PrivateEndpoint.fromJSON(e));
        message.nextPageToken =
            object.nextPageToken !== undefined && object.nextPageToken !== null
                ? String(object.nextPageToken)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        if (message.privateEndpoints) {
            obj.privateEndpoints = message.privateEndpoints.map((e) => e ? private_endpoint_1.PrivateEndpoint.toJSON(e) : undefined);
        }
        else {
            obj.privateEndpoints = [];
        }
        message.nextPageToken !== undefined && (obj.nextPageToken = message.nextPageToken);
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseListPrivateEndpointsResponse);
        message.privateEndpoints =
            ((_a = object.privateEndpoints) === null || _a === void 0 ? void 0 : _a.map((e) => private_endpoint_1.PrivateEndpoint.fromPartial(e))) || [];
        message.nextPageToken = (_b = object.nextPageToken) !== null && _b !== void 0 ? _b : '';
        return message;
    },
};
const baseListPrivateEndpointOperationsRequest = {
    privateEndpointId: '',
    pageSize: 0,
    pageToken: '',
};
exports.ListPrivateEndpointOperationsRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.privateEndpointId !== '') {
            writer.uint32(10).string(message.privateEndpointId);
        }
        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({}, baseListPrivateEndpointOperationsRequest);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.privateEndpointId = 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({}, baseListPrivateEndpointOperationsRequest);
        message.privateEndpointId =
            object.privateEndpointId !== undefined && object.privateEndpointId !== null
                ? String(object.privateEndpointId)
                : '';
        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.privateEndpointId !== undefined &&
            (obj.privateEndpointId = message.privateEndpointId);
        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({}, baseListPrivateEndpointOperationsRequest);
        message.privateEndpointId = (_a = object.privateEndpointId) !== 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 baseListPrivateEndpointOperationsResponse = { nextPageToken: '' };
exports.ListPrivateEndpointOperationsResponse = {
    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({}, baseListPrivateEndpointOperationsResponse);
        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({}, baseListPrivateEndpointOperationsResponse);
        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({}, baseListPrivateEndpointOperationsResponse);
        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 PrivateEndpoint resources. */
exports.PrivateEndpointServiceService = {
    /**
     * Returns the specified Private Endpoint resource.
     *
     * To get the list of all available PrivateEndpoint resources, make a [List]
     * request.
     */
    get: {
        path: '/yandex.cloud.vpc.v1.privatelink.PrivateEndpointService/Get',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.GetPrivateEndpointRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.GetPrivateEndpointRequest.decode(value),
        responseSerialize: (value) => Buffer.from(private_endpoint_1.PrivateEndpoint.encode(value).finish()),
        responseDeserialize: (value) => private_endpoint_1.PrivateEndpoint.decode(value),
    },
    /** Retrieves the list of PrivateEndpoint resources in the specified folder. */
    list: {
        path: '/yandex.cloud.vpc.v1.privatelink.PrivateEndpointService/List',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.ListPrivateEndpointsRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.ListPrivateEndpointsRequest.decode(value),
        responseSerialize: (value) => Buffer.from(exports.ListPrivateEndpointsResponse.encode(value).finish()),
        responseDeserialize: (value) => exports.ListPrivateEndpointsResponse.decode(value),
    },
    /** Creates an private endpoint in the specified folder and network. */
    create: {
        path: '/yandex.cloud.vpc.v1.privatelink.PrivateEndpointService/Create',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.CreatePrivateEndpointRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.CreatePrivateEndpointRequest.decode(value),
        responseSerialize: (value) => Buffer.from(operation_1.Operation.encode(value).finish()),
        responseDeserialize: (value) => operation_1.Operation.decode(value),
    },
    /** Updates the specified private endpoint. */
    update: {
        path: '/yandex.cloud.vpc.v1.privatelink.PrivateEndpointService/Update',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.UpdatePrivateEndpointRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.UpdatePrivateEndpointRequest.decode(value),
        responseSerialize: (value) => Buffer.from(operation_1.Operation.encode(value).finish()),
        responseDeserialize: (value) => operation_1.Operation.decode(value),
    },
    /** Deletes the specified private endpoint. */
    delete: {
        path: '/yandex.cloud.vpc.v1.privatelink.PrivateEndpointService/Delete',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.DeletePrivateEndpointRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.DeletePrivateEndpointRequest.decode(value),
        responseSerialize: (value) => Buffer.from(operation_1.Operation.encode(value).finish()),
        responseDeserialize: (value) => operation_1.Operation.decode(value),
    },
    /** List operations for the specified private endpoint. */
    listOperations: {
        path: '/yandex.cloud.vpc.v1.privatelink.PrivateEndpointService/ListOperations',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.ListPrivateEndpointOperationsRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.ListPrivateEndpointOperationsRequest.decode(value),
        responseSerialize: (value) => Buffer.from(exports.ListPrivateEndpointOperationsResponse.encode(value).finish()),
        responseDeserialize: (value) => exports.ListPrivateEndpointOperationsResponse.decode(value),
    },
};
exports.PrivateEndpointServiceClient = (0, grpc_js_1.makeGenericClientConstructor)(exports.PrivateEndpointServiceService, 'yandex.cloud.vpc.v1.privatelink.PrivateEndpointService');
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();
}
