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