Skip to content

Commit 7c9edb5

Browse files
feat(operation_service): add human readable description for operation type (#130)
1 parent 7744d4e commit 7c9edb5

File tree

3 files changed

+43
-15
lines changed

3 files changed

+43
-15
lines changed

internal/types/operation.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ type Operation interface {
2424
GetContainerID() string
2525
GetType() OperationType
2626
SetType(t OperationType)
27+
GetTypeDescription() string
2728
GetState() OperationState
2829
SetState(s OperationState)
2930
GetMessage() string
@@ -65,6 +66,9 @@ func (o *TakeBackupOperation) GetType() OperationType {
6566
}
6667
func (o *TakeBackupOperation) SetType(_ OperationType) {
6768
}
69+
func (o *TakeBackupOperation) GetTypeDescription() string {
70+
return "TakeBackupOperation"
71+
}
6872
func (o *TakeBackupOperation) GetState() OperationState {
6973
return o.State
7074
}
@@ -148,6 +152,9 @@ func (o *RestoreBackupOperation) GetType() OperationType {
148152
}
149153
func (o *RestoreBackupOperation) SetType(_ OperationType) {
150154
}
155+
func (o *RestoreBackupOperation) GetTypeDescription() string {
156+
return "RestoreBackupOperation"
157+
}
151158
func (o *RestoreBackupOperation) GetState() OperationState {
152159
return o.State
153160
}
@@ -222,6 +229,9 @@ func (o *DeleteBackupOperation) GetType() OperationType {
222229
}
223230
func (o *DeleteBackupOperation) SetType(_ OperationType) {
224231
}
232+
func (o *DeleteBackupOperation) GetTypeDescription() string {
233+
return "DeleteBackupOperation"
234+
}
225235
func (o *DeleteBackupOperation) GetState() OperationState {
226236
return o.State
227237
}
@@ -298,6 +308,9 @@ func (o *TakeBackupWithRetryOperation) GetState() OperationState {
298308
func (o *TakeBackupWithRetryOperation) SetState(s OperationState) {
299309
o.State = s
300310
}
311+
func (o *TakeBackupWithRetryOperation) GetTypeDescription() string {
312+
return "TakeBackupWithRetryOperation"
313+
}
301314
func (o *TakeBackupWithRetryOperation) GetMessage() string {
302315
return o.Message
303316
}
@@ -389,6 +402,9 @@ func (o *GenericOperation) GetType() OperationType {
389402
func (o *GenericOperation) SetType(t OperationType) {
390403
o.Type = t
391404
}
405+
func (o *GenericOperation) GetTypeDescription() string {
406+
return "Undefined"
407+
}
392408
func (o *GenericOperation) GetState() OperationState {
393409
return o.State
394410
}

pkg/proto/ydbcp/v1alpha1/operation.pb.go

Lines changed: 25 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/proto/ydbcp/v1alpha1/operation.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,6 @@ message Operation {
5252
string parent_operation_id = 15;
5353
// Retry configuration for the operation.
5454
RetryConfig retry_config = 16;
55+
// Human readable description for the operation type.
56+
string type_description = 17;
5557
}

0 commit comments

Comments
 (0)