Ejemplo n.º 1
0
        private void LogConfigurationError <T>(EtlConfiguration <T> config, List <string> errors) where T : ConnectionString
        {
            var errorMessage = $"Invalid ETL configuration for '{config.Name}'{(config.Connection != null ? $" ({config.GetDestination()})" : string.Empty)}. " +
                               $"Reason{(errors.Count > 1 ? "s" : string.Empty)}: {string.Join(";", errors)}.";

            if (Logger.IsInfoEnabled)
            {
                Logger.Info(errorMessage);
            }

            var alert = AlertRaised.Create(_database.Name, AlertTitle, errorMessage, AlertType.Etl_Error, NotificationSeverity.Error);

            _database.NotificationCenter.Add(alert);
        }
Ejemplo n.º 2
0
        private void LogConfigurationWarning <T>(EtlConfiguration <T> config, List <string> warnings) where T : ConnectionString
        {
            var warnMessage = $"Warning about ETL configuration for '{config.Name}'{(config.Connection != null ? $" ({config.GetDestination()})" : string.Empty)}. " +
                              $"Reason{(warnings.Count > 1 ? "s" : string.Empty)}: {string.Join(";", warnings)}.";

            if (Logger.IsInfoEnabled)
            {
                Logger.Info(warnMessage);
            }

            var alert = AlertRaised.Create(_database.Name, AlertTitle, warnMessage, AlertType.Etl_Warning, NotificationSeverity.Warning);

            _database.NotificationCenter.Add(alert);
        }
Ejemplo n.º 3
0
        private bool ValidateConfiguration <T>(EtlConfiguration <T> config, HashSet <string> uniqueNames) where T : ConnectionString
        {
            if (config.Validate(out List <string> errors) == false)
            {
                LogConfigurationError(config, errors);
                return(false);
            }

            if (_databaseRecord.Encrypted && config.UsingEncryptedCommunicationChannel() == false && config.AllowEtlOnNonEncryptedChannel == false)
            {
                LogConfigurationError(config,
                                      new List <string>
                {
                    $"{_database.Name} is encrypted, but connection to ETL destination {config.GetDestination()} does not use encryption, so ETL is not allowed. " +
                    $"You can change this behavior by setting {nameof(config.AllowEtlOnNonEncryptedChannel)} when creating the ETL configuration"
                });
                return(false);
            }

            if (_databaseRecord.Encrypted && config.UsingEncryptedCommunicationChannel() == false && config.AllowEtlOnNonEncryptedChannel)
            {
                LogConfigurationWarning(config,
                                        new List <string>
                {
                    $"{_database.Name} is encrypted and connection to ETL destination {config.GetDestination()} does not use encryption, " +
                    $"but {nameof(config.AllowEtlOnNonEncryptedChannel)} is set to true, so ETL is allowed"
                });
                return(true);
            }

            if (uniqueNames.Add(config.Name) == false)
            {
                LogConfigurationError(config,
                                      new List <string>
                {
                    $"ETL with name '{config.Name}' is already defined"
                });
                return(false);
            }

            return(true);
        }