1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123 | import { checkGate } from './gate.js';
import * as http from './http.js';
/** POST /domains/registrations/{id}/dns — Put a domain on ird nameservers (202). */
export const enableHosting = async (client, id, body) => {
await checkGate(client, 'POST /domains/registrations/{id}/dns', { registrationId: id });
return http.post(client, '/domains/registrations/{id}/dns', { params: { id }, body });
};
/** DELETE /domains/registrations/{id}/dns — Take a domain off ird DNS. */
export const disableHosting = async (client, id, body) => {
await checkGate(client, 'DELETE /domains/registrations/{id}/dns', { registrationId: id });
return http.del(client, '/domains/registrations/{id}/dns', { params: { id }, body });
};
/** GET /domains/registrations/{id}/dns/dnssec — DNSSEC state of the hosted zone. */
export const getDnssec = (client, id) => http.get(client, '/domains/registrations/{id}/dns/dnssec', { params: { id } });
/** POST /domains/registrations/{id}/dns/dnssec — Enable DNSSEC on the hosted zone (202). */
export const enableDnssec = async (client, id, body) => {
await checkGate(client, 'POST /domains/registrations/{id}/dns/dnssec', { registrationId: id });
return http.post(client, '/domains/registrations/{id}/dns/dnssec', { params: { id }, body });
};
/** DELETE /domains/registrations/{id}/dns/dnssec — Disable DNSSEC on the hosted zone (202). */
export const disableDnssec = async (client, id, body) => {
await checkGate(client, 'DELETE /domains/registrations/{id}/dns/dnssec', { registrationId: id });
return http.del(client, '/domains/registrations/{id}/dns/dnssec', { params: { id }, body });
};
/**
* GET /domains/registrations/{id}/dns/nameservers — The nameserver set the
* hosted zone is published under: `mode` "shared" (ird's public nameservers)
* or "labels" (private nameservers unique to the domain), with
* `nameservers`, `nameservers_ready` and `available_modes`. Free.
*/
export const hostedNameservers = (client, id) => http.get(client, '/domains/registrations/{id}/dns/nameservers', { params: { id } });
/**
* POST /domains/registrations/{id}/dns/nameservers — Move the hosted zone
* between nameserver sets: `mode` "shared" or "labels" (labels are offered
* for .ro domains only). Answers 200 when nothing had to change, 202 with a
* `registry_action` when a registrar nameserver change was enqueued — poll
* `hostedNameservers` for `nameservers_ready`. Free.
*/
export const setHostedNameservers = async (client, id, body) => {
await checkGate(client, 'POST /domains/registrations/{id}/dns/nameservers', { registrationId: id });
return http.post(client, '/domains/registrations/{id}/dns/nameservers', { params: { id }, body });
};
/** GET /dns/domains — Your hosted DNS domains. */
export const listZones = (client) => http.get(client, '/dns/domains');
/** GET /dns/domains/{domain} — A hosted domain's zone. */
export const getZone = (client, domain) => http.get(client, '/dns/domains/{domain}', { params: { domain } });
/** PUT /dns/domains/{domain}/records — Set a DNS record or RRset. */
export const setRecord = async (client, domain, body) => {
await checkGate(client, 'PUT /dns/domains/{domain}/records', { domain });
return http.put(client, '/dns/domains/{domain}/records', { params: { domain }, body });
};
/** DELETE /dns/domains/{domain}/records — Delete a DNS record (carries a JSON body). */
export const deleteRecord = async (client, domain, body) => {
await checkGate(client, 'DELETE /dns/domains/{domain}/records', { domain });
return http.del(client, '/dns/domains/{domain}/records', { params: { domain }, body });
};
/**
* GET /dns/claims — Domains you hold at another registrar and host (or are
* about to host) on ird DNS: every live claim plus those ended in the last
* 30 days, newest first. Optional `state` (pending / verified / active /
* lapsed / revoked / expired) and `limit` (1..500, default 50).
*/
export const listClaims = (client, query) => http.get(client, '/dns/claims', { query });
/**
* POST /dns/claims — Claim a registrable domain registered elsewhere so ird
* can be its DNS (201). The response's `claim` carries the `nameservers` to
* set at your registrar; the claim activates once the parent zone lists
* exactly those (checked every few minutes, or now via `verifyClaim`).
* Gated on `domain`.
*/
export const createClaim = async (client, body) => {
await checkGate(client, 'POST /dns/claims', { domain: body.domain });
return http.post(client, '/dns/claims', { body });
};
/**
* GET /dns/claims/{id} — A claim: nameservers to set, its window while
* pending, the latest delegation read and registry facts.
*/
export const getClaim = (client, id) => http.get(client, '/dns/claims/{id}', { params: { id } });
/** Resolve the claim's domain (only when gated) and run the gate. */
const checkClaimGate = async (client, op, id) => {
if (!client.gate)
return;
const { claim } = await getClaim(client, id);
await checkGate(client, op, { domain: claim?.domain });
};
/**
* DELETE /dns/claims/{id} — Release a claim: it ends (state revoked) and the
* hosted zone goes out of service, a snapshot of its records kept. Point the
* domain's nameservers elsewhere first. Gated on the claim's domain
* (resolved via `getClaim` when a gate is set).
*/
export const releaseClaim = async (client, id) => {
await checkClaimGate(client, 'DELETE /dns/claims/{id}', id);
return http.del(client, '/dns/claims/{id}', { params: { id } });
};
/**
* PUT /dns/claims/{id}/seed — Attach a copy of the domain's current records
* to a pending claim, so the zone ird creates at activation starts from them
* instead of empty. `snapshot_id` comes from `domains.dnsSnapshot`, taken
* while the domain still resolves at its previous host. Gated on the
* claim's domain (resolved via `getClaim` when a gate is set).
*/
export const seedClaim = async (client, id, body) => {
await checkClaimGate(client, 'PUT /dns/claims/{id}/seed', id);
return http.put(client, '/dns/claims/{id}/seed', { params: { id }, body });
};
/**
* DELETE /dns/claims/{id}/seed — Drop the attached copy; the zone then
* starts empty at activation. Gated on the claim's domain (resolved via
* `getClaim` when a gate is set).
*/
export const unseedClaim = async (client, id) => {
await checkClaimGate(client, 'DELETE /dns/claims/{id}/seed', id);
return http.del(client, '/dns/claims/{id}/seed', { params: { id } });
};
/**
* POST /dns/claims/{id}/verify — Read the domain's delegation at its parent
* zone now and activate the claim when it lists the claim's nameservers.
* Anything else is not an error: the response is 200 with `check.ok` false
* and a `reason`.
*/
export const verifyClaim = (client, id) => http.post(client, '/dns/claims/{id}/verify', { params: { id } });
|