Documentation
¶
Index ¶
- Variables
- func BuildDuoCLIEnv() []string
- func ManagedBinaryPath() (string, error)
- type BinaryInfo
- type BinaryManager
- func (m *BinaryManager) CheckForUpdate(ctx context.Context, currentVersion string, lastCheckTime time.Time, ...) (bool, string, string, time.Time, error)
- func (m *BinaryManager) EnsureInstalled(ctx context.Context, installedVersion, installedPath string, ...) (*BinaryInfo, error)
- func (m *BinaryManager) Update(ctx context.Context) (*BinaryInfo, error)
Constants ¶
This section is empty.
Variables ¶
var ErrUnsupportedPlatform = errors.New("unsupported platform")
ErrUnsupportedPlatform is returned when the current OS or architecture is not supported by the Duo CLI.
Functions ¶
func BuildDuoCLIEnv ¶
func BuildDuoCLIEnv() []string
BuildDuoCLIEnv builds the environment variables for the Duo CLI process. This allows the Duo CLI team to track usage sources via GITLAB_DUO_DISTRIBUTION.
func ManagedBinaryPath ¶ added in v1.92.0
ManagedBinaryPath returns the path where the managed Duo CLI binary is installed.
Types ¶
type BinaryInfo ¶
BinaryInfo represents metadata about the installed Duo CLI binary.
type BinaryManager ¶
type BinaryManager struct {
// contains filtered or unexported fields
}
BinaryManager handles the lifecycle of the Duo CLI binary.
func NewBinaryManager ¶
func NewBinaryManager(io *iostreams.IOStreams) *BinaryManager
NewBinaryManager creates a new BinaryManager instance.
func (*BinaryManager) CheckForUpdate ¶
func (m *BinaryManager) CheckForUpdate(ctx context.Context, currentVersion string, lastCheckTime time.Time, forceCheck bool) (bool, string, string, time.Time, error)
CheckForUpdate checks if a newer version of Duo CLI is available within the supported major version. Returns (hasUpdate, latestVersion, newMajorVersion, newCheckTime, error). newMajorVersion is non-empty when the latest release has a higher major than supported. Caller should save newCheckTime to config if non-zero.
func (*BinaryManager) EnsureInstalled ¶
func (m *BinaryManager) EnsureInstalled(ctx context.Context, installedVersion, installedPath string, autoDownload string) (*BinaryInfo, error)
EnsureInstalled ensures the Duo CLI binary is installed and returns metadata. If installedPath points to a custom location (outside the managed install dir), it validates the path and returns it directly without downloading. Otherwise, if the managed binary is missing or invalid, it prompts and downloads it.
func (*BinaryManager) Update ¶
func (m *BinaryManager) Update(ctx context.Context) (*BinaryInfo, error)
update downloads and installs the latest version of Duo CLI. Returns BinaryInfo for caller to save to config.