Esempio n. 1
0
        private async Task <FlowBlobOutputSpec> ProcessOutputBlob(string configName, FlowGuiOutput uiOutput)
        {
            if (uiOutput != null && uiOutput.Properties != null)
            {
                var sparkKeyVaultName = Configuration[Constants.ConfigSettingName_RuntimeKeyVaultName];

                string connectionString = await KeyVaultClient.GetSecretFromKeyVaultAsync(sparkKeyVaultName, uiOutput.Properties.ConnectionString);

                var blobPath       = $"wasbs://{uiOutput.Properties.ContainerName}{ParseBlobAccountName(connectionString)}.blob.core.windows.net/{uiOutput.Properties.BlobPrefix}/%1$tY/%1$tm/%1$td/%1$tH/${{quarterBucket}}/${{minuteBucket}}";
                var secretId       = $"{configName}-output";
                var blobPathSecret = await KeyVaultClient.SaveSecretAsync(sparkKeyVaultName, secretId, blobPath, true);

                FlowBlobOutputSpec blobOutput = new FlowBlobOutputSpec()
                {
                    CompressionType = uiOutput.Properties.CompressionType,
                    Format          = uiOutput.Properties.Format,
                    Groups          = new BlobOutputGroups()
                    {
                        Main = new BlobOutputMain()
                        {
                            Folder = blobPathSecret
                        }
                    }
                };
                return(blobOutput);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 2
0
        private FlowBlobOutputSpec ProcessOutputLocal(string configName, FlowGuiOutput uiOutput)
        {
            if (uiOutput != null && uiOutput.Properties != null)
            {
                string outputPath = uiOutput.Properties.ConnectionString.TrimEnd('/');
                var    localPath  = $"{outputPath}/%1$tY/%1$tm/%1$td/%1$tH/${{quarterBucket}}/${{minuteBucket}}";

                FlowBlobOutputSpec localOutput = new FlowBlobOutputSpec()
                {
                    CompressionType = uiOutput.Properties.CompressionType,
                    Format          = uiOutput.Properties.Format,
                    Groups          = new BlobOutputGroups()
                    {
                        Main = new BlobOutputMain()
                        {
                            Folder = localPath
                        }
                    }
                };
                return(localOutput);
            }
            else
            {
                return(null);
            }
        }
        private async Task <FlowBlobOutputSpec> ProcessOutputBlob(string inputMode, string configName, FlowGuiOutput uiOutput)
        {
            if (uiOutput != null && uiOutput.Properties != null)
            {
                var sparkKeyVaultName = Configuration[Constants.ConfigSettingName_RuntimeKeyVaultName];

                string connectionString = await KeyVaultClient.ResolveSecretUriAsync(uiOutput.Properties.ConnectionString).ConfigureAwait(false);

                var accountName = ConfigHelper.ParseBlobAccountName(connectionString);
                var timeFormat  = ConfigHelper.GetBlobPartitionFormat(inputMode, uiOutput.Properties.BlobPartitionFormat);

                var blobPath       = $"wasbs://{uiOutput.Properties.ContainerName}@{accountName}.blob.core.windows.net/{uiOutput.Properties.BlobPrefix}/{timeFormat}";
                var secretId       = $"{configName}-output";
                var sparkType      = Configuration.TryGet(Constants.ConfigSettingName_SparkType, out string value) ? value : null;
                var blobPathSecret = await KeyVaultClient.SaveSecretAsync(sparkKeyVaultName, secretId, blobPath, sparkType, true);

                await KeyVaultClient.SaveSecretAsync(sparkKeyVaultName, $"{Constants.AccountSecretPrefix}{accountName}", ConfigHelper.ParseBlobAccountKey(connectionString), sparkType, false);

                FlowBlobOutputSpec blobOutput = new FlowBlobOutputSpec()
                {
                    CompressionType = uiOutput.Properties.CompressionType,
                    Format          = uiOutput.Properties.Format,
                    Groups          = new BlobOutputGroups()
                    {
                        Main = new BlobOutputMain()
                        {
                            Folder = blobPathSecret
                        }
                    }
                };
                return(blobOutput);
            }
            else
            {
                return(null);
            }
        }