func (c *ClientConfig) IsValid() bool {
	if len(c.Host) == 0 {
		return false
	}
	c.FormatHost()
	return c.Host != "" && (c.Token != "" || c.Authentication != nil)
}
IsValid returns true if the configuration contains the necessary fields, otherwise false.
package api
import (
	"fmt"
	"io"
	"io/ioutil"
	"os"
	"os/user"
	"path/filepath"
	"runtime"
	"strings"
)
const (
	currentContextKeyJSON = "currentContext"
	currentContextKeyYAML = "CurrentContext"
	contextsKeyJSON = "contexts"
	contextsKeyYAML = "Contexts"
	basicAuthenticationKeyJSON = "basic"
	basicAuthenticationKeyYAML = "Basic"
	kerberosAuthenticationKeyJSON = "kerberos"
	kerberosAuthenticationKeyYAML = "Kerberos"
	kerberosConfFileKeyJSON = "confFile"
	kerberosConfFileKeyYAML = "ConfFile"
	kerberosMethodKeyJSON = "method"
	kerberosMethodKeyYAML = "Method"
	kerberosWithPasswordMethodKeyJSON = "withPassword"
	kerberosWithPasswordMethodKeyYAML = "WithPassword"
	kerberosWithKeytabMethodKeyJSON = "withKeytab"
	kerberosWithKeytabMethodKeyYAML = "WithKeytab"
	kerberosFromCCacheMethodKeyJSON = "fromCCache"
	kerberosFromCCacheMethodKeyYAML = "FromCCache"
)
type (
	Config struct {
		CurrentContext string
		Contexts       map[string]*ClientConfig
	}
	ClientConfig struct {
		Host string `json:"host" yaml:"Host" survey:"host"`
		Authentication Authentication `json:"-" yaml:"-" survey:"-"`
		Token string `json:"token,omitempty" yaml:"Token,omitempty" survey:"-"`
		Timeout string `json:"timeout,omitempty" yaml:"Timeout,omitempty" survey:"timeout"`
		Insecure bool `json:"insecure,omitempty" yaml:"Insecure,omitempty" survey:"insecure"`
		Debug bool `json:"debug,omitempty" yaml:"Debug,omitempty" survey:"debug"`
	}
)
func (c *Config) IsValid() bool {
	if len(c.Contexts) == 0 {
		return false
	}
	for _, cfg := range c.Contexts {
		if !cfg.IsValid() {
			return false
		}
	}
	return len(c.Contexts) > 0
}