Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
33 changes: 17 additions & 16 deletions DirectConnector/AzureBlobFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
//------------------------------------------------------------

using System.Net;
using Microsoft.Azure.Connectors.DirectClient.Azureblob;
using Azure.Connectors.Sdk.AzureBlob;

Check failure on line 6 in DirectConnector/AzureBlobFunctions.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

The type or namespace name 'Connectors' does not exist in the namespace 'Azure' (are you missing an assembly reference?)
using Azure.Connectors.Sdk.AzureBlob.Models;

Check failure on line 7 in DirectConnector/AzureBlobFunctions.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

The type or namespace name 'Connectors' does not exist in the namespace 'Azure' (are you missing an assembly reference?)
using Microsoft.Azure.Connectors.Sdk;
using Microsoft.Azure.Functions.Worker;
using Microsoft.Azure.Functions.Worker.Http;
Expand All @@ -13,7 +14,7 @@

/// <summary>
/// Azure Functions demonstrating Azure Blob Storage operations using the generated
/// <see cref="AzureblobClient"/> from the DirectClient SDK.
/// <see cref="AzureBlobClient"/> from the DirectClient SDK.
/// </summary>
/// <remarks>
/// Azure Blob Storage uses key-based auth (accountName + accessKey), not OAuth.
Expand All @@ -22,26 +23,26 @@
public class AzureBlobFunctions
{
private readonly ILogger<AzureBlobFunctions> _logger;
private readonly AzureblobClient _azureBlobClient;
private readonly AzureBlobClient _azureBlobClient;

public AzureBlobFunctions(
ILogger<AzureBlobFunctions> logger,
AzureblobClient azureBlobClient)
AzureBlobClient azureBlobClient)
{
this._logger = logger;
this._azureBlobClient = azureBlobClient;
}

/// <summary>
/// Gets blob metadata using the generated <see cref="AzureblobClient"/>.
/// Gets blob metadata using the generated <see cref="AzureBlobClient"/>.
/// Exercises the <see cref="DataWithSensitivityLabelInfo"/> response type.
/// </summary>
[Function("GetBlobMetadata")]
public async Task<HttpResponseData> GetBlobMetadataAsync(
[HttpTrigger(AuthorizationLevel.Function, "get", Route = "blob/metadata")] HttpRequestData request,
CancellationToken cancellationToken)
{
this._logger.LogInformation("GetBlobMetadata: Using generated AzureblobClient.");
this._logger.LogInformation("GetBlobMetadata: Using generated AzureBlobClient.");

var storageAccount = request.Query["account"];
var blobPath = request.Query["path"];
Expand Down Expand Up @@ -71,7 +72,7 @@
.ConfigureAwait(continueOnCapturedContext: false);
return response;
}
catch (AzureblobConnectorException ex)
catch (AzureBlobConnectorException ex)
{
this._logger.LogError(ex, "Azure Blob connector error: '{StatusCode}'.", ex.StatusCode);

Expand All @@ -94,15 +95,15 @@
}

/// <summary>
/// Downloads blob content using the generated <see cref="AzureblobClient"/>.
/// Downloads blob content using the generated <see cref="AzureBlobClient"/>.
/// Exercises the byte[] return path.
/// </summary>
[Function("DownloadBlob")]
public async Task<HttpResponseData> DownloadBlobAsync(
[HttpTrigger(AuthorizationLevel.Function, "get", Route = "blob/download")] HttpRequestData request,
CancellationToken cancellationToken)
{
this._logger.LogInformation("DownloadBlob: Using generated AzureblobClient byte[] response path.");
this._logger.LogInformation("DownloadBlob: Using generated AzureBlobClient byte[] response path.");

var storageAccount = request.Query["account"];
var blobPath = request.Query["path"];
Expand Down Expand Up @@ -140,7 +141,7 @@

return response;
}
catch (AzureblobConnectorException ex)
catch (AzureBlobConnectorException ex)
{
this._logger.LogError(ex, "Azure Blob connector error: '{StatusCode}'.", ex.StatusCode);

Expand All @@ -163,15 +164,15 @@
}

/// <summary>
/// Uploads a blob using the generated <see cref="AzureblobClient"/>.
/// Uploads a blob using the generated <see cref="AzureBlobClient"/>.
/// Exercises the byte[] input path with <see cref="BlobMetadata"/> response.
/// </summary>
[Function("UploadBlob")]
public async Task<HttpResponseData> UploadBlobAsync(
[HttpTrigger(AuthorizationLevel.Function, "post", Route = "blob/upload")] HttpRequestData request,
CancellationToken cancellationToken)
{
this._logger.LogInformation("UploadBlob: Using generated AzureblobClient.");
this._logger.LogInformation("UploadBlob: Using generated AzureBlobClient.");

var storageAccount = request.Query["account"];
var folder = request.Query["folder"];
Expand Down Expand Up @@ -210,7 +211,7 @@
.ConfigureAwait(continueOnCapturedContext: false);
return response;
}
catch (AzureblobConnectorException ex)
catch (AzureBlobConnectorException ex)
{
this._logger.LogError(ex, "Azure Blob connector error: '{StatusCode}'.", ex.StatusCode);

Expand All @@ -233,15 +234,15 @@
}

/// <summary>
/// Deletes a blob using the generated <see cref="AzureblobClient"/>.
/// Deletes a blob using the generated <see cref="AzureBlobClient"/>.
/// Exercises the void (no response body) path.
/// </summary>
[Function("DeleteBlob")]
public async Task<HttpResponseData> DeleteBlobAsync(
[HttpTrigger(AuthorizationLevel.Function, "delete", Route = "blob/delete")] HttpRequestData request,
CancellationToken cancellationToken)
{
this._logger.LogInformation("DeleteBlob: Using generated AzureblobClient.");
this._logger.LogInformation("DeleteBlob: Using generated AzureBlobClient.");

var storageAccount = request.Query["account"];
var blobId = request.Query["id"];
Expand Down Expand Up @@ -271,7 +272,7 @@
.ConfigureAwait(continueOnCapturedContext: false);
return response;
}
catch (AzureblobConnectorException ex)
catch (AzureBlobConnectorException ex)
{
this._logger.LogError(ex, "Azure Blob connector error: '{StatusCode}'.", ex.StatusCode);

Expand Down
43 changes: 23 additions & 20 deletions DirectConnector/ConnectorFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,22 @@
using System.Net;
using System.Text;
using System.Text.Json;
using Microsoft.Azure.Connectors.DirectClient.Office365;
using Microsoft.Azure.Connectors.DirectClient.Sharepointonline;
using Microsoft.Azure.Connectors.DirectClient.Teams;
using Azure.Connectors.Sdk.Office365;

Check failure on line 8 in DirectConnector/ConnectorFunctions.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

The type or namespace name 'Connectors' does not exist in the namespace 'Azure' (are you missing an assembly reference?)
using Azure.Connectors.Sdk.Office365.Models;

Check failure on line 9 in DirectConnector/ConnectorFunctions.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

The type or namespace name 'Connectors' does not exist in the namespace 'Azure' (are you missing an assembly reference?)
using Azure.Connectors.Sdk.SharePointOnline;

Check failure on line 10 in DirectConnector/ConnectorFunctions.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

The type or namespace name 'Connectors' does not exist in the namespace 'Azure' (are you missing an assembly reference?)
using Azure.Connectors.Sdk.SharePointOnline.Models;

Check failure on line 11 in DirectConnector/ConnectorFunctions.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

The type or namespace name 'Connectors' does not exist in the namespace 'Azure' (are you missing an assembly reference?)
using Azure.Connectors.Sdk.Teams;

Check failure on line 12 in DirectConnector/ConnectorFunctions.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

The type or namespace name 'Connectors' does not exist in the namespace 'Azure' (are you missing an assembly reference?)
using Azure.Connectors.Sdk.Teams.Models;

Check failure on line 13 in DirectConnector/ConnectorFunctions.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

The type or namespace name 'Connectors' does not exist in the namespace 'Azure' (are you missing an assembly reference?)
using Microsoft.Azure.Connectors.Sdk;
using Microsoft.Azure.Functions.Worker;
using Microsoft.Azure.Functions.Worker.Http;
using Microsoft.Extensions.Logging;
using SharePointBlobMetadata = Microsoft.Azure.Connectors.DirectClient.Sharepointonline.BlobMetadata;
using SharePointBlobMetadata = Azure.Connectors.Sdk.SharePointOnline.Models.BlobMetadata;

Check failure on line 18 in DirectConnector/ConnectorFunctions.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

The type or namespace name 'Connectors' does not exist in the namespace 'Azure' (are you missing an assembly reference?)

namespace DirectConnector;

/// <summary>
/// Azure Functions that use the generated <see cref="Office365Client"/>, <see cref="SharepointonlineClient"/>,
/// Azure Functions that use the generated <see cref="Office365Client"/>, <see cref="SharePointOnlineClient"/>,
/// and <see cref="TeamsClient"/> from the DirectClient SDK.
/// </summary>
/// <remarks>
Expand Down Expand Up @@ -56,7 +59,7 @@

private readonly ILogger<ConnectorFunctions> _logger;
private readonly Office365Client _office365Client;
private readonly SharepointonlineClient _sharePointClient;
private readonly SharePointOnlineClient _sharePointClient;
private readonly TeamsClient _teamsClient;

/// <summary>
Expand All @@ -69,7 +72,7 @@
public ConnectorFunctions(
ILogger<ConnectorFunctions> logger,
Office365Client office365Client,
SharepointonlineClient sharePointClient,
SharePointOnlineClient sharePointClient,
TeamsClient teamsClient)
{
this._logger = logger;
Expand Down Expand Up @@ -246,7 +249,7 @@
}

/// <summary>
/// Gets all SharePoint lists and libraries for a site using the generated <see cref="SharepointonlineClient"/>.
/// Gets all SharePoint lists and libraries for a site using the generated <see cref="SharePointOnlineClient"/>.
/// </summary>
/// <param name="request">The HTTP request containing the site address.</param>
/// <param name="cancellationToken">The cancellation token.</param>
Expand All @@ -255,7 +258,7 @@
[HttpTrigger(AuthorizationLevel.Function, "get", Route = "sharepoint/lists")] HttpRequestData request,
CancellationToken cancellationToken)
{
this._logger.LogInformation("GetSharePointLists: Using generated SharepointonlineClient from SDK.");
this._logger.LogInformation("GetSharePointLists: Using generated SharePointOnlineClient from SDK.");

var siteAddress = request.Query["site"];
if (string.IsNullOrEmpty(siteAddress))
Expand Down Expand Up @@ -290,7 +293,7 @@

return response;
}
catch (SharepointonlineConnectorException ex)
catch (SharePointOnlineConnectorException ex)
{
this._logger.LogError(ex, "SharePoint connector error: '{StatusCode}'.", ex.StatusCode);

Expand Down Expand Up @@ -325,7 +328,7 @@
}

