Documentation ¶
Overview ¶
Package types specifies the types for clientconfig
Index ¶
- Constants
- Variables
- func IsValidTarget(target string, allowGlobal, allowUnknown bool) bool
- type CLIOptionsdeprecated
- type Cert
- type ClientConfig
- func (c *ClientConfig) GetAllCurrentContextsList() ([]string, error)
- func (c *ClientConfig) GetAllCurrentContextsMap() (map[Target]*Context, error)
- func (c *ClientConfig) GetContext(name string) (*Context, error)
- func (c *ClientConfig) GetCurrentContext(target Target) (*Context, error)
- func (c *ClientConfig) GetCurrentServer() (*Server, error)deprecated
- func (c *ClientConfig) GetEnvConfigurations() map[string]string
- func (c *ClientConfig) HasContext(name string) bool
- func (c *ClientConfig) HasServer(name string) booldeprecated
- func (c *ClientConfig) IsConfigFeatureActivated(featurePath string) (bool, error)
- func (c *ClientConfig) SetCurrentContext(target Target, ctxName string) error
- func (c *ClientConfig) SetEditionSelector(edition EditionSelector)deprecated
- func (c *ClientConfig) SetUnstableVersionSelector(f VersionSelectorLevel)deprecated
- func (c *ClientConfig) SplitFeaturePath(featurePath string) (string, string, error)
- type ClientConfigListdeprecated
- type ClientOptions
- type ClusterServer
- type ConfigMetadata
- type Context
- type CoreCliOptions
- type EditionSelectordeprecated
- type EnvMap
- type FeatureMap
- type GCPDiscoverydeprecated
- type GCPPluginRepositorydeprecated
- type GenericRESTDiscovery
- type GlobalServer
- type GlobalServerAuth
- type KubernetesDiscovery
- type LocalDiscovery
- type ManagementClusterServerdeprecated
- type Metadata
- type OCIDiscovery
- type PluginDiscovery
- type PluginRepositorydeprecated
- type Serverdeprecated
- func (s *Server) IsGlobal() booldeprecated
- func (s *Server) IsManagementCluster() booldeprecated
- type ServerTypedeprecated
- type Target
- type VersionSelectorLeveldeprecated
Constants ¶
const ( // FeatureCli allows a feature to be set at the CLI level (globally) rather than for a single plugin // // Deprecated: This API constant is deprecated FeatureCli string = "cli" // EditionStandard refers to the standard edition // Edition value (in config) affects branding and cluster creation // // Deprecated: This API constant is deprecated EditionStandard = "tkg" // EditionCommunity refers to the community edition // // Deprecated: This API constant is deprecated EditionCommunity = "tce" )
Variables ¶
var ( // SupportedTargets is a list of all supported Target SupportedTargets = []Target{TargetK8s, TargetTMC} )
Functions ¶
func IsValidTarget ¶
IsValidTarget validates the target string specified is valid or not TargetGlobal and TargetUnknown are special targets and hence this function provide flexibility additional arguments to allow them based on the requirement
Types ¶
type CLIOptions
deprecated
type CLIOptions struct { // Repositories are the plugin repositories. // // Deprecated: Repositories has been deprecated and will be removed from future version Repositories []PluginRepository `json:"repositories,omitempty" yaml:"repositories,omitempty"` // DiscoverySources determines from where to discover stand-alone plugins // // Deprecated: DiscoverySources has been deprecated and will be removed in a future version. use CoreCliOptions.DiscoverySources DiscoverySources []PluginDiscovery `json:"discoverySources,omitempty" yaml:"discoverySources,omitempty"` // UnstableVersionSelector determined which version tags are allowed // // Deprecated: UnstableVersionSelector has been deprecated and will be removed from future version UnstableVersionSelector VersionSelectorLevel `json:"unstableVersionSelector,omitempty" yaml:"unstableVersionSelector,omitempty"` // Edition // // Deprecated: Edition has been deprecated and will be removed from future version Edition EditionSelector `json:"edition,omitempty" yaml:"edition,omitempty"` // BOMRepo is the root repository URL used to resolve the compatibiilty file // and bill of materials. An example URL is projects.registry.vmware.com/tkg. // // Deprecated: BOMRepo has been deprecated and will be removed from future version BOMRepo string `json:"bomRepo,omitempty" yaml:"bomRepo,omitempty"` // CompatibilityFilePath is the path, from the BOM repo, to download and access the compatibility file. // the compatibility file is used for resolving the bill of materials for creating clusters. // // Deprecated: CompatibilityFilePath has been deprecated and will be removed from future version CompatibilityFilePath string `json:"compatibilityFilePath,omitempty" yaml:"compatibilityFilePath,omitempty"` }
CLIOptions are options for the CLI.
Deprecated: CLIOptions has been deprecated and will be removed from future version
type Cert ¶ added in v0.90.0
type Cert struct { // Host is the host(or ipaddress) or host:port for which the certificate configuration is applicable Host string `json:"host,omitempty" yaml:"host,omitempty"` // CACertData is the CA certificate for the host CACertData string `json:"caCertData,omitempty" yaml:"caCertData,omitempty"` // Insecure is to allow insecure connections with host Insecure string `json:"insecure,omitempty" yaml:"insecure,omitempty"` // SkipCertVerify is to skip certificate validation SkipCertVerify string `json:"skipCertVerify,omitempty" yaml:"skipCertVerify,omitempty"` }
Cert provides a certificate configuration for an endpoint
type ClientConfig ¶
type ClientConfig struct { // KnownServers available. // // Deprecated: This field is deprecated. Use KnownContexts instead. KnownServers []*Server `json:"servers,omitempty" yaml:"servers,omitempty"` // CurrentServer in use. // // Deprecated: This field is deprecated. Use CurrentContext instead. CurrentServer string `json:"current,omitempty" yaml:"current,omitempty"` // KnownContexts available. KnownContexts []*Context `json:"contexts,omitempty" yaml:"contexts,omitempty"` // CurrentContext for every type. CurrentContext map[Target]string `json:"currentContext,omitempty" yaml:"currentContext,omitempty"` // ClientOptions are client specific options like feature flags, environment variables, repositories, discoverySources, etc. ClientOptions *ClientOptions `json:"clientOptions,omitempty" yaml:"clientOptions,omitempty"` // CoreCliOptions are core CLI specific options that are specific to CLI(not for plugins) like ceipOptIn, etc // that goes into nextgen configuration file. CoreCliOptions *CoreCliOptions `json:"cli,omitempty" yaml:"cli,omitempty"` // Certs is the collection of host, and its certificate data used to communicate with the host Certs []*Cert `json:"certs,omitempty" yaml:"certs,omitempty"` }
ClientConfig is the Schema for the configs API
func (*ClientConfig) GetAllCurrentContextsList ¶
func (c *ClientConfig) GetAllCurrentContextsList() ([]string, error)
GetAllCurrentContextsList returns all current context names as list
func (*ClientConfig) GetAllCurrentContextsMap ¶
func (c *ClientConfig) GetAllCurrentContextsMap() (map[Target]*Context, error)
GetAllCurrentContextsMap returns all current context per Target
func (*ClientConfig) GetContext ¶
func (c *ClientConfig) GetContext(name string) (*Context, error)
GetContext by name.
func (*ClientConfig) GetCurrentContext ¶
func (c *ClientConfig) GetCurrentContext(target Target) (*Context, error)
GetCurrentContext returns the current context for the given type.
func (*ClientConfig) GetCurrentServer
deprecated
func (c *ClientConfig) GetCurrentServer() (*Server, error)
GetCurrentServer returns the current server.
Deprecated: This API is deprecated. Use GetCurrentContext() instead.
func (*ClientConfig) GetEnvConfigurations ¶
func (c *ClientConfig) GetEnvConfigurations() map[string]string
GetEnvConfigurations returns a map of environment variables to values it returns nil if configuration is not yet defined
func (*ClientConfig) HasContext ¶
func (c *ClientConfig) HasContext(name string) bool
HasContext tells whether the Context by the given name exists.
func (*ClientConfig) HasServer
deprecated
func (c *ClientConfig) HasServer(name string) bool
HasServer tells whether the Server by the given name exists.
Deprecated: This API is deprecated. Use HasContext instead.
func (*ClientConfig) IsConfigFeatureActivated ¶
func (c *ClientConfig) IsConfigFeatureActivated(featurePath string) (bool, error)
IsConfigFeatureActivated return true if the feature is activated, false if not. An error if the featurePath is malformed
func (*ClientConfig) SetCurrentContext ¶
func (c *ClientConfig) SetCurrentContext(target Target, ctxName string) error
SetCurrentContext sets the current context for the given target.
func (*ClientConfig) SetEditionSelector
deprecated
func (c *ClientConfig) SetEditionSelector(edition EditionSelector)
SetEditionSelector indicates the edition of tanzu to be run EditionStandard is the default, EditionCommunity is also available. These values affect branding and cluster creation
Deprecated: This API is deprecated.
func (*ClientConfig) SetUnstableVersionSelector
deprecated
func (c *ClientConfig) SetUnstableVersionSelector(f VersionSelectorLevel)
SetUnstableVersionSelector will help determine the unstable versions supported In order of restrictiveness: "all" -> "alpha" -> "experimental" -> "none" none: return stable versions only. the default for both the config and the old flag. alpha: only versions tagged with -alpha experimental: all pre-release versions without +build semver data all: return all unstable versions.
Deprecated: This API is deprecated.
func (*ClientConfig) SplitFeaturePath ¶
func (c *ClientConfig) SplitFeaturePath(featurePath string) (string, string, error)
SplitFeaturePath splits a feature's path into the pluginName and the featureName For example "features.management-cluster.dual-stack" returns "management-cluster", "dual-stack" An error results from a malformed path, including any path that does not start with "features."
type ClientConfigList
deprecated
type ClientConfigList struct {
Items []ClientConfig `json:"items"`
}
ClientConfigList contains a list of ClientConfig
Deprecated: ClientConfigList struct is deprecated. Use ClientConfig instead.
type ClientOptions ¶
type ClientOptions struct { // CLI options specific to the CLI. // // Deprecated: CLI has been deprecated and will be removed from future version. use CoreCliOptions CLI *CLIOptions `json:"cli,omitempty" yaml:"cli,omitempty"` Features map[string]FeatureMap `json:"features,omitempty" yaml:"features,omitempty"` Env map[string]string `json:"env,omitempty" yaml:"env,omitempty"` }
ClientOptions are the client specific options.
type ClusterServer ¶
type ClusterServer struct { // Endpoint for the login. Endpoint string `json:"endpoint,omitempty" yaml:"endpoint,omitempty"` // Path to the kubeconfig. Path string `json:"path,omitempty" yaml:"path,omitempty"` // The kubernetes context to use (if required), defaults to current. Context string `json:"context,omitempty" yaml:"context,omitempty"` // Denotes whether this server is a management cluster or not (workload cluster). IsManagementCluster bool `json:"isManagementCluster,omitempty" yaml:"isManagementCluster,omitempty"` }
ClusterServer contains the configuration for a kubernetes cluster (kubeconfig).
type ConfigMetadata ¶
type ConfigMetadata struct { // PatchStrategy patch strategy to determine merge of nodes in config file. Two ways of patch strategies are merge and replace PatchStrategy map[string]string `json:"patchStrategy,omitempty" yaml:"patchStrategy,omitempty" mapstructure:"patchStrategy,omitempty"` // Settings related to config Settings map[string]string `json:"settings,omitempty" yaml:"settings,omitempty" mapstructure:"settings,omitempty"` }
ConfigMetadata to store any config related metadata or settings
type Context ¶
type Context struct { // Name of the context. Name string `json:"name,omitempty" yaml:"name,omitempty"` // Target of the context. Target Target `json:"target,omitempty" yaml:"target,omitempty"` // GlobalOpts if the context is a global control plane (e.g., TMC). GlobalOpts *GlobalServer `json:"globalOpts,omitempty" yaml:"globalOpts,omitempty"` // ClusterOpts if the context is a kubernetes cluster. ClusterOpts *ClusterServer `json:"clusterOpts,omitempty" yaml:"clusterOpts,omitempty"` // DiscoverySources determines from where to discover plugins // associated with this context. // Deprecated: This field is deprecated. It is currently no used. DiscoverySources []PluginDiscovery `json:"discoverySources,omitempty" yaml:"discoverySources,omitempty"` }
Context configuration for a control plane. This can one of the following, 1. Kubernetes Cluster 2. Tanzu Mission Control endpoint
func (*Context) IsManagementCluster ¶
IsManagementCluster tells if the context is for a management cluster.
type CoreCliOptions ¶ added in v0.80.0
type CoreCliOptions struct { // CEIPOptIn is the user's CEIP opt-in/opt-out status. CEIPOptIn string `json:"ceipOptIn,omitempty" yaml:"ceipOptIn,omitempty"` // EULAStatus is the EULA acceptance status. EULAStatus string `json:"eulaStatus,omitempty" yaml:"eulaStatus,omitempty"` // DiscoverySources determine where to discover plugins DiscoverySources []PluginDiscovery `json:"discoverySources,omitempty" yaml:"discoverySources,omitempty"` }
CoreCliOptions are core CLI specific options that are specific to CLI(not for plugins) like ceipOptIn, etc that goes into nextgen configuration file.
type EditionSelector
deprecated
type EditionSelector string
EditionSelector allows selecting edition versions based on config file
Deprecated: This type is deprecated
type EnvMap ¶
EnvMap is simply a hash table, but needs an explicit type to be an object in another hash map (cf ClientOptions.Env)
type FeatureMap ¶
FeatureMap is simply a hash table, but needs an explicit type to be an object in another hash map (cf ClientOptions.Features)
type GCPDiscovery
deprecated
type GCPDiscovery struct { // Name is a name of the discovery Name string `json:"name,omitempty" yaml:"name,omitempty"` // Bucket is a Google Cloud Storage bucket. // E.g., tanzu-cli Bucket string `json:"bucket,omitempty" yaml:"bucket,omitempty"` // BasePath is a URI path that is prefixed to the object name/path. // E.g., plugins/cluster ManifestPath string `json:"manifestPath,omitempty" yaml:"manifestPath,omitempty"` }
GCPDiscovery provides a plugin discovery mechanism via a Google Cloud Storage bucket with a manifest.yaml file.
Deprecated: GCPDiscovery has been deprecated and will be removed from future version
type GCPPluginRepository
deprecated
type GCPPluginRepository struct { // Name of the repository. Name string `json:"name,omitempty" yaml:"name,omitempty"` // BucketName is the name of the bucket. BucketName string `json:"bucketName,omitempty" yaml:"bucketName,omitempty"` // RootPath within the bucket. RootPath string `json:"rootPath,omitempty" yaml:"rootPath,omitempty"` }
GCPPluginRepository is a plugin repository that utilizes GCP cloud storage.
Deprecated: GCPPluginRepository has been deprecated and will be removed from future version
type GenericRESTDiscovery ¶
type GenericRESTDiscovery struct { // Name is a name of the discovery Name string `json:"name,omitempty" yaml:"name,omitempty"` // Endpoint is the REST API server endpoint. // E.g., api.my-domain.local Endpoint string `json:"endpoint,omitempty" yaml:"endpoint,omitempty"` // BasePath is the base URL path of the plugin discovery API. // E.g., /v1alpha1/cli/plugins BasePath string `json:"basePath,omitempty" yaml:"basePath,omitempty"` }
GenericRESTDiscovery provides a plugin discovery mechanism via any REST API endpoint. The fully qualified list URL is constructed as `https://{Endpoint}/{BasePath}` and the get plugin URL is constructed as . `https://{Endpoint}/{BasePath}/{Plugin}`.
type GlobalServer ¶
type GlobalServer struct { // Endpoint for the server. Endpoint string `json:"endpoint,omitempty" yaml:"endpoint,omitempty"` // Auth for the global server. Auth GlobalServerAuth `json:"auth,omitempty" yaml:"auth,omitempty"` }
GlobalServer is the configuration for a global server.
type GlobalServerAuth ¶
type GlobalServerAuth struct { // Issuer url for IDP, compliant with OIDC Metadata Discovery. Issuer string `json:"issuer,omitempty" yaml:"issuer,omitempty"` // UserName is the authorized user the token is assigned to. UserName string `json:"userName,omitempty" yaml:"userName,omitempty"` // Permissions are roles assigned to the user. Permissions []string `json:"permissions,omitempty" yaml:"permissions,omitempty"` // AccessToken is the current access token based on the context. AccessToken string `json:"accessToken,omitempty" yaml:"accessToken,omitempty"` // IDToken is the current id token based on the context scoped to the CLI. IDToken string `json:"IDToken,omitempty" yaml:"IDToken,omitempty"` // RefreshToken will be stored only in case of api-token login flow. RefreshToken string `json:"refresh_token,omitempty" yaml:"refresh_token,omitempty"` // Expiration times of the token. Expiration time.Time `json:"expiration,omitempty" yaml:"expiration,omitempty"` // Type of the token (user or client). Type string `json:"type" yaml:"type,omitempty"` }
GlobalServerAuth is authentication for a global server.
type KubernetesDiscovery ¶
type KubernetesDiscovery struct { // Name is a name of the discovery Name string `json:"name,omitempty" yaml:"name,omitempty"` // Path to the kubeconfig. Path string `json:"path,omitempty" yaml:"path,omitempty"` // The context to use (if required), defaults to current. Context string `json:"context,omitempty" yaml:"context,omitempty"` // Version of the CLIPlugins API to query. // E.g., v1alpha1 Version string `json:"version,omitempty" yaml:"version,omitempty"` }
KubernetesDiscovery provides a plugin discovery mechanism via the Kubernetes API server.
type LocalDiscovery ¶
type LocalDiscovery struct { // Name is a name of the discovery Name string `json:"name,omitempty" yaml:"name,omitempty"` // Path is a local path pointing to directory // containing YAML files, each of which contains single // CLIPlugin API resource. Path string `json:"path,omitempty" yaml:"path,omitempty"` }
LocalDiscovery is a artifact discovery endpoint utilizing a local host OS.
type ManagementClusterServer
deprecated
type ManagementClusterServer struct { // Endpoint for the login. Endpoint string `json:"endpoint,omitempty" yaml:"endpoint,omitempty"` // Path to the kubeconfig. Path string `json:"path,omitempty" yaml:"path,omitempty"` // The context to use (if required), defaults to current. Context string `json:"context,omitempty" yaml:"context,omitempty"` }
ManagementClusterServer is the configuration for a management cluster kubeconfig.
Deprecated: This struct is deprecated. Use ClusterServer instead.
type Metadata ¶
type Metadata struct { // ConfigMetadata to store any config related metadata or settings ConfigMetadata *ConfigMetadata `json:"configMetadata,omitempty" yaml:"configMetadata,omitempty" mapstructure:"configMetadata,omitempty"` }
Metadata struct type to store config related metadata
type OCIDiscovery ¶
type OCIDiscovery struct { // Name is a name of the discovery Name string `json:"name,omitempty" yaml:"name,omitempty"` // Image is an OCI compliant image. Which include DNS-compatible registry name, // a valid URI path(MAY contain zero or more ‘/’) and a valid tag. // E.g., harbor.my-domain.local/tanzu-cli/plugins-manifest:latest // Contains a directory containing YAML files, each of which contains single // CLIPlugin API resource. Image string `json:"image,omitempty" yaml:"image,omitempty"` }
OCIDiscovery provides a plugin discovery mechanism via a OCI Image Registry
type PluginDiscovery ¶
type PluginDiscovery struct { // GCPStorage is set if the plugins are to be discovered via Google Cloud Storage. // // Deprecated: GCP has been deprecated and will be removed from future version GCP *GCPDiscovery `json:"gcp,omitempty" yaml:"gcp,omitempty"` // OCIDiscovery is set if the plugins are to be discovered via an OCI Image Registry. OCI *OCIDiscovery `json:"oci,omitempty" yaml:"oci,omitempty"` // GenericRESTDiscovery is set if the plugins are to be discovered via a REST API endpoint. REST *GenericRESTDiscovery `json:"rest,omitempty" yaml:"rest,omitempty"` // KubernetesDiscovery is set if the plugins are to be discovered via the Kubernetes API server. Kubernetes *KubernetesDiscovery `json:"k8s,omitempty" yaml:"k8s,omitempty"` // LocalDiscovery is set if the plugins are to be discovered via Local Manifest fast. Local *LocalDiscovery `json:"local,omitempty" yaml:"local,omitempty"` }
PluginDiscovery contains a specific distribution mechanism. Only one of the configs must be set.
type PluginRepository
deprecated
type PluginRepository struct { // GCPPluginRepository is a plugin repository that utilizes GCP cloud storage. GCPPluginRepository *GCPPluginRepository `json:"gcpPluginRepository,omitempty" yaml:"gcpPluginRepository,omitempty"` }
PluginRepository is a CLI plugin repository
Deprecated: PluginRepository has been deprecated and will be removed from future version
type Server
deprecated
type Server struct { // Name of the server. Name string `json:"name,omitempty" yaml:"name,omitempty"` // Type of the endpoint. Type ServerType `json:"type,omitempty" yaml:"type,omitempty"` // GlobalOpts if the server is global. GlobalOpts *GlobalServer `json:"globalOpts,omitempty" yaml:"globalOpts,omitempty"` // ManagementClusterOpts if the server is a management cluster. ManagementClusterOpts *ManagementClusterServer `json:"managementClusterOpts,omitempty" yaml:"managementClusterOpts,omitempty"` // DiscoverySources determines from where to discover plugins // associated with this server DiscoverySources []PluginDiscovery `json:"discoverySources,omitempty" yaml:"discoverySources,omitempty"` }
Server connection.
Deprecated: This struct is deprecated. Use Context instead.
func (*Server) IsManagementCluster
deprecated
type ServerType
deprecated
type ServerType string
ServerType is the type of server.
Deprecated: This API is deprecated. Superseded by Target.
const ( // ManagementClusterServerType is a management cluster server. // // Deprecated: This variable is deprecated. Use TargetK8s instead. ManagementClusterServerType ServerType = "managementcluster" // GlobalServerType is a global control plane server. // // Deprecated: This variable is deprecated. Use TargetTMC instead. GlobalServerType ServerType = "global" )
type Target ¶
type Target string
Target is the namespace of the CLI to which plugin is applicable
const ( // TargetK8s is a kubernetes target of the CLI // This target applies if the plugin is interacting with a Kubernetes cluster TargetK8s Target = "kubernetes" // TargetTMC is a Tanzu Mission Control target of the CLI // This target applies if the plugin is interacting with a Tanzu Mission Control endpoint TargetTMC Target = "mission-control" // TargetGlobal is used for plugins that are not associated with any target TargetGlobal Target = "global" // TargetUnknown specifies that the target is not currently known TargetUnknown Target = "" )
func StringToTarget ¶
StringToTarget converts string to Target type
type VersionSelectorLevel
deprecated
type VersionSelectorLevel string
VersionSelectorLevel allows selecting plugin versions based on semver properties
Deprecated: This API type is deprecated
const ( // AllUnstableVersions allows all plugin versions // // Deprecated: This API constant is deprecated AllUnstableVersions VersionSelectorLevel = "all" // AlphaUnstableVersions allows all alpha tagged versions // // Deprecated: This API constant is deprecated AlphaUnstableVersions VersionSelectorLevel = "alpha" // ExperimentalUnstableVersions includes all pre-releases, minus +build tags // // Deprecated: This API constant is deprecated ExperimentalUnstableVersions VersionSelectorLevel = "experimental" // NoUnstableVersions allows no unstable plugin versions, format major.minor.patch only // // Deprecated: This API constant is deprecated NoUnstableVersions VersionSelectorLevel = "none" )