public static async Task <string> GetValuesAsync(string deviceId, string date, string?sensorType) { DeviceMeasuredValues measuredValues = await AzureBlobRetriever.GetMeasuredValuesAsync(deviceId, date, sensorType); var result = Newtonsoft.Json.JsonConvert.SerializeObject(measuredValues); return(result); }
public static async Task <IActionResult> GetBlob( [HttpTrigger(AuthorizationLevel.System, Constants.Constants.HttpGet, Route = "GetBlob/{containerName}/{blobName}")] HttpRequest request, ILogger logger, string containerName, string blobName) { var blobRetriever = await AzureBlobRetriever.InitializeAsync(containerName); return(new OkObjectResult(await blobRetriever.GetBlob(blobName))); }
public static async Task <IActionResult> GetAllBlobs( [HttpTrigger(AuthorizationLevel.System, Constants.Constants.HttpGet, Route = "GetAllBlobs/{containerName}")] HttpRequest request, ILogger logger, string containerName) { var blobRetriever = await AzureBlobRetriever.InitializeAsync(containerName); var response = await blobRetriever.GetAllBlobs(); return(new OkObjectResult(response.ToBlobDetails())); }
public static async Task <IActionResult> DownloadBlobInline( [HttpTrigger(AuthorizationLevel.System, Constants.Constants.HttpGet, Route = "DownloadBlobInline/{containerName}/{blobName}")] HttpRequest request, ILogger logger, string containerName, string blobName ) { var blobRetriever = await AzureBlobRetriever.InitializeAsync(containerName); var stream = await blobRetriever.GetBlobAsStream(blobName); return(new FileStreamResult(stream, MimeTypes.GetMimeType(blobName))); }
public static async Task <FileResult> DownloadBlob( [HttpTrigger(AuthorizationLevel.System, Constants.Constants.HttpGet, Route = "DownloadBlob/{containerName}/{blobName}")] HttpRequest request, ILogger logger, string containerName, string blobName) { var blobRetriever = await AzureBlobRetriever.InitializeAsync(containerName); using (var ms = new MemoryStream()) { var stream = await blobRetriever.GetBlobAsStream(blobName); await stream.CopyToAsync(ms); return(new FileContentResult(ms.ToArray(), MediaTypeNames.Application.Octet) { FileDownloadName = blobName }); } }