mirror of
https://github.com/fleetdm/fleet
synced 2026-04-21 21:47:20 +00:00
<!-- Add the related story/sub-task/bug number, like Resolves #123, or remove if NA --> **Related issue:** Resolves #38878 and #38879 # Checklist for submitter If some of the following don't apply, delete the relevant line. - [x] Changes file added for user-visible changes in `changes/`, `orbit/changes/` or `ee/fleetd-chrome/changes`. See [Changes files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/guides/committing-changes.md#changes-files) for more information. - [x] Input data is properly validated, `SELECT *` is avoided, SQL injection is prevented (using placeholders for values in statements) - [x] If paths of existing endpoints are modified without backwards compatibility, checked the frontend/CLI for any necessary changes ## Testing - [x] Added/updated automated tests - [x] Where appropriate, [automated tests simulate multiple hosts and test for host isolation](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/reference/patterns-backend.md#unit-testing) (updates to one hosts's records do not affect another) - [x] QA'd all new/changed functionality manually
84 lines
2.5 KiB
Go
84 lines
2.5 KiB
Go
package android
|
|
|
|
import (
|
|
"database/sql"
|
|
"time"
|
|
)
|
|
|
|
const DefaultAndroidPolicyID = 1
|
|
|
|
type SignupDetails struct {
|
|
Url string
|
|
Name string
|
|
}
|
|
|
|
type Enterprise struct {
|
|
ID uint `db:"id"`
|
|
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 EnterpriseDetails struct {
|
|
Enterprise
|
|
SignupName string `db:"signup_name"`
|
|
SignupToken string `db:"signup_token"`
|
|
TopicID string `db:"pubsub_topic_id"`
|
|
UserID uint `db:"user_id"`
|
|
}
|
|
|
|
type EnrollmentToken struct {
|
|
EnrollmentToken string `json:"android_enrollment_token"`
|
|
EnrollmentURL string `json:"android_enrollment_url"`
|
|
EnrollmentQRCode string `json:"android_enrollment_qr_code"`
|
|
}
|
|
|
|
type Device struct {
|
|
ID uint `db:"id"`
|
|
HostID uint `db:"host_id"`
|
|
DeviceID string `db:"device_id"`
|
|
EnterpriseSpecificID *string `db:"enterprise_specific_id"`
|
|
LastPolicySyncTime *time.Time `db:"last_policy_sync_time"`
|
|
AppliedPolicyID *string `db:"applied_policy_id"`
|
|
AppliedPolicyVersion *int64 `db:"applied_policy_version"`
|
|
}
|
|
|
|
type AgentManagedConfiguration struct {
|
|
ServerURL string `json:"server_url"`
|
|
HostUUID string `json:"host_uuid"`
|
|
EnrollSecret string `json:"enroll_secret"`
|
|
CertificateTemplateIDs []AgentCertificateTemplate `json:"certificate_templates,omitempty"`
|
|
}
|
|
|
|
type AgentCertificateTemplate struct {
|
|
ID uint `json:"id"`
|
|
Status string `json:"status"`
|
|
Operation string `json:"operation"`
|
|
UUID string `json:"uuid"`
|
|
}
|
|
|
|
// MDMAndroidPolicyRequest represents a request made to the Android Management
|
|
// API (AMAPI) to patch the policy or the device (as made by
|
|
// androidsvc.ReconcileProfiles).
|
|
type MDMAndroidPolicyRequest struct {
|
|
RequestUUID string `db:"request_uuid"`
|
|
RequestName string `db:"request_name"`
|
|
PolicyID string `db:"policy_id"`
|
|
Payload []byte `db:"payload"`
|
|
StatusCode int `db:"status_code"`
|
|
ErrorDetails sql.Null[string] `db:"error_details"`
|
|
AppliedPolicyVersion sql.Null[int64] `db:"applied_policy_version"`
|
|
PolicyVersion sql.Null[int64] `db:"policy_version"`
|
|
}
|
|
|
|
const AppStatusAvailable = "AVAILABLE"
|