зеркало из https://github.com/docker/node-sdk.git
Add container Host config, getting CPU / Memory reservations and limits in container info
Signed-off-by: Guillaume Tardif <guillaume.tardif@docker.com>
This commit is contained in:
Родитель
bbd38be6fb
Коммит
2f05bef3aa
|
@ -45,14 +45,26 @@ message Container {
|
|||
string command = 4;
|
||||
uint64 cpu_time = 5;
|
||||
uint64 memory_usage = 6;
|
||||
// kept for breaking change for now, moved to HostConfig
|
||||
uint64 memory_limit = 7;
|
||||
uint64 pids_current = 8;
|
||||
uint64 pids_limit = 9;
|
||||
repeated string labels = 10;
|
||||
repeated Port ports = 11;
|
||||
// kept for breaking change for now, moved to HostConfig
|
||||
uint64 cpu_limit = 12;
|
||||
string platform = 13;
|
||||
// kept for breaking change for now, moved to HostConfig
|
||||
string restart_policy_condition = 14;
|
||||
HostConfig host_config = 15;
|
||||
}
|
||||
|
||||
message HostConfig {
|
||||
uint64 memory_reservation = 1;
|
||||
uint64 memory_limit = 2;
|
||||
uint64 cpu_reservation = 3;
|
||||
uint64 cpu_limit = 4;
|
||||
string restart_policy = 5;
|
||||
}
|
||||
|
||||
message InspectRequest {
|
||||
|
|
|
@ -87,6 +87,12 @@ export class Container extends jspb.Message {
|
|||
setRestartPolicyCondition(value: string): Container;
|
||||
|
||||
|
||||
hasHostConfig(): boolean;
|
||||
clearHostConfig(): void;
|
||||
getHostConfig(): HostConfig | undefined;
|
||||
setHostConfig(value?: HostConfig): Container;
|
||||
|
||||
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): Container.AsObject;
|
||||
static toObject(includeInstance: boolean, msg: Container): Container.AsObject;
|
||||
|
@ -113,6 +119,44 @@ export namespace Container {
|
|||
cpuLimit: number,
|
||||
platform: string,
|
||||
restartPolicyCondition: string,
|
||||
hostConfig?: HostConfig.AsObject,
|
||||
}
|
||||
}
|
||||
|
||||
export class HostConfig extends jspb.Message {
|
||||
getMemoryReservation(): number;
|
||||
setMemoryReservation(value: number): HostConfig;
|
||||
|
||||
getMemoryLimit(): number;
|
||||
setMemoryLimit(value: number): HostConfig;
|
||||
|
||||
getCpuReservation(): number;
|
||||
setCpuReservation(value: number): HostConfig;
|
||||
|
||||
getCpuLimit(): number;
|
||||
setCpuLimit(value: number): HostConfig;
|
||||
|
||||
getRestartPolicy(): string;
|
||||
setRestartPolicy(value: string): HostConfig;
|
||||
|
||||
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): HostConfig.AsObject;
|
||||
static toObject(includeInstance: boolean, msg: HostConfig): HostConfig.AsObject;
|
||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||
static serializeBinaryToWriter(message: HostConfig, writer: jspb.BinaryWriter): void;
|
||||
static deserializeBinary(bytes: Uint8Array): HostConfig;
|
||||
static deserializeBinaryFromReader(message: HostConfig, reader: jspb.BinaryReader): HostConfig;
|
||||
}
|
||||
|
||||
export namespace HostConfig {
|
||||
export type AsObject = {
|
||||
memoryReservation: number,
|
||||
memoryLimit: number,
|
||||
cpuReservation: number,
|
||||
cpuLimit: number,
|
||||
restartPolicy: string,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ goog.exportSymbol('proto.com.docker.api.protos.containers.v1.DeleteRequest', nul
|
|||
goog.exportSymbol('proto.com.docker.api.protos.containers.v1.DeleteResponse', null, global);
|
||||
goog.exportSymbol('proto.com.docker.api.protos.containers.v1.ExecRequest', null, global);
|
||||
goog.exportSymbol('proto.com.docker.api.protos.containers.v1.ExecResponse', null, global);
|
||||
goog.exportSymbol('proto.com.docker.api.protos.containers.v1.HostConfig', null, global);
|
||||
goog.exportSymbol('proto.com.docker.api.protos.containers.v1.InspectRequest', null, global);
|
||||
goog.exportSymbol('proto.com.docker.api.protos.containers.v1.InspectResponse', null, global);
|
||||
goog.exportSymbol('proto.com.docker.api.protos.containers.v1.KillRequest', null, global);
|
||||
|
@ -74,6 +75,27 @@ if (goog.DEBUG && !COMPILED) {
|
|||
*/
|
||||
proto.com.docker.api.protos.containers.v1.Container.displayName = 'proto.com.docker.api.protos.containers.v1.Container';
|
||||
}
|
||||
/**
|
||||
* Generated by JsPbCodeGenerator.
|
||||
* @param {Array=} opt_data Optional initial data array, typically from a
|
||||
* server response, or constructed directly in Javascript. The array is used
|
||||
* in place and becomes part of the constructed object. It is not cloned.
|
||||
* If no data is provided, the constructed object will be empty, but still
|
||||
* valid.
|
||||
* @extends {jspb.Message}
|
||||
* @constructor
|
||||
*/
|
||||
proto.com.docker.api.protos.containers.v1.HostConfig = function(opt_data) {
|
||||
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
|
||||
};
|
||||
goog.inherits(proto.com.docker.api.protos.containers.v1.HostConfig, jspb.Message);
|
||||
if (goog.DEBUG && !COMPILED) {
|
||||
/**
|
||||
* @public
|
||||
* @override
|
||||
*/
|
||||
proto.com.docker.api.protos.containers.v1.HostConfig.displayName = 'proto.com.docker.api.protos.containers.v1.HostConfig';
|
||||
}
|
||||
/**
|
||||
* Generated by JsPbCodeGenerator.
|
||||
* @param {Array=} opt_data Optional initial data array, typically from a
|
||||
|
@ -725,7 +747,8 @@ proto.com.docker.api.protos.containers.v1.Container.toObject = function(includeI
|
|||
proto.com.docker.api.protos.containers.v1.Port.toObject, includeInstance),
|
||||
cpuLimit: jspb.Message.getFieldWithDefault(msg, 12, 0),
|
||||
platform: jspb.Message.getFieldWithDefault(msg, 13, ""),
|
||||
restartPolicyCondition: jspb.Message.getFieldWithDefault(msg, 14, "")
|
||||
restartPolicyCondition: jspb.Message.getFieldWithDefault(msg, 14, ""),
|
||||
hostConfig: (f = msg.getHostConfig()) && proto.com.docker.api.protos.containers.v1.HostConfig.toObject(includeInstance, f)
|
||||
};
|
||||
|
||||
if (includeInstance) {
|
||||
|
@ -819,6 +842,11 @@ proto.com.docker.api.protos.containers.v1.Container.deserializeBinaryFromReader
|
|||
var value = /** @type {string} */ (reader.readString());
|
||||
msg.setRestartPolicyCondition(value);
|
||||
break;
|
||||
case 15:
|
||||
var value = new proto.com.docker.api.protos.containers.v1.HostConfig;
|
||||
reader.readMessage(value,proto.com.docker.api.protos.containers.v1.HostConfig.deserializeBinaryFromReader);
|
||||
msg.setHostConfig(value);
|
||||
break;
|
||||
default:
|
||||
reader.skipField();
|
||||
break;
|
||||
|
@ -947,6 +975,14 @@ proto.com.docker.api.protos.containers.v1.Container.serializeBinaryToWriter = fu
|
|||
f
|
||||
);
|
||||
}
|
||||
f = message.getHostConfig();
|
||||
if (f != null) {
|
||||
writer.writeMessage(
|
||||
15,
|
||||
f,
|
||||
proto.com.docker.api.protos.containers.v1.HostConfig.serializeBinaryToWriter
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -1241,6 +1277,293 @@ proto.com.docker.api.protos.containers.v1.Container.prototype.setRestartPolicyCo
|
|||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional HostConfig host_config = 15;
|
||||
* @return {?proto.com.docker.api.protos.containers.v1.HostConfig}
|
||||
*/
|
||||
proto.com.docker.api.protos.containers.v1.Container.prototype.getHostConfig = function() {
|
||||
return /** @type{?proto.com.docker.api.protos.containers.v1.HostConfig} */ (
|
||||
jspb.Message.getWrapperField(this, proto.com.docker.api.protos.containers.v1.HostConfig, 15));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {?proto.com.docker.api.protos.containers.v1.HostConfig|undefined} value
|
||||
* @return {!proto.com.docker.api.protos.containers.v1.Container} returns this
|
||||
*/
|
||||
proto.com.docker.api.protos.containers.v1.Container.prototype.setHostConfig = function(value) {
|
||||
return jspb.Message.setWrapperField(this, 15, value);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Clears the message field making it undefined.
|
||||
* @return {!proto.com.docker.api.protos.containers.v1.Container} returns this
|
||||
*/
|
||||
proto.com.docker.api.protos.containers.v1.Container.prototype.clearHostConfig = function() {
|
||||
return this.setHostConfig(undefined);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether this field is set.
|
||||
* @return {boolean}
|
||||
*/
|
||||
proto.com.docker.api.protos.containers.v1.Container.prototype.hasHostConfig = function() {
|
||||
return jspb.Message.getField(this, 15) != null;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (jspb.Message.GENERATE_TO_OBJECT) {
|
||||
/**
|
||||
* Creates an object representation of this proto.
|
||||
* Field names that are reserved in JavaScript and will be renamed to pb_name.
|
||||
* Optional fields that are not set will be set to undefined.
|
||||
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
|
||||
* For the list of reserved names please see:
|
||||
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
|
||||
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
|
||||
* JSPB instance for transitional soy proto support:
|
||||
* http://goto/soy-param-migration
|
||||
* @return {!Object}
|
||||
*/
|
||||
proto.com.docker.api.protos.containers.v1.HostConfig.prototype.toObject = function(opt_includeInstance) {
|
||||
return proto.com.docker.api.protos.containers.v1.HostConfig.toObject(opt_includeInstance, this);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Static version of the {@see toObject} method.
|
||||
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
|
||||
* the JSPB instance for transitional soy proto support:
|
||||
* http://goto/soy-param-migration
|
||||
* @param {!proto.com.docker.api.protos.containers.v1.HostConfig} msg The msg instance to transform.
|
||||
* @return {!Object}
|
||||
* @suppress {unusedLocalVariables} f is only used for nested messages
|
||||
*/
|
||||
proto.com.docker.api.protos.containers.v1.HostConfig.toObject = function(includeInstance, msg) {
|
||||
var f, obj = {
|
||||
memoryReservation: jspb.Message.getFieldWithDefault(msg, 1, 0),
|
||||
memoryLimit: jspb.Message.getFieldWithDefault(msg, 2, 0),
|
||||
cpuReservation: jspb.Message.getFieldWithDefault(msg, 3, 0),
|
||||
cpuLimit: jspb.Message.getFieldWithDefault(msg, 4, 0),
|
||||
restartPolicy: jspb.Message.getFieldWithDefault(msg, 5, "")
|
||||
};
|
||||
|
||||
if (includeInstance) {
|
||||
obj.$jspbMessageInstance = msg;
|
||||
}
|
||||
return obj;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Deserializes binary data (in protobuf wire format).
|
||||
* @param {jspb.ByteSource} bytes The bytes to deserialize.
|
||||
* @return {!proto.com.docker.api.protos.containers.v1.HostConfig}
|
||||
*/
|
||||
proto.com.docker.api.protos.containers.v1.HostConfig.deserializeBinary = function(bytes) {
|
||||
var reader = new jspb.BinaryReader(bytes);
|
||||
var msg = new proto.com.docker.api.protos.containers.v1.HostConfig;
|
||||
return proto.com.docker.api.protos.containers.v1.HostConfig.deserializeBinaryFromReader(msg, reader);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Deserializes binary data (in protobuf wire format) from the
|
||||
* given reader into the given message object.
|
||||
* @param {!proto.com.docker.api.protos.containers.v1.HostConfig} msg The message object to deserialize into.
|
||||
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
|
||||
* @return {!proto.com.docker.api.protos.containers.v1.HostConfig}
|
||||
*/
|
||||
proto.com.docker.api.protos.containers.v1.HostConfig.deserializeBinaryFromReader = function(msg, reader) {
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup()) {
|
||||
break;
|
||||
}
|
||||
var field = reader.getFieldNumber();
|
||||
switch (field) {
|
||||
case 1:
|
||||
var value = /** @type {number} */ (reader.readUint64());
|
||||
msg.setMemoryReservation(value);
|
||||
break;
|
||||
case 2:
|
||||
var value = /** @type {number} */ (reader.readUint64());
|
||||
msg.setMemoryLimit(value);
|
||||
break;
|
||||
case 3:
|
||||
var value = /** @type {number} */ (reader.readUint64());
|
||||
msg.setCpuReservation(value);
|
||||
break;
|
||||
case 4:
|
||||
var value = /** @type {number} */ (reader.readUint64());
|
||||
msg.setCpuLimit(value);
|
||||
break;
|
||||
case 5:
|
||||
var value = /** @type {string} */ (reader.readString());
|
||||
msg.setRestartPolicy(value);
|
||||
break;
|
||||
default:
|
||||
reader.skipField();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return msg;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Serializes the message to binary data (in protobuf wire format).
|
||||
* @return {!Uint8Array}
|
||||
*/
|
||||
proto.com.docker.api.protos.containers.v1.HostConfig.prototype.serializeBinary = function() {
|
||||
var writer = new jspb.BinaryWriter();
|
||||
proto.com.docker.api.protos.containers.v1.HostConfig.serializeBinaryToWriter(this, writer);
|
||||
return writer.getResultBuffer();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Serializes the given message to binary data (in protobuf wire
|
||||
* format), writing to the given BinaryWriter.
|
||||
* @param {!proto.com.docker.api.protos.containers.v1.HostConfig} message
|
||||
* @param {!jspb.BinaryWriter} writer
|
||||
* @suppress {unusedLocalVariables} f is only used for nested messages
|
||||
*/
|
||||
proto.com.docker.api.protos.containers.v1.HostConfig.serializeBinaryToWriter = function(message, writer) {
|
||||
var f = undefined;
|
||||
f = message.getMemoryReservation();
|
||||
if (f !== 0) {
|
||||
writer.writeUint64(
|
||||
1,
|
||||
f
|
||||
);
|
||||
}
|
||||
f = message.getMemoryLimit();
|
||||
if (f !== 0) {
|
||||
writer.writeUint64(
|
||||
2,
|
||||
f
|
||||
);
|
||||
}
|
||||
f = message.getCpuReservation();
|
||||
if (f !== 0) {
|
||||
writer.writeUint64(
|
||||
3,
|
||||
f
|
||||
);
|
||||
}
|
||||
f = message.getCpuLimit();
|
||||
if (f !== 0) {
|
||||
writer.writeUint64(
|
||||
4,
|
||||
f
|
||||
);
|
||||
}
|
||||
f = message.getRestartPolicy();
|
||||
if (f.length > 0) {
|
||||
writer.writeString(
|
||||
5,
|
||||
f
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional uint64 memory_reservation = 1;
|
||||
* @return {number}
|
||||
*/
|
||||
proto.com.docker.api.protos.containers.v1.HostConfig.prototype.getMemoryReservation = function() {
|
||||
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {number} value
|
||||
* @return {!proto.com.docker.api.protos.containers.v1.HostConfig} returns this
|
||||
*/
|
||||
proto.com.docker.api.protos.containers.v1.HostConfig.prototype.setMemoryReservation = function(value) {
|
||||
return jspb.Message.setProto3IntField(this, 1, value);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional uint64 memory_limit = 2;
|
||||
* @return {number}
|
||||
*/
|
||||
proto.com.docker.api.protos.containers.v1.HostConfig.prototype.getMemoryLimit = function() {
|
||||
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {number} value
|
||||
* @return {!proto.com.docker.api.protos.containers.v1.HostConfig} returns this
|
||||
*/
|
||||
proto.com.docker.api.protos.containers.v1.HostConfig.prototype.setMemoryLimit = function(value) {
|
||||
return jspb.Message.setProto3IntField(this, 2, value);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional uint64 cpu_reservation = 3;
|
||||
* @return {number}
|
||||
*/
|
||||
proto.com.docker.api.protos.containers.v1.HostConfig.prototype.getCpuReservation = function() {
|
||||
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {number} value
|
||||
* @return {!proto.com.docker.api.protos.containers.v1.HostConfig} returns this
|
||||
*/
|
||||
proto.com.docker.api.protos.containers.v1.HostConfig.prototype.setCpuReservation = function(value) {
|
||||
return jspb.Message.setProto3IntField(this, 3, value);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional uint64 cpu_limit = 4;
|
||||
* @return {number}
|
||||
*/
|
||||
proto.com.docker.api.protos.containers.v1.HostConfig.prototype.getCpuLimit = function() {
|
||||
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {number} value
|
||||
* @return {!proto.com.docker.api.protos.containers.v1.HostConfig} returns this
|
||||
*/
|
||||
proto.com.docker.api.protos.containers.v1.HostConfig.prototype.setCpuLimit = function(value) {
|
||||
return jspb.Message.setProto3IntField(this, 4, value);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional string restart_policy = 5;
|
||||
* @return {string}
|
||||
*/
|
||||
proto.com.docker.api.protos.containers.v1.HostConfig.prototype.getRestartPolicy = function() {
|
||||
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, ""));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @return {!proto.com.docker.api.protos.containers.v1.HostConfig} returns this
|
||||
*/
|
||||
proto.com.docker.api.protos.containers.v1.HostConfig.prototype.setRestartPolicy = function(value) {
|
||||
return jspb.Message.setProto3StringField(this, 5, value);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче