Esempio n. 1
0
        static void Main(string[] args)
        {
            //get data from
            string storageAccount = ConfigurationManager.AppSettings["StorageAccount"];
            string rootFolder     = ConfigurationManager.AppSettings["RootFolder"];
            string localFolder    = ConfigurationManager.AppSettings["ManifestLocation"];
            string manifestName   = ConfigurationManager.AppSettings["ManifestName"];
            var    TenantId       = ConfigurationManager.AppSettings["TenantId"];
            var    AppId          = ConfigurationManager.AppSettings["AppId"];
            var    AppSecret      = ConfigurationManager.AppSettings["AppSecret"];
            bool   createDS       = System.Convert.ToBoolean(ConfigurationManager.AppSettings["CreateDS"]);
            var    SAS            = ConfigurationManager.AppSettings["SAS"];
            var    pass           = ConfigurationManager.AppSettings["Password"];

            AdlsContext adlsContext = new AdlsContext()
            {
                StorageAccount = storageAccount,
                FileSytemName  = rootFolder,
                TenantId       = TenantId,
                ClientAppId    = AppId,
                ClientSecret   = AppSecret
            };

            var statements = ManifestHandler.CDMToSQL(adlsContext, storageAccount, rootFolder, localFolder, manifestName, SAS, pass, createDS);


            Console.WriteLine(JsonConvert.SerializeObject(statements));
        }
        public static async Task <IActionResult> manifestToSynapseView(
            [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req,
            ILogger log, ExecutionContext context)
        {
            log.LogInformation("C# HTTP trigger function processed a request.");
            //get data from
            string storageAccount = req.Headers["StorageAccount"];
            string rootFolder     = req.Headers["RootFolder"];
            string localFolder    = req.Headers["ManifestLocation"];
            string manifestName   = req.Headers["ManifestName"];

            var  TenantId  = System.Environment.GetEnvironmentVariable("TenantId");
            var  AppId     = System.Environment.GetEnvironmentVariable("AppId");;
            var  AppSecret = System.Environment.GetEnvironmentVariable("AppSecret");
            bool createDS  = System.Convert.ToBoolean(System.Environment.GetEnvironmentVariable("CreateDS"));
            var  SAS       = System.Environment.GetEnvironmentVariable("SAS");
            var  pass      = System.Environment.GetEnvironmentVariable("Password");

            AdlsContext adlsContext = new AdlsContext()
            {
                StorageAccount = storageAccount,
                FileSytemName  = rootFolder,
                TenantId       = TenantId,
                ClientAppId    = AppId,
                ClientSecret   = AppSecret
            };

            var statements = await ManifestHandler.CDMToSQL(adlsContext, storageAccount, rootFolder, localFolder, manifestName, SAS, pass, createDS);


            return(new OkObjectResult(JsonConvert.SerializeObject(statements)));
        }