Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: migrate activity (part1) (#6584)

ecmadaob78fe5a861ea
diff --git a/backend/api/v1/common.go b/backend/api/v1/common.go
index 0e1630d036..8429ee69bb 100644
--- a/backend/api/v1/common.go
+++ b/backend/api/v1/common.go
@@ -47,6 +47,9 @@ const (
databaseGroupNamePrefix = "databaseGroups/"
schemaGroupNamePrefix = "schemaGroups/"
changeHistoryPrefix = "changeHistories/"
+ issueNamePrefix = "issues/"
+ pipelineNamePrefix = "pipelines/"
+ logNamePrefix = "logs/"
deploymentConfigSuffix = "/deploymentConfig"
backupSettingSuffix = "/backupSetting"
@@ -110,6 +113,18 @@ func getProjectIDWebhookID(name string) (string, string, error) {
return tokens[0], tokens[1], nil
}
+func getUIDFromName(name, prefix string) (int, error) {
+ tokens, err := getNameParentTokens(name, prefix)
+ if err != nil {
+ return 0, err
+ }
+ uid, err := strconv.Atoi(tokens[0])
+ if err != nil {
+ return 0, errors.Errorf("invalid ID %q", tokens[0])
+ }
+ return uid, nil
+}
+
func trimSuffixAndGetProjectID(name string, suffix string) (string, error) {
trimmed, err := trimSuffix(name, suffix)
if err != nil {
@@ -188,15 +203,7 @@ func getInstanceDatabaseIDBackupName(name string) (string, string, string, error
}
func getUserID(name string) (int, error) {
- tokens, err := getNameParentTokens(name, userNamePrefix)
- if err != nil {
- return 0, err
- }
- userID, err := strconv.Atoi(tokens[0])
- if err != nil {
- return 0, errors.Errorf("invalid user ID %q", tokens[0])
- }
- return userID, nil
+ return getUIDFromName(name, userNamePrefix)
}
func getUserEmail(name string) (string, error) {
diff --git a/backend/api/v1/logging_service.go b/backend/api/v1/logging_service.go
new file mode 100644
index 0000000000..eef59becae
--- /dev/null
+++ b/backend/api/v1/logging_service.go
@@ -0,0 +1,481 @@
+package v1
+
+import (
+ "context"
+ "fmt"
+ "strconv"
+ "strings"
+ "time"
+
+ "google.golang.org/grpc/codes"
+ "google.golang.org/grpc/status"
+ "google.golang.org/protobuf/types/known/timestamppb"
+
+ "github.com/pkg/errors"
+
+ api "github.com/bytebase/bytebase/backend/legacyapi"
+ "github.com/bytebase/bytebase/backend/store"
+ storepb "github.com/bytebase/bytebase/proto/generated-go/store"
+ v1pb "github.com/bytebase/bytebase/proto/generated-go/v1"
+)
+
+// LoggingService implements the logging service.
+type LoggingService struct {
+ v1pb.UnimplementedLoggingServiceServer
+ store *store.Store
+}
+
+// NewLoggingService creates a new LoggingService.
+func NewLoggingService(store *store.Store) *LoggingService {
+ return &LoggingService{
+ store: store,
+ }
+}
+
+var resourceActionTypeMap = map[string][]api.ActivityType{
+ "users": {
+ api.ActivityMemberCreate,
+ api.ActivityMemberRoleUpdate,
+ api.ActivityMemberActivate,
+ api.ActivityMemberDeactivate,
+ },
+ "instances": {
+ api.ActivitySQLEditorQuery,
+ api.ActivitySQLExport,
+ },
+ "projects": {
+ api.ActivityProjectRepositoryPush,
+ api.ActivityProjectDatabaseTransfer,
+ api.ActivityProjectMemberCreate,
+ api.ActivityProjectMemberDelete,
+ api.ActivityProjectMemberRoleUpdate,
+ api.ActivityDatabaseRecoveryPITRDone,
+ },
+ "pipelines": {
+ api.ActivityPipelineStageStatusUpdate,
+ api.ActivityPipelineTaskStatusUpdate,
+ api.ActivityPipelineTaskFileCommit,
+ api.ActivityPipelineTaskStatementUpdate,
+ api.ActivityPipelineTaskEarliestAllowedTimeUpdate,
+ },
+ "issues": {
+ api.ActivityIssueCreate,
+ api.ActivityIssueCommentCreate,
+ api.ActivityIssueFieldUpdate,
+ api.ActivityIssueStatusUpdate,
+ api.ActivityIssueApprovalNotify,
+ },
+}
+
+// ListLogs lists the logs.
+func (s *LoggingService) ListLogs(ctx context.Context, request *v1pb.ListLogsRequest) (*v1pb.ListLogsResponse, error) {
+ var pageToken storepb.PageToken
+ if request.PageToken != "" {
+ if err := unmarshalPageToken(request.PageToken, &pageToken); err != nil {
+ return nil, status.Errorf(codes.InvalidArgument, "invalid page token: %v", err)
+ }
+ if pageToken.Limit != request.PageSize {
+ return nil, status.Errorf(codes.InvalidArgument, "request page size does not match the page token")
+ }
+ } else {
+ pageToken.Limit = request.PageSize
+ }
+
+ limit := int(pageToken.Limit)
+ if limit <= 0 {
+ limit = 10
+ }
+ if limit > 1000 {
+ limit = 1000
+ }
+ limitPlusOne := limit + 1
+ offset := int(pageToken.Offset)
+
+ activityFind := &store.FindActivityMessage{
+ Limit: &limitPlusOne,
+ Offset: &offset,
+ }
+
+ filters, err := parseFilter(request.Filter)
+ if err != nil {
+ return nil, status.Errorf(codes.InvalidArgument, err.Error())
+ }
+
+ if request.OrderBy != "" {
+ orderByKeys, err := parseOrderBy(request.OrderBy)
+ if err != nil {
+ return nil, status.Errorf(codes.InvalidArgument, err.Error())
+ }
+ if len(orderByKeys) != 1 || orderByKeys[0].key != "create_time" {
+ return nil, status.Errorf(codes.InvalidArgument, `invalid order_by, only support order by "create_time" for now`)
+ }
+ order := api.DESC
+ if orderByKeys[0].isAscend {
+ order = api.ASC
+ }
+ activityFind.Order = &order
+ }
+
+ for _, spec := range filters {
+ switch spec.key {
+ case "creator":
+ if spec.operator != comparatorTypeEqual {
+ return nil, status.Errorf(codes.InvalidArgument, `only support "=" operation for "creator" filter`)
+ }
+ creatorEmail := strings.TrimPrefix(spec.value, "users/")
+ if creatorEmail == "" {
+ return nil, status.Errorf(codes.InvalidArgument, "invalid empty creator identifier")
+ }
+ user, err := s.store.GetUser(ctx, &store.FindUserMessage{
+ Email: &creatorEmail,
+ })
+ if err != nil {
+ return nil, status.Errorf(codes.Internal, `failed to find user "%s" with error: %v`, creatorEmail, err.Error())
+ }
+ if user == nil {
+ return nil, errors.Errorf("cannot found user %s", creatorEmail)
+ }
+ activityFind.CreatorID = &user.ID
+ case "resource":
+ if spec.operator != comparatorTypeEqual {
+ return nil, status.Errorf(codes.InvalidArgument, `only support "=" operation for "resource" filter`)
+ }
+ sections := strings.Split(spec.value, "/")
+ if len(sections) != 2 {
+ return nil, status.Errorf(codes.InvalidArgument, `invalid resource "%s" for filter`, spec.value)
+ }
+ typeList, ok := resourceActionTypeMap[sections[0]]
+ if !ok {
+ return nil, status.Errorf(codes.InvalidArgument, `unsupport resource %s`, spec.value)
+ }
+ activityFind.TypeList = append(activityFind.TypeList, typeList...)
+ switch fmt.Sprintf("%s/", sections[0]) {
+ case userNamePrefix:
+ user, err := s.store.GetUser(ctx, &store.FindUserMessage{
+ Email: &sections[1],
+ ShowDeleted: true,
+ })
+ if err != nil {
+ return nil, status.Errorf(codes.Internal, err.Error())
+ }
+ if user == nil {
+ return nil, status.Errorf(codes.NotFound, "user %q not found", spec.value)
+ }
+ activityFind.ContainerUID = &user.ID
+ case instanceNamePrefix:
+ instance, err := s.store.GetInstanceV2(ctx, &store.FindInstanceMessage{
+ ResourceID: &sections[1],
+ ShowDeleted: true,
+ })
+ if err != nil {
+ return nil, status.Errorf(codes.Internal, err.Error())
+ }
+ if instance == nil {
+ return nil, status.Errorf(codes.NotFound, "instance %q not found", spec.value)
+ }
+ activityFind.ContainerUID = &instance.UID
+ case projectNamePrefix:
+ project, err := s.store.GetProjectV2(ctx, &store.FindProjectMessage{
+ ResourceID: &sections[1],
+ ShowDeleted: true,
+ })
+ if err != nil {
+ return nil, status.Errorf(codes.Internal, err.Error())
+ }
+ if project == nil {
+ return nil, status.Errorf(codes.NotFound, "project %q not found", spec.value)
+ }
+ activityFind.ContainerUID = &project.UID
+ case pipelineNamePrefix, issueNamePrefix:
+ uid, err := strconv.Atoi(sections[1])
+ if err != nil {
+ return nil, status.Errorf(codes.InvalidArgument, `invalid resource id "%s"`, spec.value)
+ }
+ activityFind.ContainerUID = &uid
+ default:
+ return nil, status.Errorf(codes.InvalidArgument, `resource "%s" in filter is not support`, spec.value)
+ }
+ case "level":
+ if spec.operator != comparatorTypeEqual {
+ return nil, status.Errorf(codes.InvalidArgument, `only support "=" operation for "level" filter`)
+ }
+ for _, level := range strings.Split(spec.value, " | ") {
+ activityLevel, err := convertToActivityLevel(v1pb.LogEntity_Level(v1pb.LogEntity_Level_value[level]))
+ if err != nil {
+ return nil, err
+ }
+ activityFind.LevelList = append(activityFind.LevelList, activityLevel)
+ }
+ case "action":
+ if spec.operator != comparatorTypeEqual {
+ return nil, status.Errorf(codes.InvalidArgument, `only support "=" operation for "action" filter`)
+ }
+ for _, action := range strings.Split(spec.value, " | ") {
+ activityType, err := convertToActivityType(v1pb.LogEntity_Action(v1pb.LogEntity_Action_value[action]))
+ if err != nil {
+ return nil, err
+ }
+ activityFind.TypeList = append(activityFind.TypeList, activityType)
+ }
+ case "create_time":
+ if spec.operator != comparatorTypeGreaterEqual && spec.operator != comparatorTypeLessEqual {
+ return nil, status.Errorf(codes.InvalidArgument, `only support "<=" or ">=" operation for "create_time" filter`)
+ }
+ t, err := time.Parse(time.RFC3339, spec.value)
+ if err != nil {
+ return nil, status.Errorf(codes.InvalidArgument, "invalid start_time filter %q", spec.value)
+ }
+ ts := t.Unix()
+ if spec.operator == comparatorTypeGreaterEqual {
+ activityFind.CreatedTsAfter = &ts
+ } else {
+ activityFind.CreatedTsBefore = &ts
+ }
+ default:
+ return nil, status.Errorf(codes.InvalidArgument, "invalid filter %s", spec.key)
+ }
+ }
+
+ activityList, err := s.store.ListActivityV2(ctx, activityFind)
+ if err != nil {
+ return nil, status.Errorf(codes.Internal, "failed to list activity: %v", err.Error())
+ }
+
+ nextPageToken := ""
+ if len(activityList) == limitPlusOne {
+ activityList = activityList[:limit]
+ if nextPageToken, err = marshalPageToken(&storepb.PageToken{
+ Limit: int32(limit),
+ Offset: int32(limit + offset),
+ }); err != nil {
+ return nil, status.Errorf(codes.Internal, "failed to marshal next page token, error: %v", err)
+ }
+ }
+
+ resp := &v1pb.ListLogsResponse{
+ NextPageToken: nextPageToken,
+ }
+ for _, activity := range activityList {
+ logEntity, err := s.convertToLogEntity(ctx, activity)
+ if err != nil {
+ return nil, status.Errorf(codes.Internal, "failed to convert log entity, error: %v", err)
+ }
+ resp.LogEntities = append(resp.LogEntities, logEntity)
+ }
+
+ return resp, nil
+}
+
+func (s *LoggingService) convertToLogEntity(ctx context.Context, activity *store.ActivityMessage) (*v1pb.LogEntity, error) {
+ resource := ""
+ switch activity.Type {
+ case
+ api.ActivityMemberCreate,
+ api.ActivityMemberRoleUpdate,
+ api.ActivityMemberActivate,
+ api.ActivityMemberDeactivate:
+ user, err := s.store.GetUserByID(ctx, activity.ContainerUID)
+ if err != nil {
+ return nil, err
+ }
+ if user == nil {
+ return nil, errors.Errorf("cannot found user with id %d", activity.ContainerUID)
+ }
+ resource = fmt.Sprintf("%s%s", userNamePrefix, user.Email)
+ case
+ api.ActivityIssueCreate,
+ api.ActivityIssueCommentCreate,
+ api.ActivityIssueFieldUpdate,
+ api.ActivityIssueStatusUpdate,
+ api.ActivityIssueApprovalNotify:
+ resource = fmt.Sprintf("%s%d", issueNamePrefix, activity.ContainerUID)
+ case
+ api.ActivityPipelineStageStatusUpdate,
+ api.ActivityPipelineTaskStatusUpdate,
+ api.ActivityPipelineTaskFileCommit,
+ api.ActivityPipelineTaskStatementUpdate,
+ api.ActivityPipelineTaskEarliestAllowedTimeUpdate:
+ resource = fmt.Sprintf("%s%d", pipelineNamePrefix, activity.ContainerUID)
+ case
+ api.ActivityProjectRepositoryPush,
+ api.ActivityProjectDatabaseTransfer,
+ api.ActivityProjectMemberCreate,
+ api.ActivityProjectMemberDelete,
+ api.ActivityProjectMemberRoleUpdate,
+ api.ActivityDatabaseRecoveryPITRDone:
+ project, err := s.store.GetProjectByID(ctx, activity.ContainerUID)
+ if err != nil {
+ return nil, err
+ }
+ if project == nil {
+ return nil, errors.Errorf("failed to find project by id %d", activity.ContainerUID)
+ }
+ resource = fmt.Sprintf("%s%s", projectNamePrefix, project.ResourceID)
+ case
+ api.ActivitySQLEditorQuery,
+ api.ActivitySQLExport:
+ instance, err := s.store.GetInstanceByID(ctx, activity.ContainerUID)
+ if err != nil {
+ return nil, err
+ }
+ if instance == nil {
+ return nil, errors.Errorf("failed to find instance by id %d", activity.ContainerUID)
+ }
+ resource = fmt.Sprintf("%s%s", instanceNamePrefix, instance.ResourceID)
+ }
+
+ user, err := s.store.GetUserByID(ctx, activity.CreatorID)
+ if err != nil {
+ return nil, err
+ }
+ if user == nil {
+ return nil, errors.Errorf("cannot found user with id %d", activity.ContainerUID)
+ }
+
+ return &v1pb.LogEntity{
+ Name: fmt.Sprintf("%s%d", logNamePrefix, activity.UID),
+ Creator: fmt.Sprintf("%s%s", userNamePrefix, user.Email),
+ Resource: resource,
+ Action: convertToActionType(activity.Type),
+ Level: convertToLogLevel(activity.Level),
+ CreateTime: timestamppb.New(time.Unix(activity.CreatedTs, 0)),
+ Comment: activity.Comment,
+ Payload: activity.Payload,
+ }, nil
+}
+
+func convertToActivityType(action v1pb.LogEntity_Action) (api.ActivityType, error) {
+ switch action {
+ case v1pb.LogEntity_ACTION_MEMBER_CREATE:
+ return api.ActivityMemberCreate, nil
+ case v1pb.LogEntity_ACTION_MEMBER_ROLE_UPDATE:
+ return api.ActivityMemberRoleUpdate, nil
+ case v1pb.LogEntity_ACTION_MEMBER_ACTIVATE:
+ return api.ActivityMemberActivate, nil
+ case v1pb.LogEntity_ACTION_MEMBER_DEACTIVE:
+ return api.ActivityMemberDeactivate, nil
+
+ case v1pb.LogEntity_ACTION_ISSUE_CREATE:
+ return api.ActivityIssueCreate, nil
+ case v1pb.LogEntity_ACTION_ISSUE_COMMENT_CREATE:
+ return api.ActivityIssueCommentCreate, nil
+ case v1pb.LogEntity_ACTION_ISSUE_FIELD_UPDATE:
+ return api.ActivityIssueFieldUpdate, nil
+ case v1pb.LogEntity_ACTION_ISSUE_STATUS_UPDATE:
+ return api.ActivityIssueStatusUpdate, nil
+ case v1pb.LogEntity_ACTION_ISSUE_APPROVAL_NOTIFY:
+ return api.ActivityIssueApprovalNotify, nil
+
+ case v1pb.LogEntity_ACTION_PIPELINE_STAGE_STATUS_UPDATE:
+ return api.ActivityPipelineStageStatusUpdate, nil
+ case v1pb.LogEntity_ACTION_PIPELINE_TASK_STATUS_UPDATE:
+ return api.ActivityPipelineTaskStatusUpdate, nil
+ case v1pb.LogEntity_ACTION_PIPELINE_TASK_FILE_COMMIT:
+ return api.ActivityPipelineTaskFileCommit, nil
+ case v1pb.LogEntity_ACTION_PIPELINE_TASK_STATEMENT_UPDATE:
+ return api.ActivityPipelineTaskStatementUpdate, nil
+ case v1pb.LogEntity_ACTION_PIPELINE_TASK_EARLIEST_ALLOWED_TIME_UPDATE:
+ return api.ActivityPipelineTaskEarliestAllowedTimeUpdate, nil
+
+ case v1pb.LogEntity_ACTION_PROJECT_REPOSITORY_PUSH:
+ return api.ActivityProjectRepositoryPush, nil
+ case v1pb.LogEntity_ACTION_PROJECT_DATABASE_TRANSFER:
+ return api.ActivityProjectDatabaseTransfer, nil
+ case v1pb.LogEntity_ACTION_PROJECT_MEMBER_CREATE:
+ return api.ActivityProjectMemberCreate, nil
+ case v1pb.LogEntity_ACTION_PROJECT_MEMBER_DELETE:
+ return api.ActivityProjectMemberDelete, nil
+ case v1pb.LogEntity_ACTION_PROJECT_MEMBER_ROLE_UPDATE:
+ return api.ActivityProjectMemberRoleUpdate, nil
+ case v1pb.LogEntity_ACTION_PROJECT_DATABASE_RECOVERY_PITR_DONE:
+ return api.ActivityDatabaseRecoveryPITRDone, nil
+
+ case v1pb.LogEntity_ACTION_DATABASE_SQL_EDITOR_QUERY:
+ return api.ActivitySQLEditorQuery, nil
+ case v1pb.LogEntity_ACTION_DATABASE_SQL_EXPORT:
+ return api.ActivitySQLExport, nil
+ default:
+ return api.ActivityMemberCreate, status.Errorf(codes.InvalidArgument, "unsupported action type: %v", action)
+ }
+}
+
+func convertToActionType(activityType api.ActivityType) v1pb.LogEntity_Action {
+ switch activityType {
+ case api.ActivityMemberCreate:
+ return v1pb.LogEntity_ACTION_MEMBER_CREATE
+ case api.ActivityMemberRoleUpdate:
+ return v1pb.LogEntity_ACTION_MEMBER_ROLE_UPDATE
+ case api.ActivityMemberActivate:
+ return v1pb.LogEntity_ACTION_MEMBER_ACTIVATE
+ case api.ActivityMemberDeactivate:
+ return v1pb.LogEntity_ACTION_MEMBER_DEACTIVE
+
+ case api.ActivityIssueCreate:
+ return v1pb.LogEntity_ACTION_ISSUE_CREATE
+ case api.ActivityIssueCommentCreate:
+ return v1pb.LogEntity_ACTION_ISSUE_COMMENT_CREATE
+ case api.ActivityIssueFieldUpdate:
+ return v1pb.LogEntity_ACTION_ISSUE_FIELD_UPDATE
+ case api.ActivityIssueStatusUpdate:
+ return v1pb.LogEntity_ACTION_ISSUE_STATUS_UPDATE
+ case api.ActivityIssueApprovalNotify:
+ return v1pb.LogEntity_ACTION_ISSUE_APPROVAL_NOTIFY
+
+ case api.ActivityPipelineStageStatusUpdate:
+ return v1pb.LogEntity_ACTION_PIPELINE_STAGE_STATUS_UPDATE
+ case api.ActivityPipelineTaskStatusUpdate:
+ return v1pb.LogEntity_ACTION_PIPELINE_TASK_STATUS_UPDATE
+ case api.ActivityPipelineTaskFileCommit:
+ return v1pb.LogEntity_ACTION_PIPELINE_TASK_FILE_COMMIT
+ case api.ActivityPipelineTaskStatementUpdate:
+ return v1pb.LogEntity_ACTION_PIPELINE_TASK_STATEMENT_UPDATE
+ case api.ActivityPipelineTaskEarliestAllowedTimeUpdate:
+ return v1pb.LogEntity_ACTION_PIPELINE_TASK_EARLIEST_ALLOWED_TIME_UPDATE
+
+ case api.ActivityProjectRepositoryPush:
+ return v1pb.LogEntity_ACTION_PROJECT_REPOSITORY_PUSH
+ case api.ActivityProjectDatabaseTransfer:
+ return v1pb.LogEntity_ACTION_PROJECT_DATABASE_TRANSFER
+ case api.ActivityProjectMemberCreate:
+ return v1pb.LogEntity_ACTION_PROJECT_MEMBER_CREATE
+ case api.ActivityProjectMemberDelete:
+ return v1pb.LogEntity_ACTION_PROJECT_MEMBER_DELETE
+ case api.ActivityProjectMemberRoleUpdate:
+ return v1pb.LogEntity_ACTION_PROJECT_MEMBER_ROLE_UPDATE
+ case api.ActivityDatabaseRecoveryPITRDone:
+ return v1pb.LogEntity_ACTION_PROJECT_DATABASE_RECOVERY_PITR_DONE
+
+ case api.ActivitySQLEditorQuery:
+ return v1pb.LogEntity_ACTION_DATABASE_SQL_EDITOR_QUERY
+ case api.ActivitySQLExport:
+ return v1pb.LogEntity_ACTION_DATABASE_SQL_EXPORT
+ default:
+ return v1pb.LogEntity_ACTION_UNSPECIFIED
+ }
+}
+
+func convertToActivityLevel(logLevel v1pb.LogEntity_Level) (api.ActivityLevel, error) {
+ switch logLevel {
+ case v1pb.LogEntity_LEVEL_ERROR:
+ return api.ActivityError, nil
+ case v1pb.LogEntity_LEVEL_WARNING:
+ return api.ActivityWarn, nil
+ case v1pb.LogEntity_LEVEL_INFO:
+ return api.ActivityInfo, nil
+ default:
+ return api.ActivityError, status.Errorf(codes.InvalidArgument, "unsupport log level %v", logLevel)
+ }
+}
+
+func convertToLogLevel(activityLevel api.ActivityLevel) v1pb.LogEntity_Level {
+ switch activityLevel {
+ case api.ActivityInfo:
+ return v1pb.LogEntity_LEVEL_INFO
+ case api.ActivityWarn:
+ return v1pb.LogEntity_LEVEL_WARNING
+ case api.ActivityError:
+ return v1pb.LogEntity_LEVEL_ERROR
+ default:
+ return v1pb.LogEntity_LEVEL_UNSPECIFIED
+ }
+}
diff --git a/backend/server/server.go b/backend/server/server.go
index 43761ec785..b2564a188c 100644
--- a/backend/server/server.go
+++ b/backend/server/server.go
@@ -599,6 +599,7 @@ func NewServer(ctx context.Context, profile config.Profile) (*Server, error) {
v1pb.RegisterRoleServiceServer(s.grpcServer, v1.NewRoleService(s.store, s.licenseService))
v1pb.RegisterSheetServiceServer(s.grpcServer, v1.NewSheetService(s.store))
v1pb.RegisterCelServiceServer(s.grpcServer, v1.NewCelService())
+ v1pb.RegisterLoggingServiceServer(s.grpcServer, v1.NewLoggingService(s.store))
reflection.Register(s.grpcServer)
// REST gateway proxy.
@@ -659,6 +660,9 @@ func NewServer(ctx context.Context, profile config.Profile) (*Server, error) {
if err := v1pb.RegisterRolloutServiceHandler(ctx, mux, grpcConn); err != nil {
return nil, err
}
+ if err := v1pb.RegisterLoggingServiceHandler(ctx, mux, grpcConn); err != nil {
+ return nil, err
+ }
e.Any("/v1/*", echo.WrapHandler(mux))
// GRPC web proxy.
options := []grpcweb.Option{
diff --git a/backend/store/activity.go b/backend/store/activity.go
index cee9b01313..34f8f42a56 100644
--- a/backend/store/activity.go
+++ b/backend/store/activity.go
@@ -690,3 +690,145 @@ func convertStorePBStatusToAPIApprovalEventStatus(status storepb.ActivityIssueCo
return ""
}
}
+
+// ActivityMessage is the API message for activity.
+type ActivityMessage struct {
+ UID int
+ CreatedTs int64
+
+ // Related fields
+ CreatorID int
+ // The object where this activity belongs
+ // e.g if Type is "bb.issue.xxx", then this field refers to the corresponding issue's id.
+ ContainerUID int
+
+ // Domain specific fields
+ Type api.ActivityType
+ Level api.ActivityLevel
+ Comment string
+ Payload string
+}
+
+// FindActivityMessage is the API message for listing activities.
+type FindActivityMessage struct {
+ UID *int
+ CreatorID *int
+ LevelList []api.ActivityLevel
+ TypeList []api.ActivityType
+ ContainerUID *int
+ CreatedTsAfter *int64
+ CreatedTsBefore *int64
+ Limit *int
+ Offset *int
+ // If specified, sorts the returned list by created_ts in <<ORDER>>
+ // Different use cases want different orders.
+ // e.g. Issue activity list wants ASC, while view recent activity list wants DESC.
+ Order *api.SortOrder
+}
+
+// ListActivityV2 lists the activity.
+func (s *Store) ListActivityV2(ctx context.Context, find *FindActivityMessage) ([]*ActivityMessage, error) {
+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})
+ if err != nil {
+ return nil, err
+ }
+ defer tx.Rollback()
+
+ list, err := listActivityImplV2(ctx, tx, find)
+ if err != nil {
+ return nil, err
+ }
+
+ return list, nil
+}
+
+func listActivityImplV2(ctx context.Context, tx *Tx, find *FindActivityMessage) ([]*ActivityMessage, error) {
+ // Build WHERE clause.
+ where, args := []string{"TRUE"}, []any{}
+ if v := find.UID; v != nil {
+ where, args = append(where, fmt.Sprintf("id = $%d", len(args)+1)), append(args, *v)
+ }
+ if v := find.ContainerUID; v != nil {
+ where, args = append(where, fmt.Sprintf("container_id = $%d", len(args)+1)), append(args, *v)
+ }
+ if v := find.CreatorID; v != nil {
+ where, args = append(where, fmt.Sprintf("creator_id = $%d", len(args)+1)), append(args, *v)
+ }
+ if v := find.LevelList; len(v) > 0 {
+ var queryValues []string
+ for _, level := range v {
+ queryValues, args = append(queryValues, fmt.Sprintf("level = $%d", len(args)+1)), append(args, level)
+ }
+ where = append(where, fmt.Sprintf("(%s)", strings.Join(queryValues, " OR ")))
+ }
+ if v := find.TypeList; len(v) > 0 {
+ var queryValues []string
+ for _, t := range v {
+ queryValues, args = append(queryValues, fmt.Sprintf("type = $%d", len(args)+1)), append(args, t)
+ }
+ where = append(where, fmt.Sprintf("(%s)", strings.Join(queryValues, " OR ")))
+ }
+ if v := find.CreatedTsAfter; v != nil {
+ where, args = append(where, fmt.Sprintf("created_ts >= $%d", len(args)+1)), append(args, *v)
+ }
+ if v := find.CreatedTsBefore; v != nil {
+ where, args = append(where, fmt.Sprintf("created_ts <= $%d", len(args)+1)), append(args, *v)
+ }
+
+ query := `
+ SELECT
+ id,
+ creator_id,
+ created_ts,
+ container_id,
+ type,
+ level,
+ comment,
+ payload
+ FROM activity
+ WHERE ` + strings.Join(where, " AND ")
+
+ if v := find.Order; v != nil {
+ query += fmt.Sprintf(" ORDER BY created_ts %s", *v)
+ }
+ if v := find.Limit; v != nil {
+ query += fmt.Sprintf(" LIMIT %d", *v)
+ }
+ if v := find.Offset; v != nil {
+ query += fmt.Sprintf(" OFFSET %d", *v)
+ }
+
+ rows, err := tx.QueryContext(ctx, query, args...)
+ if err != nil {
+ return nil, err
+ }
+ defer rows.Close()
+
+ // Iterate over result set and deserialize rows into activityRawList.
+ var activityList []*ActivityMessage
+ for rows.Next() {
+ var activity ActivityMessage
+ var protoPayload string
+ if err := rows.Scan(
+ &activity.UID,
+ &activity.CreatorID,
+ &activity.CreatedTs,
+ &activity.ContainerUID,
+ &activity.Type,
+ &activity.Level,
+ &activity.Comment,
+ &protoPayload,
+ ); err != nil {
+ return nil, err
+ }
+ if activity.Payload, err = convertProtoPayloadToAPIPayload(activity.Type, protoPayload); err != nil {
+ return nil, err
+ }
+ activityList = append(activityList, &activity)
+ }
+ if err := rows.Err(); err != nil {
+ return nil, err
+ }
+
+ return activityList, nil
+}
diff --git a/frontend/src/components/AuditLog/AuditLogTable.vue b/frontend/src/components/AuditLog/AuditLogTable.vue
index 2addd1f0fd..77132826d6 100644
--- a/frontend/src/components/AuditLog/AuditLogTable.vue
+++ b/frontend/src/components/AuditLog/AuditLogTable.vue
@@ -6,24 +6,22 @@
:show-header="true"
:row-clickable="false"
>
- <template #body="{ rowData: auditLog }: { rowData: AuditLog }">
+ <template #body="{ rowData: auditLog }: { rowData: LogEntity }">
<BBTableCell :left-padding="4" class="table-cell w-56">
<div>
- {{ dayjs.unix(auditLog.createdTs).format("YYYY-MM-DD HH:mm:ss Z") }}
+ {{ dayjs(auditLog.createTime).format("YYYY-MM-DD HH:mm:ss Z") }}
</div>
</BBTableCell>
<BBTableCell class="table-cell w-24">
<span
:class="`inline-flex items-center px-2 py-1 rounded-lg text-xs font-semibold whitespace-nowrap ${
- auditLevelColorMap[auditLog.level as AuditActivityLevel]
+ auditLevelColorMap[auditLog.level]
}`"
- >{{ auditLog.level }}</span
+ >{{ logEntity_LevelToJSON(auditLog.level) }}</span
>
</BBTableCell>
<BBTableCell class="table-cell w-28 whitespace-nowrap">
- {{
- t(AuditActivityTypeI18nNameMap[auditLog.type as AuditActivityType])
- }}
+ {{ t(AuditActivityTypeI18nNameMap[auditLog.action]) }}
</BBTableCell>
<BBTableCell class="table-cell w-20">
<UserByEmail :email="auditLog.creator" :plain="true" />
@@ -63,31 +61,33 @@
<script lang="ts" setup>
import { computed, PropType } from "vue";
import { useI18n } from "vue-i18n";
-import {
- AuditLog,
- AuditActivityTypeI18nNameMap,
- AuditActivityType,
- AuditActivityLevel,
-} from "@/types";
+import { AuditActivityTypeI18nNameMap } from "@/types";
import { UserByEmail } from "../v2";
+import {
+ LogEntity,
+ LogEntity_Level,
+ logEntity_LevelToJSON,
+} from "@/types/proto/v1/logging_service";
defineProps({
auditLogList: {
- type: Array as PropType<AuditLog[]>,
+ type: Array as PropType<LogEntity[]>,
required: true,
},
});
defineEmits<{
- (event: "view-detail", list: AuditLog, e: MouseEvent): void;
+ (event: "view-detail", log: LogEntity, e: MouseEvent): void;
}>();
const { t } = useI18n();
-const auditLevelColorMap: Record<AuditActivityLevel, string> = {
- [AuditActivityLevel.INFO]: "bg-gray-100 text-gray-800",
- [AuditActivityLevel.WARN]: "bg-yellow-100 text-yellow-800",
- [AuditActivityLevel.ERROR]: "bg-red-100 text-red-800",
+const auditLevelColorMap: Record<LogEntity_Level, string> = {
+ [LogEntity_Level.LEVEL_UNSPECIFIED]: "bg-gray-100 text-gray-800",
+ [LogEntity_Level.UNRECOGNIZED]: "bg-gray-100 text-gray-800",
+ [LogEntity_Level.LEVEL_INFO]: "bg-gray-100 text-gray-800",
+ [LogEntity_Level.LEVEL_WARNING]: "bg-yellow-100 text-yellow-800",
+ [LogEntity_Level.LEVEL_ERROR]: "bg-red-100 text-red-800",
};
const columnList = computed(() => [
diff --git a/frontend/src/components/AuditLog/PagedAuditLogTable.vue b/frontend/src/components/AuditLog/PagedAuditLogTable.vue
index b4f27aef96..f71ffffa6a 100644
--- a/frontend/src/components/AuditLog/PagedAuditLogTable.vue
+++ b/frontend/src/components/AuditLog/PagedAuditLogTable.vue
@@ -27,14 +27,15 @@
<script lang="ts" setup>
import { computed, PropType, reactive, watch } from "vue";
-import { useIsLoggedIn, useAuditLogStore } from "@/store";
-import { ActivityFind, AuditLog } from "@/types";
+import { useIsLoggedIn, useActivityV1Store } from "@/store";
+import { FindActivityMessage } from "@/types";
import { useSessionStorage } from "@vueuse/core";
import { stringify } from "qs";
+import { LogEntity } from "@/types/proto/v1/logging_service";
type LocalState = {
loading: boolean;
- auditLogList: AuditLog[];
+ auditLogList: LogEntity[];
paginationToken: string;
hasMore: boolean;
};
@@ -63,10 +64,9 @@ const props = defineProps({
required: true,
},
activityFind: {
- type: Object as PropType<ActivityFind>,
+ type: Object as PropType<FindActivityMessage>,
default: () => ({
- typePrefix: "",
- order: "DESC",
+ order: "desc",
}),
},
pageSize: {
@@ -94,7 +94,7 @@ const sessionState = useSessionStorage<SessionState>(
}
);
-const auditLogStore = useAuditLogStore();
+const activityV1Store = useActivityV1Store();
const isLoggedIn = useIsLoggedIn();
const limit = computed(() => {
@@ -112,7 +112,7 @@ const condition = computed(() => {
});
});
-const fetchData = (refresh = false) => {
+const fetchData = async (refresh = false) => {
state.loading = true;
const isFirstFetch = state.paginationToken === "";
@@ -122,32 +122,33 @@ const fetchData = (refresh = false) => {
: // Always load one page if NOT the first fetch
limit.value;
- auditLogStore
- .fetchPagedAuditLogList({
- ...props.activityFind,
- limit: expectedRowCount,
- token: state.paginationToken,
- })
- .then(({ nextToken, auditLogList }) => {
- if (refresh) {
- state.auditLogList = auditLogList;
- } else {
- state.auditLogList.push(...auditLogList);
- }
-
- if (auditLogList.length < expectedRowCount) {
- state.hasMore = false;
- } else if (!isFirstFetch) {
- // If we didn't reach the end, memorize we've clicked the "load more" button.
- sessionState.value.page++;
- }
-
- sessionState.value.updatedTs = Date.now();
- state.paginationToken = nextToken;
- })
- .finally(() => {
- state.loading = false;
- });
+ try {
+ const { nextPageToken, logEntities } =
+ await activityV1Store.fetchActivityList({
+ ...props.activityFind,
+ pageSize: expectedRowCount,
+ pageToken: state.paginationToken,
+ });
+ if (refresh) {
+ state.auditLogList = logEntities;
+ } else {
+ state.auditLogList.push(...logEntities);
+ }
+
+ if (logEntities.length < expectedRowCount) {
+ state.hasMore = false;
+ } else if (!isFirstFetch) {
+ // If we didn't reach the end, memorize we've clicked the "load more" button.
+ sessionState.value.page++;
+ }
+
+ sessionState.value.updatedTs = Date.now();
+ state.paginationToken = nextPageToken;
+ } catch (e) {
+ console.error(e);
+ } finally {
+ state.loading = false;
+ }
};
const resetSession = () => {
diff --git a/frontend/src/components/AuditLog/TypeSelect.vue b/frontend/src/components/AuditLog/TypeSelect.vue
index 6e40271c3a..374b0d9ae1 100644
--- a/frontend/src/components/AuditLog/TypeSelect.vue
+++ b/frontend/src/components/AuditLog/TypeSelect.vue
@@ -4,14 +4,14 @@
:selected-item-list="selectedTypeList"
:item-list="typeList"
:placeholder="$t('audit-log.table.select-type')"
- @update-item-list="(list: AuditActivityType[]) => $emit('update-selected-type-list', list)"
+ @update-item-list="(list: LogEntity_Action[]) => $emit('update-selected-type-list', list)"
>
<template #menuItem="{ item }">
{{ $t(getLabel(item)) }}
</template>
<template #menuItemGroup="{ itemList }">
<ResponsiveTags
- :tags="itemList.map((item: AuditActivityType) => $t(getLabel(item)))"
+ :tags="itemList.map((item: LogEntity_Action) => $t(getLabel(item)))"
/>
</template>
</BBSelect>
@@ -19,17 +19,18 @@
<script lang="ts" setup>
import { PropType } from "vue";
-import { AuditActivityType, AuditActivityTypeI18nNameMap } from "@/types";
+import { AuditActivityTypeI18nNameMap } from "@/types";
+import { LogEntity_Action } from "@/types/proto/v1/logging_service";
defineProps({
selectedTypeList: {
- type: Array as PropType<AuditActivityType[]>,
+ type: Array as PropType<LogEntity_Action[]>,
required: true,
},
});
defineEmits(["update-selected-type-list"]);
const typeList = Object.keys(AuditActivityTypeI18nNameMap);
-const getLabel = (type: AuditActivityType): string =>
+const getLabel = (type: LogEntity_Action): string =>
AuditActivityTypeI18nNameMap[type];
</script>
diff --git a/frontend/src/components/v2/Model/User/UserByEmail.vue b/frontend/src/components/v2/Model/User/UserByEmail.vue
index 849eb5c2ad..0efc694087 100644
--- a/frontend/src/components/v2/Model/User/UserByEmail.vue
+++ b/frontend/src/components/v2/Model/User/UserByEmail.vue
@@ -11,6 +11,7 @@
<script setup lang="ts">
import { computed } from "vue";
import { useUserStore } from "@/store";
+import { getUserEmailFromIdentifier } from "@/store/modules/v1/common";
import { extractUserUID } from "@/utils";
const props = withDefaults(
@@ -30,7 +31,7 @@ const props = withDefaults(
const store = useUserStore();
const user = computed(() => {
- return store.getUserByEmail(props.email);
+ return store.getUserByEmail(getUserEmailFromIdentifier(props.email));
});
const bindings = computed(() => {
diff --git a/frontend/src/grpcweb/index.ts b/frontend/src/grpcweb/index.ts
index 7d26aa157c..46e863f841 100644
--- a/frontend/src/grpcweb/index.ts
+++ b/frontend/src/grpcweb/index.ts
@@ -25,6 +25,7 @@ import { CelServiceDefinition } from "@/types/proto/v1/cel_service";
import { SubscriptionServiceDefinition } from "@/types/proto/v1/subscription_service";
import { ActuatorServiceDefinition } from "@/types/proto/v1/actuator_service";
import { ExternalVersionControlServiceDefinition } from "@/types/proto/v1/externalvs_service";
+import { LoggingServiceDefinition } from "@/types/proto/v1/logging_service";
// Create each grpc service client.
// Reference: https://github.com/deeplay-io/nice-grpc/blob/master/packages/nice-grpc-web/README.md
@@ -142,6 +143,11 @@ export const externalVersionControlServiceClient = clientFactory.create(
channel
);
+export const loggingServiceClient = clientFactory.create(
+ LoggingServiceDefinition,
+ channel
+);
+
// e.g. How to use `authServiceClient`?
//
// await authServiceClient.login({
diff --git a/frontend/src/store/modules/auditLog.ts b/frontend/src/store/modules/auditLog.ts
deleted file mode 100644
index 54aa8571c6..0000000000
--- a/frontend/src/store/modules/auditLog.ts
+++ /dev/null
@@ -1,82 +0,0 @@
-import { defineStore } from "pinia";
-import axios from "axios";
-import { stringify } from "qs";
-import type {
- AuditLogState,
- ResourceObject,
- ResourceIdentifier,
- ActivityFind,
-} from "@/types";
-import { empty, isPagedResponse } from "@/types";
-import type { AuditLog } from "@/types/auditLog";
-import { getPrincipalFromIncludedList } from "./principal";
-import { convertEntityList } from "./utils";
-
-const convert = (
- auditLog: ResourceObject,
- includedList: ResourceObject[]
-): AuditLog => {
- return {
- ...(auditLog.attributes as Omit<AuditLog, "creator">),
- creator: getPrincipalFromIncludedList(
- auditLog.relationships!.creator.data,
- includedList
- )?.email as string,
- };
-};
-
-function getAuditLogFromIncludedList(
- data:
- | ResourceIdentifier<ResourceObject>
- | ResourceIdentifier<ResourceObject>[]
- | undefined,
- includedList: ResourceObject[]
-): AuditLog {
- if (data == null) {
- return empty("AUDIT_LOG");
- }
- for (const item of includedList || []) {
- if (item.type !== "activity") {
- continue;
- }
- if (item.id == (data as ResourceIdentifier).id) {
- return convert(item, includedList);
- }
- }
- return empty("AUDIT_LOG");
-}
-
-export const useAuditLogStore = defineStore("auditLog", {
- state: (): AuditLogState => ({
- auditLogList: [],
- }),
- actions: {
- setAuditLogList(auditLogList: AuditLog[]) {
- this.auditLogList = auditLogList;
- },
- async fetchPagedAuditLogList(params: ActivityFind) {
- const url = `/api/activity?${stringify(params, {
- arrayFormat: "repeat",
- })}`;
- const responseData = (await axios.get(url)).data;
- const auditLogList = convertEntityList(
- responseData,
- "activityList",
- convert,
- getAuditLogFromIncludedList
- );
- const nextToken = isPagedResponse(responseData, "activityList")
- ? responseData.data.attributes.nextToken
- : "";
- return {
- nextToken,
- auditLogList,
- };
- },
- async fetchAuditLogList(params: ActivityFind) {
- const res = await this.fetchPagedAuditLogList(params);
- this.setAuditLogList(res.auditLogList);
- return res.auditLogList;
- },
- },
-});
diff --git a/frontend/src/store/modules/index.ts b/frontend/src/store/modules/index.ts
index b1ff2affef..c97800f3cf 100644
--- a/frontend/src/store/modules/index.ts
+++ b/frontend/src/store/modules/index.ts
@@ -1,6 +1,5 @@
export * from "./activity";
export * from "./anomaly";
-export * from "./auditLog";
export * from "./auth";
export * from "./bookmark";
export * from "./command";
diff --git a/frontend/src/store/modules/v1/activity.ts b/frontend/src/store/modules/v1/activity.ts
new file mode 100644
index 0000000000..1c9ff040ee
--- /dev/null
+++ b/frontend/src/store/modules/v1/activity.ts
@@ -0,0 +1,65 @@
+import { defineStore } from "pinia";
+import dayjs from "dayjs";
+import utc from "dayjs/plugin/utc";
+
+import { loggingServiceClient } from "@/grpcweb";
+import { FindActivityMessage } from "@/types";
+import { userNamePrefix } from "./common";
+import {
+ logEntity_ActionToJSON,
+ logEntity_LevelToJSON,
+} from "@/types/proto/v1/logging_service";
+
+dayjs.extend(utc);
+
+export const useActivityV1Store = defineStore("activity_v1", () => {
+ const fetchActivityList = async (find: FindActivityMessage) => {
+ const resp = await loggingServiceClient.listLogs({
+ orderBy: find.order ? `create_time ${find.order}` : "",
+ filter: buildFilter(find),
+ pageSize: find.pageSize,
+ pageToken: find.pageToken,
+ });
+
+ return resp;
+ };
+
+ const buildFilter = (find: FindActivityMessage): string => {
+ const filter: string[] = [];
+ if (find.resource) {
+ filter.push(`resource = "${find.resource}"`);
+ }
+ if (find.creatorEmail) {
+ filter.push(`creator = "${userNamePrefix}${find.creatorEmail}"`);
+ }
+ if (find.level) {
+ filter.push(
+ `level = "${find.level
+ .map((l) => logEntity_LevelToJSON(l))
+ .join(" | ")}"`
+ );
+ }
+ if (find.action) {
+ filter.push(
+ `action = "${find.action
+ .map((a) => logEntity_ActionToJSON(a))
+ .join(" | ")}"`
+ );
+ }
+ if (find.createdTsAfter) {
+ filter.push(
+ `create_time >= "${dayjs(find.createdTsAfter).utc().format()}"`
+ );
+ }
+ if (find.createdTsBefore) {
+ filter.push(
+ `create_time <= "${dayjs(find.createdTsBefore).utc().format()}"`
+ );
+ }
+ return filter.join(" && ");
+ };
+
+ return {
+ fetchActivityList,
+ };
+});
diff --git a/frontend/src/store/modules/v1/index.ts b/frontend/src/store/modules/v1/index.ts
index 863f623ae9..18b2b95b59 100644
--- a/frontend/src/store/modules/v1/index.ts
+++ b/frontend/src/store/modules/v1/index.ts
@@ -17,3 +17,4 @@ export * from "./repository";
export * from "./vcs";
export * from "./changeHistory";
export * from "./dbSchema";
+export * from "./activity";
diff --git a/frontend/src/types/activity.ts b/frontend/src/types/activity.ts
index c60ac9062b..6817e53d3c 100644
--- a/frontend/src/types/activity.ts
+++ b/frontend/src/types/activity.ts
@@ -19,6 +19,10 @@ import { VCSPushEvent } from "./vcs";
import { Advice } from "./sqlAdvice";
import { t } from "../plugins/i18n";
import { ApprovalEvent } from "./review";
+import {
+ LogEntity_Action,
+ LogEntity_Level,
+} from "@/types/proto/v1/logging_service";
export type IssueActivityType =
| "bb.issue.create"
@@ -281,3 +285,15 @@ export type ActivityFind = {
createdTsAfter?: number;
createdTsBefore?: number;
};
+
+export interface FindActivityMessage {
+ resource?: string;
+ creatorEmail?: string;
+ level?: LogEntity_Level[];
+ action?: LogEntity_Action[];
+ createdTsAfter?: number;
+ createdTsBefore?: number;
+ order?: "acs" | "desc";
+ pageSize?: number;
+ pageToken?: string;
+}
diff --git a/frontend/src/types/auditLog.ts b/frontend/src/types/auditLog.ts
index af1e2b2085..2a03493ee3 100644
--- a/frontend/src/types/auditLog.ts
+++ b/frontend/src/types/auditLog.ts
@@ -1,50 +1,35 @@
-export enum AuditActivityType {
+import { LogEntity_Action } from "@/types/proto/v1/logging_service";
+
+export const AuditActivityTypeList = [
// Workspace level.
//
// Member related
- WorkspaceMemberCreate = "bb.member.create",
- WorkspaceMemberRoleUpdate = "bb.member.role.update",
- WorkspaceMemberActivate = "bb.member.activate",
- WorkspaceMemberDeactivate = "bb.member.deactivate",
-
+ LogEntity_Action.ACTION_MEMBER_CREATE,
+ LogEntity_Action.ACTION_MEMBER_ROLE_UPDATE,
+ LogEntity_Action.ACTION_MEMBER_ACTIVATE,
+ LogEntity_Action.ACTION_MEMBER_DEACTIVE,
// Project level.
//
// Project related
- DatabaseTransfer = "bb.project.database.transfer",
- ProjectMemberRoleUpdate = "bb.project.member.role.update",
-
+ LogEntity_Action.ACTION_PROJECT_DATABASE_TRANSFER,
+ LogEntity_Action.ACTION_PROJECT_MEMBER_ROLE_UPDATE,
// SQL Editor related.
- SQLEditorQuery = "bb.sql-editor.query",
-}
+ LogEntity_Action.ACTION_DATABASE_SQL_EDITOR_QUERY,
+];
-export enum AuditActivityLevel {
- INFO = "INFO",
- WARN = "WARN",
- ERROR = "ERROR",
-}
-
-// Mapping from an activity type to a human readable string.
-export const AuditActivityTypeI18nNameMap: Record<AuditActivityType, string> = {
- [AuditActivityType.WorkspaceMemberCreate]:
+export const AuditActivityTypeI18nNameMap: { [key: number]: string } = {
+ [LogEntity_Action.ACTION_MEMBER_CREATE]:
"audit-log.type.workspace.member-create",
- [AuditActivityType.WorkspaceMemberRoleUpdate]:
+ [LogEntity_Action.ACTION_MEMBER_ROLE_UPDATE]:
"audit-log.type.workspace.member-role-update",
- [AuditActivityType.WorkspaceMemberActivate]:
+ [LogEntity_Action.ACTION_MEMBER_ACTIVATE]:
"audit-log.type.workspace.member-activate",
- [AuditActivityType.WorkspaceMemberDeactivate]:
+ [LogEntity_Action.ACTION_MEMBER_DEACTIVE]:
"audit-log.type.workspace.member-deactivate",
- [AuditActivityType.DatabaseTransfer]:
+ [LogEntity_Action.ACTION_PROJECT_DATABASE_TRANSFER]:
"audit-log.type.project.database-transfer",
- [AuditActivityType.ProjectMemberRoleUpdate]:
+ [LogEntity_Action.ACTION_PROJECT_MEMBER_ROLE_UPDATE]:
"audit-log.type.project.member-role-update",
- [AuditActivityType.SQLEditorQuery]: "audit-log.type.sql-editor-query",
-};
-
-export type AuditLog = {
- createdTs: number;
- creator: string;
- type: AuditActivityType;
- level: AuditActivityLevel;
- comment: string;
- payload: unknown;
+ [LogEntity_Action.ACTION_DATABASE_SQL_EDITOR_QUERY]:
+ "audit-log.type.sql-editor-query",
};
diff --git a/frontend/src/types/common.ts b/frontend/src/types/common.ts
index 17b8dd8efd..465ecf656d 100644
--- a/frontend/src/types/common.ts
+++ b/frontend/src/types/common.ts
@@ -15,7 +15,6 @@ import { Principal } from "./principal";
import { Project, ProjectMember } from "./project";
import { VCS } from "./vcs";
import { SQLReviewPolicy } from "./sqlReview";
-import { AuditLog, AuditActivityType, AuditActivityLevel } from "./auditLog";
import { BackupPlanSchedule } from "@/types/proto/v1/org_policy_service";
// System bot id
@@ -125,7 +124,6 @@ interface ResourceMaker {
(type: "VCS"): VCS;
(type: "ANOMALY"): Anomaly;
(type: "SQL_REVIEW"): SQLReviewPolicy;
- (type: "AUDIT_LOG"): AuditLog;
}
const makeUnknown = (type: ResourceType) => {
@@ -618,15 +616,6 @@ const makeEmpty = (type: ResourceType) => {
},
};
- const EMPTY_AUDIT_LOG: AuditLog = {
- createdTs: 0,
- creator: EMPTY_PRINCIPAL.email,
- type: AuditActivityType.WorkspaceMemberCreate,
- level: AuditActivityLevel.INFO,
- comment: "",
- payload: "",
- };
-
switch (type) {
case "PRINCIPAL":
return EMPTY_PRINCIPAL;
@@ -664,8 +653,6 @@ const makeEmpty = (type: ResourceType) => {
return EMPTY_VCS;
case "ANOMALY":
return EMPTY_ANOMALY;
- case "AUDIT_LOG":
- return EMPTY_AUDIT_LOG;
}
};
diff --git a/frontend/src/types/proto/v1/logging_service.ts b/frontend/src/types/proto/v1/logging_service.ts
index 972b7b25a9..86595b2c41 100644
--- a/frontend/src/types/proto/v1/logging_service.ts
+++ b/frontend/src/types/proto/v1/logging_service.ts
@@ -1,31 +1,39 @@
/* eslint-disable */
import type { CallContext, CallOptions } from "nice-grpc-common";
import * as _m0 from "protobufjs/minimal";
-import { Struct } from "../google/protobuf/struct";
import { Timestamp } from "../google/protobuf/timestamp";
export const protobufPackage = "bytebase.v1";
export interface ListLogsRequest {
- /**
- * The parent resource name.
- * Format:
- * projects/{project}
- * workspaces/{workspace}
- */
- parent: 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
- * - container
- * - level
- * - action
+ * - 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", container="issue/123"'
+ * List the logs of type 'ACTION_ISSUE_COMMENT_CREATE' in issue/123: 'action="ACTION_ISSUE_COMMENT_CREATE", resource="issue/123"'
*/
filter: string;
+ /**
+ * The order by of the log.
+ * Only support order by create_time.
+ * For example:
+ * - order_by = "create_time acs"
+ * - order_by = "create_time desc"
+ */
+ orderBy: string;
/**
* Not used. The maximum number of logs to return.
* The service may return fewer than this value.
@@ -41,46 +49,55 @@ export interface ListLogsRequest {
}
export interface ListLogsResponse {
- /** The list of log entries. */
- logEntries: LogEntry[];
+ /** The list of log entities. */
+ logEntities: LogEntity[];
/**
- * A token to retrieve next page of log entries.
+ * 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 entries.
+ * to retrieve the next page of log entities.
*/
nextPageToken: string;
}
-export interface LogEntry {
+export interface LogEntity {
+ /**
+ * The name of the log.
+ * Format: logs/{uid}
+ */
+ name: string;
/**
- * The creator of the log entry.
- * Format: users/{emailid}
+ * The creator of the log entity.
+ * Format: users/{email}
*/
creator: string;
/** The timestamp when the backup resource was created initally. */
createTime?: Date;
- /** The timestamp when the backup resource was updated. */
- updateTime?: Date;
- action: LogEntry_Action;
- level: LogEntry_Level;
+ action: LogEntity_Action;
+ level: LogEntity_Level;
/**
- * The name of the resource associated with this log entry. For example, the resource user associated with log entry type of "ACTION_MEMBER_CREATE".
+ * 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}
- * For ACTION_PIPELINE_*: pipelines/{pipeline}
- * For ACTION_PROJECT_*: projects/{project}
- * For ACTION_SQL_EDITOR_QUERY: workspaces/{workspace} OR projects/{project}
+ * 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}
+ */
+ resource: string;
+ /**
+ * The payload of the log entity.
+ * TODO: use oneof
*/
- resourceName: string;
- /** The payload of the log entry. */
- jsonPayload?: { [key: string]: any };
+ payload: string;
+ comment: string;
}
-export enum LogEntry_Action {
+export enum LogEntity_Action {
+ /** ACTION_UNSPECIFIED - In worksapce resource only. */
ACTION_UNSPECIFIED = 0,
/**
- * ACTION_MEMBER_CREATE - In worksapce resource only.
+ * ACTION_MEMBER_CREATE - Member related activity types.
+ * Enum value 1 - 20
*
* ACTION_MEMBER_CREATE is the type for creating a new member.
*/
@@ -92,173 +109,192 @@ export enum LogEntry_Action {
/** ACTION_MEMBER_DEACTIVE - ACTION_MEMBER_DEACTIVE is the type for deactiving members. */
ACTION_MEMBER_DEACTIVE = 4,
/**
- * ACTION_ISSUE_CREATE - In project resource only.
+ * ACTION_ISSUE_CREATE - Issue related activity types.
+ * Enum value 21 - 40
*
* ACTION_ISSUE_CREATE is the type for creating a new issue.
*/
- ACTION_ISSUE_CREATE = 5,
+ ACTION_ISSUE_CREATE = 21,
/** ACTION_ISSUE_COMMENT_CREATE - ACTION_ISSUE_COMMENT_CREATE is the type for creating a new comment on an issue. */
- ACTION_ISSUE_COMMENT_CREATE = 6,
+ ACTION_ISSUE_COMMENT_CREATE = 22,
/** ACTION_ISSUE_FIELD_UPDATE - ACTION_ISSUE_FIELD_UPDATE is the type for updating an issue's field. */
- ACTION_ISSUE_FIELD_UPDATE = 7,
+ ACTION_ISSUE_FIELD_UPDATE = 23,
/** ACTION_ISSUE_STATUS_UPDATE - ACTION_ISSUE_STATUS_UPDATE is the type for updating an issue's status. */
- ACTION_ISSUE_STATUS_UPDATE = 8,
- /** ACTION_PIPELINE_STAGE_STATUS_UPDATE - ACTION_PIPELINE_STAGE_STATUS_UPDATE is the type for stage begins or ends. */
- ACTION_PIPELINE_STAGE_STATUS_UPDATE = 9,
- /** ACTION_PIPELINE_TASK_STATUS_UPDATE - ACTION_PIPELINE_TASK_STATUS_UPDATE is the type for updating pipeline task status. */
- ACTION_PIPELINE_TASK_STATUS_UPDATE = 10,
- /** ACTION_PIPELINE_TASK_FILE_COMMIT - ACTION_PIPELINE_TASK_FILE_COMMIT is the type for committing pipeline task files. */
- ACTION_PIPELINE_TASK_FILE_COMMIT = 11,
- /** ACTION_PIPELINE_TASK_STATEMENT_UPDATE - ACTION_PIPELINE_TASK_STATEMENT_UPDATE is the type for updating pipeline task SQL statement. */
- ACTION_PIPELINE_TASK_STATEMENT_UPDATE = 12,
- /** ACITON_PIPELINE_TASK_EARLIEST_ALLOWED_DATE_UPDATE - ACTION_PIPELINE_TASK_EARLIEST_ALLOWED_DATE_UPDATE is the type for updating pipeline task the earliest allowed time. */
- ACITON_PIPELINE_TASK_EARLIEST_ALLOWED_DATE_UPDATE = 13,
- /** ACTION_PROJECT_MEMBER_CREATE - ACTION_PROJECT_MEMBER_CREATE is the type for creating a new project member. */
- ACTION_PROJECT_MEMBER_CREATE = 14,
- /** ACTION_PROJECT_MEMBER_ROLE_UPDATE - ACTION_PROJECT_MEMBER_ROLE_UPDATE is the type for updating a project member's role. */
- ACTION_PROJECT_MEMBER_ROLE_UPDATE = 15,
- /** ACTION_PROJECT_MEMBER_DELETE - ACTION_PROJECT_MEMBER_DELETE is the type for deleting a project member. */
- ACTION_PROJECT_MEMBER_DELETE = 16,
- /** ACTION_PROJECT_REPOSITORY_PUSH - ACTION_PROJECT_REPOSITORY_PUSH is the type for pushing to a project repository. */
- ACTION_PROJECT_REPOSITORY_PUSH = 17,
- /** ACTION_PROJECT_DTABASE_TRANSFER - ACTION_PROJECT_DATABASE_TRANSFER is the type for transferring a database to a project. */
- ACTION_PROJECT_DTABASE_TRANSFER = 18,
+ ACTION_ISSUE_STATUS_UPDATE = 24,
+ /** ACTION_ISSUE_APPROVAL_NOTIFY - ACTION_ISSUE_APPROVAL_NOTIFY is the type for notifying issue approval. */
+ ACTION_ISSUE_APPROVAL_NOTIFY = 25,
+ /** ACTION_PIPELINE_STAGE_STATUS_UPDATE - ACTION_PIPELINE_STAGE_STATUS_UPDATE represents the pipeline stage status change, including BEGIN, END for now. */
+ ACTION_PIPELINE_STAGE_STATUS_UPDATE = 31,
+ /** ACTION_PIPELINE_TASK_STATUS_UPDATE - ACTION_PIPELINE_TASK_STATUS_UPDATE represents the pipeline task status change, including PENDING, PENDING_APPROVAL, RUNNING, SUCCESS, FAILURE, CANCELED for now. */
+ ACTION_PIPELINE_TASK_STATUS_UPDATE = 32,
+ /** ACTION_PIPELINE_TASK_FILE_COMMIT - ACTION_PIPELINE_TASK_FILE_COMMIT represents the VCS trigger to commit a file to update the task statement. */
+ ACTION_PIPELINE_TASK_FILE_COMMIT = 33,
+ /** ACTION_PIPELINE_TASK_STATEMENT_UPDATE - ACTION_PIPELINE_TASK_STATEMENT_UPDATE represents the manual update of the task statement. */
+ ACTION_PIPELINE_TASK_STATEMENT_UPDATE = 34,
+ /** ACTION_PIPELINE_TASK_EARLIEST_ALLOWED_TIME_UPDATE - ACTION_PIPELINE_TASK_EARLIEST_ALLOWED_TIME_UPDATE represents the manual update of the task earliest allowed time. */
+ ACTION_PIPELINE_TASK_EARLIEST_ALLOWED_TIME_UPDATE = 35,
+ /**
+ * ACTION_PROJECT_REPOSITORY_PUSH - Project related activity types.
+ * Enum value 41 - 60
+ *
+ * ACTION_PROJECT_REPOSITORY_PUSH represents Bytebase receiving a push event from the project repository.
+ */
+ ACTION_PROJECT_REPOSITORY_PUSH = 41,
+ /** ACTION_PROJECT_MEMBER_CREATE - ACTION_PROJECT_MEMBER_CREATE represents adding a member to the project. */
+ ACTION_PROJECT_MEMBER_CREATE = 42,
+ /** ACTION_PROJECT_MEMBER_DELETE - ACTION_PROJECT_MEMBER_DELETE represents removing a member from the project. */
+ ACTION_PROJECT_MEMBER_DELETE = 43,
+ /** ACTION_PROJECT_MEMBER_ROLE_UPDATE - ACTION_PROJECT_MEMBER_ROLE_UPDATE represents updating the member role, for example, from ADMIN to MEMBER. */
+ ACTION_PROJECT_MEMBER_ROLE_UPDATE = 44,
/** ACTION_PROJECT_DATABASE_RECOVERY_PITR_DONE - ACTION_PROJECT_DATABASE_RECOVERY_PITR_DONE is the type for database PITR recovery done. */
- ACTION_PROJECT_DATABASE_RECOVERY_PITR_DONE = 19,
+ ACTION_PROJECT_DATABASE_RECOVERY_PITR_DONE = 45,
+ /** ACTION_PROJECT_DATABASE_TRANSFER - ACTION_PROJECT_DATABASE_TRANSFER represents transfering the database from one project to another. */
+ ACTION_PROJECT_DATABASE_TRANSFER = 46,
/**
- * ACTION_SQL_EDITOR_QUERY - Both in workspace and project resource.
+ * ACTION_DATABASE_SQL_EDITOR_QUERY - Database related activity types.
+ * Enum value 61 - 80
*
- * ACTION_SQL_EDITOR_QUERY is the type for SQL editor query.
- * If user runs SQL in Read-only mode, this action will belong to project resource.
- * If user runs SQL in Read-write mode, this action will belong to workspace resource.
+ * ACTION_DATABASE_SQL_EDITOR_QUERY is the type for SQL editor query.
*/
- ACTION_SQL_EDITOR_QUERY = 20,
+ ACTION_DATABASE_SQL_EDITOR_QUERY = 61,
+ /** ACTION_DATABASE_SQL_EXPORT - ACTION_DATABASE_SQL_EXPORT is the type for exporting SQL. */
+ ACTION_DATABASE_SQL_EXPORT = 62,
UNRECOGNIZED = -1,
}
-export function logEntry_ActionFromJSON(object: any): LogEntry_Action {
+export function logEntity_ActionFromJSON(object: any): LogEntity_Action {
switch (object) {
case 0:
case "ACTION_UNSPECIFIED":
- return LogEntry_Action.ACTION_UNSPECIFIED;
+ return LogEntity_Action.ACTION_UNSPECIFIED;
case 1:
case "ACTION_MEMBER_CREATE":
- return LogEntry_Action.ACTION_MEMBER_CREATE;
+ return LogEntity_Action.ACTION_MEMBER_CREATE;
case 2:
case "ACTION_MEMBER_ROLE_UPDATE":
- return LogEntry_Action.ACTION_MEMBER_ROLE_UPDATE;
+ return LogEntity_Action.ACTION_MEMBER_ROLE_UPDATE;
case 3:
case "ACTION_MEMBER_ACTIVATE":
- return LogEntry_Action.ACTION_MEMBER_ACTIVATE;
+ return LogEntity_Action.ACTION_MEMBER_ACTIVATE;
case 4:
case "ACTION_MEMBER_DEACTIVE":
- return LogEntry_Action.ACTION_MEMBER_DEACTIVE;
- case 5:
+ return LogEntity_Action.ACTION_MEMBER_DEACTIVE;
+ case 21:
case "ACTION_ISSUE_CREATE":
- return LogEntry_Action.ACTION_ISSUE_CREATE;
- case 6:
+ return LogEntity_Action.ACTION_ISSUE_CREATE;
+ case 22:
case "ACTION_ISSUE_COMMENT_CREATE":
- return LogEntry_Action.ACTION_ISSUE_COMMENT_CREATE;
- case 7:
+ return LogEntity_Action.ACTION_ISSUE_COMMENT_CREATE;
+ case 23:
case "ACTION_ISSUE_FIELD_UPDATE":
- return LogEntry_Action.ACTION_ISSUE_FIELD_UPDATE;
- case 8:
+ return LogEntity_Action.ACTION_ISSUE_FIELD_UPDATE;
+ case 24:
case "ACTION_ISSUE_STATUS_UPDATE":
- return LogEntry_Action.ACTION_ISSUE_STATUS_UPDATE;
- case 9:
+ return LogEntity_Action.ACTION_ISSUE_STATUS_UPDATE;
+ case 25:
+ case "ACTION_ISSUE_APPROVAL_NOTIFY":
+ return LogEntity_Action.ACTION_ISSUE_APPROVAL_NOTIFY;
+ case 31:
case "ACTION_PIPELINE_STAGE_STATUS_UPDATE":
- return LogEntry_Action.ACTION_PIPELINE_STAGE_STATUS_UPDATE;
- case 10:
+ return LogEntity_Action.ACTION_PIPELINE_STAGE_STATUS_UPDATE;
+ case 32:
case "ACTION_PIPELINE_TASK_STATUS_UPDATE":
- return LogEntry_Action.ACTION_PIPELINE_TASK_STATUS_UPDATE;
- case 11:
+ return LogEntity_Action.ACTION_PIPELINE_TASK_STATUS_UPDATE;
+ case 33:
case "ACTION_PIPELINE_TASK_FILE_COMMIT":
- return LogEntry_Action.ACTION_PIPELINE_TASK_FILE_COMMIT;
- case 12:
+ return LogEntity_Action.ACTION_PIPELINE_TASK_FILE_COMMIT;
+ case 34:
case "ACTION_PIPELINE_TASK_STATEMENT_UPDATE":
- return LogEntry_Action.ACTION_PIPELINE_TASK_STATEMENT_UPDATE;
- case 13:
- case "ACITON_PIPELINE_TASK_EARLIEST_ALLOWED_DATE_UPDATE":
- return LogEntry_Action.ACITON_PIPELINE_TASK_EARLIEST_ALLOWED_DATE_UPDATE;
- case 14:
+ return LogEntity_Action.ACTION_PIPELINE_TASK_STATEMENT_UPDATE;
+ case 35:
+ case "ACTION_PIPELINE_TASK_EARLIEST_ALLOWED_TIME_UPDATE":
+ return LogEntity_Action.ACTION_PIPELINE_TASK_EARLIEST_ALLOWED_TIME_UPDATE;
+ case 41:
+ case "ACTION_PROJECT_REPOSITORY_PUSH":
+ return LogEntity_Action.ACTION_PROJECT_REPOSITORY_PUSH;
+ case 42:
case "ACTION_PROJECT_MEMBER_CREATE":
- return LogEntry_Action.ACTION_PROJECT_MEMBER_CREATE;
- case 15:
- case "ACTION_PROJECT_MEMBER_ROLE_UPDATE":
- return LogEntry_Action.ACTION_PROJECT_MEMBER_ROLE_UPDATE;
- case 16:
+ return LogEntity_Action.ACTION_PROJECT_MEMBER_CREATE;
+ case 43:
case "ACTION_PROJECT_MEMBER_DELETE":
- return LogEntry_Action.ACTION_PROJECT_MEMBER_DELETE;
- case 17:
- case "ACTION_PROJECT_REPOSITORY_PUSH":
- return LogEntry_Action.ACTION_PROJECT_REPOSITORY_PUSH;
- case 18:
- case "ACTION_PROJECT_DTABASE_TRANSFER":
- return LogEntry_Action.ACTION_PROJECT_DTABASE_TRANSFER;
- case 19:
+ return LogEntity_Action.ACTION_PROJECT_MEMBER_DELETE;
+ case 44:
+ case "ACTION_PROJECT_MEMBER_ROLE_UPDATE":
+ return LogEntity_Action.ACTION_PROJECT_MEMBER_ROLE_UPDATE;
+ case 45:
case "ACTION_PROJECT_DATABASE_RECOVERY_PITR_DONE":
- return LogEntry_Action.ACTION_PROJECT_DATABASE_RECOVERY_PITR_DONE;
- case 20:
- case "ACTION_SQL_EDITOR_QUERY":
- return LogEntry_Action.ACTION_SQL_EDITOR_QUERY;
+ return LogEntity_Action.ACTION_PROJECT_DATABASE_RECOVERY_PITR_DONE;
+ case 46:
+ case "ACTION_PROJECT_DATABASE_TRANSFER":
+ return LogEntity_Action.ACTION_PROJECT_DATABASE_TRANSFER;
+ case 61:
+ case "ACTION_DATABASE_SQL_EDITOR_QUERY":
+ return LogEntity_Action.ACTION_DATABASE_SQL_EDITOR_QUERY;
+ case 62:
+ case "ACTION_DATABASE_SQL_EXPORT":
+ return LogEntity_Action.ACTION_DATABASE_SQL_EXPORT;
case -1:
case "UNRECOGNIZED":
default:
- return LogEntry_Action.UNRECOGNIZED;
+ return LogEntity_Action.UNRECOGNIZED;
}
}
-export function logEntry_ActionToJSON(object: LogEntry_Action): string {
+export function logEntity_ActionToJSON(object: LogEntity_Action): string {
switch (object) {
- case LogEntry_Action.ACTION_UNSPECIFIED:
+ case LogEntity_Action.ACTION_UNSPECIFIED:
return "ACTION_UNSPECIFIED";
- case LogEntry_Action.ACTION_MEMBER_CREATE:
+ case LogEntity_Action.ACTION_MEMBER_CREATE:
return "ACTION_MEMBER_CREATE";
- case LogEntry_Action.ACTION_MEMBER_ROLE_UPDATE:
+ case LogEntity_Action.ACTION_MEMBER_ROLE_UPDATE:
return "ACTION_MEMBER_ROLE_UPDATE";
- case LogEntry_Action.ACTION_MEMBER_ACTIVATE:
+ case LogEntity_Action.ACTION_MEMBER_ACTIVATE:
return "ACTION_MEMBER_ACTIVATE";
- case LogEntry_Action.ACTION_MEMBER_DEACTIVE:
+ case LogEntity_Action.ACTION_MEMBER_DEACTIVE:
return "ACTION_MEMBER_DEACTIVE";
- case LogEntry_Action.ACTION_ISSUE_CREATE:
+ case LogEntity_Action.ACTION_ISSUE_CREATE:
return "ACTION_ISSUE_CREATE";
- case LogEntry_Action.ACTION_ISSUE_COMMENT_CREATE:
+ case LogEntity_Action.ACTION_ISSUE_COMMENT_CREATE:
return "ACTION_ISSUE_COMMENT_CREATE";
- case LogEntry_Action.ACTION_ISSUE_FIELD_UPDATE:
+ case LogEntity_Action.ACTION_ISSUE_FIELD_UPDATE:
return "ACTION_ISSUE_FIELD_UPDATE";
- case LogEntry_Action.ACTION_ISSUE_STATUS_UPDATE:
+ case LogEntity_Action.ACTION_ISSUE_STATUS_UPDATE:
return "ACTION_ISSUE_STATUS_UPDATE";
- case LogEntry_Action.ACTION_PIPELINE_STAGE_STATUS_UPDATE:
+ case LogEntity_Action.ACTION_ISSUE_APPROVAL_NOTIFY:
+ return "ACTION_ISSUE_APPROVAL_NOTIFY";
+ case LogEntity_Action.ACTION_PIPELINE_STAGE_STATUS_UPDATE:
return "ACTION_PIPELINE_STAGE_STATUS_UPDATE";
- case LogEntry_Action.ACTION_PIPELINE_TASK_STATUS_UPDATE:
+ case LogEntity_Action.ACTION_PIPELINE_TASK_STATUS_UPDATE:
return "ACTION_PIPELINE_TASK_STATUS_UPDATE";
- case LogEntry_Action.ACTION_PIPELINE_TASK_FILE_COMMIT:
+ case LogEntity_Action.ACTION_PIPELINE_TASK_FILE_COMMIT:
return "ACTION_PIPELINE_TASK_FILE_COMMIT";
- case LogEntry_Action.ACTION_PIPELINE_TASK_STATEMENT_UPDATE:
+ case LogEntity_Action.ACTION_PIPELINE_TASK_STATEMENT_UPDATE:
return "ACTION_PIPELINE_TASK_STATEMENT_UPDATE";
- case LogEntry_Action.ACITON_PIPELINE_TASK_EARLIEST_ALLOWED_DATE_UPDATE:
- return "ACITON_PIPELINE_TASK_EARLIEST_ALLOWED_DATE_UPDATE";
- case LogEntry_Action.ACTION_PROJECT_MEMBER_CREATE:
+ case LogEntity_Action.ACTION_PIPELINE_TASK_EARLIEST_ALLOWED_TIME_UPDATE:
+ return "ACTION_PIPELINE_TASK_EARLIEST_ALLOWED_TIME_UPDATE";
+ case LogEntity_Action.ACTION_PROJECT_REPOSITORY_PUSH:
+ return "ACTION_PROJECT_REPOSITORY_PUSH";
+ case LogEntity_Action.ACTION_PROJECT_MEMBER_CREATE:
return "ACTION_PROJECT_MEMBER_CREATE";
- case LogEntry_Action.ACTION_PROJECT_MEMBER_ROLE_UPDATE:
- return "ACTION_PROJECT_MEMBER_ROLE_UPDATE";
- case LogEntry_Action.ACTION_PROJECT_MEMBER_DELETE:
+ case LogEntity_Action.ACTION_PROJECT_MEMBER_DELETE:
return "ACTION_PROJECT_MEMBER_DELETE";
- case LogEntry_Action.ACTION_PROJECT_REPOSITORY_PUSH:
- return "ACTION_PROJECT_REPOSITORY_PUSH";
- case LogEntry_Action.ACTION_PROJECT_DTABASE_TRANSFER:
- return "ACTION_PROJECT_DTABASE_TRANSFER";
- case LogEntry_Action.ACTION_PROJECT_DATABASE_RECOVERY_PITR_DONE:
+ case LogEntity_Action.ACTION_PROJECT_MEMBER_ROLE_UPDATE:
+ return "ACTION_PROJECT_MEMBER_ROLE_UPDATE";
+ case LogEntity_Action.ACTION_PROJECT_DATABASE_RECOVERY_PITR_DONE:
return "ACTION_PROJECT_DATABASE_RECOVERY_PITR_DONE";
- case LogEntry_Action.ACTION_SQL_EDITOR_QUERY:
- return "ACTION_SQL_EDITOR_QUERY";
- case LogEntry_Action.UNRECOGNIZED:
+ case LogEntity_Action.ACTION_PROJECT_DATABASE_TRANSFER:
+ return "ACTION_PROJECT_DATABASE_TRANSFER";
+ case LogEntity_Action.ACTION_DATABASE_SQL_EDITOR_QUERY:
+ return "ACTION_DATABASE_SQL_EDITOR_QUERY";
+ case LogEntity_Action.ACTION_DATABASE_SQL_EXPORT:
+ return "ACTION_DATABASE_SQL_EXPORT";
+ case LogEntity_Action.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
-export enum LogEntry_Level {
+export enum LogEntity_Level {
LEVEL_UNSPECIFIED = 0,
/** LEVEL_INFO - LEVEL_INFO is the type for information. */
LEVEL_INFO = 1,
@@ -269,54 +305,54 @@ export enum LogEntry_Level {
UNRECOGNIZED = -1,
}
-export function logEntry_LevelFromJSON(object: any): LogEntry_Level {
+export function logEntity_LevelFromJSON(object: any): LogEntity_Level {
switch (object) {
case 0:
case "LEVEL_UNSPECIFIED":
- return LogEntry_Level.LEVEL_UNSPECIFIED;
+ return LogEntity_Level.LEVEL_UNSPECIFIED;
case 1:
case "LEVEL_INFO":
- return LogEntry_Level.LEVEL_INFO;
+ return LogEntity_Level.LEVEL_INFO;
case 2:
case "LEVEL_WARNING":
- return LogEntry_Level.LEVEL_WARNING;
+ return LogEntity_Level.LEVEL_WARNING;
case 3:
case "LEVEL_ERROR":
- return LogEntry_Level.LEVEL_ERROR;
+ return LogEntity_Level.LEVEL_ERROR;
case -1:
case "UNRECOGNIZED":
default:
- return LogEntry_Level.UNRECOGNIZED;
+ return LogEntity_Level.UNRECOGNIZED;
}
}
-export function logEntry_LevelToJSON(object: LogEntry_Level): string {
+export function logEntity_LevelToJSON(object: LogEntity_Level): string {
switch (object) {
- case LogEntry_Level.LEVEL_UNSPECIFIED:
+ case LogEntity_Level.LEVEL_UNSPECIFIED:
return "LEVEL_UNSPECIFIED";
- case LogEntry_Level.LEVEL_INFO:
+ case LogEntity_Level.LEVEL_INFO:
return "LEVEL_INFO";
- case LogEntry_Level.LEVEL_WARNING:
+ case LogEntity_Level.LEVEL_WARNING:
return "LEVEL_WARNING";
- case LogEntry_Level.LEVEL_ERROR:
+ case LogEntity_Level.LEVEL_ERROR:
return "LEVEL_ERROR";
- case LogEntry_Level.UNRECOGNIZED:
+ case LogEntity_Level.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
function createBaseListLogsRequest(): ListLogsRequest {
- return { parent: "", filter: "", pageSize: 0, pageToken: "" };
+ return { filter: "", orderBy: "", pageSize: 0, pageToken: "" };
}
export const ListLogsRequest = {
encode(message: ListLogsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
- if (message.parent !== "") {
- writer.uint32(10).string(message.parent);
- }
if (message.filter !== "") {
- writer.uint32(18).string(message.filter);
+ writer.uint32(10).string(message.filter);
+ }
+ if (message.orderBy !== "") {
+ writer.uint32(18).string(message.orderBy);
}
if (message.pageSize !== 0) {
writer.uint32(24).int32(message.pageSize);
@@ -339,14 +375,14 @@ export const ListLogsRequest = {
break;
}
- message.parent = reader.string();
+ message.filter = reader.string();
continue;
case 2:
if (tag !== 18) {
break;
}
- message.filter = reader.string();
+ message.orderBy = reader.string();
continue;
case 3:
if (tag !== 24) {
@@ -373,8 +409,8 @@ export const ListLogsRequest = {
fromJSON(object: any): ListLogsRequest {
return {
- parent: isSet(object.parent) ? String(object.parent) : "",
filter: isSet(object.filter) ? String(object.filter) : "",
+ orderBy: isSet(object.orderBy) ? String(object.orderBy) : "",
pageSize: isSet(object.pageSize) ? Number(object.pageSize) : 0,
pageToken: isSet(object.pageToken) ? String(object.pageToken) : "",
};
@@ -382,8 +418,8 @@ export const ListLogsRequest = {
toJSON(message: ListLogsRequest): unknown {
const obj: any = {};
- message.parent !== undefined && (obj.parent = message.parent);
message.filter !== undefined && (obj.filter = message.filter);
+ message.orderBy !== undefined && (obj.orderBy = message.orderBy);
message.pageSize !== undefined && (obj.pageSize = Math.round(message.pageSize));
message.pageToken !== undefined && (obj.pageToken = message.pageToken);
return obj;
@@ -395,8 +431,8 @@ export const ListLogsRequest = {
fromPartial(object: DeepPartial<ListLogsRequest>): ListLogsRequest {
const message = createBaseListLogsRequest();
- message.parent = object.parent ?? "";
message.filter = object.filter ?? "";
+ message.orderBy = object.orderBy ?? "";
message.pageSize = object.pageSize ?? 0;
message.pageToken = object.pageToken ?? "";
return message;
@@ -404,13 +440,13 @@ export const ListLogsRequest = {
};
function createBaseListLogsResponse(): ListLogsResponse {
- return { logEntries: [], nextPageToken: "" };
+ return { logEntities: [], nextPageToken: "" };
}
export const ListLogsResponse = {
encode(message: ListLogsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
- for (const v of message.logEntries) {
- LogEntry.encode(v!, writer.uint32(10).fork()).ldelim();
+ for (const v of message.logEntities) {
+ LogEntity.encode(v!, writer.uint32(10).fork()).ldelim();
}
if (message.nextPageToken !== "") {
writer.uint32(18).string(message.nextPageToken);
@@ -430,7 +466,7 @@ export const ListLogsResponse = {
break;
}
- message.logEntries.push(LogEntry.decode(reader, reader.uint32()));
+ message.logEntities.push(LogEntity.decode(reader, reader.uint32()));
continue;
case 2:
if (tag !== 18) {
@@ -450,17 +486,17 @@ export const ListLogsResponse = {
fromJSON(object: any): ListLogsResponse {
return {
- logEntries: Array.isArray(object?.logEntries) ? object.logEntries.map((e: any) => LogEntry.fromJSON(e)) : [],
+ logEntities: Array.isArray(object?.logEntities) ? object.logEntities.map((e: any) => LogEntity.fromJSON(e)) : [],
nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "",
};
},
toJSON(message: ListLogsResponse): unknown {
const obj: any = {};
- if (message.logEntries) {
- obj.logEntries = message.logEntries.map((e) => e ? LogEntry.toJSON(e) : undefined);
+ if (message.logEntities) {
+ obj.logEntities = message.logEntities.map((e) => e ? LogEntity.toJSON(e) : undefined);
} else {
- obj.logEntries = [];
+ obj.logEntities = [];
}
message.nextPageToken !== undefined && (obj.nextPageToken = message.nextPageToken);
return obj;
@@ -472,34 +508,26 @@ export const ListLogsResponse = {
fromPartial(object: DeepPartial<ListLogsResponse>): ListLogsResponse {
const message = createBaseListLogsResponse();
- message.logEntries = object.logEntries?.map((e) => LogEntry.fromPartial(e)) || [];
+ message.logEntities = object.logEntities?.map((e) => LogEntity.fromPartial(e)) || [];
message.nextPageToken = object.nextPageToken ?? "";
return message;
},
};
-function createBaseLogEntry(): LogEntry {
- return {
- creator: "",
- createTime: undefined,
- updateTime: undefined,
- action: 0,
- level: 0,
- resourceName: "",
- jsonPayload: undefined,
- };
+function createBaseLogEntity(): LogEntity {
+ return { name: "", creator: "", createTime: undefined, action: 0, level: 0, resource: "", payload: "", comment: "" };
}
-export const LogEntry = {
- encode(message: LogEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+export const LogEntity = {
+ encode(message: LogEntity, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.name !== "") {
+ writer.uint32(10).string(message.name);
+ }
if (message.creator !== "") {
- writer.uint32(10).string(message.creator);
+ writer.uint32(18).string(message.creator);
}
if (message.createTime !== undefined) {
- Timestamp.encode(toTimestamp(message.createTime), writer.uint32(18).fork()).ldelim();
- }
- if (message.updateTime !== undefined) {
- Timestamp.encode(toTimestamp(message.updateTime), writer.uint32(26).fork()).ldelim();
+ Timestamp.encode(toTimestamp(message.createTime), writer.uint32(26).fork()).ldelim();
}
if (message.action !== 0) {
writer.uint32(32).int32(message.action);
@@ -507,19 +535,22 @@ export const LogEntry = {
if (message.level !== 0) {
writer.uint32(40).int32(message.level);
}
- if (message.resourceName !== "") {
- writer.uint32(50).string(message.resourceName);
+ if (message.resource !== "") {
+ writer.uint32(50).string(message.resource);
}
- if (message.jsonPayload !== undefined) {
- Struct.encode(Struct.wrap(message.jsonPayload), writer.uint32(58).fork()).ldelim();
+ if (message.payload !== "") {
+ writer.uint32(58).string(message.payload);
+ }
+ if (message.comment !== "") {
+ writer.uint32(66).string(message.comment);
}
return writer;
},
- decode(input: _m0.Reader | Uint8Array, length?: number): LogEntry {
+ decode(input: _m0.Reader | Uint8Array, length?: number): LogEntity {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseLogEntry();
+ const message = createBaseLogEntity();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -528,21 +559,21 @@ export const LogEntry = {
break;
}
- message.creator = reader.string();
+ message.name = reader.string();
continue;
case 2:
if (tag !== 18) {
break;
}
- message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.creator = reader.string();
continue;
case 3:
if (tag !== 26) {
break;
}
- message.updateTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
continue;
case 4:
if (tag !== 32) {
@@ -563,14 +594,21 @@ export const LogEntry = {
break;
}
- message.resourceName = reader.string();
+ message.resource = reader.string();
continue;
case 7:
if (tag !== 58) {
break;
}
- message.jsonPayload = Struct.unwrap(Struct.decode(reader, reader.uint32()));
+ message.payload = reader.string();
+ continue;
+ case 8:
+ if (tag !== 66) {
+ break;
+ }
+
+ message.comment = reader.string();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
@@ -581,43 +619,46 @@ export const LogEntry = {
return message;
},
- fromJSON(object: any): LogEntry {
+ fromJSON(object: any): LogEntity {
return {
+ name: isSet(object.name) ? String(object.name) : "",
creator: isSet(object.creator) ? String(object.creator) : "",
createTime: isSet(object.createTime) ? fromJsonTimestamp(object.createTime) : undefined,
- updateTime: isSet(object.updateTime) ? fromJsonTimestamp(object.updateTime) : undefined,
- action: isSet(object.action) ? logEntry_ActionFromJSON(object.action) : 0,
- level: isSet(object.level) ? logEntry_LevelFromJSON(object.level) : 0,
- resourceName: isSet(object.resourceName) ? String(object.resourceName) : "",
- jsonPayload: isObject(object.jsonPayload) ? object.jsonPayload : undefined,
+ action: isSet(object.action) ? logEntity_ActionFromJSON(object.action) : 0,
+ level: isSet(object.level) ? logEntity_LevelFromJSON(object.level) : 0,
+ resource: isSet(object.resource) ? String(object.resource) : "",
+ payload: isSet(object.payload) ? String(object.payload) : "",
+ comment: isSet(object.comment) ? String(object.comment) : "",
};
},
- toJSON(message: LogEntry): unknown {
+ toJSON(message: LogEntity): unknown {
const obj: any = {};
+ message.name !== undefined && (obj.name = message.name);
message.creator !== undefined && (obj.creator = message.creator);
message.createTime !== undefined && (obj.createTime = message.createTime.toISOString());
- message.updateTime !== undefined && (obj.updateTime = message.updateTime.toISOString());
- message.action !== undefined && (obj.action = logEntry_ActionToJSON(message.action));
- message.level !== undefined && (obj.level = logEntry_LevelToJSON(message.level));
- message.resourceName !== undefined && (obj.resourceName = message.resourceName);
- message.jsonPayload !== undefined && (obj.jsonPayload = message.jsonPayload);
+ message.action !== undefined && (obj.action = logEntity_ActionToJSON(message.action));
+ message.level !== undefined && (obj.level = logEntity_LevelToJSON(message.level));
+ message.resource !== undefined && (obj.resource = message.resource);
+ message.payload !== undefined && (obj.payload = message.payload);
+ message.comment !== undefined && (obj.comment = message.comment);
return obj;
},
- create(base?: DeepPartial<LogEntry>): LogEntry {
- return LogEntry.fromPartial(base ?? {});
+ create(base?: DeepPartial<LogEntity>): LogEntity {
+ return LogEntity.fromPartial(base ?? {});
},
- fromPartial(object: DeepPartial<LogEntry>): LogEntry {
- const message = createBaseLogEntry();
+ fromPartial(object: DeepPartial<LogEntity>): LogEntity {
+ const message = createBaseLogEntity();
+ message.name = object.name ?? "";
message.creator = object.creator ?? "";
message.createTime = object.createTime ?? undefined;
- message.updateTime = object.updateTime ?? undefined;
message.action = object.action ?? 0;
message.level = object.level ?? 0;
- message.resourceName = object.resourceName ?? "";
- message.jsonPayload = object.jsonPayload ?? undefined;
+ message.resource = object.resource ?? "";
+ message.payload = object.payload ?? "";
+ message.comment = object.comment ?? "";
return message;
},
};
@@ -635,75 +676,8 @@ export const LoggingServiceDefinition = {
responseStream: false,
options: {
_unknownFields: {
- 8410: [new Uint8Array([6, 112, 97, 114, 101, 110, 116])],
578365826: [
- new Uint8Array([
- 64,
- 90,
- 32,
- 34,
- 30,
- 47,
- 118,
- 49,
- 47,
- 123,
- 112,
- 97,
- 114,
- 101,
- 110,
- 116,
- 61,
- 119,
- 111,
- 114,
- 107,
- 115,
- 112,
- 97,
- 99,
- 101,
- 115,
- 47,
- 42,
- 125,
- 47,
- 108,
- 111,
- 103,
- 115,
- 34,
- 28,
- 47,
- 118,
- 49,
- 47,
- 123,
- 112,
- 97,
- 114,
- 101,
- 110,
- 116,
- 61,
- 112,
- 114,
- 111,
- 106,
- 101,
- 99,
- 116,
- 115,
- 47,
- 42,
- 125,
- 47,
- 108,
- 111,
- 103,
- 115,
- ]),
+ new Uint8Array([17, 18, 15, 47, 118, 49, 47, 108, 111, 103, 115, 58, 115, 101, 97, 114, 99, 104]),
],
},
},
@@ -748,10 +722,6 @@ function fromJsonTimestamp(o: any): Date {
}
}
-function isObject(value: any): boolean {
- return typeof value === "object" && value !== null;
-}
-
function isSet(value: any): boolean {
return value !== null && value !== undefined;
}
diff --git a/frontend/src/views/SettingWorkspaceAuditLog.vue b/frontend/src/views/SettingWorkspaceAuditLog.vue
index 93ffebf602..db6d697fdc 100644
--- a/frontend/src/views/SettingWorkspaceAuditLog.vue
+++ b/frontend/src/views/SettingWorkspaceAuditLog.vue
@@ -36,12 +36,12 @@
<PagedAuditLogTable
v-if="hasAuditLogFeature"
:activity-find="{
- typePrefix:
+ action:
selectedAuditTypeList.length > 0
? selectedAuditTypeList
- : typePrefixList,
- user: parseInt(selectedUserUID, 10) > 0 ? selectedUserUID : undefined,
- order: 'DESC',
+ : AuditActivityTypeList,
+ creatorEmail: selectedUserEmail,
+ order: 'desc',
createdTsAfter: selectedTimeRange ? selectedTimeRange[0] : undefined,
createdTsBefore: selectedTimeRange ? selectedTimeRange[1] : undefined,
}"
@@ -82,13 +82,7 @@
</NGi>
<NGi span="17">
<span v-if="value !== ''">
- {{
- (key as string).includes("Ts")
- ? dayjs
- .unix(value as number)
- .format("YYYY-MM-DD HH:mm:ss Z")
- : value
- }}
+ {{ value }}
</span>
<span v-else class="italic text-gray-500">
{{ $t("audit-log.table.empty") }}
@@ -106,10 +100,20 @@
import { reactive, ref, computed } from "vue";
import { useRoute, useRouter } from "vue-router";
import { NGrid, NGi, NDatePicker } from "naive-ui";
+import dayjs from "dayjs";
import { useI18n } from "vue-i18n";
import { BBDialog } from "@/bbkit";
-import { AuditActivityType, UNKNOWN_ID } from "@/types";
-import { featureToRef } from "@/store";
+import {
+ AuditActivityTypeList,
+ UNKNOWN_ID,
+ AuditActivityTypeI18nNameMap,
+} from "@/types";
+import { featureToRef, useUserStore } from "@/store";
+import {
+ LogEntity,
+ LogEntity_Action,
+ logEntity_LevelToJSON,
+} from "@/types/proto/v1/logging_service";
const dialog = ref<InstanceType<typeof BBDialog> | null>(null);
const state = reactive({
@@ -120,22 +124,19 @@ const state = reactive({
const { t } = useI18n();
const router = useRouter();
const route = useRoute();
+const userStore = useUserStore();
const hasAuditLogFeature = featureToRef("bb.feature.audit-log");
const logKeyMap = {
createdTs: t("audit-log.table.created-time"),
level: t("audit-log.table.level"),
- type: t("audit-log.table.type"),
+ action: t("audit-log.table.type"),
creator: t("audit-log.table.actor"),
comment: t("audit-log.table.comment"),
payload: t("audit-log.table.payload"),
};
-const typePrefixList = (
- Object.keys(AuditActivityType) as Array<keyof typeof AuditActivityType>
-).map((key) => AuditActivityType[key]);
-
const selectedUserUID = computed((): string => {
const id = route.query.user as string;
if (id) {
@@ -144,13 +145,19 @@ const selectedUserUID = computed((): string => {
return String(UNKNOWN_ID);
});
-const selectedAuditTypeList = computed((): AuditActivityType[] => {
+const selectedUserEmail = computed((): string => {
+ const id = route.query.user as string;
+ const selected = userStore.getUserById(id);
+ return selected?.email ?? "";
+});
+
+const selectedAuditTypeList = computed((): LogEntity_Action[] => {
const typeList = route.query.type as string;
if (typeList) {
if (typeList.includes(",")) {
- return typeList.split(",") as AuditActivityType[];
+ return typeList.split(",").map((n) => Number(n) as LogEntity_Action);
} else {
- return [typeList as AuditActivityType];
+ return [Number(typeList) as LogEntity_Action];
}
}
return [];
@@ -169,10 +176,31 @@ const selectedTimeRange = computed((): [number, number] => {
return defaultTimeRange;
});
-const handleViewDetail = (log: any) => {
+const handleViewDetail = (log: LogEntity) => {
// Display detail fields in the same order as logKeyMap.
state.modalContent = Object.fromEntries(
- Object.keys(logKeyMap).map((logKey) => [logKey, log[logKey]])
+ Object.keys(logKeyMap)
+ .map((logKey) => {
+ switch (logKey) {
+ case "createdTs":
+ return [
+ logKey,
+ dayjs(log.createTime).format("YYYY-MM-DD HH:mm:ss Z"),
+ ];
+ case "level":
+ return [logKey, logEntity_LevelToJSON(log.level)];
+ case "action":
+ return [logKey, t(AuditActivityTypeI18nNameMap[log.action])];
+ case "creator":
+ return [logKey, log.creator];
+ case "comment":
+ return [logKey, log.comment];
+ case "payload":
+ return [logKey, log.payload];
+ }
+ return [];
+ })
+ .filter((arr) => arr.length === 2)
);
state.showModal = true;
dialog.value!.open();
@@ -188,7 +216,7 @@ const selectUser = (user: string) => {
});
};
-const selectAuditType = (typeList: AuditActivityType[]) => {
+const selectAuditType = (typeList: LogEntity_Action[]) => {
if (typeList.length === 0) {
// Clear `type=` query string if no type selected.
const query = Object.assign({}, route.query);
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index 30ee31801f..64f77d9542 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -233,10 +233,10 @@
- [v1/logging_service.proto](#v1_logging_service-proto)
- [ListLogsRequest](#bytebase-v1-ListLogsRequest)
- [ListLogsResponse](#bytebase-v1-ListLogsResponse)
- - [LogEntry](#bytebase-v1-LogEntry)
+ - [LogEntity](#bytebase-v1-LogEntity)
- - [LogEntry.Action](#bytebase-v1-LogEntry-Action)
- - [LogEntry.Level](#bytebase-v1-LogEntry-Level)
+ - [LogEntity.Action](#bytebase-v1-LogEntity-Action)
+ - [LogEntity.Level](#bytebase-v1-LogEntity-Level)
- [LoggingService](#bytebase-v1-LoggingService)
@@ -3823,8 +3823,8 @@ The instance&#39;s `name` field is used to identify the instance to update. Form
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| parent | [string](#string) | | The parent resource name. Format: projects/{project} workspaces/{workspace} |
-| 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 - container - level - action For example: List the logs of type &#39;ACTION_ISSUE_COMMENT_CREATE&#39; in issue/123: &#39;action=&#34;ACTION_ISSUE_COMMENT_CREATE&#34;, container=&#34;issue/123&#34;&#39; |
+| 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 = &#34;users/{email}&#34; - resource, example: - resource = &#34;projects/{project resource id}&#34; - level, example: - level = &#34;INFO&#34; - level = &#34;ERROR | WARN&#34; - action, example: - action = &#34;ACTION_MEMBER_CREATE&#34; | &#34;ACTION_ISSUE_CREATE&#34; - create_time, example: - create_time &lt;= &#34;2022-01-01T12:00:00.000Z&#34; - create_time &gt;= &#34;2022-01-01T12:00:00.000Z&#34; For example: List the logs of type &#39;ACTION_ISSUE_COMMENT_CREATE&#39; in issue/123: &#39;action=&#34;ACTION_ISSUE_COMMENT_CREATE&#34;, resource=&#34;issue/123&#34;&#39; |
+| order_by | [string](#string) | | The order by of the log. Only support order by create_time. For example: - order_by = &#34;create_time acs&#34; - order_by = &#34;create_time desc&#34; |
| 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. |
@@ -3841,29 +3841,30 @@ The instance&#39;s `name` field is used to identify the instance to update. Form
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| log_entries | [LogEntry](#bytebase-v1-LogEntry) | repeated | The list of log entries. |
-| next_page_token | [string](#string) | | A token to retrieve next page of log entries. Pass this value in the page_token field in the subsequent call to `ListLogs` method to retrieve the next page of log entries. |
+| 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-LogEntry"></a>
+<a name="bytebase-v1-LogEntity"></a>
-### LogEntry
+### LogEntity
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| creator | [string](#string) | | The creator of the log entry. Format: users/{emailid} |
+| 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) | | The timestamp when the backup resource was created initally. |
-| update_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | The timestamp when the backup resource was updated. |
-| action | [LogEntry.Action](#bytebase-v1-LogEntry-Action) | | |
-| level | [LogEntry.Level](#bytebase-v1-LogEntry-Level) | | |
-| resource_name | [string](#string) | | The name of the resource associated with this log entry. For example, the resource user associated with log entry type of &#34;ACTION_MEMBER_CREATE&#34;. Format: For ACTION_MEMBER_*: users/{email} For ACTION_ISSUE_*: issues/{issue} For ACTION_PIPELINE_*: pipelines/{pipeline} For ACTION_PROJECT_*: projects/{project} For ACTION_SQL_EDITOR_QUERY: workspaces/{workspace} OR projects/{project} |
-| json_payload | [google.protobuf.Struct](#google-protobuf-Struct) | | The payload of the log entry. |
+| 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 &#34;ACTION_MEMBER_CREATE&#34;. 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) | | |
@@ -3872,46 +3873,50 @@ The instance&#39;s `name` field is used to identify the instance to update. Form
-<a name="bytebase-v1-LogEntry-Action"></a>
+<a name="bytebase-v1-LogEntity-Action"></a>
-### LogEntry.Action
+### LogEntity.Action
| Name | Number | Description |
| ---- | ------ | ----------- |
-| ACTION_UNSPECIFIED | 0 | |
-| ACTION_MEMBER_CREATE | 1 | In worksapce resource only.
+| 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&#39;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 | 5 | In project resource only.
+| ACTION_ISSUE_CREATE | 21 | Issue related activity types. Enum value 21 - 40
ACTION_ISSUE_CREATE is the type for creating a new issue. |
-| ACTION_ISSUE_COMMENT_CREATE | 6 | ACTION_ISSUE_COMMENT_CREATE is the type for creating a new comment on an issue. |
-| ACTION_ISSUE_FIELD_UPDATE | 7 | ACTION_ISSUE_FIELD_UPDATE is the type for updating an issue&#39;s field. |
-| ACTION_ISSUE_STATUS_UPDATE | 8 | ACTION_ISSUE_STATUS_UPDATE is the type for updating an issue&#39;s status. |
-| ACTION_PIPELINE_STAGE_STATUS_UPDATE | 9 | ACTION_PIPELINE_STAGE_STATUS_UPDATE is the type for stage begins or ends. |
-| ACTION_PIPELINE_TASK_STATUS_UPDATE | 10 | ACTION_PIPELINE_TASK_STATUS_UPDATE is the type for updating pipeline task status. |
-| ACTION_PIPELINE_TASK_FILE_COMMIT | 11 | ACTION_PIPELINE_TASK_FILE_COMMIT is the type for committing pipeline task files. |
-| ACTION_PIPELINE_TASK_STATEMENT_UPDATE | 12 | ACTION_PIPELINE_TASK_STATEMENT_UPDATE is the type for updating pipeline task SQL statement. |
-| ACITON_PIPELINE_TASK_EARLIEST_ALLOWED_DATE_UPDATE | 13 | ACTION_PIPELINE_TASK_EARLIEST_ALLOWED_DATE_UPDATE is the type for updating pipeline task the earliest allowed time. |
-| ACTION_PROJECT_MEMBER_CREATE | 14 | ACTION_PROJECT_MEMBER_CREATE is the type for creating a new project member. |
-| ACTION_PROJECT_MEMBER_ROLE_UPDATE | 15 | ACTION_PROJECT_MEMBER_ROLE_UPDATE is the type for updating a project member&#39;s role. |
-| ACTION_PROJECT_MEMBER_DELETE | 16 | ACTION_PROJECT_MEMBER_DELETE is the type for deleting a project member. |
-| ACTION_PROJECT_REPOSITORY_PUSH | 17 | ACTION_PROJECT_REPOSITORY_PUSH is the type for pushing to a project repository. |
-| ACTION_PROJECT_DTABASE_TRANSFER | 18 | ACTION_PROJECT_DATABASE_TRANSFER is the type for transferring a database to a project. |
-| ACTION_PROJECT_DATABASE_RECOVERY_PITR_DONE | 19 | ACTION_PROJECT_DATABASE_RECOVERY_PITR_DONE is the type for database PITR recovery done. |
-| ACTION_SQL_EDITOR_QUERY | 20 | Both in workspace and project resource.
+| 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&#39;s field. |
+| ACTION_ISSUE_STATUS_UPDATE | 24 | ACTION_ISSUE_STATUS_UPDATE is the type for updating an issue&#39;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
-ACTION_SQL_EDITOR_QUERY is the type for SQL editor query. If user runs SQL in Read-only mode, this action will belong to project resource. If user runs SQL in Read-write mode, this action will belong to workspace resource. |
+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-LogEntry-Level"></a>
+<a name="bytebase-v1-LogEntity-Level"></a>
-### LogEntry.Level
+### LogEntity.Level
| Name | Number | Description |
diff --git a/proto/generated-go/v1/logging_service.pb.go b/proto/generated-go/v1/logging_service.pb.go
index a6c848eced..d14a14b27b 100644
--- a/proto/generated-go/v1/logging_service.pb.go
+++ b/proto/generated-go/v1/logging_service.pb.go
@@ -10,7 +10,6 @@ import (
_ "google.golang.org/genproto/googleapis/api/annotations"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
- structpb "google.golang.org/protobuf/types/known/structpb"
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
reflect "reflect"
sync "sync"
@@ -23,158 +22,170 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
-type LogEntry_Action int32
+type LogEntity_Action int32
const (
- LogEntry_ACTION_UNSPECIFIED LogEntry_Action = 0
- // In worksapce resource only.
+ LogEntity_ACTION_UNSPECIFIED LogEntity_Action = 0 // In worksapce resource only.
+ // Member related activity types.
+ // Enum value 1 - 20
//
// ACTION_MEMBER_CREATE is the type for creating a new member.
- LogEntry_ACTION_MEMBER_CREATE LogEntry_Action = 1
+ LogEntity_ACTION_MEMBER_CREATE LogEntity_Action = 1
// ACTION_MEMBER_ROLE_UPDATE is the type for updating a member's role.
- LogEntry_ACTION_MEMBER_ROLE_UPDATE LogEntry_Action = 2
+ LogEntity_ACTION_MEMBER_ROLE_UPDATE LogEntity_Action = 2
// ACTION_MEMBER_ACTIVATE_UPDATE is the type for activating members.
- LogEntry_ACTION_MEMBER_ACTIVATE LogEntry_Action = 3
+ LogEntity_ACTION_MEMBER_ACTIVATE LogEntity_Action = 3
// ACTION_MEMBER_DEACTIVE is the type for deactiving members.
- LogEntry_ACTION_MEMBER_DEACTIVE LogEntry_Action = 4
- // In project resource only.
+ LogEntity_ACTION_MEMBER_DEACTIVE LogEntity_Action = 4
+ // Issue related activity types.
+ // Enum value 21 - 40
//
// ACTION_ISSUE_CREATE is the type for creating a new issue.
- LogEntry_ACTION_ISSUE_CREATE LogEntry_Action = 5
+ LogEntity_ACTION_ISSUE_CREATE LogEntity_Action = 21
// ACTION_ISSUE_COMMENT_CREATE is the type for creating a new comment on an issue.
- LogEntry_ACTION_ISSUE_COMMENT_CREATE LogEntry_Action = 6
+ LogEntity_ACTION_ISSUE_COMMENT_CREATE LogEntity_Action = 22
// ACTION_ISSUE_FIELD_UPDATE is the type for updating an issue's field.
- LogEntry_ACTION_ISSUE_FIELD_UPDATE LogEntry_Action = 7
+ LogEntity_ACTION_ISSUE_FIELD_UPDATE LogEntity_Action = 23
// ACTION_ISSUE_STATUS_UPDATE is the type for updating an issue's status.
- LogEntry_ACTION_ISSUE_STATUS_UPDATE LogEntry_Action = 8
- // ACTION_PIPELINE_STAGE_STATUS_UPDATE is the type for stage begins or ends.
- LogEntry_ACTION_PIPELINE_STAGE_STATUS_UPDATE LogEntry_Action = 9
- // ACTION_PIPELINE_TASK_STATUS_UPDATE is the type for updating pipeline task status.
- LogEntry_ACTION_PIPELINE_TASK_STATUS_UPDATE LogEntry_Action = 10
- // ACTION_PIPELINE_TASK_FILE_COMMIT is the type for committing pipeline task files.
- LogEntry_ACTION_PIPELINE_TASK_FILE_COMMIT LogEntry_Action = 11
- // ACTION_PIPELINE_TASK_STATEMENT_UPDATE is the type for updating pipeline task SQL statement.
- LogEntry_ACTION_PIPELINE_TASK_STATEMENT_UPDATE LogEntry_Action = 12
- // ACTION_PIPELINE_TASK_EARLIEST_ALLOWED_DATE_UPDATE is the type for updating pipeline task the earliest allowed time.
- LogEntry_ACITON_PIPELINE_TASK_EARLIEST_ALLOWED_DATE_UPDATE LogEntry_Action = 13
- // ACTION_PROJECT_MEMBER_CREATE is the type for creating a new project member.
- LogEntry_ACTION_PROJECT_MEMBER_CREATE LogEntry_Action = 14
- // ACTION_PROJECT_MEMBER_ROLE_UPDATE is the type for updating a project member's role.
- LogEntry_ACTION_PROJECT_MEMBER_ROLE_UPDATE LogEntry_Action = 15
- // ACTION_PROJECT_MEMBER_DELETE is the type for deleting a project member.
- LogEntry_ACTION_PROJECT_MEMBER_DELETE LogEntry_Action = 16
- // ACTION_PROJECT_REPOSITORY_PUSH is the type for pushing to a project repository.
- LogEntry_ACTION_PROJECT_REPOSITORY_PUSH LogEntry_Action = 17
- // ACTION_PROJECT_DATABASE_TRANSFER is the type for transferring a database to a project.
- LogEntry_ACTION_PROJECT_DTABASE_TRANSFER LogEntry_Action = 18
+ LogEntity_ACTION_ISSUE_STATUS_UPDATE LogEntity_Action = 24
+ // ACTION_ISSUE_APPROVAL_NOTIFY is the type for notifying issue approval.
+ LogEntity_ACTION_ISSUE_APPROVAL_NOTIFY LogEntity_Action = 25
+ // ACTION_PIPELINE_STAGE_STATUS_UPDATE represents the pipeline stage status change, including BEGIN, END for now.
+ LogEntity_ACTION_PIPELINE_STAGE_STATUS_UPDATE LogEntity_Action = 31
+ // ACTION_PIPELINE_TASK_STATUS_UPDATE represents the pipeline task status change, including PENDING, PENDING_APPROVAL, RUNNING, SUCCESS, FAILURE, CANCELED for now.
+ LogEntity_ACTION_PIPELINE_TASK_STATUS_UPDATE LogEntity_Action = 32
+ // ACTION_PIPELINE_TASK_FILE_COMMIT represents the VCS trigger to commit a file to update the task statement.
+ LogEntity_ACTION_PIPELINE_TASK_FILE_COMMIT LogEntity_Action = 33
+ // ACTION_PIPELINE_TASK_STATEMENT_UPDATE represents the manual update of the task statement.
+ LogEntity_ACTION_PIPELINE_TASK_STATEMENT_UPDATE LogEntity_Action = 34
+ // ACTION_PIPELINE_TASK_EARLIEST_ALLOWED_TIME_UPDATE represents the manual update of the task earliest allowed time.
+ LogEntity_ACTION_PIPELINE_TASK_EARLIEST_ALLOWED_TIME_UPDATE LogEntity_Action = 35
+ // Project related activity types.
+ // Enum value 41 - 60
+ //
+ // ACTION_PROJECT_REPOSITORY_PUSH represents Bytebase receiving a push event from the project repository.
+ LogEntity_ACTION_PROJECT_REPOSITORY_PUSH LogEntity_Action = 41
+ // ACTION_PROJECT_MEMBER_CREATE represents adding a member to the project.
+ LogEntity_ACTION_PROJECT_MEMBER_CREATE LogEntity_Action = 42
+ // ACTION_PROJECT_MEMBER_DELETE represents removing a member from the project.
+ LogEntity_ACTION_PROJECT_MEMBER_DELETE LogEntity_Action = 43
+ // ACTION_PROJECT_MEMBER_ROLE_UPDATE represents updating the member role, for example, from ADMIN to MEMBER.
+ LogEntity_ACTION_PROJECT_MEMBER_ROLE_UPDATE LogEntity_Action = 44
// ACTION_PROJECT_DATABASE_RECOVERY_PITR_DONE is the type for database PITR recovery done.
- LogEntry_ACTION_PROJECT_DATABASE_RECOVERY_PITR_DONE LogEntry_Action = 19
- // Both in workspace and project resource.
+ LogEntity_ACTION_PROJECT_DATABASE_RECOVERY_PITR_DONE LogEntity_Action = 45
+ // ACTION_PROJECT_DATABASE_TRANSFER represents transfering the database from one project to another.
+ LogEntity_ACTION_PROJECT_DATABASE_TRANSFER LogEntity_Action = 46
+ // Database related activity types.
+ // Enum value 61 - 80
//
- // ACTION_SQL_EDITOR_QUERY is the type for SQL editor query.
- // If user runs SQL in Read-only mode, this action will belong to project resource.
- // If user runs SQL in Read-write mode, this action will belong to workspace resource.
- LogEntry_ACTION_SQL_EDITOR_QUERY LogEntry_Action = 20
+ // ACTION_DATABASE_SQL_EDITOR_QUERY is the type for SQL editor query.
+ LogEntity_ACTION_DATABASE_SQL_EDITOR_QUERY LogEntity_Action = 61
+ // ACTION_DATABASE_SQL_EXPORT is the type for exporting SQL.
+ LogEntity_ACTION_DATABASE_SQL_EXPORT LogEntity_Action = 62
)
-// Enum value maps for LogEntry_Action.
+// Enum value maps for LogEntity_Action.
var (
- LogEntry_Action_name = map[int32]string{
+ LogEntity_Action_name = map[int32]string{
0: "ACTION_UNSPECIFIED",
1: "ACTION_MEMBER_CREATE",
2: "ACTION_MEMBER_ROLE_UPDATE",
3: "ACTION_MEMBER_ACTIVATE",
4: "ACTION_MEMBER_DEACTIVE",
- 5: "ACTION_ISSUE_CREATE",
- 6: "ACTION_ISSUE_COMMENT_CREATE",
- 7: "ACTION_ISSUE_FIELD_UPDATE",
- 8: "ACTION_ISSUE_STATUS_UPDATE",
- 9: "ACTION_PIPELINE_STAGE_STATUS_UPDATE",
- 10: "ACTION_PIPELINE_TASK_STATUS_UPDATE",
- 11: "ACTION_PIPELINE_TASK_FILE_COMMIT",
- 12: "ACTION_PIPELINE_TASK_STATEMENT_UPDATE",
- 13: "ACITON_PIPELINE_TASK_EARLIEST_ALLOWED_DATE_UPDATE",
- 14: "ACTION_PROJECT_MEMBER_CREATE",
- 15: "ACTION_PROJECT_MEMBER_ROLE_UPDATE",
- 16: "ACTION_PROJECT_MEMBER_DELETE",
- 17: "ACTION_PROJECT_REPOSITORY_PUSH",
- 18: "ACTION_PROJECT_DTABASE_TRANSFER",
- 19: "ACTION_PROJECT_DATABASE_RECOVERY_PITR_DONE",
- 20: "ACTION_SQL_EDITOR_QUERY",
+ 21: "ACTION_ISSUE_CREATE",
+ 22: "ACTION_ISSUE_COMMENT_CREATE",
+ 23: "ACTION_ISSUE_FIELD_UPDATE",
+ 24: "ACTION_ISSUE_STATUS_UPDATE",
+ 25: "ACTION_ISSUE_APPROVAL_NOTIFY",
+ 31: "ACTION_PIPELINE_STAGE_STATUS_UPDATE",
+ 32: "ACTION_PIPELINE_TASK_STATUS_UPDATE",
+ 33: "ACTION_PIPELINE_TASK_FILE_COMMIT",
+ 34: "ACTION_PIPELINE_TASK_STATEMENT_UPDATE",
+ 35: "ACTION_PIPELINE_TASK_EARLIEST_ALLOWED_TIME_UPDATE",
+ 41: "ACTION_PROJECT_REPOSITORY_PUSH",
+ 42: "ACTION_PROJECT_MEMBER_CREATE",
+ 43: "ACTION_PROJECT_MEMBER_DELETE",
+ 44: "ACTION_PROJECT_MEMBER_ROLE_UPDATE",
+ 45: "ACTION_PROJECT_DATABASE_RECOVERY_PITR_DONE",
+ 46: "ACTION_PROJECT_DATABASE_TRANSFER",
+ 61: "ACTION_DATABASE_SQL_EDITOR_QUERY",
+ 62: "ACTION_DATABASE_SQL_EXPORT",
}
- LogEntry_Action_value = map[string]int32{
+ LogEntity_Action_value = map[string]int32{
"ACTION_UNSPECIFIED": 0,
"ACTION_MEMBER_CREATE": 1,
"ACTION_MEMBER_ROLE_UPDATE": 2,
"ACTION_MEMBER_ACTIVATE": 3,
"ACTION_MEMBER_DEACTIVE": 4,
- "ACTION_ISSUE_CREATE": 5,
- "ACTION_ISSUE_COMMENT_CREATE": 6,
- "ACTION_ISSUE_FIELD_UPDATE": 7,
- "ACTION_ISSUE_STATUS_UPDATE": 8,
- "ACTION_PIPELINE_STAGE_STATUS_UPDATE": 9,
- "ACTION_PIPELINE_TASK_STATUS_UPDATE": 10,
- "ACTION_PIPELINE_TASK_FILE_COMMIT": 11,
- "ACTION_PIPELINE_TASK_STATEMENT_UPDATE": 12,
- "ACITON_PIPELINE_TASK_EARLIEST_ALLOWED_DATE_UPDATE": 13,
- "ACTION_PROJECT_MEMBER_CREATE": 14,
- "ACTION_PROJECT_MEMBER_ROLE_UPDATE": 15,
- "ACTION_PROJECT_MEMBER_DELETE": 16,
- "ACTION_PROJECT_REPOSITORY_PUSH": 17,
- "ACTION_PROJECT_DTABASE_TRANSFER": 18,
- "ACTION_PROJECT_DATABASE_RECOVERY_PITR_DONE": 19,
- "ACTION_SQL_EDITOR_QUERY": 20,
+ "ACTION_ISSUE_CREATE": 21,
+ "ACTION_ISSUE_COMMENT_CREATE": 22,
+ "ACTION_ISSUE_FIELD_UPDATE": 23,
+ "ACTION_ISSUE_STATUS_UPDATE": 24,
+ "ACTION_ISSUE_APPROVAL_NOTIFY": 25,
+ "ACTION_PIPELINE_STAGE_STATUS_UPDATE": 31,
+ "ACTION_PIPELINE_TASK_STATUS_UPDATE": 32,
+ "ACTION_PIPELINE_TASK_FILE_COMMIT": 33,
+ "ACTION_PIPELINE_TASK_STATEMENT_UPDATE": 34,
+ "ACTION_PIPELINE_TASK_EARLIEST_ALLOWED_TIME_UPDATE": 35,
+ "ACTION_PROJECT_REPOSITORY_PUSH": 41,
+ "ACTION_PROJECT_MEMBER_CREATE": 42,
+ "ACTION_PROJECT_MEMBER_DELETE": 43,
+ "ACTION_PROJECT_MEMBER_ROLE_UPDATE": 44,
+ "ACTION_PROJECT_DATABASE_RECOVERY_PITR_DONE": 45,
+ "ACTION_PROJECT_DATABASE_TRANSFER": 46,
+ "ACTION_DATABASE_SQL_EDITOR_QUERY": 61,
+ "ACTION_DATABASE_SQL_EXPORT": 62,
}
)
-func (x LogEntry_Action) Enum() *LogEntry_Action {
- p := new(LogEntry_Action)
+func (x LogEntity_Action) Enum() *LogEntity_Action {
+ p := new(LogEntity_Action)
*p = x
return p
}
-func (x LogEntry_Action) String() string {
+func (x LogEntity_Action) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
-func (LogEntry_Action) Descriptor() protoreflect.EnumDescriptor {
+func (LogEntity_Action) Descriptor() protoreflect.EnumDescriptor {
return file_v1_logging_service_proto_enumTypes[0].Descriptor()
}
-func (LogEntry_Action) Type() protoreflect.EnumType {
+func (LogEntity_Action) Type() protoreflect.EnumType {
return &file_v1_logging_service_proto_enumTypes[0]
}
-func (x LogEntry_Action) Number() protoreflect.EnumNumber {
+func (x LogEntity_Action) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
-// Deprecated: Use LogEntry_Action.Descriptor instead.
-func (LogEntry_Action) EnumDescriptor() ([]byte, []int) {
+// Deprecated: Use LogEntity_Action.Descriptor instead.
+func (LogEntity_Action) EnumDescriptor() ([]byte, []int) {
return file_v1_logging_service_proto_rawDescGZIP(), []int{2, 0}
}
-type LogEntry_Level int32
+type LogEntity_Level int32
const (
- LogEntry_LEVEL_UNSPECIFIED LogEntry_Level = 0
+ LogEntity_LEVEL_UNSPECIFIED LogEntity_Level = 0
// LEVEL_INFO is the type for information.
- LogEntry_LEVEL_INFO LogEntry_Level = 1
+ LogEntity_LEVEL_INFO LogEntity_Level = 1
// LEVEL_WARNING is the type for warning.
- LogEntry_LEVEL_WARNING LogEntry_Level = 2
+ LogEntity_LEVEL_WARNING LogEntity_Level = 2
// LEVEL_ERROR is the type for error.
- LogEntry_LEVEL_ERROR LogEntry_Level = 3
+ LogEntity_LEVEL_ERROR LogEntity_Level = 3
)
-// Enum value maps for LogEntry_Level.
+// Enum value maps for LogEntity_Level.
var (
- LogEntry_Level_name = map[int32]string{
+ LogEntity_Level_name = map[int32]string{
0: "LEVEL_UNSPECIFIED",
1: "LEVEL_INFO",
2: "LEVEL_WARNING",
3: "LEVEL_ERROR",
}
- LogEntry_Level_value = map[string]int32{
+ LogEntity_Level_value = map[string]int32{
"LEVEL_UNSPECIFIED": 0,
"LEVEL_INFO": 1,
"LEVEL_WARNING": 2,
@@ -182,30 +193,30 @@ var (
}
)
-func (x LogEntry_Level) Enum() *LogEntry_Level {
- p := new(LogEntry_Level)
+func (x LogEntity_Level) Enum() *LogEntity_Level {
+ p := new(LogEntity_Level)
*p = x
return p
}
-func (x LogEntry_Level) String() string {
+func (x LogEntity_Level) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
-func (LogEntry_Level) Descriptor() protoreflect.EnumDescriptor {
+func (LogEntity_Level) Descriptor() protoreflect.EnumDescriptor {
return file_v1_logging_service_proto_enumTypes[1].Descriptor()
}
-func (LogEntry_Level) Type() protoreflect.EnumType {
+func (LogEntity_Level) Type() protoreflect.EnumType {
return &file_v1_logging_service_proto_enumTypes[1]
}
-func (x LogEntry_Level) Number() protoreflect.EnumNumber {
+func (x LogEntity_Level) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
-// Deprecated: Use LogEntry_Level.Descriptor instead.
-func (LogEntry_Level) EnumDescriptor() ([]byte, []int) {
+// Deprecated: Use LogEntity_Level.Descriptor instead.
+func (LogEntity_Level) EnumDescriptor() ([]byte, []int) {
return file_v1_logging_service_proto_rawDescGZIP(), []int{2, 1}
}
@@ -214,21 +225,35 @@ type ListLogsRequest struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
- // The parent resource name.
- // Format:
- // projects/{project}
- // workspaces/{workspace}
- Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"`
// 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
- // - container
- // - level
- // - action
+ // - 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", container="issue/123"'
- Filter string `protobuf:"bytes,2,opt,name=filter,proto3" json:"filter,omitempty"`
+ // List the logs of type 'ACTION_ISSUE_COMMENT_CREATE' in issue/123: 'action="ACTION_ISSUE_COMMENT_CREATE", resource="issue/123"'
+ Filter string `protobuf:"bytes,1,opt,name=filter,proto3" json:"filter,omitempty"`
+ // The order by of the log.
+ // Only support order by create_time.
+ // For example:
+ // - order_by = "create_time acs"
+ // - order_by = "create_time desc"
+ OrderBy string `protobuf:"bytes,2,opt,name=order_by,json=orderBy,proto3" json:"order_by,omitempty"`
// 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.
@@ -271,16 +296,16 @@ func (*ListLogsRequest) Descriptor() ([]byte, []int) {
return file_v1_logging_service_proto_rawDescGZIP(), []int{0}
}
-func (x *ListLogsRequest) GetParent() string {
+func (x *ListLogsRequest) GetFilter() string {
if x != nil {
- return x.Parent
+ return x.Filter
}
return ""
}
-func (x *ListLogsRequest) GetFilter() string {
+func (x *ListLogsRequest) GetOrderBy() string {
if x != nil {
- return x.Filter
+ return x.OrderBy
}
return ""
}
@@ -304,11 +329,11 @@ type ListLogsResponse struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
- // The list of log entries.
- LogEntries []*LogEntry `protobuf:"bytes,1,rep,name=log_entries,json=logEntries,proto3" json:"log_entries,omitempty"`
- // A token to retrieve next page of log entries.
+ // The list of log entities.
+ LogEntities []*LogEntity `protobuf:"bytes,1,rep,name=log_entities,json=logEntities,proto3" json:"log_entities,omitempty"`
+ // 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 entries.
+ // to retrieve the next page of log entities.
NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"`
}
@@ -344,9 +369,9 @@ func (*ListLogsResponse) Descriptor() ([]byte, []int) {
return file_v1_logging_service_proto_rawDescGZIP(), []int{1}
}
-func (x *ListLogsResponse) GetLogEntries() []*LogEntry {
+func (x *ListLogsResponse) GetLogEntities() []*LogEntity {
if x != nil {
- return x.LogEntries
+ return x.LogEntities
}
return nil
}
@@ -358,34 +383,37 @@ func (x *ListLogsResponse) GetNextPageToken() string {
return ""
}
-type LogEntry struct {
+type LogEntity struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
- // The creator of the log entry.
- // Format: users/{emailid}
- Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
+ // The name of the log.
+ // Format: logs/{uid}
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ // The creator of the log entity.
+ // Format: users/{email}
+ Creator string `protobuf:"bytes,2,opt,name=creator,proto3" json:"creator,omitempty"`
// The timestamp when the backup resource was created initally.
- CreateTime *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"`
- // The timestamp when the backup resource was updated.
- UpdateTime *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=update_time,json=updateTime,proto3" json:"update_time,omitempty"`
- Action LogEntry_Action `protobuf:"varint,4,opt,name=action,proto3,enum=bytebase.v1.LogEntry_Action" json:"action,omitempty"`
- Level LogEntry_Level `protobuf:"varint,5,opt,name=level,proto3,enum=bytebase.v1.LogEntry_Level" json:"level,omitempty"`
- // The name of the resource associated with this log entry. For example, the resource user associated with log entry type of "ACTION_MEMBER_CREATE".
+ CreateTime *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"`
+ Action LogEntity_Action `protobuf:"varint,4,opt,name=action,proto3,enum=bytebase.v1.LogEntity_Action" json:"action,omitempty"`
+ Level LogEntity_Level `protobuf:"varint,5,opt,name=level,proto3,enum=bytebase.v1.LogEntity_Level" json:"level,omitempty"`
+ // 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}
- // For ACTION_PIPELINE_*: pipelines/{pipeline}
- // For ACTION_PROJECT_*: projects/{project}
- // For ACTION_SQL_EDITOR_QUERY: workspaces/{workspace} OR projects/{project}
- ResourceName string `protobuf:"bytes,6,opt,name=resource_name,json=resourceName,proto3" json:"resource_name,omitempty"`
- // The payload of the log entry.
- JsonPayload *structpb.Struct `protobuf:"bytes,7,opt,name=json_payload,json=jsonPayload,proto3" json:"json_payload,omitempty"`
-}
-
-func (x *LogEntry) Reset() {
- *x = LogEntry{}
+ // 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}
+ Resource string `protobuf:"bytes,6,opt,name=resource,proto3" json:"resource,omitempty"`
+ // The payload of the log entity.
+ // TODO: use oneof
+ Payload string `protobuf:"bytes,7,opt,name=payload,proto3" json:"payload,omitempty"`
+ Comment string `protobuf:"bytes,8,opt,name=comment,proto3" json:"comment,omitempty"`
+}
+
+func (x *LogEntity) Reset() {
+ *x = LogEntity{}
if protoimpl.UnsafeEnabled {
mi := &file_v1_logging_service_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -393,13 +421,13 @@ func (x *LogEntry) Reset() {
}
}
-func (x *LogEntry) String() string {
+func (x *LogEntity) String() string {
return protoimpl.X.MessageStringOf(x)
}
-func (*LogEntry) ProtoMessage() {}
+func (*LogEntity) ProtoMessage() {}
-func (x *LogEntry) ProtoReflect() protoreflect.Message {
+func (x *LogEntity) ProtoReflect() protoreflect.Message {
mi := &file_v1_logging_service_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -411,58 +439,65 @@ func (x *LogEntry) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
-// Deprecated: Use LogEntry.ProtoReflect.Descriptor instead.
-func (*LogEntry) Descriptor() ([]byte, []int) {
+// Deprecated: Use LogEntity.ProtoReflect.Descriptor instead.
+func (*LogEntity) Descriptor() ([]byte, []int) {
return file_v1_logging_service_proto_rawDescGZIP(), []int{2}
}
-func (x *LogEntry) GetCreator() string {
+func (x *LogEntity) GetName() string {
if x != nil {
- return x.Creator
+ return x.Name
}
return ""
}
-func (x *LogEntry) GetCreateTime() *timestamppb.Timestamp {
+func (x *LogEntity) GetCreator() string {
if x != nil {
- return x.CreateTime
+ return x.Creator
}
- return nil
+ return ""
}
-func (x *LogEntry) GetUpdateTime() *timestamppb.Timestamp {
+func (x *LogEntity) GetCreateTime() *timestamppb.Timestamp {
if x != nil {
- return x.UpdateTime
+ return x.CreateTime
}
return nil
}
-func (x *LogEntry) GetAction() LogEntry_Action {
+func (x *LogEntity) GetAction() LogEntity_Action {
if x != nil {
return x.Action
}
- return LogEntry_ACTION_UNSPECIFIED
+ return LogEntity_ACTION_UNSPECIFIED
}
-func (x *LogEntry) GetLevel() LogEntry_Level {
+func (x *LogEntity) GetLevel() LogEntity_Level {
if x != nil {
return x.Level
}
- return LogEntry_LEVEL_UNSPECIFIED
+ return LogEntity_LEVEL_UNSPECIFIED
}
-func (x *LogEntry) GetResourceName() string {
+func (x *LogEntity) GetResource() string {
if x != nil {
- return x.ResourceName
+ return x.Resource
}
return ""
}
-func (x *LogEntry) GetJsonPayload() *structpb.Struct {
+func (x *LogEntity) GetPayload() string {
if x != nil {
- return x.JsonPayload
+ return x.Payload
}
- return nil
+ return ""
+}
+
+func (x *LogEntity) GetComment() string {
+ if x != nil {
+ return x.Comment
+ }
+ return ""
}
var File_v1_logging_service_proto protoreflect.FileDescriptor
@@ -472,119 +507,114 @@ var file_v1_logging_service_proto_rawDesc = []byte{
0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x62, 0x79, 0x74, 0x65,
0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f,
0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e,
- 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70,
- 0x69, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f,
- 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64,
- 0x5f, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a,
- 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
- 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 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, 0x82,
- 0x01, 0x0a, 0x0f, 0x4c, 0x69, 0x73, 0x74, 0x4c, 0x6f, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65,
- 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01,
- 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x02, 0x52, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x12,
- 0x16, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x02, 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, 0x03, 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, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f,
- 0x6b, 0x65, 0x6e, 0x22, 0x77, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x4c, 0x6f, 0x67, 0x73, 0x52,
- 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x0b, 0x6c, 0x6f, 0x67, 0x5f, 0x65,
- 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x62,
- 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x6f, 0x67, 0x45, 0x6e,
- 0x74, 0x72, 0x79, 0x42, 0x03, 0xe0, 0x41, 0x03, 0x52, 0x0a, 0x6c, 0x6f, 0x67, 0x45, 0x6e, 0x74,
- 0x72, 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, 0xc1, 0x09, 0x0a,
- 0x08, 0x4c, 0x6f, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x1d, 0x0a, 0x07, 0x63, 0x72, 0x65,
- 0x61, 0x74, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x02, 0x52,
- 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x40, 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x61,
- 0x74, 0x65, 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, 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, 0x03, 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, 0x12, 0x39, 0x0a, 0x06,
- 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x62,
- 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x6f, 0x67, 0x45, 0x6e,
- 0x74, 0x72, 0x79, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x03, 0xe0, 0x41, 0x02, 0x52,
- 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x36, 0x0a, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c,
- 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,
- 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x6f, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x2e, 0x4c, 0x65,
- 0x76, 0x65, 0x6c, 0x42, 0x03, 0xe0, 0x41, 0x03, 0x52, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x12,
- 0x28, 0x0a, 0x0d, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65,
- 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x02, 0x52, 0x0c, 0x72, 0x65, 0x73,
- 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x3a, 0x0a, 0x0c, 0x6a, 0x73, 0x6f,
- 0x6e, 0x5f, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32,
- 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
- 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x0b, 0x6a, 0x73, 0x6f, 0x6e, 0x50, 0x61,
- 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0xe4, 0x05, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e,
- 0x12, 0x16, 0x0a, 0x12, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45,
- 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x18, 0x0a, 0x14, 0x41, 0x43, 0x54, 0x49,
- 0x4f, 0x4e, 0x5f, 0x4d, 0x45, 0x4d, 0x42, 0x45, 0x52, 0x5f, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45,
- 0x10, 0x01, 0x12, 0x1d, 0x0a, 0x19, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4d, 0x45, 0x4d,
- 0x42, 0x45, 0x52, 0x5f, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x10,
- 0x02, 0x12, 0x1a, 0x0a, 0x16, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4d, 0x45, 0x4d, 0x42,
- 0x45, 0x52, 0x5f, 0x41, 0x43, 0x54, 0x49, 0x56, 0x41, 0x54, 0x45, 0x10, 0x03, 0x12, 0x1a, 0x0a,
- 0x16, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4d, 0x45, 0x4d, 0x42, 0x45, 0x52, 0x5f, 0x44,
- 0x45, 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, 0x10, 0x04, 0x12, 0x17, 0x0a, 0x13, 0x41, 0x43, 0x54,
- 0x49, 0x4f, 0x4e, 0x5f, 0x49, 0x53, 0x53, 0x55, 0x45, 0x5f, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45,
- 0x10, 0x05, 0x12, 0x1f, 0x0a, 0x1b, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x49, 0x53, 0x53,
- 0x55, 0x45, 0x5f, 0x43, 0x4f, 0x4d, 0x4d, 0x45, 0x4e, 0x54, 0x5f, 0x43, 0x52, 0x45, 0x41, 0x54,
- 0x45, 0x10, 0x06, 0x12, 0x1d, 0x0a, 0x19, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x49, 0x53,
- 0x53, 0x55, 0x45, 0x5f, 0x46, 0x49, 0x45, 0x4c, 0x44, 0x5f, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45,
- 0x10, 0x07, 0x12, 0x1e, 0x0a, 0x1a, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x49, 0x53, 0x53,
- 0x55, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45,
- 0x10, 0x08, 0x12, 0x27, 0x0a, 0x23, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x50, 0x49, 0x50,
- 0x45, 0x4c, 0x49, 0x4e, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x47, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54,
- 0x55, 0x53, 0x5f, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x10, 0x09, 0x12, 0x26, 0x0a, 0x22, 0x41,
- 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x50, 0x49, 0x50, 0x45, 0x4c, 0x49, 0x4e, 0x45, 0x5f, 0x54,
- 0x41, 0x53, 0x4b, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x50, 0x44, 0x41, 0x54,
- 0x45, 0x10, 0x0a, 0x12, 0x24, 0x0a, 0x20, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x50, 0x49,
- 0x50, 0x45, 0x4c, 0x49, 0x4e, 0x45, 0x5f, 0x54, 0x41, 0x53, 0x4b, 0x5f, 0x46, 0x49, 0x4c, 0x45,
- 0x5f, 0x43, 0x4f, 0x4d, 0x4d, 0x49, 0x54, 0x10, 0x0b, 0x12, 0x29, 0x0a, 0x25, 0x41, 0x43, 0x54,
- 0x49, 0x4f, 0x4e, 0x5f, 0x50, 0x49, 0x50, 0x45, 0x4c, 0x49, 0x4e, 0x45, 0x5f, 0x54, 0x41, 0x53,
- 0x4b, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x45, 0x4d, 0x45, 0x4e, 0x54, 0x5f, 0x55, 0x50, 0x44, 0x41,
- 0x54, 0x45, 0x10, 0x0c, 0x12, 0x35, 0x0a, 0x31, 0x41, 0x43, 0x49, 0x54, 0x4f, 0x4e, 0x5f, 0x50,
- 0x49, 0x50, 0x45, 0x4c, 0x49, 0x4e, 0x45, 0x5f, 0x54, 0x41, 0x53, 0x4b, 0x5f, 0x45, 0x41, 0x52,
- 0x4c, 0x49, 0x45, 0x53, 0x54, 0x5f, 0x41, 0x4c, 0x4c, 0x4f, 0x57, 0x45, 0x44, 0x5f, 0x44, 0x41,
- 0x54, 0x45, 0x5f, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x10, 0x0d, 0x12, 0x20, 0x0a, 0x1c, 0x41,
+ 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70,
+ 0x69, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72,
+ 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 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, 0x80, 0x01, 0x0a, 0x0f, 0x4c, 0x69, 0x73, 0x74,
+ 0x4c, 0x6f, 0x67, 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, 0x19, 0x0a, 0x08, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x5f, 0x62, 0x79, 0x18,
+ 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x42, 0x79, 0x12, 0x1b,
+ 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x03, 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, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x7a, 0x0a, 0x10, 0x4c, 0x69,
+ 0x73, 0x74, 0x4c, 0x6f, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e,
+ 0x0a, 0x0c, 0x6c, 0x6f, 0x67, 0x5f, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01,
+ 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e,
+ 0x76, 0x31, 0x2e, 0x4c, 0x6f, 0x67, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x42, 0x03, 0xe0, 0x41,
+ 0x03, 0x52, 0x0b, 0x6c, 0x6f, 0x67, 0x45, 0x6e, 0x74, 0x69, 0x74, 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, 0xdb, 0x09, 0x0a, 0x09, 0x4c, 0x6f, 0x67, 0x45, 0x6e,
+ 0x74, 0x69, 0x74, 0x79, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01,
+ 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x03, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a,
+ 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03,
+ 0xe0, 0x41, 0x03, 0x52, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x40, 0x0a, 0x0b,
+ 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 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, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x3a,
+ 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1d,
+ 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x6f, 0x67,
+ 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x03, 0xe0,
+ 0x41, 0x02, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x37, 0x0a, 0x05, 0x6c, 0x65,
+ 0x76, 0x65, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x62, 0x79, 0x74, 0x65,
+ 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x6f, 0x67, 0x45, 0x6e, 0x74, 0x69, 0x74,
+ 0x79, 0x2e, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x42, 0x03, 0xe0, 0x41, 0x02, 0x52, 0x05, 0x6c, 0x65,
+ 0x76, 0x65, 0x6c, 0x12, 0x1f, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18,
+ 0x06, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x02, 0x52, 0x08, 0x72, 0x65, 0x73, 0x6f,
+ 0x75, 0x72, 0x63, 0x65, 0x12, 0x1d, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18,
+ 0x07, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x02, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c,
+ 0x6f, 0x61, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x08,
+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0xb0, 0x06,
+ 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x12, 0x41, 0x43, 0x54, 0x49,
+ 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00,
+ 0x12, 0x18, 0x0a, 0x14, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4d, 0x45, 0x4d, 0x42, 0x45,
+ 0x52, 0x5f, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, 0x10, 0x01, 0x12, 0x1d, 0x0a, 0x19, 0x41, 0x43,
+ 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4d, 0x45, 0x4d, 0x42, 0x45, 0x52, 0x5f, 0x52, 0x4f, 0x4c, 0x45,
+ 0x5f, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x10, 0x02, 0x12, 0x1a, 0x0a, 0x16, 0x41, 0x43, 0x54,
+ 0x49, 0x4f, 0x4e, 0x5f, 0x4d, 0x45, 0x4d, 0x42, 0x45, 0x52, 0x5f, 0x41, 0x43, 0x54, 0x49, 0x56,
+ 0x41, 0x54, 0x45, 0x10, 0x03, 0x12, 0x1a, 0x0a, 0x16, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f,
+ 0x4d, 0x45, 0x4d, 0x42, 0x45, 0x52, 0x5f, 0x44, 0x45, 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, 0x10,
+ 0x04, 0x12, 0x17, 0x0a, 0x13, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x49, 0x53, 0x53, 0x55,
+ 0x45, 0x5f, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, 0x10, 0x15, 0x12, 0x1f, 0x0a, 0x1b, 0x41, 0x43,
+ 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x49, 0x53, 0x53, 0x55, 0x45, 0x5f, 0x43, 0x4f, 0x4d, 0x4d, 0x45,
+ 0x4e, 0x54, 0x5f, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, 0x10, 0x16, 0x12, 0x1d, 0x0a, 0x19, 0x41,
+ 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x49, 0x53, 0x53, 0x55, 0x45, 0x5f, 0x46, 0x49, 0x45, 0x4c,
+ 0x44, 0x5f, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x10, 0x17, 0x12, 0x1e, 0x0a, 0x1a, 0x41, 0x43,
+ 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x49, 0x53, 0x53, 0x55, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55,
+ 0x53, 0x5f, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x10, 0x18, 0x12, 0x20, 0x0a, 0x1c, 0x41, 0x43,
+ 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x49, 0x53, 0x53, 0x55, 0x45, 0x5f, 0x41, 0x50, 0x50, 0x52, 0x4f,
+ 0x56, 0x41, 0x4c, 0x5f, 0x4e, 0x4f, 0x54, 0x49, 0x46, 0x59, 0x10, 0x19, 0x12, 0x27, 0x0a, 0x23,
+ 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x50, 0x49, 0x50, 0x45, 0x4c, 0x49, 0x4e, 0x45, 0x5f,
+ 0x53, 0x54, 0x41, 0x47, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x50, 0x44,
+ 0x41, 0x54, 0x45, 0x10, 0x1f, 0x12, 0x26, 0x0a, 0x22, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f,
+ 0x50, 0x49, 0x50, 0x45, 0x4c, 0x49, 0x4e, 0x45, 0x5f, 0x54, 0x41, 0x53, 0x4b, 0x5f, 0x53, 0x54,
+ 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x10, 0x20, 0x12, 0x24, 0x0a,
+ 0x20, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x50, 0x49, 0x50, 0x45, 0x4c, 0x49, 0x4e, 0x45,
+ 0x5f, 0x54, 0x41, 0x53, 0x4b, 0x5f, 0x46, 0x49, 0x4c, 0x45, 0x5f, 0x43, 0x4f, 0x4d, 0x4d, 0x49,
+ 0x54, 0x10, 0x21, 0x12, 0x29, 0x0a, 0x25, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x50, 0x49,
+ 0x50, 0x45, 0x4c, 0x49, 0x4e, 0x45, 0x5f, 0x54, 0x41, 0x53, 0x4b, 0x5f, 0x53, 0x54, 0x41, 0x54,
+ 0x45, 0x4d, 0x45, 0x4e, 0x54, 0x5f, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x10, 0x22, 0x12, 0x35,
+ 0x0a, 0x31, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x50, 0x49, 0x50, 0x45, 0x4c, 0x49, 0x4e,
+ 0x45, 0x5f, 0x54, 0x41, 0x53, 0x4b, 0x5f, 0x45, 0x41, 0x52, 0x4c, 0x49, 0x45, 0x53, 0x54, 0x5f,
+ 0x41, 0x4c, 0x4c, 0x4f, 0x57, 0x45, 0x44, 0x5f, 0x54, 0x49, 0x4d, 0x45, 0x5f, 0x55, 0x50, 0x44,
+ 0x41, 0x54, 0x45, 0x10, 0x23, 0x12, 0x22, 0x0a, 0x1e, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f,
+ 0x50, 0x52, 0x4f, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x52, 0x45, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x4f,
+ 0x52, 0x59, 0x5f, 0x50, 0x55, 0x53, 0x48, 0x10, 0x29, 0x12, 0x20, 0x0a, 0x1c, 0x41, 0x43, 0x54,
+ 0x49, 0x4f, 0x4e, 0x5f, 0x50, 0x52, 0x4f, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x4d, 0x45, 0x4d, 0x42,
+ 0x45, 0x52, 0x5f, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, 0x10, 0x2a, 0x12, 0x20, 0x0a, 0x1c, 0x41,
0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x50, 0x52, 0x4f, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x4d, 0x45,
- 0x4d, 0x42, 0x45, 0x52, 0x5f, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, 0x10, 0x0e, 0x12, 0x25, 0x0a,
+ 0x4d, 0x42, 0x45, 0x52, 0x5f, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x10, 0x2b, 0x12, 0x25, 0x0a,
0x21, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x50, 0x52, 0x4f, 0x4a, 0x45, 0x43, 0x54, 0x5f,
0x4d, 0x45, 0x4d, 0x42, 0x45, 0x52, 0x5f, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x55, 0x50, 0x44, 0x41,
- 0x54, 0x45, 0x10, 0x0f, 0x12, 0x20, 0x0a, 0x1c, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x50,
- 0x52, 0x4f, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x4d, 0x45, 0x4d, 0x42, 0x45, 0x52, 0x5f, 0x44, 0x45,
- 0x4c, 0x45, 0x54, 0x45, 0x10, 0x10, 0x12, 0x22, 0x0a, 0x1e, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e,
- 0x5f, 0x50, 0x52, 0x4f, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x52, 0x45, 0x50, 0x4f, 0x53, 0x49, 0x54,
- 0x4f, 0x52, 0x59, 0x5f, 0x50, 0x55, 0x53, 0x48, 0x10, 0x11, 0x12, 0x23, 0x0a, 0x1f, 0x41, 0x43,
- 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x50, 0x52, 0x4f, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x44, 0x54, 0x41,
- 0x42, 0x41, 0x53, 0x45, 0x5f, 0x54, 0x52, 0x41, 0x4e, 0x53, 0x46, 0x45, 0x52, 0x10, 0x12, 0x12,
- 0x2e, 0x0a, 0x2a, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x50, 0x52, 0x4f, 0x4a, 0x45, 0x43,
- 0x54, 0x5f, 0x44, 0x41, 0x54, 0x41, 0x42, 0x41, 0x53, 0x45, 0x5f, 0x52, 0x45, 0x43, 0x4f, 0x56,
- 0x45, 0x52, 0x59, 0x5f, 0x50, 0x49, 0x54, 0x52, 0x5f, 0x44, 0x4f, 0x4e, 0x45, 0x10, 0x13, 0x12,
- 0x1b, 0x0a, 0x17, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x51, 0x4c, 0x5f, 0x45, 0x44,
- 0x49, 0x54, 0x4f, 0x52, 0x5f, 0x51, 0x55, 0x45, 0x52, 0x59, 0x10, 0x14, 0x22, 0x52, 0x0a, 0x05,
- 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x15, 0x0a, 0x11, 0x4c, 0x45, 0x56, 0x45, 0x4c, 0x5f, 0x55,
- 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a,
- 0x4c, 0x45, 0x56, 0x45, 0x4c, 0x5f, 0x49, 0x4e, 0x46, 0x4f, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d,
- 0x4c, 0x45, 0x56, 0x45, 0x4c, 0x5f, 0x57, 0x41, 0x52, 0x4e, 0x49, 0x4e, 0x47, 0x10, 0x02, 0x12,
- 0x0f, 0x0a, 0x0b, 0x4c, 0x45, 0x56, 0x45, 0x4c, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x03,
- 0x32, 0xab, 0x01, 0x0a, 0x0e, 0x4c, 0x6f, 0x67, 0x67, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x72, 0x76,
- 0x69, 0x63, 0x65, 0x12, 0x98, 0x01, 0x0a, 0x08, 0x4c, 0x69, 0x73, 0x74, 0x4c, 0x6f, 0x67, 0x73,
- 0x12, 0x1c, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c,
- 0x69, 0x73, 0x74, 0x4c, 0x6f, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d,
- 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73,
- 0x74, 0x4c, 0x6f, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x4f, 0xda,
- 0x41, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x40, 0x5a, 0x20,
- 0x22, 0x1e, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x77, 0x6f,
- 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x6c, 0x6f, 0x67, 0x73,
- 0x22, 0x1c, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x70, 0x72,
- 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x6c, 0x6f, 0x67, 0x73, 0x42, 0x11,
- 0x5a, 0x0f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x76,
- 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+ 0x54, 0x45, 0x10, 0x2c, 0x12, 0x2e, 0x0a, 0x2a, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x50,
+ 0x52, 0x4f, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x44, 0x41, 0x54, 0x41, 0x42, 0x41, 0x53, 0x45, 0x5f,
+ 0x52, 0x45, 0x43, 0x4f, 0x56, 0x45, 0x52, 0x59, 0x5f, 0x50, 0x49, 0x54, 0x52, 0x5f, 0x44, 0x4f,
+ 0x4e, 0x45, 0x10, 0x2d, 0x12, 0x24, 0x0a, 0x20, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x50,
+ 0x52, 0x4f, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x44, 0x41, 0x54, 0x41, 0x42, 0x41, 0x53, 0x45, 0x5f,
+ 0x54, 0x52, 0x41, 0x4e, 0x53, 0x46, 0x45, 0x52, 0x10, 0x2e, 0x12, 0x24, 0x0a, 0x20, 0x41, 0x43,
+ 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x44, 0x41, 0x54, 0x41, 0x42, 0x41, 0x53, 0x45, 0x5f, 0x53, 0x51,
+ 0x4c, 0x5f, 0x45, 0x44, 0x49, 0x54, 0x4f, 0x52, 0x5f, 0x51, 0x55, 0x45, 0x52, 0x59, 0x10, 0x3d,
+ 0x12, 0x1e, 0x0a, 0x1a, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x44, 0x41, 0x54, 0x41, 0x42,
+ 0x41, 0x53, 0x45, 0x5f, 0x53, 0x51, 0x4c, 0x5f, 0x45, 0x58, 0x50, 0x4f, 0x52, 0x54, 0x10, 0x3e,
+ 0x22, 0x52, 0x0a, 0x05, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x15, 0x0a, 0x11, 0x4c, 0x45, 0x56,
+ 0x45, 0x4c, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00,
+ 0x12, 0x0e, 0x0a, 0x0a, 0x4c, 0x45, 0x56, 0x45, 0x4c, 0x5f, 0x49, 0x4e, 0x46, 0x4f, 0x10, 0x01,
+ 0x12, 0x11, 0x0a, 0x0d, 0x4c, 0x45, 0x56, 0x45, 0x4c, 0x5f, 0x57, 0x41, 0x52, 0x4e, 0x49, 0x4e,
+ 0x47, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x4c, 0x45, 0x56, 0x45, 0x4c, 0x5f, 0x45, 0x52, 0x52,
+ 0x4f, 0x52, 0x10, 0x03, 0x32, 0x72, 0x0a, 0x0e, 0x4c, 0x6f, 0x67, 0x67, 0x69, 0x6e, 0x67, 0x53,
+ 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x60, 0x0a, 0x08, 0x4c, 0x69, 0x73, 0x74, 0x4c, 0x6f,
+ 0x67, 0x73, 0x12, 0x1c, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31,
+ 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4c, 0x6f, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
+ 0x1a, 0x1d, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c,
+ 0x69, 0x73, 0x74, 0x4c, 0x6f, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22,
+ 0x17, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x11, 0x12, 0x0f, 0x2f, 0x76, 0x31, 0x2f, 0x6c, 0x6f, 0x67,
+ 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 (
@@ -602,28 +632,25 @@ func file_v1_logging_service_proto_rawDescGZIP() []byte {
var file_v1_logging_service_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
var file_v1_logging_service_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_v1_logging_service_proto_goTypes = []interface{}{
- (LogEntry_Action)(0), // 0: bytebase.v1.LogEntry.Action
- (LogEntry_Level)(0), // 1: bytebase.v1.LogEntry.Level
+ (LogEntity_Action)(0), // 0: bytebase.v1.LogEntity.Action
+ (LogEntity_Level)(0), // 1: bytebase.v1.LogEntity.Level
(*ListLogsRequest)(nil), // 2: bytebase.v1.ListLogsRequest
(*ListLogsResponse)(nil), // 3: bytebase.v1.ListLogsResponse
- (*LogEntry)(nil), // 4: bytebase.v1.LogEntry
+ (*LogEntity)(nil), // 4: bytebase.v1.LogEntity
(*timestamppb.Timestamp)(nil), // 5: google.protobuf.Timestamp
- (*structpb.Struct)(nil), // 6: google.protobuf.Struct
}
var file_v1_logging_service_proto_depIdxs = []int32{
- 4, // 0: bytebase.v1.ListLogsResponse.log_entries:type_name -> bytebase.v1.LogEntry
- 5, // 1: bytebase.v1.LogEntry.create_time:type_name -> google.protobuf.Timestamp
- 5, // 2: bytebase.v1.LogEntry.update_time:type_name -> google.protobuf.Timestamp
- 0, // 3: bytebase.v1.LogEntry.action:type_name -> bytebase.v1.LogEntry.Action
- 1, // 4: bytebase.v1.LogEntry.level:type_name -> bytebase.v1.LogEntry.Level
- 6, // 5: bytebase.v1.LogEntry.json_payload:type_name -> google.protobuf.Struct
- 2, // 6: bytebase.v1.LoggingService.ListLogs:input_type -> bytebase.v1.ListLogsRequest
- 3, // 7: bytebase.v1.LoggingService.ListLogs:output_type -> bytebase.v1.ListLogsResponse
- 7, // [7:8] is the sub-list for method output_type
- 6, // [6:7] is the sub-list for method input_type
- 6, // [6:6] is the sub-list for extension type_name
- 6, // [6:6] is the sub-list for extension extendee
- 0, // [0:6] is the sub-list for field type_name
+ 4, // 0: bytebase.v1.ListLogsResponse.log_entities:type_name -> bytebase.v1.LogEntity
+ 5, // 1: bytebase.v1.LogEntity.create_time:type_name -> google.protobuf.Timestamp
+ 0, // 2: bytebase.v1.LogEntity.action:type_name -> bytebase.v1.LogEntity.Action
+ 1, // 3: bytebase.v1.LogEntity.level:type_name -> bytebase.v1.LogEntity.Level
+ 2, // 4: bytebase.v1.LoggingService.ListLogs:input_type -> bytebase.v1.ListLogsRequest
+ 3, // 5: bytebase.v1.LoggingService.ListLogs:output_type -> bytebase.v1.ListLogsResponse
+ 5, // [5:6] is the sub-list for method output_type
+ 4, // [4:5] is the sub-list for method input_type
+ 4, // [4:4] is the sub-list for extension type_name
+ 4, // [4:4] is the sub-list for extension extendee
+ 0, // [0:4] is the sub-list for field type_name
}
func init() { file_v1_logging_service_proto_init() }
@@ -657,7 +684,7 @@ func file_v1_logging_service_proto_init() {
}
}
file_v1_logging_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*LogEntry); i {
+ switch v := v.(*LogEntity); i {
case 0:
return &v.state
case 1:
diff --git a/proto/generated-go/v1/logging_service.pb.gw.go b/proto/generated-go/v1/logging_service.pb.gw.go
index 3dcce72813..cd2832971e 100644
--- a/proto/generated-go/v1/logging_service.pb.gw.go
+++ b/proto/generated-go/v1/logging_service.pb.gw.go
@@ -32,30 +32,13 @@ var _ = utilities.NewDoubleArray
var _ = metadata.Join
var (
- filter_LoggingService_ListLogs_0 = &utilities.DoubleArray{Encoding: map[string]int{"parent": 0}, Base: []int{1, 2, 0, 0}, Check: []int{0, 1, 2, 2}}
+ filter_LoggingService_ListLogs_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_LoggingService_ListLogs_0(ctx context.Context, marshaler runtime.Marshaler, client LoggingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ListLogsRequest
var metadata runtime.ServerMetadata
- var (
- val string
- ok bool
- err error
- _ = err
- )
-
- val, ok = pathParams["parent"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")
- }
-
- protoReq.Parent, err = runtime.String(val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)
- }
-
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
@@ -72,23 +55,6 @@ func local_request_LoggingService_ListLogs_0(ctx context.Context, marshaler runt
var protoReq ListLogsRequest
var metadata runtime.ServerMetadata
- var (
- val string
- ok bool
- err error
- _ = err
- )
-
- val, ok = pathParams["parent"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")
- }
-
- protoReq.Parent, err = runtime.String(val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)
- }
-
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
@@ -101,83 +67,13 @@ func local_request_LoggingService_ListLogs_0(ctx context.Context, marshaler runt
}
-var (
- filter_LoggingService_ListLogs_1 = &utilities.DoubleArray{Encoding: map[string]int{"parent": 0}, Base: []int{1, 2, 0, 0}, Check: []int{0, 1, 2, 2}}
-)
-
-func request_LoggingService_ListLogs_1(ctx context.Context, marshaler runtime.Marshaler, client LoggingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq ListLogsRequest
- var metadata runtime.ServerMetadata
-
- var (
- val string
- ok bool
- err error
- _ = err
- )
-
- val, ok = pathParams["parent"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")
- }
-
- protoReq.Parent, err = runtime.String(val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)
- }
-
- if err := req.ParseForm(); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_LoggingService_ListLogs_1); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := client.ListLogs(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-
-}
-
-func local_request_LoggingService_ListLogs_1(ctx context.Context, marshaler runtime.Marshaler, server LoggingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq ListLogsRequest
- var metadata runtime.ServerMetadata
-
- var (
- val string
- ok bool
- err error
- _ = err
- )
-
- val, ok = pathParams["parent"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")
- }
-
- protoReq.Parent, err = runtime.String(val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)
- }
-
- if err := req.ParseForm(); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_LoggingService_ListLogs_1); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := server.ListLogs(ctx, &protoReq)
- return msg, metadata, err
-
-}
-
// RegisterLoggingServiceHandlerServer registers the http handlers for service LoggingService to "mux".
// UnaryRPC :call LoggingServiceServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterLoggingServiceHandlerFromEndpoint instead.
func RegisterLoggingServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server LoggingServiceServer) error {
- mux.Handle("POST", pattern_LoggingService_ListLogs_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ mux.Handle("GET", pattern_LoggingService_ListLogs_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
@@ -185,7 +81,7 @@ func RegisterLoggingServiceHandlerServer(ctx context.Context, mux *runtime.Serve
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.LoggingService/ListLogs", runtime.WithHTTPPathPattern("/v1/{parent=projects/*}/logs"))
+ annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.LoggingService/ListLogs", runtime.WithHTTPPathPattern("/v1/logs:search"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -202,31 +98,6 @@ func RegisterLoggingServiceHandlerServer(ctx context.Context, mux *runtime.Serve
})
- mux.Handle("POST", pattern_LoggingService_ListLogs_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(req.Context())
- defer cancel()
- var stream runtime.ServerTransportStream
- ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- var err error
- var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.LoggingService/ListLogs", runtime.WithHTTPPathPattern("/v1/{parent=workspaces/*}/logs"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := local_request_LoggingService_ListLogs_1(annotatedContext, inboundMarshaler, server, req, pathParams)
- md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
- annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
- if err != nil {
- runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
- return
- }
-
- forward_LoggingService_ListLogs_1(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
return nil
}
@@ -268,13 +139,13 @@ func RegisterLoggingServiceHandler(ctx context.Context, mux *runtime.ServeMux, c
// "LoggingServiceClient" to call the correct interceptors.
func RegisterLoggingServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client LoggingServiceClient) error {
- mux.Handle("POST", pattern_LoggingService_ListLogs_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ mux.Handle("GET", pattern_LoggingService_ListLogs_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.LoggingService/ListLogs", runtime.WithHTTPPathPattern("/v1/{parent=projects/*}/logs"))
+ annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.LoggingService/ListLogs", runtime.WithHTTPPathPattern("/v1/logs:search"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -290,39 +161,13 @@ func RegisterLoggingServiceHandlerClient(ctx context.Context, mux *runtime.Serve
})
- mux.Handle("POST", pattern_LoggingService_ListLogs_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(req.Context())
- defer cancel()
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- var err error
- var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.LoggingService/ListLogs", runtime.WithHTTPPathPattern("/v1/{parent=workspaces/*}/logs"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := request_LoggingService_ListLogs_1(annotatedContext, inboundMarshaler, client, req, pathParams)
- annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
- if err != nil {
- runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
- return
- }
-
- forward_LoggingService_ListLogs_1(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
return nil
}
var (
- pattern_LoggingService_ListLogs_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"v1", "projects", "parent", "logs"}, ""))
-
- pattern_LoggingService_ListLogs_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"v1", "workspaces", "parent", "logs"}, ""))
+ pattern_LoggingService_ListLogs_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "logs"}, "search"))
)
var (
forward_LoggingService_ListLogs_0 = runtime.ForwardResponseMessage
-
- forward_LoggingService_ListLogs_1 = runtime.ForwardResponseMessage
)
diff --git a/proto/v1/logging_service.proto b/proto/v1/logging_service.proto
index faf369ffc2..21e33631a1 100644
--- a/proto/v1/logging_service.proto
+++ b/proto/v1/logging_service.proto
@@ -3,40 +3,43 @@ syntax = "proto3";
package bytebase.v1;
import "google/api/annotations.proto";
-import "google/api/client.proto";
import "google/api/field_behavior.proto";
-import "google/protobuf/struct.proto";
import "google/protobuf/timestamp.proto";
option go_package = "generated-go/v1";
service LoggingService {
rpc ListLogs(ListLogsRequest) returns (ListLogsResponse) {
- option (google.api.http) = {
- post: "/v1/{parent=projects/*}/logs"
- additional_bindings: {post: "/v1/{parent=workspaces/*}/logs"}
- };
- option (google.api.method_signature) = "parent";
+ option (google.api.http) = {get: "/v1/logs:search"};
}
}
message ListLogsRequest {
- // The parent resource name.
- // Format:
- // projects/{project}
- // workspaces/{workspace}
- string parent = 1 [(google.api.field_behavior) = REQUIRED];
-
// 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
- // - container
- // - level
- // - action
+ // - 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"'
+ string filter = 1;
+
+ // The order by of the log.
+ // Only support order by create_time.
// For example:
- // List the logs of type 'ACTION_ISSUE_COMMENT_CREATE' in issue/123: 'action="ACTION_ISSUE_COMMENT_CREATE", container="issue/123"'
- string filter = 2;
+ // - order_by = "create_time acs"
+ // - order_by = "create_time desc"
+ string order_by = 2;
// Not used. The maximum number of logs to return.
// The service may return fewer than this value.
@@ -50,29 +53,33 @@ message ListLogsRequest {
}
message ListLogsResponse {
- // The list of log entries.
- repeated LogEntry log_entries = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
+ // The list of log entities.
+ repeated LogEntity log_entities = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
- // A token to retrieve next page of log entries.
+ // 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 entries.
+ // to retrieve the next page of log entities.
string next_page_token = 2;
}
-message LogEntry {
- // The creator of the log entry.
- // Format: users/{emailid}
- string creator = 1 [(google.api.field_behavior) = REQUIRED];
+message LogEntity {
+ // The name of the log.
+ // Format: logs/{uid}
+ string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
- // The timestamp when the backup resource was created initally.
- google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
+ // The creator of the log entity.
+ // Format: users/{email}
+ string creator = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
- // The timestamp when the backup resource was updated.
- google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
+ // The timestamp when the backup resource was created initally.
+ google.protobuf.Timestamp create_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
enum Action {
ACTION_UNSPECIFIED = 0;
// In worksapce resource only.
+
+ // Member related activity types.
+ // Enum value 1 - 20
//
// ACTION_MEMBER_CREATE is the type for creating a new member.
ACTION_MEMBER_CREATE = 1;
@@ -84,49 +91,56 @@ message LogEntry {
ACTION_MEMBER_DEACTIVE = 4;
// In project resource only.
+
+ // Issue related activity types.
+ // Enum value 21 - 40
//
// ACTION_ISSUE_CREATE is the type for creating a new issue.
- ACTION_ISSUE_CREATE = 5;
+ ACTION_ISSUE_CREATE = 21;
// ACTION_ISSUE_COMMENT_CREATE is the type for creating a new comment on an issue.
- ACTION_ISSUE_COMMENT_CREATE = 6;
+ ACTION_ISSUE_COMMENT_CREATE = 22;
// ACTION_ISSUE_FIELD_UPDATE is the type for updating an issue's field.
- ACTION_ISSUE_FIELD_UPDATE = 7;
+ ACTION_ISSUE_FIELD_UPDATE = 23;
// ACTION_ISSUE_STATUS_UPDATE is the type for updating an issue's status.
- ACTION_ISSUE_STATUS_UPDATE = 8;
-
- // ACTION_PIPELINE_STAGE_STATUS_UPDATE is the type for stage begins or ends.
- ACTION_PIPELINE_STAGE_STATUS_UPDATE = 9;
- // ACTION_PIPELINE_TASK_STATUS_UPDATE is the type for updating pipeline task status.
- ACTION_PIPELINE_TASK_STATUS_UPDATE = 10;
- // ACTION_PIPELINE_TASK_FILE_COMMIT is the type for committing pipeline task files.
- ACTION_PIPELINE_TASK_FILE_COMMIT = 11;
- // ACTION_PIPELINE_TASK_STATEMENT_UPDATE is the type for updating pipeline task SQL statement.
- ACTION_PIPELINE_TASK_STATEMENT_UPDATE = 12;
- // ACTION_PIPELINE_TASK_EARLIEST_ALLOWED_DATE_UPDATE is the type for updating pipeline task the earliest allowed time.
- ACITON_PIPELINE_TASK_EARLIEST_ALLOWED_DATE_UPDATE = 13;
-
- // ACTION_PROJECT_MEMBER_CREATE is the type for creating a new project member.
- ACTION_PROJECT_MEMBER_CREATE = 14;
- // ACTION_PROJECT_MEMBER_ROLE_UPDATE is the type for updating a project member's role.
- ACTION_PROJECT_MEMBER_ROLE_UPDATE = 15;
- // ACTION_PROJECT_MEMBER_DELETE is the type for deleting a project member.
- ACTION_PROJECT_MEMBER_DELETE = 16;
-
- // ACTION_PROJECT_REPOSITORY_PUSH is the type for pushing to a project repository.
- ACTION_PROJECT_REPOSITORY_PUSH = 17;
-
- // ACTION_PROJECT_DATABASE_TRANSFER is the type for transferring a database to a project.
- ACTION_PROJECT_DTABASE_TRANSFER = 18;
-
+ ACTION_ISSUE_STATUS_UPDATE = 24;
+ // ACTION_ISSUE_APPROVAL_NOTIFY is the type for notifying issue approval.
+ ACTION_ISSUE_APPROVAL_NOTIFY = 25;
+ // ACTION_PIPELINE_STAGE_STATUS_UPDATE represents the pipeline stage status change, including BEGIN, END for now.
+ ACTION_PIPELINE_STAGE_STATUS_UPDATE = 31;
+ // ACTION_PIPELINE_TASK_STATUS_UPDATE represents the pipeline task status change, including PENDING, PENDING_APPROVAL, RUNNING, SUCCESS, FAILURE, CANCELED for now.
+ ACTION_PIPELINE_TASK_STATUS_UPDATE = 32;
+ // ACTION_PIPELINE_TASK_FILE_COMMIT represents the VCS trigger to commit a file to update the task statement.
+ ACTION_PIPELINE_TASK_FILE_COMMIT = 33;
+ // ACTION_PIPELINE_TASK_STATEMENT_UPDATE represents the manual update of the task statement.
+ ACTION_PIPELINE_TASK_STATEMENT_UPDATE = 34;
+ // ACTION_PIPELINE_TASK_EARLIEST_ALLOWED_TIME_UPDATE represents the manual update of the task earliest allowed time.
+ ACTION_PIPELINE_TASK_EARLIEST_ALLOWED_TIME_UPDATE = 35;
+
+ // Project related activity types.
+ // Enum value 41 - 60
+ //
+ // ACTION_PROJECT_REPOSITORY_PUSH represents Bytebase receiving a push event from the project repository.
+ ACTION_PROJECT_REPOSITORY_PUSH = 41;
+ // ACTION_PROJECT_MEMBER_CREATE represents adding a member to the project.
+ ACTION_PROJECT_MEMBER_CREATE = 42;
+ // ACTION_PROJECT_MEMBER_DELETE represents removing a member from the project.
+ ACTION_PROJECT_MEMBER_DELETE = 43;
+ // ACTION_PROJECT_MEMBER_ROLE_UPDATE represents updating the member role, for example, from ADMIN to MEMBER.
+ ACTION_PROJECT_MEMBER_ROLE_UPDATE = 44;
// ACTION_PROJECT_DATABASE_RECOVERY_PITR_DONE is the type for database PITR recovery done.
- ACTION_PROJECT_DATABASE_RECOVERY_PITR_DONE = 19;
+ ACTION_PROJECT_DATABASE_RECOVERY_PITR_DONE = 45;
+ // ACTION_PROJECT_DATABASE_TRANSFER represents transfering the database from one project to another.
+ ACTION_PROJECT_DATABASE_TRANSFER = 46;
- // Both in workspace and project resource.
+ // In instance resource only.
+
+ // Database related activity types.
+ // Enum value 61 - 80
//
- // ACTION_SQL_EDITOR_QUERY is the type for SQL editor query.
- // If user runs SQL in Read-only mode, this action will belong to project resource.
- // If user runs SQL in Read-write mode, this action will belong to workspace resource.
- ACTION_SQL_EDITOR_QUERY = 20;
+ // ACTION_DATABASE_SQL_EDITOR_QUERY is the type for SQL editor query.
+ ACTION_DATABASE_SQL_EDITOR_QUERY = 61;
+ // ACTION_DATABASE_SQL_EXPORT is the type for exporting SQL.
+ ACTION_DATABASE_SQL_EXPORT = 62;
}
Action action = 4 [(google.api.field_behavior) = REQUIRED];
@@ -139,17 +153,20 @@ message LogEntry {
// LEVEL_ERROR is the type for error.
LEVEL_ERROR = 3;
}
- Level level = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
+ Level level = 5 [(google.api.field_behavior) = REQUIRED];
- // The name of the resource associated with this log entry. For example, the resource user associated with log entry type of "ACTION_MEMBER_CREATE".
+ // 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}
- // For ACTION_PIPELINE_*: pipelines/{pipeline}
- // For ACTION_PROJECT_*: projects/{project}
- // For ACTION_SQL_EDITOR_QUERY: workspaces/{workspace} OR projects/{project}
- string resource_name = 6 [(google.api.field_behavior) = REQUIRED];
-
- // The payload of the log entry.
- google.protobuf.Struct json_payload = 7;
+ // 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}
+ string resource = 6 [(google.api.field_behavior) = REQUIRED];
+
+ // The payload of the log entity.
+ // TODO: use oneof
+ string payload = 7 [(google.api.field_behavior) = REQUIRED];
+
+ string comment = 8;
}