diff --git a/components/server/ee/src/billing/billing-mode.spec.db.ts b/components/server/ee/src/billing/billing-mode.spec.db.ts index 34c656013e0a02..12e914e9f69cbb 100644 --- a/components/server/ee/src/billing/billing-mode.spec.db.ts +++ b/components/server/ee/src/billing/billing-mode.spec.db.ts @@ -50,6 +50,8 @@ import { ReconcileUsageResponse, ListUsageRequest_Ordering, ListUsageResponse, + ResetUsageResponse, + ResetUsageRequest, } from "@gitpod/usage-api/lib/usage/v1/usage.pb"; import { CallOptions } from "nice-grpc-common"; chai.use(deepEqualInAnyOrder); @@ -124,6 +126,10 @@ class UsageServiceClientMock implements UsageServiceClient { ): Promise { throw new Error("Mock: not implemented"); } + + async resetUsage(request: ResetUsageRequest, options?: CallOptions | undefined): Promise { + throw new Error("Mock: not implemented"); + } } class ConfigCatClientMock implements Client { diff --git a/components/usage-api/go/v1/usage.pb.go b/components/usage-api/go/v1/usage.pb.go index 7a11fecf7a09ca..df15f2aa6b7b6e 100644 --- a/components/usage-api/go/v1/usage.pb.go +++ b/components/usage-api/go/v1/usage.pb.go @@ -996,6 +996,82 @@ func (x *CostCenter) GetNextBillingTime() *timestamppb.Timestamp { return nil } +type ResetUsageRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ResetUsageRequest) Reset() { + *x = ResetUsageRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_usage_v1_usage_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ResetUsageRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResetUsageRequest) ProtoMessage() {} + +func (x *ResetUsageRequest) ProtoReflect() protoreflect.Message { + mi := &file_usage_v1_usage_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ResetUsageRequest.ProtoReflect.Descriptor instead. +func (*ResetUsageRequest) Descriptor() ([]byte, []int) { + return file_usage_v1_usage_proto_rawDescGZIP(), []int{14} +} + +type ResetUsageResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ResetUsageResponse) Reset() { + *x = ResetUsageResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_usage_v1_usage_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ResetUsageResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResetUsageResponse) ProtoMessage() {} + +func (x *ResetUsageResponse) ProtoReflect() protoreflect.Message { + mi := &file_usage_v1_usage_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ResetUsageResponse.ProtoReflect.Descriptor instead. +func (*ResetUsageResponse) Descriptor() ([]byte, []int) { + return file_usage_v1_usage_proto_rawDescGZIP(), []int{15} +} + var File_usage_v1_usage_proto protoreflect.FileDescriptor var file_usage_v1_usage_proto_rawDesc = []byte{ @@ -1125,36 +1201,44 @@ var file_usage_v1_usage_proto_rawDesc = []byte{ 0x12, 0x1b, 0x0a, 0x17, 0x42, 0x49, 0x4c, 0x4c, 0x49, 0x4e, 0x47, 0x5f, 0x53, 0x54, 0x52, 0x41, 0x54, 0x45, 0x47, 0x59, 0x5f, 0x53, 0x54, 0x52, 0x49, 0x50, 0x45, 0x10, 0x00, 0x12, 0x1a, 0x0a, 0x16, 0x42, 0x49, 0x4c, 0x4c, 0x49, 0x4e, 0x47, 0x5f, 0x53, 0x54, 0x52, 0x41, 0x54, 0x45, 0x47, - 0x59, 0x5f, 0x4f, 0x54, 0x48, 0x45, 0x52, 0x10, 0x01, 0x32, 0xa0, 0x03, 0x0a, 0x0c, 0x55, 0x73, - 0x61, 0x67, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x52, 0x0a, 0x0d, 0x47, 0x65, - 0x74, 0x43, 0x6f, 0x73, 0x74, 0x43, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x1e, 0x2e, 0x75, 0x73, - 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x73, 0x74, 0x43, 0x65, - 0x6e, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x75, 0x73, - 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x73, 0x74, 0x43, 0x65, - 0x6e, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x52, - 0x0a, 0x0d, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x73, 0x74, 0x43, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x12, - 0x1e, 0x2e, 0x75, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x43, 0x6f, - 0x73, 0x74, 0x43, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x1f, 0x2e, 0x75, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x43, 0x6f, - 0x73, 0x74, 0x43, 0x65, 0x6e, 0x74, 0x65, 0x72, 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, 0x12, 0x46, 0x0a, 0x09, 0x4c, 0x69, 0x73, - 0x74, 0x55, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1a, 0x2e, 0x75, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, - 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x75, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, - 0x73, 0x74, 0x55, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x00, 0x12, 0x49, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x12, - 0x1b, 0x2e, 0x75, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x61, - 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x75, - 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x61, 0x6c, 0x61, 0x6e, - 0x63, 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, + 0x59, 0x5f, 0x4f, 0x54, 0x48, 0x45, 0x52, 0x10, 0x01, 0x22, 0x13, 0x0a, 0x11, 0x52, 0x65, 0x73, + 0x65, 0x74, 0x55, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x14, + 0x0a, 0x12, 0x52, 0x65, 0x73, 0x65, 0x74, 0x55, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xeb, 0x03, 0x0a, 0x0c, 0x55, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x52, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x73, 0x74, + 0x43, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x1e, 0x2e, 0x75, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, + 0x31, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x73, 0x74, 0x43, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x75, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, + 0x31, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x73, 0x74, 0x43, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x52, 0x0a, 0x0d, 0x53, 0x65, 0x74, + 0x43, 0x6f, 0x73, 0x74, 0x43, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x1e, 0x2e, 0x75, 0x73, 0x61, + 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x73, 0x74, 0x43, 0x65, 0x6e, + 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x75, 0x73, 0x61, + 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x73, 0x74, 0x43, 0x65, 0x6e, + 0x74, 0x65, 0x72, 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, 0x12, 0x49, 0x0a, 0x0a, 0x52, 0x65, 0x73, 0x65, 0x74, 0x55, 0x73, 0x61, + 0x67, 0x65, 0x12, 0x1b, 0x2e, 0x75, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, + 0x73, 0x65, 0x74, 0x55, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x1c, 0x2e, 0x75, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x73, 0x65, 0x74, + 0x55, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, + 0x46, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1a, 0x2e, 0x75, + 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x61, 0x67, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x75, 0x73, 0x61, 0x67, 0x65, + 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x49, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x42, 0x61, + 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x1b, 0x2e, 0x75, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, + 0x2e, 0x47, 0x65, 0x74, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x75, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, + 0x74, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 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 ( @@ -1170,7 +1254,7 @@ func file_usage_v1_usage_proto_rawDescGZIP() []byte { } var file_usage_v1_usage_proto_enumTypes = make([]protoimpl.EnumInfo, 3) -var file_usage_v1_usage_proto_msgTypes = make([]protoimpl.MessageInfo, 14) +var file_usage_v1_usage_proto_msgTypes = make([]protoimpl.MessageInfo, 16) var file_usage_v1_usage_proto_goTypes = []interface{}{ (ListUsageRequest_Ordering)(0), // 0: usage.v1.ListUsageRequest.Ordering (Usage_Kind)(0), // 1: usage.v1.Usage.Kind @@ -1189,36 +1273,40 @@ var file_usage_v1_usage_proto_goTypes = []interface{}{ (*GetCostCenterRequest)(nil), // 14: usage.v1.GetCostCenterRequest (*GetCostCenterResponse)(nil), // 15: usage.v1.GetCostCenterResponse (*CostCenter)(nil), // 16: usage.v1.CostCenter - (*timestamppb.Timestamp)(nil), // 17: google.protobuf.Timestamp + (*ResetUsageRequest)(nil), // 17: usage.v1.ResetUsageRequest + (*ResetUsageResponse)(nil), // 18: usage.v1.ResetUsageResponse + (*timestamppb.Timestamp)(nil), // 19: google.protobuf.Timestamp } var file_usage_v1_usage_proto_depIdxs = []int32{ - 17, // 0: usage.v1.ReconcileUsageRequest.from:type_name -> google.protobuf.Timestamp - 17, // 1: usage.v1.ReconcileUsageRequest.to:type_name -> google.protobuf.Timestamp - 17, // 2: usage.v1.ListUsageRequest.from:type_name -> google.protobuf.Timestamp - 17, // 3: usage.v1.ListUsageRequest.to:type_name -> google.protobuf.Timestamp + 19, // 0: usage.v1.ReconcileUsageRequest.from:type_name -> google.protobuf.Timestamp + 19, // 1: usage.v1.ReconcileUsageRequest.to:type_name -> google.protobuf.Timestamp + 19, // 2: usage.v1.ListUsageRequest.from:type_name -> google.protobuf.Timestamp + 19, // 3: usage.v1.ListUsageRequest.to:type_name -> google.protobuf.Timestamp 0, // 4: usage.v1.ListUsageRequest.order:type_name -> usage.v1.ListUsageRequest.Ordering 5, // 5: usage.v1.ListUsageRequest.pagination:type_name -> usage.v1.PaginatedRequest 9, // 6: usage.v1.ListUsageResponse.usage_entries:type_name -> usage.v1.Usage 6, // 7: usage.v1.ListUsageResponse.pagination:type_name -> usage.v1.PaginatedResponse - 17, // 8: usage.v1.Usage.effective_time:type_name -> google.protobuf.Timestamp + 19, // 8: usage.v1.Usage.effective_time:type_name -> google.protobuf.Timestamp 1, // 9: usage.v1.Usage.kind:type_name -> usage.v1.Usage.Kind 16, // 10: usage.v1.SetCostCenterRequest.cost_center:type_name -> usage.v1.CostCenter 16, // 11: usage.v1.SetCostCenterResponse.cost_center:type_name -> usage.v1.CostCenter 16, // 12: usage.v1.GetCostCenterResponse.cost_center:type_name -> usage.v1.CostCenter 2, // 13: usage.v1.CostCenter.billing_strategy:type_name -> usage.v1.CostCenter.BillingStrategy - 17, // 14: usage.v1.CostCenter.next_billing_time:type_name -> google.protobuf.Timestamp + 19, // 14: usage.v1.CostCenter.next_billing_time:type_name -> google.protobuf.Timestamp 14, // 15: usage.v1.UsageService.GetCostCenter:input_type -> usage.v1.GetCostCenterRequest 10, // 16: usage.v1.UsageService.SetCostCenter:input_type -> usage.v1.SetCostCenterRequest 3, // 17: usage.v1.UsageService.ReconcileUsage:input_type -> usage.v1.ReconcileUsageRequest - 7, // 18: usage.v1.UsageService.ListUsage:input_type -> usage.v1.ListUsageRequest - 12, // 19: usage.v1.UsageService.GetBalance:input_type -> usage.v1.GetBalanceRequest - 15, // 20: usage.v1.UsageService.GetCostCenter:output_type -> usage.v1.GetCostCenterResponse - 11, // 21: usage.v1.UsageService.SetCostCenter:output_type -> usage.v1.SetCostCenterResponse - 4, // 22: usage.v1.UsageService.ReconcileUsage:output_type -> usage.v1.ReconcileUsageResponse - 8, // 23: usage.v1.UsageService.ListUsage:output_type -> usage.v1.ListUsageResponse - 13, // 24: usage.v1.UsageService.GetBalance:output_type -> usage.v1.GetBalanceResponse - 20, // [20:25] is the sub-list for method output_type - 15, // [15:20] is the sub-list for method input_type + 17, // 18: usage.v1.UsageService.ResetUsage:input_type -> usage.v1.ResetUsageRequest + 7, // 19: usage.v1.UsageService.ListUsage:input_type -> usage.v1.ListUsageRequest + 12, // 20: usage.v1.UsageService.GetBalance:input_type -> usage.v1.GetBalanceRequest + 15, // 21: usage.v1.UsageService.GetCostCenter:output_type -> usage.v1.GetCostCenterResponse + 11, // 22: usage.v1.UsageService.SetCostCenter:output_type -> usage.v1.SetCostCenterResponse + 4, // 23: usage.v1.UsageService.ReconcileUsage:output_type -> usage.v1.ReconcileUsageResponse + 18, // 24: usage.v1.UsageService.ResetUsage:output_type -> usage.v1.ResetUsageResponse + 8, // 25: usage.v1.UsageService.ListUsage:output_type -> usage.v1.ListUsageResponse + 13, // 26: usage.v1.UsageService.GetBalance:output_type -> usage.v1.GetBalanceResponse + 21, // [21:27] is the sub-list for method output_type + 15, // [15:21] is the sub-list for method input_type 15, // [15:15] is the sub-list for extension type_name 15, // [15:15] is the sub-list for extension extendee 0, // [0:15] is the sub-list for field type_name @@ -1398,6 +1486,30 @@ func file_usage_v1_usage_proto_init() { return nil } } + file_usage_v1_usage_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ResetUsageRequest); 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[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ResetUsageResponse); 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{ @@ -1405,7 +1517,7 @@ func file_usage_v1_usage_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_usage_v1_usage_proto_rawDesc, NumEnums: 3, - NumMessages: 14, + NumMessages: 16, 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 9b26bd6dbe2e85..17559e5290e0eb 100644 --- a/components/usage-api/go/v1/usage_grpc.pb.go +++ b/components/usage-api/go/v1/usage_grpc.pb.go @@ -32,6 +32,8 @@ type UsageServiceClient interface { SetCostCenter(ctx context.Context, in *SetCostCenterRequest, opts ...grpc.CallOption) (*SetCostCenterResponse, error) // Triggers reconciliation of usage. ReconcileUsage(ctx context.Context, in *ReconcileUsageRequest, opts ...grpc.CallOption) (*ReconcileUsageResponse, error) + // ResetUsage resets Usage for CostCenters which have expired or will explire shortly + ResetUsage(ctx context.Context, in *ResetUsageRequest, opts ...grpc.CallOption) (*ResetUsageResponse, error) // ListUsage retrieves all usage for the specified attributionId and theb given time range ListUsage(ctx context.Context, in *ListUsageRequest, opts ...grpc.CallOption) (*ListUsageResponse, error) // GetBalance returns the current credits balance for the given attributionId @@ -73,6 +75,15 @@ func (c *usageServiceClient) ReconcileUsage(ctx context.Context, in *ReconcileUs return out, nil } +func (c *usageServiceClient) ResetUsage(ctx context.Context, in *ResetUsageRequest, opts ...grpc.CallOption) (*ResetUsageResponse, error) { + out := new(ResetUsageResponse) + err := c.cc.Invoke(ctx, "/usage.v1.UsageService/ResetUsage", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *usageServiceClient) ListUsage(ctx context.Context, in *ListUsageRequest, opts ...grpc.CallOption) (*ListUsageResponse, error) { out := new(ListUsageResponse) err := c.cc.Invoke(ctx, "/usage.v1.UsageService/ListUsage", in, out, opts...) @@ -101,6 +112,8 @@ type UsageServiceServer interface { SetCostCenter(context.Context, *SetCostCenterRequest) (*SetCostCenterResponse, error) // Triggers reconciliation of usage. ReconcileUsage(context.Context, *ReconcileUsageRequest) (*ReconcileUsageResponse, error) + // ResetUsage resets Usage for CostCenters which have expired or will explire shortly + ResetUsage(context.Context, *ResetUsageRequest) (*ResetUsageResponse, error) // ListUsage retrieves all usage for the specified attributionId and theb given time range ListUsage(context.Context, *ListUsageRequest) (*ListUsageResponse, error) // GetBalance returns the current credits balance for the given attributionId @@ -121,6 +134,9 @@ func (UnimplementedUsageServiceServer) SetCostCenter(context.Context, *SetCostCe func (UnimplementedUsageServiceServer) ReconcileUsage(context.Context, *ReconcileUsageRequest) (*ReconcileUsageResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ReconcileUsage not implemented") } +func (UnimplementedUsageServiceServer) ResetUsage(context.Context, *ResetUsageRequest) (*ResetUsageResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ResetUsage not implemented") +} func (UnimplementedUsageServiceServer) ListUsage(context.Context, *ListUsageRequest) (*ListUsageResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ListUsage not implemented") } @@ -194,6 +210,24 @@ func _UsageService_ReconcileUsage_Handler(srv interface{}, ctx context.Context, return interceptor(ctx, in, info, handler) } +func _UsageService_ResetUsage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ResetUsageRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UsageServiceServer).ResetUsage(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/usage.v1.UsageService/ResetUsage", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UsageServiceServer).ResetUsage(ctx, req.(*ResetUsageRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _UsageService_ListUsage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ListUsageRequest) if err := dec(in); err != nil { @@ -249,6 +283,10 @@ var UsageService_ServiceDesc = grpc.ServiceDesc{ MethodName: "ReconcileUsage", Handler: _UsageService_ReconcileUsage_Handler, }, + { + MethodName: "ResetUsage", + Handler: _UsageService_ResetUsage_Handler, + }, { MethodName: "ListUsage", Handler: _UsageService_ListUsage_Handler, diff --git a/components/usage-api/typescript/src/usage/v1/usage.pb.ts b/components/usage-api/typescript/src/usage/v1/usage.pb.ts index 4a824b50d05487..0faf9d4262f5ab 100644 --- a/components/usage-api/typescript/src/usage/v1/usage.pb.ts +++ b/components/usage-api/typescript/src/usage/v1/usage.pb.ts @@ -242,6 +242,12 @@ export function costCenter_BillingStrategyToNumber(object: CostCenter_BillingStr } } +export interface ResetUsageRequest { +} + +export interface ResetUsageResponse { +} + function createBaseReconcileUsageRequest(): ReconcileUsageRequest { return { from: undefined, to: undefined }; } @@ -1149,6 +1155,84 @@ export const CostCenter = { }, }; +function createBaseResetUsageRequest(): ResetUsageRequest { + return {}; +} + +export const ResetUsageRequest = { + encode(_: ResetUsageRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ResetUsageRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResetUsageRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): ResetUsageRequest { + return {}; + }, + + toJSON(_: ResetUsageRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial(_: DeepPartial): ResetUsageRequest { + const message = createBaseResetUsageRequest(); + return message; + }, +}; + +function createBaseResetUsageResponse(): ResetUsageResponse { + return {}; +} + +export const ResetUsageResponse = { + encode(_: ResetUsageResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ResetUsageResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResetUsageResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): ResetUsageResponse { + return {}; + }, + + toJSON(_: ResetUsageResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial(_: DeepPartial): ResetUsageResponse { + const message = createBaseResetUsageResponse(); + return message; + }, +}; + export type UsageServiceDefinition = typeof UsageServiceDefinition; export const UsageServiceDefinition = { name: "UsageService", @@ -1181,6 +1265,15 @@ export const UsageServiceDefinition = { responseStream: false, options: {}, }, + /** ResetUsage resets Usage for CostCenters which have expired or will explire shortly */ + resetUsage: { + name: "ResetUsage", + requestType: ResetUsageRequest, + requestStream: false, + responseType: ResetUsageResponse, + responseStream: false, + options: {}, + }, /** ListUsage retrieves all usage for the specified attributionId and theb given time range */ listUsage: { name: "ListUsage", @@ -1218,6 +1311,11 @@ export interface UsageServiceServiceImplementation { request: ReconcileUsageRequest, context: CallContext & CallContextExt, ): Promise>; + /** ResetUsage resets Usage for CostCenters which have expired or will explire shortly */ + resetUsage( + request: ResetUsageRequest, + context: CallContext & CallContextExt, + ): Promise>; /** ListUsage retrieves all usage for the specified attributionId and theb given time range */ listUsage(request: ListUsageRequest, context: CallContext & CallContextExt): Promise>; /** GetBalance returns the current credits balance for the given attributionId */ @@ -1243,6 +1341,11 @@ export interface UsageServiceClient { request: DeepPartial, options?: CallOptions & CallOptionsExt, ): Promise; + /** ResetUsage resets Usage for CostCenters which have expired or will explire shortly */ + resetUsage( + request: DeepPartial, + options?: CallOptions & CallOptionsExt, + ): Promise; /** ListUsage retrieves all usage for the specified attributionId and theb given time range */ listUsage(request: DeepPartial, options?: CallOptions & CallOptionsExt): Promise; /** GetBalance returns the current credits balance for the given attributionId */ diff --git a/components/usage-api/usage/v1/usage.proto b/components/usage-api/usage/v1/usage.proto index cee624b6a871a9..7bf0c20f52293a 100644 --- a/components/usage-api/usage/v1/usage.proto +++ b/components/usage-api/usage/v1/usage.proto @@ -17,6 +17,9 @@ service UsageService { // Triggers reconciliation of usage. rpc ReconcileUsage(ReconcileUsageRequest) returns (ReconcileUsageResponse) {} + // ResetUsage resets Usage for CostCenters which have expired or will explire shortly + rpc ResetUsage(ResetUsageRequest) returns (ResetUsageResponse) {} + // ListUsage retrieves all usage for the specified attributionId and theb given time range rpc ListUsage(ListUsageRequest) returns (ListUsageResponse) {} @@ -127,3 +130,7 @@ message CostCenter { // next_billing_time specifies when the next billing cycle happens. Only set when billing strategy is 'other'. This property is readonly. google.protobuf.Timestamp next_billing_time = 4; } + +message ResetUsageRequest {} + +message ResetUsageResponse {}