Documentation ¶
Overview ¶
Package config Provide API methods to Read/Write specific stanza of config file
Package config Provide API methods to Read/Write specific stanza of config file
Package config Provide API methods to Read/Write specific stanza of config file
Package config Provide API methods to Read/Write specific stanza of config file
Index ¶
- Constants
- Variables
- func AcquireTanzuConfigLock()
- func AcquireTanzuConfigNextGenLock()
- func AcquireTanzuMetadataLock()
- func AddContext(c *configtypes.Context, setCurrent bool) error
- func AddServer(s *configtypes.Server, setCurrent bool) errordeprecated
- func CertExists(host string) (bool, error)
- func CfgMetadataFilePath() (path string, err error)
- func ClientConfigNextGenPath() (path string, err error)
- func ClientConfigPath() (path string, err error)
- func ConfigureDefaultFeatureFlagsIfMissing(plugin string, defaultFeatureFlags map[string]bool) error
- func ConfigureFeatureFlags(defaultFeatureFlags map[string]bool, opts ...Options) error
- func ContextExists(name string) (bool, error)
- func CopyLegacyConfigDir() error
- func DeleteCLIDiscoverySource(name string) error
- func DeleteCLIRepository(name string) errordeprecated
- func DeleteCert(host string) error
- func DeleteClientConfig() error
- func DeleteClientConfigNextGen() error
- func DeleteConfigMetadataSetting(key string) error
- func DeleteContext(name string) error
- func DeleteEnv(key string) error
- func DeleteFeature(plugin, key string) error
- func DeleteServer(name string) errordeprecated
- func DeleteTelemetryOptions() error
- func EndpointFromContext(s *configtypes.Context) (endpoint string, err error)
- func EndpointFromServer(s *configtypes.Server) (endpoint string, err error)deprecated
- func GetActiveContext(contextType configtypes.ContextType) (c *configtypes.Context, err error)
- func GetAllActiveContextsList() ([]string, error)
- func GetAllActiveContextsMap() (map[configtypes.ContextType]*configtypes.Context, error)
- func GetAllCurrentContextsList() ([]string, error)deprecated
- func GetAllCurrentContextsMap() (map[configtypes.Target]*configtypes.Context, error)deprecated
- func GetAllEnvs() (map[string]string, error)
- func GetAllFeatureFlags() (map[string]types.FeatureMap, error)
- func GetCEIPOptIn() (string, error)
- func GetCLIDiscoverySource(name string) (*configtypes.PluginDiscovery, error)
- func GetCLIDiscoverySources() ([]configtypes.PluginDiscovery, error)
- func GetCLIId() (string, error)
- func GetCLIRepositories() ([]configtypes.PluginRepository, error)deprecated
- func GetCLIRepository(name string) (*configtypes.PluginRepository, error)deprecated
- func GetCLITelemetryOptions() (*configtypes.TelemetryOptions, error)
- func GetCert(host string) (*configtypes.Cert, error)
- func GetCerts() ([]*configtypes.Cert, error)
- func GetClientConfig() (cfg *configtypes.ClientConfig, err error)
- func GetClientConfigNoLock() (cfg *configtypes.ClientConfig, err error)
- func GetConfigMetadata() (*configtypes.ConfigMetadata, error)
- func GetConfigMetadataPatchStrategy() (map[string]string, error)
- func GetConfigMetadataSetting(key string) (string, error)
- func GetConfigMetadataSettings() (map[string]string, error)
- func GetContext(name string) (*configtypes.Context, error)
- func GetContextsByType(contextType configtypes.ContextType) ([]*configtypes.Context, error)
- func GetCurrentContext(target configtypes.Target) (c *configtypes.Context, err error)deprecated
- func GetCurrentServer() (*configtypes.Server, error)deprecated
- func GetEULAAcceptedVersions() ([]string, error)
- func GetEdition() (string, error)deprecated
- func GetEnv(key string) (string, error)
- func GetEnvConfigurations() map[string]string
- func GetKubeconfigForContext(contextName string, opts ...ResourceOptions) ([]byte, error)
- func GetMetadata() (*configtypes.Metadata, error)
- func GetServer(name string) (*configtypes.Server, error)deprecated
- func GetTanzuContextAccessToken(contextName string) (string, error)
- func GetTanzuPluginConfigDir() (string, error)
- func IsConfigMetadataSettingsEnabled(key string) (bool, error)
- func IsFeatureActivated(feature string) bool
- func IsFeatureEnabled(plugin, key string) (bool, error)
- func LocalDir() (path string, err error)
- func PopulateContexts(cfg *configtypes.ClientConfig) bool
- func PutServer(s *configtypes.Server, setCurrent bool) errordeprecated
- func ReleaseTanzuConfigLock()
- func ReleaseTanzuConfigNextGenLock()
- func ReleaseTanzuMetadataLock()
- func RemoveActiveContext(contextType configtypes.ContextType) error
- func RemoveContext(name string) error
- func RemoveCurrentContext(target configtypes.Target) errordeprecated
- func RemoveCurrentServer(name string) errordeprecated
- func RemoveServer(name string) errordeprecated
- func ServerExists(name string) (bool, error)deprecated
- func SetActiveContext(name string) error
- func SetCEIPOptIn(val string) (err error)
- func SetCLIDiscoverySource(discoverySource configtypes.PluginDiscovery) (err error)
- func SetCLIDiscoverySources(discoverySources []configtypes.PluginDiscovery) (err error)
- func SetCLIId(val string) (err error)
- func SetCLIRepository(repository configtypes.PluginRepository) (err error)deprecated
- func SetCLITelemetryOptions(c *configtypes.TelemetryOptions) error
- func SetCert(c *configtypes.Cert) error
- func SetConfigMetadataPatchStrategies(patchStrategies map[string]string) error
- func SetConfigMetadataPatchStrategy(key, value string) error
- func SetConfigMetadataSetting(key, value string) (err error)
- func SetContext(c *configtypes.Context, setCurrent bool) error
- func SetCurrentContext(name string) errordeprecated
- func SetCurrentServer(name string) errordeprecated
- func SetEULAAcceptedVersions(acceptedVersions []string) (err error)
- func SetEULAStatus(val EULAStatus) (err error)
- func SetEdition(val string) (err error)deprecated
- func SetEnv(key, value string) (err error)
- func SetFeature(plugin, key, value string) (err error)
- func SetServer(s *configtypes.Server, setCurrent bool) errordeprecated
- func SetTanzuContextActiveResource(contextName string, resourceInfo ResourceInfo, opts ...CommandOptions) error
- func StoreClientConfig(cfg *configtypes.ClientConfig) error
- func UseUnifiedConfig() (bool, error)
- type CfgOptions
- type CfgOpts
- type CommandOptions
- type EULAStatus
- type FeatureOptions
- type IdpType
- type Options
- type ResourceInfo
- type ResourceOptions
Constants ¶
const ( // EnvConfigKey is the environment variable that points to a tanzu config. EnvConfigKey = "TANZU_CONFIG" // ConfigName is the name of the config ConfigName = "config.yaml" )
const ( // EnvConfigNextGenKey is the environment variable that points to a tanzu config. EnvConfigNextGenKey = "TANZU_CONFIG_NEXT_GEN" // CfgNextGenName is the name of the config metadata CfgNextGenName = "config-ng.yaml" )
const ( LocalTanzuConfigNextGenFileLock = ".tanzu-config-ng.lock" // DefaultConfigNextGenLockTimeout is the default time waiting on the filelock DefaultConfigNextGenLockTimeout = 10 * time.Minute )
const ( // EnvEndpointKey is the environment variable that overrides the tanzu endpoint. EnvEndpointKey = "TANZU_ENDPOINT" //nolint:gosec // Avoid "hardcoded credentials" false positive. // EnvAPITokenKey is the environment variable that overrides the tanzu API token for global auth. EnvAPITokenKey = "TANZU_API_TOKEN" )
const ( KeyServers = "servers" KeyContexts = "contexts" KeyCurrentServer = "current" KeyCurrentContext = "currentContext" KeyClientOptions = "clientOptions" KeyCLI = "cli" KeyFeatures = "features" KeyEnv = "env" KeyDiscoverySources = "discoverySources" KeyRepositories = "repositories" KeyUnstableVersionSelector = "unstableVersionSelector" KeyEdition = "edition" KeyKind = "kind" KeyMetadata = "metadata" KeyAPIVersion = "apiVersion" KeyBomRepo = "bomRepo" KeyCompatibilityFilePath = "compatibilityFilePath" KeyCEIPOptIn = "ceipOptIn" KeyEULAStatus = "eulaStatus" KeyEULAVersions = "eulaAcceptedVersions" KeyCerts = "certs" KeyTelemetry = "telemetry" KeyCLIId = "cliId" KeySource = "source" KeyAdditionalMetadata = "additionalMetadata" )
Keys used to parse the yaml node to retrieve specific stanza of the config file
const ( DiscoveryTypeOCI = "oci" DiscoveryTypeLocal = "local" DiscoveryTypeGCP = "gcp" DiscoveryTypeKubernetes = "kubernetes" DiscoveryTypeREST = "rest" )
DiscoveryType constants
const ( LocalTanzuFileLock = ".tanzu.lock" // DefaultLockTimeout is the default time waiting on the filelock DefaultLockTimeout = 10 * time.Minute )
const ( // EnvConfigMetadataKey is the environment variable that points to a tanzu config. EnvConfigMetadataKey = "TANZU_CONFIG_METADATA" // CfgMetadataName is the name of the config metadata hidden file CfgMetadataName = ".config-metadata.yaml" )
const ( KeyConfigMetadata = "configMetadata" KeyPatchStrategy = "patchStrategy" KeySettings = "settings" )
Keys used to parse the yaml node to retrieve specific stanza of the config file
const ( LocalTanzuMetadataFileLock = ".tanzu-metadata.lock" // DefaultMetadataLockTimeout is the default time waiting on the filelock DefaultMetadataLockTimeout = 10 * time.Minute )
const ( OrgIDKey = "tanzuOrgID" OrgNameKey = "tanzuOrgName" ProjectNameKey = "tanzuProjectName" ProjectIDKey = "tanzuProjectID" SpaceNameKey = "tanzuSpaceName" ClusterGroupNameKey = "tanzuClusterGroupName" TanzuMissionControlEndpointKey = "tanzuMissionControlEndpoint" TanzuHubEndpointKey = "tanzuHubEndpoint" TanzuAuthEndpointKey = "tanzuAuthEndpoint" TanzuIdpTypeKey = "tanzuIdpType" )
keys to Context's AdditionalMetadata map
const (
Default = "default"
)
const (
SettingUseUnifiedConfig = "useUnifiedConfig"
)
Variables ¶
var ( // LocalDirName is the name of the local directory in which tanzu state is stored. LocalDirName = ".config/tanzu" // TestLocalDirName is the name of the local directory in which tanzu state is stored for testing. TestLocalDirName = ".tanzu-test" )
var DiscardedConfigNodeKeys = []string{ KeyContexts, KeyCurrentContext, }
var LegacyConfigNodeKeys = []string{ KeyAPIVersion, KeyKind, KeyMetadata, KeyClientOptions, KeyServers, KeyCurrentServer, }
LegacyConfigNodeKeys config nodes that goes to config.yaml
var (
// PluginsBaseDir is the name of the plugins owned base directory in which plugin owned settings is stored.
PluginsBaseDir = "plugins"
)
Functions ¶
func AcquireTanzuConfigLock ¶
func AcquireTanzuConfigLock()
AcquireTanzuConfigLock tries to acquire lock to update tanzu config file with timeout
func AcquireTanzuConfigNextGenLock ¶ added in v0.0.2
func AcquireTanzuConfigNextGenLock()
AcquireTanzuConfigNextGenLock tries to acquire lock to update tanzu config file with timeout
func AcquireTanzuMetadataLock ¶ added in v0.0.2
func AcquireTanzuMetadataLock()
AcquireTanzuMetadataLock tries to acquire lock to update tanzu config metadata file with timeout
func AddContext ¶
func AddContext(c *configtypes.Context, setCurrent bool) error
AddContext add or update context and currentContext
func AddServer
deprecated
func AddServer(s *configtypes.Server, setCurrent bool) error
AddServer add or update server and currentServer
Deprecated: This API is deprecated. Use AddContext or SetContext instead.
func CertExists ¶ added in v0.90.0
CertExists checks if cert config by host or URI already exists
func CfgMetadataFilePath ¶ added in v0.0.2
func ClientConfigNextGenPath ¶ added in v0.0.2
ClientConfigNextGenPath retrieved config-alt file path
func ClientConfigPath ¶
ClientConfigPath returns the tanzu config path, checking for environment overrides.
func ConfigureDefaultFeatureFlagsIfMissing ¶ added in v0.0.2
func ConfigureDefaultFeatureFlagsIfMissing(plugin string, defaultFeatureFlags map[string]bool) error
ConfigureDefaultFeatureFlagsIfMissing add or update plugin features based on specified default feature flags
func ConfigureFeatureFlags ¶ added in v1.2.0
ConfigureFeatureFlags sets default feature flags to ClientConfig if they are missing. It accepts a map of feature flags and a variadic Options parameter to apply additional settings.
func ContextExists ¶
ContextExists checks if context by name already exists
func CopyLegacyConfigDir ¶
func CopyLegacyConfigDir() error
CopyLegacyConfigDir copies configuration files from legacy config dir to the new location. This is a no-op if the legacy dir does not exist or if the new config dir already exists. Deprecated: This API is deprecated use config next gen APIs
func DeleteCLIDiscoverySource ¶ added in v0.0.2
DeleteCLIDiscoverySource delete cli discoverySource by name
func DeleteCLIRepository
deprecated
added in
v0.0.2
func DeleteCert ¶ added in v0.90.0
DeleteCert delete a cert configuration by host
func DeleteClientConfig ¶
func DeleteClientConfig() error
DeleteClientConfig deletes the config yaml from the local directory.
func DeleteClientConfigNextGen ¶ added in v0.0.2
func DeleteClientConfigNextGen() error
DeleteClientConfigNextGen deletes the config-ng yaml from the local directory.
func DeleteConfigMetadataSetting ¶ added in v0.0.2
DeleteConfigMetadataSetting delete the env entry of specified key
func DeleteContext ¶ added in v0.0.2
DeleteContext delete a context by name
func DeleteFeature ¶ added in v0.0.2
DeleteFeature deletes the specified plugin key
func DeleteServer
deprecated
added in
v0.0.2
func DeleteTelemetryOptions ¶ added in v1.0.0
func DeleteTelemetryOptions() error
DeleteTelemetryOptions deletes the telemetry options from the CLI configuration
func EndpointFromContext ¶
func EndpointFromContext(s *configtypes.Context) (endpoint string, err error)
EndpointFromContext retrieved the endpoint from the specified context
func EndpointFromServer
deprecated
func EndpointFromServer(s *configtypes.Server) (endpoint string, err error)
EndpointFromServer returns the endpoint from server.
Deprecated: This API is deprecated. Use EndpointFromContext instead.
func GetActiveContext ¶ added in v1.1.0
func GetActiveContext(contextType configtypes.ContextType) (c *configtypes.Context, err error)
GetActiveContext retrieves the active context for the specified contextType
func GetAllActiveContextsList ¶ added in v1.1.0
GetAllActiveContextsList returns all active context names as list
func GetAllActiveContextsMap ¶ added in v1.1.0
func GetAllActiveContextsMap() (map[configtypes.ContextType]*configtypes.Context, error)
GetAllActiveContextsMap returns all active context per ContextType
func GetAllCurrentContextsList
deprecated
added in
v0.0.2
func GetAllCurrentContextsMap
deprecated
added in
v0.0.2
func GetAllCurrentContextsMap() (map[configtypes.Target]*configtypes.Context, error)
GetAllCurrentContextsMap returns all current context per Target
Deprecated: GetAllCurrentContextsMap is deprecated. Use GetAllActiveContextsMap instead
func GetAllEnvs ¶ added in v0.0.2
GetAllEnvs retrieves all env values from config
func GetAllFeatureFlags ¶ added in v1.2.0
func GetAllFeatureFlags() (map[string]types.FeatureMap, error)
GetAllFeatureFlags retrieves all feature flags values from config
func GetCEIPOptIn ¶ added in v0.80.0
GetCEIPOptIn retrieves ClientOptions ceipOptIn
func GetCLIDiscoverySource ¶ added in v0.0.2
func GetCLIDiscoverySource(name string) (*configtypes.PluginDiscovery, error)
GetCLIDiscoverySource retrieves cli discovery source by name assuming that there should only be one source with the name, returns the first match
func GetCLIDiscoverySources ¶ added in v0.0.2
func GetCLIDiscoverySources() ([]configtypes.PluginDiscovery, error)
GetCLIDiscoverySources retrieves cli discovery sources
func GetCLIRepositories
deprecated
added in
v0.0.2
func GetCLIRepositories() ([]configtypes.PluginRepository, error)
GetCLIRepositories retrieves cli repositories
Deprecated: This API is deprecated
func GetCLIRepository
deprecated
added in
v0.0.2
func GetCLIRepository(name string) (*configtypes.PluginRepository, error)
GetCLIRepository retrieves cli repository by name
Deprecated: This API is deprecated
func GetCLITelemetryOptions ¶ added in v1.0.0
func GetCLITelemetryOptions() (*configtypes.TelemetryOptions, error)
GetCLITelemetryOptions retrieves the CLI telemetry configuration
func GetCert ¶ added in v0.90.0
func GetCert(host string) (*configtypes.Cert, error)
GetCert retrieves the cert configuration by host or URI
func GetCerts ¶ added in v0.90.0
func GetCerts() ([]*configtypes.Cert, error)
GetCerts retrieves all the certs
func GetClientConfig ¶
func GetClientConfig() (cfg *configtypes.ClientConfig, err error)
GetClientConfig retrieves the config from the local directory with file lock
func GetClientConfigNoLock ¶
func GetClientConfigNoLock() (cfg *configtypes.ClientConfig, err error)
GetClientConfigNoLock retrieves the config from the local directory without acquiring the lock
func GetConfigMetadata ¶ added in v0.0.2
func GetConfigMetadata() (*configtypes.ConfigMetadata, error)
GetConfigMetadata retrieves configMetadata
func GetConfigMetadataPatchStrategy ¶ added in v0.0.2
GetConfigMetadataPatchStrategy retrieves patch strategies
func GetConfigMetadataSetting ¶ added in v0.0.2
func GetConfigMetadataSettings ¶ added in v0.0.2
GetConfigMetadataSettings retrieves feature flags
func GetContext ¶
func GetContext(name string) (*configtypes.Context, error)
GetContext retrieves the context by name
func GetContextsByType ¶ added in v1.1.0
func GetContextsByType(contextType configtypes.ContextType) ([]*configtypes.Context, error)
GetContextsByType retrieves the contexts of a provided context type
func GetCurrentContext
deprecated
func GetCurrentContext(target configtypes.Target) (c *configtypes.Context, err error)
GetCurrentContext retrieves the current context for the specified target
Deprecated: GetCurrentContext is deprecated. Use GetActiveContext instead
func GetCurrentServer
deprecated
func GetCurrentServer() (*configtypes.Server, error)
GetCurrentServer retrieves the current server
Deprecated: This API is deprecated. Use GetCurrentContext instead.
func GetEULAAcceptedVersions ¶ added in v1.1.0
GetEULAAcceptedVersions returns the list of EULA versions accepted
func GetEdition
deprecated
func GetEnvConfigurations ¶
GetEnvConfigurations returns a map of configured environment variables to values as part of tanzu configuration file it returns nil if configuration is not yet defined
func GetKubeconfigForContext ¶ added in v1.1.0
func GetKubeconfigForContext(contextName string, opts ...ResourceOptions) ([]byte, error)
GetKubeconfigForContext returns the kubeconfig for any arbitrary kubernetes resource or Tanzu resource in the Tanzu object hierarchy referred by the Tanzu context Pre-reqs: projectID, space and clustergroup names should be valid for retrieving Kubeconfig of Tanzu context
Notes:
Use Case 1: Get the kubeconfig pointing to Tanzu org -> projectID = "" -> spaceName = "" -> clusterGroupName = "" ex: kubeconfig's cluster.server URL : https://endpoint/org/orgid
Use Case 2: Get the kubeconfig pointing to Tanzu project -> projectID = "PROJECTNAME" -> spaceName = "" -> clusterGroupName = "" ex: kubeconfig's cluster.server URL : https://endpoint/org/orgid/project/<projectID>
Use Case 3: Get the kubeconfig pointing to Tanzu space -> projectID = "PROJECTID" -> spaceName = "SPACENAME" -> clusterGroupName = "" ex: kubeconfig's cluster.server URL : https://endpoint/org/orgid/project/<projectID>/space/<spaceName>
Use Case 4: Get the kubeconfig pointing to Tanzu clustergroup -> projectID = "PROJECTID" -> spaceName = "" -> clusterGroupName = "CLUSTERGROUPNAME" ex: kubeconfig's cluster.server URL : https://endpoint/org/orgid/project/<projectID>/clustergroup/<clustergroupName>
Note: Specifying `spaceName` and `clusterGroupName` both at the same time is incorrect input.
Use Case 5: Get the kubeconfig pointing to Kubernetes context -> projectID = "" -> spaceName = "" -> clusterGroupName = ""
func GetMetadata ¶ added in v0.0.2
func GetMetadata() (*configtypes.Metadata, error)
GetMetadata retrieves Metadata
func GetServer
deprecated
func GetServer(name string) (*configtypes.Server, error)
GetServer retrieves server by name
Deprecated: This API is deprecated. Use GetContext instead.
func GetTanzuContextAccessToken ¶ added in v1.3.0
GetTanzuContextAccessToken returns working access token for the specified Tanzu Context
func GetTanzuPluginConfigDir ¶ added in v1.1.0
GetTanzuPluginConfigDir Retrieve the tanzu configuration directory that can be used by the plugins to // create a plugin specific directory to manage plugin owned configurations. .config/tanzu/plugins
func IsConfigMetadataSettingsEnabled ¶ added in v0.0.2
IsConfigMetadataSettingsEnabled checks and returns whether specific plugin and key is true
func IsFeatureActivated ¶
IsFeatureActivated returns true if the given feature is activated User can set this CLI feature flag using `tanzu config set features.global.<feature> true`
func IsFeatureEnabled ¶ added in v0.0.2
IsFeatureEnabled checks and returns whether specific plugin and key is true
func PopulateContexts ¶
func PopulateContexts(cfg *configtypes.ClientConfig) bool
PopulateContexts converts the known servers that are missing in contexts. This is needed when reading the config file persisted by an older core or plugin, so that it is forwards compatible with a new core plugin. Returns true if there was any delta.
func PutServer
deprecated
func PutServer(s *configtypes.Server, setCurrent bool) error
PutServer add or update server and currentServer
Deprecated: This API is deprecated. Use AddContext or SetContext instead.
func ReleaseTanzuConfigLock ¶
func ReleaseTanzuConfigLock()
ReleaseTanzuConfigLock releases the lock if the tanzuConfigLock was acquired
func ReleaseTanzuConfigNextGenLock ¶ added in v0.0.2
func ReleaseTanzuConfigNextGenLock()
ReleaseTanzuConfigNextGenLock releases the lock if the tanzuConfigLock was acquired
func ReleaseTanzuMetadataLock ¶ added in v0.0.2
func ReleaseTanzuMetadataLock()
ReleaseTanzuMetadataLock releases the lock if the tanzuMetadataLock was acquired
func RemoveActiveContext ¶ added in v1.1.0
func RemoveActiveContext(contextType configtypes.ContextType) error
RemoveActiveContext removed the current context of specified context type
func RemoveCurrentContext
deprecated
added in
v0.0.2
func RemoveCurrentContext(target configtypes.Target) error
RemoveCurrentContext removed the current context of specified context type
Deprecated: RemoveCurrentContext is deprecated. Use RemoveActiveContext instead
func RemoveCurrentServer
deprecated
added in
v0.0.2
func RemoveServer
deprecated
func ServerExists
deprecated
func SetActiveContext ¶ added in v1.1.0
SetActiveContext sets the active context to the specified name if context is present
func SetCEIPOptIn ¶ added in v0.80.0
SetCEIPOptIn adds or updates ceipOptIn value
func SetCLIDiscoverySource ¶ added in v0.0.2
func SetCLIDiscoverySource(discoverySource configtypes.PluginDiscovery) (err error)
SetCLIDiscoverySource add or update a cli discoverySource
func SetCLIDiscoverySources ¶ added in v0.0.2
func SetCLIDiscoverySources(discoverySources []configtypes.PluginDiscovery) (err error)
SetCLIDiscoverySources Add/Update array of cli discovery sources to the yaml node
func SetCLIRepository
deprecated
added in
v0.0.2
func SetCLIRepository(repository configtypes.PluginRepository) (err error)
SetCLIRepository add or update a repository
Deprecated: This API is deprecated
func SetCLITelemetryOptions ¶ added in v1.0.0
func SetCLITelemetryOptions(c *configtypes.TelemetryOptions) error
SetCLITelemetryOptions add or update CLI telemetry configuration
func SetCert ¶ added in v0.90.0
func SetCert(c *configtypes.Cert) error
SetCert add or update cert configuration
func SetConfigMetadataPatchStrategies ¶ added in v0.0.2
SetConfigMetadataPatchStrategies add or update map of patch strategies
func SetConfigMetadataPatchStrategy ¶ added in v0.0.2
SetConfigMetadataPatchStrategy add or update patch strategy specified by key-value pair
func SetConfigMetadataSetting ¶ added in v0.0.2
SetConfigMetadataSetting add or update a env key and value
func SetContext ¶ added in v0.0.2
func SetContext(c *configtypes.Context, setCurrent bool) error
SetContext add or update context and currentContext
func SetCurrentContext
deprecated
func SetCurrentServer
deprecated
func SetEULAAcceptedVersions ¶ added in v1.1.0
SetEULAAcceptedVersions updates the list of EULA versions accepted
func SetEULAStatus ¶ added in v0.90.0
func SetEULAStatus(val EULAStatus) (err error)
SetEULAStatus adds or updates the EULA status
func SetEdition
deprecated
added in
v0.0.2
func SetFeature ¶ added in v0.0.2
SetFeature add or update plugin key value
func SetServer
deprecated
added in
v0.0.2
func SetServer(s *configtypes.Server, setCurrent bool) error
SetServer add or update server and currentServer
Deprecated: This API is deprecated. Use AddContext or SetContext instead.
func SetTanzuContextActiveResource ¶ added in v1.1.0
func SetTanzuContextActiveResource(contextName string, resourceInfo ResourceInfo, opts ...CommandOptions) error
SetTanzuContextActiveResource sets the active Tanzu resource for the given context and also updates the kubeconfig referenced by the context of type Tanzu
Pre-reqs: project and space/clustergroup names should be valid
Note: To set
- a space as active resource, both project,projectID and space names are required
- a clustergroup as active resource, both project,projectID and clustergroup names are required
- a project as active resource, only project name and project ID are required (space should be empty string)
- org as active resource, project name, project ID, space and clustergroup names should be empty strings
func StoreClientConfig ¶
func StoreClientConfig(cfg *configtypes.ClientConfig) error
StoreClientConfig stores the config in the local directory. Make sure to Acquire and Release tanzu lock when reading/writing to the tanzu client configuration Deprecated: StoreClientConfig is deprecated. Avoid using this method for Delete operations. Use New Config API methods.
func UseUnifiedConfig ¶ added in v0.0.2
UseUnifiedConfig checks useUnifiedConfig feature flag
Types ¶
type CfgOptions ¶ added in v0.0.2
type CfgOptions struct {
CfgPath string // file path to the config file
}
type CfgOpts ¶ added in v0.0.2
type CfgOpts func(config *CfgOptions)
func WithCfgPath ¶ added in v0.0.2
type CommandOptions ¶ added in v1.1.0
type CommandOptions func(o *cmdOptions)
func WithErrorWriter ¶ added in v1.1.0
func WithErrorWriter(errWriter io.Writer) CommandOptions
WithErrorWriter specifies the CommandOption for configuring Stderr
func WithNoStderr ¶ added in v1.1.0
func WithNoStderr() CommandOptions
WithNoStderr specifies to ignore stderr
func WithNoStdout ¶ added in v1.1.0
func WithNoStdout() CommandOptions
WithNoStdout specifies to ignore stdout
func WithOutputWriter ¶ added in v1.1.0
func WithOutputWriter(outWriter io.Writer) CommandOptions
WithOutputWriter specifies the CommandOption for configuring Stdout
type EULAStatus ¶ added in v0.90.0
type EULAStatus string
EULAStatus is the user's EULA acceptance status
const ( // User is shown the EULA, but has not accepted it. EULAStatusShown EULAStatus = "shown" // User has accepted EULA. EULAStatusAccepted EULAStatus = "accepted" // Acceptance state is not set EULAStatusUnset EULAStatus = "" )
func GetEULAStatus ¶ added in v0.90.0
func GetEULAStatus() (EULAStatus, error)
GetEULAStatus retrieves EULA status
type FeatureOptions ¶ added in v1.2.0
type FeatureOptions struct {
SkipIfExists bool // SkipIfExists indicates whether to skip setting the feature flag if it already exists.
}
FeatureOptions is a struct that defines the options for feature flag configuration.
type Options ¶ added in v1.2.0
type Options func(opts *FeatureOptions)
Options is a function type that applies configuration options to FeatureOptions.
func SkipIfExists ¶ added in v1.2.0
func SkipIfExists() Options
SkipIfExists returns an Options function that sets the SkipIfExists option to true.
type ResourceInfo ¶ added in v1.1.0
type ResourceInfo struct { // OrgID ID of the Organization OrgID string // OrgName name of the Organization OrgName string // ProjectName name of the Project ProjectName string // ProjectID ID of the Project. ProjectID string // SpaceName name of the Space SpaceName string // ClusterGroupName name of the ClusterGroup ClusterGroupName string }
ResourceInfo contains information identifying the Tanzu resource associated with the Context
func GetTanzuContextActiveResource ¶ added in v1.1.0
func GetTanzuContextActiveResource(contextName string) (*ResourceInfo, error)
GetTanzuContextActiveResource returns the Tanzu active resource information for the given context
type ResourceOptions ¶ added in v1.2.0
type ResourceOptions func(o *resourceOptions)
func ForClusterGroup ¶ added in v1.2.0
func ForClusterGroup(clusterGroupName string) ResourceOptions
func ForCustomPath ¶ added in v1.2.0
func ForCustomPath(customPath string) ResourceOptions
func ForProject ¶ added in v1.2.0
func ForProject(projectID string) ResourceOptions
func ForSpace ¶ added in v1.2.0
func ForSpace(spaceName string) ResourceOptions
Source Files ¶
- certs.go
- cli_discovery_sources.go
- cli_options.go
- cli_options_nextgen.go
- cli_options_telemetry.go
- cli_repositories.go
- clientconfig_factory.go
- clientconfig_filesystem.go
- clientconfignextgen_factory.go
- clientconfignextgen_filesystem.go
- clientconfignextgen_lock.go
- config_factory.go
- config_filesystem.go
- config_keys.go
- config_types.go
- contexts.go
- conversion.go
- discovery_sources_node.go
- envs.go
- features.go
- fileutil.go
- legacy_clientconfig.go
- legacy_clientconfig_factory.go
- legacy_clientconfig_filesystem.go
- lock.go
- metadata_api.go
- metadata_factory.go
- metadata_filesystem.go
- metadata_keys.go
- metadata_lock.go
- metadata_settings_api.go
- plugin-owned.go
- servers.go
- tanzu_context.go
Directories ¶
Path | Synopsis |
---|---|
Package collectionutils provide helper functions to operate on collections like array, map
|
Package collectionutils provide helper functions to operate on collections like array, map |
internal
|
|
kubeconfig
Package kubeconfig provides the kubeconfig file access functionality
|
Package kubeconfig provides the kubeconfig file access functionality |
Package nodeutils provides utility methods to perform operations on yaml node
|
Package nodeutils provides utility methods to perform operations on yaml node |
Package types specifies the types for clientconfig
|
Package types specifies the types for clientconfig |