cli

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2022 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LevelFromVerbosity

func LevelFromVerbosity(v int) zerolog.Level

LevelFromVerbosity takes a command-line `-v` stackable flag count, e.g. `-vv`, `-vvv` and transforms it into a sensible loglevel. The mapping is:

``:     Warn
`-v`:   Info
`-vv`:  Debug
`-vvv`: Trace

func NewLogger

func NewLogger(cliName string, verbosity int) *zerolog.Logger

Types

type Cli

type Cli struct {
	Verbose int `opt:"" short:"v" type:"counter" help:"Enable debug mode."`

	Version VersionCmd `cmd:"" help:"Show match-cli version."`
	Partner PartnerCmd `cmd:"" help:"Partner command."`
	Match   MatchCmd   `cmd:"" help:"Match command."`
}

func (*Cli) NewContext

func (c *Cli) NewContext() (*CliContext, error)

type CliContext

type CliContext struct {
	// contains filtered or unexported fields
}

func (*CliContext) LoadConfig

func (c *CliContext) LoadConfig() error

func (*CliContext) SaveConfig

func (c *CliContext) SaveConfig() error

type Config

type Config struct {
	Partners []PartnerConfig `json:"partners"`
}

type MatchCmd

type MatchCmd struct {
	Create     MatchCreateCmd     `cmd:"" help:"Create a match"`
	List       MatchListCmd       `cmd:"" help:"List matches"`
	GetResults MatchGetResultsCmd `cmd:"" help:"Get match results"`
	Run        MatchRunCmd        `cmd:"" help:"Run a match"`
}

type MatchCreateCmd

type MatchCreateCmd struct {
	Partner string `arg:"" required:"" help:"Name of the partner"`
	Name    string `arg:"" required:"" help:"Name of the match"`
}

func (*MatchCreateCmd) Run

func (m *MatchCreateCmd) Run(cli *CliContext) error

type MatchGetResultsCmd

type MatchGetResultsCmd struct {
	Partner string `arg:"" required:"" help:"Name of the partner"`
	MatchId string `arg:"" required:"" help:"ID of the match"`
}

func (*MatchGetResultsCmd) Run

func (m *MatchGetResultsCmd) Run(cli *CliContext) error

type MatchListCmd

type MatchListCmd struct {
	Partner string `arg:"" required:"" help:"Name of the partner"`
}

func (*MatchListCmd) Run

func (m *MatchListCmd) Run(cli *CliContext) error

type MatchRunCmd

type MatchRunCmd struct {
	Partner     string        `arg:"" required:"" help:"Name of the partner"`
	InitTimeout time.Duration `default:"10m" help:"Timeout for the initialization of the match"`
	RunTimeout  time.Duration `default:"30m" help:"Timeout for the match operation"`
	MatchID     string        `arg:"" required:"" help:"ID of the match"`
	File        *os.File      `arg:"" required:"" help:"File to match"`
	Protocol    string        `default:"dhpsi" enum:"kkrtpsi,dhpsi" help:"Preferred PSI protocol"`
}

func (*MatchRunCmd) Run

func (m *MatchRunCmd) Run(cli *CliContext) error

Run authenticates with the partner and runs the PSI match attempt. The result of the match is printed on success.

type PartnerCmd

type PartnerCmd struct {
	Connect PartnerConnectCmd `cmd:"" help:"Connect to a partner sandbox with an invite token."`
	List    PartnerListCmd    `cmd:"" help:"List partners."`
	Get     PartnerGetCmd     `cmd:"" help:"Get partner."`
}

type PartnerConfig

type PartnerConfig struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	URL         string `json:"url"`
	Id          string `json:"id"`
	PrivateKey  string `json:"private_key"`
}

func (*PartnerConfig) NewClient

func (partner *PartnerConfig) NewClient() (*client.OptableRpcClient, error)

func (*PartnerConfig) NewToken

func (partner *PartnerConfig) NewToken(expireAt time.Duration) (string, error)

func (*PartnerConfig) ParsedPrivateKey

func (partner *PartnerConfig) ParsedPrivateKey() (*ecdsa.PrivateKey, error)

type PartnerConnectCmd

type PartnerConnectCmd struct {
	Name  string `arg:"" required:"" help:"Name of the partner."`
	Token string `arg:"" required:"" help:"The invite token from the partner"`
}

func (*PartnerConnectCmd) Run

func (p *PartnerConnectCmd) Run(cli *CliContext) error

type PartnerGetCmd

type PartnerGetCmd struct {
	Name string `arg:"" required:"" help:"Name of the partner."`
}

func (*PartnerGetCmd) Run

func (p *PartnerGetCmd) Run(cli *CliContext) error

type PartnerListCmd

type PartnerListCmd struct {
}

func (*PartnerListCmd) Run

func (p *PartnerListCmd) Run(cli *CliContext) error

type VersionCmd

type VersionCmd struct{}

func (*VersionCmd) Run

func (v *VersionCmd) Run(ctx *kong.Context) error

Jump to

Keyboard shortcuts

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