diff --git a/audit/api/model.go b/audit/api/model.go index 00b9c6a..af40d7d 100644 --- a/audit/api/model.go +++ b/audit/api/model.go @@ -912,7 +912,6 @@ func OperationNameFromGrpcMethod(path string) string { func GetObjectIdAndTypeFromUrlPath(path string) ( string, *SingularType, - *PluralType, error, ) { @@ -922,15 +921,15 @@ func GetObjectIdAndTypeFromUrlPath(path string) ( objectTypePlural := AsPluralType(objectTypeIdMatches[1]) objectTypeSingular, err := objectTypePlural.AsSingularType() if err != nil { - return "", nil, nil, err + return "", nil, err } objectType := &objectTypeSingular objectId := objectTypeIdMatches[2] - return objectId, objectType, &objectTypePlural, nil + return objectId, objectType, nil } - return "", nil, nil, nil + return "", nil, nil } func ToArrayMap(input map[string]string) map[string][]string { diff --git a/audit/api/model_test.go b/audit/api/model_test.go index 244b613..2f00ba3 100644 --- a/audit/api/model_test.go +++ b/audit/api/model_test.go @@ -978,27 +978,24 @@ func Test_OperationNameFromGrpcMethod(t *testing.T) { func Test_GetObjectIdAndTypeFromUrlPath(t *testing.T) { t.Run("object id and type not in url", func(t *testing.T) { - objectId, singularType, pluralType, err := GetObjectIdAndTypeFromUrlPath("/v2/projects/audit") + objectId, singularType, err := GetObjectIdAndTypeFromUrlPath("/v2/projects/audit") assert.NoError(t, err) assert.Equal(t, "", objectId) assert.Nil(t, singularType) - assert.Nil(t, pluralType) }) t.Run("object id and type in url", func(t *testing.T) { - objectId, singularType, pluralType, err := GetObjectIdAndTypeFromUrlPath("/v2/projects/f17d4064-9b65-4334-b6a7-8fed96340124") + objectId, singularType, err := GetObjectIdAndTypeFromUrlPath("/v2/projects/f17d4064-9b65-4334-b6a7-8fed96340124") assert.NoError(t, err) assert.Equal(t, "f17d4064-9b65-4334-b6a7-8fed96340124", objectId) assert.Equal(t, SingularTypeProject, *singularType) - assert.Equal(t, PluralTypeProject, *pluralType) }) t.Run("multiple object ids and types in url", func(t *testing.T) { - objectId, singularType, pluralType, err := GetObjectIdAndTypeFromUrlPath("/v2/organization/8ee58bec-d496-4bb9-af8d-72fda4d78b6b/projects/f17d4064-9b65-4334-b6a7-8fed96340124") + objectId, singularType, err := GetObjectIdAndTypeFromUrlPath("/v2/organization/8ee58bec-d496-4bb9-af8d-72fda4d78b6b/projects/f17d4064-9b65-4334-b6a7-8fed96340124") assert.NoError(t, err) assert.Equal(t, "f17d4064-9b65-4334-b6a7-8fed96340124", objectId) assert.Equal(t, SingularTypeProject, *singularType) - assert.Equal(t, PluralTypeProject, *pluralType) }) }