Minor refactor of tag keys and error generation
This commit is contained in:
parent
0e5f5bde49
commit
0ebd6c8eec
@ -25,7 +25,7 @@ const (
|
||||
LegacyUserTagPrefix = "tag:"
|
||||
|
||||
tenantIDKey = "tenant"
|
||||
resourceIDKey = "resource"
|
||||
resourceIDKey = "protectedResource"
|
||||
serviceCatPrefix = "sc-"
|
||||
separator = "_"
|
||||
|
||||
@ -35,6 +35,8 @@ const (
|
||||
defaultTagValue = "1"
|
||||
)
|
||||
|
||||
var errMissingPrefix = clues.New("missing tag prefix")
|
||||
|
||||
func serviceCatString(
|
||||
service path.ServiceType,
|
||||
category path.CategoryType,
|
||||
@ -50,7 +52,9 @@ func serviceCatStringToTypes(
|
||||
if trimmed == input {
|
||||
return path.UnknownService,
|
||||
path.UnknownCategory,
|
||||
clues.New("missing tag prefix")
|
||||
clues.Stack(errMissingPrefix).With(
|
||||
"expected_prefix", serviceCatPrefix,
|
||||
"input", input)
|
||||
}
|
||||
|
||||
parts := strings.Split(trimmed, separator)
|
||||
|
||||
@ -20,7 +20,7 @@ func TestBackupBasesUnitSuite(t *testing.T) {
|
||||
suite.Run(t, &BackupBasesUnitSuite{Suite: tester.NewUnitSuite(t)})
|
||||
}
|
||||
|
||||
func (suite *BackupBasesUnitSuite) TestReasonSerialization() {
|
||||
func (suite *BackupBasesUnitSuite) TestServiceCategorySerialization() {
|
||||
table := []struct {
|
||||
name string
|
||||
input string
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user