Changed folder structure, added explicit nullable for extensions.

This commit is contained in:
2024-10-31 13:07:39 +01:00
parent eadd35ac09
commit 935632df27
45 changed files with 1121 additions and 214 deletions

View File

@@ -0,0 +1,22 @@
namespace AMWD.Net.Api.Cloudflare.Zones
{
/// <summary>
/// A nameserver.
/// </summary>
public class Nameserver
{
/// <summary>
/// The nameserver type.
/// </summary>
[JsonProperty("type")]
public virtual NameserverType Type { get; set; }
// TODO: DEPRECATED? - not available on API request.
///// <summary>
///// Configured nameserver set to be used for this zone.
///// </summary>
///// <value>Range: <c>1 &lt;=</c> X <c>&lt;= 5</c></value>
//[JsonProperty("ns_set")]
//public virtual int NameserverSet { get; set; }
}
}

View File

@@ -0,0 +1,83 @@
namespace AMWD.Net.Api.Cloudflare.Zones
{
/// <summary>
/// The SOA (Start of Authority) record.
/// </summary>
public class StartOfAuthority
{
/// <summary>
/// Initializes a new instance of the <see cref="StartOfAuthority"/> class.
/// </summary>
/// <param name="primaryNameserver">The primary nameserver.</param>
/// <param name="zoneAdministrator">The zone administrator. First dot will be interpreted as @-sign.</param>
/// <param name="ttl">The time to live of the SOA record.</param>
/// <param name="refresh">Time in seconds after which secondary servers should re-check the SOA record to see if the zone has been updated.</param>
/// <param name="retry">Time in seconds after which secondary servers should retry queries after the primary server was unresponsive.</param>
/// <param name="expire">Time in seconds of being unable to query the primary server after which secondary servers should stop serving the zone.</param>
/// <param name="minimumTtl">The time to live (TTL) for negative caching of records within the zone.</param>
public StartOfAuthority(string primaryNameserver, string zoneAdministrator, int ttl, int refresh, int retry, int expire, int minimumTtl)
{
PrimaryNameserver = primaryNameserver;
ZoneAdministrator = zoneAdministrator;
Ttl = ttl;
Refresh = refresh;
Retry = retry;
Expire = expire;
MinimumTtl = minimumTtl;
}
/// <summary>
/// Time in seconds of being unable to query the primary server after which secondary servers should stop serving the zone.
/// </summary>
/// <value>Unit: seconds. Range: <c>86400 &lt;=</c> X <c>&lt;= 2419200</c></value>
[JsonProperty("expire")]
public virtual int Expire { get; set; }
/// <summary>
/// The time to live (TTL) for negative caching of records within the zone.
/// </summary>
/// <value>Unit: seconds. Range: <c>60 &lt;=</c> X <c>&lt;= 86400</c></value>
[JsonProperty("min_ttl")]
public virtual int MinimumTtl { get; set; }
/// <summary>
/// The primary nameserver, which may be used for outbound zone transfers.
/// </summary>
[JsonProperty("mname", NullValueHandling = NullValueHandling.Include)]
public virtual string PrimaryNameserver { get; set; }
/// <summary>
/// Time in seconds after which secondary servers should re-check the SOA record to see if the zone has been updated.
/// </summary>
/// <value>Unit: seconds. Range: <c>600 &lt;=</c> X <c>&lt;= 86400</c></value>
[JsonProperty("refresh")]
public virtual int Refresh { get; set; }
/// <summary>
/// Time in seconds after which secondary servers should retry queries after the primary server was unresponsive.
/// </summary>
/// <value>Unit: seconds. Range: <c>600 &lt;=</c> X <c>&lt;= 86400</c></value>
[JsonProperty("retry")]
public virtual int Retry { get; set; }
/// <summary>
/// The email address of the zone administrator, with the first label representing the local part of the email address.
/// </summary>
/// <remarks>
/// The first dot is interpreted as @ sign.
/// <br/>
/// admin.example.com => admin@example.com
/// <br/>
/// test\.user.example.org => test.user@example.org
/// </remarks>
[JsonProperty("rname", NullValueHandling = NullValueHandling.Include)]
public virtual string ZoneAdministrator { get; set; }
/// <summary>
/// The time to live (TTL) of the SOA record itself.
/// </summary>
/// <value>Unit: seconds. Range: <c>300 &lt;=</c> X <c>&lt;= 86400</c></value>
[JsonProperty("ttl")]
public virtual int Ttl { get; set; }
}
}

View File

