Skip to content

Commit d924fde

Browse files
committed
[ZT] Implement APIRequest component in core docs (#24458)
1 parent 42469f3 commit d924fde

File tree

20 files changed

+965
-1059
lines changed

20 files changed

+965
-1059
lines changed

src/content/docs/cloudflare-one/connections/connect-devices/agentless/pac-files.mdx

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@ sidebar:
55
order: 1
66
---
77

8-
import { Details, GlossaryDefinition, TabItem, Tabs } from "~/components";
8+
import {
9+
Details,
10+
GlossaryDefinition,
11+
TabItem,
12+
Tabs,
13+
APIRequest,
14+
} from "~/components";
915

1016
:::note
1117
Only available on Enterprise plans.
@@ -40,7 +46,6 @@ All devices you add to the proxy endpoint will be able to access your Cloudflare
4046
3. Give your endpoint any name.
4147

4248
4. Enter the public source IP address of your device(s) in CIDR notation. For example:
43-
4449
- **IPv4**: `192.0.2.0/8`
4550
- **IPv6**: `2001:0db8:0000:0000:0000:1234:5678:0000/109`
4651

@@ -62,15 +67,16 @@ https://<SUBDOMAIN>.proxy.cloudflare-gateway.com
6267

6368
1. [Create a proxy endpoint](/api/resources/zero_trust/subresources/gateway/subresources/proxy_endpoints/methods/create/) with the following call:
6469

65-
```bash
66-
curl https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/gateway/proxy_endpoints \
67-
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
68-
--header "Content-Type: application/json" \
69-
--data '{"name": "any_name", "ips": ["<PUBLIC_IP>", "<PUBLIC_IP2>", "<PUBLIC_IP3>"]}'
70-
```
70+
<APIRequest
71+
path="/accounts/{account_id}/gateway/proxy_endpoints"
72+
method="POST"
73+
json={{
74+
name: "any_name",
75+
ips: ["<PUBLIC_IP>", "<PUBLIC_IP2>", "<PUBLIC_IP3>"],
76+
}}
77+
/>
7178

7279
Replace `<PUBLIC_IP>` with the source IP address of your device in CIDR notation. For example:
73-
7480
- **IPv4**: `192.0.2.0/8`
7581
- **IPv6**: `2001:0db8:0000:0000:0000:1234:5678:0000/32`
7682

@@ -210,10 +216,10 @@ To get the domain of a proxy endpoint:
210216

211217
1. Use the [List proxy endpoints](/api/resources/zero_trust/subresources/gateway/subresources/proxy_endpoints/methods/list/) operation to get a list of your proxy endpoints and their details. For example:
212218

213-
```bash
214-
curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/gateway/proxy_endpoints \
215-
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN"
216-
```
219+
<APIRequest
220+
path="/accounts/{account_id}/gateway/proxy_endpoints"
221+
method="GET"
222+
/>
217223

218224
```json {8} output
219225
{

src/content/docs/cloudflare-one/connections/connect-devices/user-side-certificates/custom-certificate.mdx

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ description: Configure WARP to use a custom root certificate instead of the
88
Cloudflare certificate.
99
---
1010

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

1313
:::note
1414
Only available on Enterprise plans.
@@ -82,11 +82,10 @@ openssl x509 -in <CUSTOM-ROOT-CERT>.pem -text
8282

8383
2. Set the certificate as available for use in inspection with the [Activate a Zero Trust certificate endpoint](/api/resources/zero_trust/subresources/gateway/subresources/certificates/methods/activate/). This will deploy the certificate across the Cloudflare global network.
8484

85-
```sh
86-
curl --request POST \
87-
"https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/gateway/certificates/$CERTIFICATE_ID/activate" \
88-
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN"
89-
```
85+
<APIRequest
86+
path="/accounts/{account_id}/gateway/certificates/{certificate_id}/activate"
87+
method="POST"
88+
/>
9089

9190
The response will return the certificate and a `pending_deployment` binding status. For example:
9291

@@ -114,10 +113,10 @@ openssl x509 -in <CUSTOM-ROOT-CERT>.pem -text
114113

115114
3. Use the [Get Zero Trust certificate details endpoint](/api/resources/zero_trust/subresources/gateway/subresources/certificates/methods/get/) to verify the certificate's binding status is set to `available`.
116115

117-
```sh
118-
curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/gateway/certificates/$CERTIFICATE_ID \
119-
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN"
120-
```
116+
<APIRequest
117+
path="/accounts/{account_id}/gateway/certificates/{certificate_id}"
118+
method="GET"
119+
/>
121120

122121
```json {12}
123122
{
@@ -145,20 +144,18 @@ openssl x509 -in <CUSTOM-ROOT-CERT>.pem -text
145144

146145
5. Use the [Patch Zero Trust account configuration endpoint](/api/resources/zero_trust/subresources/gateway/subresources/configurations/methods/edit/) to turn on the certificate for use in inspection. For example:
147146

148-
```sh {9}
149-
curl --request PATCH \
150-
"https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/gateway/configuration" \
151-
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
152-
--header "Content-Type: application/json" \
153-
--data '{
154-
"settings": {
155-
"certificate": {
156-
"id": "$CERTIFICATE_ID",
157-
"in_use": true
158-
}
159-
}
160-
}'
161-
```
147+
<APIRequest
148+
path="/accounts/{account_id}/gateway/configuration"
149+
method="PATCH"
150+
json={{
151+
settings: {
152+
certificate: {
153+
id: "{certificate_id}",
154+
in_use: true,
155+
},
156+
},
157+
}}
158+
/>
162159

163160
Once `in-use` is set to `true`, Gateway will sign your traffic using the custom root certificate and private key. If you turn off or deactivate the custom certificate, Gateway will revert to the next available Cloudflare certificate generated for your Zero Trust account.
164161

src/content/docs/cloudflare-one/connections/connect-devices/user-side-certificates/index.mdx

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ sidebar:
55
order: 2
66
---
77

8-
import { Tabs, TabItem } from "~/components";
8+
import { Tabs, TabItem, APIRequest } from "~/components";
99

1010
Advanced security features such as [HTTPS traffic inspection](/cloudflare-one/policies/gateway/http-policies/tls-decryption/), [Data Loss Prevention](/cloudflare-one/policies/data-loss-prevention/), [anti-virus scanning](/cloudflare-one/policies/gateway/http-policies/antivirus-scanning/), [Access for Infrastructure](/cloudflare-one/applications/non-http/infrastructure-apps/), and [Browser Isolation](/cloudflare-one/policies/browser-isolation/) require users to install and trust a root certificate on their device. You can either install the certificate provided by Cloudflare (default option), or generate your own custom certificate and upload it to Cloudflare.
1111

@@ -46,11 +46,7 @@ To generate a new Cloudflare root certificate for your Zero Trust organization:
4646

4747
Send a `POST` request to the [Create Zero Trust certificate](/api/resources/zero_trust/subresources/gateway/subresources/certificates/methods/create/) endpoint.
4848

49-
```sh
50-
curl --request POST \
51-
https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/gateway/certificates \
52-
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN"
53-
```
49+
<APIRequest path="/accounts/{account_id}/gateway/certificates" method="POST" />
5450

5551
The API will respond with the ID and contents of the new certificate.
5652

@@ -83,11 +79,10 @@ To activate your root certificate:
8379

8480
Send a `POST` request to the [Activate a Zero Trust certificate](/api/resources/zero_trust/subresources/gateway/subresources/certificates/methods/activate/) endpoint.
8581

86-
```sh
87-
curl --request POST \
88-
https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/gateway/certificates/$CERTIFICATE_ID/activate \
89-
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN"
90-
```
82+
<APIRequest
83+
path="/accounts/{account_id}/gateway/certificates/{certificate_id}/activate"
84+
method="POST"
85+
/>
9186

9287
</TabItem> </Tabs>
9388

@@ -108,20 +103,18 @@ Once you deploy and install your certificate, you can turn it on for use in insp
108103

109104
Send a `PUT` request to the [Update Zero Trust account configuration](/api/resources/zero_trust/subresources/gateway/subresources/configurations/methods/update/) endpoint. For example:
110105

111-
```sh
112-
curl --request PUT \
113-
"https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/gateway/configuration" \
114-
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
115-
--header "Content-Type: application/json" \
116-
--data '{
117-
"settings": {
118-
"certificate": {
119-
"id": "$CERTIFICATE_ID",
120-
"in_use": true
121-
}
122-
}
123-
}'
124-
```
106+
<APIRequest
107+
path="/accounts/{account_id}/gateway/configuration"
108+
method="PUT"
109+
json={{
110+
settings: {
111+
certificate: {
112+
id: "{certificate_id}",
113+
in_use: true,
114+
},
115+
},
116+
}}
117+
/>
125118

126119
</TabItem> </Tabs>
127120

0 commit comments

Comments
 (0)