Documentation ¶
Overview ¶
Package centralconfig implements an interface to deal with the central configuration.
Package centralconfig implements an interface to deal with the central configuration.
Package centralconfig implements an interface to deal with the central configuration.
Index ¶
Constants ¶
const ( KeyDefaultTanzuEndpoint = "cli.core.tanzu_default_endpoint" KeyDefaultPluginDBCacheRefreshThresholdSeconds = "cli.core.tanzu_cli_default_plugin_db_cache_refresh_threshold_seconds" KeyDefaultInventoryRefreshTTLSeconds = "cli.core.tanzu_cli_default_inventory_refresh_ttl_seconds" KeyTanzuEndpointMap = "cli.core.tanzu_endpoint_map" KeyTanzuPlatformSaaSEndpointsAsRegularExpression = "cli.core.tanzu_cli_platform_saas_endpoints_as_regular_expression" KeyTanzuConfigEndpointUpdateVersion = "cli.core.tanzu_cli_config_endpoint_update_version" KeyTanzuConfigEndpointUpdateMapping = "cli.core.tanzu_cli_config_endpoint_update_mapping" )
Variables ¶
var ( // NOTE: This value will be overwritten from the value specified in the central configuration. // It serves as a fallback default only if reading the central configuration fails. DefaultTanzuPlatformEndpoint = "https://api.tanzu.cloud.vmware.com" // DefaultPluginDBCacheRefreshThresholdSeconds is the default value for db cache refresh // For testing, it can be overridden using the environment variable TANZU_CLI_PLUGIN_DB_CACHE_REFRESH_THRESHOLD_SECONDS. // It serves as a fallback default only if reading the central configuration fails. DefaultPluginDBCacheRefreshThresholdSeconds = 24 * 60 * 60 // 24 hours // DefaultInventoryRefreshTTLSeconds is the interval in seconds between two checks of the inventory digest. // For testing, it can be overridden using the environment variable TANZU_CLI_PLUGIN_DB_CACHE_TTL_SECONDS. DefaultInventoryRefreshTTLSeconds = 30 * 60 // 30 minutes // DefaultCentralConfigReader is a pre-initialized default central configuration reader instance. // This global object can be used directly to read configuration from the default central configuration. DefaultCentralConfigReader = newDefaultCentralConfigReader() )
Functions ¶
This section is empty.
Types ¶
type CentralConfig ¶
type CentralConfig interface { // GetCentralConfigEntry reads the central configuration and // returns the value for the given key. The value is unmarshalled // into the out parameter. The out parameter must be a non-nil // pointer to a value. If the key does not exist, the out parameter // is not modified and an error is returned. GetCentralConfigEntry(key string, out interface{}) error // GetDefaultTanzuEndpoint returns default endpoint for the tanzu platform from the default // central configuration file GetDefaultTanzuEndpoint() (string, error) // GetPluginDBCacheRefreshThresholdSeconds returns default value for central db cache refresh in seconds // from the default central configuration file GetPluginDBCacheRefreshThresholdSeconds() (int, error) // GetInventoryRefreshTTLSeconds returns default value for central db refresh TTL in seconds // from the default central configuration file GetInventoryRefreshTTLSeconds() (int, error) // GetTanzuPlatformEndpointToServiceEndpointMap returns Map of tanzu platform endpoint to service endpoints // from the default central configuration file GetTanzuPlatformEndpointToServiceEndpointMap() (TanzuPlatformEndpointToServiceEndpointMap, error) // GetTanzuPlatformSaaSEndpointList returns list of tanzu platform saas endpoints which can be a regular // expression. When comparing the result please make sure to use regex match instead of string comparison GetTanzuPlatformSaaSEndpointList() []string // GetTanzuConfigEndpointUpdateVersion returns current version for the local configuration file update // If the version specified here does not match with the local version stored in the datastore that means // the local configuration file endpoint updates are required GetTanzuConfigEndpointUpdateVersion() (string, error) // GetTanzuConfigEndpointUpdateMapping returns mapping of old endpoints to new endpoints that needs to be updated // in the user's local configuration file GetTanzuConfigEndpointUpdateMapping() (map[string]string, error) }
CentralConfig is used to interact with the central configuration.
type KeyNotFoundError ¶
type KeyNotFoundError struct {
Key string
}
KeyNotFoundError represents an error when the key is not found in the central configuration.
func (*KeyNotFoundError) Error ¶
func (e *KeyNotFoundError) Error() string
type ServiceEndpointMap ¶ added in v1.5.0
type ServiceEndpointMap struct { // UCPEndpoint is the endpoint for the UCP (Unified Control Plane) service. UCPEndpoint string `yaml:"ucp"` // TMCEndpoint is the endpoint for the TMC (Tanzu Mission Control) service. TMCEndpoint string `yaml:"tmc"` // HubEndpoint is the endpoint for the Tanzu Hub service. HubEndpoint string `yaml:"hub"` }
ServiceEndpointMap represents a map of service endpoints for a Tanzu platform. It contains the endpoints for UCP, TMC, and Hub services.
type TanzuPlatformEndpointToServiceEndpointMap ¶ added in v1.5.0
type TanzuPlatformEndpointToServiceEndpointMap map[string]ServiceEndpointMap
TanzuPlatformEndpointToServiceEndpointMap is a map that maps Tanzu platform endpoints to service endpoint maps. It is used to store the endpoints for different Tanzu services, such as UCP, TMC, and Hub.