(bindings []resources.ServiceCredentialBinding, spaceGUID string)
| 121 | } |
| 122 | |
| 123 | func buildBoundAppsLookup(bindings []resources.ServiceCredentialBinding, spaceGUID string) map[string][]string { |
| 124 | type bindingKey struct { |
| 125 | appGUID string |
| 126 | serviceInstanceGUID string |
| 127 | } |
| 128 | seenBindingKeys := make(map[bindingKey]struct{}) |
| 129 | appsBoundLookup := make(map[string][]string) |
| 130 | for _, binding := range bindings { |
| 131 | if binding.Type == resources.AppBinding && binding.AppSpaceGUID == spaceGUID { |
| 132 | bk := bindingKey{appGUID: binding.AppGUID, serviceInstanceGUID: binding.ServiceInstanceGUID} |
| 133 | // Prevent duplicate app names for the same service instance in case of duplicate bindings |
| 134 | if _, exists := seenBindingKeys[bk]; !exists { |
| 135 | appsBoundLookup[binding.ServiceInstanceGUID] = append(appsBoundLookup[binding.ServiceInstanceGUID], binding.AppName) |
| 136 | seenBindingKeys[bk] = struct{}{} |
| 137 | } |
| 138 | } |
| 139 | } |
| 140 | return appsBoundLookup |
| 141 | } |
no outgoing calls
no test coverage detected