private TenantStatus GetTenantStatus(Tenant tenant)
        {
            WebApiOptions session = new WebApiOptions(tenant.WebApiUrl);

            // no authorization necessary for getting tenant status...

            var agent = new ApiAgent(session);

            return(agent.GetTenantStatusAsync(tenant.ContextIdentifier, tenant.Environment.Current).Result);
        }
        private async Task <StringDictionary> GetSystemInfo(Tenant tenant)
        {
            WebApiOptions session = new WebApiOptions(tenant.WebApiUrl);

            // no authorization necessary for getting system info...

            var agent = new ApiAgent(session);

            return(await agent.GetApiVersionAsync());
        }
Example #3
0
        public void ImportAll()
        {
            var description = typeof(T).Name;

            Parallel.ForEach(Season.Seasons, (season) =>
            {
                var watch = Stopwatch.StartNew();

                Logger.Info(string.Format("Start {0} {1}", description, season.Name));
                var agent = new ApiAgent <T>(_urlPattern);

                for (var i = season.StartGame; i < season.LastGame; i++)
                {
                    try
                    {
                        var fileName = string.Format(_fileNamePattern, season.Id, i);

                        if (!_downloadIfExists && File.Exists(fileName))
                        {
                            continue;
                        }

                        var model = agent.GetModel(i);

                        if (model.Id < 1)
                        {
                            continue;
                        }

                        JsonToFileSerializer <T> .WriteToFile(model, fileName);
                        Logger.Debug(string.Format("Imported game {0} to {1}", i, fileName));
                    }
                    catch (Exception ex)
                    {
                        Logger.Error(string.Format("Error importing game {0} in season {1}", i, season.Name), ex);
                    }
                }

                Logger.Info(string.Format("[Success] Finished {0} {1} in {2}", description, season.Name, watch.Elapsed.ToString()));
            });
        }
Example #4
0
 public Docktor(Configuration config)
 {
     this._config = config;
     _agent       = new ApiAgent(_config.ConfigurationData.DockerSettings);
     _dbConnector = new DbConnector(_config.ConfigurationData.InfluxDbSettings);
 }