config

package
v1.4.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 22 Imported by: 21

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

View Source
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"
)
View Source
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"
)
View Source
const (
	LocalTanzuConfigNextGenFileLock = ".tanzu-config-ng.lock"
	// DefaultConfigNextGenLockTimeout is the default time waiting on the filelock
	DefaultConfigNextGenLockTimeout = 10 * time.Minute
)
View Source
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"
)
View Source
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

View Source
const (
	DiscoveryTypeOCI        = "oci"
	DiscoveryTypeLocal      = "local"
	DiscoveryTypeGCP        = "gcp"
	DiscoveryTypeKubernetes = "kubernetes"
	DiscoveryTypeREST       = "rest"
)

DiscoveryType constants

View Source
const (
	LocalTanzuFileLock = ".tanzu.lock"
	// DefaultLockTimeout is the default time waiting on the filelock
	DefaultLockTimeout = 10 * time.Minute
)
View Source
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"
)
View Source
const (
	KeyConfigMetadata = "configMetadata"
	KeyPatchStrategy  = "patchStrategy"
	KeySettings       = "settings"
)

Keys used to parse the yaml node to retrieve specific stanza of the config file

View Source
const (
	LocalTanzuMetadataFileLock = ".tanzu-metadata.lock"
	// DefaultMetadataLockTimeout is the default time waiting on the filelock
	DefaultMetadataLockTimeout = 10 * time.Minute
)
View Source
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

View Source
const (
	Default = "default"
)
View Source
const (
	SettingUseUnifiedConfig = "useUnifiedConfig"
)

Variables

View Source
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"
)
View Source
var DiscardedConfigNodeKeys = []string{
	KeyContexts,
	KeyCurrentContext,
}

LegacyConfigNodeKeys config nodes that goes to config.yaml

View Source
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

func CertExists(host string) (bool, error)

CertExists checks if cert config by host or URI already exists

func CfgMetadataFilePath added in v0.0.2

func CfgMetadataFilePath() (path string, err error)

func ClientConfigNextGenPath added in v0.0.2

func ClientConfigNextGenPath() (path string, err error)

ClientConfigNextGenPath retrieved config-alt file path

func ClientConfigPath

func ClientConfigPath() (path string, err error)

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

func ConfigureFeatureFlags(defaultFeatureFlags map[string]bool, opts ...Options) error

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

func ContextExists(name string) (bool, error)

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

func DeleteCLIDiscoverySource(name string) error

DeleteCLIDiscoverySource delete cli discoverySource by name

func DeleteCLIRepository deprecated added in v0.0.2

func DeleteCLIRepository(name string) error

DeleteCLIRepository delete a cli repository by name

Deprecated: This API is deprecated

func DeleteCert added in v0.90.0

func DeleteCert(host string) error

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

func DeleteConfigMetadataSetting(key string) error

DeleteConfigMetadataSetting delete the env entry of specified key

func DeleteContext added in v0.0.2

func DeleteContext(name string) error

DeleteContext delete a context by name

func DeleteEnv added in v0.0.2

func DeleteEnv(key string) error

DeleteEnv delete the env entry of specified key

func DeleteFeature added in v0.0.2

func DeleteFeature(plugin, key string) error

DeleteFeature deletes the specified plugin key

func DeleteServer deprecated added in v0.0.2

func DeleteServer(name string) error

DeleteServer deletes the server specified by name

Deprecated: This API is deprecated. Use DeleteContext instead.

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

func GetAllActiveContextsList() ([]string, error)

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 GetAllCurrentContextsList() ([]string, error)

GetAllCurrentContextsList returns all current context names as list

Deprecated: GetAllCurrentContextsList is deprecated. Use GetAllActiveContextsList instead

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

func GetAllEnvs() (map[string]string, error)

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

func GetCEIPOptIn() (string, error)

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 GetCLIId added in v1.0.0

func GetCLIId() (string, error)

GetCLIId retrieves cliId

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

func GetConfigMetadataPatchStrategy() (map[string]string, error)

GetConfigMetadataPatchStrategy retrieves patch strategies

func GetConfigMetadataSetting added in v0.0.2

