public async Task <Volume> CreateVolumeAsync(
            string name,
            IDictionary <string, string> secrets,
            CapacityRange range)
        {
            var azureFileAccount = azureFileAccountProvider.Provide(new AzureFileAccountProviderContext(secrets));
            var azureFileService = azureFileServiceFactory.Create(azureFileAccount);
            var shareName        = name;
            // Ignore limit_bytes
            var share = await azureFileService.CreateShareAsync(shareName,
                                                                SizeConverter.RequiredBytesToQuota(range?.RequiredBytes));

            var shareId = new AzureFileShareId
            {
                ShareName = share.Name,
                AccountId = azureFileAccount.Id,
            };

            return(new Volume
            {
                Id = volumeIdProvider.CreateVolumeId(shareId),
                CapacityBytes = SizeConverter.QuotaToCapacityBytes(share.QuotaInGib),
            });
        }
Exemple #2
0
 public string CreateVolumeId(AzureFileShareId shareId)
 => $"{scheme}{shareId.AccountId.Name}.{shareId.AccountId.EnvironmentName}/{shareId.ShareName}".ToLower();