checkin

package
v0.0.0-...-29c6822 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2018 License: MIT, MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthenticateTopic = "mdm.Authenticate"
	TokenUpdateTopic  = "mdm.TokenUpdate"
	CheckoutTopic     = "mdm.CheckOut"
)

PubSub Topics where MDM Checkin events are published to.

View Source
const CheckinBucket = "mdm.Checkin.ARCHIVE"

CheckinBucket is the *bolt.DB bucket where checkins are archived.

Variables

This section is empty.

Functions

func EncodeError

func EncodeError(ctx context.Context, err error, w http.ResponseWriter)

EncodeError is used by the HTTP transport to encode service errors in HTTP. The EncodeError should be passed to the Go-Kit httptransport as the ServerErrorEncoder to encode error responses. According to the MDM Check-in protocol specification, the device only needs a 401 (Unauthorized) response in case of failure.

func MakeCheckinEndpoint

func MakeCheckinEndpoint(svc Service) endpoint.Endpoint

func MarshalEvent

func MarshalEvent(e *Event) ([]byte, error)

MarshalEvent serializes an event to a protocol buffer wire format.

func UnmarshalEvent

func UnmarshalEvent(data []byte, e *Event) error

UnmarshalEvent parses a protocol buffer representation of data into the Event.

Types

type Checkin

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

func New

func New(db *bolt.DB, pub pubsub.Publisher) (*Checkin, error)

func (*Checkin) Authenticate

func (svc *Checkin) Authenticate(ctx context.Context, cmd mdm.CheckinCommand) error

func (*Checkin) CheckOut

func (svc *Checkin) CheckOut(ctx context.Context, cmd mdm.CheckinCommand) error

func (*Checkin) TokenUpdate

func (svc *Checkin) TokenUpdate(ctx context.Context, cmd mdm.CheckinCommand) error

type Endpoints

type Endpoints struct {
	CheckinEndpoint endpoint.Endpoint
}

type Event

type Event struct {
	ID      string
	Time    time.Time
	Command mdm.CheckinCommand
}

func NewEvent

func NewEvent(cmd mdm.CheckinCommand) *Event

NewEvent returns an Event with a unique ID and the current time.

type HTTPHandlers

type HTTPHandlers struct {
	// The CheckinHandler should accept PUT requests
	CheckinHandler http.Handler
}

func MakeHTTPHandlers

func MakeHTTPHandlers(ctx context.Context, endpoints Endpoints, opts ...httptransport.ServerOption) HTTPHandlers

type Service

type Service interface {
	Authenticate(ctx context.Context, cmd mdm.CheckinCommand) error
	TokenUpdate(ctx context.Context, cmd mdm.CheckinCommand) error
	CheckOut(ctx context.Context, cmd mdm.CheckinCommand) error
}

Service defines methods for and MDM Check-in service.

Directories

Path Synopsis
internal
checkinproto
Package checkinproto is a generated protocol buffer package.
Package checkinproto is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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