From 802e59799c14dff6a78f89e9aab0afc7296bdee7 Mon Sep 17 00:00:00 2001 From: Oliver Kieselbach Date: Fri, 27 Mar 2026 22:36:36 +0100 Subject: [PATCH] fix compiler nullable warnings --- .../AutopilotMonitor.Agent/buildcounter.txt | 2 +- .../Models/BootstrapApiModels.cs | 24 ++++----- .../Models/Config/AdminConfiguration.cs | 8 +-- .../Models/Config/AgentConfigResponse.cs | 4 +- .../Models/Config/TenantConfiguration.cs | 24 ++++----- .../Models/Diagnostics/AgentErrorReport.cs | 8 +-- .../Models/Diagnostics/DiagnosticsLogPath.cs | 4 +- .../Models/Enrollment/BootstrapSession.cs | 10 ++-- .../Models/Enrollment/EnrollmentEvent.cs | 8 +-- .../Models/Enrollment/SessionRegistration.cs | 22 ++++---- .../Notifications/NotificationAction.cs | 6 +-- .../Models/Notifications/NotificationAlert.cs | 6 +-- .../Models/Notifications/NotificationFact.cs | 4 +- .../Notifications/NotificationSection.cs | 4 +- .../Models/ReportApiModels.cs | 44 ++++++++-------- .../Models/Rules/AnalyzeRule.cs | 44 ++++++++-------- .../Models/Rules/GatherRule.cs | 20 ++++---- .../Models/Rules/ImeLogPattern.cs | 12 ++--- .../Models/Rules/RuleResult.cs | 14 +++--- .../Models/SessionApiModels.cs | 50 +++++++++---------- 20 files changed, 159 insertions(+), 159 deletions(-) diff --git a/src/Agent/AutopilotMonitor.Agent/buildcounter.txt b/src/Agent/AutopilotMonitor.Agent/buildcounter.txt index bb33380a..775971ea 100644 --- a/src/Agent/AutopilotMonitor.Agent/buildcounter.txt +++ b/src/Agent/AutopilotMonitor.Agent/buildcounter.txt @@ -1 +1 @@ -646 +648 diff --git a/src/Shared/AutopilotMonitor.Shared/Models/BootstrapApiModels.cs b/src/Shared/AutopilotMonitor.Shared/Models/BootstrapApiModels.cs index 5a403d61..83e8a0a4 100644 --- a/src/Shared/AutopilotMonitor.Shared/Models/BootstrapApiModels.cs +++ b/src/Shared/AutopilotMonitor.Shared/Models/BootstrapApiModels.cs @@ -8,7 +8,7 @@ namespace AutopilotMonitor.Shared.Models /// public class CreateBootstrapSessionRequest { - public string TenantId { get; set; } + public string TenantId { get; set; } = default!; /// /// How long the bootstrap URL should be valid (1–168 hours, default 8) @@ -18,7 +18,7 @@ namespace AutopilotMonitor.Shared.Models /// /// Optional human-readable label (e.g. "Lab A", "Floor 3") /// - public string Label { get; set; } + public string Label { get; set; } = default!; } /// @@ -27,10 +27,10 @@ namespace AutopilotMonitor.Shared.Models public class CreateBootstrapSessionResponse { public bool Success { get; set; } - public string ShortCode { get; set; } - public string BootstrapUrl { get; set; } + public string ShortCode { get; set; } = default!; + public string BootstrapUrl { get; set; } = default!; public DateTime ExpiresAt { get; set; } - public string Message { get; set; } + public string Message { get; set; } = default!; } /// @@ -38,11 +38,11 @@ namespace AutopilotMonitor.Shared.Models /// public class BootstrapSessionListItem { - public string ShortCode { get; set; } - public string Label { get; set; } + public string ShortCode { get; set; } = default!; + public string Label { get; set; } = default!; public DateTime CreatedAt { get; set; } public DateTime ExpiresAt { get; set; } - public string CreatedByUpn { get; set; } + public string CreatedByUpn { get; set; } = default!; public bool IsRevoked { get; set; } public bool IsExpired { get; set; } public int UsageCount { get; set; } @@ -63,10 +63,10 @@ namespace AutopilotMonitor.Shared.Models public class ValidateBootstrapCodeResponse { public bool Success { get; set; } - public string TenantId { get; set; } - public string Token { get; set; } - public string AgentDownloadUrl { get; set; } + public string TenantId { get; set; } = default!; + public string Token { get; set; } = default!; + public string AgentDownloadUrl { get; set; } = default!; public DateTime ExpiresAt { get; set; } - public string Message { get; set; } + public string Message { get; set; } = default!; } } diff --git a/src/Shared/AutopilotMonitor.Shared/Models/Config/AdminConfiguration.cs b/src/Shared/AutopilotMonitor.Shared/Models/Config/AdminConfiguration.cs index 8df4e7cb..7c499509 100644 --- a/src/Shared/AutopilotMonitor.Shared/Models/Config/AdminConfiguration.cs +++ b/src/Shared/AutopilotMonitor.Shared/Models/Config/AdminConfiguration.cs @@ -30,7 +30,7 @@ namespace AutopilotMonitor.Shared.Models /// /// Updated by (Global Admin user email) /// - public string UpdatedBy { get; set; } + public string UpdatedBy { get; set; } = default!; // ===== RATE LIMITING SETTINGS ===== @@ -102,7 +102,7 @@ namespace AutopilotMonitor.Shared.Models /// to include in the diagnostics ZIP package for all tenants. /// Each entry: { "path": "...", "description": "...", "isBuiltIn": true } /// - public string DiagnosticsGlobalLogPathsJson { get; set; } + public string DiagnosticsGlobalLogPathsJson { get; set; } = default!; /// /// Returns the deserialized list of global diagnostics log paths. @@ -130,7 +130,7 @@ namespace AutopilotMonitor.Shared.Models /// Free registration at https://nvd.nist.gov/developers/request-an-api-key /// null = operate without API key (slower, still functional). /// - public string NvdApiKey { get; set; } + public string NvdApiKey { get; set; } = default!; /// /// Whether vulnerability correlation is globally enabled. @@ -143,7 +143,7 @@ namespace AutopilotMonitor.Shared.Models /// Last successful vulnerability data sync timestamp (UTC ISO 8601). /// Updated by VulnerabilityDataSyncFunction. /// - public string VulnerabilityDataLastSyncUtc { get; set; } + public string VulnerabilityDataLastSyncUtc { get; set; } = default!; /// /// Creates default configuration diff --git a/src/Shared/AutopilotMonitor.Shared/Models/Config/AgentConfigResponse.cs b/src/Shared/AutopilotMonitor.Shared/Models/Config/AgentConfigResponse.cs index cb345b76..3db587a9 100644 --- a/src/Shared/AutopilotMonitor.Shared/Models/Config/AgentConfigResponse.cs +++ b/src/Shared/AutopilotMonitor.Shared/Models/Config/AgentConfigResponse.cs @@ -40,7 +40,7 @@ namespace AutopilotMonitor.Shared.Models /// public bool EnableImeMatchLog { get; set; } = false; - public CollectorConfiguration Collectors { get; set; } + public CollectorConfiguration Collectors { get; set; } = default!; /// /// User-defined ad-hoc gather rules (minimal set, not for IME log parsing) @@ -104,7 +104,7 @@ namespace AutopilotMonitor.Shared.Models /// Expected size: 540 x 80 px. Larger images will be center-cropped. /// null = no banner. /// - public string EnrollmentSummaryBrandingImageUrl { get; set; } + public string EnrollmentSummaryBrandingImageUrl { get; set; } = default!; /// /// Maximum time in seconds the agent retries launching the enrollment summary dialog diff --git a/src/Shared/AutopilotMonitor.Shared/Models/Config/TenantConfiguration.cs b/src/Shared/AutopilotMonitor.Shared/Models/Config/TenantConfiguration.cs index f75d7bf6..5bdc1991 100644 --- a/src/Shared/AutopilotMonitor.Shared/Models/Config/TenantConfiguration.cs +++ b/src/Shared/AutopilotMonitor.Shared/Models/Config/TenantConfiguration.cs @@ -15,13 +15,13 @@ namespace AutopilotMonitor.Shared.Models /// /// Tenant ID (PartitionKey in Table Storage) /// - public string TenantId { get; set; } + public string TenantId { get; set; } = default!; /// /// Domain name extracted from the first user's UPN /// Used for display purposes (e.g., contoso.com) /// - public string DomainName { get; set; } + public string DomainName { get; set; } = default!; /// /// When the configuration was last updated @@ -31,7 +31,7 @@ namespace AutopilotMonitor.Shared.Models /// /// Updated by (user email or system) /// - public string UpdatedBy { get; set; } + public string UpdatedBy { get; set; } = default!; // ===== TENANT STATUS ===== @@ -215,7 +215,7 @@ namespace AutopilotMonitor.Shared.Models /// NTP server address for time check during enrollment. /// null = use agent default ("time.windows.com"). /// - public string NtpServer { get; set; } + public string NtpServer { get; set; } = default!; /// /// Whether to automatically set the device timezone based on IP geolocation. @@ -235,7 +235,7 @@ namespace AutopilotMonitor.Shared.Models /// Log verbosity level override for this tenant's agents. /// null = use agent default ("Info"). Values: "Info", "Debug", "Verbose", "Trace". /// - public string LogLevel { get; set; } + public string LogLevel { get; set; } = default!; /// /// Maximum events per upload batch. @@ -260,7 +260,7 @@ namespace AutopilotMonitor.Shared.Models /// Optional URL to a branding image displayed as a banner at the top of the enrollment summary dialog. /// Expected size: 540 x 80 px. Larger images will be center-cropped. /// - public string EnrollmentSummaryBrandingImageUrl { get; set; } + public string EnrollmentSummaryBrandingImageUrl { get; set; } = default!; /// /// Maximum time in seconds the agent retries launching the enrollment summary dialog @@ -296,7 +296,7 @@ namespace AutopilotMonitor.Shared.Models /// on a newly enrolled device (merged with built-in defaults on the agent). /// Example: ["SupportAdmin", "TechDesk"] /// - public string LocalAdminAllowedAccountsJson { get; set; } + public string LocalAdminAllowedAccountsJson { get; set; } = default!; /// /// Returns the deserialized list of additional allowed local admin account names. @@ -351,7 +351,7 @@ namespace AutopilotMonitor.Shared.Models /// to include in the diagnostics ZIP package (additive to global paths). /// Each entry: { "path": "...", "description": "...", "isBuiltIn": false } /// - public string DiagnosticsLogPathsJson { get; set; } + public string DiagnosticsLogPathsJson { get; set; } = default!; /// /// Returns the deserialized list of tenant-specific diagnostics log paths. @@ -379,7 +379,7 @@ namespace AutopilotMonitor.Shared.Models /// Each tenant provides their own container — data stays in the customer's storage. /// If null or empty, diagnostics upload is disabled. /// - public string DiagnosticsBlobSasUrl { get; set; } + public string DiagnosticsBlobSasUrl { get; set; } = default!; /// /// When to upload diagnostics packages: "Off", "Always", "OnFailure". @@ -402,7 +402,7 @@ namespace AutopilotMonitor.Shared.Models /// URL of the Teams Incoming Webhook for enrollment notifications. /// If null or empty, no notifications are sent. /// - public string TeamsWebhookUrl { get; set; } + public string TeamsWebhookUrl { get; set; } = default!; /// /// Send a Teams notification when an enrollment completes successfully. @@ -429,7 +429,7 @@ namespace AutopilotMonitor.Shared.Models /// Generic webhook URL for enrollment notifications. /// Replaces TeamsWebhookUrl for new configurations. /// - public string WebhookUrl { get; set; } + public string WebhookUrl { get; set; } = default!; /// /// Send a webhook notification when enrollment succeeds. Default: true. @@ -447,7 +447,7 @@ namespace AutopilotMonitor.Shared.Models /// Returns the effective webhook URL and provider type, handling legacy TeamsWebhookUrl migration. /// New fields take priority; falls back to TeamsWebhookUrl as TeamsLegacyConnector. /// - public (string Url, int ProviderType) GetEffectiveWebhookConfig() + public (string? Url, int ProviderType) GetEffectiveWebhookConfig() { // New fields take priority if (!string.IsNullOrEmpty(WebhookUrl) && WebhookProviderType != 0) diff --git a/src/Shared/AutopilotMonitor.Shared/Models/Diagnostics/AgentErrorReport.cs b/src/Shared/AutopilotMonitor.Shared/Models/Diagnostics/AgentErrorReport.cs index 08706036..c5b8e4e2 100644 --- a/src/Shared/AutopilotMonitor.Shared/Models/Diagnostics/AgentErrorReport.cs +++ b/src/Shared/AutopilotMonitor.Shared/Models/Diagnostics/AgentErrorReport.cs @@ -35,12 +35,12 @@ namespace AutopilotMonitor.Shared.Models /// The agent's current session ID (from SessionPersistence). /// Allows correlation with session data already in the backend. /// - public string SessionId { get; set; } + public string SessionId { get; set; } = default!; /// /// Tenant ID, from the device's MDM enrollment registry key. /// - public string TenantId { get; set; } + public string TenantId { get; set; } = default!; /// /// Classification of the error. @@ -51,7 +51,7 @@ namespace AutopilotMonitor.Shared.Models /// Error message from the exception or HTTP response. /// Kept short — no stack traces, no sensitive data. /// - public string Message { get; set; } + public string Message { get; set; } = default!; /// /// HTTP status code returned by the backend, if applicable. @@ -68,7 +68,7 @@ namespace AutopilotMonitor.Shared.Models /// /// Agent version string for diagnosing version-specific issues. /// - public string AgentVersion { get; set; } + public string AgentVersion { get; set; } = default!; /// /// UTC timestamp of when the error occurred on the agent. diff --git a/src/Shared/AutopilotMonitor.Shared/Models/Diagnostics/DiagnosticsLogPath.cs b/src/Shared/AutopilotMonitor.Shared/Models/Diagnostics/DiagnosticsLogPath.cs index b3808b72..2211c796 100644 --- a/src/Shared/AutopilotMonitor.Shared/Models/Diagnostics/DiagnosticsLogPath.cs +++ b/src/Shared/AutopilotMonitor.Shared/Models/Diagnostics/DiagnosticsLogPath.cs @@ -11,12 +11,12 @@ namespace AutopilotMonitor.Shared.Models /// Environment variables are expanded by the agent. /// Wildcards are only allowed in the last path segment (e.g. "C:\Windows\Panther\*.log"). /// - public string Path { get; set; } + public string Path { get; set; } = default!; /// /// Human-readable description shown in the portal. /// - public string Description { get; set; } + public string Description { get; set; } = default!; /// /// True when defined globally by a Global Admin — displayed as read-only for tenants. diff --git a/src/Shared/AutopilotMonitor.Shared/Models/Enrollment/BootstrapSession.cs b/src/Shared/AutopilotMonitor.Shared/Models/Enrollment/BootstrapSession.cs index e9ffc3a4..9752a1b3 100644 --- a/src/Shared/AutopilotMonitor.Shared/Models/Enrollment/BootstrapSession.cs +++ b/src/Shared/AutopilotMonitor.Shared/Models/Enrollment/BootstrapSession.cs @@ -12,19 +12,19 @@ namespace AutopilotMonitor.Shared.Models /// /// Tenant ID (Azure AD tenant GUID). Used as PartitionKey for the main entity. /// - public string TenantId { get; set; } + public string TenantId { get; set; } = default!; /// /// Short alphanumeric code (6 chars) used in the URL path. /// Used as RowKey for the main entity. /// - public string ShortCode { get; set; } + public string ShortCode { get; set; } = default!; /// /// GUID token embedded in the generated bootstrap script. /// The agent sends this as X-Bootstrap-Token header for pre-MDM authentication. /// - public string Token { get; set; } + public string Token { get; set; } = default!; /// /// When this session was created @@ -40,7 +40,7 @@ namespace AutopilotMonitor.Shared.Models /// /// UPN of the admin who created this session /// - public string CreatedByUpn { get; set; } + public string CreatedByUpn { get; set; } = default!; /// /// Whether this session has been manually revoked by an admin @@ -55,6 +55,6 @@ namespace AutopilotMonitor.Shared.Models /// /// Optional human-readable label (e.g. "Lab A", "Floor 3") /// - public string Label { get; set; } + public string Label { get; set; } = default!; } } diff --git a/src/Shared/AutopilotMonitor.Shared/Models/Enrollment/EnrollmentEvent.cs b/src/Shared/AutopilotMonitor.Shared/Models/Enrollment/EnrollmentEvent.cs index cc1d82ec..63effd8b 100644 --- a/src/Shared/AutopilotMonitor.Shared/Models/Enrollment/EnrollmentEvent.cs +++ b/src/Shared/AutopilotMonitor.Shared/Models/Enrollment/EnrollmentEvent.cs @@ -41,7 +41,7 @@ namespace AutopilotMonitor.Shared.Models /// /// Type of event (e.g., "phase_transition", "app_install_start", "error") /// - public string EventType { get; set; } + public string EventType { get; set; } = default!; /// /// Severity level of the event (internal property, not serialized) @@ -58,7 +58,7 @@ namespace AutopilotMonitor.Shared.Models /// /// Source of the event (e.g., "IME", "EventLog", "Agent") /// - public string Source { get; set; } + public string Source { get; set; } = default!; /// /// Phase during which this event occurred (internal property, not serialized) @@ -107,7 +107,7 @@ namespace AutopilotMonitor.Shared.Models /// /// Human-readable message /// - public string Message { get; set; } + public string Message { get; set; } = default!; /// /// Additional structured data @@ -124,7 +124,7 @@ namespace AutopilotMonitor.Shared.Models /// Represents the exact sort key used in storage. /// [JsonPropertyName("rowKey")] - public string RowKey { get; set; } + public string RowKey { get; set; } = default!; public EnrollmentEvent() { diff --git a/src/Shared/AutopilotMonitor.Shared/Models/Enrollment/SessionRegistration.cs b/src/Shared/AutopilotMonitor.Shared/Models/Enrollment/SessionRegistration.cs index 4ee83ee3..987c4fe3 100644 --- a/src/Shared/AutopilotMonitor.Shared/Models/Enrollment/SessionRegistration.cs +++ b/src/Shared/AutopilotMonitor.Shared/Models/Enrollment/SessionRegistration.cs @@ -15,52 +15,52 @@ namespace AutopilotMonitor.Shared.Models /// /// Tenant identifier /// - public string TenantId { get; set; } + public string TenantId { get; set; } = default!; /// /// Device serial number /// - public string SerialNumber { get; set; } + public string SerialNumber { get; set; } = default!; /// /// Device manufacturer /// - public string Manufacturer { get; set; } + public string Manufacturer { get; set; } = default!; /// /// Device model /// - public string Model { get; set; } + public string Model { get; set; } = default!; /// /// Device name /// - public string DeviceName { get; set; } + public string DeviceName { get; set; } = default!; /// /// OS product name, e.g. "Microsoft Windows 11 Pro" /// - public string OsName { get; set; } + public string OsName { get; set; } = default!; /// /// Real OS build number, e.g. "26220.7934" (CurrentBuild.UBR from registry) /// - public string OsBuild { get; set; } + public string OsBuild { get; set; } = default!; /// /// OS display version, e.g. "25H2", "24H2" /// - public string OsDisplayVersion { get; set; } + public string OsDisplayVersion { get; set; } = default!; /// /// OS edition (e.g., "Pro", "Enterprise") /// - public string OsEdition { get; set; } + public string OsEdition { get; set; } = default!; /// /// OS language /// - public string OsLanguage { get; set; } + public string OsLanguage { get; set; } = default!; /// /// Whether this is user-driven enrollment @@ -80,7 +80,7 @@ namespace AutopilotMonitor.Shared.Models /// /// Agent version /// - public string AgentVersion { get; set; } + public string AgentVersion { get; set; } = default!; /// /// Enrollment type detected by the agent: "v1" (Autopilot Classic/ESP) or "v2" (Windows Device Preparation) diff --git a/src/Shared/AutopilotMonitor.Shared/Models/Notifications/NotificationAction.cs b/src/Shared/AutopilotMonitor.Shared/Models/Notifications/NotificationAction.cs index 3b27edab..989d12db 100644 --- a/src/Shared/AutopilotMonitor.Shared/Models/Notifications/NotificationAction.cs +++ b/src/Shared/AutopilotMonitor.Shared/Models/Notifications/NotificationAction.cs @@ -2,8 +2,8 @@ namespace AutopilotMonitor.Shared.Models.Notifications { public class NotificationAction { - public string Type { get; set; } - public string Title { get; set; } - public string Url { get; set; } + public string Type { get; set; } = default!; + public string Title { get; set; } = default!; + public string Url { get; set; } = default!; } } diff --git a/src/Shared/AutopilotMonitor.Shared/Models/Notifications/NotificationAlert.cs b/src/Shared/AutopilotMonitor.Shared/Models/Notifications/NotificationAlert.cs index 95e71534..9aa16c49 100644 --- a/src/Shared/AutopilotMonitor.Shared/Models/Notifications/NotificationAlert.cs +++ b/src/Shared/AutopilotMonitor.Shared/Models/Notifications/NotificationAlert.cs @@ -10,16 +10,16 @@ namespace AutopilotMonitor.Shared.Models.Notifications public class NotificationAlert { /// Main title, e.g. "Enrollment Succeeded". - public string Title { get; set; } + public string Title { get; set; } = default!; /// One-line summary for toast/preview text. - public string Summary { get; set; } + public string Summary { get; set; } = default!; /// Severity level used for color/icon mapping in renderers. public NotificationSeverity Severity { get; set; } /// Hex color code (without #). Used by legacy Teams renderer, mapped to styles by others. - public string ThemeColor { get; set; } + public string ThemeColor { get; set; } = default!; /// Key-value fact pairs (Device, Serial, Hardware, Duration, etc.). public List Facts { get; set; } = new(); diff --git a/src/Shared/AutopilotMonitor.Shared/Models/Notifications/NotificationFact.cs b/src/Shared/AutopilotMonitor.Shared/Models/Notifications/NotificationFact.cs index 83348857..8ba8ab26 100644 --- a/src/Shared/AutopilotMonitor.Shared/Models/Notifications/NotificationFact.cs +++ b/src/Shared/AutopilotMonitor.Shared/Models/Notifications/NotificationFact.cs @@ -2,7 +2,7 @@ namespace AutopilotMonitor.Shared.Models.Notifications { public class NotificationFact { - public string Name { get; set; } - public string Value { get; set; } + public string Name { get; set; } = default!; + public string Value { get; set; } = default!; } } diff --git a/src/Shared/AutopilotMonitor.Shared/Models/Notifications/NotificationSection.cs b/src/Shared/AutopilotMonitor.Shared/Models/Notifications/NotificationSection.cs index 650f947c..d89f3aad 100644 --- a/src/Shared/AutopilotMonitor.Shared/Models/Notifications/NotificationSection.cs +++ b/src/Shared/AutopilotMonitor.Shared/Models/Notifications/NotificationSection.cs @@ -2,7 +2,7 @@ namespace AutopilotMonitor.Shared.Models.Notifications { public class NotificationSection { - public string Title { get; set; } - public string Text { get; set; } + public string Title { get; set; } = default!; + public string Text { get; set; } = default!; } } diff --git a/src/Shared/AutopilotMonitor.Shared/Models/ReportApiModels.cs b/src/Shared/AutopilotMonitor.Shared/Models/ReportApiModels.cs index 60083d1b..4d89582f 100644 --- a/src/Shared/AutopilotMonitor.Shared/Models/ReportApiModels.cs +++ b/src/Shared/AutopilotMonitor.Shared/Models/ReportApiModels.cs @@ -8,34 +8,34 @@ namespace AutopilotMonitor.Shared.Models /// public class SubmitSessionReportRequest { - public string TenantId { get; set; } - public string SessionId { get; set; } - public string Comment { get; set; } - public string Email { get; set; } + public string TenantId { get; set; } = default!; + public string SessionId { get; set; } = default!; + public string Comment { get; set; } = default!; + public string Email { get; set; } = default!; /// Session row as CSV (single data row with header) - public string SessionCsv { get; set; } + public string SessionCsv { get; set; } = default!; /// Pre-generated UI timeline export (TXT) - public string TimelineExportTxt { get; set; } + public string TimelineExportTxt { get; set; } = default!; /// Pre-generated raw events table export (CSV) - public string EventsCsv { get; set; } + public string EventsCsv { get; set; } = default!; /// Pre-generated analysis rule results export (CSV) - public string RuleResultsCsv { get; set; } + public string RuleResultsCsv { get; set; } = default!; /// Base64-encoded screenshot image (optional) - public string ScreenshotBase64 { get; set; } + public string ScreenshotBase64 { get; set; } = default!; /// Original screenshot file name for extension detection - public string ScreenshotFileName { get; set; } + public string ScreenshotFileName { get; set; } = default!; /// Base64-encoded agent log file (optional, max 5 MB) - public string AgentLogBase64 { get; set; } + public string AgentLogBase64 { get; set; } = default!; /// Original agent log file name - public string AgentLogFileName { get; set; } + public string AgentLogFileName { get; set; } = default!; } /// @@ -44,8 +44,8 @@ namespace AutopilotMonitor.Shared.Models public class SubmitSessionReportResponse { public bool Success { get; set; } - public string Message { get; set; } - public string ReportId { get; set; } + public string Message { get; set; } = default!; + public string ReportId { get; set; } = default!; } /// @@ -53,14 +53,14 @@ namespace AutopilotMonitor.Shared.Models /// public class SessionReportMetadata { - public string ReportId { get; set; } - public string TenantId { get; set; } - public string SessionId { get; set; } - public string Comment { get; set; } - public string Email { get; set; } - public string BlobName { get; set; } - public string SubmittedBy { get; set; } + public string ReportId { get; set; } = default!; + public string TenantId { get; set; } = default!; + public string SessionId { get; set; } = default!; + public string Comment { get; set; } = default!; + public string Email { get; set; } = default!; + public string BlobName { get; set; } = default!; + public string SubmittedBy { get; set; } = default!; public DateTime SubmittedAt { get; set; } - public string AdminNote { get; set; } + public string AdminNote { get; set; } = default!; } } diff --git a/src/Shared/AutopilotMonitor.Shared/Models/Rules/AnalyzeRule.cs b/src/Shared/AutopilotMonitor.Shared/Models/Rules/AnalyzeRule.cs index 8f15937c..7ee5093d 100644 --- a/src/Shared/AutopilotMonitor.Shared/Models/Rules/AnalyzeRule.cs +++ b/src/Shared/AutopilotMonitor.Shared/Models/Rules/AnalyzeRule.cs @@ -12,27 +12,27 @@ namespace AutopilotMonitor.Shared.Models /// /// Unique rule identifier (e.g., "ANALYZE-NET-001") /// - public string RuleId { get; set; } + public string RuleId { get; set; } = default!; /// /// Human-readable rule title (e.g., "Proxy Authentication Required") /// - public string Title { get; set; } + public string Title { get; set; } = default!; /// /// Detailed description of what this rule detects /// - public string Description { get; set; } + public string Description { get; set; } = default!; /// /// Severity level: "info", "warning", "high", "critical" /// - public string Severity { get; set; } + public string Severity { get; set; } = default!; /// /// Rule category: network, identity, enrollment, apps, esp, device /// - public string Category { get; set; } + public string Category { get; set; } = default!; /// /// Semantic version of this rule (e.g., "1.0.0") @@ -100,7 +100,7 @@ namespace AutopilotMonitor.Shared.Models /// Detailed explanation of the detected issue /// Supports markdown formatting /// - public string Explanation { get; set; } + public string Explanation { get; set; } = default!; /// /// Steps to remediate the detected issue @@ -138,19 +138,19 @@ namespace AutopilotMonitor.Shared.Models /// /// Descriptive name for this signal (e.g., "proxy_407_error") /// - public string Signal { get; set; } + public string Signal { get; set; } = default!; /// /// Source of the signal: "event_type", "event_data", "phase_duration", "event_count", "app_install_duration", "event_correlation" /// - public string Source { get; set; } + public string Source { get; set; } = default!; /// /// Event type to match on. /// For "event_type"/"event_data": the event type to match. /// For "event_correlation": the FIRST event type (Event A). /// - public string EventType { get; set; } + public string EventType { get; set; } = default!; /// /// Data field to match on. @@ -158,19 +158,19 @@ namespace AutopilotMonitor.Shared.Models /// For "event_correlation": optional filter field on Event B (the second event). /// Uses dot notation for nested fields (e.g., "data.errorCode"). /// - public string DataField { get; set; } + public string DataField { get; set; } = default!; /// /// Comparison operator: "equals", "not_equals", "contains", "not_contains", "regex", "not_regex", "gt", "lt", "gte", "lte", "exists", "not_exists", "count_gte" /// For "event_correlation": operator for the Event B filter (applied to DataField). /// - public string Operator { get; set; } + public string Operator { get; set; } = default!; /// /// Value to compare against. /// For "event_correlation": value for the Event B filter. /// - public string Value { get; set; } + public string Value { get; set; } = default!; /// /// Whether this condition must match for the rule to fire @@ -185,13 +185,13 @@ namespace AutopilotMonitor.Shared.Models /// The second event type to correlate with (Event B). /// Example: "app_install_failed" /// - public string CorrelateEventType { get; set; } + public string CorrelateEventType { get; set; } = default!; /// /// The data field to join on — must have the same value in both Event A and Event B. /// Example: "appId" means both events must share the same appId value. /// - public string JoinField { get; set; } + public string JoinField { get; set; } = default!; /// /// Maximum time in seconds between Event A and Event B. Null or 0 means no time limit. @@ -202,17 +202,17 @@ namespace AutopilotMonitor.Shared.Models /// Optional filter field on Event A (the first event). /// Combined with EventAFilterOperator and EventAFilterValue. /// - public string EventAFilterField { get; set; } + public string EventAFilterField { get; set; } = default!; /// /// Operator for the Event A filter. Uses same operators as the main Operator field. /// - public string EventAFilterOperator { get; set; } + public string EventAFilterOperator { get; set; } = default!; /// /// Value for the Event A filter. /// - public string EventAFilterValue { get; set; } + public string EventAFilterValue { get; set; } = default!; } /// @@ -223,12 +223,12 @@ namespace AutopilotMonitor.Shared.Models /// /// Descriptive name for this factor /// - public string Signal { get; set; } + public string Signal { get; set; } = default!; /// /// Condition expression (e.g., "count >= 5", "exists", "duration > 300") /// - public string Condition { get; set; } + public string Condition { get; set; } = default!; /// /// Confidence weight to add when this factor matches (0-100) @@ -245,7 +245,7 @@ namespace AutopilotMonitor.Shared.Models /// /// Title of the remediation approach /// - public string Title { get; set; } + public string Title { get; set; } = default!; /// /// Ordered steps to execute @@ -261,11 +261,11 @@ namespace AutopilotMonitor.Shared.Models /// /// Display title for the link /// - public string Title { get; set; } + public string Title { get; set; } = default!; /// /// URL to the documentation /// - public string Url { get; set; } + public string Url { get; set; } = default!; } } diff --git a/src/Shared/AutopilotMonitor.Shared/Models/Rules/GatherRule.cs b/src/Shared/AutopilotMonitor.Shared/Models/Rules/GatherRule.cs index 87edad1d..83a4a914 100644 --- a/src/Shared/AutopilotMonitor.Shared/Models/Rules/GatherRule.cs +++ b/src/Shared/AutopilotMonitor.Shared/Models/Rules/GatherRule.cs @@ -13,22 +13,22 @@ namespace AutopilotMonitor.Shared.Models /// /// Unique rule identifier (e.g., "GATHER-NET-001") /// - public string RuleId { get; set; } + public string RuleId { get; set; } = default!; /// /// Human-readable rule title (e.g., "Collect WinHTTP Proxy Settings") /// - public string Title { get; set; } + public string Title { get; set; } = default!; /// /// Detailed description of what this rule collects and why /// - public string Description { get; set; } + public string Description { get; set; } = default!; /// /// Rule category: network, identity, apps, device, esp, enrollment /// - public string Category { get; set; } + public string Category { get; set; } = default!; /// /// Semantic version of this rule (e.g., "1.0.0") @@ -72,7 +72,7 @@ namespace AutopilotMonitor.Shared.Models /// for the full list of approved commands. /// - "logparser": Parse a CMTrace-format log file using a regex pattern with named capture groups /// - public string CollectorType { get; set; } + public string CollectorType { get; set; } = default!; /// /// Target for collection: @@ -83,7 +83,7 @@ namespace AutopilotMonitor.Shared.Models /// - command_allowlisted: Exact command string as it appears in the allowlist (e.g., "Get-Tpm", "dsregcmd /status") /// - logparser: Log file path with env vars (e.g., "%ProgramData%\Microsoft\IntuneManagementExtension\Logs\AppWorkload.log") /// - public string Target { get; set; } + public string Target { get; set; } = default!; /// /// Additional parameters for the collector: @@ -101,7 +101,7 @@ namespace AutopilotMonitor.Shared.Models /// /// Trigger type: "startup", "phase_change", "interval", "on_event" /// - public string Trigger { get; set; } + public string Trigger { get; set; } = default!; /// /// Interval in seconds (only used when Trigger = "interval") @@ -112,20 +112,20 @@ namespace AutopilotMonitor.Shared.Models /// Phase to trigger on (only used when Trigger = "phase_change") /// e.g., "Identity", "MdmEnrollment", "AppInstallation" /// - public string TriggerPhase { get; set; } + public string TriggerPhase { get; set; } = default!; /// /// Event type to trigger on (only used when Trigger = "on_event") /// e.g., "app_install_failed" /// - public string TriggerEventType { get; set; } + public string TriggerEventType { get; set; } = default!; // ===== OUTPUT ===== /// /// EventType for the emitted event (e.g., "gather_proxy_settings") /// - public string OutputEventType { get; set; } + public string OutputEventType { get; set; } = default!; /// /// Severity for the emitted event diff --git a/src/Shared/AutopilotMonitor.Shared/Models/Rules/ImeLogPattern.cs b/src/Shared/AutopilotMonitor.Shared/Models/Rules/ImeLogPattern.cs index 6d085697..276559b0 100644 --- a/src/Shared/AutopilotMonitor.Shared/Models/Rules/ImeLogPattern.cs +++ b/src/Shared/AutopilotMonitor.Shared/Models/Rules/ImeLogPattern.cs @@ -12,7 +12,7 @@ namespace AutopilotMonitor.Shared.Models /// /// Unique pattern identifier (e.g., "IME-ESP-PHASE") /// - public string PatternId { get; set; } + public string PatternId { get; set; } = default!; /// /// Pattern category controlling when the pattern is active: @@ -20,14 +20,14 @@ namespace AutopilotMonitor.Shared.Models /// - "currentPhase": Only active during the current ESP phase /// - "otherPhases": Only active during non-current ESP phases (for history/completed apps) /// - public string Category { get; set; } + public string Category { get; set; } = default!; /// /// Regex pattern string to match against IME log message content. /// Supports named capture groups (e.g., (?<id>...)) which are passed to the action handler. /// Uses {GUID} as placeholder for the standard GUID capture pattern. /// - public string Pattern { get; set; } + public string Pattern { get; set; } = default!; /// /// Action to perform when the pattern matches: @@ -48,7 +48,7 @@ namespace AutopilotMonitor.Shared.Models /// - "updateWin32AppState": Update from Win32 app state (uses 'id'/'state' capture groups) /// - "cancelStuckAndSetCurrent": Cancel stuck app and set new current (uses 'id' capture group) /// - public string Action { get; set; } + public string Action { get; set; } = default!; /// /// Optional extra parameters for the action handler. @@ -57,7 +57,7 @@ namespace AutopilotMonitor.Shared.Models /// - { "useCurrentApp": "true" } to use CurrentPackageId instead of captured 'id' /// - { "checkTo": "true" } to check the 'to' capture group value before applying state /// - public Dictionary Parameters { get; set; } + public Dictionary Parameters { get; set; } = default!; /// /// Whether this pattern is enabled. Allows disabling patterns without removing them. @@ -68,7 +68,7 @@ namespace AutopilotMonitor.Shared.Models /// Human-readable description of what this pattern detects and why. /// Not used by the agent — purely for documentation and UI display. /// - public string Description { get; set; } + public string Description { get; set; } = default!; /// /// Whether this is a built-in pattern (shipped with the system). diff --git a/src/Shared/AutopilotMonitor.Shared/Models/Rules/RuleResult.cs b/src/Shared/AutopilotMonitor.Shared/Models/Rules/RuleResult.cs index 85d6cbd9..3c9b88e5 100644 --- a/src/Shared/AutopilotMonitor.Shared/Models/Rules/RuleResult.cs +++ b/src/Shared/AutopilotMonitor.Shared/Models/Rules/RuleResult.cs @@ -17,32 +17,32 @@ namespace AutopilotMonitor.Shared.Models /// /// Session this result belongs to /// - public string SessionId { get; set; } + public string SessionId { get; set; } = default!; /// /// Tenant this result belongs to /// - public string TenantId { get; set; } + public string TenantId { get; set; } = default!; /// /// The rule that produced this result /// - public string RuleId { get; set; } + public string RuleId { get; set; } = default!; /// /// Human-readable title of the rule /// - public string RuleTitle { get; set; } + public string RuleTitle { get; set; } = default!; /// /// Severity level: "info", "warning", "high", "critical" /// - public string Severity { get; set; } + public string Severity { get; set; } = default!; /// /// Rule category: network, identity, enrollment, apps, esp, device /// - public string Category { get; set; } + public string Category { get; set; } = default!; /// /// Confidence score (0-100) @@ -53,7 +53,7 @@ namespace AutopilotMonitor.Shared.Models /// /// Detailed explanation of the detected issue /// - public string Explanation { get; set; } + public string Explanation { get; set; } = default!; /// /// Remediation steps for the detected issue diff --git a/src/Shared/AutopilotMonitor.Shared/Models/SessionApiModels.cs b/src/Shared/AutopilotMonitor.Shared/Models/SessionApiModels.cs index ea492acb..fa8752df 100644 --- a/src/Shared/AutopilotMonitor.Shared/Models/SessionApiModels.cs +++ b/src/Shared/AutopilotMonitor.Shared/Models/SessionApiModels.cs @@ -8,7 +8,7 @@ namespace AutopilotMonitor.Shared.Models /// public class RegisterSessionRequest { - public SessionRegistration Registration { get; set; } + public SessionRegistration Registration { get; set; } = default!; } /// @@ -16,9 +16,9 @@ namespace AutopilotMonitor.Shared.Models /// public class RegisterSessionResponse { - public string SessionId { get; set; } + public string SessionId { get; set; } = default!; public bool Success { get; set; } - public string Message { get; set; } + public string Message { get; set; } = default!; public DateTime RegisteredAt { get; set; } /// @@ -33,8 +33,8 @@ namespace AutopilotMonitor.Shared.Models /// public class IngestEventsRequest { - public string SessionId { get; set; } - public string TenantId { get; set; } + public string SessionId { get; set; } = default!; + public string TenantId { get; set; } = default!; public List Events { get; set; } public bool IsCompressed { get; set; } @@ -52,7 +52,7 @@ namespace AutopilotMonitor.Shared.Models public bool Success { get; set; } public int EventsReceived { get; set; } public int EventsProcessed { get; set; } - public string Message { get; set; } + public string Message { get; set; } = default!; public DateTime ProcessedAt { get; set; } /// @@ -120,9 +120,9 @@ namespace AutopilotMonitor.Shared.Models /// public class GetDiagnosticsUploadUrlRequest { - public string TenantId { get; set; } - public string SessionId { get; set; } - public string FileName { get; set; } + public string TenantId { get; set; } = default!; + public string SessionId { get; set; } = default!; + public string FileName { get; set; } = default!; } /// @@ -141,20 +141,20 @@ namespace AutopilotMonitor.Shared.Models /// public class SessionSummary { - public string SessionId { get; set; } - public string TenantId { get; set; } - public string SerialNumber { get; set; } - public string DeviceName { get; set; } - public string Manufacturer { get; set; } - public string Model { get; set; } + public string SessionId { get; set; } = default!; + public string TenantId { get; set; } = default!; + public string SerialNumber { get; set; } = default!; + public string DeviceName { get; set; } = default!; + public string Manufacturer { get; set; } = default!; + public string Model { get; set; } = default!; public DateTime StartedAt { get; set; } public DateTime? CompletedAt { get; set; } // Serialize as integer (0-7) not string for frontend compatibility public int CurrentPhase { get; set; } - public string CurrentPhaseDetail { get; set; } + public string CurrentPhaseDetail { get; set; } = default!; public SessionStatus Status { get; set; } - public string FailureReason { get; set; } + public string FailureReason { get; set; } = default!; public int EventCount { get; set; } public int? DurationSeconds { get; set; } @@ -168,7 +168,7 @@ namespace AutopilotMonitor.Shared.Models /// Blob name of the uploaded diagnostics archive (null if not uploaded). /// Used to construct a download URL via the tenant's Blob Storage SAS URL. /// - public string DiagnosticsBlobName { get; set; } + public string DiagnosticsBlobName { get; set; } = default!; /// /// Timestamp of the most recently received event for this session. @@ -198,14 +198,14 @@ namespace AutopilotMonitor.Shared.Models public bool IsHybridJoin { get; set; } // Device detail fields — stored in the Sessions table but omitted from earlier versions - public string OsName { get; set; } - public string OsBuild { get; set; } - public string OsDisplayVersion { get; set; } - public string OsEdition { get; set; } - public string OsLanguage { get; set; } + public string OsName { get; set; } = default!; + public string OsBuild { get; set; } = default!; + public string OsDisplayVersion { get; set; } = default!; + public string OsEdition { get; set; } = default!; + public string OsLanguage { get; set; } = default!; public bool IsUserDriven { get; set; } - public string AgentVersion { get; set; } - public string ImeAgentVersion { get; set; } + public string AgentVersion { get; set; } = default!; + public string ImeAgentVersion { get; set; } = default!; // Geographic location fields — populated from device_location event geo data public string GeoCountry { get; set; } = string.Empty;