Documentation
¶
Overview ¶
Package webhook is a NanoMDM service for sending HTTP webhook events.
Index ¶
- Constants
- type AcknowledgeEvent
- type CheckinEvent
- type Doer
- type EnrollmentID
- type EventJson
- type EventJsonTopic
- type IDs
- type IDsType
- type Option
- type RawPayload
- type UDID
- type Webhook
- func (w *Webhook) Authenticate(r *mdm.Request, m *mdm.Authenticate) error
- func (w *Webhook) CheckOut(r *mdm.Request, m *mdm.CheckOut) error
- func (w *Webhook) CommandAndReportResults(r *mdm.Request, results *mdm.CommandResults) (*mdm.Command, error)
- func (w *Webhook) DeclarativeManagement(r *mdm.Request, m *mdm.DeclarativeManagement) ([]byte, error)
- func (w *Webhook) GetBootstrapToken(r *mdm.Request, m *mdm.GetBootstrapToken) (*mdm.BootstrapToken, error)
- func (w *Webhook) GetToken(r *mdm.Request, m *mdm.GetToken) (*mdm.GetTokenResponse, error)
- func (w *Webhook) SetBootstrapToken(r *mdm.Request, m *mdm.SetBootstrapToken) error
- func (w *Webhook) TokenUpdate(r *mdm.Request, m *mdm.TokenUpdate) error
- func (w *Webhook) UserAuthenticate(r *mdm.Request, m *mdm.UserAuthenticate) ([]byte, error)
Constants ¶
const ( // ContentType used for all requests. ContentType = "application/json; charset=utf-8" // HTTP header name used when including HMAC signatures. HMACHeader = "X-Hmac-Signature" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AcknowledgeEvent ¶
type AcknowledgeEvent struct {
// The command UUID parsed from the command report, if available.
CommandUuid *string `json:"command_uuid,omitempty"`
// The `EnrollmentID` of the MDM enrollment.
EnrollmentId *EnrollmentID `json:"enrollment_id,omitempty"`
// NanoMDM enrollment IDs.
Ids *IDs `json:"ids,omitempty"`
// The raw HTTP body of the MDM command report.
RawPayload RawPayload `json:"raw_payload"`
// The MDM status of the device. Can indicate command report status.
Status string `json:"status"`
// The `UDID` of the MDM device.
Udid *UDID `json:"udid,omitempty"`
// Query paramters of the command report MDM HTTP request.
UrlParams map[string]string `json:"url_params,omitempty"`
}
The "command and report results" (a.k.a. "Acknowledge" or "Connect") event. Represents the MDM command report from MDM enrollments.
type CheckinEvent ¶
type CheckinEvent struct {
// The `EnrollmentID` of the MDM enrollment.
EnrollmentId *EnrollmentID `json:"enrollment_id,omitempty"`
// NanoMDM enrollment IDs.
Ids *IDs `json:"ids,omitempty"`
// The raw HTTP body of the MDM command report.
RawPayload RawPayload `json:"raw_payload"`
// Count of how many `TokenUpdate` check-in messages have occured since device
// enrollment. Primarily to differentiate an enrollment `TokenUpdate` vs. a
// follow-up. Will only be present for a topic name of `mdm.TokenUpdate`.
TokenUpdateTally *int `json:"token_update_tally,omitempty"`
// The `UDID` of the MDM device.
Udid *UDID `json:"udid,omitempty"`
// Query paramters of the command report MDM HTTP request.
UrlParams map[string]string `json:"url_params,omitempty"`
}
The MDM check-in event. The specific check-in type will be indicated in the event topic name as well as the `MessageType` key in the raw payload.
type EventJson ¶
type EventJson struct {
// If present, the MDM "command and report results" (a.k.a. "Acknowledge" or
// "Connect") event. The topic name will be `mdm.Connect`.
AcknowledgeEvent *AcknowledgeEvent `json:"acknowledge_event,omitempty"`
// If present, the MDM check-in event.
CheckinEvent *CheckinEvent `json:"checkin_event,omitempty"`
// The date and time the event was created at.
CreatedAt time.Time `json:"created_at"`
// The unique identifier of the event.
EventId *string `json:"event_id,omitempty"`
// The topic name of the event.
Topic EventJsonTopic `json:"topic"`
}
MicroMDM webhook event
type EventJsonTopic ¶
type EventJsonTopic string
const EventJsonTopicMdmAuthenticate EventJsonTopic = "mdm.Authenticate"
const EventJsonTopicMdmCheckOut EventJsonTopic = "mdm.CheckOut"
const EventJsonTopicMdmConnect EventJsonTopic = "mdm.Connect"
const EventJsonTopicMdmDeclarativeManagement EventJsonTopic = "mdm.DeclarativeManagement"
const EventJsonTopicMdmGetBootstrapToken EventJsonTopic = "mdm.GetBootstrapToken"
const EventJsonTopicMdmGetToken EventJsonTopic = "mdm.GetToken"
const EventJsonTopicMdmSetBootstrapToken EventJsonTopic = "mdm.SetBootstrapToken"
const EventJsonTopicMdmTokenUpdate EventJsonTopic = "mdm.TokenUpdate"
const EventJsonTopicMdmUserAuthenticate EventJsonTopic = "mdm.UserAuthenticate"
type IDs ¶
type IDs struct {
// NanoMDM enrollment ID. See
// https://github.com/micromdm/nanomdm/blob/main/docs/operations-guide.md#enrollment-ids
// for details.
Id string `json:"id"`
// Parent Enrollment ID. In the case of a user channel enrollment the Parent ID
// will be the device channel enrollment ID for the user user.
ParentId *string `json:"parent_id,omitempty"`
// Type of enrollment.
Type IDsType `json:"type"`
}
NanoMDM enrollment IDs.
type IDsType ¶
type IDsType string
const IDsTypeDevice IDsType = "Device"
const IDsTypeUser IDsType = "User"
const IDsTypeUserEnrollment IDsType = "User Enrollment"
const IDsTypeUserEnrollmentDevice IDsType = "User Enrollment (Device)"
type Option ¶
type Option func(*Webhook)
Options configure webhook services.
func WithClient ¶
WithClient configures an HTTP client to use when sending webhooks.
func WithEventID ¶
WithEventID uses fn to get the event ID for each webhook event. Commonly a trace ID or other identifier is used from the context.
func WithHMACSecret ¶
WithHMACSecret will add a SHA-256 HMAC of the webhook HTTP body using key. The HMAC is provided in the HMACHeader header and is Base-64 encoded.
func WithTokenUpdateTalley ¶
func WithTokenUpdateTalley(store storage.TokenUpdateTallyStore) Option
WithTokenUpdateTalley specifies a storage backend to retrieve the "token talley" from. This permits sending the token talley in the event to the webhook.
type Webhook ¶
type Webhook struct {
// contains filtered or unexported fields
}
Webhook is a NanoMDM service for sending HTTP webhook events.
func (*Webhook) Authenticate ¶
Authenticate sends a webhook event of the NanoMDM Authenticate check-in message.
func (*Webhook) CommandAndReportResults ¶
func (w *Webhook) CommandAndReportResults(r *mdm.Request, results *mdm.CommandResults) (*mdm.Command, error)
CommandAndReportResults sends a webhook event of the NanoMDM command results.
func (*Webhook) DeclarativeManagement ¶
func (w *Webhook) DeclarativeManagement(r *mdm.Request, m *mdm.DeclarativeManagement) ([]byte, error)
DeclarativeManagement sends a webhook event of the NanoMDM DeclarativeManagement check-in message.
func (*Webhook) GetBootstrapToken ¶
func (w *Webhook) GetBootstrapToken(r *mdm.Request, m *mdm.GetBootstrapToken) (*mdm.BootstrapToken, error)
GetBootstrapToken sends a webhook event of the NanoMDM GetBootstrapToken check-in message.
func (*Webhook) SetBootstrapToken ¶
SetBootstrapToken sends a webhook event of the NanoMDM SetBootstrapToken check-in message.
func (*Webhook) TokenUpdate ¶
TokenUpdate sends a webhook event of the NanoMDM TokenUpdate check-in message.
func (*Webhook) UserAuthenticate ¶
UserAuthenticate sends a webhook event of the NanoMDM UserAuthenticate check-in message.