MCPcopy
hub / github.com/kubernetes/client-go / getAuthInfo

Method getAuthInfo

tools/clientcmd/client_config.go:424–437  ·  view source on GitHub ↗

getAuthInfo returns the clientcmdapi.AuthInfo, or an error if a required auth info is not found.

()

Source from the content-addressed store, hash-verified

422
423// getAuthInfo returns the clientcmdapi.AuthInfo, or an error if a required auth info is not found.
424func (config *DirectClientConfig) getAuthInfo() (clientcmdapi.AuthInfo, error) {
425 authInfos := config.config.AuthInfos
426 authInfoName, required := config.getAuthInfoName()
427
428 mergedAuthInfo := clientcmdapi.NewAuthInfo()
429 if configAuthInfo, exists := authInfos[authInfoName]; exists {
430 mergo.MergeWithOverwrite(mergedAuthInfo, configAuthInfo)
431 } else if required {
432 return clientcmdapi.AuthInfo{}, fmt.Errorf("auth info %q does not exist", authInfoName)
433 }
434 mergo.MergeWithOverwrite(mergedAuthInfo, config.overrides.AuthInfo)
435
436 return *mergedAuthInfo, nil
437}
438
439// getCluster returns the clientcmdapi.Cluster, or an error if a required cluster is not found.
440func (config *DirectClientConfig) getCluster() (clientcmdapi.Cluster, error) {

Callers 2

ClientConfigMethod · 0.95
ConfirmUsableMethod · 0.95

Calls 2

getAuthInfoNameMethod · 0.95
ErrorfMethod · 0.65

Tested by

no test coverage detected