Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Code Samples for Netherite #72

Merged
merged 2 commits into from
Sep 20, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
229 changes: 229 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -441,3 +441,232 @@ $RECYCLE.BIN/
# The build keeps auto-generating this file. We do not want this.
/.nuget/NuGet.Config
NuGet.Config


## Python specifics

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

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don’t work, or not
# install all needed dependencies.
#Pipfile.lock

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

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

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# Azure Functions artifacts
bin
obj
appsettings.json
.python_packages

## TypeScript specifics

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TypeScript output
dist
out

# Azure Functions artifacts
bin
obj
appsettings.json
54 changes: 0 additions & 54 deletions samples/Hello/deploy-on-premium.ps1

This file was deleted.

8 changes: 0 additions & 8 deletions samples/Hello/local.settings.json

This file was deleted.

24 changes: 0 additions & 24 deletions samples/Hello/settings.ps1

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static class HelloCities
{
[FunctionName(nameof(HelloCities))]
public async static Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = "hellocities")] HttpRequest req,
[HttpTrigger(AuthorizationLevel.Function, "post", Route = "hellocities")] HttpRequest req,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using non-anonymous access makes it slightly more difficult to run this sample. I suppose there is a risk is that users will forget to secure this later (after copying the sample).

Still, simplicity of the sample is important so I would probably leave this anonymous. I had a quick look at DF samples and they use anonymous also (e.g. https://github.com/Azure/azure-functions-durable-extension/blob/dev/samples/javascript/HttpStart/function.json).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had the risk in mind, but you are right, the samples in the documentation are anonymous. I changed that for all implementations. I will make a remark in the documentation

[DurableClient] IDurableClient client)
{
string orchestrationInstanceId = await client.StartNewAsync(nameof(HelloSequence));
Expand Down
21 changes: 21 additions & 0 deletions samples/Hello_Netherite_with_DotNetCore/deploy-dotnet-function.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/pwsh

# review these parameters before running the script
$Configuration = "Release"

# read the parameters
. ../scripts/settings.ps1

Write-Host "Building Function App..."

Write-Host Building $Configuration Configuration...
dotnet build -c $Configuration

# enter the directory with the binaries
Push-Location -Path bin/$Configuration/netcoreapp3.1


Write-Host "Publishing Code to Function App..."
func azure functionapp publish $functionAppName

Pop-Location
File renamed without changes.
8 changes: 8 additions & 0 deletions samples/Hello_Netherite_with_DotNetCore/local.settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"EventHubsConnection": "MemoryF",
"FUNCTIONS_WORKER_RUNTIME": "dotnet"
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/usr/bin/pwsh

# read the parameters
. ./settings.ps1
. ../scripts/settings.ps1

# Build app
dotnet build

# enter the directory with the debug binaries
if (-not (Test-Path -Path ./bin/Debug/netcoreapp3.1/bin)) {
Expand Down
6 changes: 6 additions & 0 deletions samples/Hello_Netherite_with_Python/.funcignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.git*
.vscode
local.settings.json
test
.venv
*.ps1
6 changes: 6 additions & 0 deletions samples/Hello_Netherite_with_Python/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"recommendations": [
"ms-azuretools.vscode-azurefunctions",
"ms-python.python"
]
}
Loading