Beispiel #1
0
 internal static async System.Threading.Tasks.Task StageFilesAsync(List <IFileStagingProvider> filesToStage, ConcurrentDictionary <Type, IFileStagingArtifact> allFileStagingArtifacts)
 {
     using (System.Threading.Tasks.Task asyncTask = FileStagingLinkedSources.StageFilesAsync(filesToStage, allFileStagingArtifacts, string.Empty))
     {
         await asyncTask.ConfigureAwait(continueOnCapturedContext : false);
     }
 }
Beispiel #2
0
        private static void CreateDefaultBlobContainerAndSASIfNeededReturn(List <IFileStagingProvider> filesToStage, SequentialFileStagingArtifact seqArtifact)
        {
            if ((null != filesToStage) && (filesToStage.Count > 0))
            {
                // construct the name of the new blob container.
                seqArtifact.BlobContainerCreated = FileStagingLinkedSources.ConstructDefaultName(seqArtifact.NamingFragment).ToLowerInvariant();

                // get any instance for the storage credentials
                FileToStage anyRealInstance = FindAtLeastOne(filesToStage);

                if (null != anyRealInstance)
                {
                    StagingStorageAccount creds = anyRealInstance.StagingStorageAccount;
                    string   policyName         = Batch.Constants.DefaultConveniencePrefix + Constants.DefaultContainerPolicyFragment;
                    DateTime startTime          = DateTime.UtcNow;
                    DateTime expiredAtTime      = startTime + new TimeSpan(24 /* hrs*/, 0, 0);

                    seqArtifact.DefaultContainerSAS = CreateContainerWithPolicySASIfNotExist(
                        creds.StorageAccount,
                        creds.StorageAccountKey,
                        creds.BlobUri,
                        seqArtifact.BlobContainerCreated,
                        policyName,
                        startTime,
                        expiredAtTime,
                        SharedAccessBlobPermissions.Read);

                    return;  // done
                }
            }
        }