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: support policy payload (#4223)
ecmadaob92b7646d0bd
diff --git a/api/issue.go b/api/issue.goindex 40f802b491..e9ff20a06d 100644--- a/api/issue.go+++ b/api/issue.go@@ -25,16 +25,12 @@ const (IssueGeneral IssueType = "bb.issue.general"// IssueDatabaseCreate is the issue type for creating databases.IssueDatabaseCreate IssueType = "bb.issue.database.create"- // IssueDatabaseGrant is the issue type for granting databases.- IssueDatabaseGrant IssueType = "bb.issue.database.grant"// IssueDatabaseSchemaUpdate is the issue type for updating database schemas (DDL).IssueDatabaseSchemaUpdate IssueType = "bb.issue.database.schema.update"// IssueDatabaseSchemaUpdateGhost is the issue type for updating database schemas using gh-ost.IssueDatabaseSchemaUpdateGhost IssueType = "bb.issue.database.schema.update.ghost"// IssueDatabaseDataUpdate is the issue type for updating database data (DML).IssueDatabaseDataUpdate IssueType = "bb.issue.database.data.update"- // IssueDataSourceRequest is the issue type for requesting database sources.- IssueDataSourceRequest IssueType = "bb.issue.data-source.request"// IssueDatabaseRestorePITR is the issue type for performing a Point-in-time Recovery.IssueDatabaseRestorePITR IssueType = "bb.issue.database.restore.pitr"// IssueDatabaseRollback is the issue type for a generated rollback issue.diff --git a/frontend/src/types/proto/v1/deployment.ts b/frontend/src/types/proto/v1/deployment.tsnew file mode 100644index 0000000000..57e6846446--- /dev/null+++ b/frontend/src/types/proto/v1/deployment.ts@@ -0,0 +1,66 @@+/* eslint-disable */++export const protobufPackage = "bytebase.v1";++export enum DeploymentType {+ DEPLOYMENT_TYPE_UNSPECIFIED = 0,+ DATABASE_CREATE = 1,+ DATABASE_DDL = 2,+ DATABASE_DDL_GHOST = 3,+ DATABASE_DML = 4,+ DATABASE_RESTORE_PITR = 5,+ DATABASE_DML_ROLLBACK = 6,+ UNRECOGNIZED = -1,+}++export function deploymentTypeFromJSON(object: any): DeploymentType {+ switch (object) {+ case 0:+ case "DEPLOYMENT_TYPE_UNSPECIFIED":+ return DeploymentType.DEPLOYMENT_TYPE_UNSPECIFIED;+ case 1:+ case "DATABASE_CREATE":+ return DeploymentType.DATABASE_CREATE;+ case 2:+ case "DATABASE_DDL":+ return DeploymentType.DATABASE_DDL;+ case 3:+ case "DATABASE_DDL_GHOST":+ return DeploymentType.DATABASE_DDL_GHOST;+ case 4:+ case "DATABASE_DML":+ return DeploymentType.DATABASE_DML;+ case 5:+ case "DATABASE_RESTORE_PITR":+ return DeploymentType.DATABASE_RESTORE_PITR;+ case 6:+ case "DATABASE_DML_ROLLBACK":+ return DeploymentType.DATABASE_DML_ROLLBACK;+ case -1:+ case "UNRECOGNIZED":+ default:+ return DeploymentType.UNRECOGNIZED;+ }+}++export function deploymentTypeToJSON(object: DeploymentType): string {+ switch (object) {+ case DeploymentType.DEPLOYMENT_TYPE_UNSPECIFIED:+ return "DEPLOYMENT_TYPE_UNSPECIFIED";+ case DeploymentType.DATABASE_CREATE:+ return "DATABASE_CREATE";+ case DeploymentType.DATABASE_DDL:+ return "DATABASE_DDL";+ case DeploymentType.DATABASE_DDL_GHOST:+ return "DATABASE_DDL_GHOST";+ case DeploymentType.DATABASE_DML:+ return "DATABASE_DML";+ case DeploymentType.DATABASE_RESTORE_PITR:+ return "DATABASE_RESTORE_PITR";+ case DeploymentType.DATABASE_DML_ROLLBACK:+ return "DATABASE_DML_ROLLBACK";+ case DeploymentType.UNRECOGNIZED:+ default:+ return "UNRECOGNIZED";+ }+}diff --git a/frontend/src/types/proto/v1/org_policy_service.ts b/frontend/src/types/proto/v1/org_policy_service.tsindex 84472b4b13..322ba3b3e5 100644--- a/frontend/src/types/proto/v1/org_policy_service.ts+++ b/frontend/src/types/proto/v1/org_policy_service.ts@@ -1,12 +1,14 @@/* eslint-disable */import _m0 from "protobufjs/minimal";+import { Duration } from "../google/protobuf/duration";import { State, stateFromJSON, stateToJSON } from "./common";+import { DeploymentType, deploymentTypeFromJSON, deploymentTypeToJSON } from "./deployment";export const protobufPackage = "bytebase.v1";export enum PolicyType {POLICY_TYPE_UNSPECIFIED = 0,- PIPELINE_APPROVAL = 1,+ DEPLOYMENT_APPROVAL = 1,BACKUP_PLAN = 2,SQL_REVIEW = 3,SENSITIVE_DATA = 4,@@ -20,8 +22,8 @@ export function policyTypeFromJSON(object: any): PolicyType {case "POLICY_TYPE_UNSPECIFIED":return PolicyType.POLICY_TYPE_UNSPECIFIED;case 1:- case "PIPELINE_APPROVAL":- return PolicyType.PIPELINE_APPROVAL;+ case "DEPLOYMENT_APPROVAL":+ return PolicyType.DEPLOYMENT_APPROVAL;case 2:case "BACKUP_PLAN":return PolicyType.BACKUP_PLAN;@@ -45,8 +47,8 @@ export function policyTypeToJSON(object: PolicyType): string {switch (object) {case PolicyType.POLICY_TYPE_UNSPECIFIED:return "POLICY_TYPE_UNSPECIFIED";- case PolicyType.PIPELINE_APPROVAL:- return "PIPELINE_APPROVAL";+ case PolicyType.DEPLOYMENT_APPROVAL:+ return "DEPLOYMENT_APPROVAL";case PolicyType.BACKUP_PLAN:return "BACKUP_PLAN";case PolicyType.SQL_REVIEW:@@ -61,6 +63,207 @@ export function policyTypeToJSON(object: PolicyType): string {}}+export enum ApprovalGroup {+ ASSIGNEE_GROUP_UNSPECIFIED = 0,+ APPROVAL_GROUP_DBA = 1,+ APPROVAL_GROUP_PROJECT_OWNER = 2,+ UNRECOGNIZED = -1,+}++export function approvalGroupFromJSON(object: any): ApprovalGroup {+ switch (object) {+ case 0:+ case "ASSIGNEE_GROUP_UNSPECIFIED":+ return ApprovalGroup.ASSIGNEE_GROUP_UNSPECIFIED;+ case 1:+ case "APPROVAL_GROUP_DBA":+ return ApprovalGroup.APPROVAL_GROUP_DBA;+ case 2:+ case "APPROVAL_GROUP_PROJECT_OWNER":+ return ApprovalGroup.APPROVAL_GROUP_PROJECT_OWNER;+ case -1:+ case "UNRECOGNIZED":+ default:+ return ApprovalGroup.UNRECOGNIZED;+ }+}++export function approvalGroupToJSON(object: ApprovalGroup): string {+ switch (object) {+ case ApprovalGroup.ASSIGNEE_GROUP_UNSPECIFIED:+ return "ASSIGNEE_GROUP_UNSPECIFIED";+ case ApprovalGroup.APPROVAL_GROUP_DBA:+ return "APPROVAL_GROUP_DBA";+ case ApprovalGroup.APPROVAL_GROUP_PROJECT_OWNER:+ return "APPROVAL_GROUP_PROJECT_OWNER";+ case ApprovalGroup.UNRECOGNIZED:+ default:+ return "UNRECOGNIZED";+ }+}++export enum ApprovalStrategy {+ APPROVAL_STRATEGY_UNSPECIFIED = 0,+ AUTOMATIC = 1,+ MANUAL = 2,+ UNRECOGNIZED = -1,+}++export function approvalStrategyFromJSON(object: any): ApprovalStrategy {+ switch (object) {+ case 0:+ case "APPROVAL_STRATEGY_UNSPECIFIED":+ return ApprovalStrategy.APPROVAL_STRATEGY_UNSPECIFIED;+ case 1:+ case "AUTOMATIC":+ return ApprovalStrategy.AUTOMATIC;+ case 2:+ case "MANUAL":+ return ApprovalStrategy.MANUAL;+ case -1:+ case "UNRECOGNIZED":+ default:+ return ApprovalStrategy.UNRECOGNIZED;+ }+}++export function approvalStrategyToJSON(object: ApprovalStrategy): string {+ switch (object) {+ case ApprovalStrategy.APPROVAL_STRATEGY_UNSPECIFIED:+ return "APPROVAL_STRATEGY_UNSPECIFIED";+ case ApprovalStrategy.AUTOMATIC:+ return "AUTOMATIC";+ case ApprovalStrategy.MANUAL:+ return "MANUAL";+ case ApprovalStrategy.UNRECOGNIZED:+ default:+ return "UNRECOGNIZED";+ }+}++export enum BackupPlanSchedule {+ SCHEDULE_UNSPECIFIED = 0,+ UNSET = 1,+ DAILY = 2,+ WEEKLY = 3,+ UNRECOGNIZED = -1,+}++export function backupPlanScheduleFromJSON(object: any): BackupPlanSchedule {+ switch (object) {+ case 0:+ case "SCHEDULE_UNSPECIFIED":+ return BackupPlanSchedule.SCHEDULE_UNSPECIFIED;+ case 1:+ case "UNSET":+ return BackupPlanSchedule.UNSET;+ case 2:+ case "DAILY":+ return BackupPlanSchedule.DAILY;+ case 3:+ case "WEEKLY":+ return BackupPlanSchedule.WEEKLY;+ case -1:+ case "UNRECOGNIZED":+ default:+ return BackupPlanSchedule.UNRECOGNIZED;+ }+}++export function backupPlanScheduleToJSON(object: BackupPlanSchedule): string {+ switch (object) {+ case BackupPlanSchedule.SCHEDULE_UNSPECIFIED:+ return "SCHEDULE_UNSPECIFIED";+ case BackupPlanSchedule.UNSET:+ return "UNSET";+ case BackupPlanSchedule.DAILY:+ return "DAILY";+ case BackupPlanSchedule.WEEKLY:+ return "WEEKLY";+ case BackupPlanSchedule.UNRECOGNIZED:+ default:+ return "UNRECOGNIZED";+ }+}++export enum SensitiveDataMaskType {+ MASK_TYPE_UNSPECIFIED = 0,+ DEFAULT = 1,+ UNRECOGNIZED = -1,+}++export function sensitiveDataMaskTypeFromJSON(object: any): SensitiveDataMaskType {+ switch (object) {+ case 0:+ case "MASK_TYPE_UNSPECIFIED":+ return SensitiveDataMaskType.MASK_TYPE_UNSPECIFIED;+ case 1:+ case "DEFAULT":+ return SensitiveDataMaskType.DEFAULT;+ case -1:+ case "UNRECOGNIZED":+ default:+ return SensitiveDataMaskType.UNRECOGNIZED;+ }+}++export function sensitiveDataMaskTypeToJSON(object: SensitiveDataMaskType): string {+ switch (object) {+ case SensitiveDataMaskType.MASK_TYPE_UNSPECIFIED:+ return "MASK_TYPE_UNSPECIFIED";+ case SensitiveDataMaskType.DEFAULT:+ return "DEFAULT";+ case SensitiveDataMaskType.UNRECOGNIZED:+ default:+ return "UNRECOGNIZED";+ }+}++export enum SQLReviewRuleLevel {+ LEVEL_UNSPECIFIED = 0,+ ERROR = 1,+ WARNING = 2,+ DISABLED = 3,+ UNRECOGNIZED = -1,+}++export function sQLReviewRuleLevelFromJSON(object: any): SQLReviewRuleLevel {+ switch (object) {+ case 0:+ case "LEVEL_UNSPECIFIED":+ return SQLReviewRuleLevel.LEVEL_UNSPECIFIED;+ case 1:+ case "ERROR":+ return SQLReviewRuleLevel.ERROR;+ case 2:+ case "WARNING":+ return SQLReviewRuleLevel.WARNING;+ case 3:+ case "DISABLED":+ return SQLReviewRuleLevel.DISABLED;+ case -1:+ case "UNRECOGNIZED":+ default:+ return SQLReviewRuleLevel.UNRECOGNIZED;+ }+}++export function sQLReviewRuleLevelToJSON(object: SQLReviewRuleLevel): string {+ switch (object) {+ case SQLReviewRuleLevel.LEVEL_UNSPECIFIED:+ return "LEVEL_UNSPECIFIED";+ case SQLReviewRuleLevel.ERROR:+ return "ERROR";+ case SQLReviewRuleLevel.WARNING:+ return "WARNING";+ case SQLReviewRuleLevel.DISABLED:+ return "DISABLED";+ case SQLReviewRuleLevel.UNRECOGNIZED:+ default:+ return "UNRECOGNIZED";+ }+}+export interface GetPolicyRequest {/*** The name of the policy to retrieve.@@ -105,7 +308,11 @@ export interface ListPoliciesResponse {export interface Policy {/*** The name of the policy.- * Format: {resource type}/{resource id}/policies/{policy type}+ * Format: {resource name}/policies/{policy type}+ * Workspace resource name: "".+ * Environment resource name: environments/environment-id.+ * Instance resource name: environments/environment-id/instances/instance-id.+ * Database resource name: environments/environment-id/instances/instance-id/databases/database-name.*/name: string;/** The system-assigned, unique identifier for a resource. */@@ -113,6 +320,56 @@ export interface Policy {state: State;inheritFromParent: boolean;type: PolicyType;+ deploymentApprovalPolicy?: DeploymentApprovalPolicy | undefined;+ backupPlanPolicy?: BackupPlanPolicy | undefined;+ sensitiveDataPolicy?: SensitiveDataPolicy | undefined;+ accessControlPolicy?: AccessControlPolicy | undefined;+ sqlReviewPolicy?: SQLReviewPolicy | undefined;+}++export interface DeploymentApprovalPolicy {+ defaultStrategy: ApprovalStrategy;+ deploymentApprovalStrategies: DeploymentApprovalStrategy[];+}++export interface DeploymentApprovalStrategy {+ deploymentType: DeploymentType;+ approvalGroup: ApprovalGroup;+ approvalStrategy: ApprovalStrategy;+}++export interface BackupPlanPolicy {+ schedule: BackupPlanSchedule;+ retentionDuration?: Duration;+}++export interface SensitiveDataPolicy {+ sensitiveData: SensitiveData[];+}++export interface SensitiveData {+ schema: string;+ table: string;+ column: string;+ maskType: SensitiveDataMaskType;+}++export interface AccessControlPolicy {+ disallowRules: AccessControlRule[];+}++export interface AccessControlRule {+ fullDatabase: boolean;+}++export interface SQLReviewPolicy {+ title: string;+ rules: SQLReviewRule[];+}++export interface SQLReviewRule {+ type: string;+ level: SQLReviewRuleLevel;payload: string;}@@ -293,7 +550,18 @@ export const ListPoliciesResponse = {};function createBasePolicy(): Policy {- return { name: "", uid: "", state: 0, inheritFromParent: false, type: 0, payload: "" };+ return {+ name: "",+ uid: "",+ state: 0,+ inheritFromParent: false,+ type: 0,+ deploymentApprovalPolicy: undefined,+ backupPlanPolicy: undefined,+ sensitiveDataPolicy: undefined,+ accessControlPolicy: undefined,+ sqlReviewPolicy: undefined,+ };}export const Policy = {@@ -313,8 +581,20 @@ export const Policy = {if (message.type !== 0) {writer.uint32(40).int32(message.type);}- if (message.payload !== "") {- writer.uint32(50).string(message.payload);+ if (message.deploymentApprovalPolicy !== undefined) {+ DeploymentApprovalPolicy.encode(message.deploymentApprovalPolicy, writer.uint32(50).fork()).ldelim();+ }+ if (message.backupPlanPolicy !== undefined) {+ BackupPlanPolicy.encode(message.backupPlanPolicy, writer.uint32(58).fork()).ldelim();+ }+ if (message.sensitiveDataPolicy !== undefined) {+ SensitiveDataPolicy.encode(message.sensitiveDataPolicy, writer.uint32(66).fork()).ldelim();+ }+ if (message.accessControlPolicy !== undefined) {+ AccessControlPolicy.encode(message.accessControlPolicy, writer.uint32(74).fork()).ldelim();+ }+ if (message.sqlReviewPolicy !== undefined) {+ SQLReviewPolicy.encode(message.sqlReviewPolicy, writer.uint32(82).fork()).ldelim();}return writer;},@@ -342,7 +622,19 @@ export const Policy = {message.type = reader.int32() as any;break;case 6:- message.payload = reader.string();+ message.deploymentApprovalPolicy = DeploymentApprovalPolicy.decode(reader, reader.uint32());+ break;+ case 7:+ message.backupPlanPolicy = BackupPlanPolicy.decode(reader, reader.uint32());+ break;+ case 8:+ message.sensitiveDataPolicy = SensitiveDataPolicy.decode(reader, reader.uint32());+ break;+ case 9:+ message.accessControlPolicy = AccessControlPolicy.decode(reader, reader.uint32());+ break;+ case 10:+ message.sqlReviewPolicy = SQLReviewPolicy.decode(reader, reader.uint32());break;default:reader.skipType(tag & 7);@@ -359,7 +651,17 @@ export const Policy = {state: isSet(object.state) ? stateFromJSON(object.state) : 0,inheritFromParent: isSet(object.inheritFromParent) ? Boolean(object.inheritFromParent) : false,type: isSet(object.type) ? policyTypeFromJSON(object.type) : 0,- payload: isSet(object.payload) ? String(object.payload) : "",+ deploymentApprovalPolicy: isSet(object.deploymentApprovalPolicy)+ ? DeploymentApprovalPolicy.fromJSON(object.deploymentApprovalPolicy)+ : undefined,+ backupPlanPolicy: isSet(object.backupPlanPolicy) ? BackupPlanPolicy.fromJSON(object.backupPlanPolicy) : undefined,+ sensitiveDataPolicy: isSet(object.sensitiveDataPolicy)+ ? SensitiveDataPolicy.fromJSON(object.sensitiveDataPolicy)+ : undefined,+ accessControlPolicy: isSet(object.accessControlPolicy)+ ? AccessControlPolicy.fromJSON(object.accessControlPolicy)+ : undefined,+ sqlReviewPolicy: isSet(object.sqlReviewPolicy) ? SQLReviewPolicy.fromJSON(object.sqlReviewPolicy) : undefined,};},@@ -370,7 +672,19 @@ export const Policy = {message.state !== undefined && (obj.state = stateToJSON(message.state));message.inheritFromParent !== undefined && (obj.inheritFromParent = message.inheritFromParent);message.type !== undefined && (obj.type = policyTypeToJSON(message.type));- message.payload !== undefined && (obj.payload = message.payload);+ message.deploymentApprovalPolicy !== undefined && (obj.deploymentApprovalPolicy = message.deploymentApprovalPolicy+ ? DeploymentApprovalPolicy.toJSON(message.deploymentApprovalPolicy)+ : undefined);+ message.backupPlanPolicy !== undefined &&+ (obj.backupPlanPolicy = message.backupPlanPolicy ? BackupPlanPolicy.toJSON(message.backupPlanPolicy) : undefined);+ message.sensitiveDataPolicy !== undefined && (obj.sensitiveDataPolicy = message.sensitiveDataPolicy+ ? SensitiveDataPolicy.toJSON(message.sensitiveDataPolicy)+ : undefined);+ message.accessControlPolicy !== undefined && (obj.accessControlPolicy = message.accessControlPolicy+ ? AccessControlPolicy.toJSON(message.accessControlPolicy)+ : undefined);+ message.sqlReviewPolicy !== undefined &&+ (obj.sqlReviewPolicy = message.sqlReviewPolicy ? SQLReviewPolicy.toJSON(message.sqlReviewPolicy) : undefined);return obj;},@@ -381,6 +695,578 @@ export const Policy = {message.state = object.state ?? 0;message.inheritFromParent = object.inheritFromParent ?? false;message.type = object.type ?? 0;+ message.deploymentApprovalPolicy =+ (object.deploymentApprovalPolicy !== undefined && object.deploymentApprovalPolicy !== null)+ ? DeploymentApprovalPolicy.fromPartial(object.deploymentApprovalPolicy)+ : undefined;+ message.backupPlanPolicy = (object.backupPlanPolicy !== undefined && object.backupPlanPolicy !== null)+ ? BackupPlanPolicy.fromPartial(object.backupPlanPolicy)+ : undefined;+ message.sensitiveDataPolicy = (object.sensitiveDataPolicy !== undefined && object.sensitiveDataPolicy !== null)+ ? SensitiveDataPolicy.fromPartial(object.sensitiveDataPolicy)+ : undefined;+ message.accessControlPolicy = (object.accessControlPolicy !== undefined && object.accessControlPolicy !== null)+ ? AccessControlPolicy.fromPartial(object.accessControlPolicy)+ : undefined;+ message.sqlReviewPolicy = (object.sqlReviewPolicy !== undefined && object.sqlReviewPolicy !== null)+ ? SQLReviewPolicy.fromPartial(object.sqlReviewPolicy)+ : undefined;+ return message;+ },+};++function createBaseDeploymentApprovalPolicy(): DeploymentApprovalPolicy {+ return { defaultStrategy: 0, deploymentApprovalStrategies: [] };+}++export const DeploymentApprovalPolicy = {+ encode(message: DeploymentApprovalPolicy, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {+ if (message.defaultStrategy !== 0) {+ writer.uint32(8).int32(message.defaultStrategy);+ }+ for (const v of message.deploymentApprovalStrategies) {+ DeploymentApprovalStrategy.encode(v!, writer.uint32(18).fork()).ldelim();+ }+ return writer;+ },++ decode(input: _m0.Reader | Uint8Array, length?: number): DeploymentApprovalPolicy {+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);+ let end = length === undefined ? reader.len : reader.pos + length;+ const message = createBaseDeploymentApprovalPolicy();+ while (reader.pos < end) {+ const tag = reader.uint32();+ switch (tag >>> 3) {+ case 1:+ message.defaultStrategy = reader.int32() as any;+ break;+ case 2:+ message.deploymentApprovalStrategies.push(DeploymentApprovalStrategy.decode(reader, reader.uint32()));+ break;+ default:+ reader.skipType(tag & 7);+ break;+ }+ }+ return message;+ },++ fromJSON(object: any): DeploymentApprovalPolicy {+ return {+ defaultStrategy: isSet(object.defaultStrategy) ? approvalStrategyFromJSON(object.defaultStrategy) : 0,+ deploymentApprovalStrategies: Array.isArray(object?.deploymentApprovalStrategies)+ ? object.deploymentApprovalStrategies.map((e: any) => DeploymentApprovalStrategy.fromJSON(e))+ : [],+ };+ },++ toJSON(message: DeploymentApprovalPolicy): unknown {+ const obj: any = {};+ message.defaultStrategy !== undefined && (obj.defaultStrategy = approvalStrategyToJSON(message.defaultStrategy));+ if (message.deploymentApprovalStrategies) {+ obj.deploymentApprovalStrategies = message.deploymentApprovalStrategies.map((e) =>+ e ? DeploymentApprovalStrategy.toJSON(e) : undefined+ );+ } else {+ obj.deploymentApprovalStrategies = [];+ }+ return obj;+ },++ fromPartial<I extends Exact<DeepPartial<DeploymentApprovalPolicy>, I>>(object: I): DeploymentApprovalPolicy {+ const message = createBaseDeploymentApprovalPolicy();+ message.defaultStrategy = object.defaultStrategy ?? 0;+ message.deploymentApprovalStrategies =+ object.deploymentApprovalStrategies?.map((e) => DeploymentApprovalStrategy.fromPartial(e)) || [];+ return message;+ },+};++function createBaseDeploymentApprovalStrategy(): DeploymentApprovalStrategy {+ return { deploymentType: 0, approvalGroup: 0, approvalStrategy: 0 };+}++export const DeploymentApprovalStrategy = {+ encode(message: DeploymentApprovalStrategy, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {+ if (message.deploymentType !== 0) {+ writer.uint32(8).int32(message.deploymentType);+ }+ if (message.approvalGroup !== 0) {+ writer.uint32(16).int32(message.approvalGroup);+ }+ if (message.approvalStrategy !== 0) {+ writer.uint32(24).int32(message.approvalStrategy);+ }+ return writer;+ },++ decode(input: _m0.Reader | Uint8Array, length?: number): DeploymentApprovalStrategy {+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);+ let end = length === undefined ? reader.len : reader.pos + length;+ const message = createBaseDeploymentApprovalStrategy();+ while (reader.pos < end) {+ const tag = reader.uint32();+ switch (tag >>> 3) {+ case 1:+ message.deploymentType = reader.int32() as any;+ break;+ case 2:+ message.approvalGroup = reader.int32() as any;+ break;+ case 3:+ message.approvalStrategy = reader.int32() as any;+ break;+ default:+ reader.skipType(tag & 7);+ break;+ }+ }+ return message;+ },++ fromJSON(object: any): DeploymentApprovalStrategy {+ return {+ deploymentType: isSet(object.deploymentType) ? deploymentTypeFromJSON(object.deploymentType) : 0,+ approvalGroup: isSet(object.approvalGroup) ? approvalGroupFromJSON(object.approvalGroup) : 0,+ approvalStrategy: isSet(object.approvalStrategy) ? approvalStrategyFromJSON(object.approvalStrategy) : 0,+ };+ },++ toJSON(message: DeploymentApprovalStrategy): unknown {+ const obj: any = {};+ message.deploymentType !== undefined && (obj.deploymentType = deploymentTypeToJSON(message.deploymentType));+ message.approvalGroup !== undefined && (obj.approvalGroup = approvalGroupToJSON(message.approvalGroup));+ message.approvalStrategy !== undefined && (obj.approvalStrategy = approvalStrategyToJSON(message.approvalStrategy));+ return obj;+ },++ fromPartial<I extends Exact<DeepPartial<DeploymentApprovalStrategy>, I>>(object: I): DeploymentApprovalStrategy {+ const message = createBaseDeploymentApprovalStrategy();+ message.deploymentType = object.deploymentType ?? 0;+ message.approvalGroup = object.approvalGroup ?? 0;+ message.approvalStrategy = object.approvalStrategy ?? 0;+ return message;+ },+};++function createBaseBackupPlanPolicy(): BackupPlanPolicy {+ return { schedule: 0, retentionDuration: undefined };+}++export const BackupPlanPolicy = {+ encode(message: BackupPlanPolicy, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {+ if (message.schedule !== 0) {+ writer.uint32(8).int32(message.schedule);+ }+ if (message.retentionDuration !== undefined) {+ Duration.encode(message.retentionDuration, writer.uint32(18).fork()).ldelim();+ }+ return writer;+ },++ decode(input: _m0.Reader | Uint8Array, length?: number): BackupPlanPolicy {+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);+ let end = length === undefined ? reader.len : reader.pos + length;+ const message = createBaseBackupPlanPolicy();+ while (reader.pos < end) {+ const tag = reader.uint32();+ switch (tag >>> 3) {+ case 1:+ message.schedule = reader.int32() as any;+ break;+ case 2:+ message.retentionDuration = Duration.decode(reader, reader.uint32());+ break;+ default:+ reader.skipType(tag & 7);+ break;+ }+ }+ return message;+ },++ fromJSON(object: any): BackupPlanPolicy {+ return {+ schedule: isSet(object.schedule) ? backupPlanScheduleFromJSON(object.schedule) : 0,+ retentionDuration: isSet(object.retentionDuration) ? Duration.fromJSON(object.retentionDuration) : undefined,+ };+ },++ toJSON(message: BackupPlanPolicy): unknown {+ const obj: any = {};+ message.schedule !== undefined && (obj.schedule = backupPlanScheduleToJSON(message.schedule));+ message.retentionDuration !== undefined &&+ (obj.retentionDuration = message.retentionDuration ? Duration.toJSON(message.retentionDuration) : undefined);+ return obj;+ },++ fromPartial<I extends Exact<DeepPartial<BackupPlanPolicy>, I>>(object: I): BackupPlanPolicy {+ const message = createBaseBackupPlanPolicy();+ message.schedule = object.schedule ?? 0;+ message.retentionDuration = (object.retentionDuration !== undefined && object.retentionDuration !== null)+ ? Duration.fromPartial(object.retentionDuration)+ : undefined;+ return message;+ },+};++function createBaseSensitiveDataPolicy(): SensitiveDataPolicy {+ return { sensitiveData: [] };+}++export const SensitiveDataPolicy = {+ encode(message: SensitiveDataPolicy, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {+ for (const v of message.sensitiveData) {+ SensitiveData.encode(v!, writer.uint32(10).fork()).ldelim();+ }+ return writer;+ },++ decode(input: _m0.Reader | Uint8Array, length?: number): SensitiveDataPolicy {+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);+ let end = length === undefined ? reader.len : reader.pos + length;+ const message = createBaseSensitiveDataPolicy();+ while (reader.pos < end) {+ const tag = reader.uint32();+ switch (tag >>> 3) {+ case 1:+ message.sensitiveData.push(SensitiveData.decode(reader, reader.uint32()));+ break;+ default:+ reader.skipType(tag & 7);+ break;+ }+ }+ return message;+ },++ fromJSON(object: any): SensitiveDataPolicy {+ return {+ sensitiveData: Array.isArray(object?.sensitiveData)+ ? object.sensitiveData.map((e: any) => SensitiveData.fromJSON(e))+ : [],+ };+ },++ toJSON(message: SensitiveDataPolicy): unknown {+ const obj: any = {};+ if (message.sensitiveData) {+ obj.sensitiveData = message.sensitiveData.map((e) => e ? SensitiveData.toJSON(e) : undefined);+ } else {+ obj.sensitiveData = [];+ }+ return obj;+ },++ fromPartial<I extends Exact<DeepPartial<SensitiveDataPolicy>, I>>(object: I): SensitiveDataPolicy {+ const message = createBaseSensitiveDataPolicy();+ message.sensitiveData = object.sensitiveData?.map((e) => SensitiveData.fromPartial(e)) || [];+ return message;+ },+};++function createBaseSensitiveData(): SensitiveData {+ return { schema: "", table: "", column: "", maskType: 0 };+}++export const SensitiveData = {+ encode(message: SensitiveData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {+ if (message.schema !== "") {+ writer.uint32(10).string(message.schema);+ }+ if (message.table !== "") {+ writer.uint32(18).string(message.table);+ }+ if (message.column !== "") {+ writer.uint32(26).string(message.column);+ }+ if (message.maskType !== 0) {+ writer.uint32(32).int32(message.maskType);+ }+ return writer;+ },++ decode(input: _m0.Reader | Uint8Array, length?: number): SensitiveData {+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);+ let end = length === undefined ? reader.len : reader.pos + length;+ const message = createBaseSensitiveData();+ while (reader.pos < end) {+ const tag = reader.uint32();+ switch (tag >>> 3) {+ case 1:+ message.schema = reader.string();+ break;+ case 2:+ message.table = reader.string();+ break;+ case 3:+ message.column = reader.string();+ break;+ case 4:+ message.maskType = reader.int32() as any;+ break;+ default:+ reader.skipType(tag & 7);+ break;+ }+ }+ return message;+ },++ fromJSON(object: any): SensitiveData {+ return {+ schema: isSet(object.schema) ? String(object.schema) : "",+ table: isSet(object.table) ? String(object.table) : "",+ column: isSet(object.column) ? String(object.column) : "",+ maskType: isSet(object.maskType) ? sensitiveDataMaskTypeFromJSON(object.maskType) : 0,+ };+ },++ toJSON(message: SensitiveData): unknown {+ const obj: any = {};+ message.schema !== undefined && (obj.schema = message.schema);+ message.table !== undefined && (obj.table = message.table);+ message.column !== undefined && (obj.column = message.column);+ message.maskType !== undefined && (obj.maskType = sensitiveDataMaskTypeToJSON(message.maskType));+ return obj;+ },++ fromPartial<I extends Exact<DeepPartial<SensitiveData>, I>>(object: I): SensitiveData {+ const message = createBaseSensitiveData();+ message.schema = object.schema ?? "";+ message.table = object.table ?? "";+ message.column = object.column ?? "";+ message.maskType = object.maskType ?? 0;+ return message;+ },+};++function createBaseAccessControlPolicy(): AccessControlPolicy {+ return { disallowRules: [] };+}++export const AccessControlPolicy = {+ encode(message: AccessControlPolicy, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {+ for (const v of message.disallowRules) {+ AccessControlRule.encode(v!, writer.uint32(10).fork()).ldelim();+ }+ return writer;+ },++ decode(input: _m0.Reader | Uint8Array, length?: number): AccessControlPolicy {+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);+ let end = length === undefined ? reader.len : reader.pos + length;+ const message = createBaseAccessControlPolicy();+ while (reader.pos < end) {+ const tag = reader.uint32();+ switch (tag >>> 3) {+ case 1:+ message.disallowRules.push(AccessControlRule.decode(reader, reader.uint32()));+ break;+ default:+ reader.skipType(tag & 7);+ break;+ }+ }+ return message;+ },++ fromJSON(object: any): AccessControlPolicy {+ return {+ disallowRules: Array.isArray(object?.disallowRules)+ ? object.disallowRules.map((e: any) => AccessControlRule.fromJSON(e))+ : [],+ };+ },++ toJSON(message: AccessControlPolicy): unknown {+ const obj: any = {};+ if (message.disallowRules) {+ obj.disallowRules = message.disallowRules.map((e) => e ? AccessControlRule.toJSON(e) : undefined);+ } else {+ obj.disallowRules = [];+ }+ return obj;+ },++ fromPartial<I extends Exact<DeepPartial<AccessControlPolicy>, I>>(object: I): AccessControlPolicy {+ const message = createBaseAccessControlPolicy();+ message.disallowRules = object.disallowRules?.map((e) => AccessControlRule.fromPartial(e)) || [];+ return message;+ },+};++function createBaseAccessControlRule(): AccessControlRule {+ return { fullDatabase: false };+}++export const AccessControlRule = {+ encode(message: AccessControlRule, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {+ if (message.fullDatabase === true) {+ writer.uint32(8).bool(message.fullDatabase);+ }+ return writer;+ },++ decode(input: _m0.Reader | Uint8Array, length?: number): AccessControlRule {+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);+ let end = length === undefined ? reader.len : reader.pos + length;+ const message = createBaseAccessControlRule();+ while (reader.pos < end) {+ const tag = reader.uint32();+ switch (tag >>> 3) {+ case 1:+ message.fullDatabase = reader.bool();+ break;+ default:+ reader.skipType(tag & 7);+ break;+ }+ }+ return message;+ },++ fromJSON(object: any): AccessControlRule {+ return { fullDatabase: isSet(object.fullDatabase) ? Boolean(object.fullDatabase) : false };+ },++ toJSON(message: AccessControlRule): unknown {+ const obj: any = {};+ message.fullDatabase !== undefined && (obj.fullDatabase = message.fullDatabase);+ return obj;+ },++ fromPartial<I extends Exact<DeepPartial<AccessControlRule>, I>>(object: I): AccessControlRule {+ const message = createBaseAccessControlRule();+ message.fullDatabase = object.fullDatabase ?? false;+ return message;+ },+};++function createBaseSQLReviewPolicy(): SQLReviewPolicy {+ return { title: "", rules: [] };+}++export const SQLReviewPolicy = {+ encode(message: SQLReviewPolicy, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {+ if (message.title !== "") {+ writer.uint32(10).string(message.title);+ }+ for (const v of message.rules) {+ SQLReviewRule.encode(v!, writer.uint32(18).fork()).ldelim();+ }+ return writer;+ },++ decode(input: _m0.Reader | Uint8Array, length?: number): SQLReviewPolicy {+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);+ let end = length === undefined ? reader.len : reader.pos + length;+ const message = createBaseSQLReviewPolicy();+ while (reader.pos < end) {+ const tag = reader.uint32();+ switch (tag >>> 3) {+ case 1:+ message.title = reader.string();+ break;+ case 2:+ message.rules.push(SQLReviewRule.decode(reader, reader.uint32()));+ break;+ default:+ reader.skipType(tag & 7);+ break;+ }+ }+ return message;+ },++ fromJSON(object: any): SQLReviewPolicy {+ return {+ title: isSet(object.title) ? String(object.title) : "",+ rules: Array.isArray(object?.rules) ? object.rules.map((e: any) => SQLReviewRule.fromJSON(e)) : [],+ };+ },++ toJSON(message: SQLReviewPolicy): unknown {+ const obj: any = {};+ message.title !== undefined && (obj.title = message.title);+ if (message.rules) {+ obj.rules = message.rules.map((e) => e ? SQLReviewRule.toJSON(e) : undefined);+ } else {+ obj.rules = [];+ }+ return obj;+ },++ fromPartial<I extends Exact<DeepPartial<SQLReviewPolicy>, I>>(object: I): SQLReviewPolicy {+ const message = createBaseSQLReviewPolicy();+ message.title = object.title ?? "";+ message.rules = object.rules?.map((e) => SQLReviewRule.fromPartial(e)) || [];+ return message;+ },+};++function createBaseSQLReviewRule(): SQLReviewRule {+ return { type: "", level: 0, payload: "" };+}++export const SQLReviewRule = {+ encode(message: SQLReviewRule, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {+ if (message.type !== "") {+ writer.uint32(10).string(message.type);+ }+ if (message.level !== 0) {+ writer.uint32(16).int32(message.level);+ }+ if (message.payload !== "") {+ writer.uint32(26).string(message.payload);+ }+ return writer;+ },++ decode(input: _m0.Reader | Uint8Array, length?: number): SQLReviewRule {+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);+ let end = length === undefined ? reader.len : reader.pos + length;+ const message = createBaseSQLReviewRule();+ while (reader.pos < end) {+ const tag = reader.uint32();+ switch (tag >>> 3) {+ case 1:+ message.type = reader.string();+ break;+ case 2:+ message.level = reader.int32() as any;+ break;+ case 3:+ message.payload = reader.string();+ break;+ default:+ reader.skipType(tag & 7);+ break;+ }+ }+ return message;+ },++ fromJSON(object: any): SQLReviewRule {+ return {+ type: isSet(object.type) ? String(object.type) : "",+ level: isSet(object.level) ? sQLReviewRuleLevelFromJSON(object.level) : 0,+ payload: isSet(object.payload) ? String(object.payload) : "",+ };+ },++ toJSON(message: SQLReviewRule): unknown {+ const obj: any = {};+ message.type !== undefined && (obj.type = message.type);+ message.level !== undefined && (obj.level = sQLReviewRuleLevelToJSON(message.level));+ message.payload !== undefined && (obj.payload = message.payload);+ return obj;+ },++ fromPartial<I extends Exact<DeepPartial<SQLReviewRule>, I>>(object: I): SQLReviewRule {+ const message = createBaseSQLReviewRule();+ message.type = object.type ?? "";+ message.level = object.level ?? 0;message.payload = object.payload ?? "";return message;},diff --git a/proto/generated-go/v1/deployment.pb.go b/proto/generated-go/v1/deployment.pb.gonew file mode 100644index 0000000000..736512981f--- /dev/null+++ b/proto/generated-go/v1/deployment.pb.go@@ -0,0 +1,152 @@+// Code generated by protoc-gen-go. DO NOT EDIT.+// versions:+// protoc-gen-go v1.28.1+// protoc (unknown)+// source: v1/deployment.proto++package v1++import (+ 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 DeploymentType int32++const (+ DeploymentType_DEPLOYMENT_TYPE_UNSPECIFIED DeploymentType = 0+ DeploymentType_DATABASE_CREATE DeploymentType = 1+ DeploymentType_DATABASE_DDL DeploymentType = 2+ DeploymentType_DATABASE_DDL_GHOST DeploymentType = 3+ DeploymentType_DATABASE_DML DeploymentType = 4+ DeploymentType_DATABASE_RESTORE_PITR DeploymentType = 5+ DeploymentType_DATABASE_DML_ROLLBACK DeploymentType = 6+)++// Enum value maps for DeploymentType.+var (+ DeploymentType_name = map[int32]string{+ 0: "DEPLOYMENT_TYPE_UNSPECIFIED",+ 1: "DATABASE_CREATE",+ 2: "DATABASE_DDL",+ 3: "DATABASE_DDL_GHOST",+ 4: "DATABASE_DML",+ 5: "DATABASE_RESTORE_PITR",+ 6: "DATABASE_DML_ROLLBACK",+ }+ DeploymentType_value = map[string]int32{+ "DEPLOYMENT_TYPE_UNSPECIFIED": 0,+ "DATABASE_CREATE": 1,+ "DATABASE_DDL": 2,+ "DATABASE_DDL_GHOST": 3,+ "DATABASE_DML": 4,+ "DATABASE_RESTORE_PITR": 5,+ "DATABASE_DML_ROLLBACK": 6,+ }+)++func (x DeploymentType) Enum() *DeploymentType {+ p := new(DeploymentType)+ *p = x+ return p+}++func (x DeploymentType) String() string {+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))+}++func (DeploymentType) Descriptor() protoreflect.EnumDescriptor {+ return file_v1_deployment_proto_enumTypes[0].Descriptor()+}++func (DeploymentType) Type() protoreflect.EnumType {+ return &file_v1_deployment_proto_enumTypes[0]+}++func (x DeploymentType) Number() protoreflect.EnumNumber {+ return protoreflect.EnumNumber(x)+}++// Deprecated: Use DeploymentType.Descriptor instead.+func (DeploymentType) EnumDescriptor() ([]byte, []int) {+ return file_v1_deployment_proto_rawDescGZIP(), []int{0}+}++var File_v1_deployment_proto protoreflect.FileDescriptor++var file_v1_deployment_proto_rawDesc = []byte{+ 0x0a, 0x13, 0x76, 0x31, 0x2f, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x2e,+ 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e,+ 0x76, 0x31, 0x2a, 0xb8, 0x01, 0x0a, 0x0e, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e,+ 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1f, 0x0a, 0x1b, 0x44, 0x45, 0x50, 0x4c, 0x4f, 0x59, 0x4d,+ 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49,+ 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x44, 0x41, 0x54, 0x41, 0x42, 0x41,+ 0x53, 0x45, 0x5f, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, 0x10, 0x01, 0x12, 0x10, 0x0a, 0x0c, 0x44,+ 0x41, 0x54, 0x41, 0x42, 0x41, 0x53, 0x45, 0x5f, 0x44, 0x44, 0x4c, 0x10, 0x02, 0x12, 0x16, 0x0a,+ 0x12, 0x44, 0x41, 0x54, 0x41, 0x42, 0x41, 0x53, 0x45, 0x5f, 0x44, 0x44, 0x4c, 0x5f, 0x47, 0x48,+ 0x4f, 0x53, 0x54, 0x10, 0x03, 0x12, 0x10, 0x0a, 0x0c, 0x44, 0x41, 0x54, 0x41, 0x42, 0x41, 0x53,+ 0x45, 0x5f, 0x44, 0x4d, 0x4c, 0x10, 0x04, 0x12, 0x19, 0x0a, 0x15, 0x44, 0x41, 0x54, 0x41, 0x42,+ 0x41, 0x53, 0x45, 0x5f, 0x52, 0x45, 0x53, 0x54, 0x4f, 0x52, 0x45, 0x5f, 0x50, 0x49, 0x54, 0x52,+ 0x10, 0x05, 0x12, 0x19, 0x0a, 0x15, 0x44, 0x41, 0x54, 0x41, 0x42, 0x41, 0x53, 0x45, 0x5f, 0x44,+ 0x4d, 0x4c, 0x5f, 0x52, 0x4f, 0x4c, 0x4c, 0x42, 0x41, 0x43, 0x4b, 0x10, 0x06, 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 (+ file_v1_deployment_proto_rawDescOnce sync.Once+ file_v1_deployment_proto_rawDescData = file_v1_deployment_proto_rawDesc+)++func file_v1_deployment_proto_rawDescGZIP() []byte {+ file_v1_deployment_proto_rawDescOnce.Do(func() {+ file_v1_deployment_proto_rawDescData = protoimpl.X.CompressGZIP(file_v1_deployment_proto_rawDescData)+ })+ return file_v1_deployment_proto_rawDescData+}++var file_v1_deployment_proto_enumTypes = make([]protoimpl.EnumInfo, 1)+var file_v1_deployment_proto_goTypes = []interface{}{+ (DeploymentType)(0), // 0: bytebase.v1.DeploymentType+}+var file_v1_deployment_proto_depIdxs = []int32{+ 0, // [0:0] is the sub-list for method output_type+ 0, // [0:0] is the sub-list for method input_type+ 0, // [0:0] is the sub-list for extension type_name+ 0, // [0:0] is the sub-list for extension extendee+ 0, // [0:0] is the sub-list for field type_name+}++func init() { file_v1_deployment_proto_init() }+func file_v1_deployment_proto_init() {+ if File_v1_deployment_proto != nil {+ return+ }+ type x struct{}+ out := protoimpl.TypeBuilder{+ File: protoimpl.DescBuilder{+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),+ RawDescriptor: file_v1_deployment_proto_rawDesc,+ NumEnums: 1,+ NumMessages: 0,+ NumExtensions: 0,+ NumServices: 0,+ },+ GoTypes: file_v1_deployment_proto_goTypes,+ DependencyIndexes: file_v1_deployment_proto_depIdxs,+ EnumInfos: file_v1_deployment_proto_enumTypes,+ }.Build()+ File_v1_deployment_proto = out.File+ file_v1_deployment_proto_rawDesc = nil+ file_v1_deployment_proto_goTypes = nil+ file_v1_deployment_proto_depIdxs = nil+}diff --git a/proto/generated-go/v1/org_policy_service.pb.go b/proto/generated-go/v1/org_policy_service.pb.goindex de6eb093ad..907fdaa77a 100644--- a/proto/generated-go/v1/org_policy_service.pb.go+++ b/proto/generated-go/v1/org_policy_service.pb.go@@ -10,6 +10,7 @@ import (_ "google.golang.org/genproto/googleapis/api/annotations"protoreflect "google.golang.org/protobuf/reflect/protoreflect"protoimpl "google.golang.org/protobuf/runtime/protoimpl"+ durationpb "google.golang.org/protobuf/types/known/durationpb"_ "google.golang.org/protobuf/types/known/emptypb"_ "google.golang.org/protobuf/types/known/fieldmaskpb"reflect "reflect"@@ -27,7 +28,7 @@ type PolicyType int32const (PolicyType_POLICY_TYPE_UNSPECIFIED PolicyType = 0- PolicyType_PIPELINE_APPROVAL PolicyType = 1+ PolicyType_DEPLOYMENT_APPROVAL PolicyType = 1PolicyType_BACKUP_PLAN PolicyType = 2PolicyType_SQL_REVIEW PolicyType = 3PolicyType_SENSITIVE_DATA PolicyType = 4@@ -38,7 +39,7 @@ const (var (PolicyType_name = map[int32]string{0: "POLICY_TYPE_UNSPECIFIED",- 1: "PIPELINE_APPROVAL",+ 1: "DEPLOYMENT_APPROVAL",2: "BACKUP_PLAN",3: "SQL_REVIEW",4: "SENSITIVE_DATA",@@ -46,7 +47,7 @@ var (}PolicyType_value = map[string]int32{"POLICY_TYPE_UNSPECIFIED": 0,- "PIPELINE_APPROVAL": 1,+ "DEPLOYMENT_APPROVAL": 1,"BACKUP_PLAN": 2,"SQL_REVIEW": 3,"SENSITIVE_DATA": 4,@@ -81,6 +82,254 @@ func (PolicyType) EnumDescriptor() ([]byte, []int) {return file_v1_org_policy_service_proto_rawDescGZIP(), []int{0}}+type ApprovalGroup int32++const (+ ApprovalGroup_ASSIGNEE_GROUP_UNSPECIFIED ApprovalGroup = 0+ ApprovalGroup_APPROVAL_GROUP_DBA ApprovalGroup = 1+ ApprovalGroup_APPROVAL_GROUP_PROJECT_OWNER ApprovalGroup = 2+)++// Enum value maps for ApprovalGroup.+var (+ ApprovalGroup_name = map[int32]string{+ 0: "ASSIGNEE_GROUP_UNSPECIFIED",+ 1: "APPROVAL_GROUP_DBA",+ 2: "APPROVAL_GROUP_PROJECT_OWNER",+ }+ ApprovalGroup_value = map[string]int32{+ "ASSIGNEE_GROUP_UNSPECIFIED": 0,+ "APPROVAL_GROUP_DBA": 1,+ "APPROVAL_GROUP_PROJECT_OWNER": 2,+ }+)++func (x ApprovalGroup) Enum() *ApprovalGroup {+ p := new(ApprovalGroup)+ *p = x+ return p+}++func (x ApprovalGroup) String() string {+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))+}++func (ApprovalGroup) Descriptor() protoreflect.EnumDescriptor {+ return file_v1_org_policy_service_proto_enumTypes[1].Descriptor()+}++func (ApprovalGroup) Type() protoreflect.EnumType {+ return &file_v1_org_policy_service_proto_enumTypes[1]+}++func (x ApprovalGroup) Number() protoreflect.EnumNumber {+ return protoreflect.EnumNumber(x)+}++// Deprecated: Use ApprovalGroup.Descriptor instead.+func (ApprovalGroup) EnumDescriptor() ([]byte, []int) {+ return file_v1_org_policy_service_proto_rawDescGZIP(), []int{1}+}++type ApprovalStrategy int32++const (+ ApprovalStrategy_APPROVAL_STRATEGY_UNSPECIFIED ApprovalStrategy = 0+ ApprovalStrategy_AUTOMATIC ApprovalStrategy = 1+ ApprovalStrategy_MANUAL ApprovalStrategy = 2+)++// Enum value maps for ApprovalStrategy.+var (+ ApprovalStrategy_name = map[int32]string{+ 0: "APPROVAL_STRATEGY_UNSPECIFIED",+ 1: "AUTOMATIC",+ 2: "MANUAL",+ }+ ApprovalStrategy_value = map[string]int32{+ "APPROVAL_STRATEGY_UNSPECIFIED": 0,+ "AUTOMATIC": 1,+ "MANUAL": 2,+ }+)++func (x ApprovalStrategy) Enum() *ApprovalStrategy {+ p := new(ApprovalStrategy)+ *p = x+ return p+}++func (x ApprovalStrategy) String() string {+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))+}++func (ApprovalStrategy) Descriptor() protoreflect.EnumDescriptor {+ return file_v1_org_policy_service_proto_enumTypes[2].Descriptor()+}++func (ApprovalStrategy) Type() protoreflect.EnumType {+ return &file_v1_org_policy_service_proto_enumTypes[2]+}++func (x ApprovalStrategy) Number() protoreflect.EnumNumber {+ return protoreflect.EnumNumber(x)+}++// Deprecated: Use ApprovalStrategy.Descriptor instead.+func (ApprovalStrategy) EnumDescriptor() ([]byte, []int) {+ return file_v1_org_policy_service_proto_rawDescGZIP(), []int{2}+}++type BackupPlanSchedule int32++const (+ BackupPlanSchedule_SCHEDULE_UNSPECIFIED BackupPlanSchedule = 0+ BackupPlanSchedule_UNSET BackupPlanSchedule = 1+ BackupPlanSchedule_DAILY BackupPlanSchedule = 2+ BackupPlanSchedule_WEEKLY BackupPlanSchedule = 3+)++// Enum value maps for BackupPlanSchedule.+var (+ BackupPlanSchedule_name = map[int32]string{+ 0: "SCHEDULE_UNSPECIFIED",+ 1: "UNSET",+ 2: "DAILY",+ 3: "WEEKLY",+ }+ BackupPlanSchedule_value = map[string]int32{+ "SCHEDULE_UNSPECIFIED": 0,+ "UNSET": 1,+ "DAILY": 2,+ "WEEKLY": 3,+ }+)++func (x BackupPlanSchedule) Enum() *BackupPlanSchedule {+ p := new(BackupPlanSchedule)+ *p = x+ return p+}++func (x BackupPlanSchedule) String() string {+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))+}++func (BackupPlanSchedule) Descriptor() protoreflect.EnumDescriptor {+ return file_v1_org_policy_service_proto_enumTypes[3].Descriptor()+}++func (BackupPlanSchedule) Type() protoreflect.EnumType {+ return &file_v1_org_policy_service_proto_enumTypes[3]+}++func (x BackupPlanSchedule) Number() protoreflect.EnumNumber {+ return protoreflect.EnumNumber(x)+}++// Deprecated: Use BackupPlanSchedule.Descriptor instead.+func (BackupPlanSchedule) EnumDescriptor() ([]byte, []int) {+ return file_v1_org_policy_service_proto_rawDescGZIP(), []int{3}+}++type SensitiveDataMaskType int32++const (+ SensitiveDataMaskType_MASK_TYPE_UNSPECIFIED SensitiveDataMaskType = 0+ SensitiveDataMaskType_DEFAULT SensitiveDataMaskType = 1+)++// Enum value maps for SensitiveDataMaskType.+var (+ SensitiveDataMaskType_name = map[int32]string{+ 0: "MASK_TYPE_UNSPECIFIED",+ 1: "DEFAULT",+ }+ SensitiveDataMaskType_value = map[string]int32{+ "MASK_TYPE_UNSPECIFIED": 0,+ "DEFAULT": 1,+ }+)++func (x SensitiveDataMaskType) Enum() *SensitiveDataMaskType {+ p := new(SensitiveDataMaskType)+ *p = x+ return p+}++func (x SensitiveDataMaskType) String() string {+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))+}++func (SensitiveDataMaskType) Descriptor() protoreflect.EnumDescriptor {+ return file_v1_org_policy_service_proto_enumTypes[4].Descriptor()+}++func (SensitiveDataMaskType) Type() protoreflect.EnumType {+ return &file_v1_org_policy_service_proto_enumTypes[4]+}++func (x SensitiveDataMaskType) Number() protoreflect.EnumNumber {+ return protoreflect.EnumNumber(x)+}++// Deprecated: Use SensitiveDataMaskType.Descriptor instead.+func (SensitiveDataMaskType) EnumDescriptor() ([]byte, []int) {+ return file_v1_org_policy_service_proto_rawDescGZIP(), []int{4}+}++type SQLReviewRuleLevel int32++const (+ SQLReviewRuleLevel_LEVEL_UNSPECIFIED SQLReviewRuleLevel = 0+ SQLReviewRuleLevel_ERROR SQLReviewRuleLevel = 1+ SQLReviewRuleLevel_WARNING SQLReviewRuleLevel = 2+ SQLReviewRuleLevel_DISABLED SQLReviewRuleLevel = 3+)++// Enum value maps for SQLReviewRuleLevel.+var (+ SQLReviewRuleLevel_name = map[int32]string{+ 0: "LEVEL_UNSPECIFIED",+ 1: "ERROR",+ 2: "WARNING",+ 3: "DISABLED",+ }+ SQLReviewRuleLevel_value = map[string]int32{+ "LEVEL_UNSPECIFIED": 0,+ "ERROR": 1,+ "WARNING": 2,+ "DISABLED": 3,+ }+)++func (x SQLReviewRuleLevel) Enum() *SQLReviewRuleLevel {+ p := new(SQLReviewRuleLevel)+ *p = x+ return p+}++func (x SQLReviewRuleLevel) String() string {+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))+}++func (SQLReviewRuleLevel) Descriptor() protoreflect.EnumDescriptor {+ return file_v1_org_policy_service_proto_enumTypes[5].Descriptor()+}++func (SQLReviewRuleLevel) Type() protoreflect.EnumType {+ return &file_v1_org_policy_service_proto_enumTypes[5]+}++func (x SQLReviewRuleLevel) Number() protoreflect.EnumNumber {+ return protoreflect.EnumNumber(x)+}++// Deprecated: Use SQLReviewRuleLevel.Descriptor instead.+func (SQLReviewRuleLevel) EnumDescriptor() ([]byte, []int) {+ return file_v1_org_policy_service_proto_rawDescGZIP(), []int{5}+}+type GetPolicyRequest struct {state protoimpl.MessageStatesizeCache protoimpl.SizeCache@@ -268,14 +517,25 @@ type Policy struct {unknownFields protoimpl.UnknownFields// The name of the policy.- // Format: {resource type}/{resource id}/policies/{policy type}+ // Format: {resource name}/policies/{policy type}+ // Workspace resource name: "".+ // Environment resource name: environments/environment-id.+ // Instance resource name: environments/environment-id/instances/instance-id.+ // Database resource name: environments/environment-id/instances/instance-id/databases/database-name.Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`// The system-assigned, unique identifier for a resource.Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid,omitempty"`State State `protobuf:"varint,3,opt,name=state,proto3,enum=bytebase.v1.State" json:"state,omitempty"`InheritFromParent bool `protobuf:"varint,4,opt,name=inherit_from_parent,json=inheritFromParent,proto3" json:"inherit_from_parent,omitempty"`Type PolicyType `protobuf:"varint,5,opt,name=type,proto3,enum=bytebase.v1.PolicyType" json:"type,omitempty"`- Payload string `protobuf:"bytes,6,opt,name=payload,proto3" json:"payload,omitempty"`+ // Types that are assignable to Policy:+ //+ // *Policy_DeploymentApprovalPolicy+ // *Policy_BackupPlanPolicy+ // *Policy_SensitiveDataPolicy+ // *Policy_AccessControlPolicy+ // *Policy_SqlReviewPolicy+ Policy isPolicy_Policy `protobuf_oneof:"policy"`}func (x *Policy) Reset() {@@ -345,212 +605,1064 @@ func (x *Policy) GetType() PolicyType {return PolicyType_POLICY_TYPE_UNSPECIFIED}-func (x *Policy) GetPayload() string {- if x != nil {- return x.Payload+func (m *Policy) GetPolicy() isPolicy_Policy {+ if m != nil {+ return m.Policy}- return ""+ return nil}-var File_v1_org_policy_service_proto protoreflect.FileDescriptor+func (x *Policy) GetDeploymentApprovalPolicy() *DeploymentApprovalPolicy {+ if x, ok := x.GetPolicy().(*Policy_DeploymentApprovalPolicy); ok {+ return x.DeploymentApprovalPolicy+ }+ return nil+}-var file_v1_org_policy_service_proto_rawDesc = []byte{- 0x0a, 0x1b, 0x76, 0x31, 0x2f, 0x6f, 0x72, 0x67, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5f,- 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x62,- 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67,- 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f,- 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,- 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74,- 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x66, 0x69,- 0x65, 0x6c, 0x64, 0x5f, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f,- 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,- 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a,- 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,- 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74,- 0x6f, 0x1a, 0x0f, 0x76, 0x31, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f,- 0x74, 0x6f, 0x22, 0x2c, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52,- 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01,- 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x02, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65,- 0x22, 0x6f, 0x0a, 0x13, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73,- 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e,- 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x02, 0x52, 0x06, 0x70,- 0x61, 0x72, 0x65, 0x6e, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69,- 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69,- 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e,- 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65,- 0x6e, 0x22, 0x6f, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65,- 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2f, 0x0a, 0x08, 0x70, 0x6f, 0x6c,- 0x69, 0x63, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x62, 0x79,- 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79,- 0x52, 0x08, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 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, 0xd5, 0x01, 0x0a, 0x06, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x12, 0x0a,- 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d,- 0x65, 0x12, 0x16, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04,- 0xe2, 0x41, 0x01, 0x03, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x28, 0x0a, 0x05, 0x73, 0x74, 0x61,- 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,- 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74,- 0x61, 0x74, 0x65, 0x12, 0x2e, 0x0a, 0x13, 0x69, 0x6e, 0x68, 0x65, 0x72, 0x69, 0x74, 0x5f, 0x66,- 0x72, 0x6f, 0x6d, 0x5f, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08,- 0x52, 0x11, 0x69, 0x6e, 0x68, 0x65, 0x72, 0x69, 0x74, 0x46, 0x72, 0x6f, 0x6d, 0x50, 0x61, 0x72,- 0x65, 0x6e, 0x74, 0x12, 0x2b, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28,- 0x0e, 0x32, 0x17, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e,- 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65,- 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28,- 0x09, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2a, 0x89, 0x01, 0x0a, 0x0a, 0x50,- 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x17, 0x50, 0x4f, 0x4c,- 0x49, 0x43, 0x59, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49,- 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x50, 0x49, 0x50, 0x45, 0x4c, 0x49,- 0x4e, 0x45, 0x5f, 0x41, 0x50, 0x50, 0x52, 0x4f, 0x56, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x0f, 0x0a,- 0x0b, 0x42, 0x41, 0x43, 0x4b, 0x55, 0x50, 0x5f, 0x50, 0x4c, 0x41, 0x4e, 0x10, 0x02, 0x12, 0x0e,- 0x0a, 0x0a, 0x53, 0x51, 0x4c, 0x5f, 0x52, 0x45, 0x56, 0x49, 0x45, 0x57, 0x10, 0x03, 0x12, 0x12,- 0x0a, 0x0e, 0x53, 0x45, 0x4e, 0x53, 0x49, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x44, 0x41, 0x54, 0x41,- 0x10, 0x04, 0x12, 0x12, 0x0a, 0x0e, 0x41, 0x43, 0x43, 0x45, 0x53, 0x53, 0x5f, 0x43, 0x4f, 0x4e,- 0x54, 0x52, 0x4f, 0x4c, 0x10, 0x05, 0x32, 0xed, 0x04, 0x0a, 0x10, 0x4f, 0x72, 0x67, 0x50, 0x6f,- 0x6c, 0x69, 0x63, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xa7, 0x02, 0x0a, 0x09,- 0x47, 0x65, 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x1d, 0x2e, 0x62, 0x79, 0x74, 0x65,- 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63,- 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,- 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x22, 0xe5, 0x01,- 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0xd7, 0x01, 0x5a, 0x22,- 0x12, 0x20, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x70, 0x72, 0x6f, 0x6a,- 0x65, 0x63, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x2f,- 0x2a, 0x7d, 0x5a, 0x26, 0x12, 0x24, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d,- 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x70,- 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x5a, 0x32, 0x12, 0x30, 0x2f, 0x76,- 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d,- 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73,- 0x2f, 0x2a, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x5a, 0x3e,- 0x12, 0x3c, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x65, 0x6e, 0x76, 0x69,- 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x69, 0x6e, 0x73, 0x74, 0x61,- 0x6e, 0x63, 0x65, 0x73, 0x2f, 0x2a, 0x2f, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x73,- 0x2f, 0x2a, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x15,- 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69,- 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0xae, 0x02, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x6f,- 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x12, 0x20, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,- 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65,- 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,- 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63,- 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xd8, 0x01, 0xda, 0x41,- 0x00, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0xce, 0x01, 0x5a, 0x22, 0x12, 0x20, 0x2f, 0x76, 0x31, 0x2f,- 0x7b, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73,- 0x2f, 0x2a, 0x7d, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x5a, 0x26, 0x12, 0x24,- 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x65, 0x6e, 0x76, 0x69,- 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x70, 0x6f, 0x6c, 0x69,- 0x63, 0x69, 0x65, 0x73, 0x5a, 0x32, 0x12, 0x30, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70, 0x61, 0x72,- 0x65, 0x6e, 0x74, 0x3d, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73,- 0x2f, 0x2a, 0x2f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x2f,- 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x5a, 0x3e, 0x12, 0x3c, 0x2f, 0x76, 0x31, 0x2f,- 0x7b, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d,- 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73,- 0x2f, 0x2a, 0x2f, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x2f,- 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x12, 0x0c, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x6f,- 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 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,+func (x *Policy) GetBackupPlanPolicy() *BackupPlanPolicy {+ if x, ok := x.GetPolicy().(*Policy_BackupPlanPolicy); ok {+ return x.BackupPlanPolicy+ }+ return nil}-var (- file_v1_org_policy_service_proto_rawDescOnce sync.Once- file_v1_org_policy_service_proto_rawDescData = file_v1_org_policy_service_proto_rawDesc-)+func (x *Policy) GetSensitiveDataPolicy() *SensitiveDataPolicy {+ if x, ok := x.GetPolicy().(*Policy_SensitiveDataPolicy); ok {+ return x.SensitiveDataPolicy+ }+ return nil+}-func file_v1_org_policy_service_proto_rawDescGZIP() []byte {- file_v1_org_policy_service_proto_rawDescOnce.Do(func() {- file_v1_org_policy_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_v1_org_policy_service_proto_rawDescData)- })- return file_v1_org_policy_service_proto_rawDescData+func (x *Policy) GetAccessControlPolicy() *AccessControlPolicy {+ if x, ok := x.GetPolicy().(*Policy_AccessControlPolicy); ok {+ return x.AccessControlPolicy+ }+ return nil}-var file_v1_org_policy_service_proto_enumTypes = make([]protoimpl.EnumInfo, 1)-var file_v1_org_policy_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4)-var file_v1_org_policy_service_proto_goTypes = []interface{}{- (PolicyType)(0), // 0: bytebase.v1.PolicyType- (*GetPolicyRequest)(nil), // 1: bytebase.v1.GetPolicyRequest- (*ListPoliciesRequest)(nil), // 2: bytebase.v1.ListPoliciesRequest- (*ListPoliciesResponse)(nil), // 3: bytebase.v1.ListPoliciesResponse- (*Policy)(nil), // 4: bytebase.v1.Policy- (State)(0), // 5: bytebase.v1.State+func (x *Policy) GetSqlReviewPolicy() *SQLReviewPolicy {+ if x, ok := x.GetPolicy().(*Policy_SqlReviewPolicy); ok {+ return x.SqlReviewPolicy+ }+ return nil}-var file_v1_org_policy_service_proto_depIdxs = []int32{- 4, // 0: bytebase.v1.ListPoliciesResponse.policies:type_name -> bytebase.v1.Policy- 5, // 1: bytebase.v1.Policy.state:type_name -> bytebase.v1.State- 0, // 2: bytebase.v1.Policy.type:type_name -> bytebase.v1.PolicyType- 1, // 3: bytebase.v1.OrgPolicyService.GetPolicy:input_type -> bytebase.v1.GetPolicyRequest- 2, // 4: bytebase.v1.OrgPolicyService.ListPolicies:input_type -> bytebase.v1.ListPoliciesRequest- 4, // 5: bytebase.v1.OrgPolicyService.GetPolicy:output_type -> bytebase.v1.Policy- 3, // 6: bytebase.v1.OrgPolicyService.ListPolicies:output_type -> bytebase.v1.ListPoliciesResponse- 5, // [5:7] is the sub-list for method output_type- 3, // [3:5] is the sub-list for method input_type- 3, // [3:3] is the sub-list for extension type_name- 3, // [3:3] is the sub-list for extension extendee- 0, // [0:3] is the sub-list for field type_name++type isPolicy_Policy interface {+ isPolicy_Policy()}-func init() { file_v1_org_policy_service_proto_init() }-func file_v1_org_policy_service_proto_init() {- if File_v1_org_policy_service_proto != nil {- return+type Policy_DeploymentApprovalPolicy struct {+ DeploymentApprovalPolicy *DeploymentApprovalPolicy `protobuf:"bytes,6,opt,name=deployment_approval_policy,json=deploymentApprovalPolicy,proto3,oneof"`+}++type Policy_BackupPlanPolicy struct {+ BackupPlanPolicy *BackupPlanPolicy `protobuf:"bytes,7,opt,name=backup_plan_policy,json=backupPlanPolicy,proto3,oneof"`+}++type Policy_SensitiveDataPolicy struct {+ SensitiveDataPolicy *SensitiveDataPolicy `protobuf:"bytes,8,opt,name=sensitive_data_policy,json=sensitiveDataPolicy,proto3,oneof"`+}++type Policy_AccessControlPolicy struct {+ AccessControlPolicy *AccessControlPolicy `protobuf:"bytes,9,opt,name=access_control_policy,json=accessControlPolicy,proto3,oneof"`+}++type Policy_SqlReviewPolicy struct {+ SqlReviewPolicy *SQLReviewPolicy `protobuf:"bytes,10,opt,name=sql_review_policy,json=sqlReviewPolicy,proto3,oneof"`+}++func (*Policy_DeploymentApprovalPolicy) isPolicy_Policy() {}++func (*Policy_BackupPlanPolicy) isPolicy_Policy() {}++func (*Policy_SensitiveDataPolicy) isPolicy_Policy() {}++func (*Policy_AccessControlPolicy) isPolicy_Policy() {}++func (*Policy_SqlReviewPolicy) isPolicy_Policy() {}++type DeploymentApprovalPolicy struct {+ state protoimpl.MessageState+ sizeCache protoimpl.SizeCache+ unknownFields protoimpl.UnknownFields++ DefaultStrategy ApprovalStrategy `protobuf:"varint,1,opt,name=default_strategy,json=defaultStrategy,proto3,enum=bytebase.v1.ApprovalStrategy" json:"default_strategy,omitempty"`+ DeploymentApprovalStrategies []*DeploymentApprovalStrategy `protobuf:"bytes,2,rep,name=deployment_approval_strategies,json=deploymentApprovalStrategies,proto3" json:"deployment_approval_strategies,omitempty"`+}++func (x *DeploymentApprovalPolicy) Reset() {+ *x = DeploymentApprovalPolicy{}+ if protoimpl.UnsafeEnabled {+ mi := &file_v1_org_policy_service_proto_msgTypes[4]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)}- file_v1_common_proto_init()- if !protoimpl.UnsafeEnabled {- file_v1_org_policy_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {- switch v := v.(*GetPolicyRequest); i {- case 0:- return &v.state- case 1:- return &v.sizeCache- case 2:- return &v.unknownFields- default:- return nil- }- }- file_v1_org_policy_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {- switch v := v.(*ListPoliciesRequest); i {- case 0:- return &v.state- case 1:- return &v.sizeCache- case 2:- return &v.unknownFields- default:- return nil- }- }- file_v1_org_policy_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {- switch v := v.(*ListPoliciesResponse); i {- case 0:- return &v.state- case 1:- return &v.sizeCache- case 2:- return &v.unknownFields- default:- return nil- }+}++func (x *DeploymentApprovalPolicy) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*DeploymentApprovalPolicy) ProtoMessage() {}++func (x *DeploymentApprovalPolicy) ProtoReflect() protoreflect.Message {+ mi := &file_v1_org_policy_service_proto_msgTypes[4]+ if protoimpl.UnsafeEnabled && x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)}- file_v1_org_policy_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {- switch v := v.(*Policy); i {- case 0:- return &v.state- case 1:- return &v.sizeCache- case 2:+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use DeploymentApprovalPolicy.ProtoReflect.Descriptor instead.+func (*DeploymentApprovalPolicy) Descriptor() ([]byte, []int) {+ return file_v1_org_policy_service_proto_rawDescGZIP(), []int{4}+}++func (x *DeploymentApprovalPolicy) GetDefaultStrategy() ApprovalStrategy {+ if x != nil {+ return x.DefaultStrategy+ }+ return ApprovalStrategy_APPROVAL_STRATEGY_UNSPECIFIED+}++func (x *DeploymentApprovalPolicy) GetDeploymentApprovalStrategies() []*DeploymentApprovalStrategy {+ if x != nil {+ return x.DeploymentApprovalStrategies+ }+ return nil+}++type DeploymentApprovalStrategy struct {+ state protoimpl.MessageState+ sizeCache protoimpl.SizeCache+ unknownFields protoimpl.UnknownFields++ DeploymentType DeploymentType `protobuf:"varint,1,opt,name=deployment_type,json=deploymentType,proto3,enum=bytebase.v1.DeploymentType" json:"deployment_type,omitempty"`+ ApprovalGroup ApprovalGroup `protobuf:"varint,2,opt,name=approval_group,json=approvalGroup,proto3,enum=bytebase.v1.ApprovalGroup" json:"approval_group,omitempty"`+ ApprovalStrategy ApprovalStrategy `protobuf:"varint,3,opt,name=approval_strategy,json=approvalStrategy,proto3,enum=bytebase.v1.ApprovalStrategy" json:"approval_strategy,omitempty"`+}++func (x *DeploymentApprovalStrategy) Reset() {+ *x = DeploymentApprovalStrategy{}+ if protoimpl.UnsafeEnabled {+ mi := &file_v1_org_policy_service_proto_msgTypes[5]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+ }+}++func (x *DeploymentApprovalStrategy) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*DeploymentApprovalStrategy) ProtoMessage() {}++func (x *DeploymentApprovalStrategy) ProtoReflect() protoreflect.Message {+ mi := &file_v1_org_policy_service_proto_msgTypes[5]+ 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 DeploymentApprovalStrategy.ProtoReflect.Descriptor instead.+func (*DeploymentApprovalStrategy) Descriptor() ([]byte, []int) {+ return file_v1_org_policy_service_proto_rawDescGZIP(), []int{5}+}++func (x *DeploymentApprovalStrategy) GetDeploymentType() DeploymentType {+ if x != nil {+ return x.DeploymentType+ }+ return DeploymentType_DEPLOYMENT_TYPE_UNSPECIFIED+}++func (x *DeploymentApprovalStrategy) GetApprovalGroup() ApprovalGroup {+ if x != nil {+ return x.ApprovalGroup+ }+ return ApprovalGroup_ASSIGNEE_GROUP_UNSPECIFIED+}++func (x *DeploymentApprovalStrategy) GetApprovalStrategy() ApprovalStrategy {+ if x != nil {+ return x.ApprovalStrategy+ }+ return ApprovalStrategy_APPROVAL_STRATEGY_UNSPECIFIED+}++type BackupPlanPolicy struct {+ state protoimpl.MessageState+ sizeCache protoimpl.SizeCache+ unknownFields protoimpl.UnknownFields++ Schedule BackupPlanSchedule `protobuf:"varint,1,opt,name=schedule,proto3,enum=bytebase.v1.BackupPlanSchedule" json:"schedule,omitempty"`+ RetentionDuration *durationpb.Duration `protobuf:"bytes,2,opt,name=retention_duration,json=retentionDuration,proto3" json:"retention_duration,omitempty"`+}++func (x *BackupPlanPolicy) Reset() {+ *x = BackupPlanPolicy{}+ if protoimpl.UnsafeEnabled {+ mi := &file_v1_org_policy_service_proto_msgTypes[6]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+ }+}++func (x *BackupPlanPolicy) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*BackupPlanPolicy) ProtoMessage() {}++func (x *BackupPlanPolicy) ProtoReflect() protoreflect.Message {+ mi := &file_v1_org_policy_service_proto_msgTypes[6]+ 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 BackupPlanPolicy.ProtoReflect.Descriptor instead.+func (*BackupPlanPolicy) Descriptor() ([]byte, []int) {+ return file_v1_org_policy_service_proto_rawDescGZIP(), []int{6}+}++func (x *BackupPlanPolicy) GetSchedule() BackupPlanSchedule {+ if x != nil {+ return x.Schedule+ }+ return BackupPlanSchedule_SCHEDULE_UNSPECIFIED+}++func (x *BackupPlanPolicy) GetRetentionDuration() *durationpb.Duration {+ if x != nil {+ return x.RetentionDuration+ }+ return nil+}++type SensitiveDataPolicy struct {+ state protoimpl.MessageState+ sizeCache protoimpl.SizeCache+ unknownFields protoimpl.UnknownFields++ SensitiveData []*SensitiveData `protobuf:"bytes,1,rep,name=sensitive_data,json=sensitiveData,proto3" json:"sensitive_data,omitempty"`+}++func (x *SensitiveDataPolicy) Reset() {+ *x = SensitiveDataPolicy{}+ if protoimpl.UnsafeEnabled {+ mi := &file_v1_org_policy_service_proto_msgTypes[7]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+ }+}++func (x *SensitiveDataPolicy) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*SensitiveDataPolicy) ProtoMessage() {}++func (x *SensitiveDataPolicy) ProtoReflect() protoreflect.Message {+ mi := &file_v1_org_policy_service_proto_msgTypes[7]+ 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 SensitiveDataPolicy.ProtoReflect.Descriptor instead.+func (*SensitiveDataPolicy) Descriptor() ([]byte, []int) {+ return file_v1_org_policy_service_proto_rawDescGZIP(), []int{7}+}++func (x *SensitiveDataPolicy) GetSensitiveData() []*SensitiveData {+ if x != nil {+ return x.SensitiveData+ }+ return nil+}++type SensitiveData struct {+ state protoimpl.MessageState+ sizeCache protoimpl.SizeCache+ unknownFields protoimpl.UnknownFields++ Schema string `protobuf:"bytes,1,opt,name=schema,proto3" json:"schema,omitempty"`+ Table string `protobuf:"bytes,2,opt,name=table,proto3" json:"table,omitempty"`+ Column string `protobuf:"bytes,3,opt,name=column,proto3" json:"column,omitempty"`+ MaskType SensitiveDataMaskType `protobuf:"varint,4,opt,name=mask_type,json=maskType,proto3,enum=bytebase.v1.SensitiveDataMaskType" json:"mask_type,omitempty"`+}++func (x *SensitiveData) Reset() {+ *x = SensitiveData{}+ if protoimpl.UnsafeEnabled {+ mi := &file_v1_org_policy_service_proto_msgTypes[8]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+ }+}++func (x *SensitiveData) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*SensitiveData) ProtoMessage() {}++func (x *SensitiveData) ProtoReflect() protoreflect.Message {+ mi := &file_v1_org_policy_service_proto_msgTypes[8]+ 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 SensitiveData.ProtoReflect.Descriptor instead.+func (*SensitiveData) Descriptor() ([]byte, []int) {+ return file_v1_org_policy_service_proto_rawDescGZIP(), []int{8}+}++func (x *SensitiveData) GetSchema() string {+ if x != nil {+ return x.Schema+ }+ return ""+}++func (x *SensitiveData) GetTable() string {+ if x != nil {+ return x.Table+ }+ return ""+}++func (x *SensitiveData) GetColumn() string {+ if x != nil {+ return x.Column+ }+ return ""+}++func (x *SensitiveData) GetMaskType() SensitiveDataMaskType {+ if x != nil {+ return x.MaskType+ }+ return SensitiveDataMaskType_MASK_TYPE_UNSPECIFIED+}++type AccessControlPolicy struct {+ state protoimpl.MessageState+ sizeCache protoimpl.SizeCache+ unknownFields protoimpl.UnknownFields++ DisallowRules []*AccessControlRule `protobuf:"bytes,1,rep,name=disallow_rules,json=disallowRules,proto3" json:"disallow_rules,omitempty"`+}++func (x *AccessControlPolicy) Reset() {+ *x = AccessControlPolicy{}+ if protoimpl.UnsafeEnabled {+ mi := &file_v1_org_policy_service_proto_msgTypes[9]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+ }+}++func (x *AccessControlPolicy) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*AccessControlPolicy) ProtoMessage() {}++func (x *AccessControlPolicy) ProtoReflect() protoreflect.Message {+ mi := &file_v1_org_policy_service_proto_msgTypes[9]+ 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 AccessControlPolicy.ProtoReflect.Descriptor instead.+func (*AccessControlPolicy) Descriptor() ([]byte, []int) {+ return file_v1_org_policy_service_proto_rawDescGZIP(), []int{9}+}++func (x *AccessControlPolicy) GetDisallowRules() []*AccessControlRule {+ if x != nil {+ return x.DisallowRules+ }+ return nil+}++type AccessControlRule struct {+ state protoimpl.MessageState+ sizeCache protoimpl.SizeCache+ unknownFields protoimpl.UnknownFields++ FullDatabase bool `protobuf:"varint,1,opt,name=full_database,json=fullDatabase,proto3" json:"full_database,omitempty"`+}++func (x *AccessControlRule) Reset() {+ *x = AccessControlRule{}+ if protoimpl.UnsafeEnabled {+ mi := &file_v1_org_policy_service_proto_msgTypes[10]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+ }+}++func (x *AccessControlRule) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*AccessControlRule) ProtoMessage() {}++func (x *AccessControlRule) ProtoReflect() protoreflect.Message {+ mi := &file_v1_org_policy_service_proto_msgTypes[10]+ 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 AccessControlRule.ProtoReflect.Descriptor instead.+func (*AccessControlRule) Descriptor() ([]byte, []int) {+ return file_v1_org_policy_service_proto_rawDescGZIP(), []int{10}+}++func (x *AccessControlRule) GetFullDatabase() bool {+ if x != nil {+ return x.FullDatabase+ }+ return false+}++type SQLReviewPolicy struct {+ state protoimpl.MessageState+ sizeCache protoimpl.SizeCache+ unknownFields protoimpl.UnknownFields++ Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"`+ Rules []*SQLReviewRule `protobuf:"bytes,2,rep,name=rules,proto3" json:"rules,omitempty"`+}++func (x *SQLReviewPolicy) Reset() {+ *x = SQLReviewPolicy{}+ if protoimpl.UnsafeEnabled {+ mi := &file_v1_org_policy_service_proto_msgTypes[11]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+ }+}++func (x *SQLReviewPolicy) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*SQLReviewPolicy) ProtoMessage() {}++func (x *SQLReviewPolicy) ProtoReflect() protoreflect.Message {+ mi := &file_v1_org_policy_service_proto_msgTypes[11]+ if protoimpl.UnsafeEnabled && x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use SQLReviewPolicy.ProtoReflect.Descriptor instead.+func (*SQLReviewPolicy) Descriptor() ([]byte, []int) {+ return file_v1_org_policy_service_proto_rawDescGZIP(), []int{11}+}++func (x *SQLReviewPolicy) GetTitle() string {+ if x != nil {+ return x.Title+ }+ return ""+}++func (x *SQLReviewPolicy) GetRules() []*SQLReviewRule {+ if x != nil {+ return x.Rules+ }+ return nil+}++type SQLReviewRule struct {+ state protoimpl.MessageState+ sizeCache protoimpl.SizeCache+ unknownFields protoimpl.UnknownFields++ Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`+ Level SQLReviewRuleLevel `protobuf:"varint,2,opt,name=level,proto3,enum=bytebase.v1.SQLReviewRuleLevel" json:"level,omitempty"`+ Payload string `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload,omitempty"`+}++func (x *SQLReviewRule) Reset() {+ *x = SQLReviewRule{}+ if protoimpl.UnsafeEnabled {+ mi := &file_v1_org_policy_service_proto_msgTypes[12]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+ }+}++func (x *SQLReviewRule) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*SQLReviewRule) ProtoMessage() {}++func (x *SQLReviewRule) ProtoReflect() protoreflect.Message {+ mi := &file_v1_org_policy_service_proto_msgTypes[12]+ if protoimpl.UnsafeEnabled && x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use SQLReviewRule.ProtoReflect.Descriptor instead.+func (*SQLReviewRule) Descriptor() ([]byte, []int) {+ return file_v1_org_policy_service_proto_rawDescGZIP(), []int{12}+}++func (x *SQLReviewRule) GetType() string {+ if x != nil {+ return x.Type+ }+ return ""+}++func (x *SQLReviewRule) GetLevel() SQLReviewRuleLevel {+ if x != nil {+ return x.Level+ }+ return SQLReviewRuleLevel_LEVEL_UNSPECIFIED+}++func (x *SQLReviewRule) GetPayload() string {+ if x != nil {+ return x.Payload+ }+ return ""+}++var File_v1_org_policy_service_proto protoreflect.FileDescriptor++var file_v1_org_policy_service_proto_rawDesc = []byte{+ 0x0a, 0x1b, 0x76, 0x31, 0x2f, 0x6f, 0x72, 0x67, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5f,+ 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x62,+ 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67,+ 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f,+ 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,+ 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74,+ 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x66, 0x69,+ 0x65, 0x6c, 0x64, 0x5f, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f,+ 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,+ 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f,+ 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,+ 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a,+ 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,+ 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74,+ 0x6f, 0x1a, 0x0f, 0x76, 0x31, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f,+ 0x74, 0x6f, 0x1a, 0x13, 0x76, 0x31, 0x2f, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e,+ 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2c, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x50, 0x6f,+ 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x04, 0x6e,+ 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x02, 0x52,+ 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x6f, 0x0a, 0x13, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x6f, 0x6c,+ 0x69, 0x63, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x06,+ 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41,+ 0x01, 0x02, 0x52, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61,+ 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70,+ 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f,+ 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67,+ 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x6f, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x6f,+ 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2f,+ 0x0a, 0x08, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b,+ 0x32, 0x13, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50,+ 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x08, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 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, 0xf7, 0x04, 0x0a, 0x06, 0x50, 0x6f, 0x6c, 0x69,+ 0x63, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,+ 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20,+ 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x03, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x28,+ 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e,+ 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x61, 0x74,+ 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x2e, 0x0a, 0x13, 0x69, 0x6e, 0x68, 0x65,+ 0x72, 0x69, 0x74, 0x5f, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18,+ 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x69, 0x6e, 0x68, 0x65, 0x72, 0x69, 0x74, 0x46, 0x72,+ 0x6f, 0x6d, 0x50, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x12, 0x2b, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65,+ 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,+ 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x54, 0x79, 0x70, 0x65, 0x52,+ 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x65, 0x0a, 0x1a, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d,+ 0x65, 0x6e, 0x74, 0x5f, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x61, 0x6c, 0x5f, 0x70, 0x6f, 0x6c,+ 0x69, 0x63, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x62, 0x79, 0x74, 0x65,+ 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65,+ 0x6e, 0x74, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x61, 0x6c, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79,+ 0x48, 0x00, 0x52, 0x18, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x70,+ 0x70, 0x72, 0x6f, 0x76, 0x61, 0x6c, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x4d, 0x0a, 0x12,+ 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x5f, 0x70, 0x6c, 0x61, 0x6e, 0x5f, 0x70, 0x6f, 0x6c, 0x69,+ 0x63, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,+ 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x50, 0x6c, 0x61,+ 0x6e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x48, 0x00, 0x52, 0x10, 0x62, 0x61, 0x63, 0x6b, 0x75,+ 0x70, 0x50, 0x6c, 0x61, 0x6e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x56, 0x0a, 0x15, 0x73,+ 0x65, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x70, 0x6f,+ 0x6c, 0x69, 0x63, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x62, 0x79, 0x74,+ 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x6e, 0x73, 0x69, 0x74, 0x69,+ 0x76, 0x65, 0x44, 0x61, 0x74, 0x61, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x48, 0x00, 0x52, 0x13,+ 0x73, 0x65, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x44, 0x61, 0x74, 0x61, 0x50, 0x6f, 0x6c,+ 0x69, 0x63, 0x79, 0x12, 0x56, 0x0a, 0x15, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x63, 0x6f,+ 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x18, 0x09, 0x20, 0x01,+ 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31,+ 0x2e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x50, 0x6f,+ 0x6c, 0x69, 0x63, 0x79, 0x48, 0x00, 0x52, 0x13, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x43, 0x6f,+ 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x4a, 0x0a, 0x11, 0x73,+ 0x71, 0x6c, 0x5f, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79,+ 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,+ 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x51, 0x4c, 0x52, 0x65, 0x76, 0x69, 0x65, 0x77, 0x50, 0x6f,+ 0x6c, 0x69, 0x63, 0x79, 0x48, 0x00, 0x52, 0x0f, 0x73, 0x71, 0x6c, 0x52, 0x65, 0x76, 0x69, 0x65,+ 0x77, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x42, 0x08, 0x0a, 0x06, 0x70, 0x6f, 0x6c, 0x69, 0x63,+ 0x79, 0x22, 0xd3, 0x01, 0x0a, 0x18, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74,+ 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x61, 0x6c, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x48,+ 0x0a, 0x10, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x73, 0x74, 0x72, 0x61, 0x74, 0x65,+ 0x67, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1d, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,+ 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x61, 0x6c, 0x53,+ 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x52, 0x0f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74,+ 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x12, 0x6d, 0x0a, 0x1e, 0x64, 0x65, 0x70, 0x6c,+ 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x61, 0x6c, 0x5f,+ 0x73, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x69, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b,+ 0x32, 0x27, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44,+ 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x61,+ 0x6c, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x52, 0x1c, 0x64, 0x65, 0x70, 0x6c, 0x6f,+ 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x61, 0x6c, 0x53, 0x74, 0x72,+ 0x61, 0x74, 0x65, 0x67, 0x69, 0x65, 0x73, 0x22, 0xf1, 0x01, 0x0a, 0x1a, 0x44, 0x65, 0x70, 0x6c,+ 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x61, 0x6c, 0x53, 0x74,+ 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x12, 0x44, 0x0a, 0x0f, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79,+ 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32,+ 0x1b, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65,+ 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0e, 0x64, 0x65,+ 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x41, 0x0a, 0x0e,+ 0x61, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x61, 0x6c, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x02,+ 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e,+ 0x76, 0x31, 0x2e, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x61, 0x6c, 0x47, 0x72, 0x6f, 0x75, 0x70,+ 0x52, 0x0d, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x61, 0x6c, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12,+ 0x4a, 0x0a, 0x11, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x72, 0x61,+ 0x74, 0x65, 0x67, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1d, 0x2e, 0x62, 0x79, 0x74,+ 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x61,+ 0x6c, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x52, 0x10, 0x61, 0x70, 0x70, 0x72, 0x6f,+ 0x76, 0x61, 0x6c, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x22, 0x99, 0x01, 0x0a, 0x10,+ 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x50, 0x6c, 0x61, 0x6e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79,+ 0x12, 0x3b, 0x0a, 0x08, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01,+ 0x28, 0x0e, 0x32, 0x1f, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31,+ 0x2e, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x50, 0x6c, 0x61, 0x6e, 0x53, 0x63, 0x68, 0x65, 0x64,+ 0x75, 0x6c, 0x65, 0x52, 0x08, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x48, 0x0a,+ 0x12, 0x72, 0x65, 0x74, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x75, 0x72, 0x61, 0x74,+ 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67,+ 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61,+ 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x11, 0x72, 0x65, 0x74, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x44,+ 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x58, 0x0a, 0x13, 0x53, 0x65, 0x6e, 0x73, 0x69,+ 0x74, 0x69, 0x76, 0x65, 0x44, 0x61, 0x74, 0x61, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x41,+ 0x0a, 0x0e, 0x73, 0x65, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x64, 0x61, 0x74, 0x61,+ 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,+ 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x44, 0x61,+ 0x74, 0x61, 0x52, 0x0d, 0x73, 0x65, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x44, 0x61, 0x74,+ 0x61, 0x22, 0x96, 0x01, 0x0a, 0x0d, 0x53, 0x65, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x44,+ 0x61, 0x74, 0x61, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x01, 0x20,+ 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x74,+ 0x61, 0x62, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x61, 0x62, 0x6c,+ 0x65, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28,+ 0x09, 0x52, 0x06, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x12, 0x3f, 0x0a, 0x09, 0x6d, 0x61, 0x73,+ 0x6b, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x22, 0x2e, 0x62,+ 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x6e, 0x73, 0x69,+ 0x74, 0x69, 0x76, 0x65, 0x44, 0x61, 0x74, 0x61, 0x4d, 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65,+ 0x52, 0x08, 0x6d, 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x22, 0x5c, 0x0a, 0x13, 0x41, 0x63,+ 0x63, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x50, 0x6f, 0x6c, 0x69, 0x63,+ 0x79, 0x12, 0x45, 0x0a, 0x0e, 0x64, 0x69, 0x73, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x72, 0x75,+ 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x62, 0x79, 0x74, 0x65,+ 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x43, 0x6f,+ 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x0d, 0x64, 0x69, 0x73, 0x61, 0x6c,+ 0x6c, 0x6f, 0x77, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x22, 0x38, 0x0a, 0x11, 0x41, 0x63, 0x63, 0x65,+ 0x73, 0x73, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x23, 0x0a,+ 0x0d, 0x66, 0x75, 0x6c, 0x6c, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x18, 0x01,+ 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x66, 0x75, 0x6c, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61,+ 0x73, 0x65, 0x22, 0x59, 0x0a, 0x0f, 0x53, 0x51, 0x4c, 0x52, 0x65, 0x76, 0x69, 0x65, 0x77, 0x50,+ 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x01,+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x30, 0x0a, 0x05, 0x72,+ 0x75, 0x6c, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x62, 0x79, 0x74,+ 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x51, 0x4c, 0x52, 0x65, 0x76, 0x69,+ 0x65, 0x77, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x22, 0x74, 0x0a,+ 0x0d, 0x53, 0x51, 0x4c, 0x52, 0x65, 0x76, 0x69, 0x65, 0x77, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x12,+ 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79,+ 0x70, 0x65, 0x12, 0x35, 0x0a, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28,+ 0x0e, 0x32, 0x1f, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e,+ 0x53, 0x51, 0x4c, 0x52, 0x65, 0x76, 0x69, 0x65, 0x77, 0x52, 0x75, 0x6c, 0x65, 0x4c, 0x65, 0x76,+ 0x65, 0x6c, 0x52, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79,+ 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c,+ 0x6f, 0x61, 0x64, 0x2a, 0x8b, 0x01, 0x0a, 0x0a, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x54, 0x79,+ 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x17, 0x50, 0x4f, 0x4c, 0x49, 0x43, 0x59, 0x5f, 0x54, 0x59, 0x50,+ 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12,+ 0x17, 0x0a, 0x13, 0x44, 0x45, 0x50, 0x4c, 0x4f, 0x59, 0x4d, 0x45, 0x4e, 0x54, 0x5f, 0x41, 0x50,+ 0x50, 0x52, 0x4f, 0x56, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x42, 0x41, 0x43, 0x4b,+ 0x55, 0x50, 0x5f, 0x50, 0x4c, 0x41, 0x4e, 0x10, 0x02, 0x12, 0x0e, 0x0a, 0x0a, 0x53, 0x51, 0x4c,+ 0x5f, 0x52, 0x45, 0x56, 0x49, 0x45, 0x57, 0x10, 0x03, 0x12, 0x12, 0x0a, 0x0e, 0x53, 0x45, 0x4e,+ 0x53, 0x49, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x44, 0x41, 0x54, 0x41, 0x10, 0x04, 0x12, 0x12, 0x0a,+ 0x0e, 0x41, 0x43, 0x43, 0x45, 0x53, 0x53, 0x5f, 0x43, 0x4f, 0x4e, 0x54, 0x52, 0x4f, 0x4c, 0x10,+ 0x05, 0x2a, 0x69, 0x0a, 0x0d, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x61, 0x6c, 0x47, 0x72, 0x6f,+ 0x75, 0x70, 0x12, 0x1e, 0x0a, 0x1a, 0x41, 0x53, 0x53, 0x49, 0x47, 0x4e, 0x45, 0x45, 0x5f, 0x47,+ 0x52, 0x4f, 0x55, 0x50, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44,+ 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x41, 0x50, 0x50, 0x52, 0x4f, 0x56, 0x41, 0x4c, 0x5f, 0x47,+ 0x52, 0x4f, 0x55, 0x50, 0x5f, 0x44, 0x42, 0x41, 0x10, 0x01, 0x12, 0x20, 0x0a, 0x1c, 0x41, 0x50,+ 0x50, 0x52, 0x4f, 0x56, 0x41, 0x4c, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x5f, 0x50, 0x52, 0x4f,+ 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x4f, 0x57, 0x4e, 0x45, 0x52, 0x10, 0x02, 0x2a, 0x50, 0x0a, 0x10,+ 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x61, 0x6c, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79,+ 0x12, 0x21, 0x0a, 0x1d, 0x41, 0x50, 0x50, 0x52, 0x4f, 0x56, 0x41, 0x4c, 0x5f, 0x53, 0x54, 0x52,+ 0x41, 0x54, 0x45, 0x47, 0x59, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45,+ 0x44, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x41, 0x55, 0x54, 0x4f, 0x4d, 0x41, 0x54, 0x49, 0x43,+ 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x4d, 0x41, 0x4e, 0x55, 0x41, 0x4c, 0x10, 0x02, 0x2a, 0x50,+ 0x0a, 0x12, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x50, 0x6c, 0x61, 0x6e, 0x53, 0x63, 0x68, 0x65,+ 0x64, 0x75, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x14, 0x53, 0x43, 0x48, 0x45, 0x44, 0x55, 0x4c, 0x45,+ 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x09,+ 0x0a, 0x05, 0x55, 0x4e, 0x53, 0x45, 0x54, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x44, 0x41, 0x49,+ 0x4c, 0x59, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x57, 0x45, 0x45, 0x4b, 0x4c, 0x59, 0x10, 0x03,+ 0x2a, 0x3f, 0x0a, 0x15, 0x53, 0x65, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x44, 0x61, 0x74,+ 0x61, 0x4d, 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a, 0x15, 0x4d, 0x41, 0x53,+ 0x4b, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49,+ 0x45, 0x44, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x44, 0x45, 0x46, 0x41, 0x55, 0x4c, 0x54, 0x10,+ 0x01, 0x2a, 0x51, 0x0a, 0x12, 0x53, 0x51, 0x4c, 0x52, 0x65, 0x76, 0x69, 0x65, 0x77, 0x52, 0x75,+ 0x6c, 0x65, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x15, 0x0a, 0x11, 0x4c, 0x45, 0x56, 0x45, 0x4c,+ 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x09,+ 0x0a, 0x05, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x57, 0x41, 0x52,+ 0x4e, 0x49, 0x4e, 0x47, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x49, 0x53, 0x41, 0x42, 0x4c,+ 0x45, 0x44, 0x10, 0x03, 0x32, 0xed, 0x04, 0x0a, 0x10, 0x4f, 0x72, 0x67, 0x50, 0x6f, 0x6c, 0x69,+ 0x63, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xa7, 0x02, 0x0a, 0x09, 0x47, 0x65,+ 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x1d, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61,+ 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52,+ 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,+ 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x22, 0xe5, 0x01, 0xda, 0x41,+ 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0xd7, 0x01, 0x5a, 0x22, 0x12, 0x20,+ 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63,+ 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x2f, 0x2a, 0x7d,+ 0x5a, 0x26, 0x12, 0x24, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x65, 0x6e,+ 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x70, 0x6f, 0x6c,+ 0x69, 0x63, 0x69, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x5a, 0x32, 0x12, 0x30, 0x2f, 0x76, 0x31, 0x2f,+ 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e,+ 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x2f, 0x2a,+ 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x5a, 0x3e, 0x12, 0x3c,+ 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f,+ 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63,+ 0x65, 0x73, 0x2f, 0x2a, 0x2f, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x73, 0x2f, 0x2a,+ 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x15, 0x2f, 0x76,+ 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73,+ 0x2f, 0x2a, 0x7d, 0x12, 0xae, 0x02, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x6f, 0x6c, 0x69,+ 0x63, 0x69, 0x65, 0x73, 0x12, 0x20, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e,+ 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x52,+ 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,+ 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65,+ 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xd8, 0x01, 0xda, 0x41, 0x00, 0x82,+ 0xd3, 0xe4, 0x93, 0x02, 0xce, 0x01, 0x5a, 0x22, 0x12, 0x20, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70,+ 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x2a,+ 0x7d, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x5a, 0x26, 0x12, 0x24, 0x2f, 0x76,+ 0x31, 0x2f, 0x7b, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f,+ 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69,+ 0x65, 0x73, 0x5a, 0x32, 0x12, 0x30, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70, 0x61, 0x72, 0x65, 0x6e,+ 0x74, 0x3d, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x2a,+ 0x2f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x70, 0x6f,+ 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x5a, 0x3e, 0x12, 0x3c, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70,+ 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e,+ 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x2f, 0x2a,+ 0x2f, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x70, 0x6f,+ 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x12, 0x0c, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x6f, 0x6c, 0x69,+ 0x63, 0x69, 0x65, 0x73, 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 (+ file_v1_org_policy_service_proto_rawDescOnce sync.Once+ file_v1_org_policy_service_proto_rawDescData = file_v1_org_policy_service_proto_rawDesc+)++func file_v1_org_policy_service_proto_rawDescGZIP() []byte {+ file_v1_org_policy_service_proto_rawDescOnce.Do(func() {+ file_v1_org_policy_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_v1_org_policy_service_proto_rawDescData)+ })+ return file_v1_org_policy_service_proto_rawDescData+}++var file_v1_org_policy_service_proto_enumTypes = make([]protoimpl.EnumInfo, 6)+var file_v1_org_policy_service_proto_msgTypes = make([]protoimpl.MessageInfo, 13)+var file_v1_org_policy_service_proto_goTypes = []interface{}{+ (PolicyType)(0), // 0: bytebase.v1.PolicyType+ (ApprovalGroup)(0), // 1: bytebase.v1.ApprovalGroup+ (ApprovalStrategy)(0), // 2: bytebase.v1.ApprovalStrategy+ (BackupPlanSchedule)(0), // 3: bytebase.v1.BackupPlanSchedule+ (SensitiveDataMaskType)(0), // 4: bytebase.v1.SensitiveDataMaskType+ (SQLReviewRuleLevel)(0), // 5: bytebase.v1.SQLReviewRuleLevel+ (*GetPolicyRequest)(nil), // 6: bytebase.v1.GetPolicyRequest+ (*ListPoliciesRequest)(nil), // 7: bytebase.v1.ListPoliciesRequest+ (*ListPoliciesResponse)(nil), // 8: bytebase.v1.ListPoliciesResponse+ (*Policy)(nil), // 9: bytebase.v1.Policy+ (*DeploymentApprovalPolicy)(nil), // 10: bytebase.v1.DeploymentApprovalPolicy+ (*DeploymentApprovalStrategy)(nil), // 11: bytebase.v1.DeploymentApprovalStrategy+ (*BackupPlanPolicy)(nil), // 12: bytebase.v1.BackupPlanPolicy+ (*SensitiveDataPolicy)(nil), // 13: bytebase.v1.SensitiveDataPolicy+ (*SensitiveData)(nil), // 14: bytebase.v1.SensitiveData+ (*AccessControlPolicy)(nil), // 15: bytebase.v1.AccessControlPolicy+ (*AccessControlRule)(nil), // 16: bytebase.v1.AccessControlRule+ (*SQLReviewPolicy)(nil), // 17: bytebase.v1.SQLReviewPolicy+ (*SQLReviewRule)(nil), // 18: bytebase.v1.SQLReviewRule+ (State)(0), // 19: bytebase.v1.State+ (DeploymentType)(0), // 20: bytebase.v1.DeploymentType+ (*durationpb.Duration)(nil), // 21: google.protobuf.Duration+}+var file_v1_org_policy_service_proto_depIdxs = []int32{+ 9, // 0: bytebase.v1.ListPoliciesResponse.policies:type_name -> bytebase.v1.Policy+ 19, // 1: bytebase.v1.Policy.state:type_name -> bytebase.v1.State+ 0, // 2: bytebase.v1.Policy.type:type_name -> bytebase.v1.PolicyType+ 10, // 3: bytebase.v1.Policy.deployment_approval_policy:type_name -> bytebase.v1.DeploymentApprovalPolicy+ 12, // 4: bytebase.v1.Policy.backup_plan_policy:type_name -> bytebase.v1.BackupPlanPolicy+ 13, // 5: bytebase.v1.Policy.sensitive_data_policy:type_name -> bytebase.v1.SensitiveDataPolicy+ 15, // 6: bytebase.v1.Policy.access_control_policy:type_name -> bytebase.v1.AccessControlPolicy+ 17, // 7: bytebase.v1.Policy.sql_review_policy:type_name -> bytebase.v1.SQLReviewPolicy+ 2, // 8: bytebase.v1.DeploymentApprovalPolicy.default_strategy:type_name -> bytebase.v1.ApprovalStrategy+ 11, // 9: bytebase.v1.DeploymentApprovalPolicy.deployment_approval_strategies:type_name -> bytebase.v1.DeploymentApprovalStrategy+ 20, // 10: bytebase.v1.DeploymentApprovalStrategy.deployment_type:type_name -> bytebase.v1.DeploymentType+ 1, // 11: bytebase.v1.DeploymentApprovalStrategy.approval_group:type_name -> bytebase.v1.ApprovalGroup+ 2, // 12: bytebase.v1.DeploymentApprovalStrategy.approval_strategy:type_name -> bytebase.v1.ApprovalStrategy+ 3, // 13: bytebase.v1.BackupPlanPolicy.schedule:type_name -> bytebase.v1.BackupPlanSchedule+ 21, // 14: bytebase.v1.BackupPlanPolicy.retention_duration:type_name -> google.protobuf.Duration+ 14, // 15: bytebase.v1.SensitiveDataPolicy.sensitive_data:type_name -> bytebase.v1.SensitiveData+ 4, // 16: bytebase.v1.SensitiveData.mask_type:type_name -> bytebase.v1.SensitiveDataMaskType+ 16, // 17: bytebase.v1.AccessControlPolicy.disallow_rules:type_name -> bytebase.v1.AccessControlRule+ 18, // 18: bytebase.v1.SQLReviewPolicy.rules:type_name -> bytebase.v1.SQLReviewRule+ 5, // 19: bytebase.v1.SQLReviewRule.level:type_name -> bytebase.v1.SQLReviewRuleLevel+ 6, // 20: bytebase.v1.OrgPolicyService.GetPolicy:input_type -> bytebase.v1.GetPolicyRequest+ 7, // 21: bytebase.v1.OrgPolicyService.ListPolicies:input_type -> bytebase.v1.ListPoliciesRequest+ 9, // 22: bytebase.v1.OrgPolicyService.GetPolicy:output_type -> bytebase.v1.Policy+ 8, // 23: bytebase.v1.OrgPolicyService.ListPolicies:output_type -> bytebase.v1.ListPoliciesResponse+ 22, // [22:24] is the sub-list for method output_type+ 20, // [20:22] is the sub-list for method input_type+ 20, // [20:20] is the sub-list for extension type_name+ 20, // [20:20] is the sub-list for extension extendee+ 0, // [0:20] is the sub-list for field type_name+}++func init() { file_v1_org_policy_service_proto_init() }+func file_v1_org_policy_service_proto_init() {+ if File_v1_org_policy_service_proto != nil {+ return+ }+ file_v1_common_proto_init()+ file_v1_deployment_proto_init()+ if !protoimpl.UnsafeEnabled {+ file_v1_org_policy_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {+ switch v := v.(*GetPolicyRequest); i {+ case 0:+ return &v.state+ case 1:+ return &v.sizeCache+ case 2:return &v.unknownFieldsdefault:return nil}}+ file_v1_org_policy_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {+ switch v := v.(*ListPoliciesRequest); i {+ case 0:+ return &v.state+ case 1:+ return &v.sizeCache+ case 2:+ return &v.unknownFields+ default:+ return nil+ }+ }+ file_v1_org_policy_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {+ switch v := v.(*ListPoliciesResponse); i {+ case 0:+ return &v.state+ case 1:+ return &v.sizeCache+ case 2:+ return &v.unknownFields+ default:+ return nil+ }+ }+ file_v1_org_policy_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {+ switch v := v.(*Policy); i {+ case 0:+ return &v.state+ case 1:+ return &v.sizeCache+ case 2:+ return &v.unknownFields+ default:+ return nil+ }+ }+ file_v1_org_policy_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {+ switch v := v.(*DeploymentApprovalPolicy); i {+ case 0:+ return &v.state+ case 1:+ return &v.sizeCache+ case 2:+ return &v.unknownFields+ default:+ return nil+ }+ }+ file_v1_org_policy_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {+ switch v := v.(*DeploymentApprovalStrategy); i {+ case 0:+ return &v.state+ case 1:+ return &v.sizeCache+ case 2:+ return &v.unknownFields+ default:+ return nil+ }+ }+ file_v1_org_policy_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {+ switch v := v.(*BackupPlanPolicy); i {+ case 0:+ return &v.state+ case 1:+ return &v.sizeCache+ case 2:+ return &v.unknownFields+ default:+ return nil+ }+ }+ file_v1_org_policy_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {+ switch v := v.(*SensitiveDataPolicy); i {+ case 0:+ return &v.state+ case 1:+ return &v.sizeCache+ case 2:+ return &v.unknownFields+ default:+ return nil+ }+ }+ file_v1_org_policy_service_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {+ switch v := v.(*SensitiveData); i {+ case 0:+ return &v.state+ case 1:+ return &v.sizeCache+ case 2:+ return &v.unknownFields+ default:+ return nil+ }+ }+ file_v1_org_policy_service_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {+ switch v := v.(*AccessControlPolicy); i {+ case 0:+ return &v.state+ case 1:+ return &v.sizeCache+ case 2:+ return &v.unknownFields+ default:+ return nil+ }+ }+ file_v1_org_policy_service_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {+ switch v := v.(*AccessControlRule); i {+ case 0:+ return &v.state+ case 1:+ return &v.sizeCache+ case 2:+ return &v.unknownFields+ default:+ return nil+ }+ }+ file_v1_org_policy_service_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {+ switch v := v.(*SQLReviewPolicy); i {+ case 0:+ return &v.state+ case 1:+ return &v.sizeCache+ case 2:+ return &v.unknownFields+ default:+ return nil+ }+ }+ file_v1_org_policy_service_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {+ switch v := v.(*SQLReviewRule); i {+ case 0:+ return &v.state+ case 1:+ return &v.sizeCache+ case 2:+ return &v.unknownFields+ default:+ return nil+ }+ }+ }+ file_v1_org_policy_service_proto_msgTypes[3].OneofWrappers = []interface{}{+ (*Policy_DeploymentApprovalPolicy)(nil),+ (*Policy_BackupPlanPolicy)(nil),+ (*Policy_SensitiveDataPolicy)(nil),+ (*Policy_AccessControlPolicy)(nil),+ (*Policy_SqlReviewPolicy)(nil),}type x struct{}out := protoimpl.TypeBuilder{File: protoimpl.DescBuilder{GoPackagePath: reflect.TypeOf(x{}).PkgPath(),RawDescriptor: file_v1_org_policy_service_proto_rawDesc,- NumEnums: 1,- NumMessages: 4,+ NumEnums: 6,+ NumMessages: 13,NumExtensions: 0,NumServices: 1,},diff --git a/proto/v1/deployment.proto b/proto/v1/deployment.protonew file mode 100644index 0000000000..235c9ecc19--- /dev/null+++ b/proto/v1/deployment.proto@@ -0,0 +1,15 @@+syntax = "proto3";++package bytebase.v1;++option go_package = "generated-go/v1";++enum DeploymentType {+ DEPLOYMENT_TYPE_UNSPECIFIED = 0;+ DATABASE_CREATE = 1;+ DATABASE_DDL = 2;+ DATABASE_DDL_GHOST = 3;+ DATABASE_DML = 4;+ DATABASE_RESTORE_PITR = 5;+ DATABASE_DML_ROLLBACK = 6;+}diff --git a/proto/v1/org_policy_service.proto b/proto/v1/org_policy_service.protoindex 6d8b5ada64..3189970289 100644--- a/proto/v1/org_policy_service.proto+++ b/proto/v1/org_policy_service.proto@@ -5,10 +5,12 @@ package bytebase.v1;import "google/api/annotations.proto";import "google/api/client.proto";import "google/api/field_behavior.proto";+import "google/protobuf/duration.proto";import "google/protobuf/empty.proto";import "google/protobuf/field_mask.proto";import "v1/common.proto";+import "v1/deployment.proto";option go_package = "generated-go/v1";@@ -90,7 +92,11 @@ message ListPoliciesResponse {message Policy {// The name of the policy.- // Format: {resource type}/{resource id}/policies/{policy type}+ // Format: {resource name}/policies/{policy type}+ // Workspace resource name: "".+ // Environment resource name: environments/environment-id.+ // Instance resource name: environments/environment-id/instances/instance-id.+ // Database resource name: environments/environment-id/instances/instance-id/databases/database-name.string name = 1;// The system-assigned, unique identifier for a resource.@@ -102,14 +108,97 @@ message Policy {PolicyType type = 5;- string payload = 6;+ oneof policy {+ DeploymentApprovalPolicy deployment_approval_policy = 6;+ BackupPlanPolicy backup_plan_policy = 7;+ SensitiveDataPolicy sensitive_data_policy = 8;+ AccessControlPolicy access_control_policy = 9;+ SQLReviewPolicy sql_review_policy = 10;+ }}enum PolicyType {POLICY_TYPE_UNSPECIFIED = 0;- PIPELINE_APPROVAL = 1;+ DEPLOYMENT_APPROVAL = 1;BACKUP_PLAN = 2;SQL_REVIEW = 3;SENSITIVE_DATA = 4;ACCESS_CONTROL = 5;}++message DeploymentApprovalPolicy {+ ApprovalStrategy default_strategy = 1;+ repeated DeploymentApprovalStrategy deployment_approval_strategies = 2;+}++message DeploymentApprovalStrategy {+ DeploymentType deployment_type = 1;+ ApprovalGroup approval_group = 2;+ ApprovalStrategy approval_strategy = 3;+}++enum ApprovalGroup {+ ASSIGNEE_GROUP_UNSPECIFIED = 0;+ APPROVAL_GROUP_DBA = 1;+ APPROVAL_GROUP_PROJECT_OWNER = 2;+}++enum ApprovalStrategy {+ APPROVAL_STRATEGY_UNSPECIFIED = 0;+ AUTOMATIC = 1;+ MANUAL = 2;+}++message BackupPlanPolicy {+ BackupPlanSchedule schedule = 1;+ google.protobuf.Duration retention_duration = 2;+}++enum BackupPlanSchedule {+ SCHEDULE_UNSPECIFIED = 0;+ UNSET = 1;+ DAILY = 2;+ WEEKLY = 3;+}++message SensitiveDataPolicy {+ repeated SensitiveData sensitive_data = 1;+}++message SensitiveData {+ string schema = 1;+ string table = 2;+ string column = 3;+ SensitiveDataMaskType mask_type = 4;+}++enum SensitiveDataMaskType {+ MASK_TYPE_UNSPECIFIED = 0;+ DEFAULT = 1;+}++message AccessControlPolicy {+ repeated AccessControlRule disallow_rules = 1;+}++message AccessControlRule {+ bool full_database = 1;+}++message SQLReviewPolicy {+ string title = 1;+ repeated SQLReviewRule rules = 2;+}++message SQLReviewRule {+ string type = 1;+ SQLReviewRuleLevel level = 2;+ string payload = 3;+}++enum SQLReviewRuleLevel {+ LEVEL_UNSPECIFIED = 0;+ ERROR = 1;+ WARNING = 2;+ DISABLED = 3;+}\ No newline at end of filediff --git a/server/api/v1/org_policy_service.go b/server/api/v1/org_policy_service.goindex bbf192104c..59c024d2eb 100644--- a/server/api/v1/org_policy_service.go+++ b/server/api/v1/org_policy_service.go@@ -7,11 +7,13 @@ import ("google.golang.org/grpc/codes""google.golang.org/grpc/status"+ "google.golang.org/protobuf/types/known/durationpb""github.com/pkg/errors""github.com/bytebase/bytebase/api"enterpriseAPI "github.com/bytebase/bytebase/enterprise/api"+ "github.com/bytebase/bytebase/plugin/advisor"v1pb "github.com/bytebase/bytebase/proto/generated-go/v1""github.com/bytebase/bytebase/store")@@ -64,7 +66,12 @@ func (s *OrgPolicyService) GetPolicy(ctx context.Context, request *v1pb.GetPolicreturn nil, status.Errorf(codes.NotFound, "policy %q not found", request.Name)}- return convertToPolicy(token, policy), nil+ response, err := convertToPolicy(token, policy)+ if err != nil {+ return nil, status.Errorf(codes.Internal, err.Error())+ }++ return response, nil}// ListPolicies lists policies in a specific resource.@@ -84,7 +91,15 @@ func (s *OrgPolicyService) ListPolicies(ctx context.Context, request *v1pb.ListPresponse := &v1pb.ListPoliciesResponse{}for _, policy := range policies {- response.Policies = append(response.Policies, convertToPolicy(request.Parent, policy))+ p, err := convertToPolicy(request.Parent, policy)+ if err != nil {+ return nil, status.Errorf(codes.Internal, err.Error())+ }+ if p.Type == v1pb.PolicyType_POLICY_TYPE_UNSPECIFIED {+ // skip unknown type policy and environment tier policy+ continue+ }+ response.Policies = append(response.Policies, p)}return response, nil}@@ -192,35 +207,222 @@ func (s *OrgPolicyService) getPolicyResourceTypeAndID(ctx context.Context, requereturn api.PolicyResourceTypeUnknown, 0, status.Errorf(codes.InvalidArgument, "unknown request name %s", requestName)}-func convertToPolicy(prefix string, policyMessage *store.PolicyMessage) *v1pb.Policy {+func convertToPolicy(prefix string, policyMessage *store.PolicyMessage) (*v1pb.Policy, error) {+ policy := &v1pb.Policy{+ Uid: fmt.Sprintf("%d", policyMessage.UID),+ State: convertDeletedToState(policyMessage.Deleted),+ InheritFromParent: policyMessage.InheritFromParent,+ }+pType := v1pb.PolicyType_POLICY_TYPE_UNSPECIFIEDswitch policyMessage.Type {case api.PolicyTypePipelineApproval:- pType = v1pb.PolicyType_PIPELINE_APPROVAL+ pType = v1pb.PolicyType_DEPLOYMENT_APPROVAL+ payload, err := convertPipelineApprovalPolicy(policyMessage.Payload)+ if err != nil {+ return nil, err+ }+ policy.Policy = payloadcase api.PolicyTypeBackupPlan:pType = v1pb.PolicyType_BACKUP_PLAN+ payload, err := convertBackupPlanPolicy(policyMessage.Payload)+ if err != nil {+ return nil, err+ }+ policy.Policy = payloadcase api.PolicyTypeSQLReview:pType = v1pb.PolicyType_SQL_REVIEW+ payload, err := convertSQLReviewPolicy(policyMessage.Payload)+ if err != nil {+ return nil, err+ }+ policy.Policy = payloadcase api.PolicyTypeSensitiveData:pType = v1pb.PolicyType_SENSITIVE_DATA+ payload, err := convertSensitiveDataPolicy(policyMessage.Payload)+ if err != nil {+ return nil, err+ }+ policy.Policy = payloadcase api.PolicyTypeAccessControl:pType = v1pb.PolicyType_ACCESS_CONTROL+ payload, err := convertAccessControlPolicy(policyMessage.Payload)+ if err != nil {+ return nil, err+ }+ policy.Policy = payload}- return &v1pb.Policy{- Name: fmt.Sprintf("%s/%s%s", prefix, policyNamePrefix, strings.ToLower(pType.String())),- Uid: fmt.Sprintf("%d", policyMessage.UID),- State: convertDeletedToState(policyMessage.Deleted),- InheritFromParent: policyMessage.InheritFromParent,- Type: pType,- Payload: policyMessage.Payload,+ policy.Type = pType+ policy.Name = fmt.Sprintf("%s/%s%s", prefix, policyNamePrefix, strings.ToLower(pType.String()))++ return policy, nil+}++func convertSQLReviewPolicy(payloadStr string) (*v1pb.Policy_SqlReviewPolicy, error) {+ payload, err := api.UnmarshalSQLReviewPolicy(payloadStr)+ if err != nil {+ return nil, err+ }++ var rules []*v1pb.SQLReviewRule+ for _, rule := range payload.RuleList {+ level := v1pb.SQLReviewRuleLevel_LEVEL_UNSPECIFIED+ switch rule.Level {+ case advisor.SchemaRuleLevelError:+ level = v1pb.SQLReviewRuleLevel_ERROR+ case advisor.SchemaRuleLevelWarning:+ level = v1pb.SQLReviewRuleLevel_WARNING+ case advisor.SchemaRuleLevelDisabled:+ level = v1pb.SQLReviewRuleLevel_DISABLED+ }+ rules = append(rules, &v1pb.SQLReviewRule{+ Level: level,+ Type: string(rule.Type),+ Payload: rule.Payload,+ })}++ return &v1pb.Policy_SqlReviewPolicy{+ SqlReviewPolicy: &v1pb.SQLReviewPolicy{+ Title: payload.Name,+ Rules: rules,+ },+ }, nil+}++func convertAccessControlPolicy(payloadStr string) (*v1pb.Policy_AccessControlPolicy, error) {+ payload, err := api.UnmarshalAccessControlPolicy(payloadStr)+ if err != nil {+ return nil, err+ }++ var disallowRules []*v1pb.AccessControlRule+ for _, rule := range payload.DisallowRuleList {+ disallowRules = append(disallowRules, &v1pb.AccessControlRule{+ FullDatabase: rule.FullDatabase,+ })+ }+ return &v1pb.Policy_AccessControlPolicy{+ AccessControlPolicy: &v1pb.AccessControlPolicy{+ DisallowRules: disallowRules,+ },+ }, nil+}++func convertSensitiveDataPolicy(payloadStr string) (*v1pb.Policy_SensitiveDataPolicy, error) {+ payload, err := api.UnmarshalSensitiveDataPolicy(payloadStr)+ if err != nil {+ return nil, err+ }++ var sensitiveDataList []*v1pb.SensitiveData+ for _, data := range payload.SensitiveDataList {+ maskType := v1pb.SensitiveDataMaskType_MASK_TYPE_UNSPECIFIED+ if data.Type == api.SensitiveDataMaskTypeDefault {+ maskType = v1pb.SensitiveDataMaskType_DEFAULT+ }+ sensitiveDataList = append(sensitiveDataList, &v1pb.SensitiveData{+ Table: data.Table,+ Column: data.Column,+ MaskType: maskType,+ })+ }++ return &v1pb.Policy_SensitiveDataPolicy{+ SensitiveDataPolicy: &v1pb.SensitiveDataPolicy{+ SensitiveData: sensitiveDataList,+ },+ }, nil+}++func convertBackupPlanPolicy(payloadStr string) (*v1pb.Policy_BackupPlanPolicy, error) {+ payload, err := api.UnmarshalBackupPlanPolicy(payloadStr)+ if err != nil {+ return nil, err+ }++ schedule := v1pb.BackupPlanSchedule_SCHEDULE_UNSPECIFIED+ switch payload.Schedule {+ case api.BackupPlanPolicyScheduleUnset:+ schedule = v1pb.BackupPlanSchedule_UNSET+ case api.BackupPlanPolicyScheduleDaily:+ schedule = v1pb.BackupPlanSchedule_DAILY+ case api.BackupPlanPolicyScheduleWeekly:+ schedule = v1pb.BackupPlanSchedule_WEEKLY+ }++ return &v1pb.Policy_BackupPlanPolicy{+ BackupPlanPolicy: &v1pb.BackupPlanPolicy{+ Schedule: schedule,+ RetentionDuration: &durationpb.Duration{Seconds: int64(payload.RetentionPeriodTs)},+ },+ }, nil+}++func convertPipelineApprovalPolicy(payloadStr string) (*v1pb.Policy_DeploymentApprovalPolicy, error) {+ payload, err := api.UnmarshalPipelineApprovalPolicy(payloadStr)+ if err != nil {+ return nil, err+ }++ approvalStrategy := v1pb.ApprovalStrategy_APPROVAL_STRATEGY_UNSPECIFIED+ switch payload.Value {+ case api.PipelineApprovalValueManualAlways:+ approvalStrategy = v1pb.ApprovalStrategy_MANUAL+ case api.PipelineApprovalValueManualNever:+ approvalStrategy = v1pb.ApprovalStrategy_AUTOMATIC+ }++ approvalStrategies := make([]*v1pb.DeploymentApprovalStrategy, 0)+ for _, group := range payload.AssigneeGroupList {+ assigneeGroupValue := v1pb.ApprovalGroup_ASSIGNEE_GROUP_UNSPECIFIED+ switch group.Value {+ case api.AssigneeGroupValueProjectOwner:+ assigneeGroupValue = v1pb.ApprovalGroup_APPROVAL_GROUP_PROJECT_OWNER+ case api.AssigneeGroupValueWorkspaceOwnerOrDBA:+ assigneeGroupValue = v1pb.ApprovalGroup_APPROVAL_GROUP_DBA+ }++ approvalStrategies = append(approvalStrategies, &v1pb.DeploymentApprovalStrategy{+ ApprovalGroup: assigneeGroupValue,+ DeploymentType: convertIssueTypeToDeplymentType(group.IssueType),+ ApprovalStrategy: approvalStrategy,+ })+ }++ return &v1pb.Policy_DeploymentApprovalPolicy{+ DeploymentApprovalPolicy: &v1pb.DeploymentApprovalPolicy{+ DefaultStrategy: approvalStrategy,+ DeploymentApprovalStrategies: approvalStrategies,+ },+ }, nil+}++func convertIssueTypeToDeplymentType(issueType api.IssueType) v1pb.DeploymentType {+ res := v1pb.DeploymentType_DEPLOYMENT_TYPE_UNSPECIFIED+ switch issueType {+ case api.IssueDatabaseCreate:+ res = v1pb.DeploymentType_DATABASE_CREATE+ case api.IssueDatabaseSchemaUpdate:+ res = v1pb.DeploymentType_DATABASE_DDL+ case api.IssueDatabaseSchemaUpdateGhost:+ res = v1pb.DeploymentType_DATABASE_DDL_GHOST+ case api.IssueDatabaseDataUpdate:+ res = v1pb.DeploymentType_DATABASE_DML+ case api.IssueDatabaseRestorePITR:+ res = v1pb.DeploymentType_DATABASE_RESTORE_PITR+ case api.IssueDatabaseRollback:+ res = v1pb.DeploymentType_DATABASE_DML_ROLLBACK+ }++ return res}func convertPolicyType(pType string) (api.PolicyType, error) {var policyType api.PolicyTypeswitch strings.ToUpper(pType) {- case v1pb.PolicyType_PIPELINE_APPROVAL.String():+ case v1pb.PolicyType_DEPLOYMENT_APPROVAL.String():return api.PolicyTypePipelineApproval, nilcase v1pb.PolicyType_BACKUP_PLAN.String():return api.PolicyTypeBackupPlan, nil