Reorganize Zone Extension

This commit is contained in:
2025-06-24 10:48:40 +02:00
parent 135e1a11f3
commit 6f27dd3ff8
75 changed files with 0 additions and 10129 deletions

View File

@@ -1,38 +0,0 @@
using System.Collections.Generic;
namespace AMWD.Net.Api.Cloudflare.Zones
{
/// <summary>
/// Batch of DNS Record API calls to be executed together.
/// </summary>
/// <remarks>
/// Execution order: Delete, Update, Overwrite, Create
/// </remarks>
public class BatchDnsRecordsRequest(string zoneId)
{
/// <summary>
/// The zone identifier.
/// </summary>
public string ZoneId { get; set; } = zoneId;
/// <summary>
/// The DNS record identifiers to delete.
/// </summary>
public IList<string> DnsRecordIdsToDelete { get; set; } = [];
/// <summary>
/// The DNS records to update.
/// </summary>
public IList<UpdateDnsRecordRequest> DnsRecordsToUpdate { get; set; } = [];
/// <summary>
/// The DNS records to overwrite.
/// </summary>
public IList<OverwriteDnsRecordRequest> DnsRecordsToOverwrite { get; set; } = [];
/// <summary>
/// The DNS records to create.
/// </summary>
public IList<CreateDnsRecordRequest> DnsRecordsToCreate { get; set; } = [];
}
}

View File

@@ -1,91 +0,0 @@
using System.Collections.Generic;
namespace AMWD.Net.Api.Cloudflare.Zones
{
/// <summary>
/// Request to create a new DNS record.
/// </summary>
/// <remarks>
/// Initializes a new instance of the <see cref="CreateDnsRecordRequest"/> class.
/// </remarks>
/// <param name="zoneId">The zone identifier.</param>
/// <param name="name">DNS record name (or @ for the zone apex).</param>
/// <param name="type">Record type.</param>
public class CreateDnsRecordRequest(string zoneId, string name, DnsRecordType type)
{
/// <summary>
/// The zone identifier.
/// </summary>
public string ZoneId { get; set; } = zoneId;
/// <summary>
/// Comments or notes about the DNS record.
/// </summary>
/// <remarks>
/// This field has no effect on DNS responses.
/// </remarks>
public string? Comment { get; set; }
/// <summary>
/// DNS record name (or @ for the zone apex) in Punycode.
/// </summary>
public string Name { get; set; } = name;
/// <summary>
/// Whether the record is receiving the performance and security benefits of Cloudflare.
/// </summary>
public bool Proxied { get; set; }
/// <summary>
/// Settings for the DNS record.
/// </summary>
public object? Settings { get; set; }
/// <summary>
/// Custom tags for the DNS record.
/// </summary>
/// <remarks>
/// This field has no effect on DNS responses.
/// </remarks>
public IList<string>? Tags { get; set; }
/// <summary>
/// Time To Live (TTL) of the DNS record in seconds.
/// </summary>
/// <remarks>
/// Setting to <c>1</c> means 'automatic'.
/// Value must be between <c>60</c> and <c>86400</c>, <em>with the minimum reduced to 30 for Enterprise zones</em>.
/// </remarks>
public int? Ttl { get; set; }
/// <summary>
/// Components of a record.
/// </summary>
/// <remarks>
/// <strong>Caution:</strong> This field has priority over the <see cref="Content"/> field.
/// </remarks>
public object? Data { get; set; }
/// <summary>
/// A valid content.
/// </summary>
/// <remarks>
/// <strong>Caution:</strong> This field has no effect for record types with specific <see cref="Data"/> values.
/// </remarks>
public string? Content { get; set; }
/// <summary>
/// A priority.
/// </summary>
/// <remarks>
/// Required for <see cref="DnsRecordType.Mx"/>, <see cref="DnsRecordType.Srv"/> and <see cref="DnsRecordType.Uri"/> records; unused by other record types.
/// Records with lower priorities are preferred.
/// </remarks>
public ushort? Priority { get; set; }
/// <summary>
/// Record type.
/// </summary>
public DnsRecordType Type { get; set; } = type;
}
}

View File

