connect

package
v0.1.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAssetNotFound                 = errors.New("asset not found")
	ErrAccountNotFound               = errors.New("account not found")
	ErrAccountAmbiguous              = errors.New("account is ambiguous")
	ErrInteractiveCredentialRequired = errors.New("interactive account credential is required")
)

Functions

func ResolveAsset

func ResolveAsset(ctx context.Context, api AssetAPI, reference string) (jumpserver.AssetDetail, error)

func ResolvePermittedAccount added in v0.1.4

func ResolvePermittedAccount(accounts []jumpserver.Account, reference string) (jumpserver.Account, error)

ResolvePermittedAccount 从资产授权账号中解析明确引用,拒绝重名歧义。 空引用、交互选择和连接伪账号由调用方按用例处理。

Types

type API

type API interface {
	AssetAPI
	CreateConnectionToken(context.Context, jumpserver.ConnectionRequest) (string, error)
	GetClientConnection(context.Context, string) (jumpserver.ClientConnection, error)
}

type AssetAPI

type AssetAPI interface {
	ListAssets(context.Context, jumpserver.AssetQuery) (jumpserver.AssetPage, error)
	GetAsset(context.Context, string) (jumpserver.AssetDetail, error)
}

type ConfigLoader

type ConfigLoader interface {
	Load() (projectconfig.Config, error)
}

type Options

type Options struct {
	Target         target.Input
	Protocol       string
	NonInteractive bool
	SelectAccount  func([]jumpserver.Account) (jumpserver.Account, error)
}

type Prepared

type Prepared struct {
	Selection  target.Selection
	Asset      jumpserver.AssetDetail
	Account    jumpserver.Account
	Connection jumpserver.ClientConnection
}

type Service

type Service struct {
	Config ConfigLoader
	Tokens TokenManager
	NewAPI func(site, accessToken, organization string) (API, error)
}

func (Service) Prepare

func (s Service) Prepare(ctx context.Context, options Options) (Prepared, error)

type TokenManager

type TokenManager interface {
	EnsureFresh(context.Context, string) (credential.Token, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL