Documentation ¶
Index ¶
- Constants
- Variables
- func CreateProfile(p *print.Printer, profile string, setProfile, emptyProfile bool) error
- func DeleteProfile(p *print.Printer, profile string) error
- func DuplicateProfileConfiguration(p *print.Printer, currentProfile, newProfile string) error
- func GetConfiguredProfile() (configuredProfile, activeProfile, configurationMethod string, err error)
- func GetProfile() (string, error)
- func GetProfileFolderPath(profile string) string
- func GetProfileFromEnv() (string, bool)
- func InitConfig()
- func ListProfiles() ([]string, error)
- func ProfileExists(profile string) (bool, error)
- func SetProfile(p *print.Printer, profile string) error
- func UnsetProfile(p *print.Printer) error
- func ValidateProfile(profile string) error
- func Write() error
Constants ¶
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
const ProfileEnvVar = "STACKIT_CLI_PROFILE"
Variables ¶
var ConfigKeys = []string{ AsyncKey, OutputFormatKey, ProjectIdKey, SessionTimeLimitKey, VerbosityKey, IdentityProviderCustomEndpointKey, DNSCustomEndpointKey, LoadBalancerCustomEndpointKey, LogMeCustomEndpointKey, MariaDBCustomEndpointKey, ObjectStorageCustomEndpointKey, OpenSearchCustomEndpointKey, PostgresFlexCustomEndpointKey, ResourceManagerEndpointKey, ArgusCustomEndpointKey, AuthorizationCustomEndpointKey, MongoDBFlexCustomEndpointKey, RabbitMQCustomEndpointKey, RedisCustomEndpointKey, ResourceManagerEndpointKey, SecretsManagerCustomEndpointKey, ServiceAccountCustomEndpointKey, ServiceEnablementCustomEndpointKey, ServerBackupCustomEndpointKey, SKECustomEndpointKey, SQLServerFlexCustomEndpointKey, }
Functions ¶
func CreateProfile ¶ added in v0.8.0
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
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
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
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
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
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
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 SetProfile ¶ added in v0.8.0
SetProfile sets the profile to be used by the CLI.
func UnsetProfile ¶ added in v0.8.0
UnsetProfile removes the profile file. If the profile file does not exist, it does nothing.
func ValidateProfile ¶ added in v0.8.0
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.
Types ¶
This section is empty.