common

package
v1.14.2 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2025 License: Apache-2.0 Imports: 18 Imported by: ? 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

View Source
const (
	OutputFormatText = "text"
	OutputFormatWide = "wide"
	OutputFormatJSON = "json"
	OutputFormatYAML = "yaml"
)

Variables

This section is empty.

Functions

func ConvertMapToFunctionConfigWithStatus

func ConvertMapToFunctionConfigWithStatus(functionMap map[string]interface{}) (*functionconfig.ConfigWithStatus, error)

ConvertMapToFunctionConfigWithStatus converts a map to a function config with status

func GetUnmarshalFunc

func GetUnmarshalFunc(bytes []byte) (func(data []byte, v interface{}) error, error)

func OpenFile

func OpenFile(filepath string) (*os.File, error)

OpenFile validates filepath existence and returns a file (it is the caller's responsibility to close it)

func ReadFromInOrStdin

func ReadFromInOrStdin(r io.Reader) ([]byte, error)

func RenderAPIGateways

func RenderAPIGateways(apiGateways []platform.APIGateway,
	format string,
	writer io.Writer,
	renderCallback func(apiGateways []platform.APIGateway, renderer func(interface{}) error) error) error

func RenderFunctionEvents

func RenderFunctionEvents(functionEvents []platform.FunctionEvent,
	format string,
	writer io.Writer,
	renderCallback func(functions []platform.FunctionEvent, renderer func(interface{}) error) error) error

func RenderFunctions

func RenderFunctions(ctx context.Context,
	logger logger.Logger,
	functions []platform.Function,
	format string,
	writer io.Writer,
	renderCallback func(functions []platform.Function, renderer func(interface{}) error, exportOptions *common.ExportFunctionOptions) error,
	exportOptions *common.ExportFunctionOptions) error

func RenderProjects

func RenderProjects(ctx context.Context,
	projects []platform.Project,
	format string,
	writer io.Writer,
	renderCallback func(ctx context.Context, functions []platform.Project, renderer func(interface{}) error) error,
	skipSpecCleanup bool) error

Types

type FailReport

type FailReport struct {
	FailReason     string `json:"failReason,omitempty"`
	CanBeAutoFixed bool   `json:"canBeAutoFixed,omitempty"`
}

type FunctionReports

type FunctionReports struct {
	Success []string               `json:"success,omitempty"`
	Failed  map[string]*FailReport `json:"failed,omitempty"`
	// contains filtered or unexported fields
}

func NewFunctionReports

func NewFunctionReports() *FunctionReports

func (*FunctionReports) AddFailure

func (fr *FunctionReports) AddFailure(name string, err error, canBeAutoFixed bool)

func (*FunctionReports) AddSuccess

func (fr *FunctionReports) AddSuccess(name string)

func (*FunctionReports) PrintAsTable

func (fr *FunctionReports) PrintAsTable(t table.Writer, onlyFailed bool)

func (*FunctionReports) SaveToFile

func (fr *FunctionReports) SaveToFile(ctx context.Context, loggerInstance logger.Logger, path string)

func (*FunctionReports) SprintfError

func (fr *FunctionReports) SprintfError() string

type PatchManifest

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

func NewPatchManifest

func NewPatchManifest() *PatchManifest

func NewPatchManifestFromFile

func NewPatchManifestFromFile(path string) (*PatchManifest, error)

func (*PatchManifest) AddFailure

func (m *PatchManifest) AddFailure(name string, err error, retryable bool)

func (*PatchManifest) AddSkipped

func (m *PatchManifest) AddSkipped(name string)

func (*PatchManifest) AddSuccess

func (m *PatchManifest) AddSuccess(name string)

func (*PatchManifest) GetFailed

func (m *PatchManifest) GetFailed() map[string]failDescription

func (*PatchManifest) GetRetryableFunctionNames

func (m *PatchManifest) GetRetryableFunctionNames() []string

func (*PatchManifest) GetSkipped

func (m *PatchManifest) GetSkipped() []string

func (*PatchManifest) GetSuccess

func (m *PatchManifest) GetSuccess() []string

func (*PatchManifest) LogOutput

func (m *PatchManifest) LogOutput(ctx context.Context, loggerInstance logger.Logger)

func (*PatchManifest) SaveToFile

func (m *PatchManifest) SaveToFile(ctx context.Context, loggerInstance logger.Logger, path string)

func (*PatchManifest) SprintfError

func (m *PatchManifest) SprintfError() string

type ProjectReport

type ProjectReport struct {
	Name            string           `json:"name,omitempty"`
	Skipped         bool             `json:"skipped,omitempty"`
	Success         bool             `json:"success,omitempty"`
	Failed          *FailReport      `json:"failed,omitempty"`
	FunctionReports *FunctionReports `json:"functionReports,omitempty"`
}

func NewProjectReport

func NewProjectReport(name string) *ProjectReport

func (*ProjectReport) PrintAsTable

func (pr *ProjectReport) PrintAsTable(t table.Writer, onlyFailed bool)

func (*ProjectReport) SaveToFile

func (pr *ProjectReport) SaveToFile(ctx context.Context, loggerInstance logger.Logger, path string)

func (*ProjectReport) SetFailed

func (pr *ProjectReport) SetFailed(failReport *FailReport)

SetFailed sets the "Failed" status if it hasn't been set yet. In other words, it retains only the first error that occurred.

func (*ProjectReport) SprintfError

func (pr *ProjectReport) SprintfError() string

type ProjectReports

type ProjectReports struct {
	Reports map[string]*ProjectReport `json:"reports,omitempty"`
}

func NewProjectReports

func NewProjectReports() *ProjectReports

func (*ProjectReports) AddReport

func (pr *ProjectReports) AddReport(report *ProjectReport)

func (*ProjectReports) GetReport

func (pr *ProjectReports) GetReport(projectName string) (report *ProjectReport, exists bool)

func (*ProjectReports) PrintAsTable

func (pr *ProjectReports) PrintAsTable(t table.Writer, onlyFailed bool)

func (*ProjectReports) SaveToFile

func (pr *ProjectReports) SaveToFile(ctx context.Context, loggerInstance logger.Logger, path string)

func (*ProjectReports) SprintfError

func (pr *ProjectReports) SprintfError() string

type Report

type Report interface {
	// SaveToFile saves a report to file on a given path
	SaveToFile(ctx context.Context, loggerInstance logger.Logger, path string)

	// SprintfError generates string with detailed error
	SprintfError() string

	// PrintAsTable adds rows to the provided table writer
	PrintAsTable(t table.Writer, onlyFailed bool)
}

Jump to

Keyboard shortcuts

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