Skip to content

Commit

Permalink
add function-unzip
Browse files Browse the repository at this point in the history
  • Loading branch information
mahdikhashan committed Dec 14, 2024
1 parent cdf58cb commit 031dfe5
Show file tree
Hide file tree
Showing 7 changed files with 113 additions and 0 deletions.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
### Azure Project

TODO

#### Setup

- install azd
```bash
brew tap azure/azd && brew install azd
```

- verify installation
```bash
azd version
```

- azure functions tools
```bash
brew tap azure/functions
brew install azure-functions-core-tools@4
# if upgrading on a machine that has 2.x or 3.x installed:
brew link --overwrite azure-functions-core-tools@4
```

#### Creating functions

```bash

```
Empty file removed functions/.gitkeep
Empty file.
48 changes: 48 additions & 0 deletions functions/unzip/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
bin
obj
csx
.vs
edge
Publish

*.user
*.suo
*.cscfg
*.Cache
project.lock.json

/packages
/TestResults

/tools/NuGet.exe
/App_Data
/secrets
/data
.secrets
appsettings.json
local.settings.json

node_modules
dist

# Local python packages
.python_packages/

# Python Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# Azurite artifacts
__blobstorage__
__queuestorage__
__azurite_db*__.json
5 changes: 5 additions & 0 deletions functions/unzip/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"ms-azuretools.vscode-azurefunctions"
]
}
14 changes: 14 additions & 0 deletions functions/unzip/function_app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import azure.functions as func
import datetime
import json
import logging

app = func.FunctionApp()


@app.blob_trigger(arg_name="myblob", path="dataset",
connection="BlobStorageConnectionString")
def Unzip(myblob: func.InputStream):
logging.info(f"Python blob trigger function processed blob"
f"Name: {myblob.name}"
f"Blob Size: {myblob.length} bytes")
15 changes: 15 additions & 0 deletions functions/unzip/host.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
}
}
},
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[4.*, 5.0.0)"
}
}
5 changes: 5 additions & 0 deletions functions/unzip/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Do not include azure-functions-worker in this file
# The Python Worker is managed by the Azure Functions platform
# Manually managing azure-functions-worker may cause unexpected issues

azure-functions

0 comments on commit 031dfe5

Please sign in to comment.