From a52e8a73644496fd77dac3698e6875a7cbc7959c Mon Sep 17 00:00:00 2001 From: Milan Pavlik Date: Wed, 27 Jul 2022 08:25:41 +0000 Subject: [PATCH 1/2] [usage] Add CollectUsage RPC --- components/usage-api/go/v1/usage.pb.go | 206 +++++++-- components/usage-api/go/v1/usage_grpc.pb.go | 38 ++ .../src/usage/v1/usage_grpc_pb.d.ts | 17 + .../typescript/src/usage/v1/usage_grpc_pb.js | 34 ++ .../typescript/src/usage/v1/usage_pb.d.ts | 51 +++ .../typescript/src/usage/v1/usage_pb.js | 406 ++++++++++++++++++ components/usage-api/usage/v1/usage.proto | 12 + 7 files changed, 737 insertions(+), 27 deletions(-) diff --git a/components/usage-api/go/v1/usage.pb.go b/components/usage-api/go/v1/usage.pb.go index 0548b3c3837476..5f064d9e2206be 100644 --- a/components/usage-api/go/v1/usage.pb.go +++ b/components/usage-api/go/v1/usage.pb.go @@ -330,6 +330,108 @@ func (x *BilledSession) GetCredits() float64 { return 0 } +type CollectUsageRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + StartTime *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"` + EndTime *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty"` +} + +func (x *CollectUsageRequest) Reset() { + *x = CollectUsageRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_usage_v1_usage_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CollectUsageRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CollectUsageRequest) ProtoMessage() {} + +func (x *CollectUsageRequest) ProtoReflect() protoreflect.Message { + mi := &file_usage_v1_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 CollectUsageRequest.ProtoReflect.Descriptor instead. +func (*CollectUsageRequest) Descriptor() ([]byte, []int) { + return file_usage_v1_usage_proto_rawDescGZIP(), []int{3} +} + +func (x *CollectUsageRequest) GetStartTime() *timestamppb.Timestamp { + if x != nil { + return x.StartTime + } + return nil +} + +func (x *CollectUsageRequest) GetEndTime() *timestamppb.Timestamp { + if x != nil { + return x.EndTime + } + return nil +} + +type CollectUsageResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Sessions []*BilledSession `protobuf:"bytes,1,rep,name=sessions,proto3" json:"sessions,omitempty"` +} + +func (x *CollectUsageResponse) Reset() { + *x = CollectUsageResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_usage_v1_usage_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CollectUsageResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CollectUsageResponse) ProtoMessage() {} + +func (x *CollectUsageResponse) ProtoReflect() protoreflect.Message { + mi := &file_usage_v1_usage_proto_msgTypes[4] + 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 CollectUsageResponse.ProtoReflect.Descriptor instead. +func (*CollectUsageResponse) Descriptor() ([]byte, []int) { + return file_usage_v1_usage_proto_rawDescGZIP(), []int{4} +} + +func (x *CollectUsageResponse) GetSessions() []*BilledSession { + if x != nil { + return x.Sessions + } + return nil +} + var File_usage_v1_usage_proto protoreflect.FileDescriptor var file_usage_v1_usage_proto_rawDesc = []byte{ @@ -389,17 +491,36 @@ var file_usage_v1_usage_proto_rawDesc = []byte{ 0x74, 0x65, 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x18, 0x01, 0x52, 0x11, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 0x18, 0x0c, 0x20, 0x01, 0x28, - 0x01, 0x52, 0x07, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 0x32, 0x68, 0x0a, 0x0c, 0x55, 0x73, - 0x61, 0x67, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x58, 0x0a, 0x0f, 0x4c, 0x69, - 0x73, 0x74, 0x42, 0x69, 0x6c, 0x6c, 0x65, 0x64, 0x55, 0x73, 0x61, 0x67, 0x65, 0x12, 0x20, 0x2e, - 0x75, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x69, 0x6c, - 0x6c, 0x65, 0x64, 0x55, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x21, 0x2e, 0x75, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x42, - 0x69, 0x6c, 0x6c, 0x65, 0x64, 0x55, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x00, 0x42, 0x2a, 0x5a, 0x28, 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, 0x75, 0x73, 0x61, 0x67, 0x65, 0x2d, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x01, 0x52, 0x07, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 0x22, 0x87, 0x01, 0x0a, 0x13, 0x43, + 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x55, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x39, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, + 0x6d, 0x70, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x35, 0x0a, + 0x08, 0x65, 0x6e, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x07, 0x65, 0x6e, 0x64, + 0x54, 0x69, 0x6d, 0x65, 0x22, 0x4b, 0x0a, 0x14, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x55, + 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x33, 0x0a, 0x08, + 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, + 0x2e, 0x75, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x69, 0x6c, 0x6c, 0x65, 0x64, + 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x73, 0x32, 0xb9, 0x01, 0x0a, 0x0c, 0x55, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x12, 0x58, 0x0a, 0x0f, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x69, 0x6c, 0x6c, 0x65, 0x64, + 0x55, 0x73, 0x61, 0x67, 0x65, 0x12, 0x20, 0x2e, 0x75, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, + 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x69, 0x6c, 0x6c, 0x65, 0x64, 0x55, 0x73, 0x61, 0x67, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x75, 0x73, 0x61, 0x67, 0x65, 0x2e, + 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x69, 0x6c, 0x6c, 0x65, 0x64, 0x55, 0x73, 0x61, + 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4f, 0x0a, 0x0c, + 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x55, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1d, 0x2e, 0x75, + 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x55, + 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x75, 0x73, + 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x55, 0x73, + 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x2a, 0x5a, + 0x28, 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, 0x75, 0x73, 0x61, + 0x67, 0x65, 0x2d, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( @@ -415,28 +536,35 @@ func file_usage_v1_usage_proto_rawDescGZIP() []byte { } var file_usage_v1_usage_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_usage_v1_usage_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_usage_v1_usage_proto_msgTypes = make([]protoimpl.MessageInfo, 5) var file_usage_v1_usage_proto_goTypes = []interface{}{ (ListBilledUsageRequest_Ordering)(0), // 0: usage.v1.ListBilledUsageRequest.Ordering (*ListBilledUsageRequest)(nil), // 1: usage.v1.ListBilledUsageRequest (*ListBilledUsageResponse)(nil), // 2: usage.v1.ListBilledUsageResponse (*BilledSession)(nil), // 3: usage.v1.BilledSession - (*timestamppb.Timestamp)(nil), // 4: google.protobuf.Timestamp + (*CollectUsageRequest)(nil), // 4: usage.v1.CollectUsageRequest + (*CollectUsageResponse)(nil), // 5: usage.v1.CollectUsageResponse + (*timestamppb.Timestamp)(nil), // 6: google.protobuf.Timestamp } var file_usage_v1_usage_proto_depIdxs = []int32{ - 4, // 0: usage.v1.ListBilledUsageRequest.from:type_name -> google.protobuf.Timestamp - 4, // 1: usage.v1.ListBilledUsageRequest.to:type_name -> google.protobuf.Timestamp - 0, // 2: usage.v1.ListBilledUsageRequest.order:type_name -> usage.v1.ListBilledUsageRequest.Ordering - 3, // 3: usage.v1.ListBilledUsageResponse.sessions:type_name -> usage.v1.BilledSession - 4, // 4: usage.v1.BilledSession.start_time:type_name -> google.protobuf.Timestamp - 4, // 5: usage.v1.BilledSession.end_time:type_name -> google.protobuf.Timestamp - 1, // 6: usage.v1.UsageService.ListBilledUsage:input_type -> usage.v1.ListBilledUsageRequest - 2, // 7: usage.v1.UsageService.ListBilledUsage:output_type -> usage.v1.ListBilledUsageResponse - 7, // [7:8] is the sub-list for method output_type - 6, // [6:7] is the sub-list for method input_type - 6, // [6:6] is the sub-list for extension type_name - 6, // [6:6] is the sub-list for extension extendee - 0, // [0:6] is the sub-list for field type_name + 6, // 0: usage.v1.ListBilledUsageRequest.from:type_name -> google.protobuf.Timestamp + 6, // 1: usage.v1.ListBilledUsageRequest.to:type_name -> google.protobuf.Timestamp + 0, // 2: usage.v1.ListBilledUsageRequest.order:type_name -> usage.v1.ListBilledUsageRequest.Ordering + 3, // 3: usage.v1.ListBilledUsageResponse.sessions:type_name -> usage.v1.BilledSession + 6, // 4: usage.v1.BilledSession.start_time:type_name -> google.protobuf.Timestamp + 6, // 5: usage.v1.BilledSession.end_time:type_name -> google.protobuf.Timestamp + 6, // 6: usage.v1.CollectUsageRequest.start_time:type_name -> google.protobuf.Timestamp + 6, // 7: usage.v1.CollectUsageRequest.end_time:type_name -> google.protobuf.Timestamp + 3, // 8: usage.v1.CollectUsageResponse.sessions:type_name -> usage.v1.BilledSession + 1, // 9: usage.v1.UsageService.ListBilledUsage:input_type -> usage.v1.ListBilledUsageRequest + 4, // 10: usage.v1.UsageService.CollectUsage:input_type -> usage.v1.CollectUsageRequest + 2, // 11: usage.v1.UsageService.ListBilledUsage:output_type -> usage.v1.ListBilledUsageResponse + 5, // 12: usage.v1.UsageService.CollectUsage:output_type -> usage.v1.CollectUsageResponse + 11, // [11:13] is the sub-list for method output_type + 9, // [9:11] is the sub-list for method input_type + 9, // [9:9] is the sub-list for extension type_name + 9, // [9:9] is the sub-list for extension extendee + 0, // [0:9] is the sub-list for field type_name } func init() { file_usage_v1_usage_proto_init() } @@ -481,6 +609,30 @@ func file_usage_v1_usage_proto_init() { return nil } } + file_usage_v1_usage_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CollectUsageRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_usage_v1_usage_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CollectUsageResponse); 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{ @@ -488,7 +640,7 @@ func file_usage_v1_usage_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_usage_v1_usage_proto_rawDesc, NumEnums: 1, - NumMessages: 3, + NumMessages: 5, NumExtensions: 0, NumServices: 1, }, diff --git a/components/usage-api/go/v1/usage_grpc.pb.go b/components/usage-api/go/v1/usage_grpc.pb.go index 9c53069ac7d8ba..117214e2b089e5 100644 --- a/components/usage-api/go/v1/usage_grpc.pb.go +++ b/components/usage-api/go/v1/usage_grpc.pb.go @@ -28,6 +28,8 @@ const _ = grpc.SupportPackageIsVersion7 type UsageServiceClient interface { // ListBilledUsage retrieves all usage for the specified attributionId ListBilledUsage(ctx context.Context, in *ListBilledUsageRequest, opts ...grpc.CallOption) (*ListBilledUsageResponse, error) + // CollectUsage collects usage for the specified time period, and stores the usage records in the database, returning the records. + CollectUsage(ctx context.Context, in *CollectUsageRequest, opts ...grpc.CallOption) (*CollectUsageResponse, error) } type usageServiceClient struct { @@ -47,12 +49,23 @@ func (c *usageServiceClient) ListBilledUsage(ctx context.Context, in *ListBilled return out, nil } +func (c *usageServiceClient) CollectUsage(ctx context.Context, in *CollectUsageRequest, opts ...grpc.CallOption) (*CollectUsageResponse, error) { + out := new(CollectUsageResponse) + err := c.cc.Invoke(ctx, "/usage.v1.UsageService/CollectUsage", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // UsageServiceServer is the server API for UsageService service. // All implementations must embed UnimplementedUsageServiceServer // for forward compatibility type UsageServiceServer interface { // ListBilledUsage retrieves all usage for the specified attributionId ListBilledUsage(context.Context, *ListBilledUsageRequest) (*ListBilledUsageResponse, error) + // CollectUsage collects usage for the specified time period, and stores the usage records in the database, returning the records. + CollectUsage(context.Context, *CollectUsageRequest) (*CollectUsageResponse, error) mustEmbedUnimplementedUsageServiceServer() } @@ -63,6 +76,9 @@ type UnimplementedUsageServiceServer struct { func (UnimplementedUsageServiceServer) ListBilledUsage(context.Context, *ListBilledUsageRequest) (*ListBilledUsageResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ListBilledUsage not implemented") } +func (UnimplementedUsageServiceServer) CollectUsage(context.Context, *CollectUsageRequest) (*CollectUsageResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CollectUsage not implemented") +} func (UnimplementedUsageServiceServer) mustEmbedUnimplementedUsageServiceServer() {} // UnsafeUsageServiceServer may be embedded to opt out of forward compatibility for this service. @@ -94,6 +110,24 @@ func _UsageService_ListBilledUsage_Handler(srv interface{}, ctx context.Context, return interceptor(ctx, in, info, handler) } +func _UsageService_CollectUsage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CollectUsageRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UsageServiceServer).CollectUsage(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/usage.v1.UsageService/CollectUsage", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UsageServiceServer).CollectUsage(ctx, req.(*CollectUsageRequest)) + } + return interceptor(ctx, in, info, handler) +} + // UsageService_ServiceDesc is the grpc.ServiceDesc for UsageService 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 UsageService_ServiceDesc = grpc.ServiceDesc{ MethodName: "ListBilledUsage", Handler: _UsageService_ListBilledUsage_Handler, }, + { + MethodName: "CollectUsage", + Handler: _UsageService_CollectUsage_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "usage/v1/usage.proto", diff --git a/components/usage-api/typescript/src/usage/v1/usage_grpc_pb.d.ts b/components/usage-api/typescript/src/usage/v1/usage_grpc_pb.d.ts index 613d8320273d33..960d698dc40f6f 100644 --- a/components/usage-api/typescript/src/usage/v1/usage_grpc_pb.d.ts +++ b/components/usage-api/typescript/src/usage/v1/usage_grpc_pb.d.ts @@ -16,6 +16,7 @@ import * as google_protobuf_timestamp_pb from "google-protobuf/google/protobuf/t interface IUsageServiceService extends grpc.ServiceDefinition { listBilledUsage: IUsageServiceService_IListBilledUsage; + collectUsage: IUsageServiceService_ICollectUsage; } interface IUsageServiceService_IListBilledUsage extends grpc.MethodDefinition { @@ -27,17 +28,30 @@ interface IUsageServiceService_IListBilledUsage extends grpc.MethodDefinition; responseDeserialize: grpc.deserialize; } +interface IUsageServiceService_ICollectUsage extends grpc.MethodDefinition { + path: "/usage.v1.UsageService/CollectUsage"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} export const UsageServiceService: IUsageServiceService; export interface IUsageServiceServer extends grpc.UntypedServiceImplementation { listBilledUsage: grpc.handleUnaryCall; + collectUsage: grpc.handleUnaryCall; } export interface IUsageServiceClient { listBilledUsage(request: usage_v1_usage_pb.ListBilledUsageRequest, callback: (error: grpc.ServiceError | null, response: usage_v1_usage_pb.ListBilledUsageResponse) => void): grpc.ClientUnaryCall; listBilledUsage(request: usage_v1_usage_pb.ListBilledUsageRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: usage_v1_usage_pb.ListBilledUsageResponse) => void): grpc.ClientUnaryCall; listBilledUsage(request: usage_v1_usage_pb.ListBilledUsageRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: usage_v1_usage_pb.ListBilledUsageResponse) => void): grpc.ClientUnaryCall; + collectUsage(request: usage_v1_usage_pb.CollectUsageRequest, callback: (error: grpc.ServiceError | null, response: usage_v1_usage_pb.CollectUsageResponse) => void): grpc.ClientUnaryCall; + collectUsage(request: usage_v1_usage_pb.CollectUsageRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: usage_v1_usage_pb.CollectUsageResponse) => void): grpc.ClientUnaryCall; + collectUsage(request: usage_v1_usage_pb.CollectUsageRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: usage_v1_usage_pb.CollectUsageResponse) => void): grpc.ClientUnaryCall; } export class UsageServiceClient extends grpc.Client implements IUsageServiceClient { @@ -45,4 +59,7 @@ export class UsageServiceClient extends grpc.Client implements IUsageServiceClie public listBilledUsage(request: usage_v1_usage_pb.ListBilledUsageRequest, callback: (error: grpc.ServiceError | null, response: usage_v1_usage_pb.ListBilledUsageResponse) => void): grpc.ClientUnaryCall; public listBilledUsage(request: usage_v1_usage_pb.ListBilledUsageRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: usage_v1_usage_pb.ListBilledUsageResponse) => void): grpc.ClientUnaryCall; public listBilledUsage(request: usage_v1_usage_pb.ListBilledUsageRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: usage_v1_usage_pb.ListBilledUsageResponse) => void): grpc.ClientUnaryCall; + public collectUsage(request: usage_v1_usage_pb.CollectUsageRequest, callback: (error: grpc.ServiceError | null, response: usage_v1_usage_pb.CollectUsageResponse) => void): grpc.ClientUnaryCall; + public collectUsage(request: usage_v1_usage_pb.CollectUsageRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: usage_v1_usage_pb.CollectUsageResponse) => void): grpc.ClientUnaryCall; + public collectUsage(request: usage_v1_usage_pb.CollectUsageRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: usage_v1_usage_pb.CollectUsageResponse) => void): grpc.ClientUnaryCall; } diff --git a/components/usage-api/typescript/src/usage/v1/usage_grpc_pb.js b/components/usage-api/typescript/src/usage/v1/usage_grpc_pb.js index f72af7f5c45034..9baea90f8d934c 100644 --- a/components/usage-api/typescript/src/usage/v1/usage_grpc_pb.js +++ b/components/usage-api/typescript/src/usage/v1/usage_grpc_pb.js @@ -11,6 +11,28 @@ var grpc = require('@grpc/grpc-js'); var usage_v1_usage_pb = require('../../usage/v1/usage_pb.js'); var google_protobuf_timestamp_pb = require('google-protobuf/google/protobuf/timestamp_pb.js'); +function serialize_usage_v1_CollectUsageRequest(arg) { + if (!(arg instanceof usage_v1_usage_pb.CollectUsageRequest)) { + throw new Error('Expected argument of type usage.v1.CollectUsageRequest'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_usage_v1_CollectUsageRequest(buffer_arg) { + return usage_v1_usage_pb.CollectUsageRequest.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_usage_v1_CollectUsageResponse(arg) { + if (!(arg instanceof usage_v1_usage_pb.CollectUsageResponse)) { + throw new Error('Expected argument of type usage.v1.CollectUsageResponse'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_usage_v1_CollectUsageResponse(buffer_arg) { + return usage_v1_usage_pb.CollectUsageResponse.deserializeBinary(new Uint8Array(buffer_arg)); +} + function serialize_usage_v1_ListBilledUsageRequest(arg) { if (!(arg instanceof usage_v1_usage_pb.ListBilledUsageRequest)) { throw new Error('Expected argument of type usage.v1.ListBilledUsageRequest'); @@ -47,6 +69,18 @@ listBilledUsage: { responseSerialize: serialize_usage_v1_ListBilledUsageResponse, responseDeserialize: deserialize_usage_v1_ListBilledUsageResponse, }, + // CollectUsage collects usage for the specified time period, and stores the usage records in the database, returning the records. +collectUsage: { + path: '/usage.v1.UsageService/CollectUsage', + requestStream: false, + responseStream: false, + requestType: usage_v1_usage_pb.CollectUsageRequest, + responseType: usage_v1_usage_pb.CollectUsageResponse, + requestSerialize: serialize_usage_v1_CollectUsageRequest, + requestDeserialize: deserialize_usage_v1_CollectUsageRequest, + responseSerialize: serialize_usage_v1_CollectUsageResponse, + responseDeserialize: deserialize_usage_v1_CollectUsageResponse, + }, }; exports.UsageServiceClient = grpc.makeGenericClientConstructor(UsageServiceService); diff --git a/components/usage-api/typescript/src/usage/v1/usage_pb.d.ts b/components/usage-api/typescript/src/usage/v1/usage_pb.d.ts index 0ac3dc0481daa0..78194777667441 100644 --- a/components/usage-api/typescript/src/usage/v1/usage_pb.d.ts +++ b/components/usage-api/typescript/src/usage/v1/usage_pb.d.ts @@ -134,3 +134,54 @@ export namespace BilledSession { credits: number, } } + +export class CollectUsageRequest extends jspb.Message { + + hasStartTime(): boolean; + clearStartTime(): void; + getStartTime(): google_protobuf_timestamp_pb.Timestamp | undefined; + setStartTime(value?: google_protobuf_timestamp_pb.Timestamp): CollectUsageRequest; + + hasEndTime(): boolean; + clearEndTime(): void; + getEndTime(): google_protobuf_timestamp_pb.Timestamp | undefined; + setEndTime(value?: google_protobuf_timestamp_pb.Timestamp): CollectUsageRequest; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): CollectUsageRequest.AsObject; + static toObject(includeInstance: boolean, msg: CollectUsageRequest): CollectUsageRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: CollectUsageRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): CollectUsageRequest; + static deserializeBinaryFromReader(message: CollectUsageRequest, reader: jspb.BinaryReader): CollectUsageRequest; +} + +export namespace CollectUsageRequest { + export type AsObject = { + startTime?: google_protobuf_timestamp_pb.Timestamp.AsObject, + endTime?: google_protobuf_timestamp_pb.Timestamp.AsObject, + } +} + +export class CollectUsageResponse extends jspb.Message { + clearSessionsList(): void; + getSessionsList(): Array; + setSessionsList(value: Array): CollectUsageResponse; + addSessions(value?: BilledSession, index?: number): BilledSession; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): CollectUsageResponse.AsObject; + static toObject(includeInstance: boolean, msg: CollectUsageResponse): CollectUsageResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: CollectUsageResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): CollectUsageResponse; + static deserializeBinaryFromReader(message: CollectUsageResponse, reader: jspb.BinaryReader): CollectUsageResponse; +} + +export namespace CollectUsageResponse { + export type AsObject = { + sessionsList: Array, + } +} diff --git a/components/usage-api/typescript/src/usage/v1/usage_pb.js b/components/usage-api/typescript/src/usage/v1/usage_pb.js index 950754161617fb..2d00c370889898 100644 --- a/components/usage-api/typescript/src/usage/v1/usage_pb.js +++ b/components/usage-api/typescript/src/usage/v1/usage_pb.js @@ -24,6 +24,8 @@ var global = (function() { return this || window || global || self || Function(' var google_protobuf_timestamp_pb = require('google-protobuf/google/protobuf/timestamp_pb.js'); goog.object.extend(proto, google_protobuf_timestamp_pb); goog.exportSymbol('proto.usage.v1.BilledSession', null, global); +goog.exportSymbol('proto.usage.v1.CollectUsageRequest', null, global); +goog.exportSymbol('proto.usage.v1.CollectUsageResponse', null, global); goog.exportSymbol('proto.usage.v1.ListBilledUsageRequest', null, global); goog.exportSymbol('proto.usage.v1.ListBilledUsageRequest.Ordering', null, global); goog.exportSymbol('proto.usage.v1.ListBilledUsageResponse', null, global); @@ -90,6 +92,48 @@ if (goog.DEBUG && !COMPILED) { */ proto.usage.v1.BilledSession.displayName = 'proto.usage.v1.BilledSession'; } +/** + * 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.usage.v1.CollectUsageRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.usage.v1.CollectUsageRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.usage.v1.CollectUsageRequest.displayName = 'proto.usage.v1.CollectUsageRequest'; +} +/** + * 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.usage.v1.CollectUsageResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.usage.v1.CollectUsageResponse.repeatedFields_, null); +}; +goog.inherits(proto.usage.v1.CollectUsageResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.usage.v1.CollectUsageResponse.displayName = 'proto.usage.v1.CollectUsageResponse'; +} @@ -1022,4 +1066,366 @@ proto.usage.v1.BilledSession.prototype.setCredits = function(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.usage.v1.CollectUsageRequest.prototype.toObject = function(opt_includeInstance) { + return proto.usage.v1.CollectUsageRequest.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.usage.v1.CollectUsageRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.usage.v1.CollectUsageRequest.toObject = function(includeInstance, msg) { + var f, obj = { + startTime: (f = msg.getStartTime()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f), + endTime: (f = msg.getEndTime()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.usage.v1.CollectUsageRequest} + */ +proto.usage.v1.CollectUsageRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.usage.v1.CollectUsageRequest; + return proto.usage.v1.CollectUsageRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.usage.v1.CollectUsageRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.usage.v1.CollectUsageRequest} + */ +proto.usage.v1.CollectUsageRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new google_protobuf_timestamp_pb.Timestamp; + reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader); + msg.setStartTime(value); + break; + case 2: + var value = new google_protobuf_timestamp_pb.Timestamp; + reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader); + msg.setEndTime(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.usage.v1.CollectUsageRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.usage.v1.CollectUsageRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.usage.v1.CollectUsageRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.usage.v1.CollectUsageRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getStartTime(); + if (f != null) { + writer.writeMessage( + 1, + f, + google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter + ); + } + f = message.getEndTime(); + if (f != null) { + writer.writeMessage( + 2, + f, + google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter + ); + } +}; + + +/** + * optional google.protobuf.Timestamp start_time = 1; + * @return {?proto.google.protobuf.Timestamp} + */ +proto.usage.v1.CollectUsageRequest.prototype.getStartTime = function() { + return /** @type{?proto.google.protobuf.Timestamp} */ ( + jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 1)); +}; + + +/** + * @param {?proto.google.protobuf.Timestamp|undefined} value + * @return {!proto.usage.v1.CollectUsageRequest} returns this +*/ +proto.usage.v1.CollectUsageRequest.prototype.setStartTime = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.usage.v1.CollectUsageRequest} returns this + */ +proto.usage.v1.CollectUsageRequest.prototype.clearStartTime = function() { + return this.setStartTime(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.usage.v1.CollectUsageRequest.prototype.hasStartTime = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional google.protobuf.Timestamp end_time = 2; + * @return {?proto.google.protobuf.Timestamp} + */ +proto.usage.v1.CollectUsageRequest.prototype.getEndTime = function() { + return /** @type{?proto.google.protobuf.Timestamp} */ ( + jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 2)); +}; + + +/** + * @param {?proto.google.protobuf.Timestamp|undefined} value + * @return {!proto.usage.v1.CollectUsageRequest} returns this +*/ +proto.usage.v1.CollectUsageRequest.prototype.setEndTime = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.usage.v1.CollectUsageRequest} returns this + */ +proto.usage.v1.CollectUsageRequest.prototype.clearEndTime = function() { + return this.setEndTime(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.usage.v1.CollectUsageRequest.prototype.hasEndTime = function() { + return jspb.Message.getField(this, 2) != null; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.usage.v1.CollectUsageResponse.repeatedFields_ = [1]; + + + +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.usage.v1.CollectUsageResponse.prototype.toObject = function(opt_includeInstance) { + return proto.usage.v1.CollectUsageResponse.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.usage.v1.CollectUsageResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.usage.v1.CollectUsageResponse.toObject = function(includeInstance, msg) { + var f, obj = { + sessionsList: jspb.Message.toObjectList(msg.getSessionsList(), + proto.usage.v1.BilledSession.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.usage.v1.CollectUsageResponse} + */ +proto.usage.v1.CollectUsageResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.usage.v1.CollectUsageResponse; + return proto.usage.v1.CollectUsageResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.usage.v1.CollectUsageResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.usage.v1.CollectUsageResponse} + */ +proto.usage.v1.CollectUsageResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.usage.v1.BilledSession; + reader.readMessage(value,proto.usage.v1.BilledSession.deserializeBinaryFromReader); + msg.addSessions(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.usage.v1.CollectUsageResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.usage.v1.CollectUsageResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.usage.v1.CollectUsageResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.usage.v1.CollectUsageResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getSessionsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 1, + f, + proto.usage.v1.BilledSession.serializeBinaryToWriter + ); + } +}; + + +/** + * repeated BilledSession sessions = 1; + * @return {!Array} + */ +proto.usage.v1.CollectUsageResponse.prototype.getSessionsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.usage.v1.BilledSession, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.usage.v1.CollectUsageResponse} returns this +*/ +proto.usage.v1.CollectUsageResponse.prototype.setSessionsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.usage.v1.BilledSession=} opt_value + * @param {number=} opt_index + * @return {!proto.usage.v1.BilledSession} + */ +proto.usage.v1.CollectUsageResponse.prototype.addSessions = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.usage.v1.BilledSession, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.usage.v1.CollectUsageResponse} returns this + */ +proto.usage.v1.CollectUsageResponse.prototype.clearSessionsList = function() { + return this.setSessionsList([]); +}; + + goog.object.extend(exports, proto.usage.v1); diff --git a/components/usage-api/usage/v1/usage.proto b/components/usage-api/usage/v1/usage.proto index 59a5c08241b48a..fbb16709e87762 100644 --- a/components/usage-api/usage/v1/usage.proto +++ b/components/usage-api/usage/v1/usage.proto @@ -9,6 +9,9 @@ import "google/protobuf/timestamp.proto"; service UsageService { // ListBilledUsage retrieves all usage for the specified attributionId rpc ListBilledUsage(ListBilledUsageRequest) returns (ListBilledUsageResponse) {} + + // CollectUsage collects usage for the specified time period, and stores the usage records in the database, returning the records. + rpc CollectUsage(CollectUsageRequest) returns (CollectUsageResponse) {} } message ListBilledUsageRequest { @@ -52,3 +55,12 @@ message BilledSession { int64 credits_deprecated = 11 [deprecated=true]; // insufficient precision to represent credits for workspace time double credits = 12; } + +message CollectUsageRequest { + google.protobuf.Timestamp start_time = 1; + google.protobuf.Timestamp end_time = 2; +} + +message CollectUsageResponse { + repeated BilledSession sessions = 1; +} From 71191636830faafa78b802c6706db738259b8c47 Mon Sep 17 00:00:00 2001 From: Milan Pavlik Date: Wed, 27 Jul 2022 09:23:37 +0000 Subject: [PATCH 2/2] [usage] Rename CollectUsage to ReconcileUsage --- components/usage-api/go/v1/usage.pb.go | 116 +++++++++--------- components/usage-api/go/v1/usage_grpc.pb.go | 32 ++--- .../src/usage/v1/usage_grpc_pb.d.ts | 28 ++--- .../typescript/src/usage/v1/usage_grpc_pb.js | 58 ++++----- .../typescript/src/usage/v1/usage_pb.d.ts | 34 ++--- .../typescript/src/usage/v1/usage_pb.js | 116 +++++++++--------- components/usage-api/usage/v1/usage.proto | 8 +- 7 files changed, 196 insertions(+), 196 deletions(-) diff --git a/components/usage-api/go/v1/usage.pb.go b/components/usage-api/go/v1/usage.pb.go index 5f064d9e2206be..42132de8d1ccd7 100644 --- a/components/usage-api/go/v1/usage.pb.go +++ b/components/usage-api/go/v1/usage.pb.go @@ -330,7 +330,7 @@ func (x *BilledSession) GetCredits() float64 { return 0 } -type CollectUsageRequest struct { +type ReconcileUsageRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -339,8 +339,8 @@ type CollectUsageRequest struct { EndTime *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty"` } -func (x *CollectUsageRequest) Reset() { - *x = CollectUsageRequest{} +func (x *ReconcileUsageRequest) Reset() { + *x = ReconcileUsageRequest{} if protoimpl.UnsafeEnabled { mi := &file_usage_v1_usage_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -348,13 +348,13 @@ func (x *CollectUsageRequest) Reset() { } } -func (x *CollectUsageRequest) String() string { +func (x *ReconcileUsageRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*CollectUsageRequest) ProtoMessage() {} +func (*ReconcileUsageRequest) ProtoMessage() {} -func (x *CollectUsageRequest) ProtoReflect() protoreflect.Message { +func (x *ReconcileUsageRequest) ProtoReflect() protoreflect.Message { mi := &file_usage_v1_usage_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -366,26 +366,26 @@ func (x *CollectUsageRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use CollectUsageRequest.ProtoReflect.Descriptor instead. -func (*CollectUsageRequest) Descriptor() ([]byte, []int) { +// Deprecated: Use ReconcileUsageRequest.ProtoReflect.Descriptor instead. +func (*ReconcileUsageRequest) Descriptor() ([]byte, []int) { return file_usage_v1_usage_proto_rawDescGZIP(), []int{3} } -func (x *CollectUsageRequest) GetStartTime() *timestamppb.Timestamp { +func (x *ReconcileUsageRequest) GetStartTime() *timestamppb.Timestamp { if x != nil { return x.StartTime } return nil } -func (x *CollectUsageRequest) GetEndTime() *timestamppb.Timestamp { +func (x *ReconcileUsageRequest) GetEndTime() *timestamppb.Timestamp { if x != nil { return x.EndTime } return nil } -type CollectUsageResponse struct { +type ReconcileUsageResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -393,8 +393,8 @@ type CollectUsageResponse struct { Sessions []*BilledSession `protobuf:"bytes,1,rep,name=sessions,proto3" json:"sessions,omitempty"` } -func (x *CollectUsageResponse) Reset() { - *x = CollectUsageResponse{} +func (x *ReconcileUsageResponse) Reset() { + *x = ReconcileUsageResponse{} if protoimpl.UnsafeEnabled { mi := &file_usage_v1_usage_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -402,13 +402,13 @@ func (x *CollectUsageResponse) Reset() { } } -func (x *CollectUsageResponse) String() string { +func (x *ReconcileUsageResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*CollectUsageResponse) ProtoMessage() {} +func (*ReconcileUsageResponse) ProtoMessage() {} -func (x *CollectUsageResponse) ProtoReflect() protoreflect.Message { +func (x *ReconcileUsageResponse) ProtoReflect() protoreflect.Message { mi := &file_usage_v1_usage_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -420,12 +420,12 @@ func (x *CollectUsageResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use CollectUsageResponse.ProtoReflect.Descriptor instead. -func (*CollectUsageResponse) Descriptor() ([]byte, []int) { +// Deprecated: Use ReconcileUsageResponse.ProtoReflect.Descriptor instead. +func (*ReconcileUsageResponse) Descriptor() ([]byte, []int) { return file_usage_v1_usage_proto_rawDescGZIP(), []int{4} } -func (x *CollectUsageResponse) GetSessions() []*BilledSession { +func (x *ReconcileUsageResponse) GetSessions() []*BilledSession { if x != nil { return x.Sessions } @@ -491,36 +491,36 @@ var file_usage_v1_usage_proto_rawDesc = []byte{ 0x74, 0x65, 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x18, 0x01, 0x52, 0x11, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 0x18, 0x0c, 0x20, 0x01, 0x28, - 0x01, 0x52, 0x07, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 0x22, 0x87, 0x01, 0x0a, 0x13, 0x43, - 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x55, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x39, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, - 0x6d, 0x70, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x35, 0x0a, - 0x08, 0x65, 0x6e, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x07, 0x65, 0x6e, 0x64, - 0x54, 0x69, 0x6d, 0x65, 0x22, 0x4b, 0x0a, 0x14, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x55, - 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x33, 0x0a, 0x08, - 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, - 0x2e, 0x75, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x69, 0x6c, 0x6c, 0x65, 0x64, - 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, - 0x73, 0x32, 0xb9, 0x01, 0x0a, 0x0c, 0x55, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x12, 0x58, 0x0a, 0x0f, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x69, 0x6c, 0x6c, 0x65, 0x64, - 0x55, 0x73, 0x61, 0x67, 0x65, 0x12, 0x20, 0x2e, 0x75, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, - 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x69, 0x6c, 0x6c, 0x65, 0x64, 0x55, 0x73, 0x61, 0x67, 0x65, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x75, 0x73, 0x61, 0x67, 0x65, 0x2e, - 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x69, 0x6c, 0x6c, 0x65, 0x64, 0x55, 0x73, 0x61, - 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4f, 0x0a, 0x0c, - 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x55, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1d, 0x2e, 0x75, - 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x55, - 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x75, 0x73, - 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x55, 0x73, - 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x2a, 0x5a, - 0x28, 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, 0x75, 0x73, 0x61, - 0x67, 0x65, 0x2d, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x01, 0x52, 0x07, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 0x22, 0x89, 0x01, 0x0a, 0x15, 0x52, + 0x65, 0x63, 0x6f, 0x6e, 0x63, 0x69, 0x6c, 0x65, 0x55, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x39, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, + 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, + 0x35, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x07, 0x65, + 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x4d, 0x0a, 0x16, 0x52, 0x65, 0x63, 0x6f, 0x6e, 0x63, + 0x69, 0x6c, 0x65, 0x55, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x33, 0x0a, 0x08, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x75, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x69, + 0x6c, 0x6c, 0x65, 0x64, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x32, 0xbf, 0x01, 0x0a, 0x0c, 0x55, 0x73, 0x61, 0x67, 0x65, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x58, 0x0a, 0x0f, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x69, + 0x6c, 0x6c, 0x65, 0x64, 0x55, 0x73, 0x61, 0x67, 0x65, 0x12, 0x20, 0x2e, 0x75, 0x73, 0x61, 0x67, + 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x69, 0x6c, 0x6c, 0x65, 0x64, 0x55, + 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x75, 0x73, + 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x69, 0x6c, 0x6c, 0x65, + 0x64, 0x55, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, + 0x12, 0x55, 0x0a, 0x0e, 0x52, 0x65, 0x63, 0x6f, 0x6e, 0x63, 0x69, 0x6c, 0x65, 0x55, 0x73, 0x61, + 0x67, 0x65, 0x12, 0x1f, 0x2e, 0x75, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, + 0x63, 0x6f, 0x6e, 0x63, 0x69, 0x6c, 0x65, 0x55, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x75, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, + 0x65, 0x63, 0x6f, 0x6e, 0x63, 0x69, 0x6c, 0x65, 0x55, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x2a, 0x5a, 0x28, 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, 0x75, 0x73, 0x61, 0x67, 0x65, 0x2d, 0x61, 0x70, 0x69, + 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -542,8 +542,8 @@ var file_usage_v1_usage_proto_goTypes = []interface{}{ (*ListBilledUsageRequest)(nil), // 1: usage.v1.ListBilledUsageRequest (*ListBilledUsageResponse)(nil), // 2: usage.v1.ListBilledUsageResponse (*BilledSession)(nil), // 3: usage.v1.BilledSession - (*CollectUsageRequest)(nil), // 4: usage.v1.CollectUsageRequest - (*CollectUsageResponse)(nil), // 5: usage.v1.CollectUsageResponse + (*ReconcileUsageRequest)(nil), // 4: usage.v1.ReconcileUsageRequest + (*ReconcileUsageResponse)(nil), // 5: usage.v1.ReconcileUsageResponse (*timestamppb.Timestamp)(nil), // 6: google.protobuf.Timestamp } var file_usage_v1_usage_proto_depIdxs = []int32{ @@ -553,13 +553,13 @@ var file_usage_v1_usage_proto_depIdxs = []int32{ 3, // 3: usage.v1.ListBilledUsageResponse.sessions:type_name -> usage.v1.BilledSession 6, // 4: usage.v1.BilledSession.start_time:type_name -> google.protobuf.Timestamp 6, // 5: usage.v1.BilledSession.end_time:type_name -> google.protobuf.Timestamp - 6, // 6: usage.v1.CollectUsageRequest.start_time:type_name -> google.protobuf.Timestamp - 6, // 7: usage.v1.CollectUsageRequest.end_time:type_name -> google.protobuf.Timestamp - 3, // 8: usage.v1.CollectUsageResponse.sessions:type_name -> usage.v1.BilledSession + 6, // 6: usage.v1.ReconcileUsageRequest.start_time:type_name -> google.protobuf.Timestamp + 6, // 7: usage.v1.ReconcileUsageRequest.end_time:type_name -> google.protobuf.Timestamp + 3, // 8: usage.v1.ReconcileUsageResponse.sessions:type_name -> usage.v1.BilledSession 1, // 9: usage.v1.UsageService.ListBilledUsage:input_type -> usage.v1.ListBilledUsageRequest - 4, // 10: usage.v1.UsageService.CollectUsage:input_type -> usage.v1.CollectUsageRequest + 4, // 10: usage.v1.UsageService.ReconcileUsage:input_type -> usage.v1.ReconcileUsageRequest 2, // 11: usage.v1.UsageService.ListBilledUsage:output_type -> usage.v1.ListBilledUsageResponse - 5, // 12: usage.v1.UsageService.CollectUsage:output_type -> usage.v1.CollectUsageResponse + 5, // 12: usage.v1.UsageService.ReconcileUsage:output_type -> usage.v1.ReconcileUsageResponse 11, // [11:13] is the sub-list for method output_type 9, // [9:11] is the sub-list for method input_type 9, // [9:9] is the sub-list for extension type_name @@ -610,7 +610,7 @@ func file_usage_v1_usage_proto_init() { } } file_usage_v1_usage_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CollectUsageRequest); i { + switch v := v.(*ReconcileUsageRequest); i { case 0: return &v.state case 1: @@ -622,7 +622,7 @@ func file_usage_v1_usage_proto_init() { } } file_usage_v1_usage_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CollectUsageResponse); i { + switch v := v.(*ReconcileUsageResponse); i { case 0: return &v.state case 1: diff --git a/components/usage-api/go/v1/usage_grpc.pb.go b/components/usage-api/go/v1/usage_grpc.pb.go index 117214e2b089e5..f780b9c31d18e6 100644 --- a/components/usage-api/go/v1/usage_grpc.pb.go +++ b/components/usage-api/go/v1/usage_grpc.pb.go @@ -28,8 +28,8 @@ const _ = grpc.SupportPackageIsVersion7 type UsageServiceClient interface { // ListBilledUsage retrieves all usage for the specified attributionId ListBilledUsage(ctx context.Context, in *ListBilledUsageRequest, opts ...grpc.CallOption) (*ListBilledUsageResponse, error) - // CollectUsage collects usage for the specified time period, and stores the usage records in the database, returning the records. - CollectUsage(ctx context.Context, in *CollectUsageRequest, opts ...grpc.CallOption) (*CollectUsageResponse, error) + // ReconcileUsage collects usage for the specified time period, and stores the usage records in the database, returning the records. + ReconcileUsage(ctx context.Context, in *ReconcileUsageRequest, opts ...grpc.CallOption) (*ReconcileUsageResponse, error) } type usageServiceClient struct { @@ -49,9 +49,9 @@ func (c *usageServiceClient) ListBilledUsage(ctx context.Context, in *ListBilled return out, nil } -func (c *usageServiceClient) CollectUsage(ctx context.Context, in *CollectUsageRequest, opts ...grpc.CallOption) (*CollectUsageResponse, error) { - out := new(CollectUsageResponse) - err := c.cc.Invoke(ctx, "/usage.v1.UsageService/CollectUsage", in, out, opts...) +func (c *usageServiceClient) ReconcileUsage(ctx context.Context, in *ReconcileUsageRequest, opts ...grpc.CallOption) (*ReconcileUsageResponse, error) { + out := new(ReconcileUsageResponse) + err := c.cc.Invoke(ctx, "/usage.v1.UsageService/ReconcileUsage", in, out, opts...) if err != nil { return nil, err } @@ -64,8 +64,8 @@ func (c *usageServiceClient) CollectUsage(ctx context.Context, in *CollectUsageR type UsageServiceServer interface { // ListBilledUsage retrieves all usage for the specified attributionId ListBilledUsage(context.Context, *ListBilledUsageRequest) (*ListBilledUsageResponse, error) - // CollectUsage collects usage for the specified time period, and stores the usage records in the database, returning the records. - CollectUsage(context.Context, *CollectUsageRequest) (*CollectUsageResponse, error) + // ReconcileUsage collects usage for the specified time period, and stores the usage records in the database, returning the records. + ReconcileUsage(context.Context, *ReconcileUsageRequest) (*ReconcileUsageResponse, error) mustEmbedUnimplementedUsageServiceServer() } @@ -76,8 +76,8 @@ type UnimplementedUsageServiceServer struct { func (UnimplementedUsageServiceServer) ListBilledUsage(context.Context, *ListBilledUsageRequest) (*ListBilledUsageResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ListBilledUsage not implemented") } -func (UnimplementedUsageServiceServer) CollectUsage(context.Context, *CollectUsageRequest) (*CollectUsageResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CollectUsage not implemented") +func (UnimplementedUsageServiceServer) ReconcileUsage(context.Context, *ReconcileUsageRequest) (*ReconcileUsageResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ReconcileUsage not implemented") } func (UnimplementedUsageServiceServer) mustEmbedUnimplementedUsageServiceServer() {} @@ -110,20 +110,20 @@ func _UsageService_ListBilledUsage_Handler(srv interface{}, ctx context.Context, return interceptor(ctx, in, info, handler) } -func _UsageService_CollectUsage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CollectUsageRequest) +func _UsageService_ReconcileUsage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ReconcileUsageRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(UsageServiceServer).CollectUsage(ctx, in) + return srv.(UsageServiceServer).ReconcileUsage(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/usage.v1.UsageService/CollectUsage", + FullMethod: "/usage.v1.UsageService/ReconcileUsage", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(UsageServiceServer).CollectUsage(ctx, req.(*CollectUsageRequest)) + return srv.(UsageServiceServer).ReconcileUsage(ctx, req.(*ReconcileUsageRequest)) } return interceptor(ctx, in, info, handler) } @@ -140,8 +140,8 @@ var UsageService_ServiceDesc = grpc.ServiceDesc{ Handler: _UsageService_ListBilledUsage_Handler, }, { - MethodName: "CollectUsage", - Handler: _UsageService_CollectUsage_Handler, + MethodName: "ReconcileUsage", + Handler: _UsageService_ReconcileUsage_Handler, }, }, Streams: []grpc.StreamDesc{}, diff --git a/components/usage-api/typescript/src/usage/v1/usage_grpc_pb.d.ts b/components/usage-api/typescript/src/usage/v1/usage_grpc_pb.d.ts index 960d698dc40f6f..cdcd756a50bc52 100644 --- a/components/usage-api/typescript/src/usage/v1/usage_grpc_pb.d.ts +++ b/components/usage-api/typescript/src/usage/v1/usage_grpc_pb.d.ts @@ -16,7 +16,7 @@ import * as google_protobuf_timestamp_pb from "google-protobuf/google/protobuf/t interface IUsageServiceService extends grpc.ServiceDefinition { listBilledUsage: IUsageServiceService_IListBilledUsage; - collectUsage: IUsageServiceService_ICollectUsage; + reconcileUsage: IUsageServiceService_IReconcileUsage; } interface IUsageServiceService_IListBilledUsage extends grpc.MethodDefinition { @@ -28,30 +28,30 @@ interface IUsageServiceService_IListBilledUsage extends grpc.MethodDefinition; responseDeserialize: grpc.deserialize; } -interface IUsageServiceService_ICollectUsage extends grpc.MethodDefinition { - path: "/usage.v1.UsageService/CollectUsage"; +interface IUsageServiceService_IReconcileUsage extends grpc.MethodDefinition { + path: "/usage.v1.UsageService/ReconcileUsage"; requestStream: false; responseStream: false; - requestSerialize: grpc.serialize; - requestDeserialize: grpc.deserialize; - responseSerialize: grpc.serialize; - responseDeserialize: grpc.deserialize; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; } export const UsageServiceService: IUsageServiceService; export interface IUsageServiceServer extends grpc.UntypedServiceImplementation { listBilledUsage: grpc.handleUnaryCall; - collectUsage: grpc.handleUnaryCall; + reconcileUsage: grpc.handleUnaryCall; } export interface IUsageServiceClient { listBilledUsage(request: usage_v1_usage_pb.ListBilledUsageRequest, callback: (error: grpc.ServiceError | null, response: usage_v1_usage_pb.ListBilledUsageResponse) => void): grpc.ClientUnaryCall; listBilledUsage(request: usage_v1_usage_pb.ListBilledUsageRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: usage_v1_usage_pb.ListBilledUsageResponse) => void): grpc.ClientUnaryCall; listBilledUsage(request: usage_v1_usage_pb.ListBilledUsageRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: usage_v1_usage_pb.ListBilledUsageResponse) => void): grpc.ClientUnaryCall; - collectUsage(request: usage_v1_usage_pb.CollectUsageRequest, callback: (error: grpc.ServiceError | null, response: usage_v1_usage_pb.CollectUsageResponse) => void): grpc.ClientUnaryCall; - collectUsage(request: usage_v1_usage_pb.CollectUsageRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: usage_v1_usage_pb.CollectUsageResponse) => void): grpc.ClientUnaryCall; - collectUsage(request: usage_v1_usage_pb.CollectUsageRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: usage_v1_usage_pb.CollectUsageResponse) => void): grpc.ClientUnaryCall; + reconcileUsage(request: usage_v1_usage_pb.ReconcileUsageRequest, callback: (error: grpc.ServiceError | null, response: usage_v1_usage_pb.ReconcileUsageResponse) => void): grpc.ClientUnaryCall; + reconcileUsage(request: usage_v1_usage_pb.ReconcileUsageRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: usage_v1_usage_pb.ReconcileUsageResponse) => void): grpc.ClientUnaryCall; + reconcileUsage(request: usage_v1_usage_pb.ReconcileUsageRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: usage_v1_usage_pb.ReconcileUsageResponse) => void): grpc.ClientUnaryCall; } export class UsageServiceClient extends grpc.Client implements IUsageServiceClient { @@ -59,7 +59,7 @@ export class UsageServiceClient extends grpc.Client implements IUsageServiceClie public listBilledUsage(request: usage_v1_usage_pb.ListBilledUsageRequest, callback: (error: grpc.ServiceError | null, response: usage_v1_usage_pb.ListBilledUsageResponse) => void): grpc.ClientUnaryCall; public listBilledUsage(request: usage_v1_usage_pb.ListBilledUsageRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: usage_v1_usage_pb.ListBilledUsageResponse) => void): grpc.ClientUnaryCall; public listBilledUsage(request: usage_v1_usage_pb.ListBilledUsageRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: usage_v1_usage_pb.ListBilledUsageResponse) => void): grpc.ClientUnaryCall; - public collectUsage(request: usage_v1_usage_pb.CollectUsageRequest, callback: (error: grpc.ServiceError | null, response: usage_v1_usage_pb.CollectUsageResponse) => void): grpc.ClientUnaryCall; - public collectUsage(request: usage_v1_usage_pb.CollectUsageRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: usage_v1_usage_pb.CollectUsageResponse) => void): grpc.ClientUnaryCall; - public collectUsage(request: usage_v1_usage_pb.CollectUsageRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: usage_v1_usage_pb.CollectUsageResponse) => void): grpc.ClientUnaryCall; + public reconcileUsage(request: usage_v1_usage_pb.ReconcileUsageRequest, callback: (error: grpc.ServiceError | null, response: usage_v1_usage_pb.ReconcileUsageResponse) => void): grpc.ClientUnaryCall; + public reconcileUsage(request: usage_v1_usage_pb.ReconcileUsageRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: usage_v1_usage_pb.ReconcileUsageResponse) => void): grpc.ClientUnaryCall; + public reconcileUsage(request: usage_v1_usage_pb.ReconcileUsageRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: usage_v1_usage_pb.ReconcileUsageResponse) => void): grpc.ClientUnaryCall; } diff --git a/components/usage-api/typescript/src/usage/v1/usage_grpc_pb.js b/components/usage-api/typescript/src/usage/v1/usage_grpc_pb.js index 9baea90f8d934c..3161bc6aff85c3 100644 --- a/components/usage-api/typescript/src/usage/v1/usage_grpc_pb.js +++ b/components/usage-api/typescript/src/usage/v1/usage_grpc_pb.js @@ -11,48 +11,48 @@ var grpc = require('@grpc/grpc-js'); var usage_v1_usage_pb = require('../../usage/v1/usage_pb.js'); var google_protobuf_timestamp_pb = require('google-protobuf/google/protobuf/timestamp_pb.js'); -function serialize_usage_v1_CollectUsageRequest(arg) { - if (!(arg instanceof usage_v1_usage_pb.CollectUsageRequest)) { - throw new Error('Expected argument of type usage.v1.CollectUsageRequest'); +function serialize_usage_v1_ListBilledUsageRequest(arg) { + if (!(arg instanceof usage_v1_usage_pb.ListBilledUsageRequest)) { + throw new Error('Expected argument of type usage.v1.ListBilledUsageRequest'); } return Buffer.from(arg.serializeBinary()); } -function deserialize_usage_v1_CollectUsageRequest(buffer_arg) { - return usage_v1_usage_pb.CollectUsageRequest.deserializeBinary(new Uint8Array(buffer_arg)); +function deserialize_usage_v1_ListBilledUsageRequest(buffer_arg) { + return usage_v1_usage_pb.ListBilledUsageRequest.deserializeBinary(new Uint8Array(buffer_arg)); } -function serialize_usage_v1_CollectUsageResponse(arg) { - if (!(arg instanceof usage_v1_usage_pb.CollectUsageResponse)) { - throw new Error('Expected argument of type usage.v1.CollectUsageResponse'); +function serialize_usage_v1_ListBilledUsageResponse(arg) { + if (!(arg instanceof usage_v1_usage_pb.ListBilledUsageResponse)) { + throw new Error('Expected argument of type usage.v1.ListBilledUsageResponse'); } return Buffer.from(arg.serializeBinary()); } -function deserialize_usage_v1_CollectUsageResponse(buffer_arg) { - return usage_v1_usage_pb.CollectUsageResponse.deserializeBinary(new Uint8Array(buffer_arg)); +function deserialize_usage_v1_ListBilledUsageResponse(buffer_arg) { + return usage_v1_usage_pb.ListBilledUsageResponse.deserializeBinary(new Uint8Array(buffer_arg)); } -function serialize_usage_v1_ListBilledUsageRequest(arg) { - if (!(arg instanceof usage_v1_usage_pb.ListBilledUsageRequest)) { - throw new Error('Expected argument of type usage.v1.ListBilledUsageRequest'); +function serialize_usage_v1_ReconcileUsageRequest(arg) { + if (!(arg instanceof usage_v1_usage_pb.ReconcileUsageRequest)) { + throw new Error('Expected argument of type usage.v1.ReconcileUsageRequest'); } return Buffer.from(arg.serializeBinary()); } -function deserialize_usage_v1_ListBilledUsageRequest(buffer_arg) { - return usage_v1_usage_pb.ListBilledUsageRequest.deserializeBinary(new Uint8Array(buffer_arg)); +function deserialize_usage_v1_ReconcileUsageRequest(buffer_arg) { + return usage_v1_usage_pb.ReconcileUsageRequest.deserializeBinary(new Uint8Array(buffer_arg)); } -function serialize_usage_v1_ListBilledUsageResponse(arg) { - if (!(arg instanceof usage_v1_usage_pb.ListBilledUsageResponse)) { - throw new Error('Expected argument of type usage.v1.ListBilledUsageResponse'); +function serialize_usage_v1_ReconcileUsageResponse(arg) { + if (!(arg instanceof usage_v1_usage_pb.ReconcileUsageResponse)) { + throw new Error('Expected argument of type usage.v1.ReconcileUsageResponse'); } return Buffer.from(arg.serializeBinary()); } -function deserialize_usage_v1_ListBilledUsageResponse(buffer_arg) { - return usage_v1_usage_pb.ListBilledUsageResponse.deserializeBinary(new Uint8Array(buffer_arg)); +function deserialize_usage_v1_ReconcileUsageResponse(buffer_arg) { + return usage_v1_usage_pb.ReconcileUsageResponse.deserializeBinary(new Uint8Array(buffer_arg)); } @@ -69,17 +69,17 @@ listBilledUsage: { responseSerialize: serialize_usage_v1_ListBilledUsageResponse, responseDeserialize: deserialize_usage_v1_ListBilledUsageResponse, }, - // CollectUsage collects usage for the specified time period, and stores the usage records in the database, returning the records. -collectUsage: { - path: '/usage.v1.UsageService/CollectUsage', + // ReconcileUsage collects usage for the specified time period, and stores the usage records in the database, returning the records. +reconcileUsage: { + path: '/usage.v1.UsageService/ReconcileUsage', requestStream: false, responseStream: false, - requestType: usage_v1_usage_pb.CollectUsageRequest, - responseType: usage_v1_usage_pb.CollectUsageResponse, - requestSerialize: serialize_usage_v1_CollectUsageRequest, - requestDeserialize: deserialize_usage_v1_CollectUsageRequest, - responseSerialize: serialize_usage_v1_CollectUsageResponse, - responseDeserialize: deserialize_usage_v1_CollectUsageResponse, + requestType: usage_v1_usage_pb.ReconcileUsageRequest, + responseType: usage_v1_usage_pb.ReconcileUsageResponse, + requestSerialize: serialize_usage_v1_ReconcileUsageRequest, + requestDeserialize: deserialize_usage_v1_ReconcileUsageRequest, + responseSerialize: serialize_usage_v1_ReconcileUsageResponse, + responseDeserialize: deserialize_usage_v1_ReconcileUsageResponse, }, }; diff --git a/components/usage-api/typescript/src/usage/v1/usage_pb.d.ts b/components/usage-api/typescript/src/usage/v1/usage_pb.d.ts index 78194777667441..1b37c71d476593 100644 --- a/components/usage-api/typescript/src/usage/v1/usage_pb.d.ts +++ b/components/usage-api/typescript/src/usage/v1/usage_pb.d.ts @@ -135,52 +135,52 @@ export namespace BilledSession { } } -export class CollectUsageRequest extends jspb.Message { +export class ReconcileUsageRequest extends jspb.Message { hasStartTime(): boolean; clearStartTime(): void; getStartTime(): google_protobuf_timestamp_pb.Timestamp | undefined; - setStartTime(value?: google_protobuf_timestamp_pb.Timestamp): CollectUsageRequest; + setStartTime(value?: google_protobuf_timestamp_pb.Timestamp): ReconcileUsageRequest; hasEndTime(): boolean; clearEndTime(): void; getEndTime(): google_protobuf_timestamp_pb.Timestamp | undefined; - setEndTime(value?: google_protobuf_timestamp_pb.Timestamp): CollectUsageRequest; + setEndTime(value?: google_protobuf_timestamp_pb.Timestamp): ReconcileUsageRequest; serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): CollectUsageRequest.AsObject; - static toObject(includeInstance: boolean, msg: CollectUsageRequest): CollectUsageRequest.AsObject; + toObject(includeInstance?: boolean): ReconcileUsageRequest.AsObject; + static toObject(includeInstance: boolean, msg: ReconcileUsageRequest): ReconcileUsageRequest.AsObject; static extensions: {[key: number]: jspb.ExtensionFieldInfo}; static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: CollectUsageRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): CollectUsageRequest; - static deserializeBinaryFromReader(message: CollectUsageRequest, reader: jspb.BinaryReader): CollectUsageRequest; + static serializeBinaryToWriter(message: ReconcileUsageRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ReconcileUsageRequest; + static deserializeBinaryFromReader(message: ReconcileUsageRequest, reader: jspb.BinaryReader): ReconcileUsageRequest; } -export namespace CollectUsageRequest { +export namespace ReconcileUsageRequest { export type AsObject = { startTime?: google_protobuf_timestamp_pb.Timestamp.AsObject, endTime?: google_protobuf_timestamp_pb.Timestamp.AsObject, } } -export class CollectUsageResponse extends jspb.Message { +export class ReconcileUsageResponse extends jspb.Message { clearSessionsList(): void; getSessionsList(): Array; - setSessionsList(value: Array): CollectUsageResponse; + setSessionsList(value: Array): ReconcileUsageResponse; addSessions(value?: BilledSession, index?: number): BilledSession; serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): CollectUsageResponse.AsObject; - static toObject(includeInstance: boolean, msg: CollectUsageResponse): CollectUsageResponse.AsObject; + toObject(includeInstance?: boolean): ReconcileUsageResponse.AsObject; + static toObject(includeInstance: boolean, msg: ReconcileUsageResponse): ReconcileUsageResponse.AsObject; static extensions: {[key: number]: jspb.ExtensionFieldInfo}; static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: CollectUsageResponse, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): CollectUsageResponse; - static deserializeBinaryFromReader(message: CollectUsageResponse, reader: jspb.BinaryReader): CollectUsageResponse; + static serializeBinaryToWriter(message: ReconcileUsageResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ReconcileUsageResponse; + static deserializeBinaryFromReader(message: ReconcileUsageResponse, reader: jspb.BinaryReader): ReconcileUsageResponse; } -export namespace CollectUsageResponse { +export namespace ReconcileUsageResponse { export type AsObject = { sessionsList: Array, } diff --git a/components/usage-api/typescript/src/usage/v1/usage_pb.js b/components/usage-api/typescript/src/usage/v1/usage_pb.js index 2d00c370889898..e13dcef0716ca5 100644 --- a/components/usage-api/typescript/src/usage/v1/usage_pb.js +++ b/components/usage-api/typescript/src/usage/v1/usage_pb.js @@ -24,11 +24,11 @@ var global = (function() { return this || window || global || self || Function(' var google_protobuf_timestamp_pb = require('google-protobuf/google/protobuf/timestamp_pb.js'); goog.object.extend(proto, google_protobuf_timestamp_pb); goog.exportSymbol('proto.usage.v1.BilledSession', null, global); -goog.exportSymbol('proto.usage.v1.CollectUsageRequest', null, global); -goog.exportSymbol('proto.usage.v1.CollectUsageResponse', null, global); goog.exportSymbol('proto.usage.v1.ListBilledUsageRequest', null, global); goog.exportSymbol('proto.usage.v1.ListBilledUsageRequest.Ordering', null, global); goog.exportSymbol('proto.usage.v1.ListBilledUsageResponse', null, global); +goog.exportSymbol('proto.usage.v1.ReconcileUsageRequest', null, global); +goog.exportSymbol('proto.usage.v1.ReconcileUsageResponse', null, global); /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a @@ -102,16 +102,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.usage.v1.CollectUsageRequest = function(opt_data) { +proto.usage.v1.ReconcileUsageRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.usage.v1.CollectUsageRequest, jspb.Message); +goog.inherits(proto.usage.v1.ReconcileUsageRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.usage.v1.CollectUsageRequest.displayName = 'proto.usage.v1.CollectUsageRequest'; + proto.usage.v1.ReconcileUsageRequest.displayName = 'proto.usage.v1.ReconcileUsageRequest'; } /** * Generated by JsPbCodeGenerator. @@ -123,16 +123,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.usage.v1.CollectUsageResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.usage.v1.CollectUsageResponse.repeatedFields_, null); +proto.usage.v1.ReconcileUsageResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.usage.v1.ReconcileUsageResponse.repeatedFields_, null); }; -goog.inherits(proto.usage.v1.CollectUsageResponse, jspb.Message); +goog.inherits(proto.usage.v1.ReconcileUsageResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.usage.v1.CollectUsageResponse.displayName = 'proto.usage.v1.CollectUsageResponse'; + proto.usage.v1.ReconcileUsageResponse.displayName = 'proto.usage.v1.ReconcileUsageResponse'; } @@ -1082,8 +1082,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.usage.v1.CollectUsageRequest.prototype.toObject = function(opt_includeInstance) { - return proto.usage.v1.CollectUsageRequest.toObject(opt_includeInstance, this); +proto.usage.v1.ReconcileUsageRequest.prototype.toObject = function(opt_includeInstance) { + return proto.usage.v1.ReconcileUsageRequest.toObject(opt_includeInstance, this); }; @@ -1092,11 +1092,11 @@ proto.usage.v1.CollectUsageRequest.prototype.toObject = function(opt_includeInst * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.usage.v1.CollectUsageRequest} msg The msg instance to transform. + * @param {!proto.usage.v1.ReconcileUsageRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.usage.v1.CollectUsageRequest.toObject = function(includeInstance, msg) { +proto.usage.v1.ReconcileUsageRequest.toObject = function(includeInstance, msg) { var f, obj = { startTime: (f = msg.getStartTime()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f), endTime: (f = msg.getEndTime()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f) @@ -1113,23 +1113,23 @@ proto.usage.v1.CollectUsageRequest.toObject = function(includeInstance, msg) { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.usage.v1.CollectUsageRequest} + * @return {!proto.usage.v1.ReconcileUsageRequest} */ -proto.usage.v1.CollectUsageRequest.deserializeBinary = function(bytes) { +proto.usage.v1.ReconcileUsageRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.usage.v1.CollectUsageRequest; - return proto.usage.v1.CollectUsageRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.usage.v1.ReconcileUsageRequest; + return proto.usage.v1.ReconcileUsageRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.usage.v1.CollectUsageRequest} msg The message object to deserialize into. + * @param {!proto.usage.v1.ReconcileUsageRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.usage.v1.CollectUsageRequest} + * @return {!proto.usage.v1.ReconcileUsageRequest} */ -proto.usage.v1.CollectUsageRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.usage.v1.ReconcileUsageRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -1159,9 +1159,9 @@ proto.usage.v1.CollectUsageRequest.deserializeBinaryFromReader = function(msg, r * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.usage.v1.CollectUsageRequest.prototype.serializeBinary = function() { +proto.usage.v1.ReconcileUsageRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.usage.v1.CollectUsageRequest.serializeBinaryToWriter(this, writer); + proto.usage.v1.ReconcileUsageRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -1169,11 +1169,11 @@ proto.usage.v1.CollectUsageRequest.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.usage.v1.CollectUsageRequest} message + * @param {!proto.usage.v1.ReconcileUsageRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.usage.v1.CollectUsageRequest.serializeBinaryToWriter = function(message, writer) { +proto.usage.v1.ReconcileUsageRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getStartTime(); if (f != null) { @@ -1198,7 +1198,7 @@ proto.usage.v1.CollectUsageRequest.serializeBinaryToWriter = function(message, w * optional google.protobuf.Timestamp start_time = 1; * @return {?proto.google.protobuf.Timestamp} */ -proto.usage.v1.CollectUsageRequest.prototype.getStartTime = function() { +proto.usage.v1.ReconcileUsageRequest.prototype.getStartTime = function() { return /** @type{?proto.google.protobuf.Timestamp} */ ( jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 1)); }; @@ -1206,18 +1206,18 @@ proto.usage.v1.CollectUsageRequest.prototype.getStartTime = function() { /** * @param {?proto.google.protobuf.Timestamp|undefined} value - * @return {!proto.usage.v1.CollectUsageRequest} returns this + * @return {!proto.usage.v1.ReconcileUsageRequest} returns this */ -proto.usage.v1.CollectUsageRequest.prototype.setStartTime = function(value) { +proto.usage.v1.ReconcileUsageRequest.prototype.setStartTime = function(value) { return jspb.Message.setWrapperField(this, 1, value); }; /** * Clears the message field making it undefined. - * @return {!proto.usage.v1.CollectUsageRequest} returns this + * @return {!proto.usage.v1.ReconcileUsageRequest} returns this */ -proto.usage.v1.CollectUsageRequest.prototype.clearStartTime = function() { +proto.usage.v1.ReconcileUsageRequest.prototype.clearStartTime = function() { return this.setStartTime(undefined); }; @@ -1226,7 +1226,7 @@ proto.usage.v1.CollectUsageRequest.prototype.clearStartTime = function() { * Returns whether this field is set. * @return {boolean} */ -proto.usage.v1.CollectUsageRequest.prototype.hasStartTime = function() { +proto.usage.v1.ReconcileUsageRequest.prototype.hasStartTime = function() { return jspb.Message.getField(this, 1) != null; }; @@ -1235,7 +1235,7 @@ proto.usage.v1.CollectUsageRequest.prototype.hasStartTime = function() { * optional google.protobuf.Timestamp end_time = 2; * @return {?proto.google.protobuf.Timestamp} */ -proto.usage.v1.CollectUsageRequest.prototype.getEndTime = function() { +proto.usage.v1.ReconcileUsageRequest.prototype.getEndTime = function() { return /** @type{?proto.google.protobuf.Timestamp} */ ( jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 2)); }; @@ -1243,18 +1243,18 @@ proto.usage.v1.CollectUsageRequest.prototype.getEndTime = function() { /** * @param {?proto.google.protobuf.Timestamp|undefined} value - * @return {!proto.usage.v1.CollectUsageRequest} returns this + * @return {!proto.usage.v1.ReconcileUsageRequest} returns this */ -proto.usage.v1.CollectUsageRequest.prototype.setEndTime = function(value) { +proto.usage.v1.ReconcileUsageRequest.prototype.setEndTime = function(value) { return jspb.Message.setWrapperField(this, 2, value); }; /** * Clears the message field making it undefined. - * @return {!proto.usage.v1.CollectUsageRequest} returns this + * @return {!proto.usage.v1.ReconcileUsageRequest} returns this */ -proto.usage.v1.CollectUsageRequest.prototype.clearEndTime = function() { +proto.usage.v1.ReconcileUsageRequest.prototype.clearEndTime = function() { return this.setEndTime(undefined); }; @@ -1263,7 +1263,7 @@ proto.usage.v1.CollectUsageRequest.prototype.clearEndTime = function() { * Returns whether this field is set. * @return {boolean} */ -proto.usage.v1.CollectUsageRequest.prototype.hasEndTime = function() { +proto.usage.v1.ReconcileUsageRequest.prototype.hasEndTime = function() { return jspb.Message.getField(this, 2) != null; }; @@ -1274,7 +1274,7 @@ proto.usage.v1.CollectUsageRequest.prototype.hasEndTime = function() { * @private {!Array} * @const */ -proto.usage.v1.CollectUsageResponse.repeatedFields_ = [1]; +proto.usage.v1.ReconcileUsageResponse.repeatedFields_ = [1]; @@ -1291,8 +1291,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.usage.v1.CollectUsageResponse.prototype.toObject = function(opt_includeInstance) { - return proto.usage.v1.CollectUsageResponse.toObject(opt_includeInstance, this); +proto.usage.v1.ReconcileUsageResponse.prototype.toObject = function(opt_includeInstance) { + return proto.usage.v1.ReconcileUsageResponse.toObject(opt_includeInstance, this); }; @@ -1301,11 +1301,11 @@ proto.usage.v1.CollectUsageResponse.prototype.toObject = function(opt_includeIns * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.usage.v1.CollectUsageResponse} msg The msg instance to transform. + * @param {!proto.usage.v1.ReconcileUsageResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.usage.v1.CollectUsageResponse.toObject = function(includeInstance, msg) { +proto.usage.v1.ReconcileUsageResponse.toObject = function(includeInstance, msg) { var f, obj = { sessionsList: jspb.Message.toObjectList(msg.getSessionsList(), proto.usage.v1.BilledSession.toObject, includeInstance) @@ -1322,23 +1322,23 @@ proto.usage.v1.CollectUsageResponse.toObject = function(includeInstance, msg) { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.usage.v1.CollectUsageResponse} + * @return {!proto.usage.v1.ReconcileUsageResponse} */ -proto.usage.v1.CollectUsageResponse.deserializeBinary = function(bytes) { +proto.usage.v1.ReconcileUsageResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.usage.v1.CollectUsageResponse; - return proto.usage.v1.CollectUsageResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.usage.v1.ReconcileUsageResponse; + return proto.usage.v1.ReconcileUsageResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.usage.v1.CollectUsageResponse} msg The message object to deserialize into. + * @param {!proto.usage.v1.ReconcileUsageResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.usage.v1.CollectUsageResponse} + * @return {!proto.usage.v1.ReconcileUsageResponse} */ -proto.usage.v1.CollectUsageResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.usage.v1.ReconcileUsageResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -1363,9 +1363,9 @@ proto.usage.v1.CollectUsageResponse.deserializeBinaryFromReader = function(msg, * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.usage.v1.CollectUsageResponse.prototype.serializeBinary = function() { +proto.usage.v1.ReconcileUsageResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.usage.v1.CollectUsageResponse.serializeBinaryToWriter(this, writer); + proto.usage.v1.ReconcileUsageResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -1373,11 +1373,11 @@ proto.usage.v1.CollectUsageResponse.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.usage.v1.CollectUsageResponse} message + * @param {!proto.usage.v1.ReconcileUsageResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.usage.v1.CollectUsageResponse.serializeBinaryToWriter = function(message, writer) { +proto.usage.v1.ReconcileUsageResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getSessionsList(); if (f.length > 0) { @@ -1394,7 +1394,7 @@ proto.usage.v1.CollectUsageResponse.serializeBinaryToWriter = function(message, * repeated BilledSession sessions = 1; * @return {!Array} */ -proto.usage.v1.CollectUsageResponse.prototype.getSessionsList = function() { +proto.usage.v1.ReconcileUsageResponse.prototype.getSessionsList = function() { return /** @type{!Array} */ ( jspb.Message.getRepeatedWrapperField(this, proto.usage.v1.BilledSession, 1)); }; @@ -1402,9 +1402,9 @@ proto.usage.v1.CollectUsageResponse.prototype.getSessionsList = function() { /** * @param {!Array} value - * @return {!proto.usage.v1.CollectUsageResponse} returns this + * @return {!proto.usage.v1.ReconcileUsageResponse} returns this */ -proto.usage.v1.CollectUsageResponse.prototype.setSessionsList = function(value) { +proto.usage.v1.ReconcileUsageResponse.prototype.setSessionsList = function(value) { return jspb.Message.setRepeatedWrapperField(this, 1, value); }; @@ -1414,16 +1414,16 @@ proto.usage.v1.CollectUsageResponse.prototype.setSessionsList = function(value) * @param {number=} opt_index * @return {!proto.usage.v1.BilledSession} */ -proto.usage.v1.CollectUsageResponse.prototype.addSessions = function(opt_value, opt_index) { +proto.usage.v1.ReconcileUsageResponse.prototype.addSessions = function(opt_value, opt_index) { return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.usage.v1.BilledSession, opt_index); }; /** * Clears the list making it empty but non-null. - * @return {!proto.usage.v1.CollectUsageResponse} returns this + * @return {!proto.usage.v1.ReconcileUsageResponse} returns this */ -proto.usage.v1.CollectUsageResponse.prototype.clearSessionsList = function() { +proto.usage.v1.ReconcileUsageResponse.prototype.clearSessionsList = function() { return this.setSessionsList([]); }; diff --git a/components/usage-api/usage/v1/usage.proto b/components/usage-api/usage/v1/usage.proto index fbb16709e87762..76d9a2f6f4d181 100644 --- a/components/usage-api/usage/v1/usage.proto +++ b/components/usage-api/usage/v1/usage.proto @@ -10,8 +10,8 @@ service UsageService { // ListBilledUsage retrieves all usage for the specified attributionId rpc ListBilledUsage(ListBilledUsageRequest) returns (ListBilledUsageResponse) {} - // CollectUsage collects usage for the specified time period, and stores the usage records in the database, returning the records. - rpc CollectUsage(CollectUsageRequest) returns (CollectUsageResponse) {} + // ReconcileUsage collects usage for the specified time period, and stores the usage records in the database, returning the records. + rpc ReconcileUsage(ReconcileUsageRequest) returns (ReconcileUsageResponse) {} } message ListBilledUsageRequest { @@ -56,11 +56,11 @@ message BilledSession { double credits = 12; } -message CollectUsageRequest { +message ReconcileUsageRequest { google.protobuf.Timestamp start_time = 1; google.protobuf.Timestamp end_time = 2; } -message CollectUsageResponse { +message ReconcileUsageResponse { repeated BilledSession sessions = 1; }