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