-
Notifications
You must be signed in to change notification settings - Fork 63
Creates PowerShell Samples / Tests #449
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
Merged
Merged
Changes from all commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
afc2b34
add powershell samples
VasuBhog d3b5a3f
add further tests
VasuBhog c92fa64
fix powershell test
VasuBhog 738337a
include runtime
VasuBhog ab4d551
copyright header fix
VasuBhog eb3b33c
deseralize powershell test
VasuBhog fa22718
add local.settings.json
VasuBhog c133228
add local.settings.json
VasuBhog 64c2c1b
add local.settings.json correct for samples/ps
VasuBhog 3eb0fc9
add local.settings.json for each sampels
VasuBhog b55cb98
update test to deseralize JSON objects and compare
VasuBhog 3957d8e
update input test to fix views test
VasuBhog 7ad4e37
Merge branch 'main' into vabhog/addPSSamplesTests
VasuBhog 92acf93
add product params test
VasuBhog d975b53
address merge conflicts
VasuBhog cbd8ee1
address merge fixes
VasuBhog 716a4c1
fix build
VasuBhog a1834b7
add function.json fix
VasuBhog b184c13
test getProductNamesViewTes
VasuBhog b82bde4
fixes
VasuBhog 0e66298
fixes serialization problems
VasuBhog dba174e
add debug test
VasuBhog e19258c
Merge branch 'main' into vabhog/addPSSamplesTests
VasuBhog 351c8e2
add debug tests
VasuBhog 96b73c6
add debug add product test
VasuBhog ddc1f82
fixes serialization problems
VasuBhog b8e57ab
fix output binding tests
VasuBhog 0cd9e31
small fixes
VasuBhog 2b6907e
product overide test
VasuBhog 33821b4
fix product test
VasuBhog 3ed6e29
fix tests
VasuBhog bd14a67
address fixes
VasuBhog ea3b366
mark tests that are not currently working
VasuBhog 60a539e
undo local.settings.json
VasuBhog 1513c55
AddProductWithMultiplePrimaryColumnsAndIdentity test
VasuBhog 188f40c
identity tests are unstable
VasuBhog 41aec73
other identity tests unstable
VasuBhog c3e98fe
address comments
VasuBhog 17d3ac1
Merge branch 'main' into vabhog/addPSSamplesTests
VasuBhog 4a9e9d7
address comments:
VasuBhog 9d006a5
add generic default files
VasuBhog 985540e
add pipeline task
VasuBhog 5c9b31c
add/edit comments
VasuBhog 67980c4
fix pipeline dotnet task
VasuBhog File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -358,4 +358,7 @@ __queuestorage__ | |
| __azurite_db*__.json | ||
|
|
||
| # Python virtual environment | ||
| .venv | ||
| .venv | ||
|
|
||
| # Mac OS X | ||
| .DS_Store | ||
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| .git* | ||
| .vscode | ||
| local.settings.json | ||
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| # Azure Functions artifacts | ||
| bin | ||
| obj | ||
| appsettings.json | ||
| local.settings.json | ||
|
|
||
| # Azurite artifacts | ||
| __blobstorage__ | ||
| __queuestorage__ | ||
| __azurite_db*__.json |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "recommendations": [ | ||
| "ms-azuretools.vscode-azurefunctions", | ||
| "ms-vscode.powershell" | ||
| ] | ||
| } |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| { | ||
| "version": "0.2.0", | ||
| "configurations": [ | ||
| { | ||
| "name": "Attach to PowerShell Functions", | ||
| "type": "PowerShell", | ||
| "request": "attach", | ||
| "customPipeName": "AzureFunctionsPSWorker", | ||
| "runspaceId": 1, | ||
| "preLaunchTask": "func: host start" | ||
| } | ||
| ] | ||
| } |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "azureFunctions.templateFilter": "All", | ||
| "azureFunctions.deploySubpath": ".", | ||
| "azureFunctions.projectLanguage": "PowerShell", | ||
| "azureFunctions.projectRuntime": "~4", | ||
| "debug.internalConsoleOptions": "neverOpen" | ||
| } |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "version": "2.0.0", | ||
| "tasks": [ | ||
| { | ||
| "type": "func", | ||
| "command": "host start", | ||
| "problemMatcher": "$func-powershell-watch", | ||
| "isBackground": true | ||
| } | ||
| ] | ||
| } |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| { | ||
| "bindings": [ | ||
| { | ||
| "authLevel": "function", | ||
| "name": "Request", | ||
| "direction": "in", | ||
| "type": "httpTrigger", | ||
| "methods": [ | ||
| "post" | ||
| ], | ||
| "route": "addproduct" | ||
| }, | ||
| { | ||
| "name": "response", | ||
| "type": "http", | ||
| "direction": "out" | ||
| }, | ||
| { | ||
| "name": "product", | ||
| "type": "sql", | ||
| "direction": "out", | ||
| "commandText": "[dbo].[Products]", | ||
| "connectionStringSetting": "SqlConnectionString" | ||
| } | ||
| ], | ||
| "disabled": false | ||
| } |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| using namespace System.Net | ||
|
|
||
| # Trigger binding data passed in via param block | ||
| param($Request) | ||
|
|
||
| # Write to the Azure Functions log stream. | ||
| Write-Host "PowerShell function with SQL Output Binding processed a request." | ||
|
|
||
| # Update req_body with the body of the request | ||
| # Note that this expects the body to be a JSON object or array of objects | ||
| # which have a property matching each of the columns in the table to upsert to. | ||
| $req_body = $Request.Body | ||
|
|
||
| # Assign the value we want to pass to the SQL Output binding. | ||
| # The -Name value corresponds to the name property in the function.json for the binding | ||
| Push-OutputBinding -Name product -Value $req_body | ||
|
|
||
| # Assign the value to return as the HTTP response. | ||
| # The -Name value matches the name property in the function.json for the binding | ||
| Push-OutputBinding -Name response -Value ([HttpResponseContext]@{ | ||
| StatusCode = [HttpStatusCode]::OK | ||
| Body = $req_body | ||
| }) |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| { | ||
| "bindings": [ | ||
| { | ||
| "authLevel": "function", | ||
| "name": "Request", | ||
| "direction": "in", | ||
| "type": "httpTrigger", | ||
| "methods": [ | ||
| "get", | ||
| "post" | ||
| ], | ||
| "route": "addproduct-params" | ||
| }, | ||
| { | ||
| "name": "response", | ||
| "type": "http", | ||
| "direction": "out" | ||
| }, | ||
| { | ||
| "name": "product", | ||
| "type": "sql", | ||
| "direction": "out", | ||
| "commandText": "[dbo].[Products]", | ||
| "connectionStringSetting": "SqlConnectionString" | ||
| } | ||
| ], | ||
| "disabled": false | ||
| } |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| using namespace System.Net | ||
|
|
||
| # Trigger binding data passed in via param block | ||
| param($Request) | ||
|
|
||
| # Write to the Azure Functions log stream. | ||
| Write-Host "PowerShell function with SQL Output Binding processed a request." | ||
|
|
||
| # Update req_query with the query of the request | ||
| $req_query = @{ | ||
| "productId"= $Request.QUERY.productId; | ||
| "name"= $Request.QUERY.name; | ||
| "cost"= $Request.QUERY.cost; | ||
| }; | ||
|
|
||
| # Assign the value we want to pass to the SQL Output binding. | ||
| # The -Name value corresponds to the name property in the function.json for the binding | ||
| Push-OutputBinding -Name product -Value $req_query | ||
|
|
||
| # Assign the value to return as the HTTP response. | ||
| # The -Name value matches the name property in the function.json for the binding | ||
| Push-OutputBinding -Name response -Value ([HttpResponseContext]@{ | ||
| StatusCode = [HttpStatusCode]::OK | ||
| Body = $req_query | ||
| }) |
27 changes: 27 additions & 0 deletions
27
samples/samples-powershell/AddProductWithDefaultPK/function.json
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| { | ||
| "bindings": [ | ||
| { | ||
| "authLevel": "function", | ||
| "name": "Request", | ||
| "direction": "in", | ||
| "type": "httpTrigger", | ||
| "methods": [ | ||
| "post" | ||
| ], | ||
| "route": "addproductwithdefaultpk" | ||
| }, | ||
| { | ||
| "name": "response", | ||
| "type": "http", | ||
| "direction": "out" | ||
| }, | ||
| { | ||
| "name": "products", | ||
| "type": "sql", | ||
| "direction": "out", | ||
| "commandText": "[dbo].[ProductsWithDefaultPK]", | ||
| "connectionStringSetting": "SqlConnectionString" | ||
| } | ||
| ], | ||
| "disabled": false | ||
| } |
23 changes: 23 additions & 0 deletions
23
samples/samples-powershell/AddProductWithDefaultPK/run.ps1
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| using namespace System.Net | ||
|
|
||
| # Trigger binding data passed in via param block | ||
| param($Request) | ||
|
|
||
| # Write to the Azure Functions log stream. | ||
| Write-Host "PowerShell function with SQL Output Binding processed a request." | ||
|
|
||
| # Update req_body with the body of the request | ||
| # Note that this expects the body to be a JSON object or array of objects | ||
| # which have a property matching each of the columns in the table to upsert to. | ||
| $req_body = $Request.Body | ||
|
|
||
| # Assign the value we want to pass to the SQL Output binding. | ||
| # The -Name value corresponds to the name property in the function.json for the binding | ||
| Push-OutputBinding -Name products -Value $req_body | ||
|
|
||
| # Assign the value to return as the HTTP response. | ||
| # The -Name value matches the name property in the function.json for the binding | ||
| Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{ | ||
| StatusCode = [HttpStatusCode]::OK | ||
| Body = $req_body | ||
| }) |
28 changes: 28 additions & 0 deletions
28
samples/samples-powershell/AddProductWithIdentityColumn/function.json
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| { | ||
| "bindings": [ | ||
| { | ||
| "authLevel": "function", | ||
| "name": "Request", | ||
| "direction": "in", | ||
| "type": "httpTrigger", | ||
| "methods": [ | ||
| "get", | ||
| "post" | ||
| ], | ||
| "route": "addproductwithidentitycolumn" | ||
| }, | ||
| { | ||
| "name": "response", | ||
| "type": "http", | ||
| "direction": "out" | ||
| }, | ||
| { | ||
| "name": "product", | ||
| "type": "sql", | ||
| "direction": "out", | ||
| "commandText": "[dbo].[ProductsWithIdentity]", | ||
| "connectionStringSetting": "SqlConnectionString" | ||
| } | ||
| ], | ||
| "disabled": false | ||
| } |
24 changes: 24 additions & 0 deletions
24
samples/samples-powershell/AddProductWithIdentityColumn/run.ps1
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| using namespace System.Net | ||
|
|
||
| # Trigger binding data passed in via param block | ||
| param($Request) | ||
|
|
||
| # Write to the Azure Functions log stream. | ||
| Write-Host "PowerShell function with SQL Output Binding processed a request." | ||
|
|
||
| # Update req_query with the query of the request | ||
| $req_query = @{ | ||
| name=$Request.QUERY.name; | ||
| cost=$Request.QUERY.cost; | ||
| }; | ||
|
|
||
| # Assign the value we want to pass to the SQL Output binding. | ||
| # The -Name value corresponds to the name property in the function.json for the binding | ||
| Push-OutputBinding -Name product -Value $req_query | ||
|
|
||
| # Assign the value to return as the HTTP response. | ||
| # The -Name value matches the name property in the function.json for the binding | ||
| Push-OutputBinding -Name response -Value ([HttpResponseContext]@{ | ||
| StatusCode = [HttpStatusCode]::OK | ||
| Body = $req_query | ||
| }) |
27 changes: 27 additions & 0 deletions
27
samples/samples-powershell/AddProductWithIdentityColumnIncluded/function.json
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| { | ||
| "bindings": [ | ||
| { | ||
| "authLevel": "function", | ||
| "name": "Request", | ||
| "direction": "in", | ||
| "type": "httpTrigger", | ||
| "methods": [ | ||
| "get" | ||
| ], | ||
| "route": "addproductwithidentitycolumnincluded" | ||
| }, | ||
| { | ||
| "name": "response", | ||
| "type": "http", | ||
| "direction": "out" | ||
| }, | ||
| { | ||
| "name": "product", | ||
| "type": "sql", | ||
| "direction": "out", | ||
| "commandText": "[dbo].[ProductsWithIdentity]", | ||
| "connectionStringSetting": "SqlConnectionString" | ||
| } | ||
| ], | ||
| "disabled": false | ||
| } |
25 changes: 25 additions & 0 deletions
25
samples/samples-powershell/AddProductWithIdentityColumnIncluded/run.ps1
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| using namespace System.Net | ||
|
|
||
| # Trigger binding data passed in via param block | ||
| param($Request) | ||
|
|
||
| # Write to the Azure Functions log stream. | ||
| Write-Host "PowerShell function with SQL Output Binding processed a request." | ||
|
|
||
| # Update req_query with the body of the request | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Update comment |
||
| $req_query = @{ | ||
| productId= if($Request.QUERY.productId) { $Request.QUERY.productId } else { $null }; | ||
| name=$Request.QUERY.name; | ||
| cost=$Request.QUERY.cost; | ||
| }; | ||
|
|
||
| # Assign the value we want to pass to the SQL Output binding. | ||
| # The -Name value corresponds to the name property in the function.json for the binding | ||
| Push-OutputBinding -Name product -Value $req_query | ||
|
|
||
| # Assign the value to return as the HTTP response. | ||
| # The -Name value matches the name property in the function.json for the binding | ||
| Push-OutputBinding -Name response -Value ([HttpResponseContext]@{ | ||
| StatusCode = [HttpStatusCode]::OK | ||
| Body = $req_query | ||
| }) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.