Example #1
0
 public LocalDataStoreContextTest()
 {
     this.localDataStoreContext = new LocalDataStoreContext(
         Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
         ConfigurationManager.AppSettings["AzureIpRangeFileList"],
         ConfigurationManager.AppSettings["AwsIpRangeFile"],
         ConfigurationManager.AppSettings["AliCloudIpRangeFile"]);
 }
Example #2
0
 public ApiController(IHostingEnvironment hostingEnvironment, IOptions <AppSettings> appSettings)
 {
     this.hostingEnvironment    = hostingEnvironment;
     this.appSettings           = appSettings;
     this.localDataStoreContext = new LocalDataStoreContext(hostingEnvironment.ContentRootPath,
                                                            appSettings.Value.AzureIpRangeFileList, appSettings.Value.AwsIpRangeFile,
                                                            appSettings.Value.AliCloudIpRangeFile);
 }
Example #3
0
        public async Task InitializeAsync()
        {
            var builder = new ConfigurationBuilder()
                          .SetBasePath(Directory.GetCurrentDirectory())
                          .AddJsonFile("appsettings.json");

            IConfiguration configuration = builder.Build();
            var            appSettings   = new AppSettings();

            configuration.GetSection("AppSettings").Bind(appSettings);

            var localDataStoreContext = new LocalDataStoreContext(
                Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
                appSettings.AzureIpRangeFileList,
                appSettings.AwsIpRangeFile,
                appSettings.AliCloudIpRangeFile);

            foreach (var account in localDataStoreContext.StorageAccounts.ToList())
            {
                if (account.Name != "astuaenorth")
                {
                    continue;
                }

                var storageContext = new StorageContext(account);

                Console.WriteLine($"[{account.Name}] Starting configure storage account");

                await storageContext.EnableLoggingAsync();

                Console.WriteLine($"[{account.Name}] Enable logging completed successfully");

                await storageContext.EnableCORSAsync();

                Console.WriteLine($"[{account.Name}] Successfully enabled CORS");

                await storageContext.CreatePublicContainerAsync();

                Console.WriteLine($"[{account.Name}] Successfully created public container");

                await storageContext.CreatePrivateContainerAsync(AzureSpeedConstants.PrivateContainerName);

                Console.WriteLine($"[{account.Name}] Successfully created private container");

                await storageContext.CreatePrivateContainerAsync(AzureSpeedConstants.UploadContainerName);

                Console.WriteLine($"[{account.Name}] Successfully created upload container");

                await storageContext.Upload100MBBlobAsync();

                Console.WriteLine($"[{account.Name}] Successfully uploaded 100MB.bin blob");

                Console.WriteLine($"[{account.Name}] Successfully initialized storage account");
            }

            Console.WriteLine("Successfully completed all storage accounts configuration");
        }
 public ApiController(
     IAzureIPInfoProvider azureIPInfoProvider,
     ILogger <ApiController> logger,
     IWebHostEnvironment webHostEnvironment)
 {
     this.azureIPInfoProvider = azureIPInfoProvider;
     this.logger = logger;
     this.localDataStoreContext = new LocalDataStoreContext(webHostEnvironment.ContentRootPath);
 }
Example #5
0
 public LegacyApiController(
     IFileProvider fileProvider,
     ILogger <LegacyApiController> logger,
     IWebHostEnvironment webHostEnvironment)
 {
     this.fileProvider          = fileProvider;
     this.logger                = logger;
     this.localDataStoreContext = new LocalDataStoreContext(webHostEnvironment.ContentRootPath);
 }
Example #6
0
        public async Task InitializeAsync()
        {
            var builder = new ConfigurationBuilder()
                          .SetBasePath(Directory.GetCurrentDirectory())
                          .AddJsonFile("appsettings.json");

            IConfiguration configuration = builder.Build();
            var            appSettings   = new AppSettings();

            configuration.GetSection("AppSettings").Bind(appSettings);

            var localDataStoreContext = new LocalDataStoreContext(
                Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
                appSettings.AzureIpRangeFileList,
                appSettings.AwsIpRangeFile,
                appSettings.AliCloudIpRangeFile);

            foreach (var account in localDataStoreContext.StorageAccounts.ToList())
            {
                if (account.Name != "azspdeastasia")
                {
                    continue;
                }

                var storageContext = new StorageContext(account);

                Console.WriteLine($"[{account.Name}] About to initialize stroage account ");

                await storageContext.EnableLoggingAsync();

                Console.WriteLine($"[{account.Name}] Enable logging completed succesfully");

                await storageContext.EnableCORSAsync();

                Console.WriteLine($"[{account.Name}] Enable CORS completed");

                await storageContext.CreatePublicContainerAsync();

                Console.WriteLine($"[{account.Name}] Create public container completed");

                await storageContext.CreatePrivateContainerAsync();

                Console.WriteLine($"[{account.Name}] Create private container completed");

                await storageContext.Upload100MBBlobAsync();

                Console.WriteLine($"[{account.Name}] Upload 100MB.bin blob completed");

                Console.WriteLine($"[{account.Name}] Storage account is initilized successfully");
            }

            Console.WriteLine("All storage accounts are initialized successfully");
        }