@@ -13,13 +13,13 @@ namespace AMWD.Net.Api.Cloudflare.Zones
/// </summary>
// <= 32 characters
[JsonProperty("id")]
public string Id { get; set; }
public string? Id { get; set; }
/// <summary>
/// The account the zone belongs to.
/// </summary>
[JsonProperty("account")]
public AccountBase Account { get; set; }
public AccountBase? Account { get; set; }
/// <summary>
/// The last time proof of ownership was detected and the zone was made active.
@@ -45,7 +45,7 @@ namespace AMWD.Net.Api.Cloudflare.Zones
/// Metadata about the zone.
/// </summary>
[JsonProperty("meta")]
public ZoneMetaData Meta { get; set; }
public ZoneMetaData? Meta { get; set; }
/// <summary>
/// When the zone was last modified.
@@ -58,37 +58,37 @@ namespace AMWD.Net.Api.Cloudflare.Zones
/// </summary>
// <= 253 characters
[JsonProperty("name")]
public string Name { get; set; }
public string? Name { get; set; }
/// <summary>
/// The name servers Cloudflare assigns to a zone.
/// </summary>
[JsonProperty("name_servers")]
public IReadOnlyList<string> NameServers { get; set; }
public IReadOnlyList<string>? NameServers { get; set; }
/// <summary>
/// DNS host at the time of switching to Cloudflare.
/// </summary>
[JsonProperty("original_dnshost")]
public string OriginalDnshost { get; set; }
public string? OriginalDnshost { get; set; }
/// <summary>
/// Original name servers before moving to Cloudflare.
/// </summary>
[JsonProperty("original_name_servers")]
public IReadOnlyList<string> OriginalNameServers { get; set; }
public IReadOnlyList<string>? OriginalNameServers { get; set; }
/// <summary>
/// Registrar for the domain at the time of switching to Cloudflare.
/// </summary>
[JsonProperty("original_registrar")]
public string OriginalRegistrar { get; set; }
public string? OriginalRegistrar { get; set; }
/// <summary>
/// The owner of the zone.
/// </summary>
[JsonProperty("owner")]
public OwnerBase Owner { get; set; }
public OwnerBase? Owner { get; set; }
/// <summary>
/// Indicates whether the zone is only using Cloudflare DNS services.
@@ -115,6 +115,6 @@ namespace AMWD.Net.Api.Cloudflare.Zones
/// <em>This is only available for Business and Enterprise plans.</em>
/// </summary>
[JsonProperty("vanity_name_servers")]
public IReadOnlyList<string> VanityNameServers { get; set; }
public IReadOnlyList<string>? VanityNameServers { get; set; }
}
}

View File

@@ -0,0 +1,59 @@
namespace AMWD.Net.Api.Cloudflare.Zones
{
/// <summary>
/// The DNS settings.
/// </summary>
public class ZoneDnsSetting
{
/// <summary>
/// Whether to flatten all CNAME records in the zone. Note that, due to DNS limitations,
/// a CNAME record at the zone apex will always be flattened.
/// </summary>
[JsonProperty("flatten_all_cnames")]
public bool FlattenAllCnames { get; set; }
/// <summary>
/// Whether to enable Foundation DNS Advanced Nameservers on the zone.
/// </summary>
[JsonProperty("foundation_dns")]
public bool FoundationDns { get; set; }
/// <summary>
/// Whether to enable multi-provider DNS, which causes Cloudflare to activate the zone even when non-Cloudflare NS records exist,
/// and to respect NS records at the zone apex during outbound zone transfers.
/// </summary>
[JsonProperty("multi_provider")]
public bool MultiProvider { get; set; }
/// <summary>
/// Settings determining the nameservers through which the zone should be available.
/// </summary>
[JsonProperty("nameservers")]
public Nameserver? Nameservers { get; set; }
/// <summary>
/// The time to live (TTL) of the zone's nameserver (NS) records.
/// </summary>
// 30 <= X <= 86400
[JsonProperty("ns_ttl")]
public int NameserverTtl { get; set; }
/// <summary>
/// Allows a Secondary DNS zone to use (proxied) override records and CNAME flattening at the zone apex.
/// </summary>
[JsonProperty("secondary_overrides")]
public bool SecondaryOverrides { get; set; }
/// <summary>
/// Components of the zone's SOA record.
/// </summary>
[JsonProperty("soa")]
public StartOfAuthority? SOA { get; set; }
/// <summary>
/// Whether the zone mode is a regular or CDN/DNS only zone.
/// </summary>
[JsonProperty("zone_mode")]
public ZoneMode Mode { get; set; }
}
}

View File

@@ -17,7 +17,7 @@ namespace AMWD.Net.Api.Cloudflare.Zones
/// Gets or sets an information whether subdomains are included in the hold.
/// </summary>
[JsonProperty("include_subdomains")]
public string IncludeSubdomains { get; set; }
public string? IncludeSubdomains { get; set; }
/// <summary>
/// Gets or sets the time after which the zone is no longer on hold.

View File

@@ -10,6 +10,6 @@
/// </summary>
// <= 32 characters
[JsonProperty("id")]
public string Id { get; set; }
public string? Id { get; set; }
}
}