public static void Run( [BlobTrigger("lelantus-sa-container/{name}", Connection = "StorageConnectionString")] Stream myBlob, string name, ILogger log) { var media = MediaEntityUtils.GetMediaEntity(name); var httpClient = new HttpClient(); var myContent = JsonConvert.SerializeObject(media); var buffer = System.Text.Encoding.UTF8.GetBytes(myContent); var byteContent = new ByteArrayContent(buffer); byteContent.Headers.ContentType = new MediaTypeHeaderValue("application/json"); var result = httpClient.PostAsync(new Uri("https://lelantus.azurewebsites.net/api/MediaHub"), byteContent).Result; }
public static void Run( [BlobTrigger("lelantus-sa-container/{name}", Connection = "StorageConnectionString")] Stream myBlob, ILogger logger, string name, ILogger log, ExecutionContext context) { log.LogInformation($"C# Blob trigger function Processed blob\n Name:{name} \n Size: {myBlob.Length} Bytes"); var config = new ConfigurationBuilder() .SetBasePath(context.FunctionAppDirectory) .AddJsonFile("local.settings.json", optional: true, reloadOnChange: true) .AddEnvironmentVariables() .Build(); var connectionString = config["TableConnectionString"]; _account = CloudStorageAccount.Parse(connectionString); var media = MediaEntityUtils.GetMediaEntity(name); var table = GetMediaTable().Result; var insertedMedia = InsertOrMergeEntityAsync(table, media).Result; Console.WriteLine("Media inserted: " + media.Name); }