Skip to content

Commit 68106cc

Browse files
RebeccaTamachirodaisyfaithauma
authored andcommitted
[DNS] Use APIRequest component (#22328)
* Replace example in /cloudflare-as-secondary/proxy-traffic.mdx * More consistent with formatting and finish cf-as-secondary * Replace DNSSEC status and multi-provider setting * dnsesec-for-primary: replace create DNSKEY example * Revert "dnsesec-for-primary: replace create DNSKEY example" This reverts commit 9d2a601. * dnsesec-for-primary: replace get ZSK example * Revert "dnsesec-for-primary: replace get ZSK example" This reverts commit 4e71662. * Replace remaining /zones/{zone_id}/dnssec PATCH examples * Replace remaining /zones/{zone_id}/dns_settings examples * Apply in dns-firewall and fix {cluster_tag} with {dns_firewall_id} * Replace /zones/{zone_id}/custom_ns examples * Replace example in partial internal-reference-zone-api.mdx
1 parent 253c9cf commit 68106cc

File tree

10 files changed

+122
-146
lines changed

10 files changed

+122
-146
lines changed

src/content/docs/dns/dns-firewall/random-prefix-attacks/setup.mdx

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,23 @@ head:
99

1010
---
1111

12+
import { APIRequest } from "~/components";
13+
1214
In order to enable automatic mitigation of [random prefix attacks](/dns/dns-firewall/random-prefix-attacks/about/):
1315

1416
1. Set up [DNS Firewall](/dns/dns-firewall/setup/).
1517
2. Send a [`PATCH` request](/api/resources/dns_firewall/methods/edit/) to update your DNS Firewall cluster.
1618

17-
```bash
18-
curl --request PATCH "https://api.cloudflare.com/client/v4/accounts/{account_id}/dns_firewall/{cluster_tag}" \
19-
--header "Authorization: Bearer <API_TOKEN>" \
20-
--header "Content-Type: application/json" \
21-
--data '{
22-
"attack_mitigation": {
23-
"enabled": true,
24-
"only_when_upstream_unhealthy": true
25-
}
26-
}'
27-
```
19+
<APIRequest
20+
path="/accounts/{account_id}/dns_firewall/{dns_firewall_id}"
21+
method="PATCH"
22+
json={{
23+
"attack_mitigation": {
24+
"enabled": true,
25+
"only_when_upstream_unhealthy": true,
26+
}
27+
}}
28+
/>
2829

2930
Once you receive a `200` success response from the API, queries identified as being part of a random prefix attack will receive a `REFUSED` response.
3031

src/content/docs/dns/dnssec/dnssec-active-migration.mdx

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ head:
99
content: DNSSEC migration tutorial
1010
---
1111

12-
import { Details } from "~/components";
12+
import { Details, APIRequest } from "~/components";
1313

1414
Follow this tutorial to migrate an existing DNS zone to Cloudflare without having to disable DNSSEC.
1515

@@ -36,25 +36,23 @@ The provider you are migrating from must allow you to add DNSKEY records on the
3636

3737
3. Go to **DNS** > **Settings**, and select **Enable DNSSEC**. Or use the following [API request](/api/resources/dns/subresources/dnssec/methods/edit/).
3838

39-
```bash
40-
curl --request PATCH \
41-
https://api.cloudflare.com/client/v4/zones/{zone_id}/dnssec \
42-
--header "X-Auth-Email: <EMAIL>" \
43-
--header "X-Auth-Key: <API_KEY>" \
44-
--header "Content-Type: application/json" \
45-
--data '{"status": "active"}'
46-
```
39+
<APIRequest
40+
path="/zones/{zone_id}/dnssec"
41+
method="PATCH"
42+
json={{
43+
"status": "active",
44+
}}
45+
/>
4746

4847
4. Go to **DNS** > **Settings**, and enable **Multi-signer DNSSEC**. Or use the following [API request](/api/resources/dns/subresources/dnssec/methods/edit/).
4948

50-
```bash
51-
curl --request PATCH \
52-
https://api.cloudflare.com/client/v4/zones/{zone_id}/dnssec \
53-
--header "X-Auth-Email: <EMAIL>" \
54-
--header "X-Auth-Key: <API_KEY>" \
55-
--header "Content-Type: application/json" \
56-
--data '{"dnssec_multi_signer": true}'
57-
```
49+
<APIRequest
50+
path="/zones/{zone_id}/dnssec"
51+
method="PATCH"
52+
json={{
53+
"dnssec_multi_signer": true,
54+
}}
55+
/>
5856

5957
## 2. Cross-import ZSKs
6058

src/content/docs/dns/dnssec/multi-signer-dnssec/setup.mdx

Lines changed: 24 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ sidebar:
66
label: Setup
77
---
88

9-
import { Tabs, TabItem } from "~/components";
9+
import { Tabs, TabItem, APIRequest } from "~/components";
1010

1111
This page explains how you can enable [multi-signer DNSSEC](/dns/dnssec/multi-signer-dnssec/about/) with Cloudflare, using the [model 2](/dns/dnssec/multi-signer-dnssec/about/#model-2) as described in [RFC 8901](https://www.rfc-editor.org/rfc/rfc8901.html).
1212

@@ -44,17 +44,14 @@ For the purpose of this tutorial, you will update your registrar with the DS rec
4444

4545
1. Use the [Edit DNSSEC Status endpoint](/api/resources/dns/subresources/dnssec/methods/edit/) to enable DNSSEC and activate multi-signer DNSSEC for your zone. Set `status` to `active` and `dnssec_multi_signer` to `true`, as in the following example.
4646

47-
```bash
48-
curl --request PATCH \
49-
"https://api.cloudflare.com/client/v4/zones/{zone_id}/dnssec" \
50-
--header "X-Auth-Email: <EMAIL>" \
51-
--header "X-Auth-Key: <API_KEY>" \
52-
--header "Content-Type: application/json" \
53-
--data '{
54-
"status": "active",
55-
"dnssec_multi_signer": true
56-
}'
57-
```
47+
<APIRequest
48+
path="/zones/{zone_id}/dnssec"
49+
method="PATCH"
50+
json={{
51+
"status": "active",
52+
"dnssec_multi_signer": true,
53+
}}
54+
/>
5855

5956
2. Add the ZSK(s) of your external provider(s) to Cloudflare by creating a DNSKEY record on your zone.
6057

@@ -97,16 +94,13 @@ curl "https://api.cloudflare.com/client/v4/zones/{zone_id}/dns_records" \
9794
This step is required. Without turning on this setting, Cloudflare will ignore any `NS` records created on the zone apex. This means that responses to DNS queries made to the zone apex and requesting `NS` records will only contain Cloudflare nameservers.
9895
:::
9996

100-
```bash
101-
curl --request PATCH \
102-
"https://api.cloudflare.com/client/v4/zones/{zone_id}/dns_settings" \
103-
--header "X-Auth-Email: <EMAIL>" \
104-
--header "X-Auth-Key: <API_KEY>" \
105-
--header "Content-Type: application/json" \
106-
--data '{
107-
"multi_provider": true
108-
}'
109-
```
97+
<APIRequest
98+
path="/zones/{zone_id}/dns_settings"
99+
method="PATCH"
100+
json={{
101+
"multi_provider": true,
102+
}}
103+
/>
110104

111105
</TabItem>
112106
</Tabs>
@@ -135,16 +129,14 @@ For the purpose of this tutorial, you will update your registrar with the DS rec
135129

136130
1. Use the [Edit DNSSEC Status endpoint](/api/resources/dns/subresources/dnssec/methods/edit/) to enable DNSSEC and activate multi-signer DNSSEC for your zone. Set `status` to `active` and `dnssec_multi_signer` to `true`, as in the following example.
137131

138-
```bash
139-
$ curl --request PATCH 'https://api.cloudflare.com/client/v4/zones/{zone_id}/dnssec' \
140-
--header "X-Auth-Email: <EMAIL>" \
141-
--header "X-Auth-Key: <API_KEY>" \
142-
--header "Content-Type: application/json" \
143-
--data '{
144-
"status": "active",
145-
"dnssec_multi_signer": true
146-
}'
147-
```
132+
<APIRequest
133+
path="/zones/{zone_id}/dnssec"
134+
method="PATCH"
135+
json={{
136+
"status": "active",
137+
"dnssec_multi_signer": true,
138+
}}
139+
/>
148140

149141
2. Add the ZSK(s) of your external provider(s) to a DNSKEY record at your primary DNS provider. This record should be transferred successfully to Cloudflare.
150142

src/content/docs/dns/foundation-dns/setup.mdx

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ sidebar:
66
label: Setup
77
---
88

9-
import { TabItem, Tabs } from "~/components";
9+
import { TabItem, Tabs, APIRequest } from "~/components";
1010

1111
Advanced nameservers included with [Foundation DNS](/dns/foundation-dns/) are an opt-in configuration.
1212

@@ -27,16 +27,13 @@ To enable advanced nameservers on an existing zone:
2727

2828
Use the [Update DNS Settings](/api/resources/dns/subresources/settings/methods/edit/) endpoint to send a PATCH request like the following:
2929

30-
```bash
31-
curl --request PATCH \
32-
"https://api.cloudflare.com/client/v4/zones/{zone_id}/dns_settings" \
33-
--header "X-Auth-Email: <EMAIL>" \
34-
--header "X-Auth-Key: <API_KEY>" \
35-
--header "Content-Type: application/json" \
36-
--data '{
37-
"foundation_dns": true
38-
}'
39-
```
30+
<APIRequest
31+
path="/zones/{zone_id}/dns_settings"
32+
method="PATCH"
33+
json={{
34+
"foundation_dns": true,
35+
}}
36+
/>
4037

4138
The response body will contain your assigned namservers in the `nameservers` object. You will use these nameservers in the next step.
4239

src/content/docs/dns/nameservers/custom-nameservers/tenant-custom-nameservers.mdx

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ description: With tenant-level custom nameservers, you can use the same custom
1414

1515
---
1616

17-
import { Example, Render } from "~/components"
17+
import { Example, Render, APIRequest } from "~/components"
1818

1919
<Render file="acns-tcns-intro" params={{ one: "Tenant", two: "T", three: "tenant", four: "accounts", five: "tenant " }} />
2020

@@ -38,17 +38,15 @@ If you are an account owner and your account is part of a tenant that has custom
3838

3939
1. Use a [PUT command](/api/resources/zones/subresources/custom_nameservers/methods/update/) and specify `ns_type` and `ns_set`.
4040

41-
```bash
42-
curl --request PUT https://api.cloudflare.com/client/v4/zones/{zone_id}/custom_ns \
43-
--header "X-Auth-Email: <EMAIL>" \
44-
--header "X-Auth-Key: <API_KEY>" \
45-
--header "Content-Type: application/json" \
46-
--data '{
47-
"enabled": true,
48-
"ns_type": "tenant",
49-
"ns_set": <SET>
50-
}'
51-
```
41+
<APIRequest
42+
path="/zones/{zone_id}/custom_ns"
43+
method="PUT"
44+
json={{
45+
"enabled": true,
46+
"ns_type": "tenant",
47+
"ns_set": "<SET>",
48+
}}
49+
/>
5250

5351
:::note
5452

src/content/docs/dns/zone-setups/zone-transfers/cloudflare-as-primary/dnssec-for-primary.mdx

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ head:
99
content: Set up multi-signer DNSSEC with outgoing zone transfers
1010
---
1111

12-
import { Example } from "~/components";
12+
import { Example, APIRequest } from "~/components";
1313

1414
With [outgoing zone transfers](/dns/zone-setups/zone-transfers/cloudflare-as-primary/), you keep Cloudflare as your primary DNS provider and use one or more secondary providers for increased availability and fault tolerance.
1515

@@ -27,17 +27,14 @@ Note that:
2727

2828
1. Use the [Edit DNSSEC Status endpoint](/api/resources/dns/subresources/dnssec/methods/edit/) to enable DNSSEC and activate multi-signer DNSSEC for your zone. This is done by setting `status` to `active` and `dnssec_multi_signer` to `true`, as in the following example.
2929

30-
```bash
31-
curl --request PATCH \
32-
'https://api.cloudflare.com/client/v4/zones/{zone_id}/dnssec' \
33-
--header "X-Auth-Email: <EMAIL>" \
34-
--header "X-Auth-Key: <API_KEY>" \
35-
--header "Content-Type: application/json" \
36-
--data '{
37-
"status": "active",
38-
"dnssec_multi_signer": true
39-
}'
40-
```
30+
<APIRequest
31+
path="/zones/{zone_id}/dnssec"
32+
method="PATCH"
33+
json={{
34+
"status": "active",
35+
"dnssec_multi_signer": true,
36+
}}
37+
/>
4138

4239
2. Add the ZSK(s) of your external provider(s) to Cloudflare by creating a DNSKEY record on your zone.
4340

src/content/docs/dns/zone-setups/zone-transfers/cloudflare-as-primary/setup.mdx

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ head:
88
content: Set up outgoing zone transfers (Cloudflare as Primary)
99
---
1010

11-
import { Render, TabItem, Tabs } from "~/components";
11+
import { Render, TabItem, Tabs, APIRequest } from "~/components";
1212

1313
With [outgoing zone transfers](/dns/zone-setups/zone-transfers/cloudflare-as-primary/), you can keep Cloudflare as your primary DNS provider and use one or more secondary providers for increased availability and fault tolerance.
1414

@@ -137,16 +137,13 @@ If your account [zone defaults](/dns/additional-options/dns-zone-defaults/) are
137137

138138
Send the following `PATCH` request replacing the placeholders with your zone ID and authentication information:
139139

140-
```bash
141-
curl --request PATCH \
142-
"https://api.cloudflare.com/client/v4/zones/{zone_id}/dns_settings" \
143-
--header "X-Auth-Email: <EMAIL>" \
144-
--header "X-Auth-Key: <API_KEY>" \
145-
--header "Content-Type: application/json" \
146-
--data '{
147-
"multi_provider": true
148-
}'
149-
```
140+
<APIRequest
141+
path="/zones/{zone_id}/dns_settings"
142+
method="PATCH"
143+
json={{
144+
"multi_provider": true,
145+
}}
146+
/>
150147

151148
</TabItem> </Tabs>
152149

src/content/docs/dns/zone-setups/zone-transfers/cloudflare-as-secondary/dnssec-for-secondary.mdx

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ head:
88
content: DNSSEC for Secondary DNS
99
---
1010

11-
import { Render, TabItem, Tabs, GlossaryTooltip } from "~/components";
11+
import { Render, TabItem, Tabs, GlossaryTooltip, APIRequest } from "~/components";
1212

1313
[DNS Security Extensions (DNSSEC)](https://www.cloudflare.com/learning/dns/dns-security/) increase security by adding cryptographic signatures to DNS records. When you use multiple providers and Cloudflare is secondary, you have a few options to enable DNSSEC for records served by Cloudflare.
1414

@@ -44,16 +44,13 @@ In this setup, DNSSEC on your pirmary DNS provider does not need to be enabled.
4444

4545
1. Use the [Edit DNSSEC Status endpoint](/api/resources/dns/subresources/dnssec/methods/edit/) and set a `status` of `active` for your zone.
4646

47-
```bash
48-
curl --request PATCH \
49-
https://api.cloudflare.com/client/v4/zones/{zone_id}/dnssec \
50-
--header "X-Auth-Email: <EMAIL>" \
51-
--header "X-Auth-Key: <API_KEY>" \
52-
--header "Content-Type: application/json" \
53-
--data '{
54-
"status": "active"
55-
}'
56-
```
47+
<APIRequest
48+
path="/zones/{zone_id}/dnssec"
49+
method="PATCH"
50+
json={{
51+
"status": "active",
52+
}}
53+
/>
5754

5855
2. Use the [DNSSEC Details endpoint](/api/resources/dns/subresources/dnssec/methods/get/) to get the necessary values to create a **DS** record at your registrar.
5956

@@ -95,16 +92,13 @@ b. Under **DNSSEC with Secondary DNS** select **Pre-signed**.
9592

9693
Use the [Edit DNSSEC Status endpoint](/api/resources/dns/subresources/dnssec/methods/edit/) and set the `dnssec_presigned` value to `true`.
9794

98-
```bash
99-
curl --request PATCH \
100-
https://api.cloudflare.com/client/v4/zones/{zone_id}/dnssec \
101-
--header "X-Auth-Email: <EMAIL>" \
102-
--header "X-Auth-Key: <API_KEY>" \
103-
--header "Content-Type: application/json" \
104-
--data '{
105-
"dnssec_presigned": true
106-
}'
107-
```
95+
<APIRequest
96+
path="/zones/{zone_id}/dnssec"
97+
method="PATCH"
98+
json={{
99+
"dnssec_presigned": true,
100+
}}
101+
/>
108102

109103
</TabItem> </Tabs>
110104

src/content/docs/dns/zone-setups/zone-transfers/cloudflare-as-secondary/proxy-traffic.mdx

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ head:
88
content: Proxy traffic with Secondary DNS override
99
---
1010

11-
import { TabItem, Tabs } from "~/components";
11+
import { TabItem, Tabs, APIRequest } from "~/components";
1212

1313
When you set up [incoming zone transfers](/dns/zone-setups/zone-transfers/cloudflare-as-secondary/setup/) on a secondary zone, you cannot enable the proxy on any transferred DNS records by default.
1414

@@ -47,16 +47,13 @@ Before you set up Secondary DNS override, make sure that you have:
4747

4848
1. To enable Secondary DNS override on a zone, use the following PATCH request:
4949

50-
```bash
51-
curl --request PATCH \
52-
https://api.cloudflare.com/client/v4/zones/{zone_id}/dns_settings \
53-
--header "X-Auth-Email: <EMAIL>" \
54-
--header "X-Auth-Key: <API_KEY>" \
55-
--header "Content-Type: application/json" \
56-
--data '{
57-
"secondary_overrides": true
58-
}'
59-
```
50+
<APIRequest
51+
path="/zones/{zone_id}/dns_settings"
52+
method="PATCH"
53+
json={{
54+
"secondary_overrides": true,
55+
}}
56+
/>
6057

6158
2. For specific A, AAAA, or CNAME records, send a [POST](/api/resources/dns/subresources/records/methods/create/) request with the `proxied` status as `true`.
6259
- Make sure the added record has the same name as the transferred record you intend to proxy. Cloudflare only looks at the name and the proxy status, so the record content does not matter.

0 commit comments

Comments
 (0)