forked from ravendb/ravendb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RavenDB-21956 Add azure queue storage etl
- Loading branch information
1 parent
df870d3
commit 96ccc96
Showing
22 changed files
with
1,178 additions
and
10 deletions.
There are no files selected for viewing
86 changes: 86 additions & 0 deletions
86
src/Raven.Client/Documents/Operations/ETL/Queue/AzureQueueStorageConnectionSettings.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
using System; | ||
using System.Linq; | ||
using Sparrow.Json.Parsing; | ||
|
||
namespace Raven.Client.Documents.Operations.ETL.Queue; | ||
|
||
public sealed class AzureQueueStorageConnectionSettings | ||
{ | ||
public Authentication Authentication; | ||
|
||
public string GetStorageUrl() | ||
{ | ||
string storageAccountName = GetStorageAccountName(); | ||
return $"https://{storageAccountName}.queue.core.windows.net/"; | ||
} | ||
|
||
public string GetStorageAccountName() | ||
{ | ||
string storageAccountName = ""; | ||
|
||
if (Authentication.ConnectionString != null) | ||
{ | ||
var accountNamePart = Authentication.ConnectionString.Split(';') | ||
.FirstOrDefault(part => part.StartsWith("AccountName=", StringComparison.OrdinalIgnoreCase)); | ||
|
||
if (accountNamePart == null) | ||
{ | ||
throw new ArgumentException("Storage account name not found in the connection string.", | ||
nameof(Authentication.ConnectionString)); | ||
} | ||
|
||
storageAccountName = accountNamePart.Substring("AccountName=".Length); | ||
} | ||
else if (Authentication.EntraId != null) | ||
{ | ||
storageAccountName = Authentication.EntraId.StorageAccountName; | ||
} | ||
|
||
return storageAccountName; | ||
} | ||
|
||
public DynamicJsonValue ToJson() | ||
{ | ||
var json = new DynamicJsonValue | ||
{ | ||
[nameof(Authentication)] = Authentication == null | ||
? null | ||
: new DynamicJsonValue | ||
{ | ||
[nameof(Authentication.ConnectionString)] = Authentication.ConnectionString, | ||
[nameof(Authentication.Passwordless)] = Authentication.Passwordless, | ||
[nameof(Authentication.EntraId)] = | ||
Authentication.EntraId == null | ||
? null | ||
: new DynamicJsonValue | ||
{ | ||
[nameof(Authentication.EntraId.StorageAccountName)] = | ||
Authentication?.EntraId?.StorageAccountName, | ||
[nameof(Authentication.EntraId.TenantId)] = | ||
Authentication?.EntraId?.TenantId, | ||
[nameof(Authentication.EntraId.ClientId)] = | ||
Authentication?.EntraId?.ClientId, | ||
[nameof(Authentication.EntraId.ClientSecret)] = | ||
Authentication?.EntraId?.ClientSecret | ||
} | ||
} | ||
}; | ||
|
||
return json; | ||
} | ||
} | ||
|
||
public sealed class Authentication | ||
{ | ||
public EntraId EntraId { get; set; } | ||
public string ConnectionString { get; set; } | ||
public bool Passwordless { get; set; } | ||
} | ||
|
||
public sealed class EntraId | ||
{ | ||
public string StorageAccountName { get; set; } | ||
public string TenantId { get; set; } | ||
public string ClientId { get; set; } | ||
public string ClientSecret { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,6 @@ public enum QueueBrokerType | |
{ | ||
None, | ||
Kafka, | ||
RabbitMq | ||
RabbitMq, | ||
AzureQueueStorage | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.