@@ -34,13 +34,14 @@ type QualifierMappingService interface {
34
34
CreateQualifierMappings (qualifierMappings []* QualifierMapping , tx * pg.Tx ) ([]* QualifierMapping , error )
35
35
GetQualifierMappings (resourceType ResourceType , scope * Scope , resourceIds []int ) ([]* QualifierMapping , error )
36
36
DeleteAllQualifierMappings (resourceType ResourceType , auditLog sql.AuditLog , tx * pg.Tx ) error
37
- DeleteByIdentifierKeyValue (resourceType ResourceType , identifierKey int , identifierValue int , auditLog sql.AuditLog , tx * pg.Tx ) error
37
+ DeleteByIdentifierKeyAndValue (resourceType ResourceType , identifierKey int , identifierValue int , qualifierId int , auditLog sql.AuditLog , tx * pg.Tx ) error
38
38
DeleteAllByIds (qualifierMappingIds []int , userId int32 , tx * pg.Tx ) error
39
39
DeleteResourceMappingsForScopes (tx * pg.Tx , userId int32 , resourceType ResourceType , qualifierSelector QualifierSelector , scopes []* SelectionIdentifier ) error
40
40
CreateMappingsForSelections (tx * pg.Tx , userId int32 , resourceMappingSelections []* ResourceMappingSelection ) ([]* ResourceMappingSelection , error )
41
41
CreateMappings (tx * pg.Tx , userId int32 , resourceType ResourceType , resourceIds []int , qualifierSelector QualifierSelector , selectionIdentifiers []* SelectionIdentifier ) error
42
42
GetResourceMappingsForSelections (resourceType ResourceType , qualifierSelector QualifierSelector , selectionIdentifiers []* SelectionIdentifier ) ([]ResourceQualifierMappings , error )
43
43
GetResourceMappingsForResources (resourceType ResourceType , resourceIds []int , qualifierSelector QualifierSelector ) ([]ResourceQualifierMappings , error )
44
+ QualifierMappingServiceEnt
44
45
}
45
46
46
47
type QualifierMappingServiceImpl struct {
@@ -57,24 +58,24 @@ func NewQualifierMappingServiceImpl(logger *zap.SugaredLogger, qualifierMappingR
57
58
}, nil
58
59
}
59
60
60
- func (impl QualifierMappingServiceImpl ) CreateQualifierMappings (qualifierMappings []* QualifierMapping , tx * pg.Tx ) ([]* QualifierMapping , error ) {
61
+ func (impl * QualifierMappingServiceImpl ) CreateQualifierMappings (qualifierMappings []* QualifierMapping , tx * pg.Tx ) ([]* QualifierMapping , error ) {
61
62
return impl .qualifierMappingRepository .CreateQualifierMappings (qualifierMappings , tx )
62
63
}
63
64
64
- func (impl QualifierMappingServiceImpl ) GetQualifierMappings (resourceType ResourceType , scope * Scope , resourceIds []int ) ([]* QualifierMapping , error ) {
65
+ func (impl * QualifierMappingServiceImpl ) GetQualifierMappings (resourceType ResourceType , scope * Scope , resourceIds []int ) ([]* QualifierMapping , error ) {
65
66
searchableKeyNameIdMap := impl .devtronResourceSearchableKeyService .GetAllSearchableKeyNameIdMap ()
66
67
return impl .qualifierMappingRepository .GetQualifierMappings (resourceType , scope , searchableKeyNameIdMap , resourceIds )
67
68
}
68
69
69
- func (impl QualifierMappingServiceImpl ) DeleteAllQualifierMappings (resourceType ResourceType , auditLog sql.AuditLog , tx * pg.Tx ) error {
70
+ func (impl * QualifierMappingServiceImpl ) DeleteAllQualifierMappings (resourceType ResourceType , auditLog sql.AuditLog , tx * pg.Tx ) error {
70
71
return impl .qualifierMappingRepository .DeleteAllQualifierMappings (resourceType , auditLog , tx )
71
72
}
72
73
73
- func (impl QualifierMappingServiceImpl ) DeleteByIdentifierKeyValue (resourceType ResourceType , identifierKey int , identifierValue int , auditLog sql.AuditLog , tx * pg.Tx ) error {
74
+ func (impl * QualifierMappingServiceImpl ) DeleteByIdentifierKeyAndValue (resourceType ResourceType , identifierKey int , identifierValue int , qualifierId int , auditLog sql.AuditLog , tx * pg.Tx ) error {
74
75
return impl .qualifierMappingRepository .DeleteByResourceTypeIdentifierKeyAndValue (resourceType , identifierKey , identifierValue , auditLog , tx )
75
76
}
76
77
77
- func (impl QualifierMappingServiceImpl ) DeleteAllByIds (qualifierMappingIds []int , userId int32 , tx * pg.Tx ) error {
78
+ func (impl * QualifierMappingServiceImpl ) DeleteAllByIds (qualifierMappingIds []int , userId int32 , tx * pg.Tx ) error {
78
79
auditLog := sql.AuditLog {
79
80
CreatedOn : time .Now (),
80
81
CreatedBy : userId ,
@@ -84,7 +85,7 @@ func (impl QualifierMappingServiceImpl) DeleteAllByIds(qualifierMappingIds []int
84
85
return impl .qualifierMappingRepository .DeleteAllByIds (qualifierMappingIds , auditLog , tx )
85
86
}
86
87
87
- func (impl QualifierMappingServiceImpl ) CreateMappingsForSelections (tx * pg.Tx , userId int32 , resourceMappingSelections []* ResourceMappingSelection ) ([]* ResourceMappingSelection , error ) {
88
+ func (impl * QualifierMappingServiceImpl ) CreateMappingsForSelections (tx * pg.Tx , userId int32 , resourceMappingSelections []* ResourceMappingSelection ) ([]* ResourceMappingSelection , error ) {
88
89
89
90
resourceKeyMap := impl .devtronResourceSearchableKeyService .GetAllSearchableKeyNameIdMap ()
90
91
@@ -140,7 +141,7 @@ func (impl QualifierMappingServiceImpl) CreateMappingsForSelections(tx *pg.Tx, u
140
141
return maps .Values (mappingsToSelection ), nil
141
142
}
142
143
143
- func (impl QualifierMappingServiceImpl ) CreateMappings (tx * pg.Tx , userId int32 , resourceType ResourceType , resourceIds []int , qualifierSelector QualifierSelector , selectionIdentifiers []* SelectionIdentifier ) error {
144
+ func (impl * QualifierMappingServiceImpl ) CreateMappings (tx * pg.Tx , userId int32 , resourceType ResourceType , resourceIds []int , qualifierSelector QualifierSelector , selectionIdentifiers []* SelectionIdentifier ) error {
144
145
mappings := make ([]* ResourceMappingSelection , 0 )
145
146
for _ , id := range resourceIds {
146
147
for _ , selectionIdentifier := range selectionIdentifiers {
@@ -197,7 +198,7 @@ func (impl *QualifierMappingServiceImpl) filterAndGroupMappings(mappings []*Qual
197
198
return groupedMappings
198
199
}
199
200
200
- func (impl QualifierMappingServiceImpl ) getAppEnvIdentifierFromGroup (group []* QualifierMapping ) * SelectionIdentifier {
201
+ func (impl * QualifierMappingServiceImpl ) getAppEnvIdentifierFromGroup (group []* QualifierMapping ) * SelectionIdentifier {
201
202
resourceKeyToName := impl .devtronResourceSearchableKeyService .GetAllSearchableKeyIdNameMap ()
202
203
var appId , envId int
203
204
var appName , envName string
@@ -213,7 +214,7 @@ func (impl QualifierMappingServiceImpl) getAppEnvIdentifierFromGroup(group []*Qu
213
214
return getSelectionIdentifierForAppEnv (appId , envId , getIdentifierNamesForAppEnv (envName , appName ))
214
215
}
215
216
216
- func (impl QualifierMappingServiceImpl ) getSelectionIdentifierForAppEnvSelector (mappingGroups [][]* QualifierMapping ) map [int ][]* SelectionIdentifier {
217
+ func (impl * QualifierMappingServiceImpl ) getSelectionIdentifierForAppEnvSelector (mappingGroups [][]* QualifierMapping ) map [int ][]* SelectionIdentifier {
217
218
218
219
resourceIdToIdentifier := make (map [int ][]* SelectionIdentifier )
219
220
for _ , group := range mappingGroups {
@@ -229,7 +230,7 @@ func (impl QualifierMappingServiceImpl) getSelectionIdentifierForAppEnvSelector(
229
230
return resourceIdToIdentifier
230
231
}
231
232
232
- func (impl QualifierMappingServiceImpl ) DeleteResourceMappingsForScopes (tx * pg.Tx , userId int32 , resourceType ResourceType , qualifierSelector QualifierSelector , scopes []* SelectionIdentifier ) error {
233
+ func (impl * QualifierMappingServiceImpl ) DeleteResourceMappingsForScopes (tx * pg.Tx , userId int32 , resourceType ResourceType , qualifierSelector QualifierSelector , scopes []* SelectionIdentifier ) error {
233
234
if qualifierSelector != ApplicationEnvironmentSelector {
234
235
return fmt .Errorf ("selector currently not implemented" )
235
236
}
@@ -256,7 +257,7 @@ func (impl QualifierMappingServiceImpl) DeleteResourceMappingsForScopes(tx *pg.T
256
257
257
258
}
258
259
259
- func (impl QualifierMappingServiceImpl ) GetResourceMappingsForSelections (resourceType ResourceType , qualifierSelector QualifierSelector , selectionIdentifiers []* SelectionIdentifier ) ([]ResourceQualifierMappings , error ) {
260
+ func (impl * QualifierMappingServiceImpl ) GetResourceMappingsForSelections (resourceType ResourceType , qualifierSelector QualifierSelector , selectionIdentifiers []* SelectionIdentifier ) ([]ResourceQualifierMappings , error ) {
260
261
if qualifierSelector != ApplicationEnvironmentSelector {
261
262
return nil , fmt .Errorf ("selector currently not implemented" )
262
263
}
@@ -278,7 +279,7 @@ func (impl QualifierMappingServiceImpl) GetResourceMappingsForSelections(resourc
278
279
279
280
return impl .processMappings (resourceType , mappings , qualifierSelector , getCompositeStringsAppEnvSelection (selectionIdentifiers ))
280
281
}
281
- func (impl QualifierMappingServiceImpl ) GetResourceMappingsForResources (resourceType ResourceType , resourceIds []int , qualifierSelector QualifierSelector ) ([]ResourceQualifierMappings , error ) {
282
+ func (impl * QualifierMappingServiceImpl ) GetResourceMappingsForResources (resourceType ResourceType , resourceIds []int , qualifierSelector QualifierSelector ) ([]ResourceQualifierMappings , error ) {
282
283
mappings , err := impl .qualifierMappingRepository .GetMappingsByResourceTypeAndIdsAndQualifierId (resourceType , resourceIds , int (qualifierSelector .toQualifier ()))
283
284
if err != nil {
284
285
return nil , err
@@ -287,7 +288,7 @@ func (impl QualifierMappingServiceImpl) GetResourceMappingsForResources(resource
287
288
return impl .processMappings (resourceType , mappings , qualifierSelector , mapset .NewSet ())
288
289
}
289
290
290
- func (impl QualifierMappingServiceImpl ) processMappings (resourceType ResourceType , mappings []* QualifierMapping , qualifierSelector QualifierSelector , composites mapset.Set ) ([]ResourceQualifierMappings , error ) {
291
+ func (impl * QualifierMappingServiceImpl ) processMappings (resourceType ResourceType , mappings []* QualifierMapping , qualifierSelector QualifierSelector , composites mapset.Set ) ([]ResourceQualifierMappings , error ) {
291
292
groups := impl .filterAndGroupMappings (mappings , qualifierSelector , composites )
292
293
if qualifierSelector != ApplicationEnvironmentSelector {
293
294
return nil , fmt .Errorf ("selector currently not implemented" )
0 commit comments