Example #1
0
 public HealthCheckSettings(Dictionary <string, string> config)
 {
     Status = config == null || !config.ContainsKey(STATUS)
                    ? HealthCheckStatus.Undefined
                    : (BoolKey(config, STATUS) ? HealthCheckStatus.Enabled : HealthCheckStatus.Disabled);
     IntervalInDays = IntKey(config, INTERVAL_IN_DAYS, DEFAULT_INTERVAL_IN_DAYS);
     if (!Enum.TryParse(Get(config, DAY_OF_WEEK), out DayOfWeek))
     {
         DayOfWeek = (DayOfWeek)GetDefaultDay();
     }
     TimeOfDay                    = IntKey(config, TIME_OF_DAY, GetDefaultTime());
     RetryInterval                = IntKey(config, RETRY_INTERVAL, DEFAULT_RETRY_INTERVAL);
     UploadTokenSecretUuid        = Get(config, UPLOAD_TOKEN_SECRET);
     DiagnosticTokenSecretUuid    = Get(config, DIAGNOSTIC_TOKEN_SECRET);
     NewUploadRequest             = Get(config, NEW_UPLOAD_REQUEST);
     UserNameSecretUuid           = Get(config, UPLOAD_CREDENTIAL_USER_SECRET);
     PasswordSecretUuid           = Get(config, UPLOAD_CREDENTIAL_PASSWORD_SECRET);
     LastSuccessfulUpload         = Get(config, LAST_SUCCESSFUL_UPLOAD);
     LastFailedUpload             = Get(config, LAST_FAILED_UPLOAD);
     UploadUuid                   = Get(config, UPLOAD_UUID);
     ReportAnalysisSeverity       = StringToDiagnosticAlertSeverity(Get(config, REPORT_ANALYSIS_SEVERITY));
     ReportAnalysisIssuesDetected = IntKey(config, REPORT_ANALYSIS_ISSUES_DETECTED, 0);
     ReportAnalysisUploadUuid     = Get(config, REPORT_ANALYSIS_UPLOAD_UUID);
     ReportAnalysisUploadTime     = Get(config, REPORT_ANALYSIS_UPLOAD_TIME);
 }
        internal static string DiagnosticAlertSeverityToString(DiagnosticAlertSeverity severity)
        {
            switch (severity)
            {
            case DiagnosticAlertSeverity.Error:
                return("Error");

            case DiagnosticAlertSeverity.Warning:
                return("Warning");

            default:
                return("Info");
            }
        }