Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: add `store/policy.proto` (#6839)
boojack5427e1d7420c
diff --git a/frontend/src/types/proto/store/policy.ts b/frontend/src/types/proto/store/policy.tsnew file mode 100644index 0000000000..1ab27d59c6--- /dev/null+++ b/frontend/src/types/proto/store/policy.ts@@ -0,0 +1,194 @@+/* eslint-disable */+import * as _m0 from "protobufjs/minimal";+import { Expr } from "../google/type/expr";++export const protobufPackage = "bytebase.store";++export interface IamPolicy {+ /** Collection of binding. */+ bindings: Binding[];+}++/** Reference: https://cloud.google.com/pubsub/docs/reference/rpc/google.iam.v1#binding */+export interface Binding {+ /**+ * Role that is assigned to the list of members.+ * Format: roles/{role}+ */+ role: string;+ /**+ * Specifies the principals requesting access for a Bytebase resource.+ * `members` can have the following values:+ *+ * * `allUsers`: A special identifier that represents anyone.+ * * `user:{emailid}`: An email address that represents a specific Bytebase account. For example, `[email protected]`.+ */+ members: string[];+ /**+ * The condition that is associated with this binding.+ * If the condition evaluates to true, then this binding applies to the current request.+ * If the condition evaluates to false, then this binding does not apply to the current request. However, a different role binding might grant the same role to one or more of the principals in this binding.+ */+ condition?: Expr;+}++function createBaseIamPolicy(): IamPolicy {+ return { bindings: [] };+}++export const IamPolicy = {+ encode(message: IamPolicy, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {+ for (const v of message.bindings) {+ Binding.encode(v!, writer.uint32(10).fork()).ldelim();+ }+ return writer;+ },++ decode(input: _m0.Reader | Uint8Array, length?: number): IamPolicy {+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);+ let end = length === undefined ? reader.len : reader.pos + length;+ const message = createBaseIamPolicy();+ while (reader.pos < end) {+ const tag = reader.uint32();+ switch (tag >>> 3) {+ case 1:+ if (tag !== 10) {+ break;+ }++ message.bindings.push(Binding.decode(reader, reader.uint32()));+ continue;+ }+ if ((tag & 7) === 4 || tag === 0) {+ break;+ }+ reader.skipType(tag & 7);+ }+ return message;+ },++ fromJSON(object: any): IamPolicy {+ return { bindings: Array.isArray(object?.bindings) ? object.bindings.map((e: any) => Binding.fromJSON(e)) : [] };+ },++ toJSON(message: IamPolicy): unknown {+ const obj: any = {};+ if (message.bindings) {+ obj.bindings = message.bindings.map((e) => e ? Binding.toJSON(e) : undefined);+ } else {+ obj.bindings = [];+ }+ return obj;+ },++ create(base?: DeepPartial<IamPolicy>): IamPolicy {+ return IamPolicy.fromPartial(base ?? {});+ },++ fromPartial(object: DeepPartial<IamPolicy>): IamPolicy {+ const message = createBaseIamPolicy();+ message.bindings = object.bindings?.map((e) => Binding.fromPartial(e)) || [];+ return message;+ },+};++function createBaseBinding(): Binding {+ return { role: "", members: [], condition: undefined };+}++export const Binding = {+ encode(message: Binding, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {+ if (message.role !== "") {+ writer.uint32(10).string(message.role);+ }+ for (const v of message.members) {+ writer.uint32(18).string(v!);+ }+ if (message.condition !== undefined) {+ Expr.encode(message.condition, writer.uint32(26).fork()).ldelim();+ }+ return writer;+ },++ decode(input: _m0.Reader | Uint8Array, length?: number): Binding {+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);+ let end = length === undefined ? reader.len : reader.pos + length;+ const message = createBaseBinding();+ while (reader.pos < end) {+ const tag = reader.uint32();+ switch (tag >>> 3) {+ case 1:+ if (tag !== 10) {+ break;+ }++ message.role = reader.string();+ continue;+ case 2:+ if (tag !== 18) {+ break;+ }++ message.members.push(reader.string());+ continue;+ case 3:+ if (tag !== 26) {+ break;+ }++ message.condition = Expr.decode(reader, reader.uint32());+ continue;+ }+ if ((tag & 7) === 4 || tag === 0) {+ break;+ }+ reader.skipType(tag & 7);+ }+ return message;+ },++ fromJSON(object: any): Binding {+ return {+ role: isSet(object.role) ? String(object.role) : "",+ members: Array.isArray(object?.members) ? object.members.map((e: any) => String(e)) : [],+ condition: isSet(object.condition) ? Expr.fromJSON(object.condition) : undefined,+ };+ },++ toJSON(message: Binding): unknown {+ const obj: any = {};+ message.role !== undefined && (obj.role = message.role);+ if (message.members) {+ obj.members = message.members.map((e) => e);+ } else {+ obj.members = [];+ }+ message.condition !== undefined && (obj.condition = message.condition ? Expr.toJSON(message.condition) : undefined);+ return obj;+ },++ create(base?: DeepPartial<Binding>): Binding {+ return Binding.fromPartial(base ?? {});+ },++ fromPartial(object: DeepPartial<Binding>): Binding {+ const message = createBaseBinding();+ message.role = object.role ?? "";+ message.members = object.members?.map((e) => e) || [];+ message.condition = (object.condition !== undefined && object.condition !== null)+ ? Expr.fromPartial(object.condition)+ : undefined;+ return message;+ },+};++type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;++export type DeepPartial<T> = T extends Builtin ? T+ : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>+ : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }+ : Partial<T>;++function isSet(value: any): boolean {+ return value !== null && value !== undefined;+}diff --git a/proto/gen/grpc-doc/store/README.md b/proto/gen/grpc-doc/store/README.mdindex 9775342ea0..d26b9fa25b 100644--- a/proto/gen/grpc-doc/store/README.md+++ b/proto/gen/grpc-doc/store/README.md@@ -91,6 +91,10 @@- [PlanConfig.ChangeDatabaseConfig.Type](#bytebase-store-PlanConfig-ChangeDatabaseConfig-Type)+- [store/policy.proto](#store_policy-proto)+ - [Binding](#bytebase-store-Binding)+ - [IamPolicy](#bytebase-store-IamPolicy)+- [store/setting.proto](#store_setting-proto)- [AgentPluginSetting](#bytebase-store-AgentPluginSetting)- [ExternalApprovalSetting](#bytebase-store-ExternalApprovalSetting)@@ -1380,6 +1384,56 @@ Type is the database change type.+<a name="store_policy-proto"></a>+<p align="right"><a href="#top">Top</a></p>++## store/policy.proto++++<a name="bytebase-store-Binding"></a>++### Binding+Reference: https://cloud.google.com/pubsub/docs/reference/rpc/google.iam.v1#binding+++| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| role | [string](#string) | | Role that is assigned to the list of members. Format: roles/{role} |+| members | [string](#string) | repeated | Specifies the principals requesting access for a Bytebase resource. `members` can have the following values:++* `allUsers`: A special identifier that represents anyone. * `user:{emailid}`: An email address that represents a specific Bytebase account. For example, `[email protected]`. |+| condition | [google.type.Expr](#google-type-Expr) | | The condition that is associated with this binding. If the condition evaluates to true, then this binding applies to the current request. If the condition evaluates to false, then this binding does not apply to the current request. However, a different role binding might grant the same role to one or more of the principals in this binding. |+++++++<a name="bytebase-store-IamPolicy"></a>++### IamPolicy++++| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| bindings | [Binding](#bytebase-store-Binding) | repeated | Collection of binding. |+++++++++++++++<a name="store_setting-proto"></a><p align="right"><a href="#top">Top</a></p>diff --git a/proto/generated-go/store/policy.pb.go b/proto/generated-go/store/policy.pb.gonew file mode 100644index 0000000000..a4ebf6a096--- /dev/null+++ b/proto/generated-go/store/policy.pb.go@@ -0,0 +1,245 @@+// Code generated by protoc-gen-go. DO NOT EDIT.+// versions:+// protoc-gen-go v1.30.0+// protoc (unknown)+// source: store/policy.proto++package store++import (+ expr "google.golang.org/genproto/googleapis/type/expr"+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"+ reflect "reflect"+ sync "sync"+)++const (+ // Verify that this generated code is sufficiently up-to-date.+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)+ // Verify that runtime/protoimpl is sufficiently up-to-date.+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)+)++type IamPolicy struct {+ state protoimpl.MessageState+ sizeCache protoimpl.SizeCache+ unknownFields protoimpl.UnknownFields++ // Collection of binding.+ Bindings []*Binding `protobuf:"bytes,1,rep,name=bindings,proto3" json:"bindings,omitempty"`+}++func (x *IamPolicy) Reset() {+ *x = IamPolicy{}+ if protoimpl.UnsafeEnabled {+ mi := &file_store_policy_proto_msgTypes[0]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+ }+}++func (x *IamPolicy) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*IamPolicy) ProtoMessage() {}++func (x *IamPolicy) ProtoReflect() protoreflect.Message {+ mi := &file_store_policy_proto_msgTypes[0]+ 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 IamPolicy.ProtoReflect.Descriptor instead.+func (*IamPolicy) Descriptor() ([]byte, []int) {+ return file_store_policy_proto_rawDescGZIP(), []int{0}+}++func (x *IamPolicy) GetBindings() []*Binding {+ if x != nil {+ return x.Bindings+ }+ return nil+}++// Reference: https://cloud.google.com/pubsub/docs/reference/rpc/google.iam.v1#binding+type Binding struct {+ state protoimpl.MessageState+ sizeCache protoimpl.SizeCache+ unknownFields protoimpl.UnknownFields++ // Role that is assigned to the list of members.+ // Format: roles/{role}+ Role string `protobuf:"bytes,1,opt,name=role,proto3" json:"role,omitempty"`+ // Specifies the principals requesting access for a Bytebase resource.+ // `members` can have the following values:+ //+ // * `allUsers`: A special identifier that represents anyone.+ // * `user:{emailid}`: An email address that represents a specific Bytebase account. For example, `[email protected]`.+ Members []string `protobuf:"bytes,2,rep,name=members,proto3" json:"members,omitempty"`+ // The condition that is associated with this binding.+ // If the condition evaluates to true, then this binding applies to the current request.+ // If the condition evaluates to false, then this binding does not apply to the current request. However, a different role binding might grant the same role to one or more of the principals in this binding.+ Condition *expr.Expr `protobuf:"bytes,3,opt,name=condition,proto3" json:"condition,omitempty"`+}++func (x *Binding) Reset() {+ *x = Binding{}+ if protoimpl.UnsafeEnabled {+ mi := &file_store_policy_proto_msgTypes[1]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+ }+}++func (x *Binding) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*Binding) ProtoMessage() {}++func (x *Binding) ProtoReflect() protoreflect.Message {+ mi := &file_store_policy_proto_msgTypes[1]+ 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 Binding.ProtoReflect.Descriptor instead.+func (*Binding) Descriptor() ([]byte, []int) {+ return file_store_policy_proto_rawDescGZIP(), []int{1}+}++func (x *Binding) GetRole() string {+ if x != nil {+ return x.Role+ }+ return ""+}++func (x *Binding) GetMembers() []string {+ if x != nil {+ return x.Members+ }+ return nil+}++func (x *Binding) GetCondition() *expr.Expr {+ if x != nil {+ return x.Condition+ }+ return nil+}++var File_store_policy_proto protoreflect.FileDescriptor++var file_store_policy_proto_rawDesc = []byte{+ 0x0a, 0x12, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x70,+ 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73,+ 0x74, 0x6f, 0x72, 0x65, 0x1a, 0x16, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x74, 0x79, 0x70,+ 0x65, 0x2f, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x40, 0x0a, 0x09,+ 0x49, 0x61, 0x6d, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x33, 0x0a, 0x08, 0x62, 0x69, 0x6e,+ 0x64, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x62, 0x79,+ 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x42, 0x69, 0x6e,+ 0x64, 0x69, 0x6e, 0x67, 0x52, 0x08, 0x62, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x22, 0x68,+ 0x0a, 0x07, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x6f, 0x6c,+ 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x12, 0x18, 0x0a,+ 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07,+ 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x12, 0x2f, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x64, 0x69,+ 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x67, 0x6f, 0x6f,+ 0x67, 0x6c, 0x65, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x52, 0x09, 0x63,+ 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x14, 0x5a, 0x12, 0x67, 0x65, 0x6e, 0x65,+ 0x72, 0x61, 0x74, 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06,+ 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,+}++var (+ file_store_policy_proto_rawDescOnce sync.Once+ file_store_policy_proto_rawDescData = file_store_policy_proto_rawDesc+)++func file_store_policy_proto_rawDescGZIP() []byte {+ file_store_policy_proto_rawDescOnce.Do(func() {+ file_store_policy_proto_rawDescData = protoimpl.X.CompressGZIP(file_store_policy_proto_rawDescData)+ })+ return file_store_policy_proto_rawDescData+}++var file_store_policy_proto_msgTypes = make([]protoimpl.MessageInfo, 2)+var file_store_policy_proto_goTypes = []interface{}{+ (*IamPolicy)(nil), // 0: bytebase.store.IamPolicy+ (*Binding)(nil), // 1: bytebase.store.Binding+ (*expr.Expr)(nil), // 2: google.type.Expr+}+var file_store_policy_proto_depIdxs = []int32{+ 1, // 0: bytebase.store.IamPolicy.bindings:type_name -> bytebase.store.Binding+ 2, // 1: bytebase.store.Binding.condition:type_name -> google.type.Expr+ 2, // [2:2] is the sub-list for method output_type+ 2, // [2:2] 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+}++func init() { file_store_policy_proto_init() }+func file_store_policy_proto_init() {+ if File_store_policy_proto != nil {+ return+ }+ if !protoimpl.UnsafeEnabled {+ file_store_policy_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {+ switch v := v.(*IamPolicy); i {+ case 0:+ return &v.state+ case 1:+ return &v.sizeCache+ case 2:+ return &v.unknownFields+ default:+ return nil+ }+ }+ file_store_policy_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {+ switch v := v.(*Binding); 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{+ File: protoimpl.DescBuilder{+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),+ RawDescriptor: file_store_policy_proto_rawDesc,+ NumEnums: 0,+ NumMessages: 2,+ NumExtensions: 0,+ NumServices: 0,+ },+ GoTypes: file_store_policy_proto_goTypes,+ DependencyIndexes: file_store_policy_proto_depIdxs,+ MessageInfos: file_store_policy_proto_msgTypes,+ }.Build()+ File_store_policy_proto = out.File+ file_store_policy_proto_rawDesc = nil+ file_store_policy_proto_goTypes = nil+ file_store_policy_proto_depIdxs = nil+}diff --git a/proto/store/policy.proto b/proto/store/policy.protonew file mode 100644index 0000000000..c195b07d85--- /dev/null+++ b/proto/store/policy.proto@@ -0,0 +1,31 @@+syntax = "proto3";++package bytebase.store;++import "google/type/expr.proto";++option go_package = "generated-go/store";++message IamPolicy {+ // Collection of binding.+ repeated Binding bindings = 1;+}++// Reference: https://cloud.google.com/pubsub/docs/reference/rpc/google.iam.v1#binding+message Binding {+ // Role that is assigned to the list of members.+ // Format: roles/{role}+ string role = 1;++ // Specifies the principals requesting access for a Bytebase resource.+ // `members` can have the following values:+ //+ // * `allUsers`: A special identifier that represents anyone.+ // * `user:{emailid}`: An email address that represents a specific Bytebase account. For example, `[email protected]`.+ repeated string members = 2;++ // The condition that is associated with this binding.+ // If the condition evaluates to true, then this binding applies to the current request.+ // If the condition evaluates to false, then this binding does not apply to the current request. However, a different role binding might grant the same role to one or more of the principals in this binding.+ google.type.Expr condition = 3;+}