@yandex-cloud/nodejs-sdk
Version:
Yandex.Cloud NodeJS SDK
1,065 lines • 132 kB
JavaScript
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.InstanceGroupServiceClient = exports.InstanceGroupServiceService = exports.ListInstanceGroupLogRecordsResponse = exports.ListInstanceGroupLogRecordsRequest = exports.ListInstanceGroupOperationsResponse = exports.ListInstanceGroupOperationsRequest = exports.StopInstancesRequest = exports.DeleteInstancesRequest = exports.ListInstanceGroupInstancesResponse = exports.ListInstanceGroupInstancesRequest = exports.ListInstanceGroupsResponse = exports.ListInstanceGroupsRequest = exports.StopInstancesMetadata = exports.DeleteInstancesMetadata = exports.DeleteInstanceGroupMetadata = exports.DeleteInstanceGroupRequest = exports.RollingRecreateMetadata = exports.RollingRecreateRequest = exports.RollingRestartMetadata = exports.RollingRestartRequest = exports.StopInstanceGroupMetadata = exports.StopInstanceGroupRequest = exports.StartInstanceGroupMetadata = exports.StartInstanceGroupRequest = exports.UpdateInstanceGroupMetadata = exports.UpdateInstanceGroupFromYamlRequest = exports.UpdateInstanceGroupRequest_LabelsEntry = exports.UpdateInstanceGroupRequest = exports.CreateInstanceGroupMetadata = exports.CreateInstanceGroupFromYamlRequest = exports.CreateInstanceGroupRequest_LabelsEntry = exports.CreateInstanceGroupRequest = exports.GetInstanceGroupRequest = exports.PauseInstanceGroupProcessMetadata = exports.PauseInstanceGroupProcessesRequest = exports.ResumeInstanceGroupProcessMetadata = exports.ResumeInstanceGroupProcessesRequest = exports.instanceGroupViewToJSON = exports.instanceGroupViewFromJSON = exports.InstanceGroupView = exports.protobufPackage = void 0;
/* eslint-disable */
const typeRegistry_1 = require("../../../../../typeRegistry");
const long_1 = __importDefault(require("long"));
const grpc_js_1 = require("@grpc/grpc-js");
const minimal_1 = __importDefault(require("protobufjs/minimal"));
const instance_group_1 = require("../../../../../yandex/cloud/compute/v1/instancegroup/instance_group");
const field_mask_1 = require("../../../../../google/protobuf/field_mask");
const operation_1 = require("../../../../../yandex/cloud/operation/operation");
const access_1 = require("../../../../../yandex/cloud/access/access");
exports.protobufPackage = "yandex.cloud.compute.v1.instancegroup";
var InstanceGroupView;
(function (InstanceGroupView) {
/** BASIC - Doesn't include the metadata of the instance template in the server response. */
InstanceGroupView[InstanceGroupView["BASIC"] = 0] = "BASIC";
/** FULL - Returns the metadata of the instance template in the server response. */
InstanceGroupView[InstanceGroupView["FULL"] = 1] = "FULL";
InstanceGroupView[InstanceGroupView["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(InstanceGroupView = exports.InstanceGroupView || (exports.InstanceGroupView = {}));
function instanceGroupViewFromJSON(object) {
switch (object) {
case 0:
case "BASIC":
return InstanceGroupView.BASIC;
case 1:
case "FULL":
return InstanceGroupView.FULL;
case -1:
case "UNRECOGNIZED":
default:
return InstanceGroupView.UNRECOGNIZED;
}
}
exports.instanceGroupViewFromJSON = instanceGroupViewFromJSON;
function instanceGroupViewToJSON(object) {
switch (object) {
case InstanceGroupView.BASIC:
return "BASIC";
case InstanceGroupView.FULL:
return "FULL";
default:
return "UNKNOWN";
}
}
exports.instanceGroupViewToJSON = instanceGroupViewToJSON;
const baseResumeInstanceGroupProcessesRequest = {
$type: "yandex.cloud.compute.v1.instancegroup.ResumeInstanceGroupProcessesRequest",
instanceGroupId: "",
};
exports.ResumeInstanceGroupProcessesRequest = {
$type: "yandex.cloud.compute.v1.instancegroup.ResumeInstanceGroupProcessesRequest",
encode(message, writer = minimal_1.default.Writer.create()) {
if (message.instanceGroupId !== "") {
writer.uint32(10).string(message.instanceGroupId);
}
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({}, baseResumeInstanceGroupProcessesRequest);
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.instanceGroupId = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object) {
const message = Object.assign({}, baseResumeInstanceGroupProcessesRequest);
message.instanceGroupId =
object.instanceGroupId !== undefined && object.instanceGroupId !== null
? String(object.instanceGroupId)
: "";
return message;
},
toJSON(message) {
const obj = {};
message.instanceGroupId !== undefined &&
(obj.instanceGroupId = message.instanceGroupId);
return obj;
},
fromPartial(object) {
var _a;
const message = Object.assign({}, baseResumeInstanceGroupProcessesRequest);
message.instanceGroupId = (_a = object.instanceGroupId) !== null && _a !== void 0 ? _a : "";
return message;
},
};
typeRegistry_1.messageTypeRegistry.set(exports.ResumeInstanceGroupProcessesRequest.$type, exports.ResumeInstanceGroupProcessesRequest);
const baseResumeInstanceGroupProcessMetadata = {
$type: "yandex.cloud.compute.v1.instancegroup.ResumeInstanceGroupProcessMetadata",
instanceGroupId: "",
};
exports.ResumeInstanceGroupProcessMetadata = {
$type: "yandex.cloud.compute.v1.instancegroup.ResumeInstanceGroupProcessMetadata",
encode(message, writer = minimal_1.default.Writer.create()) {
if (message.instanceGroupId !== "") {
writer.uint32(10).string(message.instanceGroupId);
}
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({}, baseResumeInstanceGroupProcessMetadata);
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.instanceGroupId = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object) {
const message = Object.assign({}, baseResumeInstanceGroupProcessMetadata);
message.instanceGroupId =
object.instanceGroupId !== undefined && object.instanceGroupId !== null
? String(object.instanceGroupId)
: "";
return message;
},
toJSON(message) {
const obj = {};
message.instanceGroupId !== undefined &&
(obj.instanceGroupId = message.instanceGroupId);
return obj;
},
fromPartial(object) {
var _a;
const message = Object.assign({}, baseResumeInstanceGroupProcessMetadata);
message.instanceGroupId = (_a = object.instanceGroupId) !== null && _a !== void 0 ? _a : "";
return message;
},
};
typeRegistry_1.messageTypeRegistry.set(exports.ResumeInstanceGroupProcessMetadata.$type, exports.ResumeInstanceGroupProcessMetadata);
const basePauseInstanceGroupProcessesRequest = {
$type: "yandex.cloud.compute.v1.instancegroup.PauseInstanceGroupProcessesRequest",
instanceGroupId: "",
};
exports.PauseInstanceGroupProcessesRequest = {
$type: "yandex.cloud.compute.v1.instancegroup.PauseInstanceGroupProcessesRequest",
encode(message, writer = minimal_1.default.Writer.create()) {
if (message.instanceGroupId !== "") {
writer.uint32(10).string(message.instanceGroupId);
}
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({}, basePauseInstanceGroupProcessesRequest);
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.instanceGroupId = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object) {
const message = Object.assign({}, basePauseInstanceGroupProcessesRequest);
message.instanceGroupId =
object.instanceGroupId !== undefined && object.instanceGroupId !== null
? String(object.instanceGroupId)
: "";
return message;
},
toJSON(message) {
const obj = {};
message.instanceGroupId !== undefined &&
(obj.instanceGroupId = message.instanceGroupId);
return obj;
},
fromPartial(object) {
var _a;
const message = Object.assign({}, basePauseInstanceGroupProcessesRequest);
message.instanceGroupId = (_a = object.instanceGroupId) !== null && _a !== void 0 ? _a : "";
return message;
},
};
typeRegistry_1.messageTypeRegistry.set(exports.PauseInstanceGroupProcessesRequest.$type, exports.PauseInstanceGroupProcessesRequest);
const basePauseInstanceGroupProcessMetadata = {
$type: "yandex.cloud.compute.v1.instancegroup.PauseInstanceGroupProcessMetadata",
instanceGroupId: "",
};
exports.PauseInstanceGroupProcessMetadata = {
$type: "yandex.cloud.compute.v1.instancegroup.PauseInstanceGroupProcessMetadata",
encode(message, writer = minimal_1.default.Writer.create()) {
if (message.instanceGroupId !== "") {
writer.uint32(10).string(message.instanceGroupId);
}
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({}, basePauseInstanceGroupProcessMetadata);
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.instanceGroupId = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object) {
const message = Object.assign({}, basePauseInstanceGroupProcessMetadata);
message.instanceGroupId =
object.instanceGroupId !== undefined && object.instanceGroupId !== null
? String(object.instanceGroupId)
: "";
return message;
},
toJSON(message) {
const obj = {};
message.instanceGroupId !== undefined &&
(obj.instanceGroupId = message.instanceGroupId);
return obj;
},
fromPartial(object) {
var _a;
const message = Object.assign({}, basePauseInstanceGroupProcessMetadata);
message.instanceGroupId = (_a = object.instanceGroupId) !== null && _a !== void 0 ? _a : "";
return message;
},
};
typeRegistry_1.messageTypeRegistry.set(exports.PauseInstanceGroupProcessMetadata.$type, exports.PauseInstanceGroupProcessMetadata);
const baseGetInstanceGroupRequest = {
$type: "yandex.cloud.compute.v1.instancegroup.GetInstanceGroupRequest",
instanceGroupId: "",
view: 0,
};
exports.GetInstanceGroupRequest = {
$type: "yandex.cloud.compute.v1.instancegroup.GetInstanceGroupRequest",
encode(message, writer = minimal_1.default.Writer.create()) {
if (message.instanceGroupId !== "") {
writer.uint32(10).string(message.instanceGroupId);
}
if (message.view !== 0) {
writer.uint32(16).int32(message.view);
}
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({}, baseGetInstanceGroupRequest);
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.instanceGroupId = reader.string();
break;
case 2:
message.view = reader.int32();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object) {
const message = Object.assign({}, baseGetInstanceGroupRequest);
message.instanceGroupId =
object.instanceGroupId !== undefined && object.instanceGroupId !== null
? String(object.instanceGroupId)
: "";
message.view =
object.view !== undefined && object.view !== null
? instanceGroupViewFromJSON(object.view)
: 0;
return message;
},
toJSON(message) {
const obj = {};
message.instanceGroupId !== undefined &&
(obj.instanceGroupId = message.instanceGroupId);
message.view !== undefined &&
(obj.view = instanceGroupViewToJSON(message.view));
return obj;
},
fromPartial(object) {
var _a, _b;
const message = Object.assign({}, baseGetInstanceGroupRequest);
message.instanceGroupId = (_a = object.instanceGroupId) !== null && _a !== void 0 ? _a : "";
message.view = (_b = object.view) !== null && _b !== void 0 ? _b : 0;
return message;
},
};
typeRegistry_1.messageTypeRegistry.set(exports.GetInstanceGroupRequest.$type, exports.GetInstanceGroupRequest);
const baseCreateInstanceGroupRequest = {
$type: "yandex.cloud.compute.v1.instancegroup.CreateInstanceGroupRequest",
folderId: "",
name: "",
description: "",
serviceAccountId: "",
deletionProtection: false,
};
exports.CreateInstanceGroupRequest = {
$type: "yandex.cloud.compute.v1.instancegroup.CreateInstanceGroupRequest",
encode(message, writer = minimal_1.default.Writer.create()) {
if (message.folderId !== "") {
writer.uint32(10).string(message.folderId);
}
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.CreateInstanceGroupRequest_LabelsEntry.encode({
$type: "yandex.cloud.compute.v1.instancegroup.CreateInstanceGroupRequest.LabelsEntry",
key: key,
value,
}, writer.uint32(42).fork()).ldelim();
});
if (message.instanceTemplate !== undefined) {
instance_group_1.InstanceTemplate.encode(message.instanceTemplate, writer.uint32(50).fork()).ldelim();
}
if (message.scalePolicy !== undefined) {
instance_group_1.ScalePolicy.encode(message.scalePolicy, writer.uint32(58).fork()).ldelim();
}
if (message.deployPolicy !== undefined) {
instance_group_1.DeployPolicy.encode(message.deployPolicy, writer.uint32(66).fork()).ldelim();
}
if (message.allocationPolicy !== undefined) {
instance_group_1.AllocationPolicy.encode(message.allocationPolicy, writer.uint32(74).fork()).ldelim();
}
if (message.loadBalancerSpec !== undefined) {
instance_group_1.LoadBalancerSpec.encode(message.loadBalancerSpec, writer.uint32(82).fork()).ldelim();
}
if (message.healthChecksSpec !== undefined) {
instance_group_1.HealthChecksSpec.encode(message.healthChecksSpec, writer.uint32(90).fork()).ldelim();
}
if (message.serviceAccountId !== "") {
writer.uint32(98).string(message.serviceAccountId);
}
for (const v of message.variables) {
instance_group_1.Variable.encode(v, writer.uint32(106).fork()).ldelim();
}
if (message.deletionProtection === true) {
writer.uint32(112).bool(message.deletionProtection);
}
if (message.applicationLoadBalancerSpec !== undefined) {
instance_group_1.ApplicationLoadBalancerSpec.encode(message.applicationLoadBalancerSpec, writer.uint32(122).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({}, baseCreateInstanceGroupRequest);
message.labels = {};
message.variables = [];
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.folderId = reader.string();
break;
case 3:
message.name = reader.string();
break;
case 4:
message.description = reader.string();
break;
case 5:
const entry5 = exports.CreateInstanceGroupRequest_LabelsEntry.decode(reader, reader.uint32());
if (entry5.value !== undefined) {
message.labels[entry5.key] = entry5.value;
}
break;
case 6:
message.instanceTemplate = instance_group_1.InstanceTemplate.decode(reader, reader.uint32());
break;
case 7:
message.scalePolicy = instance_group_1.ScalePolicy.decode(reader, reader.uint32());
break;
case 8:
message.deployPolicy = instance_group_1.DeployPolicy.decode(reader, reader.uint32());
break;
case 9:
message.allocationPolicy = instance_group_1.AllocationPolicy.decode(reader, reader.uint32());
break;
case 10:
message.loadBalancerSpec = instance_group_1.LoadBalancerSpec.decode(reader, reader.uint32());
break;
case 11:
message.healthChecksSpec = instance_group_1.HealthChecksSpec.decode(reader, reader.uint32());
break;
case 12:
message.serviceAccountId = reader.string();
break;
case 13:
message.variables.push(instance_group_1.Variable.decode(reader, reader.uint32()));
break;
case 14:
message.deletionProtection = reader.bool();
break;
case 15:
message.applicationLoadBalancerSpec =
instance_group_1.ApplicationLoadBalancerSpec.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object) {
var _a, _b;
const message = Object.assign({}, baseCreateInstanceGroupRequest);
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.instanceTemplate =
object.instanceTemplate !== undefined && object.instanceTemplate !== null
? instance_group_1.InstanceTemplate.fromJSON(object.instanceTemplate)
: undefined;
message.scalePolicy =
object.scalePolicy !== undefined && object.scalePolicy !== null
? instance_group_1.ScalePolicy.fromJSON(object.scalePolicy)
: undefined;
message.deployPolicy =
object.deployPolicy !== undefined && object.deployPolicy !== null
? instance_group_1.DeployPolicy.fromJSON(object.deployPolicy)
: undefined;
message.allocationPolicy =
object.allocationPolicy !== undefined && object.allocationPolicy !== null
? instance_group_1.AllocationPolicy.fromJSON(object.allocationPolicy)
: undefined;
message.loadBalancerSpec =
object.loadBalancerSpec !== undefined && object.loadBalancerSpec !== null
? instance_group_1.LoadBalancerSpec.fromJSON(object.loadBalancerSpec)
: undefined;
message.healthChecksSpec =
object.healthChecksSpec !== undefined && object.healthChecksSpec !== null
? instance_group_1.HealthChecksSpec.fromJSON(object.healthChecksSpec)
: undefined;
message.serviceAccountId =
object.serviceAccountId !== undefined && object.serviceAccountId !== null
? String(object.serviceAccountId)
: "";
message.variables = ((_b = object.variables) !== null && _b !== void 0 ? _b : []).map((e) => instance_group_1.Variable.fromJSON(e));
message.deletionProtection =
object.deletionProtection !== undefined &&
object.deletionProtection !== null
? Boolean(object.deletionProtection)
: false;
message.applicationLoadBalancerSpec =
object.applicationLoadBalancerSpec !== undefined &&
object.applicationLoadBalancerSpec !== null
? instance_group_1.ApplicationLoadBalancerSpec.fromJSON(object.applicationLoadBalancerSpec)
: 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.instanceTemplate !== undefined &&
(obj.instanceTemplate = message.instanceTemplate
? instance_group_1.InstanceTemplate.toJSON(message.instanceTemplate)
: undefined);
message.scalePolicy !== undefined &&
(obj.scalePolicy = message.scalePolicy
? instance_group_1.ScalePolicy.toJSON(message.scalePolicy)
: undefined);
message.deployPolicy !== undefined &&
(obj.deployPolicy = message.deployPolicy
? instance_group_1.DeployPolicy.toJSON(message.deployPolicy)
: undefined);
message.allocationPolicy !== undefined &&
(obj.allocationPolicy = message.allocationPolicy
? instance_group_1.AllocationPolicy.toJSON(message.allocationPolicy)
: undefined);
message.loadBalancerSpec !== undefined &&
(obj.loadBalancerSpec = message.loadBalancerSpec
? instance_group_1.LoadBalancerSpec.toJSON(message.loadBalancerSpec)
: undefined);
message.healthChecksSpec !== undefined &&
(obj.healthChecksSpec = message.healthChecksSpec
? instance_group_1.HealthChecksSpec.toJSON(message.healthChecksSpec)
: undefined);
message.serviceAccountId !== undefined &&
(obj.serviceAccountId = message.serviceAccountId);
if (message.variables) {
obj.variables = message.variables.map((e) => e ? instance_group_1.Variable.toJSON(e) : undefined);
}
else {
obj.variables = [];
}
message.deletionProtection !== undefined &&
(obj.deletionProtection = message.deletionProtection);
message.applicationLoadBalancerSpec !== undefined &&
(obj.applicationLoadBalancerSpec = message.applicationLoadBalancerSpec
? instance_group_1.ApplicationLoadBalancerSpec.toJSON(message.applicationLoadBalancerSpec)
: undefined);
return obj;
},
fromPartial(object) {
var _a, _b, _c, _d, _e, _f, _g;
const message = Object.assign({}, baseCreateInstanceGroupRequest);
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.instanceTemplate =
object.instanceTemplate !== undefined && object.instanceTemplate !== null
? instance_group_1.InstanceTemplate.fromPartial(object.instanceTemplate)
: undefined;
message.scalePolicy =
object.scalePolicy !== undefined && object.scalePolicy !== null
? instance_group_1.ScalePolicy.fromPartial(object.scalePolicy)
: undefined;
message.deployPolicy =
object.deployPolicy !== undefined && object.deployPolicy !== null
? instance_group_1.DeployPolicy.fromPartial(object.deployPolicy)
: undefined;
message.allocationPolicy =
object.allocationPolicy !== undefined && object.allocationPolicy !== null
? instance_group_1.AllocationPolicy.fromPartial(object.allocationPolicy)
: undefined;
message.loadBalancerSpec =
object.loadBalancerSpec !== undefined && object.loadBalancerSpec !== null
? instance_group_1.LoadBalancerSpec.fromPartial(object.loadBalancerSpec)
: undefined;
message.healthChecksSpec =
object.healthChecksSpec !== undefined && object.healthChecksSpec !== null
? instance_group_1.HealthChecksSpec.fromPartial(object.healthChecksSpec)
: undefined;
message.serviceAccountId = (_e = object.serviceAccountId) !== null && _e !== void 0 ? _e : "";
message.variables =
((_f = object.variables) === null || _f === void 0 ? void 0 : _f.map((e) => instance_group_1.Variable.fromPartial(e))) || [];
message.deletionProtection = (_g = object.deletionProtection) !== null && _g !== void 0 ? _g : false;
message.applicationLoadBalancerSpec =
object.applicationLoadBalancerSpec !== undefined &&
object.applicationLoadBalancerSpec !== null
? instance_group_1.ApplicationLoadBalancerSpec.fromPartial(object.applicationLoadBalancerSpec)
: undefined;
return message;
},
};
typeRegistry_1.messageTypeRegistry.set(exports.CreateInstanceGroupRequest.$type, exports.CreateInstanceGroupRequest);
const baseCreateInstanceGroupRequest_LabelsEntry = {
$type: "yandex.cloud.compute.v1.instancegroup.CreateInstanceGroupRequest.LabelsEntry",
key: "",
value: "",
};
exports.CreateInstanceGroupRequest_LabelsEntry = {
$type: "yandex.cloud.compute.v1.instancegroup.CreateInstanceGroupRequest.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({}, baseCreateInstanceGroupRequest_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({}, baseCreateInstanceGroupRequest_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({}, baseCreateInstanceGroupRequest_LabelsEntry);
message.key = (_a = object.key) !== null && _a !== void 0 ? _a : "";
message.value = (_b = object.value) !== null && _b !== void 0 ? _b : "";
return message;
},
};
typeRegistry_1.messageTypeRegistry.set(exports.CreateInstanceGroupRequest_LabelsEntry.$type, exports.CreateInstanceGroupRequest_LabelsEntry);
const baseCreateInstanceGroupFromYamlRequest = {
$type: "yandex.cloud.compute.v1.instancegroup.CreateInstanceGroupFromYamlRequest",
folderId: "",
instanceGroupYaml: "",
};
exports.CreateInstanceGroupFromYamlRequest = {
$type: "yandex.cloud.compute.v1.instancegroup.CreateInstanceGroupFromYamlRequest",
encode(message, writer = minimal_1.default.Writer.create()) {
if (message.folderId !== "") {
writer.uint32(10).string(message.folderId);
}
if (message.instanceGroupYaml !== "") {
writer.uint32(18).string(message.instanceGroupYaml);
}
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({}, baseCreateInstanceGroupFromYamlRequest);
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.folderId = reader.string();
break;
case 2:
message.instanceGroupYaml = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object) {
const message = Object.assign({}, baseCreateInstanceGroupFromYamlRequest);
message.folderId =
object.folderId !== undefined && object.folderId !== null
? String(object.folderId)
: "";
message.instanceGroupYaml =
object.instanceGroupYaml !== undefined &&
object.instanceGroupYaml !== null
? String(object.instanceGroupYaml)
: "";
return message;
},
toJSON(message) {
const obj = {};
message.folderId !== undefined && (obj.folderId = message.folderId);
message.instanceGroupYaml !== undefined &&
(obj.instanceGroupYaml = message.instanceGroupYaml);
return obj;
},
fromPartial(object) {
var _a, _b;
const message = Object.assign({}, baseCreateInstanceGroupFromYamlRequest);
message.folderId = (_a = object.folderId) !== null && _a !== void 0 ? _a : "";
message.instanceGroupYaml = (_b = object.instanceGroupYaml) !== null && _b !== void 0 ? _b : "";
return message;
},
};
typeRegistry_1.messageTypeRegistry.set(exports.CreateInstanceGroupFromYamlRequest.$type, exports.CreateInstanceGroupFromYamlRequest);
const baseCreateInstanceGroupMetadata = {
$type: "yandex.cloud.compute.v1.instancegroup.CreateInstanceGroupMetadata",
instanceGroupId: "",
};
exports.CreateInstanceGroupMetadata = {
$type: "yandex.cloud.compute.v1.instancegroup.CreateInstanceGroupMetadata",
encode(message, writer = minimal_1.default.Writer.create()) {
if (message.instanceGroupId !== "") {
writer.uint32(10).string(message.instanceGroupId);
}
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({}, baseCreateInstanceGroupMetadata);
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.instanceGroupId = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object) {
const message = Object.assign({}, baseCreateInstanceGroupMetadata);
message.instanceGroupId =
object.instanceGroupId !== undefined && object.instanceGroupId !== null
? String(object.instanceGroupId)
: "";
return message;
},
toJSON(message) {
const obj = {};
message.instanceGroupId !== undefined &&
(obj.instanceGroupId = message.instanceGroupId);
return obj;
},
fromPartial(object) {
var _a;
const message = Object.assign({}, baseCreateInstanceGroupMetadata);
message.instanceGroupId = (_a = object.instanceGroupId) !== null && _a !== void 0 ? _a : "";
return message;
},
};
typeRegistry_1.messageTypeRegistry.set(exports.CreateInstanceGroupMetadata.$type, exports.CreateInstanceGroupMetadata);
const baseUpdateInstanceGroupRequest = {
$type: "yandex.cloud.compute.v1.instancegroup.UpdateInstanceGroupRequest",
instanceGroupId: "",
name: "",
description: "",
serviceAccountId: "",
deletionProtection: false,
};
exports.UpdateInstanceGroupRequest = {
$type: "yandex.cloud.compute.v1.instancegroup.UpdateInstanceGroupRequest",
encode(message, writer = minimal_1.default.Writer.create()) {
if (message.instanceGroupId !== "") {
writer.uint32(10).string(message.instanceGroupId);
}
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.UpdateInstanceGroupRequest_LabelsEntry.encode({
$type: "yandex.cloud.compute.v1.instancegroup.UpdateInstanceGroupRequest.LabelsEntry",
key: key,
value,
}, writer.uint32(42).fork()).ldelim();
});
if (message.instanceTemplate !== undefined) {
instance_group_1.InstanceTemplate.encode(message.instanceTemplate, writer.uint32(50).fork()).ldelim();
}
if (message.scalePolicy !== undefined) {
instance_group_1.ScalePolicy.encode(message.scalePolicy, writer.uint32(58).fork()).ldelim();
}
if (message.deployPolicy !== undefined) {
instance_group_1.DeployPolicy.encode(message.deployPolicy, writer.uint32(66).fork()).ldelim();
}
if (message.allocationPolicy !== undefined) {
instance_group_1.AllocationPolicy.encode(message.allocationPolicy, writer.uint32(74).fork()).ldelim();
}
if (message.healthChecksSpec !== undefined) {
instance_group_1.HealthChecksSpec.encode(message.healthChecksSpec, writer.uint32(90).fork()).ldelim();
}
if (message.serviceAccountId !== "") {
writer.uint32(98).string(message.serviceAccountId);
}
if (message.loadBalancerSpec !== undefined) {
instance_group_1.LoadBalancerSpec.encode(message.loadBalancerSpec, writer.uint32(114).fork()).ldelim();
}
for (const v of message.variables) {
instance_group_1.Variable.encode(v, writer.uint32(122).fork()).ldelim();
}
if (message.deletionProtection === true) {
writer.uint32(128).bool(message.deletionProtection);
}
if (message.applicationLoadBalancerSpec !== undefined) {
instance_group_1.ApplicationLoadBalancerSpec.encode(message.applicationLoadBalancerSpec, writer.uint32(138).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({}, baseUpdateInstanceGroupRequest);
message.labels = {};
message.variables = [];
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.instanceGroupId = 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.UpdateInstanceGroupRequest_LabelsEntry.decode(reader, reader.uint32());
if (entry5.value !== undefined) {
message.labels[entry5.key] = entry5.value;
}
break;
case 6:
message.instanceTemplate = instance_group_1.InstanceTemplate.decode(reader, reader.uint32());
break;
case 7:
message.scalePolicy = instance_group_1.ScalePolicy.decode(reader, reader.uint32());
break;
case 8:
message.deployPolicy = instance_group_1.DeployPolicy.decode(reader, reader.uint32());
break;
case 9:
message.allocationPolicy = instance_group_1.AllocationPolicy.decode(reader, reader.uint32());
break;
case 11:
message.healthChecksSpec = instance_group_1.HealthChecksSpec.decode(reader, reader.uint32());
break;
case 12:
message.serviceAccountId = reader.string();
break;
case 14:
message.loadBalancerSpec = instance_group_1.LoadBalancerSpec.decode(reader, reader.uint32());
break;
case 15:
message.variables.push(instance_group_1.Variable.decode(reader, reader.uint32()));
break;
case 16:
message.deletionProtection = reader.bool();
break;
case 17:
message.applicationLoadBalancerSpec =
instance_group_1.ApplicationLoadBalancerSpec.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object) {
var _a, _b;
const message = Object.assign({}, baseUpdateInstanceGroupRequest);
message.instanceGroupId =
object.instanceGroupId !== undefined && object.instanceGroupId !== null
? String(object.instanceGroupId)
: "";
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.instanceTemplate =
object.instanceTemplate !== undefined && object.instanceTemplate !== null
? instance_group_1.InstanceTemplate.fromJSON(object.instanceTemplate)
: undefined;
message.scalePolicy =
object.scalePolicy !== undefined && object.scalePolicy !== null
? instance_group_1.ScalePolicy.fromJSON(object.scalePolicy)
: undefined;
message.deployPolicy =
object.deployPolicy !== undefined && object.deployPolicy !== null
? instance_group_1.DeployPolicy.fromJSON(object.deployPolicy)
: undefined;
message.allocationPolicy =
object.allocationPolicy !== undefined && object.allocationPolicy !== null
? instance_group_1.AllocationPolicy.fromJSON(object.allocationPolicy)
: undefined;
message.healthChecksSpec =
object.healthChecksSpec !== undefined && object.healthChecksSpec !== null
? instance_group_1.HealthChecksSpec.fromJSON(object.healthChecksSpec)
: undefined;
message.serviceAccountId =
object.serviceAccountId !== undefined && object.serviceAccountId !== null
? String(object.serviceAccountId)
: "";
message.loadBalancerSpec =
object.loadBalancerSpec !== undefined && object.loadBalancerSpec !== null
? instance_group_1.LoadBalancerSpec.fromJSON(object.loadBalancerSpec)
: undefined;
message.variables = ((_b = object.variables) !== null && _b !== void 0 ? _b : []).map((e) => instance_group_1.Variable.fromJSON(e));
message.deletionProtection =
object.deletionProtection !== undefined &&
object.deletionProtection !== null
? Boolean(object.deletionProtection)
: false;
message.applicationLoadBalancerSpec =
object.applicationLoadBalancerSpec !== undefined &&
object.applicationLoadBalancerSpec !== null
? instance_group_1.ApplicationLoadBalancerSpec.fromJSON(object.applicationLoadBalancerSpec)
: undefined;
return message;
},
toJSON(message) {
const obj = {};
message.instanceGroupId !== undefined &&
(obj.instanceGroupId = message.instanceGroupId);
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.instanceTemplate !== undefined &&
(obj.instanceTemplate = message.instanceTemplate
? instance_group_1.InstanceTemplate.toJSON(message.instanceTemplate)
: undefined);
message.scalePolicy !== undefined &&
(obj.scalePolicy = message.scalePolicy
? instance_group_1.ScalePolicy.toJSON(message.scalePolicy)
: undefined);
message.deployPolicy !== undefined &&
(obj.deployPolicy = message.deployPolicy
? instance_group_1.DeployPolicy.toJSON(message.deployPolicy)
: undefined);
message.allocationPolicy !== undefined &&
(obj.allocationPolicy = message.allocationPolicy
? instance_group_1.AllocationPolicy.toJSON(message.allocationPolicy)
: undefined);
message.healthChecksSpec !== undefined &&
(obj.healthChecksSpec = message.healthChecksSpec
? instance_group_1.HealthChecksSpec.toJSON(message.healthChecksSpec)
: undefined);
message.serviceAccountId !== undefined &&
(obj.serviceAccountId = message.serviceAccountId);
message.loadBalancerSpec !== undefined &&
(obj.loadBalancerSpec = message.loadBalancerSpec
? instance_group_1.LoadBalancerSpec.toJSON(message.loadBalancerSpec)
: undefined);
if (message.variables) {
obj.variables = message.variables.map((e) => e ? instance_group_1.Variable.toJSON(e) : undefined);
}
else {
obj.variables = [];
}
message.deletionProtection !== undefined &&
(obj.deletionProtection = message.deletionProtection);
message.applicationLoadBalancerSpec !== undefined &&
(obj.applicationLoadBalancerSpec = message.applicationLoadBalancerSpec
? instance_group_1.ApplicationLoadBalancerSpec.toJSON(message.applicationLoadBalancerSpec)
: undefined);
return obj;
},
fromPartial(object) {
var _a, _b, _c, _d, _e, _f, _g;
const message = Object.assign({}, baseUpdateInstanceGroupRequest);
message.instanceGroupId = (_a = object.instanceGroupId) !== 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.instanceTemplate =
object.instanceTemplate !== undefined && object.instanceTemplate !== null
? instance_group_1.InstanceTemplate.fromPartial(object.instanceTemplate)
: undefined;
message.scalePolicy =
object.scalePolicy !== undefined && object.scalePolicy !== null
? instance_group_1.ScalePolicy.fromPartial(object.scalePolicy)
: undefined;
message.deployPolicy =
object.deployPolicy !== undefined && object.deployPolicy !== null
? instance_group_1.DeployPolicy.fromPartial(object.deployPolicy)
: undefined;
message.allocationPolicy =
object.allocationPolicy !== undefined && object.allocationPolicy !== null
? instance_group_1.AllocationPolicy.fromPartial(object.allocationPolicy)
: undefined;
message.healthChecksSpec =
object.healthChecksSpec !== undefined && object.healthChecksSpec !== null
? instance_group_1.HealthChecksSpec.fromPartial(object.healthChecksSpec)
: undefined;
message.serviceAccountId = (_e = object.serviceAccountId) !== null && _e !== void 0 ? _e : "";
message.loadBalancerSpec =
object.loadBalancerSpec !