UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

2,083 lines (1,826 loc) 300 kB
// 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 { SinglePage, 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. * * @example * ```ts * const recordResponse = await client.dns.records.create({ * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', * name: 'example.com', * ttl: 3600, * type: 'A', * }); * ``` */ 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. * * @example * ```ts * const recordResponse = await client.dns.records.update( * '023e105f4ecef8ad9ca31a8372d0c353', * { * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', * name: 'example.com', * ttl: 3600, * type: 'A', * }, * ); * ``` */ 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. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const recordResponse of client.dns.records.list({ * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', * })) { * // ... * } * ``` */ 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 * * @example * ```ts * const record = await client.dns.records.delete( * '023e105f4ecef8ad9ca31a8372d0c353', * { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ 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 * * @example * ```ts * const response = await client.dns.records.batch({ * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', * }); * ``` */ 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. * * @example * ```ts * const recordResponse = await client.dns.records.edit( * '023e105f4ecef8ad9ca31a8372d0c353', * { * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', * name: 'example.com', * ttl: 3600, * type: 'A', * }, * ); * ``` */ 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. * * @example * ```ts * const response = await client.dns.records.export({ * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', * }); * ``` */ 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 * * @example * ```ts * const recordResponse = await client.dns.records.get( * '023e105f4ecef8ad9ca31a8372d0c353', * { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ 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. * * @example * ```ts * const response = await client.dns.records.import({ * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', * file: 'www.example.com. 300 IN A 127.0.0.1', * }); * ``` */ 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. * * @deprecated This endpoint is deprecated in favor of a new asynchronous version. Please use the [/scan/trigger](https://developers.cloudflare.com/api/resources/dns/subresources/records/methods/scan/trigger) and [/scan/review](https://developers.cloudflare.com/api/resources/dns/subresources/records/methods/scan/review) endpoints instead. */ 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); } /** * Retrieves the list of DNS records discovered up to this point by the * asynchronous scan. These records are temporary until explicitly accepted or * rejected via `POST /scan/review`. Additional records may be discovered by the * scan later. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const recordResponse of client.dns.records.scanList( * { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * )) { * // ... * } * ``` */ scanList( params: RecordScanListParams, options?: Core.RequestOptions, ): Core.PagePromise<RecordResponsesSinglePage, RecordResponse> { const { zone_id } = params; return this._client.getAPIList( `/zones/${zone_id}/dns_records/scan/review`, RecordResponsesSinglePage, options, ); } /** * Accept or reject DNS records found by the DNS records scan. Accepted records * will be permanently added to the zone, while rejected records will be * permanently deleted. * * @example * ```ts * const response = await client.dns.records.scanReview({ * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', * }); * ``` */ scanReview( params: RecordScanReviewParams, options?: Core.RequestOptions, ): Core.APIPromise<RecordScanReviewResponse> { const { zone_id, ...body } = params; return ( this._client.post(`/zones/${zone_id}/dns_records/scan/review`, { body, ...options, }) as Core.APIPromise<{ result: RecordScanReviewResponse }> )._thenUnwrap((obj) => obj.result); } /** * Initiates an asynchronous scan for common DNS records on your domain. Note that * this **does not** automatically add records to your zone. The scan runs in the * background, and results can be reviewed later using the `/scan/review` * endpoints. Useful if you haven't updated your nameservers yet. * * @example * ```ts * const response = await client.dns.records.scanTrigger({ * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', * }); * ``` */ scanTrigger( params: RecordScanTriggerParams, options?: Core.RequestOptions, ): Core.APIPromise<RecordScanTriggerResponse> { const { zone_id } = params; return this._client.post(`/zones/${zone_id}/dns_records/scan/trigger`, options); } } export class RecordResponsesV4PagePaginationArray extends V4PagePaginationArray<RecordResponse> {} export class RecordResponsesSinglePage extends SinglePage<RecordResponse> {} export interface ARecord { /** * Complete DNS record name, including the zone name, in Punycode. */ name: string; /** * 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'; /** * Comments or notes about the DNS record. This field has no effect on DNS * responses. */ comment?: string; /** * A valid IPv4 address. */ content?: 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>; } 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 { /** * Complete DNS record name, including the zone name, in Punycode. */ name: string; /** * 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'; /** * Comments or notes about the DNS record. This field has no effect on DNS * responses. */ comment?: string; /** * A valid IPv4 address. */ content?: 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>; } 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 { /** * Complete DNS record name, including the zone name, in Punycode. */ name: string; /** * 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'; /** * Comments or notes about the DNS record. This field has no effect on DNS * responses. */ comment?: string; /** * A valid IPv6 address. */ content?: 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>; } 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 { /** * Complete DNS record name, including the zone name, in Punycode. */ name: string; /** * 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'; /** * Comments or notes about the DNS record. This field has no effect on DNS * responses. */ comment?: string; /** * A valid IPv6 address. */ content?: 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>; } 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.ARecord | BatchPatch.AAAARecord | BatchPatch.CNAMERecord | BatchPatch.MXRecord | BatchPatch.NSRecord | BatchPatch.OpenpgpkeyRecord | BatchPatch.PTRRecord | BatchPatch.TXTRecord | BatchPatch.CAARecord | BatchPatch.CERTRecord | BatchPatch.DNSKEYRecord | BatchPatch.DSRecord | BatchPatch.HTTPSRecord | BatchPatch.LOCRecord | BatchPatch.NAPTRRecord | BatchPatch.SMIMEARecord | BatchPatch.SRVRecord | BatchPatch.SSHFPRecord | BatchPatch.SVCBRecord | BatchPatch.TLSARecord | BatchPatch.URIRecord; export namespace BatchPatch { export interface ARecord extends RecordsAPI.ARecord { /** * Identifier. */ id: string; } export interface AAAARecord extends RecordsAPI.AAAARecord { /** * Identifier. */ id: string; } export interface CNAMERecord extends RecordsAPI.CNAMERecord { /** * Identifier. */ id: string; } export interface MXRecord extends RecordsAPI.MXRecord { /** * Identifier. */ id: string; } export interface NSRecord extends RecordsAPI.NSRecord { /** * Identifier. */ id: string; } export interface OpenpgpkeyRecord { /** * Identifier. */ id: string; /** * Complete DNS record name, including the zone name, in Punycode. */ name: string; /** * 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'; /** * 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; /** * Whether the record is receiving the performance and security benefits of * Cloudflare. */ proxied?: boolean; /** * Settings for the DNS record. */ settings?: OpenpgpkeyRecord.Settings; /** * Custom tags for the DNS record. This field has no effect on DNS responses. */ tags?: Array<RecordsAPI.RecordTags>; } export namespace OpenpgpkeyRecord { /** * 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 PTRRecord extends RecordsAPI.PTRRecord { /** * Identifier. */ id: string; } export interface TXTRecord extends RecordsAPI.TXTRecord { /** * Identifier. */ id: string; } export interface CAARecord extends RecordsAPI.CAARecord { /** * Identifier. */ id: string; } export interface CERTRecord extends RecordsAPI.CERTRecord { /** * Identifier. */ id: string; } export interface DNSKEYRecord extends RecordsAPI.DNSKEYRecord { /** * Identifier. */ id: string; } export interface DSRecord extends RecordsAPI.DSRecord { /** * Identifier. */ id: string; } export interface HTTPSRecord extends RecordsAPI.HTTPSRecord { /** * Identifier. */ id: string; } export interface LOCRecord extends RecordsAPI.LOCRecord { /** * Identifier. */ id: string; } export interface NAPTRRecord extends RecordsAPI.NAPTRRecord { /** * Identifier. */ id: string; } export interface SMIMEARecord extends RecordsAPI.SMIMEARecord { /** * Identifier. */ id: string; } export interface SRVRecord extends RecordsAPI.SRVRecord { /** * Identifier. */ id: string; } export interface SSHFPRecord extends RecordsAPI.SSHFPRecord { /** * Identifier. */ id: string; } export interface SVCBRecord extends RecordsAPI.SVCBRecord { /** * Identifier. */ id: string; } export interface TLSARecord extends RecordsAPI.TLSARecord { /** * Identifier. */ id: string; } export interface URIRecord extends RecordsAPI.URIRecord { /** * Identifier. */ id: string; } } export type BatchPatchParam = | BatchPatchParam.ARecord | BatchPatchParam.AAAARecord | BatchPatchParam.CNAMERecord | BatchPatchParam.MXRecord | BatchPatchParam.NSRecord | BatchPatchParam.OpenpgpkeyRecord | BatchPatchParam.PTRRecord | BatchPatchParam.TXTRecord | BatchPatchParam.CAARecord | BatchPatchParam.CERTRecord | BatchPatchParam.DNSKEYRecord | BatchPatchParam.DSRecord | BatchPatchParam.HTTPSRecord | BatchPatchParam.LOCRecord | BatchPatchParam.NAPTRRecord | BatchPatchParam.SMIMEARecord | BatchPatchParam.SRVRecord | BatchPatchParam.SSHFPRecord | BatchPatchParam.SVCBRecord | BatchPatchParam.TLSARecord | BatchPatchParam.URIRecord; export namespace BatchPatchParam { export interface ARecord extends RecordsAPI.ARecordParam { /** * Identifier. */ id: string; } export interface AAAARecord extends RecordsAPI.AAAARecordParam { /** * Identifier. */ id: string; } export interface CNAMERecord extends RecordsAPI.CNAMERecordParam { /** * Identifier. */ id: string; } export interface MXRecord extends RecordsAPI.MXRecordParam { /** * Identifier. */ id: string; } export interface NSRecord extends RecordsAPI.NSRecordParam { /** * Identifier. */ id: string; } export interface OpenpgpkeyRecord { /** * Identifier. */ id: string; /** * Complete DNS record name, including the zone name, in Punycode. */ name: string; /** * 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'; /** * 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; /** * Whether the record is receiving the performance and security benefits of * Cloudflare. */ proxied?: boolean; /** * Settings for the DNS record. */ settings?: OpenpgpkeyRecord.Settings; /** * Custom tags for the DNS record. This field has no effect on DNS responses. */ tags?: Array<RecordsAPI.RecordTagsParam>; } export namespace OpenpgpkeyRecord { /** * 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 PTRRecord extends RecordsAPI.PTRRecordParam { /** * Identifier. */ id: string; } export interface TXTRecord extends RecordsAPI.TXTRecordParam { /** * Identifier. */ id: string; } export interface CAARecord extends RecordsAPI.CAARecordParam { /** * Identifier. */ id: string; } export interface CERTRecord extends RecordsAPI.CERTRecordParam { /** * Identifier. */ id: string; } export interface DNSKEYRecord extends RecordsAPI.DNSKEYRecordParam { /** * Identifier. */ id: string; } export interface DSRecord extends RecordsAPI.DSRecordParam { /** * Identifier. */ id: string; } export interface HTTPSRecord extends RecordsAPI.HTTPSRecordParam { /** * Identifier. */ id: string; } export interface LOCRecord extends RecordsAPI.LOCRecordParam { /** * Identifier. */ id: string; } export interface NAPTRRecord extends RecordsAPI.NAPTRRecordParam { /** * Identifier. */ id: string; } export interface SMIMEARecord extends RecordsAPI.SMIMEARecordParam { /** * Identifier. */ id: string; } export interface SRVRecord extends RecordsAPI.SRVRecordParam { /** * Identifier. */ id: string; } export interface SSHFPRecord extends RecordsAPI.SSHFPRecordParam { /** * Identifier. */ id: string; } export interface SVCBRecord extends RecordsAPI.SVCBRecordParam { /** * Identifier. */ id: string; } export interface TLSARecord extends RecordsAPI.TLSARecordParam { /** * Identifier. */ id: string; } export interface URIRecord extends RecordsAPI.URIRecordParam { /** * Identifier. */ id: string; } } export type BatchPut = | BatchPut.ARecord | BatchPut.AAAARecord | BatchPut.CNAMERecord | BatchPut.MXRecord | BatchPut.NSRecord | BatchPut.OpenpgpkeyRecord | BatchPut.PTRRecord | BatchPut.TXTRecord | BatchPut.CAARecord | BatchPut.CERTRecord | BatchPut.DNSKEYRecord | BatchPut.DSRecord | BatchPut.HTTPSRecord | BatchPut.LOCRecord | BatchPut.NAPTRRecord | BatchPut.SMIMEARecord | BatchPut.SRVRecord | BatchPut.SSHFPRecord | BatchPut.SVCBRecord | BatchPut.TLSARecord | BatchPut.URIRecord; export namespace BatchPut { export interface ARecord extends RecordsAPI.ARecord { /** * Identifier. */ id: string; } export interface AAAARecord extends RecordsAPI.AAAARecord { /** * Identifier. */ id: string; } export interface CNAMERecord extends RecordsAPI.CNAMERecord { /** * Identifier. */ id: string; } export interface MXRecord extends RecordsAPI.MXRecord { /** * Identifier. */ id: string; } export interface NSRecord extends RecordsAPI.NSRecord { /** * Identifier. */ id: string; } export interface OpenpgpkeyRecord { /** * Identifier. */ id: string; /** * Complete DNS record name, including the zone name, in Punycode. */ name: string; /** * 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'; /** * 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; /** * Whether the record is receiving the performance and security benefits of * Cloudflare. */ proxied?: boolean; /** * Settings for the DNS record. */ settings?: OpenpgpkeyRecord.Settings; /** * Custom tags for the DNS record. This field has no effect on DNS responses. */ tags?: Array<RecordsAPI.RecordTags>; } export namespace OpenpgpkeyRecord { /** * 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 PTRRecord extends RecordsAPI.PTRRecord { /** * Identifier. */ id: string; } export interface TXTRecord extends RecordsAPI.TXTRecord { /** * Identifier. */ id: string; } export interface CAARecord extends RecordsAPI.CAARecord { /** * Identifier. */ id: string; } export interface CERTRecord extends RecordsAPI.CERTRecord { /** * Identifier. */ id: string; } export interface DNSKEYRecord extends RecordsAPI.DNSKEYRecord { /** * Identifier. */ id: string; } export interface DSRecord extends RecordsAPI.DSRecord { /** * Identifier. */ id: string; } export interface HTTPSRecord extends RecordsAPI.HTTPSRecord { /** * Identifier. */ id: string; } export interface LOCRecord extends RecordsAPI.LOCRecord { /** * Identifier. */ id: string; } export interface NAPTRRecord extends RecordsAPI.NAPTRRecord { /** * Identifier. */ id: string; } export interface SMIMEARecord extends RecordsAPI.SMIMEARecord { /** * Identifier. */ id: string; } export interface SRVRecord extends RecordsAPI.SRVRecord { /** * Identifier. */ id: string; } export interface SSHFPRecord extends RecordsAPI.SSHFPRecord { /** * Identifier. */ id: string; } export interface SVCBRecord extends RecordsAPI.SVCBRecord { /** * Identifier. */ id: string; } export interface TLSARecord extends RecordsAPI.TLSARecord { /** * Identifier. */ id: string; } export interface URIRecord extends RecordsAPI.URIRecord { /** * Identifier. */ id: string; } } export type BatchPutParam = | BatchPutParam.ARecord | BatchPutParam.AAAARecord | BatchPutParam.CNAMERecord | BatchPutParam.MXRecord | BatchPutParam.NSRecord | BatchPutParam.OpenpgpkeyRecord | BatchPutParam.PTRRecord | BatchPutParam.TXTRecord | BatchPutParam.CAARecord | BatchPutParam.CERTRecord | BatchPutParam.DNSKEYRecord | BatchPutParam.DSRecord | BatchPutParam.HTTPSRecord | BatchPutParam.LOCRecord | BatchPutParam.NAPTRRecord | BatchPutParam.SMIMEARecord | BatchPutParam.SRVRecord | BatchPutParam.SSHFPRecord | BatchPutParam.SVCBRecord | BatchPutParam.TLSARecord | BatchPutParam.URIRecord; export namespace BatchPutParam { export interface ARecord extends RecordsAPI.ARecordParam { /** * Identifier. */ id: string; } export interface AAAARecord extends RecordsAPI.AAAARecordParam { /** * Identifier. */ id: string; } export interface CNAMERecord extends RecordsAPI.CNAMERecordParam { /** * Identifier. */ id: string; } export interface MXRecord extends RecordsAPI.MXRecordParam { /** * Identifier. */ id: string; } export interface NSRecord extends RecordsAPI.NSRecordParam { /** * Identifier. */ id: string; } export interface OpenpgpkeyRecord { /** * Identifier. */ id: string; /** * Complete DNS record name, including the zone name, in Punycode. */ name: string; /** * 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'; /** * 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; /** * Whether the record is receiving the performance and security benefits of * Cloudflare. */ proxied?: boolean; /** * Settings for the DNS record. */ settings?: OpenpgpkeyRecord.Settings; /** * Custom tags for the DNS record. This field has no effect on DNS responses. */ tags?: Array<RecordsAPI.RecordTagsParam>; } export namespace OpenpgpkeyRecord { /** * 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 PTRRecord extends RecordsAPI.PTRRecordParam { /** * Identifier. */ id: string; } export interface TXTRecord extends RecordsAPI.TXTRecordParam { /** * Identifier. */ id: string; } export interface CAARecord extends RecordsAPI.CAARecordParam { /** * Identifier. */ id: string; } export interface CERTRecord extends RecordsAPI.CERTRecordParam { /** * Identifier. */ id: string; } export interface DNSKEYRecord extends RecordsAPI.DNSKEYRecordParam { /** * Identifier. */ id: string; } export interface DSRecord extends RecordsAPI.DSRecordParam { /** * Identifier. */ id: string; } export interface HTTPSRecord extends RecordsAPI.HTTPSRecordParam { /** * Identifier. */ id: string; } export interface LOCRecord extends RecordsAPI.LOCRecordParam { /** * Identifier. */ id: string; } export interface NAPTRRecord extends RecordsAPI.NAPTRRecordParam { /** * Identifier. */ id: string; } export interface SMIMEARecord extends RecordsAPI.SMIMEARecordParam { /** * Identifier. */ id: string; } export interface SRVRecord extends RecordsAPI.SRVRecordParam { /** * Identifier. */ id: string; } export interface SSHFPRecord extends RecordsAPI.SSHFPRecordParam { /** * Identifier. */ id: string; } export interface SVCBRecord extends RecordsAPI.SVCBRecordParam { /** * Identifier. */ id: string; } export interface TLSARecord extends RecordsAPI.TLSARecordParam { /** * Identifier. */ id: string; } export interface URIRecord extends RecordsAPI.URIRecordParam { /** * Identifier. */ id: string; } } export interface CAARecord { /** * Complete DNS record name, including the zone name, in Punycode. */ name: string; /** * 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'; /** * 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; /** * 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>; } 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 { /** * Complete DNS record name, including the zone name, in Punycode. */ name: string; /** * 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'; /** * 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; /** * 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>; } 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 { /** * Complete DNS record name, including the zone name, in Punycode. */ name: string; /** * 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'; /** * 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; /** * 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>; } 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 { /** * Complete DNS record name, including the zone name, in Punycode. */ name: string; /** * 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'; /** * 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; /** * 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>; } 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 { /** * Complete DNS record name, including the zone name, in Punycode. */ name: string; /** * 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'; /** * 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; /** * 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>; } 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 { /** * Complete DNS record name, including the zone name, in Punycode. */ name: string; /** * 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'; /** * 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; /** * Whether the record is receiving the performance and security benefits of * Cloudflare. */