Migrate existing code
This commit is contained in:
parent
384ff4a6f3
commit
9b49f880a2
30 changed files with 1789 additions and 5 deletions
39
Integrations/PowerDns/Replies.cs
Normal file
39
Integrations/PowerDns/Replies.cs
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace DotNetDDI.Integrations.PowerDns;
|
||||
|
||||
[JsonDerivedType(typeof(BoolReply))]
|
||||
[JsonDerivedType(typeof(LookupReply))]
|
||||
public abstract class Reply;
|
||||
|
||||
public abstract class Reply<T>(T result) : Reply
|
||||
{
|
||||
[JsonPropertyName("result")]
|
||||
public T Result => result;
|
||||
}
|
||||
|
||||
public class BoolReply(bool result) : Reply<bool>(result)
|
||||
{
|
||||
public static BoolReply False { get; } = new BoolReply(false);
|
||||
|
||||
public static BoolReply True { get; } = new BoolReply(true);
|
||||
}
|
||||
|
||||
public class LookupReply(QueryResult[] result) : Reply<QueryResult[]>(result);
|
||||
|
||||
public record QueryResult(
|
||||
[property: JsonPropertyName("qtype")] string QType,
|
||||
[property: JsonPropertyName("qname")] string QName,
|
||||
[property: JsonPropertyName("content")] string Content,
|
||||
[property: JsonPropertyName("ttl")] int TTL
|
||||
)
|
||||
{
|
||||
[JsonPropertyName("auth")]
|
||||
public bool? Auth { get; init; } = default;
|
||||
|
||||
[JsonPropertyName("domain_id")]
|
||||
public int? DomainId { get; init; } = default;
|
||||
|
||||
[JsonPropertyName("scopeMask")]
|
||||
public int? ScopeMask { get; init; } = default;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue