cloudflare
Version:
The official TypeScript library for the Cloudflare API
2,177 lines (1,886 loc) • 289 kB
text/typescript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../../resource';
import * as Core from '../../core';
import * as RecordsAPI from './records';
import * as Shared from '../shared';
import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../pagination';
export class Records extends APIResource {
/**
* Create a new DNS record for a zone.
*
* Notes:
*
* - A/AAAA records cannot exist on the same name as CNAME records.
* - NS records cannot exist on the same name as any other record type.
* - Domain names are always represented in Punycode, even if Unicode characters
* were used when creating the record.
*/
create(params: RecordCreateParams, options?: Core.RequestOptions): Core.APIPromise<RecordResponse> {
const { zone_id, ...body } = params;
return (
this._client.post(`/zones/${zone_id}/dns_records`, { body, ...options }) as Core.APIPromise<{
result: RecordResponse;
}>
)._thenUnwrap((obj) => obj.result);
}
/**
* Overwrite an existing DNS record.
*
* Notes:
*
* - A/AAAA records cannot exist on the same name as CNAME records.
* - NS records cannot exist on the same name as any other record type.
* - Domain names are always represented in Punycode, even if Unicode characters
* were used when creating the record.
*/
update(
dnsRecordId: string,
params: RecordUpdateParams,
options?: Core.RequestOptions,
): Core.APIPromise<RecordResponse> {
const { zone_id, ...body } = params;
return (
this._client.put(`/zones/${zone_id}/dns_records/${dnsRecordId}`, {
body,
...options,
}) as Core.APIPromise<{ result: RecordResponse }>
)._thenUnwrap((obj) => obj.result);
}
/**
* List, search, sort, and filter a zones' DNS records.
*/
list(
params: RecordListParams,
options?: Core.RequestOptions,
): Core.PagePromise<RecordResponsesV4PagePaginationArray, RecordResponse> {
const { zone_id, ...query } = params;
return this._client.getAPIList(`/zones/${zone_id}/dns_records`, RecordResponsesV4PagePaginationArray, {
query,
...options,
});
}
/**
* Delete DNS Record
*/
delete(
dnsRecordId: string,
params: RecordDeleteParams,
options?: Core.RequestOptions,
): Core.APIPromise<RecordDeleteResponse> {
const { zone_id } = params;
return (
this._client.delete(`/zones/${zone_id}/dns_records/${dnsRecordId}`, options) as Core.APIPromise<{
result: RecordDeleteResponse;
}>
)._thenUnwrap((obj) => obj.result);
}
/**
* Send a Batch of DNS Record API calls to be executed together.
*
* Notes:
*
* - Although Cloudflare will execute the batched operations in a single database
* transaction, Cloudflare's distributed KV store must treat each record change
* as a single key-value pair. This means that the propagation of changes is not
* atomic. See
* [the documentation](https://developers.cloudflare.com/dns/manage-dns-records/how-to/batch-record-changes/ "Batch DNS records")
* for more information.
* - The operations you specify within the /batch request body are always executed
* in the following order:
*
* - Deletes
* - Patches
* - Puts
* - Posts
*/
batch(params: RecordBatchParams, options?: Core.RequestOptions): Core.APIPromise<RecordBatchResponse> {
const { zone_id, ...body } = params;
return (
this._client.post(`/zones/${zone_id}/dns_records/batch`, { body, ...options }) as Core.APIPromise<{
result: RecordBatchResponse;
}>
)._thenUnwrap((obj) => obj.result);
}
/**
* Update an existing DNS record.
*
* Notes:
*
* - A/AAAA records cannot exist on the same name as CNAME records.
* - NS records cannot exist on the same name as any other record type.
* - Domain names are always represented in Punycode, even if Unicode characters
* were used when creating the record.
*/
edit(
dnsRecordId: string,
params: RecordEditParams,
options?: Core.RequestOptions,
): Core.APIPromise<RecordResponse> {
const { zone_id, ...body } = params;
return (
this._client.patch(`/zones/${zone_id}/dns_records/${dnsRecordId}`, {
body,
...options,
}) as Core.APIPromise<{ result: RecordResponse }>
)._thenUnwrap((obj) => obj.result);
}
/**
* You can export your
* [BIND config](https://en.wikipedia.org/wiki/Zone_file "Zone file") through this
* endpoint.
*
* See
* [the documentation](https://developers.cloudflare.com/dns/manage-dns-records/how-to/import-and-export/ "Import and export records")
* for more information.
*/
export(params: RecordExportParams, options?: Core.RequestOptions): Core.APIPromise<string> {
const { zone_id } = params;
return this._client.get(`/zones/${zone_id}/dns_records/export`, {
...options,
headers: { Accept: 'text/plain', ...options?.headers },
});
}
/**
* DNS Record Details
*/
get(
dnsRecordId: string,
params: RecordGetParams,
options?: Core.RequestOptions,
): Core.APIPromise<RecordResponse> {
const { zone_id } = params;
return (
this._client.get(`/zones/${zone_id}/dns_records/${dnsRecordId}`, options) as Core.APIPromise<{
result: RecordResponse;
}>
)._thenUnwrap((obj) => obj.result);
}
/**
* You can upload your
* [BIND config](https://en.wikipedia.org/wiki/Zone_file "Zone file") through this
* endpoint. It assumes that cURL is called from a location with bind_config.txt
* (valid BIND config) present.
*
* See
* [the documentation](https://developers.cloudflare.com/dns/manage-dns-records/how-to/import-and-export/ "Import and export records")
* for more information.
*/
import(params: RecordImportParams, options?: Core.RequestOptions): Core.APIPromise<RecordImportResponse> {
const { zone_id, ...body } = params;
return (
this._client.post(
`/zones/${zone_id}/dns_records/import`,
Core.multipartFormRequestOptions({ body, ...options }),
) as Core.APIPromise<{ result: RecordImportResponse }>
)._thenUnwrap((obj) => obj.result);
}
/**
* Scan for common DNS records on your domain and automatically add them to your
* zone. Useful if you haven't updated your nameservers yet.
*/
scan(params: RecordScanParams, options?: Core.RequestOptions): Core.APIPromise<RecordScanResponse> {
const { zone_id, body } = params;
return (
this._client.post(`/zones/${zone_id}/dns_records/scan`, { body: body, ...options }) as Core.APIPromise<{
result: RecordScanResponse;
}>
)._thenUnwrap((obj) => obj.result);
}
}
export class RecordResponsesV4PagePaginationArray extends V4PagePaginationArray<RecordResponse> {}
export interface ARecord {
/**
* Comments or notes about the DNS record. This field has no effect on DNS
* responses.
*/
comment?: string;
/**
* A valid IPv4 address.
*/
content?: string;
/**
* DNS record name (or @ for the zone apex) in Punycode.
*/
name?: string;
/**
* Whether the record is receiving the performance and security benefits of
* Cloudflare.
*/
proxied?: boolean;
/**
* Settings for the DNS record.
*/
settings?: ARecord.Settings;
/**
* Custom tags for the DNS record. This field has no effect on DNS responses.
*/
tags?: Array<RecordTags>;
/**
* Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'.
* Value must be between 60 and 86400, with the minimum reduced to 30 for
* Enterprise zones.
*/
ttl?: TTL;
/**
* Record type.
*/
type?: 'A';
}
export namespace ARecord {
/**
* Settings for the DNS record.
*/
export interface Settings {
/**
* When enabled, only A records will be generated, and AAAA records will not be
* created. This setting is intended for exceptional cases. Note that this option
* only applies to proxied records and it has no effect on whether Cloudflare
* communicates with the origin using IPv4 or IPv6.
*/
ipv4_only?: boolean;
/**
* When enabled, only AAAA records will be generated, and A records will not be
* created. This setting is intended for exceptional cases. Note that this option
* only applies to proxied records and it has no effect on whether Cloudflare
* communicates with the origin using IPv4 or IPv6.
*/
ipv6_only?: boolean;
}
}
export interface ARecordParam {
/**
* Comments or notes about the DNS record. This field has no effect on DNS
* responses.
*/
comment?: string;
/**
* A valid IPv4 address.
*/
content?: string;
/**
* DNS record name (or @ for the zone apex) in Punycode.
*/
name?: string;
/**
* Whether the record is receiving the performance and security benefits of
* Cloudflare.
*/
proxied?: boolean;
/**
* Settings for the DNS record.
*/
settings?: ARecordParam.Settings;
/**
* Custom tags for the DNS record. This field has no effect on DNS responses.
*/
tags?: Array<RecordTagsParam>;
/**
* Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'.
* Value must be between 60 and 86400, with the minimum reduced to 30 for
* Enterprise zones.
*/
ttl?: TTLParam;
/**
* Record type.
*/
type?: 'A';
}
export namespace ARecordParam {
/**
* Settings for the DNS record.
*/
export interface Settings {
/**
* When enabled, only A records will be generated, and AAAA records will not be
* created. This setting is intended for exceptional cases. Note that this option
* only applies to proxied records and it has no effect on whether Cloudflare
* communicates with the origin using IPv4 or IPv6.
*/
ipv4_only?: boolean;
/**
* When enabled, only AAAA records will be generated, and A records will not be
* created. This setting is intended for exceptional cases. Note that this option
* only applies to proxied records and it has no effect on whether Cloudflare
* communicates with the origin using IPv4 or IPv6.
*/
ipv6_only?: boolean;
}
}
export interface AAAARecord {
/**
* Comments or notes about the DNS record. This field has no effect on DNS
* responses.
*/
comment?: string;
/**
* A valid IPv6 address.
*/
content?: string;
/**
* DNS record name (or @ for the zone apex) in Punycode.
*/
name?: string;
/**
* Whether the record is receiving the performance and security benefits of
* Cloudflare.
*/
proxied?: boolean;
/**
* Settings for the DNS record.
*/
settings?: AAAARecord.Settings;
/**
* Custom tags for the DNS record. This field has no effect on DNS responses.
*/
tags?: Array<RecordTags>;
/**
* Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'.
* Value must be between 60 and 86400, with the minimum reduced to 30 for
* Enterprise zones.
*/
ttl?: TTL;
/**
* Record type.
*/
type?: 'AAAA';
}
export namespace AAAARecord {
/**
* Settings for the DNS record.
*/
export interface Settings {
/**
* When enabled, only A records will be generated, and AAAA records will not be
* created. This setting is intended for exceptional cases. Note that this option
* only applies to proxied records and it has no effect on whether Cloudflare
* communicates with the origin using IPv4 or IPv6.
*/
ipv4_only?: boolean;
/**
* When enabled, only AAAA records will be generated, and A records will not be
* created. This setting is intended for exceptional cases. Note that this option
* only applies to proxied records and it has no effect on whether Cloudflare
* communicates with the origin using IPv4 or IPv6.
*/
ipv6_only?: boolean;
}
}
export interface AAAARecordParam {
/**
* Comments or notes about the DNS record. This field has no effect on DNS
* responses.
*/
comment?: string;
/**
* A valid IPv6 address.
*/
content?: string;
/**
* DNS record name (or @ for the zone apex) in Punycode.
*/
name?: string;
/**
* Whether the record is receiving the performance and security benefits of
* Cloudflare.
*/
proxied?: boolean;
/**
* Settings for the DNS record.
*/
settings?: AAAARecordParam.Settings;
/**
* Custom tags for the DNS record. This field has no effect on DNS responses.
*/
tags?: Array<RecordTagsParam>;
/**
* Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'.
* Value must be between 60 and 86400, with the minimum reduced to 30 for
* Enterprise zones.
*/
ttl?: TTLParam;
/**
* Record type.
*/
type?: 'AAAA';
}
export namespace AAAARecordParam {
/**
* Settings for the DNS record.
*/
export interface Settings {
/**
* When enabled, only A records will be generated, and AAAA records will not be
* created. This setting is intended for exceptional cases. Note that this option
* only applies to proxied records and it has no effect on whether Cloudflare
* communicates with the origin using IPv4 or IPv6.
*/
ipv4_only?: boolean;
/**
* When enabled, only AAAA records will be generated, and A records will not be
* created. This setting is intended for exceptional cases. Note that this option
* only applies to proxied records and it has no effect on whether Cloudflare
* communicates with the origin using IPv4 or IPv6.
*/
ipv6_only?: boolean;
}
}
export type BatchPatch =
| BatchPatch.A
| BatchPatch.AAAA
| BatchPatch.CAA
| BatchPatch.CERT
| BatchPatch.CNAME
| BatchPatch.DNSKEY
| BatchPatch.DS
| BatchPatch.HTTPS
| BatchPatch.LOC
| BatchPatch.MX
| BatchPatch.NAPTR
| BatchPatch.NS
| BatchPatch.Openpgpkey
| BatchPatch.PTR
| BatchPatch.SMIMEA
| BatchPatch.SRV
| BatchPatch.SSHFP
| BatchPatch.SVCB
| BatchPatch.TLSA
| BatchPatch.TXT
| BatchPatch.URI;
export namespace BatchPatch {
export interface A extends RecordsAPI.ARecord {
/**
* Identifier
*/
id: string;
}
export interface AAAA extends RecordsAPI.AAAARecord {
/**
* Identifier
*/
id: string;
}
export interface CAA extends RecordsAPI.CAARecord {
/**
* Identifier
*/
id: string;
}
export interface CERT extends RecordsAPI.CERTRecord {
/**
* Identifier
*/
id: string;
}
export interface CNAME extends RecordsAPI.CNAMERecord {
/**
* Identifier
*/
id: string;
}
export interface DNSKEY extends RecordsAPI.DNSKEYRecord {
/**
* Identifier
*/
id: string;
}
export interface DS extends RecordsAPI.DSRecord {
/**
* Identifier
*/
id: string;
}
export interface HTTPS extends RecordsAPI.HTTPSRecord {
/**
* Identifier
*/
id: string;
}
export interface LOC extends RecordsAPI.LOCRecord {
/**
* Identifier
*/
id: string;
}
export interface MX extends RecordsAPI.MXRecord {
/**
* Identifier
*/
id: string;
}
export interface NAPTR extends RecordsAPI.NAPTRRecord {
/**
* Identifier
*/
id: string;
}
export interface NS extends RecordsAPI.NSRecord {
/**
* Identifier
*/
id: string;
}
export interface Openpgpkey {
/**
* Identifier
*/
id: string;
/**
* Comments or notes about the DNS record. This field has no effect on DNS
* responses.
*/
comment?: string;
/**
* A single Base64-encoded OpenPGP Transferable Public Key (RFC 4880 Section 11.1)
*/
content?: string;
/**
* DNS record name (or @ for the zone apex) in Punycode.
*/
name?: string;
/**
* Whether the record is receiving the performance and security benefits of
* Cloudflare.
*/
proxied?: boolean;
/**
* Settings for the DNS record.
*/
settings?: Openpgpkey.Settings;
/**
* Custom tags for the DNS record. This field has no effect on DNS responses.
*/
tags?: Array<RecordsAPI.RecordTags>;
/**
* Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'.
* Value must be between 60 and 86400, with the minimum reduced to 30 for
* Enterprise zones.
*/
ttl?: RecordsAPI.TTL;
/**
* Record type.
*/
type?: 'OPENPGPKEY';
}
export namespace Openpgpkey {
/**
* Settings for the DNS record.
*/
export interface Settings {
/**
* When enabled, only A records will be generated, and AAAA records will not be
* created. This setting is intended for exceptional cases. Note that this option
* only applies to proxied records and it has no effect on whether Cloudflare
* communicates with the origin using IPv4 or IPv6.
*/
ipv4_only?: boolean;
/**
* When enabled, only AAAA records will be generated, and A records will not be
* created. This setting is intended for exceptional cases. Note that this option
* only applies to proxied records and it has no effect on whether Cloudflare
* communicates with the origin using IPv4 or IPv6.
*/
ipv6_only?: boolean;
}
}
export interface PTR extends RecordsAPI.PTRRecord {
/**
* Identifier
*/
id: string;
}
export interface SMIMEA extends RecordsAPI.SMIMEARecord {
/**
* Identifier
*/
id: string;
}
export interface SRV extends RecordsAPI.SRVRecord {
/**
* Identifier
*/
id: string;
}
export interface SSHFP extends RecordsAPI.SSHFPRecord {
/**
* Identifier
*/
id: string;
}
export interface SVCB extends RecordsAPI.SVCBRecord {
/**
* Identifier
*/
id: string;
}
export interface TLSA extends RecordsAPI.TLSARecord {
/**
* Identifier
*/
id: string;
}
export interface TXT extends RecordsAPI.TXTRecord {
/**
* Identifier
*/
id: string;
}
export interface URI extends RecordsAPI.URIRecord {
/**
* Identifier
*/
id: string;
}
}
export type BatchPatchParam =
| BatchPatchParam.A
| BatchPatchParam.AAAA
| BatchPatchParam.CAA
| BatchPatchParam.CERT
| BatchPatchParam.CNAME
| BatchPatchParam.DNSKEY
| BatchPatchParam.DS
| BatchPatchParam.HTTPS
| BatchPatchParam.LOC
| BatchPatchParam.MX
| BatchPatchParam.NAPTR
| BatchPatchParam.NS
| BatchPatchParam.Openpgpkey
| BatchPatchParam.PTR
| BatchPatchParam.SMIMEA
| BatchPatchParam.SRV
| BatchPatchParam.SSHFP
| BatchPatchParam.SVCB
| BatchPatchParam.TLSA
| BatchPatchParam.TXT
| BatchPatchParam.URI;
export namespace BatchPatchParam {
export interface A extends RecordsAPI.ARecordParam {
/**
* Identifier
*/
id: string;
}
export interface AAAA extends RecordsAPI.AAAARecordParam {
/**
* Identifier
*/
id: string;
}
export interface CAA extends RecordsAPI.CAARecordParam {
/**
* Identifier
*/
id: string;
}
export interface CERT extends RecordsAPI.CERTRecordParam {
/**
* Identifier
*/
id: string;
}
export interface CNAME extends RecordsAPI.CNAMERecordParam {
/**
* Identifier
*/
id: string;
}
export interface DNSKEY extends RecordsAPI.DNSKEYRecordParam {
/**
* Identifier
*/
id: string;
}
export interface DS extends RecordsAPI.DSRecordParam {
/**
* Identifier
*/
id: string;
}
export interface HTTPS extends RecordsAPI.HTTPSRecordParam {
/**
* Identifier
*/
id: string;
}
export interface LOC extends RecordsAPI.LOCRecordParam {
/**
* Identifier
*/
id: string;
}
export interface MX extends RecordsAPI.MXRecordParam {
/**
* Identifier
*/
id: string;
}
export interface NAPTR extends RecordsAPI.NAPTRRecordParam {
/**
* Identifier
*/
id: string;
}
export interface NS extends RecordsAPI.NSRecordParam {
/**
* Identifier
*/
id: string;
}
export interface Openpgpkey {
/**
* Identifier
*/
id: string;
/**
* Comments or notes about the DNS record. This field has no effect on DNS
* responses.
*/
comment?: string;
/**
* A single Base64-encoded OpenPGP Transferable Public Key (RFC 4880 Section 11.1)
*/
content?: string;
/**
* DNS record name (or @ for the zone apex) in Punycode.
*/
name?: string;
/**
* Whether the record is receiving the performance and security benefits of
* Cloudflare.
*/
proxied?: boolean;
/**
* Settings for the DNS record.
*/
settings?: Openpgpkey.Settings;
/**
* Custom tags for the DNS record. This field has no effect on DNS responses.
*/
tags?: Array<RecordsAPI.RecordTagsParam>;
/**
* Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'.
* Value must be between 60 and 86400, with the minimum reduced to 30 for
* Enterprise zones.
*/
ttl?: RecordsAPI.TTLParam;
/**
* Record type.
*/
type?: 'OPENPGPKEY';
}
export namespace Openpgpkey {
/**
* Settings for the DNS record.
*/
export interface Settings {
/**
* When enabled, only A records will be generated, and AAAA records will not be
* created. This setting is intended for exceptional cases. Note that this option
* only applies to proxied records and it has no effect on whether Cloudflare
* communicates with the origin using IPv4 or IPv6.
*/
ipv4_only?: boolean;
/**
* When enabled, only AAAA records will be generated, and A records will not be
* created. This setting is intended for exceptional cases. Note that this option
* only applies to proxied records and it has no effect on whether Cloudflare
* communicates with the origin using IPv4 or IPv6.
*/
ipv6_only?: boolean;
}
}
export interface PTR extends RecordsAPI.PTRRecordParam {
/**
* Identifier
*/
id: string;
}
export interface SMIMEA extends RecordsAPI.SMIMEARecordParam {
/**
* Identifier
*/
id: string;
}
export interface SRV extends RecordsAPI.SRVRecordParam {
/**
* Identifier
*/
id: string;
}
export interface SSHFP extends RecordsAPI.SSHFPRecordParam {
/**
* Identifier
*/
id: string;
}
export interface SVCB extends RecordsAPI.SVCBRecordParam {
/**
* Identifier
*/
id: string;
}
export interface TLSA extends RecordsAPI.TLSARecordParam {
/**
* Identifier
*/
id: string;
}
export interface TXT extends RecordsAPI.TXTRecordParam {
/**
* Identifier
*/
id: string;
}
export interface URI extends RecordsAPI.URIRecordParam {
/**
* Identifier
*/
id: string;
}
}
export type BatchPut =
| BatchPut.A
| BatchPut.AAAA
| BatchPut.CAA
| BatchPut.CERT
| BatchPut.CNAME
| BatchPut.DNSKEY
| BatchPut.DS
| BatchPut.HTTPS
| BatchPut.LOC
| BatchPut.MX
| BatchPut.NAPTR
| BatchPut.NS
| BatchPut.Openpgpkey
| BatchPut.PTR
| BatchPut.SMIMEA
| BatchPut.SRV
| BatchPut.SSHFP
| BatchPut.SVCB
| BatchPut.TLSA
| BatchPut.TXT
| BatchPut.URI;
export namespace BatchPut {
export interface A extends RecordsAPI.ARecord {
/**
* Identifier
*/
id?: string;
}
export interface AAAA extends RecordsAPI.AAAARecord {
/**
* Identifier
*/
id?: string;
}
export interface CAA extends RecordsAPI.CAARecord {
/**
* Identifier
*/
id?: string;
}
export interface CERT extends RecordsAPI.CERTRecord {
/**
* Identifier
*/
id?: string;
}
export interface CNAME extends RecordsAPI.CNAMERecord {
/**
* Identifier
*/
id?: string;
}
export interface DNSKEY extends RecordsAPI.DNSKEYRecord {
/**
* Identifier
*/
id?: string;
}
export interface DS extends RecordsAPI.DSRecord {
/**
* Identifier
*/
id?: string;
}
export interface HTTPS extends RecordsAPI.HTTPSRecord {
/**
* Identifier
*/
id?: string;
}
export interface LOC extends RecordsAPI.LOCRecord {
/**
* Identifier
*/
id?: string;
}
export interface MX extends RecordsAPI.MXRecord {
/**
* Identifier
*/
id?: string;
}
export interface NAPTR extends RecordsAPI.NAPTRRecord {
/**
* Identifier
*/
id?: string;
}
export interface NS extends RecordsAPI.NSRecord {
/**
* Identifier
*/
id?: string;
}
export interface Openpgpkey {
/**
* A single Base64-encoded OpenPGP Transferable Public Key (RFC 4880 Section 11.1)
*/
content: string;
/**
* DNS record name (or @ for the zone apex) in Punycode.
*/
name: string;
/**
* Record type.
*/
type: 'OPENPGPKEY';
/**
* Identifier
*/
id?: string;
/**
* Comments or notes about the DNS record. This field has no effect on DNS
* responses.
*/
comment?: string;
/**
* Whether the record is receiving the performance and security benefits of
* Cloudflare.
*/
proxied?: boolean;
/**
* Settings for the DNS record.
*/
settings?: Openpgpkey.Settings;
/**
* Custom tags for the DNS record. This field has no effect on DNS responses.
*/
tags?: Array<RecordsAPI.RecordTags>;
/**
* Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'.
* Value must be between 60 and 86400, with the minimum reduced to 30 for
* Enterprise zones.
*/
ttl?: RecordsAPI.TTL;
}
export namespace Openpgpkey {
/**
* Settings for the DNS record.
*/
export interface Settings {
/**
* When enabled, only A records will be generated, and AAAA records will not be
* created. This setting is intended for exceptional cases. Note that this option
* only applies to proxied records and it has no effect on whether Cloudflare
* communicates with the origin using IPv4 or IPv6.
*/
ipv4_only?: boolean;
/**
* When enabled, only AAAA records will be generated, and A records will not be
* created. This setting is intended for exceptional cases. Note that this option
* only applies to proxied records and it has no effect on whether Cloudflare
* communicates with the origin using IPv4 or IPv6.
*/
ipv6_only?: boolean;
}
}
export interface PTR extends RecordsAPI.PTRRecord {
/**
* Identifier
*/
id?: string;
}
export interface SMIMEA extends RecordsAPI.SMIMEARecord {
/**
* Identifier
*/
id?: string;
}
export interface SRV extends RecordsAPI.SRVRecord {
/**
* Identifier
*/
id?: string;
}
export interface SSHFP extends RecordsAPI.SSHFPRecord {
/**
* Identifier
*/
id?: string;
}
export interface SVCB extends RecordsAPI.SVCBRecord {
/**
* Identifier
*/
id?: string;
}
export interface TLSA extends RecordsAPI.TLSARecord {
/**
* Identifier
*/
id?: string;
}
export interface TXT extends RecordsAPI.TXTRecord {
/**
* Identifier
*/
id?: string;
}
export interface URI extends RecordsAPI.URIRecord {
/**
* Identifier
*/
id?: string;
}
}
export type BatchPutParam =
| BatchPutParam.A
| BatchPutParam.AAAA
| BatchPutParam.CAA
| BatchPutParam.CERT
| BatchPutParam.CNAME
| BatchPutParam.DNSKEY
| BatchPutParam.DS
| BatchPutParam.HTTPS
| BatchPutParam.LOC
| BatchPutParam.MX
| BatchPutParam.NAPTR
| BatchPutParam.NS
| BatchPutParam.Openpgpkey
| BatchPutParam.PTR
| BatchPutParam.SMIMEA
| BatchPutParam.SRV
| BatchPutParam.SSHFP
| BatchPutParam.SVCB
| BatchPutParam.TLSA
| BatchPutParam.TXT
| BatchPutParam.URI;
export namespace BatchPutParam {
export interface A extends RecordsAPI.ARecordParam {
/**
* Identifier
*/
id?: string;
}
export interface AAAA extends RecordsAPI.AAAARecordParam {
/**
* Identifier
*/
id?: string;
}
export interface CAA extends RecordsAPI.CAARecordParam {
/**
* Identifier
*/
id?: string;
}
export interface CERT extends RecordsAPI.CERTRecordParam {
/**
* Identifier
*/
id?: string;
}
export interface CNAME extends RecordsAPI.CNAMERecordParam {
/**
* Identifier
*/
id?: string;
}
export interface DNSKEY extends RecordsAPI.DNSKEYRecordParam {
/**
* Identifier
*/
id?: string;
}
export interface DS extends RecordsAPI.DSRecordParam {
/**
* Identifier
*/
id?: string;
}
export interface HTTPS extends RecordsAPI.HTTPSRecordParam {
/**
* Identifier
*/
id?: string;
}
export interface LOC extends RecordsAPI.LOCRecordParam {
/**
* Identifier
*/
id?: string;
}
export interface MX extends RecordsAPI.MXRecordParam {
/**
* Identifier
*/
id?: string;
}
export interface NAPTR extends RecordsAPI.NAPTRRecordParam {
/**
* Identifier
*/
id?: string;
}
export interface NS extends RecordsAPI.NSRecordParam {
/**
* Identifier
*/
id?: string;
}
export interface Openpgpkey {
/**
* A single Base64-encoded OpenPGP Transferable Public Key (RFC 4880 Section 11.1)
*/
content: string;
/**
* DNS record name (or @ for the zone apex) in Punycode.
*/
name: string;
/**
* Record type.
*/
type: 'OPENPGPKEY';
/**
* Identifier
*/
id?: string;
/**
* Comments or notes about the DNS record. This field has no effect on DNS
* responses.
*/
comment?: string;
/**
* Whether the record is receiving the performance and security benefits of
* Cloudflare.
*/
proxied?: boolean;
/**
* Settings for the DNS record.
*/
settings?: Openpgpkey.Settings;
/**
* Custom tags for the DNS record. This field has no effect on DNS responses.
*/
tags?: Array<RecordsAPI.RecordTagsParam>;
/**
* Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'.
* Value must be between 60 and 86400, with the minimum reduced to 30 for
* Enterprise zones.
*/
ttl?: RecordsAPI.TTLParam;
}
export namespace Openpgpkey {
/**
* Settings for the DNS record.
*/
export interface Settings {
/**
* When enabled, only A records will be generated, and AAAA records will not be
* created. This setting is intended for exceptional cases. Note that this option
* only applies to proxied records and it has no effect on whether Cloudflare
* communicates with the origin using IPv4 or IPv6.
*/
ipv4_only?: boolean;
/**
* When enabled, only AAAA records will be generated, and A records will not be
* created. This setting is intended for exceptional cases. Note that this option
* only applies to proxied records and it has no effect on whether Cloudflare
* communicates with the origin using IPv4 or IPv6.
*/
ipv6_only?: boolean;
}
}
export interface PTR extends RecordsAPI.PTRRecordParam {
/**
* Identifier
*/
id?: string;
}
export interface SMIMEA extends RecordsAPI.SMIMEARecordParam {
/**
* Identifier
*/
id?: string;
}
export interface SRV extends RecordsAPI.SRVRecordParam {
/**
* Identifier
*/
id?: string;
}
export interface SSHFP extends RecordsAPI.SSHFPRecordParam {
/**
* Identifier
*/
id?: string;
}
export interface SVCB extends RecordsAPI.SVCBRecordParam {
/**
* Identifier
*/
id?: string;
}
export interface TLSA extends RecordsAPI.TLSARecordParam {
/**
* Identifier
*/
id?: string;
}
export interface TXT extends RecordsAPI.TXTRecordParam {
/**
* Identifier
*/
id?: string;
}
export interface URI extends RecordsAPI.URIRecordParam {
/**
* Identifier
*/
id?: string;
}
}
export interface CAARecord {
/**
* Comments or notes about the DNS record. This field has no effect on DNS
* responses.
*/
comment?: string;
/**
* Formatted CAA content. See 'data' to set CAA properties.
*/
content?: string;
/**
* Components of a CAA record.
*/
data?: CAARecord.Data;
/**
* DNS record name (or @ for the zone apex) in Punycode.
*/
name?: string;
/**
* Whether the record is receiving the performance and security benefits of
* Cloudflare.
*/
proxied?: boolean;
/**
* Settings for the DNS record.
*/
settings?: CAARecord.Settings;
/**
* Custom tags for the DNS record. This field has no effect on DNS responses.
*/
tags?: Array<RecordTags>;
/**
* Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'.
* Value must be between 60 and 86400, with the minimum reduced to 30 for
* Enterprise zones.
*/
ttl?: TTL;
/**
* Record type.
*/
type?: 'CAA';
}
export namespace CAARecord {
/**
* Components of a CAA record.
*/
export interface Data {
/**
* Flags for the CAA record.
*/
flags?: number;
/**
* Name of the property controlled by this record (e.g.: issue, issuewild, iodef).
*/
tag?: string;
/**
* Value of the record. This field's semantics depend on the chosen tag.
*/
value?: string;
}
/**
* Settings for the DNS record.
*/
export interface Settings {
/**
* When enabled, only A records will be generated, and AAAA records will not be
* created. This setting is intended for exceptional cases. Note that this option
* only applies to proxied records and it has no effect on whether Cloudflare
* communicates with the origin using IPv4 or IPv6.
*/
ipv4_only?: boolean;
/**
* When enabled, only AAAA records will be generated, and A records will not be
* created. This setting is intended for exceptional cases. Note that this option
* only applies to proxied records and it has no effect on whether Cloudflare
* communicates with the origin using IPv4 or IPv6.
*/
ipv6_only?: boolean;
}
}
export interface CAARecordParam {
/**
* Comments or notes about the DNS record. This field has no effect on DNS
* responses.
*/
comment?: string;
/**
* Components of a CAA record.
*/
data?: CAARecordParam.Data;
/**
* DNS record name (or @ for the zone apex) in Punycode.
*/
name?: string;
/**
* Whether the record is receiving the performance and security benefits of
* Cloudflare.
*/
proxied?: boolean;
/**
* Settings for the DNS record.
*/
settings?: CAARecordParam.Settings;
/**
* Custom tags for the DNS record. This field has no effect on DNS responses.
*/
tags?: Array<RecordTagsParam>;
/**
* Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'.
* Value must be between 60 and 86400, with the minimum reduced to 30 for
* Enterprise zones.
*/
ttl?: TTLParam;
/**
* Record type.
*/
type?: 'CAA';
}
export namespace CAARecordParam {
/**
* Components of a CAA record.
*/
export interface Data {
/**
* Flags for the CAA record.
*/
flags?: number;
/**
* Name of the property controlled by this record (e.g.: issue, issuewild, iodef).
*/
tag?: string;
/**
* Value of the record. This field's semantics depend on the chosen tag.
*/
value?: string;
}
/**
* Settings for the DNS record.
*/
export interface Settings {
/**
* When enabled, only A records will be generated, and AAAA records will not be
* created. This setting is intended for exceptional cases. Note that this option
* only applies to proxied records and it has no effect on whether Cloudflare
* communicates with the origin using IPv4 or IPv6.
*/
ipv4_only?: boolean;
/**
* When enabled, only AAAA records will be generated, and A records will not be
* created. This setting is intended for exceptional cases. Note that this option
* only applies to proxied records and it has no effect on whether Cloudflare
* communicates with the origin using IPv4 or IPv6.
*/
ipv6_only?: boolean;
}
}
export interface CERTRecord {
/**
* Comments or notes about the DNS record. This field has no effect on DNS
* responses.
*/
comment?: string;
/**
* Formatted CERT content. See 'data' to set CERT properties.
*/
content?: string;
/**
* Components of a CERT record.
*/
data?: CERTRecord.Data;
/**
* DNS record name (or @ for the zone apex) in Punycode.
*/
name?: string;
/**
* Whether the record is receiving the performance and security benefits of
* Cloudflare.
*/
proxied?: boolean;
/**
* Settings for the DNS record.
*/
settings?: CERTRecord.Settings;
/**
* Custom tags for the DNS record. This field has no effect on DNS responses.
*/
tags?: Array<RecordTags>;
/**
* Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'.
* Value must be between 60 and 86400, with the minimum reduced to 30 for
* Enterprise zones.
*/
ttl?: TTL;
/**
* Record type.
*/
type?: 'CERT';
}
export namespace CERTRecord {
/**
* Components of a CERT record.
*/
export interface Data {
/**
* Algorithm.
*/
algorithm?: number;
/**
* Certificate.
*/
certificate?: string;
/**
* Key Tag.
*/
key_tag?: number;
/**
* Type.
*/
type?: number;
}
/**
* Settings for the DNS record.
*/
export interface Settings {
/**
* When enabled, only A records will be generated, and AAAA records will not be
* created. This setting is intended for exceptional cases. Note that this option
* only applies to proxied records and it has no effect on whether Cloudflare
* communicates with the origin using IPv4 or IPv6.
*/
ipv4_only?: boolean;
/**
* When enabled, only AAAA records will be generated, and A records will not be
* created. This setting is intended for exceptional cases. Note that this option
* only applies to proxied records and it has no effect on whether Cloudflare
* communicates with the origin using IPv4 or IPv6.
*/
ipv6_only?: boolean;
}
}
export interface CERTRecordParam {
/**
* Comments or notes about the DNS record. This field has no effect on DNS
* responses.
*/
comment?: string;
/**
* Components of a CERT record.
*/
data?: CERTRecordParam.Data;
/**
* DNS record name (or @ for the zone apex) in Punycode.
*/
name?: string;
/**
* Whether the record is receiving the performance and security benefits of
* Cloudflare.
*/
proxied?: boolean;
/**
* Settings for the DNS record.
*/
settings?: CERTRecordParam.Settings;
/**
* Custom tags for the DNS record. This field has no effect on DNS responses.
*/
tags?: Array<RecordTagsParam>;
/**
* Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'.
* Value must be between 60 and 86400, with the minimum reduced to 30 for
* Enterprise zones.
*/
ttl?: TTLParam;
/**
* Record type.
*/
type?: 'CERT';
}
export namespace CERTRecordParam {
/**
* Components of a CERT record.
*/
export interface Data {
/**
* Algorithm.
*/
algorithm?: number;
/**
* Certificate.
*/
certificate?: string;
/**
* Key Tag.
*/
key_tag?: number;
/**
* Type.
*/
type?: number;
}
/**
* Settings for the DNS record.
*/
export interface Settings {
/**
* When enabled, only A records will be generated, and AAAA records will not be
* created. This setting is intended for exceptional cases. Note that this option
* only applies to proxied records and it has no effect on whether Cloudflare
* communicates with the origin using IPv4 or IPv6.
*/
ipv4_only?: boolean;
/**
* When enabled, only AAAA records will be generated, and A records will not be
* created. This setting is intended for exceptional cases. Note that this option
* only applies to proxied records and it has no effect on whether Cloudflare
* communicates with the origin using IPv4 or IPv6.
*/
ipv6_only?: boolean;
}
}
export interface CNAMERecord {
/**
* Comments or notes about the DNS record. This field has no effect on DNS
* responses.
*/
comment?: string;
/**
* A valid hostname. Must not match the record's name.
*/
content?: string;
/**
* DNS record name (or @ for the zone apex) in Punycode.
*/
name?: string;
/**
* Whether the record is receiving the performance and security benefits of
* Cloudflare.
*/
proxied?: boolean;
/**
* Settings for the DNS record.
*/
settings?: CNAMERecord.Settings;
/**
* Custom tags for the DNS record. This field has no effect on DNS responses.
*/
tags?: Array<RecordTags>;
/**
* Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'.
* Value must be between 60 and 86400, with the minimum reduced to 30 for
* Enterprise zones.
*/
ttl?: TTL;
/**
* Record type.
*/
type?: 'CNAME';
}
export namespace CNAMERecord {
/**
* Settings for the DNS record.
*/
export interface Settings {
/**
* If enabled, causes the CNAME record to be resolved externally and the resulting
* address records (e.g., A and AAAA) to be returned instead of the CNAME record
* itself. This setting is unavailable for proxied records, since they are always
* flattened.
*/
flatten_cname?: boolean;
/**
* When enabled, only A records will be generated, and AAAA records will not be
* created. This setting is intended for exceptional cases. Note that this option
* only applies to proxied records and it has no effect on whether Cloudflare
* communicates with the origin using IPv4 or IPv6.
*/
ipv4_only?: boolean;
/**
* When enabled, only AAAA records will be generated, and A records will not be
* created. This setting is intended for exceptional cases. Note that this option
* only applies to proxied records and it has no effect on whether Cloudflare
* communicates with the origin using IPv4 or IPv6.
*/
ipv6_only?: boolean;
}
}
export interface CNAMERecordParam {
/**
* Comments or notes about the DNS record. This field has no effect on DNS
* responses.
*/
comment?: string;
/**
* A valid hostname. Must not match the record's name.
*/
content?: string;
/**
* DNS record name (or @ for the zone apex) in Punycode.
*/
name?: string;
/**
* Whether the record is receiving the performance and security benefits of
* Cloudflare.
*/
proxied?: boolean;
/**
* Settings for the DNS record.
*/
settings?: CNAMERecordParam.Settings;
/**
* Custom tags for the DNS record. This field has no effect on DNS responses.
*/
tags?: Array<RecordTagsParam>;
/**
* Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'.
* Value must be between 60 and 86400, with the minimum reduced to 30 for
* Enterprise zones.
*/
ttl?: TTLParam;
/**
* Record type.
*/
type?: 'CNAME';
}
export namespace CNAMERecordParam {
/**
* Settings for the DNS record.
*/
export interface Settings {
/**
* If enabled, causes the CNAME record to be resolved externally and the resulting
* address records (e.g., A and AAAA) to be returned instead of the CNAME record
* itself. This setting is unavailable for proxied records, since they are always
* flattened.
*/
flatten_cname?: boolean;
/**
* When enabled, only A records will be generated, and AAAA records will not be
* created. This setting is intended for exceptional cases. Note that this option
* only applies to proxied records and it has no effect on whether Cloudflare
* communicates with the origin using IPv4 or IPv6.
*/
ipv4_only?: boolean;
/**
* When enabled, only AAAA records will be generated, and A records will not be
* created. This setting is intended for exceptional cases. Note that this option
* only applies to proxied records and it has no effect on whether Cloudflare
* communicates with the origin using IPv4 or IPv6.
*/
ipv6_only?: boolean;
}
}
export interface DNSKEYRecord {
/**
* Comments or notes about the DNS record. This field has no effect on DNS
* responses.
*/
comment?: string;
/**
* Formatted DNSKEY content. See 'data' to set DNSKEY properties.
*/
content?: string;
/**
* Components of a DNSKEY record.
*/
data?: DNSKEYRecord.Data;
/**
* DNS record name (or @ for the zone apex) in Punycode.
*/
name?: string;
/**
* Whether the record is receiving the performance and security benefits of
* Cloudflare.
*/
proxied?: boolean;
/**
* Settings for the DNS record.
*/
settings?: DNSKEYRecord.Settings;
/**
* Custom tags for the DNS record. This field has no effect on DNS responses.
*/
tags?: Array<RecordTags>;
/**
* Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'.
* Value must be between 60 and 86400, with the minimum reduced to 30 for
* Enterprise zones.
*/
ttl?: TTL;
/**
* Record type.
*/
type?: 'DNSKEY';
}
export namespace DNSKEYRecord {
/**
* Components of a DNSKEY record.
*/
export interface Data {
/**
* Algorithm.
*/
algorithm?: number;
/**
* Flags.
*/
flags?: number;
/**
* Protocol.
*/
protocol?: number;
/**
* Public Key.
*/
public_key?: string;
}
/**
* Settings for the DNS record.
*/
export interface Settings {
/**
* When enabled, only A records will be generated, and AAAA records will not be
* created. This setting is intended for exceptional cases. Note that this option
* only applies to proxied records and it has no effect on whether Cloudflare
* communicates with the origin using IPv4 or IPv6.
*/
ipv4_only?: boolean;
/**
* When enabled, only AAAA records will be generated, and A records will not be
* created. This setting is intended for exceptional cases. Note that this option
* only applies to proxied records and it has no effect on whether Cloudflare
* communicates with the origin using IPv4 or IPv6.
*/
ipv6_only?: boolean;
}
}
export interface DNSKEYRecordParam {
/**
* Comments or notes about the DNS record. This field has no effect on DNS
* responses.
*/
comment?: string;
/**
* Components of a DNSKEY record.
*/
data?: DNSKEYRecordParam.Data;
/**
* DNS record name (or @ for the zone apex) in Punycode.
*/
name?: string;
/**
* Whether the record is receiving the performance and security benefits of
* Cloudflare.
*/
proxied?: boolean;
/**
* Settings for the DNS record.
*/
settings?: DNSKEYRecordParam.Settings;
/**
* Custom tags for the DNS record. This field has no effect on DNS responses.
*/
tags?: Array<RecordTagsParam>;
/**
* Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'.
* Value must be between 60 and 86400, with the minimum reduced to 30 for
* Enterprise zones.
*/
ttl?: TTLParam;
/**
* Record type.
*/
type?: 'DNSKEY';
}
export namespace DNSKEYRecordParam {
/**
* Components of a DNSKEY record.
*/
export interface Data {
/**
* Algorithm.
*/
algorithm?: number;
/**
* Flags.
*/
flags?: number;
/**
* Protocol.
*/
protocol?: number;
/**
* Public Key.
*/
public_key?: string;
}
/**
* Settings for the DNS record.
*/
export interface Settings {
/**
* When enabled, only A records will be generated, and AAAA records will not be
* created. This setting is intended for exceptional cases. Note that this option
* only applies to proxied records and it has no effect on whether Cloudflare
* communicates with the origin using IPv4 or IPv6.
*/
ipv4_only?: boolean;
/**
* When enabled, only AAAA records will be generated, and A records will not be
* created. This setting is intended for exceptional cases. Note that this option
* only applies to proxied records and it has no effect on whether Cloudflare
* communicates with the origin using IPv4 or IPv6.
*/
ipv6_only?: boolean;
}
}
export interface DSRecord {
/**
* Comments or notes about the DNS record. This field has no effect on DNS
* responses.
*/
comment?: string;
/**
* Formatted DS content. See 'data' to set DS properties.
*/
content?: string;
/**
* Components of a DS record.
*/
data?: DSRecord.Data;
/**
* DNS record name (or @ for the zone apex) in P