backend

package
v0.0.0-...-d3eef10 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2023 License: MIT Imports: 13 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBackendDownload   = errors.New("Backend: image download failed")
	ErrBackendBadRequest = errors.New("Backend: bad request")
)
View Source
var (
	// ErrBadRouting is returned when an expected path variable is missing.
	// It always indicates programmer error.
	ErrBadRouting = errors.New("inconsistent mapping between route and handler (programmer error)")
)

Functions

func MakeBackendHTTPHandler

func MakeBackendHTTPHandler(s BackendService, logger log.Logger) http.Handler

func MakeGetControllerEndpoint

func MakeGetControllerEndpoint(s BackendService) endpoint.Endpoint

func MakeGetDeploymentBaseEndpoint

func MakeGetDeploymentBaseEndpoint(s BackendService) endpoint.Endpoint

func MakeGetDownloadHttpEndpoint

func MakeGetDownloadHttpEndpoint(s BackendService) endpoint.Endpoint

func MakePostCancelActionFeedbackEndpoint

func MakePostCancelActionFeedbackEndpoint(s BackendService) endpoint.Endpoint

func MakePostDeploymentBaseFeedbackEndpoint

func MakePostDeploymentBaseFeedbackEndpoint(s BackendService) endpoint.Endpoint

func MakePutConfigDataEndpoint

func MakePutConfigDataEndpoint(s BackendService) endpoint.Endpoint

Types

type BackendService

type BackendService interface {
	GetController(ctx context.Context, bid string) (Controller, error)
	PostCancelActionFeedback(ctx context.Context, bid string, fb CancelActionFeedback) error
	PutConfigData(ctx context.Context, bid string, cfg ConfigData) error
	GetDeplymentBase(ctx context.Context, bid string, acid string) (DeploymentBase, error)
	PostDeploymentBaseFeedback(ctx context.Context, bid string, fb DeploymentBaseFeedback) error
	GetDownloadHttp(ctx context.Context, bid string, ver string) ([]byte, error)
}

func NewHawkbitBackendService

func NewHawkbitBackendService() BackendService

type CancelActionFeedback

type CancelActionFeedback struct {
	ID     string `json:"id"`
	Time   string `json:"time"`
	Status struct {
		Execution string `json:"execution"`
		Result    struct {
			Finished string `json:"finished"`
		} `json:"result"`
	} `json:"status"`
}

type ConfigData

type ConfigData struct {
	Mode string `json:"mode"`
	Data struct {
		VIN        string `json:"vin"`
		HwRevision string `json:"hwRevision"`
	} `json:"data"`
	ID     string `json:"id"`
	Time   string `json:"time"`
	Status struct {
		Execution string `json:"execution"`
		Result    struct {
			Finished string `json:"finished"`
		} `json:"result"`
	} `json:"status"`
}

type Controller

type Controller struct {
	Config struct {
		Polling struct {
			Sleep string `json:"sleep"`
		} `json:"polling"`
	} `json:"config"`
	Links struct {
		DeploymentBase struct {
			Href string `json:"href"`
		} `json:"deploymentBase"`
		CancelAction struct {
			Href string `json:"href"`
		} `json:"cancelAction"`
		ConfigData struct {
			Href string `json:"href"`
		} `json:"configData"`
	} `json:"_links"`
}

type DeploymentBase

type DeploymentBase struct {
	ID         string `json:"id"`
	Deployment struct {
		Download string    `json:"download"`
		Update   string    `json:"update"`
		Chunks   [1]chunks `json:"chunks"`
	} `json:"deployment"`
}

type DeploymentBaseFeedback

type DeploymentBaseFeedback struct {
	ID     string `json:"id"`
	Status struct {
		Execution string `json:"execution"`
		Result    struct {
			Finished string `json:"finished"`
		} `json:"result"`
	} `json:"status"`
}

type Endpoints

type Endpoints struct {
	GetControllerEndpoint              endpoint.Endpoint
	PostCancelActionFeebackEndpoint    endpoint.Endpoint
	PutConfigDataEndpoint              endpoint.Endpoint
	GetDeploymentBaseEndpoint          endpoint.Endpoint
	PostDeploymentBaseFeedbackEndpoint endpoint.Endpoint
	GetDownloadHttpEndpoint            endpoint.Endpoint
}

func MakeBackendServerEndpoints

func MakeBackendServerEndpoints(s BackendService) Endpoints

type GetControllerRequest

type GetControllerRequest struct {
	Bid string
}

type GetControllerResponse

type GetControllerResponse struct {
	Ctrlr Controller `json:"controller"`
	Err   error      `json:"err,omitempty"`
}

type GetDeplymentBaseRequest

type GetDeplymentBaseRequest struct {
	Bid  string
	Acid string
}

type GetDeplymentBaseResponse

type GetDeplymentBaseResponse struct {
	Dp  DeploymentBase `json:"deploymentBase,omitempty"`
	Err error          `json:"err,omitempty"`
}

type GetDownloadHttpRequest

type GetDownloadHttpRequest struct {
	Bid string
	Ver string
}

type GetDownloadHttpResponse

type GetDownloadHttpResponse struct {
	File []byte
}

type Middleware

type Middleware func(BackendService) BackendService

Middleware describes a BackendService (as opposed to endpoint) middleware.

func LoggingBackendMiddleware

func LoggingBackendMiddleware(logger log.Logger) Middleware

type PostCancelActionFeedbackRequest

type PostCancelActionFeedbackRequest struct {
	Bid string
	Fb  CancelActionFeedback `json:"cancelActionFeedback,omitempty"`
}

type PostCancelActionFeedbackResponse

type PostCancelActionFeedbackResponse struct {
	Err error `json:"err,omitempty"`
}

type PostDeploymentBaseFeedbackRequest

type PostDeploymentBaseFeedbackRequest struct {
	Bid string
	Fb  DeploymentBaseFeedback `json:"deploymentBaseFeedback,omitempty"`
}

type PostDeploymentBaseFeedbackResponse

type PostDeploymentBaseFeedbackResponse struct {
	Err error `json:"err,omitempty"`
}

type PutConfigDataRequest

type PutConfigDataRequest struct {
	Bid string
	Cfg ConfigData `json:"configData,omitempty"`
}

type PutConfigDataResponse

type PutConfigDataResponse struct {
	Err error `json:"err,omitempty"`
}

Jump to

Keyboard shortcuts

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