Documentation ¶
Index ¶
Constants ¶
View Source
const ( CommandGet = "GET" CommandGetAttrs = "GET_ATTRIBUTES" CommandSet = "SET" CommandSetAttrs = "SET_ATTRIBUTES" CommandTestSet = "TEST_AND_SET" CommandAddRow = "ADD_ROW" CommandDeleteRow = "DELETE_ROW" CommandReplaceRows = "REPLACE_ROWS" HeaderWPASyncOldCID = "X-Webpa-Sync-Old-Cid" HeaderWPASyncNewCID = "X-Webpa-Sync-New-Cid" HeaderWPASyncCMC = "X-Webpa-Sync-Cmc" )
All the supported commands, WebPA Headers and misc
Variables ¶
View Source
var ( ErrEmptyNames = transaction.NewBadRequestError(errors.New("names parameter is required")) ErrInvalidService = transaction.NewBadRequestError(errors.New("unsupported Service")) ErrUnsupportedMethod = transaction.NewBadRequestError(errors.New("unsupported method. Could not decode request payload")) //Set command errors ErrInvalidSetWDMP = transaction.NewBadRequestError(errors.New("invalid SET message")) ErrNewCIDRequired = transaction.NewBadRequestError(errors.New("newCid is required for TEST_AND_SET")) //Add/Delete command errors ErrMissingTable = transaction.NewBadRequestError(errors.New("table property is required")) ErrMissingRow = transaction.NewBadRequestError(errors.New("row property is required")) ErrInvalidRow = transaction.NewBadRequestError(errors.New("row property is invalid")) ErrInvalidPayload = transaction.NewBadRequestError(errors.New("payload is invalid")) //Replace command error ErrMissingRows = transaction.NewBadRequestError(errors.New("rows property is required")) ErrInvalidRows = transaction.NewBadRequestError(errors.New("rows property is invalid")) )
Error values definitions for the translation service
Functions ¶
func ConfigHandler ¶
func ConfigHandler(c *Options)
ConfigHandler sets up the server that powers the translation service
Types ¶
type Options ¶
type Options struct { S Service //APIRouter is assumed to be a subrouter with the API prefix path (i.e. 'api/v2') APIRouter *mux.Router Authenticate *alice.Chain Log *zap.Logger ValidServices []string ReducedLoggingResponseCodes []int }
Options wraps the properties needed to set up the translation server
type Service ¶
type Service interface {
SendWRP(context.Context, *wrp.Message, string) (*transaction.XmidtResponse, error)
}
Service represents the Webpa-Tr1d1um component that translates WDMP data into WRP which is compatible with the XMiDT API.
func NewService ¶
func NewService(o *ServiceOptions) Service
NewService constructs a new translation service instance given some options.
type ServiceOptions ¶
type ServiceOptions struct { //XmidtWrpURL is the URL of the XMiDT API which takes in WRP messages. XmidtWrpURL string //WRPSource is the value set on the WRPSource field of all WRP messages created by Tr1d1um. WRPSource string //Acquirer provides a mechanism to build auth headers for outbound requests. AuthAcquirer acquire.Acquirer //T is the component that's responsible to make the HTTP //request to the XMiDT API and return only data we care about. transaction.T }
ServiceOptions defines the options needed to build a new translation WRP service.
Click to show internal directories.
Click to hide internal directories.