Documentation
¶
Index ¶
- Constants
- func HandleAPIv1(prefix string, mux Mux, logger log.Logger, store APIStorage, ...)
- func PathIDGetter(r *http.Request) ([]string, error)
- func PushHandler(pusher push.Pusher, logger log.Logger) http.HandlerFuncdeprecated
- func PushToIDsHandler(pusher push.Pusher, logger log.Logger, ...) http.HandlerFunc
- func RawCommandEnqueueHandler(enqueuer storage.CommandEnqueuer, pusher push.Pusher, logger log.Logger) http.HandlerFuncdeprecated
- func RawCommandEnqueueToIDsHandler(enqueuer storage.CommandEnqueuer, pusher push.Pusher, logger log.Logger, ...) http.HandlerFunc
- func StorePushCertHandler(storage storage.PushCertStore, logger log.Logger) http.HandlerFunc
- type APIStorage
- type Mux
Constants ¶
const ( APIEndpointPushCert = "/pushcert" APIEndpointPush = "/push/" // note trailing slash APIEndpointEnqueue = "/enqueue/" // note trailing slash )
Variables ¶
This section is empty.
Functions ¶
func HandleAPIv1 ¶ added in v0.8.0
HandleAPIv1 registers the various API handlers into mux. API endpoint paths are prepended with prefix. Authentication or any other layered handlers are not present. They are assumed to be layered with mux. If prefix is empty and these handlers are used in sub-paths then handlers should have that sub-path stripped from the request. The logger is adorned with a "handler" key of the endpoint name.
func PathIDGetter ¶ added in v0.8.0
PathIDGetter returns the list of comma-separated enrollment IDs from r.
func PushHandler
deprecated
PushHandler sends APNs push notifications to MDM enrollments.
Note the whole URL path is used as the identifier to push to. This probably necessitates stripping the URL prefix before using. Also note we expose Go errors to the output as this is meant for "API" users.
Deprecated: use PushToIDsHandler instead. Use PathIDGetter with it for the previous behavior.
func PushToIDsHandler ¶ added in v0.8.0
func PushToIDsHandler(pusher push.Pusher, logger log.Logger, idGetter func(*http.Request) ([]string, error)) http.HandlerFunc
PushToIDsHandler sends APNs push notifications to MDM enrollments. Use idGetter to get the slice of enrollment IDs from the HTTP request.
func RawCommandEnqueueHandler
deprecated
func RawCommandEnqueueHandler(enqueuer storage.CommandEnqueuer, pusher push.Pusher, logger log.Logger) http.HandlerFunc
RawCommandEnqueueHandler enqueues a raw MDM command plist and sends push notifications to MDM enrollments.
Note the whole URL path is used as the identifier to enqueue (and push to. This probably necessitates stripping the URL prefix before using. Also note we expose Go errors to the output as this is meant for "API" users.
Deprecated: use RawCommandEnqueueToIDsHandler instead. Use PathIDGetter with it for the previous behavior.
func RawCommandEnqueueToIDsHandler ¶ added in v0.8.0
func RawCommandEnqueueToIDsHandler(enqueuer storage.CommandEnqueuer, pusher push.Pusher, logger log.Logger, idGetter func(*http.Request) ([]string, error)) http.HandlerFunc
RawCommandEnqueueToIDsHandler enqueues a raw MDM command and sends push notifications to MDM enrollments. Use idGetter to get the slice of enrollment IDs from the HTTP request.
func StorePushCertHandler ¶
func StorePushCertHandler(storage storage.PushCertStore, logger log.Logger) http.HandlerFunc
StorePushCertHandler reads a PEM-encoded certificate and private key from the HTTP body and saves it to storage. This effectively enables us to do something like: "% cat push.pem push.key | curl -T - http://api.example.com/" to upload our push certs.
Types ¶
type APIStorage ¶ added in v0.8.0
type APIStorage interface {
storage.PushCertStore
storage.CommandEnqueuer
}
APIStorage is required for the API handlers.