Fix Lint warnings: Missing comments for functions
* Added comments wherever missing for exported functions/constants Change-Id: I3757fcf7b9ad24753e2803abaaad84bba7e84fd0 Relates-To: #148
This commit is contained in:
parent
9530e88c97
commit
972dcf93a9
@ -21,6 +21,7 @@ import (
|
||||
"sigs.k8s.io/yaml"
|
||||
)
|
||||
|
||||
// AuthInfo contains kubeConfig AuthInfo Object
|
||||
type AuthInfo struct {
|
||||
// KubeConfig AuthInfo Object
|
||||
authInfo *api.AuthInfo
|
||||
@ -36,9 +37,12 @@ func (c *AuthInfo) String() string {
|
||||
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
|
||||
}
|
||||
|
@ -66,22 +66,29 @@ func (c *Cluster) String() string {
|
||||
return fmt.Sprintf("%s\n%s", string(cyaml), string(kyaml))
|
||||
}
|
||||
|
||||
// PrettyString returns cluster information in a formatted string
|
||||
func (c *Cluster) PrettyString() string {
|
||||
clusterName := NewClusterComplexNameFromKubeClusterName(c.NameInKubeconf)
|
||||
return fmt.Sprintf("Cluster: %s\n%s:\n%s", clusterName.Name, clusterName.Type, c)
|
||||
}
|
||||
|
||||
// KubeCluster returns KubeConfig Cluster Object
|
||||
func (c *Cluster) KubeCluster() *api.Cluster {
|
||||
return c.cluster
|
||||
}
|
||||
|
||||
// SetKubeCluster sets cluster in KubeConfig
|
||||
func (c *Cluster) SetKubeCluster(kc *api.Cluster) {
|
||||
c.cluster = kc
|
||||
}
|
||||
|
||||
// String returns cluster's complex name, formed by combining name and type with a delimiter('_')
|
||||
func (c *ClusterComplexName) String() string {
|
||||
return strings.Join([]string{c.Name, c.Type}, AirshipClusterNameSeparator)
|
||||
}
|
||||
|
||||
// ValidClusterType checks for the possible options for cluster type
|
||||
// Returns error when invalid cluster type is given
|
||||
func ValidClusterType(clusterType string) error {
|
||||
for _, validType := range AllClusterTypes {
|
||||
if clusterType == validType {
|
||||
|
@ -684,6 +684,7 @@ func (c *Config) CurrentContextTargetPath() (string, error) {
|
||||
return ccm.TargetPath, nil
|
||||
}
|
||||
|
||||
// CurrentContextClusterType returns cluster type of current context
|
||||
func (c *Config) CurrentContextClusterType() (string, error) {
|
||||
context, err := c.GetCurrentContext()
|
||||
if err != nil {
|
||||
@ -692,6 +693,7 @@ func (c *Config) CurrentContextClusterType() (string, error) {
|
||||
return context.ClusterType(), nil
|
||||
}
|
||||
|
||||
// CurrentContextClusterName returns cluster name of current context
|
||||
func (c *Config) CurrentContextClusterName() (string, error) {
|
||||
context, err := c.GetCurrentContext()
|
||||
if err != nil {
|
||||
|
@ -20,6 +20,7 @@ import (
|
||||
"errors"
|
||||
)
|
||||
|
||||
// RunSetAuthInfo validates the given command line options and invokes AddAuthInfo/ModifyAuthInfo
|
||||
func RunSetAuthInfo(o *AuthInfoOptions, airconfig *Config, writeToStorage bool) (bool, error) {
|
||||
modified := false
|
||||
err := o.Validate()
|
||||
@ -54,6 +55,7 @@ func RunSetAuthInfo(o *AuthInfoOptions, airconfig *Config, writeToStorage bool)
|
||||
return modified, nil
|
||||
}
|
||||
|
||||
// RunSetCluster validates the given command line options and invokes AddCluster/ModifyCluster
|
||||
func RunSetCluster(o *ClusterOptions, airconfig *Config, writeToStorage bool) (bool, error) {
|
||||
modified := false
|
||||
err := o.Validate()
|
||||
@ -98,6 +100,7 @@ func RunSetCluster(o *ClusterOptions, airconfig *Config, writeToStorage bool) (b
|
||||
return modified, nil
|
||||
}
|
||||
|
||||
// RunSetContext validates the given command line options and invokes AddContext/ModifyContext
|
||||
func RunSetContext(o *ContextOptions, airconfig *Config, writeToStorage bool) (bool, error) {
|
||||
modified := false
|
||||
err := o.Validate()
|
||||
@ -148,6 +151,7 @@ func RunSetContext(o *ContextOptions, airconfig *Config, writeToStorage bool) (b
|
||||
return modified, nil
|
||||
}
|
||||
|
||||
// RunUseContext validates the given context name and updates it as current context
|
||||
func RunUseContext(desiredContext string, airconfig *Config) error {
|
||||
if _, err := airconfig.GetContext(desiredContext); err != nil {
|
||||
return err
|
||||
|
@ -72,6 +72,8 @@ func (c *Context) ClusterType() string {
|
||||
return NewClusterComplexNameFromKubeClusterName(c.NameInKubeconf).Type
|
||||
}
|
||||
|
||||
// ClusterName returns cluster name by extracting the name portion from
|
||||
// the complex cluster name
|
||||
func (c *Context) ClusterName() string {
|
||||
return NewClusterComplexNameFromKubeClusterName(c.NameInKubeconf).Name
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user