-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add IManagementClient.GetShovelStatusesAsync() (api/shovels)
- Loading branch information
1 parent
b43357f
commit bfd8f2c
Showing
6 changed files
with
289 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using EasyNetQ.Management.Client.Serialization; | ||
using System.Text.Json; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace EasyNetQ.Management.Client.Model; | ||
|
||
public record ShovelStatus | ||
( | ||
string Name, | ||
string Vhost, | ||
string Node, | ||
[property: JsonConverter(typeof(DateTimeConverter))] | ||
DateTime Timestamp, | ||
string Type, | ||
string State, | ||
|
||
string? SrcProtocol = null, | ||
string? SrcUri = null, | ||
string? SrcQueue = null, | ||
string? SrcExchange = null, | ||
string? SrcExchangeKey = null, | ||
string? DestProtocol = null, | ||
string? DestUri = null, | ||
string? DestQueue = null, | ||
string? DestExchange = null, | ||
string? DestExchangeKey = null, | ||
string? BlockedStatus = null, | ||
|
||
string? Reason = null | ||
) | ||
{ | ||
[JsonExtensionData()] | ||
public IDictionary<string, JsonElement>? JsonExtensionData { get; set; } | ||
|
||
[JsonIgnore()] | ||
public IReadOnlyDictionary<string, object?>? ExtensionData | ||
{ | ||
get { return JsonExtensionDataExtensions.ToExtensionData(JsonExtensionData); } | ||
set { JsonExtensionData = JsonExtensionDataExtensions.ToJsonExtensionData(value); } | ||
} | ||
}; |
19 changes: 19 additions & 0 deletions
19
Source/EasyNetQ.Management.Client/Serialization/DateTimeConverter.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,19 @@ | ||
using System.Diagnostics; | ||
using System.Text.Json; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace EasyNetQ.Management.Client.Serialization; | ||
|
||
internal class DateTimeConverter : JsonConverter<DateTime> | ||
{ | ||
public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) | ||
{ | ||
Debug.Assert(typeToConvert == typeof(DateTime)); | ||
return DateTime.Parse(reader.GetString() ?? string.Empty); | ||
} | ||
|
||
public override void Write(Utf8JsonWriter writer, DateTime value, JsonSerializerOptions options) | ||
{ | ||
writer.WriteStringValue(value.ToString()); | ||
} | ||
} |