diff --git a/components/content-service-api/go/log.pb.go b/components/content-service-api/go/headless-log.pb.go similarity index 51% rename from components/content-service-api/go/log.pb.go rename to components/content-service-api/go/headless-log.pb.go index a219c575adfa97..478c82277e8ace 100644 --- a/components/content-service-api/go/log.pb.go +++ b/components/content-service-api/go/headless-log.pb.go @@ -6,7 +6,7 @@ // versions: // protoc-gen-go v1.26.0 // protoc v3.15.5 -// source: log.proto +// source: headless-log.proto package api @@ -38,7 +38,7 @@ type LogDownloadURLRequest struct { func (x *LogDownloadURLRequest) Reset() { *x = LogDownloadURLRequest{} if protoimpl.UnsafeEnabled { - mi := &file_log_proto_msgTypes[0] + mi := &file_headless_log_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -51,7 +51,7 @@ func (x *LogDownloadURLRequest) String() string { func (*LogDownloadURLRequest) ProtoMessage() {} func (x *LogDownloadURLRequest) ProtoReflect() protoreflect.Message { - mi := &file_log_proto_msgTypes[0] + mi := &file_headless_log_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -64,7 +64,7 @@ func (x *LogDownloadURLRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use LogDownloadURLRequest.ProtoReflect.Descriptor instead. func (*LogDownloadURLRequest) Descriptor() ([]byte, []int) { - return file_log_proto_rawDescGZIP(), []int{0} + return file_headless_log_proto_rawDescGZIP(), []int{0} } func (x *LogDownloadURLRequest) GetOwnerId() string { @@ -106,7 +106,7 @@ type LogDownloadURLResponse struct { func (x *LogDownloadURLResponse) Reset() { *x = LogDownloadURLResponse{} if protoimpl.UnsafeEnabled { - mi := &file_log_proto_msgTypes[1] + mi := &file_headless_log_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -119,7 +119,7 @@ func (x *LogDownloadURLResponse) String() string { func (*LogDownloadURLResponse) ProtoMessage() {} func (x *LogDownloadURLResponse) ProtoReflect() protoreflect.Message { - mi := &file_log_proto_msgTypes[1] + mi := &file_headless_log_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -132,7 +132,7 @@ func (x *LogDownloadURLResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use LogDownloadURLResponse.ProtoReflect.Descriptor instead. func (*LogDownloadURLResponse) Descriptor() ([]byte, []int) { - return file_log_proto_rawDescGZIP(), []int{1} + return file_headless_log_proto_rawDescGZIP(), []int{1} } func (x *LogDownloadURLResponse) GetUrl() string { @@ -142,7 +142,7 @@ func (x *LogDownloadURLResponse) GetUrl() string { return "" } -type ListPrebuildLogsRequest struct { +type ListLogsRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -152,23 +152,23 @@ type ListPrebuildLogsRequest struct { InstanceId string `protobuf:"bytes,3,opt,name=instance_id,json=instanceId,proto3" json:"instance_id,omitempty"` } -func (x *ListPrebuildLogsRequest) Reset() { - *x = ListPrebuildLogsRequest{} +func (x *ListLogsRequest) Reset() { + *x = ListLogsRequest{} if protoimpl.UnsafeEnabled { - mi := &file_log_proto_msgTypes[2] + mi := &file_headless_log_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *ListPrebuildLogsRequest) String() string { +func (x *ListLogsRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ListPrebuildLogsRequest) ProtoMessage() {} +func (*ListLogsRequest) ProtoMessage() {} -func (x *ListPrebuildLogsRequest) ProtoReflect() protoreflect.Message { - mi := &file_log_proto_msgTypes[2] +func (x *ListLogsRequest) ProtoReflect() protoreflect.Message { + mi := &file_headless_log_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -179,33 +179,33 @@ func (x *ListPrebuildLogsRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ListPrebuildLogsRequest.ProtoReflect.Descriptor instead. -func (*ListPrebuildLogsRequest) Descriptor() ([]byte, []int) { - return file_log_proto_rawDescGZIP(), []int{2} +// Deprecated: Use ListLogsRequest.ProtoReflect.Descriptor instead. +func (*ListLogsRequest) Descriptor() ([]byte, []int) { + return file_headless_log_proto_rawDescGZIP(), []int{2} } -func (x *ListPrebuildLogsRequest) GetOwnerId() string { +func (x *ListLogsRequest) GetOwnerId() string { if x != nil { return x.OwnerId } return "" } -func (x *ListPrebuildLogsRequest) GetWorkspaceId() string { +func (x *ListLogsRequest) GetWorkspaceId() string { if x != nil { return x.WorkspaceId } return "" } -func (x *ListPrebuildLogsRequest) GetInstanceId() string { +func (x *ListLogsRequest) GetInstanceId() string { if x != nil { return x.InstanceId } return "" } -type ListPrebuildLogsResponse struct { +type ListLogsResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -213,23 +213,23 @@ type ListPrebuildLogsResponse struct { TaskId []string `protobuf:"bytes,1,rep,name=taskId,proto3" json:"taskId,omitempty"` } -func (x *ListPrebuildLogsResponse) Reset() { - *x = ListPrebuildLogsResponse{} +func (x *ListLogsResponse) Reset() { + *x = ListLogsResponse{} if protoimpl.UnsafeEnabled { - mi := &file_log_proto_msgTypes[3] + mi := &file_headless_log_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *ListPrebuildLogsResponse) String() string { +func (x *ListLogsResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ListPrebuildLogsResponse) ProtoMessage() {} +func (*ListLogsResponse) ProtoMessage() {} -func (x *ListPrebuildLogsResponse) ProtoReflect() protoreflect.Message { - mi := &file_log_proto_msgTypes[3] +func (x *ListLogsResponse) ProtoReflect() protoreflect.Message { + mi := &file_headless_log_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -240,89 +240,88 @@ func (x *ListPrebuildLogsResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ListPrebuildLogsResponse.ProtoReflect.Descriptor instead. -func (*ListPrebuildLogsResponse) Descriptor() ([]byte, []int) { - return file_log_proto_rawDescGZIP(), []int{3} +// Deprecated: Use ListLogsResponse.ProtoReflect.Descriptor instead. +func (*ListLogsResponse) Descriptor() ([]byte, []int) { + return file_headless_log_proto_rawDescGZIP(), []int{3} } -func (x *ListPrebuildLogsResponse) GetTaskId() []string { +func (x *ListLogsResponse) GetTaskId() []string { if x != nil { return x.TaskId } return nil } -var File_log_proto protoreflect.FileDescriptor - -var file_log_proto_rawDesc = []byte{ - 0x0a, 0x09, 0x6c, 0x6f, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x63, 0x6f, 0x6e, - 0x74, 0x65, 0x6e, 0x74, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x22, 0x8f, 0x01, 0x0a, 0x15, - 0x4c, 0x6f, 0x67, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x55, 0x52, 0x4c, 0x52, 0x65, +var File_headless_log_proto protoreflect.FileDescriptor + +var file_headless_log_proto_rawDesc = []byte{ + 0x0a, 0x12, 0x68, 0x65, 0x61, 0x64, 0x6c, 0x65, 0x73, 0x73, 0x2d, 0x6c, 0x6f, 0x67, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x22, 0x8f, 0x01, 0x0a, 0x15, 0x4c, 0x6f, 0x67, 0x44, 0x6f, 0x77, 0x6e, + 0x6c, 0x6f, 0x61, 0x64, 0x55, 0x52, 0x4c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, + 0x0a, 0x08, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x77, 0x6f, 0x72, + 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0b, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, + 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0a, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x12, 0x17, 0x0a, + 0x07, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, + 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x22, 0x2a, 0x0a, 0x16, 0x4c, 0x6f, 0x67, 0x44, 0x6f, 0x77, + 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x55, 0x52, 0x4c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, + 0x72, 0x6c, 0x22, 0x70, 0x0a, 0x0f, 0x4c, 0x69, 0x73, 0x74, 0x4c, 0x6f, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, - 0x63, 0x65, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x69, 0x64, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x22, 0x2a, 0x0a, - 0x16, 0x4c, 0x6f, 0x67, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x55, 0x52, 0x4c, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x22, 0x78, 0x0a, 0x17, 0x4c, 0x69, 0x73, - 0x74, 0x50, 0x72, 0x65, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x4c, 0x6f, 0x67, 0x73, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, - 0x21, 0x0a, 0x0c, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, - 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x69, - 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, - 0x65, 0x49, 0x64, 0x22, 0x32, 0x0a, 0x18, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x72, 0x65, 0x62, 0x75, - 0x69, 0x6c, 0x64, 0x4c, 0x6f, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x16, 0x0a, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, - 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x32, 0xd8, 0x01, 0x0a, 0x0a, 0x4c, 0x6f, 0x67, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x61, 0x0a, 0x0e, 0x4c, 0x6f, 0x67, 0x44, 0x6f, 0x77, - 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x55, 0x52, 0x4c, 0x12, 0x25, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, - 0x6e, 0x74, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4c, 0x6f, 0x67, 0x44, 0x6f, 0x77, - 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x55, 0x52, 0x4c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x26, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x2e, 0x4c, 0x6f, 0x67, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x55, 0x52, 0x4c, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x67, 0x0a, 0x10, 0x4c, 0x69, 0x73, - 0x74, 0x50, 0x72, 0x65, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x4c, 0x6f, 0x67, 0x73, 0x12, 0x27, 0x2e, - 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4c, - 0x69, 0x73, 0x74, 0x50, 0x72, 0x65, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x4c, 0x6f, 0x67, 0x73, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x72, 0x65, 0x62, - 0x75, 0x69, 0x6c, 0x64, 0x4c, 0x6f, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x00, 0x42, 0x31, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x67, 0x69, 0x74, 0x70, 0x6f, 0x64, 0x2d, 0x69, 0x6f, 0x2f, 0x67, 0x69, 0x74, 0x70, 0x6f, - 0x64, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x2f, 0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x63, 0x65, 0x49, 0x64, 0x22, 0x2a, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x4c, 0x6f, 0x67, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x73, 0x6b, + 0x49, 0x64, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, + 0x32, 0xc8, 0x01, 0x0a, 0x12, 0x48, 0x65, 0x61, 0x64, 0x6c, 0x65, 0x73, 0x73, 0x4c, 0x6f, 0x67, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x61, 0x0a, 0x0e, 0x4c, 0x6f, 0x67, 0x44, 0x6f, + 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x55, 0x52, 0x4c, 0x12, 0x25, 0x2e, 0x63, 0x6f, 0x6e, 0x74, + 0x65, 0x6e, 0x74, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4c, 0x6f, 0x67, 0x44, 0x6f, + 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x55, 0x52, 0x4c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x26, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x2e, 0x4c, 0x6f, 0x67, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x55, 0x52, 0x4c, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4f, 0x0a, 0x08, 0x4c, 0x69, + 0x73, 0x74, 0x4c, 0x6f, 0x67, 0x73, 0x12, 0x1f, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4c, 0x6f, 0x67, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, + 0x74, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4c, 0x6f, 0x67, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x31, 0x5a, 0x2f, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x69, 0x74, 0x70, 0x6f, 0x64, + 0x2d, 0x69, 0x6f, 0x2f, 0x67, 0x69, 0x74, 0x70, 0x6f, 0x64, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x65, + 0x6e, 0x74, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_log_proto_rawDescOnce sync.Once - file_log_proto_rawDescData = file_log_proto_rawDesc + file_headless_log_proto_rawDescOnce sync.Once + file_headless_log_proto_rawDescData = file_headless_log_proto_rawDesc ) -func file_log_proto_rawDescGZIP() []byte { - file_log_proto_rawDescOnce.Do(func() { - file_log_proto_rawDescData = protoimpl.X.CompressGZIP(file_log_proto_rawDescData) +func file_headless_log_proto_rawDescGZIP() []byte { + file_headless_log_proto_rawDescOnce.Do(func() { + file_headless_log_proto_rawDescData = protoimpl.X.CompressGZIP(file_headless_log_proto_rawDescData) }) - return file_log_proto_rawDescData + return file_headless_log_proto_rawDescData } -var file_log_proto_msgTypes = make([]protoimpl.MessageInfo, 4) -var file_log_proto_goTypes = []interface{}{ - (*LogDownloadURLRequest)(nil), // 0: contentservice.LogDownloadURLRequest - (*LogDownloadURLResponse)(nil), // 1: contentservice.LogDownloadURLResponse - (*ListPrebuildLogsRequest)(nil), // 2: contentservice.ListPrebuildLogsRequest - (*ListPrebuildLogsResponse)(nil), // 3: contentservice.ListPrebuildLogsResponse +var file_headless_log_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_headless_log_proto_goTypes = []interface{}{ + (*LogDownloadURLRequest)(nil), // 0: contentservice.LogDownloadURLRequest + (*LogDownloadURLResponse)(nil), // 1: contentservice.LogDownloadURLResponse + (*ListLogsRequest)(nil), // 2: contentservice.ListLogsRequest + (*ListLogsResponse)(nil), // 3: contentservice.ListLogsResponse } -var file_log_proto_depIdxs = []int32{ - 0, // 0: contentservice.LogService.LogDownloadURL:input_type -> contentservice.LogDownloadURLRequest - 2, // 1: contentservice.LogService.ListPrebuildLogs:input_type -> contentservice.ListPrebuildLogsRequest - 1, // 2: contentservice.LogService.LogDownloadURL:output_type -> contentservice.LogDownloadURLResponse - 3, // 3: contentservice.LogService.ListPrebuildLogs:output_type -> contentservice.ListPrebuildLogsResponse +var file_headless_log_proto_depIdxs = []int32{ + 0, // 0: contentservice.HeadlessLogService.LogDownloadURL:input_type -> contentservice.LogDownloadURLRequest + 2, // 1: contentservice.HeadlessLogService.ListLogs:input_type -> contentservice.ListLogsRequest + 1, // 2: contentservice.HeadlessLogService.LogDownloadURL:output_type -> contentservice.LogDownloadURLResponse + 3, // 3: contentservice.HeadlessLogService.ListLogs:output_type -> contentservice.ListLogsResponse 2, // [2:4] is the sub-list for method output_type 0, // [0:2] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name @@ -330,13 +329,13 @@ var file_log_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for field type_name } -func init() { file_log_proto_init() } -func file_log_proto_init() { - if File_log_proto != nil { +func init() { file_headless_log_proto_init() } +func file_headless_log_proto_init() { + if File_headless_log_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_log_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_headless_log_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*LogDownloadURLRequest); i { case 0: return &v.state @@ -348,7 +347,7 @@ func file_log_proto_init() { return nil } } - file_log_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_headless_log_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*LogDownloadURLResponse); i { case 0: return &v.state @@ -360,8 +359,8 @@ func file_log_proto_init() { return nil } } - file_log_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListPrebuildLogsRequest); i { + file_headless_log_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListLogsRequest); i { case 0: return &v.state case 1: @@ -372,8 +371,8 @@ func file_log_proto_init() { return nil } } - file_log_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListPrebuildLogsResponse); i { + file_headless_log_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListLogsResponse); i { case 0: return &v.state case 1: @@ -389,18 +388,18 @@ func file_log_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_log_proto_rawDesc, + RawDescriptor: file_headless_log_proto_rawDesc, NumEnums: 0, NumMessages: 4, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_log_proto_goTypes, - DependencyIndexes: file_log_proto_depIdxs, - MessageInfos: file_log_proto_msgTypes, + GoTypes: file_headless_log_proto_goTypes, + DependencyIndexes: file_headless_log_proto_depIdxs, + MessageInfos: file_headless_log_proto_msgTypes, }.Build() - File_log_proto = out.File - file_log_proto_rawDesc = nil - file_log_proto_goTypes = nil - file_log_proto_depIdxs = nil + File_headless_log_proto = out.File + file_headless_log_proto_rawDesc = nil + file_headless_log_proto_goTypes = nil + file_headless_log_proto_depIdxs = nil } diff --git a/components/content-service-api/go/headless-log_grpc.pb.go b/components/content-service-api/go/headless-log_grpc.pb.go new file mode 100644 index 00000000000000..3c889eb771fc82 --- /dev/null +++ b/components/content-service-api/go/headless-log_grpc.pb.go @@ -0,0 +1,145 @@ +// Copyright (c) 2021 Gitpod GmbH. All rights reserved. +// Licensed under the GNU Affero General Public License (AGPL). +// See License-AGPL.txt in the project root for license information. + +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. + +package api + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// HeadlessLogServiceClient is the client API for HeadlessLogService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type HeadlessLogServiceClient interface { + // LogDownloadURL provides a URL from where the content of a workspace can be downloaded from + LogDownloadURL(ctx context.Context, in *LogDownloadURLRequest, opts ...grpc.CallOption) (*LogDownloadURLResponse, error) + // ListLogs returns a list of taskIds for the specified workspace instance + ListLogs(ctx context.Context, in *ListLogsRequest, opts ...grpc.CallOption) (*ListLogsResponse, error) +} + +type headlessLogServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewHeadlessLogServiceClient(cc grpc.ClientConnInterface) HeadlessLogServiceClient { + return &headlessLogServiceClient{cc} +} + +func (c *headlessLogServiceClient) LogDownloadURL(ctx context.Context, in *LogDownloadURLRequest, opts ...grpc.CallOption) (*LogDownloadURLResponse, error) { + out := new(LogDownloadURLResponse) + err := c.cc.Invoke(ctx, "/contentservice.HeadlessLogService/LogDownloadURL", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *headlessLogServiceClient) ListLogs(ctx context.Context, in *ListLogsRequest, opts ...grpc.CallOption) (*ListLogsResponse, error) { + out := new(ListLogsResponse) + err := c.cc.Invoke(ctx, "/contentservice.HeadlessLogService/ListLogs", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// HeadlessLogServiceServer is the server API for HeadlessLogService service. +// All implementations must embed UnimplementedHeadlessLogServiceServer +// for forward compatibility +type HeadlessLogServiceServer interface { + // LogDownloadURL provides a URL from where the content of a workspace can be downloaded from + LogDownloadURL(context.Context, *LogDownloadURLRequest) (*LogDownloadURLResponse, error) + // ListLogs returns a list of taskIds for the specified workspace instance + ListLogs(context.Context, *ListLogsRequest) (*ListLogsResponse, error) + mustEmbedUnimplementedHeadlessLogServiceServer() +} + +// UnimplementedHeadlessLogServiceServer must be embedded to have forward compatible implementations. +type UnimplementedHeadlessLogServiceServer struct { +} + +func (UnimplementedHeadlessLogServiceServer) LogDownloadURL(context.Context, *LogDownloadURLRequest) (*LogDownloadURLResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method LogDownloadURL not implemented") +} +func (UnimplementedHeadlessLogServiceServer) ListLogs(context.Context, *ListLogsRequest) (*ListLogsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListLogs not implemented") +} +func (UnimplementedHeadlessLogServiceServer) mustEmbedUnimplementedHeadlessLogServiceServer() {} + +// UnsafeHeadlessLogServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to HeadlessLogServiceServer will +// result in compilation errors. +type UnsafeHeadlessLogServiceServer interface { + mustEmbedUnimplementedHeadlessLogServiceServer() +} + +func RegisterHeadlessLogServiceServer(s grpc.ServiceRegistrar, srv HeadlessLogServiceServer) { + s.RegisterService(&HeadlessLogService_ServiceDesc, srv) +} + +func _HeadlessLogService_LogDownloadURL_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(LogDownloadURLRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(HeadlessLogServiceServer).LogDownloadURL(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/contentservice.HeadlessLogService/LogDownloadURL", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(HeadlessLogServiceServer).LogDownloadURL(ctx, req.(*LogDownloadURLRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _HeadlessLogService_ListLogs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListLogsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(HeadlessLogServiceServer).ListLogs(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/contentservice.HeadlessLogService/ListLogs", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(HeadlessLogServiceServer).ListLogs(ctx, req.(*ListLogsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// HeadlessLogService_ServiceDesc is the grpc.ServiceDesc for HeadlessLogService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var HeadlessLogService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "contentservice.HeadlessLogService", + HandlerType: (*HeadlessLogServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "LogDownloadURL", + Handler: _HeadlessLogService_LogDownloadURL_Handler, + }, + { + MethodName: "ListLogs", + Handler: _HeadlessLogService_ListLogs_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "headless-log.proto", +} diff --git a/components/content-service-api/go/log_grpc.pb.go b/components/content-service-api/go/log_grpc.pb.go deleted file mode 100644 index ffbaab501ece43..00000000000000 --- a/components/content-service-api/go/log_grpc.pb.go +++ /dev/null @@ -1,145 +0,0 @@ -// Copyright (c) 2021 Gitpod GmbH. All rights reserved. -// Licensed under the GNU Affero General Public License (AGPL). -// See License-AGPL.txt in the project root for license information. - -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. - -package api - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -// LogServiceClient is the client API for LogService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type LogServiceClient interface { - // LogDownloadURL provides a URL from where the content of a workspace can be downloaded from - LogDownloadURL(ctx context.Context, in *LogDownloadURLRequest, opts ...grpc.CallOption) (*LogDownloadURLResponse, error) - // ListPrebuildLogs returns a list of taskIds for the specified workspace instance - ListPrebuildLogs(ctx context.Context, in *ListPrebuildLogsRequest, opts ...grpc.CallOption) (*ListPrebuildLogsResponse, error) -} - -type logServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewLogServiceClient(cc grpc.ClientConnInterface) LogServiceClient { - return &logServiceClient{cc} -} - -func (c *logServiceClient) LogDownloadURL(ctx context.Context, in *LogDownloadURLRequest, opts ...grpc.CallOption) (*LogDownloadURLResponse, error) { - out := new(LogDownloadURLResponse) - err := c.cc.Invoke(ctx, "/contentservice.LogService/LogDownloadURL", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *logServiceClient) ListPrebuildLogs(ctx context.Context, in *ListPrebuildLogsRequest, opts ...grpc.CallOption) (*ListPrebuildLogsResponse, error) { - out := new(ListPrebuildLogsResponse) - err := c.cc.Invoke(ctx, "/contentservice.LogService/ListPrebuildLogs", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// LogServiceServer is the server API for LogService service. -// All implementations must embed UnimplementedLogServiceServer -// for forward compatibility -type LogServiceServer interface { - // LogDownloadURL provides a URL from where the content of a workspace can be downloaded from - LogDownloadURL(context.Context, *LogDownloadURLRequest) (*LogDownloadURLResponse, error) - // ListPrebuildLogs returns a list of taskIds for the specified workspace instance - ListPrebuildLogs(context.Context, *ListPrebuildLogsRequest) (*ListPrebuildLogsResponse, error) - mustEmbedUnimplementedLogServiceServer() -} - -// UnimplementedLogServiceServer must be embedded to have forward compatible implementations. -type UnimplementedLogServiceServer struct { -} - -func (UnimplementedLogServiceServer) LogDownloadURL(context.Context, *LogDownloadURLRequest) (*LogDownloadURLResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method LogDownloadURL not implemented") -} -func (UnimplementedLogServiceServer) ListPrebuildLogs(context.Context, *ListPrebuildLogsRequest) (*ListPrebuildLogsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ListPrebuildLogs not implemented") -} -func (UnimplementedLogServiceServer) mustEmbedUnimplementedLogServiceServer() {} - -// UnsafeLogServiceServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to LogServiceServer will -// result in compilation errors. -type UnsafeLogServiceServer interface { - mustEmbedUnimplementedLogServiceServer() -} - -func RegisterLogServiceServer(s grpc.ServiceRegistrar, srv LogServiceServer) { - s.RegisterService(&LogService_ServiceDesc, srv) -} - -func _LogService_LogDownloadURL_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(LogDownloadURLRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(LogServiceServer).LogDownloadURL(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/contentservice.LogService/LogDownloadURL", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LogServiceServer).LogDownloadURL(ctx, req.(*LogDownloadURLRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _LogService_ListPrebuildLogs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ListPrebuildLogsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(LogServiceServer).ListPrebuildLogs(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/contentservice.LogService/ListPrebuildLogs", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LogServiceServer).ListPrebuildLogs(ctx, req.(*ListPrebuildLogsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// LogService_ServiceDesc is the grpc.ServiceDesc for LogService service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var LogService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "contentservice.LogService", - HandlerType: (*LogServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "LogDownloadURL", - Handler: _LogService_LogDownloadURL_Handler, - }, - { - MethodName: "ListPrebuildLogs", - Handler: _LogService_ListPrebuildLogs_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "log.proto", -} diff --git a/components/content-service-api/log.proto b/components/content-service-api/headless-log.proto similarity index 75% rename from components/content-service-api/log.proto rename to components/content-service-api/headless-log.proto index 062042064403ee..109f07f67c47d7 100644 --- a/components/content-service-api/log.proto +++ b/components/content-service-api/headless-log.proto @@ -8,12 +8,12 @@ package contentservice; option go_package = "github.com/gitpod-io/gitpod/content-service/api"; -service LogService { +service HeadlessLogService { // LogDownloadURL provides a URL from where the content of a workspace can be downloaded from rpc LogDownloadURL(LogDownloadURLRequest) returns (LogDownloadURLResponse) {}; - // ListPrebuildLogs returns a list of taskIds for the specified workspace instance - rpc ListPrebuildLogs(ListPrebuildLogsRequest) returns (ListPrebuildLogsResponse) {}; + // ListLogs returns a list of taskIds for the specified workspace instance + rpc ListLogs(ListLogsRequest) returns (ListLogsResponse) {}; } message LogDownloadURLRequest { @@ -26,11 +26,11 @@ message LogDownloadURLResponse { string url = 1; } -message ListPrebuildLogsRequest { +message ListLogsRequest { string owner_id = 1; string workspace_id = 2; string instance_id = 3; } -message ListPrebuildLogsResponse { +message ListLogsResponse { repeated string taskId = 1; } \ No newline at end of file diff --git a/components/content-service-api/typescript/src/headless-log_grpc_pb.d.ts b/components/content-service-api/typescript/src/headless-log_grpc_pb.d.ts new file mode 100644 index 00000000000000..dcca135646b57e --- /dev/null +++ b/components/content-service-api/typescript/src/headless-log_grpc_pb.d.ts @@ -0,0 +1,65 @@ +/** + * Copyright (c) 2021 Gitpod GmbH. All rights reserved. + * Licensed under the GNU Affero General Public License (AGPL). + * See License-AGPL.txt in the project root for license information. + */ + +// package: contentservice +// file: headless-log.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as grpc from "@grpc/grpc-js"; +import {handleClientStreamingCall} from "@grpc/grpc-js/build/src/server-call"; +import * as headless_log_pb from "./headless-log_pb"; + +interface IHeadlessLogServiceService extends grpc.ServiceDefinition { + logDownloadURL: IHeadlessLogServiceService_ILogDownloadURL; + listLogs: IHeadlessLogServiceService_IListLogs; +} + +interface IHeadlessLogServiceService_ILogDownloadURL extends grpc.MethodDefinition { + path: "/contentservice.HeadlessLogService/LogDownloadURL"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IHeadlessLogServiceService_IListLogs extends grpc.MethodDefinition { + path: "/contentservice.HeadlessLogService/ListLogs"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} + +export const HeadlessLogServiceService: IHeadlessLogServiceService; + +export interface IHeadlessLogServiceServer extends grpc.UntypedServiceImplementation { + logDownloadURL: grpc.handleUnaryCall; + listLogs: grpc.handleUnaryCall; +} + +export interface IHeadlessLogServiceClient { + logDownloadURL(request: headless_log_pb.LogDownloadURLRequest, callback: (error: grpc.ServiceError | null, response: headless_log_pb.LogDownloadURLResponse) => void): grpc.ClientUnaryCall; + logDownloadURL(request: headless_log_pb.LogDownloadURLRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: headless_log_pb.LogDownloadURLResponse) => void): grpc.ClientUnaryCall; + logDownloadURL(request: headless_log_pb.LogDownloadURLRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: headless_log_pb.LogDownloadURLResponse) => void): grpc.ClientUnaryCall; + listLogs(request: headless_log_pb.ListLogsRequest, callback: (error: grpc.ServiceError | null, response: headless_log_pb.ListLogsResponse) => void): grpc.ClientUnaryCall; + listLogs(request: headless_log_pb.ListLogsRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: headless_log_pb.ListLogsResponse) => void): grpc.ClientUnaryCall; + listLogs(request: headless_log_pb.ListLogsRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: headless_log_pb.ListLogsResponse) => void): grpc.ClientUnaryCall; +} + +export class HeadlessLogServiceClient extends grpc.Client implements IHeadlessLogServiceClient { + constructor(address: string, credentials: grpc.ChannelCredentials, options?: Partial); + public logDownloadURL(request: headless_log_pb.LogDownloadURLRequest, callback: (error: grpc.ServiceError | null, response: headless_log_pb.LogDownloadURLResponse) => void): grpc.ClientUnaryCall; + public logDownloadURL(request: headless_log_pb.LogDownloadURLRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: headless_log_pb.LogDownloadURLResponse) => void): grpc.ClientUnaryCall; + public logDownloadURL(request: headless_log_pb.LogDownloadURLRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: headless_log_pb.LogDownloadURLResponse) => void): grpc.ClientUnaryCall; + public listLogs(request: headless_log_pb.ListLogsRequest, callback: (error: grpc.ServiceError | null, response: headless_log_pb.ListLogsResponse) => void): grpc.ClientUnaryCall; + public listLogs(request: headless_log_pb.ListLogsRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: headless_log_pb.ListLogsResponse) => void): grpc.ClientUnaryCall; + public listLogs(request: headless_log_pb.ListLogsRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: headless_log_pb.ListLogsResponse) => void): grpc.ClientUnaryCall; +} diff --git a/components/content-service-api/typescript/src/headless-log_grpc_pb.js b/components/content-service-api/typescript/src/headless-log_grpc_pb.js new file mode 100644 index 00000000000000..3d3cd7f3a18213 --- /dev/null +++ b/components/content-service-api/typescript/src/headless-log_grpc_pb.js @@ -0,0 +1,84 @@ +// GENERATED CODE -- DO NOT EDIT! + +// Original file comments: +// Copyright (c) 2021 Gitpod GmbH. All rights reserved. +// Licensed under the GNU Affero General Public License (AGPL). +// See License-AGPL.txt in the project root for license information. +// +'use strict'; +var grpc = require('@grpc/grpc-js'); +var headless$log_pb = require('./headless-log_pb.js'); + +function serialize_contentservice_ListLogsRequest(arg) { + if (!(arg instanceof headless$log_pb.ListLogsRequest)) { + throw new Error('Expected argument of type contentservice.ListLogsRequest'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_contentservice_ListLogsRequest(buffer_arg) { + return headless$log_pb.ListLogsRequest.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_contentservice_ListLogsResponse(arg) { + if (!(arg instanceof headless$log_pb.ListLogsResponse)) { + throw new Error('Expected argument of type contentservice.ListLogsResponse'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_contentservice_ListLogsResponse(buffer_arg) { + return headless$log_pb.ListLogsResponse.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_contentservice_LogDownloadURLRequest(arg) { + if (!(arg instanceof headless$log_pb.LogDownloadURLRequest)) { + throw new Error('Expected argument of type contentservice.LogDownloadURLRequest'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_contentservice_LogDownloadURLRequest(buffer_arg) { + return headless$log_pb.LogDownloadURLRequest.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_contentservice_LogDownloadURLResponse(arg) { + if (!(arg instanceof headless$log_pb.LogDownloadURLResponse)) { + throw new Error('Expected argument of type contentservice.LogDownloadURLResponse'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_contentservice_LogDownloadURLResponse(buffer_arg) { + return headless$log_pb.LogDownloadURLResponse.deserializeBinary(new Uint8Array(buffer_arg)); +} + + +var HeadlessLogServiceService = exports.HeadlessLogServiceService = { + // LogDownloadURL provides a URL from where the content of a workspace can be downloaded from +logDownloadURL: { + path: '/contentservice.HeadlessLogService/LogDownloadURL', + requestStream: false, + responseStream: false, + requestType: headless$log_pb.LogDownloadURLRequest, + responseType: headless$log_pb.LogDownloadURLResponse, + requestSerialize: serialize_contentservice_LogDownloadURLRequest, + requestDeserialize: deserialize_contentservice_LogDownloadURLRequest, + responseSerialize: serialize_contentservice_LogDownloadURLResponse, + responseDeserialize: deserialize_contentservice_LogDownloadURLResponse, + }, + // ListLogs returns a list of taskIds for the specified workspace instance +listLogs: { + path: '/contentservice.HeadlessLogService/ListLogs', + requestStream: false, + responseStream: false, + requestType: headless$log_pb.ListLogsRequest, + responseType: headless$log_pb.ListLogsResponse, + requestSerialize: serialize_contentservice_ListLogsRequest, + requestDeserialize: deserialize_contentservice_ListLogsRequest, + responseSerialize: serialize_contentservice_ListLogsResponse, + responseDeserialize: deserialize_contentservice_ListLogsResponse, + }, +}; + +exports.HeadlessLogServiceClient = grpc.makeGenericClientConstructor(HeadlessLogServiceService); diff --git a/components/content-service-api/typescript/src/log_pb.d.ts b/components/content-service-api/typescript/src/headless-log_pb.d.ts similarity index 69% rename from components/content-service-api/typescript/src/log_pb.d.ts rename to components/content-service-api/typescript/src/headless-log_pb.d.ts index d2a4ccaa61f5d9..b046709dcd4249 100644 --- a/components/content-service-api/typescript/src/log_pb.d.ts +++ b/components/content-service-api/typescript/src/headless-log_pb.d.ts @@ -5,7 +5,7 @@ */ // package: contentservice -// file: log.proto +// file: headless-log.proto /* tslint:disable */ /* eslint-disable */ @@ -61,25 +61,25 @@ export namespace LogDownloadURLResponse { } } -export class ListPrebuildLogsRequest extends jspb.Message { +export class ListLogsRequest extends jspb.Message { getOwnerId(): string; - setOwnerId(value: string): ListPrebuildLogsRequest; + setOwnerId(value: string): ListLogsRequest; getWorkspaceId(): string; - setWorkspaceId(value: string): ListPrebuildLogsRequest; + setWorkspaceId(value: string): ListLogsRequest; getInstanceId(): string; - setInstanceId(value: string): ListPrebuildLogsRequest; + setInstanceId(value: string): ListLogsRequest; serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): ListPrebuildLogsRequest.AsObject; - static toObject(includeInstance: boolean, msg: ListPrebuildLogsRequest): ListPrebuildLogsRequest.AsObject; + toObject(includeInstance?: boolean): ListLogsRequest.AsObject; + static toObject(includeInstance: boolean, msg: ListLogsRequest): ListLogsRequest.AsObject; static extensions: {[key: number]: jspb.ExtensionFieldInfo}; static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: ListPrebuildLogsRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): ListPrebuildLogsRequest; - static deserializeBinaryFromReader(message: ListPrebuildLogsRequest, reader: jspb.BinaryReader): ListPrebuildLogsRequest; + static serializeBinaryToWriter(message: ListLogsRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ListLogsRequest; + static deserializeBinaryFromReader(message: ListLogsRequest, reader: jspb.BinaryReader): ListLogsRequest; } -export namespace ListPrebuildLogsRequest { +export namespace ListLogsRequest { export type AsObject = { ownerId: string, workspaceId: string, @@ -87,23 +87,23 @@ export namespace ListPrebuildLogsRequest { } } -export class ListPrebuildLogsResponse extends jspb.Message { +export class ListLogsResponse extends jspb.Message { clearTaskidList(): void; getTaskidList(): Array; - setTaskidList(value: Array): ListPrebuildLogsResponse; + setTaskidList(value: Array): ListLogsResponse; addTaskid(value: string, index?: number): string; serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): ListPrebuildLogsResponse.AsObject; - static toObject(includeInstance: boolean, msg: ListPrebuildLogsResponse): ListPrebuildLogsResponse.AsObject; + toObject(includeInstance?: boolean): ListLogsResponse.AsObject; + static toObject(includeInstance: boolean, msg: ListLogsResponse): ListLogsResponse.AsObject; static extensions: {[key: number]: jspb.ExtensionFieldInfo}; static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: ListPrebuildLogsResponse, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): ListPrebuildLogsResponse; - static deserializeBinaryFromReader(message: ListPrebuildLogsResponse, reader: jspb.BinaryReader): ListPrebuildLogsResponse; + static serializeBinaryToWriter(message: ListLogsResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ListLogsResponse; + static deserializeBinaryFromReader(message: ListLogsResponse, reader: jspb.BinaryReader): ListLogsResponse; } -export namespace ListPrebuildLogsResponse { +export namespace ListLogsResponse { export type AsObject = { taskidList: Array, } diff --git a/components/content-service-api/typescript/src/log_pb.js b/components/content-service-api/typescript/src/headless-log_pb.js similarity index 81% rename from components/content-service-api/typescript/src/log_pb.js rename to components/content-service-api/typescript/src/headless-log_pb.js index c98831a535f036..cdb6c20c98f766 100644 --- a/components/content-service-api/typescript/src/log_pb.js +++ b/components/content-service-api/typescript/src/headless-log_pb.js @@ -4,7 +4,7 @@ * See License-AGPL.txt in the project root for license information. */ -// source: log.proto +// source: headless-log.proto /** * @fileoverview * @enhanceable @@ -21,8 +21,8 @@ var jspb = require('google-protobuf'); var goog = jspb; var global = Function('return this')(); -goog.exportSymbol('proto.contentservice.ListPrebuildLogsRequest', null, global); -goog.exportSymbol('proto.contentservice.ListPrebuildLogsResponse', null, global); +goog.exportSymbol('proto.contentservice.ListLogsRequest', null, global); +goog.exportSymbol('proto.contentservice.ListLogsResponse', null, global); goog.exportSymbol('proto.contentservice.LogDownloadURLRequest', null, global); goog.exportSymbol('proto.contentservice.LogDownloadURLResponse', null, global); /** @@ -77,16 +77,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.contentservice.ListPrebuildLogsRequest = function(opt_data) { +proto.contentservice.ListLogsRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.contentservice.ListPrebuildLogsRequest, jspb.Message); +goog.inherits(proto.contentservice.ListLogsRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.contentservice.ListPrebuildLogsRequest.displayName = 'proto.contentservice.ListPrebuildLogsRequest'; + proto.contentservice.ListLogsRequest.displayName = 'proto.contentservice.ListLogsRequest'; } /** * Generated by JsPbCodeGenerator. @@ -98,16 +98,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.contentservice.ListPrebuildLogsResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.contentservice.ListPrebuildLogsResponse.repeatedFields_, null); +proto.contentservice.ListLogsResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.contentservice.ListLogsResponse.repeatedFields_, null); }; -goog.inherits(proto.contentservice.ListPrebuildLogsResponse, jspb.Message); +goog.inherits(proto.contentservice.ListLogsResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.contentservice.ListPrebuildLogsResponse.displayName = 'proto.contentservice.ListPrebuildLogsResponse'; + proto.contentservice.ListLogsResponse.displayName = 'proto.contentservice.ListLogsResponse'; } @@ -475,8 +475,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.contentservice.ListPrebuildLogsRequest.prototype.toObject = function(opt_includeInstance) { - return proto.contentservice.ListPrebuildLogsRequest.toObject(opt_includeInstance, this); +proto.contentservice.ListLogsRequest.prototype.toObject = function(opt_includeInstance) { + return proto.contentservice.ListLogsRequest.toObject(opt_includeInstance, this); }; @@ -485,11 +485,11 @@ proto.contentservice.ListPrebuildLogsRequest.prototype.toObject = function(opt_i * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.contentservice.ListPrebuildLogsRequest} msg The msg instance to transform. + * @param {!proto.contentservice.ListLogsRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.contentservice.ListPrebuildLogsRequest.toObject = function(includeInstance, msg) { +proto.contentservice.ListLogsRequest.toObject = function(includeInstance, msg) { var f, obj = { ownerId: jspb.Message.getFieldWithDefault(msg, 1, ""), workspaceId: jspb.Message.getFieldWithDefault(msg, 2, ""), @@ -507,23 +507,23 @@ proto.contentservice.ListPrebuildLogsRequest.toObject = function(includeInstance /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.contentservice.ListPrebuildLogsRequest} + * @return {!proto.contentservice.ListLogsRequest} */ -proto.contentservice.ListPrebuildLogsRequest.deserializeBinary = function(bytes) { +proto.contentservice.ListLogsRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.contentservice.ListPrebuildLogsRequest; - return proto.contentservice.ListPrebuildLogsRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.contentservice.ListLogsRequest; + return proto.contentservice.ListLogsRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.contentservice.ListPrebuildLogsRequest} msg The message object to deserialize into. + * @param {!proto.contentservice.ListLogsRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.contentservice.ListPrebuildLogsRequest} + * @return {!proto.contentservice.ListLogsRequest} */ -proto.contentservice.ListPrebuildLogsRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.contentservice.ListLogsRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -555,9 +555,9 @@ proto.contentservice.ListPrebuildLogsRequest.deserializeBinaryFromReader = funct * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.contentservice.ListPrebuildLogsRequest.prototype.serializeBinary = function() { +proto.contentservice.ListLogsRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.contentservice.ListPrebuildLogsRequest.serializeBinaryToWriter(this, writer); + proto.contentservice.ListLogsRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -565,11 +565,11 @@ proto.contentservice.ListPrebuildLogsRequest.prototype.serializeBinary = functio /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.contentservice.ListPrebuildLogsRequest} message + * @param {!proto.contentservice.ListLogsRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.contentservice.ListPrebuildLogsRequest.serializeBinaryToWriter = function(message, writer) { +proto.contentservice.ListLogsRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getOwnerId(); if (f.length > 0) { @@ -599,16 +599,16 @@ proto.contentservice.ListPrebuildLogsRequest.serializeBinaryToWriter = function( * optional string owner_id = 1; * @return {string} */ -proto.contentservice.ListPrebuildLogsRequest.prototype.getOwnerId = function() { +proto.contentservice.ListLogsRequest.prototype.getOwnerId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value - * @return {!proto.contentservice.ListPrebuildLogsRequest} returns this + * @return {!proto.contentservice.ListLogsRequest} returns this */ -proto.contentservice.ListPrebuildLogsRequest.prototype.setOwnerId = function(value) { +proto.contentservice.ListLogsRequest.prototype.setOwnerId = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; @@ -617,16 +617,16 @@ proto.contentservice.ListPrebuildLogsRequest.prototype.setOwnerId = function(val * optional string workspace_id = 2; * @return {string} */ -proto.contentservice.ListPrebuildLogsRequest.prototype.getWorkspaceId = function() { +proto.contentservice.ListLogsRequest.prototype.getWorkspaceId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** * @param {string} value - * @return {!proto.contentservice.ListPrebuildLogsRequest} returns this + * @return {!proto.contentservice.ListLogsRequest} returns this */ -proto.contentservice.ListPrebuildLogsRequest.prototype.setWorkspaceId = function(value) { +proto.contentservice.ListLogsRequest.prototype.setWorkspaceId = function(value) { return jspb.Message.setProto3StringField(this, 2, value); }; @@ -635,16 +635,16 @@ proto.contentservice.ListPrebuildLogsRequest.prototype.setWorkspaceId = function * optional string instance_id = 3; * @return {string} */ -proto.contentservice.ListPrebuildLogsRequest.prototype.getInstanceId = function() { +proto.contentservice.ListLogsRequest.prototype.getInstanceId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); }; /** * @param {string} value - * @return {!proto.contentservice.ListPrebuildLogsRequest} returns this + * @return {!proto.contentservice.ListLogsRequest} returns this */ -proto.contentservice.ListPrebuildLogsRequest.prototype.setInstanceId = function(value) { +proto.contentservice.ListLogsRequest.prototype.setInstanceId = function(value) { return jspb.Message.setProto3StringField(this, 3, value); }; @@ -655,7 +655,7 @@ proto.contentservice.ListPrebuildLogsRequest.prototype.setInstanceId = function( * @private {!Array} * @const */ -proto.contentservice.ListPrebuildLogsResponse.repeatedFields_ = [1]; +proto.contentservice.ListLogsResponse.repeatedFields_ = [1]; @@ -672,8 +672,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.contentservice.ListPrebuildLogsResponse.prototype.toObject = function(opt_includeInstance) { - return proto.contentservice.ListPrebuildLogsResponse.toObject(opt_includeInstance, this); +proto.contentservice.ListLogsResponse.prototype.toObject = function(opt_includeInstance) { + return proto.contentservice.ListLogsResponse.toObject(opt_includeInstance, this); }; @@ -682,11 +682,11 @@ proto.contentservice.ListPrebuildLogsResponse.prototype.toObject = function(opt_ * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.contentservice.ListPrebuildLogsResponse} msg The msg instance to transform. + * @param {!proto.contentservice.ListLogsResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.contentservice.ListPrebuildLogsResponse.toObject = function(includeInstance, msg) { +proto.contentservice.ListLogsResponse.toObject = function(includeInstance, msg) { var f, obj = { taskidList: (f = jspb.Message.getRepeatedField(msg, 1)) == null ? undefined : f }; @@ -702,23 +702,23 @@ proto.contentservice.ListPrebuildLogsResponse.toObject = function(includeInstanc /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.contentservice.ListPrebuildLogsResponse} + * @return {!proto.contentservice.ListLogsResponse} */ -proto.contentservice.ListPrebuildLogsResponse.deserializeBinary = function(bytes) { +proto.contentservice.ListLogsResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.contentservice.ListPrebuildLogsResponse; - return proto.contentservice.ListPrebuildLogsResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.contentservice.ListLogsResponse; + return proto.contentservice.ListLogsResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.contentservice.ListPrebuildLogsResponse} msg The message object to deserialize into. + * @param {!proto.contentservice.ListLogsResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.contentservice.ListPrebuildLogsResponse} + * @return {!proto.contentservice.ListLogsResponse} */ -proto.contentservice.ListPrebuildLogsResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.contentservice.ListLogsResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -742,9 +742,9 @@ proto.contentservice.ListPrebuildLogsResponse.deserializeBinaryFromReader = func * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.contentservice.ListPrebuildLogsResponse.prototype.serializeBinary = function() { +proto.contentservice.ListLogsResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.contentservice.ListPrebuildLogsResponse.serializeBinaryToWriter(this, writer); + proto.contentservice.ListLogsResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -752,11 +752,11 @@ proto.contentservice.ListPrebuildLogsResponse.prototype.serializeBinary = functi /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.contentservice.ListPrebuildLogsResponse} message + * @param {!proto.contentservice.ListLogsResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.contentservice.ListPrebuildLogsResponse.serializeBinaryToWriter = function(message, writer) { +proto.contentservice.ListLogsResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getTaskidList(); if (f.length > 0) { @@ -772,16 +772,16 @@ proto.contentservice.ListPrebuildLogsResponse.serializeBinaryToWriter = function * repeated string taskId = 1; * @return {!Array} */ -proto.contentservice.ListPrebuildLogsResponse.prototype.getTaskidList = function() { +proto.contentservice.ListLogsResponse.prototype.getTaskidList = function() { return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); }; /** * @param {!Array} value - * @return {!proto.contentservice.ListPrebuildLogsResponse} returns this + * @return {!proto.contentservice.ListLogsResponse} returns this */ -proto.contentservice.ListPrebuildLogsResponse.prototype.setTaskidList = function(value) { +proto.contentservice.ListLogsResponse.prototype.setTaskidList = function(value) { return jspb.Message.setField(this, 1, value || []); }; @@ -789,18 +789,18 @@ proto.contentservice.ListPrebuildLogsResponse.prototype.setTaskidList = function /** * @param {string} value * @param {number=} opt_index - * @return {!proto.contentservice.ListPrebuildLogsResponse} returns this + * @return {!proto.contentservice.ListLogsResponse} returns this */ -proto.contentservice.ListPrebuildLogsResponse.prototype.addTaskid = function(value, opt_index) { +proto.contentservice.ListLogsResponse.prototype.addTaskid = function(value, opt_index) { return jspb.Message.addToRepeatedField(this, 1, value, opt_index); }; /** * Clears the list making it empty but non-null. - * @return {!proto.contentservice.ListPrebuildLogsResponse} returns this + * @return {!proto.contentservice.ListLogsResponse} returns this */ -proto.contentservice.ListPrebuildLogsResponse.prototype.clearTaskidList = function() { +proto.contentservice.ListLogsResponse.prototype.clearTaskidList = function() { return this.setTaskidList([]); }; diff --git a/components/content-service-api/typescript/src/log_grpc_pb.d.ts b/components/content-service-api/typescript/src/log_grpc_pb.d.ts deleted file mode 100644 index 5213aff5e79f73..00000000000000 --- a/components/content-service-api/typescript/src/log_grpc_pb.d.ts +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Copyright (c) 2021 Gitpod GmbH. All rights reserved. - * Licensed under the GNU Affero General Public License (AGPL). - * See License-AGPL.txt in the project root for license information. - */ - -// package: contentservice -// file: log.proto - -/* tslint:disable */ -/* eslint-disable */ - -import * as grpc from "@grpc/grpc-js"; -import {handleClientStreamingCall} from "@grpc/grpc-js/build/src/server-call"; -import * as log_pb from "./log_pb"; - -interface ILogServiceService extends grpc.ServiceDefinition { - logDownloadURL: ILogServiceService_ILogDownloadURL; - listPrebuildLogs: ILogServiceService_IListPrebuildLogs; -} - -interface ILogServiceService_ILogDownloadURL extends grpc.MethodDefinition { - path: "/contentservice.LogService/LogDownloadURL"; - requestStream: false; - responseStream: false; - requestSerialize: grpc.serialize; - requestDeserialize: grpc.deserialize; - responseSerialize: grpc.serialize; - responseDeserialize: grpc.deserialize; -} -interface ILogServiceService_IListPrebuildLogs extends grpc.MethodDefinition { - path: "/contentservice.LogService/ListPrebuildLogs"; - requestStream: false; - responseStream: false; - requestSerialize: grpc.serialize; - requestDeserialize: grpc.deserialize; - responseSerialize: grpc.serialize; - responseDeserialize: grpc.deserialize; -} - -export const LogServiceService: ILogServiceService; - -export interface ILogServiceServer extends grpc.UntypedServiceImplementation { - logDownloadURL: grpc.handleUnaryCall; - listPrebuildLogs: grpc.handleUnaryCall; -} - -export interface ILogServiceClient { - logDownloadURL(request: log_pb.LogDownloadURLRequest, callback: (error: grpc.ServiceError | null, response: log_pb.LogDownloadURLResponse) => void): grpc.ClientUnaryCall; - logDownloadURL(request: log_pb.LogDownloadURLRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: log_pb.LogDownloadURLResponse) => void): grpc.ClientUnaryCall; - logDownloadURL(request: log_pb.LogDownloadURLRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: log_pb.LogDownloadURLResponse) => void): grpc.ClientUnaryCall; - listPrebuildLogs(request: log_pb.ListPrebuildLogsRequest, callback: (error: grpc.ServiceError | null, response: log_pb.ListPrebuildLogsResponse) => void): grpc.ClientUnaryCall; - listPrebuildLogs(request: log_pb.ListPrebuildLogsRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: log_pb.ListPrebuildLogsResponse) => void): grpc.ClientUnaryCall; - listPrebuildLogs(request: log_pb.ListPrebuildLogsRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: log_pb.ListPrebuildLogsResponse) => void): grpc.ClientUnaryCall; -} - -export class LogServiceClient extends grpc.Client implements ILogServiceClient { - constructor(address: string, credentials: grpc.ChannelCredentials, options?: Partial); - public logDownloadURL(request: log_pb.LogDownloadURLRequest, callback: (error: grpc.ServiceError | null, response: log_pb.LogDownloadURLResponse) => void): grpc.ClientUnaryCall; - public logDownloadURL(request: log_pb.LogDownloadURLRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: log_pb.LogDownloadURLResponse) => void): grpc.ClientUnaryCall; - public logDownloadURL(request: log_pb.LogDownloadURLRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: log_pb.LogDownloadURLResponse) => void): grpc.ClientUnaryCall; - public listPrebuildLogs(request: log_pb.ListPrebuildLogsRequest, callback: (error: grpc.ServiceError | null, response: log_pb.ListPrebuildLogsResponse) => void): grpc.ClientUnaryCall; - public listPrebuildLogs(request: log_pb.ListPrebuildLogsRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: log_pb.ListPrebuildLogsResponse) => void): grpc.ClientUnaryCall; - public listPrebuildLogs(request: log_pb.ListPrebuildLogsRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: log_pb.ListPrebuildLogsResponse) => void): grpc.ClientUnaryCall; -} diff --git a/components/content-service-api/typescript/src/log_grpc_pb.js b/components/content-service-api/typescript/src/log_grpc_pb.js deleted file mode 100644 index 468b8e602fdd82..00000000000000 --- a/components/content-service-api/typescript/src/log_grpc_pb.js +++ /dev/null @@ -1,84 +0,0 @@ -// GENERATED CODE -- DO NOT EDIT! - -// Original file comments: -// Copyright (c) 2021 Gitpod GmbH. All rights reserved. -// Licensed under the GNU Affero General Public License (AGPL). -// See License-AGPL.txt in the project root for license information. -// -'use strict'; -var grpc = require('@grpc/grpc-js'); -var log_pb = require('./log_pb.js'); - -function serialize_contentservice_ListPrebuildLogsRequest(arg) { - if (!(arg instanceof log_pb.ListPrebuildLogsRequest)) { - throw new Error('Expected argument of type contentservice.ListPrebuildLogsRequest'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_contentservice_ListPrebuildLogsRequest(buffer_arg) { - return log_pb.ListPrebuildLogsRequest.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_contentservice_ListPrebuildLogsResponse(arg) { - if (!(arg instanceof log_pb.ListPrebuildLogsResponse)) { - throw new Error('Expected argument of type contentservice.ListPrebuildLogsResponse'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_contentservice_ListPrebuildLogsResponse(buffer_arg) { - return log_pb.ListPrebuildLogsResponse.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_contentservice_LogDownloadURLRequest(arg) { - if (!(arg instanceof log_pb.LogDownloadURLRequest)) { - throw new Error('Expected argument of type contentservice.LogDownloadURLRequest'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_contentservice_LogDownloadURLRequest(buffer_arg) { - return log_pb.LogDownloadURLRequest.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_contentservice_LogDownloadURLResponse(arg) { - if (!(arg instanceof log_pb.LogDownloadURLResponse)) { - throw new Error('Expected argument of type contentservice.LogDownloadURLResponse'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_contentservice_LogDownloadURLResponse(buffer_arg) { - return log_pb.LogDownloadURLResponse.deserializeBinary(new Uint8Array(buffer_arg)); -} - - -var LogServiceService = exports.LogServiceService = { - // LogDownloadURL provides a URL from where the content of a workspace can be downloaded from -logDownloadURL: { - path: '/contentservice.LogService/LogDownloadURL', - requestStream: false, - responseStream: false, - requestType: log_pb.LogDownloadURLRequest, - responseType: log_pb.LogDownloadURLResponse, - requestSerialize: serialize_contentservice_LogDownloadURLRequest, - requestDeserialize: deserialize_contentservice_LogDownloadURLRequest, - responseSerialize: serialize_contentservice_LogDownloadURLResponse, - responseDeserialize: deserialize_contentservice_LogDownloadURLResponse, - }, - // ListPrebuildLogs returns a list of taskIds for the specified workspace instance -listPrebuildLogs: { - path: '/contentservice.LogService/ListPrebuildLogs', - requestStream: false, - responseStream: false, - requestType: log_pb.ListPrebuildLogsRequest, - responseType: log_pb.ListPrebuildLogsResponse, - requestSerialize: serialize_contentservice_ListPrebuildLogsRequest, - requestDeserialize: deserialize_contentservice_ListPrebuildLogsRequest, - responseSerialize: serialize_contentservice_ListPrebuildLogsResponse, - responseDeserialize: deserialize_contentservice_ListPrebuildLogsResponse, - }, -}; - -exports.LogServiceClient = grpc.makeGenericClientConstructor(LogServiceService); diff --git a/components/content-service/cmd/run.go b/components/content-service/cmd/run.go index 7c2afeac818966..3a4a51b1c44c43 100644 --- a/components/content-service/cmd/run.go +++ b/components/content-service/cmd/run.go @@ -90,11 +90,11 @@ var runCmd = &cobra.Command{ } api.RegisterWorkspaceServiceServer(server, workspaceService) - logService, err := service.NewLogService(cfg.Storage) + headlessLogService, err := service.NewHeadlessLogService(cfg.Storage) if err != nil { log.WithError(err).Fatalf("cannot create log service") } - api.RegisterLogServiceServer(server, logService) + api.RegisterHeadlessLogServiceServer(server, headlessLogService) idePluginService, err := service.NewIDEPluginService(cfg.Storage) if err != nil { diff --git a/components/content-service/pkg/logs/logs.go b/components/content-service/pkg/logs/logs.go index df8444e5647a9b..a5f04fce58f4c8 100644 --- a/components/content-service/pkg/logs/logs.go +++ b/components/content-service/pkg/logs/logs.go @@ -22,13 +22,13 @@ const ( legacyTerminalStoreLocation = "/workspace" legacyPrebuildLogFilePrefix = ".prebuild-log-" - // UploadedPrebuildLogPathPrefix is the prefix under which workspace logs are stored inside an instance - UploadedPrebuildLogPathPrefix = "logs" + // UploadedHeadlessLogPathPrefix is the prefix under which workspace logs are stored inside an instance + UploadedHeadlessLogPathPrefix = "logs" ) -// UploadedPrebuildLogPath returns the path relative to the -func UploadedPrebuildLogPath(taskID string) string { - return fmt.Sprintf("%s/%s", UploadedPrebuildLogPathPrefix, taskID) +// UploadedHeadlessLogPath returns the path relative to the +func UploadedHeadlessLogPath(taskID string) string { + return fmt.Sprintf("%s/%s", UploadedHeadlessLogPathPrefix, taskID) } // PrebuildLogFileName is the absolute path to the file containing the output of the prebuild log for the given task in recent workspaces @@ -73,8 +73,8 @@ func ListPrebuildLogFiles(ctx context.Context, location string) (filePaths []str return filePaths, nil } -// ParseTaskID tries to parse the streamID from the given file name path -func ParseTaskID(filePath string) (string, error) { +// ParseTaskIDFromPrebuildLogFilePath tries to parse the streamID from the given file name path +func ParseTaskIDFromPrebuildLogFilePath(filePath string) (string, error) { fileName := filepath.Base(filePath) var streamID string diff --git a/components/content-service/pkg/service/logs-service.go b/components/content-service/pkg/service/headless-log-service.go similarity index 55% rename from components/content-service/pkg/service/logs-service.go rename to components/content-service/pkg/service/headless-log-service.go index 25df940bafdc2b..449321e2f98878 100644 --- a/components/content-service/pkg/service/logs-service.go +++ b/components/content-service/pkg/service/headless-log-service.go @@ -6,8 +6,10 @@ package service import ( "context" + "strings" "github.com/opentracing/opentracing-go" + "golang.org/x/xerrors" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -18,41 +20,35 @@ import ( "github.com/gitpod-io/gitpod/content-service/pkg/storage" ) -// LogService implements LogServiceServer -type LogService struct { +// HeadlessLogService implements LogServiceServer +type HeadlessLogService struct { cfg storage.Config s storage.PresignedAccess - d storage.DirectAccess - api.UnimplementedLogServiceServer + api.UnimplementedHeadlessLogServiceServer } -// NewLogService create a new content service -func NewLogService(cfg storage.Config) (res *LogService, err error) { +// NewHeadlessLogService create a new content service +func NewHeadlessLogService(cfg storage.Config) (res *HeadlessLogService, err error) { s, err := storage.NewPresignedAccess(&cfg) if err != nil { return nil, err } - d, err := storage.NewDirectAccess(&cfg) - if err != nil { - return nil, err - } - return &LogService{ + return &HeadlessLogService{ cfg: cfg, s: s, - d: d, }, nil } // LogDownloadURL provides a URL from where the content of a workspace log stream can be downloaded from -func (ls *LogService) LogDownloadURL(ctx context.Context, req *api.LogDownloadURLRequest) (resp *api.LogDownloadURLResponse, err error) { +func (ls *HeadlessLogService) LogDownloadURL(ctx context.Context, req *api.LogDownloadURLRequest) (resp *api.LogDownloadURLResponse, err error) { span, ctx := opentracing.StartSpanFromContext(ctx, "WorkspaceDownloadURL") span.SetTag("user", req.OwnerId) span.SetTag("workspaceId", req.WorkspaceId) span.SetTag("instanceId", req.InstanceId) defer tracing.FinishSpan(span, &err) - blobName := ls.s.InstanceObject(req.WorkspaceId, req.InstanceId, logs.UploadedPrebuildLogPath(req.TaskId)) + blobName := ls.s.InstanceObject(req.WorkspaceId, req.InstanceId, logs.UploadedHeadlessLogPath(req.TaskId)) info, err := ls.s.SignDownload(ctx, ls.s.Bucket(req.OwnerId), blobName, &storage.SignedURLOptions{}) if err != nil { log.WithFields(log.OWI(req.OwnerId, req.WorkspaceId, "")). @@ -71,16 +67,34 @@ func (ls *LogService) LogDownloadURL(ctx context.Context, req *api.LogDownloadUR }, nil } -// ListPrebuildLogs returns a list of taskIds for the specified workspace instance -func (ls *LogService) ListPrebuildLogs(ctx context.Context, req *api.ListPrebuildLogsRequest) (resp *api.ListPrebuildLogsResponse, err error) { - // all files under this prefix are logs prebuild log files, named after their respective taskIds - prefix := ls.s.InstanceObject(req.WorkspaceId, req.InstanceId, logs.UploadedPrebuildLogPathPrefix) - objects, err := ls.d.ListObjects(ctx, prefix) +// ListLogs returns a list of taskIds for the specified workspace instance +func (ls *HeadlessLogService) ListLogs(ctx context.Context, req *api.ListLogsRequest) (resp *api.ListLogsResponse, err error) { + da, err := storage.NewDirectAccess(&ls.cfg) + if err != nil { + return nil, xerrors.Errorf("cannot use configured storage: %w", err) + } + + err = da.Init(ctx, req.OwnerId, req.WorkspaceId, req.InstanceId) + if err != nil { + return nil, xerrors.Errorf("cannot use configured storage: %w", err) + } + // we do not need to check whether the bucket exists because ListObjects() does that for us + + // all files under this prefix are headless log files, named after their respective taskId + prefix := ls.s.InstanceObject(req.WorkspaceId, req.InstanceId, logs.UploadedHeadlessLogPathPrefix) + objects, err := da.ListObjects(ctx, prefix) if err != nil { return nil, err } - return &api.ListPrebuildLogsResponse{ - TaskId: objects, + var taskIds []string + for _, obj := range objects { + ss := strings.Split(obj, "/") + taskId := ss[len(ss)-1] + taskIds = append(taskIds, taskId) + } + + return &api.ListLogsResponse{ + TaskId: taskIds, }, nil } diff --git a/components/content-service/pkg/storage/gcloud.go b/components/content-service/pkg/storage/gcloud.go index 5f80e946c8707b..33f702f696e002 100644 --- a/components/content-service/pkg/storage/gcloud.go +++ b/components/content-service/pkg/storage/gcloud.go @@ -287,16 +287,25 @@ func ParseSnapshotName(name string) (bkt, obj string, err error) { return } -// ListObjects returns all objects found with the given prefix +// ListObjects returns all objects found with the given prefix. Returns an empty list if the bucket does not exuist (yet). func (rs *DirectGCPStorage) ListObjects(ctx context.Context, prefix string) (objects []string, err error) { bkt := rs.client.Bucket(rs.bucketName()) + _, err = bkt.Attrs(ctx) + if err == gcpstorage.ErrBucketNotExist { + // bucket does not exist: nothing to list + return nil, nil + } + if err != nil { + return nil, xerrors.Errorf("cannot list objects: %w", err) + } + iter := bkt.Objects(ctx, &gcpstorage.Query{Prefix: prefix}) var obj *gcpstorage.ObjectAttrs for obj, err = iter.Next(); obj != nil; obj, err = iter.Next() { objects = append(objects, obj.Name) } if err != iterator.Done && err != nil { - return nil, err + return nil, xerrors.Errorf("cannot iterate list objects: %w", err) } return objects, nil diff --git a/components/content-service/pkg/storage/minio.go b/components/content-service/pkg/storage/minio.go index dfe6a19f3c4b1d..c149c18244394a 100644 --- a/components/content-service/pkg/storage/minio.go +++ b/components/content-service/pkg/storage/minio.go @@ -212,18 +212,28 @@ func (rs *DirectMinIOStorage) DownloadSnapshot(ctx context.Context, destination return rs.download(ctx, destination, bkt, obj, mappings) } -// ListObjects returns all objects found with the given prefix +// ListObjects returns all objects found with the given prefix. Returns an empty list if the bucket does not exuist (yet). func (rs *DirectMinIOStorage) ListObjects(ctx context.Context, prefix string) (objects []string, err error) { ctx, cancel := context.WithTimeout(ctx, 10*time.Second) defer cancel() - objectCh := rs.client.ListObjects(ctx, rs.bucketName(), minio.ListObjectsOptions{ + bucketName := rs.bucketName() + exists, err := rs.client.BucketExists(ctx, bucketName) + if err != nil { + return nil, xerrors.Errorf("cannot list objects: %w", err) + } + if !exists { + // bucket does not exist: nothing to list + return nil, nil + } + + objectCh := rs.client.ListObjects(ctx, bucketName, minio.ListObjectsOptions{ Prefix: prefix, Recursive: true, }) for object := range objectCh { if object.Err != nil { - return nil, object.Err + return nil, xerrors.Errorf("cannot iterate list objects: %w", object.Err) } objects = append(objects, object.Key) } diff --git a/components/content-service/pkg/storage/noop.go b/components/content-service/pkg/storage/noop.go index 8136b636cc27fc..2ec77304259b91 100644 --- a/components/content-service/pkg/storage/noop.go +++ b/components/content-service/pkg/storage/noop.go @@ -35,7 +35,7 @@ func (rs *DirectNoopStorage) DownloadSnapshot(ctx context.Context, destination s return false, nil } -// ListObjects returns all objects found with the given prefix +// ListObjects returns all objects found with the given prefix. Returns an empty list if the bucket does not exuist (yet). func (rs *DirectNoopStorage) ListObjects(ctx context.Context, prefix string) (objects []string, err error) { return nil, nil } diff --git a/components/content-service/pkg/storage/storage.go b/components/content-service/pkg/storage/storage.go index 72e513b01908ce..e167191aea03f2 100644 --- a/components/content-service/pkg/storage/storage.go +++ b/components/content-service/pkg/storage/storage.go @@ -145,7 +145,7 @@ type DirectAccess interface { // EnsureExists makes sure that the remote storage location exists and can be up- or downloaded from EnsureExists(ctx context.Context) error - // ListObjects returns all objects found with the given prefix + // ListObjects returns all objects found with the given prefix. Returns an empty list if the bucket does not exuist (yet). ListObjects(ctx context.Context, prefix string) ([]string, error) // Fully qualifies a snapshot name so that it can be downloaded using DownloadSnapshot diff --git a/components/gitpod-protocol/src/gitpod-service.ts b/components/gitpod-protocol/src/gitpod-service.ts index 831b84cda466a8..10dc713d413f01 100644 --- a/components/gitpod-protocol/src/gitpod-service.ts +++ b/components/gitpod-protocol/src/gitpod-service.ts @@ -14,7 +14,7 @@ import { } from './protocol'; import { JsonRpcProxy, JsonRpcServer } from './messaging/proxy-factory'; import { Disposable, CancellationTokenSource } from 'vscode-jsonrpc'; -import { HeadlessLogEvent, HeadlessLogSources } from './headless-workspace-log'; +import { HeadlessLogEvent, HeadlessLogUrls } from './headless-workspace-log'; import { WorkspaceInstance, WorkspaceInstancePort, WorkspaceInstancePhase } from './workspace-instance'; import { AdminServer } from './admin-protocol'; import { GitpodHostUrl } from './util/gitpod-host-url'; @@ -85,7 +85,7 @@ export interface GitpodServer extends JsonRpcServer, AdminServer, watchWorkspaceImageBuildLogs(workspaceId: string): Promise; watchHeadlessWorkspaceLogs(workspaceId: string): Promise; isPrebuildDone(pwsid: string): Promise; - getHeadlessLog(instanceId: string): Promise; + getHeadlessLog(instanceId: string): Promise; // Workspace timeout setWorkspaceTimeout(workspaceId: string, duration: WorkspaceTimeoutDuration): Promise; diff --git a/components/gitpod-protocol/src/headless-workspace-log.ts b/components/gitpod-protocol/src/headless-workspace-log.ts index ef9898ef04abf2..5503d024c749b3 100644 --- a/components/gitpod-protocol/src/headless-workspace-log.ts +++ b/components/gitpod-protocol/src/headless-workspace-log.ts @@ -41,7 +41,7 @@ export interface TheiaHeadlessLogMessage { snapshotURL?: string; } -export interface HeadlessLogSources { +export interface HeadlessLogUrls { // A map of id to URL streams: { [streamID: string]: string }; } diff --git a/components/gitpod-protocol/src/wsready.ts b/components/gitpod-protocol/src/wsready.ts index d950c7d25c92a4..d6c185e501e391 100644 --- a/components/gitpod-protocol/src/wsready.ts +++ b/components/gitpod-protocol/src/wsready.ts @@ -4,7 +4,7 @@ * See License-AGPL.txt in the project root for license information. */ -// generated using github.com/32leaves/bel on 2021-06-30 15:17:12.411118468 +0000 UTC m=+0.009646252 +// generated using github.com/32leaves/bel on 2021-07-01 13:33:23.288163364 +0000 UTC m=+0.012145659 // DO NOT MODIFY export enum WorkspaceInitSource { diff --git a/components/server/src/container-module.ts b/components/server/src/container-module.ts index a5423ab0886e0a..24d6b40e5e8c03 100644 --- a/components/server/src/container-module.ts +++ b/components/server/src/container-module.ts @@ -75,8 +75,9 @@ import { newAnalyticsWriterFromEnv, IAnalyticsWriter } from '@gitpod/gitpod-prot import { OAuthController } from './oauth-server/oauth-controller'; import { ImageBuildPrefixContextParser } from './workspace/imagebuild-prefix-context-parser'; import { AdditionalContentPrefixContextParser } from './workspace/additional-content-prefix-context-parser'; -import { WorkspaceLogService } from './workspace/workspace-log-service'; +import { HeadlessLogService } from './workspace/headless-log-service'; import { HeadlessLogController } from './workspace/headless-log-controller'; +import { HeadlessLogServiceClient } from '@gitpod/content-service/lib/headless-log_grpc_pb'; export const productionContainerModule = new ContainerModule((bind, unbind, isBound, rebind) => { bind(Env).toSelf().inSingletonScope(); @@ -189,6 +190,8 @@ export const productionContainerModule = new ContainerModule((bind, unbind, isBo bind(WorkspaceServiceClient).toConstantValue(workspaceServiceClient); const idePluginServiceClient = new IDEPluginServiceClient(contentServiceAddress, grpc.credentials.createInsecure()) bind(IDEPluginServiceClient).toConstantValue(idePluginServiceClient); + const headlessLogServiceClient = new HeadlessLogServiceClient(contentServiceAddress, grpc.credentials.createInsecure()) + bind(HeadlessLogServiceClient).toConstantValue(headlessLogServiceClient); bind(StorageClient).to(ContentServiceStorageClient).inSingletonScope(); @@ -198,6 +201,6 @@ export const productionContainerModule = new ContainerModule((bind, unbind, isBo bind(OAuthController).toSelf().inSingletonScope(); - bind(WorkspaceLogService).toSelf().inSingletonScope(); + bind(HeadlessLogService).toSelf().inSingletonScope(); bind(HeadlessLogController).toSelf().inSingletonScope(); }); diff --git a/components/server/src/workspace/gitpod-server-impl.ts b/components/server/src/workspace/gitpod-server-impl.ts index 8fa1566b9f0d6b..25a742f0315f7d 100644 --- a/components/server/src/workspace/gitpod-server-impl.ts +++ b/components/server/src/workspace/gitpod-server-impl.ts @@ -46,8 +46,8 @@ import { MessageBusIntegration } from './messagebus-integration'; import { WorkspaceDeletionService } from './workspace-deletion-service'; import { WorkspaceFactory } from './workspace-factory'; import { WorkspaceStarter } from './workspace-starter'; -import { HeadlessLogSources } from "@gitpod/gitpod-protocol/lib/headless-workspace-log"; -import { WorkspaceLogService } from "./workspace-log-service"; +import { HeadlessLogUrls } from "@gitpod/gitpod-protocol/lib/headless-workspace-log"; +import { HeadlessLogService } from "./headless-log-service"; @injectable() export class GitpodServerImpl implements GitpodServer, Disposable { @@ -89,7 +89,7 @@ export class GitpodServerImpl { - this.checkAndBlockUser('getHeadlessLog', { instanceId }); + async getHeadlessLog(instanceId: string): Promise { + const user = this.checkAndBlockUser('getHeadlessLog', { instanceId }); const span = opentracing.globalTracer().startSpan("getHeadlessLog"); const ws = await this.workspaceDb.trace({span}).findByInstanceId(instanceId); @@ -1182,11 +1182,11 @@ export class GitpodServerImpl { diff --git a/components/server/src/workspace/headless-log-controller.ts b/components/server/src/workspace/headless-log-controller.ts index 2b5bc02164a04e..8860e3f52fd2be 100644 --- a/components/server/src/workspace/headless-log-controller.ts +++ b/components/server/src/workspace/headless-log-controller.ts @@ -12,7 +12,7 @@ import { CompositeResourceAccessGuard, OwnerResourceGuard, WorkspaceLogAccessGua import { HostContextProvider } from "../auth/host-context-provider"; import { DBWithTracing, TracedWorkspaceDB } from "@gitpod/gitpod-db/lib/traced-db"; import { WorkspaceDB } from "@gitpod/gitpod-db/lib/workspace-db"; -import { WorkspaceLogService } from "./workspace-log-service"; +import { HeadlessLogService } from "./headless-log-service"; import * as opentracing from 'opentracing'; import { asyncHandler } from "../express-util"; import { Deferred } from "@gitpod/gitpod-protocol/lib/util/deferred"; @@ -26,7 +26,7 @@ export class HeadlessLogController { @inject(HostContextProvider) protected readonly hostContextProvider: HostContextProvider; @inject(TracedWorkspaceDB) protected readonly workspaceDb: DBWithTracing; - @inject(WorkspaceLogService) protected readonly workspaceLogService: WorkspaceLogService; + @inject(HeadlessLogService) protected readonly headlessLogService: HeadlessLogService; @inject(BearerAuth) protected readonly auth: BearerAuth; get apiRouter(): express.Router { @@ -113,7 +113,7 @@ export class HeadlessLogController { process.nextTick(resolve); } })); - await this.workspaceLogService.streamWorkspaceLog(instance, params.terminalId, writeToResponse, aborted); + await this.headlessLogService.streamWorkspaceLog(instance, params.terminalId, writeToResponse, aborted); // In an ideal world, we'd use res.addTrailers()/response.trailer here. But despite being introduced with HTTP/1.1 in 1999, trailers are not supported by popular proxies (nginx, for example). // So we resort to this hand-written solution diff --git a/components/server/src/workspace/workspace-log-service.ts b/components/server/src/workspace/headless-log-service.ts similarity index 60% rename from components/server/src/workspace/workspace-log-service.ts rename to components/server/src/workspace/headless-log-service.ts index c01e4d5e01b665..9d30525c0c2f52 100644 --- a/components/server/src/workspace/workspace-log-service.ts +++ b/components/server/src/workspace/headless-log-service.ts @@ -5,7 +5,7 @@ */ import { WorkspaceDB } from "@gitpod/gitpod-db/lib/workspace-db"; -import { HeadlessLogSources } from "@gitpod/gitpod-protocol/lib/headless-workspace-log"; +import { HeadlessLogUrls } from "@gitpod/gitpod-protocol/lib/headless-workspace-log"; import { inject, injectable } from "inversify"; import * as url from "url"; import { Status, StatusServiceClient } from '@gitpod/supervisor-api-grpcweb/lib/status_pb_service' @@ -13,46 +13,84 @@ import { TasksStatusRequest, TasksStatusResponse, TaskStatus } from "@gitpod/sup import { ResponseStream, TerminalServiceClient } from "@gitpod/supervisor-api-grpcweb/lib/terminal_pb_service"; import { ListenTerminalRequest, ListenTerminalResponse } from "@gitpod/supervisor-api-grpcweb/lib/terminal_pb"; import { WorkspaceInstance } from "@gitpod/gitpod-protocol"; -import { status as grpcStatus } from '@grpc/grpc-js'; +import * as grpc from '@grpc/grpc-js'; import { Env } from "../env"; import * as browserHeaders from "browser-headers"; import { log } from '@gitpod/gitpod-protocol/lib/util/logging'; import { TextDecoder } from "util"; import { WebsocketTransport } from "../util/grpc-web-ws-transport"; import { Deferred } from "@gitpod/gitpod-protocol/lib/util/deferred"; +import { HeadlessLogServiceClient } from '@gitpod/content-service/lib/headless-log_grpc_pb'; +import { ListLogsRequest, ListLogsResponse, LogDownloadURLRequest, LogDownloadURLResponse } from '@gitpod/content-service/lib/headless-log_pb'; @injectable() -export class WorkspaceLogService { +export class HeadlessLogService { static readonly SUPERVISOR_API_PATH = "/_supervisor/v1"; @inject(WorkspaceDB) protected readonly db: WorkspaceDB; @inject(Env) protected readonly env: Env; - - public async getWorkspaceLogURLs(wsi: WorkspaceInstance, maxTimeoutSecs: number = 30): Promise { - const aborted = new Deferred(); - setTimeout(() => aborted.resolve(true), maxTimeoutSecs * 1000); - const streamIds = await this.retryWhileInstanceIsRunning(wsi, () => this.listWorkspaceLogs(wsi), "list workspace log streams", aborted); - if (streamIds === undefined) { - return undefined; + @inject(HeadlessLogServiceClient) protected readonly headlessLogClient: HeadlessLogServiceClient; + + public async getHeadlessLogURLs(userId: string, wsi: WorkspaceInstance, maxTimeoutSecs: number = 30): Promise { + if (isSupervisorAvailableSoon(wsi)) { + const aborted = new Deferred(); + setTimeout(() => aborted.resolve(true), maxTimeoutSecs * 1000); + const streamIds = await this.retryWhileInstanceIsRunning(wsi, () => this.supervisorListHeadlessLogs(wsi), "list headless log streams", aborted); + if (streamIds !== undefined) { + return streamIds; + } } - // render URLs + // we were unable to get a resonse from supervisor - let's try content service next + return await this.contentServiceListLogs(userId, wsi); + } + + protected async contentServiceListLogs(userId: string, wsi: WorkspaceInstance): Promise { + const req = new ListLogsRequest(); + req.setOwnerId(userId); + req.setWorkspaceId(wsi.workspaceId); + req.setInstanceId(wsi.id); + const response = await new Promise((resolve, reject) => { + this.headlessLogClient.listLogs(req, (err: grpc.ServiceError | null, response: ListLogsResponse) => { + if (err) { + reject(err); + } else { + resolve(response); + } + }); + }); + + log.info(`got ${response.getTaskidList().length} taskIds from content-service`); + + // fetch a download URL for each task + const responses: Promise<[string, string]>[] = response.getTaskidList() + .map((taskId) => new Promise<[string, string]>((resolve, reject) => { + const req = new LogDownloadURLRequest(); + req.setOwnerId(userId); + req.setWorkspaceId(wsi.workspaceId); + req.setInstanceId(wsi.id); + req.setTaskId(taskId); + this.headlessLogClient.logDownloadURL(req, (err: grpc.ServiceError | null, response: LogDownloadURLResponse) => { + if (err) { + reject(err); + } else { + resolve([taskId, response.getUrl()]); + } + }); + })); + const urlForTaskId = await Promise.all(responses); + + // TODO translate to URL of proxy endpoint from where this can be downloaded const streams: { [id: string]: string } = {}; - for (const [streamId, terminalId] of streamIds.entries()) { - streams[streamId] = this.env.hostUrl.with({ - pathname: `/headless-logs/${wsi.id}/${terminalId}`, - }).toString(); + for (const [taskId, url] of urlForTaskId) { + streams[taskId] = url; } return { streams }; } - /** - * Returns a list of ids of streams for the given workspace - * @param workspace - */ - protected async listWorkspaceLogs(wsi: WorkspaceInstance): Promise> { + protected async supervisorListHeadlessLogs(wsi: WorkspaceInstance): Promise { const tasks = await new Promise((resolve, reject) => { const client = new StatusServiceClient(toSupervisorURL(wsi.ideUrl), { transport: WebsocketTransport(), @@ -65,7 +103,7 @@ export class WorkspaceLogService { stream.cancel(); }); stream.on('end', (status?: Status) => { - if (status && status.code !== grpcStatus.OK) { + if (status && status.code !== grpc.status.OK) { const err = new Error(`upstream ended with status code: ${status.code}`); (err as any).status = status; reject(err); @@ -73,9 +111,18 @@ export class WorkspaceLogService { }); }); - const result = new Map(); - tasks.forEach(t => result.set(t.getId(), t.getTerminal())); - return result; + // render URLs that point to server's /headless-logs/ endpoint which forwards calls to the running workspaces's supervisor + const streams: { [id: string]: string } = {}; + for (const task of tasks) { + const taskId = task.getId(); + const terminalId = task.getTerminal(); + streams[taskId] = this.env.hostUrl.with({ + pathname: `/headless-logs/${wsi.id}/${terminalId}`, + }).toString(); + } + return { + streams + }; } /** @@ -110,14 +157,14 @@ export class WorkspaceLogService { }); }); stream.on('end', (status?: Status) => { - if (!status || status.code === grpcStatus.OK) { + if (!status || status.code === grpc.status.OK) { resolve(); return; } const err = new Error(`upstream ended with status code: ${status.code}`); (err as any).status = status; - if (!receivedDataYet && status.code === grpcStatus.UNAVAILABLE) { + if (!receivedDataYet && status.code === grpc.status.UNAVAILABLE) { log.debug("stream headless workspace log", err); reject(err); return; @@ -162,22 +209,26 @@ export class WorkspaceLogService { } protected shouldRetry(wsi: WorkspaceInstance): boolean { - switch (wsi.status.phase) { - case "creating": - case "preparing": - case "initializing": - case "pending": - case "running": - return true; - default: - return false; - } + return isSupervisorAvailableSoon(wsi); + } +} + +function isSupervisorAvailableSoon(wsi: WorkspaceInstance): boolean { + switch (wsi.status.phase) { + case "creating": + case "preparing": + case "initializing": + case "pending": + case "running": + return true; + default: + return false; } } function toSupervisorURL(ideUrl: string): string { const u = new url.URL(ideUrl); - u.pathname = WorkspaceLogService.SUPERVISOR_API_PATH; + u.pathname = HeadlessLogService.SUPERVISOR_API_PATH; return u.toString(); } diff --git a/components/ws-daemon/pkg/content/initializer.go b/components/ws-daemon/pkg/content/initializer.go index b449bfcc89c737..b7d868cf26ab75 100644 --- a/components/ws-daemon/pkg/content/initializer.go +++ b/components/ws-daemon/pkg/content/initializer.go @@ -347,6 +347,11 @@ func (rs *remoteContentStorage) DownloadSnapshot(ctx context.Context, destinatio return rs.Download(ctx, destination, name, mappings) } +// ListObjects returns all objects found with the given prefix. Returns an empty list if the bucket does not exuist (yet). +func (rs *remoteContentStorage) ListObjects(ctx context.Context, prefix string) (objects []string, err error) { + return []string{}, nil +} + // Qualify just returns the name func (rs *remoteContentStorage) Qualify(name string) string { return name diff --git a/components/ws-daemon/pkg/content/service.go b/components/ws-daemon/pkg/content/service.go index ab43e12c34a261..f34347525bbe60 100644 --- a/components/ws-daemon/pkg/content/service.go +++ b/components/ws-daemon/pkg/content/service.go @@ -607,20 +607,20 @@ func (s *WorkspaceService) uploadWorkspaceLogs(ctx context.Context, sess *sessio return xerrors.Errorf("no remote storage configured") } + // currently we're only uploading prebuild log files logFiles, err := logs.ListPrebuildLogFiles(ctx, sess.Location) if err != nil { return err } for _, absLogPath := range logFiles { - taskID, parseErr := logs.ParseTaskID(absLogPath) + taskID, parseErr := logs.ParseTaskIDFromPrebuildLogFilePath(absLogPath) if parseErr != nil { - log.WithError(parseErr).Warn("cannot parse workspace log file name") + log.WithError(parseErr).Warn("cannot parse headless workspace log file name") continue } err = retryIfErr(ctx, s.config.Backup.Attempts, log.WithFields(sess.OWI()).WithField("op", "upload log"), func(ctx context.Context) (err error) { - // TODO(gpl) We name the log file by taskID bc that's the only thing we have readily available. It would be more consistent to use terminalID instead, which we don't have at our disposal here. - _, _, err = rs.UploadInstance(ctx, absLogPath, logs.UploadedWorkspaceLogPath(taskID)) + _, _, err = rs.UploadInstance(ctx, absLogPath, logs.UploadedHeadlessLogPath(taskID)) if err != nil { return }