// GET api/lab3/[id]
        public async Task<SasDto> Get(string clientId)
        {
            var client = await GetClientInfoFromDB(clientId);

            await this.SetupQueue(client.QueueName, "Send", AccessRights.Send);
            await this.SetupQueue(client.ClientId, "Listen", AccessRights.Listen, TimeSpan.FromHours(24));

            var sasDto = new SasDto();
            sasDto.ExpirationTime = DateTimeOffset.Now.AddHours(24);
            sasDto.BlobContainerUrl = await this.GetBlobContainerSas(sasDto.ExpirationTime, client.ClientId);
            
            sasDto.ServiceBusNamespace = this.serviceBusNamespace;
            
            sasDto.JobQueue = client.QueueName;
            sasDto.JobQueueSasUrl = this.GetQueueSas(client.QueueName, "Send", TimeSpan.FromHours(24));

            sasDto.ResultQueue = client.ClientId;
            sasDto.ResultQueueUrl = this.GetQueueSas(client.ClientId, "Listen", TimeSpan.FromHours(24));

            return sasDto;
        }
Example #2
0
 internal UploadJob(SasDto sasDto)
 {
     this.blobContainer = new CloudBlobContainer(new Uri(sasDto.BlobContainerUrl));
     this.queue = Lab3Helper.GetQueueClient(sasDto.ServiceBusNamespace, sasDto.JobQueueSasUrl, sasDto.JobQueue);
 }