From 85dc4fb5ce06397f769bb6e5da01667816863cb4 Mon Sep 17 00:00:00 2001 From: Milan Pavlik Date: Tue, 23 Aug 2022 09:14:01 +0000 Subject: [PATCH] [content-service] Define GetDownloadURL rpc --- components/content-service-api/go/blobs.pb.go | 1 + .../content-service-api/go/initializer.pb.go | 1 + components/content-service-api/go/usage.pb.go | 174 ++++++++-- .../content-service-api/go/usage_grpc.pb.go | 38 +++ .../typescript/src/usage_grpc_pb.d.ts | 17 + .../typescript/src/usage_grpc_pb.js | 34 ++ .../typescript/src/usage_pb.d.ts | 40 +++ .../typescript/src/usage_pb.js | 304 ++++++++++++++++++ components/content-service-api/usage.proto | 11 + 9 files changed, 601 insertions(+), 19 deletions(-) diff --git a/components/content-service-api/go/blobs.pb.go b/components/content-service-api/go/blobs.pb.go index 7378e7e70e7265..c9e0354aa5fc9c 100644 --- a/components/content-service-api/go/blobs.pb.go +++ b/components/content-service-api/go/blobs.pb.go @@ -251,6 +251,7 @@ type DeleteRequest struct { OwnerId string `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` // Types that are assignable to Name: + // // *DeleteRequest_Exact // *DeleteRequest_Prefix Name isDeleteRequest_Name `protobuf_oneof:"name"` diff --git a/components/content-service-api/go/initializer.pb.go b/components/content-service-api/go/initializer.pb.go index c78a90615b7228..c10291cc30070a 100644 --- a/components/content-service-api/go/initializer.pb.go +++ b/components/content-service-api/go/initializer.pb.go @@ -142,6 +142,7 @@ type WorkspaceInitializer struct { unknownFields protoimpl.UnknownFields // Types that are assignable to Spec: + // // *WorkspaceInitializer_Empty // *WorkspaceInitializer_Git // *WorkspaceInitializer_Snapshot diff --git a/components/content-service-api/go/usage.pb.go b/components/content-service-api/go/usage.pb.go index f35ba84e3f437e..abb1f47984b1f4 100644 --- a/components/content-service-api/go/usage.pb.go +++ b/components/content-service-api/go/usage.pb.go @@ -118,6 +118,100 @@ func (x *UsageReportUploadURLResponse) GetUrl() string { return "" } +type UsageReportDownloadURLRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *UsageReportDownloadURLRequest) Reset() { + *x = UsageReportDownloadURLRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_usage_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UsageReportDownloadURLRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UsageReportDownloadURLRequest) ProtoMessage() {} + +func (x *UsageReportDownloadURLRequest) ProtoReflect() protoreflect.Message { + mi := &file_usage_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UsageReportDownloadURLRequest.ProtoReflect.Descriptor instead. +func (*UsageReportDownloadURLRequest) Descriptor() ([]byte, []int) { + return file_usage_proto_rawDescGZIP(), []int{2} +} + +func (x *UsageReportDownloadURLRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type UsageReportDownloadURLResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` +} + +func (x *UsageReportDownloadURLResponse) Reset() { + *x = UsageReportDownloadURLResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_usage_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UsageReportDownloadURLResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UsageReportDownloadURLResponse) ProtoMessage() {} + +func (x *UsageReportDownloadURLResponse) ProtoReflect() protoreflect.Message { + mi := &file_usage_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UsageReportDownloadURLResponse.ProtoReflect.Descriptor instead. +func (*UsageReportDownloadURLResponse) Descriptor() ([]byte, []int) { + return file_usage_proto_rawDescGZIP(), []int{3} +} + +func (x *UsageReportDownloadURLResponse) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + var File_usage_proto protoreflect.FileDescriptor var file_usage_proto_rawDesc = []byte{ @@ -129,18 +223,32 @@ var file_usage_proto_rawDesc = []byte{ 0x22, 0x30, 0x0a, 0x1c, 0x55, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x55, 0x70, 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, 0x32, 0x7e, 0x0a, 0x12, 0x55, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, - 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x68, 0x0a, 0x09, 0x55, 0x70, 0x6c, 0x6f, - 0x61, 0x64, 0x55, 0x52, 0x4c, 0x12, 0x2b, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x55, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x70, 0x6f, - 0x72, 0x74, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x55, 0x52, 0x4c, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x2e, 0x55, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x55, - 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x55, 0x52, 0x4c, 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, + 0x72, 0x6c, 0x22, 0x33, 0x0a, 0x1d, 0x55, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, + 0x74, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x55, 0x52, 0x4c, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x32, 0x0a, 0x1e, 0x55, 0x73, 0x61, 0x67, 0x65, + 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 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, 0x32, 0xee, 0x01, 0x0a, 0x12, + 0x55, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x12, 0x68, 0x0a, 0x09, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x55, 0x52, 0x4c, 0x12, + 0x2b, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x2e, 0x55, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x55, 0x70, 0x6c, 0x6f, + 0x61, 0x64, 0x55, 0x52, 0x4c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x63, + 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x55, 0x73, + 0x61, 0x67, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x55, + 0x52, 0x4c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x6e, 0x0a, 0x0b, + 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x55, 0x52, 0x4c, 0x12, 0x2d, 0x2e, 0x63, 0x6f, + 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x55, 0x73, 0x61, + 0x67, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, + 0x55, 0x52, 0x4c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x63, 0x6f, 0x6e, + 0x74, 0x65, 0x6e, 0x74, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x55, 0x73, 0x61, 0x67, + 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x55, + 0x52, 0x4c, 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 ( @@ -155,16 +263,20 @@ func file_usage_proto_rawDescGZIP() []byte { return file_usage_proto_rawDescData } -var file_usage_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_usage_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_usage_proto_goTypes = []interface{}{ - (*UsageReportUploadURLRequest)(nil), // 0: contentservice.UsageReportUploadURLRequest - (*UsageReportUploadURLResponse)(nil), // 1: contentservice.UsageReportUploadURLResponse + (*UsageReportUploadURLRequest)(nil), // 0: contentservice.UsageReportUploadURLRequest + (*UsageReportUploadURLResponse)(nil), // 1: contentservice.UsageReportUploadURLResponse + (*UsageReportDownloadURLRequest)(nil), // 2: contentservice.UsageReportDownloadURLRequest + (*UsageReportDownloadURLResponse)(nil), // 3: contentservice.UsageReportDownloadURLResponse } var file_usage_proto_depIdxs = []int32{ 0, // 0: contentservice.UsageReportService.UploadURL:input_type -> contentservice.UsageReportUploadURLRequest - 1, // 1: contentservice.UsageReportService.UploadURL:output_type -> contentservice.UsageReportUploadURLResponse - 1, // [1:2] is the sub-list for method output_type - 0, // [0:1] is the sub-list for method input_type + 2, // 1: contentservice.UsageReportService.DownloadURL:input_type -> contentservice.UsageReportDownloadURLRequest + 1, // 2: contentservice.UsageReportService.UploadURL:output_type -> contentservice.UsageReportUploadURLResponse + 3, // 3: contentservice.UsageReportService.DownloadURL:output_type -> contentservice.UsageReportDownloadURLResponse + 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 0, // [0:0] is the sub-list for extension extendee 0, // [0:0] is the sub-list for field type_name @@ -200,6 +312,30 @@ func file_usage_proto_init() { return nil } } + file_usage_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UsageReportDownloadURLRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_usage_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UsageReportDownloadURLResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -207,7 +343,7 @@ func file_usage_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_usage_proto_rawDesc, NumEnums: 0, - NumMessages: 2, + NumMessages: 4, NumExtensions: 0, NumServices: 1, }, diff --git a/components/content-service-api/go/usage_grpc.pb.go b/components/content-service-api/go/usage_grpc.pb.go index 022b99992f6a12..4de41dd76a51b5 100644 --- a/components/content-service-api/go/usage_grpc.pb.go +++ b/components/content-service-api/go/usage_grpc.pb.go @@ -28,6 +28,8 @@ const _ = grpc.SupportPackageIsVersion7 type UsageReportServiceClient interface { // UploadURL provides a URL to which clients can upload the content via HTTP PUT. UploadURL(ctx context.Context, in *UsageReportUploadURLRequest, opts ...grpc.CallOption) (*UsageReportUploadURLResponse, error) + // DownloadURL retrieves a URL which can be used to download a Usage Report. + DownloadURL(ctx context.Context, in *UsageReportDownloadURLRequest, opts ...grpc.CallOption) (*UsageReportDownloadURLResponse, error) } type usageReportServiceClient struct { @@ -47,12 +49,23 @@ func (c *usageReportServiceClient) UploadURL(ctx context.Context, in *UsageRepor return out, nil } +func (c *usageReportServiceClient) DownloadURL(ctx context.Context, in *UsageReportDownloadURLRequest, opts ...grpc.CallOption) (*UsageReportDownloadURLResponse, error) { + out := new(UsageReportDownloadURLResponse) + err := c.cc.Invoke(ctx, "/contentservice.UsageReportService/DownloadURL", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // UsageReportServiceServer is the server API for UsageReportService service. // All implementations must embed UnimplementedUsageReportServiceServer // for forward compatibility type UsageReportServiceServer interface { // UploadURL provides a URL to which clients can upload the content via HTTP PUT. UploadURL(context.Context, *UsageReportUploadURLRequest) (*UsageReportUploadURLResponse, error) + // DownloadURL retrieves a URL which can be used to download a Usage Report. + DownloadURL(context.Context, *UsageReportDownloadURLRequest) (*UsageReportDownloadURLResponse, error) mustEmbedUnimplementedUsageReportServiceServer() } @@ -63,6 +76,9 @@ type UnimplementedUsageReportServiceServer struct { func (UnimplementedUsageReportServiceServer) UploadURL(context.Context, *UsageReportUploadURLRequest) (*UsageReportUploadURLResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UploadURL not implemented") } +func (UnimplementedUsageReportServiceServer) DownloadURL(context.Context, *UsageReportDownloadURLRequest) (*UsageReportDownloadURLResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DownloadURL not implemented") +} func (UnimplementedUsageReportServiceServer) mustEmbedUnimplementedUsageReportServiceServer() {} // UnsafeUsageReportServiceServer may be embedded to opt out of forward compatibility for this service. @@ -94,6 +110,24 @@ func _UsageReportService_UploadURL_Handler(srv interface{}, ctx context.Context, return interceptor(ctx, in, info, handler) } +func _UsageReportService_DownloadURL_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UsageReportDownloadURLRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UsageReportServiceServer).DownloadURL(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/contentservice.UsageReportService/DownloadURL", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UsageReportServiceServer).DownloadURL(ctx, req.(*UsageReportDownloadURLRequest)) + } + return interceptor(ctx, in, info, handler) +} + // UsageReportService_ServiceDesc is the grpc.ServiceDesc for UsageReportService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -105,6 +139,10 @@ var UsageReportService_ServiceDesc = grpc.ServiceDesc{ MethodName: "UploadURL", Handler: _UsageReportService_UploadURL_Handler, }, + { + MethodName: "DownloadURL", + Handler: _UsageReportService_DownloadURL_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "usage.proto", diff --git a/components/content-service-api/typescript/src/usage_grpc_pb.d.ts b/components/content-service-api/typescript/src/usage_grpc_pb.d.ts index 99c771355373a4..e463ed79b56306 100644 --- a/components/content-service-api/typescript/src/usage_grpc_pb.d.ts +++ b/components/content-service-api/typescript/src/usage_grpc_pb.d.ts @@ -15,6 +15,7 @@ import * as usage_pb from "./usage_pb"; interface IUsageReportServiceService extends grpc.ServiceDefinition { uploadURL: IUsageReportServiceService_IUploadURL; + downloadURL: IUsageReportServiceService_IDownloadURL; } interface IUsageReportServiceService_IUploadURL extends grpc.MethodDefinition { @@ -26,17 +27,30 @@ interface IUsageReportServiceService_IUploadURL extends grpc.MethodDefinition; responseDeserialize: grpc.deserialize; } +interface IUsageReportServiceService_IDownloadURL extends grpc.MethodDefinition { + path: "/contentservice.UsageReportService/DownloadURL"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} export const UsageReportServiceService: IUsageReportServiceService; export interface IUsageReportServiceServer extends grpc.UntypedServiceImplementation { uploadURL: grpc.handleUnaryCall; + downloadURL: grpc.handleUnaryCall; } export interface IUsageReportServiceClient { uploadURL(request: usage_pb.UsageReportUploadURLRequest, callback: (error: grpc.ServiceError | null, response: usage_pb.UsageReportUploadURLResponse) => void): grpc.ClientUnaryCall; uploadURL(request: usage_pb.UsageReportUploadURLRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: usage_pb.UsageReportUploadURLResponse) => void): grpc.ClientUnaryCall; uploadURL(request: usage_pb.UsageReportUploadURLRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: usage_pb.UsageReportUploadURLResponse) => void): grpc.ClientUnaryCall; + downloadURL(request: usage_pb.UsageReportDownloadURLRequest, callback: (error: grpc.ServiceError | null, response: usage_pb.UsageReportDownloadURLResponse) => void): grpc.ClientUnaryCall; + downloadURL(request: usage_pb.UsageReportDownloadURLRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: usage_pb.UsageReportDownloadURLResponse) => void): grpc.ClientUnaryCall; + downloadURL(request: usage_pb.UsageReportDownloadURLRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: usage_pb.UsageReportDownloadURLResponse) => void): grpc.ClientUnaryCall; } export class UsageReportServiceClient extends grpc.Client implements IUsageReportServiceClient { @@ -44,4 +58,7 @@ export class UsageReportServiceClient extends grpc.Client implements IUsageRepor public uploadURL(request: usage_pb.UsageReportUploadURLRequest, callback: (error: grpc.ServiceError | null, response: usage_pb.UsageReportUploadURLResponse) => void): grpc.ClientUnaryCall; public uploadURL(request: usage_pb.UsageReportUploadURLRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: usage_pb.UsageReportUploadURLResponse) => void): grpc.ClientUnaryCall; public uploadURL(request: usage_pb.UsageReportUploadURLRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: usage_pb.UsageReportUploadURLResponse) => void): grpc.ClientUnaryCall; + public downloadURL(request: usage_pb.UsageReportDownloadURLRequest, callback: (error: grpc.ServiceError | null, response: usage_pb.UsageReportDownloadURLResponse) => void): grpc.ClientUnaryCall; + public downloadURL(request: usage_pb.UsageReportDownloadURLRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: usage_pb.UsageReportDownloadURLResponse) => void): grpc.ClientUnaryCall; + public downloadURL(request: usage_pb.UsageReportDownloadURLRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: usage_pb.UsageReportDownloadURLResponse) => void): grpc.ClientUnaryCall; } diff --git a/components/content-service-api/typescript/src/usage_grpc_pb.js b/components/content-service-api/typescript/src/usage_grpc_pb.js index 506fb29c6128d8..b2a1341261e024 100644 --- a/components/content-service-api/typescript/src/usage_grpc_pb.js +++ b/components/content-service-api/typescript/src/usage_grpc_pb.js @@ -9,6 +9,28 @@ var grpc = require('@grpc/grpc-js'); var usage_pb = require('./usage_pb.js'); +function serialize_contentservice_UsageReportDownloadURLRequest(arg) { + if (!(arg instanceof usage_pb.UsageReportDownloadURLRequest)) { + throw new Error('Expected argument of type contentservice.UsageReportDownloadURLRequest'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_contentservice_UsageReportDownloadURLRequest(buffer_arg) { + return usage_pb.UsageReportDownloadURLRequest.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_contentservice_UsageReportDownloadURLResponse(arg) { + if (!(arg instanceof usage_pb.UsageReportDownloadURLResponse)) { + throw new Error('Expected argument of type contentservice.UsageReportDownloadURLResponse'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_contentservice_UsageReportDownloadURLResponse(buffer_arg) { + return usage_pb.UsageReportDownloadURLResponse.deserializeBinary(new Uint8Array(buffer_arg)); +} + function serialize_contentservice_UsageReportUploadURLRequest(arg) { if (!(arg instanceof usage_pb.UsageReportUploadURLRequest)) { throw new Error('Expected argument of type contentservice.UsageReportUploadURLRequest'); @@ -45,6 +67,18 @@ uploadURL: { responseSerialize: serialize_contentservice_UsageReportUploadURLResponse, responseDeserialize: deserialize_contentservice_UsageReportUploadURLResponse, }, + // DownloadURL retrieves a URL which can be used to download a Usage Report. +downloadURL: { + path: '/contentservice.UsageReportService/DownloadURL', + requestStream: false, + responseStream: false, + requestType: usage_pb.UsageReportDownloadURLRequest, + responseType: usage_pb.UsageReportDownloadURLResponse, + requestSerialize: serialize_contentservice_UsageReportDownloadURLRequest, + requestDeserialize: deserialize_contentservice_UsageReportDownloadURLRequest, + responseSerialize: serialize_contentservice_UsageReportDownloadURLResponse, + responseDeserialize: deserialize_contentservice_UsageReportDownloadURLResponse, + }, }; exports.UsageReportServiceClient = grpc.makeGenericClientConstructor(UsageReportServiceService); diff --git a/components/content-service-api/typescript/src/usage_pb.d.ts b/components/content-service-api/typescript/src/usage_pb.d.ts index 941a972c30a225..058e9f3407eda3 100644 --- a/components/content-service-api/typescript/src/usage_pb.d.ts +++ b/components/content-service-api/typescript/src/usage_pb.d.ts @@ -51,3 +51,43 @@ export namespace UsageReportUploadURLResponse { url: string, } } + +export class UsageReportDownloadURLRequest extends jspb.Message { + getName(): string; + setName(value: string): UsageReportDownloadURLRequest; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): UsageReportDownloadURLRequest.AsObject; + static toObject(includeInstance: boolean, msg: UsageReportDownloadURLRequest): UsageReportDownloadURLRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: UsageReportDownloadURLRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): UsageReportDownloadURLRequest; + static deserializeBinaryFromReader(message: UsageReportDownloadURLRequest, reader: jspb.BinaryReader): UsageReportDownloadURLRequest; +} + +export namespace UsageReportDownloadURLRequest { + export type AsObject = { + name: string, + } +} + +export class UsageReportDownloadURLResponse extends jspb.Message { + getUrl(): string; + setUrl(value: string): UsageReportDownloadURLResponse; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): UsageReportDownloadURLResponse.AsObject; + static toObject(includeInstance: boolean, msg: UsageReportDownloadURLResponse): UsageReportDownloadURLResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: UsageReportDownloadURLResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): UsageReportDownloadURLResponse; + static deserializeBinaryFromReader(message: UsageReportDownloadURLResponse, reader: jspb.BinaryReader): UsageReportDownloadURLResponse; +} + +export namespace UsageReportDownloadURLResponse { + export type AsObject = { + url: string, + } +} diff --git a/components/content-service-api/typescript/src/usage_pb.js b/components/content-service-api/typescript/src/usage_pb.js index 18d909d445ad1b..8a9e87e9e79759 100644 --- a/components/content-service-api/typescript/src/usage_pb.js +++ b/components/content-service-api/typescript/src/usage_pb.js @@ -21,6 +21,8 @@ var jspb = require('google-protobuf'); var goog = jspb; var global = (function() { return this || window || global || self || Function('return this')(); }).call(null); +goog.exportSymbol('proto.contentservice.UsageReportDownloadURLRequest', null, global); +goog.exportSymbol('proto.contentservice.UsageReportDownloadURLResponse', null, global); goog.exportSymbol('proto.contentservice.UsageReportUploadURLRequest', null, global); goog.exportSymbol('proto.contentservice.UsageReportUploadURLResponse', null, global); /** @@ -65,6 +67,48 @@ if (goog.DEBUG && !COMPILED) { */ proto.contentservice.UsageReportUploadURLResponse.displayName = 'proto.contentservice.UsageReportUploadURLResponse'; } +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.contentservice.UsageReportDownloadURLRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.contentservice.UsageReportDownloadURLRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.contentservice.UsageReportDownloadURLRequest.displayName = 'proto.contentservice.UsageReportDownloadURLRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.contentservice.UsageReportDownloadURLResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.contentservice.UsageReportDownloadURLResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.contentservice.UsageReportDownloadURLResponse.displayName = 'proto.contentservice.UsageReportDownloadURLResponse'; +} @@ -325,4 +369,264 @@ proto.contentservice.UsageReportUploadURLResponse.prototype.setUrl = function(va }; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.contentservice.UsageReportDownloadURLRequest.prototype.toObject = function(opt_includeInstance) { + return proto.contentservice.UsageReportDownloadURLRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.contentservice.UsageReportDownloadURLRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.contentservice.UsageReportDownloadURLRequest.toObject = function(includeInstance, msg) { + var f, obj = { + name: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.contentservice.UsageReportDownloadURLRequest} + */ +proto.contentservice.UsageReportDownloadURLRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.contentservice.UsageReportDownloadURLRequest; + return proto.contentservice.UsageReportDownloadURLRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.contentservice.UsageReportDownloadURLRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.contentservice.UsageReportDownloadURLRequest} + */ +proto.contentservice.UsageReportDownloadURLRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setName(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.contentservice.UsageReportDownloadURLRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.contentservice.UsageReportDownloadURLRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.contentservice.UsageReportDownloadURLRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.contentservice.UsageReportDownloadURLRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getName(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string name = 1; + * @return {string} + */ +proto.contentservice.UsageReportDownloadURLRequest.prototype.getName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.contentservice.UsageReportDownloadURLRequest} returns this + */ +proto.contentservice.UsageReportDownloadURLRequest.prototype.setName = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.contentservice.UsageReportDownloadURLResponse.prototype.toObject = function(opt_includeInstance) { + return proto.contentservice.UsageReportDownloadURLResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.contentservice.UsageReportDownloadURLResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.contentservice.UsageReportDownloadURLResponse.toObject = function(includeInstance, msg) { + var f, obj = { + url: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.contentservice.UsageReportDownloadURLResponse} + */ +proto.contentservice.UsageReportDownloadURLResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.contentservice.UsageReportDownloadURLResponse; + return proto.contentservice.UsageReportDownloadURLResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.contentservice.UsageReportDownloadURLResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.contentservice.UsageReportDownloadURLResponse} + */ +proto.contentservice.UsageReportDownloadURLResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setUrl(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.contentservice.UsageReportDownloadURLResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.contentservice.UsageReportDownloadURLResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.contentservice.UsageReportDownloadURLResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.contentservice.UsageReportDownloadURLResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getUrl(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string url = 1; + * @return {string} + */ +proto.contentservice.UsageReportDownloadURLResponse.prototype.getUrl = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.contentservice.UsageReportDownloadURLResponse} returns this + */ +proto.contentservice.UsageReportDownloadURLResponse.prototype.setUrl = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + goog.object.extend(exports, proto.contentservice); diff --git a/components/content-service-api/usage.proto b/components/content-service-api/usage.proto index d5cee80979ed6b..e48091a852c1b6 100644 --- a/components/content-service-api/usage.proto +++ b/components/content-service-api/usage.proto @@ -11,6 +11,9 @@ option go_package = "github.com/gitpod-io/gitpod/content-service/api"; service UsageReportService { // UploadURL provides a URL to which clients can upload the content via HTTP PUT. rpc UploadURL(UsageReportUploadURLRequest) returns (UsageReportUploadURLResponse) {} + + // DownloadURL retrieves a URL which can be used to download a Usage Report. + rpc DownloadURL(UsageReportDownloadURLRequest) returns (UsageReportDownloadURLResponse) {} } message UsageReportUploadURLRequest { @@ -20,3 +23,11 @@ message UsageReportUploadURLRequest { message UsageReportUploadURLResponse { string url = 1; } + +message UsageReportDownloadURLRequest { + string name = 1; +} + +message UsageReportDownloadURLResponse { + string url = 1; +}