From 2ad098c6125f057c6c2b89a5f3a354215be72323 Mon Sep 17 00:00:00 2001 From: Pavel Sviderski Date: Thu, 20 Mar 2025 21:36:41 +1000 Subject: [PATCH] feat(deploy): introduce proto for InspectImage and InspectRemoteImage methods --- internal/machine/api/pb/docker.pb.go | 392 ++++++++++++++++++---- internal/machine/api/pb/docker.proto | 24 +- internal/machine/api/pb/docker_grpc.pb.go | 94 +++++- 3 files changed, 439 insertions(+), 71 deletions(-) diff --git a/internal/machine/api/pb/docker.pb.go b/internal/machine/api/pb/docker.pb.go index dd959aac..d656a245 100644 --- a/internal/machine/api/pb/docker.pb.go +++ b/internal/machine/api/pb/docker.pb.go @@ -671,6 +671,196 @@ func (x *JSONMessage) GetMessage() []byte { return nil } +type InspectImageRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *InspectImageRequest) Reset() { + *x = InspectImageRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_internal_machine_api_pb_docker_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InspectImageRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InspectImageRequest) ProtoMessage() {} + +func (x *InspectImageRequest) ProtoReflect() protoreflect.Message { + mi := &file_internal_machine_api_pb_docker_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InspectImageRequest.ProtoReflect.Descriptor instead. +func (*InspectImageRequest) Descriptor() ([]byte, []int) { + return file_internal_machine_api_pb_docker_proto_rawDescGZIP(), []int{12} +} + +func (x *InspectImageRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type InspectImageResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // JSON serialized types.ImageInspect. + Response []byte `protobuf:"bytes,1,opt,name=response,proto3" json:"response,omitempty"` +} + +func (x *InspectImageResponse) Reset() { + *x = InspectImageResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_internal_machine_api_pb_docker_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InspectImageResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InspectImageResponse) ProtoMessage() {} + +func (x *InspectImageResponse) ProtoReflect() protoreflect.Message { + mi := &file_internal_machine_api_pb_docker_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InspectImageResponse.ProtoReflect.Descriptor instead. +func (*InspectImageResponse) Descriptor() ([]byte, []int) { + return file_internal_machine_api_pb_docker_proto_rawDescGZIP(), []int{13} +} + +func (x *InspectImageResponse) GetResponse() []byte { + if x != nil { + return x.Response + } + return nil +} + +type InspectRemoteImageRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *InspectRemoteImageRequest) Reset() { + *x = InspectRemoteImageRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_internal_machine_api_pb_docker_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InspectRemoteImageRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InspectRemoteImageRequest) ProtoMessage() {} + +func (x *InspectRemoteImageRequest) ProtoReflect() protoreflect.Message { + mi := &file_internal_machine_api_pb_docker_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InspectRemoteImageRequest.ProtoReflect.Descriptor instead. +func (*InspectRemoteImageRequest) Descriptor() ([]byte, []int) { + return file_internal_machine_api_pb_docker_proto_rawDescGZIP(), []int{14} +} + +func (x *InspectRemoteImageRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type InspectRemoteImageResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Raw manifest data (JSON). + Manifest []byte `protobuf:"bytes,1,opt,name=manifest,proto3" json:"manifest,omitempty"` +} + +func (x *InspectRemoteImageResponse) Reset() { + *x = InspectRemoteImageResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_internal_machine_api_pb_docker_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InspectRemoteImageResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InspectRemoteImageResponse) ProtoMessage() {} + +func (x *InspectRemoteImageResponse) ProtoReflect() protoreflect.Message { + mi := &file_internal_machine_api_pb_docker_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InspectRemoteImageResponse.ProtoReflect.Descriptor instead. +func (*InspectRemoteImageResponse) Descriptor() ([]byte, []int) { + return file_internal_machine_api_pb_docker_proto_rawDescGZIP(), []int{15} +} + +func (x *InspectRemoteImageResponse) GetManifest() []byte { + if x != nil { + return x.Manifest + } + return nil +} + var File_internal_machine_api_pb_docker_proto protoreflect.FileDescriptor var file_internal_machine_api_pb_docker_proto_rawDesc = []byte{ @@ -734,43 +924,65 @@ var file_internal_machine_api_pb_docker_proto_rawDesc = []byte{ 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x27, 0x0a, 0x0b, 0x4a, 0x53, 0x4f, 0x4e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x32, 0xfc, 0x03, 0x0a, 0x06, 0x44, - 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x12, 0x4c, 0x0a, 0x0f, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, - 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x1b, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x43, - 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x72, 0x65, 0x61, - 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x4f, 0x0a, 0x10, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x43, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x1c, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x49, 0x6e, + 0x0c, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x25, 0x0a, 0x13, 0x49, 0x6e, + 0x73, 0x70, 0x65, 0x63, 0x74, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, + 0x64, 0x22, 0x32, 0x0a, 0x14, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x49, 0x6d, 0x61, 0x67, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x72, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2b, 0x0a, 0x19, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, + 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, + 0x69, 0x64, 0x22, 0x38, 0x0a, 0x1a, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x52, 0x65, 0x6d, + 0x6f, 0x74, 0x65, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x08, 0x6d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x32, 0x98, 0x05, 0x0a, + 0x06, 0x44, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x12, 0x4c, 0x0a, 0x0f, 0x43, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x1b, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4f, 0x0a, 0x10, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, + 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x1c, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x49, 0x6e, 0x73, 0x70, - 0x65, 0x63, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x0e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x43, 0x6f, 0x6e, - 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x1a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x61, - 0x72, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x42, 0x0a, 0x0d, 0x53, 0x74, - 0x6f, 0x70, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x19, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x53, 0x74, 0x6f, 0x70, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x49, - 0x0a, 0x0e, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73, - 0x12, 0x1a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x61, - 0x69, 0x6e, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, - 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x46, 0x0a, 0x0f, 0x52, 0x65, 0x6d, - 0x6f, 0x76, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x1b, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, - 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, - 0x79, 0x12, 0x36, 0x0a, 0x09, 0x50, 0x75, 0x6c, 0x6c, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x15, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x50, 0x75, 0x6c, 0x6c, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4a, 0x53, 0x4f, 0x4e, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x30, 0x01, 0x42, 0x37, 0x5a, 0x35, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x73, 0x76, 0x69, 0x64, 0x65, 0x72, 0x73, - 0x6b, 0x69, 0x2f, 0x75, 0x6e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, - 0x6e, 0x61, 0x6c, 0x2f, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, - 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x0e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x43, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x1a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x53, + 0x74, 0x61, 0x72, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x42, 0x0a, 0x0d, + 0x53, 0x74, 0x6f, 0x70, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x19, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x6f, 0x70, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, + 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, + 0x12, 0x49, 0x0a, 0x0e, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, + 0x72, 0x73, 0x12, 0x1a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x6f, 0x6e, + 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, + 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x46, 0x0a, 0x0f, 0x52, + 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x1b, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, + 0x70, 0x74, 0x79, 0x12, 0x36, 0x0a, 0x09, 0x50, 0x75, 0x6c, 0x6c, 0x49, 0x6d, 0x61, 0x67, 0x65, + 0x12, 0x15, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x50, 0x75, 0x6c, 0x6c, 0x49, 0x6d, 0x61, 0x67, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4a, 0x53, + 0x4f, 0x4e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x30, 0x01, 0x12, 0x43, 0x0a, 0x0c, 0x49, + 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x18, 0x2e, 0x61, 0x70, + 0x69, 0x2e, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x49, 0x6e, 0x73, 0x70, + 0x65, 0x63, 0x74, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x55, 0x0a, 0x12, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x52, 0x65, 0x6d, 0x6f, 0x74, + 0x65, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x1e, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x49, 0x6e, 0x73, + 0x70, 0x65, 0x63, 0x74, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x49, 0x6e, 0x73, + 0x70, 0x65, 0x63, 0x74, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x37, 0x5a, 0x35, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x73, 0x76, 0x69, 0x64, 0x65, 0x72, 0x73, 0x6b, 0x69, + 0x2f, 0x75, 0x6e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, + 0x6c, 0x2f, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x62, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -785,26 +997,30 @@ func file_internal_machine_api_pb_docker_proto_rawDescGZIP() []byte { return file_internal_machine_api_pb_docker_proto_rawDescData } -var file_internal_machine_api_pb_docker_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_internal_machine_api_pb_docker_proto_msgTypes = make([]protoimpl.MessageInfo, 16) var file_internal_machine_api_pb_docker_proto_goTypes = []any{ - (*CreateContainerRequest)(nil), // 0: api.CreateContainerRequest - (*CreateContainerResponse)(nil), // 1: api.CreateContainerResponse - (*InspectContainerRequest)(nil), // 2: api.InspectContainerRequest - (*InspectContainerResponse)(nil), // 3: api.InspectContainerResponse - (*StartContainerRequest)(nil), // 4: api.StartContainerRequest - (*StopContainerRequest)(nil), // 5: api.StopContainerRequest - (*ListContainersRequest)(nil), // 6: api.ListContainersRequest - (*ListContainersResponse)(nil), // 7: api.ListContainersResponse - (*MachineContainers)(nil), // 8: api.MachineContainers - (*RemoveContainerRequest)(nil), // 9: api.RemoveContainerRequest - (*PullImageRequest)(nil), // 10: api.PullImageRequest - (*JSONMessage)(nil), // 11: api.JSONMessage - (*Metadata)(nil), // 12: api.Metadata - (*emptypb.Empty)(nil), // 13: google.protobuf.Empty + (*CreateContainerRequest)(nil), // 0: api.CreateContainerRequest + (*CreateContainerResponse)(nil), // 1: api.CreateContainerResponse + (*InspectContainerRequest)(nil), // 2: api.InspectContainerRequest + (*InspectContainerResponse)(nil), // 3: api.InspectContainerResponse + (*StartContainerRequest)(nil), // 4: api.StartContainerRequest + (*StopContainerRequest)(nil), // 5: api.StopContainerRequest + (*ListContainersRequest)(nil), // 6: api.ListContainersRequest + (*ListContainersResponse)(nil), // 7: api.ListContainersResponse + (*MachineContainers)(nil), // 8: api.MachineContainers + (*RemoveContainerRequest)(nil), // 9: api.RemoveContainerRequest + (*PullImageRequest)(nil), // 10: api.PullImageRequest + (*JSONMessage)(nil), // 11: api.JSONMessage + (*InspectImageRequest)(nil), // 12: api.InspectImageRequest + (*InspectImageResponse)(nil), // 13: api.InspectImageResponse + (*InspectRemoteImageRequest)(nil), // 14: api.InspectRemoteImageRequest + (*InspectRemoteImageResponse)(nil), // 15: api.InspectRemoteImageResponse + (*Metadata)(nil), // 16: api.Metadata + (*emptypb.Empty)(nil), // 17: google.protobuf.Empty } var file_internal_machine_api_pb_docker_proto_depIdxs = []int32{ 8, // 0: api.ListContainersResponse.messages:type_name -> api.MachineContainers - 12, // 1: api.MachineContainers.metadata:type_name -> api.Metadata + 16, // 1: api.MachineContainers.metadata:type_name -> api.Metadata 0, // 2: api.Docker.CreateContainer:input_type -> api.CreateContainerRequest 2, // 3: api.Docker.InspectContainer:input_type -> api.InspectContainerRequest 4, // 4: api.Docker.StartContainer:input_type -> api.StartContainerRequest @@ -812,15 +1028,19 @@ var file_internal_machine_api_pb_docker_proto_depIdxs = []int32{ 6, // 6: api.Docker.ListContainers:input_type -> api.ListContainersRequest 9, // 7: api.Docker.RemoveContainer:input_type -> api.RemoveContainerRequest 10, // 8: api.Docker.PullImage:input_type -> api.PullImageRequest - 1, // 9: api.Docker.CreateContainer:output_type -> api.CreateContainerResponse - 3, // 10: api.Docker.InspectContainer:output_type -> api.InspectContainerResponse - 13, // 11: api.Docker.StartContainer:output_type -> google.protobuf.Empty - 13, // 12: api.Docker.StopContainer:output_type -> google.protobuf.Empty - 7, // 13: api.Docker.ListContainers:output_type -> api.ListContainersResponse - 13, // 14: api.Docker.RemoveContainer:output_type -> google.protobuf.Empty - 11, // 15: api.Docker.PullImage:output_type -> api.JSONMessage - 9, // [9:16] is the sub-list for method output_type - 2, // [2:9] is the sub-list for method input_type + 12, // 9: api.Docker.InspectImage:input_type -> api.InspectImageRequest + 14, // 10: api.Docker.InspectRemoteImage:input_type -> api.InspectRemoteImageRequest + 1, // 11: api.Docker.CreateContainer:output_type -> api.CreateContainerResponse + 3, // 12: api.Docker.InspectContainer:output_type -> api.InspectContainerResponse + 17, // 13: api.Docker.StartContainer:output_type -> google.protobuf.Empty + 17, // 14: api.Docker.StopContainer:output_type -> google.protobuf.Empty + 7, // 15: api.Docker.ListContainers:output_type -> api.ListContainersResponse + 17, // 16: api.Docker.RemoveContainer:output_type -> google.protobuf.Empty + 11, // 17: api.Docker.PullImage:output_type -> api.JSONMessage + 13, // 18: api.Docker.InspectImage:output_type -> api.InspectImageResponse + 15, // 19: api.Docker.InspectRemoteImage:output_type -> api.InspectRemoteImageResponse + 11, // [11:20] is the sub-list for method output_type + 2, // [2:11] is the sub-list for method input_type 2, // [2:2] is the sub-list for extension type_name 2, // [2:2] is the sub-list for extension extendee 0, // [0:2] is the sub-list for field type_name @@ -977,6 +1197,54 @@ func file_internal_machine_api_pb_docker_proto_init() { return nil } } + file_internal_machine_api_pb_docker_proto_msgTypes[12].Exporter = func(v any, i int) any { + switch v := v.(*InspectImageRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_internal_machine_api_pb_docker_proto_msgTypes[13].Exporter = func(v any, i int) any { + switch v := v.(*InspectImageResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_internal_machine_api_pb_docker_proto_msgTypes[14].Exporter = func(v any, i int) any { + switch v := v.(*InspectRemoteImageRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_internal_machine_api_pb_docker_proto_msgTypes[15].Exporter = func(v any, i int) any { + switch v := v.(*InspectRemoteImageResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -984,7 +1252,7 @@ func file_internal_machine_api_pb_docker_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_internal_machine_api_pb_docker_proto_rawDesc, NumEnums: 0, - NumMessages: 12, + NumMessages: 16, NumExtensions: 0, NumServices: 1, }, diff --git a/internal/machine/api/pb/docker.proto b/internal/machine/api/pb/docker.proto index 35f5a22e..f16fe392 100644 --- a/internal/machine/api/pb/docker.proto +++ b/internal/machine/api/pb/docker.proto @@ -15,8 +15,10 @@ service Docker { rpc ListContainers(ListContainersRequest) returns (ListContainersResponse); rpc RemoveContainer(RemoveContainerRequest) returns (google.protobuf.Empty); rpc PullImage(PullImageRequest) returns (stream JSONMessage); - // TODO: implement InspectImageFromRegistry to resolve image name to digest and supported platforms using - // the configured Docker auth. + rpc InspectImage(InspectImageRequest) returns (InspectImageResponse); + // InspectRemoteImage returns the image metadata for an image in a remote registry using the machine's + // Docker auth credentials if necessary. + rpc InspectRemoteImage(InspectRemoteImageRequest) returns (InspectRemoteImageResponse); } message CreateContainerRequest { @@ -89,3 +91,21 @@ message JSONMessage { // JSON serialized jsonmessage.JSONMessage. bytes message = 1; } + +message InspectImageRequest { + string id = 1; +} + +message InspectImageResponse { + // JSON serialized types.ImageInspect. + bytes response = 1; +} + +message InspectRemoteImageRequest { + string id = 1; +} + +message InspectRemoteImageResponse { + // Raw manifest data (JSON). + bytes manifest = 1; +} diff --git a/internal/machine/api/pb/docker_grpc.pb.go b/internal/machine/api/pb/docker_grpc.pb.go index 5715be6a..32ad607e 100644 --- a/internal/machine/api/pb/docker_grpc.pb.go +++ b/internal/machine/api/pb/docker_grpc.pb.go @@ -20,13 +20,15 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( - Docker_CreateContainer_FullMethodName = "/api.Docker/CreateContainer" - Docker_InspectContainer_FullMethodName = "/api.Docker/InspectContainer" - Docker_StartContainer_FullMethodName = "/api.Docker/StartContainer" - Docker_StopContainer_FullMethodName = "/api.Docker/StopContainer" - Docker_ListContainers_FullMethodName = "/api.Docker/ListContainers" - Docker_RemoveContainer_FullMethodName = "/api.Docker/RemoveContainer" - Docker_PullImage_FullMethodName = "/api.Docker/PullImage" + Docker_CreateContainer_FullMethodName = "/api.Docker/CreateContainer" + Docker_InspectContainer_FullMethodName = "/api.Docker/InspectContainer" + Docker_StartContainer_FullMethodName = "/api.Docker/StartContainer" + Docker_StopContainer_FullMethodName = "/api.Docker/StopContainer" + Docker_ListContainers_FullMethodName = "/api.Docker/ListContainers" + Docker_RemoveContainer_FullMethodName = "/api.Docker/RemoveContainer" + Docker_PullImage_FullMethodName = "/api.Docker/PullImage" + Docker_InspectImage_FullMethodName = "/api.Docker/InspectImage" + Docker_InspectRemoteImage_FullMethodName = "/api.Docker/InspectRemoteImage" ) // DockerClient is the client API for Docker service. @@ -40,6 +42,10 @@ type DockerClient interface { ListContainers(ctx context.Context, in *ListContainersRequest, opts ...grpc.CallOption) (*ListContainersResponse, error) RemoveContainer(ctx context.Context, in *RemoveContainerRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) PullImage(ctx context.Context, in *PullImageRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[JSONMessage], error) + InspectImage(ctx context.Context, in *InspectImageRequest, opts ...grpc.CallOption) (*InspectImageResponse, error) + // InspectRemoteImage returns the image metadata for an image in a remote registry using the machine's + // Docker auth credentials if necessary. + InspectRemoteImage(ctx context.Context, in *InspectRemoteImageRequest, opts ...grpc.CallOption) (*InspectRemoteImageResponse, error) } type dockerClient struct { @@ -129,6 +135,26 @@ func (c *dockerClient) PullImage(ctx context.Context, in *PullImageRequest, opts // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. type Docker_PullImageClient = grpc.ServerStreamingClient[JSONMessage] +func (c *dockerClient) InspectImage(ctx context.Context, in *InspectImageRequest, opts ...grpc.CallOption) (*InspectImageResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(InspectImageResponse) + err := c.cc.Invoke(ctx, Docker_InspectImage_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *dockerClient) InspectRemoteImage(ctx context.Context, in *InspectRemoteImageRequest, opts ...grpc.CallOption) (*InspectRemoteImageResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(InspectRemoteImageResponse) + err := c.cc.Invoke(ctx, Docker_InspectRemoteImage_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + // DockerServer is the server API for Docker service. // All implementations must embed UnimplementedDockerServer // for forward compatibility. @@ -140,6 +166,10 @@ type DockerServer interface { ListContainers(context.Context, *ListContainersRequest) (*ListContainersResponse, error) RemoveContainer(context.Context, *RemoveContainerRequest) (*emptypb.Empty, error) PullImage(*PullImageRequest, grpc.ServerStreamingServer[JSONMessage]) error + InspectImage(context.Context, *InspectImageRequest) (*InspectImageResponse, error) + // InspectRemoteImage returns the image metadata for an image in a remote registry using the machine's + // Docker auth credentials if necessary. + InspectRemoteImage(context.Context, *InspectRemoteImageRequest) (*InspectRemoteImageResponse, error) mustEmbedUnimplementedDockerServer() } @@ -171,6 +201,12 @@ func (UnimplementedDockerServer) RemoveContainer(context.Context, *RemoveContain func (UnimplementedDockerServer) PullImage(*PullImageRequest, grpc.ServerStreamingServer[JSONMessage]) error { return status.Errorf(codes.Unimplemented, "method PullImage not implemented") } +func (UnimplementedDockerServer) InspectImage(context.Context, *InspectImageRequest) (*InspectImageResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method InspectImage not implemented") +} +func (UnimplementedDockerServer) InspectRemoteImage(context.Context, *InspectRemoteImageRequest) (*InspectRemoteImageResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method InspectRemoteImage not implemented") +} func (UnimplementedDockerServer) mustEmbedUnimplementedDockerServer() {} func (UnimplementedDockerServer) testEmbeddedByValue() {} @@ -311,6 +347,42 @@ func _Docker_PullImage_Handler(srv interface{}, stream grpc.ServerStream) error // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. type Docker_PullImageServer = grpc.ServerStreamingServer[JSONMessage] +func _Docker_InspectImage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(InspectImageRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DockerServer).InspectImage(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Docker_InspectImage_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DockerServer).InspectImage(ctx, req.(*InspectImageRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Docker_InspectRemoteImage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(InspectRemoteImageRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DockerServer).InspectRemoteImage(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Docker_InspectRemoteImage_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DockerServer).InspectRemoteImage(ctx, req.(*InspectRemoteImageRequest)) + } + return interceptor(ctx, in, info, handler) +} + // Docker_ServiceDesc is the grpc.ServiceDesc for Docker service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -342,6 +414,14 @@ var Docker_ServiceDesc = grpc.ServiceDesc{ MethodName: "RemoveContainer", Handler: _Docker_RemoveContainer_Handler, }, + { + MethodName: "InspectImage", + Handler: _Docker_InspectImage_Handler, + }, + { + MethodName: "InspectRemoteImage", + Handler: _Docker_InspectRemoteImage_Handler, + }, }, Streams: []grpc.StreamDesc{ {