Documentation ¶
Index ¶
- Variables
- func InitializeLibrary(config *Config) error
- func LoadConfigFromEnv(config *Config)
- func ValidateAkeylessCliProfileExists(config *Config, name string) error
- func ValidateAkeylessHomeDirectoryExists(config *Config) error
- func ValidateConfig(config *Config) error
- type Config
- type Profile
- type Token
- func CheckForExistingToken(profile *Profile, config *Config) (*Token, error)
- func GetToken(profile *Profile, config *Config) (*Token, error)
- func InitializeAndGetToken(config *Config) (*Token, error)
- func ParseTokenFile(path string) (*Token, error)
- func ShellOutForNewToken(profile *Profile, config *Config) (*Token, error)
Constants ¶
This section is empty.
Variables ¶
var DEFAULT_EXPIRY_BUFFER = 10 * time.Minute
Functions ¶
func InitializeLibrary ¶
InitializeLibrary initializes the Sheller library with the provided configuration. It loads the configuration from environment variables and validates it.
func LoadConfigFromEnv ¶
func LoadConfigFromEnv(config *Config)
LoadConfigFromEnv loads configuration options from environment variables. It updates the provided config object with values from the environment.
func ValidateConfig ¶
ValidateConfig validates the provided configuration. It checks if the CLIPath, Profile, and AkeylessPath are set correctly and if the files and directories they point to exist and are accessible.
Types ¶
type Config ¶
type Config struct { CLIPath string // Path to the Akeyless CLI executable Profile string // Name of the Akeyless CLI profile to use AkeylessPath string // Path to the .akeyless directory ExpiryBuffer time.Duration // Buffer time before token expiry to trigger re-authentication Debug bool // Debug flag to enable or disable debug logging AppFs *afero.Afero // Filesystem to use to enable mocking of the filesystem }
Config holds the configuration options for the Sheller library.
func NewConfig ¶
func NewConfig(cliPath, profile, akeylessPath string, expiryBuffer time.Duration, debug bool) *Config
NewConfig creates a new Config instance with the provided parameters. cliPath: Path to the Akeyless CLI executable profile: Name of the Akeyless CLI profile to use akeylessPath: Path to the .akeyless directory expiryBuffer: Buffer time before token expiry to trigger re-authentication debug: Debug flag to enable or disable debug logging
func NewConfigWithDefaults ¶
func NewConfigWithDefaults() *Config
NewConfigWithDefaults creates a new Config instance with default values. It pulls the CLIPath from the system path and uses the "default" CLI profile.
type Profile ¶
type Profile struct { Name string `toml:"name"` AccessID string `toml:"access_id"` AccessType string `toml:"access_type"` }
Profile represents an Akeyless CLI profile.
func GetProfile ¶
GetProfile loads the specified profile from the .akeyless/profiles directory.
func ListProfiles ¶
ListProfiles lists all profiles in the .akeyless/profiles directory.
type Token ¶
type Token struct { AccessID string `json:"access_id"` Token string `json:"token"` Expiry time.Time `json:"expiry"` AuthCreds string `json:"auth_creds"` UamCreds string `json:"uam_creds"` KfmCreds string `json:"kfm_creds"` }
Token holds the details of an authentication token.
func CheckForExistingToken ¶
CheckForExistingToken checks for an existing valid token for the specified profile.
func GetToken ¶
GetToken retrieves a token for the specified profile, either by reusing an existing valid token or by shelling out to the Akeyless CLI.
func InitializeAndGetToken ¶
InitializeAndGetToken initializes the library, gets the profile, and retrieves the token. It returns the retrieved token or an error if something went wrong.
func ParseTokenFile ¶
ParseTokenFile parses a token file and returns a Token struct.