Example #7
0
        public LocalDataStoreContextTest()
        {
            var builder = new ConfigurationBuilder()
                          .SetBasePath(Directory.GetCurrentDirectory())
                          .AddJsonFile("appsettings.json");

            IConfiguration configuration = builder.Build();
            var            appSettings   = new AppSettings();

            configuration.GetSection("AppSettings").Bind(appSettings);

            this.localDataStoreContext = new LocalDataStoreContext(
                Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
                appSettings.AzureIpRangeFileList,
                appSettings.AwsIpRangeFile,
                appSettings.AliCloudIpRangeFile);
        }
Example #8
0
        public async Task InitializeAsync()
        {
            var localDataStoreContext = new LocalDataStoreContext(
                Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
                ConfigurationManager.AppSettings["AzureIpRangeFileList"],
                ConfigurationManager.AppSettings["AwsIpRangeFile"],
                ConfigurationManager.AppSettings["AliCloudIpRangeFile"]);

            foreach (var account in localDataStoreContext.StorageAccounts.ToList())
            {
                if (account.Name != "azspdwestus2")
                {
                    continue;
                }

                var storageContext = new StorageContext(account);

                Console.WriteLine($"[{account.Name}] About to initialize stroage account ");

                await storageContext.EnableLoggingAsync();

                Console.WriteLine($"[{account.Name}] Enable logging completed succesfully");

                await storageContext.EnableCORSAsync();

                Console.WriteLine($"[{account.Name}] Enable CORS completed");

                await storageContext.CreatePublicContainerAsync();

                Console.WriteLine($"[{account.Name}] Create public container completed");

                await storageContext.CreatePrivateContainerAsync();

                Console.WriteLine($"[{account.Name}] Create private container completed");

                await storageContext.Upload100MBBlobAsync();

                Console.WriteLine($"[{account.Name}] Upload 100MB.bin blob completed");

                Console.WriteLine($"[{account.Name}] Storage account is initilized successfully");
            }

            Console.WriteLine("All storage accounts are initialized successfully");
        }
Example #9
0
        public async Task InitializeAsync()
        {
            var localDataStoreContext = new LocalDataStoreContext(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));

            foreach (var account in localDataStoreContext.StorageAccounts.ToList())
            {
                if (account.Name != "astnorwayeast")
                {
                    continue;
                }

                var storageContext = new StorageContext(account);

                Console.WriteLine($"[{account.Name}] Starting configure storage account");

                await storageContext.EnableLoggingAsync();

                Console.WriteLine($"[{account.Name}] Enable logging completed successfully");

                await storageContext.EnableCORSAsync();

                Console.WriteLine($"[{account.Name}] Successfully enabled CORS");

                await storageContext.CreatePublicContainerAsync();

                Console.WriteLine($"[{account.Name}] Successfully created public container");

                await storageContext.CreatePrivateContainerAsync(AzureSpeedConstants.PrivateContainerName);

                Console.WriteLine($"[{account.Name}] Successfully created private container");

                await storageContext.CreatePrivateContainerAsync(AzureSpeedConstants.UploadContainerName);

                Console.WriteLine($"[{account.Name}] Successfully created upload container");

                await storageContext.Upload100MBBlobAsync();

                Console.WriteLine($"[{account.Name}] Successfully uploaded 100MB.bin blob");

                Console.WriteLine($"[{account.Name}] Successfully initialized storage account");
            }

            Console.WriteLine("Successfully completed all storage accounts configuration");
        }
 public LocalDataStoreContextTest()
 {
     this.localDataStoreContext = new LocalDataStoreContext(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
 }