Created
November 29, 2019 14:30
-
-
Save justinyoo/977295c0919f5e4fcd7a7eebc4455a27 to your computer and use it in GitHub Desktop.
25 Days of Serverless
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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