cli

package
v0.0.0-...-19f3ddf Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: BSD-3-Clause Imports: 22 Imported by: 0

Documentation

Overview

Responsible for the abstraction layer representing each command grouping

Provides functionality to connect to other CFT services.

Represents the CLI command grouping

GRPC Server impl

Represents the server command grouping

Index

Constants

View Source
const (
	DefaultPort         = 8080
	DefaultLogDirectory = "/tmp/cros-fw-provision/"
)

Variables

This section is empty.

Functions

func SetUpLog

func SetUpLog(dir string) (*log.Logger, error)

SetUpLog sets up the golang default logging, and returns the logger

Types

type AbstractCommand

type AbstractCommand interface {
	// Run runs the command
	Run() error

	// Is checks if the string is representative of the command
	Is(string) bool

	// Init is an initializer for the command given the trailing args
	Init([]string) error

	// Name is the command name (for debugging)
	Name() string
}

AbstractCommand represents a CLI grouping (e.g.: run as server, run as CLI, etc)

func ParseInputs

func ParseInputs() (AbstractCommand, error)

ParseInputs is a helper method which parses input arguments. It is effectively a factory method.

type CLICommand

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

CLI command executed the provisioning as a CLI

func NewCLICommand

func NewCLICommand() *CLICommand

func (*CLICommand) Init

func (cc *CLICommand) Init(args []string) error

func (*CLICommand) Is

func (cc *CLICommand) Is(group string) bool

func (*CLICommand) Logger

func (cc *CLICommand) Logger() *log.Logger

Logger returns the log

func (*CLICommand) Name

func (cc *CLICommand) Name() string

func (*CLICommand) Run

func (cc *CLICommand) Run() error

Run starts the firmware provision and does a single provision.

type FWProvisionServer

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

func NewFWProvisionServer

func NewFWProvisionServer(listenPort int, log *log.Logger) (*FWProvisionServer, func(), error)

NewFWProvisionServer returns a new FWProvisionServer, a closer function, and an error.

func (*FWProvisionServer) Install

Install starts the firmware provisioning in the background, and returns a long running operation or an error.

func (*FWProvisionServer) Start

func (ps *FWProvisionServer) Start() error

Start starts the grpc server.

func (*FWProvisionServer) StartUp

StartUp handles the initialization of the GenericProvisionService by passing in parameters through the ProvisionStartupRequest.

type ServerCommand

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

ServerCommand executed the provisioning as a Server

func NewServerCommand

func NewServerCommand() *ServerCommand

func (*ServerCommand) Init

func (sc *ServerCommand) Init(args []string) error

func (*ServerCommand) Is

func (sc *ServerCommand) Is(group string) bool

func (*ServerCommand) Name

func (sc *ServerCommand) Name() string

func (*ServerCommand) Run

func (sc *ServerCommand) Run() error

Jump to

Keyboard shortcuts

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