private void Init() { var ddb = new AmazonDynamoDBClient(); _config = new GeoDataManagerConfiguration(ddb, _tableName); _geoDataManager = new GeoDataManager(_config); }
public SiteAdminController( SiteManager siteManager, GeoDataManager geoDataManager, IOptions <MultiTenantOptions> multiTenantOptions, IOptions <UIOptions> uiOptionsAccessor, IOptions <LayoutSelectorOptions> layoutSeletorOptionsAccessor, ILayoutFileListBuilder layoutListBuilder //ConfigHelper configuration //, ITriggerStartup startupTrigger ) { //if (siteResolver == null) { throw new ArgumentNullException(nameof(siteResolver)); } if (geoDataManager == null) { throw new ArgumentNullException(nameof(geoDataManager)); } //if (configuration == null) { throw new ArgumentNullException(nameof(configuration)); } //config = configuration; this.multiTenantOptions = multiTenantOptions.Value; //Site = siteResolver.Resolve(); this.siteManager = siteManager; this.geoDataManager = geoDataManager; uiOptions = uiOptionsAccessor.Value; this.layoutListBuilder = layoutListBuilder; layoutOptions = layoutSeletorOptionsAccessor.Value; //startup = startupTrigger; }
public SiteAdminController( SiteManager siteManager, GeoDataManager geoDataManager, IOptions <MultiTenantOptions> multiTenantOptions, IOptions <UIOptions> uiOptionsAccessor //ConfigHelper configuration //, ITriggerStartup startupTrigger ) { //if (siteResolver == null) { throw new ArgumentNullException(nameof(siteResolver)); } if (geoDataManager == null) { throw new ArgumentNullException(nameof(geoDataManager)); } //if (configuration == null) { throw new ArgumentNullException(nameof(configuration)); } //config = configuration; this.multiTenantOptions = multiTenantOptions.Options; //Site = siteResolver.Resolve(); this.siteManager = siteManager; this.geoDataManager = geoDataManager; uiOptions = uiOptionsAccessor.Options; //startup = startupTrigger; }
private void SetupGeoDataManager() { var accessKey = ConfigurationManager.AppSettings["AWS_ACCESS_KEY_ID"]; var secretKey = ConfigurationManager.AppSettings["AWS_SECRET_KEY"]; var tableName = ConfigurationManager.AppSettings["PARAM1"]; var regionName = ConfigurationManager.AppSettings["PARAM2"]; var region = RegionEndpoint.GetBySystemName(regionName); var config = new AmazonDynamoDBConfig { MaxErrorRetry = 20, RegionEndpoint = region }; var creds = new BasicAWSCredentials(accessKey, secretKey); bool useLocalDb; bool.TryParse(ConfigurationManager.AppSettings["AWS_USE_LOCAL_DB"], out useLocalDb); if (useLocalDb) { var localDB = ConfigurationManager.AppSettings["AWS_LOCAL_DYNAMO_DB_ENDPOINT"]; config.ServiceURL = localDB; } var ddb = new AmazonDynamoDBClient(creds, config); _config = new GeoDataManagerConfiguration(ddb, tableName); _geoDataManager = new GeoDataManager(_config); }
public CoreDataController( SiteSettings currentSite, GeoDataManager geoDataManager, IOptions <UIOptions> uiOptionsAccessor ) { Site = currentSite; dataManager = geoDataManager; uiOptions = uiOptionsAccessor.Value; }
public CoreDataController( ISiteResolver siteResolver, GeoDataManager geoDataManager, IOptions <UIOptions> uiOptionsAccessor ) { Site = siteResolver.Resolve(); dataManager = geoDataManager; uiOptions = uiOptionsAccessor.Value; }
public CoreDataController( SiteContext currentSite, GeoDataManager geoDataManager, IStringLocalizer <CloudscribeCore> localizer, IOptions <UIOptions> uiOptionsAccessor ) { Site = currentSite; dataManager = geoDataManager; uiOptions = uiOptionsAccessor.Value; sr = localizer; }
public async Task <string> FunctionHandler(ResponseSourse json, ILambdaContext context) { context.Logger.LogLine($"Beginning to process {context.FunctionName} records..."); var photoJsonData = json; //return ""; context.Logger.LogLine($"Create context {context.FunctionName}..."); var config = new GeoDataManagerConfiguration(new AmazonDynamoDBClient(), _tableName); var ddb = new AmazonDynamoDBClient(); _config = new GeoDataManagerConfiguration(ddb, _tableName); _geoDataManager = new GeoDataManager(_config); var items = photoJsonData.response.items.ToList(); for (int i = 0; i < items.Count; i++) { var item = items.ElementAt(i); var imgUrl = item.sizes.FirstOrDefault(x => x.type == "p")?.url; var imgUrlLarge = item.sizes.FirstOrDefault(x => x.type == "w")?.url; if (String.IsNullOrEmpty(imgUrl) || String.IsNullOrEmpty(imgUrlLarge)) { continue; } var guid = Guid.NewGuid(); var latitude = item.lat; var longitude = item.@long; var point = new GeoPoint(latitude, longitude); var rangeKeyVal = new AttributeValue { S = guid.ToString() }; var imgUrlVal = new AttributeValue { S = imgUrl }; var imgUrlLargeVal = new AttributeValue { S = imgUrlLarge }; var req = new PutPointRequest(point, rangeKeyVal); req.PutItemRequest.Item["imgUrl"] = imgUrlVal; req.PutItemRequest.Item["imgUrlLarge"] = imgUrlLargeVal; await _geoDataManager.PutPointAsync(req); } context.Logger.LogLine("Stream processing complete."); return(true.ToString()); }
private async Task CreateTable() { var config = new GeoDataManagerConfiguration(new AmazonDynamoDBClient(), _tableName); try { var ctr = GeoTableUtil.GetCreateTableRequest(config); var ddb = new AmazonDynamoDBClient(); _config = new GeoDataManagerConfiguration(ddb, _tableName); _geoDataManager = new GeoDataManager(_config); await config.DynamoDBClient.CreateTableAsync(ctr); await InsertData(); } catch (Exception) { throw; } }
public void SetupGeoDataManager() { var accessKey = "test"; // ConfigurationManager.AppSettings["AWS_ACCESS_KEY_ID"]; var secretKey = "test"; // ConfigurationManager.AppSettings["AWS_SECRET_KEY"]; var tableName = "Practices"; // ConfigurationManager.AppSettings["PARAM1"]; var regionName = "us-east-1"; // ConfigurationManager.AppSettings["PARAM2"]; var region = RegionEndpoint.GetBySystemName(regionName); var localDB = "http://localhost:8000"; var config = new AmazonDynamoDBConfig { MaxErrorRetry = 20 , RegionEndpoint = region , ServiceURL = localDB , AuthenticationRegion = regionName }; _creds = new BasicAWSCredentials(accessKey, secretKey); _ddb = new AmazonDynamoDBClient(_creds, config); _config = new GeoDataManagerConfiguration(_ddb, tableName); _geoDataManager = new GeoDataManager(_config); }