Documentation ¶
Index ¶
- Constants
- Variables
- func CertificateDetails(cert *x509.Certificate) string
- func CheckMinAPIVersionRestriction(cmd *cobra.Command, currentVersion int) error
- func DefaultDeviceID() string
- func IsAuthCheckEnabled(cmd *cobra.Command) bool
- func NeedUpdatedAPIVersionConfig(cmd *cobra.Command) bool
- func NormalizeConfigurationURL(u string) (string, error)
- func ReadPemFile(path string) (*x509.Certificate, error)
- type Config
- func (c *Config) CheckForUpdate(out io.Writer, client *http.Client, current string) (*Config, error)
- func (c *Config) ClearBearer() error
- func (c *Config) ClearCredentials() error
- func (c *Config) ExpiredAtValid() bool
- func (c *Config) GetBearTokenHeaderValue() (string, error)
- func (c *Config) GetHost() (string, error)
- func (c *Config) IsRequireAuthentication() bool
- func (c *Config) KeyringPrefix() (string, error)
- func (c *Config) LoadCredentials() (*Credentials, error)
- func (c *Config) StoreCredentials(username, password string) error
- type Credentials
Constants ¶
const NeedUpdateAPIConfig = "updateAPIConfig"
const SkipAuthCheck = "skipAuthCheck"
Variables ¶
var ErrNoAddr = errors.New("No valid address set, run 'sdpctl configure' or set SDPCTL_URL")
Functions ¶
func CertificateDetails ¶
func CertificateDetails(cert *x509.Certificate) string
func DefaultDeviceID ¶
func DefaultDeviceID() string
DefaultDeviceID return a unique ID in UUID format. machine.ID() tries to read /etc/machine-id on Linux /etc/hostid on BSD ioreg -rd1 -c IOPlatformExpertDevice | grep IOPlatformUUID on OSX reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography /v MachineGuid on Windows and tries to parse the value as a UUID https://github.com/denisbrodbeck/machineid if we can't get a valid UUID based on the machine ID, we will fallback to a random UUID value.
func IsAuthCheckEnabled ¶
func ReadPemFile ¶
func ReadPemFile(path string) (*x509.Certificate, error)
Types ¶
type Config ¶
type Config struct { URL string `mapstructure:"url"` Provider *string `mapstructure:"provider"` Insecure bool `mapstructure:"insecure"` Debug bool `mapstructure:"debug"` // http debug flag Version int `mapstructure:"api_version"` // api peer interface version BearerToken *string `mapstructure:"bearer:squash"` // current logged in user token ExpiresAt *string `mapstructure:"expires_at"` DeviceID string `mapstructure:"device_id"` PemFilePath string `mapstructure:"pem_filepath"` // deprecated in favor of pem_base64, kept for backwards compatibility PemBase64 *string `mapstructure:"pem_base64"` DisableVersionCheck bool `mapstructure:"disable_version_check"` LastVersionCheck string `mapstructure:"last_version_check"` NoInteractive bool `mapstructure:"-"` CiMode bool `mapstructure:"-"` EventsPath string `mapstructure:"-"` }
func NewConfiguration ¶
func (*Config) CheckForUpdate ¶
func (*Config) ClearBearer ¶
func (*Config) ClearCredentials ¶
func (*Config) ExpiredAtValid ¶
func (*Config) GetBearTokenHeaderValue ¶
func (*Config) IsRequireAuthentication ¶
func (*Config) KeyringPrefix ¶
KeyringPrefix is the raw string values that will be used in the keyring package it needs to be a unique, reproducible value for the selected Collective + profile. Downstream, this string value will be converted to a integer value (pkg/hashcode) and used as a prefix when storing values in the keyring/keychain.
func (*Config) LoadCredentials ¶
func (c *Config) LoadCredentials() (*Credentials, error)