Skip to content
Merged
Show file tree
Hide file tree
Changes from 85 commits
Commits
Show all changes
123 commits
Select commit Hold shift + click to select a range
257add7
Add E2E tests for blob SDK type bindings (#1360)
liliankasem Feb 22, 2023
3f84651
Add analyzer for SupportsDeferredBindingAttribute (#1367)
liliankasem Feb 23, 2023
6b1189a
Update SupportsDeferredBinding diagnostic code & update docs (#1377)
liliankasem Feb 23, 2023
d16ab2d
Revert "Remove types, tests & logic related to the SDK-binding featur…
liliankasem Feb 23, 2023
cdcbc9d
Added unit tests for BlobStorageConverter (#1370)
surgupta-msft Feb 23, 2023
f7853d7
Initial changes
surgupta-msft Mar 16, 2023
9d105a6
Updating metadata
surgupta-msft Mar 17, 2023
0a4342b
Adding a test
surgupta-msft Mar 20, 2023
d5206aa
Code refactoring
surgupta-msft Mar 21, 2023
fae3f6b
Cosmos DB converter for SDK-type support and samples (#1406)
liliankasem Mar 21, 2023
a4da7dc
Execution flow added
surgupta-msft Mar 22, 2023
1b3395e
Update pipeline variables to include tags (#1427)
liliankasem Mar 22, 2023
cb93c71
Update extension variables to not use build number with tags (#1429)
liliankasem Mar 22, 2023
61479cb
Execution flow
surgupta-msft Mar 22, 2023
356b372
cleanup
surgupta-msft Mar 22, 2023
199e6cb
Cleanup
surgupta-msft Mar 23, 2023
379da90
Cleanup
surgupta-msft Mar 23, 2023
71e0be8
Cleanup execution flow
surgupta-msft Mar 23, 2023
ad21fb9
Added test
surgupta-msft Mar 23, 2023
6e14edf
Adding tests
surgupta-msft Apr 7, 2023
a398322
code cleanup
surgupta-msft Apr 7, 2023
df76646
Code cleanup
surgupta-msft Apr 7, 2023
bc9749f
code refactor
surgupta-msft Apr 7, 2023
0eb9b5f
Added logic to check type before sending to converter
surgupta-msft Apr 10, 2023
6630355
Updated tests
surgupta-msft Apr 10, 2023
15752e9
Removing advertised converters from options
surgupta-msft Apr 10, 2023
1ef5181
Adding options back
surgupta-msft Apr 11, 2023
63af451
Changes to check type
surgupta-msft Apr 13, 2023
29bcb97
updating type check logic
surgupta-msft Apr 14, 2023
dfac68e
correction in metadata generation
surgupta-msft Apr 14, 2023
359b38c
code cleanup
surgupta-msft Apr 17, 2023
7211f01
Test cleanup
surgupta-msft Apr 17, 2023
b565b45
Added changes to support poco
surgupta-msft Apr 18, 2023
478f7b9
Metadata generation changes
surgupta-msft Apr 18, 2023
0074cbd
Changes on Invocation side
surgupta-msft Apr 18, 2023
f06b7dd
correcting type check and tests
surgupta-msft Apr 18, 2023
e6b059f
Test for poco invocation support
surgupta-msft Apr 19, 2023
4f8431b
Added tests for poco invocation flows
surgupta-msft Apr 19, 2023
8f88495
Metadata generator minor update
surgupta-msft Apr 19, 2023
5af5a3d
Grpc definition update
surgupta-msft Apr 19, 2023
3aee9e6
Added poco and poco collection check
surgupta-msft Apr 19, 2023
321050d
cleanup metadata generation
surgupta-msft Apr 19, 2023
68b232a
Adding support for type collection
surgupta-msft Apr 21, 2023
ac548ee
Merge branch 'feature/sdk-type-binding' into surgupta/bypass-deferred…
surgupta-msft Apr 21, 2023
e8ebef0
code cleanup
surgupta-msft Apr 21, 2023
c6c922c
Fixing metadata gen
surgupta-msft Apr 21, 2023
b34e939
Test fix
surgupta-msft Apr 21, 2023
b4c9e17
Grpc definition fix
surgupta-msft Apr 22, 2023
54c1cee
Removing BlobContainerClient advertisement
surgupta-msft Apr 22, 2023
3323177
Readding containerclient
surgupta-msft Apr 22, 2023
12fd136
Updated metadata generator
surgupta-msft Apr 25, 2023
deed9ed
Changes as per latest design
surgupta-msft Apr 27, 2023
81f7712
code cleanup
surgupta-msft Apr 28, 2023
5ddcc76
updatin tests input
surgupta-msft Apr 28, 2023
78e4271
code cleanup
surgupta-msft May 1, 2023
02ec62f
Cleanup Metadata generation
surgupta-msft May 1, 2023
0a6468e
correcting converters fallback logic
surgupta-msft May 1, 2023
5073024
Removing converter advertisement on cosmos trigger
surgupta-msft May 1, 2023
0136fc7
Fixing failing test
surgupta-msft May 1, 2023
053b347
test check in
aishwaryabh May 1, 2023
f1dece6
Undo testing changes in sample app
surgupta-msft May 1, 2023
daa23fc
spacing fix
surgupta-msft May 1, 2023
e918fcd
updated tests
surgupta-msft May 2, 2023
4330c7d
non secret changes
aishwaryabh May 3, 2023
b8b89e0
Addressing PR feedback
surgupta-msft May 3, 2023
ef812c6
e2e test work
aishwaryabh May 4, 2023
eda9939
adding comments
aishwaryabh May 4, 2023
7ef0a40
Removed json deserialization attribute
surgupta-msft May 4, 2023
8391cf2
Rename to AllowConverterFallback
surgupta-msft May 4, 2023
bac43ab
Addressing feedback
surgupta-msft May 5, 2023
3971796
Metada generation cleanup
surgupta-msft May 5, 2023
b8507af
Test cleanup
surgupta-msft May 5, 2023
be00b04
Addressing feedback
surgupta-msft May 5, 2023
1780981
Updated grpcFunctionDefinition for multiple inputConverterAttribute
surgupta-msft May 5, 2023
f1bcde0
Removing cosmos converter registration
surgupta-msft May 5, 2023
6197db7
Address PR feedback
surgupta-msft May 5, 2023
9d803b7
Address PR feedback
surgupta-msft May 5, 2023
49e5d04
Test fix
surgupta-msft May 5, 2023
6d4978d
Minor
surgupta-msft May 5, 2023
ef81ba5
addressing comments
aishwaryabh May 8, 2023
863a085
adding deferred binding changes
aishwaryabh May 9, 2023
a610fc7
getting e2e working
aishwaryabh May 11, 2023
ad3a33c
Implement bypass deferred binding (#1462)
surgupta-msft May 12, 2023
e44e958
Rebase with base feautre branch
surgupta-msft May 13, 2023
aea37bc
Build issue fix
surgupta-msft May 13, 2023
b84b502
comments
aishwaryabh May 16, 2023
9528313
Update test/E2ETests/E2EApps/E2EApp/Table/TableInputBindingFunctions.cs
aishwaryabh May 16, 2023
a03cf63
Adding check for PR in yml file (#1546)
surgupta-msft May 18, 2023
4f03d50
addressing some more comments
aishwaryabh May 18, 2023
7e407df
Merge branch 'aibhandari/table-converter-legit' of https://github.com…
aishwaryabh May 18, 2023
8a84657
dependency
aishwaryabh May 18, 2023
2d1cbbd
one more dependency
aishwaryabh May 18, 2023
86d0a6c
trying to compile lol
aishwaryabh May 18, 2023
ee8cca4
seeing if tables project compiles with dependency
aishwaryabh May 18, 2023
5b8fe06
removing local instance
aishwaryabh May 18, 2023
702b4c6
see if this compiles
aishwaryabh May 18, 2023
df5430e
trying to remove test
aishwaryabh May 18, 2023
5ba7205
nvm adding it back
aishwaryabh May 18, 2023
625b2ba
adding keys to nuget.config
aishwaryabh May 19, 2023
07804eb
trying to get feed
aishwaryabh May 19, 2023
e07c983
trying again
aishwaryabh May 19, 2023
e753271
more yml
aishwaryabh May 19, 2023
561349e
fixing spacing
aishwaryabh May 19, 2023
1628a95
ci.yml
aishwaryabh May 22, 2023
14f203e
Add ability to bind to SBReceivedMessage (#1313)
JoshLove-msft May 22, 2023
a8e8897
another change
aishwaryabh May 22, 2023
eb6ac69
Merge branch 'feature/sdk-type-binding' into aibhandari/table-convert…
aishwaryabh May 22, 2023
43e5394
trying again
aishwaryabh May 22, 2023
ef088f7
Merge branch 'aibhandari/table-converter-legit' of https://github.com…
aishwaryabh May 22, 2023
eb2ae14
formatting changes
aishwaryabh May 22, 2023
6e52dc7
merging
aishwaryabh May 23, 2023
bbff7a9
changes
aishwaryabh May 23, 2023
7683684
updating worker.sdk package
aishwaryabh May 23, 2023
bcd3107
fixing unit test
aishwaryabh May 23, 2023
904d3e7
getting unit tests to pass
aishwaryabh May 24, 2023
276f803
fixing test
aishwaryabh May 24, 2023
b05e4af
release notes
aishwaryabh May 24, 2023
f4540ab
addressing comments
aishwaryabh May 24, 2023
7cccefa
changing cs proj version
aishwaryabh May 24, 2023
b08f877
changes
aishwaryabh May 24, 2023
270d7fd
fixing build error
aishwaryabh May 25, 2023
5656c0b
addressing comments
aishwaryabh May 25, 2023
0e6dc40
fix e2e test
aishwaryabh May 25, 2023
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
9 changes: 8 additions & 1 deletion DotNetWorker.sln
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Worker.Extensions.Kafka", "
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sdk.Analyzers", "sdk\Sdk.Analyzers\Sdk.Analyzers.csproj", "{055D602D-D2B3-416B-AC59-1972D832032A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sdk.Analyzers.Tests", "test\Sdk.Analyzers.Tests\Sdk.Analyzers.Tests\Sdk.Analyzers.Tests.csproj", "{A75EA1E1-2801-460C-87C0-DE6A82D30851}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sdk.Analyzers.Tests", "test\Sdk.Analyzers.Tests\Sdk.Analyzers.Tests.csproj", "{A75EA1E1-2801-460C-87C0-DE6A82D30851}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{083592CA-7DAB-44CE-8979-44FAFA46AEC3}"
EndProject
Expand Down Expand Up @@ -119,6 +119,8 @@ EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Worker.Extensions.Shared", "extensions\Worker.Extensions.Shared\Worker.Extensions.Shared.csproj", "{277D77B9-8915-41E3-8763-0B66328ADDDA}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WorkerBindingSamples", "samples\WorkerBindingSamples\WorkerBindingSamples.csproj", "{901DA3C3-3ABA-4859-89D3-63343ED2A0AC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WorkerExtensionTests", "test\WorkerExtensionTests\WorkerExtensionTests.csproj", "{17BDCE12-6964-4B87-B2AC-68CE270A3E9A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -293,6 +295,10 @@ Global
{901DA3C3-3ABA-4859-89D3-63343ED2A0AC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{901DA3C3-3ABA-4859-89D3-63343ED2A0AC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{901DA3C3-3ABA-4859-89D3-63343ED2A0AC}.Release|Any CPU.Build.0 = Release|Any CPU
{17BDCE12-6964-4B87-B2AC-68CE270A3E9A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{17BDCE12-6964-4B87-B2AC-68CE270A3E9A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{17BDCE12-6964-4B87-B2AC-68CE270A3E9A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{17BDCE12-6964-4B87-B2AC-68CE270A3E9A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -344,6 +350,7 @@ Global
{004DEF24-7EBB-499D-BD1C-E940AC4E122D} = {A7B4FF1E-3DF7-4F28-9333-D0961CDDF702}
{277D77B9-8915-41E3-8763-0B66328ADDDA} = {A7B4FF1E-3DF7-4F28-9333-D0961CDDF702}
{901DA3C3-3ABA-4859-89D3-63343ED2A0AC} = {9D6603BD-7EA2-4D11-A69C-0D9E01317FD6}
{17BDCE12-6964-4B87-B2AC-68CE270A3E9A} = {FD7243E4-BF18-43F8-8744-BA1D17ACF378}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {497D2ED4-A13E-4BCA-8D29-F30CA7D0EA4A}
Expand Down
20 changes: 10 additions & 10 deletions build/pipelines/templates/extensions-variables.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
variables:
${{ if not(contains(variables['Build.SourceBranch'], '/release/' )) }}:
buildNumberTemp: $(Build.BuildNumber)
${{ if contains(variables['Build.SourceBranch'], '/release/' ) }}:
isReleaseBuildTemp: true
buildNumber: $[variables.buildNumberTemp]
isReleaseBuild: $[variables.isReleaseBuildTemp]
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
variables:
${{ if and( not(contains(variables['Build.SourceBranch'], '/release/')), not(startsWith(variables['Build.SourceBranch'], 'refs/tags')) ) }}:
buildNumberTemp: $(Build.BuildNumber)
${{ if or( contains(variables['Build.SourceBranch'], '/release/'), startsWith(variables['Build.SourceBranch'], 'refs/tags') ) }}:
isReleaseBuildTemp: true
buildNumber: $[variables.buildNumberTemp]
isReleaseBuild: $[variables.isReleaseBuildTemp]
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
26 changes: 26 additions & 0 deletions docs/analyzer-rules/AZFW0009.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# AZFW0009: Invalid use of SupportsDeferredBinding attribute

| | Value |
|-|-|
| **Rule ID** |AZFW0009|
| **Category** |[Usage]|
| **Severity** |Error|

## Cause

This rule is triggered when the `SupportsDeferredBinding` attribute is used on any class other
than an input (`InputBindingAttribute`) or trigger (`TriggerBindingAttribute`) binding based class.

## Rule description

The `SupportsDeferredBinding` attribute is used to determine if a binding supports deferred binding.
Currently, this feature is only supported for input and trigger bindings. Output bindings are not supported
and this attribute should not be used on any other class type.

## How to fix violations

Remove the use of the `SupportsDeferredBinding` attribute from your class.

## When to suppress warnings

This rule should not be suppressed because this error may prevent your Azure Functions from running.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using System;

namespace Microsoft.Azure.Functions.Worker.Extensions.Abstractions
{
/// <summary>
/// Specifies if a converter supports deferred binding when generating function metadata.
/// This is to be used on converters that support deferred binding.
/// </summary>
[AttributeUsage(AttributeTargets.Class)]
public class SupportsDeferredBindingAttribute : Attribute
{
}
}
3 changes: 2 additions & 1 deletion extensions/Worker.Extensions.CosmosDB/release_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
<!-- Please add your release notes in the following format:
- My change description (#PR/#issue)
-->
- Fixed incorrect type of CosmosDBTriggerAttribute's `StartFromTime` property.

- Add support for SDK-type bindings via deferred binding feature (#1406)
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using System;
using System.Collections.Concurrent;
using Azure.Core;
using Microsoft.Azure.Cosmos;
using Microsoft.Azure.Functions.Worker.Extensions.CosmosDB;

namespace Microsoft.Azure.Functions.Worker
{
internal class CosmosDBBindingOptions
{
public string? ConnectionString { get; set; }

public string? AccountEndpoint { get; set; }

public TokenCredential? Credential { get; set; }

internal string BuildCacheKey(string connectionString, string region) => $"{connectionString}|{region}";
internal ConcurrentDictionary<string, CosmosClient> ClientCache { get; } = new ConcurrentDictionary<string, CosmosClient>();

internal virtual CosmosClient GetClient(string connection, string preferredLocations = "")
{
if (string.IsNullOrEmpty(connection))
{
throw new ArgumentNullException(nameof(connection));
}

string cacheKey = BuildCacheKey(connection, preferredLocations);

CosmosClientOptions cosmosClientOptions = new ()
{
ConnectionMode = ConnectionMode.Gateway
};

if (!string.IsNullOrEmpty(preferredLocations))
{
cosmosClientOptions.ApplicationPreferredRegions = Utilities.ParsePreferredLocations(preferredLocations);
}

return ClientCache.GetOrAdd(cacheKey, (c) => CreateService(cosmosClientOptions));
}

private CosmosClient CreateService(CosmosClientOptions cosmosClientOptions)
{
return string.IsNullOrEmpty(ConnectionString)
? new CosmosClient(AccountEndpoint, Credential, cosmosClientOptions) // AAD auth
: new CosmosClient(ConnectionString, cosmosClientOptions); // Connection string based auth
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using System;
using Microsoft.Azure.Functions.Worker.Extensions;
using Microsoft.Azure.Functions.Worker.Extensions.CosmosDB;
using Microsoft.Extensions.Azure;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Options;

namespace Microsoft.Azure.Functions.Worker
{
internal class CosmosDBBindingOptionsSetup : IConfigureNamedOptions<CosmosDBBindingOptions>
{
private readonly IConfiguration _configuration;
private readonly AzureComponentFactory _componentFactory;

public CosmosDBBindingOptionsSetup(IConfiguration configuration, AzureComponentFactory componentFactory)
{
_configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
_componentFactory = componentFactory ?? throw new ArgumentNullException(nameof(componentFactory));
}

public void Configure(CosmosDBBindingOptions options)
{
Configure(Options.DefaultName, options);
}

public void Configure(string name, CosmosDBBindingOptions options)
{
IConfigurationSection connectionSection = _configuration.GetWebJobsConnectionStringSection(name);

if (!connectionSection.Exists())
{
throw new InvalidOperationException($"Cosmos DB connection configuration '{name}' does not exist. " +
"Make sure that it is a defined App Setting.");
}

if (!string.IsNullOrWhiteSpace(connectionSection.Value))
{
options.ConnectionString = connectionSection.Value;
}
else
{
options.AccountEndpoint = connectionSection[Constants.AccountEndpoint];
if (string.IsNullOrWhiteSpace(options.AccountEndpoint))
{
throw new InvalidOperationException($"Connection should have an '{Constants.AccountEndpoint}' property or be a " +
$"string representing a connection string.");
}

options.Credential = _componentFactory.CreateTokenCredential(connectionSection);
}
}
}
}
15 changes: 15 additions & 0 deletions extensions/Worker.Extensions.CosmosDB/src/Constants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

namespace Microsoft.Azure.Functions.Worker.Extensions.CosmosDB
{
internal static class Constants
{
internal const string CosmosExtensionName = "CosmosDB";
internal const string ConfigurationSectionName = "AzureWebJobs";
internal const string ConnectionStringsSectionName = "ConnectionStrings";
internal const string AccountEndpoint = "accountEndpoint";
internal const string JsonContentType = "application/json";
}
}
Loading