response

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2022 License: MIT Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DiffResponse

type DiffResponse struct {
	*Response

	Colorize bool

	DeviceDiff string
	Candidate  string
	Current    string

	Difflines    []string
	Additions    []string
	Subtractions []string

	SideBySideW int
	// contains filtered or unexported fields
}

DiffResponse is a special response object specifically for `GetDiff` operations.

func NewDiffResponse

func NewDiffResponse(host string, opts ...util.Option) *DiffResponse

NewDiffResponse returns a new DiffResponse object.

func (*DiffResponse) RecordDiff

func (r *DiffResponse) RecordDiff(device, candidate, current string)

RecordDiff records the outcome of a GetDiff result.

func (*DiffResponse) SideBySideDiff

func (r *DiffResponse) SideBySideDiff() string

SideBySideDiff returns the diff in a side-by-side output.

func (*DiffResponse) UnifiedDiff

func (r *DiffResponse) UnifiedDiff() string

UnifiedDiff returns the diff in a unified output.

type PlatformResponse

type PlatformResponse struct {
	Result           string
	ScrapliResponses []*response.Response
}

PlatformResponse is a simple response objects that platform implementations return to the Cfg instance.

type Response

type Response struct {
	Result string
	Op     string

	Host        string
	StartTime   time.Time
	EndTime     time.Time
	ElapsedTime float64

	ScrapliResponses []*response.Response

	Failed error
}

Response is similar to the scrapligo response.Response object, but is tailored for scrapligocfg uses. The Result field is the primary result of the given operation -- for example if the operation was GetVersion, then the Result is the parsed version string. The Op field is the human-readable name of the operation.

func NewResponse

func NewResponse(op, host string) *Response

NewResponse returns a new Response object with the StartTime set to now.

func (*Response) Record

func (r *Response) Record(rs []*response.Response, result string)

Record "records" the slice of scrapligo response.Response objects and the final result of the scrapligocfg operation.

Jump to

Keyboard shortcuts

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