bb3daf1795
This is a series of patches that refactor config.go into several smaller modules, each relating specifically to one component of the configuration structure. This particular patch split auth info and cluster related part in separate modules. Relates-To: #35 Change-Id: Ib2abebc87c80549544a8b7775969df9db55aa8be
45 lines
1.0 KiB
Go
45 lines
1.0 KiB
Go
/*
|
|
Copyright 2014 The Kubernetes Authors.
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
*/
|
|
|
|
package config
|
|
|
|
import (
|
|
"k8s.io/client-go/tools/clientcmd/api"
|
|
"sigs.k8s.io/yaml"
|
|
)
|
|
|
|
type AuthInfo struct {
|
|
// KubeConfig AuthInfo Object
|
|
authInfo *api.AuthInfo
|
|
}
|
|
|
|
// AuthInfo functions
|
|
func (c *AuthInfo) String() string {
|
|
kauthinfo := c.KubeAuthInfo()
|
|
kyaml, err := yaml.Marshal(&kauthinfo)
|
|
if err != nil {
|
|
return ""
|
|
}
|
|
return string(kyaml)
|
|
}
|
|
|
|
func (c *AuthInfo) KubeAuthInfo() *api.AuthInfo {
|
|
return c.authInfo
|
|
}
|
|
func (c *AuthInfo) SetKubeAuthInfo(kc *api.AuthInfo) {
|
|
c.authInfo = kc
|
|
}
|