From 519b18d868dcfbb1f85f477e3612ec749eea97ed Mon Sep 17 00:00:00 2001 From: "Laurie T. Malau" Date: Tue, 18 Oct 2022 11:18:57 +0000 Subject: [PATCH] [usage] Proto changes Stripe RPC --- components/usage-api/go/v1/billing.pb.go | 542 ++++++++++++++---- components/usage-api/go/v1/billing_grpc.pb.go | 76 +++ .../typescript/src/usage/v1/billing.pb.ts | 301 ++++++++++ components/usage-api/usage/v1/billing.proto | 28 + 4 files changed, 838 insertions(+), 109 deletions(-) diff --git a/components/usage-api/go/v1/billing.pb.go b/components/usage-api/go/v1/billing.pb.go index 05721729db2770..9da4a1cd7f500c 100644 --- a/components/usage-api/go/v1/billing.pb.go +++ b/components/usage-api/go/v1/billing.pb.go @@ -572,94 +572,358 @@ func (x *CreateStripeCustomerResponse) GetCustomer() *StripeCustomer { return nil } +type CreateStripeSubscriptionRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AttributionId string `protobuf:"bytes,1,opt,name=attribution_id,json=attributionId,proto3" json:"attribution_id,omitempty"` + StripeIntentId string `protobuf:"bytes,2,opt,name=stripe_intent_id,json=stripeIntentId,proto3" json:"stripe_intent_id,omitempty"` + UsageLimit int32 `protobuf:"varint,3,opt,name=usage_limit,json=usageLimit,proto3" json:"usage_limit,omitempty"` +} + +func (x *CreateStripeSubscriptionRequest) Reset() { + *x = CreateStripeSubscriptionRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_usage_v1_billing_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateStripeSubscriptionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateStripeSubscriptionRequest) ProtoMessage() {} + +func (x *CreateStripeSubscriptionRequest) ProtoReflect() protoreflect.Message { + mi := &file_usage_v1_billing_proto_msgTypes[11] + 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 CreateStripeSubscriptionRequest.ProtoReflect.Descriptor instead. +func (*CreateStripeSubscriptionRequest) Descriptor() ([]byte, []int) { + return file_usage_v1_billing_proto_rawDescGZIP(), []int{11} +} + +func (x *CreateStripeSubscriptionRequest) GetAttributionId() string { + if x != nil { + return x.AttributionId + } + return "" +} + +func (x *CreateStripeSubscriptionRequest) GetStripeIntentId() string { + if x != nil { + return x.StripeIntentId + } + return "" +} + +func (x *CreateStripeSubscriptionRequest) GetUsageLimit() int32 { + if x != nil { + return x.UsageLimit + } + return 0 +} + +type CreateStripeSubscriptionResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Customer *StripeCustomer `protobuf:"bytes,1,opt,name=customer,proto3" json:"customer,omitempty"` + CostCenter *CostCenter `protobuf:"bytes,2,opt,name=cost_center,json=costCenter,proto3" json:"cost_center,omitempty"` +} + +func (x *CreateStripeSubscriptionResponse) Reset() { + *x = CreateStripeSubscriptionResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_usage_v1_billing_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateStripeSubscriptionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateStripeSubscriptionResponse) ProtoMessage() {} + +func (x *CreateStripeSubscriptionResponse) ProtoReflect() protoreflect.Message { + mi := &file_usage_v1_billing_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateStripeSubscriptionResponse.ProtoReflect.Descriptor instead. +func (*CreateStripeSubscriptionResponse) Descriptor() ([]byte, []int) { + return file_usage_v1_billing_proto_rawDescGZIP(), []int{12} +} + +func (x *CreateStripeSubscriptionResponse) GetCustomer() *StripeCustomer { + if x != nil { + return x.Customer + } + return nil +} + +func (x *CreateStripeSubscriptionResponse) GetCostCenter() *CostCenter { + if x != nil { + return x.CostCenter + } + return nil +} + +type GetStripeSubscriptionRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AttributionId string `protobuf:"bytes,1,opt,name=attribution_id,json=attributionId,proto3" json:"attribution_id,omitempty"` + Status string `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"` +} + +func (x *GetStripeSubscriptionRequest) Reset() { + *x = GetStripeSubscriptionRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_usage_v1_billing_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetStripeSubscriptionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetStripeSubscriptionRequest) ProtoMessage() {} + +func (x *GetStripeSubscriptionRequest) ProtoReflect() protoreflect.Message { + mi := &file_usage_v1_billing_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetStripeSubscriptionRequest.ProtoReflect.Descriptor instead. +func (*GetStripeSubscriptionRequest) Descriptor() ([]byte, []int) { + return file_usage_v1_billing_proto_rawDescGZIP(), []int{13} +} + +func (x *GetStripeSubscriptionRequest) GetAttributionId() string { + if x != nil { + return x.AttributionId + } + return "" +} + +func (x *GetStripeSubscriptionRequest) GetStatus() string { + if x != nil { + return x.Status + } + return "" +} + +type GetStripeSubscriptionResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SubscriptionId string `protobuf:"bytes,1,opt,name=subscription_id,json=subscriptionId,proto3" json:"subscription_id,omitempty"` +} + +func (x *GetStripeSubscriptionResponse) Reset() { + *x = GetStripeSubscriptionResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_usage_v1_billing_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetStripeSubscriptionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetStripeSubscriptionResponse) ProtoMessage() {} + +func (x *GetStripeSubscriptionResponse) ProtoReflect() protoreflect.Message { + mi := &file_usage_v1_billing_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 GetStripeSubscriptionResponse.ProtoReflect.Descriptor instead. +func (*GetStripeSubscriptionResponse) Descriptor() ([]byte, []int) { + return file_usage_v1_billing_proto_rawDescGZIP(), []int{14} +} + +func (x *GetStripeSubscriptionResponse) GetSubscriptionId() string { + if x != nil { + return x.SubscriptionId + } + return "" +} + var File_usage_v1_billing_proto protoreflect.FileDescriptor var file_usage_v1_billing_proto_rawDesc = []byte{ 0x0a, 0x16, 0x75, 0x73, 0x61, 0x67, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x62, 0x69, 0x6c, 0x6c, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x75, 0x73, 0x61, 0x67, 0x65, 0x2e, - 0x76, 0x31, 0x22, 0x1a, 0x0a, 0x18, 0x52, 0x65, 0x63, 0x6f, 0x6e, 0x63, 0x69, 0x6c, 0x65, 0x49, - 0x6e, 0x76, 0x6f, 0x69, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x1b, - 0x0a, 0x19, 0x52, 0x65, 0x63, 0x6f, 0x6e, 0x63, 0x69, 0x6c, 0x65, 0x49, 0x6e, 0x76, 0x6f, 0x69, - 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x37, 0x0a, 0x16, 0x46, - 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x49, 0x6e, 0x76, 0x6f, 0x69, 0x63, 0x65, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x6e, 0x76, 0x6f, 0x69, 0x63, 0x65, - 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x69, 0x6e, 0x76, 0x6f, 0x69, - 0x63, 0x65, 0x49, 0x64, 0x22, 0x19, 0x0a, 0x17, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, - 0x49, 0x6e, 0x76, 0x6f, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x44, 0x0a, 0x19, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x0f, - 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0x1c, 0x0a, 0x1a, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x53, - 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x81, 0x01, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x53, 0x74, 0x72, 0x69, 0x70, - 0x65, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x27, 0x0a, 0x0e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x5f, - 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0d, 0x61, 0x74, 0x74, 0x72, - 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x2e, 0x0a, 0x12, 0x73, 0x74, 0x72, - 0x69, 0x70, 0x65, 0x5f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x10, 0x73, 0x74, 0x72, 0x69, 0x70, 0x65, 0x43, - 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x49, 0x64, 0x42, 0x0c, 0x0a, 0x0a, 0x69, 0x64, 0x65, - 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0x78, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x53, 0x74, - 0x72, 0x69, 0x70, 0x65, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a, 0x08, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x75, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, - 0x31, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x70, 0x65, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, - 0x52, 0x08, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x12, 0x25, 0x0a, 0x0e, 0x61, 0x74, - 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0d, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x49, - 0x64, 0x22, 0x20, 0x0a, 0x0e, 0x53, 0x74, 0x72, 0x69, 0x70, 0x65, 0x43, 0x75, 0x73, 0x74, 0x6f, - 0x6d, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x02, 0x69, 0x64, 0x22, 0x8a, 0x01, 0x0a, 0x1b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x74, - 0x72, 0x69, 0x70, 0x65, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, - 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x61, 0x74, 0x74, - 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, - 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, - 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, - 0x22, 0x54, 0x0a, 0x1c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x74, 0x72, 0x69, 0x70, 0x65, - 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x34, 0x0a, 0x08, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x75, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, - 0x72, 0x69, 0x70, 0x65, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x52, 0x08, 0x63, 0x75, - 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x32, 0xf6, 0x03, 0x0a, 0x0e, 0x42, 0x69, 0x6c, 0x6c, 0x69, - 0x6e, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x5e, 0x0a, 0x11, 0x52, 0x65, 0x63, - 0x6f, 0x6e, 0x63, 0x69, 0x6c, 0x65, 0x49, 0x6e, 0x76, 0x6f, 0x69, 0x63, 0x65, 0x73, 0x12, 0x22, - 0x2e, 0x75, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x63, 0x6f, 0x6e, 0x63, - 0x69, 0x6c, 0x65, 0x49, 0x6e, 0x76, 0x6f, 0x69, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x75, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, - 0x63, 0x6f, 0x6e, 0x63, 0x69, 0x6c, 0x65, 0x49, 0x6e, 0x76, 0x6f, 0x69, 0x63, 0x65, 0x73, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x58, 0x0a, 0x0f, 0x46, 0x69, 0x6e, - 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x49, 0x6e, 0x76, 0x6f, 0x69, 0x63, 0x65, 0x12, 0x20, 0x2e, 0x75, - 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, - 0x49, 0x6e, 0x76, 0x6f, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, - 0x2e, 0x75, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x69, - 0x7a, 0x65, 0x49, 0x6e, 0x76, 0x6f, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x00, 0x12, 0x61, 0x0a, 0x12, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x53, 0x75, 0x62, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x23, 0x2e, 0x75, 0x73, 0x61, 0x67, - 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x53, 0x75, 0x62, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, - 0x2e, 0x75, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, - 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x5e, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x53, 0x74, 0x72, - 0x69, 0x70, 0x65, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x12, 0x22, 0x2e, 0x75, 0x73, - 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x74, 0x72, 0x69, 0x70, 0x65, - 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x23, 0x2e, 0x75, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x74, - 0x72, 0x69, 0x70, 0x65, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x67, 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, - 0x53, 0x74, 0x72, 0x69, 0x70, 0x65, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x12, 0x25, - 0x2e, 0x75, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x76, 0x31, 0x1a, 0x14, 0x75, 0x73, 0x61, 0x67, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x61, + 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x1a, 0x0a, 0x18, 0x52, 0x65, 0x63, 0x6f, + 0x6e, 0x63, 0x69, 0x6c, 0x65, 0x49, 0x6e, 0x76, 0x6f, 0x69, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x22, 0x1b, 0x0a, 0x19, 0x52, 0x65, 0x63, 0x6f, 0x6e, 0x63, 0x69, 0x6c, + 0x65, 0x49, 0x6e, 0x76, 0x6f, 0x69, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x37, 0x0a, 0x16, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x49, 0x6e, 0x76, + 0x6f, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x69, + 0x6e, 0x76, 0x6f, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x09, 0x69, 0x6e, 0x76, 0x6f, 0x69, 0x63, 0x65, 0x49, 0x64, 0x22, 0x19, 0x0a, 0x17, 0x46, 0x69, + 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x49, 0x6e, 0x76, 0x6f, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x44, 0x0a, 0x19, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x53, + 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x27, 0x0a, 0x0f, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x73, 0x75, 0x62, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0x1c, 0x0a, 0x1a, 0x43, + 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x81, 0x01, 0x0a, 0x18, 0x47, 0x65, + 0x74, 0x53, 0x74, 0x72, 0x69, 0x70, 0x65, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x0e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, + 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, + 0x52, 0x0d, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, + 0x2e, 0x0a, 0x12, 0x73, 0x74, 0x72, 0x69, 0x70, 0x65, 0x5f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, + 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x10, 0x73, + 0x74, 0x72, 0x69, 0x70, 0x65, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x49, 0x64, 0x42, + 0x0c, 0x0a, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0x78, 0x0a, + 0x19, 0x47, 0x65, 0x74, 0x53, 0x74, 0x72, 0x69, 0x70, 0x65, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, + 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a, 0x08, 0x63, 0x75, + 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x75, + 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x70, 0x65, 0x43, 0x75, + 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x52, 0x08, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, + 0x12, 0x25, 0x0a, 0x0e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x5f, + 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, + 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0x20, 0x0a, 0x0e, 0x53, 0x74, 0x72, 0x69, 0x70, + 0x65, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x8a, 0x01, 0x0a, 0x1b, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x53, 0x74, 0x72, 0x69, 0x70, 0x65, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, + 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x61, 0x74, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0d, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, + 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x75, + 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x75, + 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x22, 0x54, 0x0a, 0x1c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x74, 0x72, 0x69, 0x70, 0x65, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x75, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a, 0x08, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, + 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x75, 0x73, 0x61, 0x67, 0x65, + 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x70, 0x65, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, + 0x65, 0x72, 0x52, 0x08, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x22, 0x93, 0x01, 0x0a, + 0x1f, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x74, 0x72, 0x69, 0x70, 0x65, 0x53, 0x75, 0x62, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x25, 0x0a, 0x0e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x5f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, + 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x28, 0x0a, 0x10, 0x73, 0x74, 0x72, 0x69, 0x70, + 0x65, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0e, 0x73, 0x74, 0x72, 0x69, 0x70, 0x65, 0x49, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x49, + 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x75, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x75, 0x73, 0x61, 0x67, 0x65, 0x4c, 0x69, 0x6d, + 0x69, 0x74, 0x22, 0x8f, 0x01, 0x0a, 0x20, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x74, 0x72, + 0x69, 0x70, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a, 0x08, 0x63, 0x75, 0x73, 0x74, 0x6f, + 0x6d, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x75, 0x73, 0x61, 0x67, + 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x70, 0x65, 0x43, 0x75, 0x73, 0x74, 0x6f, + 0x6d, 0x65, 0x72, 0x52, 0x08, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x12, 0x35, 0x0a, + 0x0b, 0x63, 0x6f, 0x73, 0x74, 0x5f, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x75, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, + 0x73, 0x74, 0x43, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x0a, 0x63, 0x6f, 0x73, 0x74, 0x43, 0x65, + 0x6e, 0x74, 0x65, 0x72, 0x22, 0x5d, 0x0a, 0x1c, 0x47, 0x65, 0x74, 0x53, 0x74, 0x72, 0x69, 0x70, + 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, + 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x61, 0x74, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x22, 0x48, 0x0a, 0x1d, 0x47, 0x65, 0x74, 0x53, 0x74, 0x72, 0x69, 0x70, 0x65, + 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x73, + 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x32, 0xd7, 0x05, + 0x0a, 0x0e, 0x42, 0x69, 0x6c, 0x6c, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x12, 0x5e, 0x0a, 0x11, 0x52, 0x65, 0x63, 0x6f, 0x6e, 0x63, 0x69, 0x6c, 0x65, 0x49, 0x6e, 0x76, + 0x6f, 0x69, 0x63, 0x65, 0x73, 0x12, 0x22, 0x2e, 0x75, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, + 0x2e, 0x52, 0x65, 0x63, 0x6f, 0x6e, 0x63, 0x69, 0x6c, 0x65, 0x49, 0x6e, 0x76, 0x6f, 0x69, 0x63, + 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x75, 0x73, 0x61, 0x67, + 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x63, 0x6f, 0x6e, 0x63, 0x69, 0x6c, 0x65, 0x49, 0x6e, + 0x76, 0x6f, 0x69, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, + 0x12, 0x58, 0x0a, 0x0f, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x49, 0x6e, 0x76, 0x6f, + 0x69, 0x63, 0x65, 0x12, 0x20, 0x2e, 0x75, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x46, + 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x49, 0x6e, 0x76, 0x6f, 0x69, 0x63, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x75, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, + 0x2e, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x49, 0x6e, 0x76, 0x6f, 0x69, 0x63, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x61, 0x0a, 0x12, 0x43, 0x61, + 0x6e, 0x63, 0x65, 0x6c, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x12, 0x23, 0x2e, 0x75, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x61, 0x6e, 0x63, + 0x65, 0x6c, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x75, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, + 0x2e, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x5e, 0x0a, + 0x11, 0x47, 0x65, 0x74, 0x53, 0x74, 0x72, 0x69, 0x70, 0x65, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, + 0x65, 0x72, 0x12, 0x22, 0x2e, 0x75, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, + 0x74, 0x53, 0x74, 0x72, 0x69, 0x70, 0x65, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x75, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, + 0x31, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x74, 0x72, 0x69, 0x70, 0x65, 0x43, 0x75, 0x73, 0x74, 0x6f, + 0x6d, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x67, 0x0a, + 0x14, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x74, 0x72, 0x69, 0x70, 0x65, 0x43, 0x75, 0x73, + 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x12, 0x25, 0x2e, 0x75, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x74, 0x72, 0x69, 0x70, 0x65, 0x43, 0x75, 0x73, - 0x74, 0x6f, 0x6d, 0x65, 0x72, 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, + 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x75, + 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x74, + 0x72, 0x69, 0x70, 0x65, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x73, 0x0a, 0x18, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x53, 0x74, 0x72, 0x69, 0x70, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x29, 0x2e, 0x75, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x53, 0x74, 0x72, 0x69, 0x70, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, + 0x75, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, + 0x74, 0x72, 0x69, 0x70, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x6a, 0x0a, 0x15, 0x47, + 0x65, 0x74, 0x53, 0x74, 0x72, 0x69, 0x70, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x26, 0x2e, 0x75, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, + 0x47, 0x65, 0x74, 0x53, 0x74, 0x72, 0x69, 0x70, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x75, + 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x74, 0x72, 0x69, 0x70, + 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 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 ( @@ -674,38 +938,49 @@ func file_usage_v1_billing_proto_rawDescGZIP() []byte { return file_usage_v1_billing_proto_rawDescData } -var file_usage_v1_billing_proto_msgTypes = make([]protoimpl.MessageInfo, 11) +var file_usage_v1_billing_proto_msgTypes = make([]protoimpl.MessageInfo, 15) var file_usage_v1_billing_proto_goTypes = []interface{}{ - (*ReconcileInvoicesRequest)(nil), // 0: usage.v1.ReconcileInvoicesRequest - (*ReconcileInvoicesResponse)(nil), // 1: usage.v1.ReconcileInvoicesResponse - (*FinalizeInvoiceRequest)(nil), // 2: usage.v1.FinalizeInvoiceRequest - (*FinalizeInvoiceResponse)(nil), // 3: usage.v1.FinalizeInvoiceResponse - (*CancelSubscriptionRequest)(nil), // 4: usage.v1.CancelSubscriptionRequest - (*CancelSubscriptionResponse)(nil), // 5: usage.v1.CancelSubscriptionResponse - (*GetStripeCustomerRequest)(nil), // 6: usage.v1.GetStripeCustomerRequest - (*GetStripeCustomerResponse)(nil), // 7: usage.v1.GetStripeCustomerResponse - (*StripeCustomer)(nil), // 8: usage.v1.StripeCustomer - (*CreateStripeCustomerRequest)(nil), // 9: usage.v1.CreateStripeCustomerRequest - (*CreateStripeCustomerResponse)(nil), // 10: usage.v1.CreateStripeCustomerResponse + (*ReconcileInvoicesRequest)(nil), // 0: usage.v1.ReconcileInvoicesRequest + (*ReconcileInvoicesResponse)(nil), // 1: usage.v1.ReconcileInvoicesResponse + (*FinalizeInvoiceRequest)(nil), // 2: usage.v1.FinalizeInvoiceRequest + (*FinalizeInvoiceResponse)(nil), // 3: usage.v1.FinalizeInvoiceResponse + (*CancelSubscriptionRequest)(nil), // 4: usage.v1.CancelSubscriptionRequest + (*CancelSubscriptionResponse)(nil), // 5: usage.v1.CancelSubscriptionResponse + (*GetStripeCustomerRequest)(nil), // 6: usage.v1.GetStripeCustomerRequest + (*GetStripeCustomerResponse)(nil), // 7: usage.v1.GetStripeCustomerResponse + (*StripeCustomer)(nil), // 8: usage.v1.StripeCustomer + (*CreateStripeCustomerRequest)(nil), // 9: usage.v1.CreateStripeCustomerRequest + (*CreateStripeCustomerResponse)(nil), // 10: usage.v1.CreateStripeCustomerResponse + (*CreateStripeSubscriptionRequest)(nil), // 11: usage.v1.CreateStripeSubscriptionRequest + (*CreateStripeSubscriptionResponse)(nil), // 12: usage.v1.CreateStripeSubscriptionResponse + (*GetStripeSubscriptionRequest)(nil), // 13: usage.v1.GetStripeSubscriptionRequest + (*GetStripeSubscriptionResponse)(nil), // 14: usage.v1.GetStripeSubscriptionResponse + (*CostCenter)(nil), // 15: usage.v1.CostCenter } var file_usage_v1_billing_proto_depIdxs = []int32{ 8, // 0: usage.v1.GetStripeCustomerResponse.customer:type_name -> usage.v1.StripeCustomer 8, // 1: usage.v1.CreateStripeCustomerResponse.customer:type_name -> usage.v1.StripeCustomer - 0, // 2: usage.v1.BillingService.ReconcileInvoices:input_type -> usage.v1.ReconcileInvoicesRequest - 2, // 3: usage.v1.BillingService.FinalizeInvoice:input_type -> usage.v1.FinalizeInvoiceRequest - 4, // 4: usage.v1.BillingService.CancelSubscription:input_type -> usage.v1.CancelSubscriptionRequest - 6, // 5: usage.v1.BillingService.GetStripeCustomer:input_type -> usage.v1.GetStripeCustomerRequest - 9, // 6: usage.v1.BillingService.CreateStripeCustomer:input_type -> usage.v1.CreateStripeCustomerRequest - 1, // 7: usage.v1.BillingService.ReconcileInvoices:output_type -> usage.v1.ReconcileInvoicesResponse - 3, // 8: usage.v1.BillingService.FinalizeInvoice:output_type -> usage.v1.FinalizeInvoiceResponse - 5, // 9: usage.v1.BillingService.CancelSubscription:output_type -> usage.v1.CancelSubscriptionResponse - 7, // 10: usage.v1.BillingService.GetStripeCustomer:output_type -> usage.v1.GetStripeCustomerResponse - 10, // 11: usage.v1.BillingService.CreateStripeCustomer:output_type -> usage.v1.CreateStripeCustomerResponse - 7, // [7:12] is the sub-list for method output_type - 2, // [2:7] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name + 8, // 2: usage.v1.CreateStripeSubscriptionResponse.customer:type_name -> usage.v1.StripeCustomer + 15, // 3: usage.v1.CreateStripeSubscriptionResponse.cost_center:type_name -> usage.v1.CostCenter + 0, // 4: usage.v1.BillingService.ReconcileInvoices:input_type -> usage.v1.ReconcileInvoicesRequest + 2, // 5: usage.v1.BillingService.FinalizeInvoice:input_type -> usage.v1.FinalizeInvoiceRequest + 4, // 6: usage.v1.BillingService.CancelSubscription:input_type -> usage.v1.CancelSubscriptionRequest + 6, // 7: usage.v1.BillingService.GetStripeCustomer:input_type -> usage.v1.GetStripeCustomerRequest + 9, // 8: usage.v1.BillingService.CreateStripeCustomer:input_type -> usage.v1.CreateStripeCustomerRequest + 11, // 9: usage.v1.BillingService.CreateStripeSubscription:input_type -> usage.v1.CreateStripeSubscriptionRequest + 13, // 10: usage.v1.BillingService.GetStripeSubscription:input_type -> usage.v1.GetStripeSubscriptionRequest + 1, // 11: usage.v1.BillingService.ReconcileInvoices:output_type -> usage.v1.ReconcileInvoicesResponse + 3, // 12: usage.v1.BillingService.FinalizeInvoice:output_type -> usage.v1.FinalizeInvoiceResponse + 5, // 13: usage.v1.BillingService.CancelSubscription:output_type -> usage.v1.CancelSubscriptionResponse + 7, // 14: usage.v1.BillingService.GetStripeCustomer:output_type -> usage.v1.GetStripeCustomerResponse + 10, // 15: usage.v1.BillingService.CreateStripeCustomer:output_type -> usage.v1.CreateStripeCustomerResponse + 12, // 16: usage.v1.BillingService.CreateStripeSubscription:output_type -> usage.v1.CreateStripeSubscriptionResponse + 14, // 17: usage.v1.BillingService.GetStripeSubscription:output_type -> usage.v1.GetStripeSubscriptionResponse + 11, // [11:18] is the sub-list for method output_type + 4, // [4:11] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name } func init() { file_usage_v1_billing_proto_init() } @@ -713,6 +988,7 @@ func file_usage_v1_billing_proto_init() { if File_usage_v1_billing_proto != nil { return } + file_usage_v1_usage_proto_init() if !protoimpl.UnsafeEnabled { file_usage_v1_billing_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ReconcileInvoicesRequest); i { @@ -846,6 +1122,54 @@ func file_usage_v1_billing_proto_init() { return nil } } + file_usage_v1_billing_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateStripeSubscriptionRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_usage_v1_billing_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateStripeSubscriptionResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_usage_v1_billing_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetStripeSubscriptionRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_usage_v1_billing_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetStripeSubscriptionResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } file_usage_v1_billing_proto_msgTypes[6].OneofWrappers = []interface{}{ (*GetStripeCustomerRequest_AttributionId)(nil), @@ -857,7 +1181,7 @@ func file_usage_v1_billing_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_usage_v1_billing_proto_rawDesc, NumEnums: 0, - NumMessages: 11, + NumMessages: 15, NumExtensions: 0, NumServices: 1, }, diff --git a/components/usage-api/go/v1/billing_grpc.pb.go b/components/usage-api/go/v1/billing_grpc.pb.go index f5509e06f1b6a1..5524a5a51af12d 100644 --- a/components/usage-api/go/v1/billing_grpc.pb.go +++ b/components/usage-api/go/v1/billing_grpc.pb.go @@ -38,6 +38,10 @@ type BillingServiceClient interface { // GetStripeCustomer retrieves a Stripe Customer GetStripeCustomer(ctx context.Context, in *GetStripeCustomerRequest, opts ...grpc.CallOption) (*GetStripeCustomerResponse, error) CreateStripeCustomer(ctx context.Context, in *CreateStripeCustomerRequest, opts ...grpc.CallOption) (*CreateStripeCustomerResponse, error) + CreateStripeSubscription(ctx context.Context, in *CreateStripeSubscriptionRequest, opts ...grpc.CallOption) (*CreateStripeSubscriptionResponse, error) + // GetStripeSubscription without passing in the `status` will return uncancelled subscriptions + // Stripe returns a list which may include more than one, but we will throw an error in that case + GetStripeSubscription(ctx context.Context, in *GetStripeSubscriptionRequest, opts ...grpc.CallOption) (*GetStripeSubscriptionResponse, error) } type billingServiceClient struct { @@ -93,6 +97,24 @@ func (c *billingServiceClient) CreateStripeCustomer(ctx context.Context, in *Cre return out, nil } +func (c *billingServiceClient) CreateStripeSubscription(ctx context.Context, in *CreateStripeSubscriptionRequest, opts ...grpc.CallOption) (*CreateStripeSubscriptionResponse, error) { + out := new(CreateStripeSubscriptionResponse) + err := c.cc.Invoke(ctx, "/usage.v1.BillingService/CreateStripeSubscription", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *billingServiceClient) GetStripeSubscription(ctx context.Context, in *GetStripeSubscriptionRequest, opts ...grpc.CallOption) (*GetStripeSubscriptionResponse, error) { + out := new(GetStripeSubscriptionResponse) + err := c.cc.Invoke(ctx, "/usage.v1.BillingService/GetStripeSubscription", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // BillingServiceServer is the server API for BillingService service. // All implementations must embed UnimplementedBillingServiceServer // for forward compatibility @@ -109,6 +131,10 @@ type BillingServiceServer interface { // GetStripeCustomer retrieves a Stripe Customer GetStripeCustomer(context.Context, *GetStripeCustomerRequest) (*GetStripeCustomerResponse, error) CreateStripeCustomer(context.Context, *CreateStripeCustomerRequest) (*CreateStripeCustomerResponse, error) + CreateStripeSubscription(context.Context, *CreateStripeSubscriptionRequest) (*CreateStripeSubscriptionResponse, error) + // GetStripeSubscription without passing in the `status` will return uncancelled subscriptions + // Stripe returns a list which may include more than one, but we will throw an error in that case + GetStripeSubscription(context.Context, *GetStripeSubscriptionRequest) (*GetStripeSubscriptionResponse, error) mustEmbedUnimplementedBillingServiceServer() } @@ -131,6 +157,12 @@ func (UnimplementedBillingServiceServer) GetStripeCustomer(context.Context, *Get func (UnimplementedBillingServiceServer) CreateStripeCustomer(context.Context, *CreateStripeCustomerRequest) (*CreateStripeCustomerResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CreateStripeCustomer not implemented") } +func (UnimplementedBillingServiceServer) CreateStripeSubscription(context.Context, *CreateStripeSubscriptionRequest) (*CreateStripeSubscriptionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateStripeSubscription not implemented") +} +func (UnimplementedBillingServiceServer) GetStripeSubscription(context.Context, *GetStripeSubscriptionRequest) (*GetStripeSubscriptionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetStripeSubscription not implemented") +} func (UnimplementedBillingServiceServer) mustEmbedUnimplementedBillingServiceServer() {} // UnsafeBillingServiceServer may be embedded to opt out of forward compatibility for this service. @@ -234,6 +266,42 @@ func _BillingService_CreateStripeCustomer_Handler(srv interface{}, ctx context.C return interceptor(ctx, in, info, handler) } +func _BillingService_CreateStripeSubscription_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateStripeSubscriptionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BillingServiceServer).CreateStripeSubscription(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/usage.v1.BillingService/CreateStripeSubscription", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BillingServiceServer).CreateStripeSubscription(ctx, req.(*CreateStripeSubscriptionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _BillingService_GetStripeSubscription_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetStripeSubscriptionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BillingServiceServer).GetStripeSubscription(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/usage.v1.BillingService/GetStripeSubscription", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BillingServiceServer).GetStripeSubscription(ctx, req.(*GetStripeSubscriptionRequest)) + } + return interceptor(ctx, in, info, handler) +} + // BillingService_ServiceDesc is the grpc.ServiceDesc for BillingService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -261,6 +329,14 @@ var BillingService_ServiceDesc = grpc.ServiceDesc{ MethodName: "CreateStripeCustomer", Handler: _BillingService_CreateStripeCustomer_Handler, }, + { + MethodName: "CreateStripeSubscription", + Handler: _BillingService_CreateStripeSubscription_Handler, + }, + { + MethodName: "GetStripeSubscription", + Handler: _BillingService_GetStripeSubscription_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "usage/v1/billing.proto", diff --git a/components/usage-api/typescript/src/usage/v1/billing.pb.ts b/components/usage-api/typescript/src/usage/v1/billing.pb.ts index 0f314ccd079ff7..37d503780e604c 100644 --- a/components/usage-api/typescript/src/usage/v1/billing.pb.ts +++ b/components/usage-api/typescript/src/usage/v1/billing.pb.ts @@ -7,6 +7,7 @@ /* eslint-disable */ import { CallContext, CallOptions } from "nice-grpc-common"; import * as _m0 from "protobufjs/minimal"; +import { CostCenter } from "./usage.pb"; export const protobufPackage = "usage.v1"; @@ -56,6 +57,26 @@ export interface CreateStripeCustomerResponse { customer: StripeCustomer | undefined; } +export interface CreateStripeSubscriptionRequest { + attributionId: string; + stripeIntentId: string; + usageLimit: number; +} + +export interface CreateStripeSubscriptionResponse { + customer: StripeCustomer | undefined; + costCenter: CostCenter | undefined; +} + +export interface GetStripeSubscriptionRequest { + attributionId: string; + status: string; +} + +export interface GetStripeSubscriptionResponse { + subscriptionId: string; +} + function createBaseReconcileInvoicesRequest(): ReconcileInvoicesRequest { return {}; } @@ -598,6 +619,242 @@ export const CreateStripeCustomerResponse = { }, }; +function createBaseCreateStripeSubscriptionRequest(): CreateStripeSubscriptionRequest { + return { attributionId: "", stripeIntentId: "", usageLimit: 0 }; +} + +export const CreateStripeSubscriptionRequest = { + encode(message: CreateStripeSubscriptionRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.attributionId !== "") { + writer.uint32(10).string(message.attributionId); + } + if (message.stripeIntentId !== "") { + writer.uint32(18).string(message.stripeIntentId); + } + if (message.usageLimit !== 0) { + writer.uint32(24).int32(message.usageLimit); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CreateStripeSubscriptionRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreateStripeSubscriptionRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.attributionId = reader.string(); + break; + case 2: + message.stripeIntentId = reader.string(); + break; + case 3: + message.usageLimit = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): CreateStripeSubscriptionRequest { + return { + attributionId: isSet(object.attributionId) ? String(object.attributionId) : "", + stripeIntentId: isSet(object.stripeIntentId) ? String(object.stripeIntentId) : "", + usageLimit: isSet(object.usageLimit) ? Number(object.usageLimit) : 0, + }; + }, + + toJSON(message: CreateStripeSubscriptionRequest): unknown { + const obj: any = {}; + message.attributionId !== undefined && (obj.attributionId = message.attributionId); + message.stripeIntentId !== undefined && (obj.stripeIntentId = message.stripeIntentId); + message.usageLimit !== undefined && (obj.usageLimit = Math.round(message.usageLimit)); + return obj; + }, + + fromPartial(object: DeepPartial): CreateStripeSubscriptionRequest { + const message = createBaseCreateStripeSubscriptionRequest(); + message.attributionId = object.attributionId ?? ""; + message.stripeIntentId = object.stripeIntentId ?? ""; + message.usageLimit = object.usageLimit ?? 0; + return message; + }, +}; + +function createBaseCreateStripeSubscriptionResponse(): CreateStripeSubscriptionResponse { + return { customer: undefined, costCenter: undefined }; +} + +export const CreateStripeSubscriptionResponse = { + encode(message: CreateStripeSubscriptionResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.customer !== undefined) { + StripeCustomer.encode(message.customer, writer.uint32(10).fork()).ldelim(); + } + if (message.costCenter !== undefined) { + CostCenter.encode(message.costCenter, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CreateStripeSubscriptionResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreateStripeSubscriptionResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.customer = StripeCustomer.decode(reader, reader.uint32()); + break; + case 2: + message.costCenter = CostCenter.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): CreateStripeSubscriptionResponse { + return { + customer: isSet(object.customer) ? StripeCustomer.fromJSON(object.customer) : undefined, + costCenter: isSet(object.costCenter) ? CostCenter.fromJSON(object.costCenter) : undefined, + }; + }, + + toJSON(message: CreateStripeSubscriptionResponse): unknown { + const obj: any = {}; + message.customer !== undefined && + (obj.customer = message.customer ? StripeCustomer.toJSON(message.customer) : undefined); + message.costCenter !== undefined && + (obj.costCenter = message.costCenter ? CostCenter.toJSON(message.costCenter) : undefined); + return obj; + }, + + fromPartial(object: DeepPartial): CreateStripeSubscriptionResponse { + const message = createBaseCreateStripeSubscriptionResponse(); + message.customer = (object.customer !== undefined && object.customer !== null) + ? StripeCustomer.fromPartial(object.customer) + : undefined; + message.costCenter = (object.costCenter !== undefined && object.costCenter !== null) + ? CostCenter.fromPartial(object.costCenter) + : undefined; + return message; + }, +}; + +function createBaseGetStripeSubscriptionRequest(): GetStripeSubscriptionRequest { + return { attributionId: "", status: "" }; +} + +export const GetStripeSubscriptionRequest = { + encode(message: GetStripeSubscriptionRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.attributionId !== "") { + writer.uint32(10).string(message.attributionId); + } + if (message.status !== "") { + writer.uint32(18).string(message.status); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetStripeSubscriptionRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetStripeSubscriptionRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.attributionId = reader.string(); + break; + case 2: + message.status = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GetStripeSubscriptionRequest { + return { + attributionId: isSet(object.attributionId) ? String(object.attributionId) : "", + status: isSet(object.status) ? String(object.status) : "", + }; + }, + + toJSON(message: GetStripeSubscriptionRequest): unknown { + const obj: any = {}; + message.attributionId !== undefined && (obj.attributionId = message.attributionId); + message.status !== undefined && (obj.status = message.status); + return obj; + }, + + fromPartial(object: DeepPartial): GetStripeSubscriptionRequest { + const message = createBaseGetStripeSubscriptionRequest(); + message.attributionId = object.attributionId ?? ""; + message.status = object.status ?? ""; + return message; + }, +}; + +function createBaseGetStripeSubscriptionResponse(): GetStripeSubscriptionResponse { + return { subscriptionId: "" }; +} + +export const GetStripeSubscriptionResponse = { + encode(message: GetStripeSubscriptionResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.subscriptionId !== "") { + writer.uint32(10).string(message.subscriptionId); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetStripeSubscriptionResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetStripeSubscriptionResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.subscriptionId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GetStripeSubscriptionResponse { + return { subscriptionId: isSet(object.subscriptionId) ? String(object.subscriptionId) : "" }; + }, + + toJSON(message: GetStripeSubscriptionResponse): unknown { + const obj: any = {}; + message.subscriptionId !== undefined && (obj.subscriptionId = message.subscriptionId); + return obj; + }, + + fromPartial(object: DeepPartial): GetStripeSubscriptionResponse { + const message = createBaseGetStripeSubscriptionResponse(); + message.subscriptionId = object.subscriptionId ?? ""; + return message; + }, +}; + export type BillingServiceDefinition = typeof BillingServiceDefinition; export const BillingServiceDefinition = { name: "BillingService", @@ -656,6 +913,26 @@ export const BillingServiceDefinition = { responseStream: false, options: {}, }, + createStripeSubscription: { + name: "CreateStripeSubscription", + requestType: CreateStripeSubscriptionRequest, + requestStream: false, + responseType: CreateStripeSubscriptionResponse, + responseStream: false, + options: {}, + }, + /** + * GetStripeSubscription without passing in the `status` will return uncancelled subscriptions + * Stripe returns a list which may include more than one, but we will throw an error in that case + */ + getStripeSubscription: { + name: "GetStripeSubscription", + requestType: GetStripeSubscriptionRequest, + requestStream: false, + responseType: GetStripeSubscriptionResponse, + responseStream: false, + options: {}, + }, }, } as const; @@ -693,6 +970,18 @@ export interface BillingServiceServiceImplementation { request: CreateStripeCustomerRequest, context: CallContext & CallContextExt, ): Promise>; + createStripeSubscription( + request: CreateStripeSubscriptionRequest, + context: CallContext & CallContextExt, + ): Promise>; + /** + * GetStripeSubscription without passing in the `status` will return uncancelled subscriptions + * Stripe returns a list which may include more than one, but we will throw an error in that case + */ + getStripeSubscription( + request: GetStripeSubscriptionRequest, + context: CallContext & CallContextExt, + ): Promise>; } export interface BillingServiceClient { @@ -729,6 +1018,18 @@ export interface BillingServiceClient { request: DeepPartial, options?: CallOptions & CallOptionsExt, ): Promise; + createStripeSubscription( + request: DeepPartial, + options?: CallOptions & CallOptionsExt, + ): Promise; + /** + * GetStripeSubscription without passing in the `status` will return uncancelled subscriptions + * Stripe returns a list which may include more than one, but we will throw an error in that case + */ + getStripeSubscription( + request: DeepPartial, + options?: CallOptions & CallOptionsExt, + ): Promise; } export interface DataLoaderOptions { diff --git a/components/usage-api/usage/v1/billing.proto b/components/usage-api/usage/v1/billing.proto index 3d668a78d764b7..bc46a222bcd5ec 100644 --- a/components/usage-api/usage/v1/billing.proto +++ b/components/usage-api/usage/v1/billing.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package usage.v1; +import "usage/v1/usage.proto"; + option go_package = "github.com/gitpod-io/gitpod/usage-api/v1"; service BillingService { @@ -22,6 +24,11 @@ service BillingService { rpc CreateStripeCustomer(CreateStripeCustomerRequest) returns (CreateStripeCustomerResponse) {}; + rpc CreateStripeSubscription(CreateStripeSubscriptionRequest) returns (CreateStripeSubscriptionResponse) {}; + + // GetStripeSubscription without passing in the `status` will return uncancelled subscriptions + // Stripe returns a list which may include more than one, but we will throw an error in that case + rpc GetStripeSubscription(GetStripeSubscriptionRequest) returns (GetStripeSubscriptionResponse) {}; } message ReconcileInvoicesRequest {} @@ -70,3 +77,24 @@ message CreateStripeCustomerRequest { message CreateStripeCustomerResponse { StripeCustomer customer = 1; } + +message CreateStripeSubscriptionRequest { + string attribution_id = 1; + string stripe_intent_id = 2; + + int32 usage_limit = 3; +} + +message CreateStripeSubscriptionResponse { + StripeCustomer customer = 1; + v1.CostCenter cost_center = 2; +} + +message GetStripeSubscriptionRequest { + string attribution_id = 1; + string status = 2; +} + +message GetStripeSubscriptionResponse { + string subscription_id = 1; +}