Skip to content

Commit

Permalink
add deletion logic
Browse files Browse the repository at this point in the history
  • Loading branch information
ihaveamicroservice committed Oct 6, 2023
1 parent 0534c94 commit 000ab0e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions function_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ def image_compressor_ultra_low(inputblob: func.InputStream, outputblob: func.Out

@app.event_grid_trigger(arg_name="azeventgrid")
def delete_compressed_image(azeventgrid: func.EventGridEvent):
logging.info(f'Python EventGrid trigger processed an event, name: {azeventgrid.subject}')
logging.info("JSON:")
logging.info(azeventgrid.get_json())
logging.info("NAME:")
logging.info(os.path.basename(azeventgrid.subject))
blob_name=os.path.basename(azeventgrid.subject)
connection_string = os.environ["AzureWebJobsStorage"]
blob_service_client = BlobServiceClient.from_connection_string(connection_string)
for container_name in "techcamp-target-low" "techcamp-target-ultra-low":
blob_client = blob_service_client.get_blob_client(container=container_name, blob=blob_name)
blob_client.delete_blob()

0 comments on commit 000ab0e

Please sign in to comment.