Skip to content

Commit

Permalink
Update Akka.Hosting extension methods to support DefaultAzureCredenti…
Browse files Browse the repository at this point in the history
…al (#237)

* Update Akka.Hosting extension methods to support DefaultAzureCredential

(cherry picked from commit b37c9db)

* Make setup classes sealed

* Fix missing HOCON settings

* Revert const back to public

Co-authored-by: Aaron Stannard <[email protected]>
  • Loading branch information
Arkatufus and Aaronontheweb authored Aug 29, 2022
1 parent 27e7121 commit cdf3a41
Show file tree
Hide file tree
Showing 7 changed files with 423 additions and 86 deletions.
445 changes: 390 additions & 55 deletions src/Akka.Persistence.Azure.Hosting/AzurePersistenceExtensions.cs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Akka.Event;
using Akka.Hosting;
using Akka.Persistence.Azure.Hosting;
using Akka.Persistence.Azure.Tests.Helper;
using Akka.TestKit.Xunit2.Internals;
using FluentAssertions;
using Microsoft.Extensions.DependencyInjection;
Expand All @@ -20,6 +21,7 @@ public class AzurePersistenceHostingSanityCheck
public static async Task<IHost> StartHost(Action<AkkaConfigurationBuilder> testSetup)
{
var conn = Environment.GetEnvironmentVariable("AZURE_CONNECTION_STR") ?? "UseDevelopmentStorage=true";
await DbUtils.CleanupCloudTable(conn);
var host = new HostBuilder()
.ConfigureServices(collection =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,19 +116,19 @@ public AzureTableStorageJournalSettings(
public bool AutoInitialize { get; }

/// <summary>
/// A <see cref="Uri"/> referencing the blob service.
/// This is likely to be similar to "https://{account_name}.table.core.windows.net".
/// A <see cref="Uri"/> referencing the Azure Table Storage service.
/// This is likely to be similar to "https://{account_name}.table.core.windows.net".
/// </summary>
public Uri ServiceUri { get; }

/// <summary>
/// The <see cref="DefaultAzureCredential"/> used to sign API requests.
/// The <see cref="DefaultAzureCredential"/> used to sign API requests.
/// </summary>
public DefaultAzureCredential DefaultAzureCredential { get; }

/// <summary>
/// Optional client options that define the transport pipeline policies for authentication,
/// retries, etc., that are applied to every request.
/// Optional client options that define the transport pipeline policies for authentication,
/// retries, etc., that are applied to every request.
/// </summary>
public TableClientOptions TableClientOptions { get; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace Akka.Persistence.Azure.Journal
{
public class AzureTableStorageJournalSetup : Setup
public sealed class AzureTableStorageJournalSetup : Setup
{
/// <summary>
/// The connection string for connecting to Windows Azure table storage.
Expand Down Expand Up @@ -51,19 +51,19 @@ public class AzureTableStorageJournalSetup : Setup
public bool? AutoInitialize { get; set; }

/// <summary>
/// A <see cref="Uri"/> referencing the blob service.
/// This is likely to be similar to "https://{account_name}.table.core.windows.net".
/// A <see cref="Uri"/> referencing the Azure Storage Table service.
/// This is likely to be similar to "https://{account_name}.table.core.windows.net".
/// </summary>
public Uri ServiceUri { get; set; }

/// <summary>
/// The <see cref="DefaultAzureCredential"/> used to sign API requests.
/// The <see cref="DefaultAzureCredential"/> used to sign API requests.
/// </summary>
public DefaultAzureCredential DefaultAzureCredential { get; set; }

/// <summary>
/// Optional client options that define the transport pipeline policies for authentication,
/// retries, etc., that are applied to every request.
/// Optional client options that define the transport pipeline policies for authentication,
/// retries, etc., that are applied to every request.
/// </summary>
public TableClientOptions TableClientOptions { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace Akka.Persistence.Azure.Query
{
public class AzureTableStorageReadJournalSetup: Setup
public sealed class AzureTableStorageReadJournalSetup: Setup
{
/// <summary>
/// How many events to fetch in one query (replay) and keep buffered until they
Expand Down
28 changes: 14 additions & 14 deletions src/Akka.Persistence.Azure/Snapshot/AzureBlobSnapshotSetup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,24 @@
namespace Akka.Persistence.Azure.Snapshot
{
/// <summary>
/// Setup class for <see cref="AzureBlobSnapshotStore"/>.
/// Any populated properties will override its respective HOCON setting.
/// Setup class for <see cref="AzureBlobSnapshotStore"/>.
/// Any populated properties will override its respective HOCON setting.
/// </summary>
public class AzureBlobSnapshotSetup : Setup
public sealed class AzureBlobSnapshotSetup : Setup
{
/// <summary>
/// Create a new <see cref="AzureBlobSnapshotSetup"/>
/// Create a new <see cref="AzureBlobSnapshotSetup"/>
/// </summary>
/// <param name="serviceUri">
/// A <see cref="Uri"/> referencing the blob service.
/// This is likely to be similar to "https://{account_name}.blob.core.windows.net".
/// A <see cref="Uri"/> referencing the blob service.
/// This is likely to be similar to "https://{account_name}.blob.core.windows.net".
/// </param>
/// <param name="defaultAzureCredential">
/// The <see cref="DefaultAzureCredential"/> used to sign requests.
/// The <see cref="DefaultAzureCredential"/> used to sign requests.
/// </param>
/// <param name="blobClientOptions">
/// Optional client options that define the transport pipeline policies for authentication,
/// retries, etc., that are applied to every request.
/// Optional client options that define the transport pipeline policies for authentication,
/// retries, etc., that are applied to every request.
/// </param>
/// <returns>A new <see cref="AzureBlobSnapshotSetup"/> instance</returns>
public static AzureBlobSnapshotSetup Create(
Expand Down Expand Up @@ -87,19 +87,19 @@ public static AzureBlobSnapshotSetup Create(
public PublicAccessType? ContainerPublicAccessType { get; set; }

/// <summary>
/// A <see cref="Uri"/> referencing the blob service.
/// This is likely to be similar to "https://{account_name}.blob.core.windows.net".
/// A <see cref="Uri"/> referencing the blob service.
/// This is likely to be similar to "https://{account_name}.blob.core.windows.net".
/// </summary>
public Uri ServiceUri { get; set; }

/// <summary>
/// The <see cref="DefaultAzureCredential"/> used to sign API requests.
/// The <see cref="DefaultAzureCredential"/> used to sign API requests.
/// </summary>
public DefaultAzureCredential DefaultAzureCredential { get; set; }

/// <summary>
/// Optional client options that define the transport pipeline policies for authentication,
/// retries, etc., that are applied to every request.
/// Optional client options that define the transport pipeline policies for authentication,
/// retries, etc., that are applied to every request.
/// </summary>
public BlobClientOptions BlobClientOptions { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,19 +129,19 @@ public AzureBlobSnapshotStoreSettings(
public PublicAccessType ContainerPublicAccessType { get; }

/// <summary>
/// A <see cref="Uri"/> referencing the blob service.
/// This is likely to be similar to "https://{account_name}.blob.core.windows.net".
/// A <see cref="Uri"/> referencing the blob service.
/// This is likely to be similar to "https://{account_name}.blob.core.windows.net".
/// </summary>
public Uri ServiceUri { get; }

/// <summary>
/// The <see cref="DefaultAzureCredential"/> used to sign API requests.
/// The <see cref="DefaultAzureCredential"/> used to sign API requests.
/// </summary>
public DefaultAzureCredential DefaultAzureCredential { get; }

/// <summary>
/// Optional client options that define the transport pipeline policies for authentication,
/// retries, etc., that are applied to every request.
/// Optional client options that define the transport pipeline policies for authentication,
/// retries, etc., that are applied to every request.
/// </summary>
public BlobClientOptions BlobClientOptions { get; }

Expand Down

0 comments on commit cdf3a41

Please sign in to comment.