Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: plan proto (#16457)

Danny Xu72b8d0b18b1e
diff --git a/backend/enterprise/api/limit.go b/backend/enterprise/api/limit.go
index b8366e8f7f..8ba0a3caf0 100644
--- a/backend/enterprise/api/limit.go
+++ b/backend/enterprise/api/limit.go
@@ -2,10 +2,13 @@ package api
import (
_ "embed"
+ "encoding/json"
+ "google.golang.org/protobuf/encoding/protojson"
"gopkg.in/yaml.v3"
"github.com/bytebase/bytebase/backend/base"
+ v1pb "github.com/bytebase/bytebase/proto/generated-go/v1"
)
//go:embed plan.yaml
@@ -27,22 +30,41 @@ var PlanLimitValues = map[PlanLimit]map[base.PlanType]int{
PlanLimitMaximumUser: {},
}
-type planLimitConfig struct {
- Type base.PlanType `yaml:"type"`
- MaximumInstanceCount int `yaml:"maximumInstanceCount"`
- MaximumSeatCount int `yaml:"maximumSeatCount"`
-}
+func init() {
+ // First unmarshal YAML to a generic map, then convert to JSON for protojson
+ var yamlData map[string]any
+ if err := yaml.Unmarshal([]byte(planConfigStr), &yamlData); err != nil {
+ panic("failed to unmarshal plan.yaml: " + err.Error())
+ }
-type planConfg struct {
- PlanList []*planLimitConfig `yaml:"planList"`
-}
+ // Convert YAML data to JSON bytes
+ jsonBytes, err := json.Marshal(yamlData)
+ if err != nil {
+ panic("failed to convert plan.yaml to JSON: " + err.Error())
+ }
-func init() {
- conf := &planConfg{}
- _ = yaml.Unmarshal([]byte(planConfigStr), conf)
+ conf := &v1pb.PlanConfig{}
+ //nolint:forbidigo
+ if err := protojson.Unmarshal(jsonBytes, conf); err != nil {
+ panic("failed to unmarshal plan config proto: " + err.Error())
+ }
+
+ for _, planLimit := range conf.Plans {
+ planType := convertProtoPlanType(planLimit.Type)
+ PlanLimitValues[PlanLimitMaximumInstance][planType] = int(planLimit.MaximumInstanceCount)
+ PlanLimitValues[PlanLimitMaximumUser][planType] = int(planLimit.MaximumSeatCount)
+ }
+}
- for _, limitConfig := range conf.PlanList {
- PlanLimitValues[PlanLimitMaximumInstance][limitConfig.Type] = limitConfig.MaximumInstanceCount
- PlanLimitValues[PlanLimitMaximumUser][limitConfig.Type] = limitConfig.MaximumSeatCount
+func convertProtoPlanType(protoPlanType v1pb.PlanType) base.PlanType {
+ switch protoPlanType {
+ case v1pb.PlanType_FREE:
+ return base.FREE
+ case v1pb.PlanType_TEAM:
+ return base.TEAM
+ case v1pb.PlanType_ENTERPRISE:
+ return base.ENTERPRISE
+ default:
+ return base.FREE
}
}
diff --git a/backend/enterprise/api/plan.yaml b/backend/enterprise/api/plan.yaml
index e739faff88..8df647fe16 100644
--- a/backend/enterprise/api/plan.yaml
+++ b/backend/enterprise/api/plan.yaml
@@ -1,10 +1,10 @@
-planList:
- - type: 0
- maximumInstanceCount: 10
- maximumSeatCount: 20
+plans:
- type: 1
- maximumInstanceCount: 10
- maximumSeatCount: 20
+ maximum_instance_count: 10
+ maximum_seat_count: 20
- type: 2
- maximumInstanceCount: -1
- maximumSeatCount: -1
\ No newline at end of file
+ maximum_instance_count: 10
+ maximum_seat_count: 20
+ - type: 3
+ maximum_instance_count: -1
+ maximum_seat_count: -1
\ No newline at end of file
diff --git a/frontend/src/types/plan.ts b/frontend/src/types/plan.ts
index 3c6fbd4a77..64c80ef2a5 100644
--- a/frontend/src/types/plan.ts
+++ b/frontend/src/types/plan.ts
@@ -1,6 +1,7 @@
import {
PlanType,
- planTypeFromJSON,
+ type PlanConfig,
+ type PlanLimitConfig,
} from "@/types/proto/v1/subscription_service";
import planData from "./plan.yaml";
@@ -73,14 +74,8 @@ export const planTypeToString = (planType: PlanType): string => {
}
};
-export interface Plan {
- type: PlanType;
- maximumSeatCount: number;
- maximumInstanceCount: number;
-}
+// Re-export proto types for convenience
+export type { PlanConfig, PlanLimitConfig };
-export const PLANS: Plan[] = planData.planList.map((raw: any) => ({
- type: planTypeFromJSON(raw.type + 1),
- maximumSeatCount: raw.maximumSeatCount,
- maximumInstanceCount: raw.maximumInstanceCount,
-}));
+export const PLAN_CONFIG: PlanConfig = planData;
+export const PLANS: PlanLimitConfig[] = planData.plans;
diff --git a/frontend/src/types/proto/v1/subscription_service.ts b/frontend/src/types/proto/v1/subscription_service.ts
index e6d66d7a01..81bee8f786 100644
--- a/frontend/src/types/proto/v1/subscription_service.ts
+++ b/frontend/src/types/proto/v1/subscription_service.ts
@@ -113,6 +113,18 @@ export interface Feature_MatrixEntry {
value: boolean;
}
+/** PlanConfig represents the configuration for all plans loaded from plan.yaml */
+export interface PlanConfig {
+ plans: PlanLimitConfig[];
+}
+
+/** PlanLimitConfig represents a single plan's configuration */
+export interface PlanLimitConfig {
+ type: PlanType;
+ maximumInstanceCount: number;
+ maximumSeatCount: number;
+}
+
function createBaseGetSubscriptionRequest(): GetSubscriptionRequest {
return {};
}
@@ -679,6 +691,144 @@ export const Feature_MatrixEntry: MessageFns<Feature_MatrixEntry> = {
},
};
+function createBasePlanConfig(): PlanConfig {
+ return { plans: [] };
+}
+
+export const PlanConfig: MessageFns<PlanConfig> = {
+ encode(message: PlanConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
+ for (const v of message.plans) {
+ PlanLimitConfig.encode(v!, writer.uint32(10).fork()).join();
+ }
+ return writer;
+ },
+
+ decode(input: BinaryReader | Uint8Array, length?: number): PlanConfig {
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBasePlanConfig();
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1: {
+ if (tag !== 10) {
+ break;
+ }
+
+ message.plans.push(PlanLimitConfig.decode(reader, reader.uint32()));
+ continue;
+ }
+ }
+ if ((tag & 7) === 4 || tag === 0) {
+ break;
+ }
+ reader.skip(tag & 7);
+ }
+ return message;
+ },
+
+ toJSON(message: PlanConfig): unknown {
+ const obj: any = {};
+ if (message.plans?.length) {
+ obj.plans = message.plans.map((e) => PlanLimitConfig.toJSON(e));
+ }
+ return obj;
+ },
+
+ create(base?: DeepPartial<PlanConfig>): PlanConfig {
+ return PlanConfig.fromPartial(base ?? {});
+ },
+ fromPartial(object: DeepPartial<PlanConfig>): PlanConfig {
+ const message = createBasePlanConfig();
+ message.plans = object.plans?.map((e) => PlanLimitConfig.fromPartial(e)) || [];
+ return message;
+ },
+};
+
+function createBasePlanLimitConfig(): PlanLimitConfig {
+ return { type: PlanType.PLAN_TYPE_UNSPECIFIED, maximumInstanceCount: 0, maximumSeatCount: 0 };
+}
+
+export const PlanLimitConfig: MessageFns<PlanLimitConfig> = {
+ encode(message: PlanLimitConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
+ if (message.type !== PlanType.PLAN_TYPE_UNSPECIFIED) {
+ writer.uint32(8).int32(planTypeToNumber(message.type));
+ }
+ if (message.maximumInstanceCount !== 0) {
+ writer.uint32(16).int32(message.maximumInstanceCount);
+ }
+ if (message.maximumSeatCount !== 0) {
+ writer.uint32(24).int32(message.maximumSeatCount);
+ }
+ return writer;
+ },
+
+ decode(input: BinaryReader | Uint8Array, length?: number): PlanLimitConfig {
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBasePlanLimitConfig();
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1: {
+ if (tag !== 8) {
+ break;
+ }
+
+ message.type = planTypeFromJSON(reader.int32());
+ continue;
+ }
+ case 2: {
+ if (tag !== 16) {
+ break;
+ }
+
+ message.maximumInstanceCount = reader.int32();
+ continue;
+ }
+ case 3: {
+ if (tag !== 24) {
+ break;
+ }
+
+ message.maximumSeatCount = reader.int32();
+ continue;
+ }
+ }
+ if ((tag & 7) === 4 || tag === 0) {
+ break;
+ }
+ reader.skip(tag & 7);
+ }
+ return message;
+ },
+
+ toJSON(message: PlanLimitConfig): unknown {
+ const obj: any = {};
+ if (message.type !== PlanType.PLAN_TYPE_UNSPECIFIED) {
+ obj.type = planTypeToJSON(message.type);
+ }
+ if (message.maximumInstanceCount !== 0) {
+ obj.maximumInstanceCount = Math.round(message.maximumInstanceCount);
+ }
+ if (message.maximumSeatCount !== 0) {
+ obj.maximumSeatCount = Math.round(message.maximumSeatCount);
+ }
+ return obj;
+ },
+
+ create(base?: DeepPartial<PlanLimitConfig>): PlanLimitConfig {
+ return PlanLimitConfig.fromPartial(base ?? {});
+ },
+ fromPartial(object: DeepPartial<PlanLimitConfig>): PlanLimitConfig {
+ const message = createBasePlanLimitConfig();
+ message.type = object.type ?? PlanType.PLAN_TYPE_UNSPECIFIED;
+ message.maximumInstanceCount = object.maximumInstanceCount ?? 0;
+ message.maximumSeatCount = object.maximumSeatCount ?? 0;
+ return message;
+ },
+};
+
export type SubscriptionServiceDefinition = typeof SubscriptionServiceDefinition;
export const SubscriptionServiceDefinition = {
name: "SubscriptionService",
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index aa11d1b279..c3ef33a299 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -212,6 +212,8 @@
- [GetFeatureMatrixRequest](#bytebase-v1-GetFeatureMatrixRequest)
- [GetSubscriptionRequest](#bytebase-v1-GetSubscriptionRequest)
- [PatchSubscription](#bytebase-v1-PatchSubscription)
+ - [PlanConfig](#bytebase-v1-PlanConfig)
+ - [PlanLimitConfig](#bytebase-v1-PlanLimitConfig)
- [Subscription](#bytebase-v1-Subscription)
- [UpdateSubscriptionRequest](#bytebase-v1-UpdateSubscriptionRequest)
@@ -4004,6 +4006,38 @@ ANY means approving any node will proceed.
+<a name="bytebase-v1-PlanConfig"></a>
+
+### PlanConfig
+PlanConfig represents the configuration for all plans loaded from plan.yaml
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| plans | [PlanLimitConfig](#bytebase-v1-PlanLimitConfig) | repeated | |
+
+
+
+
+
+
+<a name="bytebase-v1-PlanLimitConfig"></a>
+
+### PlanLimitConfig
+PlanLimitConfig represents a single plan&#39;s configuration
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| type | [PlanType](#bytebase-v1-PlanType) | | |
+| maximum_instance_count | [int32](#int32) | | |
+| maximum_seat_count | [int32](#int32) | | |
+
+
+
+
+
+
<a name="bytebase-v1-Subscription"></a>
### Subscription
diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.html
index da4d59494b..9d5ccaf60a 100644
--- a/proto/gen/grpc-doc/v1/index.html
+++ b/proto/gen/grpc-doc/v1/index.html
@@ -987,6 +987,14 @@
<a href="#bytebase.v1.PatchSubscription"><span class="badge">M</span>PatchSubscription</a>
</li>
+ <li>
+ <a href="#bytebase.v1.PlanConfig"><span class="badge">M</span>PlanConfig</a>
+ </li>
+
+ <li>
+ <a href="#bytebase.v1.PlanLimitConfig"><span class="badge">M</span>PlanLimitConfig</a>
+ </li>
+
<li>
<a href="#bytebase.v1.Subscription"><span class="badge">M</span>Subscription</a>
</li>
@@ -11936,6 +11944,68 @@ The access is based on approval flow.</p></td>
+ <h3 id="bytebase.v1.PlanConfig">PlanConfig</h3>
+ <p>PlanConfig represents the configuration for all plans loaded from plan.yaml</p>
+
+
+ <table class="field-table">
+ <thead>
+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
+ </thead>
+ <tbody>
+
+ <tr>
+ <td>plans</td>
+ <td><a href="#bytebase.v1.PlanLimitConfig">PlanLimitConfig</a></td>
+ <td>repeated</td>
+ <td><p> </p></td>
+ </tr>
+
+ </tbody>
+ </table>
+
+
+
+
+
+ <h3 id="bytebase.v1.PlanLimitConfig">PlanLimitConfig</h3>
+ <p>PlanLimitConfig represents a single plan's configuration</p>
+
+
+ <table class="field-table">
+ <thead>
+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
+ </thead>
+ <tbody>
+
+ <tr>
+ <td>type</td>
+ <td><a href="#bytebase.v1.PlanType">PlanType</a></td>
+ <td></td>
+ <td><p> </p></td>
+ </tr>
+
+ <tr>
+ <td>maximum_instance_count</td>
+ <td><a href="#int32">int32</a></td>
+ <td></td>
+ <td><p> </p></td>
+ </tr>
+
+ <tr>
+ <td>maximum_seat_count</td>
+ <td><a href="#int32">int32</a></td>
+ <td></td>
+ <td><p> </p></td>
+ </tr>
+
+ </tbody>
+ </table>
+
+
+
+
+
<h3 id="bytebase.v1.Subscription">Subscription</h3>
<p></p>
diff --git a/proto/generated-go/v1/subscription_service.pb.go b/proto/generated-go/v1/subscription_service.pb.go
index 94a41d9714..28631da599 100644
--- a/proto/generated-go/v1/subscription_service.pb.go
+++ b/proto/generated-go/v1/subscription_service.pb.go
@@ -433,6 +433,112 @@ func (x *Feature) GetMatrix() map[string]bool {
return nil
}
+// PlanConfig represents the configuration for all plans loaded from plan.yaml
+type PlanConfig struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ Plans []*PlanLimitConfig `protobuf:"bytes,1,rep,name=plans,proto3" json:"plans,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *PlanConfig) Reset() {
+ *x = PlanConfig{}
+ mi := &file_v1_subscription_service_proto_msgTypes[7]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *PlanConfig) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*PlanConfig) ProtoMessage() {}
+
+func (x *PlanConfig) ProtoReflect() protoreflect.Message {
+ mi := &file_v1_subscription_service_proto_msgTypes[7]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use PlanConfig.ProtoReflect.Descriptor instead.
+func (*PlanConfig) Descriptor() ([]byte, []int) {
+ return file_v1_subscription_service_proto_rawDescGZIP(), []int{7}
+}
+
+func (x *PlanConfig) GetPlans() []*PlanLimitConfig {
+ if x != nil {
+ return x.Plans
+ }
+ return nil
+}
+
+// PlanLimitConfig represents a single plan's configuration
+type PlanLimitConfig struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ Type PlanType `protobuf:"varint,1,opt,name=type,proto3,enum=bytebase.v1.PlanType" json:"type,omitempty"`
+ MaximumInstanceCount int32 `protobuf:"varint,2,opt,name=maximum_instance_count,json=maximumInstanceCount,proto3" json:"maximum_instance_count,omitempty"`
+ MaximumSeatCount int32 `protobuf:"varint,3,opt,name=maximum_seat_count,json=maximumSeatCount,proto3" json:"maximum_seat_count,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *PlanLimitConfig) Reset() {
+ *x = PlanLimitConfig{}
+ mi := &file_v1_subscription_service_proto_msgTypes[8]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *PlanLimitConfig) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*PlanLimitConfig) ProtoMessage() {}
+
+func (x *PlanLimitConfig) ProtoReflect() protoreflect.Message {
+ mi := &file_v1_subscription_service_proto_msgTypes[8]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use PlanLimitConfig.ProtoReflect.Descriptor instead.
+func (*PlanLimitConfig) Descriptor() ([]byte, []int) {
+ return file_v1_subscription_service_proto_rawDescGZIP(), []int{8}
+}
+
+func (x *PlanLimitConfig) GetType() PlanType {
+ if x != nil {
+ return x.Type
+ }
+ return PlanType_PLAN_TYPE_UNSPECIFIED
+}
+
+func (x *PlanLimitConfig) GetMaximumInstanceCount() int32 {
+ if x != nil {
+ return x.MaximumInstanceCount
+ }
+ return 0
+}
+
+func (x *PlanLimitConfig) GetMaximumSeatCount() int32 {
+ if x != nil {
+ return x.MaximumSeatCount
+ }
+ return 0
+}
+
var File_v1_subscription_service_proto protoreflect.FileDescriptor
const file_v1_subscription_service_proto_rawDesc = "" +
@@ -461,7 +567,14 @@ const file_v1_subscription_service_proto_rawDesc = "" +
"\x06matrix\x18\x02 \x03(\v2 .bytebase.v1.Feature.MatrixEntryR\x06matrix\x1a9\n" +
"\vMatrixEntry\x12\x10\n" +
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
- "\x05value\x18\x02 \x01(\bR\x05value:\x028\x01*I\n" +
+ "\x05value\x18\x02 \x01(\bR\x05value:\x028\x01\"@\n" +
+ "\n" +
+ "PlanConfig\x122\n" +
+ "\x05plans\x18\x01 \x03(\v2\x1c.bytebase.v1.PlanLimitConfigR\x05plans\"\xa0\x01\n" +
+ "\x0fPlanLimitConfig\x12)\n" +
+ "\x04type\x18\x01 \x01(\x0e2\x15.bytebase.v1.PlanTypeR\x04type\x124\n" +
+ "\x16maximum_instance_count\x18\x02 \x01(\x05R\x14maximumInstanceCount\x12,\n" +
+ "\x12maximum_seat_count\x18\x03 \x01(\x05R\x10maximumSeatCount*I\n" +
"\bPlanType\x12\x19\n" +
"\x15PLAN_TYPE_UNSPECIFIED\x10\x00\x12\b\n" +
"\x04FREE\x10\x01\x12\b\n" +
@@ -486,7 +599,7 @@ func file_v1_subscription_service_proto_rawDescGZIP() []byte {
}
var file_v1_subscription_service_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
-var file_v1_subscription_service_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
+var file_v1_subscription_service_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
var file_v1_subscription_service_proto_goTypes = []any{
(PlanType)(0), // 0: bytebase.v1.PlanType
(*GetSubscriptionRequest)(nil), // 1: bytebase.v1.GetSubscriptionRequest
@@ -496,27 +609,31 @@ var file_v1_subscription_service_proto_goTypes = []any{
(*Subscription)(nil), // 5: bytebase.v1.Subscription
(*FeatureMatrix)(nil), // 6: bytebase.v1.FeatureMatrix
(*Feature)(nil), // 7: bytebase.v1.Feature
- nil, // 8: bytebase.v1.Feature.MatrixEntry
- (*timestamppb.Timestamp)(nil), // 9: google.protobuf.Timestamp
+ (*PlanConfig)(nil), // 8: bytebase.v1.PlanConfig
+ (*PlanLimitConfig)(nil), // 9: bytebase.v1.PlanLimitConfig
+ nil, // 10: bytebase.v1.Feature.MatrixEntry
+ (*timestamppb.Timestamp)(nil), // 11: google.protobuf.Timestamp
}
var file_v1_subscription_service_proto_depIdxs = []int32{
- 4, // 0: bytebase.v1.UpdateSubscriptionRequest.patch:type_name -> bytebase.v1.PatchSubscription
- 9, // 1: bytebase.v1.Subscription.expires_time:type_name -> google.protobuf.Timestamp
- 9, // 2: bytebase.v1.Subscription.started_time:type_name -> google.protobuf.Timestamp
- 0, // 3: bytebase.v1.Subscription.plan:type_name -> bytebase.v1.PlanType
- 7, // 4: bytebase.v1.FeatureMatrix.features:type_name -> bytebase.v1.Feature
- 8, // 5: bytebase.v1.Feature.matrix:type_name -> bytebase.v1.Feature.MatrixEntry
- 1, // 6: bytebase.v1.SubscriptionService.GetSubscription:input_type -> bytebase.v1.GetSubscriptionRequest
- 2, // 7: bytebase.v1.SubscriptionService.GetFeatureMatrix:input_type -> bytebase.v1.GetFeatureMatrixRequest
- 3, // 8: bytebase.v1.SubscriptionService.UpdateSubscription:input_type -> bytebase.v1.UpdateSubscriptionRequest
- 5, // 9: bytebase.v1.SubscriptionService.GetSubscription:output_type -> bytebase.v1.Subscription
- 6, // 10: bytebase.v1.SubscriptionService.GetFeatureMatrix:output_type -> bytebase.v1.FeatureMatrix
- 5, // 11: bytebase.v1.SubscriptionService.UpdateSubscription:output_type -> bytebase.v1.Subscription
- 9, // [9:12] is the sub-list for method output_type
- 6, // [6:9] 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
+ 4, // 0: bytebase.v1.UpdateSubscriptionRequest.patch:type_name -> bytebase.v1.PatchSubscription
+ 11, // 1: bytebase.v1.Subscription.expires_time:type_name -> google.protobuf.Timestamp
+ 11, // 2: bytebase.v1.Subscription.started_time:type_name -> google.protobuf.Timestamp
+ 0, // 3: bytebase.v1.Subscription.plan:type_name -> bytebase.v1.PlanType
+ 7, // 4: bytebase.v1.FeatureMatrix.features:type_name -> bytebase.v1.Feature
+ 10, // 5: bytebase.v1.Feature.matrix:type_name -> bytebase.v1.Feature.MatrixEntry
+ 9, // 6: bytebase.v1.PlanConfig.plans:type_name -> bytebase.v1.PlanLimitConfig
+ 0, // 7: bytebase.v1.PlanLimitConfig.type:type_name -> bytebase.v1.PlanType
+ 1, // 8: bytebase.v1.SubscriptionService.GetSubscription:input_type -> bytebase.v1.GetSubscriptionRequest
+ 2, // 9: bytebase.v1.SubscriptionService.GetFeatureMatrix:input_type -> bytebase.v1.GetFeatureMatrixRequest
+ 3, // 10: bytebase.v1.SubscriptionService.UpdateSubscription:input_type -> bytebase.v1.UpdateSubscriptionRequest
+ 5, // 11: bytebase.v1.SubscriptionService.GetSubscription:output_type -> bytebase.v1.Subscription
+ 6, // 12: bytebase.v1.SubscriptionService.GetFeatureMatrix:output_type -> bytebase.v1.FeatureMatrix
+ 5, // 13: bytebase.v1.SubscriptionService.UpdateSubscription:output_type -> bytebase.v1.Subscription
+ 11, // [11:14] is the sub-list for method output_type
+ 8, // [8:11] is the sub-list for method input_type
+ 8, // [8:8] is the sub-list for extension type_name
+ 8, // [8:8] is the sub-list for extension extendee
+ 0, // [0:8] is the sub-list for field type_name
}
func init() { file_v1_subscription_service_proto_init() }
@@ -531,7 +648,7 @@ func file_v1_subscription_service_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_v1_subscription_service_proto_rawDesc), len(file_v1_subscription_service_proto_rawDesc)),
NumEnums: 1,
- NumMessages: 8,
+ NumMessages: 10,
NumExtensions: 0,
NumServices: 1,
},
diff --git a/proto/v1/v1/subscription_service.proto b/proto/v1/v1/subscription_service.proto
index 58bef76bd0..eba338f005 100644
--- a/proto/v1/v1/subscription_service.proto
+++ b/proto/v1/v1/subscription_service.proto
@@ -85,3 +85,15 @@ message Feature {
// Matrix is the feature matrix for different plan. The key is the plan enum in string value.
map<string, bool> matrix = 2;
}
+
+// PlanConfig represents the configuration for all plans loaded from plan.yaml
+message PlanConfig {
+ repeated PlanLimitConfig plans = 1;
+}
+
+// PlanLimitConfig represents a single plan's configuration
+message PlanLimitConfig {
+ PlanType type = 1;
+ int32 maximum_instance_count = 2;
+ int32 maximum_seat_count = 3;
+}