@@ -1,37 +0,0 @@
namespace AMWD.Net.Api.Cloudflare.Zones
{
/// <summary>
/// Request to create a new zone.
/// </summary>
/// <remarks>
/// Request to create a new zone.
/// </remarks>
/// <param name="accountId">The account identifier.</param>
/// <param name="name">The domain name.</param>
public class CreateZoneRequest(string accountId, string name)
{
/// <summary>
/// The account identifier.
/// </summary>
public string AccountId { get; set; } = accountId;
/// <summary>
/// The domain name.
/// </summary>
public string Name { get; set; } = name;
/// <summary>
/// The zone type.
/// </summary>
/// <remarks>
/// <para>
/// A full zone implies that DNS is hosted with Cloudflare.
/// A partial zone is typically a partner-hosted zone or a CNAME setup.
/// </para>
/// <para>
/// If not set, Cloudflare will use <see cref="ZoneType.Full"/> as default.
/// </para>
/// </remarks>
public ZoneType? Type { get; set; }
}
}

View File

@@ -1,34 +0,0 @@
using System.Collections.Generic;
namespace AMWD.Net.Api.Cloudflare.Zones
{
/// <summary>
/// A request to edit a zone.
/// </summary>
/// <remarks>
/// Initializes a new instance of the <see cref="EditZoneRequest"/> class.
/// </remarks>
/// <param name="id">The zone identifier.</param>
public class EditZoneRequest(string id)
{
/// <summary>
/// Identifier.
/// </summary>
public string Id { get; set; } = id;
/// <summary>
/// A full zone implies that DNS is hosted with Cloudflare. A partial zone is typically a partner-hosted zone or a CNAME setup.
/// <br/>
/// <em>This parameter is only available to Enterprise customers or if it has been explicitly enabled on a zone.</em>
/// </summary>
public ZoneType? Type { get; set; }
/// <summary>
/// An array of domains used for custom name servers.
/// <br/>
/// <em>This is only available for Business and Enterprise plans.</em>
/// </summary>
public IList<string>? VanityNameServers { get; set; }
}
}

View File

@@ -1,28 +0,0 @@
namespace AMWD.Net.Api.Cloudflare.Zones
{
/// <summary>
/// Request to import DNS records from a BIND configuration file.
/// </summary>
public class ImportDnsRecordsRequest(string zoneId, string file)
{
/// <summary>
/// The zone identifier.
/// </summary>
public string ZoneId { get; set; } = zoneId;
/// <summary>
/// Whether or not proxiable records should receive the performance and security benefits of Cloudflare.
/// </summary>
public bool? Proxied { get; set; }
/// <summary>
/// BIND config to import.
/// </summary>
/// <remarks>
/// If the property is an absolute path, the content of that file will be used as the BIND configuration.
/// <br />
/// Otherwise the property will be treated as BIND configuration itself.
/// </remarks>
public string File { get; set; } = file;
}
}

View File

@@ -1,20 +0,0 @@
namespace AMWD.Net.Api.Cloudflare.Zones
{
/// <summary>
/// Request to overwrite a DNS record.
/// </summary>
/// <remarks>
/// Initializes a new instance of the <see cref="OverwriteDnsRecordRequest"/> class.
/// </remarks>
/// <param name="id">The DNS record identifier.</param>
/// <param name="zoneId">The zone identifier.</param>
/// <param name="name">DNS record name (or @ for the zone apex).</param>
/// <param name="type">Record type.</param>
public class OverwriteDnsRecordRequest(string id, string zoneId, string name, DnsRecordType type) : CreateDnsRecordRequest(zoneId, name, type)
{
/// <summary>
/// The DNS record identifier.
/// </summary>
public string Id { get; set; } = id;
}
}

View File

@@ -1,20 +0,0 @@
namespace AMWD.Net.Api.Cloudflare.Zones
{
/// <summary>
/// Request to update a DNS record.
/// </summary>
/// <remarks>
/// Initializes a new instance of the <see cref="UpdateDnsRecordRequest"/> class.
/// </remarks>
/// <param name="id">The DNS record identifier.</param>
/// <param name="zoneId">The zone identifier.</param>
/// <param name="name">DNS record name (or @ for the zone apex).</param>
/// <param name="type">Record type.</param>
public class UpdateDnsRecordRequest(string id, string zoneId, string name, DnsRecordType type) : CreateDnsRecordRequest(zoneId, name, type)
{
/// <summary>
/// The DNS record identifier.
/// </summary>
public string Id { get; set; } = id;
}
}

View File

