Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
feat(api): implement the anomaly service (#4931)
h3n4l72cb0992df21
diff --git a/backend/api/v1/anomaly_service.go b/backend/api/v1/anomaly_service.gonew file mode 100644index 0000000000..239e854db8--- /dev/null+++ b/backend/api/v1/anomaly_service.go@@ -0,0 +1,240 @@+package v1++import (+ "context"+ "encoding/json"+ "fmt"+ "time"++ "google.golang.org/grpc/codes"+ "google.golang.org/grpc/status"+ "google.golang.org/protobuf/types/known/timestamppb"++ "github.com/pkg/errors"++ api "github.com/bytebase/bytebase/backend/legacyapi"+ "github.com/bytebase/bytebase/backend/store"+ v1pb "github.com/bytebase/bytebase/proto/generated-go/v1"+)++const (+ typeFilterKey = "type"+ resourceFilterKey = "resource"+)++var (+ typesMap = map[string]api.AnomalyType{+ "INSTANCE_CONNECTION": api.AnomalyInstanceConnection,+ "MIGRATION_SCHEMA": api.AnomalyInstanceMigrationSchema,+ "DATABASE_BACKUP_POLICY_VIOLATION": api.AnomalyDatabaseBackupPolicyViolation,+ "DATABASE_BACKUP_MISSING": api.AnomalyDatabaseBackupMissing,+ "DATABASE_CONNECTION": api.AnomalyDatabaseConnection,+ "DATABASE_SCHEMA_DRIFT": api.AnomalyDatabaseSchemaDrift,+ }+)++// AnomalyService implements the anomaly service.+type AnomalyService struct {+ v1pb.UnimplementedAnomalyServiceServer+ store *store.Store+}++// NewAnomalyService creates a new anomaly service.+func NewAnomalyService(store *store.Store) *AnomalyService {+ return &AnomalyService{store: store}+}++// SearchAnomalies implements the SearchAnomalies RPC.+func (s *AnomalyService) SearchAnomalies(ctx context.Context, request *v1pb.SearchAnomaliesRequest) (*v1pb.+ SearchAnomaliesResponse, error) {+ var find store.ListAnomalyMessage+ var environmentID, instanceID, databaseName string+ if request.Filter != "" {+ // We only support filter by type and resource now.+ types, err := getEBNFTokens(request.Filter, typeFilterKey)+ if err != nil {+ return nil, status.Errorf(codes.InvalidArgument, err.Error())+ }+ for _, tp := range types {+ if v, ok := typesMap[tp]; ok {+ find.Types = append(find.Types, &v)+ } else {+ return nil, status.Errorf(codes.InvalidArgument, "Invalid type filter %q", tp)+ }+ }+ resources, err := getEBNFTokens(request.Filter, resourceFilterKey)+ if err != nil {+ return nil, status.Errorf(codes.InvalidArgument, err.Error())+ }+ if len(resources) > 1 {+ return nil, status.Errorf(codes.InvalidArgument, "Only one resource can be specified")+ }++ // For resources filter, we only support filter by instance and database.+ envID, insID, err := getEnvironmentInstanceID(resources[0])+ if err != nil {+ // Try to treat as database resource.+ envID, insID, dbName, err := getEnvironmentInstanceDatabaseID(resources[0])+ if err != nil {+ return nil, status.Errorf(codes.InvalidArgument, "Only support filter by instance and database in resource filter")+ }+ environmentID, instanceID, databaseName = envID, insID, dbName+ } else {+ // Treat as instance resource.+ environmentID, instanceID = envID, insID+ }+ if environmentID != "" {+ env, err := s.store.GetEnvironmentV2(ctx, &store.FindEnvironmentMessage{+ ResourceID: &environmentID,+ })+ if err != nil {+ return nil, status.Errorf(codes.Internal, err.Error())+ }+ if env == nil {+ return nil, status.Errorf(codes.NotFound, "Environment %q not found", environmentID)+ }+ }+ if environmentID != "" && instanceID != "" {+ instance, err := s.store.GetInstanceV2(ctx, &store.FindInstanceMessage{+ EnvironmentID: &environmentID,+ ResourceID: &instanceID,+ })+ if err != nil {+ return nil, status.Errorf(codes.Internal, err.Error())+ }+ if instance == nil {+ return nil, status.Errorf(codes.NotFound, "Instance %q not found", instanceID)+ }+ find.InstanceUID = &instance.UID+ }+ if environmentID != "" && instanceID != "" && databaseName != "" {+ database, err := s.store.GetDatabaseV2(ctx, &store.FindDatabaseMessage{+ EnvironmentID: &environmentID,+ InstanceID: &instanceID,+ DatabaseName: &databaseName,+ })+ if err != nil {+ return nil, status.Errorf(codes.Internal, err.Error())+ }+ if database == nil {+ return nil, status.Errorf(codes.NotFound, "Database %q not found in environment %q instance %q", databaseName, environmentID, instanceID)+ }+ find.DatabaseUID = &database.UID+ }+ }++ anomalies, err := s.store.ListAnomalyV2(ctx, &find)+ if err != nil {+ return nil, status.Errorf(codes.Internal, err.Error())+ }++ var response v1pb.SearchAnomaliesResponse+ for _, anomaly := range anomalies {+ pbAnomaly, err := convertToAnomaly(anomaly, environmentID, instanceID, databaseName)+ if err != nil {+ return nil, status.Errorf(codes.Internal, err.Error())+ }+ response.Anomalies = append(response.Anomalies, pbAnomaly)+ }+ return &response, nil+}++func convertToAnomaly(anomaly *store.AnomalyMessage, environmentID, instanceID, databaseName string) (*v1pb.Anomaly, error) {+ var pbAnomaly v1pb.Anomaly+ if environmentID != "" && instanceID != "" && databaseName != "" {+ pbAnomaly.Resource = fmt.Sprintf("%s%s/%s%s/%s%s", environmentNamePrefix, environmentID, instanceNamePrefix, instanceID, databaseIDPrefix, databaseName)+ } else if environmentID != "" && instanceID != "" {+ pbAnomaly.Resource = fmt.Sprintf("%s%s/%s%s", environmentNamePrefix, environmentID, instanceNamePrefix, instanceID)+ }++ switch anomaly.Type {+ case api.AnomalyInstanceConnection:+ var detail api.AnomalyInstanceConnectionPayload+ if err := json.Unmarshal([]byte(anomaly.Payload), &detail); err != nil {+ return nil, errors.Wrapf(err, "failed to unmarshal instance connection anomaly payload")+ }+ pbAnomaly.Type = v1pb.Anomaly_INSTANCE_CONNECTION+ pbAnomaly.Detail = &v1pb.Anomaly_InstanceConnectionDetail_{+ InstanceConnectionDetail: &v1pb.Anomaly_InstanceConnectionDetail{+ Detail: detail.Detail,+ },+ }+ case api.AnomalyDatabaseBackupPolicyViolation:+ var detail api.AnomalyDatabaseBackupPolicyViolationPayload+ if err := json.Unmarshal([]byte(anomaly.Payload), &detail); err != nil {+ return nil, errors.Wrapf(err, "failed to unmarshal database backup policy violation anomaly payload")+ }+ pbAnomaly.Type = v1pb.Anomaly_DATABASE_BACKUP_POLICY_VIOLATION+ pbAnomaly.Detail = &v1pb.Anomaly_DatabaseBackupPolicyViolationDetail_{+ DatabaseBackupPolicyViolationDetail: &v1pb.Anomaly_DatabaseBackupPolicyViolationDetail{+ // The instance are bind to a specify environment, and cannot be moved to another environment in Bytebase.+ // So it's safe to use environmentID here.+ Parent: fmt.Sprintf("%s%s/%s%s", environmentNamePrefix, environmentID, instanceNamePrefix, instanceID),+ ExpectedSchedule: convertBackupPlanSchedule(detail.ExpectedBackupSchedule),+ ActualSchedule: convertBackupPlanSchedule(detail.ActualBackupSchedule),+ },+ }+ case api.AnomalyDatabaseBackupMissing:+ var detail api.AnomalyDatabaseBackupMissingPayload+ if err := json.Unmarshal([]byte(anomaly.Payload), &detail); err != nil {+ return nil, errors.Wrapf(err, "failed to unmarshal database backup missing anomaly payload")+ }+ pbAnomaly.Type = v1pb.Anomaly_DATABASE_BACKUP_MISSING+ pbAnomaly.Detail = &v1pb.Anomaly_DatabaseBackupMissingDetail_{+ DatabaseBackupMissingDetail: &v1pb.Anomaly_DatabaseBackupMissingDetail{+ ExpectedSchedule: convertBackupPlanSchedule(detail.ExpectedBackupSchedule),+ LatestBackupTime: timestamppb.New(time.Unix(detail.LastBackupTs, 0)),+ },+ }+ case api.AnomalyDatabaseConnection:+ var detail api.AnomalyDatabaseConnectionPayload+ if err := json.Unmarshal([]byte(anomaly.Payload), &detail); err != nil {+ return nil, errors.Wrapf(err, "failed to unmarshal database connection anomaly payload")+ }+ pbAnomaly.Type = v1pb.Anomaly_DATABASE_CONNECTION+ pbAnomaly.Detail = &v1pb.Anomaly_DatabaseConnectionDetail_{+ DatabaseConnectionDetail: &v1pb.Anomaly_DatabaseConnectionDetail{+ Detail: detail.Detail,+ },+ }+ case api.AnomalyDatabaseSchemaDrift:+ var detail api.AnomalyDatabaseSchemaDriftPayload+ if err := json.Unmarshal([]byte(anomaly.Payload), &detail); err != nil {+ return nil, errors.Wrapf(err, "failed to unmarshal database schema drift anomaly payload")+ }+ pbAnomaly.Type = v1pb.Anomaly_DATABASE_SCHEMA_DRIFT+ pbAnomaly.Detail = &v1pb.Anomaly_DatabaseSchemaDriftDetail_{+ DatabaseSchemaDriftDetail: &v1pb.Anomaly_DatabaseSchemaDriftDetail{+ RecordVersion: detail.Version,+ ExpectedSchema: detail.Expect,+ ActualSchema: detail.Actual,+ },+ }+ }+ pbAnomaly.Severity = getSeverityFromAnomalyType(pbAnomaly.Type)+ return &pbAnomaly, nil+}++func getSeverityFromAnomalyType(tp v1pb.Anomaly_AnomalyType) v1pb.Anomaly_AnomalySeverity {+ switch tp {+ case v1pb.Anomaly_DATABASE_BACKUP_POLICY_VIOLATION:+ return v1pb.Anomaly_MEDIUM+ case v1pb.Anomaly_DATABASE_BACKUP_MISSING:+ return v1pb.Anomaly_HIGH+ case v1pb.Anomaly_INSTANCE_CONNECTION, v1pb.Anomaly_MIGRATION_SCHEMA, v1pb.Anomaly_DATABASE_CONNECTION, v1pb.Anomaly_DATABASE_SCHEMA_DRIFT:+ return v1pb.Anomaly_CRITICAL+ }+ return v1pb.Anomaly_ANOMALY_SEVERITY_UNSPECIFIED+}++func convertBackupPlanSchedule(s api.BackupPlanPolicySchedule) v1pb.Anomaly_BackupPlanSchedule {+ switch s {+ case api.BackupPlanPolicyScheduleUnset:+ return v1pb.Anomaly_UNSET+ case api.BackupPlanPolicyScheduleDaily:+ return v1pb.Anomaly_DAILY+ case api.BackupPlanPolicyScheduleWeekly:+ return v1pb.Anomaly_WEEKLY+ }+ return v1pb.Anomaly_BACKUP_PLAN_SCHEDULE_UNSPECIFIED+}diff --git a/backend/api/v1/common.go b/backend/api/v1/common.goindex 1af3981085..3313fc827e 100644--- a/backend/api/v1/common.go+++ b/backend/api/v1/common.go@@ -211,6 +211,47 @@ func getFilter(filter, filterKey string) (string, error) {return "", retErr}+// getEBNFTokens will parse the simple filter such as `project = "abc" | "def".` to {project: ["abc", "def"]} .+func getEBNFTokens(filter, filterKey string) ([]string, error) {+ grammar, err := ebnf.Parse("", strings.NewReader(filter))+ if err != nil {+ return nil, errors.Wrapf(err, "invalid filter %q", filter)+ }+ productions, ok := grammar[filterKey]+ if !ok {+ return nil, nil+ }+ switch expr := productions.Expr.(type) {+ case *ebnf.Token:+ // filterKey = "abc".+ return []string{expr.String}, nil+ case ebnf.Alternative:+ // filterKey = "abc" | "def".+ var tokens []string+ for _, expr := range expr {+ token, ok := expr.(*ebnf.Token)+ if !ok {+ return nil, errors.Errorf("invalid filter %q", filter)+ }+ tokens = append(tokens, token.String)+ }+ return tokens, nil+ case *ebnf.Alternative:+ // filterKey = "abc" | "def".+ var tokens []string+ for _, expr := range *expr {+ token, ok := expr.(*ebnf.Token)+ if !ok {+ return nil, errors.Errorf("invalid filter %q", filter)+ }+ tokens = append(tokens, token.String)+ }+ return tokens, nil+ default:+ return nil, errors.Errorf("invalid filter %q", filter)+ }+}+func convertToEngine(engine db.Type) v1pb.Engine {switch engine {case db.ClickHouse:diff --git a/backend/api/v1/common_test.go b/backend/api/v1/common_test.goindex 4d5511b59e..72c1370b07 100644--- a/backend/api/v1/common_test.go+++ b/backend/api/v1/common_test.go@@ -104,3 +104,57 @@ func TestGetEnvironmentInstanceDatabaseID(t *testing.T) {_, _, err = getEnvironmentInstanceID("environments/e1/instances/i2/databases/d3")require.Error(t, err)}++func TestGetEBNFTokens(t *testing.T) {+ testCases := []struct {+ input string+ key string+ want []string+ wantErr bool+ }{+ {+ input: `resource="environments/e1/instances/i2".`,+ key: "resource",+ want: []string{+ "environments/e1/instances/i2",+ },+ wantErr: false,+ },+ {+ input: `resource="environments/e1/instances/i2/databases/db3".`,+ key: "resource",+ want: []string{+ "environments/e1/instances/i2/databases/db3",+ },+ wantErr: false,+ },+ {+ input: `type="DATABASE_BACKUP_MISSING" | "DATABASE_BACKUP_FAILED".`,+ key: "type",+ want: []string{+ "DATABASE_BACKUP_MISSING",+ "DATABASE_BACKUP_FAILED",+ },+ wantErr: false,+ },+ {+ input: `a="1" | "2". b="3" | "4".`,+ key: "b",+ want: []string{+ "3",+ "4",+ },+ wantErr: false,+ },+ }++ for _, tc := range testCases {+ got, err := getEBNFTokens(tc.input, tc.key)+ if tc.wantErr {+ require.Error(t, err)+ } else {+ require.NoError(t, err)+ require.Equal(t, tc.want, got)+ }+ }+}diff --git a/backend/server/server.go b/backend/server/server.goindex b9e65da589..fa7dd54e6a 100644--- a/backend/server/server.go+++ b/backend/server/server.go@@ -479,6 +479,7 @@ func NewServer(ctx context.Context, profile config.Profile) (*Server, error) {v1pb.RegisterOrgPolicyServiceServer(s.grpcServer, v1.NewOrgPolicyService(s.store, s.licenseService))v1pb.RegisterIdentityProviderServiceServer(s.grpcServer, v1.NewIdentityProviderService(s.store, s.licenseService, &profile))v1pb.RegisterSettingServiceServer(s.grpcServer, v1.NewSettingService(s.store))+ v1pb.RegisterAnomalyServiceServer(s.grpcServer, v1.NewAnomalyService(s.store))reflection.Register(s.grpcServer)// REST gateway proxy.@@ -515,6 +516,9 @@ func NewServer(ctx context.Context, profile config.Profile) (*Server, error) {if err := v1pb.RegisterSettingServiceHandler(ctx, mux, grpcConn); err != nil {return nil, err}+ if err := v1pb.RegisterAnomalyServiceHandler(ctx, mux, grpcConn); err != nil {+ return nil, err+ }e.Any("/v1/*", echo.WrapHandler(mux))// GRPC web proxy.options := []grpcweb.Option{diff --git a/backend/store/anomaly.go b/backend/store/anomaly.goindex 23ec7f9a72..0f10905a7a 100644--- a/backend/store/anomaly.go+++ b/backend/store/anomaly.go@@ -440,3 +440,96 @@ func archiveAnomalyImpl(ctx context.Context, tx *Tx, archive *api.AnomalyArchivereturn nil}++// AnomalyMessage is the message of the anomaly.+type AnomalyMessage struct {+ // InstanceUID is the unique identifier of the instance.+ InstanceUID int+ // DatabaseUID is the unique identifier of the database, it will be nil if the anomaly is instance level.+ DatabaseUID *int+ // Type is the type of the anomaly.+ Type api.AnomalyType+ // Payload is the payload of the anomaly.+ Payload string+}++// ListAnomalyMessage is the message to list anomalies.+type ListAnomalyMessage struct {+ InstanceUID *int+ DatabaseUID *int+ Types []*api.AnomalyType+}++// ListAnomalyV2 lists anomalies, only return the normal ones.+func (s *Store) ListAnomalyV2(ctx context.Context, list *ListAnomalyMessage) ([]*AnomalyMessage, error) {+ // Build where clause+ where, args := []string{"row_status = $1"}, []interface{}{api.Normal}+ if v := list.InstanceUID; v != nil {+ where, args = append(where, fmt.Sprintf("instance_id = $%d", len(args)+1)), append(args, *v)+ }+ if v := list.DatabaseUID; v != nil {+ where, args = append(where, fmt.Sprintf("database_id = $%d", len(args)+1)), append(args, *v)+ }+ if len(list.Types) > 0 {+ var sub []string+ for _, v := range list.Types {+ sub, args = append(sub, fmt.Sprintf("$%d", len(args)+1)), append(args, *v)+ }+ where = append(where, fmt.Sprintf("type IN (%s)", strings.Join(sub, `,`)))+ }++ query := fmt.Sprintf(`+ SELECT+ instance_id,+ database_id,+ type,+ payload+ FROM anomaly WHERE (%s+ AND EXISTS (+ SELECT 1+ FROM instance+ WHERE instance.id = anomaly.instance_id AND instance.row_status != 'ARCHIVED'+ ))+ `, strings.Join(where, " AND "))++ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})+ if err != nil {+ return nil, errors.Wrapf(err, "failed to begin transaction")+ }+ defer tx.Rollback()++ rows, err := tx.QueryContext(ctx, query, args...)+ if err != nil {+ return nil, FormatError(err)+ }+ defer rows.Close()++ var anomalies []*AnomalyMessage+ for rows.Next() {+ var anomaly AnomalyMessage+ // DatabaseID field can be NULL in the PostgreSQL database, so we use sql.NullInt32 to represent it.+ var databaseID sql.NullInt32+ if err := rows.Scan(+ &anomaly.InstanceUID,+ &databaseID,+ &anomaly.Type,+ &anomaly.Payload,+ ); err != nil {+ return nil, FormatError(err)+ }+ if databaseID.Valid {+ value := int(databaseID.Int32)+ anomaly.DatabaseUID = &value+ }+ anomalies = append(anomalies, &anomaly)+ }+ if err := rows.Err(); err != nil {+ return nil, FormatError(err)+ }++ if err := tx.Commit(); err != nil {+ return nil, errors.Wrapf(err, "failed to commit transaction")+ }++ return anomalies, nil+}diff --git a/frontend/src/types/proto/v1/anomaly_service.ts b/frontend/src/types/proto/v1/anomaly_service.tsindex 93318c0ea5..5483fe78bf 100644--- a/frontend/src/types/proto/v1/anomaly_service.ts+++ b/frontend/src/types/proto/v1/anomaly_service.ts@@ -8,10 +8,11 @@ export const protobufPackage = "bytebase.v1";export interface SearchAnomaliesRequest {/*** filter is the filter to apply on the search anomaly request,- * follow the [google cel-spec](https://github.com/google/cel-spec) syntax.+ * follow the [ebnf](https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form) syntax.+ * Only support filter by resource and type for now.* For example:- * Search the anomalies of a specific resource: 'anomaly.resource_name="environments/{environemnt}/instances/{instance}"'- * Search the specified type of anomalies: 'anomaly.type="DATABASE_BACKUP_POLICY_VIOLATION"'+ * Search the anomalies of a specific resource: 'resource="environments/{environemnt}/instances/{instance}".'+ * Search the specified types of anomalies: 'type="DATABASE_BACKUP_POLICY_VIOLATION" | "MIGRATION_SCHEMA".'*/filter: string;/**@@ -51,8 +52,8 @@ export interface Anomaly {resource: string;/** type is the type of the anomaly. */type: Anomaly_AnomalyType;- /** serverity is the serverity of the anomaly. */- serverity: Anomaly_AnomalyServerity;+ /** severity is the severity of the anomaly. */+ severity: Anomaly_AnomalySeverity;instanceConnectionDetail?: Anomaly_InstanceConnectionDetail | undefined;databaseConnectionDetail?: Anomaly_DatabaseConnectionDetail | undefined;databaseBackupPolicyViolationDetail?: Anomaly_DatabaseBackupPolicyViolationDetail | undefined;@@ -143,51 +144,51 @@ export function anomaly_AnomalyTypeToJSON(object: Anomaly_AnomalyType): string {}}-/** AnomalyServerity is the severity of the anomaly. */-export enum Anomaly_AnomalyServerity {- /** ANOMALY_SERVERITY_UNSPECIFIED - Unspecified anomaly serverity. */- ANOMALY_SERVERITY_UNSPECIFIED = 0,- /** MEDIUM - MEDIUM is the info level anomaly serverity. */+/** AnomalySeverity is the severity of the anomaly. */+export enum Anomaly_AnomalySeverity {+ /** ANOMALY_SEVERITY_UNSPECIFIED - Unspecified anomaly severity. */+ ANOMALY_SEVERITY_UNSPECIFIED = 0,+ /** MEDIUM - MEDIUM is the info level anomaly severity. */MEDIUM = 1,- /** HIGH - HIGH is the warning level anomaly serverity. */+ /** HIGH - HIGH is the warning level anomaly severity. */HIGH = 2,- /** CRITICAL - CRITICAL is the critical level anomaly serverity. */+ /** CRITICAL - CRITICAL is the critical level anomaly severity. */CRITICAL = 3,UNRECOGNIZED = -1,}-export function anomaly_AnomalyServerityFromJSON(object: any): Anomaly_AnomalyServerity {+export function anomaly_AnomalySeverityFromJSON(object: any): Anomaly_AnomalySeverity {switch (object) {case 0:- case "ANOMALY_SERVERITY_UNSPECIFIED":- return Anomaly_AnomalyServerity.ANOMALY_SERVERITY_UNSPECIFIED;+ case "ANOMALY_SEVERITY_UNSPECIFIED":+ return Anomaly_AnomalySeverity.ANOMALY_SEVERITY_UNSPECIFIED;case 1:case "MEDIUM":- return Anomaly_AnomalyServerity.MEDIUM;+ return Anomaly_AnomalySeverity.MEDIUM;case 2:case "HIGH":- return Anomaly_AnomalyServerity.HIGH;+ return Anomaly_AnomalySeverity.HIGH;case 3:case "CRITICAL":- return Anomaly_AnomalyServerity.CRITICAL;+ return Anomaly_AnomalySeverity.CRITICAL;case -1:case "UNRECOGNIZED":default:- return Anomaly_AnomalyServerity.UNRECOGNIZED;+ return Anomaly_AnomalySeverity.UNRECOGNIZED;}}-export function anomaly_AnomalyServerityToJSON(object: Anomaly_AnomalyServerity): string {+export function anomaly_AnomalySeverityToJSON(object: Anomaly_AnomalySeverity): string {switch (object) {- case Anomaly_AnomalyServerity.ANOMALY_SERVERITY_UNSPECIFIED:- return "ANOMALY_SERVERITY_UNSPECIFIED";- case Anomaly_AnomalyServerity.MEDIUM:+ case Anomaly_AnomalySeverity.ANOMALY_SEVERITY_UNSPECIFIED:+ return "ANOMALY_SEVERITY_UNSPECIFIED";+ case Anomaly_AnomalySeverity.MEDIUM:return "MEDIUM";- case Anomaly_AnomalyServerity.HIGH:+ case Anomaly_AnomalySeverity.HIGH:return "HIGH";- case Anomaly_AnomalyServerity.CRITICAL:+ case Anomaly_AnomalySeverity.CRITICAL:return "CRITICAL";- case Anomaly_AnomalyServerity.UNRECOGNIZED:+ case Anomaly_AnomalySeverity.UNRECOGNIZED:default:return "UNRECOGNIZED";}@@ -280,8 +281,8 @@ export interface Anomaly_DatabaseBackupPolicyViolationDetail {export interface Anomaly_DatabaseBackupMissingDetail {/** expected_schedule is the expected backup plan schedule in the database. */expectedSchedule: Anomaly_BackupPlanSchedule;- /** lastest_backup_time is the last backup time in the database. */- lastestBackupTime?: Date;+ /** latest_backup_time is the latest backup time in the database. */+ latestBackupTime?: Date;}/** DatabaseSchemaDriftDetail is the detail for database schema drift anomaly. */@@ -427,7 +428,7 @@ function createBaseAnomaly(): Anomaly {return {resource: "",type: 0,- serverity: 0,+ severity: 0,instanceConnectionDetail: undefined,databaseConnectionDetail: undefined,databaseBackupPolicyViolationDetail: undefined,@@ -444,8 +445,8 @@ export const Anomaly = {if (message.type !== 0) {writer.uint32(16).int32(message.type);}- if (message.serverity !== 0) {- writer.uint32(24).int32(message.serverity);+ if (message.severity !== 0) {+ writer.uint32(24).int32(message.severity);}if (message.instanceConnectionDetail !== undefined) {Anomaly_InstanceConnectionDetail.encode(message.instanceConnectionDetail, writer.uint32(34).fork()).ldelim();@@ -483,7 +484,7 @@ export const Anomaly = {message.type = reader.int32() as any;break;case 3:- message.serverity = reader.int32() as any;+ message.severity = reader.int32() as any;break;case 4:message.instanceConnectionDetail = Anomaly_InstanceConnectionDetail.decode(reader, reader.uint32());@@ -515,7 +516,7 @@ export const Anomaly = {return {resource: isSet(object.resource) ? String(object.resource) : "",type: isSet(object.type) ? anomaly_AnomalyTypeFromJSON(object.type) : 0,- serverity: isSet(object.serverity) ? anomaly_AnomalyServerityFromJSON(object.serverity) : 0,+ severity: isSet(object.severity) ? anomaly_AnomalySeverityFromJSON(object.severity) : 0,instanceConnectionDetail: isSet(object.instanceConnectionDetail)? Anomaly_InstanceConnectionDetail.fromJSON(object.instanceConnectionDetail): undefined,@@ -538,7 +539,7 @@ export const Anomaly = {const obj: any = {};message.resource !== undefined && (obj.resource = message.resource);message.type !== undefined && (obj.type = anomaly_AnomalyTypeToJSON(message.type));- message.serverity !== undefined && (obj.serverity = anomaly_AnomalyServerityToJSON(message.serverity));+ message.severity !== undefined && (obj.severity = anomaly_AnomalySeverityToJSON(message.severity));message.instanceConnectionDetail !== undefined && (obj.instanceConnectionDetail = message.instanceConnectionDetail? Anomaly_InstanceConnectionDetail.toJSON(message.instanceConnectionDetail): undefined);@@ -564,7 +565,7 @@ export const Anomaly = {const message = createBaseAnomaly();message.resource = object.resource ?? "";message.type = object.type ?? 0;- message.serverity = object.serverity ?? 0;+ message.severity = object.severity ?? 0;message.instanceConnectionDetail =(object.instanceConnectionDetail !== undefined && object.instanceConnectionDetail !== null)? Anomaly_InstanceConnectionDetail.fromPartial(object.instanceConnectionDetail)@@ -757,7 +758,7 @@ export const Anomaly_DatabaseBackupPolicyViolationDetail = {};function createBaseAnomaly_DatabaseBackupMissingDetail(): Anomaly_DatabaseBackupMissingDetail {- return { expectedSchedule: 0, lastestBackupTime: undefined };+ return { expectedSchedule: 0, latestBackupTime: undefined };}export const Anomaly_DatabaseBackupMissingDetail = {@@ -765,8 +766,8 @@ export const Anomaly_DatabaseBackupMissingDetail = {if (message.expectedSchedule !== 0) {writer.uint32(8).int32(message.expectedSchedule);}- if (message.lastestBackupTime !== undefined) {- Timestamp.encode(toTimestamp(message.lastestBackupTime), writer.uint32(18).fork()).ldelim();+ if (message.latestBackupTime !== undefined) {+ Timestamp.encode(toTimestamp(message.latestBackupTime), writer.uint32(18).fork()).ldelim();}return writer;},@@ -782,7 +783,7 @@ export const Anomaly_DatabaseBackupMissingDetail = {message.expectedSchedule = reader.int32() as any;break;case 2:- message.lastestBackupTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));+ message.latestBackupTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));break;default:reader.skipType(tag & 7);@@ -797,7 +798,7 @@ export const Anomaly_DatabaseBackupMissingDetail = {expectedSchedule: isSet(object.expectedSchedule)? anomaly_BackupPlanScheduleFromJSON(object.expectedSchedule): 0,- lastestBackupTime: isSet(object.lastestBackupTime) ? fromJsonTimestamp(object.lastestBackupTime) : undefined,+ latestBackupTime: isSet(object.latestBackupTime) ? fromJsonTimestamp(object.latestBackupTime) : undefined,};},@@ -805,14 +806,14 @@ export const Anomaly_DatabaseBackupMissingDetail = {const obj: any = {};message.expectedSchedule !== undefined &&(obj.expectedSchedule = anomaly_BackupPlanScheduleToJSON(message.expectedSchedule));- message.lastestBackupTime !== undefined && (obj.lastestBackupTime = message.lastestBackupTime.toISOString());+ message.latestBackupTime !== undefined && (obj.latestBackupTime = message.latestBackupTime.toISOString());return obj;},fromPartial(object: DeepPartial<Anomaly_DatabaseBackupMissingDetail>): Anomaly_DatabaseBackupMissingDetail {const message = createBaseAnomaly_DatabaseBackupMissingDetail();message.expectedSchedule = object.expectedSchedule ?? 0;- message.lastestBackupTime = object.lastestBackupTime ?? undefined;+ message.latestBackupTime = object.latestBackupTime ?? undefined;return message;},};diff --git a/proto/generated-go/v1/anomaly_service.pb.go b/proto/generated-go/v1/anomaly_service.pb.goindex 1d9feb988b..eedf5f849a 100644--- a/proto/generated-go/v1/anomaly_service.pb.go+++ b/proto/generated-go/v1/anomaly_service.pb.go@@ -98,60 +98,60 @@ func (Anomaly_AnomalyType) EnumDescriptor() ([]byte, []int) {return file_v1_anomaly_service_proto_rawDescGZIP(), []int{2, 0}}-// AnomalyServerity is the severity of the anomaly.-type Anomaly_AnomalyServerity int32+// AnomalySeverity is the severity of the anomaly.+type Anomaly_AnomalySeverity int32const (- // Unspecified anomaly serverity.- Anomaly_ANOMALY_SERVERITY_UNSPECIFIED Anomaly_AnomalyServerity = 0- // MEDIUM is the info level anomaly serverity.- Anomaly_MEDIUM Anomaly_AnomalyServerity = 1- // HIGH is the warning level anomaly serverity.- Anomaly_HIGH Anomaly_AnomalyServerity = 2- // CRITICAL is the critical level anomaly serverity.- Anomaly_CRITICAL Anomaly_AnomalyServerity = 3+ // Unspecified anomaly severity.+ Anomaly_ANOMALY_SEVERITY_UNSPECIFIED Anomaly_AnomalySeverity = 0+ // MEDIUM is the info level anomaly severity.+ Anomaly_MEDIUM Anomaly_AnomalySeverity = 1+ // HIGH is the warning level anomaly severity.+ Anomaly_HIGH Anomaly_AnomalySeverity = 2+ // CRITICAL is the critical level anomaly severity.+ Anomaly_CRITICAL Anomaly_AnomalySeverity = 3)-// Enum value maps for Anomaly_AnomalyServerity.+// Enum value maps for Anomaly_AnomalySeverity.var (- Anomaly_AnomalyServerity_name = map[int32]string{- 0: "ANOMALY_SERVERITY_UNSPECIFIED",+ Anomaly_AnomalySeverity_name = map[int32]string{+ 0: "ANOMALY_SEVERITY_UNSPECIFIED",1: "MEDIUM",2: "HIGH",3: "CRITICAL",}- Anomaly_AnomalyServerity_value = map[string]int32{- "ANOMALY_SERVERITY_UNSPECIFIED": 0,- "MEDIUM": 1,- "HIGH": 2,- "CRITICAL": 3,+ Anomaly_AnomalySeverity_value = map[string]int32{+ "ANOMALY_SEVERITY_UNSPECIFIED": 0,+ "MEDIUM": 1,+ "HIGH": 2,+ "CRITICAL": 3,})-func (x Anomaly_AnomalyServerity) Enum() *Anomaly_AnomalyServerity {- p := new(Anomaly_AnomalyServerity)+func (x Anomaly_AnomalySeverity) Enum() *Anomaly_AnomalySeverity {+ p := new(Anomaly_AnomalySeverity)*p = xreturn p}-func (x Anomaly_AnomalyServerity) String() string {+func (x Anomaly_AnomalySeverity) String() string {return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))}-func (Anomaly_AnomalyServerity) Descriptor() protoreflect.EnumDescriptor {+func (Anomaly_AnomalySeverity) Descriptor() protoreflect.EnumDescriptor {return file_v1_anomaly_service_proto_enumTypes[1].Descriptor()}-func (Anomaly_AnomalyServerity) Type() protoreflect.EnumType {+func (Anomaly_AnomalySeverity) Type() protoreflect.EnumType {return &file_v1_anomaly_service_proto_enumTypes[1]}-func (x Anomaly_AnomalyServerity) Number() protoreflect.EnumNumber {+func (x Anomaly_AnomalySeverity) Number() protoreflect.EnumNumber {return protoreflect.EnumNumber(x)}-// Deprecated: Use Anomaly_AnomalyServerity.Descriptor instead.-func (Anomaly_AnomalyServerity) EnumDescriptor() ([]byte, []int) {+// Deprecated: Use Anomaly_AnomalySeverity.Descriptor instead.+func (Anomaly_AnomalySeverity) EnumDescriptor() ([]byte, []int) {return file_v1_anomaly_service_proto_rawDescGZIP(), []int{2, 1}}@@ -218,10 +218,11 @@ type SearchAnomaliesRequest struct {unknownFields protoimpl.UnknownFields// filter is the filter to apply on the search anomaly request,- // follow the [google cel-spec](https://github.com/google/cel-spec) syntax.+ // follow the [ebnf](https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form) syntax.+ // Only support filter by resource and type for now.// For example:- // Search the anomalies of a specific resource: 'anomaly.resource_name="environments/{environemnt}/instances/{instance}"'- // Search the specified type of anomalies: 'anomaly.type="DATABASE_BACKUP_POLICY_VIOLATION"'+ // Search the anomalies of a specific resource: 'resource="environments/{environemnt}/instances/{instance}".'+ // Search the specified types of anomalies: 'type="DATABASE_BACKUP_POLICY_VIOLATION" | "MIGRATION_SCHEMA".'Filter string `protobuf:"bytes,1,opt,name=filter,proto3" json:"filter,omitempty"`// Not used. The maximum number of anomalies to return. The service may return fewer than// this value.@@ -359,8 +360,8 @@ type Anomaly struct {Resource string `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"`// type is the type of the anomaly.Type Anomaly_AnomalyType `protobuf:"varint,2,opt,name=type,proto3,enum=bytebase.v1.Anomaly_AnomalyType" json:"type,omitempty"`- // serverity is the serverity of the anomaly.- Serverity Anomaly_AnomalyServerity `protobuf:"varint,3,opt,name=serverity,proto3,enum=bytebase.v1.Anomaly_AnomalyServerity" json:"serverity,omitempty"`+ // severity is the severity of the anomaly.+ Severity Anomaly_AnomalySeverity `protobuf:"varint,3,opt,name=severity,proto3,enum=bytebase.v1.Anomaly_AnomalySeverity" json:"severity,omitempty"`// detail is the detail of the anomaly.//// Types that are assignable to Detail:@@ -419,11 +420,11 @@ func (x *Anomaly) GetType() Anomaly_AnomalyType {return Anomaly_ANOMALY_TYPE_UNSPECIFIED}-func (x *Anomaly) GetServerity() Anomaly_AnomalyServerity {+func (x *Anomaly) GetSeverity() Anomaly_AnomalySeverity {if x != nil {- return x.Serverity+ return x.Severity}- return Anomaly_ANOMALY_SERVERITY_UNSPECIFIED+ return Anomaly_ANOMALY_SEVERITY_UNSPECIFIED}func (m *Anomaly) GetDetail() isAnomaly_Detail {@@ -680,8 +681,8 @@ type Anomaly_DatabaseBackupMissingDetail struct {// expected_schedule is the expected backup plan schedule in the database.ExpectedSchedule Anomaly_BackupPlanSchedule `protobuf:"varint,1,opt,name=expected_schedule,json=expectedSchedule,proto3,enum=bytebase.v1.Anomaly_BackupPlanSchedule" json:"expected_schedule,omitempty"`- // lastest_backup_time is the last backup time in the database.- LastestBackupTime *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=lastest_backup_time,json=lastestBackupTime,proto3" json:"lastest_backup_time,omitempty"`+ // latest_backup_time is the latest backup time in the database.+ LatestBackupTime *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=latest_backup_time,json=latestBackupTime,proto3" json:"latest_backup_time,omitempty"`}func (x *Anomaly_DatabaseBackupMissingDetail) Reset() {@@ -723,9 +724,9 @@ func (x *Anomaly_DatabaseBackupMissingDetail) GetExpectedSchedule() Anomaly_Backreturn Anomaly_BACKUP_PLAN_SCHEDULE_UNSPECIFIED}-func (x *Anomaly_DatabaseBackupMissingDetail) GetLastestBackupTime() *timestamppb.Timestamp {+func (x *Anomaly_DatabaseBackupMissingDetail) GetLatestBackupTime() *timestamppb.Timestamp {if x != nil {- return x.LastestBackupTime+ return x.LatestBackupTime}return nil}@@ -829,133 +830,133 @@ var file_v1_anomaly_service_proto_rawDesc = []byte{0x6f, 0x6d, 0x61, 0x6c, 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,- 0xbf, 0x0e, 0x0a, 0x07, 0x41, 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x79, 0x12, 0x20, 0x0a, 0x08, 0x72,+ 0xb8, 0x0e, 0x0a, 0x07, 0x41, 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x79, 0x12, 0x20, 0x0a, 0x08, 0x72,0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2,0x41, 0x01, 0x02, 0x52, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x34, 0x0a,0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x62, 0x79,0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x6e, 0x6f, 0x6d, 0x61, 0x6c,0x79, 0x2e, 0x41, 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x79, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74,- 0x79, 0x70, 0x65, 0x12, 0x43, 0x0a, 0x09, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79,- 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x25, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,- 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x79, 0x2e, 0x41, 0x6e, 0x6f,- 0x6d, 0x61, 0x6c, 0x79, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, 0x52, 0x09, 0x73,- 0x65, 0x72, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, 0x12, 0x6d, 0x0a, 0x1a, 0x69, 0x6e, 0x73, 0x74,- 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f,- 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x62,- 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x6e, 0x6f, 0x6d, 0x61,- 0x6c, 0x79, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65,- 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x48, 0x00, 0x52, 0x18, 0x69,- 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f,- 0x6e, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x6d, 0x0a, 0x1a, 0x64, 0x61, 0x74, 0x61, 0x62,- 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64,- 0x65, 0x74, 0x61, 0x69, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x62, 0x79,- 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x6e, 0x6f, 0x6d, 0x61, 0x6c,- 0x79, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63,- 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x48, 0x00, 0x52, 0x18, 0x64, 0x61,- 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e,- 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x90, 0x01, 0x0a, 0x27, 0x64, 0x61, 0x74, 0x61, 0x62,- 0x61, 0x73, 0x65, 0x5f, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63,- 0x79, 0x5f, 0x76, 0x69, 0x6f, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x65, 0x74, 0x61,- 0x69, 0x6c, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,+ 0x79, 0x70, 0x65, 0x12, 0x40, 0x0a, 0x08, 0x73, 0x65, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, 0x18,+ 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x24, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65,+ 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x79, 0x2e, 0x41, 0x6e, 0x6f, 0x6d,+ 0x61, 0x6c, 0x79, 0x53, 0x65, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, 0x52, 0x08, 0x73, 0x65, 0x76,+ 0x65, 0x72, 0x69, 0x74, 0x79, 0x12, 0x6d, 0x0a, 0x1a, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63,+ 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x65, 0x74,+ 0x61, 0x69, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x62, 0x79, 0x74, 0x65,+ 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x79, 0x2e,+ 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69,+ 0x6f, 0x6e, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x48, 0x00, 0x52, 0x18, 0x69, 0x6e, 0x73, 0x74,+ 0x61, 0x6e, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65,+ 0x74, 0x61, 0x69, 0x6c, 0x12, 0x6d, 0x0a, 0x1a, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65,+ 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x65, 0x74, 0x61,+ 0x69, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x79, 0x2e, 0x44,+ 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f,+ 0x6e, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x48, 0x00, 0x52, 0x18, 0x64, 0x61, 0x74, 0x61, 0x62,+ 0x61, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x74,+ 0x61, 0x69, 0x6c, 0x12, 0x90, 0x01, 0x0a, 0x27, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65,+ 0x5f, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5f, 0x76,+ 0x69, 0x6f, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x18,+ 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65,+ 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x79, 0x2e, 0x44, 0x61, 0x74, 0x61,+ 0x62, 0x61, 0x73, 0x65, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79,+ 0x56, 0x69, 0x6f, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x48,+ 0x00, 0x52, 0x23, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x42, 0x61, 0x63, 0x6b, 0x75,+ 0x70, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x56, 0x69, 0x6f, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e,+ 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x77, 0x0a, 0x1e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61,+ 0x73, 0x65, 0x5f, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x5f, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6e,+ 0x67, 0x5f, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30,+ 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x6e, 0x6f,+ 0x6d, 0x61, 0x6c, 0x79, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x42, 0x61, 0x63,+ 0x6b, 0x75, 0x70, 0x4d, 0x69, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c,+ 0x48, 0x00, 0x52, 0x1b, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x42, 0x61, 0x63, 0x6b,+ 0x75, 0x70, 0x4d, 0x69, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12,+ 0x71, 0x0a, 0x1c, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x73, 0x63, 0x68, 0x65,+ 0x6d, 0x61, 0x5f, 0x64, 0x72, 0x69, 0x66, 0x74, 0x5f, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x18,+ 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65,+ 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x79, 0x2e, 0x44, 0x61, 0x74, 0x61,+ 0x62, 0x61, 0x73, 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x44, 0x72, 0x69, 0x66, 0x74, 0x44,+ 0x65, 0x74, 0x61, 0x69, 0x6c, 0x48, 0x00, 0x52, 0x19, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73,+ 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x44, 0x72, 0x69, 0x66, 0x74, 0x44, 0x65, 0x74, 0x61,+ 0x69, 0x6c, 0x1a, 0x32, 0x0a, 0x18, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x43, 0x6f,+ 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x16,+ 0x0a, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06,+ 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x1a, 0x32, 0x0a, 0x18, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61,+ 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x74, 0x61,+ 0x69, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x18, 0x01, 0x20, 0x01,+ 0x28, 0x09, 0x52, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x1a, 0xe5, 0x01, 0x0a, 0x23, 0x44,0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x50, 0x6f, 0x6c,0x69, 0x63, 0x79, 0x56, 0x69, 0x6f, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x74, 0x61,- 0x69, 0x6c, 0x48, 0x00, 0x52, 0x23, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x42, 0x61,- 0x63, 0x6b, 0x75, 0x70, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x56, 0x69, 0x6f, 0x6c, 0x61, 0x74,- 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x77, 0x0a, 0x1e, 0x64, 0x61, 0x74,- 0x61, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x5f, 0x6d, 0x69, 0x73,- 0x73, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x18, 0x07, 0x20, 0x01, 0x28,- 0x0b, 0x32, 0x30, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e,- 0x41, 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x79, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65,- 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x4d, 0x69, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x44, 0x65, 0x74,- 0x61, 0x69, 0x6c, 0x48, 0x00, 0x52, 0x1b, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x42,+ 0x69, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01,+ 0x28, 0x09, 0x52, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x12, 0x54, 0x0a, 0x11, 0x65, 0x78,+ 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x18,+ 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x27, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65,+ 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x79, 0x2e, 0x42, 0x61, 0x63, 0x6b,+ 0x75, 0x70, 0x50, 0x6c, 0x61, 0x6e, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x10,+ 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65,+ 0x12, 0x50, 0x0a, 0x0f, 0x61, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x64,+ 0x75, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x27, 0x2e, 0x62, 0x79, 0x74, 0x65,+ 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x79, 0x2e,+ 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x50, 0x6c, 0x61, 0x6e, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75,+ 0x6c, 0x65, 0x52, 0x0e, 0x61, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75,+ 0x6c, 0x65, 0x1a, 0xbd, 0x01, 0x0a, 0x1b, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x42,0x61, 0x63, 0x6b, 0x75, 0x70, 0x4d, 0x69, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x44, 0x65, 0x74, 0x61,- 0x69, 0x6c, 0x12, 0x71, 0x0a, 0x1c, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x73,- 0x63, 0x68, 0x65, 0x6d, 0x61, 0x5f, 0x64, 0x72, 0x69, 0x66, 0x74, 0x5f, 0x64, 0x65, 0x74, 0x61,- 0x69, 0x6c, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,- 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x79, 0x2e, 0x44,- 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x44, 0x72, 0x69,- 0x66, 0x74, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x48, 0x00, 0x52, 0x19, 0x64, 0x61, 0x74, 0x61,- 0x62, 0x61, 0x73, 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x44, 0x72, 0x69, 0x66, 0x74, 0x44,- 0x65, 0x74, 0x61, 0x69, 0x6c, 0x1a, 0x32, 0x0a, 0x18, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63,- 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x74, 0x61, 0x69,- 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28,- 0x09, 0x52, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x1a, 0x32, 0x0a, 0x18, 0x44, 0x61, 0x74,- 0x61, 0x62, 0x61, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44,- 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x18,- 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x1a, 0xe5, 0x01,- 0x0a, 0x23, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70,- 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x56, 0x69, 0x6f, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44,- 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18,- 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x12, 0x54, 0x0a,- 0x11, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75,- 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x27, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,- 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x79, 0x2e, 0x42,- 0x61, 0x63, 0x6b, 0x75, 0x70, 0x50, 0x6c, 0x61, 0x6e, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c,- 0x65, 0x52, 0x10, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x53, 0x63, 0x68, 0x65, 0x64,- 0x75, 0x6c, 0x65, 0x12, 0x50, 0x0a, 0x0f, 0x61, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x5f, 0x73, 0x63,- 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x27, 0x2e, 0x62,- 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x6e, 0x6f, 0x6d, 0x61,- 0x6c, 0x79, 0x2e, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x50, 0x6c, 0x61, 0x6e, 0x53, 0x63, 0x68,- 0x65, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x0e, 0x61, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x53, 0x63, 0x68,- 0x65, 0x64, 0x75, 0x6c, 0x65, 0x1a, 0xbf, 0x01, 0x0a, 0x1b, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61,- 0x73, 0x65, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x4d, 0x69, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x44,- 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x54, 0x0a, 0x11, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65,- 0x64, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e,- 0x32, 0x27, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41,- 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x79, 0x2e, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x50, 0x6c, 0x61,- 0x6e, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x10, 0x65, 0x78, 0x70, 0x65, 0x63,- 0x74, 0x65, 0x64, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x4a, 0x0a, 0x13, 0x6c,- 0x61, 0x73, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x5f, 0x74, 0x69,- 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,- 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73,- 0x74, 0x61, 0x6d, 0x70, 0x52, 0x11, 0x6c, 0x61, 0x73, 0x74, 0x65, 0x73, 0x74, 0x42, 0x61, 0x63,- 0x6b, 0x75, 0x70, 0x54, 0x69, 0x6d, 0x65, 0x1a, 0x90, 0x01, 0x0a, 0x19, 0x44, 0x61, 0x74, 0x61,- 0x62, 0x61, 0x73, 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x44, 0x72, 0x69, 0x66, 0x74, 0x44,- 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x5f,- 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x72,- 0x65, 0x63, 0x6f, 0x72, 0x64, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x27, 0x0a, 0x0f,- 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18,- 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x53,- 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x23, 0x0a, 0x0d, 0x61, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x5f,- 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x63,- 0x74, 0x75, 0x61, 0x6c, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x22, 0xd1, 0x01, 0x0a, 0x0b, 0x41,- 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1c, 0x0a, 0x18, 0x41, 0x4e,- 0x4f, 0x4d, 0x41, 0x4c, 0x59, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45,- 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x17, 0x0a, 0x13, 0x49, 0x4e, 0x53, 0x54,- 0x41, 0x4e, 0x43, 0x45, 0x5f, 0x43, 0x4f, 0x4e, 0x4e, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x10,- 0x01, 0x12, 0x14, 0x0a, 0x10, 0x4d, 0x49, 0x47, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53,- 0x43, 0x48, 0x45, 0x4d, 0x41, 0x10, 0x02, 0x12, 0x24, 0x0a, 0x20, 0x44, 0x41, 0x54, 0x41, 0x42,- 0x41, 0x53, 0x45, 0x5f, 0x42, 0x41, 0x43, 0x4b, 0x55, 0x50, 0x5f, 0x50, 0x4f, 0x4c, 0x49, 0x43,- 0x59, 0x5f, 0x56, 0x49, 0x4f, 0x4c, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x03, 0x12, 0x1b, 0x0a,- 0x17, 0x44, 0x41, 0x54, 0x41, 0x42, 0x41, 0x53, 0x45, 0x5f, 0x42, 0x41, 0x43, 0x4b, 0x55, 0x50,- 0x5f, 0x4d, 0x49, 0x53, 0x53, 0x49, 0x4e, 0x47, 0x10, 0x04, 0x12, 0x17, 0x0a, 0x13, 0x44, 0x41,- 0x54, 0x41, 0x42, 0x41, 0x53, 0x45, 0x5f, 0x43, 0x4f, 0x4e, 0x4e, 0x45, 0x43, 0x54, 0x49, 0x4f,- 0x4e, 0x10, 0x05, 0x12, 0x19, 0x0a, 0x15, 0x44, 0x41, 0x54, 0x41, 0x42, 0x41, 0x53, 0x45, 0x5f,- 0x53, 0x43, 0x48, 0x45, 0x4d, 0x41, 0x5f, 0x44, 0x52, 0x49, 0x46, 0x54, 0x10, 0x06, 0x22, 0x59,- 0x0a, 0x10, 0x41, 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x79, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x69,- 0x74, 0x79, 0x12, 0x21, 0x0a, 0x1d, 0x41, 0x4e, 0x4f, 0x4d, 0x41, 0x4c, 0x59, 0x5f, 0x53, 0x45,- 0x52, 0x56, 0x45, 0x52, 0x49, 0x54, 0x59, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46,- 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x4d, 0x45, 0x44, 0x49, 0x55, 0x4d, 0x10,- 0x01, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x49, 0x47, 0x48, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x43,- 0x52, 0x49, 0x54, 0x49, 0x43, 0x41, 0x4c, 0x10, 0x03, 0x22, 0x5c, 0x0a, 0x12, 0x42, 0x61, 0x63,- 0x6b, 0x75, 0x70, 0x50, 0x6c, 0x61, 0x6e, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x12,- 0x24, 0x0a, 0x20, 0x42, 0x41, 0x43, 0x4b, 0x55, 0x50, 0x5f, 0x50, 0x4c, 0x41, 0x4e, 0x5f, 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, 0x42, 0x08, 0x0a, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69,- 0x6c, 0x32, 0x8f, 0x01, 0x0a, 0x0e, 0x41, 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x79, 0x53, 0x65, 0x72,- 0x76, 0x69, 0x63, 0x65, 0x12, 0x7d, 0x0a, 0x0f, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x41, 0x6e,- 0x6f, 0x6d, 0x61, 0x6c, 0x69, 0x65, 0x73, 0x12, 0x23, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61,- 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x41, 0x6e, 0x6f, 0x6d,- 0x61, 0x6c, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x62,- 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63,- 0x68, 0x41, 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,- 0x73, 0x65, 0x22, 0x1f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x3a, 0x01, 0x2a, 0x22, 0x14, 0x2f,- 0x76, 0x31, 0x2f, 0x61, 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x69, 0x65, 0x73, 0x2f, 0x73, 0x65, 0x61,- 0x72, 0x63, 0x68, 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,+ 0x69, 0x6c, 0x12, 0x54, 0x0a, 0x11, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x5f, 0x73,+ 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x27, 0x2e,+ 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x6e, 0x6f, 0x6d,+ 0x61, 0x6c, 0x79, 0x2e, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x50, 0x6c, 0x61, 0x6e, 0x53, 0x63,+ 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x10, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64,+ 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x48, 0x0a, 0x12, 0x6c, 0x61, 0x74, 0x65,+ 0x73, 0x74, 0x5f, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02,+ 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,+ 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70,+ 0x52, 0x10, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x54, 0x69,+ 0x6d, 0x65, 0x1a, 0x90, 0x01, 0x0a, 0x19, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x53,+ 0x63, 0x68, 0x65, 0x6d, 0x61, 0x44, 0x72, 0x69, 0x66, 0x74, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c,+ 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69,+ 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64,+ 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x27, 0x0a, 0x0f, 0x65, 0x78, 0x70, 0x65, 0x63,+ 0x74, 0x65, 0x64, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,+ 0x52, 0x0e, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61,+ 0x12, 0x23, 0x0a, 0x0d, 0x61, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d,+ 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x53,+ 0x63, 0x68, 0x65, 0x6d, 0x61, 0x22, 0xd1, 0x01, 0x0a, 0x0b, 0x41, 0x6e, 0x6f, 0x6d, 0x61, 0x6c,+ 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1c, 0x0a, 0x18, 0x41, 0x4e, 0x4f, 0x4d, 0x41, 0x4c, 0x59,+ 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45,+ 0x44, 0x10, 0x00, 0x12, 0x17, 0x0a, 0x13, 0x49, 0x4e, 0x53, 0x54, 0x41, 0x4e, 0x43, 0x45, 0x5f,+ 0x43, 0x4f, 0x4e, 0x4e, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10,+ 0x4d, 0x49, 0x47, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x43, 0x48, 0x45, 0x4d, 0x41,+ 0x10, 0x02, 0x12, 0x24, 0x0a, 0x20, 0x44, 0x41, 0x54, 0x41, 0x42, 0x41, 0x53, 0x45, 0x5f, 0x42,+ 0x41, 0x43, 0x4b, 0x55, 0x50, 0x5f, 0x50, 0x4f, 0x4c, 0x49, 0x43, 0x59, 0x5f, 0x56, 0x49, 0x4f,+ 0x4c, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x03, 0x12, 0x1b, 0x0a, 0x17, 0x44, 0x41, 0x54, 0x41,+ 0x42, 0x41, 0x53, 0x45, 0x5f, 0x42, 0x41, 0x43, 0x4b, 0x55, 0x50, 0x5f, 0x4d, 0x49, 0x53, 0x53,+ 0x49, 0x4e, 0x47, 0x10, 0x04, 0x12, 0x17, 0x0a, 0x13, 0x44, 0x41, 0x54, 0x41, 0x42, 0x41, 0x53,+ 0x45, 0x5f, 0x43, 0x4f, 0x4e, 0x4e, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x05, 0x12, 0x19,+ 0x0a, 0x15, 0x44, 0x41, 0x54, 0x41, 0x42, 0x41, 0x53, 0x45, 0x5f, 0x53, 0x43, 0x48, 0x45, 0x4d,+ 0x41, 0x5f, 0x44, 0x52, 0x49, 0x46, 0x54, 0x10, 0x06, 0x22, 0x57, 0x0a, 0x0f, 0x41, 0x6e, 0x6f,+ 0x6d, 0x61, 0x6c, 0x79, 0x53, 0x65, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, 0x12, 0x20, 0x0a, 0x1c,+ 0x41, 0x4e, 0x4f, 0x4d, 0x41, 0x4c, 0x59, 0x5f, 0x53, 0x45, 0x56, 0x45, 0x52, 0x49, 0x54, 0x59,+ 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0a,+ 0x0a, 0x06, 0x4d, 0x45, 0x44, 0x49, 0x55, 0x4d, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x49,+ 0x47, 0x48, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x43, 0x52, 0x49, 0x54, 0x49, 0x43, 0x41, 0x4c,+ 0x10, 0x03, 0x22, 0x5c, 0x0a, 0x12, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x50, 0x6c, 0x61, 0x6e,+ 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x24, 0x0a, 0x20, 0x42, 0x41, 0x43, 0x4b,+ 0x55, 0x50, 0x5f, 0x50, 0x4c, 0x41, 0x4e, 0x5f, 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,+ 0x42, 0x08, 0x0a, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x32, 0x8f, 0x01, 0x0a, 0x0e, 0x41,+ 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x7d, 0x0a,+ 0x0f, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x41, 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x69, 0x65, 0x73,+ 0x12, 0x23, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53,+ 0x65, 0x61, 0x72, 0x63, 0x68, 0x41, 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x69, 0x65, 0x73, 0x52, 0x65,+ 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65,+ 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x41, 0x6e, 0x6f, 0x6d, 0x61, 0x6c,+ 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1f, 0x82, 0xd3, 0xe4,+ 0x93, 0x02, 0x19, 0x3a, 0x01, 0x2a, 0x22, 0x14, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x6e, 0x6f, 0x6d,+ 0x61, 0x6c, 0x69, 0x65, 0x73, 0x2f, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 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 (@@ -974,7 +975,7 @@ var file_v1_anomaly_service_proto_enumTypes = make([]protoimpl.EnumInfo, 3)var file_v1_anomaly_service_proto_msgTypes = make([]protoimpl.MessageInfo, 8)var file_v1_anomaly_service_proto_goTypes = []interface{}{(Anomaly_AnomalyType)(0), // 0: bytebase.v1.Anomaly.AnomalyType- (Anomaly_AnomalyServerity)(0), // 1: bytebase.v1.Anomaly.AnomalyServerity+ (Anomaly_AnomalySeverity)(0), // 1: bytebase.v1.Anomaly.AnomalySeverity(Anomaly_BackupPlanSchedule)(0), // 2: bytebase.v1.Anomaly.BackupPlanSchedule(*SearchAnomaliesRequest)(nil), // 3: bytebase.v1.SearchAnomaliesRequest(*SearchAnomaliesResponse)(nil), // 4: bytebase.v1.SearchAnomaliesResponse@@ -989,7 +990,7 @@ var file_v1_anomaly_service_proto_goTypes = []interface{}{var file_v1_anomaly_service_proto_depIdxs = []int32{5, // 0: bytebase.v1.SearchAnomaliesResponse.anomalies:type_name -> bytebase.v1.Anomaly0, // 1: bytebase.v1.Anomaly.type:type_name -> bytebase.v1.Anomaly.AnomalyType- 1, // 2: bytebase.v1.Anomaly.serverity:type_name -> bytebase.v1.Anomaly.AnomalyServerity+ 1, // 2: bytebase.v1.Anomaly.severity:type_name -> bytebase.v1.Anomaly.AnomalySeverity6, // 3: bytebase.v1.Anomaly.instance_connection_detail:type_name -> bytebase.v1.Anomaly.InstanceConnectionDetail7, // 4: bytebase.v1.Anomaly.database_connection_detail:type_name -> bytebase.v1.Anomaly.DatabaseConnectionDetail8, // 5: bytebase.v1.Anomaly.database_backup_policy_violation_detail:type_name -> bytebase.v1.Anomaly.DatabaseBackupPolicyViolationDetail@@ -998,7 +999,7 @@ var file_v1_anomaly_service_proto_depIdxs = []int32{2, // 8: bytebase.v1.Anomaly.DatabaseBackupPolicyViolationDetail.expected_schedule:type_name -> bytebase.v1.Anomaly.BackupPlanSchedule2, // 9: bytebase.v1.Anomaly.DatabaseBackupPolicyViolationDetail.actual_schedule:type_name -> bytebase.v1.Anomaly.BackupPlanSchedule2, // 10: bytebase.v1.Anomaly.DatabaseBackupMissingDetail.expected_schedule:type_name -> bytebase.v1.Anomaly.BackupPlanSchedule- 11, // 11: bytebase.v1.Anomaly.DatabaseBackupMissingDetail.lastest_backup_time:type_name -> google.protobuf.Timestamp+ 11, // 11: bytebase.v1.Anomaly.DatabaseBackupMissingDetail.latest_backup_time:type_name -> google.protobuf.Timestamp3, // 12: bytebase.v1.AnomalyService.SearchAnomalies:input_type -> bytebase.v1.SearchAnomaliesRequest4, // 13: bytebase.v1.AnomalyService.SearchAnomalies:output_type -> bytebase.v1.SearchAnomaliesResponse13, // [13:14] is the sub-list for method output_typediff --git a/proto/v1/anomaly_service.proto b/proto/v1/anomaly_service.protoindex 78348087de..2928558dce 100644--- a/proto/v1/anomaly_service.proto+++ b/proto/v1/anomaly_service.proto@@ -24,10 +24,11 @@ service AnomalyService {message SearchAnomaliesRequest {// filter is the filter to apply on the search anomaly request,- // follow the [google cel-spec](https://github.com/google/cel-spec) syntax.+ // follow the [ebnf](https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form) syntax.+ // Only support filter by resource and type for now.// For example:- // Search the anomalies of a specific resource: 'anomaly.resource_name="environments/{environemnt}/instances/{instance}"'- // Search the specified type of anomalies: 'anomaly.type="DATABASE_BACKUP_POLICY_VIOLATION"'+ // Search the anomalies of a specific resource: 'resource="environments/{environemnt}/instances/{instance}".'+ // Search the specified types of anomalies: 'type="DATABASE_BACKUP_POLICY_VIOLATION" | "MIGRATION_SCHEMA".'string filter = 1;// Not used. The maximum number of anomalies to return. The service may return fewer than@@ -79,15 +80,15 @@ message Anomaly {DATABASE_SCHEMA_DRIFT = 6;}- // AnomalyServerity is the severity of the anomaly.- enum AnomalyServerity {- // Unspecified anomaly serverity.- ANOMALY_SERVERITY_UNSPECIFIED = 0;- // MEDIUM is the info level anomaly serverity.+ // AnomalySeverity is the severity of the anomaly.+ enum AnomalySeverity {+ // Unspecified anomaly severity.+ ANOMALY_SEVERITY_UNSPECIFIED = 0;+ // MEDIUM is the info level anomaly severity.MEDIUM = 1;- // HIGH is the warning level anomaly serverity.+ // HIGH is the warning level anomaly severity.HIGH = 2;- // CRITICAL is the critical level anomaly serverity.+ // CRITICAL is the critical level anomaly severity.CRITICAL = 3;}@@ -100,8 +101,8 @@ message Anomaly {// type is the type of the anomaly.AnomalyType type = 2;- // serverity is the serverity of the anomaly.- AnomalyServerity serverity = 3;+ // severity is the severity of the anomaly.+ AnomalySeverity severity = 3;// Instance level anomaly detail.//@@ -149,8 +150,8 @@ message Anomaly {// expected_schedule is the expected backup plan schedule in the database.BackupPlanSchedule expected_schedule = 1;- // lastest_backup_time is the last backup time in the database.- google.protobuf.Timestamp lastest_backup_time = 2;+ // latest_backup_time is the latest backup time in the database.+ google.protobuf.Timestamp latest_backup_time = 2;}// DatabaseSchemaDriftDetail is the detail for database schema drift anomaly.