/// <summary>
/// Lists files in a SharePoint folder using the generated <see cref="SharepointonlineClient"/>.
/// Lists files in a SharePoint folder using the generated <see cref="SharePointOnlineClient"/>.
/// </summary>
/// <remarks>
/// Exercises the <see cref="SharePointBlobMetadata"/> model for folder browsing.
Expand All @@ -337,7 +340,7 @@
[HttpTrigger(AuthorizationLevel.Function, "get", Route = "sharepoint/files")] HttpRequestData request,
CancellationToken cancellationToken)
{
this._logger.LogInformation("ListFolder: Using generated SharepointonlineClient from SDK.");
this._logger.LogInformation("ListFolder: Using generated SharePointOnlineClient from SDK.");

var siteAddress = request.Query["site"];
if (string.IsNullOrEmpty(siteAddress))
Expand Down Expand Up @@ -386,7 +389,7 @@

return response;
}
catch (SharepointonlineConnectorException ex)
catch (SharePointOnlineConnectorException ex)
{
this._logger.LogError(ex, "SharePoint connector error: '{StatusCode}'.", ex.StatusCode);

Expand Down Expand Up @@ -420,7 +423,7 @@
/// Downloads file content from SharePoint as binary bytes.
/// </summary>
/// <remarks>
/// Exercises the <c>byte[]</c> response path in <see cref="SharepointonlineClient.GetFileContentByPathAsync"/>.
/// Exercises the <c>byte[]</c> response path in <see cref="SharePointOnlineClient.GetFileContentByPathAsync"/>.
/// The generated <c>CallConnectorAsync</c> detects <c>byte[]</c> as the response type and uses
/// <c>ReadAsByteArrayAsync</c> instead of JSON deserialization.
/// </remarks>
Expand All @@ -431,7 +434,7 @@
[HttpTrigger(AuthorizationLevel.Function, "get", Route = "sharepoint/download")] HttpRequestData request,
CancellationToken cancellationToken)
{
this._logger.LogInformation("DownloadFile: Using generated SharepointonlineClient byte[] response path.");
this._logger.LogInformation("DownloadFile: Using generated SharePointOnlineClient byte[] response path.");

var siteAddress = request.Query["site"];
var filePath = request.Query["path"];
Expand Down Expand Up @@ -471,7 +474,7 @@

return response;
}
catch (SharepointonlineConnectorException ex)
catch (SharePointOnlineConnectorException ex)
{
this._logger.LogError(ex, "SharePoint connector error: '{StatusCode}'.", ex.StatusCode);

Expand Down Expand Up @@ -505,7 +508,7 @@
/// Uploads a file to a SharePoint document library.
/// </summary>
/// <remarks>
/// Exercises the <c>byte[]</c> input path in <see cref="SharepointonlineClient.CreateFileAsync"/>.
/// Exercises the <c>byte[]</c> input path in <see cref="SharePointOnlineClient.CreateFileAsync"/>.
/// Accepts a JSON body with base64-encoded content or plain text, and uploads it to
/// the specified SharePoint folder.
/// </remarks>
Expand All @@ -516,7 +519,7 @@
[HttpTrigger(AuthorizationLevel.Function, "post", Route = "sharepoint/upload")] HttpRequestData request,
CancellationToken cancellationToken)
{
this._logger.LogInformation("UploadFile: Using generated SharepointonlineClient byte[] input path.");
this._logger.LogInformation("UploadFile: Using generated SharePointOnlineClient byte[] input path.");

try
{
Expand Down Expand Up @@ -593,7 +596,7 @@

return response;
}
catch (SharepointonlineConnectorException ex)
catch (SharePointOnlineConnectorException ex)
{
this._logger.LogError(ex, "SharePoint connector error: '{StatusCode}'.", ex.StatusCode);

Expand Down Expand Up @@ -1178,7 +1181,7 @@
// The actual message body properties are determined at runtime by the connector's schema
// discovery endpoint. With [JsonExtensionData] on AdditionalProperties, arbitrary properties
// are now serialized correctly. Populate the dictionary with the expected message fields.
var messageRequest = new Microsoft.Azure.Connectors.DirectClient.Teams.DynamicPostMessageRequest();
var messageRequest = new Azure.Connectors.Sdk.Teams.DynamicPostMessageRequest();
messageRequest.AdditionalProperties["recipient"] = JsonSerializer.SerializeToElement(
new
{
Expand Down
2 changes: 1 addition & 1 deletion DirectConnector/ConnectorTriggerMetadataAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public sealed class ConnectorTriggerMetadataAttribute : Attribute

/// <summary>
/// The trigger operation name. Use constants from the connector's <c>*TriggerOperations</c> class
/// (e.g., <see cref="Microsoft.Azure.Connectors.DirectClient.Office365.Office365TriggerOperations"/>).
/// (e.g., <see cref="Azure.Connectors.Sdk.Office365.Office365TriggerOperations"/>).
/// </summary>
public string OperationName { get; set; } = "";

Expand Down
3 changes: 2 additions & 1 deletion DirectConnector/MqFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

using System.Net;
using System.Text.Json;
using Microsoft.Azure.Connectors.DirectClient.Mq;
using Azure.Connectors.Sdk.Mq;

Check failure on line 7 in DirectConnector/MqFunctions.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

The type or namespace name 'Connectors' does not exist in the namespace 'Azure' (are you missing an assembly reference?)
using Azure.Connectors.Sdk.Mq.Models;
using Microsoft.Azure.Connectors.Sdk;
using Microsoft.Azure.Functions.Worker;
using Microsoft.Azure.Functions.Worker.Http;
Expand Down
Loading
Loading