Added 'DnsRecords' extensions
This commit is contained in:
159
src/Extensions/Cloudflare.Dns/Requests/BatchDnsRecordsRequest.cs
Normal file
159
src/Extensions/Cloudflare.Dns/Requests/BatchDnsRecordsRequest.cs
Normal file
@@ -0,0 +1,159 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Dns
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a request to manipulate DNS records.
|
||||
/// </summary>
|
||||
public class BatchDnsRecordsRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BatchDnsRecordsRequest"/> class.
|
||||
/// </summary>
|
||||
/// <param name="zoneId">The zone identifier.</param>
|
||||
public BatchDnsRecordsRequest(string zoneId)
|
||||
{
|
||||
ZoneId = zoneId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The zone identifier.
|
||||
/// </summary>
|
||||
public string ZoneId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The DNS records to delete.
|
||||
/// </summary>
|
||||
public IReadOnlyCollection<string>? Deletes { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The DNS records to update.
|
||||
/// </summary>
|
||||
public IReadOnlyCollection<Patch>? Updates { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The DNS records to create.
|
||||
/// </summary>
|
||||
public IReadOnlyCollection<Post>? Creates { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The DNS records to overwrite.
|
||||
/// </summary>
|
||||
public IReadOnlyCollection<Put>? Overwrites { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Represents a request to update a DNS record.
|
||||
/// </summary>
|
||||
public class Patch : Post
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Patch"/> class.
|
||||
/// </summary>
|
||||
/// <param name="id">The DNS record identifier.</param>
|
||||
/// <param name="name">DNS record name (or @ for the zone apex) in Punycode.</param>
|
||||
public Patch(string id, string name)
|
||||
: base(name)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The DNS record identifier.
|
||||
/// </summary>
|
||||
public string Id { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a request to create a DNS record.
|
||||
/// </summary>
|
||||
public class Post
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Post"/> class.
|
||||
/// </summary>
|
||||
/// <param name="name">DNS record name (or @ for the zone apex) in Punycode.</param>
|
||||
public Post(string name)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// DNS record name (or @ for the zone apex) in Punycode.
|
||||
/// </summary>
|
||||
public string Name { 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>, with the
|
||||
/// minimum reduced to <c>30</c> for Enterprise zones.
|
||||
/// </remarks>
|
||||
public int? TimeToLive { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// DNS record type.
|
||||
/// </summary>
|
||||
public DnsRecordType Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Comments or notes about the DNS record.
|
||||
/// This field has no effect on DNS responses.
|
||||
/// </summary>
|
||||
public string? Comment { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The content of the DNS record.
|
||||
/// </summary>
|
||||
public string? Content { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Components of a record.
|
||||
/// </summary>
|
||||
public object? Data { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Required for MX, SRV and URI records; unused by other record types.
|
||||
/// Records with lower priorities are preferred.
|
||||
/// </summary>
|
||||
public int? Priority { get; set; }
|
||||
|
||||
/// <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 DnsRecordSettings? Settings { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Custom tags for the DNS record.
|
||||
/// This field has no effect on DNS responses.
|
||||
/// </summary>
|
||||
public IReadOnlyCollection<string>? Tags { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a request to overwrite a DNS record.
|
||||
/// </summary>
|
||||
public class Put : Post
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Put"/> class.
|
||||
/// </summary>
|
||||
/// <param name="id">The DNS record identifier.</param>
|
||||
/// <param name="name">DNS record name (or @ for the zone apex) in Punycode.</param>
|
||||
public Put(string id, string name)
|
||||
: base(name)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The DNS record identifier.
|
||||
/// </summary>
|
||||
public string Id { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Dns
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a request to create a DNS record.
|
||||
/// </summary>
|
||||
public class CreateDnsRecordRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CreateDnsRecordRequest"/> class.
|
||||
/// </summary>
|
||||
/// <param name="zoneId">The zone identifier.</param>
|
||||
/// <param name="name">DNS record name (or @ for the zone apex) in Punycode.</param>
|
||||
public CreateDnsRecordRequest(string zoneId, string name)
|
||||
{
|
||||
ZoneId = zoneId;
|
||||
Name = name;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The zone identifier.
|
||||
/// </summary>
|
||||
public string ZoneId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// DNS record name (or @ for the zone apex) in Punycode.
|
||||
/// </summary>
|
||||
public string Name { 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>, with the
|
||||
/// minimum reduced to <c>30</c> for Enterprise zones.
|
||||
/// </remarks>
|
||||
public int? TimeToLive { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// DNS record type.
|
||||
/// </summary>
|
||||
public DnsRecordType Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Comments or notes about the DNS record.
|
||||
/// This field has no effect on DNS responses.
|
||||
/// </summary>
|
||||
public string? Comment { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The content of the DNS record.
|
||||
/// </summary>
|
||||
public string? Content { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Components of a record.
|
||||
/// </summary>
|
||||
public object? Data { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Required for MX, SRV and URI records; unused by other record types.
|
||||
/// Records with lower priorities are preferred.
|
||||
/// </summary>
|
||||
public int? Priority { get; set; }
|
||||
|
||||
/// <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 DnsRecordSettings? Settings { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Custom tags for the DNS record.
|
||||
/// This field has no effect on DNS responses.
|
||||
/// </summary>
|
||||
public IReadOnlyCollection<string>? Tags { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Dns
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a request to delete a DNS record.
|
||||
/// </summary>
|
||||
public class DeleteDnsRecordRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DeleteDnsRecordRequest"/> class.
|
||||
/// </summary>
|
||||
/// <param name="zoneId">The zone identifier.</param>
|
||||
/// <param name="recordId">The DNS record identifier.</param>
|
||||
public DeleteDnsRecordRequest(string zoneId, string recordId)
|
||||
{
|
||||
ZoneId = zoneId;
|
||||
RecordId = recordId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The zone identifier.
|
||||
/// </summary>
|
||||
public string ZoneId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The DNS record identifier.
|
||||
/// </summary>
|
||||
public string RecordId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Dns
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a request to import DNS records.
|
||||
/// </summary>
|
||||
public class ImportDnsRecordsRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ImportDnsRecordsRequest"/> class.
|
||||
/// </summary>
|
||||
/// <param name="zoneId">The zone identifier.</param>
|
||||
public ImportDnsRecordsRequest(string zoneId)
|
||||
{
|
||||
ZoneId = zoneId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The zone identifier.
|
||||
/// </summary>
|
||||
public string ZoneId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// BIND config to import.
|
||||
/// </summary>
|
||||
public string? File { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not proxiable records should receive the performance and
|
||||
/// security benefits of Cloudflare.
|
||||
/// </summary>
|
||||
public bool? Proxied { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Dns
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a request to overwrite a DNS record.
|
||||
/// </summary>
|
||||
public class OverwriteDnsRecordRequest : CreateDnsRecordRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="OverwriteDnsRecordRequest"/> class.
|
||||
/// </summary>
|
||||
/// <param name="zoneId">The zone identifier.</param>
|
||||
/// <param name="recordId">The DNS record identifier.</param>
|
||||
/// <param name="name">DNS record name (or @ for the zone apex) in Punycode.</param>
|
||||
public OverwriteDnsRecordRequest(string zoneId, string recordId, string name)
|
||||
: base(zoneId, name)
|
||||
{
|
||||
RecordId = recordId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The DNS record identifier.
|
||||
/// </summary>
|
||||
public string RecordId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Dns
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a request to update a DNS record.
|
||||
/// </summary>
|
||||
public class UpdateDnsRecordRequest : CreateDnsRecordRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UpdateDnsRecordRequest"/> class.
|
||||
/// </summary>
|
||||
/// <param name="zoneId">The zone identifier.</param>
|
||||
/// <param name="recordId">The DNS record identifier.</param>
|
||||
/// <param name="name">DNS record name (or @ for the zone apex) in Punycode.</param>
|
||||
public UpdateDnsRecordRequest(string zoneId, string recordId, string name)
|
||||
: base(zoneId, name)
|
||||
{
|
||||
RecordId = recordId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The DNS record identifier.
|
||||
/// </summary>
|
||||
public string RecordId { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user