Class BatchDnsRecordsRequest
- Namespace
- Cloudflare.NET.Dns.Models
- Assembly
- Cloudflare.NET.dll
Request to perform batch DNS record operations in a single API call.
Execution Order: Deletes → Patches → Puts → Posts. This order ensures that deletions happen first, allowing re-creation of records with the same name in the same batch.
public record BatchDnsRecordsRequest : IEquatable<BatchDnsRecordsRequest>
- Inheritance
-
BatchDnsRecordsRequest
- Implements
- Inherited Members
Examples
// Batch: delete one record, update another, create two new ones
var batch = new BatchDnsRecordsRequest(
Deletes: [new BatchDeleteOperation("record-id-to-delete")],
Patches: [new BatchPatchOperation("record-id-to-update", Content: "192.0.2.100")],
Posts: [
new CreateDnsRecordRequest(DnsRecordType.A, "new.example.com", "192.0.2.1"),
new CreateDnsRecordRequest(DnsRecordType.A, "new2.example.com", "192.0.2.2")
]
);
var result = await dns.BatchDnsRecordsAsync(zoneId, batch);
Constructors
BatchDnsRecordsRequest(IReadOnlyList<BatchDeleteOperation>?, IReadOnlyList<BatchPatchOperation>?, IReadOnlyList<BatchPutOperation>?, IReadOnlyList<CreateDnsRecordRequest>?)
Request to perform batch DNS record operations in a single API call.
Execution Order: Deletes → Patches → Puts → Posts. This order ensures that deletions happen first, allowing re-creation of records with the same name in the same batch.
public BatchDnsRecordsRequest(IReadOnlyList<BatchDeleteOperation>? Deletes = null, IReadOnlyList<BatchPatchOperation>? Patches = null, IReadOnlyList<BatchPutOperation>? Puts = null, IReadOnlyList<CreateDnsRecordRequest>? Posts = null)
Parameters
DeletesIReadOnlyList<BatchDeleteOperation>Records to delete (by ID). Executed first.
PatchesIReadOnlyList<BatchPatchOperation>Records to partially update (PATCH). Executed second.
PutsIReadOnlyList<BatchPutOperation>Records to fully replace (PUT). Executed third.
PostsIReadOnlyList<CreateDnsRecordRequest>Records to create (POST). Executed last.
Examples
// Batch: delete one record, update another, create two new ones
var batch = new BatchDnsRecordsRequest(
Deletes: [new BatchDeleteOperation("record-id-to-delete")],
Patches: [new BatchPatchOperation("record-id-to-update", Content: "192.0.2.100")],
Posts: [
new CreateDnsRecordRequest(DnsRecordType.A, "new.example.com", "192.0.2.1"),
new CreateDnsRecordRequest(DnsRecordType.A, "new2.example.com", "192.0.2.2")
]
);
var result = await dns.BatchDnsRecordsAsync(zoneId, batch);
- See Also
Properties
Deletes
Records to delete (by ID). Executed first.
[JsonPropertyName("deletes")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public IReadOnlyList<BatchDeleteOperation>? Deletes { get; init; }
Property Value
Patches
Records to partially update (PATCH). Executed second.
[JsonPropertyName("patches")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public IReadOnlyList<BatchPatchOperation>? Patches { get; init; }
Property Value
Posts
Records to create (POST). Executed last.
[JsonPropertyName("posts")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public IReadOnlyList<CreateDnsRecordRequest>? Posts { get; init; }
Property Value
Puts
Records to fully replace (PUT). Executed third.
[JsonPropertyName("puts")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public IReadOnlyList<BatchPutOperation>? Puts { get; init; }