Example #1
0
        public TagIdGroupBolt()
        {
            Microsoft.WindowsAzure.Storage.CloudStorageAccount storageAccount = GetStorageAccount();

            // Create the table client.
            Microsoft.WindowsAzure.Storage.Table.CloudTableClient tableClient = storageAccount.CreateCloudTableClient();

            this.table = tableClient.GetTableReference("tagId");

            this.table.CreateIfNotExists();
        }
        public ReportGroupCompletnessBolt()
        {
            Microsoft.WindowsAzure.Storage.CloudStorageAccount storageAccount = GetStorageAccount();

            // Create the table client.
            Microsoft.WindowsAzure.Storage.Table.CloudTableClient tableClient = storageAccount.CreateCloudTableClient();

            this.table = tableClient.GetTableReference("reportCompletness");

            this.table.CreateIfNotExists();
        }
Example #3
0
        public WordCountBolt()
        {
            name = (new Random(DateTime.Now.Millisecond)).Next();

            Microsoft.WindowsAzure.Storage.CloudStorageAccount storageAccount = GetStorageAccount();

            // Create the table client.
            Microsoft.WindowsAzure.Storage.Table.CloudTableClient tableClient = storageAccount.CreateCloudTableClient();

            this.table = tableClient.GetTableReference("wordcount");

            this.table.CreateIfNotExists();
        }
Example #4
0
        public static CloudTable GetTable(string name)
        {
            Microsoft.WindowsAzure.Storage.CloudStorageAccount storageAccount = GetStorageAccount();

            // Create the table client.
            CloudTableClient tableClient = storageAccount.CreateCloudTableClient();

            CloudTable table = tableClient.GetTableReference(name);

            table.CreateIfNotExists();

            return(table);
        }
Example #5
0
        /// <summary>
        /// Sets the connection to Azure
        /// Creates the table if it does not exist
        /// </summary>
        public BaseDataServiceContext()
        {
            storageCredentials = new Microsoft.WindowsAzure.Storage.Auth.StorageCredentials(
                Sample.Azure.Common.Setting.SettingService.CloudStorageAccountName,
                Sample.Azure.Common.Setting.SettingService.CloudStorageKey);

            storageAccount = new Microsoft.WindowsAzure.Storage.CloudStorageAccount(storageCredentials,
                                                                                    new Uri(Sample.Azure.Common.Setting.SettingService.CloudStorageBlobEndPoint),
                                                                                    new Uri(Sample.Azure.Common.Setting.SettingService.CloudStorageQueueEndPoint),
                                                                                    new Uri(Sample.Azure.Common.Setting.SettingService.CloudStorageTableEndPoint),
                                                                                    new Uri(Sample.Azure.Common.Setting.SettingService.CloudStorageFileEndPoint));

            tableClient = storageAccount.CreateCloudTableClient();

            cloudTable = tableClient.GetTableReference(this.TableName);

            if (!tableCreatedList.Contains(this.TableName))
            {
                cloudTable.CreateIfNotExists();
                tableCreatedList.Add(this.TableName);
            }
        }
        public static async Task <IActionResult> Run([HttpTrigger(AuthorizationLevel.Function, "get", Route = null)] HttpRequest req, ILogger log, ExecutionContext context)
        {
            string Path = req.Query["Path"].ToString();
            var    sas  = "https://adsgofasttransientstg.blob.core.windows.net/" + Path + "?";

            foreach (var i in req.Query)
            {
                if (i.Key != "Path" && i.Key != "TargetSystemUidInPHI")
                {
                    sas += "&" + i.Key + "=" + i.Value;
                }
            }

            var cloudBlockBlob = new Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob(new Uri(sas));
            await cloudBlockBlob.UploadTextAsync("Hello World");

            //Write to Filelist table so that downstream tasks can be triggered efficiently
            var _storageCredentials  = new Microsoft.WindowsAzure.Storage.Auth.StorageCredentials("?sv=2018-03-28&tn=Filelist&sig=MFbvVgbNLs3UjqAPfU%2BYwQqxcTYwCPnNKCwCUp4XRmo%3D&se=2021-09-06T23%3A15%3A57Z&sp=au");
            var SourceStorageAccount = new Microsoft.WindowsAzure.Storage.CloudStorageAccount(storageCredentials: _storageCredentials, accountName: "adsgofasttransientstg", endpointSuffix: "core.windows.net", useHttps: true);
            var client = SourceStorageAccount.CreateCloudTableClient();

            Microsoft.WindowsAzure.Storage.Table.CloudTable table = client.GetTableReference("Filelist");
            var _dict = new Dictionary <string, EntityProperty>();

            _dict.Add("FilePath", new EntityProperty(Path));
            var _tableEntity    = new DynamicTableEntity(DateTime.UtcNow.ToString("yyyy-MM-dd hh:mm"), Guid.NewGuid().ToString(), null, _dict);
            var _tableOperation = TableOperation.Insert(_tableEntity);

            try
            {
                await table.ExecuteAsync(_tableOperation);
            }
            catch (Microsoft.WindowsAzure.Storage.StorageException ex)
            {
            }
            return(new OkObjectResult(new { }));
        }
