Added DNS Records for Zone actions
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
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; } = [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user