utils

package
v0.0.0-...-d6600ca Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2019 License: Apache-2.0 Imports: 15 Imported by: 4

Documentation

Index

Constants

View Source
const ERR_EXTENSION_NOT_FOUND string = "extension not found"
View Source
const ERR_TIMEOUT string = "Timeout while executing the extension. The extension did not respond in a reasonable amount of time."

Variables

View Source
var HTTP_408 int64 = 408
View Source
var HTTP_500 int64 = 500

Functions

func GenerateErrorResponse

func GenerateErrorResponse(code *int64, message string) *models.Error

func NewStatus

func NewStatus() models.StatusResponse

func ReadExitStatus

func ReadExitStatus(err error, cmdExec *exec.Cmd, c CSMFileHelper) int

func ReadOutputFile

func ReadOutputFile(outputFile *os.File, removeAfter bool) ([]byte, error)

func RunCmd

func RunCmd(cmdExec *exec.Cmd, c CSMFileHelper) bool

returns false if the process is forced stopped and true otherwise

Types

type CSMFileHelper

type CSMFileHelper struct {
	CSMFileHelperInterface
	Logger *logrus.Logger
	Config *common.ServiceManagerConfiguration
}

func (CSMFileHelper) GetExtension

func (c CSMFileHelper) GetExtension(extPath string) (bool, string)

GetExtension verify if the extension file exists

func (CSMFileHelper) RunExtension

func (c CSMFileHelper) RunExtension(extensionPath string, params ...string) (bool, string)

RunExtension executes the extension

func (CSMFileHelper) RunExtensionFileGen

func (c CSMFileHelper) RunExtensionFileGen(extensionPath string, params ...string) (bool, *os.File, string)

RunExtensionFileGen executes the extension

type CSMFileHelperInterface

type CSMFileHelperInterface interface {
	GetExtension(extPath string) (bool, string)
	RunExtension(extensionPath string, params ...string) (bool, string)
	RunExtensionFileGen(extensionPath string, params ...string) (bool, *os.File, string)
}

type JsonResponse

type JsonResponse struct {
	ErrorCode    int                        `json:"error_code,omitempty"`
	ErrorMessage string                     `json:"error_message,omitempty"`
	Details      interface{}                `json:"details,omitempty"`
	Status       string                     `json:"status"`
	ServiceType  string                     `json:"service_type"`
	Diagnostics  []*models.StatusDiagnostic `json:"diagnostics,omitempty"`
}

func (*JsonResponse) Unmarshal

func (j *JsonResponse) Unmarshal(value []byte) error

Jump to

Keyboard shortcuts

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