protected static DataStream GetValidStream() { if (_currentStream != null) { return(_currentStream); } _currentStream = new Pipeline.Admin.Models.DataStream() { Id = "06A0754DB67945E7BAD5614B097C61F5", Key = "mykey", Name = "My Name", StreamType = Core.Models.EntityHeader <DataStreamTypes> .Create(DataStreamTypes.Postgresql), CreationDate = DateTime.Now.ToJSONString(), LastUpdatedDate = DateTime.Now.ToJSONString(), DeviceIdFieldName = "deviceId", TimestampFieldName = "timeStamp", DbValidateSchema = true, AutoCreateSQLTable = true, CreatedBy = EntityHeader.Create("A8A087E53D2043538F32FB18C2CA67F7", "user"), LastUpdatedBy = EntityHeader.Create("A8A087E53D2043538F32FB18C2CA67F7", "user"), }; _currentStream.RedisServerUris = Environment.GetEnvironmentVariable("REDIS_CACHE_URI", EnvironmentVariableTarget.User); _currentStream.RedisPassword = Environment.GetEnvironmentVariable("REDIS_CACHE_PWD", EnvironmentVariableTarget.User); Assert.IsFalse(String.IsNullOrEmpty(_currentStream.RedisServerUris), "Must provide at a minimum one URI for a Redis Server"); Assert.IsFalse(String.IsNullOrEmpty(_currentStream.RedisPassword), "Database must be in an environment variable as [REDIS_CACHE_PWD]"); _currentStream.Fields.Add(new DataStreamField() { FieldName = "int1", IsRequired = true, FieldType = Core.Models.EntityHeader <DeviceAdmin.Models.ParameterTypes> .Create(DeviceAdmin.Models.ParameterTypes.Integer), Name = "int1", Key = "int1" }); _currentStream.Fields.Add(new DataStreamField() { FieldName = "dec1", FieldType = Core.Models.EntityHeader <DeviceAdmin.Models.ParameterTypes> .Create(DeviceAdmin.Models.ParameterTypes.Decimal), Name = "dec1", Key = "dec1" }); _currentStream.Fields.Add(new DataStreamField() { FieldName = "str1", IsRequired = true, FieldType = Core.Models.EntityHeader <DeviceAdmin.Models.ParameterTypes> .Create(DeviceAdmin.Models.ParameterTypes.String), Name = "str1", Key = "str1" }); _logger = new Logging.Loggers.InstanceLogger(new Utils.LogWriter(), "HOSTID", "1234", "INSTID"); return(_currentStream); }
public async Task <X509Certificate2> GetCertificate(IInstanceLogger instanceLogger, string domainName) { if (instanceLogger == null) { throw new ArgumentNullException(nameof(instanceLogger)); } AcmeCertificateManager._instanceLogger = instanceLogger; this._storage.Init(this._settings, instanceLogger); AcmeCertificateManager._instanceLogger.AddCustomEvent(Core.PlatformSupport.LogLevel.Verbose, $"{Tag}_GetCertificate", $"Certificate Requested for {domainName}"); var pfx = await _storage.GetCertAsync(domainName); if (pfx != null) { AcmeCertificateManager._instanceLogger.AddCustomEvent(Core.PlatformSupport.LogLevel.Verbose, $"{Tag}_GetCertificate", $"Certificate found in storage for {domainName}"); var cert = new X509Certificate2(pfx, _settings.PfxPassword); AcmeCertificateManager._instanceLogger.AddCustomEvent(Core.PlatformSupport.LogLevel.Verbose, $"{Tag}_GetCertificate", $"Certificate has expire date of {cert.NotAfter}"); if (cert.NotAfter - DateTime.UtcNow > _settings.RenewalPeriod) { AcmeCertificateManager._instanceLogger.AddCustomEvent(Core.PlatformSupport.LogLevel.Verbose, $"{Tag}_GetCertificate", $"Certificate is valid, returning cert"); return(cert); } else { AcmeCertificateManager._instanceLogger.AddCustomEvent(Core.PlatformSupport.LogLevel.Verbose, $"{Tag}_GetCertificate", $"Certificate is will expire, will request new cert"); } } else { AcmeCertificateManager._instanceLogger.AddCustomEvent(Core.PlatformSupport.LogLevel.Verbose, $"{Tag}_GetCertificate", $"Did not find certificate in storage for: {domainName}"); } AcmeCertificateManager._instanceLogger.AddCustomEvent(Core.PlatformSupport.LogLevel.Verbose, $"{Tag}_GetCertificate", $"Requesting new certificate for {domainName}"); pfx = await RequestNewCertificateV2(domainName); if (pfx != null) { AcmeCertificateManager._instanceLogger.AddCustomEvent(Core.PlatformSupport.LogLevel.Verbose, $"{Tag}_GetCertificate", $"Obtained certificate for {domainName}"); AcmeCertificateManager._instanceLogger.AddCustomEvent(Core.PlatformSupport.LogLevel.Verbose, $"{Tag}_GetCertificate", $"Storing certificate for {domainName}"); await _storage.StoreCertAsync(domainName, pfx); AcmeCertificateManager._instanceLogger.AddCustomEvent(Core.PlatformSupport.LogLevel.Verbose, $"{Tag}_GetCertificate", $"Stored certificate will create X509 and return {domainName}"); return(new X509Certificate2(pfx, _settings.PfxPassword)); } else { AcmeCertificateManager._instanceLogger.AddError($"{Tag}_GetCertificate", $"Response from certificate is null for {domainName}, did not get certificate."); return(null); } }
public AzureEventHubConnector(IInstanceLogger instanceLogger) { _instanceLogger = instanceLogger; }
public AzureTableStorageConnector(IInstanceLogger logger) { _instanceLogger = logger; }
public AWSS3Connector(IInstanceLogger instanceLogger) { _logger = instanceLogger; }
public AWSElasticSearchConnector(IInstanceLogger instanceLogger) { _instanceLogger = instanceLogger; }
private static DataStream GetValidStream() { if (_currentStream != null) { return(_currentStream); } _currentStream = new Pipeline.Admin.Models.DataStream() { Id = "06A0754DB67945E7BAD5614B097C61F5", Key = "mykey", Name = "My Name", StreamType = Core.Models.EntityHeader <DataStreamTypes> .Create(DataStreamTypes.Postgresql), CreationDate = DateTime.Now.ToJSONString(), LastUpdatedDate = DateTime.Now.ToJSONString(), DeviceIdFieldName = "deviceId", TimestampFieldName = "timeStamp", DbValidateSchema = true, AutoCreateSQLTable = true, CreatedBy = EntityHeader.Create("A8A087E53D2043538F32FB18C2CA67F7", "user"), LastUpdatedBy = EntityHeader.Create("A8A087E53D2043538F32FB18C2CA67F7", "user"), DbURL = System.Environment.GetEnvironmentVariable("PS_DB_URL"), DbUserName = System.Environment.GetEnvironmentVariable("PS_DB_USER_NAME"), DbPassword = System.Environment.GetEnvironmentVariable("PS_DB_PASSWORD"), DbName = "testing", DbSchema = "public", DbTableName = "information", CreateTableDDL = @" CREATE EXTENSION if not exists postgis; CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE; CREATE TABLE if not exists public.information ( id SERIAL, deviceId text not null, timeStamp timestamp not null, int1 integer NULL, datetime1 timestamp NULL, int2 integer NULL, dec1 float4 NULL, str1 text NULL, local1 GEOGRAPHY NULL, pointindex1 integer NULL ); SELECT create_hypertable('information','timestamp');" }; Assert.IsFalse(String.IsNullOrEmpty(_currentStream.DbURL), "Database Url must be provided as an Environment Variable in [PS_DB_URL]"); Assert.IsFalse(String.IsNullOrEmpty(_currentStream.DbName), "Database Name must be provided as an Environment Variable in [PS_DB_NAME]"); Assert.IsFalse(String.IsNullOrEmpty(_currentStream.DbUserName), "Database User Name must be provided as an Environment Variable in [PS_DB_USER_NAME]"); Assert.IsFalse(String.IsNullOrEmpty(_currentStream.DbPassword), "Data base password must be provided as an Environment Variable in [PS_DB_PASSWORD]"); _currentStream.Fields.Add(new DataStreamField() { FieldName = "int1", IsRequired = true, FieldType = Core.Models.EntityHeader <DeviceAdmin.Models.ParameterTypes> .Create(DeviceAdmin.Models.ParameterTypes.Integer), Name = "int1", Key = "int1" }); _currentStream.Fields.Add(new DataStreamField() { FieldName = "datetime1", IsRequired = true, FieldType = Core.Models.EntityHeader <DeviceAdmin.Models.ParameterTypes> .Create(DeviceAdmin.Models.ParameterTypes.DateTime), Name = "datetime1", Key = "datetime1" }); _currentStream.Fields.Add(new DataStreamField() { FieldName = "int2", FieldType = Core.Models.EntityHeader <DeviceAdmin.Models.ParameterTypes> .Create(DeviceAdmin.Models.ParameterTypes.Integer), Name = "int2", Key = "int2" }); _currentStream.Fields.Add(new DataStreamField() { FieldName = "dec1", FieldType = Core.Models.EntityHeader <DeviceAdmin.Models.ParameterTypes> .Create(DeviceAdmin.Models.ParameterTypes.Decimal), Name = "dec1", Key = "dec1" }); _currentStream.Fields.Add(new DataStreamField() { FieldName = "str1", IsRequired = true, FieldType = Core.Models.EntityHeader <DeviceAdmin.Models.ParameterTypes> .Create(DeviceAdmin.Models.ParameterTypes.String), Name = "str1", Key = "str1" }); _currentStream.Fields.Add(new DataStreamField() { FieldName = "local1", FieldType = Core.Models.EntityHeader <DeviceAdmin.Models.ParameterTypes> .Create(DeviceAdmin.Models.ParameterTypes.GeoLocation), Name = "local1", Key = "local1" }); _currentStream.Fields.Add(new DataStreamField() { FieldName = "pointindex1", FieldType = Core.Models.EntityHeader <DeviceAdmin.Models.ParameterTypes> .Create(DeviceAdmin.Models.ParameterTypes.Integer), Name = "pointindex1", IsRequired = true, Key = "pointindex1" }); _logger = new Logging.Loggers.InstanceLogger(new Utils.LogWriter(), "HOSTID", "1234", "INSTID"); return(_currentStream); }
public DeviceMediaRepo(IInstanceLogger instanceLogger) { _logger = instanceLogger; }
public AzureBlobConnector(IInstanceLogger instanceLogger) { _instanceLogger = instanceLogger; }
public void Init(IAcmeSettings settings, IInstanceLogger instanceLogger) { _settings = settings; _instanceLogger = instanceLogger; }
public PointArrayPostgresqlConnector(IInstanceLogger instanceLogger) : base(instanceLogger) { }