From f29c691a5dd9472fc6d119da2dbbdd56324e6977 Mon Sep 17 00:00:00 2001
From: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>
Date: Tue, 1 Dec 2020 15:29:23 -0800
Subject: [PATCH] CloudNative.CloudEvents bridge library (#17234)
* CloudNative.CloudEvents bridge library
* PR fb
* Fix NUnit casing
* Export API
---
eng/.docsettings.yml | 1 +
eng/Packages.Data.props | 1 +
.../Azure.Messaging.EventGrid.sln | 12 ++
...zure.Messaging.EventGrid.netstandard2.0.cs | 4 +
.../Customization/EventGridPublisherClient.cs | 142 +++++++++++++-----
.../CHANGELOG.md | 7 +
.../Directory.Build.props | 7 +
.../README.md | 48 ++++++
...d.CloudNativeCloudEvents.netstandard2.0.cs | 8 +
.../src/EventGridPublisherClientExtensions.cs | 101 +++++++++++++
...ng.EventGrid.CloudNativeCloudEvents.csproj | 21 +++
.../tests/CloudEventTests.cs | 129 ++++++++++++++++
.../tests/CloudNativeLiveTests.cs | 64 ++++++++
...ntGrid.CloudNativeCloudEvents.Tests.csproj | 25 +++
.../CanPublishCloudEvent.json | 37 +++++
.../CanPublishCloudEventAsync.json | 37 +++++
16 files changed, 603 insertions(+), 41 deletions(-)
create mode 100644 sdk/eventgrid/Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents/CHANGELOG.md
create mode 100644 sdk/eventgrid/Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents/Directory.Build.props
create mode 100644 sdk/eventgrid/Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents/README.md
create mode 100644 sdk/eventgrid/Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents/api/Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents.netstandard2.0.cs
create mode 100644 sdk/eventgrid/Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents/src/EventGridPublisherClientExtensions.cs
create mode 100644 sdk/eventgrid/Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents/src/Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents.csproj
create mode 100644 sdk/eventgrid/Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents/tests/CloudEventTests.cs
create mode 100644 sdk/eventgrid/Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents/tests/CloudNativeLiveTests.cs
create mode 100644 sdk/eventgrid/Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents/tests/Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents.Tests.csproj
create mode 100644 sdk/eventgrid/Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents/tests/SessionRecords/CloudNativeLiveTests/CanPublishCloudEvent.json
create mode 100644 sdk/eventgrid/Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents/tests/SessionRecords/CloudNativeLiveTests/CanPublishCloudEventAsync.json
diff --git a/eng/.docsettings.yml b/eng/.docsettings.yml
index 9048aab2e49d2..49ec02099f58d 100644
--- a/eng/.docsettings.yml
+++ b/eng/.docsettings.yml
@@ -148,6 +148,7 @@ known_content_issues:
- ['sdk/extensions/Azure.Extensions.AspNetCore.Configuration.Secrets/README.md', 'azure-sdk-tools/issues/404']
- ['sdk/extensions/Microsoft.Azure.WebJobs.Extensions.Clients/README.md','azure-sdk-tools/issues/404']
- ['sdk/extensions/Microsoft.Extensions.Azure/README.md','#5499']
+ - ['sdk/eventgrid/Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents/README.md', '#15423']
- ['sdk/eventhub/README.md','azure-sdk-tools/issues/42']
- ['sdk/search/README.md','azure-sdk-tools/issues/42']
- ['sdk/formrecognizer/Azure.AI.FormRecognizer/README.md','#5499']
diff --git a/eng/Packages.Data.props b/eng/Packages.Data.props
index 7cef773fe2789..39cb864836ae5 100644
--- a/eng/Packages.Data.props
+++ b/eng/Packages.Data.props
@@ -32,6 +32,7 @@
+
diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid/Azure.Messaging.EventGrid.sln b/sdk/eventgrid/Azure.Messaging.EventGrid/Azure.Messaging.EventGrid.sln
index 2474f9baa6cad..f7da22ebd0d86 100644
--- a/sdk/eventgrid/Azure.Messaging.EventGrid/Azure.Messaging.EventGrid.sln
+++ b/sdk/eventgrid/Azure.Messaging.EventGrid/Azure.Messaging.EventGrid.sln
@@ -13,6 +13,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Core.Experimental", "
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Core", "..\..\core\Azure.Core\src\Azure.Core.csproj", "{21CF4B4A-5027-46D0-B50A-976BF8483095}"
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents", "..\Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents\src\Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents.csproj", "{A24C8A1C-B6A0-4F50-A690-9B1D3DF9228C}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents.Tests", "..\Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents\tests\Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents.Tests.csproj", "{28B77D76-084F-4C7E-8A1B-631444EED6A2}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -39,6 +43,14 @@ Global
{21CF4B4A-5027-46D0-B50A-976BF8483095}.Debug|Any CPU.Build.0 = Debug|Any CPU
{21CF4B4A-5027-46D0-B50A-976BF8483095}.Release|Any CPU.ActiveCfg = Release|Any CPU
{21CF4B4A-5027-46D0-B50A-976BF8483095}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A24C8A1C-B6A0-4F50-A690-9B1D3DF9228C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A24C8A1C-B6A0-4F50-A690-9B1D3DF9228C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A24C8A1C-B6A0-4F50-A690-9B1D3DF9228C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A24C8A1C-B6A0-4F50-A690-9B1D3DF9228C}.Release|Any CPU.Build.0 = Release|Any CPU
+ {28B77D76-084F-4C7E-8A1B-631444EED6A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {28B77D76-084F-4C7E-8A1B-631444EED6A2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {28B77D76-084F-4C7E-8A1B-631444EED6A2}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {28B77D76-084F-4C7E-8A1B-631444EED6A2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid/api/Azure.Messaging.EventGrid.netstandard2.0.cs b/sdk/eventgrid/Azure.Messaging.EventGrid/api/Azure.Messaging.EventGrid.netstandard2.0.cs
index 52dba42fda0a7..33bf6722ffe1a 100644
--- a/sdk/eventgrid/Azure.Messaging.EventGrid/api/Azure.Messaging.EventGrid.netstandard2.0.cs
+++ b/sdk/eventgrid/Azure.Messaging.EventGrid/api/Azure.Messaging.EventGrid.netstandard2.0.cs
@@ -49,6 +49,10 @@ public EventGridPublisherClient(System.Uri endpoint, Azure.AzureKeyCredential cr
public EventGridPublisherClient(System.Uri endpoint, Azure.Messaging.EventGrid.EventGridSharedAccessSignatureCredential credential) { }
public EventGridPublisherClient(System.Uri endpoint, Azure.Messaging.EventGrid.EventGridSharedAccessSignatureCredential credential, Azure.Messaging.EventGrid.EventGridPublisherClientOptions options) { }
public static string BuildSharedAccessSignature(System.Uri endpoint, System.DateTimeOffset expirationUtc, Azure.AzureKeyCredential key, Azure.Messaging.EventGrid.EventGridPublisherClientOptions.ServiceVersion apiVersion = Azure.Messaging.EventGrid.EventGridPublisherClientOptions.ServiceVersion.V2018_01_01) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public virtual Azure.Response SendEncodedCloudEvents(System.ReadOnlyMemory cloudEvents, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public virtual System.Threading.Tasks.Task SendEncodedCloudEventsAsync(System.ReadOnlyMemory cloudEvents, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response SendEvents(System.Collections.Generic.IEnumerable events, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response SendEvents(System.Collections.Generic.IEnumerable events, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response SendEvents(System.Collections.Generic.IEnumerable