@@ -1,61 +0,0 @@
namespace AMWD.Net.Api.Cloudflare.Zones
{
/// <summary>
/// Update DNS settings request.
/// </summary>
/// <remarks>
/// Initializes a new instance of the <see cref="UpdateDnsSettingsRequest"/> class.
/// </remarks>
/// <param name="id">The zone identifier.</param>
public class UpdateDnsSettingsRequest(string id)
{
/// <summary>
/// The zone identifier.
/// </summary>
public string Id { get; set; } = id;
/// <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>
public bool? FlattenAllCnames { get; set; }
/// <summary>
/// Whether to enable Foundation DNS Advanced Nameservers on the zone.
/// </summary>
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>
public bool? MultiProvider { get; set; }
/// <summary>
/// Settings determining the nameservers through which the zone should be available.
/// </summary>
public Nameserver? Nameservers { get; set; }
/// <summary>
/// The time to live (TTL) of the zone's nameserver (NS) records.
/// </summary>
/// <value>Unit: seconds. Range: <c>30 &lt;=</c> X <c>&lt;= 86400</c></value>
public int? NameserverTtl { get; set; }
/// <summary>
/// Allows a Secondary DNS zone to use (proxied) override records and CNAME flattening at the zone apex.
/// </summary>
public bool? SecondaryOverrides { get; set; }
/// <summary>
/// Components of the zone's SOA record.
/// </summary>
public StartOfAuthority? SOA { get; set; }
/// <summary>
/// Whether the zone mode is a regular or CDN/DNS only zone.
/// </summary>
public ZoneMode? Mode { get; set; }
}
}

View File

@@ -1,100 +0,0 @@
using System;
using System.Collections.Generic;
namespace AMWD.Net.Api.Cloudflare.Zones
{
/// <summary>
/// Request to update security.txt
/// </summary>
public class UpdateSecurityTxtRequest(string zoneId)
{
/// <summary>
/// The zone identifier.
/// </summary>
public string ZoneId { get; set; } = zoneId;
/// <summary>
/// Gets or sets the acknowledgements.
/// </summary>
/// <remarks>
/// Example: <c>https://example.com/hall-of-fame.html</c>
/// </remarks>
public IList<string>? Acknowledgements { get; set; }
/// <summary>
/// Gets or sets the canonical.
/// </summary>
/// <remarks>
/// Example: <c>https://www.example.com/.well-known/security.txt</c>
/// </remarks>
public IList<string>? Canonical { get; set; }
/// <summary>
/// Gets or sets the contact.
/// </summary>
/// <remarks>
/// Examples:
/// <list type="bullet">
/// <item>mailto:security@example.com</item>
/// <item>tel:+1-201-555-0123</item>
/// <item>https://example.com/security-contact.html</item>
/// </list>
/// </remarks>
public IList<string>? Contact { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this security.txt is enabled.
/// </summary>
public bool? Enabled { get; set; }
/// <summary>
/// Gets or sets the encryption.
/// </summary>
/// <remarks>
/// Examples:
/// <list type="bullet">
/// <item>https://example.com/pgp-key.txt</item>
/// <item>dns:5d2d37ab76d47d36._openpgpkey.example.com?type=OPENPGPKEY</item>
/// <item>openpgp4fpr:5f2de5521c63a801ab59ccb603d49de44b29100f</item>
/// </list>
/// </remarks>
public IList<string>? Encryption { get; set; }
/// <summary>
/// Gets or sets the expires.
/// </summary>
/// <remarks>
/// <strong>NOTE</strong>: The value will be converted to UTC when the <see cref="DateTime.Kind"/> is not <see cref="DateTimeKind.Utc"/>.
/// </remarks>
public DateTime? Expires { get; set; }
/// <summary>
/// Gets or sets the hiring.
/// </summary>
/// <remarks>
/// Example: <c>https://example.com/jobs.html</c>
/// </remarks>
public IList<string>? Hiring { get; set; }
/// <summary>
/// Gets or sets the policies.
/// </summary>
/// <remarks>
/// Example: <c>https://example.com/disclosure-policy.html</c>
/// </remarks>
public IList<string>? Policy { get; set; }
/// <summary>
/// Gets or sets the preferred languages.
/// </summary>
/// <remarks>
/// Examples:
/// <list type="bullet">
/// <item>en</item>
/// <item>es</item>
/// <item>fr</item>
/// </list>
/// </remarks>
public IList<string>? PreferredLanguages { get; set; }
}
}

View File

@@ -1,24 +0,0 @@
using System.Collections.Generic;
namespace AMWD.Net.Api.Cloudflare.Zones
{
/// <summary>
/// Url with headers to purge.
/// </summary>
/// <remarks>
/// Initializes a new instance of the <see cref="ZonePurgeCachedUrlRequest"/> class.
/// </remarks>
/// <param name="url">The url to purge.</param>
public class ZonePurgeCachedUrlRequest(string url)
{
/// <summary>
/// Defined headers to specifiy the purge request.
/// </summary>
public Dictionary<string, string> Headers { get; set; } = [];
/// <summary>
/// The file url to purge.
/// </summary>
public string Url { get; set; } = url;
}
}