device

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EMPTY    DEPProfileStatus = "empty"
	ASSIGNED                  = "assigned"
	PUSHED                    = "pushed"
	REMOVED                   = "removed"
)

DEPProfileStatus values

View Source
const DeviceEnrolledTopic = "mdm.DeviceEnrolled"

Variables

This section is empty.

Functions

func MakeListDevicesEndpoint

func MakeListDevicesEndpoint(svc Service) endpoint.Endpoint

func MakeRemoveDevicesEndpoint

func MakeRemoveDevicesEndpoint(svc Service) endpoint.Endpoint

func MarshalDevice

func MarshalDevice(dev *Device) ([]byte, error)

func RegisterHTTPHandlers

func RegisterHTTPHandlers(r *mux.Router, e Endpoints, options ...httptransport.ServerOption)

func UDIDCertAuthMiddleware

func UDIDCertAuthMiddleware(store UDIDCertAuthStore, logger log.Logger, warnOnly bool) mdm.Middleware

func UnmarshalDevice

func UnmarshalDevice(data []byte, dev *Device) error

Types

type DEPProfileStatus

type DEPProfileStatus string

DEPProfileStatus is the status of the DEP Profile can be either "empty", "assigned", "pushed", or "removed"

type Device

type Device struct {
	UUID                   string           `db:"uuid"`
	UDID                   string           `db:"udid"`
	SerialNumber           string           `db:"serial_number"`
	OSVersion              string           `db:"os_version"`
	BuildVersion           string           `db:"build_version"`
	ProductName            string           `db:"product_name"`
	IMEI                   string           `db:"imei"`
	MEID                   string           `db:"meid"`
	PushMagic              string           `db:"push_magic"`
	AwaitingConfiguration  bool             `db:"awaiting_configuration"`
	Token                  string           `db:"token"`
	UnlockToken            string           `db:"unlock_token"`
	Enrolled               bool             `db:"enrolled"`
	Description            string           `db:"description"`
	Model                  string           `db:"model"`
	ModelName              string           `db:"model_name"`
	DeviceName             string           `db:"device_name"`
	Color                  string           `db:"color"`
	AssetTag               string           `db:"asset_tag"`
	DEPProfileStatus       DEPProfileStatus `db:"dep_profile_status"`
	DEPProfileUUID         string           `db:"dep_profile_uuid"`
	DEPProfileAssignTime   time.Time        `db:"dep_profile_assign_time"`
	DEPProfilePushTime     time.Time        `db:"dep_profile_push_time"`
	DEPProfileAssignedDate time.Time        `db:"dep_profile_assigned_date"`
	DEPProfileAssignedBy   string           `db:"dep_profile_assigned_by"`
	LastSeen               time.Time        `db:"last_seen"`
	BootstrapToken         []byte           `db:"bootstrap_token"`
}

type DeviceDTO

type DeviceDTO struct {
	SerialNumber     string           `json:"serial_number"`
	UDID             string           `json:"udid"`
	EnrollmentStatus bool             `json:"enrollment_status"`
	LastSeen         time.Time        `json:"last_seen"`
	DEPProfileStatus DEPProfileStatus `json:"dep_profile_status"`
}

type DeviceService

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

func New

func New(store Store) *DeviceService

func (*DeviceService) ListDevices

func (svc *DeviceService) ListDevices(ctx context.Context, opt ListDevicesOption) ([]DeviceDTO, error)

func (*DeviceService) RemoveDevices

func (svc *DeviceService) RemoveDevices(ctx context.Context, opt RemoveDevicesOptions) error

type DeviceWorkerStore

type DeviceWorkerStore interface {
	Save(ctx context.Context, d *Device) error
	DeviceByUDID(ctx context.Context, udid string) (*Device, error)
	DeviceBySerial(ctx context.Context, serial string) (*Device, error)
}

type Endpoints

type Endpoints struct {
	ListDevicesEndpoint   endpoint.Endpoint
	RemoveDevicesEndpoint endpoint.Endpoint
}

func MakeServerEndpoints

func MakeServerEndpoints(s Service, outer endpoint.Middleware, others ...endpoint.Middleware) Endpoints

func (Endpoints) ListDevices

func (e Endpoints) ListDevices(ctx context.Context, opts ListDevicesOption) ([]DeviceDTO, error)

func (Endpoints) RemoveDevices

func (e Endpoints) RemoveDevices(ctx context.Context, Opts RemoveDevicesOptions) error

type ListDevicesOption

type ListDevicesOption struct {
	Page    int `json:"page"`
	PerPage int `json:"per_page"`

	FilterSerial []string `json:"filter_serial"`
	FilterUDID   []string `json:"filter_udid"`
}

type RemoveDevicesOptions

type RemoveDevicesOptions struct {
	UDIDs   []string `json:"udids"`
	Serials []string `json:"serials"`
}

type Service

type Service interface {
	ListDevices(ctx context.Context, opt ListDevicesOption) ([]DeviceDTO, error)
	RemoveDevices(ctx context.Context, opt RemoveDevicesOptions) error
}

func NewHTTPClient

func NewHTTPClient(instance, token string, logger log.Logger, opts ...httptransport.ClientOption) (Service, error)

type Store

type Store interface {
	List(ctx context.Context, opt ListDevicesOption) ([]Device, error)
	DeleteByUDID(ctx context.Context, udid string) error
	DeleteBySerial(ctx context.Context, serial string) error
}

type UDIDCertAuthStore

type UDIDCertAuthStore interface {
	SaveUDIDCertHash(udid, certHash []byte) error
	GetUDIDCertHash(udid []byte) ([]byte, error)
}

type Worker

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

func NewWorker

func NewWorker(db DeviceWorkerStore, ps pubsub.PublishSubscriber, logger log.Logger) *Worker

func (*Worker) Run

func (w *Worker) Run(ctx context.Context) error

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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