public AWSAutoBooksAPIStub(AutoBookSettings autoBookSettings, IAutoBookRepository autoBookRepository, IAutoBookInstanceConfigurationRepository autoBookInstanceConfigurationRepository) { _autoBookSettings = autoBookSettings; _autoBookRepository = autoBookRepository; _autoBookInstanceConfigurationRepository = autoBookInstanceConfigurationRepository; CreateInitialAutoBookCollection(); }
public void AddOrUpdate(AutoBookSettings autoBookSettings) { var currentEntity = GetEntity(); if (currentEntity == null) { currentEntity = _mapper.Map <Entities.Tenant.AutoBookApi.AutoBookSettings>(autoBookSettings); _dbContext.Add(currentEntity, post => post.MapTo(autoBookSettings), _mapper); } else { _mapper.Map(autoBookSettings, currentEntity); _dbContext.Update(currentEntity, post => post.MapTo(autoBookSettings), _mapper); } _cachedAutoBookSettings = currentEntity; }
/// <summary> /// Returns default AutoBookSettings for the system. /// Auto-provisioning is disabled so that the setting can be reviewed before we turn it on. /// </summary> /// <returns></returns> public static AutoBookSettings GetDefaultAutoBookSettings() { AutoBookSettings autoBookSettings = new AutoBookSettings() { AutoProvisioning = false, // Disabled so that we don't start re-provisioning with the version below MinInstances = 0, // We only want instances when we need them, reduces costs MaxInstances = 5, SystemMaxInstances = 10, // Low limit to start with CreationTimeout = Duration.FromMinutes(15), // Takes about 5 mins usually MinLifetime = Duration.FromMinutes(65), // At least 1 hr MaxLifetime = Duration.FromMilliseconds(0), // No need to recycle ProvisioningAPIURL = "http://xg-autobook-provider-api-dev.eu-west-2.elasticbeanstalk.com", // Same API for all systems ApplicationVersion = null, // "v1.53.0-dev" BinariesVersion = null, Locked = false }; return(autoBookSettings); }
public void AddOrUpdate(AutoBookSettings autoBookSettings) { lock (_session) { var currentSettings = Get(); if (autoBookSettings == currentSettings) { return; } if (currentSettings != null) { _mapper.Map(autoBookSettings, currentSettings); _session.Store(currentSettings); } else { _session.Store(autoBookSettings); } } }
public AWSAutoBookAPI(AutoBook autoBook, AutoBookSettings autoBookSettings, string accessToken) { _autoBook = autoBook; _autoBookSettings = autoBookSettings; _accessToken = accessToken; }
public TestEnvironmentAWSAutoBooks(IRepositoryFactory repositoryFactory, IAutoBookRepository autoBookRepository, IAutoBookInstanceConfigurationRepository autoBookInstanceConfigurationRepository, IAWSInstanceConfigurationRepository awsInstanceConfigurationRepository, IAuditEventRepository auditEventRepository, AutoBookSettings autoBooksSettings, IAutoBooksAPI <AWSPAAutoBook, AWSPACreateAutoBook> autoBooksApi, IAutoBooksTestHandler autoBookTestHandler) : base( repositoryFactory, autoBookRepository, autoBookInstanceConfigurationRepository, awsInstanceConfigurationRepository, auditEventRepository, autoBooksSettings, autoBooksApi, null) { _autoBookTestHandler = autoBookTestHandler; }