mirror of
https://github.com/fleetdm/fleet
synced 2026-05-18 14:38:53 +00:00
For #26218 Basic Android MDM on/off backend functionality. Manually tested. The following env vars must be set: ``` FLEET_DEV_ANDROID_ENABLED=1 FLEET_DEV_ANDROID_SERVICE_CREDENTIALS=$(cat credentials.json) FLEET_DEV_ANDROID_PUBSUB_TOPIC=projects/your-project/topics/your-topic ``` I picked https://github.com/go-json-experiment/json as the JSON library, which seems like the safest option. - will become json/v2 at some point - currently used in production by other companies, like Tailscale - well-maintained - Some context here: https://github.com/fleetdm/fleet/issues/25512 Plan for next work: - refactoring from 1st PR - add pubsub with device enroll -> spec proxy for fleetdm.com - come back to this sub-task to add tests and finish TODOs # Checklist for submitter - [x] Added/updated automated tests - [x] Manual QA for all new/changed functionality
34 lines
650 B
Go
34 lines
650 B
Go
package android
|
|
|
|
type SignupDetails struct {
|
|
Url string
|
|
Name string
|
|
}
|
|
|
|
type Enterprise struct {
|
|
ID uint `db:"id"`
|
|
SignupName string `db:"signup_name"`
|
|
EnterpriseID string `db:"enterprise_id"`
|
|
}
|
|
|
|
func (e Enterprise) Name() string {
|
|
return "enterprises/" + e.EnterpriseID
|
|
}
|
|
|
|
func (e Enterprise) IsValid() bool {
|
|
return e.EnterpriseID != ""
|
|
}
|
|
|
|
func (e Enterprise) AuthzType() string {
|
|
return "android_enterprise"
|
|
}
|
|
|
|
type EnrollmentToken struct {
|
|
Value string `json:"value"`
|
|
}
|
|
|
|
type Host struct {
|
|
HostID uint `db:"host_id"`
|
|
FleetEnterpriseID uint `db:"enterprise_id"`
|
|
DeviceID string `db:"device_id"`
|
|
}
|