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: migrate anomaly to v1 (#6652)
ecmadaoa4555ec1fa59
diff --git a/backend/api/v1/anomaly_service.go b/backend/api/v1/anomaly_service.goindex 8f247a64d2..1e02de776a 100644--- a/backend/api/v1/anomaly_service.go+++ b/backend/api/v1/anomaly_service.go@@ -4,6 +4,7 @@ import ("context""encoding/json""fmt"+ "strings""time""google.golang.org/grpc/codes"@@ -48,7 +49,6 @@ func NewAnomalyService(store *store.Store) *AnomalyService {func (s *AnomalyService) SearchAnomalies(ctx context.Context, request *v1pb.SearchAnomaliesRequest) (*v1pb.SearchAnomaliesResponse, error) {var find store.ListAnomalyMessage- var environmentID, instanceID, databaseName stringif request.Filter != "" {// We only support filter by type and resource now.types, err := getEBNFTokens(request.Filter, typeFilterKey)@@ -59,7 +59,7 @@ func (s *AnomalyService) SearchAnomalies(ctx context.Context, request *v1pb.Searif v, ok := typesMap[tp]; ok {find.Types = append(find.Types, v)} else {- return nil, status.Errorf(codes.InvalidArgument, "Invalid type filter %q", tp)+ return nil, status.Errorf(codes.InvalidArgument, "invalid type filter %q", tp)}}resources, err := getEBNFTokens(request.Filter, resourceFilterKey)@@ -67,46 +67,37 @@ func (s *AnomalyService) SearchAnomalies(ctx context.Context, request *v1pb.Searreturn 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.- insID, err := getInstanceID(resources[0])- if err != nil {- // Try to treat as database resource.- insID, dbName, err := getInstanceDatabaseID(resources[0])- if err != nil {- return nil, status.Errorf(codes.InvalidArgument, "Only support filter by instance and database in resource filter")- }- instanceID, databaseName = insID, dbName- } else {- // Treat as instance resource.- instanceID = insID- }- if instanceID != "" {- instance, err := s.store.GetInstanceV2(ctx, &store.FindInstanceMessage{- 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 instanceID != "" && databaseName != "" {- database, err := s.store.GetDatabaseV2(ctx, &store.FindDatabaseMessage{- 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)+ return nil, status.Errorf(codes.InvalidArgument, "only one resource can be specified")+ } else if len(resources) == 1 {+ sections := strings.Split(resources[0], "/")+ if len(sections) == 2 {+ // Treat as instances/{resource id}+ insID, err := getInstanceID(resources[0])+ if err != nil {+ return nil, status.Errorf(codes.InvalidArgument, `invalid resource filter "%s": %v`, resources[0], err.Error())+ }+ find.InstanceID = &insID+ } else if len(sections) == 4 {+ // Treat as instances/{resource id}/databases/{db name}+ insID, dbName, err := getInstanceDatabaseID(resources[0])+ if err != nil {+ return nil, status.Errorf(codes.InvalidArgument, `invalid resource filter "%s": %v`, resources[0], err.Error())+ }+ database, err := s.store.GetDatabaseV2(ctx, &store.FindDatabaseMessage{+ InstanceID: &insID,+ DatabaseName: &dbName,+ })+ if err != nil {+ return nil, status.Errorf(codes.Internal, err.Error())+ }+ if database == nil {+ return nil, status.Errorf(codes.NotFound, "cannot found the database %s", resources[0])+ }+ find.InstanceID = &insID+ find.DatabaseUID = &database.UID+ } else {+ return nil, status.Errorf(codes.InvalidArgument, `invalid resource filter "%s"`, resources[0])}- find.DatabaseUID = &database.UID}}@@ -117,7 +108,7 @@ func (s *AnomalyService) SearchAnomalies(ctx context.Context, request *v1pb.Searvar response v1pb.SearchAnomaliesResponsefor _, anomaly := range anomalies {- pbAnomaly, err := convertToAnomaly(anomaly, environmentID, instanceID, databaseName)+ pbAnomaly, err := s.convertToAnomaly(ctx, anomaly)if err != nil {return nil, status.Errorf(codes.Internal, err.Error())}@@ -126,12 +117,26 @@ func (s *AnomalyService) SearchAnomalies(ctx context.Context, request *v1pb.Searreturn &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", instanceNamePrefix, instanceID, databaseIDPrefix, databaseName)- } else if environmentID != "" && instanceID != "" {- pbAnomaly.Resource = fmt.Sprintf("%s%s", instanceNamePrefix, instanceID)+func (s *AnomalyService) convertToAnomaly(ctx context.Context, anomaly *store.AnomalyMessage) (*v1pb.Anomaly, error) {+ pbAnomaly := &v1pb.Anomaly{+ CreateTime: timestamppb.New(time.Unix(anomaly.CreatedTs, 0)),+ UpdateTime: timestamppb.New(time.Unix(anomaly.UpdatedTs, 0)),+ }++ if v := anomaly.DatabaseUID; v != nil {+ database, err := s.store.GetDatabaseV2(ctx, &store.FindDatabaseMessage{+ UID: v,+ ShowDeleted: true,+ })+ if err != nil {+ return nil, errors.Wrapf(err, "failed to find database with id %d", v)+ }+ if database == nil {+ return nil, errors.Errorf("cannot found database with id %d", v)+ }+ pbAnomaly.Resource = fmt.Sprintf("%s%s/%s%s", instanceNamePrefix, database.InstanceID, databaseIDPrefix, database.DatabaseName)+ } else {+ pbAnomaly.Resource = fmt.Sprintf("%s%s", instanceNamePrefix, anomaly.InstanceID)}switch anomaly.Type {@@ -151,12 +156,16 @@ func convertToAnomaly(anomaly *store.AnomalyMessage, environmentID, instanceID,if err := json.Unmarshal([]byte(anomaly.Payload), &detail); err != nil {return nil, errors.Wrapf(err, "failed to unmarshal database backup policy violation anomaly payload")}+ environment, err := s.store.GetEnvironmentByID(ctx, detail.EnvironmentID)+ if err != nil {+ return nil, errors.Wrapf(err, "failed to find environment with id %d", detail.EnvironmentID)+ }pbAnomaly.Type = v1pb.Anomaly_DATABASE_BACKUP_POLICY_VIOLATIONpbAnomaly.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", instanceNamePrefix, instanceID),+ Parent: fmt.Sprintf("%s%s", environmentNamePrefix, environment.ResourceID),ExpectedSchedule: convertBackupPlanSchedule(detail.ExpectedBackupSchedule),ActualSchedule: convertBackupPlanSchedule(detail.ActualBackupSchedule),},@@ -199,7 +208,7 @@ func convertToAnomaly(anomaly *store.AnomalyMessage, environmentID, instanceID,}}pbAnomaly.Severity = getSeverityFromAnomalyType(pbAnomaly.Type)- return &pbAnomaly, nil+ return pbAnomaly, nil}func getSeverityFromAnomalyType(tp v1pb.Anomaly_AnomalyType) v1pb.Anomaly_AnomalySeverity {@@ -214,14 +223,14 @@ func getSeverityFromAnomalyType(tp v1pb.Anomaly_AnomalyType) v1pb.Anomaly_Anomalreturn v1pb.Anomaly_ANOMALY_SEVERITY_UNSPECIFIED}-func convertBackupPlanSchedule(s api.BackupPlanPolicySchedule) v1pb.Anomaly_BackupPlanSchedule {+func convertBackupPlanSchedule(s api.BackupPlanPolicySchedule) v1pb.BackupPlanSchedule {switch s {case api.BackupPlanPolicyScheduleUnset:- return v1pb.Anomaly_UNSET+ return v1pb.BackupPlanSchedule_UNSETcase api.BackupPlanPolicyScheduleDaily:- return v1pb.Anomaly_DAILY+ return v1pb.BackupPlanSchedule_DAILYcase api.BackupPlanPolicyScheduleWeekly:- return v1pb.Anomaly_WEEKLY+ return v1pb.BackupPlanSchedule_WEEKLY}- return v1pb.Anomaly_BACKUP_PLAN_SCHEDULE_UNSPECIFIED+ return v1pb.BackupPlanSchedule_SCHEDULE_UNSPECIFIED}diff --git a/backend/legacyapi/anomaly.go b/backend/legacyapi/anomaly.goindex 6a09ca7615..e71f978ef9 100644--- a/backend/legacyapi/anomaly.go+++ b/backend/legacyapi/anomaly.go@@ -18,31 +18,6 @@ const (AnomalyDatabaseSchemaDrift AnomalyType = "bb.anomaly.database.schema.drift")-// AnomalySeverity is the severity of anomaly.-type AnomalySeverity string--const (- // AnomalySeverityMedium is the medium severity.- AnomalySeverityMedium AnomalySeverity = "MEDIUM"- // AnomalySeverityHigh is the high severity.- AnomalySeverityHigh AnomalySeverity = "HIGH"- // AnomalySeverityCritical is the critical severity.- AnomalySeverityCritical AnomalySeverity = "CRITICAL"-)--// AnomalySeverityFromType maps the severity from a anomaly type.-func AnomalySeverityFromType(anomalyType AnomalyType) AnomalySeverity {- switch anomalyType {- case AnomalyDatabaseBackupPolicyViolation:- return AnomalySeverityMedium- case AnomalyDatabaseBackupMissing:- return AnomalySeverityHigh- case AnomalyInstanceConnection, AnomalyInstanceMigrationSchema, AnomalyDatabaseConnection, AnomalyDatabaseSchemaDrift:- return AnomalySeverityCritical- }- return AnomalySeverityCritical-}-// AnomalyInstanceConnectionPayload is the API message for instance connection payloads.type AnomalyInstanceConnectionPayload struct {// Connection failure detail@@ -78,29 +53,3 @@ type AnomalyDatabaseSchemaDriftPayload struct {// The actual schema dumped from the databaseActual string `json:"actual,omitempty"`}--// Anomaly is the API message for an anomaly.-type Anomaly struct {- ID int `jsonapi:"primary,anomaly"`-- // Standard fields- CreatorID int- Creator *Principal `jsonapi:"relation,creator"`- CreatedTs int64 `jsonapi:"attr,createdTs"`- UpdaterID int- Updater *Principal `jsonapi:"relation,updater"`- UpdatedTs int64 `jsonapi:"attr,updatedTs"`-- // Related fields- InstanceID int `jsonapi:"attr,instanceId"`- Instance *Instance `jsonapi:"relation,instance"`- // Instance anomaly doesn't have databaseID- DatabaseID *int `jsonapi:"attr,databaseId"`- Database *Database `jsonapi:"relation,database"`-- // Domain specific fields- Type AnomalyType `jsonapi:"attr,type"`- // Calculated field derived from type- Severity AnomalySeverity `jsonapi:"attr,severity"`- Payload string `jsonapi:"attr,payload"`-}diff --git a/backend/runner/anomaly/scanner.go b/backend/runner/anomaly/scanner.goindex 02890aa1d2..be76795a90 100644--- a/backend/runner/anomaly/scanner.go+++ b/backend/runner/anomaly/scanner.go@@ -165,9 +165,9 @@ func (s *Scanner) checkInstanceAnomaly(ctx context.Context, instance *store.Instzap.Error(err))} else {if _, err = s.store.UpsertActiveAnomalyV2(ctx, api.SystemBotID, &store.AnomalyMessage{- InstanceUID: instance.UID,- Type: api.AnomalyInstanceConnection,- Payload: string(payload),+ InstanceID: instance.ResourceID,+ Type: api.AnomalyInstanceConnection,+ Payload: string(payload),}); err != nil {log.Error("Failed to create anomaly",zap.String("instance", instance.ResourceID),@@ -180,8 +180,8 @@ func (s *Scanner) checkInstanceAnomaly(ctx context.Context, instance *store.Instdefer driver.Close(ctx)err = s.store.ArchiveAnomalyV2(ctx, &store.ArchiveAnomalyMessage{- InstanceUID: &instance.UID,- Type: api.AnomalyInstanceConnection,+ InstanceID: &instance.ResourceID,+ Type: api.AnomalyInstanceConnection,})if err != nil && common.ErrorCode(err) != common.NotFound {log.Error("Failed to close anomaly",@@ -208,7 +208,7 @@ func (s *Scanner) checkDatabaseAnomaly(ctx context.Context, instance *store.Instzap.Error(err))} else {if _, err = s.store.UpsertActiveAnomalyV2(ctx, api.SystemBotID, &store.AnomalyMessage{- InstanceUID: instance.UID,+ InstanceID: instance.ResourceID,DatabaseUID: &database.UID,Type: api.AnomalyDatabaseConnection,Payload: string(payload),@@ -289,7 +289,7 @@ func (s *Scanner) checkDatabaseAnomaly(ctx context.Context, instance *store.Instzap.Error(err))} else {if _, err = s.store.UpsertActiveAnomalyV2(ctx, api.SystemBotID, &store.AnomalyMessage{- InstanceUID: instance.UID,+ InstanceID: instance.ResourceID,DatabaseUID: &database.UID,Type: api.AnomalyDatabaseSchemaDrift,Payload: string(payload),@@ -373,7 +373,7 @@ func (s *Scanner) checkBackupAnomaly(ctx context.Context, environment *store.Envzap.Error(err))} else {if _, err = s.store.UpsertActiveAnomalyV2(ctx, api.SystemBotID, &store.AnomalyMessage{- InstanceUID: instance.UID,+ InstanceID: instance.ResourceID,DatabaseUID: &database.UID,Type: api.AnomalyDatabaseBackupPolicyViolation,Payload: string(payload),@@ -455,7 +455,7 @@ func (s *Scanner) checkBackupAnomaly(ctx context.Context, environment *store.Envzap.Error(err))} else {if _, err = s.store.UpsertActiveAnomalyV2(ctx, api.SystemBotID, &store.AnomalyMessage{- InstanceUID: instance.UID,+ InstanceID: instance.ResourceID,DatabaseUID: &database.UID,Type: api.AnomalyDatabaseBackupMissing,Payload: string(payload),diff --git a/backend/server/acl_casbin_policy_dba.csv b/backend/server/acl_casbin_policy_dba.csvindex c2ec3a0f45..e18536a901 100644--- a/backend/server/acl_casbin_policy_dba.csv+++ b/backend/server/acl_casbin_policy_dba.csv@@ -91,5 +91,4 @@ p, DBA, /vcs/{vcsID}/external-repository, GETp, DBA, /setting, GETp, DBA, /label, GETp, DBA, /label/{labelID}, PATCH-p, DBA, /feature, GET-p, DBA, /anomaly, GET+p, DBA, /feature, GET\ No newline at end of filediff --git a/backend/server/acl_casbin_policy_developer.csv b/backend/server/acl_casbin_policy_developer.csvindex f56db06741..7615667dbf 100644--- a/backend/server/acl_casbin_policy_developer.csv+++ b/backend/server/acl_casbin_policy_developer.csv@@ -76,5 +76,4 @@ p, DEVELOPER, /vcs/{vcsID}, GETp, DEVELOPER, /vcs/{vcsID}/external-repository, GETp, DEVELOPER, /setting, GETp, DEVELOPER, /label, GET-p, DEVELOPER, /feature, GET-p, DEVELOPER, /anomaly, GET+p, DEVELOPER, /feature, GET\ No newline at end of filediff --git a/backend/server/acl_casbin_policy_owner.csv b/backend/server/acl_casbin_policy_owner.csvindex 5d701a1eaa..86329f68da 100644--- a/backend/server/acl_casbin_policy_owner.csv+++ b/backend/server/acl_casbin_policy_owner.csv@@ -99,4 +99,3 @@ p, OWNER, /setting/{name}, PATCHp, OWNER, /label, GETp, OWNER, /label/{labelID}, PATCHp, OWNER, /feature, GET-p, OWNER, /anomaly, GETdiff --git a/backend/server/anomaly.go b/backend/server/anomaly.godeleted file mode 100644index f0f435815f..0000000000--- a/backend/server/anomaly.go+++ /dev/null@@ -1,61 +0,0 @@-package server--import (- "fmt"- "net/http"- "strconv"-- "github.com/google/jsonapi"- "github.com/labstack/echo/v4"-- api "github.com/bytebase/bytebase/backend/legacyapi"- "github.com/bytebase/bytebase/backend/store"-)--func (s *Server) registerAnomalyRoutes(g *echo.Group) {- g.GET("/anomaly", func(c echo.Context) error {- ctx := c.Request().Context()- normalRowStatus := api.Normal- find := &store.ListAnomalyMessage{- RowStatus: &normalRowStatus,- }-- if instanceIDStr := c.QueryParam("instance"); instanceIDStr != "" {- instanceID, err := strconv.Atoi(instanceIDStr)- if err != nil {- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Query parameter instance is not a number: %s", instanceIDStr)).SetInternal(err)- }- find.InstanceUID = &instanceID- find.Types = append(find.Types, api.AnomalyInstanceConnection, api.AnomalyInstanceMigrationSchema)- }- if databaseIDStr := c.QueryParam("database"); databaseIDStr != "" {- databaseID, err := strconv.Atoi(databaseIDStr)- if err != nil {- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Query parameter database is not a number: %s", databaseIDStr)).SetInternal(err)- }- find.DatabaseUID = &databaseID- }- if rowStatus := c.QueryParam("rowStatus"); rowStatus != "" {- find.RowStatus = (*api.RowStatus)(&rowStatus)- }- if anomalyType := c.QueryParam("type"); anomalyType != "" {- find.Types = append(find.Types, api.AnomalyType(anomalyType))- }-- anomalyList, err := s.store.ListAnomalyV2(ctx, find)- if err != nil {- return echo.NewHTTPError(http.StatusInternalServerError, "Failed to fetch anomaly list").SetInternal(err)- }-- var apiAnomalyList []*api.Anomaly- for _, anomaly := range anomalyList {- apiAnomalyList = append(apiAnomalyList, anomaly.ToAPIAnomaly())- }-- c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)- if err := jsonapi.MarshalPayload(c.Response().Writer, apiAnomalyList); err != nil {- return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal anomaly list response").SetInternal(err)- }- return nil- })-}diff --git a/backend/server/server.go b/backend/server/server.goindex 1afc5db4b6..0227f6e328 100644--- a/backend/server/server.go+++ b/backend/server/server.go@@ -517,7 +517,6 @@ func NewServer(ctx context.Context, profile config.Profile) (*Server, error) {s.registerStageRoutes(apiGroup)s.registerActivityRoutes(apiGroup)s.registerSQLRoutes(apiGroup)- s.registerAnomalyRoutes(apiGroup)// Register healthz endpoint.e.GET("/healthz", func(c echo.Context) error {diff --git a/backend/store/anomaly.go b/backend/store/anomaly.goindex 1bcd8b7115..2f183f52db 100644--- a/backend/store/anomaly.go+++ b/backend/store/anomaly.go@@ -14,8 +14,8 @@ import (// AnomalyMessage is the message of the anomaly.type AnomalyMessage struct {- // InstanceUID is the unique identifier of the instance.- InstanceUID int+ // InstanceID is the instance resource id.+ InstanceID string// 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.@@ -24,46 +24,32 @@ type AnomalyMessage struct {Payload string// Output only fields.//- // ID is the unique identifier of the anomaly.- ID int+ // UID is the unique identifier of the anomaly.+ UID int// CreatedTs is the timestamp when the anomaly is created.CreatedTs int64// UpdatedTs is the timestamp when the anomaly is updated.UpdatedTs int64}-// ToAPIAnomaly converts the anomaly message to the api anomaly.-func (a *AnomalyMessage) ToAPIAnomaly() *api.Anomaly {- return &api.Anomaly{- ID: a.ID,- UpdatedTs: a.UpdatedTs,- CreatedTs: a.CreatedTs,- InstanceID: a.InstanceUID,- DatabaseID: a.DatabaseUID,- Type: a.Type,- Payload: a.Payload,- Severity: api.AnomalySeverityFromType(a.Type),- }-}-// ListAnomalyMessage is the message to list anomalies.type ListAnomalyMessage struct {RowStatus *api.RowStatus- InstanceUID *int+ InstanceID *stringDatabaseUID *intTypes []api.AnomalyType}// ArchiveAnomalyMessage is the message to archive an anomaly.type ArchiveAnomalyMessage struct {- InstanceUID *int+ InstanceID *stringDatabaseUID *intType api.AnomalyType}// updateAnomalyMessage is the message to update an anomaly.type updateAnomalyMessage struct {- ID int+ UID intPayload string}@@ -78,7 +64,7 @@ func (s *Store) UpsertActiveAnomalyV2(ctx context.Context, principalUID int, upsstatus := api.Normalfind := &ListAnomalyMessage{RowStatus: &status,- InstanceUID: &upsert.InstanceUID,+ InstanceID: &upsert.InstanceID,DatabaseUID: upsert.DatabaseUID,Types: []api.AnomalyType{upsert.Type},}@@ -90,7 +76,7 @@ func (s *Store) UpsertActiveAnomalyV2(ctx context.Context, principalUID int, upsvar anomaly *AnomalyMessageif len(list) == 0 {anomaly, err = s.createAnomalyImplV2(ctx, tx, principalUID, &AnomalyMessage{- InstanceUID: upsert.InstanceUID,+ InstanceID: upsert.InstanceID,DatabaseUID: upsert.DatabaseUID,Type: upsert.Type,Payload: upsert.Payload,@@ -101,7 +87,7 @@ func (s *Store) UpsertActiveAnomalyV2(ctx context.Context, principalUID int, ups} else if len(list) == 1 {// Even if field value does not change, we still patch to update the updated_ts.anomaly, err = updateAnomalyV2(ctx, tx, principalUID, &updateAnomalyMessage{- ID: list[0].ID,+ UID: list[0].UID,Payload: upsert.Payload,})if err != nil {@@ -141,10 +127,10 @@ func (s *Store) ListAnomalyV2(ctx context.Context, list *ListAnomalyMessage) ([]// ArchiveAnomalyV2 archives an anomaly.func (s *Store) ArchiveAnomalyV2(ctx context.Context, archive *ArchiveAnomalyMessage) error {- if archive.InstanceUID == nil && archive.DatabaseUID == nil {+ if archive.InstanceID == nil && archive.DatabaseUID == nil {return &common.Error{Code: common.Internal, Err: errors.Errorf("failed to close anomaly, should specify either instanceID or databaseID")}}- if archive.InstanceUID != nil && archive.DatabaseUID != nil {+ if archive.InstanceID != nil && archive.DatabaseUID != nil {return &common.Error{Code: common.Internal, Err: errors.Errorf("failed to close anomaly, should specify either instanceID or databaseID, but not both")}}@@ -155,11 +141,16 @@ func (s *Store) ArchiveAnomalyV2(ctx context.Context, archive *ArchiveAnomalyMesdefer tx.Rollback()// Remove row from database.- if archive.InstanceUID != nil {- result, err := tx.ExecContext(ctx,- `UPDATE anomaly SET row_status = $1 WHERE instance_id = $2 AND database_id IS NULL AND type = $3`,+ if archive.InstanceID != nil {+ result, err := tx.ExecContext(ctx, `+ UPDATE+ anomaly+ SET anomaly.row_status = $1+ FROM instance+ WHERE anomaly.instance_id = instance.id AND instance.resource_id = $2 AND anomaly.database_id IS NULL AND anomaly.type = $3+ `,api.Archived,- *archive.InstanceUID,+ *archive.InstanceID,archive.Type,)if err != nil {@@ -167,7 +158,7 @@ func (s *Store) ArchiveAnomalyV2(ctx context.Context, archive *ArchiveAnomalyMes}if rows, _ := result.RowsAffected(); rows == 0 {- return &common.Error{Code: common.NotFound, Err: errors.Errorf("anomaly not found instance: %d type: %s", *archive.InstanceUID, archive.Type)}+ return &common.Error{Code: common.NotFound, Err: errors.Errorf("anomaly not found with instance %s and type %s", *archive.InstanceID, archive.Type)}}} else if archive.DatabaseUID != nil {result, err := tx.ExecContext(ctx,@@ -191,11 +182,20 @@ func (s *Store) ArchiveAnomalyV2(ctx context.Context, archive *ArchiveAnomalyMesreturn nil}-func (*Store) createAnomalyImplV2(ctx context.Context, tx *Tx, principalUID int, create *AnomalyMessage) (*AnomalyMessage, error) {+func (s *Store) createAnomalyImplV2(ctx context.Context, tx *Tx, principalUID int, create *AnomalyMessage) (*AnomalyMessage, error) {// Inserts row into database.if create.Payload == "" {create.Payload = "{}"}++ instance, err := s.GetInstanceV2(ctx, &FindInstanceMessage{ResourceID: &create.InstanceID})+ if err != nil {+ return nil, err+ }+ if instance == nil {+ return nil, errors.Errorf("instance %q not found", create.InstanceID)+ }+query := `INSERT INTO anomaly (creator_id,@@ -206,20 +206,19 @@ func (*Store) createAnomalyImplV2(ctx context.Context, tx *Tx, principalUID int,payload)VALUES ($1, $2, $3, $4, $5, $6)- RETURNING id, instance_id, database_id, type, payload+ RETURNING id, database_id, type, payload`var anomaly AnomalyMessagevar databaseUID sql.NullInt32if err := tx.QueryRowContext(ctx, query,principalUID,principalUID,- create.InstanceUID,+ instance.UID,create.DatabaseUID,create.Type,create.Payload,).Scan(- &anomaly.ID,- &anomaly.InstanceUID,+ &anomaly.UID,&databaseUID,&anomaly.Type,&anomaly.Payload,@@ -233,6 +232,7 @@ func (*Store) createAnomalyImplV2(ctx context.Context, tx *Tx, principalUID int,value := int(databaseUID.Int32)anomaly.DatabaseUID = &value}+ anomaly.InstanceID = instance.ResourceIDreturn &anomaly, nil}@@ -240,37 +240,40 @@ func (*Store) createAnomalyImplV2(ctx context.Context, tx *Tx, principalUID int,func (*Store) listAnomalyImplV2(ctx context.Context, tx *Tx, list *ListAnomalyMessage) ([]*AnomalyMessage, error) {where, args := []string{"TRUE"}, []any{}if v := list.RowStatus; v != nil {- where, args = append(where, fmt.Sprintf("row_status = $%d", len(args)+1)), append(args, *v)+ where, args = append(where, fmt.Sprintf("anomaly.row_status = $%d", len(args)+1)), append(args, *v)}- if v := list.InstanceUID; v != nil {- where, args = append(where, fmt.Sprintf("instance_id = $%d", len(args)+1)), append(args, *v)+ if v := list.InstanceID; v != nil {+ where, args = append(where, fmt.Sprintf("instance.resource_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)+ where, args = append(where, fmt.Sprintf("anomaly.database_id = $%d", len(args)+1)), append(args, *v)}if len(list.Types) > 0 {var sub []stringfor _, 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, `,`)))+ where = append(where, fmt.Sprintf("anomaly.type IN (%s)", strings.Join(sub, `,`)))}query := fmt.Sprintf(`SELECT- id,- created_ts,- updated_ts,- 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'- ))+ anomaly.id,+ anomaly.created_ts,+ anomaly.updated_ts,+ instance.resource_id AS instance_id,+ anomaly.database_id,+ anomaly.type,+ anomaly.payload+ FROM anomaly+ LEFT JOIN instance ON anomaly.instance_id = instance.id+ WHERE (%s+ AND EXISTS (+ SELECT 1+ FROM instance+ WHERE instance.id = anomaly.instance_id AND instance.row_status != 'ARCHIVED'+ )+ )`, strings.Join(where, " AND "))rows, err := tx.QueryContext(ctx, query, args...)@@ -285,10 +288,10 @@ func (*Store) listAnomalyImplV2(ctx context.Context, tx *Tx, list *ListAnomalyMe// DatabaseID field can be NULL in the PostgreSQL database, so we use sql.NullInt32 to represent it.var databaseID sql.NullInt32if err := rows.Scan(- &anomaly.ID,+ &anomaly.UID,&anomaly.CreatedTs,&anomaly.UpdatedTs,- &anomaly.InstanceUID,+ &anomaly.InstanceID,&databaseID,&anomaly.Type,&anomaly.Payload,@@ -314,24 +317,32 @@ func updateAnomalyV2(ctx context.Context, tx *Tx, principalUID int, update *updaif update.Payload == "" {update.Payload = "{}"}- set, args := []string{"updater_id = $1"}, []any{principalUID}- set, args = append(set, "payload = $2"), append(args, update.Payload)- args = append(args, update.ID)+ set, args := []string{"anomaly.updater_id = $1"}, []any{principalUID}+ set, args = append(set, "anomaly.payload = $2"), append(args, update.Payload)+ args = append(args, update.UID)// Execute update query with RETURNING.query := `UPDATE anomalySET ` + strings.Join(set, ", ") + `- WHERE id = $3- RETURNING id, created_ts, updated_ts, instance_id, database_id, type, payload+ FROM instance+ WHERE anomaly.instance_id = instance.id AND anomaly.id = $3+ RETURNING+ anomaly.id,+ anomaly.created_ts,+ anomaly.updated_ts,+ instance.resource_id AS instance_id,+ anomaly.database_id,+ anomaly.type,+ anomaly.payload`var anomaly AnomalyMessagevar databaseID sql.NullInt32if err := tx.QueryRowContext(ctx, query, args...).Scan(- &anomaly.ID,+ &anomaly.UID,&anomaly.CreatedTs,&anomaly.UpdatedTs,- &anomaly.InstanceUID,+ &anomaly.InstanceID,&databaseID,&anomaly.Type,&anomaly.Payload,diff --git a/frontend/src/components/AnomalyTable.vue b/frontend/src/components/AnomalyTable.vueindex ea9f4b9413..5d55d812be 100644--- a/frontend/src/components/AnomalyTable.vue+++ b/frontend/src/components/AnomalyTable.vue@@ -21,15 +21,15 @@<template #body="{ rowData: anomaly }"><BBTableCell :left-padding="4"><heroicons-outline:information-circle- v-if="anomaly.severity == 'MEDIUM'"+ v-if="anomaly.severity == Anomaly_AnomalySeverity.MEDIUM"class="w-6 h-6 text-info"/><heroicons-outline:exclamation- v-else-if="anomaly.severity == 'HIGH'"+ v-else-if="anomaly.severity == Anomaly_AnomalySeverity.HIGH"class="w-6 h-6 text-warning"/><heroicons-outline:exclamation-circle- v-else-if="anomaly.severity == 'CRITICAL'"+ v-else-if="anomaly.severity == Anomaly_AnomalySeverity.CRITICAL"class="w-6 h-6 text-error"/></BBTableCell>@@ -43,24 +43,24 @@</span></BBTableCell><BBTableCell>- {{ humanizeTs(anomaly.updatedTs) }}+ {{ humanizeTs((anomaly.updateTime?.getTime() ?? 0) / 1000) }}</BBTableCell><BBTableCell>- {{ humanizeTs(anomaly.createdTs) }}+ {{ humanizeTs((anomaly.createTime?.getTime() ?? 0) / 1000) }}</BBTableCell></template></BBTable><BBModalv-if="schemaDriftDetail"- :title="`'${schemaDriftDetail.database.databaseName}' schema drift - ${schemaDriftDetail.payload.version} vs Actual`"+ :title="`'${schemaDriftDetail.database.databaseName}' schema drift - ${schemaDriftDetail.payload?.recordVersion} vs Actual`"@close="dismissModal"><div class="space-y-4"><code-diffclass="w-full"- :old-string="schemaDriftDetail.payload.expect"- :new-string="schemaDriftDetail.payload.actual"- :file-name="`${schemaDriftDetail.payload.version} (left) vs Actual (right)`"+ :old-string="schemaDriftDetail.payload?.expectedSchema"+ :new-string="schemaDriftDetail.payload?.actualSchema"+ :file-name="`${schemaDriftDetail.payload?.recordVersion} (left) vs Actual (right)`"output-format="side-by-side"/><div class="flex justify-end px-4">@@ -72,24 +72,21 @@</BBModal></template>-<script lang="ts">-import { computed, defineComponent, PropType, reactive } from "vue";+<script lang="ts" setup>+import { computed, PropType, reactive } from "vue";import { useRouter } from "vue-router";import { CodeDiff } from "v-code-diff";import { useI18n } from "vue-i18n";import { BBTableSectionDataSource } from "../bbkit/types";-import {- Anomaly,- AnomalyDatabaseBackupMissingPayload,- AnomalyDatabaseBackupPolicyViolationPayload,- AnomalyDatabaseConnectionPayload,- AnomalyDatabaseSchemaDriftPayload,- AnomalyInstanceConnectionPayload,- AnomalyType,-} from "../types";+import { UNKNOWN_ENVIRONMENT_NAME } from "../types";import { databaseV1Slug, instanceV1Slug, humanizeTs } from "../utils";import { useDatabaseV1Store, useInstanceV1Store } from "@/store";import { useEnvironmentV1Store } from "@/store";+import {+ Anomaly,+ Anomaly_AnomalyType,+ Anomaly_AnomalySeverity,+} from "@/types/proto/v1/anomaly_service";type Action = {onClick: () => void;@@ -101,226 +98,208 @@ interface LocalState {selectedAnomaly?: Anomaly;}-export default defineComponent({- name: "AnomalyTable",- components: { CodeDiff },- props: {- anomalySectionList: {- required: true,- type: Object as PropType<BBTableSectionDataSource<Anomaly>[]>,- },- compactSection: {- default: true,- type: Boolean,- },+defineProps({+ anomalySectionList: {+ required: true,+ type: Object as PropType<BBTableSectionDataSource<Anomaly>[]>,},- setup() {- const router = useRouter();- const { t } = useI18n();+ compactSection: {+ default: true,+ type: Boolean,+ },+});- const state = reactive<LocalState>({- showModal: false,- });+const router = useRouter();+const { t } = useI18n();- const columnList = computed(() => [- {- title: "",- },- {- title: t("common.type"),- },- {- title: t("common.detail"),- },- {- title: t("anomaly.last-seen"),- },- {- title: t("anomaly.first-seen"),- },- ]);+const state = reactive<LocalState>({+ showModal: false,+});- const typeName = (type: AnomalyType): string => {- switch (type) {- case "bb.anomaly.instance.connection":- return t("anomaly.types.connection-failure");- case "bb.anomaly.instance.migration-schema":- return t("anomaly.types.missing-migration-schema");- case "bb.anomaly.database.backup.policy-violation":- return t("anomaly.types.backup-enforcement-violation");- case "bb.anomaly.database.backup.missing":- return t("anomaly.types.missing-backup");- case "bb.anomaly.database.connection":- return t("anomaly.types.connection-failure");- case "bb.anomaly.database.schema.drift":- return t("anomaly.types.schema-drift");- }- };+const columnList = computed(() => [+ {+ title: "",+ },+ {+ title: t("common.type"),+ },+ {+ title: t("common.detail"),+ },+ {+ title: t("anomaly.last-seen"),+ },+ {+ title: t("anomaly.first-seen"),+ },+]);- const detail = (anomaly: Anomaly): string => {- switch (anomaly.type) {- case "bb.anomaly.instance.connection": {- const payload = anomaly.payload as AnomalyInstanceConnectionPayload;- return payload.detail;- }- case "bb.anomaly.instance.migration-schema":- return "Please create migration schema on the instance first.";- case "bb.anomaly.database.backup.policy-violation": {- const payload =- anomaly.payload as AnomalyDatabaseBackupPolicyViolationPayload;- const environment = useEnvironmentV1Store().getEnvironmentByUID(- String(payload.environmentId)- );- return `'${environment.title}' environment requires ${payload.expectedSchedule} auto-backup.`;- }- case "bb.anomaly.database.backup.missing": {- const payload =- anomaly.payload as AnomalyDatabaseBackupMissingPayload;- const missingSentence = `Missing ${payload.expectedSchedule} backup, `;- return (- missingSentence +- (payload.lastBackupTs- ? `last successful backup taken on ${humanizeTs(- payload.lastBackupTs- )}.`- : "no successful backup taken.")- );- }- case "bb.anomaly.database.connection": {- const payload = anomaly.payload as AnomalyDatabaseConnectionPayload;- return payload.detail;- }- case "bb.anomaly.database.schema.drift": {- const payload = anomaly.payload as AnomalyDatabaseSchemaDriftPayload;- return `Recorded latest schema version ${payload.version} is different from the actual schema.`;- }+const typeName = (type: Anomaly_AnomalyType): string => {+ switch (type) {+ case Anomaly_AnomalyType.INSTANCE_CONNECTION:+ return t("anomaly.types.connection-failure");+ case Anomaly_AnomalyType.MIGRATION_SCHEMA:+ return t("anomaly.types.missing-migration-schema");+ case Anomaly_AnomalyType.DATABASE_BACKUP_POLICY_VIOLATION:+ return t("anomaly.types.backup-enforcement-violation");+ case Anomaly_AnomalyType.DATABASE_BACKUP_MISSING:+ return t("anomaly.types.missing-backup");+ case Anomaly_AnomalyType.DATABASE_CONNECTION:+ return t("anomaly.types.connection-failure");+ case Anomaly_AnomalyType.DATABASE_SCHEMA_DRIFT:+ return t("anomaly.types.schema-drift");+ default:+ return "";+ }+};++const detail = (anomaly: Anomaly): string => {+ switch (anomaly.type) {+ case Anomaly_AnomalyType.INSTANCE_CONNECTION: {+ return anomaly.instanceConnectionDetail?.detail ?? "";+ }+ case Anomaly_AnomalyType.MIGRATION_SCHEMA:+ return "Please create migration schema on the instance first.";+ case Anomaly_AnomalyType.DATABASE_BACKUP_POLICY_VIOLATION: {+ const environment = useEnvironmentV1Store().getEnvironmentByName(+ anomaly.databaseBackupPolicyViolationDetail?.parent ??+ UNKNOWN_ENVIRONMENT_NAME+ );+ if (!environment) {+ return "";}- };+ return `'${environment.title}' environment requires ${anomaly.databaseBackupPolicyViolationDetail?.expectedSchedule} auto-backup.`;+ }+ case Anomaly_AnomalyType.DATABASE_BACKUP_MISSING: {+ const payload = anomaly.databaseBackupMissingDetail;+ const missingSentence = `Missing ${payload?.expectedSchedule} backup, `;+ return (+ missingSentence ++ (payload?.latestBackupTime+ ? `last successful backup taken on ${humanizeTs(+ (payload?.latestBackupTime.getTime() ?? 0) / 1000+ )}.`+ : "no successful backup taken.")+ );+ }+ case Anomaly_AnomalyType.DATABASE_CONNECTION: {+ return anomaly.databaseConnectionDetail?.detail ?? "";+ }+ case Anomaly_AnomalyType.DATABASE_SCHEMA_DRIFT: {+ return `Recorded latest schema version ${anomaly.databaseSchemaDriftDetail?.recordVersion} is different from the actual schema.`;+ }+ default:+ return "";+ }+};- const action = (anomaly: Anomaly): Action => {- switch (anomaly.type) {- case "bb.anomaly.instance.connection": {- const instance = useInstanceV1Store().getInstanceByUID(- String(anomaly.instanceId!)- );- return {- onClick: () => {- router.push({- name: "workspace.instance.detail",- params: {- instanceSlug: instanceV1Slug(instance),- },- });- },- title: t("anomaly.action.check-instance"),- };- }- case "bb.anomaly.instance.migration-schema": {- const instance = useInstanceV1Store().getInstanceByUID(- String(anomaly.instanceId!)- );- return {- onClick: () => {- router.push({- name: "workspace.instance.detail",- params: {- instanceSlug: instanceV1Slug(instance),- },- });+const action = (anomaly: Anomaly): Action => {+ switch (anomaly.type) {+ case Anomaly_AnomalyType.INSTANCE_CONNECTION: {+ const instance = useInstanceV1Store().getInstanceByName(anomaly.resource);+ return {+ onClick: () => {+ router.push({+ name: "workspace.instance.detail",+ params: {+ instanceSlug: instanceV1Slug(instance),},- title: t("anomaly.action.check-instance"),- };- }- case "bb.anomaly.database.backup.policy-violation": {- const database = useDatabaseV1Store().getDatabaseByUID(- String(anomaly.databaseId!)- );- return {- onClick: () => {- router.push({- name: "workspace.database.detail",- params: {- databaseSlug: databaseV1Slug(database),- },- hash: "#backup-and-restore",- });+ });+ },+ title: t("anomaly.action.check-instance"),+ };+ }+ case Anomaly_AnomalyType.MIGRATION_SCHEMA: {+ const instance = useInstanceV1Store().getInstanceByName(anomaly.resource);+ return {+ onClick: () => {+ router.push({+ name: "workspace.instance.detail",+ params: {+ instanceSlug: instanceV1Slug(instance),},- title: t("anomaly.action.configure-backup"),- };- }- case "bb.anomaly.database.backup.missing": {- const database = useDatabaseV1Store().getDatabaseByUID(- String(anomaly.databaseId!)- );- return {- onClick: () => {- router.push({- name: "workspace.database.detail",- params: {- databaseSlug: databaseV1Slug(database),- },- hash: "#backup-and-restore",- });+ });+ },+ title: t("anomaly.action.check-instance"),+ };+ }+ case Anomaly_AnomalyType.DATABASE_BACKUP_POLICY_VIOLATION: {+ const database = useDatabaseV1Store().getDatabaseByName(anomaly.resource);+ return {+ onClick: () => {+ router.push({+ name: "workspace.database.detail",+ params: {+ databaseSlug: databaseV1Slug(database),},- title: t("anomaly.action.view-backup"),- };- }- case "bb.anomaly.database.connection": {- const instance = useInstanceV1Store().getInstanceByUID(- String(anomaly.instanceId!)- );- return {- onClick: () => {- router.push({- name: "workspace.instance.detail",- params: {- instanceSlug: instanceV1Slug(instance),- },- });+ hash: "#backup-and-restore",+ });+ },+ title: t("anomaly.action.configure-backup"),+ };+ }+ case Anomaly_AnomalyType.DATABASE_BACKUP_MISSING: {+ const database = useDatabaseV1Store().getDatabaseByName(anomaly.resource);+ return {+ onClick: () => {+ router.push({+ name: "workspace.database.detail",+ params: {+ databaseSlug: databaseV1Slug(database),},- title: t("anomaly.action.check-instance"),- };- }- case "bb.anomaly.database.schema.drift":- return {- onClick: () => {- state.selectedAnomaly = anomaly;- state.showModal = true;- useDatabaseV1Store().getOrFetchDatabaseByUID(- String(anomaly.databaseId!)- );+ hash: "#backup-and-restore",+ });+ },+ title: t("anomaly.action.view-backup"),+ };+ }+ case Anomaly_AnomalyType.DATABASE_CONNECTION: {+ const instance = useInstanceV1Store().getInstanceByName(anomaly.resource);+ return {+ onClick: () => {+ router.push({+ name: "workspace.instance.detail",+ params: {+ instanceSlug: instanceV1Slug(instance),},- title: t("anomaly.action.view-diff"),- };- }- };-- const schemaDriftDetail = computed(() => {- if (state.showModal && state.selectedAnomaly) {- const anomaly = state.selectedAnomaly;- const payload = anomaly.payload as AnomalyDatabaseSchemaDriftPayload;- const database = useDatabaseV1Store().getDatabaseByUID(- String(anomaly.databaseId!)- );- return { anomaly, payload, database };- }- return undefined;- });-- const dismissModal = () => {- state.showModal = false;- state.selectedAnomaly = undefined;- };+ });+ },+ title: t("anomaly.action.check-instance"),+ };+ }+ case Anomaly_AnomalyType.DATABASE_SCHEMA_DRIFT:+ return {+ onClick: () => {+ state.selectedAnomaly = anomaly;+ state.showModal = true;+ useDatabaseV1Store().getOrFetchDatabaseByName(anomaly.resource);+ },+ title: t("anomaly.action.view-diff"),+ };+ default:+ return {+ // eslint-disable-next-line @typescript-eslint/no-empty-function+ onClick: () => {},+ title: "",+ };+ }+};+const schemaDriftDetail = computed(() => {+ if (state.showModal && state.selectedAnomaly) {+ const anomaly = state.selectedAnomaly;+ const database = useDatabaseV1Store().getDatabaseByName(anomaly.resource);return {- columnList,- state,- typeName,- detail,- action,- schemaDriftDetail,- dismissModal,+ anomaly,+ payload: anomaly.databaseSchemaDriftDetail,+ database,};- },+ }+ return undefined;});++const dismissModal = () => {+ state.showModal = false;+ state.selectedAnomaly = undefined;+};</script>diff --git a/frontend/src/components/DatabaseOverviewPanel.vue b/frontend/src/components/DatabaseOverviewPanel.vueindex 1332ac1420..6f3f525273 100644--- a/frontend/src/components/DatabaseOverviewPanel.vue+++ b/frontend/src/components/DatabaseOverviewPanel.vue@@ -145,14 +145,15 @@<script lang="ts" setup>import { head } from "lodash-es";import { computed, reactive, watchEffect, PropType } from "vue";-import { Anomaly, ComposedDatabase, DataSource } from "../types";-import { useAnomalyList, useDBSchemaV1Store } from "@/store";+import { ComposedDatabase, DataSource } from "../types";+import { useAnomalyV1List, useDBSchemaV1Store } from "@/store";import { BBTableSectionDataSource } from "../bbkit/types";import AnomalyTable from "../components/AnomalyTable.vue";import TableTable from "../components/TableTable.vue";import ViewTable from "../components/ViewTable.vue";import FunctionTable from "../components/FunctionTable.vue";import { Engine, State } from "@/types/proto/v1/common";+import { Anomaly } from "@/types/proto/v1/anomaly_service";interface LocalState {selectedSchemaName: string;@@ -195,8 +196,8 @@ const prepareDatabaseMetadata = async () => {watchEffect(prepareDatabaseMetadata);-const anomalyList = useAnomalyList(- computed(() => ({ databaseId: Number(props.database.uid) }))+const anomalyList = useAnomalyV1List(+ computed(() => ({ database: props.database.name })));const anomalySectionList = computed((): BBTableSectionDataSource<Anomaly>[] => {diff --git a/frontend/src/grpcweb/index.ts b/frontend/src/grpcweb/index.tsindex f53844204e..782be64874 100644--- a/frontend/src/grpcweb/index.ts+++ b/frontend/src/grpcweb/index.ts@@ -28,6 +28,7 @@ import { ExternalVersionControlServiceDefinition } from "@/types/proto/v1/externimport { LoggingServiceDefinition } from "@/types/proto/v1/logging_service";import { BookmarkServiceDefinition } from "@/types/proto/v1/bookmark_service";import { InboxServiceDefinition } from "@/types/proto/v1/inbox_service";+import { AnomalyServiceDefinition } from "@/types/proto/v1/anomaly_service";// Create each grpc service client.// Reference: https://github.com/deeplay-io/nice-grpc/blob/master/packages/nice-grpc-web/README.md@@ -160,6 +161,11 @@ export const inboxServiceClient = clientFactory.create(channel);+export const anomalyServiceClient = clientFactory.create(+ AnomalyServiceDefinition,+ channel+);+// e.g. How to use `authServiceClient`?//// await authServiceClient.login({diff --git a/frontend/src/store/modules/anomaly.ts b/frontend/src/store/modules/anomaly.tsdeleted file mode 100644index 961aa85e2c..0000000000--- a/frontend/src/store/modules/anomaly.ts+++ /dev/null@@ -1,114 +0,0 @@-import { defineStore } from "pinia";-import QueryString from "qs";-import axios from "axios";-import { computed, ref, unref, watch } from "vue";-import {- Anomaly,- AnomalyFind,- ResourceObject,- ResourceObjects,- ResponseWithData,- UNKNOWN_ID,- MaybeRef,- unknown,- Instance,- Database,- InstanceId,- DatabaseId,-} from "@/types";-import { getPrincipalFromIncludedList } from "./principal";-import { useLegacyDatabaseStore, useLegacyInstanceStore } from ".";--function convert(- anomaly: ResourceObject,- includedList: ResourceObject[]-): Anomaly {- const instanceId = anomaly.attributes.instanceId as InstanceId;- let instance: Instance = unknown("INSTANCE") as Instance;- const databaseId = anomaly.attributes.databaseId as DatabaseId;- let database: Database = unknown("DATABASE") as Database;-- const instanceStore = useLegacyInstanceStore();- const databaseStore = useLegacyDatabaseStore();- for (const item of includedList || []) {- if (item.type == "instance" && item.id == String(instanceId)) {- instance = instanceStore.convert(item, includedList);- }- if (item.type == "database" && item.id == String(databaseId)) {- database = databaseStore.convert(item, includedList);- }- }-- return {- ...(anomaly.attributes as Omit<- Anomaly,- "id" | "payload" | "creator" | "updater" | "instance" | "database"- >),- creator: getPrincipalFromIncludedList(- anomaly.relationships!.creator.data,- includedList- ),- updater: getPrincipalFromIncludedList(- anomaly.relationships!.updater.data,- includedList- ),- id: parseInt(anomaly.id),- payload: JSON.parse((anomaly.attributes.payload as string) || "{}"),- instance,- database,- };-}--export const useAnomalyStore = defineStore("anomaly", {- actions: {- convert(anomaly: ResourceObject): Anomaly {- // Pass includedList with [] here, otherwise, it may cause cyclic dependency- // e.g. Database calls this to convert its dataSourceList, while data source here- // also tries to convert its database.- return convert(anomaly, []);- },- async fetchAnomalyList(find: AnomalyFind) {- const api = "/api/anomaly";- const url = `${api}?${buildQueryByAnomalyFind(find)}`;- const response = await axios.get(url);- const responseData = response.data as ResponseWithData<ResourceObjects>;- const anomalyList = responseData.data.map((resourceObj) =>- convert(resourceObj, responseData.included || [])- );- return anomalyList;- },- },-});--const buildQueryByAnomalyFind = (find: AnomalyFind): string => {- const query: Record<string, any> = {};- if (find.instanceId && find.instanceId !== UNKNOWN_ID) {- query.instance = find.instanceId;- }- if (find.databaseId && find.databaseId !== UNKNOWN_ID) {- query.database = find.databaseId;- }- if (find.rowStatus) {- query.rowStatus = find.rowStatus;- }- if (find.type) {- query.type = find.type;- }- return QueryString.stringify(query);-};--export const useAnomalyList = (find: MaybeRef<AnomalyFind> = {}) => {- const store = useAnomalyStore();- const query = computed(() => buildQueryByAnomalyFind(unref(find)));- const list = ref<Anomaly[]>([]);- watch(- query,- () => {- store- .fetchAnomalyList(unref(find))- .then((result) => (list.value = result));- },- { immediate: true }- );- return list;-};diff --git a/frontend/src/store/modules/index.ts b/frontend/src/store/modules/index.tsindex d6d6dd08ea..e85d117f1e 100644--- a/frontend/src/store/modules/index.ts+++ b/frontend/src/store/modules/index.ts@@ -1,5 +1,4 @@export * from "./activity";-export * from "./anomaly";export * from "./auth";export * from "./command";export * from "./database";diff --git a/frontend/src/store/modules/v1/anomaly.ts b/frontend/src/store/modules/v1/anomaly.tsnew file mode 100644index 0000000000..26ffff6b4a--- /dev/null+++ b/frontend/src/store/modules/v1/anomaly.ts@@ -0,0 +1,46 @@+import { computed, ref, unref, watch } from "vue";+import { defineStore } from "pinia";++import { anomalyServiceClient } from "@/grpcweb";+import { Anomaly } from "@/types/proto/v1/anomaly_service";+import { FindAnomalyMessage, MaybeRef } from "@/types";++const buildFilter = (find: FindAnomalyMessage): string => {+ const filter: string[] = [];+ if (find.instance) {+ filter.push(`resource = "${find.instance}".`);+ } else if (find.database) {+ filter.push(`resource = "${find.database}".`);+ }+ if (find.type) {+ filter.push(`type = "${find.type}".`);+ }+ return filter.join(" && ");+};++export const useAnomalyV1Store = defineStore("anomaly_v1", {+ actions: {+ async fetchAnomalyList(find: FindAnomalyMessage) {+ const resp = await anomalyServiceClient.searchAnomalies({+ filter: buildFilter(find),+ });+ return resp.anomalies;+ },+ },+});++export const useAnomalyV1List = (find: MaybeRef<FindAnomalyMessage> = {}) => {+ const store = useAnomalyV1Store();+ const query = computed(() => buildFilter(unref(find)));+ const list = ref<Anomaly[]>([]);+ watch(+ query,+ () => {+ store.fetchAnomalyList(unref(find)).then((result) => {+ list.value = result;+ });+ },+ { immediate: true }+ );+ return list;+};diff --git a/frontend/src/store/modules/v1/index.ts b/frontend/src/store/modules/v1/index.tsindex 734c67290b..2a131bf033 100644--- a/frontend/src/store/modules/v1/index.ts+++ b/frontend/src/store/modules/v1/index.ts@@ -20,3 +20,4 @@ export * from "./dbSchema";export * from "./activity";export * from "./bookmark";export * from "./inbox";+export * from "./anomaly";diff --git a/frontend/src/types/anomaly.ts b/frontend/src/types/anomaly.tsindex fc00229862..dde4cff473 100644--- a/frontend/src/types/anomaly.ts+++ b/frontend/src/types/anomaly.ts@@ -1,79 +1,7 @@-import {- AnomalyId,- Database,- DatabaseId,- EnvironmentId,- Instance,- InstanceId,- Principal,- RowStatus,-} from ".";-import { BackupPlanSchedule } from "@/types/proto/v1/org_policy_service";+import { Anomaly_AnomalyType } from "@/types/proto/v1/anomaly_service";-export type AnomalyType =- | "bb.anomaly.instance.connection"- | "bb.anomaly.instance.migration-schema"- | "bb.anomaly.database.backup.policy-violation"- | "bb.anomaly.database.backup.missing"- | "bb.anomaly.database.connection"- | "bb.anomaly.database.schema.drift";--export type AnomalyInstanceConnectionPayload = {- detail: string;-};--export type AnomalyDatabaseBackupPolicyViolationPayload = {- environmentId: EnvironmentId;- expectedSchedule: BackupPlanSchedule;- actualSchedule: BackupPlanSchedule;-};--export type AnomalyDatabaseBackupMissingPayload = {- expectedSchedule: BackupPlanSchedule;- lastBackupTs: number;-};--export type AnomalyDatabaseConnectionPayload = {- detail: string;-};--export type AnomalyDatabaseSchemaDriftPayload = {- version: string;- expect: string;- actual: string;-};--export type AnomalyPayload =- | AnomalyDatabaseBackupPolicyViolationPayload- | AnomalyDatabaseBackupMissingPayload- | AnomalyDatabaseConnectionPayload- | AnomalyDatabaseSchemaDriftPayload;--export type AnomalySeverity = "MEDIUM" | "HIGH" | "CRITICAL";--export type Anomaly = {- id: AnomalyId;-- // Related fields- instanceId: InstanceId;- instance: Instance;- databaseId?: DatabaseId;- database?: Database;-- // Standard fields- creator: Principal;- createdTs: number;- updater: Principal;- updatedTs: number;-- type: AnomalyType;- severity: AnomalySeverity;- payload: AnomalyPayload;-};--export type AnomalyFind = {- instanceId?: InstanceId;- databaseId?: DatabaseId;- rowStatus?: RowStatus;- type?: AnomalyType;-};+export interface FindAnomalyMessage {+ instance?: string;+ database?: string;+ type?: Anomaly_AnomalyType;+}diff --git a/frontend/src/types/common.ts b/frontend/src/types/common.tsindex d949ac925d..afe70a4719 100644--- a/frontend/src/types/common.ts+++ b/frontend/src/types/common.ts@@ -1,4 +1,3 @@-import { Anomaly } from "./anomaly";import { BackupSetting } from "./backup";import { EMPTY_ID, UNKNOWN_ID } from "./const";import { Database } from "./database";@@ -12,7 +11,6 @@ import { Principal } from "./principal";import { Project, ProjectMember } from "./project";import { VCS } from "./vcs";import { SQLReviewPolicy } from "./sqlReview";-import { BackupPlanSchedule } from "@/types/proto/v1/org_policy_service";// System bot idexport const SYSTEM_BOT_ID = 1;@@ -115,7 +113,6 @@ interface ResourceMaker {(type: "TASK_PROGRESS"): TaskProgress;(type: "TASK"): Task;(type: "VCS"): VCS;- (type: "ANOMALY"): Anomaly;(type: "SQL_REVIEW"): SQLReviewPolicy;}@@ -298,25 +295,6 @@ const makeUnknown = (type: ResourceType) => {secret: "",};- const UNKNOWN_ANOMALY: Anomaly = {- id: UNKNOWN_ID,- creator: UNKNOWN_PRINCIPAL,- createdTs: 0,- updater: UNKNOWN_PRINCIPAL,- updatedTs: 0,- instanceId: UNKNOWN_ID,- instance: UNKNOWN_INSTANCE,- databaseId: UNKNOWN_ID,- database: UNKNOWN_DATABASE,- type: "bb.anomaly.database.backup.policy-violation",- severity: "MEDIUM",- payload: {- environmentId: UNKNOWN_ID,- expectedSchedule: BackupPlanSchedule.DAILY,- actualSchedule: BackupPlanSchedule.UNSET,- },- };-switch (type) {case "PRINCIPAL":return UNKNOWN_PRINCIPAL;@@ -346,8 +324,6 @@ const makeUnknown = (type: ResourceType) => {return UNKNOWN_TASK;case "VCS":return UNKNOWN_VCS;- case "ANOMALY":- return UNKNOWN_ANOMALY;}};@@ -532,25 +508,6 @@ const makeEmpty = (type: ResourceType) => {secret: "",};- const EMPTY_ANOMALY: Anomaly = {- id: EMPTY_ID,- creator: EMPTY_PRINCIPAL,- createdTs: 0,- updater: EMPTY_PRINCIPAL,- updatedTs: 0,- instanceId: EMPTY_ID,- instance: EMPTY_INSTANCE,- databaseId: EMPTY_ID,- database: EMPTY_DATABASE,- type: "bb.anomaly.database.backup.policy-violation",- severity: "MEDIUM",- payload: {- environmentId: EMPTY_ID,- expectedSchedule: BackupPlanSchedule.DAILY,- actualSchedule: BackupPlanSchedule.UNSET,- },- };-switch (type) {case "PRINCIPAL":return EMPTY_PRINCIPAL;@@ -580,8 +537,6 @@ const makeEmpty = (type: ResourceType) => {return EMPTY_TASK;case "VCS":return EMPTY_VCS;- case "ANOMALY":- return EMPTY_ANOMALY;}};diff --git a/frontend/src/types/id.ts b/frontend/src/types/id.tsindex 60befd8577..5c98a83ad7 100644--- a/frontend/src/types/id.ts+++ b/frontend/src/types/id.ts@@ -50,8 +50,6 @@ export type BackupId = IdType;export type BackupSettingId = IdType;-export type AnomalyId = IdType;-export type CommandId = string;export type CommandRegisterId = string;diff --git a/frontend/src/types/proto/v1/anomaly_service.ts b/frontend/src/types/proto/v1/anomaly_service.tsindex 56aaf3b65f..e8b0e665b5 100644--- a/frontend/src/types/proto/v1/anomaly_service.ts+++ b/frontend/src/types/proto/v1/anomaly_service.ts@@ -2,6 +2,7 @@import type { CallContext, CallOptions } from "nice-grpc-common";import * as _m0 from "protobufjs/minimal";import { Timestamp } from "../google/protobuf/timestamp";+import { BackupPlanSchedule, backupPlanScheduleFromJSON, backupPlanScheduleToJSON } from "./org_policy_service";export const protobufPackage = "bytebase.v1";@@ -59,6 +60,8 @@ export interface Anomaly {databaseBackupPolicyViolationDetail?: Anomaly_DatabaseBackupPolicyViolationDetail | undefined;databaseBackupMissingDetail?: Anomaly_DatabaseBackupMissingDetail | undefined;databaseSchemaDriftDetail?: Anomaly_DatabaseSchemaDriftDetail | undefined;+ createTime?: Date;+ updateTime?: Date;}/** AnomalyType is the type of the anomaly. */@@ -194,56 +197,6 @@ export function anomaly_AnomalySeverityToJSON(object: Anomaly_AnomalySeverity):}}-/** BackupPlanSchedule is the backup plan schedule. */-export enum Anomaly_BackupPlanSchedule {- /** BACKUP_PLAN_SCHEDULE_UNSPECIFIED - Unspecified backup plan schedule. */- BACKUP_PLAN_SCHEDULE_UNSPECIFIED = 0,- /** UNSET - UNSET is the unset backup plan schedule. */- UNSET = 1,- /** DAILY - DAILY is the daily backup plan schedule. */- DAILY = 2,- /** WEEKLY - WEEKLY is the weekly backup plan schedule. */- WEEKLY = 3,- UNRECOGNIZED = -1,-}--export function anomaly_BackupPlanScheduleFromJSON(object: any): Anomaly_BackupPlanSchedule {- switch (object) {- case 0:- case "BACKUP_PLAN_SCHEDULE_UNSPECIFIED":- return Anomaly_BackupPlanSchedule.BACKUP_PLAN_SCHEDULE_UNSPECIFIED;- case 1:- case "UNSET":- return Anomaly_BackupPlanSchedule.UNSET;- case 2:- case "DAILY":- return Anomaly_BackupPlanSchedule.DAILY;- case 3:- case "WEEKLY":- return Anomaly_BackupPlanSchedule.WEEKLY;- case -1:- case "UNRECOGNIZED":- default:- return Anomaly_BackupPlanSchedule.UNRECOGNIZED;- }-}--export function anomaly_BackupPlanScheduleToJSON(object: Anomaly_BackupPlanSchedule): string {- switch (object) {- case Anomaly_BackupPlanSchedule.BACKUP_PLAN_SCHEDULE_UNSPECIFIED:- return "BACKUP_PLAN_SCHEDULE_UNSPECIFIED";- case Anomaly_BackupPlanSchedule.UNSET:- return "UNSET";- case Anomaly_BackupPlanSchedule.DAILY:- return "DAILY";- case Anomaly_BackupPlanSchedule.WEEKLY:- return "WEEKLY";- case Anomaly_BackupPlanSchedule.UNRECOGNIZED:- default:- return "UNRECOGNIZED";- }-}-/*** Instance level anomaly detail.*@@ -272,15 +225,15 @@ export interface Anomaly_DatabaseBackupPolicyViolationDetail {*/parent: string;/** expected_schedule is the expected backup plan schedule in the parent. */- expectedSchedule: Anomaly_BackupPlanSchedule;+ expectedSchedule: BackupPlanSchedule;/** actual_schedule is the actual backup plan schedule in the database. */- actualSchedule: Anomaly_BackupPlanSchedule;+ actualSchedule: BackupPlanSchedule;}/** DatabaseBackupMissingDetail is the detail for database backup missing anomaly. */export interface Anomaly_DatabaseBackupMissingDetail {/** expected_schedule is the expected backup plan schedule in the database. */- expectedSchedule: Anomaly_BackupPlanSchedule;+ expectedSchedule: BackupPlanSchedule;/** latest_backup_time is the latest backup time in the database. */latestBackupTime?: Date;}@@ -464,6 +417,8 @@ function createBaseAnomaly(): Anomaly {databaseBackupPolicyViolationDetail: undefined,databaseBackupMissingDetail: undefined,databaseSchemaDriftDetail: undefined,+ createTime: undefined,+ updateTime: undefined,};}@@ -497,6 +452,12 @@ export const Anomaly = {if (message.databaseSchemaDriftDetail !== undefined) {Anomaly_DatabaseSchemaDriftDetail.encode(message.databaseSchemaDriftDetail, writer.uint32(66).fork()).ldelim();}+ if (message.createTime !== undefined) {+ Timestamp.encode(toTimestamp(message.createTime), writer.uint32(74).fork()).ldelim();+ }+ if (message.updateTime !== undefined) {+ Timestamp.encode(toTimestamp(message.updateTime), writer.uint32(82).fork()).ldelim();+ }return writer;},@@ -566,6 +527,20 @@ export const Anomaly = {message.databaseSchemaDriftDetail = Anomaly_DatabaseSchemaDriftDetail.decode(reader, reader.uint32());continue;+ case 9:+ if (tag !== 74) {+ break;+ }++ message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));+ continue;+ case 10:+ if (tag !== 82) {+ break;+ }++ message.updateTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));+ continue;}if ((tag & 7) === 4 || tag === 0) {break;@@ -595,6 +570,8 @@ export const Anomaly = {databaseSchemaDriftDetail: isSet(object.databaseSchemaDriftDetail)? Anomaly_DatabaseSchemaDriftDetail.fromJSON(object.databaseSchemaDriftDetail): undefined,+ createTime: isSet(object.createTime) ? fromJsonTimestamp(object.createTime) : undefined,+ updateTime: isSet(object.updateTime) ? fromJsonTimestamp(object.updateTime) : undefined,};},@@ -621,6 +598,8 @@ export const Anomaly = {(obj.databaseSchemaDriftDetail = message.databaseSchemaDriftDetail? Anomaly_DatabaseSchemaDriftDetail.toJSON(message.databaseSchemaDriftDetail): undefined);+ message.createTime !== undefined && (obj.createTime = message.createTime.toISOString());+ message.updateTime !== undefined && (obj.updateTime = message.updateTime.toISOString());return obj;},@@ -653,6 +632,8 @@ export const Anomaly = {(object.databaseSchemaDriftDetail !== undefined && object.databaseSchemaDriftDetail !== null)? Anomaly_DatabaseSchemaDriftDetail.fromPartial(object.databaseSchemaDriftDetail): undefined;+ message.createTime = object.createTime ?? undefined;+ message.updateTime = object.updateTime ?? undefined;return message;},};@@ -827,10 +808,8 @@ export const Anomaly_DatabaseBackupPolicyViolationDetail = {fromJSON(object: any): Anomaly_DatabaseBackupPolicyViolationDetail {return {parent: isSet(object.parent) ? String(object.parent) : "",- expectedSchedule: isSet(object.expectedSchedule)- ? anomaly_BackupPlanScheduleFromJSON(object.expectedSchedule)- : 0,- actualSchedule: isSet(object.actualSchedule) ? anomaly_BackupPlanScheduleFromJSON(object.actualSchedule) : 0,+ expectedSchedule: isSet(object.expectedSchedule) ? backupPlanScheduleFromJSON(object.expectedSchedule) : 0,+ actualSchedule: isSet(object.actualSchedule) ? backupPlanScheduleFromJSON(object.actualSchedule) : 0,};},@@ -838,9 +817,8 @@ export const Anomaly_DatabaseBackupPolicyViolationDetail = {const obj: any = {};message.parent !== undefined && (obj.parent = message.parent);message.expectedSchedule !== undefined &&- (obj.expectedSchedule = anomaly_BackupPlanScheduleToJSON(message.expectedSchedule));- message.actualSchedule !== undefined &&- (obj.actualSchedule = anomaly_BackupPlanScheduleToJSON(message.actualSchedule));+ (obj.expectedSchedule = backupPlanScheduleToJSON(message.expectedSchedule));+ message.actualSchedule !== undefined && (obj.actualSchedule = backupPlanScheduleToJSON(message.actualSchedule));return obj;},@@ -906,9 +884,7 @@ export const Anomaly_DatabaseBackupMissingDetail = {fromJSON(object: any): Anomaly_DatabaseBackupMissingDetail {return {- expectedSchedule: isSet(object.expectedSchedule)- ? anomaly_BackupPlanScheduleFromJSON(object.expectedSchedule)- : 0,+ expectedSchedule: isSet(object.expectedSchedule) ? backupPlanScheduleFromJSON(object.expectedSchedule) : 0,latestBackupTime: isSet(object.latestBackupTime) ? fromJsonTimestamp(object.latestBackupTime) : undefined,};},@@ -916,7 +892,7 @@ export const Anomaly_DatabaseBackupMissingDetail = {toJSON(message: Anomaly_DatabaseBackupMissingDetail): unknown {const obj: any = {};message.expectedSchedule !== undefined &&- (obj.expectedSchedule = anomaly_BackupPlanScheduleToJSON(message.expectedSchedule));+ (obj.expectedSchedule = backupPlanScheduleToJSON(message.expectedSchedule));message.latestBackupTime !== undefined && (obj.latestBackupTime = message.latestBackupTime.toISOString());return obj;},diff --git a/frontend/src/types/store.ts b/frontend/src/types/store.tsindex 64170b748d..8eaadb1ea5 100644--- a/frontend/src/types/store.ts+++ b/frontend/src/types/store.ts@@ -85,9 +85,6 @@ export interface VCSState {vcsById: Map<VCSId, VCS>;}-// eslint-disable-next-line @typescript-eslint/no-empty-interface-export interface AnomalyState {}-export interface NotificationState {notificationByModule: Map<string, Notification[]>;}diff --git a/frontend/src/views/AnomalyCenterDashboard.vue b/frontend/src/views/AnomalyCenterDashboard.vueindex ff76591e16..35fbd0a66a 100644--- a/frontend/src/views/AnomalyCenterDashboard.vue+++ b/frontend/src/views/AnomalyCenterDashboard.vue@@ -131,7 +131,7 @@ import { useI18n } from "vue-i18n";import { cloneDeep } from "lodash-es";import AnomalyTable from "@/components/AnomalyTable.vue";-import { Anomaly, UNKNOWN_USER_NAME } from "../types";+import { UNKNOWN_USER_NAME } from "../types";import {databaseV1Slug,instanceV1Slug,@@ -142,12 +142,16 @@ import {import { BBTabFilterItem, BBTableSectionDataSource } from "@/bbkit/types";import {featureToRef,- useAnomalyList,+ useAnomalyV1List,useCurrentUserV1,useDatabaseV1Store,useEnvironmentV1List,useInstanceV1List,} from "@/store";+import {+ Anomaly,+ Anomaly_AnomalySeverity,+} from "@/types/proto/v1/anomaly_service";const DATABASE_TAB = 0;const INSTANCE_TAB = 1;@@ -202,7 +206,7 @@ export default defineComponent({const { instanceList } = useInstanceV1List();- const allAnomalyList = useAnomalyList();+ const allAnomalyList = useAnomalyV1List();const databaseAnomalySectionList = computed((): BBTableSectionDataSource<Anomaly>[] => {@@ -227,7 +231,7 @@ export default defineComponent({for (const database of dbList) {const anomalyListOfDatabase = allAnomalyList.value.filter(- (anomaly) => String(anomaly.databaseId) === String(database.uid)+ (anomaly) => anomaly.resource === database.name);if (anomalyListOfDatabase.length > 0) {@@ -265,8 +269,8 @@ export default defineComponent({insList = sortInstanceV1List(insList);for (const instance of insList) {- const anomalyListOfInstance = allAnomalyList.value.filter(- (anomaly) => String(anomaly.instanceId) === instance.uid+ const anomalyListOfInstance = allAnomalyList.value.filter((anomaly) =>+ anomaly.resource.startsWith(instance.name));if (anomalyListOfInstance.length > 0) {sectionList.push({@@ -288,17 +292,17 @@ export default defineComponent({let highCount = 0;let mediumCount = 0;const anomalyListOfDatabase = allAnomalyList.value.filter(- (anomaly) => String(anomaly.databaseId) === database.uid+ (anomaly) => anomaly.resource === database.name);for (const anomaly of anomalyListOfDatabase) {switch (anomaly.severity) {- case "CRITICAL":+ case Anomaly_AnomalySeverity.CRITICAL:criticalCount++;break;- case "HIGH":+ case Anomaly_AnomalySeverity.HIGH:highCount++;break;- case "MEDIUM":+ case Anomaly_AnomalySeverity.MEDIUM:mediumCount++;break;}@@ -338,17 +342,17 @@ export default defineComponent({let highCount = 0;let mediumCount = 0;const anomalyListOfInstance = allAnomalyList.value.filter(- (anomaly) => String(anomaly.instanceId) === instance.uid+ (anomaly) => anomaly.resource === instance.name);for (const anomaly of anomalyListOfInstance) {switch (anomaly.severity) {- case "CRITICAL":+ case Anomaly_AnomalySeverity.CRITICAL:criticalCount++;break;- case "HIGH":+ case Anomaly_AnomalySeverity.HIGH:highCount++;break;- case "MEDIUM":+ case Anomaly_AnomalySeverity.MEDIUM:mediumCount++;break;}diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.mdindex d3b7da021a..ce03aa743b 100644--- a/proto/gen/grpc-doc/v1/README.md+++ b/proto/gen/grpc-doc/v1/README.md@@ -14,6 +14,42 @@- [ActuatorService](#bytebase-v1-ActuatorService)+- [v1/common.proto](#v1_common-proto)+ - [Engine](#bytebase-v1-Engine)+ - [State](#bytebase-v1-State)++- [v1/deployment.proto](#v1_deployment-proto)+ - [DeploymentType](#bytebase-v1-DeploymentType)++- [v1/org_policy_service.proto](#v1_org_policy_service-proto)+ - [AccessControlPolicy](#bytebase-v1-AccessControlPolicy)+ - [AccessControlRule](#bytebase-v1-AccessControlRule)+ - [BackupPlanPolicy](#bytebase-v1-BackupPlanPolicy)+ - [CreatePolicyRequest](#bytebase-v1-CreatePolicyRequest)+ - [DeletePolicyRequest](#bytebase-v1-DeletePolicyRequest)+ - [DeploymentApprovalPolicy](#bytebase-v1-DeploymentApprovalPolicy)+ - [DeploymentApprovalStrategy](#bytebase-v1-DeploymentApprovalStrategy)+ - [GetPolicyRequest](#bytebase-v1-GetPolicyRequest)+ - [ListPoliciesRequest](#bytebase-v1-ListPoliciesRequest)+ - [ListPoliciesResponse](#bytebase-v1-ListPoliciesResponse)+ - [Policy](#bytebase-v1-Policy)+ - [SQLReviewPolicy](#bytebase-v1-SQLReviewPolicy)+ - [SQLReviewRule](#bytebase-v1-SQLReviewRule)+ - [SensitiveData](#bytebase-v1-SensitiveData)+ - [SensitiveDataPolicy](#bytebase-v1-SensitiveDataPolicy)+ - [SlowQueryPolicy](#bytebase-v1-SlowQueryPolicy)+ - [UpdatePolicyRequest](#bytebase-v1-UpdatePolicyRequest)++ - [ApprovalGroup](#bytebase-v1-ApprovalGroup)+ - [ApprovalStrategy](#bytebase-v1-ApprovalStrategy)+ - [BackupPlanSchedule](#bytebase-v1-BackupPlanSchedule)+ - [PolicyResourceType](#bytebase-v1-PolicyResourceType)+ - [PolicyType](#bytebase-v1-PolicyType)+ - [SQLReviewRuleLevel](#bytebase-v1-SQLReviewRuleLevel)+ - [SensitiveDataMaskType](#bytebase-v1-SensitiveDataMaskType)++ - [OrgPolicyService](#bytebase-v1-OrgPolicyService)+- [v1/anomaly_service.proto](#v1_anomaly_service-proto)- [Anomaly](#bytebase-v1-Anomaly)- [Anomaly.DatabaseBackupMissingDetail](#bytebase-v1-Anomaly-DatabaseBackupMissingDetail)@@ -26,14 +62,9 @@- [Anomaly.AnomalySeverity](#bytebase-v1-Anomaly-AnomalySeverity)- [Anomaly.AnomalyType](#bytebase-v1-Anomaly-AnomalyType)- - [Anomaly.BackupPlanSchedule](#bytebase-v1-Anomaly-BackupPlanSchedule)- [AnomalyService](#bytebase-v1-AnomalyService)-- [v1/common.proto](#v1_common-proto)- - [Engine](#bytebase-v1-Engine)- - [State](#bytebase-v1-State)-- [v1/auth_service.proto](#v1_auth_service-proto)- [CreateUserRequest](#bytebase-v1-CreateUserRequest)- [DeleteUserRequest](#bytebase-v1-DeleteUserRequest)@@ -138,9 +169,6 @@- [DatabaseService](#bytebase-v1-DatabaseService)-- [v1/deployment.proto](#v1_deployment-proto)- - [DeploymentType](#bytebase-v1-DeploymentType)-- [v1/environment_service.proto](#v1_environment_service-proto)- [CreateEnvironmentRequest](#bytebase-v1-CreateEnvironmentRequest)- [DeleteEnvironmentRequest](#bytebase-v1-DeleteEnvironmentRequest)@@ -256,35 +284,6 @@- [LoggingService](#bytebase-v1-LoggingService)-- [v1/org_policy_service.proto](#v1_org_policy_service-proto)- - [AccessControlPolicy](#bytebase-v1-AccessControlPolicy)- - [AccessControlRule](#bytebase-v1-AccessControlRule)- - [BackupPlanPolicy](#bytebase-v1-BackupPlanPolicy)- - [CreatePolicyRequest](#bytebase-v1-CreatePolicyRequest)- - [DeletePolicyRequest](#bytebase-v1-DeletePolicyRequest)- - [DeploymentApprovalPolicy](#bytebase-v1-DeploymentApprovalPolicy)- - [DeploymentApprovalStrategy](#bytebase-v1-DeploymentApprovalStrategy)- - [GetPolicyRequest](#bytebase-v1-GetPolicyRequest)- - [ListPoliciesRequest](#bytebase-v1-ListPoliciesRequest)- - [ListPoliciesResponse](#bytebase-v1-ListPoliciesResponse)- - [Policy](#bytebase-v1-Policy)- - [SQLReviewPolicy](#bytebase-v1-SQLReviewPolicy)- - [SQLReviewRule](#bytebase-v1-SQLReviewRule)- - [SensitiveData](#bytebase-v1-SensitiveData)- - [SensitiveDataPolicy](#bytebase-v1-SensitiveDataPolicy)- - [SlowQueryPolicy](#bytebase-v1-SlowQueryPolicy)- - [UpdatePolicyRequest](#bytebase-v1-UpdatePolicyRequest)-- - [ApprovalGroup](#bytebase-v1-ApprovalGroup)- - [ApprovalStrategy](#bytebase-v1-ApprovalStrategy)- - [BackupPlanSchedule](#bytebase-v1-BackupPlanSchedule)- - [PolicyResourceType](#bytebase-v1-PolicyResourceType)- - [PolicyType](#bytebase-v1-PolicyType)- - [SQLReviewRuleLevel](#bytebase-v1-SQLReviewRuleLevel)- - [SensitiveDataMaskType](#bytebase-v1-SensitiveDataMaskType)-- - [OrgPolicyService](#bytebase-v1-OrgPolicyService)-- [v1/project_service.proto](#v1_project_service-proto)- [Activity](#bytebase-v1-Activity)- [AddWebhookRequest](#bytebase-v1-AddWebhookRequest)@@ -674,649 +673,656 @@ When paginating, all other parameters provided to `ListDebugLog` must match the-<a name="v1_anomaly_service-proto"></a>+<a name="v1_common-proto"></a><p align="right"><a href="#top">Top</a></p>-## v1/anomaly_service.proto-+## v1/common.proto-<a name="bytebase-v1-Anomaly"></a>+-### Anomaly+<a name="bytebase-v1-Engine"></a>+### Engine-| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| resource | [string](#string) | | The resource that is the target of the operation. Format: - Instance: instnaces/{instance} - Database: instnaces/{instance}/databases/{database} |-| type | [Anomaly.AnomalyType](#bytebase-v1-Anomaly-AnomalyType) | | type is the type of the anomaly. |-| severity | [Anomaly.AnomalySeverity](#bytebase-v1-Anomaly-AnomalySeverity) | | severity is the severity of the anomaly. |-| instance_connection_detail | [Anomaly.InstanceConnectionDetail](#bytebase-v1-Anomaly-InstanceConnectionDetail) | | |-| database_connection_detail | [Anomaly.DatabaseConnectionDetail](#bytebase-v1-Anomaly-DatabaseConnectionDetail) | | |-| database_backup_policy_violation_detail | [Anomaly.DatabaseBackupPolicyViolationDetail](#bytebase-v1-Anomaly-DatabaseBackupPolicyViolationDetail) | | |-| database_backup_missing_detail | [Anomaly.DatabaseBackupMissingDetail](#bytebase-v1-Anomaly-DatabaseBackupMissingDetail) | | |-| database_schema_drift_detail | [Anomaly.DatabaseSchemaDriftDetail](#bytebase-v1-Anomaly-DatabaseSchemaDriftDetail) | | |+| Name | Number | Description |+| ---- | ------ | ----------- |+| ENGINE_UNSPECIFIED | 0 | |+| CLICKHOUSE | 1 | |+| MYSQL | 2 | |+| POSTGRES | 3 | |+| SNOWFLAKE | 4 | |+| SQLITE | 5 | |+| TIDB | 6 | |+| MONGODB | 7 | |+| REDIS | 8 | |+| ORACLE | 9 | |+| SPANNER | 10 | |+| MSSQL | 11 | |+| REDSHIFT | 12 | |+| MARIADB | 13 | |+| OCEANBASE | 14 | |+<a name="bytebase-v1-State"></a>+### State-<a name="bytebase-v1-Anomaly-DatabaseBackupMissingDetail"></a>-### Anomaly.DatabaseBackupMissingDetail-DatabaseBackupMissingDetail is the detail for database backup missing anomaly.+| Name | Number | Description |+| ---- | ------ | ----------- |+| STATE_UNSPECIFIED | 0 | |+| ACTIVE | 1 | |+| DELETED | 2 | |-| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| expected_schedule | [Anomaly.BackupPlanSchedule](#bytebase-v1-Anomaly-BackupPlanSchedule) | | expected_schedule is the expected backup plan schedule in the database. |-| latest_backup_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | latest_backup_time is the latest backup time in the database. |++++<a name="v1_deployment-proto"></a>+<p align="right"><a href="#top">Top</a></p>-<a name="bytebase-v1-Anomaly-DatabaseBackupPolicyViolationDetail"></a>+## v1/deployment.proto-### Anomaly.DatabaseBackupPolicyViolationDetail-DatabaseBackupPolicyViolationDetail is the detail for database backup policy violation anomaly.+-| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| parent | [string](#string) | | parent is the parent of the database. Format: environments/{environment} |-| expected_schedule | [Anomaly.BackupPlanSchedule](#bytebase-v1-Anomaly-BackupPlanSchedule) | | expected_schedule is the expected backup plan schedule in the parent. |-| actual_schedule | [Anomaly.BackupPlanSchedule](#bytebase-v1-Anomaly-BackupPlanSchedule) | | actual_schedule is the actual backup plan schedule in the database. |+<a name="bytebase-v1-DeploymentType"></a>+### DeploymentType+| Name | Number | Description |+| ---- | ------ | ----------- |+| DEPLOYMENT_TYPE_UNSPECIFIED | 0 | |+| DATABASE_CREATE | 1 | |+| DATABASE_DDL | 2 | |+| DATABASE_DDL_GHOST | 3 | |+| DATABASE_DML | 4 | |+| DATABASE_RESTORE_PITR | 5 | |-<a name="bytebase-v1-Anomaly-DatabaseConnectionDetail"></a>+-### Anomaly.DatabaseConnectionDetail-Database level anomaly detial.+-DatbaaseConnectionDetail is the detail for database connection anomaly.+-| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| detail | [string](#string) | | detail is the detail of the database connection failure. |+<a name="v1_org_policy_service-proto"></a>+<p align="right"><a href="#top">Top</a></p>+## v1/org_policy_service.proto+<a name="bytebase-v1-AccessControlPolicy"></a>-<a name="bytebase-v1-Anomaly-DatabaseSchemaDriftDetail"></a>+### AccessControlPolicy-### Anomaly.DatabaseSchemaDriftDetail-DatabaseSchemaDriftDetail is the detail for database schema drift anomaly.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| record_version | [string](#string) | | record_version is the record version of the database schema drift. |-| expected_schema | [string](#string) | | expected_schema is the expected schema in the database. |-| actual_schema | [string](#string) | | actual_schema is the actual schema in the database. |+| disallow_rules | [AccessControlRule](#bytebase-v1-AccessControlRule) | repeated | |-<a name="bytebase-v1-Anomaly-InstanceConnectionDetail"></a>+<a name="bytebase-v1-AccessControlRule"></a>-### Anomaly.InstanceConnectionDetail-Instance level anomaly detail.+### AccessControlRule-InstanceConnectionDetail is the detail for instance connection anomaly.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| detail | [string](#string) | | detail is the detail of the instance connection failure. |+| full_database | [bool](#bool) | | |-<a name="bytebase-v1-SearchAnomaliesRequest"></a>+<a name="bytebase-v1-BackupPlanPolicy"></a>-### SearchAnomaliesRequest+### BackupPlanPolicy| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| filter | [string](#string) | | filter is the filter to apply on the search anomaly request, 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: 'resource="instances/{instance}".' Search the specified types of anomalies: 'type="DATABASE_BACKUP_POLICY_VIOLATION" | "MIGRATION_SCHEMA".' |-| page_size | [int32](#int32) | | Not used. The maximum number of anomalies to return. The service may return fewer than this value. If unspecified, at most 50 anomalies will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |-| page_token | [string](#string) | | Not used. A page token, received from a previous `SearchAnomalies` call. Provide this to retrieve the subsequent page.--When paginating, all other parameters provided to `SearchAnomalies` must match the call that provided the page token. |+| schedule | [BackupPlanSchedule](#bytebase-v1-BackupPlanSchedule) | | |+| retention_duration | [google.protobuf.Duration](#google-protobuf-Duration) | | |-<a name="bytebase-v1-SearchAnomaliesResponse"></a>+<a name="bytebase-v1-CreatePolicyRequest"></a>-### SearchAnomaliesResponse+### CreatePolicyRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| anomalies | [Anomaly](#bytebase-v1-Anomaly) | repeated | anomalies is the list of anomalies. |-| next_page_token | [string](#string) | | Not used. A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. |-+| parent | [string](#string) | | The parent resource where this instance will be created. Workspace resource name: "". Environment resource name: environments/environment-id. Instance resource name: instances/instance-id. Database resource name: instances/instance-id/databases/database-name. |+| policy | [Policy](#bytebase-v1-Policy) | | The policy to create. |+| type | [PolicyType](#bytebase-v1-PolicyType) | | |--<a name="bytebase-v1-Anomaly-AnomalySeverity"></a>+<a name="bytebase-v1-DeletePolicyRequest"></a>-### Anomaly.AnomalySeverity-AnomalySeverity is the severity of the anomaly.+### DeletePolicyRequest-| Name | Number | Description |-| ---- | ------ | ----------- |-| ANOMALY_SEVERITY_UNSPECIFIED | 0 | Unspecified anomaly severity. |-| MEDIUM | 1 | MEDIUM is the info level anomaly severity. |-| HIGH | 2 | HIGH is the warning level anomaly severity. |-| CRITICAL | 3 | CRITICAL is the critical level anomaly severity. |+| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| name | [string](#string) | | The policy's `name` field is used to identify the instance to update. Format: {resource name}/policies/{policy type} Workspace resource name: "". Environment resource name: environments/environment-id. Instance resource name: instances/instance-id. Database resource name: instances/instance-id/databases/database-name. |-<a name="bytebase-v1-Anomaly-AnomalyType"></a>-### Anomaly.AnomalyType-AnomalyType is the type of the anomaly.-| Name | Number | Description |-| ---- | ------ | ----------- |-| ANOMALY_TYPE_UNSPECIFIED | 0 | Unspecified anomaly type. |-| INSTANCE_CONNECTION | 1 | Instance level anomaly.-INSTANCE_CONNECTION is the anomaly type for instance connection, e.g. the instance is down. |-| MIGRATION_SCHEMA | 2 | MIGRATION_SCHEMA is the anomaly type for migration schema, e.g. the migration schema in the instance is missing. |-| DATABASE_BACKUP_POLICY_VIOLATION | 3 | Database level anomaly.-DATABASE_BACKUP_POLICY_VIOLATION is the anomaly type for database backup policy violation, e.g. the database backup policy is not meet the environment backup policy. |-| DATABASE_BACKUP_MISSING | 4 | DATABASE_BACKUP_MISSING is the anomaly type for the backup missing, e.g. the backup is missing. |-| DATABASE_CONNECTION | 5 | DATABASE_CONNECTION is the anomaly type for database connection, e.g. the database had been deleted. |-| DATABASE_SCHEMA_DRIFT | 6 | DATABASE_SCHEMA_DRIFT is the anomaly type for database schema drift, e.g. the database schema had been changed without bytebase migration. |+<a name="bytebase-v1-DeploymentApprovalPolicy"></a>+### DeploymentApprovalPolicy-<a name="bytebase-v1-Anomaly-BackupPlanSchedule"></a>-### Anomaly.BackupPlanSchedule-BackupPlanSchedule is the backup plan schedule.-| Name | Number | Description |-| ---- | ------ | ----------- |-| BACKUP_PLAN_SCHEDULE_UNSPECIFIED | 0 | Unspecified backup plan schedule. |-| UNSET | 1 | UNSET is the unset backup plan schedule. |-| DAILY | 2 | DAILY is the daily backup plan schedule. |-| WEEKLY | 3 | WEEKLY is the weekly backup plan schedule. |+| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| default_strategy | [ApprovalStrategy](#bytebase-v1-ApprovalStrategy) | | |+| deployment_approval_strategies | [DeploymentApprovalStrategy](#bytebase-v1-DeploymentApprovalStrategy) | repeated | |---<a name="bytebase-v1-AnomalyService"></a>-### AnomalyService+<a name="bytebase-v1-DeploymentApprovalStrategy"></a>+### DeploymentApprovalStrategy-| Method Name | Request Type | Response Type | Description |-| ----------- | ------------ | ------------- | ------------|-| SearchAnomalies | [SearchAnomaliesRequest](#bytebase-v1-SearchAnomaliesRequest) | [SearchAnomaliesResponse](#bytebase-v1-SearchAnomaliesResponse) | |-+| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| deployment_type | [DeploymentType](#bytebase-v1-DeploymentType) | | |+| approval_group | [ApprovalGroup](#bytebase-v1-ApprovalGroup) | | |+| approval_strategy | [ApprovalStrategy](#bytebase-v1-ApprovalStrategy) | | |-<a name="v1_common-proto"></a>-<p align="right"><a href="#top">Top</a></p>-## v1/common.proto-+<a name="bytebase-v1-GetPolicyRequest"></a>-<a name="bytebase-v1-Engine"></a>+### GetPolicyRequest-### Engine-| Name | Number | Description |-| ---- | ------ | ----------- |-| ENGINE_UNSPECIFIED | 0 | |-| CLICKHOUSE | 1 | |-| MYSQL | 2 | |-| POSTGRES | 3 | |-| SNOWFLAKE | 4 | |-| SQLITE | 5 | |-| TIDB | 6 | |-| MONGODB | 7 | |-| REDIS | 8 | |-| ORACLE | 9 | |-| SPANNER | 10 | |-| MSSQL | 11 | |-| REDSHIFT | 12 | |-| MARIADB | 13 | |-| OCEANBASE | 14 | |+| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| name | [string](#string) | | The name of the policy to retrieve. Format: {resource type}/{resource id}/policies/{policy type} |-<a name="bytebase-v1-State"></a>-### State-| Name | Number | Description |-| ---- | ------ | ----------- |-| STATE_UNSPECIFIED | 0 | |-| ACTIVE | 1 | |-| DELETED | 2 | |+<a name="bytebase-v1-ListPoliciesRequest"></a>+### ListPoliciesRequest---+| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| parent | [string](#string) | | The parent, which owns this collection of policies. Format: {resource type}/{resource id}/policies/{policy type} |+| policy_type | [PolicyType](#bytebase-v1-PolicyType) | optional | |+| page_size | [int32](#int32) | | The maximum number of policies to return. The service may return fewer than this value. If unspecified, at most 50 policies will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |+| page_token | [string](#string) | | A page token, received from a previous `GetPolicies` call. Provide this to retrieve the subsequent page.+When paginating, all other parameters provided to `GetPolicies` must match the call that provided the page token. |+| show_deleted | [bool](#bool) | | Show deleted policies if specified. |-<a name="v1_auth_service-proto"></a>-<p align="right"><a href="#top">Top</a></p>-## v1/auth_service.proto-<a name="bytebase-v1-CreateUserRequest"></a>+<a name="bytebase-v1-ListPoliciesResponse"></a>-### CreateUserRequest+### ListPoliciesResponse| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| user | [User](#bytebase-v1-User) | | The user to create. |+| policies | [Policy](#bytebase-v1-Policy) | repeated | The policies from the specified request. |+| next_page_token | [string](#string) | | A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. |-<a name="bytebase-v1-DeleteUserRequest"></a>+<a name="bytebase-v1-Policy"></a>-### DeleteUserRequest+### Policy| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the user to delete. Format: users/{user} |+| name | [string](#string) | | The name of the policy. Format: {resource name}/policies/{policy type} Workspace resource name: "". Environment resource name: environments/environment-id. Instance resource name: instances/instance-id. Database resource name: instances/instance-id/databases/database-name. |+| uid | [string](#string) | | The system-assigned, unique identifier for a resource. |+| inherit_from_parent | [bool](#bool) | | |+| type | [PolicyType](#bytebase-v1-PolicyType) | | |+| deployment_approval_policy | [DeploymentApprovalPolicy](#bytebase-v1-DeploymentApprovalPolicy) | | |+| backup_plan_policy | [BackupPlanPolicy](#bytebase-v1-BackupPlanPolicy) | | |+| sensitive_data_policy | [SensitiveDataPolicy](#bytebase-v1-SensitiveDataPolicy) | | |+| access_control_policy | [AccessControlPolicy](#bytebase-v1-AccessControlPolicy) | | |+| sql_review_policy | [SQLReviewPolicy](#bytebase-v1-SQLReviewPolicy) | | |+| slow_query_policy | [SlowQueryPolicy](#bytebase-v1-SlowQueryPolicy) | | |+| enforce | [bool](#bool) | | |+| resource_type | [PolicyResourceType](#bytebase-v1-PolicyResourceType) | | The resource type for the policy. |+| resource_uid | [string](#string) | | The system-assigned, unique identifier for the resource. |-<a name="bytebase-v1-GetUserRequest"></a>+<a name="bytebase-v1-SQLReviewPolicy"></a>-### GetUserRequest+### SQLReviewPolicy| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the user to retrieve. Format: users/{user} |+| name | [string](#string) | | |+| rules | [SQLReviewRule](#bytebase-v1-SQLReviewRule) | repeated | |-<a name="bytebase-v1-IdentityProviderContext"></a>+<a name="bytebase-v1-SQLReviewRule"></a>-### IdentityProviderContext+### SQLReviewRule| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| oauth2_context | [OAuth2IdentityProviderContext](#bytebase-v1-OAuth2IdentityProviderContext) | | |-| oidc_context | [OIDCIdentityProviderContext](#bytebase-v1-OIDCIdentityProviderContext) | | |+| type | [string](#string) | | |+| level | [SQLReviewRuleLevel](#bytebase-v1-SQLReviewRuleLevel) | | |+| payload | [string](#string) | | |+| engine | [Engine](#bytebase-v1-Engine) | | |+| comment | [string](#string) | | |-<a name="bytebase-v1-ListUsersRequest"></a>+<a name="bytebase-v1-SensitiveData"></a>-### ListUsersRequest+### SensitiveData| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| page_size | [int32](#int32) | | The maximum number of users to return. The service may return fewer than this value. If unspecified, at most 50 users will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |-| page_token | [string](#string) | | A page token, received from a previous `ListUsers` call. Provide this to retrieve the subsequent page.--When paginating, all other parameters provided to `ListUsers` must match the call that provided the page token. |-| show_deleted | [bool](#bool) | | Show deleted users if specified. |+| schema | [string](#string) | | |+| table | [string](#string) | | |+| column | [string](#string) | | |+| mask_type | [SensitiveDataMaskType](#bytebase-v1-SensitiveDataMaskType) | | |-<a name="bytebase-v1-ListUsersResponse"></a>+<a name="bytebase-v1-SensitiveDataPolicy"></a>-### ListUsersResponse+### SensitiveDataPolicy| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| users | [User](#bytebase-v1-User) | repeated | The users from the specified request. |-| next_page_token | [string](#string) | | A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. |+| sensitive_data | [SensitiveData](#bytebase-v1-SensitiveData) | repeated | |-<a name="bytebase-v1-LoginRequest"></a>+<a name="bytebase-v1-SlowQueryPolicy"></a>-### LoginRequest+### SlowQueryPolicy| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| email | [string](#string) | | |-| password | [string](#string) | | |-| web | [bool](#bool) | | If web is set, we will set access token, refresh token, and user to the cookie. |-| idp_name | [string](#string) | | The name of the identity provider. Format: idps/{idp} |-| idp_context | [IdentityProviderContext](#bytebase-v1-IdentityProviderContext) | | The idp_context is using to get the user information from identity provider. |-| otp_code | [string](#string) | optional | The otp_code is used to verify the user's identity by MFA. |-| recovery_code | [string](#string) | optional | The recovery_code is used to recovery the user's identity with MFA. |-| mfa_temp_token | [string](#string) | optional | The mfa_temp_token is used to verify the user's identity by MFA. |+| active | [bool](#bool) | | |-<a name="bytebase-v1-LoginResponse"></a>+<a name="bytebase-v1-UpdatePolicyRequest"></a>-### LoginResponse+### UpdatePolicyRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| token | [string](#string) | | |-| mfa_temp_token | [string](#string) | optional | |---+| policy | [Policy](#bytebase-v1-Policy) | | The policy to update.+The policy's `name` field is used to identify the instance to update. Format: {resource name}/policies/{policy type} Workspace resource name: "". Environment resource name: environments/environment-id. Instance resource name: instances/instance-id. Database resource name: instances/instance-id/databases/database-name. |+| update_mask | [google.protobuf.FieldMask](#google-protobuf-FieldMask) | | The list of fields to update. |+| allow_missing | [bool](#bool) | | If set to true, and the policy is not found, a new policy will be created. In this situation, `update_mask` is ignored. |-<a name="bytebase-v1-LogoutRequest"></a>-### LogoutRequest++<a name="bytebase-v1-ApprovalGroup"></a>+### ApprovalGroup-<a name="bytebase-v1-OAuth2IdentityProviderContext"></a>+| Name | Number | Description |+| ---- | ------ | ----------- |+| ASSIGNEE_GROUP_UNSPECIFIED | 0 | |+| APPROVAL_GROUP_DBA | 1 | |+| APPROVAL_GROUP_PROJECT_OWNER | 2 | |-### OAuth2IdentityProviderContext+<a name="bytebase-v1-ApprovalStrategy"></a>-| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| code | [string](#string) | | |+### ApprovalStrategy+| Name | Number | Description |+| ---- | ------ | ----------- |+| APPROVAL_STRATEGY_UNSPECIFIED | 0 | |+| AUTOMATIC | 1 | |+| MANUAL | 2 | |+<a name="bytebase-v1-BackupPlanSchedule"></a>-<a name="bytebase-v1-OIDCIdentityProviderContext"></a>+### BackupPlanSchedule-### OIDCIdentityProviderContext+| Name | Number | Description |+| ---- | ------ | ----------- |+| SCHEDULE_UNSPECIFIED | 0 | |+| UNSET | 1 | |+| DAILY | 2 | |+| WEEKLY | 3 | |+<a name="bytebase-v1-PolicyResourceType"></a>+### PolicyResourceType-<a name="bytebase-v1-UndeleteUserRequest"></a>+| Name | Number | Description |+| ---- | ------ | ----------- |+| RESOURCE_TYPE_UNSPECIFIED | 0 | |+| WORKSPACE | 1 | |+| ENVIRONMENT | 2 | |+| PROJECT | 3 | |+| INSTANCE | 4 | |+| DATABASE | 5 | |-### UndeleteUserRequest+<a name="bytebase-v1-PolicyType"></a>-| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the deleted user. Format: users/{user} |+### PolicyType+| Name | Number | Description |+| ---- | ------ | ----------- |+| POLICY_TYPE_UNSPECIFIED | 0 | |+| DEPLOYMENT_APPROVAL | 1 | |+| BACKUP_PLAN | 2 | |+| SQL_REVIEW | 3 | |+| SENSITIVE_DATA | 4 | |+| ACCESS_CONTROL | 5 | |+| SLOW_QUERY | 6 | |+<a name="bytebase-v1-SQLReviewRuleLevel"></a>-<a name="bytebase-v1-UpdateUserRequest"></a>+### SQLReviewRuleLevel-### UpdateUserRequest+| Name | Number | Description |+| ---- | ------ | ----------- |+| LEVEL_UNSPECIFIED | 0 | |+| ERROR | 1 | |+| WARNING | 2 | |+| DISABLED | 3 | |-| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| user | [User](#bytebase-v1-User) | | The user to update.-The user's `name` field is used to identify the user to update. Format: users/{user} |-| update_mask | [google.protobuf.FieldMask](#google-protobuf-FieldMask) | | The list of fields to update. |-| otp_code | [string](#string) | optional | The otp_code is used to verify the user's identity by MFA. |-| regenerate_temp_mfa_secret | [bool](#bool) | | The regenerate_temp_mfa_secret flag means to regenerate temporary MFA secret for user. This is used for MFA setup. The temporary MFA secret and recovery codes will be returned in the response. |-| regenerate_recovery_codes | [bool](#bool) | | The regenerate_recovery_codes flag means to regenerate recovery codes for user. |+<a name="bytebase-v1-SensitiveDataMaskType"></a>+### SensitiveDataMaskType+| Name | Number | Description |+| ---- | ------ | ----------- |+| MASK_TYPE_UNSPECIFIED | 0 | |+| DEFAULT | 1 | |+-<a name="bytebase-v1-User"></a>+-### User+<a name="bytebase-v1-OrgPolicyService"></a>+### OrgPolicyService-| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the user. Format: users/{user}. {user} is a system-generated unique ID. |-| state | [State](#bytebase-v1-State) | | |-| email | [string](#string) | | |-| title | [string](#string) | | |-| user_type | [UserType](#bytebase-v1-UserType) | | |-| user_role | [UserRole](#bytebase-v1-UserRole) | | The user role will not be respected in the create user request, because the role is controlled by workspace owner. |-| password | [string](#string) | | |-| service_key | [string](#string) | | |-| mfa_enabled | [bool](#bool) | | The mfa_enabled flag means if the user has enabled MFA. |-| mfa_secret | [string](#string) | | The mfa_secret is the temporary secret using in two phase verification. |-| recovery_codes | [string](#string) | repeated | The recovery_codes is the temporary recovery codes using in two phase verification. |-| phone | [string](#string) | | Should be a valid E.164 compliant phone number. Could be empty. |+| Method Name | Request Type | Response Type | Description |+| ----------- | ------------ | ------------- | ------------|+| GetPolicy | [GetPolicyRequest](#bytebase-v1-GetPolicyRequest) | [Policy](#bytebase-v1-Policy) | |+| ListPolicies | [ListPoliciesRequest](#bytebase-v1-ListPoliciesRequest) | [ListPoliciesResponse](#bytebase-v1-ListPoliciesResponse) | |+| CreatePolicy | [CreatePolicyRequest](#bytebase-v1-CreatePolicyRequest) | [Policy](#bytebase-v1-Policy) | |+| UpdatePolicy | [UpdatePolicyRequest](#bytebase-v1-UpdatePolicyRequest) | [Policy](#bytebase-v1-Policy) | |+| DeletePolicy | [DeletePolicyRequest](#bytebase-v1-DeletePolicyRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | |+-+<a name="v1_anomaly_service-proto"></a>+<p align="right"><a href="#top">Top</a></p>+## v1/anomaly_service.proto-<a name="bytebase-v1-UserRole"></a>-### UserRole+<a name="bytebase-v1-Anomaly"></a>-| Name | Number | Description |-| ---- | ------ | ----------- |-| USER_ROLE_UNSPECIFIED | 0 | |-| OWNER | 1 | |-| DBA | 2 | |-| DEVELOPER | 3 | |+### Anomaly-<a name="bytebase-v1-UserType"></a>+| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| resource | [string](#string) | | The resource that is the target of the operation. Format: - Instance: instnaces/{instance} - Database: instnaces/{instance}/databases/{database} |+| type | [Anomaly.AnomalyType](#bytebase-v1-Anomaly-AnomalyType) | | type is the type of the anomaly. |+| severity | [Anomaly.AnomalySeverity](#bytebase-v1-Anomaly-AnomalySeverity) | | severity is the severity of the anomaly. |+| instance_connection_detail | [Anomaly.InstanceConnectionDetail](#bytebase-v1-Anomaly-InstanceConnectionDetail) | | |+| database_connection_detail | [Anomaly.DatabaseConnectionDetail](#bytebase-v1-Anomaly-DatabaseConnectionDetail) | | |+| database_backup_policy_violation_detail | [Anomaly.DatabaseBackupPolicyViolationDetail](#bytebase-v1-Anomaly-DatabaseBackupPolicyViolationDetail) | | |+| database_backup_missing_detail | [Anomaly.DatabaseBackupMissingDetail](#bytebase-v1-Anomaly-DatabaseBackupMissingDetail) | | |+| database_schema_drift_detail | [Anomaly.DatabaseSchemaDriftDetail](#bytebase-v1-Anomaly-DatabaseSchemaDriftDetail) | | |+| create_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |+| update_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |-### UserType-| Name | Number | Description |-| ---- | ------ | ----------- |-| USER_TYPE_UNSPECIFIED | 0 | |-| USER | 1 | |-| SYSTEM_BOT | 2 | |-| SERVICE_ACCOUNT | 3 | |--+<a name="bytebase-v1-Anomaly-DatabaseBackupMissingDetail"></a>+### Anomaly.DatabaseBackupMissingDetail+DatabaseBackupMissingDetail is the detail for database backup missing anomaly.-<a name="bytebase-v1-AuthService"></a>-### AuthService+| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| expected_schedule | [BackupPlanSchedule](#bytebase-v1-BackupPlanSchedule) | | expected_schedule is the expected backup plan schedule in the database. |+| latest_backup_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | latest_backup_time is the latest backup time in the database. |-| Method Name | Request Type | Response Type | Description |-| ----------- | ------------ | ------------- | ------------|-| GetUser | [GetUserRequest](#bytebase-v1-GetUserRequest) | [User](#bytebase-v1-User) | |-| ListUsers | [ListUsersRequest](#bytebase-v1-ListUsersRequest) | [ListUsersResponse](#bytebase-v1-ListUsersResponse) | |-| CreateUser | [CreateUserRequest](#bytebase-v1-CreateUserRequest) | [User](#bytebase-v1-User) | |-| UpdateUser | [UpdateUserRequest](#bytebase-v1-UpdateUserRequest) | [User](#bytebase-v1-User) | |-| DeleteUser | [DeleteUserRequest](#bytebase-v1-DeleteUserRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | |-| UndeleteUser | [UndeleteUserRequest](#bytebase-v1-UndeleteUserRequest) | [User](#bytebase-v1-User) | |-| Login | [LoginRequest](#bytebase-v1-LoginRequest) | [LoginResponse](#bytebase-v1-LoginResponse) | |-| Logout | [LogoutRequest](#bytebase-v1-LogoutRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | |--<a name="v1_bookmark_service-proto"></a>-<p align="right"><a href="#top">Top</a></p>+<a name="bytebase-v1-Anomaly-DatabaseBackupPolicyViolationDetail"></a>++### Anomaly.DatabaseBackupPolicyViolationDetail+DatabaseBackupPolicyViolationDetail is the detail for database backup policy violation anomaly.-## v1/bookmark_service.proto+| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| parent | [string](#string) | | parent is the parent of the database. Format: environments/{environment} |+| expected_schedule | [BackupPlanSchedule](#bytebase-v1-BackupPlanSchedule) | | expected_schedule is the expected backup plan schedule in the parent. |+| actual_schedule | [BackupPlanSchedule](#bytebase-v1-BackupPlanSchedule) | | actual_schedule is the actual backup plan schedule in the database. |-<a name="bytebase-v1-Bookmark"></a>-### Bookmark+<a name="bytebase-v1-Anomaly-DatabaseConnectionDetail"></a>++### Anomaly.DatabaseConnectionDetail+Database level anomaly detial.++DatbaaseConnectionDetail is the detail for database connection anomaly.++| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the bookmark. Format: bookmarks/{bookmark}, user and bookmark are server-generated unique IDs. |-| title | [string](#string) | | The title of the bookmark. |-| link | [string](#string) | | The resource link of the bookmark. Only support issue link for now. Format: Issue: /issue/slug(issue_name)-{issue_uid} Example: /issue/start-here-add-email-column-to-employee-table-101 |-+| detail | [string](#string) | | detail is the detail of the database connection failure. |-<a name="bytebase-v1-CreateBookmarkRequest"></a>-### CreateBookmarkRequest+<a name="bytebase-v1-Anomaly-DatabaseSchemaDriftDetail"></a>+### Anomaly.DatabaseSchemaDriftDetail+DatabaseSchemaDriftDetail is the detail for database schema drift anomaly.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| bookmark | [Bookmark](#bytebase-v1-Bookmark) | | The bookmark to create. |+| record_version | [string](#string) | | record_version is the record version of the database schema drift. |+| expected_schema | [string](#string) | | expected_schema is the expected schema in the database. |+| actual_schema | [string](#string) | | actual_schema is the actual schema in the database. |-<a name="bytebase-v1-DeleteBookmarkRequest"></a>+<a name="bytebase-v1-Anomaly-InstanceConnectionDetail"></a>-### DeleteBookmarkRequest+### Anomaly.InstanceConnectionDetail+Instance level anomaly detail.+InstanceConnectionDetail is the detail for instance connection anomaly.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the bookmark to delete. Format: bookmarks/{bookmark} |+| detail | [string](#string) | | detail is the detail of the instance connection failure. |-<a name="bytebase-v1-ListBookmarksRequest"></a>+<a name="bytebase-v1-SearchAnomaliesRequest"></a>-### ListBookmarksRequest+### SearchAnomaliesRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| page_size | [int32](#int32) | | Not used. The maximum number of bookmarks to return. The service may return fewer than this value. If unspecified, at most 50 bookmarks will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |-| page_token | [string](#string) | | Not used. A page token, received from a previous `ListBookmarks` call. Provide this to retrieve the subsequent page.+| filter | [string](#string) | | filter is the filter to apply on the search anomaly request, 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: 'resource="instances/{instance}".' Search the specified types of anomalies: 'type="DATABASE_BACKUP_POLICY_VIOLATION" | "MIGRATION_SCHEMA".' |+| page_size | [int32](#int32) | | Not used. The maximum number of anomalies to return. The service may return fewer than this value. If unspecified, at most 50 anomalies will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |+| page_token | [string](#string) | | Not used. A page token, received from a previous `SearchAnomalies` call. Provide this to retrieve the subsequent page.-When paginating, all other parameters provided to `ListBookmarks` must match the call that provided the page token. |+When paginating, all other parameters provided to `SearchAnomalies` must match the call that provided the page token. |-<a name="bytebase-v1-ListBookmarksResponse"></a>+<a name="bytebase-v1-SearchAnomaliesResponse"></a>-### ListBookmarksResponse+### SearchAnomaliesResponse| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| bookmarks | [Bookmark](#bytebase-v1-Bookmark) | repeated | The list of bookmarks. |+| anomalies | [Anomaly](#bytebase-v1-Anomaly) | repeated | anomalies is the list of anomalies. || next_page_token | [string](#string) | | Not used. A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. |@@ -1325,3242 +1331,3226 @@ When paginating, all other parameters provided to `ListBookmarks` must match the++<a name="bytebase-v1-Anomaly-AnomalySeverity"></a>++### Anomaly.AnomalySeverity+AnomalySeverity is the severity of the anomaly.++| Name | Number | Description |+| ---- | ------ | ----------- |+| ANOMALY_SEVERITY_UNSPECIFIED | 0 | Unspecified anomaly severity. |+| MEDIUM | 1 | MEDIUM is the info level anomaly severity. |+| HIGH | 2 | HIGH is the warning level anomaly severity. |+| CRITICAL | 3 | CRITICAL is the critical level anomaly severity. |++++<a name="bytebase-v1-Anomaly-AnomalyType"></a>++### Anomaly.AnomalyType+AnomalyType is the type of the anomaly.++| Name | Number | Description |+| ---- | ------ | ----------- |+| ANOMALY_TYPE_UNSPECIFIED | 0 | Unspecified anomaly type. |+| INSTANCE_CONNECTION | 1 | Instance level anomaly.++INSTANCE_CONNECTION is the anomaly type for instance connection, e.g. the instance is down. |+| MIGRATION_SCHEMA | 2 | MIGRATION_SCHEMA is the anomaly type for migration schema, e.g. the migration schema in the instance is missing. |+| DATABASE_BACKUP_POLICY_VIOLATION | 3 | Database level anomaly.++DATABASE_BACKUP_POLICY_VIOLATION is the anomaly type for database backup policy violation, e.g. the database backup policy is not meet the environment backup policy. |+| DATABASE_BACKUP_MISSING | 4 | DATABASE_BACKUP_MISSING is the anomaly type for the backup missing, e.g. the backup is missing. |+| DATABASE_CONNECTION | 5 | DATABASE_CONNECTION is the anomaly type for database connection, e.g. the database had been deleted. |+| DATABASE_SCHEMA_DRIFT | 6 | DATABASE_SCHEMA_DRIFT is the anomaly type for database schema drift, e.g. the database schema had been changed without bytebase migration. |++-<a name="bytebase-v1-BookmarkService"></a>+<a name="bytebase-v1-AnomalyService"></a>-### BookmarkService+### AnomalyService| Method Name | Request Type | Response Type | Description || ----------- | ------------ | ------------- | ------------|-| CreateBookmark | [CreateBookmarkRequest](#bytebase-v1-CreateBookmarkRequest) | [Bookmark](#bytebase-v1-Bookmark) | CreateBookmark creates a new bookmark. |-| DeleteBookmark | [DeleteBookmarkRequest](#bytebase-v1-DeleteBookmarkRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | DeleteBookmark deletes a bookmark. |-| ListBookmarks | [ListBookmarksRequest](#bytebase-v1-ListBookmarksRequest) | [ListBookmarksResponse](#bytebase-v1-ListBookmarksResponse) | ListBookmarks lists bookmarks. |+| SearchAnomalies | [SearchAnomaliesRequest](#bytebase-v1-SearchAnomaliesRequest) | [SearchAnomaliesResponse](#bytebase-v1-SearchAnomaliesResponse) | |-<a name="v1_cel_service-proto"></a>+<a name="v1_auth_service-proto"></a><p align="right"><a href="#top">Top</a></p>-## v1/cel_service.proto+## v1/auth_service.proto-<a name="bytebase-v1-DeparseRequest"></a>+<a name="bytebase-v1-CreateUserRequest"></a>-### DeparseRequest+### CreateUserRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| expression | [google.api.expr.v1alpha1.ParsedExpr](#google-api-expr-v1alpha1-ParsedExpr) | | |+| user | [User](#bytebase-v1-User) | | The user to create. |-<a name="bytebase-v1-DeparseResponse"></a>+<a name="bytebase-v1-DeleteUserRequest"></a>-### DeparseResponse+### DeleteUserRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| expression | [string](#string) | | |+| name | [string](#string) | | The name of the user to delete. Format: users/{user} |-<a name="bytebase-v1-ParseRequest"></a>+<a name="bytebase-v1-GetUserRequest"></a>-### ParseRequest+### GetUserRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| expression | [string](#string) | | |+| name | [string](#string) | | The name of the user to retrieve. Format: users/{user} |-<a name="bytebase-v1-ParseResponse"></a>+<a name="bytebase-v1-IdentityProviderContext"></a>-### ParseResponse+### IdentityProviderContext| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| expression | [google.api.expr.v1alpha1.ParsedExpr](#google-api-expr-v1alpha1-ParsedExpr) | | |---+| oauth2_context | [OAuth2IdentityProviderContext](#bytebase-v1-OAuth2IdentityProviderContext) | | |+| oidc_context | [OIDCIdentityProviderContext](#bytebase-v1-OIDCIdentityProviderContext) | | |----<a name="bytebase-v1-CelService"></a>+<a name="bytebase-v1-ListUsersRequest"></a>-### CelService+### ListUsersRequest-| Method Name | Request Type | Response Type | Description |-| ----------- | ------------ | ------------- | ------------|-| Parse | [ParseRequest](#bytebase-v1-ParseRequest) | [ParseResponse](#bytebase-v1-ParseResponse) | |-| Deparse | [DeparseRequest](#bytebase-v1-DeparseRequest) | [DeparseResponse](#bytebase-v1-DeparseResponse) | |-+| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| page_size | [int32](#int32) | | The maximum number of users to return. The service may return fewer than this value. If unspecified, at most 50 users will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |+| page_token | [string](#string) | | A page token, received from a previous `ListUsers` call. Provide this to retrieve the subsequent page.+When paginating, all other parameters provided to `ListUsers` must match the call that provided the page token. |+| show_deleted | [bool](#bool) | | Show deleted users if specified. |-<a name="v1_vcs-proto"></a>-<p align="right"><a href="#top">Top</a></p>-## v1/vcs.proto-<a name="bytebase-v1-Commit"></a>+<a name="bytebase-v1-ListUsersResponse"></a>-### Commit+### ListUsersResponse| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| id | [string](#string) | | |-| title | [string](#string) | | |-| message | [string](#string) | | |-| created_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |-| url | [string](#string) | | |-| author_name | [string](#string) | | |-| author_email | [string](#string) | | |-| added_list | [string](#string) | repeated | |-| modified_list | [string](#string) | repeated | |+| users | [User](#bytebase-v1-User) | repeated | The users from the specified request. |+| next_page_token | [string](#string) | | A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. |-<a name="bytebase-v1-FileCommit"></a>+<a name="bytebase-v1-LoginRequest"></a>-### FileCommit+### LoginRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| id | [string](#string) | | |-| title | [string](#string) | | |-| message | [string](#string) | | |-| created_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |-| url | [string](#string) | | |-| author_name | [string](#string) | | |-| author_email | [string](#string) | | |-| added | [string](#string) | | |+| email | [string](#string) | | |+| password | [string](#string) | | |+| web | [bool](#bool) | | If web is set, we will set access token, refresh token, and user to the cookie. |+| idp_name | [string](#string) | | The name of the identity provider. Format: idps/{idp} |+| idp_context | [IdentityProviderContext](#bytebase-v1-IdentityProviderContext) | | The idp_context is using to get the user information from identity provider. |+| otp_code | [string](#string) | optional | The otp_code is used to verify the user's identity by MFA. |+| recovery_code | [string](#string) | optional | The recovery_code is used to recovery the user's identity with MFA. |+| mfa_temp_token | [string](#string) | optional | The mfa_temp_token is used to verify the user's identity by MFA. |-<a name="bytebase-v1-PushEvent"></a>+<a name="bytebase-v1-LoginResponse"></a>-### PushEvent+### LoginResponse| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| vcs_type | [VcsType](#bytebase-v1-VcsType) | | |-| base_dir | [string](#string) | | |-| ref | [string](#string) | | |-| before | [string](#string) | | |-| after | [string](#string) | | |-| repository_id | [string](#string) | | |-| repository_url | [string](#string) | | |-| repository_full_path | [string](#string) | | |-| author_name | [string](#string) | | |-| commits | [Commit](#bytebase-v1-Commit) | repeated | |-| file_commit | [FileCommit](#bytebase-v1-FileCommit) | | |+| token | [string](#string) | | |+| mfa_temp_token | [string](#string) | optional | |-+<a name="bytebase-v1-LogoutRequest"></a>-<a name="bytebase-v1-VcsType"></a>+### LogoutRequest-### VcsType-| Name | Number | Description |-| ---- | ------ | ----------- |-| VCS_TYPE_UNSPECIFIED | 0 | |-| GITLAB | 1 | |-| GITHUB | 2 | |-| BITBUCKET | 3 | |----------<a name="v1_database_service-proto"></a>-<p align="right"><a href="#top">Top</a></p>-## v1/database_service.proto+<a name="bytebase-v1-OAuth2IdentityProviderContext"></a>-<a name="bytebase-v1-AdviseIndexRequest"></a>+### OAuth2IdentityProviderContext-### AdviseIndexRequest-AdviseIndexRequest is the request of advising index.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| parent | [string](#string) | | Format: instances/{instance}/databases/{database} |-| statement | [string](#string) | | The statement to be advised. |+| code | [string](#string) | | |-<a name="bytebase-v1-AdviseIndexResponse"></a>+<a name="bytebase-v1-OIDCIdentityProviderContext"></a>-### AdviseIndexResponse-AdviseIndexResponse is the response of advising index.+### OIDCIdentityProviderContext-| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| current_index | [string](#string) | | The current index of the statement used. |-| suggestion | [string](#string) | | The suggested index of the statement. |-| create_index_statement | [string](#string) | | The create index statement of the suggested index. |+<a name="bytebase-v1-UndeleteUserRequest"></a>-<a name="bytebase-v1-Backup"></a>+### UndeleteUserRequest-### Backup-The message of the backup.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The resource name of the database backup. backup-name is specified by the client. Format: instances/{instance}/databases/{database}/backups/{backup-name} |-| create_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | The timestamp when the backup resource was created initially. |-| update_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | The timestamp when the backup resource was updated. |-| state | [Backup.BackupState](#bytebase-v1-Backup-BackupState) | | The state of the backup. |-| backup_type | [Backup.BackupType](#bytebase-v1-Backup-BackupType) | | The type of the backup. |-| comment | [string](#string) | | The comment of the backup. |-| uid | [string](#string) | | |+| name | [string](#string) | | The name of the deleted user. Format: users/{user} |-<a name="bytebase-v1-BackupSetting"></a>+<a name="bytebase-v1-UpdateUserRequest"></a>++### UpdateUserRequest-### BackupSetting-BackupSetting is the setting for database backup.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the database backup setting. Format: instances/{instance}/databases/{database}/backupSetting |-| backup_retain_duration | [google.protobuf.Duration](#google-protobuf-Duration) | | The default maximum age of a Backup created via this BackupPlan. If specified, a Backup will be automatically deleted after its age reaches. If not specified, Backups created under this BackupPlan will be deleted after 7 DAYS. It will be rounded up to the number of days. |-| cron_schedule | [string](#string) | | Cron(https://wikipedia.com/wiki/cron) string that defines a repeating schedule for creating Backups. Support hour of day, day of week. (UTC time)+| user | [User](#bytebase-v1-User) | | The user to update.-Default (empty): Disable automatic backup. |-| hook_url | [string](#string) | | hook_url(https://www.bytebase.com/docs/disaster-recovery/backup/#post-backup-webhook) is the URL to send a notification when a backup is created. |+The user's `name` field is used to identify the user to update. Format: users/{user} |+| update_mask | [google.protobuf.FieldMask](#google-protobuf-FieldMask) | | The list of fields to update. |+| otp_code | [string](#string) | optional | The otp_code is used to verify the user's identity by MFA. |+| regenerate_temp_mfa_secret | [bool](#bool) | | The regenerate_temp_mfa_secret flag means to regenerate temporary MFA secret for user. This is used for MFA setup. The temporary MFA secret and recovery codes will be returned in the response. |+| regenerate_recovery_codes | [bool](#bool) | | The regenerate_recovery_codes flag means to regenerate recovery codes for user. |-<a name="bytebase-v1-BatchUpdateDatabasesRequest"></a>+<a name="bytebase-v1-User"></a>-### BatchUpdateDatabasesRequest+### User| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| parent | [string](#string) | | The parent resource shared by all databases being updated. Format: instances/{instance} If the operation spans parents, a dash (-) may be accepted as a wildcard. We only support updating the project of databases for now. |-| requests | [UpdateDatabaseRequest](#bytebase-v1-UpdateDatabaseRequest) | repeated | The request message specifying the resources to update. A maximum of 1000 databases can be modified in a batch. |--+| name | [string](#string) | | The name of the user. Format: users/{user}. {user} is a system-generated unique ID. |+| state | [State](#bytebase-v1-State) | | |+| email | [string](#string) | | |+| title | [string](#string) | | |+| user_type | [UserType](#bytebase-v1-UserType) | | |+| user_role | [UserRole](#bytebase-v1-UserRole) | | The user role will not be respected in the create user request, because the role is controlled by workspace owner. |+| password | [string](#string) | | |+| service_key | [string](#string) | | |+| mfa_enabled | [bool](#bool) | | The mfa_enabled flag means if the user has enabled MFA. |+| mfa_secret | [string](#string) | | The mfa_secret is the temporary secret using in two phase verification. |+| recovery_codes | [string](#string) | repeated | The recovery_codes is the temporary recovery codes using in two phase verification. |+| phone | [string](#string) | | Should be a valid E.164 compliant phone number. Could be empty. |-<a name="bytebase-v1-BatchUpdateDatabasesResponse"></a>-### BatchUpdateDatabasesResponse++<a name="bytebase-v1-UserRole"></a>-| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| databases | [Database](#bytebase-v1-Database) | repeated | Databases updated. |+### UserRole+| Name | Number | Description |+| ---- | ------ | ----------- |+| USER_ROLE_UNSPECIFIED | 0 | |+| OWNER | 1 | |+| DBA | 2 | |+| DEVELOPER | 3 | |+<a name="bytebase-v1-UserType"></a>-<a name="bytebase-v1-ChangeHistory"></a>+### UserType-### ChangeHistory+| Name | Number | Description |+| ---- | ------ | ----------- |+| USER_TYPE_UNSPECIFIED | 0 | |+| USER | 1 | |+| SYSTEM_BOT | 2 | |+| SERVICE_ACCOUNT | 3 | |-| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| name | [string](#string) | | Format: instances/{instance}/databases/{database}/changeHistories/{changeHistory} |-| uid | [string](#string) | | |-| creator | [string](#string) | | Format: users/[email protected] |-| updater | [string](#string) | | Format: users/[email protected] |-| create_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |-| update_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |-| release_version | [string](#string) | | release version of Bytebase |-| source | [ChangeHistory.Source](#bytebase-v1-ChangeHistory-Source) | | |-| type | [ChangeHistory.Type](#bytebase-v1-ChangeHistory-Type) | | |-| status | [ChangeHistory.Status](#bytebase-v1-ChangeHistory-Status) | | |-| version | [string](#string) | | |-| description | [string](#string) | | |-| statement | [string](#string) | | |-| schema | [string](#string) | | |-| prev_schema | [string](#string) | | |-| execution_duration | [google.protobuf.Duration](#google-protobuf-Duration) | | |-| review | [string](#string) | | Format: projects/{project}/reviews/{review} |-| push_event | [PushEvent](#bytebase-v1-PushEvent) | | |+++<a name="bytebase-v1-AuthService"></a>+### AuthService-<a name="bytebase-v1-ColumnMetadata"></a>+| Method Name | Request Type | Response Type | Description |+| ----------- | ------------ | ------------- | ------------|+| GetUser | [GetUserRequest](#bytebase-v1-GetUserRequest) | [User](#bytebase-v1-User) | |+| ListUsers | [ListUsersRequest](#bytebase-v1-ListUsersRequest) | [ListUsersResponse](#bytebase-v1-ListUsersResponse) | |+| CreateUser | [CreateUserRequest](#bytebase-v1-CreateUserRequest) | [User](#bytebase-v1-User) | |+| UpdateUser | [UpdateUserRequest](#bytebase-v1-UpdateUserRequest) | [User](#bytebase-v1-User) | |+| DeleteUser | [DeleteUserRequest](#bytebase-v1-DeleteUserRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | |+| UndeleteUser | [UndeleteUserRequest](#bytebase-v1-UndeleteUserRequest) | [User](#bytebase-v1-User) | |+| Login | [LoginRequest](#bytebase-v1-LoginRequest) | [LoginResponse](#bytebase-v1-LoginResponse) | |+| Logout | [LogoutRequest](#bytebase-v1-LogoutRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | |-### ColumnMetadata-ColumnMetadata is the metadata for columns.+-| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name is the name of a column. |-| position | [int32](#int32) | | The position is the position in columns. |-| default | [google.protobuf.StringValue](#google-protobuf-StringValue) | | The default is the default of a column. Use google.protobuf.StringValue to distinguish between an empty string default value or no default. |-| nullable | [bool](#bool) | | The nullable is the nullable of a column. |-| type | [string](#string) | | The type is the type of a column. |-| character_set | [string](#string) | | The character_set is the character_set of a column. |-| collation | [string](#string) | | The collation is the collation of a column. |-| comment | [string](#string) | | The comment is the comment of a column. |+<a name="v1_bookmark_service-proto"></a>+<p align="right"><a href="#top">Top</a></p>+## v1/bookmark_service.proto+<a name="bytebase-v1-Bookmark"></a>-<a name="bytebase-v1-CreateBackupRequest"></a>+### Bookmark-### CreateBackupRequest-CreateBackupRequest is the request message for CreateBackup.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| parent | [string](#string) | | The parent resource where this backup will be created. Format: instances/{instance}/databases/{database} |-| backup | [Backup](#bytebase-v1-Backup) | | |+| name | [string](#string) | | The name of the bookmark. Format: bookmarks/{bookmark}, user and bookmark are server-generated unique IDs. |+| title | [string](#string) | | The title of the bookmark. |+| link | [string](#string) | | The resource link of the bookmark. Only support issue link for now. Format: Issue: /issue/slug(issue_name)-{issue_uid} Example: /issue/start-here-add-email-column-to-employee-table-101 |-<a name="bytebase-v1-Database"></a>+<a name="bytebase-v1-CreateBookmarkRequest"></a>-### Database+### CreateBookmarkRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the database. Format: instances/{instance}/databases/{database} {database} is the database name in the instance. |-| uid | [string](#string) | | The system-assigned, unique identifier for a resource. |-| sync_state | [State](#bytebase-v1-State) | | The existence of a database on latest sync. |-| successful_sync_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | The latest synchronization time. |-| project | [string](#string) | | The project for a database. Format: projects/{project} |-| schema_version | [string](#string) | | The version of database schema. |-| labels | [Database.LabelsEntry](#bytebase-v1-Database-LabelsEntry) | repeated | Labels will be used for deployment and policy control. |+| bookmark | [Bookmark](#bytebase-v1-Bookmark) | | The bookmark to create. |-<a name="bytebase-v1-Database-LabelsEntry"></a>+<a name="bytebase-v1-DeleteBookmarkRequest"></a>-### Database.LabelsEntry+### DeleteBookmarkRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| key | [string](#string) | | |-| value | [string](#string) | | |+| name | [string](#string) | | The name of the bookmark to delete. Format: bookmarks/{bookmark} |-<a name="bytebase-v1-DatabaseMetadata"></a>+<a name="bytebase-v1-ListBookmarksRequest"></a>++### ListBookmarksRequest-### DatabaseMetadata-DatabaseMetadata is the metadata for databases.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | |-| schemas | [SchemaMetadata](#bytebase-v1-SchemaMetadata) | repeated | The schemas is the list of schemas in a database. |-| character_set | [string](#string) | | The character_set is the character set of a database. |-| collation | [string](#string) | | The collation is the collation of a database. |-| extensions | [ExtensionMetadata](#bytebase-v1-ExtensionMetadata) | repeated | The extensions is the list of extensions in a database. |+| page_size | [int32](#int32) | | Not used. The maximum number of bookmarks to return. The service may return fewer than this value. If unspecified, at most 50 bookmarks will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |+| page_token | [string](#string) | | Not used. A page token, received from a previous `ListBookmarks` call. Provide this to retrieve the subsequent page.+When paginating, all other parameters provided to `ListBookmarks` must match the call that provided the page token. |-<a name="bytebase-v1-DatabaseSchema"></a>-### DatabaseSchema-DatabaseMetadata is the metadata for databases.+<a name="bytebase-v1-ListBookmarksResponse"></a>++### ListBookmarksResponse+| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| schema | [string](#string) | | The schema dump from database. |+| bookmarks | [Bookmark](#bytebase-v1-Bookmark) | repeated | The list of bookmarks. |+| next_page_token | [string](#string) | | Not used. A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. |+-<a name="bytebase-v1-DeleteSecretRequest"></a>+-### DeleteSecretRequest++<a name="bytebase-v1-BookmarkService"></a>++### BookmarkService+++| Method Name | Request Type | Response Type | Description |+| ----------- | ------------ | ------------- | ------------|+| CreateBookmark | [CreateBookmarkRequest](#bytebase-v1-CreateBookmarkRequest) | [Bookmark](#bytebase-v1-Bookmark) | CreateBookmark creates a new bookmark. |+| DeleteBookmark | [DeleteBookmarkRequest](#bytebase-v1-DeleteBookmarkRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | DeleteBookmark deletes a bookmark. |+| ListBookmarks | [ListBookmarksRequest](#bytebase-v1-ListBookmarksRequest) | [ListBookmarksResponse](#bytebase-v1-ListBookmarksResponse) | ListBookmarks lists bookmarks. |+++-| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the secret to be deleted. Format: instances/{instance}/databases/{database}/secrets/{secret} |+<a name="v1_cel_service-proto"></a>+<p align="right"><a href="#top">Top</a></p>+## v1/cel_service.proto+<a name="bytebase-v1-DeparseRequest"></a>-<a name="bytebase-v1-DependentColumn"></a>+### DeparseRequest-### DependentColumn-DependentColumn is the metadata for dependent columns.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| schema | [string](#string) | | The schema is the schema of a reference column. |-| table | [string](#string) | | The table is the table of a reference column. |-| column | [string](#string) | | The column is the name of a reference column. |+| expression | [google.api.expr.v1alpha1.ParsedExpr](#google-api-expr-v1alpha1-ParsedExpr) | | |-<a name="bytebase-v1-ExtensionMetadata"></a>+<a name="bytebase-v1-DeparseResponse"></a>++### DeparseResponse-### ExtensionMetadata-ExtensionMetadata is the metadata for extensions.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name is the name of an extension. |-| schema | [string](#string) | | The schema is the extension that is installed to. But the extension usage is not limited to the schema. |-| version | [string](#string) | | The version is the version of an extension. |-| description | [string](#string) | | The description is the description of an extension. |+| expression | [string](#string) | | |-<a name="bytebase-v1-ForeignKeyMetadata"></a>+<a name="bytebase-v1-ParseRequest"></a>++### ParseRequest-### ForeignKeyMetadata-ForeignKeyMetadata is the metadata for foreign keys.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name is the name of a foreign key. |-| columns | [string](#string) | repeated | The columns are the ordered referencing columns of a foreign key. |-| referenced_schema | [string](#string) | | The referenced_schema is the referenced schema name of a foreign key. It is an empty string for databases without such concept such as MySQL. |-| referenced_table | [string](#string) | | The referenced_table is the referenced table name of a foreign key. |-| referenced_columns | [string](#string) | repeated | The referenced_columns are the ordered referenced columns of a foreign key. |-| on_delete | [string](#string) | | The on_delete is the on delete action of a foreign key. |-| on_update | [string](#string) | | The on_update is the on update action of a foreign key. |-| match_type | [string](#string) | | The match_type is the match type of a foreign key. The match_type is the PostgreSQL specific field. It's empty string for other databases. |+| expression | [string](#string) | | |-<a name="bytebase-v1-FunctionMetadata"></a>+<a name="bytebase-v1-ParseResponse"></a>++### ParseResponse-### FunctionMetadata-FunctionMetadata is the metadata for functions.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name is the name of a view. |-| definition | [string](#string) | | The definition is the definition of a view. |+| expression | [google.api.expr.v1alpha1.ParsedExpr](#google-api-expr-v1alpha1-ParsedExpr) | | |+-<a name="bytebase-v1-GetBackupSettingRequest"></a>+-### GetBackupSettingRequest++<a name="bytebase-v1-CelService"></a>-| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the database to retrieve backup setting. Format: instances/{instance}/databases/{database}/backupSetting |+### CelService+| Method Name | Request Type | Response Type | Description |+| ----------- | ------------ | ------------- | ------------|+| Parse | [ParseRequest](#bytebase-v1-ParseRequest) | [ParseResponse](#bytebase-v1-ParseResponse) | |+| Deparse | [DeparseRequest](#bytebase-v1-DeparseRequest) | [DeparseResponse](#bytebase-v1-DeparseResponse) | |+-<a name="bytebase-v1-GetChangeHistoryRequest"></a>+<a name="v1_vcs-proto"></a>+<p align="right"><a href="#top">Top</a></p>-### GetChangeHistoryRequest+## v1/vcs.proto++++<a name="bytebase-v1-Commit"></a>++### Commit| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the change history to retrieve. Format: instances/{instance}/databases/{database}/changeHistories/{changeHistory} |-| view | [ChangeHistoryView](#bytebase-v1-ChangeHistoryView) | | |-| sdl_format | [bool](#bool) | | Format the schema dump into SDL format. |+| id | [string](#string) | | |+| title | [string](#string) | | |+| message | [string](#string) | | |+| created_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |+| url | [string](#string) | | |+| author_name | [string](#string) | | |+| author_email | [string](#string) | | |+| added_list | [string](#string) | repeated | |+| modified_list | [string](#string) | repeated | |-<a name="bytebase-v1-GetDatabaseMetadataRequest"></a>+<a name="bytebase-v1-FileCommit"></a>-### GetDatabaseMetadataRequest+### FileCommit| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the database to retrieve metadata. Format: instances/{instance}/databases/{database}/metadata |+| id | [string](#string) | | |+| title | [string](#string) | | |+| message | [string](#string) | | |+| created_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |+| url | [string](#string) | | |+| author_name | [string](#string) | | |+| author_email | [string](#string) | | |+| added | [string](#string) | | |-<a name="bytebase-v1-GetDatabaseRequest"></a>+<a name="bytebase-v1-PushEvent"></a>-### GetDatabaseRequest+### PushEvent| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the database to retrieve. Format: instances/{instance}/databases/{database} |+| vcs_type | [VcsType](#bytebase-v1-VcsType) | | |+| base_dir | [string](#string) | | |+| ref | [string](#string) | | |+| before | [string](#string) | | |+| after | [string](#string) | | |+| repository_id | [string](#string) | | |+| repository_url | [string](#string) | | |+| repository_full_path | [string](#string) | | |+| author_name | [string](#string) | | |+| commits | [Commit](#bytebase-v1-Commit) | repeated | |+| file_commit | [FileCommit](#bytebase-v1-FileCommit) | | |+-<a name="bytebase-v1-GetDatabaseSchemaRequest"></a>-### GetDatabaseSchemaRequest+<a name="bytebase-v1-VcsType"></a>+### VcsType-| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the database to retrieve schema. Format: instances/{instance}/databases/{database}/schema |-| sdl_format | [bool](#bool) | | Format the schema dump into SDL format. |+| Name | Number | Description |+| ---- | ------ | ----------- |+| VCS_TYPE_UNSPECIFIED | 0 | |+| GITLAB | 1 | |+| GITHUB | 2 | |+| BITBUCKET | 3 | |+++-<a name="bytebase-v1-IndexMetadata"></a>-### IndexMetadata-IndexMetadata is the metadata for indexes.+<a name="v1_database_service-proto"></a>+<p align="right"><a href="#top">Top</a></p>++## v1/database_service.proto++++<a name="bytebase-v1-AdviseIndexRequest"></a>++### AdviseIndexRequest+AdviseIndexRequest is the request of advising index.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name is the name of an index. |-| expressions | [string](#string) | repeated | The expressions are the ordered columns or expressions of an index. This could refer to a column or an expression. |-| type | [string](#string) | | The type is the type of an index. |-| unique | [bool](#bool) | | The unique is whether the index is unique. |-| primary | [bool](#bool) | | The primary is whether the index is a primary key index. |-| visible | [bool](#bool) | | The visible is whether the index is visible. |-| comment | [string](#string) | | The comment is the comment of an index. |+| parent | [string](#string) | | Format: instances/{instance}/databases/{database} |+| statement | [string](#string) | | The statement to be advised. |-<a name="bytebase-v1-ListBackupsRequest"></a>+<a name="bytebase-v1-AdviseIndexResponse"></a>-### ListBackupsRequest-ListBackupsRequest is the request message for ListBackup.+### AdviseIndexResponse+AdviseIndexResponse is the response of advising index.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| parent | [string](#string) | | The parent resource where this backup will be created. Format: instances/{instance}/databases/{database} |-| page_size | [int32](#int32) | | Not used. The maximum number of backups to return. The service may return fewer than this value. If unspecified, at most 50 backups will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |-| page_token | [string](#string) | | Not used. A page token, received from a previous `ListBackup` call. Provide this to retrieve the subsequent page.--When paginating, all other parameters provided to `ListBackup` must match the call that provided the page token. |-+| current_index | [string](#string) | | The current index of the statement used. |+| suggestion | [string](#string) | | The suggested index of the statement. |+| create_index_statement | [string](#string) | | The create index statement of the suggested index. |-<a name="bytebase-v1-ListBackupsResponse"></a>-### ListBackupsResponse+<a name="bytebase-v1-Backup"></a>+### Backup+The message of the backup.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| backups | [Backup](#bytebase-v1-Backup) | repeated | The backups from the specified request. |-| next_page_token | [string](#string) | | Not used. A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. |-+| name | [string](#string) | | The resource name of the database backup. backup-name is specified by the client. Format: instances/{instance}/databases/{database}/backups/{backup-name} |+| create_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | The timestamp when the backup resource was created initially. |+| update_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | The timestamp when the backup resource was updated. |+| state | [Backup.BackupState](#bytebase-v1-Backup-BackupState) | | The state of the backup. |+| backup_type | [Backup.BackupType](#bytebase-v1-Backup-BackupType) | | The type of the backup. |+| comment | [string](#string) | | The comment of the backup. |+| uid | [string](#string) | | |-<a name="bytebase-v1-ListChangeHistoriesRequest"></a>-### ListChangeHistoriesRequest+<a name="bytebase-v1-BackupSetting"></a>+### BackupSetting+BackupSetting is the setting for database backup.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| parent | [string](#string) | | The parent of the change histories. Format: instances/{instance}/databases/{database} |-| page_size | [int32](#int32) | | The maximum number of change histories to return. The service may return fewer than this value. If unspecified, at most 10 change histories will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |-| page_token | [string](#string) | | Not used. A page token, received from a previous `ListChangeHistories` call. Provide this to retrieve the subsequent page.+| name | [string](#string) | | The name of the database backup setting. Format: instances/{instance}/databases/{database}/backupSetting |+| backup_retain_duration | [google.protobuf.Duration](#google-protobuf-Duration) | | The default maximum age of a Backup created via this BackupPlan. If specified, a Backup will be automatically deleted after its age reaches. If not specified, Backups created under this BackupPlan will be deleted after 7 DAYS. It will be rounded up to the number of days. |+| cron_schedule | [string](#string) | | Cron(https://wikipedia.com/wiki/cron) string that defines a repeating schedule for creating Backups. Support hour of day, day of week. (UTC time)-When paginating, all other parameters provided to `ListChangeHistories` must match the call that provided the page token. |-| view | [ChangeHistoryView](#bytebase-v1-ChangeHistoryView) | | |+Default (empty): Disable automatic backup. |+| hook_url | [string](#string) | | hook_url(https://www.bytebase.com/docs/disaster-recovery/backup/#post-backup-webhook) is the URL to send a notification when a backup is created. |-<a name="bytebase-v1-ListChangeHistoriesResponse"></a>+<a name="bytebase-v1-BatchUpdateDatabasesRequest"></a>-### ListChangeHistoriesResponse+### BatchUpdateDatabasesRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| change_histories | [ChangeHistory](#bytebase-v1-ChangeHistory) | repeated | The list of change histories. |-| next_page_token | [string](#string) | | A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. |+| parent | [string](#string) | | The parent resource shared by all databases being updated. Format: instances/{instance} If the operation spans parents, a dash (-) may be accepted as a wildcard. We only support updating the project of databases for now. |+| requests | [UpdateDatabaseRequest](#bytebase-v1-UpdateDatabaseRequest) | repeated | The request message specifying the resources to update. A maximum of 1000 databases can be modified in a batch. |-<a name="bytebase-v1-ListDatabasesRequest"></a>+<a name="bytebase-v1-BatchUpdateDatabasesResponse"></a>-### ListDatabasesRequest+### BatchUpdateDatabasesResponse| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| parent | [string](#string) | | The parent, which owns this collection of databases. Format: instances/{instance} Use "instances/-" to list all databases. |-| page_size | [int32](#int32) | | The maximum number of databases to return. The service may return fewer than this value. If unspecified, at most 50 databases will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |-| page_token | [string](#string) | | A page token, received from a previous `ListDatabases` call. Provide this to retrieve the subsequent page.--When paginating, all other parameters provided to `ListDatabases` must match the call that provided the page token. |-| filter | [string](#string) | | Filter is used to filter databases returned in the list. For example, "project = projects/{project}" can be used to list databases in a project. |+| databases | [Database](#bytebase-v1-Database) | repeated | Databases updated. |-<a name="bytebase-v1-ListDatabasesResponse"></a>+<a name="bytebase-v1-ChangeHistory"></a>-### ListDatabasesResponse+### ChangeHistory| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| databases | [Database](#bytebase-v1-Database) | repeated | The databases from the specified request. |-| next_page_token | [string](#string) | | A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. |-+| name | [string](#string) | | Format: instances/{instance}/databases/{database}/changeHistories/{changeHistory} |+| uid | [string](#string) | | |+| creator | [string](#string) | | Format: users/[email protected] |+| updater | [string](#string) | | Format: users/[email protected] |+| create_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |+| update_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |+| release_version | [string](#string) | | release version of Bytebase |+| source | [ChangeHistory.Source](#bytebase-v1-ChangeHistory-Source) | | |+| type | [ChangeHistory.Type](#bytebase-v1-ChangeHistory-Type) | | |+| status | [ChangeHistory.Status](#bytebase-v1-ChangeHistory-Status) | | |+| version | [string](#string) | | |+| description | [string](#string) | | |+| statement | [string](#string) | | |+| schema | [string](#string) | | |+| prev_schema | [string](#string) | | |+| execution_duration | [google.protobuf.Duration](#google-protobuf-Duration) | | |+| review | [string](#string) | | Format: projects/{project}/reviews/{review} |+| push_event | [PushEvent](#bytebase-v1-PushEvent) | | |-<a name="bytebase-v1-ListSecretsRequest"></a>-### ListSecretsRequest+<a name="bytebase-v1-ColumnMetadata"></a>+### ColumnMetadata+ColumnMetadata is the metadata for columns.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| parent | [string](#string) | | The parent of the secret. Format: instances/{instance}/databases/{database} |-| page_size | [int32](#int32) | | Not used. The maximum number of databases to return. The service may return fewer than this value. If unspecified, at most 50 databases will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |-| page_token | [string](#string) | | Not used. A page token, received from a previous `ListSecrets` call. Provide this to retrieve the subsequent page.--When paginating, all other parameters provided to `ListSecrets` must match the call that provided the page token. |-+| name | [string](#string) | | The name is the name of a column. |+| position | [int32](#int32) | | The position is the position in columns. |+| default | [google.protobuf.StringValue](#google-protobuf-StringValue) | | The default is the default of a column. Use google.protobuf.StringValue to distinguish between an empty string default value or no default. |+| nullable | [bool](#bool) | | The nullable is the nullable of a column. |+| type | [string](#string) | | The type is the type of a column. |+| character_set | [string](#string) | | The character_set is the character_set of a column. |+| collation | [string](#string) | | The collation is the collation of a column. |+| comment | [string](#string) | | The comment is the comment of a column. |-<a name="bytebase-v1-ListSecretsResponse"></a>-### ListSecretsResponse+<a name="bytebase-v1-CreateBackupRequest"></a>+### CreateBackupRequest+CreateBackupRequest is the request message for CreateBackup.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| secrets | [Secret](#bytebase-v1-Secret) | repeated | The list of secrets. |-| next_page_token | [string](#string) | | Not used. A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. |+| parent | [string](#string) | | The parent resource where this backup will be created. Format: instances/{instance}/databases/{database} |+| backup | [Backup](#bytebase-v1-Backup) | | |-<a name="bytebase-v1-ListSlowQueriesRequest"></a>+<a name="bytebase-v1-Database"></a>++### Database-### ListSlowQueriesRequest-ListSlowQueriesRequest is the request of listing slow query.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| parent | [string](#string) | | Format: instances/{instance}/databases/{database} |-| filter | [string](#string) | | The filter of the slow query log. follow the [ebnf](https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form) syntax. Support filter by project and start_time in SlowQueryDetails for now. For example: Search the slow query log of the specific project: - the specific project: project = "projects/{project}" Search the slow query log that start_time after 2022-01-01T12:00:00.000Z: - start_time > "2022-01-01T12:00:00.000Z" - Should use [RFC-3339 format](https://www.rfc-editor.org/rfc/rfc3339). - Currently we only support filtering down to date granularity. |-| order_by | [string](#string) | | The order by of the slow query log. Support order by count, latest_log_time, average_query_time, maximum_query_time, average_rows_sent, maximum_rows_sent, average_rows_examined, maximum_rows_examined for now. For example: - order by count: order_by = "count" - order by latest_log_time desc: order_by = "latest_log_time desc" Default: order by average_query_time desc. |+| name | [string](#string) | | The name of the database. Format: instances/{instance}/databases/{database} {database} is the database name in the instance. |+| uid | [string](#string) | | The system-assigned, unique identifier for a resource. |+| sync_state | [State](#bytebase-v1-State) | | The existence of a database on latest sync. |+| successful_sync_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | The latest synchronization time. |+| project | [string](#string) | | The project for a database. Format: projects/{project} |+| schema_version | [string](#string) | | The version of database schema. |+| labels | [Database.LabelsEntry](#bytebase-v1-Database-LabelsEntry) | repeated | Labels will be used for deployment and policy control. |-<a name="bytebase-v1-ListSlowQueriesResponse"></a>+<a name="bytebase-v1-Database-LabelsEntry"></a>++### Database.LabelsEntry-### ListSlowQueriesResponse-ListSlowQueriesResponse is the response of listing slow query.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| slow_query_logs | [SlowQueryLog](#bytebase-v1-SlowQueryLog) | repeated | The slow query logs. |+| key | [string](#string) | | |+| value | [string](#string) | | |-<a name="bytebase-v1-SchemaMetadata"></a>+<a name="bytebase-v1-DatabaseMetadata"></a>-### SchemaMetadata-SchemaMetadata is the metadata for schemas.-This is the concept of schema in Postgres, but it's a no-op for MySQL.+### DatabaseMetadata+DatabaseMetadata is the metadata for databases.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name is the schema name. It is an empty string for databases without such concept such as MySQL. |-| tables | [TableMetadata](#bytebase-v1-TableMetadata) | repeated | The tables is the list of tables in a schema. |-| views | [ViewMetadata](#bytebase-v1-ViewMetadata) | repeated | The views is the list of views in a schema. |-| functions | [FunctionMetadata](#bytebase-v1-FunctionMetadata) | repeated | The functions is the list of functions in a schema. |-+| name | [string](#string) | | |+| schemas | [SchemaMetadata](#bytebase-v1-SchemaMetadata) | repeated | The schemas is the list of schemas in a database. |+| character_set | [string](#string) | | The character_set is the character set of a database. |+| collation | [string](#string) | | The collation is the collation of a database. |+| extensions | [ExtensionMetadata](#bytebase-v1-ExtensionMetadata) | repeated | The extensions is the list of extensions in a database. |-<a name="bytebase-v1-SearchDatabasesRequest"></a>-### SearchDatabasesRequest+<a name="bytebase-v1-DatabaseSchema"></a>+### DatabaseSchema+DatabaseMetadata is the metadata for databases.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| parent | [string](#string) | | The parent, which owns this collection of databases. Format: instances/{instance} Use "instances/-" to list all databases. |-| page_size | [int32](#int32) | | The maximum number of databases to return. The service may return fewer than this value. If unspecified, at most 50 databases will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |-| page_token | [string](#string) | | A page token, received from a previous `ListDatabases` call. Provide this to retrieve the subsequent page.--When paginating, all other parameters provided to `ListDatabases` must match the call that provided the page token. |-| filter | [string](#string) | | Filter is used to filter databases returned in the list. For example, "project = projects/{project}" can be used to list databases in a project. |+| schema | [string](#string) | | The schema dump from database. |-<a name="bytebase-v1-SearchDatabasesResponse"></a>+<a name="bytebase-v1-DeleteSecretRequest"></a>-### SearchDatabasesResponse+### DeleteSecretRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| databases | [Database](#bytebase-v1-Database) | repeated | The databases from the specified request. |-| next_page_token | [string](#string) | | A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. |+| name | [string](#string) | | The name of the secret to be deleted. Format: instances/{instance}/databases/{database}/secrets/{secret} |-<a name="bytebase-v1-Secret"></a>+<a name="bytebase-v1-DependentColumn"></a>-### Secret-Secret is the secret of the database now.+### DependentColumn+DependentColumn is the metadata for dependent columns.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | name is the unique name of the secret, which is specified by the client. Format: instances/{instance}/databases/{database}/secrets/{secret} |-| created_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | Not used. The timestamp when the secret resource was created initially. |-| updated_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | Not used. The timestamp when the secret resource was updated. |-| value | [string](#string) | | The value of the secret. |-| description | [string](#string) | | The description of the secret. |+| schema | [string](#string) | | The schema is the schema of a reference column. |+| table | [string](#string) | | The table is the table of a reference column. |+| column | [string](#string) | | The column is the name of a reference column. |-<a name="bytebase-v1-SlowQueryDetails"></a>+<a name="bytebase-v1-ExtensionMetadata"></a>-### SlowQueryDetails-SlowQueryDetails is the details of the slow query log.+### ExtensionMetadata+ExtensionMetadata is the metadata for extensions.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| start_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | The start time of the slow query log. |-| query_time | [google.protobuf.Duration](#google-protobuf-Duration) | | The query time of the slow query log. |-| lock_time | [google.protobuf.Duration](#google-protobuf-Duration) | | The lock time of the slow query log. |-| rows_sent | [int64](#int64) | | The rows sent of the slow query log. |-| rows_examined | [int64](#int64) | | The rows examined of the slow query log. |-| sql_text | [string](#string) | | The sql text of the slow query log. |+| name | [string](#string) | | The name is the name of an extension. |+| schema | [string](#string) | | The schema is the extension that is installed to. But the extension usage is not limited to the schema. |+| version | [string](#string) | | The version is the version of an extension. |+| description | [string](#string) | | The description is the description of an extension. |-<a name="bytebase-v1-SlowQueryLog"></a>+<a name="bytebase-v1-ForeignKeyMetadata"></a>-### SlowQueryLog-SlowQueryLog is the slow query log.+### ForeignKeyMetadata+ForeignKeyMetadata is the metadata for foreign keys.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| resource | [string](#string) | | The resource of the slow query log. The format is "instances/{instance}/databases/{database}". |-| project | [string](#string) | | The project of the slow query log. The format is "projects/{project}". |-| statistics | [SlowQueryStatistics](#bytebase-v1-SlowQueryStatistics) | | The statistics of the slow query log. |+| name | [string](#string) | | The name is the name of a foreign key. |+| columns | [string](#string) | repeated | The columns are the ordered referencing columns of a foreign key. |+| referenced_schema | [string](#string) | | The referenced_schema is the referenced schema name of a foreign key. It is an empty string for databases without such concept such as MySQL. |+| referenced_table | [string](#string) | | The referenced_table is the referenced table name of a foreign key. |+| referenced_columns | [string](#string) | repeated | The referenced_columns are the ordered referenced columns of a foreign key. |+| on_delete | [string](#string) | | The on_delete is the on delete action of a foreign key. |+| on_update | [string](#string) | | The on_update is the on update action of a foreign key. |+| match_type | [string](#string) | | The match_type is the match type of a foreign key. The match_type is the PostgreSQL specific field. It's empty string for other databases. |-<a name="bytebase-v1-SlowQueryStatistics"></a>+<a name="bytebase-v1-FunctionMetadata"></a>-### SlowQueryStatistics-SlowQueryStatistics is the statistics of the slow query log.+### FunctionMetadata+FunctionMetadata is the metadata for functions.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| sql_fingerprint | [string](#string) | | The fingerprint of the slow query log. |-| count | [int64](#int64) | | The count of the slow query log. |-| latest_log_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | The latest log time of the slow query log. |-| average_query_time | [google.protobuf.Duration](#google-protobuf-Duration) | | The average query time of the slow query log. |-| maximum_query_time | [google.protobuf.Duration](#google-protobuf-Duration) | | The maximum query time of the slow query log. |-| average_rows_sent | [int64](#int64) | | The average rows sent of the slow query log. |-| maximum_rows_sent | [int64](#int64) | | The maximum rows sent of the slow query log. |-| average_rows_examined | [int64](#int64) | | The average rows examined of the slow query log. |-| maximum_rows_examined | [int64](#int64) | | The maximum rows examined of the slow query log. |-| query_time_percent | [double](#double) | | The percentage of the query time. |-| count_percent | [double](#double) | | The percentage of the count. |-| samples | [SlowQueryDetails](#bytebase-v1-SlowQueryDetails) | repeated | Samples are details of the sample slow query logs with the same fingerprint. |+| name | [string](#string) | | The name is the name of a view. |+| definition | [string](#string) | | The definition is the definition of a view. |-<a name="bytebase-v1-SyncDatabaseRequest"></a>+<a name="bytebase-v1-GetBackupSettingRequest"></a>-### SyncDatabaseRequest+### GetBackupSettingRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the database to sync. Format: instances/{instance}/databases/{database} |+| name | [string](#string) | | The name of the database to retrieve backup setting. Format: instances/{instance}/databases/{database}/backupSetting |-<a name="bytebase-v1-SyncDatabaseResponse"></a>+<a name="bytebase-v1-GetChangeHistoryRequest"></a>-### SyncDatabaseResponse+### GetChangeHistoryRequest+| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| name | [string](#string) | | The name of the change history to retrieve. Format: instances/{instance}/databases/{database}/changeHistories/{changeHistory} |+| view | [ChangeHistoryView](#bytebase-v1-ChangeHistoryView) | | |+| sdl_format | [bool](#bool) | | Format the schema dump into SDL format. |-<a name="bytebase-v1-TableMetadata"></a>-### TableMetadata-TableMetadata is the metadata for tables.++<a name="bytebase-v1-GetDatabaseMetadataRequest"></a>++### GetDatabaseMetadataRequest+| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name is the name of a table. |-| columns | [ColumnMetadata](#bytebase-v1-ColumnMetadata) | repeated | The columns is the ordered list of columns in a table. |-| indexes | [IndexMetadata](#bytebase-v1-IndexMetadata) | repeated | The indexes is the list of indexes in a table. |-| engine | [string](#string) | | The engine is the engine of a table. |-| collation | [string](#string) | | The collation is the collation of a table. |-| row_count | [int64](#int64) | | The row_count is the estimated number of rows of a table. |-| data_size | [int64](#int64) | | The data_size is the estimated data size of a table. |-| index_size | [int64](#int64) | | The index_size is the estimated index size of a table. |-| data_free | [int64](#int64) | | The data_free is the estimated free data size of a table. |-| create_options | [string](#string) | | The create_options is the create option of a table. |-| comment | [string](#string) | | The comment is the comment of a table. |-| foreign_keys | [ForeignKeyMetadata](#bytebase-v1-ForeignKeyMetadata) | repeated | The foreign_keys is the list of foreign keys in a table. |+| name | [string](#string) | | The name of the database to retrieve metadata. Format: instances/{instance}/databases/{database}/metadata |-<a name="bytebase-v1-UpdateBackupSettingRequest"></a>+<a name="bytebase-v1-GetDatabaseRequest"></a>-### UpdateBackupSettingRequest+### GetDatabaseRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| setting | [BackupSetting](#bytebase-v1-BackupSetting) | | The database backup setting to update. |+| name | [string](#string) | | The name of the database to retrieve. Format: instances/{instance}/databases/{database} |-<a name="bytebase-v1-UpdateDatabaseRequest"></a>+<a name="bytebase-v1-GetDatabaseSchemaRequest"></a>-### UpdateDatabaseRequest+### GetDatabaseSchemaRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| database | [Database](#bytebase-v1-Database) | | The database to update.--The database's `name` field is used to identify the database to update. Format: instances/{instance}/databases/{database} |-| update_mask | [google.protobuf.FieldMask](#google-protobuf-FieldMask) | | The list of fields to update. |-+| name | [string](#string) | | The name of the database to retrieve schema. Format: instances/{instance}/databases/{database}/schema |+| sdl_format | [bool](#bool) | | Format the schema dump into SDL format. |-<a name="bytebase-v1-UpdateSecretRequest"></a>-### UpdateSecretRequest+<a name="bytebase-v1-IndexMetadata"></a>+### IndexMetadata+IndexMetadata is the metadata for indexes.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| secret | [Secret](#bytebase-v1-Secret) | | The secret to be created or updated. |-| update_mask | [google.protobuf.FieldMask](#google-protobuf-FieldMask) | | The mask of the fields to be updated. |-| allow_missing | [bool](#bool) | | If true, the secret will be created if it does not exist. |+| name | [string](#string) | | The name is the name of an index. |+| expressions | [string](#string) | repeated | The expressions are the ordered columns or expressions of an index. This could refer to a column or an expression. |+| type | [string](#string) | | The type is the type of an index. |+| unique | [bool](#bool) | | The unique is whether the index is unique. |+| primary | [bool](#bool) | | The primary is whether the index is a primary key index. |+| visible | [bool](#bool) | | The visible is whether the index is visible. |+| comment | [string](#string) | | The comment is the comment of an index. |-<a name="bytebase-v1-ViewMetadata"></a>+<a name="bytebase-v1-ListBackupsRequest"></a>-### ViewMetadata-ViewMetadata is the metadata for views.+### ListBackupsRequest+ListBackupsRequest is the request message for ListBackup.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name is the name of a view. |-| definition | [string](#string) | | The definition is the definition of a view. |-| comment | [string](#string) | | The comment is the comment of a view. |-| dependent_columns | [DependentColumn](#bytebase-v1-DependentColumn) | repeated | The dependent_columns is the list of dependent columns of a view. |+| parent | [string](#string) | | The parent resource where this backup will be created. Format: instances/{instance}/databases/{database} |+| page_size | [int32](#int32) | | Not used. The maximum number of backups to return. The service may return fewer than this value. If unspecified, at most 50 backups will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |+| page_token | [string](#string) | | Not used. A page token, received from a previous `ListBackup` call. Provide this to retrieve the subsequent page.+When paginating, all other parameters provided to `ListBackup` must match the call that provided the page token. |--<a name="bytebase-v1-Backup-BackupState"></a>+<a name="bytebase-v1-ListBackupsResponse"></a>-### Backup.BackupState-The state of the backup.+### ListBackupsResponse-| Name | Number | Description |-| ---- | ------ | ----------- |-| BACKUP_STATE_UNSPECIFIED | 0 | The state of the backup is unknown. |-| PENDING_CREATE | 1 | The backup is being pending to create. |-| DONE | 2 | The backup is ready to use. |-| FAILED | 3 | The backup is being deleted. |+| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| backups | [Backup](#bytebase-v1-Backup) | repeated | The backups from the specified request. |+| next_page_token | [string](#string) | | Not used. A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. |-<a name="bytebase-v1-Backup-BackupType"></a>-### Backup.BackupType-The type of the backup.-| Name | Number | Description |-| ---- | ------ | ----------- |-| BACKUP_TYPE_UNSPECIFIED | 0 | The type of the backup is unknown. |-| MANUAL | 1 | The backup is created by user. |-| AUTOMATIC | 2 | The backup is created by automatic backup. |-| PITR | 3 | The backup is created automatically after doing PITR. |-<a name="bytebase-v1-ChangeHistory-Source"></a>+<a name="bytebase-v1-ListChangeHistoriesRequest"></a>-### ChangeHistory.Source+### ListChangeHistoriesRequest-| Name | Number | Description |-| ---- | ------ | ----------- |-| SOURCE_UNSPECIFIED | 0 | |-| UI | 1 | |-| VCS | 2 | |-| LIBRARY | 3 | |+| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| parent | [string](#string) | | The parent of the change histories. Format: instances/{instance}/databases/{database} |+| page_size | [int32](#int32) | | The maximum number of change histories to return. The service may return fewer than this value. If unspecified, at most 10 change histories will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |+| page_token | [string](#string) | | Not used. A page token, received from a previous `ListChangeHistories` call. Provide this to retrieve the subsequent page.+When paginating, all other parameters provided to `ListChangeHistories` must match the call that provided the page token. |+| view | [ChangeHistoryView](#bytebase-v1-ChangeHistoryView) | | |-<a name="bytebase-v1-ChangeHistory-Status"></a>-### ChangeHistory.Status-| Name | Number | Description |-| ---- | ------ | ----------- |-| STATUS_UNSPECIFIED | 0 | |-| PENDING | 1 | |-| DONE | 2 | |-| FAILED | 3 | |+<a name="bytebase-v1-ListChangeHistoriesResponse"></a>-<a name="bytebase-v1-ChangeHistory-Type"></a>+### ListChangeHistoriesResponse-### ChangeHistory.Type-| Name | Number | Description |-| ---- | ------ | ----------- |-| TYPE_UNSPECIFIED | 0 | |-| BASELINE | 1 | |-| MIGRATE | 2 | |-| MIGRATE_SDL | 3 | |-| MIGRATE_GHOST | 4 | |-| BRANCH | 5 | |-| DATA | 6 | |+| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| change_histories | [ChangeHistory](#bytebase-v1-ChangeHistory) | repeated | The list of change histories. |+| next_page_token | [string](#string) | | A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. |-<a name="bytebase-v1-ChangeHistoryView"></a>-### ChangeHistoryView-| Name | Number | Description |-| ---- | ------ | ----------- |-| CHANGE_HISTORY_VIEW_UNSPECIFIED | 0 | The default / unset value. The API will default to the BASIC view. |-| CHANGE_HISTORY_VIEW_BASIC | 1 | |-| CHANGE_HISTORY_VIEW_FULL | 2 | |+<a name="bytebase-v1-ListDatabasesRequest"></a>+### ListDatabasesRequest--+| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| parent | [string](#string) | | The parent, which owns this collection of databases. Format: instances/{instance} Use "instances/-" to list all databases. |+| page_size | [int32](#int32) | | The maximum number of databases to return. The service may return fewer than this value. If unspecified, at most 50 databases will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |+| page_token | [string](#string) | | A page token, received from a previous `ListDatabases` call. Provide this to retrieve the subsequent page.-<a name="bytebase-v1-DatabaseService"></a>+When paginating, all other parameters provided to `ListDatabases` must match the call that provided the page token. |+| filter | [string](#string) | | Filter is used to filter databases returned in the list. For example, "project = projects/{project}" can be used to list databases in a project. |-### DatabaseService-| Method Name | Request Type | Response Type | Description |-| ----------- | ------------ | ------------- | ------------|-| GetDatabase | [GetDatabaseRequest](#bytebase-v1-GetDatabaseRequest) | [Database](#bytebase-v1-Database) | |-| ListDatabases | [ListDatabasesRequest](#bytebase-v1-ListDatabasesRequest) | [ListDatabasesResponse](#bytebase-v1-ListDatabasesResponse) | |-| SearchDatabases | [SearchDatabasesRequest](#bytebase-v1-SearchDatabasesRequest) | [SearchDatabasesResponse](#bytebase-v1-SearchDatabasesResponse) | Search for databases that the caller has both projects.get permission on, and also satisfy the specified query. |-| UpdateDatabase | [UpdateDatabaseRequest](#bytebase-v1-UpdateDatabaseRequest) | [Database](#bytebase-v1-Database) | |-| BatchUpdateDatabases | [BatchUpdateDatabasesRequest](#bytebase-v1-BatchUpdateDatabasesRequest) | [BatchUpdateDatabasesResponse](#bytebase-v1-BatchUpdateDatabasesResponse) | |-| SyncDatabase | [SyncDatabaseRequest](#bytebase-v1-SyncDatabaseRequest) | [SyncDatabaseResponse](#bytebase-v1-SyncDatabaseResponse) | |-| GetDatabaseMetadata | [GetDatabaseMetadataRequest](#bytebase-v1-GetDatabaseMetadataRequest) | [DatabaseMetadata](#bytebase-v1-DatabaseMetadata) | |-| GetDatabaseSchema | [GetDatabaseSchemaRequest](#bytebase-v1-GetDatabaseSchemaRequest) | [DatabaseSchema](#bytebase-v1-DatabaseSchema) | |-| GetBackupSetting | [GetBackupSettingRequest](#bytebase-v1-GetBackupSettingRequest) | [BackupSetting](#bytebase-v1-BackupSetting) | |-| UpdateBackupSetting | [UpdateBackupSettingRequest](#bytebase-v1-UpdateBackupSettingRequest) | [BackupSetting](#bytebase-v1-BackupSetting) | |-| CreateBackup | [CreateBackupRequest](#bytebase-v1-CreateBackupRequest) | [Backup](#bytebase-v1-Backup) | |-| ListBackups | [ListBackupsRequest](#bytebase-v1-ListBackupsRequest) | [ListBackupsResponse](#bytebase-v1-ListBackupsResponse) | |-| ListSlowQueries | [ListSlowQueriesRequest](#bytebase-v1-ListSlowQueriesRequest) | [ListSlowQueriesResponse](#bytebase-v1-ListSlowQueriesResponse) | |-| ListSecrets | [ListSecretsRequest](#bytebase-v1-ListSecretsRequest) | [ListSecretsResponse](#bytebase-v1-ListSecretsResponse) | |-| UpdateSecret | [UpdateSecretRequest](#bytebase-v1-UpdateSecretRequest) | [Secret](#bytebase-v1-Secret) | |-| DeleteSecret | [DeleteSecretRequest](#bytebase-v1-DeleteSecretRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | |-| AdviseIndex | [AdviseIndexRequest](#bytebase-v1-AdviseIndexRequest) | [AdviseIndexResponse](#bytebase-v1-AdviseIndexResponse) | |-| ListChangeHistories | [ListChangeHistoriesRequest](#bytebase-v1-ListChangeHistoriesRequest) | [ListChangeHistoriesResponse](#bytebase-v1-ListChangeHistoriesResponse) | |-| GetChangeHistory | [GetChangeHistoryRequest](#bytebase-v1-GetChangeHistoryRequest) | [ChangeHistory](#bytebase-v1-ChangeHistory) | |-+<a name="bytebase-v1-ListDatabasesResponse"></a>-<a name="v1_deployment-proto"></a>-<p align="right"><a href="#top">Top</a></p>+### ListDatabasesResponse-## v1/deployment.proto-+| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| databases | [Database](#bytebase-v1-Database) | repeated | The databases from the specified request. |+| next_page_token | [string](#string) | | A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. |-<a name="bytebase-v1-DeploymentType"></a>-### DeploymentType-| Name | Number | Description |-| ---- | ------ | ----------- |-| DEPLOYMENT_TYPE_UNSPECIFIED | 0 | |-| DATABASE_CREATE | 1 | |-| DATABASE_DDL | 2 | |-| DATABASE_DDL_GHOST | 3 | |-| DATABASE_DML | 4 | |-| DATABASE_RESTORE_PITR | 5 | |+<a name="bytebase-v1-ListSecretsRequest"></a>-+### ListSecretsRequest--+| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| parent | [string](#string) | | The parent of the secret. Format: instances/{instance}/databases/{database} |+| page_size | [int32](#int32) | | Not used. The maximum number of databases to return. The service may return fewer than this value. If unspecified, at most 50 databases will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |+| page_token | [string](#string) | | Not used. A page token, received from a previous `ListSecrets` call. Provide this to retrieve the subsequent page.+When paginating, all other parameters provided to `ListSecrets` must match the call that provided the page token. |-<a name="v1_environment_service-proto"></a>-<p align="right"><a href="#top">Top</a></p>-## v1/environment_service.proto-<a name="bytebase-v1-CreateEnvironmentRequest"></a>-### CreateEnvironmentRequest+<a name="bytebase-v1-ListSecretsResponse"></a>++### ListSecretsResponse| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| environment | [Environment](#bytebase-v1-Environment) | | The environment to create. |-| environment_id | [string](#string) | | The ID to use for the environment, which will become the final component of the environment's resource name.--This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/. |-+| secrets | [Secret](#bytebase-v1-Secret) | repeated | The list of secrets. |+| next_page_token | [string](#string) | | Not used. A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. |-<a name="bytebase-v1-DeleteEnvironmentRequest"></a>-### DeleteEnvironmentRequest+<a name="bytebase-v1-ListSlowQueriesRequest"></a>+### ListSlowQueriesRequest+ListSlowQueriesRequest is the request of listing slow query.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the environment to delete. Format: environments/{environment} |-+| parent | [string](#string) | | Format: instances/{instance}/databases/{database} |+| filter | [string](#string) | | The filter of the slow query log. follow the [ebnf](https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form) syntax. Support filter by project and start_time in SlowQueryDetails for now. For example: Search the slow query log of the specific project: - the specific project: project = "projects/{project}" Search the slow query log that start_time after 2022-01-01T12:00:00.000Z: - start_time > "2022-01-01T12:00:00.000Z" - Should use [RFC-3339 format](https://www.rfc-editor.org/rfc/rfc3339). - Currently we only support filtering down to date granularity. |+| order_by | [string](#string) | | The order by of the slow query log. Support order by count, latest_log_time, average_query_time, maximum_query_time, average_rows_sent, maximum_rows_sent, average_rows_examined, maximum_rows_examined for now. For example: - order by count: order_by = "count" - order by latest_log_time desc: order_by = "latest_log_time desc" Default: order by average_query_time desc. |-<a name="bytebase-v1-Environment"></a>-### Environment+<a name="bytebase-v1-ListSlowQueriesResponse"></a>+### ListSlowQueriesResponse+ListSlowQueriesResponse is the response of listing slow query.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the environment. Format: environments/{environment} |-| uid | [string](#string) | | The system-assigned, unique identifier for a resource. |-| state | [State](#bytebase-v1-State) | | |-| title | [string](#string) | | |-| order | [int32](#int32) | | |-| tier | [EnvironmentTier](#bytebase-v1-EnvironmentTier) | | |-+| slow_query_logs | [SlowQueryLog](#bytebase-v1-SlowQueryLog) | repeated | The slow query logs. |-<a name="bytebase-v1-EnvironmentBackupSetting"></a>-### EnvironmentBackupSetting+<a name="bytebase-v1-SchemaMetadata"></a>+### SchemaMetadata+SchemaMetadata is the metadata for schemas.+This is the concept of schema in Postgres, but it's a no-op for MySQL.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the environment backup setting. Format: environments/{environment}/backupSetting |-| enabled | [bool](#bool) | | |+| name | [string](#string) | | The name is the schema name. It is an empty string for databases without such concept such as MySQL. |+| tables | [TableMetadata](#bytebase-v1-TableMetadata) | repeated | The tables is the list of tables in a schema. |+| views | [ViewMetadata](#bytebase-v1-ViewMetadata) | repeated | The views is the list of views in a schema. |+| functions | [FunctionMetadata](#bytebase-v1-FunctionMetadata) | repeated | The functions is the list of functions in a schema. |-<a name="bytebase-v1-GetEnvironmentRequest"></a>+<a name="bytebase-v1-SearchDatabasesRequest"></a>-### GetEnvironmentRequest+### SearchDatabasesRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the environment to retrieve. Format: environments/{environment} |+| parent | [string](#string) | | The parent, which owns this collection of databases. Format: instances/{instance} Use "instances/-" to list all databases. |+| page_size | [int32](#int32) | | The maximum number of databases to return. The service may return fewer than this value. If unspecified, at most 50 databases will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |+| page_token | [string](#string) | | A page token, received from a previous `ListDatabases` call. Provide this to retrieve the subsequent page.+When paginating, all other parameters provided to `ListDatabases` must match the call that provided the page token. |+| filter | [string](#string) | | Filter is used to filter databases returned in the list. For example, "project = projects/{project}" can be used to list databases in a project. |-<a name="bytebase-v1-ListEnvironmentsRequest"></a>-### ListEnvironmentsRequest+<a name="bytebase-v1-SearchDatabasesResponse"></a>++### SearchDatabasesResponse| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| page_size | [int32](#int32) | | The maximum number of environments to return. The service may return fewer than this value. If unspecified, at most 50 environments will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |-| page_token | [string](#string) | | A page token, received from a previous `ListEnvironments` call. Provide this to retrieve the subsequent page.--When paginating, all other parameters provided to `ListEnvironments` must match the call that provided the page token. |-| show_deleted | [bool](#bool) | | Show deleted environments if specified. |-+| databases | [Database](#bytebase-v1-Database) | repeated | The databases from the specified request. |+| next_page_token | [string](#string) | | A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. |-<a name="bytebase-v1-ListEnvironmentsResponse"></a>-### ListEnvironmentsResponse+<a name="bytebase-v1-Secret"></a>+### Secret+Secret is the secret of the database now.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| environments | [Environment](#bytebase-v1-Environment) | repeated | The environments from the specified request. |-| next_page_token | [string](#string) | | A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. |-+| name | [string](#string) | | name is the unique name of the secret, which is specified by the client. Format: instances/{instance}/databases/{database}/secrets/{secret} |+| created_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | Not used. The timestamp when the secret resource was created initially. |+| updated_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | Not used. The timestamp when the secret resource was updated. |+| value | [string](#string) | | The value of the secret. |+| description | [string](#string) | | The description of the secret. |-<a name="bytebase-v1-UndeleteEnvironmentRequest"></a>-### UndeleteEnvironmentRequest+<a name="bytebase-v1-SlowQueryDetails"></a>+### SlowQueryDetails+SlowQueryDetails is the details of the slow query log.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the deleted environment. Format: environments/{environment} |-+| start_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | The start time of the slow query log. |+| query_time | [google.protobuf.Duration](#google-protobuf-Duration) | | The query time of the slow query log. |+| lock_time | [google.protobuf.Duration](#google-protobuf-Duration) | | The lock time of the slow query log. |+| rows_sent | [int64](#int64) | | The rows sent of the slow query log. |+| rows_examined | [int64](#int64) | | The rows examined of the slow query log. |+| sql_text | [string](#string) | | The sql text of the slow query log. |-<a name="bytebase-v1-UpdateEnvironmentBackupSettingRequest"></a>-### UpdateEnvironmentBackupSettingRequest+<a name="bytebase-v1-SlowQueryLog"></a>+### SlowQueryLog+SlowQueryLog is the slow query log.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| setting | [EnvironmentBackupSetting](#bytebase-v1-EnvironmentBackupSetting) | | The environment backup setting to update. |-+| resource | [string](#string) | | The resource of the slow query log. The format is "instances/{instance}/databases/{database}". |+| project | [string](#string) | | The project of the slow query log. The format is "projects/{project}". |+| statistics | [SlowQueryStatistics](#bytebase-v1-SlowQueryStatistics) | | The statistics of the slow query log. |-<a name="bytebase-v1-UpdateEnvironmentRequest"></a>-### UpdateEnvironmentRequest+<a name="bytebase-v1-SlowQueryStatistics"></a>+### SlowQueryStatistics+SlowQueryStatistics is the statistics of the slow query log.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| environment | [Environment](#bytebase-v1-Environment) | | The environment to update.--The environment's `name` field is used to identify the environment to update. Format: environments/{environment} |-| update_mask | [google.protobuf.FieldMask](#google-protobuf-FieldMask) | | The list of fields to update. |---+| sql_fingerprint | [string](#string) | | The fingerprint of the slow query log. |+| count | [int64](#int64) | | The count of the slow query log. |+| latest_log_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | The latest log time of the slow query log. |+| average_query_time | [google.protobuf.Duration](#google-protobuf-Duration) | | The average query time of the slow query log. |+| maximum_query_time | [google.protobuf.Duration](#google-protobuf-Duration) | | The maximum query time of the slow query log. |+| average_rows_sent | [int64](#int64) | | The average rows sent of the slow query log. |+| maximum_rows_sent | [int64](#int64) | | The maximum rows sent of the slow query log. |+| average_rows_examined | [int64](#int64) | | The average rows examined of the slow query log. |+| maximum_rows_examined | [int64](#int64) | | The maximum rows examined of the slow query log. |+| query_time_percent | [double](#double) | | The percentage of the query time. |+| count_percent | [double](#double) | | The percentage of the count. |+| samples | [SlowQueryDetails](#bytebase-v1-SlowQueryDetails) | repeated | Samples are details of the sample slow query logs with the same fingerprint. |--<a name="bytebase-v1-EnvironmentTier"></a>-### EnvironmentTier+<a name="bytebase-v1-SyncDatabaseRequest"></a>-| Name | Number | Description |-| ---- | ------ | ----------- |-| ENVIRONMENT_TIER_UNSPECIFIED | 0 | |-| PROTECTED | 1 | |-| UNPROTECTED | 2 | |+### SyncDatabaseRequest--+| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| name | [string](#string) | | The name of the database to sync. Format: instances/{instance}/databases/{database} |-<a name="bytebase-v1-EnvironmentService"></a>-### EnvironmentService-| Method Name | Request Type | Response Type | Description |-| ----------- | ------------ | ------------- | ------------|-| GetEnvironment | [GetEnvironmentRequest](#bytebase-v1-GetEnvironmentRequest) | [Environment](#bytebase-v1-Environment) | |-| ListEnvironments | [ListEnvironmentsRequest](#bytebase-v1-ListEnvironmentsRequest) | [ListEnvironmentsResponse](#bytebase-v1-ListEnvironmentsResponse) | |-| CreateEnvironment | [CreateEnvironmentRequest](#bytebase-v1-CreateEnvironmentRequest) | [Environment](#bytebase-v1-Environment) | |-| UpdateEnvironment | [UpdateEnvironmentRequest](#bytebase-v1-UpdateEnvironmentRequest) | [Environment](#bytebase-v1-Environment) | |-| DeleteEnvironment | [DeleteEnvironmentRequest](#bytebase-v1-DeleteEnvironmentRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | |-| UndeleteEnvironment | [UndeleteEnvironmentRequest](#bytebase-v1-UndeleteEnvironmentRequest) | [Environment](#bytebase-v1-Environment) | |-| UpdateBackupSetting | [UpdateEnvironmentBackupSettingRequest](#bytebase-v1-UpdateEnvironmentBackupSettingRequest) | [EnvironmentBackupSetting](#bytebase-v1-EnvironmentBackupSetting) | |-+<a name="bytebase-v1-SyncDatabaseResponse"></a>+### SyncDatabaseResponse-<a name="v1_externalvs_service-proto"></a>-<p align="right"><a href="#top">Top</a></p>-## v1/externalvs_service.proto-<a name="bytebase-v1-CreateExternalVersionControlRequest"></a>-### CreateExternalVersionControlRequest+<a name="bytebase-v1-TableMetadata"></a>+### TableMetadata+TableMetadata is the metadata for tables.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| external_version_control | [ExternalVersionControl](#bytebase-v1-ExternalVersionControl) | | |+| name | [string](#string) | | The name is the name of a table. |+| columns | [ColumnMetadata](#bytebase-v1-ColumnMetadata) | repeated | The columns is the ordered list of columns in a table. |+| indexes | [IndexMetadata](#bytebase-v1-IndexMetadata) | repeated | The indexes is the list of indexes in a table. |+| engine | [string](#string) | | The engine is the engine of a table. |+| collation | [string](#string) | | The collation is the collation of a table. |+| row_count | [int64](#int64) | | The row_count is the estimated number of rows of a table. |+| data_size | [int64](#int64) | | The data_size is the estimated data size of a table. |+| index_size | [int64](#int64) | | The index_size is the estimated index size of a table. |+| data_free | [int64](#int64) | | The data_free is the estimated free data size of a table. |+| create_options | [string](#string) | | The create_options is the create option of a table. |+| comment | [string](#string) | | The comment is the comment of a table. |+| foreign_keys | [ForeignKeyMetadata](#bytebase-v1-ForeignKeyMetadata) | repeated | The foreign_keys is the list of foreign keys in a table. |-<a name="bytebase-v1-DeleteExternalVersionControlRequest"></a>+<a name="bytebase-v1-UpdateBackupSettingRequest"></a>-### DeleteExternalVersionControlRequest+### UpdateBackupSettingRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the external version control to delete. Format: externalVersionControls/{externalVersionControl} |+| setting | [BackupSetting](#bytebase-v1-BackupSetting) | | The database backup setting to update. |-<a name="bytebase-v1-ExchangeToken"></a>+<a name="bytebase-v1-UpdateDatabaseRequest"></a>-### ExchangeToken+### UpdateDatabaseRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the external version control to retrieve the linked projects. Format: externalVersionControls/{externalVersionControl} |-| code | [string](#string) | | |-| type | [ExternalVersionControl.Type](#bytebase-v1-ExternalVersionControl-Type) | | |-| instance_url | [string](#string) | | |-| client_id | [string](#string) | | |-| client_secret | [string](#string) | | |+| database | [Database](#bytebase-v1-Database) | | The database to update.++The database's `name` field is used to identify the database to update. Format: instances/{instance}/databases/{database} |+| update_mask | [google.protobuf.FieldMask](#google-protobuf-FieldMask) | | The list of fields to update. |-<a name="bytebase-v1-ExchangeTokenRequest"></a>+<a name="bytebase-v1-UpdateSecretRequest"></a>-### ExchangeTokenRequest+### UpdateSecretRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| exchange_token | [ExchangeToken](#bytebase-v1-ExchangeToken) | | |-+| secret | [Secret](#bytebase-v1-Secret) | | The secret to be created or updated. |+| update_mask | [google.protobuf.FieldMask](#google-protobuf-FieldMask) | | The mask of the fields to be updated. |+| allow_missing | [bool](#bool) | | If true, the secret will be created if it does not exist. |-<a name="bytebase-v1-ExternalVersionControl"></a>-### ExternalVersionControl+<a name="bytebase-v1-ViewMetadata"></a>+### ViewMetadata+ViewMetadata is the metadata for views.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the external version control, generated by the server, and also is the unique identifier. Format: externalVersionControls/{externalVersionControl} |-| title | [string](#string) | | The title of the external version control. It is used to display in the UI. Specified by the client. |-| type | [ExternalVersionControl.Type](#bytebase-v1-ExternalVersionControl-Type) | | |-| url | [string](#string) | | The url of the external version control. Specified by the client. For example: github.com, gitlab.com, gitlab.bytebase.com. |-| api_url | [string](#string) | | The API url of the external version control. Derived from the url. |-| application_id | [string](#string) | | The application ID of the external version control. Specified by the client. |-| secret | [string](#string) | | The application secret of the external version control. Specified by the client. |+| name | [string](#string) | | The name is the name of a view. |+| definition | [string](#string) | | The definition is the definition of a view. |+| comment | [string](#string) | | The comment is the comment of a view. |+| dependent_columns | [DependentColumn](#bytebase-v1-DependentColumn) | repeated | The dependent_columns is the list of dependent columns of a view. |+-<a name="bytebase-v1-GetExternalVersionControlRequest"></a>-### GetExternalVersionControlRequest+<a name="bytebase-v1-Backup-BackupState"></a>++### Backup.BackupState+The state of the backup.+| Name | Number | Description |+| ---- | ------ | ----------- |+| BACKUP_STATE_UNSPECIFIED | 0 | The state of the backup is unknown. |+| PENDING_CREATE | 1 | The backup is being pending to create. |+| DONE | 2 | The backup is ready to use. |+| FAILED | 3 | The backup is being deleted. |-| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the external version control to retrieve. Format: externalVersionControls/{externalVersionControl} |+<a name="bytebase-v1-Backup-BackupType"></a>+### Backup.BackupType+The type of the backup.+| Name | Number | Description |+| ---- | ------ | ----------- |+| BACKUP_TYPE_UNSPECIFIED | 0 | The type of the backup is unknown. |+| MANUAL | 1 | The backup is created by user. |+| AUTOMATIC | 2 | The backup is created by automatic backup. |+| PITR | 3 | The backup is created automatically after doing PITR. |-<a name="bytebase-v1-ListExternalVersionControlsRequest"></a>+<a name="bytebase-v1-ChangeHistory-Source"></a>-### ListExternalVersionControlsRequest+### ChangeHistory.Source+| Name | Number | Description |+| ---- | ------ | ----------- |+| SOURCE_UNSPECIFIED | 0 | |+| UI | 1 | |+| VCS | 2 | |+| LIBRARY | 3 | |-| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| page_size | [int32](#int32) | | Not used. The maximum number of external version control to return. The service may return fewer than this value. If unspecified, at most 100 external version control will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |-| page_token | [string](#string) | | Not used. A page token, received from a previous `ListExternalVersionControls` call. Provide this to retrieve the subsequent page. |+<a name="bytebase-v1-ChangeHistory-Status"></a>+### ChangeHistory.Status+| Name | Number | Description |+| ---- | ------ | ----------- |+| STATUS_UNSPECIFIED | 0 | |+| PENDING | 1 | |+| DONE | 2 | |+| FAILED | 3 | |-<a name="bytebase-v1-ListExternalVersionControlsResponse"></a>-### ListExternalVersionControlsResponse+<a name="bytebase-v1-ChangeHistory-Type"></a>+### ChangeHistory.Type-| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| external_version_controls | [ExternalVersionControl](#bytebase-v1-ExternalVersionControl) | repeated | The list of external version control. |-| next_page_token | [string](#string) | | Not used. A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. |+| Name | Number | Description |+| ---- | ------ | ----------- |+| TYPE_UNSPECIFIED | 0 | |+| BASELINE | 1 | |+| MIGRATE | 2 | |+| MIGRATE_SDL | 3 | |+| MIGRATE_GHOST | 4 | |+| BRANCH | 5 | |+| DATA | 6 | |+<a name="bytebase-v1-ChangeHistoryView"></a>+### ChangeHistoryView-<a name="bytebase-v1-ListProjectGitOpsInfoRequest"></a>-### ListProjectGitOpsInfoRequest+| Name | Number | Description |+| ---- | ------ | ----------- |+| CHANGE_HISTORY_VIEW_UNSPECIFIED | 0 | The default / unset value. The API will default to the BASIC view. |+| CHANGE_HISTORY_VIEW_BASIC | 1 | |+| CHANGE_HISTORY_VIEW_FULL | 2 | |+-| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the external version control to retrieve the linked projects. Format: externalVersionControls/{externalVersionControl} |++<a name="bytebase-v1-DatabaseService"></a>+### DatabaseService+| Method Name | Request Type | Response Type | Description |+| ----------- | ------------ | ------------- | ------------|+| GetDatabase | [GetDatabaseRequest](#bytebase-v1-GetDatabaseRequest) | [Database](#bytebase-v1-Database) | |+| ListDatabases | [ListDatabasesRequest](#bytebase-v1-ListDatabasesRequest) | [ListDatabasesResponse](#bytebase-v1-ListDatabasesResponse) | |+| SearchDatabases | [SearchDatabasesRequest](#bytebase-v1-SearchDatabasesRequest) | [SearchDatabasesResponse](#bytebase-v1-SearchDatabasesResponse) | Search for databases that the caller has both projects.get permission on, and also satisfy the specified query. |+| UpdateDatabase | [UpdateDatabaseRequest](#bytebase-v1-UpdateDatabaseRequest) | [Database](#bytebase-v1-Database) | |+| BatchUpdateDatabases | [BatchUpdateDatabasesRequest](#bytebase-v1-BatchUpdateDatabasesRequest) | [BatchUpdateDatabasesResponse](#bytebase-v1-BatchUpdateDatabasesResponse) | |+| SyncDatabase | [SyncDatabaseRequest](#bytebase-v1-SyncDatabaseRequest) | [SyncDatabaseResponse](#bytebase-v1-SyncDatabaseResponse) | |+| GetDatabaseMetadata | [GetDatabaseMetadataRequest](#bytebase-v1-GetDatabaseMetadataRequest) | [DatabaseMetadata](#bytebase-v1-DatabaseMetadata) | |+| GetDatabaseSchema | [GetDatabaseSchemaRequest](#bytebase-v1-GetDatabaseSchemaRequest) | [DatabaseSchema](#bytebase-v1-DatabaseSchema) | |+| GetBackupSetting | [GetBackupSettingRequest](#bytebase-v1-GetBackupSettingRequest) | [BackupSetting](#bytebase-v1-BackupSetting) | |+| UpdateBackupSetting | [UpdateBackupSettingRequest](#bytebase-v1-UpdateBackupSettingRequest) | [BackupSetting](#bytebase-v1-BackupSetting) | |+| CreateBackup | [CreateBackupRequest](#bytebase-v1-CreateBackupRequest) | [Backup](#bytebase-v1-Backup) | |+| ListBackups | [ListBackupsRequest](#bytebase-v1-ListBackupsRequest) | [ListBackupsResponse](#bytebase-v1-ListBackupsResponse) | |+| ListSlowQueries | [ListSlowQueriesRequest](#bytebase-v1-ListSlowQueriesRequest) | [ListSlowQueriesResponse](#bytebase-v1-ListSlowQueriesResponse) | |+| ListSecrets | [ListSecretsRequest](#bytebase-v1-ListSecretsRequest) | [ListSecretsResponse](#bytebase-v1-ListSecretsResponse) | |+| UpdateSecret | [UpdateSecretRequest](#bytebase-v1-UpdateSecretRequest) | [Secret](#bytebase-v1-Secret) | |+| DeleteSecret | [DeleteSecretRequest](#bytebase-v1-DeleteSecretRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | |+| AdviseIndex | [AdviseIndexRequest](#bytebase-v1-AdviseIndexRequest) | [AdviseIndexResponse](#bytebase-v1-AdviseIndexResponse) | |+| ListChangeHistories | [ListChangeHistoriesRequest](#bytebase-v1-ListChangeHistoriesRequest) | [ListChangeHistoriesResponse](#bytebase-v1-ListChangeHistoriesResponse) | |+| GetChangeHistory | [GetChangeHistoryRequest](#bytebase-v1-GetChangeHistoryRequest) | [ChangeHistory](#bytebase-v1-ChangeHistory) | |-<a name="bytebase-v1-ListProjectGitOpsInfoResponse"></a>+-### ListProjectGitOpsInfoResponse+++<a name="v1_environment_service-proto"></a>+<p align="right"><a href="#top">Top</a></p>++## v1/environment_service.proto++++<a name="bytebase-v1-CreateEnvironmentRequest"></a>++### CreateEnvironmentRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| project_gitops_info | [ProjectGitOpsInfo](#bytebase-v1-ProjectGitOpsInfo) | repeated | The binding between external version control and project. |+| environment | [Environment](#bytebase-v1-Environment) | | The environment to create. |+| environment_id | [string](#string) | | The ID to use for the environment, which will become the final component of the environment's resource name.+This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/. |-<a name="bytebase-v1-OAuthToken"></a>-### OAuthToken+<a name="bytebase-v1-DeleteEnvironmentRequest"></a>++### DeleteEnvironmentRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| access_token | [string](#string) | | |-| refresh_token | [string](#string) | | |-| expires_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |+| name | [string](#string) | | The name of the environment to delete. Format: environments/{environment} |-<a name="bytebase-v1-ProjectGitOpsInfo"></a>+<a name="bytebase-v1-Environment"></a>-### ProjectGitOpsInfo+### Environment| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the linked repository, generated by the server, and also is the unique identifier. Format: projects/{project}/gitOpsInfo |-| vcs_uid | [string](#string) | | The uid for related VCS. |-| title | [string](#string) | | The title of the repository. For axample: sample. |-| full_path | [string](#string) | | The full_path of the repository. For example: bytebase/sample. |-| web_url | [string](#string) | | The web url of the repository. For axample: https://gitlab.bytebase.com/bytebase/sample. |-| branch_filter | [string](#string) | | The branch Bytebase listens to for changes. For example: main. |-| base_directory | [string](#string) | | The root directory where Bytebase observes the file change. If empty, then it observes the entire repository. |-| file_path_template | [string](#string) | | Bytebase only observes the file path name matching the template pattern **relative** to the base directory. Required Placeholder: {{DB_NAME}}, {{VERSION}}, {{TYPE]}. Optional Placeholder: {{ENV_ID}}, {{DESCRIPTION}}. Optional Directory Wildcard: '*', '**'. |-| schema_path_template | [string](#string) | | The file path template for storing the latest schema auto-generated by Bytebase after migration. If empty, then Bytebase won't auto generate it. If specified, required placeholder: {{DB_NAME}}, optional placeholder: {{ENV_ID}}. |-| sheet_path_template | [string](#string) | | The file path template for matching the sql files for sheet. If specified, required Placeholder: {{NAME}}, optional Placeholder: {{ENV_ID}}, {{DB_NAME}}. |-| external_id | [string](#string) | | The reposition external id in target VCS. |-| enable_sql_review_ci | [bool](#bool) | | Set to true to enable SQL review CI for all PR/MRs. |-| webhook_endpoint_id | [string](#string) | | The webhook endpoint ID of the repository. |-| access_token | [string](#string) | | |-| expires_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |-| refresh_token | [string](#string) | | |+| name | [string](#string) | | The name of the environment. Format: environments/{environment} |+| uid | [string](#string) | | The system-assigned, unique identifier for a resource. |+| state | [State](#bytebase-v1-State) | | |+| title | [string](#string) | | |+| order | [int32](#int32) | | |+| tier | [EnvironmentTier](#bytebase-v1-EnvironmentTier) | | |-<a name="bytebase-v1-SearchExternalVersionControlProjectsRequest"></a>+<a name="bytebase-v1-EnvironmentBackupSetting"></a>-### SearchExternalVersionControlProjectsRequest+### EnvironmentBackupSetting| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the external version control to retrieve the external version control repositories. Format: externalVersionControls/{externalVersionControl} |-| access_token | [string](#string) | | |-| refresh_token | [string](#string) | | |+| name | [string](#string) | | The name of the environment backup setting. Format: environments/{environment}/backupSetting |+| enabled | [bool](#bool) | | |-<a name="bytebase-v1-SearchExternalVersionControlProjectsResponse"></a>+<a name="bytebase-v1-GetEnvironmentRequest"></a>-### SearchExternalVersionControlProjectsResponse+### GetEnvironmentRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| projects | [SearchExternalVersionControlProjectsResponse.Project](#bytebase-v1-SearchExternalVersionControlProjectsResponse-Project) | repeated | The list of project in external version control. |+| name | [string](#string) | | The name of the environment to retrieve. Format: environments/{environment} |-<a name="bytebase-v1-SearchExternalVersionControlProjectsResponse-Project"></a>+<a name="bytebase-v1-ListEnvironmentsRequest"></a>-### SearchExternalVersionControlProjectsResponse.Project+### ListEnvironmentsRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| id | [string](#string) | | The id of the project in external version control. |-| title | [string](#string) | | The title of the project in external version control. |-| fullpath | [string](#string) | | The fullpath of the project in external version control. |-| web_url | [string](#string) | | Web url of the project in external version control. |+| page_size | [int32](#int32) | | The maximum number of environments to return. The service may return fewer than this value. If unspecified, at most 50 environments will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |+| page_token | [string](#string) | | A page token, received from a previous `ListEnvironments` call. Provide this to retrieve the subsequent page.++When paginating, all other parameters provided to `ListEnvironments` must match the call that provided the page token. |+| show_deleted | [bool](#bool) | | Show deleted environments if specified. |-<a name="bytebase-v1-UpdateExternalVersionControlRequest"></a>+<a name="bytebase-v1-ListEnvironmentsResponse"></a>-### UpdateExternalVersionControlRequest+### ListEnvironmentsResponse| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| external_version_control | [ExternalVersionControl](#bytebase-v1-ExternalVersionControl) | | |-| update_mask | [google.protobuf.FieldMask](#google-protobuf-FieldMask) | | The list of fields to be updated. |+| environments | [Environment](#bytebase-v1-Environment) | repeated | The environments from the specified request. |+| next_page_token | [string](#string) | | A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. |-+<a name="bytebase-v1-UndeleteEnvironmentRequest"></a>-<a name="bytebase-v1-ExternalVersionControl-Type"></a>+### UndeleteEnvironmentRequest-### ExternalVersionControl.Type-| Name | Number | Description |-| ---- | ------ | ----------- |-| TYPE_UNSPECIFIED | 0 | |-| GITHUB | 1 | GitHub type. Using for GitHub community edition(ce). |-| GITLAB | 2 | GitLab type. Using for GitLab community edition(ce) and enterprise edition(ee). |-| BITBUCKET | 3 | BitBucket type. Using for BitBucket cloud or BitBucket server. |+| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| name | [string](#string) | | The name of the deleted environment. Format: environments/{environment} |---<a name="bytebase-v1-ExternalVersionControlService"></a>-### ExternalVersionControlService+<a name="bytebase-v1-UpdateEnvironmentBackupSettingRequest"></a>+### UpdateEnvironmentBackupSettingRequest-| Method Name | Request Type | Response Type | Description |-| ----------- | ------------ | ------------- | ------------|-| GetExternalVersionControl | [GetExternalVersionControlRequest](#bytebase-v1-GetExternalVersionControlRequest) | [ExternalVersionControl](#bytebase-v1-ExternalVersionControl) | |-| ListExternalVersionControls | [ListExternalVersionControlsRequest](#bytebase-v1-ListExternalVersionControlsRequest) | [ListExternalVersionControlsResponse](#bytebase-v1-ListExternalVersionControlsResponse) | |-| CreateExternalVersionControl | [CreateExternalVersionControlRequest](#bytebase-v1-CreateExternalVersionControlRequest) | [ExternalVersionControl](#bytebase-v1-ExternalVersionControl) | |-| UpdateExternalVersionControl | [UpdateExternalVersionControlRequest](#bytebase-v1-UpdateExternalVersionControlRequest) | [ExternalVersionControl](#bytebase-v1-ExternalVersionControl) | |-| ExchangeToken | [ExchangeTokenRequest](#bytebase-v1-ExchangeTokenRequest) | [OAuthToken](#bytebase-v1-OAuthToken) | |-| DeleteExternalVersionControl | [DeleteExternalVersionControlRequest](#bytebase-v1-DeleteExternalVersionControlRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | |-| SearchExternalVersionControlProjects | [SearchExternalVersionControlProjectsRequest](#bytebase-v1-SearchExternalVersionControlProjectsRequest) | [SearchExternalVersionControlProjectsResponse](#bytebase-v1-SearchExternalVersionControlProjectsResponse) | |-| ListProjectGitOpsInfo | [ListProjectGitOpsInfoRequest](#bytebase-v1-ListProjectGitOpsInfoRequest) | [ListProjectGitOpsInfoResponse](#bytebase-v1-ListProjectGitOpsInfoResponse) | |-+| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| setting | [EnvironmentBackupSetting](#bytebase-v1-EnvironmentBackupSetting) | | The environment backup setting to update. |-<a name="v1_idp_service-proto"></a>-<p align="right"><a href="#top">Top</a></p>-## v1/idp_service.proto-<a name="bytebase-v1-CreateIdentityProviderRequest"></a>+<a name="bytebase-v1-UpdateEnvironmentRequest"></a>-### CreateIdentityProviderRequest+### UpdateEnvironmentRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| identity_provider | [IdentityProvider](#bytebase-v1-IdentityProvider) | | The identity provider to create. |-| identity_provider_id | [string](#string) | | The ID to use for the identity provider, which will become the final component of the identity provider's resource name.+| environment | [Environment](#bytebase-v1-Environment) | | The environment to update.-This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/. |+The environment's `name` field is used to identify the environment to update. Format: environments/{environment} |+| update_mask | [google.protobuf.FieldMask](#google-protobuf-FieldMask) | | The list of fields to update. |+-<a name="bytebase-v1-DeleteIdentityProviderRequest"></a>-### DeleteIdentityProviderRequest+<a name="bytebase-v1-EnvironmentTier"></a>+### EnvironmentTier-| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the identity provider to delete. Format: idps/{identity_provider} |+| Name | Number | Description |+| ---- | ------ | ----------- |+| ENVIRONMENT_TIER_UNSPECIFIED | 0 | |+| PROTECTED | 1 | |+| UNPROTECTED | 2 | |+++<a name="bytebase-v1-EnvironmentService"></a>-<a name="bytebase-v1-FieldMapping"></a>+### EnvironmentService-### FieldMapping-FieldMapping saves the field names from user info API of identity provider.-As we save all raw json string of user info response data into `principal.idp_user_info`,-we can extract the relevant data based with `FieldMapping`.-e.g. For GitHub authenticated user API, it will return `login`, `name` and `email` in response.-Then the identifier of FieldMapping will be `login`, display_name will be `name`,-and email will be `email`.-reference: https://docs.github.com/en/rest/users/users?apiVersion=2022-11-28#get-the-authenticated-user+| Method Name | Request Type | Response Type | Description |+| ----------- | ------------ | ------------- | ------------|+| GetEnvironment | [GetEnvironmentRequest](#bytebase-v1-GetEnvironmentRequest) | [Environment](#bytebase-v1-Environment) | |+| ListEnvironments | [ListEnvironmentsRequest](#bytebase-v1-ListEnvironmentsRequest) | [ListEnvironmentsResponse](#bytebase-v1-ListEnvironmentsResponse) | |+| CreateEnvironment | [CreateEnvironmentRequest](#bytebase-v1-CreateEnvironmentRequest) | [Environment](#bytebase-v1-Environment) | |+| UpdateEnvironment | [UpdateEnvironmentRequest](#bytebase-v1-UpdateEnvironmentRequest) | [Environment](#bytebase-v1-Environment) | |+| DeleteEnvironment | [DeleteEnvironmentRequest](#bytebase-v1-DeleteEnvironmentRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | |+| UndeleteEnvironment | [UndeleteEnvironmentRequest](#bytebase-v1-UndeleteEnvironmentRequest) | [Environment](#bytebase-v1-Environment) | |+| UpdateBackupSetting | [UpdateEnvironmentBackupSettingRequest](#bytebase-v1-UpdateEnvironmentBackupSettingRequest) | [EnvironmentBackupSetting](#bytebase-v1-EnvironmentBackupSetting) | |+-| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| identifier | [string](#string) | | Identifier is the field name of the unique identifier in 3rd-party idp user info. Required. |-| display_name | [string](#string) | | DisplayName is the field name of display name in 3rd-party idp user info. |-| email | [string](#string) | | Email is the field name of primary email in 3rd-party idp user info. |+<a name="v1_externalvs_service-proto"></a>+<p align="right"><a href="#top">Top</a></p>+## v1/externalvs_service.proto-<a name="bytebase-v1-GetIdentityProviderRequest"></a>+<a name="bytebase-v1-CreateExternalVersionControlRequest"></a>-### GetIdentityProviderRequest+### CreateExternalVersionControlRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | |+| external_version_control | [ExternalVersionControl](#bytebase-v1-ExternalVersionControl) | | |-<a name="bytebase-v1-IdentityProvider"></a>+<a name="bytebase-v1-DeleteExternalVersionControlRequest"></a>-### IdentityProvider+### DeleteExternalVersionControlRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the identity provider. Format: idps/{identity_provider} |-| uid | [string](#string) | | The system-assigned, unique identifier for a resource. |-| state | [State](#bytebase-v1-State) | | |-| title | [string](#string) | | |-| domain | [string](#string) | | |-| type | [IdentityProviderType](#bytebase-v1-IdentityProviderType) | | |-| config | [IdentityProviderConfig](#bytebase-v1-IdentityProviderConfig) | | |+| name | [string](#string) | | The name of the external version control to delete. Format: externalVersionControls/{externalVersionControl} |-<a name="bytebase-v1-IdentityProviderConfig"></a>+<a name="bytebase-v1-ExchangeToken"></a>-### IdentityProviderConfig+### ExchangeToken| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| oauth2_config | [OAuth2IdentityProviderConfig](#bytebase-v1-OAuth2IdentityProviderConfig) | | |-| oidc_config | [OIDCIdentityProviderConfig](#bytebase-v1-OIDCIdentityProviderConfig) | | |+| name | [string](#string) | | The name of the external version control to retrieve the linked projects. Format: externalVersionControls/{externalVersionControl} |+| code | [string](#string) | | |+| type | [ExternalVersionControl.Type](#bytebase-v1-ExternalVersionControl-Type) | | |+| instance_url | [string](#string) | | |+| client_id | [string](#string) | | |+| client_secret | [string](#string) | | |-<a name="bytebase-v1-ListIdentityProvidersRequest"></a>+<a name="bytebase-v1-ExchangeTokenRequest"></a>-### ListIdentityProvidersRequest+### ExchangeTokenRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| page_size | [int32](#int32) | | The maximum number of identity providers to return. The service may return fewer than this value. If unspecified, at most 50 will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |-| page_token | [string](#string) | | A page token, received from a previous `ListIdentityProviders` call. Provide this to retrieve the subsequent page.--When paginating, all other parameters provided to `ListIdentityProviders` must match the call that provided the page token. |-| show_deleted | [bool](#bool) | | Show deleted identity providers if specified. |+| exchange_token | [ExchangeToken](#bytebase-v1-ExchangeToken) | | |-<a name="bytebase-v1-ListIdentityProvidersResponse"></a>+<a name="bytebase-v1-ExternalVersionControl"></a>-### ListIdentityProvidersResponse+### ExternalVersionControl| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| identity_providers | [IdentityProvider](#bytebase-v1-IdentityProvider) | repeated | The identity providers from the specified request. |-| next_page_token | [string](#string) | | A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. |+| name | [string](#string) | | The name of the external version control, generated by the server, and also is the unique identifier. Format: externalVersionControls/{externalVersionControl} |+| title | [string](#string) | | The title of the external version control. It is used to display in the UI. Specified by the client. |+| type | [ExternalVersionControl.Type](#bytebase-v1-ExternalVersionControl-Type) | | |+| url | [string](#string) | | The url of the external version control. Specified by the client. For example: github.com, gitlab.com, gitlab.bytebase.com. |+| api_url | [string](#string) | | The API url of the external version control. Derived from the url. |+| application_id | [string](#string) | | The application ID of the external version control. Specified by the client. |+| secret | [string](#string) | | The application secret of the external version control. Specified by the client. |-<a name="bytebase-v1-OAuth2IdentityProviderConfig"></a>+<a name="bytebase-v1-GetExternalVersionControlRequest"></a>++### GetExternalVersionControlRequest-### OAuth2IdentityProviderConfig-OAuth2IdentityProviderConfig is the structure for OAuth2 identity provider config.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| auth_url | [string](#string) | | |-| token_url | [string](#string) | | |-| user_info_url | [string](#string) | | |-| client_id | [string](#string) | | |-| client_secret | [string](#string) | | |-| scopes | [string](#string) | repeated | |-| field_mapping | [FieldMapping](#bytebase-v1-FieldMapping) | | |-| skip_tls_verify | [bool](#bool) | | |+| name | [string](#string) | | The name of the external version control to retrieve. Format: externalVersionControls/{externalVersionControl} |-<a name="bytebase-v1-OAuth2IdentityProviderTestRequestContext"></a>+<a name="bytebase-v1-ListExternalVersionControlsRequest"></a>-### OAuth2IdentityProviderTestRequestContext+### ListExternalVersionControlsRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| code | [string](#string) | | Authorize code from website. |+| page_size | [int32](#int32) | | Not used. The maximum number of external version control to return. The service may return fewer than this value. If unspecified, at most 100 external version control will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |+| page_token | [string](#string) | | Not used. A page token, received from a previous `ListExternalVersionControls` call. Provide this to retrieve the subsequent page. |-<a name="bytebase-v1-OIDCIdentityProviderConfig"></a>+<a name="bytebase-v1-ListExternalVersionControlsResponse"></a>++### ListExternalVersionControlsResponse-### OIDCIdentityProviderConfig-OIDCIdentityProviderConfig is the structure for OIDC identity provider config.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| issuer | [string](#string) | | |-| client_id | [string](#string) | | |-| client_secret | [string](#string) | | |-| scopes | [string](#string) | repeated | |-| field_mapping | [FieldMapping](#bytebase-v1-FieldMapping) | | |-| skip_tls_verify | [bool](#bool) | | |+| external_version_controls | [ExternalVersionControl](#bytebase-v1-ExternalVersionControl) | repeated | The list of external version control. |+| next_page_token | [string](#string) | | Not used. A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. |-<a name="bytebase-v1-TestIdentityProviderRequest"></a>+<a name="bytebase-v1-ListProjectGitOpsInfoRequest"></a>-### TestIdentityProviderRequest+### ListProjectGitOpsInfoRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| identity_provider | [IdentityProvider](#bytebase-v1-IdentityProvider) | | The identity provider to test connection including uncreated. |-| oauth2_context | [OAuth2IdentityProviderTestRequestContext](#bytebase-v1-OAuth2IdentityProviderTestRequestContext) | | |+| name | [string](#string) | | The name of the external version control to retrieve the linked projects. Format: externalVersionControls/{externalVersionControl} |-<a name="bytebase-v1-TestIdentityProviderResponse"></a>+<a name="bytebase-v1-ListProjectGitOpsInfoResponse"></a>-### TestIdentityProviderResponse+### ListProjectGitOpsInfoResponse+| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| project_gitops_info | [ProjectGitOpsInfo](#bytebase-v1-ProjectGitOpsInfo) | repeated | The binding between external version control and project. |-<a name="bytebase-v1-UndeleteIdentityProviderRequest"></a>-### UndeleteIdentityProviderRequest++<a name="bytebase-v1-OAuthToken"></a>++### OAuthToken| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the deleted identity provider. Format: idps/{identity_provider} |+| access_token | [string](#string) | | |+| refresh_token | [string](#string) | | |+| expires_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |-<a name="bytebase-v1-UpdateIdentityProviderRequest"></a>+<a name="bytebase-v1-ProjectGitOpsInfo"></a>-### UpdateIdentityProviderRequest+### ProjectGitOpsInfo| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| identity_provider | [IdentityProvider](#bytebase-v1-IdentityProvider) | | The identity provider to update.+| name | [string](#string) | | The name of the linked repository, generated by the server, and also is the unique identifier. Format: projects/{project}/gitOpsInfo |+| vcs_uid | [string](#string) | | The uid for related VCS. |+| title | [string](#string) | | The title of the repository. For axample: sample. |+| full_path | [string](#string) | | The full_path of the repository. For example: bytebase/sample. |+| web_url | [string](#string) | | The web url of the repository. For axample: https://gitlab.bytebase.com/bytebase/sample. |+| branch_filter | [string](#string) | | The branch Bytebase listens to for changes. For example: main. |+| base_directory | [string](#string) | | The root directory where Bytebase observes the file change. If empty, then it observes the entire repository. |+| file_path_template | [string](#string) | | Bytebase only observes the file path name matching the template pattern **relative** to the base directory. Required Placeholder: {{DB_NAME}}, {{VERSION}}, {{TYPE]}. Optional Placeholder: {{ENV_ID}}, {{DESCRIPTION}}. Optional Directory Wildcard: '*', '**'. |+| schema_path_template | [string](#string) | | The file path template for storing the latest schema auto-generated by Bytebase after migration. If empty, then Bytebase won't auto generate it. If specified, required placeholder: {{DB_NAME}}, optional placeholder: {{ENV_ID}}. |+| sheet_path_template | [string](#string) | | The file path template for matching the sql files for sheet. If specified, required Placeholder: {{NAME}}, optional Placeholder: {{ENV_ID}}, {{DB_NAME}}. |+| external_id | [string](#string) | | The reposition external id in target VCS. |+| enable_sql_review_ci | [bool](#bool) | | Set to true to enable SQL review CI for all PR/MRs. |+| webhook_endpoint_id | [string](#string) | | The webhook endpoint ID of the repository. |+| access_token | [string](#string) | | |+| expires_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |+| refresh_token | [string](#string) | | |-The identity provider's `name` field is used to identify the identity provider to update. Format: idps/{identity_provider} |-| update_mask | [google.protobuf.FieldMask](#google-protobuf-FieldMask) | | The list of fields to update. |-+<a name="bytebase-v1-SearchExternalVersionControlProjectsRequest"></a>+### SearchExternalVersionControlProjectsRequest-<a name="bytebase-v1-IdentityProviderType"></a>-### IdentityProviderType+| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| name | [string](#string) | | The name of the external version control to retrieve the external version control repositories. Format: externalVersionControls/{externalVersionControl} |+| access_token | [string](#string) | | |+| refresh_token | [string](#string) | | |-| Name | Number | Description |-| ---- | ------ | ----------- |-| IDENTITY_PROVIDER_TYPE_UNSPECIFIED | 0 | |-| OAUTH2 | 1 | |-| OIDC | 2 | |---<a name="bytebase-v1-IdentityProviderService"></a>+<a name="bytebase-v1-SearchExternalVersionControlProjectsResponse"></a>-### IdentityProviderService+### SearchExternalVersionControlProjectsResponse-| Method Name | Request Type | Response Type | Description |-| ----------- | ------------ | ------------- | ------------|-| GetIdentityProvider | [GetIdentityProviderRequest](#bytebase-v1-GetIdentityProviderRequest) | [IdentityProvider](#bytebase-v1-IdentityProvider) | |-| ListIdentityProviders | [ListIdentityProvidersRequest](#bytebase-v1-ListIdentityProvidersRequest) | [ListIdentityProvidersResponse](#bytebase-v1-ListIdentityProvidersResponse) | |-| CreateIdentityProvider | [CreateIdentityProviderRequest](#bytebase-v1-CreateIdentityProviderRequest) | [IdentityProvider](#bytebase-v1-IdentityProvider) | |-| UpdateIdentityProvider | [UpdateIdentityProviderRequest](#bytebase-v1-UpdateIdentityProviderRequest) | [IdentityProvider](#bytebase-v1-IdentityProvider) | |-| DeleteIdentityProvider | [DeleteIdentityProviderRequest](#bytebase-v1-DeleteIdentityProviderRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | |-| UndeleteIdentityProvider | [UndeleteIdentityProviderRequest](#bytebase-v1-UndeleteIdentityProviderRequest) | [IdentityProvider](#bytebase-v1-IdentityProvider) | |-| TestIdentityProvider | [TestIdentityProviderRequest](#bytebase-v1-TestIdentityProviderRequest) | [TestIdentityProviderResponse](#bytebase-v1-TestIdentityProviderResponse) | |-+| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| projects | [SearchExternalVersionControlProjectsResponse.Project](#bytebase-v1-SearchExternalVersionControlProjectsResponse-Project) | repeated | The list of project in external version control. |-<a name="v1_inbox_service-proto"></a>-<p align="right"><a href="#top">Top</a></p>-## v1/inbox_service.proto+<a name="bytebase-v1-SearchExternalVersionControlProjectsResponse-Project"></a>++### SearchExternalVersionControlProjectsResponse.Project-<a name="bytebase-v1-GetInboxSummaryRequest"></a>-### GetInboxSummaryRequest+| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| id | [string](#string) | | The id of the project in external version control. |+| title | [string](#string) | | The title of the project in external version control. |+| fullpath | [string](#string) | | The fullpath of the project in external version control. |+| web_url | [string](#string) | | Web url of the project in external version control. |-<a name="bytebase-v1-InboxMessage"></a>+<a name="bytebase-v1-UpdateExternalVersionControlRequest"></a>-### InboxMessage+### UpdateExternalVersionControlRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The message name in inbox/{uid} format. |-| activity_uid | [string](#string) | | |-| status | [InboxMessage.Status](#bytebase-v1-InboxMessage-Status) | | |+| external_version_control | [ExternalVersionControl](#bytebase-v1-ExternalVersionControl) | | |+| update_mask | [google.protobuf.FieldMask](#google-protobuf-FieldMask) | | The list of fields to be updated. |+-<a name="bytebase-v1-InboxSummary"></a>-### InboxSummary+<a name="bytebase-v1-ExternalVersionControl-Type"></a>+### ExternalVersionControl.Type-| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| has_unread | [bool](#bool) | | |-| has_unread_error | [bool](#bool) | | |+| Name | Number | Description |+| ---- | ------ | ----------- |+| TYPE_UNSPECIFIED | 0 | |+| GITHUB | 1 | GitHub type. Using for GitHub community edition(ce). |+| GITLAB | 2 | GitLab type. Using for GitLab community edition(ce) and enterprise edition(ee). |+| BITBUCKET | 3 | BitBucket type. Using for BitBucket cloud or BitBucket server. |+++<a name="bytebase-v1-ExternalVersionControlService"></a>-<a name="bytebase-v1-ListInboxRequest"></a>+### ExternalVersionControlService-### ListInboxRequest+| Method Name | Request Type | Response Type | Description |+| ----------- | ------------ | ------------- | ------------|+| GetExternalVersionControl | [GetExternalVersionControlRequest](#bytebase-v1-GetExternalVersionControlRequest) | [ExternalVersionControl](#bytebase-v1-ExternalVersionControl) | |+| ListExternalVersionControls | [ListExternalVersionControlsRequest](#bytebase-v1-ListExternalVersionControlsRequest) | [ListExternalVersionControlsResponse](#bytebase-v1-ListExternalVersionControlsResponse) | |+| CreateExternalVersionControl | [CreateExternalVersionControlRequest](#bytebase-v1-CreateExternalVersionControlRequest) | [ExternalVersionControl](#bytebase-v1-ExternalVersionControl) | |+| UpdateExternalVersionControl | [UpdateExternalVersionControlRequest](#bytebase-v1-UpdateExternalVersionControlRequest) | [ExternalVersionControl](#bytebase-v1-ExternalVersionControl) | |+| ExchangeToken | [ExchangeTokenRequest](#bytebase-v1-ExchangeTokenRequest) | [OAuthToken](#bytebase-v1-OAuthToken) | |+| DeleteExternalVersionControl | [DeleteExternalVersionControlRequest](#bytebase-v1-DeleteExternalVersionControlRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | |+| SearchExternalVersionControlProjects | [SearchExternalVersionControlProjectsRequest](#bytebase-v1-SearchExternalVersionControlProjectsRequest) | [SearchExternalVersionControlProjectsResponse](#bytebase-v1-SearchExternalVersionControlProjectsResponse) | |+| ListProjectGitOpsInfo | [ListProjectGitOpsInfoRequest](#bytebase-v1-ListProjectGitOpsInfoRequest) | [ListProjectGitOpsInfoResponse](#bytebase-v1-ListProjectGitOpsInfoResponse) | |+-| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| filter | [string](#string) | | filter is the filter to apply on the list inbox request, follow the [ebnf](https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form) syntax. The field only support in filter: - "create_time" with ">=" operator, example: - create_time >= "2022-01-01T12:00:00.000Z" |-| page_size | [int32](#int32) | | Not used. The maximum number of inbox to return. The service may return fewer than this value. If unspecified, at most 100 log entries will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |-| page_token | [string](#string) | | Not used. A page token, received from a previous `ListInbox` call. Provide this to retrieve the subsequent page. |+<a name="v1_idp_service-proto"></a>+<p align="right"><a href="#top">Top</a></p>+## v1/idp_service.proto-<a name="bytebase-v1-ListInboxResponse"></a>+<a name="bytebase-v1-CreateIdentityProviderRequest"></a>-### ListInboxResponse+### CreateIdentityProviderRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| inbox_messages | [InboxMessage](#bytebase-v1-InboxMessage) | repeated | The list of inbox messages. |-| next_page_token | [string](#string) | | A token to retrieve next page of inbox. Pass this value in the page_token field in the subsequent call to `ListLogs` method to retrieve the next page of log entities. |+| identity_provider | [IdentityProvider](#bytebase-v1-IdentityProvider) | | The identity provider to create. |+| identity_provider_id | [string](#string) | | The ID to use for the identity provider, which will become the final component of the identity provider's resource name.+This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/. |-<a name="bytebase-v1-UpdateInboxRequest"></a>-### UpdateInboxRequest+<a name="bytebase-v1-DeleteIdentityProviderRequest"></a>++### DeleteIdentityProviderRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| inbox_message | [InboxMessage](#bytebase-v1-InboxMessage) | | The inbox message to update. |-| update_mask | [google.protobuf.FieldMask](#google-protobuf-FieldMask) | | The list of fields to update. |+| name | [string](#string) | | The name of the identity provider to delete. Format: idps/{identity_provider} |-+<a name="bytebase-v1-FieldMapping"></a>-<a name="bytebase-v1-InboxMessage-Status"></a>+### FieldMapping+FieldMapping saves the field names from user info API of identity provider.+As we save all raw json string of user info response data into `principal.idp_user_info`,+we can extract the relevant data based with `FieldMapping`.-### InboxMessage.Status+e.g. For GitHub authenticated user API, it will return `login`, `name` and `email` in response.+Then the identifier of FieldMapping will be `login`, display_name will be `name`,+and email will be `email`.+reference: https://docs.github.com/en/rest/users/users?apiVersion=2022-11-28#get-the-authenticated-user-| Name | Number | Description |-| ---- | ------ | ----------- |-| STATUS_UNSPECIFIED | 0 | |-| STATUS_UNREAD | 1 | |-| STATUS_READ | 2 | |+| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| identifier | [string](#string) | | Identifier is the field name of the unique identifier in 3rd-party idp user info. Required. |+| display_name | [string](#string) | | DisplayName is the field name of display name in 3rd-party idp user info. |+| email | [string](#string) | | Email is the field name of primary email in 3rd-party idp user info. |---<a name="bytebase-v1-InboxService"></a>-### InboxService+<a name="bytebase-v1-GetIdentityProviderRequest"></a>+### GetIdentityProviderRequest-| Method Name | Request Type | Response Type | Description |-| ----------- | ------------ | ------------- | ------------|-| ListInbox | [ListInboxRequest](#bytebase-v1-ListInboxRequest) | [ListInboxResponse](#bytebase-v1-ListInboxResponse) | |-| GetInboxSummary | [GetInboxSummaryRequest](#bytebase-v1-GetInboxSummaryRequest) | [InboxSummary](#bytebase-v1-InboxSummary) | |-| UpdateInbox | [UpdateInboxRequest](#bytebase-v1-UpdateInboxRequest) | [InboxMessage](#bytebase-v1-InboxMessage) | |-+| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| name | [string](#string) | | |-<a name="v1_instance_role_service-proto"></a>-<p align="right"><a href="#top">Top</a></p>-## v1/instance_role_service.proto-<a name="bytebase-v1-CreateInstanceRoleRequest"></a>+<a name="bytebase-v1-IdentityProvider"></a>-### CreateInstanceRoleRequest+### IdentityProvider| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| parent | [string](#string) | | The parent resource where this role will be created. Format: instances/{instance} |-| role | [InstanceRole](#bytebase-v1-InstanceRole) | | The role to create. |+| name | [string](#string) | | The name of the identity provider. Format: idps/{identity_provider} |+| uid | [string](#string) | | The system-assigned, unique identifier for a resource. |+| state | [State](#bytebase-v1-State) | | |+| title | [string](#string) | | |+| domain | [string](#string) | | |+| type | [IdentityProviderType](#bytebase-v1-IdentityProviderType) | | |+| config | [IdentityProviderConfig](#bytebase-v1-IdentityProviderConfig) | | |-<a name="bytebase-v1-DeleteInstanceRoleRequest"></a>+<a name="bytebase-v1-IdentityProviderConfig"></a>-### DeleteInstanceRoleRequest+### IdentityProviderConfig| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the role to delete. Format: instances/{instance}/roles/{role name} |+| oauth2_config | [OAuth2IdentityProviderConfig](#bytebase-v1-OAuth2IdentityProviderConfig) | | |+| oidc_config | [OIDCIdentityProviderConfig](#bytebase-v1-OIDCIdentityProviderConfig) | | |-<a name="bytebase-v1-GetInstanceRoleRequest"></a>+<a name="bytebase-v1-ListIdentityProvidersRequest"></a>-### GetInstanceRoleRequest+### ListIdentityProvidersRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the role to retrieve. Format: instances/{instance}/roles/{role name} The role name is the unique name for the role. |+| page_size | [int32](#int32) | | The maximum number of identity providers to return. The service may return fewer than this value. If unspecified, at most 50 will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |+| page_token | [string](#string) | | A page token, received from a previous `ListIdentityProviders` call. Provide this to retrieve the subsequent page.+When paginating, all other parameters provided to `ListIdentityProviders` must match the call that provided the page token. |+| show_deleted | [bool](#bool) | | Show deleted identity providers if specified. |-<a name="bytebase-v1-InstanceRole"></a>-### InstanceRole-InstanceRole is the API message for instance role.+<a name="bytebase-v1-ListIdentityProvidersResponse"></a>++### ListIdentityProvidersResponse+| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the role. Format: instances/{instance}/roles/{role name} The role name is the unique name for the role. |-| role_name | [string](#string) | | The role name. It's unique within the instance. |-| password | [string](#string) | optional | The role password. |-| connection_limit | [int32](#int32) | optional | The connection count limit for this role. |-| valid_until | [string](#string) | optional | The expiration for the role's password. |-| attribute | [string](#string) | optional | The role attribute. For PostgreSQL, it containt super_user, no_inherit, create_role, create_db, can_login, replication and bypass_rls. Docs: https://www.postgresql.org/docs/current/role-attributes.html For MySQL, it's the global privileges as GRANT statements, which means it only contains "GRANT ... ON *.* TO ...". Docs: https://dev.mysql.com/doc/refman/8.0/en/grant.html |-+| identity_providers | [IdentityProvider](#bytebase-v1-IdentityProvider) | repeated | The identity providers from the specified request. |+| next_page_token | [string](#string) | | A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. |-<a name="bytebase-v1-ListInstanceRolesRequest"></a>-### ListInstanceRolesRequest+<a name="bytebase-v1-OAuth2IdentityProviderConfig"></a>+### OAuth2IdentityProviderConfig+OAuth2IdentityProviderConfig is the structure for OAuth2 identity provider config.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| parent | [string](#string) | | The parent, which owns this collection of roles. Format: instances/{instance} |-| page_size | [int32](#int32) | | The maximum number of roles to return. The service may return fewer than this value. If unspecified, at most 50 roles will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |-| page_token | [string](#string) | | A page token, received from a previous `ListRoles` call. Provide this to retrieve the subsequent page.--When paginating, all other parameters provided to `ListRoles` must match the call that provided the page token. |-| refresh | [bool](#bool) | | Refresh will refresh and return the latest data. |+| auth_url | [string](#string) | | |+| token_url | [string](#string) | | |+| user_info_url | [string](#string) | | |+| client_id | [string](#string) | | |+| client_secret | [string](#string) | | |+| scopes | [string](#string) | repeated | |+| field_mapping | [FieldMapping](#bytebase-v1-FieldMapping) | | |+| skip_tls_verify | [bool](#bool) | | |-<a name="bytebase-v1-ListInstanceRolesResponse"></a>+<a name="bytebase-v1-OAuth2IdentityProviderTestRequestContext"></a>-### ListInstanceRolesResponse+### OAuth2IdentityProviderTestRequestContext| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| roles | [InstanceRole](#bytebase-v1-InstanceRole) | repeated | The roles from the specified request. |-| next_page_token | [string](#string) | | A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. |-+| code | [string](#string) | | Authorize code from website. |-<a name="bytebase-v1-UndeleteInstanceRoleRequest"></a>-### UndeleteInstanceRoleRequest+<a name="bytebase-v1-OIDCIdentityProviderConfig"></a>+### OIDCIdentityProviderConfig+OIDCIdentityProviderConfig is the structure for OIDC identity provider config.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the deleted role. Format: instances/{instance}/roles/{role name} |+| issuer | [string](#string) | | |+| client_id | [string](#string) | | |+| client_secret | [string](#string) | | |+| scopes | [string](#string) | repeated | |+| field_mapping | [FieldMapping](#bytebase-v1-FieldMapping) | | |+| skip_tls_verify | [bool](#bool) | | |-<a name="bytebase-v1-UpdateInstanceRoleRequest"></a>+<a name="bytebase-v1-TestIdentityProviderRequest"></a>-### UpdateInstanceRoleRequest+### TestIdentityProviderRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| role | [InstanceRole](#bytebase-v1-InstanceRole) | | The role to update.--The role's `name` and `instance` field is used to identify the role to update. Format: instances/{instance}/roles/{role name} |-| update_mask | [google.protobuf.FieldMask](#google-protobuf-FieldMask) | | The list of fields to update. |--------+| identity_provider | [IdentityProvider](#bytebase-v1-IdentityProvider) | | The identity provider to test connection including uncreated. |+| oauth2_context | [OAuth2IdentityProviderTestRequestContext](#bytebase-v1-OAuth2IdentityProviderTestRequestContext) | | |--<a name="bytebase-v1-InstanceRoleService"></a>-### InstanceRoleService-| Method Name | Request Type | Response Type | Description |-| ----------- | ------------ | ------------- | ------------|-| GetInstanceRole | [GetInstanceRoleRequest](#bytebase-v1-GetInstanceRoleRequest) | [InstanceRole](#bytebase-v1-InstanceRole) | |-| ListInstanceRoles | [ListInstanceRolesRequest](#bytebase-v1-ListInstanceRolesRequest) | [ListInstanceRolesResponse](#bytebase-v1-ListInstanceRolesResponse) | |-| CreateInstanceRole | [CreateInstanceRoleRequest](#bytebase-v1-CreateInstanceRoleRequest) | [InstanceRole](#bytebase-v1-InstanceRole) | |-| UpdateInstanceRole | [UpdateInstanceRoleRequest](#bytebase-v1-UpdateInstanceRoleRequest) | [InstanceRole](#bytebase-v1-InstanceRole) | |-| DeleteInstanceRole | [DeleteInstanceRoleRequest](#bytebase-v1-DeleteInstanceRoleRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | |-| UndeleteInstanceRole | [UndeleteInstanceRoleRequest](#bytebase-v1-UndeleteInstanceRoleRequest) | [InstanceRole](#bytebase-v1-InstanceRole) | |+<a name="bytebase-v1-TestIdentityProviderResponse"></a>-+### TestIdentityProviderResponse-<a name="v1_instance_service-proto"></a>-<p align="right"><a href="#top">Top</a></p>-## v1/instance_service.proto-<a name="bytebase-v1-AddDataSourceRequest"></a>+<a name="bytebase-v1-UndeleteIdentityProviderRequest"></a>-### AddDataSourceRequest+### UndeleteIdentityProviderRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| instance | [string](#string) | | The name of the instance to add a data source to. Format: instances/{instance} |-| data_source | [DataSource](#bytebase-v1-DataSource) | | Identified by type. Only READ_ONLY data source can be added. |-| validate_only | [bool](#bool) | | Validate only also tests the data source connection. |+| name | [string](#string) | | The name of the deleted identity provider. Format: idps/{identity_provider} |-<a name="bytebase-v1-CreateInstanceRequest"></a>+<a name="bytebase-v1-UpdateIdentityProviderRequest"></a>-### CreateInstanceRequest+### UpdateIdentityProviderRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| instance | [Instance](#bytebase-v1-Instance) | | The instance to create. |-| instance_id | [string](#string) | | The ID to use for the instance, which will become the final component of the instance's resource name.+| identity_provider | [IdentityProvider](#bytebase-v1-IdentityProvider) | | The identity provider to update.-This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/. |-| validate_only | [bool](#bool) | | Validate only also tests the data source connection. |+The identity provider's `name` field is used to identify the identity provider to update. Format: idps/{identity_provider} |+| update_mask | [google.protobuf.FieldMask](#google-protobuf-FieldMask) | | The list of fields to update. |--<a name="bytebase-v1-DataSource"></a>--### DataSource++<a name="bytebase-v1-IdentityProviderType"></a>-| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| title | [string](#string) | | |-| type | [DataSourceType](#bytebase-v1-DataSourceType) | | |-| username | [string](#string) | | |-| password | [string](#string) | | |-| ssl_ca | [string](#string) | | |-| ssl_cert | [string](#string) | | |-| ssl_key | [string](#string) | | |-| host | [string](#string) | | |-| port | [string](#string) | | |-| database | [string](#string) | | |-| srv | [bool](#bool) | | srv and authentication_database are used for MongoDB. |-| authentication_database | [string](#string) | | |-| sid | [string](#string) | | sid and service_name are used for Oracle. |-| service_name | [string](#string) | | |-| ssh_host | [string](#string) | | Connection over SSH. The hostname of the SSH server agent. Required. |-| ssh_port | [string](#string) | | The port of the SSH server agent. It's 22 typically. Required. |-| ssh_user | [string](#string) | | The user to login the server. Required. |-| ssh_password | [string](#string) | | The password to login the server. If it's empty string, no password is required. |-| ssh_private_key | [string](#string) | | The private key to login the server. If it's empty string, we will use the system default private key from os.Getenv("SSH_AUTH_SOCK"). |+### IdentityProviderType+| Name | Number | Description |+| ---- | ------ | ----------- |+| IDENTITY_PROVIDER_TYPE_UNSPECIFIED | 0 | |+| OAUTH2 | 1 | |+| OIDC | 2 | |++-<a name="bytebase-v1-DeleteInstanceRequest"></a>-### DeleteInstanceRequest+<a name="bytebase-v1-IdentityProviderService"></a>+### IdentityProviderService-| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the instance to delete. Format: instances/{instance} |-| force | [bool](#bool) | | If set to true, any databases and sheets from this project will also be moved to default project, and all open issues will be closed. |+| Method Name | Request Type | Response Type | Description |+| ----------- | ------------ | ------------- | ------------|+| GetIdentityProvider | [GetIdentityProviderRequest](#bytebase-v1-GetIdentityProviderRequest) | [IdentityProvider](#bytebase-v1-IdentityProvider) | |+| ListIdentityProviders | [ListIdentityProvidersRequest](#bytebase-v1-ListIdentityProvidersRequest) | [ListIdentityProvidersResponse](#bytebase-v1-ListIdentityProvidersResponse) | |+| CreateIdentityProvider | [CreateIdentityProviderRequest](#bytebase-v1-CreateIdentityProviderRequest) | [IdentityProvider](#bytebase-v1-IdentityProvider) | |+| UpdateIdentityProvider | [UpdateIdentityProviderRequest](#bytebase-v1-UpdateIdentityProviderRequest) | [IdentityProvider](#bytebase-v1-IdentityProvider) | |+| DeleteIdentityProvider | [DeleteIdentityProviderRequest](#bytebase-v1-DeleteIdentityProviderRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | |+| UndeleteIdentityProvider | [UndeleteIdentityProviderRequest](#bytebase-v1-UndeleteIdentityProviderRequest) | [IdentityProvider](#bytebase-v1-IdentityProvider) | |+| TestIdentityProvider | [TestIdentityProviderRequest](#bytebase-v1-TestIdentityProviderRequest) | [TestIdentityProviderResponse](#bytebase-v1-TestIdentityProviderResponse) | |++<a name="v1_inbox_service-proto"></a>+<p align="right"><a href="#top">Top</a></p>+## v1/inbox_service.proto-<a name="bytebase-v1-GetInstanceRequest"></a>-### GetInstanceRequest+<a name="bytebase-v1-GetInboxSummaryRequest"></a>+### GetInboxSummaryRequest-| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the instance to retrieve. Format: instances/{instance} |-<a name="bytebase-v1-Instance"></a>+<a name="bytebase-v1-InboxMessage"></a>-### Instance+### InboxMessage| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the instance. Format: instances/{instance} |-| uid | [string](#string) | | The system-assigned, unique identifier for a resource. |-| state | [State](#bytebase-v1-State) | | |-| title | [string](#string) | | |-| engine | [Engine](#bytebase-v1-Engine) | | |-| engine_version | [string](#string) | | |-| external_link | [string](#string) | | |-| data_sources | [DataSource](#bytebase-v1-DataSource) | repeated | |-| environment | [string](#string) | | The environment resource. Format: environments/prod where prod is the environment resource ID. |+| name | [string](#string) | | The message name in inbox/{uid} format. |+| activity_uid | [string](#string) | | |+| status | [InboxMessage.Status](#bytebase-v1-InboxMessage-Status) | | |-<a name="bytebase-v1-ListInstancesRequest"></a>+<a name="bytebase-v1-InboxSummary"></a>-### ListInstancesRequest+### InboxSummary| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| page_size | [int32](#int32) | | The maximum number of instances to return. The service may return fewer than this value. If unspecified, at most 50 instances will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |-| page_token | [string](#string) | | A page token, received from a previous `ListInstances` call. Provide this to retrieve the subsequent page.--When paginating, all other parameters provided to `ListInstances` must match the call that provided the page token. |-| show_deleted | [bool](#bool) | | Show deleted instances if specified. |+| has_unread | [bool](#bool) | | |+| has_unread_error | [bool](#bool) | | |-<a name="bytebase-v1-ListInstancesResponse"></a>+<a name="bytebase-v1-ListInboxRequest"></a>-### ListInstancesResponse+### ListInboxRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| instances | [Instance](#bytebase-v1-Instance) | repeated | The instances from the specified request. |-| next_page_token | [string](#string) | | A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. |+| filter | [string](#string) | | filter is the filter to apply on the list inbox request, follow the [ebnf](https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form) syntax. The field only support in filter: - "create_time" with ">=" operator, example: - create_time >= "2022-01-01T12:00:00.000Z" |+| page_size | [int32](#int32) | | Not used. The maximum number of inbox to return. The service may return fewer than this value. If unspecified, at most 100 log entries will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |+| page_token | [string](#string) | | Not used. A page token, received from a previous `ListInbox` call. Provide this to retrieve the subsequent page. |-<a name="bytebase-v1-RemoveDataSourceRequest"></a>+<a name="bytebase-v1-ListInboxResponse"></a>-### RemoveDataSourceRequest+### ListInboxResponse| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| instance | [string](#string) | | The name of the instance to remove a data source from. Format: instances/{instance} |-| data_source | [DataSource](#bytebase-v1-DataSource) | | Identified by type. Only READ_ONLY data source can be removed. |+| inbox_messages | [InboxMessage](#bytebase-v1-InboxMessage) | repeated | The list of inbox messages. |+| next_page_token | [string](#string) | | A token to retrieve next page of inbox. Pass this value in the page_token field in the subsequent call to `ListLogs` method to retrieve the next page of log entities. |-<a name="bytebase-v1-SyncInstanceRequest"></a>+<a name="bytebase-v1-UpdateInboxRequest"></a>-### SyncInstanceRequest+### UpdateInboxRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of instance. Format: instances/{instance} |+| inbox_message | [InboxMessage](#bytebase-v1-InboxMessage) | | The inbox message to update. |+| update_mask | [google.protobuf.FieldMask](#google-protobuf-FieldMask) | | The list of fields to update. |+-<a name="bytebase-v1-SyncInstanceResponse"></a>-### SyncInstanceResponse+<a name="bytebase-v1-InboxMessage-Status"></a>+### InboxMessage.Status+| Name | Number | Description |+| ---- | ------ | ----------- |+| STATUS_UNSPECIFIED | 0 | |+| STATUS_UNREAD | 1 | |+| STATUS_READ | 2 | |++-<a name="bytebase-v1-SyncSlowQueriesRequest"></a>-### SyncSlowQueriesRequest+<a name="bytebase-v1-InboxService"></a>+### InboxService-| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| instance | [string](#string) | | The name of the instance to sync slow queries. Format: instances/{instance} |+| Method Name | Request Type | Response Type | Description |+| ----------- | ------------ | ------------- | ------------|+| ListInbox | [ListInboxRequest](#bytebase-v1-ListInboxRequest) | [ListInboxResponse](#bytebase-v1-ListInboxResponse) | |+| GetInboxSummary | [GetInboxSummaryRequest](#bytebase-v1-GetInboxSummaryRequest) | [InboxSummary](#bytebase-v1-InboxSummary) | |+| UpdateInbox | [UpdateInboxRequest](#bytebase-v1-UpdateInboxRequest) | [InboxMessage](#bytebase-v1-InboxMessage) | |++<a name="v1_instance_role_service-proto"></a>+<p align="right"><a href="#top">Top</a></p>+## v1/instance_role_service.proto-<a name="bytebase-v1-UndeleteInstanceRequest"></a>-### UndeleteInstanceRequest++<a name="bytebase-v1-CreateInstanceRoleRequest"></a>++### CreateInstanceRoleRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the deleted instance. Format: instances/{instance} |+| parent | [string](#string) | | The parent resource where this role will be created. Format: instances/{instance} |+| role | [InstanceRole](#bytebase-v1-InstanceRole) | | The role to create. |-<a name="bytebase-v1-UpdateDataSourceRequest"></a>+<a name="bytebase-v1-DeleteInstanceRoleRequest"></a>-### UpdateDataSourceRequest+### DeleteInstanceRoleRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| instance | [string](#string) | | The name of the instance to update a data source. Format: instances/{instance} |-| data_source | [DataSource](#bytebase-v1-DataSource) | | Identified by type. |-| update_mask | [google.protobuf.FieldMask](#google-protobuf-FieldMask) | | The list of fields to update. |-| validate_only | [bool](#bool) | | Validate only also tests the data source connection. |+| name | [string](#string) | | The name of the role to delete. Format: instances/{instance}/roles/{role name} |-<a name="bytebase-v1-UpdateInstanceRequest"></a>+<a name="bytebase-v1-GetInstanceRoleRequest"></a>-### UpdateInstanceRequest+### GetInstanceRoleRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| instance | [Instance](#bytebase-v1-Instance) | | The instance to update.--The instance's `name` field is used to identify the instance to update. Format: instances/{instance} |-| update_mask | [google.protobuf.FieldMask](#google-protobuf-FieldMask) | | The list of fields to update. |+| name | [string](#string) | | The name of the role to retrieve. Format: instances/{instance}/roles/{role name} The role name is the unique name for the role. |-+<a name="bytebase-v1-InstanceRole"></a>-<a name="bytebase-v1-DataSourceType"></a>+### InstanceRole+InstanceRole is the API message for instance role.-### DataSourceType+| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| name | [string](#string) | | The name of the role. Format: instances/{instance}/roles/{role name} The role name is the unique name for the role. |+| role_name | [string](#string) | | The role name. It's unique within the instance. |+| password | [string](#string) | optional | The role password. |+| connection_limit | [int32](#int32) | optional | The connection count limit for this role. |+| valid_until | [string](#string) | optional | The expiration for the role's password. |+| attribute | [string](#string) | optional | The role attribute. For PostgreSQL, it containt super_user, no_inherit, create_role, create_db, can_login, replication and bypass_rls. Docs: https://www.postgresql.org/docs/current/role-attributes.html For MySQL, it's the global privileges as GRANT statements, which means it only contains "GRANT ... ON *.* TO ...". Docs: https://dev.mysql.com/doc/refman/8.0/en/grant.html |-| Name | Number | Description |-| ---- | ------ | ----------- |-| DATA_SOURCE_UNSPECIFIED | 0 | |-| ADMIN | 1 | |-| READ_ONLY | 2 | |---<a name="bytebase-v1-InstanceService"></a>+<a name="bytebase-v1-ListInstanceRolesRequest"></a>-### InstanceService+### ListInstanceRolesRequest-| Method Name | Request Type | Response Type | Description |-| ----------- | ------------ | ------------- | ------------|-| GetInstance | [GetInstanceRequest](#bytebase-v1-GetInstanceRequest) | [Instance](#bytebase-v1-Instance) | |-| ListInstances | [ListInstancesRequest](#bytebase-v1-ListInstancesRequest) | [ListInstancesResponse](#bytebase-v1-ListInstancesResponse) | |-| CreateInstance | [CreateInstanceRequest](#bytebase-v1-CreateInstanceRequest) | [Instance](#bytebase-v1-Instance) | |-| UpdateInstance | [UpdateInstanceRequest](#bytebase-v1-UpdateInstanceRequest) | [Instance](#bytebase-v1-Instance) | |-| DeleteInstance | [DeleteInstanceRequest](#bytebase-v1-DeleteInstanceRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | |-| UndeleteInstance | [UndeleteInstanceRequest](#bytebase-v1-UndeleteInstanceRequest) | [Instance](#bytebase-v1-Instance) | |-| SyncInstance | [SyncInstanceRequest](#bytebase-v1-SyncInstanceRequest) | [SyncInstanceResponse](#bytebase-v1-SyncInstanceResponse) | |-| AddDataSource | [AddDataSourceRequest](#bytebase-v1-AddDataSourceRequest) | [Instance](#bytebase-v1-Instance) | |-| RemoveDataSource | [RemoveDataSourceRequest](#bytebase-v1-RemoveDataSourceRequest) | [Instance](#bytebase-v1-Instance) | |-| UpdateDataSource | [UpdateDataSourceRequest](#bytebase-v1-UpdateDataSourceRequest) | [Instance](#bytebase-v1-Instance) | |-| SyncSlowQueries | [SyncSlowQueriesRequest](#bytebase-v1-SyncSlowQueriesRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | |-+| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| parent | [string](#string) | | The parent, which owns this collection of roles. Format: instances/{instance} |+| page_size | [int32](#int32) | | The maximum number of roles to return. The service may return fewer than this value. If unspecified, at most 50 roles will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |+| page_token | [string](#string) | | A page token, received from a previous `ListRoles` call. Provide this to retrieve the subsequent page.+When paginating, all other parameters provided to `ListRoles` must match the call that provided the page token. |+| refresh | [bool](#bool) | | Refresh will refresh and return the latest data. |-<a name="v1_logging_service-proto"></a>-<p align="right"><a href="#top">Top</a></p>-## v1/logging_service.proto-<a name="bytebase-v1-GetLogRequest"></a>+<a name="bytebase-v1-ListInstanceRolesResponse"></a>-### GetLogRequest+### ListInstanceRolesResponse| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the log to retrieve. Format: logs/{uid} |+| roles | [InstanceRole](#bytebase-v1-InstanceRole) | repeated | The roles from the specified request. |+| next_page_token | [string](#string) | | A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. |-<a name="bytebase-v1-ListLogsRequest"></a>+<a name="bytebase-v1-UndeleteInstanceRoleRequest"></a>-### ListLogsRequest+### UndeleteInstanceRoleRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| filter | [string](#string) | | filter is the filter to apply on the list logs request, follow the [ebnf](https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form) syntax. The field only support in filter: - creator, example: - creator = "users/{email}" - resource, example: - resource = "projects/{project resource id}" - level, example: - level = "INFO" - level = "ERROR | WARN" - action, example: - action = "ACTION_MEMBER_CREATE" | "ACTION_ISSUE_CREATE" - create_time, example: - create_time <= "2022-01-01T12:00:00.000Z" - create_time >= "2022-01-01T12:00:00.000Z" For example: List the logs of type 'ACTION_ISSUE_COMMENT_CREATE' in issue/123: 'action="ACTION_ISSUE_COMMENT_CREATE", resource="issue/123"' |-| order_by | [string](#string) | | The order by of the log. Only support order by create_time. For example: - order_by = "create_time asc" - order_by = "create_time desc" |-| page_size | [int32](#int32) | | Not used. The maximum number of logs to return. The service may return fewer than this value. If unspecified, at most 100 log entries will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |-| page_token | [string](#string) | | Not used. A page token, received from a previous `ListLogs` call. Provide this to retrieve the subsequent page. |+| name | [string](#string) | | The name of the deleted role. Format: instances/{instance}/roles/{role name} |-<a name="bytebase-v1-ListLogsResponse"></a>+<a name="bytebase-v1-UpdateInstanceRoleRequest"></a>-### ListLogsResponse+### UpdateInstanceRoleRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| log_entities | [LogEntity](#bytebase-v1-LogEntity) | repeated | The list of log entities. |-| next_page_token | [string](#string) | | A token to retrieve next page of log entities. Pass this value in the page_token field in the subsequent call to `ListLogs` method to retrieve the next page of log entities. |+| role | [InstanceRole](#bytebase-v1-InstanceRole) | | The role to update.+The role's `name` and `instance` field is used to identify the role to update. Format: instances/{instance}/roles/{role name} |+| update_mask | [google.protobuf.FieldMask](#google-protobuf-FieldMask) | | The list of fields to update. |-<a name="bytebase-v1-LogEntity"></a>+-### LogEntity++-| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the log. Format: logs/{uid} |-| creator | [string](#string) | | The creator of the log entity. Format: users/{email} |-| create_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |-| update_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |-| action | [LogEntity.Action](#bytebase-v1-LogEntity-Action) | | |-| level | [LogEntity.Level](#bytebase-v1-LogEntity-Level) | | |-| resource | [string](#string) | | The name of the resource associated with this log entity. For example, the resource user associated with log entity type of "ACTION_MEMBER_CREATE". Format: For ACTION_MEMBER_*: users/{email} For ACTION_ISSUE_*: issues/{issue uid} For ACTION_PIPELINE_*: pipelines/{pipeline uid} For ACTION_PROJECT_*: projects/{project resource id} For ACTION_DATABASE_*: instances/{instance resource id} |-| payload | [string](#string) | | The payload of the log entity. TODO: use oneof |-| comment | [string](#string) | | |-+<a name="bytebase-v1-InstanceRoleService"></a>+### InstanceRoleService+| Method Name | Request Type | Response Type | Description |+| ----------- | ------------ | ------------- | ------------|+| GetInstanceRole | [GetInstanceRoleRequest](#bytebase-v1-GetInstanceRoleRequest) | [InstanceRole](#bytebase-v1-InstanceRole) | |+| ListInstanceRoles | [ListInstanceRolesRequest](#bytebase-v1-ListInstanceRolesRequest) | [ListInstanceRolesResponse](#bytebase-v1-ListInstanceRolesResponse) | |+| CreateInstanceRole | [CreateInstanceRoleRequest](#bytebase-v1-CreateInstanceRoleRequest) | [InstanceRole](#bytebase-v1-InstanceRole) | |+| UpdateInstanceRole | [UpdateInstanceRoleRequest](#bytebase-v1-UpdateInstanceRoleRequest) | [InstanceRole](#bytebase-v1-InstanceRole) | |+| DeleteInstanceRole | [DeleteInstanceRoleRequest](#bytebase-v1-DeleteInstanceRoleRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | |+| UndeleteInstanceRole | [UndeleteInstanceRoleRequest](#bytebase-v1-UndeleteInstanceRoleRequest) | [InstanceRole](#bytebase-v1-InstanceRole) | |-<a name="bytebase-v1-LogEntity-Action"></a>--### LogEntity.Action--| Name | Number | Description |-| ---- | ------ | ----------- |-| ACTION_UNSPECIFIED | 0 | In worksapce resource only. |-| ACTION_MEMBER_CREATE | 1 | Member related activity types. Enum value 1 - 20--ACTION_MEMBER_CREATE is the type for creating a new member. |-| ACTION_MEMBER_ROLE_UPDATE | 2 | ACTION_MEMBER_ROLE_UPDATE is the type for updating a member's role. |-| ACTION_MEMBER_ACTIVATE | 3 | ACTION_MEMBER_ACTIVATE_UPDATE is the type for activating members. |-| ACTION_MEMBER_DEACTIVE | 4 | ACTION_MEMBER_DEACTIVE is the type for deactiving members. |-| ACTION_ISSUE_CREATE | 21 | Issue related activity types. Enum value 21 - 40+<a name="v1_instance_service-proto"></a>+<p align="right"><a href="#top">Top</a></p>-ACTION_ISSUE_CREATE is the type for creating a new issue. |-| ACTION_ISSUE_COMMENT_CREATE | 22 | ACTION_ISSUE_COMMENT_CREATE is the type for creating a new comment on an issue. |-| ACTION_ISSUE_FIELD_UPDATE | 23 | ACTION_ISSUE_FIELD_UPDATE is the type for updating an issue's field. |-| ACTION_ISSUE_STATUS_UPDATE | 24 | ACTION_ISSUE_STATUS_UPDATE is the type for updating an issue's status. |-| ACTION_ISSUE_APPROVAL_NOTIFY | 25 | ACTION_ISSUE_APPROVAL_NOTIFY is the type for notifying issue approval. |-| ACTION_PIPELINE_STAGE_STATUS_UPDATE | 31 | ACTION_PIPELINE_STAGE_STATUS_UPDATE represents the pipeline stage status change, including BEGIN, END for now. |-| ACTION_PIPELINE_TASK_STATUS_UPDATE | 32 | ACTION_PIPELINE_TASK_STATUS_UPDATE represents the pipeline task status change, including PENDING, PENDING_APPROVAL, RUNNING, SUCCESS, FAILURE, CANCELED for now. |-| ACTION_PIPELINE_TASK_FILE_COMMIT | 33 | ACTION_PIPELINE_TASK_FILE_COMMIT represents the VCS trigger to commit a file to update the task statement. |-| ACTION_PIPELINE_TASK_STATEMENT_UPDATE | 34 | ACTION_PIPELINE_TASK_STATEMENT_UPDATE represents the manual update of the task statement. |-| ACTION_PIPELINE_TASK_EARLIEST_ALLOWED_TIME_UPDATE | 35 | ACTION_PIPELINE_TASK_EARLIEST_ALLOWED_TIME_UPDATE represents the manual update of the task earliest allowed time. |-| ACTION_PROJECT_REPOSITORY_PUSH | 41 | Project related activity types. Enum value 41 - 60+## v1/instance_service.proto-ACTION_PROJECT_REPOSITORY_PUSH represents Bytebase receiving a push event from the project repository. |-| ACTION_PROJECT_MEMBER_CREATE | 42 | ACTION_PROJECT_MEMBER_CREATE represents adding a member to the project. |-| ACTION_PROJECT_MEMBER_DELETE | 43 | ACTION_PROJECT_MEMBER_DELETE represents removing a member from the project. |-| ACTION_PROJECT_MEMBER_ROLE_UPDATE | 44 | ACTION_PROJECT_MEMBER_ROLE_UPDATE represents updating the member role, for example, from ADMIN to MEMBER. |-| ACTION_PROJECT_DATABASE_RECOVERY_PITR_DONE | 45 | ACTION_PROJECT_DATABASE_RECOVERY_PITR_DONE is the type for database PITR recovery done. |-| ACTION_PROJECT_DATABASE_TRANSFER | 46 | ACTION_PROJECT_DATABASE_TRANSFER represents transfering the database from one project to another. |-| ACTION_DATABASE_SQL_EDITOR_QUERY | 61 | Database related activity types. Enum value 61 - 80-ACTION_DATABASE_SQL_EDITOR_QUERY is the type for SQL editor query. |-| ACTION_DATABASE_SQL_EXPORT | 62 | ACTION_DATABASE_SQL_EXPORT is the type for exporting SQL. |+<a name="bytebase-v1-AddDataSourceRequest"></a>+### AddDataSourceRequest-<a name="bytebase-v1-LogEntity-Level"></a>-### LogEntity.Level+| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| instance | [string](#string) | | The name of the instance to add a data source to. Format: instances/{instance} |+| data_source | [DataSource](#bytebase-v1-DataSource) | | Identified by type. Only READ_ONLY data source can be added. |+| validate_only | [bool](#bool) | | Validate only also tests the data source connection. |-| Name | Number | Description |-| ---- | ------ | ----------- |-| LEVEL_UNSPECIFIED | 0 | |-| LEVEL_INFO | 1 | LEVEL_INFO is the type for information. |-| LEVEL_WARNING | 2 | LEVEL_WARNING is the type for warning. |-| LEVEL_ERROR | 3 | LEVEL_ERROR is the type for error. |---<a name="bytebase-v1-LoggingService"></a>+<a name="bytebase-v1-CreateInstanceRequest"></a>-### LoggingService+### CreateInstanceRequest-| Method Name | Request Type | Response Type | Description |-| ----------- | ------------ | ------------- | ------------|-| ListLogs | [ListLogsRequest](#bytebase-v1-ListLogsRequest) | [ListLogsResponse](#bytebase-v1-ListLogsResponse) | |-| GetLog | [GetLogRequest](#bytebase-v1-GetLogRequest) | [LogEntity](#bytebase-v1-LogEntity) | |-+| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| instance | [Instance](#bytebase-v1-Instance) | | The instance to create. |+| instance_id | [string](#string) | | The ID to use for the instance, which will become the final component of the instance's resource name.+This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/. |+| validate_only | [bool](#bool) | | Validate only also tests the data source connection. |-<a name="v1_org_policy_service-proto"></a>-<p align="right"><a href="#top">Top</a></p>-## v1/org_policy_service.proto-<a name="bytebase-v1-AccessControlPolicy"></a>+<a name="bytebase-v1-DataSource"></a>-### AccessControlPolicy+### DataSource| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| disallow_rules | [AccessControlRule](#bytebase-v1-AccessControlRule) | repeated | |+| title | [string](#string) | | |+| type | [DataSourceType](#bytebase-v1-DataSourceType) | | |+| username | [string](#string) | | |+| password | [string](#string) | | |+| ssl_ca | [string](#string) | | |+| ssl_cert | [string](#string) | | |+| ssl_key | [string](#string) | | |+| host | [string](#string) | | |+| port | [string](#string) | | |+| database | [string](#string) | | |+| srv | [bool](#bool) | | srv and authentication_database are used for MongoDB. |+| authentication_database | [string](#string) | | |+| sid | [string](#string) | | sid and service_name are used for Oracle. |+| service_name | [string](#string) | | |+| ssh_host | [string](#string) | | Connection over SSH. The hostname of the SSH server agent. Required. |+| ssh_port | [string](#string) | | The port of the SSH server agent. It's 22 typically. Required. |+| ssh_user | [string](#string) | | The user to login the server. Required. |+| ssh_password | [string](#string) | | The password to login the server. If it's empty string, no password is required. |+| ssh_private_key | [string](#string) | | The private key to login the server. If it's empty string, we will use the system default private key from os.Getenv("SSH_AUTH_SOCK"). |-<a name="bytebase-v1-AccessControlRule"></a>+<a name="bytebase-v1-DeleteInstanceRequest"></a>-### AccessControlRule+### DeleteInstanceRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| full_database | [bool](#bool) | | |+| name | [string](#string) | | The name of the instance to delete. Format: instances/{instance} |+| force | [bool](#bool) | | If set to true, any databases and sheets from this project will also be moved to default project, and all open issues will be closed. |-<a name="bytebase-v1-BackupPlanPolicy"></a>+<a name="bytebase-v1-GetInstanceRequest"></a>-### BackupPlanPolicy+### GetInstanceRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| schedule | [BackupPlanSchedule](#bytebase-v1-BackupPlanSchedule) | | |-| retention_duration | [google.protobuf.Duration](#google-protobuf-Duration) | | |+| name | [string](#string) | | The name of the instance to retrieve. Format: instances/{instance} |-<a name="bytebase-v1-CreatePolicyRequest"></a>+<a name="bytebase-v1-Instance"></a>-### CreatePolicyRequest+### Instance| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| parent | [string](#string) | | The parent resource where this instance will be created. Workspace resource name: "". Environment resource name: environments/environment-id. Instance resource name: instances/instance-id. Database resource name: instances/instance-id/databases/database-name. |-| policy | [Policy](#bytebase-v1-Policy) | | The policy to create. |-| type | [PolicyType](#bytebase-v1-PolicyType) | | |+| name | [string](#string) | | The name of the instance. Format: instances/{instance} |+| uid | [string](#string) | | The system-assigned, unique identifier for a resource. |+| state | [State](#bytebase-v1-State) | | |+| title | [string](#string) | | |+| engine | [Engine](#bytebase-v1-Engine) | | |+| engine_version | [string](#string) | | |+| external_link | [string](#string) | | |+| data_sources | [DataSource](#bytebase-v1-DataSource) | repeated | |+| environment | [string](#string) | | The environment resource. Format: environments/prod where prod is the environment resource ID. |-<a name="bytebase-v1-DeletePolicyRequest"></a>+<a name="bytebase-v1-ListInstancesRequest"></a>-### DeletePolicyRequest+### ListInstancesRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The policy's `name` field is used to identify the instance to update. Format: {resource name}/policies/{policy type} Workspace resource name: "". Environment resource name: environments/environment-id. Instance resource name: instances/instance-id. Database resource name: instances/instance-id/databases/database-name. |+| page_size | [int32](#int32) | | The maximum number of instances to return. The service may return fewer than this value. If unspecified, at most 50 instances will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |+| page_token | [string](#string) | | A page token, received from a previous `ListInstances` call. Provide this to retrieve the subsequent page.+When paginating, all other parameters provided to `ListInstances` must match the call that provided the page token. |+| show_deleted | [bool](#bool) | | Show deleted instances if specified. |-<a name="bytebase-v1-DeploymentApprovalPolicy"></a>-### DeploymentApprovalPolicy+<a name="bytebase-v1-ListInstancesResponse"></a>++### ListInstancesResponse| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| default_strategy | [ApprovalStrategy](#bytebase-v1-ApprovalStrategy) | | |-| deployment_approval_strategies | [DeploymentApprovalStrategy](#bytebase-v1-DeploymentApprovalStrategy) | repeated | |+| instances | [Instance](#bytebase-v1-Instance) | repeated | The instances from the specified request. |+| next_page_token | [string](#string) | | A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. |-<a name="bytebase-v1-DeploymentApprovalStrategy"></a>+<a name="bytebase-v1-RemoveDataSourceRequest"></a>-### DeploymentApprovalStrategy+### RemoveDataSourceRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| deployment_type | [DeploymentType](#bytebase-v1-DeploymentType) | | |-| approval_group | [ApprovalGroup](#bytebase-v1-ApprovalGroup) | | |-| approval_strategy | [ApprovalStrategy](#bytebase-v1-ApprovalStrategy) | | |+| instance | [string](#string) | | The name of the instance to remove a data source from. Format: instances/{instance} |+| data_source | [DataSource](#bytebase-v1-DataSource) | | Identified by type. Only READ_ONLY data source can be removed. |-<a name="bytebase-v1-GetPolicyRequest"></a>+<a name="bytebase-v1-SyncInstanceRequest"></a>-### GetPolicyRequest+### SyncInstanceRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the policy to retrieve. Format: {resource type}/{resource id}/policies/{policy type} |-+| name | [string](#string) | | The name of instance. Format: instances/{instance} |-<a name="bytebase-v1-ListPoliciesRequest"></a>-### ListPoliciesRequest+<a name="bytebase-v1-SyncInstanceResponse"></a>+### SyncInstanceResponse-| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| parent | [string](#string) | | The parent, which owns this collection of policies. Format: {resource type}/{resource id}/policies/{policy type} |-| policy_type | [PolicyType](#bytebase-v1-PolicyType) | optional | |-| page_size | [int32](#int32) | | The maximum number of policies to return. The service may return fewer than this value. If unspecified, at most 50 policies will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |-| page_token | [string](#string) | | A page token, received from a previous `GetPolicies` call. Provide this to retrieve the subsequent page.-When paginating, all other parameters provided to `GetPolicies` must match the call that provided the page token. |-| show_deleted | [bool](#bool) | | Show deleted policies if specified. |+<a name="bytebase-v1-SyncSlowQueriesRequest"></a>--<a name="bytebase-v1-ListPoliciesResponse"></a>--### ListPoliciesResponse+### SyncSlowQueriesRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| policies | [Policy](#bytebase-v1-Policy) | repeated | The policies from the specified request. |-| next_page_token | [string](#string) | | A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. |+| instance | [string](#string) | | The name of the instance to sync slow queries. Format: instances/{instance} |-<a name="bytebase-v1-Policy"></a>+<a name="bytebase-v1-UndeleteInstanceRequest"></a>-### Policy+### UndeleteInstanceRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the policy. Format: {resource name}/policies/{policy type} Workspace resource name: "". Environment resource name: environments/environment-id. Instance resource name: instances/instance-id. Database resource name: instances/instance-id/databases/database-name. |-| uid | [string](#string) | | The system-assigned, unique identifier for a resource. |-| inherit_from_parent | [bool](#bool) | | |-| type | [PolicyType](#bytebase-v1-PolicyType) | | |-| deployment_approval_policy | [DeploymentApprovalPolicy](#bytebase-v1-DeploymentApprovalPolicy) | | |-| backup_plan_policy | [BackupPlanPolicy](#bytebase-v1-BackupPlanPolicy) | | |-| sensitive_data_policy | [SensitiveDataPolicy](#bytebase-v1-SensitiveDataPolicy) | | |-| access_control_policy | [AccessControlPolicy](#bytebase-v1-AccessControlPolicy) | | |-| sql_review_policy | [SQLReviewPolicy](#bytebase-v1-SQLReviewPolicy) | | |-| slow_query_policy | [SlowQueryPolicy](#bytebase-v1-SlowQueryPolicy) | | |-| enforce | [bool](#bool) | | |-| resource_type | [PolicyResourceType](#bytebase-v1-PolicyResourceType) | | The resource type for the policy. |-| resource_uid | [string](#string) | | The system-assigned, unique identifier for the resource. |+| name | [string](#string) | | The name of the deleted instance. Format: instances/{instance} |-<a name="bytebase-v1-SQLReviewPolicy"></a>+<a name="bytebase-v1-UpdateDataSourceRequest"></a>-### SQLReviewPolicy+### UpdateDataSourceRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | |-| rules | [SQLReviewRule](#bytebase-v1-SQLReviewRule) | repeated | |+| instance | [string](#string) | | The name of the instance to update a data source. Format: instances/{instance} |+| data_source | [DataSource](#bytebase-v1-DataSource) | | Identified by type. |+| update_mask | [google.protobuf.FieldMask](#google-protobuf-FieldMask) | | The list of fields to update. |+| validate_only | [bool](#bool) | | Validate only also tests the data source connection. |-<a name="bytebase-v1-SQLReviewRule"></a>+<a name="bytebase-v1-UpdateInstanceRequest"></a>-### SQLReviewRule+### UpdateInstanceRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| type | [string](#string) | | |-| level | [SQLReviewRuleLevel](#bytebase-v1-SQLReviewRuleLevel) | | |-| payload | [string](#string) | | |-| engine | [Engine](#bytebase-v1-Engine) | | |-| comment | [string](#string) | | |+| instance | [Instance](#bytebase-v1-Instance) | | The instance to update.+The instance's `name` field is used to identify the instance to update. Format: instances/{instance} |+| update_mask | [google.protobuf.FieldMask](#google-protobuf-FieldMask) | | The list of fields to update. |-<a name="bytebase-v1-SensitiveData"></a>+-### SensitiveData+<a name="bytebase-v1-DataSourceType"></a>+### DataSourceType-| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| schema | [string](#string) | | |-| table | [string](#string) | | |-| column | [string](#string) | | |-| mask_type | [SensitiveDataMaskType](#bytebase-v1-SensitiveDataMaskType) | | |++| Name | Number | Description |+| ---- | ------ | ----------- |+| DATA_SOURCE_UNSPECIFIED | 0 | |+| ADMIN | 1 | |+| READ_ONLY | 2 | |+++<a name="bytebase-v1-InstanceService"></a>-<a name="bytebase-v1-SensitiveDataPolicy"></a>+### InstanceService-### SensitiveDataPolicy+| Method Name | Request Type | Response Type | Description |+| ----------- | ------------ | ------------- | ------------|+| GetInstance | [GetInstanceRequest](#bytebase-v1-GetInstanceRequest) | [Instance](#bytebase-v1-Instance) | |+| ListInstances | [ListInstancesRequest](#bytebase-v1-ListInstancesRequest) | [ListInstancesResponse](#bytebase-v1-ListInstancesResponse) | |+| CreateInstance | [CreateInstanceRequest](#bytebase-v1-CreateInstanceRequest) | [Instance](#bytebase-v1-Instance) | |+| UpdateInstance | [UpdateInstanceRequest](#bytebase-v1-UpdateInstanceRequest) | [Instance](#bytebase-v1-Instance) | |+| DeleteInstance | [DeleteInstanceRequest](#bytebase-v1-DeleteInstanceRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | |+| UndeleteInstance | [UndeleteInstanceRequest](#bytebase-v1-UndeleteInstanceRequest) | [Instance](#bytebase-v1-Instance) | |+| SyncInstance | [SyncInstanceRequest](#bytebase-v1-SyncInstanceRequest) | [SyncInstanceResponse](#bytebase-v1-SyncInstanceResponse) | |+| AddDataSource | [AddDataSourceRequest](#bytebase-v1-AddDataSourceRequest) | [Instance](#bytebase-v1-Instance) | |+| RemoveDataSource | [RemoveDataSourceRequest](#bytebase-v1-RemoveDataSourceRequest) | [Instance](#bytebase-v1-Instance) | |+| UpdateDataSource | [UpdateDataSourceRequest](#bytebase-v1-UpdateDataSourceRequest) | [Instance](#bytebase-v1-Instance) | |+| SyncSlowQueries | [SyncSlowQueriesRequest](#bytebase-v1-SyncSlowQueriesRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | |+-| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| sensitive_data | [SensitiveData](#bytebase-v1-SensitiveData) | repeated | |+<a name="v1_logging_service-proto"></a>+<p align="right"><a href="#top">Top</a></p>+## v1/logging_service.proto-<a name="bytebase-v1-SlowQueryPolicy"></a>+<a name="bytebase-v1-GetLogRequest"></a>-### SlowQueryPolicy+### GetLogRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| active | [bool](#bool) | | |+| name | [string](#string) | | The name of the log to retrieve. Format: logs/{uid} |-<a name="bytebase-v1-UpdatePolicyRequest"></a>+<a name="bytebase-v1-ListLogsRequest"></a>-### UpdatePolicyRequest+### ListLogsRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| policy | [Policy](#bytebase-v1-Policy) | | The policy to update.--The policy's `name` field is used to identify the instance to update. Format: {resource name}/policies/{policy type} Workspace resource name: "". Environment resource name: environments/environment-id. Instance resource name: instances/instance-id. Database resource name: instances/instance-id/databases/database-name. |-| update_mask | [google.protobuf.FieldMask](#google-protobuf-FieldMask) | | The list of fields to update. |-| allow_missing | [bool](#bool) | | If set to true, and the policy is not found, a new policy will be created. In this situation, `update_mask` is ignored. |+| filter | [string](#string) | | filter is the filter to apply on the list logs request, follow the [ebnf](https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form) syntax. The field only support in filter: - creator, example: - creator = "users/{email}" - resource, example: - resource = "projects/{project resource id}" - level, example: - level = "INFO" - level = "ERROR | WARN" - action, example: - action = "ACTION_MEMBER_CREATE" | "ACTION_ISSUE_CREATE" - create_time, example: - create_time <= "2022-01-01T12:00:00.000Z" - create_time >= "2022-01-01T12:00:00.000Z" For example: List the logs of type 'ACTION_ISSUE_COMMENT_CREATE' in issue/123: 'action="ACTION_ISSUE_COMMENT_CREATE", resource="issue/123"' |+| order_by | [string](#string) | | The order by of the log. Only support order by create_time. For example: - order_by = "create_time asc" - order_by = "create_time desc" |+| page_size | [int32](#int32) | | Not used. The maximum number of logs to return. The service may return fewer than this value. If unspecified, at most 100 log entries will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |+| page_token | [string](#string) | | Not used. A page token, received from a previous `ListLogs` call. Provide this to retrieve the subsequent page. |-+<a name="bytebase-v1-ListLogsResponse"></a>-<a name="bytebase-v1-ApprovalGroup"></a>+### ListLogsResponse-### ApprovalGroup-| Name | Number | Description |-| ---- | ------ | ----------- |-| ASSIGNEE_GROUP_UNSPECIFIED | 0 | |-| APPROVAL_GROUP_DBA | 1 | |-| APPROVAL_GROUP_PROJECT_OWNER | 2 | |+| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| log_entities | [LogEntity](#bytebase-v1-LogEntity) | repeated | The list of log entities. |+| next_page_token | [string](#string) | | A token to retrieve next page of log entities. Pass this value in the page_token field in the subsequent call to `ListLogs` method to retrieve the next page of log entities. |-<a name="bytebase-v1-ApprovalStrategy"></a>-### ApprovalStrategy-| Name | Number | Description |-| ---- | ------ | ----------- |-| APPROVAL_STRATEGY_UNSPECIFIED | 0 | |-| AUTOMATIC | 1 | |-| MANUAL | 2 | |----<a name="bytebase-v1-BackupPlanSchedule"></a>+<a name="bytebase-v1-LogEntity"></a>-### BackupPlanSchedule+### LogEntity-| Name | Number | Description |-| ---- | ------ | ----------- |-| SCHEDULE_UNSPECIFIED | 0 | |-| UNSET | 1 | |-| DAILY | 2 | |-| WEEKLY | 3 | |+| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| name | [string](#string) | | The name of the log. Format: logs/{uid} |+| creator | [string](#string) | | The creator of the log entity. Format: users/{email} |+| create_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |+| update_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |+| action | [LogEntity.Action](#bytebase-v1-LogEntity-Action) | | |+| level | [LogEntity.Level](#bytebase-v1-LogEntity-Level) | | |+| resource | [string](#string) | | The name of the resource associated with this log entity. For example, the resource user associated with log entity type of "ACTION_MEMBER_CREATE". Format: For ACTION_MEMBER_*: users/{email} For ACTION_ISSUE_*: issues/{issue uid} For ACTION_PIPELINE_*: pipelines/{pipeline uid} For ACTION_PROJECT_*: projects/{project resource id} For ACTION_DATABASE_*: instances/{instance resource id} |+| payload | [string](#string) | | The payload of the log entity. TODO: use oneof |+| comment | [string](#string) | | |-<a name="bytebase-v1-PolicyResourceType"></a>-### PolicyResourceType-| Name | Number | Description |-| ---- | ------ | ----------- |-| RESOURCE_TYPE_UNSPECIFIED | 0 | |-| WORKSPACE | 1 | |-| ENVIRONMENT | 2 | |-| PROJECT | 3 | |-| INSTANCE | 4 | |-| DATABASE | 5 | |-+-<a name="bytebase-v1-PolicyType"></a>+<a name="bytebase-v1-LogEntity-Action"></a>-### PolicyType+### LogEntity.Action| Name | Number | Description || ---- | ------ | ----------- |-| POLICY_TYPE_UNSPECIFIED | 0 | |-| DEPLOYMENT_APPROVAL | 1 | |-| BACKUP_PLAN | 2 | |-| SQL_REVIEW | 3 | |-| SENSITIVE_DATA | 4 | |-| ACCESS_CONTROL | 5 | |-| SLOW_QUERY | 6 | |--+| ACTION_UNSPECIFIED | 0 | In worksapce resource only. |+| ACTION_MEMBER_CREATE | 1 | Member related activity types. Enum value 1 - 20-<a name="bytebase-v1-SQLReviewRuleLevel"></a>+ACTION_MEMBER_CREATE is the type for creating a new member. |+| ACTION_MEMBER_ROLE_UPDATE | 2 | ACTION_MEMBER_ROLE_UPDATE is the type for updating a member's role. |+| ACTION_MEMBER_ACTIVATE | 3 | ACTION_MEMBER_ACTIVATE_UPDATE is the type for activating members. |+| ACTION_MEMBER_DEACTIVE | 4 | ACTION_MEMBER_DEACTIVE is the type for deactiving members. |+| ACTION_ISSUE_CREATE | 21 | Issue related activity types. Enum value 21 - 40-### SQLReviewRuleLevel+ACTION_ISSUE_CREATE is the type for creating a new issue. |+| ACTION_ISSUE_COMMENT_CREATE | 22 | ACTION_ISSUE_COMMENT_CREATE is the type for creating a new comment on an issue. |+| ACTION_ISSUE_FIELD_UPDATE | 23 | ACTION_ISSUE_FIELD_UPDATE is the type for updating an issue's field. |+| ACTION_ISSUE_STATUS_UPDATE | 24 | ACTION_ISSUE_STATUS_UPDATE is the type for updating an issue's status. |+| ACTION_ISSUE_APPROVAL_NOTIFY | 25 | ACTION_ISSUE_APPROVAL_NOTIFY is the type for notifying issue approval. |+| ACTION_PIPELINE_STAGE_STATUS_UPDATE | 31 | ACTION_PIPELINE_STAGE_STATUS_UPDATE represents the pipeline stage status change, including BEGIN, END for now. |+| ACTION_PIPELINE_TASK_STATUS_UPDATE | 32 | ACTION_PIPELINE_TASK_STATUS_UPDATE represents the pipeline task status change, including PENDING, PENDING_APPROVAL, RUNNING, SUCCESS, FAILURE, CANCELED for now. |+| ACTION_PIPELINE_TASK_FILE_COMMIT | 33 | ACTION_PIPELINE_TASK_FILE_COMMIT represents the VCS trigger to commit a file to update the task statement. |+| ACTION_PIPELINE_TASK_STATEMENT_UPDATE | 34 | ACTION_PIPELINE_TASK_STATEMENT_UPDATE represents the manual update of the task statement. |+| ACTION_PIPELINE_TASK_EARLIEST_ALLOWED_TIME_UPDATE | 35 | ACTION_PIPELINE_TASK_EARLIEST_ALLOWED_TIME_UPDATE represents the manual update of the task earliest allowed time. |+| ACTION_PROJECT_REPOSITORY_PUSH | 41 | Project related activity types. Enum value 41 - 60+ACTION_PROJECT_REPOSITORY_PUSH represents Bytebase receiving a push event from the project repository. |+| ACTION_PROJECT_MEMBER_CREATE | 42 | ACTION_PROJECT_MEMBER_CREATE represents adding a member to the project. |+| ACTION_PROJECT_MEMBER_DELETE | 43 | ACTION_PROJECT_MEMBER_DELETE represents removing a member from the project. |+| ACTION_PROJECT_MEMBER_ROLE_UPDATE | 44 | ACTION_PROJECT_MEMBER_ROLE_UPDATE represents updating the member role, for example, from ADMIN to MEMBER. |+| ACTION_PROJECT_DATABASE_RECOVERY_PITR_DONE | 45 | ACTION_PROJECT_DATABASE_RECOVERY_PITR_DONE is the type for database PITR recovery done. |+| ACTION_PROJECT_DATABASE_TRANSFER | 46 | ACTION_PROJECT_DATABASE_TRANSFER represents transfering the database from one project to another. |+| ACTION_DATABASE_SQL_EDITOR_QUERY | 61 | Database related activity types. Enum value 61 - 80-| Name | Number | Description |-| ---- | ------ | ----------- |-| LEVEL_UNSPECIFIED | 0 | |-| ERROR | 1 | |-| WARNING | 2 | |-| DISABLED | 3 | |+ACTION_DATABASE_SQL_EDITOR_QUERY is the type for SQL editor query. |+| ACTION_DATABASE_SQL_EXPORT | 62 | ACTION_DATABASE_SQL_EXPORT is the type for exporting SQL. |-<a name="bytebase-v1-SensitiveDataMaskType"></a>+<a name="bytebase-v1-LogEntity-Level"></a>-### SensitiveDataMaskType+### LogEntity.Level| Name | Number | Description || ---- | ------ | ----------- |-| MASK_TYPE_UNSPECIFIED | 0 | |-| DEFAULT | 1 | |+| LEVEL_UNSPECIFIED | 0 | |+| LEVEL_INFO | 1 | LEVEL_INFO is the type for information. |+| LEVEL_WARNING | 2 | LEVEL_WARNING is the type for warning. |+| LEVEL_ERROR | 3 | LEVEL_ERROR is the type for error. |@@ -4568,18 +4558,15 @@ The policy's `name` field is used to identify the instance to update. Format-<a name="bytebase-v1-OrgPolicyService"></a>+<a name="bytebase-v1-LoggingService"></a>-### OrgPolicyService+### LoggingService| Method Name | Request Type | Response Type | Description || ----------- | ------------ | ------------- | ------------|-| GetPolicy | [GetPolicyRequest](#bytebase-v1-GetPolicyRequest) | [Policy](#bytebase-v1-Policy) | |-| ListPolicies | [ListPoliciesRequest](#bytebase-v1-ListPoliciesRequest) | [ListPoliciesResponse](#bytebase-v1-ListPoliciesResponse) | |-| CreatePolicy | [CreatePolicyRequest](#bytebase-v1-CreatePolicyRequest) | [Policy](#bytebase-v1-Policy) | |-| UpdatePolicy | [UpdatePolicyRequest](#bytebase-v1-UpdatePolicyRequest) | [Policy](#bytebase-v1-Policy) | |-| DeletePolicy | [DeletePolicyRequest](#bytebase-v1-DeletePolicyRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | |+| ListLogs | [ListLogsRequest](#bytebase-v1-ListLogsRequest) | [ListLogsResponse](#bytebase-v1-ListLogsResponse) | |+| GetLog | [GetLogRequest](#bytebase-v1-GetLogRequest) | [LogEntity](#bytebase-v1-LogEntity) | |diff --git a/proto/generated-go/v1/anomaly_service.pb.go b/proto/generated-go/v1/anomaly_service.pb.goindex 9693994772..bb1ba16d6d 100644--- a/proto/generated-go/v1/anomaly_service.pb.go+++ b/proto/generated-go/v1/anomaly_service.pb.go@@ -154,63 +154,6 @@ func (Anomaly_AnomalySeverity) EnumDescriptor() ([]byte, []int) {return file_v1_anomaly_service_proto_rawDescGZIP(), []int{2, 1}}-// BackupPlanSchedule is the backup plan schedule.-type Anomaly_BackupPlanSchedule int32--const (- // Unspecified backup plan schedule.- Anomaly_BACKUP_PLAN_SCHEDULE_UNSPECIFIED Anomaly_BackupPlanSchedule = 0- // UNSET is the unset backup plan schedule.- Anomaly_UNSET Anomaly_BackupPlanSchedule = 1- // DAILY is the daily backup plan schedule.- Anomaly_DAILY Anomaly_BackupPlanSchedule = 2- // WEEKLY is the weekly backup plan schedule.- Anomaly_WEEKLY Anomaly_BackupPlanSchedule = 3-)--// Enum value maps for Anomaly_BackupPlanSchedule.-var (- Anomaly_BackupPlanSchedule_name = map[int32]string{- 0: "BACKUP_PLAN_SCHEDULE_UNSPECIFIED",- 1: "UNSET",- 2: "DAILY",- 3: "WEEKLY",- }- Anomaly_BackupPlanSchedule_value = map[string]int32{- "BACKUP_PLAN_SCHEDULE_UNSPECIFIED": 0,- "UNSET": 1,- "DAILY": 2,- "WEEKLY": 3,- }-)--func (x Anomaly_BackupPlanSchedule) Enum() *Anomaly_BackupPlanSchedule {- p := new(Anomaly_BackupPlanSchedule)- *p = x- return p-}--func (x Anomaly_BackupPlanSchedule) String() string {- return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))-}--func (Anomaly_BackupPlanSchedule) Descriptor() protoreflect.EnumDescriptor {- return file_v1_anomaly_service_proto_enumTypes[2].Descriptor()-}--func (Anomaly_BackupPlanSchedule) Type() protoreflect.EnumType {- return &file_v1_anomaly_service_proto_enumTypes[2]-}--func (x Anomaly_BackupPlanSchedule) Number() protoreflect.EnumNumber {- return protoreflect.EnumNumber(x)-}--// Deprecated: Use Anomaly_BackupPlanSchedule.Descriptor instead.-func (Anomaly_BackupPlanSchedule) EnumDescriptor() ([]byte, []int) {- return file_v1_anomaly_service_proto_rawDescGZIP(), []int{2, 2}-}-type SearchAnomaliesRequest struct {state protoimpl.MessageStatesizeCache protoimpl.SizeCache@@ -370,7 +313,9 @@ type Anomaly struct {// *Anomaly_DatabaseBackupPolicyViolationDetail_// *Anomaly_DatabaseBackupMissingDetail_// *Anomaly_DatabaseSchemaDriftDetail_- Detail isAnomaly_Detail `protobuf_oneof:"detail"`+ Detail isAnomaly_Detail `protobuf_oneof:"detail"`+ CreateTime *timestamppb.Timestamp `protobuf:"bytes,9,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"`+ UpdateTime *timestamppb.Timestamp `protobuf:"bytes,10,opt,name=update_time,json=updateTime,proto3" json:"update_time,omitempty"`}func (x *Anomaly) Reset() {@@ -468,6 +413,20 @@ func (x *Anomaly) GetDatabaseSchemaDriftDetail() *Anomaly_DatabaseSchemaDriftDetreturn nil}+func (x *Anomaly) GetCreateTime() *timestamppb.Timestamp {+ if x != nil {+ return x.CreateTime+ }+ return nil+}++func (x *Anomaly) GetUpdateTime() *timestamppb.Timestamp {+ if x != nil {+ return x.UpdateTime+ }+ return nil+}+type isAnomaly_Detail interface {isAnomaly_Detail()}@@ -614,9 +573,9 @@ type Anomaly_DatabaseBackupPolicyViolationDetail struct {// Format: environments/{environment}Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"`// expected_schedule is the expected backup plan schedule in the parent.- ExpectedSchedule Anomaly_BackupPlanSchedule `protobuf:"varint,2,opt,name=expected_schedule,json=expectedSchedule,proto3,enum=bytebase.v1.Anomaly_BackupPlanSchedule" json:"expected_schedule,omitempty"`+ ExpectedSchedule BackupPlanSchedule `protobuf:"varint,2,opt,name=expected_schedule,json=expectedSchedule,proto3,enum=bytebase.v1.BackupPlanSchedule" json:"expected_schedule,omitempty"`// actual_schedule is the actual backup plan schedule in the database.- ActualSchedule Anomaly_BackupPlanSchedule `protobuf:"varint,3,opt,name=actual_schedule,json=actualSchedule,proto3,enum=bytebase.v1.Anomaly_BackupPlanSchedule" json:"actual_schedule,omitempty"`+ ActualSchedule BackupPlanSchedule `protobuf:"varint,3,opt,name=actual_schedule,json=actualSchedule,proto3,enum=bytebase.v1.BackupPlanSchedule" json:"actual_schedule,omitempty"`}func (x *Anomaly_DatabaseBackupPolicyViolationDetail) Reset() {@@ -658,18 +617,18 @@ func (x *Anomaly_DatabaseBackupPolicyViolationDetail) GetParent() string {return ""}-func (x *Anomaly_DatabaseBackupPolicyViolationDetail) GetExpectedSchedule() Anomaly_BackupPlanSchedule {+func (x *Anomaly_DatabaseBackupPolicyViolationDetail) GetExpectedSchedule() BackupPlanSchedule {if x != nil {return x.ExpectedSchedule}- return Anomaly_BACKUP_PLAN_SCHEDULE_UNSPECIFIED+ return BackupPlanSchedule_SCHEDULE_UNSPECIFIED}-func (x *Anomaly_DatabaseBackupPolicyViolationDetail) GetActualSchedule() Anomaly_BackupPlanSchedule {+func (x *Anomaly_DatabaseBackupPolicyViolationDetail) GetActualSchedule() BackupPlanSchedule {if x != nil {return x.ActualSchedule}- return Anomaly_BACKUP_PLAN_SCHEDULE_UNSPECIFIED+ return BackupPlanSchedule_SCHEDULE_UNSPECIFIED}// DatabaseBackupMissingDetail is the detail for database backup missing anomaly.@@ -679,7 +638,7 @@ type Anomaly_DatabaseBackupMissingDetail struct {unknownFields protoimpl.UnknownFields// 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"`+ ExpectedSchedule BackupPlanSchedule `protobuf:"varint,1,opt,name=expected_schedule,json=expectedSchedule,proto3,enum=bytebase.v1.BackupPlanSchedule" json:"expected_schedule,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"`}@@ -716,11 +675,11 @@ func (*Anomaly_DatabaseBackupMissingDetail) Descriptor() ([]byte, []int) {return file_v1_anomaly_service_proto_rawDescGZIP(), []int{2, 3}}-func (x *Anomaly_DatabaseBackupMissingDetail) GetExpectedSchedule() Anomaly_BackupPlanSchedule {+func (x *Anomaly_DatabaseBackupMissingDetail) GetExpectedSchedule() BackupPlanSchedule {if x != nil {return x.ExpectedSchedule}- return Anomaly_BACKUP_PLAN_SCHEDULE_UNSPECIFIED+ return BackupPlanSchedule_SCHEDULE_UNSPECIFIED}func (x *Anomaly_DatabaseBackupMissingDetail) GetLatestBackupTime() *timestamppb.Timestamp {@@ -808,147 +767,150 @@ var file_v1_anomaly_service_proto_rawDesc = []byte{0x69, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72,0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70,0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d,- 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x6c, 0x0a, 0x16, 0x53, 0x65, 0x61, 0x72, 0x63,- 0x68, 0x41, 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,- 0x74, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28,- 0x09, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 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, 0x75, 0x0a, 0x17, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x41,- 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,- 0x12, 0x32, 0x0a, 0x09, 0x61, 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20,- 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76,- 0x31, 0x2e, 0x41, 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x79, 0x52, 0x09, 0x61, 0x6e, 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, 0xb7, 0x0e, 0x0a,- 0x07, 0x41, 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x79, 0x12, 0x1f, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f,- 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 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,- 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,+ 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 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, 0x22, 0x6c, 0x0a, 0x16, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x41, 0x6e,+ 0x6f, 0x6d, 0x61, 0x6c, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16,+ 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06,+ 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 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, 0x75, 0x0a, 0x17, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x41, 0x6e, 0x6f, 0x6d,+ 0x61, 0x6c, 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a,+ 0x09, 0x61, 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b,+ 0x32, 0x14, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41,+ 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x79, 0x52, 0x09, 0x61, 0x6e, 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, 0xc5, 0x0e, 0x0a, 0x07, 0x41, 0x6e,+ 0x6f, 0x6d, 0x61, 0x6c, 0x79, 0x12, 0x1f, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63,+ 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 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, 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,- 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, 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, 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,+ 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, 0x12, 0x40, 0x0a, 0x0b, 0x63,+ 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x09, 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, 0x8c, 0x01, 0x0a, 0x0e, 0x41, 0x6e, 0x6f, 0x6d, 0x61,- 0x6c, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x7a, 0x0a, 0x0f, 0x53, 0x65, 0x61,- 0x72, 0x63, 0x68, 0x41, 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x69, 0x65, 0x73, 0x12, 0x23, 0x2e, 0x62,+ 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x03, 0xe0, 0x41,+ 0x03, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x40, 0x0a,+ 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x0a, 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, 0x42, 0x03,+ 0xe0, 0x41, 0x03, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 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, 0xd5, 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, 0x4c, 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, 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, 0x10, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x53, 0x63, 0x68,+ 0x65, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x48, 0x0a, 0x0f, 0x61, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x5f,+ 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x18, 0x03, 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,+ 0x0e, 0x61, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x1a,+ 0xb5, 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,+ 0x4c, 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, 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, 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, 0x42, 0x08, 0x0a, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69,+ 0x6c, 0x32, 0x8c, 0x01, 0x0a, 0x0e, 0x41, 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x79, 0x53, 0x65, 0x72,+ 0x76, 0x69, 0x63, 0x65, 0x12, 0x7a, 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, 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, 0x1c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x12,- 0x14, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x69, 0x65, 0x73, 0x3a, 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,+ 0x68, 0x41, 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,+ 0x73, 0x65, 0x22, 0x1c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x12, 0x14, 0x2f, 0x76, 0x31, 0x2f,+ 0x61, 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x69, 0x65, 0x73, 0x3a, 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 (@@ -963,42 +925,44 @@ func file_v1_anomaly_service_proto_rawDescGZIP() []byte {return file_v1_anomaly_service_proto_rawDescData}-var file_v1_anomaly_service_proto_enumTypes = make([]protoimpl.EnumInfo, 3)+var file_v1_anomaly_service_proto_enumTypes = make([]protoimpl.EnumInfo, 2)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_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- (*Anomaly)(nil), // 5: bytebase.v1.Anomaly- (*Anomaly_InstanceConnectionDetail)(nil), // 6: bytebase.v1.Anomaly.InstanceConnectionDetail- (*Anomaly_DatabaseConnectionDetail)(nil), // 7: bytebase.v1.Anomaly.DatabaseConnectionDetail- (*Anomaly_DatabaseBackupPolicyViolationDetail)(nil), // 8: bytebase.v1.Anomaly.DatabaseBackupPolicyViolationDetail- (*Anomaly_DatabaseBackupMissingDetail)(nil), // 9: bytebase.v1.Anomaly.DatabaseBackupMissingDetail- (*Anomaly_DatabaseSchemaDriftDetail)(nil), // 10: bytebase.v1.Anomaly.DatabaseSchemaDriftDetail- (*timestamppb.Timestamp)(nil), // 11: google.protobuf.Timestamp+ (*SearchAnomaliesRequest)(nil), // 2: bytebase.v1.SearchAnomaliesRequest+ (*SearchAnomaliesResponse)(nil), // 3: bytebase.v1.SearchAnomaliesResponse+ (*Anomaly)(nil), // 4: bytebase.v1.Anomaly+ (*Anomaly_InstanceConnectionDetail)(nil), // 5: bytebase.v1.Anomaly.InstanceConnectionDetail+ (*Anomaly_DatabaseConnectionDetail)(nil), // 6: bytebase.v1.Anomaly.DatabaseConnectionDetail+ (*Anomaly_DatabaseBackupPolicyViolationDetail)(nil), // 7: bytebase.v1.Anomaly.DatabaseBackupPolicyViolationDetail+ (*Anomaly_DatabaseBackupMissingDetail)(nil), // 8: bytebase.v1.Anomaly.DatabaseBackupMissingDetail+ (*Anomaly_DatabaseSchemaDriftDetail)(nil), // 9: bytebase.v1.Anomaly.DatabaseSchemaDriftDetail+ (*timestamppb.Timestamp)(nil), // 10: google.protobuf.Timestamp+ (BackupPlanSchedule)(0), // 11: bytebase.v1.BackupPlanSchedule}var file_v1_anomaly_service_proto_depIdxs = []int32{- 5, // 0: bytebase.v1.SearchAnomaliesResponse.anomalies:type_name -> bytebase.v1.Anomaly+ 4, // 0: bytebase.v1.SearchAnomaliesResponse.anomalies:type_name -> bytebase.v1.Anomaly0, // 1: bytebase.v1.Anomaly.type:type_name -> bytebase.v1.Anomaly.AnomalyType1, // 2: bytebase.v1.Anomaly.severity:type_name -> bytebase.v1.Anomaly.AnomalySeverity- 6, // 3: bytebase.v1.Anomaly.instance_connection_detail:type_name -> bytebase.v1.Anomaly.InstanceConnectionDetail- 7, // 4: bytebase.v1.Anomaly.database_connection_detail:type_name -> bytebase.v1.Anomaly.DatabaseConnectionDetail- 8, // 5: bytebase.v1.Anomaly.database_backup_policy_violation_detail:type_name -> bytebase.v1.Anomaly.DatabaseBackupPolicyViolationDetail- 9, // 6: bytebase.v1.Anomaly.database_backup_missing_detail:type_name -> bytebase.v1.Anomaly.DatabaseBackupMissingDetail- 10, // 7: bytebase.v1.Anomaly.database_schema_drift_detail:type_name -> bytebase.v1.Anomaly.DatabaseSchemaDriftDetail- 2, // 8: bytebase.v1.Anomaly.DatabaseBackupPolicyViolationDetail.expected_schedule:type_name -> bytebase.v1.Anomaly.BackupPlanSchedule- 2, // 9: bytebase.v1.Anomaly.DatabaseBackupPolicyViolationDetail.actual_schedule:type_name -> bytebase.v1.Anomaly.BackupPlanSchedule- 2, // 10: bytebase.v1.Anomaly.DatabaseBackupMissingDetail.expected_schedule:type_name -> bytebase.v1.Anomaly.BackupPlanSchedule- 11, // 11: bytebase.v1.Anomaly.DatabaseBackupMissingDetail.latest_backup_time:type_name -> google.protobuf.Timestamp- 3, // 12: bytebase.v1.AnomalyService.SearchAnomalies:input_type -> bytebase.v1.SearchAnomaliesRequest- 4, // 13: bytebase.v1.AnomalyService.SearchAnomalies:output_type -> bytebase.v1.SearchAnomaliesResponse- 13, // [13:14] is the sub-list for method output_type- 12, // [12:13] is the sub-list for method input_type- 12, // [12:12] is the sub-list for extension type_name- 12, // [12:12] is the sub-list for extension extendee- 0, // [0:12] is the sub-list for field type_name+ 5, // 3: bytebase.v1.Anomaly.instance_connection_detail:type_name -> bytebase.v1.Anomaly.InstanceConnectionDetail+ 6, // 4: bytebase.v1.Anomaly.database_connection_detail:type_name -> bytebase.v1.Anomaly.DatabaseConnectionDetail+ 7, // 5: bytebase.v1.Anomaly.database_backup_policy_violation_detail:type_name -> bytebase.v1.Anomaly.DatabaseBackupPolicyViolationDetail+ 8, // 6: bytebase.v1.Anomaly.database_backup_missing_detail:type_name -> bytebase.v1.Anomaly.DatabaseBackupMissingDetail+ 9, // 7: bytebase.v1.Anomaly.database_schema_drift_detail:type_name -> bytebase.v1.Anomaly.DatabaseSchemaDriftDetail+ 10, // 8: bytebase.v1.Anomaly.create_time:type_name -> google.protobuf.Timestamp+ 10, // 9: bytebase.v1.Anomaly.update_time:type_name -> google.protobuf.Timestamp+ 11, // 10: bytebase.v1.Anomaly.DatabaseBackupPolicyViolationDetail.expected_schedule:type_name -> bytebase.v1.BackupPlanSchedule+ 11, // 11: bytebase.v1.Anomaly.DatabaseBackupPolicyViolationDetail.actual_schedule:type_name -> bytebase.v1.BackupPlanSchedule+ 11, // 12: bytebase.v1.Anomaly.DatabaseBackupMissingDetail.expected_schedule:type_name -> bytebase.v1.BackupPlanSchedule+ 10, // 13: bytebase.v1.Anomaly.DatabaseBackupMissingDetail.latest_backup_time:type_name -> google.protobuf.Timestamp+ 2, // 14: bytebase.v1.AnomalyService.SearchAnomalies:input_type -> bytebase.v1.SearchAnomaliesRequest+ 3, // 15: bytebase.v1.AnomalyService.SearchAnomalies:output_type -> bytebase.v1.SearchAnomaliesResponse+ 15, // [15:16] is the sub-list for method output_type+ 14, // [14:15] is the sub-list for method input_type+ 14, // [14:14] is the sub-list for extension type_name+ 14, // [14:14] is the sub-list for extension extendee+ 0, // [0:14] is the sub-list for field type_name}func init() { file_v1_anomaly_service_proto_init() }@@ -1006,6 +970,7 @@ func file_v1_anomaly_service_proto_init() {if File_v1_anomaly_service_proto != nil {return}+ file_v1_org_policy_service_proto_init()if !protoimpl.UnsafeEnabled {file_v1_anomaly_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {switch v := v.(*SearchAnomaliesRequest); i {@@ -1116,7 +1081,7 @@ func file_v1_anomaly_service_proto_init() {File: protoimpl.DescBuilder{GoPackagePath: reflect.TypeOf(x{}).PkgPath(),RawDescriptor: file_v1_anomaly_service_proto_rawDesc,- NumEnums: 3,+ NumEnums: 2,NumMessages: 8,NumExtensions: 0,NumServices: 1,diff --git a/proto/v1/anomaly_service.proto b/proto/v1/anomaly_service.protoindex 7d0503da95..34aa18c0d0 100644--- a/proto/v1/anomaly_service.proto+++ b/proto/v1/anomaly_service.proto@@ -5,6 +5,7 @@ package bytebase.v1;import "google/api/annotations.proto";import "google/api/field_behavior.proto";import "google/protobuf/timestamp.proto";+import "v1/org_policy_service.proto";option go_package = "generated-go/v1";@@ -112,18 +113,6 @@ message Anomaly {string detail = 1;}- // BackupPlanSchedule is the backup plan schedule.- enum BackupPlanSchedule {- // Unspecified backup plan schedule.- BACKUP_PLAN_SCHEDULE_UNSPECIFIED = 0;- // UNSET is the unset backup plan schedule.- UNSET = 1;- // DAILY is the daily backup plan schedule.- DAILY = 2;- // WEEKLY is the weekly backup plan schedule.- WEEKLY = 3;- }-// DatabaseBackupPolicyViolationDetail is the detail for database backup policy violation anomaly.message DatabaseBackupPolicyViolationDetail {// parent is the parent of the database.@@ -166,4 +155,8 @@ message Anomaly {DatabaseBackupMissingDetail database_backup_missing_detail = 7;DatabaseSchemaDriftDetail database_schema_drift_detail = 8;}++ google.protobuf.Timestamp create_time = 9 [(google.api.field_behavior) = OUTPUT_ONLY];++ google.protobuf.Timestamp update_time = 10 [(google.api.field_behavior) = OUTPUT_ONLY];}