Example #7
0
        static TimController()
        {
            Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.Changed += RoleEnvironment_Changed;

            Trace.TraceInformation("[TRACE] Entering TimController::TimController() static initializer...");

            string strDatabaseConnectionString =
                Microsoft.WindowsAzure.CloudConfigurationManager.GetSetting("InfloDatabaseConnectionString");

            if (strDatabaseConnectionString == null)
            {
                Trace.TraceError("Unable to retrieve database connection string");
            }
            else if (strDatabaseConnectionString.Length <= 0)
            {
                Trace.TraceError("Database connection string empty");
            }
            else  //connect to the database
            {
                srInfloDbContext = new InfloDbContext(strDatabaseConnectionString);
            }

            string strStorageAccountConnectionString =
                Microsoft.WindowsAzure.CloudConfigurationManager.GetSetting("StorageAccountConnectionString");

            if (strStorageAccountConnectionString == null)
            {
                Trace.TraceError("Unable to retrieve storage account connection string");
            }
            else if (strStorageAccountConnectionString.Length <= 0)
            {
                Trace.TraceError("Storage account connection string empty");
            }
            else  //connect to the cloud storage account
            {
                Trace.TraceInformation("[INFO] Retrieved StorageAccountConnectionString for TimController\n{0}",
                                       strStorageAccountConnectionString);

                try
                {
                    srStorageAccount = Microsoft.WindowsAzure.Storage.CloudStorageAccount.Parse(strStorageAccountConnectionString);
                }
                catch (Exception e)
                {
                    Trace.TraceError("Exception occurred when parsing storage account connection string\n{0}\n{1}",
                                     strStorageAccountConnectionString, e.Message);
                }

                if (srStorageAccount != null)
                {
                    srCloudTableClient = srStorageAccount.CreateCloudTableClient();
                    srTimV2VTable      = srCloudTableClient.GetTableReference(srTimV2VTableName);

                    try
                    {
                        srTimV2VTable.CreateIfNotExists();
                    }
                    catch (Exception e)
                    {
                        Trace.TraceError("Exception occurred when creating table for V2V TIMs\n{0}",
                                         e.Message);

                        srTimV2VTable = null;
                    }
                }
            }

            AlertSearchRadius  = GetAlertSearchDistance();
            QWarnAheadDistance = GetQWarnAheadDistance();

            srInfloDbContext.Configuration_Roadway.Load();
            srInfloDbContext.Configuration_RoadwayLinks.Load();
            srInfloDbContext.Configuration_RoadwayMileMarkers.Load();
            srInfloDbContext.TMEOutput_QWARNMessage_CV.Load();
            srInfloDbContext.TMEOutput_SPDHARMMessage_CV.Load();

            Trace.TraceInformation("[TRACE] Exiting TimController::TimController() static initializer...");
            return;
        }