972dcf93a9
* Added comments wherever missing for exported functions/constants Change-Id: I3757fcf7b9ad24753e2803abaaad84bba7e84fd0 Relates-To: #148
49 lines
1.2 KiB
Go
49 lines
1.2 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"
|
|
)
|
|
|
|
// AuthInfo contains kubeConfig AuthInfo Object
|
|
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)
|
|
}
|
|
|
|
// KubeAuthInfo returns kubeConfig AuthInfo Object
|
|
func (c *AuthInfo) KubeAuthInfo() *api.AuthInfo {
|
|
return c.authInfo
|
|
}
|
|
|
|
// SetKubeAuthInfo sets kubeConfig in AuthInfo
|
|
func (c *AuthInfo) SetKubeAuthInfo(kc *api.AuthInfo) {
|
|
c.authInfo = kc
|
|
}
|