Documentation ¶
Index ¶
- func DeleteConfigValue(key config.FieldKey) error
- func ForEachConfigFieldDefinition(fn func(d config.FieldDefinition))
- func ForEachProfileFieldDefinition(profileName string, fn func(d config.FieldDefinition))
- func GetActiveProfileAccountID() int
- func GetActiveProfileName() string
- func GetActiveProfileString(key config.FieldKey) string
- func GetConfigFieldDefinition(key config.FieldKey) *config.FieldDefinition
- func GetConfigString(key config.FieldKey) string
- func GetConfigTernary(key config.FieldKey) config.Ternary
- func GetDefaultProfileName() (string, error)
- func GetLogLevel() string
- func GetProfileInt(profileName string, key config.FieldKey) int
- func GetProfileNames() []string
- func GetProfileString(profileName string, key config.FieldKey) string
- func GetValidConfigFieldKeys() (fieldKeys []config.FieldKey)
- func RemoveProfile(profileName string) error
- func RequireActiveProfileAccountID() int
- func SetConfigValue(key config.FieldKey, value interface{}) error
- func SetDefaultProfile(profileName string) error
- func SetProfileValue(profileName string, key config.FieldKey, value interface{}) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteConfigValue ¶
DeleteConfigValue deletes a config value for the given key.
func ForEachConfigFieldDefinition ¶
func ForEachConfigFieldDefinition(fn func(d config.FieldDefinition))
ForEachConfigFieldDefinition iterates the field definitions for the config fields.
func ForEachProfileFieldDefinition ¶
func ForEachProfileFieldDefinition(profileName string, fn func(d config.FieldDefinition))
ForEachProfileFieldDefinition iterates the field definitions for the profile fields.
func GetActiveProfileAccountID ¶
func GetActiveProfileAccountID() int
GetActiveProfileAccountID retrieves the currently configured account ID. When returning an account ID, the following will be evaluated in order, short-circuiting and returning the described value if true: 1. An environment variable override has been set with NEW_RELIC_ACCOUNT_ID 2. An account ID has been provided with the `--accountId` global flag 3. An account ID has been set in the active profile 4. The zero value will be returned if none of the above are true
func GetActiveProfileName ¶
func GetActiveProfileName() string
GetActiveProfileName retrieves the profile in use for this command execution. To retrieve the active profile, the following criteria are evaluated in order, short circuiting and returning the described value if true: 1. a profile has been provided with the global `--profile` flag 2. a profile is set in the default profile config file 3. "default" is returned if none of the above are true
func GetActiveProfileString ¶
GetActiveProfileString retrieves the value set for the given key in the active profile, if any. Environment variable overrides will be preferred over values set in the active profile, and a default value will be returned if it has been configured and no value has been set for the key in the active profile. An attempt will be made to convert the underlying value to a string if is not already stored that way. Failing the above, the zero value wil be returned.
func GetConfigFieldDefinition ¶
func GetConfigFieldDefinition(key config.FieldKey) *config.FieldDefinition
GetConfigFieldDefinition retrieves the field definition for the given config key.
func GetConfigString ¶
GetConfigString retrieves the config value set for the given key, if any. Environment variable overrides will be preferred over values set in the given profile, and a default value will be returned if it has been configured and no value has been set for the key in the config file. An attempt will be made to convert the underlying value to a string if is not already stored that way. Failing the above, the zero value wil be returned.
func GetConfigTernary ¶
GetConfigTernary retrieves the config value set for the given key, if any. Environment variable overrides will be preferred over values set in the given profile, and a default value will be returned if it has been configured and no value has been set for the key in the config file. An attempt will be made to convert the underlying value to a Ternary if is not already stored that way. Failing the above, the zero value wil be returned.
func GetDefaultProfileName ¶
GetDefaultProfileName retrieves the profile set in the default profile config file. If the file does not exist, an empty string will be returned.
func GetLogLevel ¶
func GetLogLevel() string
GetLogLevel retrieves the currently configured log level. When returning a log level, the following will be evaluated in order, short-circuiting and returning the described value if true: 1. An environment variable override has been set with NEW_RELIC_CLI_LOG_LEVEL 2. A log level has been provided with the `--trace` global flag 2. A log level has been provided with the `--debug` global flag 3. A log level has been set in the config file 4. If none of the above is true, the default log level will be returned.
func GetProfileInt ¶
GetProfileInt retrieves the value set for the given key and profile, if any. Environment variable overrides will be preferred over values set in the given profile, and a default value will be returned if it has been configured and no value has been set for the key in the given profile. An attempt will be made to convert the underlying value to an int if is not already stored that way. Failing the above, the zero value wil be returned.
func GetProfileNames ¶
func GetProfileNames() []string
GetProfileNames retrieves all profile names currently configured in the credentials file.
func GetProfileString ¶
GetProfileString retrieves the value set for the given key and profile, if any. Environment variable overrides will be preferred over values set in the given profile, and a default value will be returned if it has been configured and no value has been set for the key in the given profile. An attempt will be made to convert the underlying value to a string if is not already stored that way. Failing the above, the zero value wil be returned.
func GetValidConfigFieldKeys ¶
GetValidConfigFieldKeys returns all the config field keys that can be set.
func RemoveProfile ¶
RemoveProfile removes a profile from the credentials file. If the profile being removed is the default, it will attempt to find another profile to set as the new default. If another profile cannot be found, the default profile config file will be deleted.
func RequireActiveProfileAccountID ¶
func RequireActiveProfileAccountID() int
RequireActiveProfileAccountID retrieves the currently configured account ID, returning an error if the value retrieved is the zero value. When returning an account ID, the following will be evaluated in order, short-circuiting and returning the described value if true: 1. An environment variable override has been set with NEW_RELIC_ACCOUNT_ID 2. An account ID has been provided with the `--accountId` global flag 3. An account ID has been set in the active profile
func SetConfigValue ¶
SetConfigValue sets a config value for the given key.
func SetDefaultProfile ¶
SetDefaultProfile sets the given profile as the new default in the default profile config file. If the given profile does not exist, the set operation will return an error.
Types ¶
This section is empty.