diff --git a/internal/connectors/db/yql/schema/create_tables.yql b/internal/connectors/db/yql/schema/create_tables.yql index 90fc9907..4bd3ea99 100644 --- a/internal/connectors/db/yql/schema/create_tables.yql +++ b/internal/connectors/db/yql/schema/create_tables.yql @@ -66,7 +66,7 @@ CREATE TABLE BackupSchedules ( database String NOT NULL, endpoint String NOT NULL, name String, - active Bool NOT NULL, + status String, crontab String NOT NULL, ttl Interval, diff --git a/internal/server/services/backup_schedule/backup_schedule_service.go b/internal/server/services/backup_schedule/backup_schedule_service.go index d23416d3..cfc25d27 100644 --- a/internal/server/services/backup_schedule/backup_schedule_service.go +++ b/internal/server/services/backup_schedule/backup_schedule_service.go @@ -144,7 +144,7 @@ func (s *BackupScheduleService) UpdateBackupSchedule( schedule := schedules[0] ctx = xlog.With(ctx, zap.String("ContainerID", schedule.ContainerID)) // TODO: Need to check access to backup schedule not by container id? - subject, err := auth.CheckAuth(ctx, s.auth, auth.PermissionBackupGet, schedule.ContainerID, "") + subject, err := auth.CheckAuth(ctx, s.auth, auth.PermissionBackupCreate, schedule.ContainerID, "") if err != nil { return nil, err } @@ -307,6 +307,58 @@ func (s *BackupScheduleService) ToggleBackupSchedule( return nil, status.Error(codes.Internal, "not implemented") } +func (s *BackupScheduleService) DeleteBackupSchedule( + ctx context.Context, request *pb.DeleteBackupScheduleRequest, +) (*pb.BackupSchedule, error) { + ctx = grpcinfo.WithGRPCInfo(ctx) + + scheduleID := request.GetId() + ctx = xlog.With(ctx, zap.String("BackupScheduleID", scheduleID)) + + xlog.Debug(ctx, "DeleteBackupSchedule", zap.Stringer("request", request)) + + schedules, err := s.driver.SelectBackupSchedulesWithRPOInfo( + ctx, queries.NewReadTableQuery( + queries.WithRawQuery(GetScheduleQuery), + queries.WithParameters( + table.ValueParam("$schedule_id", table_types.StringValueFromString(scheduleID)), + ), + ), + ) + + if err != nil { + xlog.Error(ctx, "error getting backup schedule", zap.Error(err)) + return nil, status.Error(codes.Internal, "error getting backup schedule") + } + if len(schedules) == 0 { + xlog.Error(ctx, "backup schedule not found") + return nil, status.Error(codes.NotFound, "backup schedule not found") + } + + schedule := schedules[0] + ctx = xlog.With(ctx, zap.String("ContainerID", schedule.ContainerID)) + // TODO: Need to check access to backup schedule not by container id? + subject, err := auth.CheckAuth(ctx, s.auth, auth.PermissionBackupCreate, schedule.ContainerID, "") + if err != nil { + return nil, err + } + ctx = xlog.With(ctx, zap.String("SubjectID", subject)) + + // TODO: set status to deleted + + err = s.driver.ExecuteUpsert(ctx, queries.NewWriteTableQuery().WithUpdateBackupSchedule(*schedule)) + if err != nil { + xlog.Error( + ctx, "can't delete backup schedule", zap.String("backup schedule", schedule.Proto().String()), + zap.Error(err), + ) + return nil, status.Error(codes.Internal, "can't delete backup schedule") + } + + xlog.Info(ctx, "DeleteBackupSchedule was completed successfully", zap.Stringer("schedule", schedule)) + return schedule.Proto(), nil +} + func (s *BackupScheduleService) Register(server server.Server) { pb.RegisterBackupScheduleServiceServer(server.GRPCServer(), s) } diff --git a/internal/types/backup.go b/internal/types/backup.go index 9bf24923..d00ca241 100644 --- a/internal/types/backup.go +++ b/internal/types/backup.go @@ -10,6 +10,17 @@ import ( "github.com/google/uuid" ) +var ( + BackupStateUnknown = pb.Backup_STATUS_UNSPECIFIED.String() + BackupStatePending = pb.Backup_PENDING.String() + BackupStateRunning = pb.Backup_RUNNING.String() + BackupStateAvailable = pb.Backup_AVAILABLE.String() + BackupStateError = pb.Backup_ERROR.String() + BackupStateCancelled = pb.Backup_CANCELLED.String() + BackupStateDeleting = pb.Backup_DELETING.String() + BackupStateDeleted = pb.Backup_DELETED.String() +) + func GenerateObjectID() string { return uuid.New().String() } diff --git a/internal/types/backup_schedule.go b/internal/types/backup_schedule.go index a6a713d7..bfa34c21 100644 --- a/internal/types/backup_schedule.go +++ b/internal/types/backup_schedule.go @@ -11,6 +11,13 @@ import ( "google.golang.org/protobuf/types/known/timestamppb" ) +var ( + ScheduleStateUnknown = pb.BackupSchedule_STATUS_UNSPECIFIED.String() + ScheduleStateActive = pb.BackupSchedule_ACTIVE.String() + ScheduleStateInactive = pb.BackupSchedule_INACTIVE.String() + ScheduleStateDeleted = pb.BackupSchedule_DELETED.String() +) + type BackupSchedule struct { ID string ContainerID string @@ -20,7 +27,7 @@ type BackupSchedule struct { SourcePathsToExclude []string Audit *pb.AuditInfo Name *string - Active bool + Status string ScheduleSettings *pb.BackupScheduleSettings NextLaunch *time.Time LastBackupID *string @@ -55,7 +62,7 @@ func (b *BackupSchedule) Proto() *pb.BackupSchedule { DatabaseName: b.DatabaseName, Endpoint: b.DatabaseEndpoint, Audit: b.Audit, - Active: b.Active, + Status: pb.BackupSchedule_Status(pb.BackupSchedule_Status_value[b.Status]), ScheduleSettings: b.ScheduleSettings, SourcePaths: b.SourcePaths, SourcePathsToExclude: b.SourcePathsToExclude, @@ -70,12 +77,13 @@ func (b *BackupSchedule) Proto() *pb.BackupSchedule { func (b *BackupSchedule) String() string { return fmt.Sprintf( - "ID: %s, Name: %s, ContainerID: %s, DatabaseEndpoint: %s, DatabaseName: %s", + "ID: %s, Name: %s, ContainerID: %s, DatabaseEndpoint: %s, DatabaseName: %s, Status: %s", b.ID, *b.Name, b.ContainerID, b.DatabaseEndpoint, b.DatabaseName, + b.Status, ) } diff --git a/internal/types/operation.go b/internal/types/operation.go index ad1fcbad..07cebcbc 100644 --- a/internal/types/operation.go +++ b/internal/types/operation.go @@ -318,15 +318,6 @@ var ( OperationStateCancelling = OperationState(pb.Operation_CANCELLING.String()) OperationStateCancelled = OperationState(pb.Operation_CANCELED.String()) OperationStateStartCancelling = OperationState(pb.Operation_START_CANCELLING.String()) - - BackupStateUnknown = pb.Backup_STATUS_UNSPECIFIED.String() - BackupStatePending = pb.Backup_PENDING.String() - BackupStateRunning = pb.Backup_RUNNING.String() - BackupStateAvailable = pb.Backup_AVAILABLE.String() - BackupStateError = pb.Backup_ERROR.String() - BackupStateCancelled = pb.Backup_CANCELLED.String() - BackupStateDeleting = pb.Backup_DELETING.String() - BackupStateDeleted = pb.Backup_DELETED.String() ) const ( diff --git a/pkg/proto/ydbcp/v1alpha1/backup_schedule.pb.go b/pkg/proto/ydbcp/v1alpha1/backup_schedule.pb.go index 8a2cc4e4..c8874077 100644 --- a/pkg/proto/ydbcp/v1alpha1/backup_schedule.pb.go +++ b/pkg/proto/ydbcp/v1alpha1/backup_schedule.pb.go @@ -22,6 +22,58 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +type BackupSchedule_Status int32 + +const ( + BackupSchedule_STATUS_UNSPECIFIED BackupSchedule_Status = 0 + BackupSchedule_ACTIVE BackupSchedule_Status = 1 + BackupSchedule_INACTIVE BackupSchedule_Status = 2 + BackupSchedule_DELETED BackupSchedule_Status = 3 +) + +// Enum value maps for BackupSchedule_Status. +var ( + BackupSchedule_Status_name = map[int32]string{ + 0: "STATUS_UNSPECIFIED", + 1: "ACTIVE", + 2: "INACTIVE", + 3: "DELETED", + } + BackupSchedule_Status_value = map[string]int32{ + "STATUS_UNSPECIFIED": 0, + "ACTIVE": 1, + "INACTIVE": 2, + "DELETED": 3, + } +) + +func (x BackupSchedule_Status) Enum() *BackupSchedule_Status { + p := new(BackupSchedule_Status) + *p = x + return p +} + +func (x BackupSchedule_Status) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (BackupSchedule_Status) Descriptor() protoreflect.EnumDescriptor { + return file_ydbcp_v1alpha1_backup_schedule_proto_enumTypes[0].Descriptor() +} + +func (BackupSchedule_Status) Type() protoreflect.EnumType { + return &file_ydbcp_v1alpha1_backup_schedule_proto_enumTypes[0] +} + +func (x BackupSchedule_Status) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use BackupSchedule_Status.Descriptor instead. +func (BackupSchedule_Status) EnumDescriptor() ([]byte, []int) { + return file_ydbcp_v1alpha1_backup_schedule_proto_rawDescGZIP(), []int{3, 0} +} + type BackupSchedulePattern struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -217,7 +269,7 @@ type BackupSchedule struct { SourcePathsToExclude []string `protobuf:"bytes,6,rep,name=source_paths_to_exclude,json=sourcePathsToExclude,proto3" json:"source_paths_to_exclude,omitempty"` // [(size) = "<=256"]; Audit *AuditInfo `protobuf:"bytes,7,opt,name=audit,proto3" json:"audit,omitempty"` ScheduleName string `protobuf:"bytes,8,opt,name=schedule_name,json=scheduleName,proto3" json:"schedule_name,omitempty"` - Active bool `protobuf:"varint,9,opt,name=active,proto3" json:"active,omitempty"` + Status BackupSchedule_Status `protobuf:"varint,9,opt,name=status,proto3,enum=ydbcp.v1alpha1.BackupSchedule_Status" json:"status,omitempty"` ScheduleSettings *BackupScheduleSettings `protobuf:"bytes,10,opt,name=schedule_settings,json=scheduleSettings,proto3" json:"schedule_settings,omitempty"` NextLaunch *timestamppb.Timestamp `protobuf:"bytes,11,opt,name=next_launch,json=nextLaunch,proto3" json:"next_launch,omitempty"` LastSuccessfulBackupInfo *ScheduledBackupInfo `protobuf:"bytes,12,opt,name=last_successful_backup_info,json=lastSuccessfulBackupInfo,proto3" json:"last_successful_backup_info,omitempty"` @@ -311,11 +363,11 @@ func (x *BackupSchedule) GetScheduleName() string { return "" } -func (x *BackupSchedule) GetActive() bool { +func (x *BackupSchedule) GetStatus() BackupSchedule_Status { if x != nil { - return x.Active + return x.Status } - return false + return BackupSchedule_STATUS_UNSPECIFIED } func (x *BackupSchedule) GetScheduleSettings() *BackupScheduleSettings { @@ -387,7 +439,7 @@ var file_ydbcp_v1alpha1_backup_schedule_proto_rawDesc = []byte{ 0x70, 0x6f, 0x5f, 0x6d, 0x61, 0x72, 0x67, 0x69, 0x6e, 0x5f, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x52, 0x18, 0x6c, 0x61, 0x73, 0x74, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x52, 0x70, 0x6f, 0x4d, 0x61, 0x72, 0x67, 0x69, 0x6e, 0x52, 0x61, 0x74, 0x69, 0x6f, 0x22, - 0xc2, 0x04, 0x0a, 0x0e, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, + 0xb2, 0x05, 0x0a, 0x0e, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, @@ -406,24 +458,31 @@ var file_ydbcp_v1alpha1_backup_schedule_proto_rawDesc = []byte{ 0x2e, 0x41, 0x75, 0x64, 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x61, 0x75, 0x64, 0x69, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, - 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, - 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x12, 0x53, - 0x0a, 0x11, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, - 0x6e, 0x67, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x79, 0x64, 0x62, 0x63, - 0x70, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x42, 0x61, 0x63, 0x6b, 0x75, - 0x70, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, - 0x73, 0x52, 0x10, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, - 0x6e, 0x67, 0x73, 0x12, 0x3b, 0x0a, 0x0b, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x6c, 0x61, 0x75, 0x6e, - 0x63, 0x68, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, - 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x6e, 0x65, 0x78, 0x74, 0x4c, 0x61, 0x75, 0x6e, 0x63, 0x68, - 0x12, 0x62, 0x0a, 0x1b, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, - 0x66, 0x75, 0x6c, 0x5f, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, - 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x79, 0x64, 0x62, 0x63, 0x70, 0x2e, 0x76, 0x31, - 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x64, - 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x18, 0x6c, 0x61, 0x73, 0x74, - 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x66, 0x75, 0x6c, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, - 0x49, 0x6e, 0x66, 0x6f, 0x42, 0x3e, 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x3d, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x18, 0x09, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x25, 0x2e, 0x79, 0x64, 0x62, 0x63, 0x70, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x53, 0x63, + 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x53, 0x0a, 0x11, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, + 0x65, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x26, 0x2e, 0x79, 0x64, 0x62, 0x63, 0x70, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, + 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x10, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, + 0x6c, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x3b, 0x0a, 0x0b, 0x6e, 0x65, + 0x78, 0x74, 0x5f, 0x6c, 0x61, 0x75, 0x6e, 0x63, 0x68, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x6e, 0x65, 0x78, + 0x74, 0x4c, 0x61, 0x75, 0x6e, 0x63, 0x68, 0x12, 0x62, 0x0a, 0x1b, 0x6c, 0x61, 0x73, 0x74, 0x5f, + 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x66, 0x75, 0x6c, 0x5f, 0x62, 0x61, 0x63, 0x6b, 0x75, + 0x70, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x79, + 0x64, 0x62, 0x63, 0x70, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x53, 0x63, + 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x64, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x49, 0x6e, 0x66, + 0x6f, 0x52, 0x18, 0x6c, 0x61, 0x73, 0x74, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x66, 0x75, + 0x6c, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x47, 0x0a, 0x06, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, + 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0a, 0x0a, + 0x06, 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x49, 0x4e, 0x41, + 0x43, 0x54, 0x49, 0x56, 0x45, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x44, 0x45, 0x4c, 0x45, 0x54, + 0x45, 0x44, 0x10, 0x03, 0x42, 0x3e, 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x79, 0x64, 0x62, 0x2d, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2f, 0x79, 0x64, 0x62, 0x63, 0x70, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x79, 0x64, 0x62, 0x63, 0x70, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x79, @@ -442,31 +501,34 @@ func file_ydbcp_v1alpha1_backup_schedule_proto_rawDescGZIP() []byte { return file_ydbcp_v1alpha1_backup_schedule_proto_rawDescData } +var file_ydbcp_v1alpha1_backup_schedule_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_ydbcp_v1alpha1_backup_schedule_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_ydbcp_v1alpha1_backup_schedule_proto_goTypes = []interface{}{ - (*BackupSchedulePattern)(nil), // 0: ydbcp.v1alpha1.BackupSchedulePattern - (*BackupScheduleSettings)(nil), // 1: ydbcp.v1alpha1.BackupScheduleSettings - (*ScheduledBackupInfo)(nil), // 2: ydbcp.v1alpha1.ScheduledBackupInfo - (*BackupSchedule)(nil), // 3: ydbcp.v1alpha1.BackupSchedule - (*durationpb.Duration)(nil), // 4: google.protobuf.Duration - (*timestamppb.Timestamp)(nil), // 5: google.protobuf.Timestamp - (*AuditInfo)(nil), // 6: ydbcp.v1alpha1.AuditInfo + (BackupSchedule_Status)(0), // 0: ydbcp.v1alpha1.BackupSchedule.Status + (*BackupSchedulePattern)(nil), // 1: ydbcp.v1alpha1.BackupSchedulePattern + (*BackupScheduleSettings)(nil), // 2: ydbcp.v1alpha1.BackupScheduleSettings + (*ScheduledBackupInfo)(nil), // 3: ydbcp.v1alpha1.ScheduledBackupInfo + (*BackupSchedule)(nil), // 4: ydbcp.v1alpha1.BackupSchedule + (*durationpb.Duration)(nil), // 5: google.protobuf.Duration + (*timestamppb.Timestamp)(nil), // 6: google.protobuf.Timestamp + (*AuditInfo)(nil), // 7: ydbcp.v1alpha1.AuditInfo } var file_ydbcp_v1alpha1_backup_schedule_proto_depIdxs = []int32{ - 0, // 0: ydbcp.v1alpha1.BackupScheduleSettings.schedule_pattern:type_name -> ydbcp.v1alpha1.BackupSchedulePattern - 4, // 1: ydbcp.v1alpha1.BackupScheduleSettings.ttl:type_name -> google.protobuf.Duration - 4, // 2: ydbcp.v1alpha1.BackupScheduleSettings.recovery_point_objective:type_name -> google.protobuf.Duration - 5, // 3: ydbcp.v1alpha1.ScheduledBackupInfo.recovery_point:type_name -> google.protobuf.Timestamp - 4, // 4: ydbcp.v1alpha1.ScheduledBackupInfo.last_backup_rpo_margin_interval:type_name -> google.protobuf.Duration - 6, // 5: ydbcp.v1alpha1.BackupSchedule.audit:type_name -> ydbcp.v1alpha1.AuditInfo - 1, // 6: ydbcp.v1alpha1.BackupSchedule.schedule_settings:type_name -> ydbcp.v1alpha1.BackupScheduleSettings - 5, // 7: ydbcp.v1alpha1.BackupSchedule.next_launch:type_name -> google.protobuf.Timestamp - 2, // 8: ydbcp.v1alpha1.BackupSchedule.last_successful_backup_info:type_name -> ydbcp.v1alpha1.ScheduledBackupInfo - 9, // [9:9] is the sub-list for method output_type - 9, // [9:9] is the sub-list for method input_type - 9, // [9:9] is the sub-list for extension type_name - 9, // [9:9] is the sub-list for extension extendee - 0, // [0:9] is the sub-list for field type_name + 1, // 0: ydbcp.v1alpha1.BackupScheduleSettings.schedule_pattern:type_name -> ydbcp.v1alpha1.BackupSchedulePattern + 5, // 1: ydbcp.v1alpha1.BackupScheduleSettings.ttl:type_name -> google.protobuf.Duration + 5, // 2: ydbcp.v1alpha1.BackupScheduleSettings.recovery_point_objective:type_name -> google.protobuf.Duration + 6, // 3: ydbcp.v1alpha1.ScheduledBackupInfo.recovery_point:type_name -> google.protobuf.Timestamp + 5, // 4: ydbcp.v1alpha1.ScheduledBackupInfo.last_backup_rpo_margin_interval:type_name -> google.protobuf.Duration + 7, // 5: ydbcp.v1alpha1.BackupSchedule.audit:type_name -> ydbcp.v1alpha1.AuditInfo + 0, // 6: ydbcp.v1alpha1.BackupSchedule.status:type_name -> ydbcp.v1alpha1.BackupSchedule.Status + 2, // 7: ydbcp.v1alpha1.BackupSchedule.schedule_settings:type_name -> ydbcp.v1alpha1.BackupScheduleSettings + 6, // 8: ydbcp.v1alpha1.BackupSchedule.next_launch:type_name -> google.protobuf.Timestamp + 3, // 9: ydbcp.v1alpha1.BackupSchedule.last_successful_backup_info:type_name -> ydbcp.v1alpha1.ScheduledBackupInfo + 10, // [10:10] is the sub-list for method output_type + 10, // [10:10] is the sub-list for method input_type + 10, // [10:10] is the sub-list for extension type_name + 10, // [10:10] is the sub-list for extension extendee + 0, // [0:10] is the sub-list for field type_name } func init() { file_ydbcp_v1alpha1_backup_schedule_proto_init() } @@ -530,13 +592,14 @@ func file_ydbcp_v1alpha1_backup_schedule_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_ydbcp_v1alpha1_backup_schedule_proto_rawDesc, - NumEnums: 0, + NumEnums: 1, NumMessages: 4, NumExtensions: 0, NumServices: 0, }, GoTypes: file_ydbcp_v1alpha1_backup_schedule_proto_goTypes, DependencyIndexes: file_ydbcp_v1alpha1_backup_schedule_proto_depIdxs, + EnumInfos: file_ydbcp_v1alpha1_backup_schedule_proto_enumTypes, MessageInfos: file_ydbcp_v1alpha1_backup_schedule_proto_msgTypes, }.Build() File_ydbcp_v1alpha1_backup_schedule_proto = out.File diff --git a/pkg/proto/ydbcp/v1alpha1/backup_schedule.proto b/pkg/proto/ydbcp/v1alpha1/backup_schedule.proto index 1c92988c..a0280f4b 100644 --- a/pkg/proto/ydbcp/v1alpha1/backup_schedule.proto +++ b/pkg/proto/ydbcp/v1alpha1/backup_schedule.proto @@ -26,6 +26,13 @@ message ScheduledBackupInfo { } message BackupSchedule { + enum Status { + STATUS_UNSPECIFIED = 0; + ACTIVE = 1; + INACTIVE = 2; + DELETED = 3; + } + //backup settings string id = 1; string container_id = 2; @@ -37,7 +44,7 @@ message BackupSchedule { ydbcp.v1alpha1.AuditInfo audit = 7; string schedule_name = 8; - bool active = 9; + Status status = 9; BackupScheduleSettings schedule_settings = 10; diff --git a/pkg/proto/ydbcp/v1alpha1/backup_schedule_service.pb.go b/pkg/proto/ydbcp/v1alpha1/backup_schedule_service.pb.go index 3d3e7ad1..b2c37817 100644 --- a/pkg/proto/ydbcp/v1alpha1/backup_schedule_service.pb.go +++ b/pkg/proto/ydbcp/v1alpha1/backup_schedule_service.pb.go @@ -430,6 +430,53 @@ func (x *ToggleBackupScheduleRequest) GetActiveState() bool { return false } +type DeleteBackupScheduleRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *DeleteBackupScheduleRequest) Reset() { + *x = DeleteBackupScheduleRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_ydbcp_v1alpha1_backup_schedule_service_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteBackupScheduleRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteBackupScheduleRequest) ProtoMessage() {} + +func (x *DeleteBackupScheduleRequest) ProtoReflect() protoreflect.Message { + mi := &file_ydbcp_v1alpha1_backup_schedule_service_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteBackupScheduleRequest.ProtoReflect.Descriptor instead. +func (*DeleteBackupScheduleRequest) Descriptor() ([]byte, []int) { + return file_ydbcp_v1alpha1_backup_schedule_service_proto_rawDescGZIP(), []int{6} +} + +func (x *DeleteBackupScheduleRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + var File_ydbcp_v1alpha1_backup_schedule_service_proto protoreflect.FileDescriptor var file_ydbcp_v1alpha1_backup_schedule_service_proto_rawDesc = []byte{ @@ -504,45 +551,54 @@ var file_ydbcp_v1alpha1_backup_schedule_service_proto_rawDesc = []byte{ 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x53, 0x74, 0x61, - 0x74, 0x65, 0x32, 0x95, 0x04, 0x0a, 0x15, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x53, 0x63, 0x68, - 0x65, 0x64, 0x75, 0x6c, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x63, 0x0a, 0x14, - 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x53, 0x63, 0x68, 0x65, - 0x64, 0x75, 0x6c, 0x65, 0x12, 0x2b, 0x2e, 0x79, 0x64, 0x62, 0x63, 0x70, 0x2e, 0x76, 0x31, 0x61, - 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x61, 0x63, 0x6b, + 0x74, 0x65, 0x22, 0x2d, 0x0a, 0x1b, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x1e, 0x2e, 0x79, 0x64, 0x62, 0x63, 0x70, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, - 0x61, 0x31, 0x2e, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, - 0x65, 0x12, 0x63, 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x61, 0x63, 0x6b, 0x75, - 0x70, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x2b, 0x2e, 0x79, 0x64, 0x62, 0x63, - 0x70, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x79, 0x64, 0x62, 0x63, 0x70, 0x2e, 0x76, - 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x53, 0x63, - 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x5d, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x42, 0x61, 0x63, - 0x6b, 0x75, 0x70, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x28, 0x2e, 0x79, 0x64, - 0x62, 0x63, 0x70, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, + 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, + 0x64, 0x32, 0xfa, 0x04, 0x0a, 0x15, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x53, 0x63, 0x68, 0x65, + 0x64, 0x75, 0x6c, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x63, 0x0a, 0x14, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x53, 0x63, 0x68, 0x65, 0x64, + 0x75, 0x6c, 0x65, 0x12, 0x2b, 0x2e, 0x79, 0x64, 0x62, 0x63, 0x70, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x61, 0x63, 0x6b, 0x75, + 0x70, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x1e, 0x2e, 0x79, 0x64, 0x62, 0x63, 0x70, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, + 0x12, 0x63, 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, + 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x2b, 0x2e, 0x79, 0x64, 0x62, 0x63, 0x70, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x79, 0x64, 0x62, 0x63, 0x70, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x53, 0x63, 0x68, - 0x65, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x6e, 0x0a, 0x13, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x61, 0x63, - 0x6b, 0x75, 0x70, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x2a, 0x2e, 0x79, - 0x64, 0x62, 0x63, 0x70, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, - 0x73, 0x74, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, - 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x79, 0x64, 0x62, 0x63, 0x70, - 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x61, - 0x63, 0x6b, 0x75, 0x70, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x63, 0x0a, 0x14, 0x54, 0x6f, 0x67, 0x67, 0x6c, 0x65, 0x42, - 0x61, 0x63, 0x6b, 0x75, 0x70, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x2b, 0x2e, - 0x79, 0x64, 0x62, 0x63, 0x70, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x54, - 0x6f, 0x67, 0x67, 0x6c, 0x65, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x53, 0x63, 0x68, 0x65, 0x64, - 0x75, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x79, 0x64, 0x62, - 0x63, 0x70, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x42, 0x61, 0x63, 0x6b, - 0x75, 0x70, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x42, 0x3e, 0x5a, 0x3c, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x79, 0x64, 0x62, 0x2d, 0x70, 0x6c, 0x61, - 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2f, 0x79, 0x64, 0x62, 0x63, 0x70, 0x2f, 0x70, 0x6b, 0x67, 0x2f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x79, 0x64, 0x62, 0x63, 0x70, 0x2f, 0x76, 0x31, 0x61, 0x6c, - 0x70, 0x68, 0x61, 0x31, 0x3b, 0x79, 0x64, 0x62, 0x63, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x65, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x5d, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x42, 0x61, 0x63, 0x6b, + 0x75, 0x70, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x28, 0x2e, 0x79, 0x64, 0x62, + 0x63, 0x70, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x42, + 0x61, 0x63, 0x6b, 0x75, 0x70, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x79, 0x64, 0x62, 0x63, 0x70, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x53, 0x63, 0x68, 0x65, + 0x64, 0x75, 0x6c, 0x65, 0x12, 0x6e, 0x0a, 0x13, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x61, 0x63, 0x6b, + 0x75, 0x70, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x2a, 0x2e, 0x79, 0x64, + 0x62, 0x63, 0x70, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, + 0x74, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x79, 0x64, 0x62, 0x63, 0x70, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x61, 0x63, + 0x6b, 0x75, 0x70, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x63, 0x0a, 0x14, 0x54, 0x6f, 0x67, 0x67, 0x6c, 0x65, 0x42, 0x61, + 0x63, 0x6b, 0x75, 0x70, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x2b, 0x2e, 0x79, + 0x64, 0x62, 0x63, 0x70, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x54, 0x6f, + 0x67, 0x67, 0x6c, 0x65, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, + 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x79, 0x64, 0x62, 0x63, + 0x70, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x42, 0x61, 0x63, 0x6b, 0x75, + 0x70, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x63, 0x0a, 0x14, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, + 0x65, 0x12, 0x2b, 0x2e, 0x79, 0x64, 0x62, 0x63, 0x70, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x53, + 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, + 0x2e, 0x79, 0x64, 0x62, 0x63, 0x70, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x42, 0x3e, + 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x79, 0x64, 0x62, + 0x2d, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2f, 0x79, 0x64, 0x62, 0x63, 0x70, 0x2f, + 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x79, 0x64, 0x62, 0x63, 0x70, 0x2f, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x79, 0x64, 0x62, 0x63, 0x70, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -557,7 +613,7 @@ func file_ydbcp_v1alpha1_backup_schedule_service_proto_rawDescGZIP() []byte { return file_ydbcp_v1alpha1_backup_schedule_service_proto_rawDescData } -var file_ydbcp_v1alpha1_backup_schedule_service_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_ydbcp_v1alpha1_backup_schedule_service_proto_msgTypes = make([]protoimpl.MessageInfo, 7) var file_ydbcp_v1alpha1_backup_schedule_service_proto_goTypes = []interface{}{ (*CreateBackupScheduleRequest)(nil), // 0: ydbcp.v1alpha1.CreateBackupScheduleRequest (*UpdateBackupScheduleRequest)(nil), // 1: ydbcp.v1alpha1.UpdateBackupScheduleRequest @@ -565,25 +621,28 @@ var file_ydbcp_v1alpha1_backup_schedule_service_proto_goTypes = []interface{}{ (*ListBackupSchedulesResponse)(nil), // 3: ydbcp.v1alpha1.ListBackupSchedulesResponse (*GetBackupScheduleRequest)(nil), // 4: ydbcp.v1alpha1.GetBackupScheduleRequest (*ToggleBackupScheduleRequest)(nil), // 5: ydbcp.v1alpha1.ToggleBackupScheduleRequest - (*BackupScheduleSettings)(nil), // 6: ydbcp.v1alpha1.BackupScheduleSettings - (*BackupSchedule)(nil), // 7: ydbcp.v1alpha1.BackupSchedule + (*DeleteBackupScheduleRequest)(nil), // 6: ydbcp.v1alpha1.DeleteBackupScheduleRequest + (*BackupScheduleSettings)(nil), // 7: ydbcp.v1alpha1.BackupScheduleSettings + (*BackupSchedule)(nil), // 8: ydbcp.v1alpha1.BackupSchedule } var file_ydbcp_v1alpha1_backup_schedule_service_proto_depIdxs = []int32{ - 6, // 0: ydbcp.v1alpha1.CreateBackupScheduleRequest.schedule_settings:type_name -> ydbcp.v1alpha1.BackupScheduleSettings - 6, // 1: ydbcp.v1alpha1.UpdateBackupScheduleRequest.schedule_settings:type_name -> ydbcp.v1alpha1.BackupScheduleSettings - 7, // 2: ydbcp.v1alpha1.ListBackupSchedulesResponse.schedules:type_name -> ydbcp.v1alpha1.BackupSchedule + 7, // 0: ydbcp.v1alpha1.CreateBackupScheduleRequest.schedule_settings:type_name -> ydbcp.v1alpha1.BackupScheduleSettings + 7, // 1: ydbcp.v1alpha1.UpdateBackupScheduleRequest.schedule_settings:type_name -> ydbcp.v1alpha1.BackupScheduleSettings + 8, // 2: ydbcp.v1alpha1.ListBackupSchedulesResponse.schedules:type_name -> ydbcp.v1alpha1.BackupSchedule 0, // 3: ydbcp.v1alpha1.BackupScheduleService.CreateBackupSchedule:input_type -> ydbcp.v1alpha1.CreateBackupScheduleRequest 1, // 4: ydbcp.v1alpha1.BackupScheduleService.UpdateBackupSchedule:input_type -> ydbcp.v1alpha1.UpdateBackupScheduleRequest 4, // 5: ydbcp.v1alpha1.BackupScheduleService.GetBackupSchedule:input_type -> ydbcp.v1alpha1.GetBackupScheduleRequest 2, // 6: ydbcp.v1alpha1.BackupScheduleService.ListBackupSchedules:input_type -> ydbcp.v1alpha1.ListBackupSchedulesRequest 5, // 7: ydbcp.v1alpha1.BackupScheduleService.ToggleBackupSchedule:input_type -> ydbcp.v1alpha1.ToggleBackupScheduleRequest - 7, // 8: ydbcp.v1alpha1.BackupScheduleService.CreateBackupSchedule:output_type -> ydbcp.v1alpha1.BackupSchedule - 7, // 9: ydbcp.v1alpha1.BackupScheduleService.UpdateBackupSchedule:output_type -> ydbcp.v1alpha1.BackupSchedule - 7, // 10: ydbcp.v1alpha1.BackupScheduleService.GetBackupSchedule:output_type -> ydbcp.v1alpha1.BackupSchedule - 3, // 11: ydbcp.v1alpha1.BackupScheduleService.ListBackupSchedules:output_type -> ydbcp.v1alpha1.ListBackupSchedulesResponse - 7, // 12: ydbcp.v1alpha1.BackupScheduleService.ToggleBackupSchedule:output_type -> ydbcp.v1alpha1.BackupSchedule - 8, // [8:13] is the sub-list for method output_type - 3, // [3:8] is the sub-list for method input_type + 6, // 8: ydbcp.v1alpha1.BackupScheduleService.DeleteBackupSchedule:input_type -> ydbcp.v1alpha1.DeleteBackupScheduleRequest + 8, // 9: ydbcp.v1alpha1.BackupScheduleService.CreateBackupSchedule:output_type -> ydbcp.v1alpha1.BackupSchedule + 8, // 10: ydbcp.v1alpha1.BackupScheduleService.UpdateBackupSchedule:output_type -> ydbcp.v1alpha1.BackupSchedule + 8, // 11: ydbcp.v1alpha1.BackupScheduleService.GetBackupSchedule:output_type -> ydbcp.v1alpha1.BackupSchedule + 3, // 12: ydbcp.v1alpha1.BackupScheduleService.ListBackupSchedules:output_type -> ydbcp.v1alpha1.ListBackupSchedulesResponse + 8, // 13: ydbcp.v1alpha1.BackupScheduleService.ToggleBackupSchedule:output_type -> ydbcp.v1alpha1.BackupSchedule + 8, // 14: ydbcp.v1alpha1.BackupScheduleService.DeleteBackupSchedule:output_type -> ydbcp.v1alpha1.BackupSchedule + 9, // [9:15] is the sub-list for method output_type + 3, // [3:9] is the sub-list for method input_type 3, // [3:3] is the sub-list for extension type_name 3, // [3:3] is the sub-list for extension extendee 0, // [0:3] is the sub-list for field type_name @@ -668,6 +727,18 @@ func file_ydbcp_v1alpha1_backup_schedule_service_proto_init() { return nil } } + file_ydbcp_v1alpha1_backup_schedule_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) any { + switch v := v.(*DeleteBackupScheduleRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -675,7 +746,7 @@ func file_ydbcp_v1alpha1_backup_schedule_service_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_ydbcp_v1alpha1_backup_schedule_service_proto_rawDesc, NumEnums: 0, - NumMessages: 6, + NumMessages: 7, NumExtensions: 0, NumServices: 1, }, diff --git a/pkg/proto/ydbcp/v1alpha1/backup_schedule_service.proto b/pkg/proto/ydbcp/v1alpha1/backup_schedule_service.proto index f87717f2..65ef1cc6 100644 --- a/pkg/proto/ydbcp/v1alpha1/backup_schedule_service.proto +++ b/pkg/proto/ydbcp/v1alpha1/backup_schedule_service.proto @@ -11,6 +11,7 @@ service BackupScheduleService { rpc GetBackupSchedule (GetBackupScheduleRequest) returns (BackupSchedule); rpc ListBackupSchedules (ListBackupSchedulesRequest) returns (ListBackupSchedulesResponse); rpc ToggleBackupSchedule (ToggleBackupScheduleRequest) returns (BackupSchedule); + rpc DeleteBackupSchedule (DeleteBackupScheduleRequest) returns (BackupSchedule); } message CreateBackupScheduleRequest { @@ -64,3 +65,7 @@ message ToggleBackupScheduleRequest { string id = 1; bool active_state = 2; } + +message DeleteBackupScheduleRequest { + string id = 1; +} diff --git a/pkg/proto/ydbcp/v1alpha1/backup_schedule_service_grpc.pb.go b/pkg/proto/ydbcp/v1alpha1/backup_schedule_service_grpc.pb.go index e7415645..f9a9bbef 100644 --- a/pkg/proto/ydbcp/v1alpha1/backup_schedule_service_grpc.pb.go +++ b/pkg/proto/ydbcp/v1alpha1/backup_schedule_service_grpc.pb.go @@ -24,6 +24,7 @@ const ( BackupScheduleService_GetBackupSchedule_FullMethodName = "/ydbcp.v1alpha1.BackupScheduleService/GetBackupSchedule" BackupScheduleService_ListBackupSchedules_FullMethodName = "/ydbcp.v1alpha1.BackupScheduleService/ListBackupSchedules" BackupScheduleService_ToggleBackupSchedule_FullMethodName = "/ydbcp.v1alpha1.BackupScheduleService/ToggleBackupSchedule" + BackupScheduleService_DeleteBackupSchedule_FullMethodName = "/ydbcp.v1alpha1.BackupScheduleService/DeleteBackupSchedule" ) // BackupScheduleServiceClient is the client API for BackupScheduleService service. @@ -35,6 +36,7 @@ type BackupScheduleServiceClient interface { GetBackupSchedule(ctx context.Context, in *GetBackupScheduleRequest, opts ...grpc.CallOption) (*BackupSchedule, error) ListBackupSchedules(ctx context.Context, in *ListBackupSchedulesRequest, opts ...grpc.CallOption) (*ListBackupSchedulesResponse, error) ToggleBackupSchedule(ctx context.Context, in *ToggleBackupScheduleRequest, opts ...grpc.CallOption) (*BackupSchedule, error) + DeleteBackupSchedule(ctx context.Context, in *DeleteBackupScheduleRequest, opts ...grpc.CallOption) (*BackupSchedule, error) } type backupScheduleServiceClient struct { @@ -90,6 +92,15 @@ func (c *backupScheduleServiceClient) ToggleBackupSchedule(ctx context.Context, return out, nil } +func (c *backupScheduleServiceClient) DeleteBackupSchedule(ctx context.Context, in *DeleteBackupScheduleRequest, opts ...grpc.CallOption) (*BackupSchedule, error) { + out := new(BackupSchedule) + err := c.cc.Invoke(ctx, BackupScheduleService_DeleteBackupSchedule_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // BackupScheduleServiceServer is the server API for BackupScheduleService service. // All implementations must embed UnimplementedBackupScheduleServiceServer // for forward compatibility @@ -99,6 +110,7 @@ type BackupScheduleServiceServer interface { GetBackupSchedule(context.Context, *GetBackupScheduleRequest) (*BackupSchedule, error) ListBackupSchedules(context.Context, *ListBackupSchedulesRequest) (*ListBackupSchedulesResponse, error) ToggleBackupSchedule(context.Context, *ToggleBackupScheduleRequest) (*BackupSchedule, error) + DeleteBackupSchedule(context.Context, *DeleteBackupScheduleRequest) (*BackupSchedule, error) mustEmbedUnimplementedBackupScheduleServiceServer() } @@ -121,6 +133,9 @@ func (UnimplementedBackupScheduleServiceServer) ListBackupSchedules(context.Cont func (UnimplementedBackupScheduleServiceServer) ToggleBackupSchedule(context.Context, *ToggleBackupScheduleRequest) (*BackupSchedule, error) { return nil, status.Errorf(codes.Unimplemented, "method ToggleBackupSchedule not implemented") } +func (UnimplementedBackupScheduleServiceServer) DeleteBackupSchedule(context.Context, *DeleteBackupScheduleRequest) (*BackupSchedule, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteBackupSchedule not implemented") +} func (UnimplementedBackupScheduleServiceServer) mustEmbedUnimplementedBackupScheduleServiceServer() {} // UnsafeBackupScheduleServiceServer may be embedded to opt out of forward compatibility for this service. @@ -224,6 +239,24 @@ func _BackupScheduleService_ToggleBackupSchedule_Handler(srv interface{}, ctx co return interceptor(ctx, in, info, handler) } +func _BackupScheduleService_DeleteBackupSchedule_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteBackupScheduleRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BackupScheduleServiceServer).DeleteBackupSchedule(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: BackupScheduleService_DeleteBackupSchedule_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BackupScheduleServiceServer).DeleteBackupSchedule(ctx, req.(*DeleteBackupScheduleRequest)) + } + return interceptor(ctx, in, info, handler) +} + // BackupScheduleService_ServiceDesc is the grpc.ServiceDesc for BackupScheduleService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -251,6 +284,10 @@ var BackupScheduleService_ServiceDesc = grpc.ServiceDesc{ MethodName: "ToggleBackupSchedule", Handler: _BackupScheduleService_ToggleBackupSchedule_Handler, }, + { + MethodName: "DeleteBackupSchedule", + Handler: _BackupScheduleService_DeleteBackupSchedule_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "ydbcp/v1alpha1/backup_schedule_service.proto",