forked from Azure/azure-functions-dotnet-worker
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add E2E tests for blob SDK type bindings (Azure#1360) * Add analyzer for SupportsDeferredBindingAttribute (Azure#1367) * Update SupportsDeferredBinding diagnostic code & update docs (Azure#1377) * Revert "Remove types, tests & logic related to the SDK-binding feature (Azure#1374)" This reverts commit eac5b19. * Added unit tests for BlobStorageConverter (Azure#1370) * Adding test project * Added tests * Initial changes * Updating metadata * Adding a test * Code refactoring * Cosmos DB converter for SDK-type support and samples (Azure#1406) * Execution flow added * Update pipeline variables to include tags (Azure#1427) * Update extension variables to not use build number with tags (Azure#1429) * Execution flow * cleanup * Cleanup * Cleanup * Cleanup execution flow * Added test * Adding tests * code cleanup * Code cleanup * code refactor * Added logic to check type before sending to converter * Updated tests * Removing advertised converters from options * Adding options back * Changes to check type * updating type check logic * correction in metadata generation * code cleanup * Test cleanup * Added changes to support poco * Metadata generation changes * Changes on Invocation side * correcting type check and tests * Test for poco invocation support * Added tests for poco invocation flows * Metadata generator minor update * Grpc definition update * Added poco and poco collection check * cleanup metadata generation * Adding support for type collection * code cleanup * Fixing metadata gen * Test fix * Grpc definition fix * Removing BlobContainerClient advertisement * Readding containerclient * Updated metadata generator * Changes as per latest design * code cleanup * updatin tests input * code cleanup * Cleanup Metadata generation * correcting converters fallback logic * Removing converter advertisement on cosmos trigger * Fixing failing test * test check in * Undo testing changes in sample app * spacing fix * updated tests * non secret changes * Addressing PR feedback * e2e test work * adding comments * Removed json deserialization attribute * Rename to AllowConverterFallback * Addressing feedback * Metada generation cleanup * Test cleanup * Addressing feedback * Updated grpcFunctionDefinition for multiple inputConverterAttribute * Removing cosmos converter registration * Address PR feedback * Address PR feedback * Test fix * Minor * addressing comments * getting e2e working * Implement bypass deferred binding (Azure#1462) Implement bypass deferred binding * Build issue fix * comments * Update test/E2ETests/E2EApps/E2EApp/Table/TableInputBindingFunctions.cs Co-authored-by: Lilian Kasem <likasem@microsoft.com> * Adding check for PR in yml file (Azure#1546) * addressing some more comments * dependency * one more dependency * trying to compile lol * seeing if tables project compiles with dependency * removing local instance * see if this compiles * trying to remove test * nvm adding it back * adding keys to nuget.config * trying to get feed * trying again * more yml * fixing spacing * ci.yml * Add ability to bind to SBReceivedMessage (Azure#1313) * another change * trying again * formatting changes * changes * updating worker.sdk package * fixing unit test * getting unit tests to pass * fixing test --------- Co-authored-by: Lilian Kasem <likasem@microsoft.com> Co-authored-by: Surgupta <surgupta@microsoft.com> Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>
- Loading branch information
1 parent
a396817
commit 99d2207
Showing
14 changed files
with
1,165 additions
and
10 deletions.
There are no files selected for viewing
This file contains 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 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 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 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<packageSources> | ||
<clear /> | ||
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" /> | ||
</packageSources> | ||
</configuration> |
This file was deleted.
Oops, something went wrong.
118 changes: 118 additions & 0 deletions
118
samples/WorkerBindingSamples/Table/TableInputBindingSamples.cs
This file contains 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,118 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the MIT License. See License.txt in the project root for license information. | ||
|
||
using System.Net; | ||
using Azure.Data.Tables; | ||
using Microsoft.Azure.Functions.Worker; | ||
using Microsoft.Azure.Functions.Worker.Http; | ||
using Microsoft.Extensions.Logging; | ||
|
||
namespace WorkerBindingSamples.Table | ||
{ | ||
public class TableInputBindingSamples | ||
{ | ||
private readonly ILogger<TableInputBindingSamples> _logger; | ||
|
||
public TableInputBindingSamples(ILogger<TableInputBindingSamples> logger) | ||
{ | ||
_logger = logger; | ||
} | ||
|
||
[Function(nameof(TableClientFunction))] | ||
public async Task<HttpResponseData> TableClientFunction( | ||
[HttpTrigger(AuthorizationLevel.Function, "get", "post")] HttpRequestData req, | ||
[TableInput("TableName")] TableClient table) | ||
{ | ||
var tableEntity = table.QueryAsync<TableEntity>(); | ||
var response = req.CreateResponse(HttpStatusCode.OK); | ||
|
||
await foreach (TableEntity val in tableEntity) | ||
{ | ||
val.TryGetValue("Text", out var text); | ||
_logger.LogInformation("Value of text: " + text); | ||
|
||
await response.WriteStringAsync(text?.ToString() ?? ""); | ||
} | ||
|
||
return response; | ||
} | ||
|
||
[Function(nameof(ReadTableDataFunction))] | ||
public async Task<HttpResponseData> ReadTableDataFunction( | ||
[HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = "items/{partitionKey}/{rowKey}")] HttpRequestData req, | ||
[TableInput("TableName", "{partitionKey}", "{rowKey}")] TableEntity table) | ||
|
||
{ | ||
table.TryGetValue("Text", out var text); | ||
var response = req.CreateResponse(HttpStatusCode.OK); | ||
await response.WriteStringAsync(text?.ToString() ?? ""); | ||
return response; | ||
} | ||
|
||
[Function(nameof(ReadTableDataFunctionWithFilter))] | ||
public async Task<HttpResponseData> ReadTableDataFunctionWithFilter( | ||
[HttpTrigger(AuthorizationLevel.Function, "get", "post")] HttpRequestData req, | ||
[TableInput("TableName", "My Partition", 2, Filter = "RowKey ne 'value'")] IEnumerable<TableEntity> table) | ||
|
||
{ | ||
List<string> tableList = new(); | ||
var response = req.CreateResponse(HttpStatusCode.OK); | ||
|
||
foreach (TableEntity tableEntity in table) | ||
{ | ||
tableEntity.TryGetValue("Text", out var text); | ||
_logger.LogInformation("Value of text: " + text); | ||
tableList.Add(text?.ToString() ?? ""); | ||
} | ||
|
||
await response.WriteStringAsync(string.Join(",", tableList)); | ||
return response; | ||
} | ||
|
||
[Function(nameof(EnumerableFunction))] | ||
public async Task<HttpResponseData> EnumerableFunction( | ||
[HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = "items/{partitionKey}")] HttpRequestData req, | ||
[TableInput("TableName", "{partitionKey}")] IEnumerable<TableEntity> tables) | ||
|
||
{ | ||
var response = req.CreateResponse(HttpStatusCode.OK); | ||
List<string> tableList = new(); | ||
|
||
foreach (TableEntity tableEntity in tables) | ||
{ | ||
tableEntity.TryGetValue("Text", out var text); | ||
_logger.LogInformation("Value of text: " + text); | ||
tableList.Add((text?.ToString()) ?? ""); | ||
} | ||
|
||
await response.WriteStringAsync(string.Join(",", tableList)); | ||
return response; | ||
} | ||
|
||
[Function(nameof(PocoFunction))] | ||
public async Task<HttpResponseData> PocoFunction( | ||
[HttpTrigger(AuthorizationLevel.Function, "get","post", Route = null)] HttpRequestData req, | ||
[TableInput("TableName")] IEnumerable<MyEntity> entities, | ||
FunctionContext executionContext) | ||
{ | ||
var response = req.CreateResponse(HttpStatusCode.OK); | ||
List<string> entityList = new(); | ||
|
||
foreach (MyEntity entity in entities) | ||
{ | ||
_logger.LogInformation($"Text: {entity.Text}"); | ||
entityList.Add((entity.Text ?? "").ToString()); | ||
} | ||
|
||
await response.WriteStringAsync(string.Join(",", entityList)); | ||
return response; | ||
} | ||
} | ||
|
||
public class MyEntity | ||
{ | ||
public string? Text { get; set; } | ||
public string? PartitionKey { get; set; } | ||
public string? RowKey { get; set; } | ||
} | ||
} |
This file contains 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 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
186 changes: 186 additions & 0 deletions
186
test/SdkE2ETests/Contents/WorkerBindingSamplesOutput/functions.metadata
This file contains 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 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
Oops, something went wrong.