Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
refactor: risk proto (#5160)
p0ny5bfc38d38114
diff --git a/frontend/src/types/proto/store/risk.ts b/frontend/src/types/proto/store/risk.tsindex fb53aecc33..77019ee93c 100644--- a/frontend/src/types/proto/store/risk.ts+++ b/frontend/src/types/proto/store/risk.ts@@ -4,32 +4,46 @@ import { ParsedExpr } from "../google/api/expr/v1alpha1/syntax";export const protobufPackage = "bytebase.store";-export interface RiskExpression {+export interface RiskRule {+ title: string;expression?: ParsedExpr;+ active: boolean;}-function createBaseRiskExpression(): RiskExpression {- return { expression: undefined };+function createBaseRiskRule(): RiskRule {+ return { title: "", expression: undefined, active: false };}-export const RiskExpression = {- encode(message: RiskExpression, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {+export const RiskRule = {+ encode(message: RiskRule, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {+ if (message.title !== "") {+ writer.uint32(10).string(message.title);+ }if (message.expression !== undefined) {- ParsedExpr.encode(message.expression, writer.uint32(10).fork()).ldelim();+ ParsedExpr.encode(message.expression, writer.uint32(18).fork()).ldelim();+ }+ if (message.active === true) {+ writer.uint32(24).bool(message.active);}return writer;},- decode(input: _m0.Reader | Uint8Array, length?: number): RiskExpression {+ decode(input: _m0.Reader | Uint8Array, length?: number): RiskRule {const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);let end = length === undefined ? reader.len : reader.pos + length;- const message = createBaseRiskExpression();+ const message = createBaseRiskRule();while (reader.pos < end) {const tag = reader.uint32();switch (tag >>> 3) {case 1:+ message.title = reader.string();+ break;+ case 2:message.expression = ParsedExpr.decode(reader, reader.uint32());break;+ case 3:+ message.active = reader.bool();+ break;default:reader.skipType(tag & 7);break;@@ -38,22 +52,30 @@ export const RiskExpression = {return message;},- fromJSON(object: any): RiskExpression {- return { expression: isSet(object.expression) ? ParsedExpr.fromJSON(object.expression) : undefined };+ fromJSON(object: any): RiskRule {+ return {+ title: isSet(object.title) ? String(object.title) : "",+ expression: isSet(object.expression) ? ParsedExpr.fromJSON(object.expression) : undefined,+ active: isSet(object.active) ? Boolean(object.active) : false,+ };},- toJSON(message: RiskExpression): unknown {+ toJSON(message: RiskRule): unknown {const obj: any = {};+ message.title !== undefined && (obj.title = message.title);message.expression !== undefined &&(obj.expression = message.expression ? ParsedExpr.toJSON(message.expression) : undefined);+ message.active !== undefined && (obj.active = message.active);return obj;},- fromPartial(object: DeepPartial<RiskExpression>): RiskExpression {- const message = createBaseRiskExpression();+ fromPartial(object: DeepPartial<RiskRule>): RiskRule {+ const message = createBaseRiskRule();+ message.title = object.title ?? "";message.expression = (object.expression !== undefined && object.expression !== null)? ParsedExpr.fromPartial(object.expression): undefined;+ message.active = object.active ?? false;return message;},};diff --git a/frontend/src/types/proto/v1/risk_service.ts b/frontend/src/types/proto/v1/risk_service.tsindex 6175e29233..8541cb1175 100644--- a/frontend/src/types/proto/v1/risk_service.ts+++ b/frontend/src/types/proto/v1/risk_service.ts@@ -3,6 +3,7 @@ import * as Long from "long";import type { CallContext, CallOptions } from "nice-grpc-common";import * as _m0 from "protobufjs/minimal";import { ParsedExpr } from "../google/api/expr/v1alpha1/syntax";+import { Empty } from "../google/protobuf/empty";import { FieldMask } from "../google/protobuf/field_mask";export const protobufPackage = "bytebase.v1";@@ -34,6 +35,11 @@ export interface ListRisksResponse {nextPageToken: string;}+export interface CreateRiskRequest {+ /** The risk to create. */+ risk?: Risk;+}+export interface UpdateRiskRequest {/*** The risk to update.@@ -46,97 +52,65 @@ export interface UpdateRiskRequest {updateMask?: string[];}+export interface DeleteRiskRequest {+ /**+ * The name of the risk to delete.+ * Format: risks/{risk}+ */+ name: string;+}+export interface Risk {/** Format: risks/{risk} */name: string;/** system-generated unique identifier. */uid: string;- namespace: Risk_Namespace;+ source: Risk_Source;title: string;level: number;- actions: RiskAction[];- rules: RiskRule[];+ rule?: RiskRule;}-export enum Risk_Namespace {- NAMESPACE_UNSPECIFIED = 0,+export enum Risk_Source {+ SOURCE_UNSPECIFIED = 0,DDL = 1,DML = 2,CREATE_DATABASE = 3,UNRECOGNIZED = -1,}-export function risk_NamespaceFromJSON(object: any): Risk_Namespace {+export function risk_SourceFromJSON(object: any): Risk_Source {switch (object) {case 0:- case "NAMESPACE_UNSPECIFIED":- return Risk_Namespace.NAMESPACE_UNSPECIFIED;+ case "SOURCE_UNSPECIFIED":+ return Risk_Source.SOURCE_UNSPECIFIED;case 1:case "DDL":- return Risk_Namespace.DDL;+ return Risk_Source.DDL;case 2:case "DML":- return Risk_Namespace.DML;+ return Risk_Source.DML;case 3:case "CREATE_DATABASE":- return Risk_Namespace.CREATE_DATABASE;+ return Risk_Source.CREATE_DATABASE;case -1:case "UNRECOGNIZED":default:- return Risk_Namespace.UNRECOGNIZED;+ return Risk_Source.UNRECOGNIZED;}}-export function risk_NamespaceToJSON(object: Risk_Namespace): string {+export function risk_SourceToJSON(object: Risk_Source): string {switch (object) {- case Risk_Namespace.NAMESPACE_UNSPECIFIED:- return "NAMESPACE_UNSPECIFIED";- case Risk_Namespace.DDL:+ case Risk_Source.SOURCE_UNSPECIFIED:+ return "SOURCE_UNSPECIFIED";+ case Risk_Source.DDL:return "DDL";- case Risk_Namespace.DML:+ case Risk_Source.DML:return "DML";- case Risk_Namespace.CREATE_DATABASE:+ case Risk_Source.CREATE_DATABASE:return "CREATE_DATABASE";- case Risk_Namespace.UNRECOGNIZED:- default:- return "UNRECOGNIZED";- }-}--export interface RiskAction {- type: RiskAction_Type;- /** Format: approvalTemplates/{approvalTemplate} */- approvalTemplate?: string | undefined;-}--export enum RiskAction_Type {- TYPE_UNSPECIFIED = 0,- CHOOSE_APPROVAL_TEMPLATE = 1,- UNRECOGNIZED = -1,-}--export function riskAction_TypeFromJSON(object: any): RiskAction_Type {- switch (object) {- case 0:- case "TYPE_UNSPECIFIED":- return RiskAction_Type.TYPE_UNSPECIFIED;- case 1:- case "CHOOSE_APPROVAL_TEMPLATE":- return RiskAction_Type.CHOOSE_APPROVAL_TEMPLATE;- case -1:- case "UNRECOGNIZED":- default:- return RiskAction_Type.UNRECOGNIZED;- }-}--export function riskAction_TypeToJSON(object: RiskAction_Type): string {- switch (object) {- case RiskAction_Type.TYPE_UNSPECIFIED:- return "TYPE_UNSPECIFIED";- case RiskAction_Type.CHOOSE_APPROVAL_TEMPLATE:- return "CHOOSE_APPROVAL_TEMPLATE";- case RiskAction_Type.UNRECOGNIZED:+ case Risk_Source.UNRECOGNIZED:default:return "UNRECOGNIZED";}@@ -268,6 +242,53 @@ export const ListRisksResponse = {},};+function createBaseCreateRiskRequest(): CreateRiskRequest {+ return { risk: undefined };+}++export const CreateRiskRequest = {+ encode(message: CreateRiskRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {+ if (message.risk !== undefined) {+ Risk.encode(message.risk, writer.uint32(10).fork()).ldelim();+ }+ return writer;+ },++ decode(input: _m0.Reader | Uint8Array, length?: number): CreateRiskRequest {+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);+ let end = length === undefined ? reader.len : reader.pos + length;+ const message = createBaseCreateRiskRequest();+ while (reader.pos < end) {+ const tag = reader.uint32();+ switch (tag >>> 3) {+ case 1:+ message.risk = Risk.decode(reader, reader.uint32());+ break;+ default:+ reader.skipType(tag & 7);+ break;+ }+ }+ return message;+ },++ fromJSON(object: any): CreateRiskRequest {+ return { risk: isSet(object.risk) ? Risk.fromJSON(object.risk) : undefined };+ },++ toJSON(message: CreateRiskRequest): unknown {+ const obj: any = {};+ message.risk !== undefined && (obj.risk = message.risk ? Risk.toJSON(message.risk) : undefined);+ return obj;+ },++ fromPartial(object: DeepPartial<CreateRiskRequest>): CreateRiskRequest {+ const message = createBaseCreateRiskRequest();+ message.risk = (object.risk !== undefined && object.risk !== null) ? Risk.fromPartial(object.risk) : undefined;+ return message;+ },+};+function createBaseUpdateRiskRequest(): UpdateRiskRequest {return { risk: undefined, updateMask: undefined };}@@ -326,8 +347,55 @@ export const UpdateRiskRequest = {},};+function createBaseDeleteRiskRequest(): DeleteRiskRequest {+ return { name: "" };+}++export const DeleteRiskRequest = {+ encode(message: DeleteRiskRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {+ if (message.name !== "") {+ writer.uint32(10).string(message.name);+ }+ return writer;+ },++ decode(input: _m0.Reader | Uint8Array, length?: number): DeleteRiskRequest {+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);+ let end = length === undefined ? reader.len : reader.pos + length;+ const message = createBaseDeleteRiskRequest();+ while (reader.pos < end) {+ const tag = reader.uint32();+ switch (tag >>> 3) {+ case 1:+ message.name = reader.string();+ break;+ default:+ reader.skipType(tag & 7);+ break;+ }+ }+ return message;+ },++ fromJSON(object: any): DeleteRiskRequest {+ return { name: isSet(object.name) ? String(object.name) : "" };+ },++ toJSON(message: DeleteRiskRequest): unknown {+ const obj: any = {};+ message.name !== undefined && (obj.name = message.name);+ return obj;+ },++ fromPartial(object: DeepPartial<DeleteRiskRequest>): DeleteRiskRequest {+ const message = createBaseDeleteRiskRequest();+ message.name = object.name ?? "";+ return message;+ },+};+function createBaseRisk(): Risk {- return { name: "", uid: "", namespace: 0, title: "", level: 0, actions: [], rules: [] };+ return { name: "", uid: "", source: 0, title: "", level: 0, rule: undefined };}export const Risk = {@@ -338,8 +406,8 @@ export const Risk = {if (message.uid !== "") {writer.uint32(18).string(message.uid);}- if (message.namespace !== 0) {- writer.uint32(24).int32(message.namespace);+ if (message.source !== 0) {+ writer.uint32(24).int32(message.source);}if (message.title !== "") {writer.uint32(34).string(message.title);@@ -347,11 +415,8 @@ export const Risk = {if (message.level !== 0) {writer.uint32(40).int64(message.level);}- for (const v of message.actions) {- RiskAction.encode(v!, writer.uint32(50).fork()).ldelim();- }- for (const v of message.rules) {- RiskRule.encode(v!, writer.uint32(58).fork()).ldelim();+ if (message.rule !== undefined) {+ RiskRule.encode(message.rule, writer.uint32(58).fork()).ldelim();}return writer;},@@ -370,7 +435,7 @@ export const Risk = {message.uid = reader.string();break;case 3:- message.namespace = reader.int32() as any;+ message.source = reader.int32() as any;break;case 4:message.title = reader.string();@@ -378,11 +443,8 @@ export const Risk = {case 5:message.level = longToNumber(reader.int64() as Long);break;- case 6:- message.actions.push(RiskAction.decode(reader, reader.uint32()));- break;case 7:- message.rules.push(RiskRule.decode(reader, reader.uint32()));+ message.rule = RiskRule.decode(reader, reader.uint32());break;default:reader.skipType(tag & 7);@@ -396,11 +458,10 @@ export const Risk = {return {name: isSet(object.name) ? String(object.name) : "",uid: isSet(object.uid) ? String(object.uid) : "",- namespace: isSet(object.namespace) ? risk_NamespaceFromJSON(object.namespace) : 0,+ source: isSet(object.source) ? risk_SourceFromJSON(object.source) : 0,title: isSet(object.title) ? String(object.title) : "",level: isSet(object.level) ? Number(object.level) : 0,- actions: Array.isArray(object?.actions) ? object.actions.map((e: any) => RiskAction.fromJSON(e)) : [],- rules: Array.isArray(object?.rules) ? object.rules.map((e: any) => RiskRule.fromJSON(e)) : [],+ rule: isSet(object.rule) ? RiskRule.fromJSON(object.rule) : undefined,};},@@ -408,19 +469,10 @@ export const Risk = {const obj: any = {};message.name !== undefined && (obj.name = message.name);message.uid !== undefined && (obj.uid = message.uid);- message.namespace !== undefined && (obj.namespace = risk_NamespaceToJSON(message.namespace));+ message.source !== undefined && (obj.source = risk_SourceToJSON(message.source));message.title !== undefined && (obj.title = message.title);message.level !== undefined && (obj.level = Math.round(message.level));- if (message.actions) {- obj.actions = message.actions.map((e) => e ? RiskAction.toJSON(e) : undefined);- } else {- obj.actions = [];- }- if (message.rules) {- obj.rules = message.rules.map((e) => e ? RiskRule.toJSON(e) : undefined);- } else {- obj.rules = [];- }+ message.rule !== undefined && (obj.rule = message.rule ? RiskRule.toJSON(message.rule) : undefined);return obj;},@@ -428,69 +480,10 @@ export const Risk = {const message = createBaseRisk();message.name = object.name ?? "";message.uid = object.uid ?? "";- message.namespace = object.namespace ?? 0;+ message.source = object.source ?? 0;message.title = object.title ?? "";message.level = object.level ?? 0;- message.actions = object.actions?.map((e) => RiskAction.fromPartial(e)) || [];- message.rules = object.rules?.map((e) => RiskRule.fromPartial(e)) || [];- return message;- },-};--function createBaseRiskAction(): RiskAction {- return { type: 0, approvalTemplate: undefined };-}--export const RiskAction = {- encode(message: RiskAction, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {- if (message.type !== 0) {- writer.uint32(8).int32(message.type);- }- if (message.approvalTemplate !== undefined) {- writer.uint32(18).string(message.approvalTemplate);- }- return writer;- },-- decode(input: _m0.Reader | Uint8Array, length?: number): RiskAction {- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);- let end = length === undefined ? reader.len : reader.pos + length;- const message = createBaseRiskAction();- while (reader.pos < end) {- const tag = reader.uint32();- switch (tag >>> 3) {- case 1:- message.type = reader.int32() as any;- break;- case 2:- message.approvalTemplate = reader.string();- break;- default:- reader.skipType(tag & 7);- break;- }- }- return message;- },-- fromJSON(object: any): RiskAction {- return {- type: isSet(object.type) ? riskAction_TypeFromJSON(object.type) : 0,- approvalTemplate: isSet(object.approvalTemplate) ? String(object.approvalTemplate) : undefined,- };- },-- toJSON(message: RiskAction): unknown {- const obj: any = {};- message.type !== undefined && (obj.type = riskAction_TypeToJSON(message.type));- message.approvalTemplate !== undefined && (obj.approvalTemplate = message.approvalTemplate);- return obj;- },-- fromPartial(object: DeepPartial<RiskAction>): RiskAction {- const message = createBaseRiskAction();- message.type = object.type ?? 0;- message.approvalTemplate = object.approvalTemplate ?? undefined;+ message.rule = (object.rule !== undefined && object.rule !== null) ? RiskRule.fromPartial(object.rule) : undefined;return message;},};@@ -578,6 +571,14 @@ export const RiskServiceDefinition = {responseStream: false,options: {},},+ createRisk: {+ name: "CreateRisk",+ requestType: CreateRiskRequest,+ requestStream: false,+ responseType: Risk,+ responseStream: false,+ options: {},+ },updateRisk: {name: "UpdateRisk",requestType: UpdateRiskRequest,@@ -586,17 +587,29 @@ export const RiskServiceDefinition = {responseStream: false,options: {},},+ deleteRisk: {+ name: "DeleteRisk",+ requestType: DeleteRiskRequest,+ requestStream: false,+ responseType: Empty,+ responseStream: false,+ options: {},+ },},} as const;export interface RiskServiceImplementation<CallContextExt = {}> {listRisks(request: ListRisksRequest, context: CallContext & CallContextExt): Promise<DeepPartial<ListRisksResponse>>;+ createRisk(request: CreateRiskRequest, context: CallContext & CallContextExt): Promise<DeepPartial<Risk>>;updateRisk(request: UpdateRiskRequest, context: CallContext & CallContextExt): Promise<DeepPartial<Risk>>;+ deleteRisk(request: DeleteRiskRequest, context: CallContext & CallContextExt): Promise<DeepPartial<Empty>>;}export interface RiskServiceClient<CallOptionsExt = {}> {listRisks(request: DeepPartial<ListRisksRequest>, options?: CallOptions & CallOptionsExt): Promise<ListRisksResponse>;+ createRisk(request: DeepPartial<CreateRiskRequest>, options?: CallOptions & CallOptionsExt): Promise<Risk>;updateRisk(request: DeepPartial<UpdateRiskRequest>, options?: CallOptions & CallOptionsExt): Promise<Risk>;+ deleteRisk(request: DeepPartial<DeleteRiskRequest>, options?: CallOptions & CallOptionsExt): Promise<Empty>;}declare var self: any | undefined;diff --git a/proto/gen/grpc-doc/store/README.md b/proto/gen/grpc-doc/store/README.mdindex f32361c4bc..9e357a8eb5 100644--- a/proto/gen/grpc-doc/store/README.md+++ b/proto/gen/grpc-doc/store/README.md@@ -36,6 +36,9 @@- [IdentityProviderType](#bytebase-store-IdentityProviderType)+- [store/risk.proto](#store_risk-proto)+ - [RiskRule](#bytebase-store-RiskRule)+- [store/setting.proto](#store_setting-proto)- [AgentPluginSetting](#bytebase-store-AgentPluginSetting)- [WorkspaceProfileSetting](#bytebase-store-WorkspaceProfileSetting)@@ -530,6 +533,39 @@ OIDCIdentityProviderConfig is the structure for OIDC identity provider config.+<a name="store_risk-proto"></a>+<p align="right"><a href="#top">Top</a></p>++## store/risk.proto++++<a name="bytebase-store-RiskRule"></a>++### RiskRule++++| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| title | [string](#string) | | |+| expression | [google.api.expr.v1alpha1.ParsedExpr](#google-api-expr-v1alpha1-ParsedExpr) | | |+| active | [bool](#bool) | | |+++++++++++++++<a name="store_setting-proto"></a><p align="right"><a href="#top">Top</a></p>diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.mdindex 7c590682ac..870efee7ed 100644--- a/proto/gen/grpc-doc/v1/README.md+++ b/proto/gen/grpc-doc/v1/README.md@@ -269,15 +269,15 @@- [ProjectService](#bytebase-v1-ProjectService)- [v1/risk_service.proto](#v1_risk_service-proto)+ - [CreateRiskRequest](#bytebase-v1-CreateRiskRequest)+ - [DeleteRiskRequest](#bytebase-v1-DeleteRiskRequest)- [ListRisksRequest](#bytebase-v1-ListRisksRequest)- [ListRisksResponse](#bytebase-v1-ListRisksResponse)- [Risk](#bytebase-v1-Risk)- - [RiskAction](#bytebase-v1-RiskAction)- [RiskRule](#bytebase-v1-RiskRule)- [UpdateRiskRequest](#bytebase-v1-UpdateRiskRequest)- - [Risk.Namespace](#bytebase-v1-Risk-Namespace)- - [RiskAction.Type](#bytebase-v1-RiskAction-Type)+ - [Risk.Source](#bytebase-v1-Risk-Source)- [RiskService](#bytebase-v1-RiskService)@@ -4105,6 +4105,36 @@ TYPE_PROJECT_REPOSITORY_PUSH represents Bytebase receiving a push event from the+<a name="bytebase-v1-CreateRiskRequest"></a>++### CreateRiskRequest++++| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| risk | [Risk](#bytebase-v1-Risk) | | The risk to create. |+++++++<a name="bytebase-v1-DeleteRiskRequest"></a>++### DeleteRiskRequest++++| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| name | [string](#string) | | The name of the risk to delete. Format: risks/{risk} |++++++<a name="bytebase-v1-ListRisksRequest"></a>### ListRisksRequest@@ -4149,27 +4179,10 @@ When paginating, all other parameters provided to `LiskRisks` must match the cal| ----- | ---- | ----- | ----------- || name | [string](#string) | | Format: risks/{risk} || uid | [string](#string) | | system-generated unique identifier. |-| namespace | [Risk.Namespace](#bytebase-v1-Risk-Namespace) | | |+| source | [Risk.Source](#bytebase-v1-Risk-Source) | | || title | [string](#string) | | || level | [int64](#int64) | | |-| actions | [RiskAction](#bytebase-v1-RiskAction) | repeated | |-| rules | [RiskRule](#bytebase-v1-RiskRule) | repeated | |-------<a name="bytebase-v1-RiskAction"></a>--### RiskAction----| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| type | [RiskAction.Type](#bytebase-v1-RiskAction-Type) | | |-| approval_template | [string](#string) | | Format: approvalTemplates/{approvalTemplate} |+| rule | [RiskRule](#bytebase-v1-RiskRule) | | |@@ -4213,31 +4226,19 @@ The risk's `name` field is used to identify the risk to update. Format: risk-<a name="bytebase-v1-Risk-Namespace"></a>+<a name="bytebase-v1-Risk-Source"></a>-### Risk.Namespace+### Risk.Source| Name | Number | Description || ---- | ------ | ----------- |-| NAMESPACE_UNSPECIFIED | 0 | |+| SOURCE_UNSPECIFIED | 0 | || DDL | 1 | || DML | 2 | || CREATE_DATABASE | 3 | |--<a name="bytebase-v1-RiskAction-Type"></a>--### RiskAction.Type---| Name | Number | Description |-| ---- | ------ | ----------- |-| TYPE_UNSPECIFIED | 0 | |-| CHOOSE_APPROVAL_TEMPLATE | 1 | |--@@ -4251,7 +4252,9 @@ The risk's `name` field is used to identify the risk to update. Format: risk| Method Name | Request Type | Response Type | Description || ----------- | ------------ | ------------- | ------------|| ListRisks | [ListRisksRequest](#bytebase-v1-ListRisksRequest) | [ListRisksResponse](#bytebase-v1-ListRisksResponse) | |+| CreateRisk | [CreateRiskRequest](#bytebase-v1-CreateRiskRequest) | [Risk](#bytebase-v1-Risk) | || UpdateRisk | [UpdateRiskRequest](#bytebase-v1-UpdateRiskRequest) | [Risk](#bytebase-v1-Risk) | |+| DeleteRisk | [DeleteRiskRequest](#bytebase-v1-DeleteRiskRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | |diff --git a/proto/generated-go/store/risk.pb.go b/proto/generated-go/store/risk.pb.goindex b86128d1ff..4753a5ab3a 100644--- a/proto/generated-go/store/risk.pb.go+++ b/proto/generated-go/store/risk.pb.go@@ -21,16 +21,18 @@ const (_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20))-type RiskExpression struct {+type RiskRule struct {state protoimpl.MessageStatesizeCache protoimpl.SizeCacheunknownFields protoimpl.UnknownFields- Expression *v1alpha1.ParsedExpr `protobuf:"bytes,1,opt,name=expression,proto3" json:"expression,omitempty"`+ Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"`+ Expression *v1alpha1.ParsedExpr `protobuf:"bytes,2,opt,name=expression,proto3" json:"expression,omitempty"`+ Active bool `protobuf:"varint,3,opt,name=active,proto3" json:"active,omitempty"`}-func (x *RiskExpression) Reset() {- *x = RiskExpression{}+func (x *RiskRule) Reset() {+ *x = RiskRule{}if protoimpl.UnsafeEnabled {mi := &file_store_risk_proto_msgTypes[0]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))@@ -38,13 +40,13 @@ func (x *RiskExpression) Reset() {}}-func (x *RiskExpression) String() string {+func (x *RiskRule) String() string {return protoimpl.X.MessageStringOf(x)}-func (*RiskExpression) ProtoMessage() {}+func (*RiskRule) ProtoMessage() {}-func (x *RiskExpression) ProtoReflect() protoreflect.Message {+func (x *RiskRule) ProtoReflect() protoreflect.Message {mi := &file_store_risk_proto_msgTypes[0]if protoimpl.UnsafeEnabled && x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))@@ -56,18 +58,32 @@ func (x *RiskExpression) ProtoReflect() protoreflect.Message {return mi.MessageOf(x)}-// Deprecated: Use RiskExpression.ProtoReflect.Descriptor instead.-func (*RiskExpression) Descriptor() ([]byte, []int) {+// Deprecated: Use RiskRule.ProtoReflect.Descriptor instead.+func (*RiskRule) Descriptor() ([]byte, []int) {return file_store_risk_proto_rawDescGZIP(), []int{0}}-func (x *RiskExpression) GetExpression() *v1alpha1.ParsedExpr {+func (x *RiskRule) GetTitle() string {+ if x != nil {+ return x.Title+ }+ return ""+}++func (x *RiskRule) GetExpression() *v1alpha1.ParsedExpr {if x != nil {return x.Expression}return nil}+func (x *RiskRule) GetActive() bool {+ if x != nil {+ return x.Active+ }+ return false+}+var File_store_risk_proto protoreflect.FileDescriptorvar file_store_risk_proto_rawDesc = []byte{@@ -75,14 +91,17 @@ var file_store_risk_proto_rawDesc = []byte{0x74, 0x6f, 0x12, 0x0e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x6f,0x72, 0x65, 0x1a, 0x25, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x65,0x78, 0x70, 0x72, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x73, 0x79, 0x6e,- 0x74, 0x61, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x56, 0x0a, 0x0e, 0x52, 0x69, 0x73,- 0x6b, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x44, 0x0a, 0x0a, 0x65,- 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,+ 0x74, 0x61, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x7e, 0x0a, 0x08, 0x52, 0x69, 0x73,+ 0x6b, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x01,+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x44, 0x0a, 0x0a, 0x65,+ 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32,0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x65, 0x78, 0x70,0x72, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65,0x64, 0x45, 0x78, 0x70, 0x72, 0x52, 0x0a, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 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,+ 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28,+ 0x08, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 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 (@@ -99,11 +118,11 @@ func file_store_risk_proto_rawDescGZIP() []byte {var file_store_risk_proto_msgTypes = make([]protoimpl.MessageInfo, 1)var file_store_risk_proto_goTypes = []interface{}{- (*RiskExpression)(nil), // 0: bytebase.store.RiskExpression+ (*RiskRule)(nil), // 0: bytebase.store.RiskRule(*v1alpha1.ParsedExpr)(nil), // 1: google.api.expr.v1alpha1.ParsedExpr}var file_store_risk_proto_depIdxs = []int32{- 1, // 0: bytebase.store.RiskExpression.expression:type_name -> google.api.expr.v1alpha1.ParsedExpr+ 1, // 0: bytebase.store.RiskRule.expression:type_name -> google.api.expr.v1alpha1.ParsedExpr1, // [1:1] is the sub-list for method output_type1, // [1:1] is the sub-list for method input_type1, // [1:1] is the sub-list for extension type_name@@ -118,7 +137,7 @@ func file_store_risk_proto_init() {}if !protoimpl.UnsafeEnabled {file_store_risk_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {- switch v := v.(*RiskExpression); i {+ switch v := v.(*RiskRule); i {case 0:return &v.statecase 1:diff --git a/proto/generated-go/v1/risk_service.pb.go b/proto/generated-go/v1/risk_service.pb.goindex 2c3124ca13..3d90c5313f 100644--- a/proto/generated-go/v1/risk_service.pb.go+++ b/proto/generated-go/v1/risk_service.pb.go@@ -11,7 +11,7 @@ import (v1alpha1 "google.golang.org/genproto/googleapis/api/expr/v1alpha1"protoreflect "google.golang.org/protobuf/reflect/protoreflect"protoimpl "google.golang.org/protobuf/runtime/protoimpl"- _ "google.golang.org/protobuf/types/known/emptypb"+ emptypb "google.golang.org/protobuf/types/known/emptypb"fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb"reflect "reflect"sync "sync"@@ -24,102 +24,56 @@ const (_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20))-type Risk_Namespace int32+type Risk_Source int32const (- Risk_NAMESPACE_UNSPECIFIED Risk_Namespace = 0- Risk_DDL Risk_Namespace = 1- Risk_DML Risk_Namespace = 2- Risk_CREATE_DATABASE Risk_Namespace = 3+ Risk_SOURCE_UNSPECIFIED Risk_Source = 0+ Risk_DDL Risk_Source = 1+ Risk_DML Risk_Source = 2+ Risk_CREATE_DATABASE Risk_Source = 3)-// Enum value maps for Risk_Namespace.+// Enum value maps for Risk_Source.var (- Risk_Namespace_name = map[int32]string{- 0: "NAMESPACE_UNSPECIFIED",+ Risk_Source_name = map[int32]string{+ 0: "SOURCE_UNSPECIFIED",1: "DDL",2: "DML",3: "CREATE_DATABASE",}- Risk_Namespace_value = map[string]int32{- "NAMESPACE_UNSPECIFIED": 0,- "DDL": 1,- "DML": 2,- "CREATE_DATABASE": 3,+ Risk_Source_value = map[string]int32{+ "SOURCE_UNSPECIFIED": 0,+ "DDL": 1,+ "DML": 2,+ "CREATE_DATABASE": 3,})-func (x Risk_Namespace) Enum() *Risk_Namespace {- p := new(Risk_Namespace)+func (x Risk_Source) Enum() *Risk_Source {+ p := new(Risk_Source)*p = xreturn p}-func (x Risk_Namespace) String() string {+func (x Risk_Source) String() string {return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))}-func (Risk_Namespace) Descriptor() protoreflect.EnumDescriptor {+func (Risk_Source) Descriptor() protoreflect.EnumDescriptor {return file_v1_risk_service_proto_enumTypes[0].Descriptor()}-func (Risk_Namespace) Type() protoreflect.EnumType {+func (Risk_Source) Type() protoreflect.EnumType {return &file_v1_risk_service_proto_enumTypes[0]}-func (x Risk_Namespace) Number() protoreflect.EnumNumber {+func (x Risk_Source) Number() protoreflect.EnumNumber {return protoreflect.EnumNumber(x)}-// Deprecated: Use Risk_Namespace.Descriptor instead.-func (Risk_Namespace) EnumDescriptor() ([]byte, []int) {- return file_v1_risk_service_proto_rawDescGZIP(), []int{3, 0}-}--type RiskAction_Type int32--const (- RiskAction_TYPE_UNSPECIFIED RiskAction_Type = 0- RiskAction_CHOOSE_APPROVAL_TEMPLATE RiskAction_Type = 1-)--// Enum value maps for RiskAction_Type.-var (- RiskAction_Type_name = map[int32]string{- 0: "TYPE_UNSPECIFIED",- 1: "CHOOSE_APPROVAL_TEMPLATE",- }- RiskAction_Type_value = map[string]int32{- "TYPE_UNSPECIFIED": 0,- "CHOOSE_APPROVAL_TEMPLATE": 1,- }-)--func (x RiskAction_Type) Enum() *RiskAction_Type {- p := new(RiskAction_Type)- *p = x- return p-}--func (x RiskAction_Type) String() string {- return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))-}--func (RiskAction_Type) Descriptor() protoreflect.EnumDescriptor {- return file_v1_risk_service_proto_enumTypes[1].Descriptor()-}--func (RiskAction_Type) Type() protoreflect.EnumType {- return &file_v1_risk_service_proto_enumTypes[1]-}--func (x RiskAction_Type) Number() protoreflect.EnumNumber {- return protoreflect.EnumNumber(x)-}--// Deprecated: Use RiskAction_Type.Descriptor instead.-func (RiskAction_Type) EnumDescriptor() ([]byte, []int) {- return file_v1_risk_service_proto_rawDescGZIP(), []int{4, 0}+// Deprecated: Use Risk_Source.Descriptor instead.+func (Risk_Source) EnumDescriptor() ([]byte, []int) {+ return file_v1_risk_service_proto_rawDescGZIP(), []int{5, 0}}type ListRisksRequest struct {@@ -243,6 +197,54 @@ func (x *ListRisksResponse) GetNextPageToken() string {return ""}+type CreateRiskRequest struct {+ state protoimpl.MessageState+ sizeCache protoimpl.SizeCache+ unknownFields protoimpl.UnknownFields++ // The risk to create.+ Risk *Risk `protobuf:"bytes,1,opt,name=risk,proto3" json:"risk,omitempty"`+}++func (x *CreateRiskRequest) Reset() {+ *x = CreateRiskRequest{}+ if protoimpl.UnsafeEnabled {+ mi := &file_v1_risk_service_proto_msgTypes[2]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+ }+}++func (x *CreateRiskRequest) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*CreateRiskRequest) ProtoMessage() {}++func (x *CreateRiskRequest) ProtoReflect() protoreflect.Message {+ mi := &file_v1_risk_service_proto_msgTypes[2]+ 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 CreateRiskRequest.ProtoReflect.Descriptor instead.+func (*CreateRiskRequest) Descriptor() ([]byte, []int) {+ return file_v1_risk_service_proto_rawDescGZIP(), []int{2}+}++func (x *CreateRiskRequest) GetRisk() *Risk {+ if x != nil {+ return x.Risk+ }+ return nil+}+type UpdateRiskRequest struct {state protoimpl.MessageStatesizeCache protoimpl.SizeCache@@ -260,7 +262,7 @@ type UpdateRiskRequest struct {func (x *UpdateRiskRequest) Reset() {*x = UpdateRiskRequest{}if protoimpl.UnsafeEnabled {- mi := &file_v1_risk_service_proto_msgTypes[2]+ mi := &file_v1_risk_service_proto_msgTypes[3]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -273,7 +275,7 @@ func (x *UpdateRiskRequest) String() string {func (*UpdateRiskRequest) ProtoMessage() {}func (x *UpdateRiskRequest) ProtoReflect() protoreflect.Message {- mi := &file_v1_risk_service_proto_msgTypes[2]+ mi := &file_v1_risk_service_proto_msgTypes[3]if protoimpl.UnsafeEnabled && x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -286,7 +288,7 @@ func (x *UpdateRiskRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use UpdateRiskRequest.ProtoReflect.Descriptor instead.func (*UpdateRiskRequest) Descriptor() ([]byte, []int) {- return file_v1_risk_service_proto_rawDescGZIP(), []int{2}+ return file_v1_risk_service_proto_rawDescGZIP(), []int{3}}func (x *UpdateRiskRequest) GetRisk() *Risk {@@ -303,39 +305,33 @@ func (x *UpdateRiskRequest) GetUpdateMask() *fieldmaskpb.FieldMask {return nil}-type Risk struct {+type DeleteRiskRequest struct {state protoimpl.MessageStatesizeCache protoimpl.SizeCacheunknownFields protoimpl.UnknownFields+ // The name of the risk to delete.// Format: risks/{risk}Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`- // system-generated unique identifier.- Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid,omitempty"`- Namespace Risk_Namespace `protobuf:"varint,3,opt,name=namespace,proto3,enum=bytebase.v1.Risk_Namespace" json:"namespace,omitempty"`- Title string `protobuf:"bytes,4,opt,name=title,proto3" json:"title,omitempty"`- Level int64 `protobuf:"varint,5,opt,name=level,proto3" json:"level,omitempty"`- Actions []*RiskAction `protobuf:"bytes,6,rep,name=actions,proto3" json:"actions,omitempty"`- Rules []*RiskRule `protobuf:"bytes,7,rep,name=rules,proto3" json:"rules,omitempty"`}-func (x *Risk) Reset() {- *x = Risk{}+func (x *DeleteRiskRequest) Reset() {+ *x = DeleteRiskRequest{}if protoimpl.UnsafeEnabled {- mi := &file_v1_risk_service_proto_msgTypes[3]+ mi := &file_v1_risk_service_proto_msgTypes[4]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}}-func (x *Risk) String() string {+func (x *DeleteRiskRequest) String() string {return protoimpl.X.MessageStringOf(x)}-func (*Risk) ProtoMessage() {}+func (*DeleteRiskRequest) ProtoMessage() {}-func (x *Risk) ProtoReflect() protoreflect.Message {- mi := &file_v1_risk_service_proto_msgTypes[3]+func (x *DeleteRiskRequest) ProtoReflect() protoreflect.Message {+ mi := &file_v1_risk_service_proto_msgTypes[4]if protoimpl.UnsafeEnabled && x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -346,89 +342,50 @@ func (x *Risk) ProtoReflect() protoreflect.Message {return mi.MessageOf(x)}-// Deprecated: Use Risk.ProtoReflect.Descriptor instead.-func (*Risk) Descriptor() ([]byte, []int) {- return file_v1_risk_service_proto_rawDescGZIP(), []int{3}+// Deprecated: Use DeleteRiskRequest.ProtoReflect.Descriptor instead.+func (*DeleteRiskRequest) Descriptor() ([]byte, []int) {+ return file_v1_risk_service_proto_rawDescGZIP(), []int{4}}-func (x *Risk) GetName() string {+func (x *DeleteRiskRequest) GetName() string {if x != nil {return x.Name}return ""}-func (x *Risk) GetUid() string {- if x != nil {- return x.Uid- }- return ""-}--func (x *Risk) GetNamespace() Risk_Namespace {- if x != nil {- return x.Namespace- }- return Risk_NAMESPACE_UNSPECIFIED-}--func (x *Risk) GetTitle() string {- if x != nil {- return x.Title- }- return ""-}--func (x *Risk) GetLevel() int64 {- if x != nil {- return x.Level- }- return 0-}--func (x *Risk) GetActions() []*RiskAction {- if x != nil {- return x.Actions- }- return nil-}--func (x *Risk) GetRules() []*RiskRule {- if x != nil {- return x.Rules- }- return nil-}--type RiskAction struct {+type Risk struct {state protoimpl.MessageStatesizeCache protoimpl.SizeCacheunknownFields protoimpl.UnknownFields- Type RiskAction_Type `protobuf:"varint,1,opt,name=type,proto3,enum=bytebase.v1.RiskAction_Type" json:"type,omitempty"`- // Types that are assignable to Payload:- //- // *RiskAction_ApprovalTemplate- Payload isRiskAction_Payload `protobuf_oneof:"payload"`+ // Format: risks/{risk}+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`+ // system-generated unique identifier.+ Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid,omitempty"`+ Source Risk_Source `protobuf:"varint,3,opt,name=source,proto3,enum=bytebase.v1.Risk_Source" json:"source,omitempty"`+ Title string `protobuf:"bytes,4,opt,name=title,proto3" json:"title,omitempty"`+ Level int64 `protobuf:"varint,5,opt,name=level,proto3" json:"level,omitempty"`+ Rule *RiskRule `protobuf:"bytes,7,opt,name=rule,proto3" json:"rule,omitempty"`}-func (x *RiskAction) Reset() {- *x = RiskAction{}+func (x *Risk) Reset() {+ *x = Risk{}if protoimpl.UnsafeEnabled {- mi := &file_v1_risk_service_proto_msgTypes[4]+ mi := &file_v1_risk_service_proto_msgTypes[5]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}}-func (x *RiskAction) String() string {+func (x *Risk) String() string {return protoimpl.X.MessageStringOf(x)}-func (*RiskAction) ProtoMessage() {}+func (*Risk) ProtoMessage() {}-func (x *RiskAction) ProtoReflect() protoreflect.Message {- mi := &file_v1_risk_service_proto_msgTypes[4]+func (x *Risk) ProtoReflect() protoreflect.Message {+ mi := &file_v1_risk_service_proto_msgTypes[5]if protoimpl.UnsafeEnabled && x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -439,42 +396,52 @@ func (x *RiskAction) ProtoReflect() protoreflect.Message {return mi.MessageOf(x)}-// Deprecated: Use RiskAction.ProtoReflect.Descriptor instead.-func (*RiskAction) Descriptor() ([]byte, []int) {- return file_v1_risk_service_proto_rawDescGZIP(), []int{4}+// Deprecated: Use Risk.ProtoReflect.Descriptor instead.+func (*Risk) Descriptor() ([]byte, []int) {+ return file_v1_risk_service_proto_rawDescGZIP(), []int{5}}-func (x *RiskAction) GetType() RiskAction_Type {+func (x *Risk) GetName() string {if x != nil {- return x.Type+ return x.Name}- return RiskAction_TYPE_UNSPECIFIED+ return ""}-func (m *RiskAction) GetPayload() isRiskAction_Payload {- if m != nil {- return m.Payload+func (x *Risk) GetUid() string {+ if x != nil {+ return x.Uid}- return nil+ return ""}-func (x *RiskAction) GetApprovalTemplate() string {- if x, ok := x.GetPayload().(*RiskAction_ApprovalTemplate); ok {- return x.ApprovalTemplate+func (x *Risk) GetSource() Risk_Source {+ if x != nil {+ return x.Source}- return ""+ return Risk_SOURCE_UNSPECIFIED}-type isRiskAction_Payload interface {- isRiskAction_Payload()+func (x *Risk) GetTitle() string {+ if x != nil {+ return x.Title+ }+ return ""}-type RiskAction_ApprovalTemplate struct {- // Format: approvalTemplates/{approvalTemplate}- ApprovalTemplate string `protobuf:"bytes,2,opt,name=approval_template,json=approvalTemplate,proto3,oneof"`+func (x *Risk) GetLevel() int64 {+ if x != nil {+ return x.Level+ }+ return 0}-func (*RiskAction_ApprovalTemplate) isRiskAction_Payload() {}+func (x *Risk) GetRule() *RiskRule {+ if x != nil {+ return x.Rule+ }+ return nil+}type RiskRule struct {state protoimpl.MessageState@@ -489,7 +456,7 @@ type RiskRule struct {func (x *RiskRule) Reset() {*x = RiskRule{}if protoimpl.UnsafeEnabled {- mi := &file_v1_risk_service_proto_msgTypes[5]+ mi := &file_v1_risk_service_proto_msgTypes[6]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -502,7 +469,7 @@ func (x *RiskRule) String() string {func (*RiskRule) ProtoMessage() {}func (x *RiskRule) ProtoReflect() protoreflect.Message {- mi := &file_v1_risk_service_proto_msgTypes[5]+ mi := &file_v1_risk_service_proto_msgTypes[6]if protoimpl.UnsafeEnabled && x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -515,7 +482,7 @@ func (x *RiskRule) ProtoReflect() protoreflect.Message {// Deprecated: Use RiskRule.ProtoReflect.Descriptor instead.func (*RiskRule) Descriptor() ([]byte, []int) {- return file_v1_risk_service_proto_rawDescGZIP(), []int{5}+ return file_v1_risk_service_proto_rawDescGZIP(), []int{6}}func (x *RiskRule) GetTitle() string {@@ -567,71 +534,75 @@ var file_v1_risk_service_proto_rawDesc = []byte{0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x69, 0x73, 0x6b, 0x52, 0x05, 0x72, 0x69, 0x73, 0x6b, 0x73,0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f,0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50,- 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x7c, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61,+ 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x3f, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61,0x74, 0x65, 0x52, 0x69, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2a, 0x0a,0x04, 0x72, 0x69, 0x73, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x62, 0x79,0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x69, 0x73, 0x6b, 0x42, 0x03,- 0xe0, 0x41, 0x02, 0x52, 0x04, 0x72, 0x69, 0x73, 0x6b, 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64,- 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a,- 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,- 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61,- 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x22, 0xc7, 0x02, 0x0a, 0x04, 0x52, 0x69, 0x73, 0x6b, 0x12,- 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e,- 0x61, 0x6d, 0x65, 0x12, 0x15, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,- 0x42, 0x03, 0xe0, 0x41, 0x03, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x39, 0x0a, 0x09, 0x6e, 0x61,- 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e,- 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x69, 0x73, 0x6b,- 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65,- 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x04,- 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6c,- 0x65, 0x76, 0x65, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6c, 0x65, 0x76, 0x65,- 0x6c, 0x12, 0x31, 0x0a, 0x07, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x06, 0x20, 0x03,- 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31,- 0x2e, 0x52, 0x69, 0x73, 0x6b, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x61, 0x63, 0x74,- 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2b, 0x0a, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x07, 0x20,- 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76,- 0x31, 0x2e, 0x52, 0x69, 0x73, 0x6b, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x05, 0x72, 0x75, 0x6c, 0x65,- 0x73, 0x22, 0x4d, 0x0a, 0x09, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x19,- 0x0a, 0x15, 0x4e, 0x41, 0x4d, 0x45, 0x53, 0x50, 0x41, 0x43, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50,- 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x44, 0x44, 0x4c,- 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x44, 0x4d, 0x4c, 0x10, 0x02, 0x12, 0x13, 0x0a, 0x0f, 0x43,- 0x52, 0x45, 0x41, 0x54, 0x45, 0x5f, 0x44, 0x41, 0x54, 0x41, 0x42, 0x41, 0x53, 0x45, 0x10, 0x03,- 0x22, 0xb4, 0x01, 0x0a, 0x0a, 0x52, 0x69, 0x73, 0x6b, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12,- 0x30, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e,- 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x69, 0x73, 0x6b,- 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70,- 0x65, 0x12, 0x2d, 0x0a, 0x11, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x61, 0x6c, 0x5f, 0x74, 0x65,- 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x10,- 0x61, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x61, 0x6c, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65,- 0x22, 0x3a, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x59, 0x50, 0x45,- 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1c,- 0x0a, 0x18, 0x43, 0x48, 0x4f, 0x4f, 0x53, 0x45, 0x5f, 0x41, 0x50, 0x50, 0x52, 0x4f, 0x56, 0x41,- 0x4c, 0x5f, 0x54, 0x45, 0x4d, 0x50, 0x4c, 0x41, 0x54, 0x45, 0x10, 0x01, 0x42, 0x09, 0x0a, 0x07,- 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x7e, 0x0a, 0x08, 0x52, 0x69, 0x73, 0x6b, 0x52,- 0x75, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01,- 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x44, 0x0a, 0x0a, 0x65, 0x78, 0x70,- 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e,- 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e,- 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, 0x64, 0x45,- 0x78, 0x70, 0x72, 0x52, 0x0a, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12,- 0x16, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52,- 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x32, 0xea, 0x01, 0x0a, 0x0b, 0x52, 0x69, 0x73, 0x6b,- 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x60, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x52,- 0x69, 0x73, 0x6b, 0x73, 0x12, 0x1d, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e,- 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x69, 0x73, 0x6b, 0x73, 0x52, 0x65, 0x71, 0x75,- 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76,- 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x69, 0x73, 0x6b, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f,- 0x6e, 0x73, 0x65, 0x22, 0x14, 0xda, 0x41, 0x00, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0b, 0x12, 0x09,- 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x69, 0x73, 0x6b, 0x73, 0x12, 0x79, 0x0a, 0x0a, 0x55, 0x70, 0x64,- 0x61, 0x74, 0x65, 0x52, 0x69, 0x73, 0x6b, 0x12, 0x1e, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61,- 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x69, 0x73, 0x6b,- 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61,- 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x69, 0x73, 0x6b, 0x22, 0x38, 0xda, 0x41, 0x10, 0x72,- 0x69, 0x73, 0x6b, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x82,- 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x3a, 0x04, 0x72, 0x69, 0x73, 0x6b, 0x32, 0x17, 0x2f, 0x76, 0x31,- 0x2f, 0x7b, 0x72, 0x69, 0x73, 0x6b, 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x72, 0x69, 0x73, 0x6b,- 0x73, 0x2f, 0x2a, 0x7d, 0x42, 0x11, 0x5a, 0x0f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65,- 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,+ 0xe0, 0x41, 0x02, 0x52, 0x04, 0x72, 0x69, 0x73, 0x6b, 0x22, 0x7c, 0x0a, 0x11, 0x55, 0x70, 0x64,+ 0x61, 0x74, 0x65, 0x52, 0x69, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2a,+ 0x0a, 0x04, 0x72, 0x69, 0x73, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x62,+ 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x69, 0x73, 0x6b, 0x42,+ 0x03, 0xe0, 0x41, 0x02, 0x52, 0x04, 0x72, 0x69, 0x73, 0x6b, 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70,+ 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32,+ 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,+ 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x0a, 0x75, 0x70, 0x64,+ 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x22, 0x2c, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74,+ 0x65, 0x52, 0x69, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x04,+ 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x02, 0x52,+ 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x83, 0x02, 0x0a, 0x04, 0x52, 0x69, 0x73, 0x6b, 0x12, 0x12,+ 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61,+ 0x6d, 0x65, 0x12, 0x15, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42,+ 0x03, 0xe0, 0x41, 0x03, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x6f, 0x75,+ 0x72, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x62, 0x79, 0x74, 0x65,+ 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x69, 0x73, 0x6b, 0x2e, 0x53, 0x6f, 0x75,+ 0x72, 0x63, 0x65, 0x52, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74,+ 0x69, 0x74, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c,+ 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03,+ 0x52, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x29, 0x0a, 0x04, 0x72, 0x75, 0x6c, 0x65, 0x18,+ 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65,+ 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x69, 0x73, 0x6b, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x04, 0x72, 0x75,+ 0x6c, 0x65, 0x22, 0x47, 0x0a, 0x06, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x16, 0x0a, 0x12,+ 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49,+ 0x45, 0x44, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x44, 0x44, 0x4c, 0x10, 0x01, 0x12, 0x07, 0x0a,+ 0x03, 0x44, 0x4d, 0x4c, 0x10, 0x02, 0x12, 0x13, 0x0a, 0x0f, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45,+ 0x5f, 0x44, 0x41, 0x54, 0x41, 0x42, 0x41, 0x53, 0x45, 0x10, 0x03, 0x22, 0x7e, 0x0a, 0x08, 0x52,+ 0x69, 0x73, 0x6b, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65,+ 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x44, 0x0a,+ 0x0a, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28,+ 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x65,+ 0x78, 0x70, 0x72, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x72,+ 0x73, 0x65, 0x64, 0x45, 0x78, 0x70, 0x72, 0x52, 0x0a, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73,+ 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18, 0x03, 0x20,+ 0x01, 0x28, 0x08, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x32, 0xad, 0x03, 0x0a, 0x0b,+ 0x52, 0x69, 0x73, 0x6b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x60, 0x0a, 0x09, 0x4c,+ 0x69, 0x73, 0x74, 0x52, 0x69, 0x73, 0x6b, 0x73, 0x12, 0x1d, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,+ 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x69, 0x73, 0x6b, 0x73,+ 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61,+ 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x69, 0x73, 0x6b, 0x73, 0x52,+ 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x14, 0xda, 0x41, 0x00, 0x82, 0xd3, 0xe4, 0x93,+ 0x02, 0x0b, 0x12, 0x09, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x69, 0x73, 0x6b, 0x73, 0x12, 0x5f, 0x0a,+ 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x69, 0x73, 0x6b, 0x12, 0x1e, 0x2e, 0x62, 0x79,+ 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65,+ 0x52, 0x69, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x62, 0x79,+ 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x69, 0x73, 0x6b, 0x22, 0x1e,+ 0xda, 0x41, 0x04, 0x72, 0x69, 0x73, 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x11, 0x3a, 0x04, 0x72,+ 0x69, 0x73, 0x6b, 0x22, 0x09, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x69, 0x73, 0x6b, 0x73, 0x12, 0x79,+ 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x69, 0x73, 0x6b, 0x12, 0x1e, 0x2e, 0x62,+ 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74,+ 0x65, 0x52, 0x69, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x62,+ 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x69, 0x73, 0x6b, 0x22,+ 0x38, 0xda, 0x41, 0x10, 0x72, 0x69, 0x73, 0x6b, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f,+ 0x6d, 0x61, 0x73, 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x3a, 0x04, 0x72, 0x69, 0x73, 0x6b,+ 0x32, 0x17, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x72, 0x69, 0x73, 0x6b, 0x2e, 0x6e, 0x61, 0x6d, 0x65,+ 0x3d, 0x72, 0x69, 0x73, 0x6b, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x60, 0x0a, 0x0a, 0x44, 0x65, 0x6c,+ 0x65, 0x74, 0x65, 0x52, 0x69, 0x73, 0x6b, 0x12, 0x1e, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61,+ 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x69, 0x73, 0x6b,+ 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,+ 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22,+ 0x1a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x2a, 0x12, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61,+ 0x6d, 0x65, 0x3d, 0x72, 0x69, 0x73, 0x6b, 0x73, 0x2f, 0x2a, 0x7d, 0x42, 0x11, 0x5a, 0x0f, 0x67,+ 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x31, 0x62, 0x06,+ 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,}var (@@ -646,38 +617,42 @@ func file_v1_risk_service_proto_rawDescGZIP() []byte {return file_v1_risk_service_proto_rawDescData}-var file_v1_risk_service_proto_enumTypes = make([]protoimpl.EnumInfo, 2)-var file_v1_risk_service_proto_msgTypes = make([]protoimpl.MessageInfo, 6)+var file_v1_risk_service_proto_enumTypes = make([]protoimpl.EnumInfo, 1)+var file_v1_risk_service_proto_msgTypes = make([]protoimpl.MessageInfo, 7)var file_v1_risk_service_proto_goTypes = []interface{}{- (Risk_Namespace)(0), // 0: bytebase.v1.Risk.Namespace- (RiskAction_Type)(0), // 1: bytebase.v1.RiskAction.Type- (*ListRisksRequest)(nil), // 2: bytebase.v1.ListRisksRequest- (*ListRisksResponse)(nil), // 3: bytebase.v1.ListRisksResponse+ (Risk_Source)(0), // 0: bytebase.v1.Risk.Source+ (*ListRisksRequest)(nil), // 1: bytebase.v1.ListRisksRequest+ (*ListRisksResponse)(nil), // 2: bytebase.v1.ListRisksResponse+ (*CreateRiskRequest)(nil), // 3: bytebase.v1.CreateRiskRequest(*UpdateRiskRequest)(nil), // 4: bytebase.v1.UpdateRiskRequest- (*Risk)(nil), // 5: bytebase.v1.Risk- (*RiskAction)(nil), // 6: bytebase.v1.RiskAction+ (*DeleteRiskRequest)(nil), // 5: bytebase.v1.DeleteRiskRequest+ (*Risk)(nil), // 6: bytebase.v1.Risk(*RiskRule)(nil), // 7: bytebase.v1.RiskRule(*fieldmaskpb.FieldMask)(nil), // 8: google.protobuf.FieldMask(*v1alpha1.ParsedExpr)(nil), // 9: google.api.expr.v1alpha1.ParsedExpr+ (*emptypb.Empty)(nil), // 10: google.protobuf.Empty}var file_v1_risk_service_proto_depIdxs = []int32{- 5, // 0: bytebase.v1.ListRisksResponse.risks:type_name -> bytebase.v1.Risk- 5, // 1: bytebase.v1.UpdateRiskRequest.risk:type_name -> bytebase.v1.Risk- 8, // 2: bytebase.v1.UpdateRiskRequest.update_mask:type_name -> google.protobuf.FieldMask- 0, // 3: bytebase.v1.Risk.namespace:type_name -> bytebase.v1.Risk.Namespace- 6, // 4: bytebase.v1.Risk.actions:type_name -> bytebase.v1.RiskAction- 7, // 5: bytebase.v1.Risk.rules:type_name -> bytebase.v1.RiskRule- 1, // 6: bytebase.v1.RiskAction.type:type_name -> bytebase.v1.RiskAction.Type- 9, // 7: bytebase.v1.RiskRule.expression:type_name -> google.api.expr.v1alpha1.ParsedExpr- 2, // 8: bytebase.v1.RiskService.ListRisks:input_type -> bytebase.v1.ListRisksRequest+ 6, // 0: bytebase.v1.ListRisksResponse.risks:type_name -> bytebase.v1.Risk+ 6, // 1: bytebase.v1.CreateRiskRequest.risk:type_name -> bytebase.v1.Risk+ 6, // 2: bytebase.v1.UpdateRiskRequest.risk:type_name -> bytebase.v1.Risk+ 8, // 3: bytebase.v1.UpdateRiskRequest.update_mask:type_name -> google.protobuf.FieldMask+ 0, // 4: bytebase.v1.Risk.source:type_name -> bytebase.v1.Risk.Source+ 7, // 5: bytebase.v1.Risk.rule:type_name -> bytebase.v1.RiskRule+ 9, // 6: bytebase.v1.RiskRule.expression:type_name -> google.api.expr.v1alpha1.ParsedExpr+ 1, // 7: bytebase.v1.RiskService.ListRisks:input_type -> bytebase.v1.ListRisksRequest+ 3, // 8: bytebase.v1.RiskService.CreateRisk:input_type -> bytebase.v1.CreateRiskRequest4, // 9: bytebase.v1.RiskService.UpdateRisk:input_type -> bytebase.v1.UpdateRiskRequest- 3, // 10: bytebase.v1.RiskService.ListRisks:output_type -> bytebase.v1.ListRisksResponse- 5, // 11: bytebase.v1.RiskService.UpdateRisk:output_type -> bytebase.v1.Risk- 10, // [10:12] is the sub-list for method output_type- 8, // [8:10] 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+ 5, // 10: bytebase.v1.RiskService.DeleteRisk:input_type -> bytebase.v1.DeleteRiskRequest+ 2, // 11: bytebase.v1.RiskService.ListRisks:output_type -> bytebase.v1.ListRisksResponse+ 6, // 12: bytebase.v1.RiskService.CreateRisk:output_type -> bytebase.v1.Risk+ 6, // 13: bytebase.v1.RiskService.UpdateRisk:output_type -> bytebase.v1.Risk+ 10, // 14: bytebase.v1.RiskService.DeleteRisk:output_type -> google.protobuf.Empty+ 11, // [11:15] is the sub-list for method output_type+ 7, // [7:11] is the sub-list for method input_type+ 7, // [7:7] is the sub-list for extension type_name+ 7, // [7:7] is the sub-list for extension extendee+ 0, // [0:7] is the sub-list for field type_name}func init() { file_v1_risk_service_proto_init() }@@ -711,7 +686,7 @@ func file_v1_risk_service_proto_init() {}}file_v1_risk_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {- switch v := v.(*UpdateRiskRequest); i {+ switch v := v.(*CreateRiskRequest); i {case 0:return &v.statecase 1:@@ -723,7 +698,7 @@ func file_v1_risk_service_proto_init() {}}file_v1_risk_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {- switch v := v.(*Risk); i {+ switch v := v.(*UpdateRiskRequest); i {case 0:return &v.statecase 1:@@ -735,7 +710,7 @@ func file_v1_risk_service_proto_init() {}}file_v1_risk_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {- switch v := v.(*RiskAction); i {+ switch v := v.(*DeleteRiskRequest); i {case 0:return &v.statecase 1:@@ -747,6 +722,18 @@ func file_v1_risk_service_proto_init() {}}file_v1_risk_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {+ switch v := v.(*Risk); i {+ case 0:+ return &v.state+ case 1:+ return &v.sizeCache+ case 2:+ return &v.unknownFields+ default:+ return nil+ }+ }+ file_v1_risk_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {switch v := v.(*RiskRule); i {case 0:return &v.state@@ -759,16 +746,13 @@ func file_v1_risk_service_proto_init() {}}}- file_v1_risk_service_proto_msgTypes[4].OneofWrappers = []interface{}{- (*RiskAction_ApprovalTemplate)(nil),- }type x struct{}out := protoimpl.TypeBuilder{File: protoimpl.DescBuilder{GoPackagePath: reflect.TypeOf(x{}).PkgPath(),RawDescriptor: file_v1_risk_service_proto_rawDesc,- NumEnums: 2,- NumMessages: 6,+ NumEnums: 1,+ NumMessages: 7,NumExtensions: 0,NumServices: 1,},diff --git a/proto/generated-go/v1/risk_service.pb.gw.go b/proto/generated-go/v1/risk_service.pb.gw.goindex a282654373..bca986d10b 100644--- a/proto/generated-go/v1/risk_service.pb.gw.go+++ b/proto/generated-go/v1/risk_service.pb.gw.go@@ -67,6 +67,40 @@ func local_request_RiskService_ListRisks_0(ctx context.Context, marshaler runtim}+func request_RiskService_CreateRisk_0(ctx context.Context, marshaler runtime.Marshaler, client RiskServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {+ var protoReq CreateRiskRequest+ var metadata runtime.ServerMetadata++ newReader, berr := utilities.IOReaderFactory(req.Body)+ if berr != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)+ }+ if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Risk); err != nil && err != io.EOF {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)+ }++ msg, err := client.CreateRisk(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))+ return msg, metadata, err++}++func local_request_RiskService_CreateRisk_0(ctx context.Context, marshaler runtime.Marshaler, server RiskServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {+ var protoReq CreateRiskRequest+ var metadata runtime.ServerMetadata++ newReader, berr := utilities.IOReaderFactory(req.Body)+ if berr != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)+ }+ if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Risk); err != nil && err != io.EOF {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)+ }++ msg, err := server.CreateRisk(ctx, &protoReq)+ return msg, metadata, err++}+var (filter_RiskService_UpdateRisk_0 = &utilities.DoubleArray{Encoding: map[string]int{"risk": 0, "name": 1}, Base: []int{1, 4, 5, 2, 0, 0, 0, 0}, Check: []int{0, 1, 1, 2, 4, 2, 2, 3}})@@ -167,6 +201,58 @@ func local_request_RiskService_UpdateRisk_0(ctx context.Context, marshaler runti}+func request_RiskService_DeleteRisk_0(ctx context.Context, marshaler runtime.Marshaler, client RiskServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {+ var protoReq DeleteRiskRequest+ var metadata runtime.ServerMetadata++ var (+ val string+ ok bool+ err error+ _ = err+ )++ val, ok = pathParams["name"]+ if !ok {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")+ }++ protoReq.Name, err = runtime.String(val)+ if err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)+ }++ msg, err := client.DeleteRisk(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))+ return msg, metadata, err++}++func local_request_RiskService_DeleteRisk_0(ctx context.Context, marshaler runtime.Marshaler, server RiskServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {+ var protoReq DeleteRiskRequest+ var metadata runtime.ServerMetadata++ var (+ val string+ ok bool+ err error+ _ = err+ )++ val, ok = pathParams["name"]+ if !ok {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")+ }++ protoReq.Name, err = runtime.String(val)+ if err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)+ }++ msg, err := server.DeleteRisk(ctx, &protoReq)+ return msg, metadata, err++}+// RegisterRiskServiceHandlerServer registers the http handlers for service RiskService to "mux".// UnaryRPC :call RiskServiceServer directly.// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.@@ -198,6 +284,31 @@ func RegisterRiskServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux})+ mux.Handle("POST", pattern_RiskService_CreateRisk_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {+ ctx, cancel := context.WithCancel(req.Context())+ defer cancel()+ var stream runtime.ServerTransportStream+ ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)+ var err error+ var annotatedContext context.Context+ annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.RiskService/CreateRisk", runtime.WithHTTPPathPattern("/v1/risks"))+ if err != nil {+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)+ return+ }+ resp, md, err := local_request_RiskService_CreateRisk_0(annotatedContext, inboundMarshaler, server, req, pathParams)+ md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)+ if err != nil {+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)+ return+ }++ forward_RiskService_CreateRisk_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)++ })+mux.Handle("PATCH", pattern_RiskService_UpdateRisk_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {ctx, cancel := context.WithCancel(req.Context())defer cancel()@@ -223,6 +334,31 @@ func RegisterRiskServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux})+ mux.Handle("DELETE", pattern_RiskService_DeleteRisk_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {+ ctx, cancel := context.WithCancel(req.Context())+ defer cancel()+ var stream runtime.ServerTransportStream+ ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)+ var err error+ var annotatedContext context.Context+ annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.RiskService/DeleteRisk", runtime.WithHTTPPathPattern("/v1/{name=risks/*}"))+ if err != nil {+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)+ return+ }+ resp, md, err := local_request_RiskService_DeleteRisk_0(annotatedContext, inboundMarshaler, server, req, pathParams)+ md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)+ if err != nil {+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)+ return+ }++ forward_RiskService_DeleteRisk_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)++ })+return nil}@@ -286,6 +422,28 @@ func RegisterRiskServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux})+ mux.Handle("POST", pattern_RiskService_CreateRisk_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {+ ctx, cancel := context.WithCancel(req.Context())+ defer cancel()+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)+ var err error+ var annotatedContext context.Context+ annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.RiskService/CreateRisk", runtime.WithHTTPPathPattern("/v1/risks"))+ if err != nil {+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)+ return+ }+ resp, md, err := request_RiskService_CreateRisk_0(annotatedContext, inboundMarshaler, client, req, pathParams)+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)+ if err != nil {+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)+ return+ }++ forward_RiskService_CreateRisk_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)++ })+mux.Handle("PATCH", pattern_RiskService_UpdateRisk_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {ctx, cancel := context.WithCancel(req.Context())defer cancel()@@ -308,17 +466,47 @@ func RegisterRiskServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux})+ mux.Handle("DELETE", pattern_RiskService_DeleteRisk_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {+ ctx, cancel := context.WithCancel(req.Context())+ defer cancel()+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)+ var err error+ var annotatedContext context.Context+ annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.RiskService/DeleteRisk", runtime.WithHTTPPathPattern("/v1/{name=risks/*}"))+ if err != nil {+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)+ return+ }+ resp, md, err := request_RiskService_DeleteRisk_0(annotatedContext, inboundMarshaler, client, req, pathParams)+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)+ if err != nil {+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)+ return+ }++ forward_RiskService_DeleteRisk_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)++ })+return nil}var (pattern_RiskService_ListRisks_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "risks"}, ""))+ pattern_RiskService_CreateRisk_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "risks"}, ""))+pattern_RiskService_UpdateRisk_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "risks", "risk.name"}, ""))++ pattern_RiskService_DeleteRisk_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "risks", "name"}, "")))var (forward_RiskService_ListRisks_0 = runtime.ForwardResponseMessage+ forward_RiskService_CreateRisk_0 = runtime.ForwardResponseMessage+forward_RiskService_UpdateRisk_0 = runtime.ForwardResponseMessage++ forward_RiskService_DeleteRisk_0 = runtime.ForwardResponseMessage)diff --git a/proto/generated-go/v1/risk_service_grpc.pb.go b/proto/generated-go/v1/risk_service_grpc.pb.goindex fa3b438cc4..7121ffe8bd 100644--- a/proto/generated-go/v1/risk_service_grpc.pb.go+++ b/proto/generated-go/v1/risk_service_grpc.pb.go@@ -11,6 +11,7 @@ import (grpc "google.golang.org/grpc"codes "google.golang.org/grpc/codes"status "google.golang.org/grpc/status"+ emptypb "google.golang.org/protobuf/types/known/emptypb")// This is a compile-time assertion to ensure that this generated file@@ -20,7 +21,9 @@ const _ = grpc.SupportPackageIsVersion7const (RiskService_ListRisks_FullMethodName = "/bytebase.v1.RiskService/ListRisks"+ RiskService_CreateRisk_FullMethodName = "/bytebase.v1.RiskService/CreateRisk"RiskService_UpdateRisk_FullMethodName = "/bytebase.v1.RiskService/UpdateRisk"+ RiskService_DeleteRisk_FullMethodName = "/bytebase.v1.RiskService/DeleteRisk")// RiskServiceClient is the client API for RiskService service.@@ -28,7 +31,9 @@ const (// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.type RiskServiceClient interface {ListRisks(ctx context.Context, in *ListRisksRequest, opts ...grpc.CallOption) (*ListRisksResponse, error)+ CreateRisk(ctx context.Context, in *CreateRiskRequest, opts ...grpc.CallOption) (*Risk, error)UpdateRisk(ctx context.Context, in *UpdateRiskRequest, opts ...grpc.CallOption) (*Risk, error)+ DeleteRisk(ctx context.Context, in *DeleteRiskRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)}type riskServiceClient struct {@@ -48,6 +53,15 @@ func (c *riskServiceClient) ListRisks(ctx context.Context, in *ListRisksRequest,return out, nil}+func (c *riskServiceClient) CreateRisk(ctx context.Context, in *CreateRiskRequest, opts ...grpc.CallOption) (*Risk, error) {+ out := new(Risk)+ err := c.cc.Invoke(ctx, RiskService_CreateRisk_FullMethodName, in, out, opts...)+ if err != nil {+ return nil, err+ }+ return out, nil+}+func (c *riskServiceClient) UpdateRisk(ctx context.Context, in *UpdateRiskRequest, opts ...grpc.CallOption) (*Risk, error) {out := new(Risk)err := c.cc.Invoke(ctx, RiskService_UpdateRisk_FullMethodName, in, out, opts...)@@ -57,12 +71,23 @@ func (c *riskServiceClient) UpdateRisk(ctx context.Context, in *UpdateRiskRequesreturn out, nil}+func (c *riskServiceClient) DeleteRisk(ctx context.Context, in *DeleteRiskRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {+ out := new(emptypb.Empty)+ err := c.cc.Invoke(ctx, RiskService_DeleteRisk_FullMethodName, in, out, opts...)+ if err != nil {+ return nil, err+ }+ return out, nil+}+// RiskServiceServer is the server API for RiskService service.// All implementations must embed UnimplementedRiskServiceServer// for forward compatibilitytype RiskServiceServer interface {ListRisks(context.Context, *ListRisksRequest) (*ListRisksResponse, error)+ CreateRisk(context.Context, *CreateRiskRequest) (*Risk, error)UpdateRisk(context.Context, *UpdateRiskRequest) (*Risk, error)+ DeleteRisk(context.Context, *DeleteRiskRequest) (*emptypb.Empty, error)mustEmbedUnimplementedRiskServiceServer()}@@ -73,9 +98,15 @@ type UnimplementedRiskServiceServer struct {func (UnimplementedRiskServiceServer) ListRisks(context.Context, *ListRisksRequest) (*ListRisksResponse, error) {return nil, status.Errorf(codes.Unimplemented, "method ListRisks not implemented")}+func (UnimplementedRiskServiceServer) CreateRisk(context.Context, *CreateRiskRequest) (*Risk, error) {+ return nil, status.Errorf(codes.Unimplemented, "method CreateRisk not implemented")+}func (UnimplementedRiskServiceServer) UpdateRisk(context.Context, *UpdateRiskRequest) (*Risk, error) {return nil, status.Errorf(codes.Unimplemented, "method UpdateRisk not implemented")}+func (UnimplementedRiskServiceServer) DeleteRisk(context.Context, *DeleteRiskRequest) (*emptypb.Empty, error) {+ return nil, status.Errorf(codes.Unimplemented, "method DeleteRisk not implemented")+}func (UnimplementedRiskServiceServer) mustEmbedUnimplementedRiskServiceServer() {}// UnsafeRiskServiceServer may be embedded to opt out of forward compatibility for this service.@@ -107,6 +138,24 @@ func _RiskService_ListRisks_Handler(srv interface{}, ctx context.Context, dec fureturn interceptor(ctx, in, info, handler)}+func _RiskService_CreateRisk_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {+ in := new(CreateRiskRequest)+ if err := dec(in); err != nil {+ return nil, err+ }+ if interceptor == nil {+ return srv.(RiskServiceServer).CreateRisk(ctx, in)+ }+ info := &grpc.UnaryServerInfo{+ Server: srv,+ FullMethod: RiskService_CreateRisk_FullMethodName,+ }+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {+ return srv.(RiskServiceServer).CreateRisk(ctx, req.(*CreateRiskRequest))+ }+ return interceptor(ctx, in, info, handler)+}+func _RiskService_UpdateRisk_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {in := new(UpdateRiskRequest)if err := dec(in); err != nil {@@ -125,6 +174,24 @@ func _RiskService_UpdateRisk_Handler(srv interface{}, ctx context.Context, dec freturn interceptor(ctx, in, info, handler)}+func _RiskService_DeleteRisk_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {+ in := new(DeleteRiskRequest)+ if err := dec(in); err != nil {+ return nil, err+ }+ if interceptor == nil {+ return srv.(RiskServiceServer).DeleteRisk(ctx, in)+ }+ info := &grpc.UnaryServerInfo{+ Server: srv,+ FullMethod: RiskService_DeleteRisk_FullMethodName,+ }+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {+ return srv.(RiskServiceServer).DeleteRisk(ctx, req.(*DeleteRiskRequest))+ }+ return interceptor(ctx, in, info, handler)+}+// RiskService_ServiceDesc is the grpc.ServiceDesc for RiskService service.// It's only intended for direct use with grpc.RegisterService,// and not to be introspected or modified (even as a copy)@@ -136,10 +203,18 @@ var RiskService_ServiceDesc = grpc.ServiceDesc{MethodName: "ListRisks",Handler: _RiskService_ListRisks_Handler,},+ {+ MethodName: "CreateRisk",+ Handler: _RiskService_CreateRisk_Handler,+ },{MethodName: "UpdateRisk",Handler: _RiskService_UpdateRisk_Handler,},+ {+ MethodName: "DeleteRisk",+ Handler: _RiskService_DeleteRisk_Handler,+ },},Streams: []grpc.StreamDesc{},Metadata: "v1/risk_service.proto",diff --git a/proto/store/activity.proto b/proto/store/activity.protoindex 0f31300d57..058c02e4d3 100644--- a/proto/store/activity.proto+++ b/proto/store/activity.proto@@ -5,10 +5,10 @@ package bytebase.store;option go_package = "github.com/bytebase/bytebase/api/proto/store";message ActivityPayload {- oneof payload {- ActivityIssueCreatePayload issue_create_payload = 1;- ActivityIssueCommentCreatePayload issue_comment_create_payload = 2;- }+ oneof payload {+ ActivityIssueCreatePayload issue_create_payload = 1;+ ActivityIssueCommentCreatePayload issue_comment_create_payload = 2;+ }}// ActivityIssueCreatePayload is the payloads for creating issues.@@ -38,7 +38,7 @@ message ActivityIssueCommentCreatePayload {TYPE_FEISHU = 1;}Type type = 1;-+enum Action {ACTION_UNSPECIFIED = 0;ACTION_APPROVE = 1;diff --git a/proto/store/risk.proto b/proto/store/risk.protonew file mode 100644index 0000000000..723c358c30--- /dev/null+++ b/proto/store/risk.proto@@ -0,0 +1,13 @@+syntax = "proto3";++package bytebase.store;++import "google/api/expr/v1alpha1/syntax.proto";++option go_package = "generated-go/store";++message RiskRule {+ string title = 1;+ google.api.expr.v1alpha1.ParsedExpr expression = 2;+ bool active = 3;+}diff --git a/proto/v1/risk_service.proto b/proto/v1/risk_service.protoindex 2175c3376a..4cc05d13a9 100644--- a/proto/v1/risk_service.proto+++ b/proto/v1/risk_service.proto@@ -17,6 +17,14 @@ service RiskService {option (google.api.method_signature) = "";}+ rpc CreateRisk(CreateRiskRequest) returns (Risk) {+ option (google.api.http) = {+ post: "/v1/risks"+ body: "risk"+ };+ option (google.api.method_signature) = "risk";+ }+rpc UpdateRisk(UpdateRiskRequest) returns (Risk) {option (google.api.http) = {patch: "/v1/{risk.name=risks/*}"@@ -24,6 +32,10 @@ service RiskService {};option (google.api.method_signature) = "risk,update_mask";}++ rpc DeleteRisk(DeleteRiskRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {delete: "/v1/{name=risks/*}"};+ }}message ListRisksRequest {@@ -49,6 +61,11 @@ message ListRisksResponse {string next_page_token = 2;}+message CreateRiskRequest {+ // The risk to create.+ Risk risk = 1 [(google.api.field_behavior) = REQUIRED];+}+message UpdateRiskRequest {// The risk to update.//@@ -60,6 +77,12 @@ message UpdateRiskRequest {google.protobuf.FieldMask update_mask = 2;}+message DeleteRiskRequest {+ // The name of the risk to delete.+ // Format: risks/{risk}+ string name = 1 [(google.api.field_behavior) = REQUIRED];+}+message Risk {// Format: risks/{risk}string name = 1;@@ -67,30 +90,17 @@ message Risk {// system-generated unique identifier.string uid = 2 [(google.api.field_behavior) = OUTPUT_ONLY];- enum Namespace {- NAMESPACE_UNSPECIFIED = 0;+ enum Source {+ SOURCE_UNSPECIFIED = 0;DDL = 1;DML = 2;CREATE_DATABASE = 3;}- Namespace namespace = 3;+ Source source = 3;string title = 4;int64 level = 5;- repeated RiskAction actions = 6;- repeated RiskRule rules = 7;-}--message RiskAction {- enum Type {- TYPE_UNSPECIFIED = 0;- CHOOSE_APPROVAL_TEMPLATE = 1;- }- Type type = 1;- oneof payload {- // Format: approvalTemplates/{approvalTemplate}- string approval_template = 2;- }+ RiskRule rule = 7;}message RiskRule {