Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
25 Days of Serverless
[FunctionName(nameof(GiftPhotoValidationFunction))]
public static async Task Run([BlobTrigger(_containerName)] CloudBlockBlob blockBlob, ILogger log)
{
log.LogInformation("Validating Gift Image is a PNG");
if (blockBlob.Name.EndsWith(".png", StringComparison.InvariantCultureIgnoreCase))
{
log.LogInformation("Confirmed PNG");
}
else
{
log.LogInformation($"Photo {blockBlob.Name} is not a PNG");
log.LogInformation($"Deleting {blockBlob.Name} from container");
await blockBlob.DeleteAsync().ConfigureAwait(false);
log.LogInformation($"Deleted {blockBlob.Name}");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.