cmd

package
v0.0.0-...-ab56314 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2025 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Package cmd provides the gcetcbendorsement CLI command abstractions.

Index

Constants

This section is empty.

Variables

View Source
var (
	// RootCmd is the canonical root cobra command for the gcetcbendorsement CLI.
	RootCmd *cobra.Command
)

Functions

func MakeRoot

func MakeRoot(ctx0 context.Context) *cobra.Command

MakeRoot returns a new root cobra command for the gcetcbendorsement CLI tool.

func ReadProto

func ReadProto(ctx context.Context, path string, m proto.Message) error

ReadProto reads a binary proto from path using the context's backend IO object, and unmarshals it into m.

Types

type Backend

type Backend struct {
	Provider              extract.LeveledQuoteProvider
	Getter                verify.HTTPSGetter
	MakeEfiVariableReader func(mountpath string) exel.VariableReader
	Now                   time.Time
	IO                    IO
}

Backend provides implementations for quote creation, internet access, and the current time.

type IO

type IO interface {
	// Create creates or opens and truncates a file at the given path, or returns an error. The
	// writer comes with a cleanup function instead of being a WriteCloser to allow for the created
	// writer to not close if needed.
	Create(path string) (gcetcbendorsement.TerminalWriter, func(), error)
	// ReadFile reads the entire contents of a file at the given path, or returns an error.
	ReadFile(path string) ([]byte, error)
}

IO provides the functionality to produce output as commands.

type OSIO

type OSIO struct{}

OSIO implements the IO interface with the os library.

func (OSIO) Create

func (OSIO) Create(path string) (gcetcbendorsement.TerminalWriter, func(), error)

Create truncates an existing file at the given path, or creates a new file. If successful, returns a writer to the file and a cleanup function for the writer. Otherwise returns an error.

func (OSIO) ReadFile

func (OSIO) ReadFile(path string) ([]byte, error)

ReadFile reads the entire contents of a file at the given path, or returns an error.

Jump to

Keyboard shortcuts

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