Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using System;
Comment thread
aishwaryabh marked this conversation as resolved.
using System.Globalization;
using Microsoft.Extensions.Configuration;

namespace Microsoft.Azure.Functions.Worker.Extensions
Expand Down Expand Up @@ -30,6 +32,45 @@ internal static IConfigurationSection GetWebJobsConnectionStringSection(this ICo
return section;
}

/// <summary>
/// Either constructs the serviceUri from the provided accountName
/// or retrieves the serviceUri for the specific resource (i.e. blobServiceUri or queueServiceUri)
/// </summary>
/// <param name="configuration">configuration section for a given connection name </param>
/// <param name="subDomain">The subdomain of the serviceUri (i.e. blob, queue, table)</param>
/// <param name="serviceUri">The serviceUri for the specific resource (i.e. blobServiceUri or queueServiceUri)</param>
internal static bool TryGetServiceUriForStorageAccounts(this IConfiguration configuration, string subDomain, out Uri serviceUri)
{
if (subDomain is null)
{
throw new ArgumentNullException(nameof(subDomain));
}
var serviceUriConfig = string.Format(CultureInfo.InvariantCulture, "{0}ServiceUri", subDomain);
Comment thread
aishwaryabh marked this conversation as resolved.
Comment thread
aishwaryabh marked this conversation as resolved.

if (configuration.GetValue<string>("accountName") is { } accountName)
{
serviceUri = FormatServiceUri(accountName, subDomain);
return true;
}
else if (configuration.GetValue<string>($"{subDomain}ServiceUri") is { } uriStr)
{
serviceUri = new Uri(uriStr);
return true;
}

serviceUri = default(Uri)!;
return false;
}

/// <summary>
/// Generates the serviceUri for a particular storage resource
/// </summary>
private static Uri FormatServiceUri(string accountName, string subDomain, string defaultProtocol = "https", string endpointSuffix = "core.windows.net")
{
var uri = string.Format(CultureInfo.InvariantCulture, "{0}://{1}.{2}.{3}", defaultProtocol, accountName, subDomain, endpointSuffix);
return new Uri(uri);
}

/// <summary>
/// Creates a WebJobs specific prefixed string using a given connection name.
/// </summary>
Expand Down Expand Up @@ -58,4 +99,4 @@ private static IConfigurationSection GetConnectionStringOrSetting(this IConfigur
return configuration.GetSection(connectionName);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using System;
Expand Down Expand Up @@ -52,7 +52,7 @@ public void Configure(string name, BlobStorageBindingOptions options)
}
else
{
if (TryGetServiceUri(connectionSection, out Uri serviceUri))
if (connectionSection.TryGetServiceUriForStorageAccounts(BlobServiceUriSubDomain, out Uri serviceUri))
{
options.ServiceUri = serviceUri;
}
Expand All @@ -61,39 +61,5 @@ public void Configure(string name, BlobStorageBindingOptions options)
options.BlobClientOptions = (BlobClientOptions)_componentFactory.CreateClientOptions(typeof(BlobClientOptions), null, connectionSection);
options.Credential = _componentFactory.CreateTokenCredential(connectionSection);
}

/// <summary>
/// Either constructs the serviceUri from the provided accountName
/// or retrieves the serviceUri for the specific resource (i.e. blobServiceUri or queueServiceUri)
/// </summary>
private bool TryGetServiceUri(IConfiguration configuration, out Uri serviceUri)
Comment thread
aishwaryabh marked this conversation as resolved.
{
var serviceUriConfig = string.Format(CultureInfo.InvariantCulture, "{0}ServiceUri", BlobServiceUriSubDomain);

string accountName;
string uriStr;
if ((accountName = configuration.GetValue<string>("accountName")) is not null)
{
serviceUri = FormatServiceUri(accountName);
return true;
}
else if ((uriStr = configuration.GetValue<string>(serviceUriConfig)) is not null)
{
serviceUri = new Uri(uriStr);
return true;
}

serviceUri = default(Uri)!;
return false;
}