func GetConfigMetadataSetting(key string) (string, error)

func GetConfigMetadataSettings added in v0.0.2

func GetConfigMetadataSettings() (map[string]string, error)

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

func GetEULAAcceptedVersions() ([]string, error)

GetEULAAcceptedVersions returns the list of EULA versions accepted

func GetEdition deprecated

func GetEdition() (string, error)

GetEdition retrieves ClientOptions Edition

Deprecated: This API is deprecated

func GetEnv added in v0.0.2

func GetEnv(key string) (string, error)

GetEnv retrieves env value by key

func GetEnvConfigurations

func GetEnvConfigurations() map[string]string

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

func GetTanzuContextAccessToken(contextName string) (string, error)

GetTanzuContextAccessToken returns working access token for the specified Tanzu Context

func GetTanzuPluginConfigDir added in v1.1.0

func GetTanzuPluginConfigDir() (string, error)

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

func IsConfigMetadataSettingsEnabled(key string) (bool, error)

IsConfigMetadataSettingsEnabled checks and returns whether specific plugin and key is true

func IsFeatureActivated

func IsFeatureActivated(feature string) bool

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

func IsFeatureEnabled(plugin, key string) (bool, error)

IsFeatureEnabled checks and returns whether specific plugin and key is true

func LocalDir

func LocalDir() (path string, err error)

LocalDir returns the local directory in which tanzu state is stored.

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 RemoveContext

func RemoveContext(name string) error

RemoveContext delete a context by name

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 RemoveCurrentServer(name string) error

RemoveCurrentServer removes the current server if server exists by specified name

Deprecated: This API is deprecated. Use RemoveCurrentContext instead.

func RemoveServer deprecated

func RemoveServer(name string) error

RemoveServer removed the server by name

Deprecated: This API is deprecated. Use DeleteContext instead.

func ServerExists deprecated

func ServerExists(name string) (bool, error)

ServerExists checks if server by specified name is present in config

Deprecated: This API is deprecated. Use ContextExists instead.

func SetActiveContext added in v1.1.0

func SetActiveContext(name string) error

SetActiveContext sets the active context to the specified name if context is present

func SetCEIPOptIn added in v0.80.0

func SetCEIPOptIn(val string) (err error)

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 SetCLIId added in v1.0.0

func SetCLIId(val string) (err error)

SetCLIId adds or updates cliId value

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

func SetConfigMetadataPatchStrategies(patchStrategies map[string]string) error

SetConfigMetadataPatchStrategies add or update map of patch strategies

func SetConfigMetadataPatchStrategy added in v0.0.2

func SetConfigMetadataPatchStrategy(key, value string) error

SetConfigMetadataPatchStrategy add or update patch strategy specified by key-value pair

func SetConfigMetadataSetting added in v0.0.2

func SetConfigMetadataSetting(key, value string) (err error)

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 SetCurrentContext(name string) error

SetCurrentContext sets the current context to the specified name if context is present

Deprecated: SetCurrentContext is deprecated. Use SetActiveContext instead

func SetCurrentServer deprecated

func SetCurrentServer(name string) error

SetCurrentServer add or update current server

Deprecated: This API is deprecated. Use SetCurrentContext instead.

func SetEULAAcceptedVersions added in v1.1.0

func SetEULAAcceptedVersions(acceptedVersions []string) (err error)

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 SetEdition(val string) (err error)

SetEdition adds or updates edition value

Deprecated: This API is deprecated

func SetEnv added in v0.0.2

func SetEnv(key, value string) (err error)

SetEnv add or update a env key and value

func SetFeature added in v0.0.2

func SetFeature(plugin, key, value string) (err error)

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

func UseUnifiedConfig() (bool, error)

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

func WithCfgPath(path string) CfgOpts

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 IdpType added in v1.4.3

type IdpType string
const (
	// UAAIdpType indicates that IDP is UAA (User Account and Authentication)
	UAAIdpType IdpType = "uaa"

	// CSPIdpType indicsates the IDP is CSP (Cloud Service Provider)
	CSPIdpType IdpType = "csp"
)

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

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL