config

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 20, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dir

func Dir() string

Dir returns the directory where the config file is stored. It will use the home directory if possible otherwise the current directory.

Types

type Config added in v0.3.0

type Config struct {
	*viper.Viper
	// contains filtered or unexported fields
}

func New

func New() *Config

func (*Config) ClearClusterNodes added in v0.3.0

func (c *Config) ClearClusterNodes(clusterName string) error

ClearClusterNodes removes all nodes under a cluster while keeping the cluster metadata intact. This is used during import to sync the node list.

func (*Config) CurrentClusterName added in v0.3.0

func (c *Config) CurrentClusterName() string

CurrentClusterName returns the current cluster name, or "" if none is set.

func (*Config) CurrentConfig added in v0.3.0

func (c *Config) CurrentConfig() (*Config, bool)

CurrentConfig returns the current node configuration if it exists. It first checks cluster-aware config, then falls back to legacy.

func (*Config) CurrentNodeName added in v0.3.0

func (c *Config) CurrentNodeName() string

CurrentNodeName returns the current node name from the configuration, if set.

func (*Config) DeleteClusterNode added in v0.3.0

func (c *Config) DeleteClusterNode(clusterName, nodeName string) error

DeleteClusterNode removes a single node from a cluster.

func (*Config) GetClusterNodeConfig added in v0.3.0

func (c *Config) GetClusterNodeConfig(clusterName, nodeName string) (*Config, bool)

GetClusterNodeConfig returns the viper sub-tree for a node within a cluster.

func (*Config) GetNodeConfig added in v0.3.0

func (c *Config) GetNodeConfig(node string) (*Config, bool)

GetNodeConfig returns the configuration for the given node if it exists. It searches cluster-aware config first, then legacy.

func (*Config) IsLegacyConfig added in v0.3.0

func (c *Config) IsLegacyConfig() bool

IsLegacyConfig returns true if the config uses the old format (top-level "nodes" without "clusters"). Callers should warn the user to re-import.

func (*Config) ListClusterNodes added in v0.3.0

func (c *Config) ListClusterNodes(clusterName string) ([]string, error)

ListClusterNodes returns all node names belonging to a cluster.

func (*Config) ListClusters added in v0.3.0

func (c *Config) ListClusters() ([]string, error)

ListClusters returns the names of all clusters in the configuration.

func (*Config) SetClusterMetadata added in v0.3.0

func (c *Config) SetClusterMetadata(clusterName, subscriptionID, resourceGroup string) error

SetClusterMetadata stores the cluster-level metadata (subscription, resource-group, cluster-name) under clusters.<clusterName>.

func (*Config) SetClusterNodeConfigWithVMSSInfo added in v0.3.0

func (c *Config) SetClusterNodeConfigWithVMSSInfo(clusterName, nodeName, subscriptionID, nodeResourceGroup, vmssName, instanceID string) error

SetClusterNodeConfigWithVMSSInfo stores a node under a specific cluster.

func (*Config) SetNodeConfigWithNodeFlag added in v0.3.0

func (c *Config) SetNodeConfigWithNodeFlag(nodeName, nodeFlag string) error

SetNodeConfigWithNodeFlag sets the node configuration with based on node flag

func (*Config) SetNodeConfigWithResourceIDFlag added in v0.3.0

func (c *Config) SetNodeConfigWithResourceIDFlag(nodeName, resourceIDFlag string) error

SetNodeConfigWithResourceIDFlag sets the node configuration with based on resource ID flag

func (*Config) SetNodeConfigWithVMSSInfoFlag added in v0.3.0

func (c *Config) SetNodeConfigWithVMSSInfoFlag(nodeName, subscriptionIDFlag, nodeResourceGroupFlag, vmssFlag, instanceIDFlag string) error

SetNodeConfigWithVMSSInfoFlag sets the node configuration with vmss info flags

func (*Config) ShowConfig added in v0.3.0

func (c *Config) ShowConfig() error

ShowConfig prints the configuration to stdout

func (*Config) UnsetAllConfig added in v0.3.0

func (c *Config) UnsetAllConfig() error

UnsetAllConfig removes all the configuration

func (*Config) UnsetClusterConfig added in v0.3.0

func (c *Config) UnsetClusterConfig(clusterName string) error

UnsetClusterConfig removes an entire cluster and its nodes from the config.

func (*Config) UnsetCurrentClusterConfig added in v0.3.0

func (c *Config) UnsetCurrentClusterConfig() error

UnsetCurrentClusterConfig removes the current-cluster selection.

func (*Config) UnsetCurrentNodeConfig added in v0.3.0

func (c *Config) UnsetCurrentNodeConfig() error

UnsetCurrentNodeConfig removes the current node from the configuration

func (*Config) UnsetNodeConfig added in v0.3.0

func (c *Config) UnsetNodeConfig(targetNode string) error

UnsetNodeConfig removes the node configuration

func (*Config) UseClusterConfig added in v0.3.0

func (c *Config) UseClusterConfig(clusterName string) error

UseClusterConfig sets the current cluster in the configuration.

func (*Config) UseNodeConfig added in v0.3.0

func (c *Config) UseNodeConfig(targetNode string) error

UseNodeConfig sets the current node to use in the configuration. It searches across all clusters for the node.

Jump to

Keyboard shortcuts

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