/// <summary>
/// Generates the serviceUri for a particular storage resource
/// </summary>
private Uri FormatServiceUri(string accountName, string defaultProtocol = "https", string endpointSuffix = "core.windows.net")
{
var uri = string.Format(CultureInfo.InvariantCulture, "{0}://{1}.{2}.{3}", defaultProtocol, accountName, BlobServiceUriSubDomain, endpointSuffix);
return new Uri(uri);
}
}
}
}
2 changes: 1 addition & 1 deletion extensions/Worker.Extensions.Tables/release_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@

### Microsoft.Azure.Functions.Worker.Extensions.Tables <version>

- <entry>
- Add abiility to bind table input to TableClient, TableEntity, and IEnumerable<TableEntity> (#1470)
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// 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 Azure.Core;
using Azure.Data.Tables;

namespace Microsoft.Azure.Functions.Worker.Extensions.Tables.Config
{
internal class TablesBindingOptions
{
public string? ConnectionString { get; set; }

public Uri? ServiceUri { get; set; }

public TokenCredential? Credential { get; set; }

public TableClientOptions? TableClientOptions { get; set; }

private TableServiceClient? TableServiceClient;

internal virtual TableServiceClient CreateClient()
{
if (ConnectionString is null && ServiceUri is null)
{
throw new ArgumentNullException(nameof(ConnectionString) + " " + nameof(ServiceUri));
}

if (TableServiceClient is not null)
{
return TableServiceClient;
}

TableServiceClient = !string.IsNullOrEmpty(ConnectionString)
? new TableServiceClient(ConnectionString, TableClientOptions) // Connection string based auth;
: new TableServiceClient(ServiceUri, Credential, TableClientOptions); // AAD auth

return TableServiceClient;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
using System;
using Azure.Data.Tables;
using Microsoft.Extensions.Azure;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Options;

namespace Microsoft.Azure.Functions.Worker.Extensions.Tables.Config
{
internal class TablesBindingOptionsSetup : IConfigureNamedOptions<TablesBindingOptions>
{
private readonly IConfiguration _configuration;
private readonly AzureComponentFactory _componentFactory;

private const string TablesServiceUriSubDomain = "table";

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

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

public void Configure(string name, TablesBindingOptions options)
{
if (string.IsNullOrWhiteSpace(name))
{
name = Constants.Storage; // default
}

IConfigurationSection connectionSection = _configuration.GetWebJobsConnectionStringSection(name);

if (!connectionSection.Exists())
{
// Not found
throw new InvalidOperationException($"Tables 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
{
if (connectionSection.TryGetServiceUriForStorageAccounts(TablesServiceUriSubDomain, out Uri serviceUri))
{
options.ServiceUri = serviceUri;
}
}

options.TableClientOptions = (TableClientOptions)_componentFactory.CreateClientOptions(typeof(TableClientOptions), null, connectionSection);
Comment thread
aishwaryabh marked this conversation as resolved.
options.Credential = _componentFactory.CreateTokenCredential(connectionSection);
}
}
}
20 changes: 20 additions & 0 deletions extensions/Worker.Extensions.Tables/src/Constants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace Microsoft.Azure.Functions.Worker.Extensions.Tables
{
internal class Constants
{
internal const string Storage = "Storage";
internal const string TablesExtensionName = "AzureStorageTables";
internal const string TableName = "TableName";
internal const string PartitionKey = "PartitionKey";
internal const string RowKey = "RowKey";
internal const string Connection = "Connection";
internal const string Take = "Take";
internal const string Filter = "Filter";
// Media content types
internal const string JsonContentType = "application/json";
}
}
7 changes: 7 additions & 0 deletions extensions/Worker.Extensions.Tables/src/Nuget.config
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>
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using Microsoft.Azure.Functions.Worker.Extensions.Abstractions;
using System.Runtime.CompilerServices;
using Microsoft.Azure.Functions.Worker.Extensions.Abstractions;

[assembly: ExtensionInformation("Microsoft.Azure.WebJobs.Extensions.Tables", "1.0.0")]
[assembly: ExtensionInformation("Microsoft.Azure.WebJobs.Extensions.Tables", "1.2.0-beta.1")]
[assembly: InternalsVisibleTo("Microsoft.Azure.Functions.WorkerExtension.Tests, PublicKey=00240000048000009400000006020000002400005253413100040000010001005148be37ac1d9f58bd40a2e472c9d380d635b6048278f7d47480b08c928858f0f7fe17a6e4ce98da0e7a7f0b8c308aecd9e9b02d7e9680a5b5b75ac7773cec096fbbc64aebd429e77cb5f89a569a79b28e9c76426783f624b6b70327eb37341eb498a2c3918af97c4860db6cdca4732787150841e395a29cfacb959c1fd971c1")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")]
Comment thread
aishwaryabh marked this conversation as resolved.
36 changes: 36 additions & 0 deletions extensions/Worker.Extensions.Tables/src/TableExtensionStartup.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// 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;
using Microsoft.Azure.Functions.Worker.Core;
using Microsoft.Azure.Functions.Worker.Extensions.Tables.Config;
using Microsoft.Extensions.Azure;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;

[assembly: WorkerExtensionStartup(typeof(TableExtensionStartup))]

namespace Microsoft.Azure.Functions.Worker
{
/// <summary>
/// Table extension startup.
/// </summary>
public class TableExtensionStartup : WorkerExtensionStartup
{
/// <summary>
/// Configure table extension startup.
/// </summary>
public override void Configure(IFunctionsWorkerApplicationBuilder applicationBuilder)
{
if (applicationBuilder == null)
{
throw new ArgumentNullException(nameof(applicationBuilder));
}

applicationBuilder.Services.AddAzureClientsCore(); // Adds AzureComponentFactory
applicationBuilder.Services.AddOptions<TablesBindingOptions>();
applicationBuilder.Services.AddSingleton<IConfigureOptions<TablesBindingOptions>, TablesBindingOptionsSetup>();
}
}
}
17 changes: 17 additions & 0 deletions extensions/Worker.Extensions.Tables/src/TableInputAttribute.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using Microsoft.Azure.Functions.Worker.Converters;
using Microsoft.Azure.Functions.Worker.Extensions.Abstractions;
using Microsoft.Azure.Functions.Worker.Extensions.Tables.TypeConverters;

namespace Microsoft.Azure.Functions.Worker
{
/// <summary>
/// Attribute used to configure a parameter as the input target for the Azure Storage Tables binding.
/// </summary>
[AllowConverterFallback(true)]
[InputConverter(typeof(TableClientConverter))]
[InputConverter(typeof(TableEntityConverter))]
[InputConverter(typeof(TableEntityEnumerableConverter))]
public class TableInputAttribute : InputBindingAttribute
{
/// <summary>Initializes a new instance of the <see cref="TableInputAttribute"/> class.</summary>
Expand Down Expand Up @@ -37,6 +43,17 @@ public TableInputAttribute(string tableName, string partitionKey, string rowKey)
RowKey = rowKey;
}

/// <summary>Initializes a new instance of the <see cref="TableInputAttribute"/> class.</summary>
/// <param name="tableName">The name of the table containing the entity.</param>
/// <param name="partitionKey">The partition key of the entity.</param>
/// <param name="take">The number of entities to return </param>
public TableInputAttribute(string tableName, string partitionKey, int take)
{
TableName = tableName;
PartitionKey = partitionKey;
Take = take;
}

/// <summary>Gets the name of the table to which to bind.</summary>
/// <remarks>When binding to a table entity, gets the name of the table containing the entity.</remarks>
public string TableName { get; }
Expand Down
Loading