ApplyAccessProviders reconciles the configured access providers against the currently registered providers and updates the manager. It logs a concise summary of the detected changes and returns whether any provider changed.
(manager *sdkaccess.Manager, oldCfg, newCfg *config.Config)
| 80 | // currently registered providers and updates the manager. It logs a concise |
| 81 | // summary of the detected changes and returns whether any provider changed. |
| 82 | func ApplyAccessProviders(manager *sdkaccess.Manager, oldCfg, newCfg *config.Config) (bool, error) { |
| 83 | if manager == nil || newCfg == nil { |
| 84 | return false, nil |
| 85 | } |
| 86 | |
| 87 | existing := manager.Providers() |
| 88 | configaccess.Register(&newCfg.SDKConfig) |
| 89 | providers, added, updated, removed, err := ReconcileProviders(oldCfg, newCfg, existing) |
| 90 | if err != nil { |
| 91 | log.Errorf("failed to reconcile request auth providers: %v", err) |
| 92 | return false, fmt.Errorf("reconciling access providers: %w", err) |
| 93 | } |
| 94 | |
| 95 | manager.SetProviders(providers) |
| 96 | |
| 97 | if len(added)+len(updated)+len(removed) > 0 { |
| 98 | log.Debugf("auth providers reconciled (added=%d updated=%d removed=%d)", len(added), len(updated), len(removed)) |
| 99 | log.Debugf("auth providers changes details - added=%v updated=%v removed=%v", added, updated, removed) |
| 100 | return true, nil |
| 101 | } |
| 102 | |
| 103 | log.Debug("auth providers unchanged after config update") |
| 104 | return false, nil |
| 105 | } |
| 106 | |
| 107 | func identifierFromProvider(provider sdkaccess.Provider) string { |
| 108 | if provider == nil { |
nothing calls this directly
no test coverage detected