config

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AsyncKey            = "async"
	OutputFormatKey     = "output_format"
	ProjectIdKey        = "project_id"
	SessionTimeLimitKey = "session_time_limit"
	VerbosityKey        = "verbosity"

	IdentityProviderCustomEndpointKey = "identity_provider_custom_endpoint"

	ArgusCustomEndpointKey             = "argus_custom_endpoint"
	AuthorizationCustomEndpointKey     = "authorization_custom_endpoint"
	DNSCustomEndpointKey               = "dns_custom_endpoint"
	LoadBalancerCustomEndpointKey      = "load_balancer_custom_endpoint"
	LogMeCustomEndpointKey             = "logme_custom_endpoint"
	MariaDBCustomEndpointKey           = "mariadb_custom_endpoint"
	MongoDBFlexCustomEndpointKey       = "mongodbflex_custom_endpoint"
	ObjectStorageCustomEndpointKey     = "object_storage_custom_endpoint"
	OpenSearchCustomEndpointKey        = "opensearch_custom_endpoint"
	PostgresFlexCustomEndpointKey      = "postgresflex_custom_endpoint"
	RabbitMQCustomEndpointKey          = "rabbitmq_custom_endpoint"
	RedisCustomEndpointKey             = "redis_custom_endpoint"
	ResourceManagerEndpointKey         = "resource_manager_custom_endpoint"
	SecretsManagerCustomEndpointKey    = "secrets_manager_custom_endpoint"
	ServiceAccountCustomEndpointKey    = "service_account_custom_endpoint"
	ServiceEnablementCustomEndpointKey = "service_enablement_custom_endpoint"
	ServerBackupCustomEndpointKey      = "serverbackup_custom_endpoint"
	SKECustomEndpointKey               = "ske_custom_endpoint"
	SQLServerFlexCustomEndpointKey     = "sqlserverflex_custom_endpoint"

	ProjectNameKey     = "project_name"
	DefaultProfileName = "default"

	AsyncDefault            = false
	SessionTimeLimitDefault = "2h"
)

Supported config keys

View Source
const ProfileEnvVar = "STACKIT_CLI_PROFILE"

Variables

Functions

func CreateProfile added in v0.8.0

func CreateProfile(p *print.Printer, profile string, setProfile, emptyProfile bool) error

CreateProfile creates a new profile. If emptyProfile is true, it creates an empty profile. Otherwise, copies the config from the current profile to the new profile. If setProfile is true, it sets the new profile as the active profile. If the profile already exists, it returns an error.

func DeleteProfile added in v0.8.0

func DeleteProfile(p *print.Printer, profile string) error

DeleteProfile deletes a profile. If the profile does not exist or is the default profile, it returns an error. If the profile is the active profile, it sets the active profile to the default profile.

func DuplicateProfileConfiguration added in v0.8.0

func DuplicateProfileConfiguration(p *print.Printer, currentProfile, newProfile string) error

DuplicateProfileConfiguration duplicates the current profile configuration to a new profile. It copies the config file from the current profile to the new profile. If the current profile does not exist, it does nothing. If the new profile already exists, it will be overwritten.

func GetConfiguredProfile added in v0.8.0

func GetConfiguredProfile() (configuredProfile, activeProfile, configurationMethod string, err error)

GetConfiguredProfile returns the profile configured by the user, the profile to be used by the CLI and the method used to configure the profile. The profile is determined by the value of the STACKIT_CLI_PROFILE environment variable, or, if not set, by the contents of the profile file in the CLI config folder. If the configured profile is not set (env var or profile file) or is set but does not exist, it falls back to the default profile. The configuration method can be environment variable, profile file or empty if profile is not configured. If the profile is not valid, it returns an error.

func GetProfile added in v0.8.0

func GetProfile() (string, error)

GetProfile returns the current profile to be used by the CLI. The profile is determined by the value of the STACKIT_CLI_PROFILE environment variable, or, if not set, by the contents of the profile file in the CLI config folder. If the profile is not set (env var or profile file) or is set but does not exist, it falls back to the default profile. If the profile is not valid, it returns an error.

func GetProfileFolderPath added in v0.8.0

func GetProfileFolderPath(profile string) string

GetProfileFolderPath returns the path to the folder where the profile configuration is stored. If the profile is the default profile, it returns the default config folder path.

func GetProfileFromEnv added in v0.8.0

func GetProfileFromEnv() (string, bool)

GetProfileFromEnv returns the profile from the environment variable. If the environment variable is not set, it returns an empty string. If the profile is not valid, it returns an error.

func InitConfig

func InitConfig()

func ListProfiles added in v0.8.0

func ListProfiles() ([]string, error)

ListProfiles returns a list of all non-default profiles. If there are no profiles, it returns an empty list.

func ProfileExists added in v0.8.0

func ProfileExists(profile string) (bool, error)

func SetProfile added in v0.8.0

func SetProfile(p *print.Printer, profile string) error

SetProfile sets the profile to be used by the CLI.

func UnsetProfile added in v0.8.0

func UnsetProfile(p *print.Printer) error

UnsetProfile removes the profile file. If the profile file does not exist, it does nothing.

func ValidateProfile added in v0.8.0

func ValidateProfile(profile string) error

ValidateProfile validates the profile name. It can only use lowercase letters, numbers, or "-" and cannot be empty. It can't start with a "-". If the profile is invalid, it returns an error.

func Write added in v0.2.3

func Write() error

Write saves the config file (wrapping `viper.WriteConfig`) and ensures that its directory exists

Types

This section is empty.

Jump to

Keyboard shortcuts

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