cf 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -1
- package/dist/{abuse-reports-Dy76QPNP.mjs → abuse-reports-Ina5TlsU.mjs} +2 -2
- package/dist/{accounts-CjtZ8x1z.mjs → accounts-B_joQcMi.mjs} +9 -9
- package/dist/{acm-C2lYIWs1.mjs → acm-_kIHqYME.mjs} +2 -2
- package/dist/{addressing-CHFK6uxW.mjs → addressing-CaFlw8y1.mjs} +10 -10
- package/dist/{agent-context-CgGCT0xU.mjs → agent-context-DMPfi54f.mjs} +1 -1
- package/dist/ai-CqnhNb_c.mjs +2 -0
- package/dist/ai-gateway-pgYGI519.mjs +8 -0
- package/dist/ai-search-eqQMPQol.mjs +7 -0
- package/dist/ai_gateway--vuVLnOm.mjs +4 -0
- package/dist/{alerting-Bk85NNf5.mjs → alerting-CPxHiYHb.mjs} +5 -5
- package/dist/{analytics-CkhhhZWZ.mjs → analytics-DSSRDZz8.mjs} +1 -1
- package/dist/analytics_engine-gWyfnsCs.mjs +2 -0
- package/dist/{api-gateway-CWdR4Ne7.mjs → api-gateway-BXXGFCVR.mjs} +10 -10
- package/dist/argo-aC6A3JyX.mjs +2 -0
- package/dist/artifacts-HD4V2xpK.mjs +4 -0
- package/dist/audit-logs-BuExU_nz.mjs +2 -0
- package/dist/auth-CSC4yhEJ.mjs +9 -0
- package/dist/auth-D5hNsOFq.mjs +5 -0
- package/dist/billing-COaghyxl.mjs +2 -0
- package/dist/bot-management-DmEzeV1Y.mjs +5 -0
- package/dist/botnet-feed-ByEAXAkw.mjs +3 -0
- package/dist/brand-protection-dPrGe8sL.mjs +3 -0
- package/dist/{browser-rendering-Rae0AUt0.mjs → browser-rendering-BiSGnpBf.mjs} +3 -3
- package/dist/{build-BE4o4imx.mjs → build-HuS9-R0V.mjs} +2 -2
- package/dist/{cache-B7pRbpTy.mjs → cache-CY-7Lt71.mjs} +4 -4
- package/dist/{calls-DXRWsZ8n.mjs → calls-wOQGDWPl.mjs} +3 -3
- package/dist/certificate-authorities-CtqzAtxQ.mjs +2 -0
- package/dist/client-certificates-CRf41xLe.mjs +3 -0
- package/dist/cloud-connector-BA5IRZUP.mjs +2 -0
- package/dist/{cloudforce-one-B6HYfk5Z.mjs → cloudforce-one-Bq_qPAWs.mjs} +20 -20
- package/dist/{completions-D_9WsLG7.mjs → completions-DOeHPdCG.mjs} +2 -2
- package/dist/{config-7CBz8Xm0.mjs → config-B5k-XbwS.mjs} +1 -1
- package/dist/connectivity-Bx3MgTHX.mjs +3 -0
- package/dist/connector-interrupts-D7ylweJZ.mjs +2 -0
- package/dist/connector-telemetry-events-6izV1kbP.mjs +2 -0
- package/dist/connector-telemetry-snapshots-BnjKbyxX.mjs +2 -0
- package/dist/connectors-DRt4e6d_.mjs +3 -0
- package/dist/{content-scanning-CnW2A0pv.mjs → content-scanning-Cd2vy5Sz.mjs} +3 -3
- package/dist/context-jpewmual.mjs +2 -0
- package/dist/{custom-certificates-CnYh6Yi-.mjs → custom-certificates-DYE-9epx.mjs} +3 -3
- package/dist/{custom-hostnames-C2upqZso.mjs → custom-hostnames-CtuTdFcX.mjs} +4 -4
- package/dist/custom-nameservers-CWqA51in.mjs +3 -0
- package/dist/custom-pages-DeUKEFGe.mjs +4 -0
- package/dist/d1-DvWY9Gp4.mjs +4 -0
- package/dist/data-security-BPo6dIWu.mjs +6 -0
- package/dist/dcv-delegation-Bgf86J-r.mjs +2 -0
- package/dist/{deploy-KBRFIatG.mjs → deploy-dVrgDUOp.mjs} +1 -1
- package/dist/{dev-pPazzZvt.mjs → dev-C01_Lby6.mjs} +1 -1
- package/dist/diagnostics-6nKPmVgz.mjs +3 -0
- package/dist/{dispatch-namespaces-Cz2rajnP.mjs → dispatch-namespaces-64lXx2WJ.mjs} +6 -6
- package/dist/{dist-DpDjsWWn.mjs → dist-C6zxsVdY.mjs} +2 -2
- package/dist/{dist-DA54ZQu0.mjs → dist-t_YrL25p.mjs} +1 -1
- package/dist/{dns-62t95Xif.mjs → dns-ClciFGxx.mjs} +13 -13
- package/dist/dns-firewall-DfUmXDCe.mjs +57 -0
- package/dist/durable-objects-CMaYZ-YU.mjs +2 -0
- package/dist/{email-routing-BDUYYeV3.mjs → email-routing-CGXhFqF5.mjs} +9 -9
- package/dist/{email-security-ChHA6eqQ.mjs → email-security-D5viPq8S.mjs} +7 -7
- package/dist/email-sending-C2jpc3gh.mjs +3 -0
- package/dist/{filters-qJpU9uAS.mjs → filters-bzsFcWt0.mjs} +3 -3
- package/dist/{firewall-C3DDwfwh.mjs → firewall-DYZcTtIC.mjs} +10 -10
- package/dist/{fraud-DY3YXFVf.mjs → fraud-C03MtdZb.mjs} +1 -1
- package/dist/google-tag-gateway-Dfy887yA.mjs +2 -0
- package/dist/{healthchecks-Drvb79v0.mjs → healthchecks-DRoAlWgr.mjs} +3 -3
- package/dist/hostnames-CFgIVI3s.mjs +3 -0
- package/dist/hyperdrive-C7-gwTSV.mjs +18 -0
- package/dist/iam-DqVPzGrb.mjs +6 -0
- package/dist/{images-D1jI3r3O.mjs → images-BYfl4YgR.mjs} +6 -6
- package/dist/index.mjs +1 -1
- package/dist/intel-duTEPIHc.mjs +3 -0
- package/dist/{ips-B6JETVOY.mjs → ips-nv9INuWZ.mjs} +1 -1
- package/dist/keyless-certificates-CRCDVd3g.mjs +3 -0
- package/dist/{kv-CSWoD9ks.mjs → kv-CZoV4tiv.mjs} +4 -4
- package/dist/leaked-credential-checks-DNIBg7Pe.mjs +3 -0
- package/dist/{load-balancers-Du1tNuUt.mjs → load-balancers--OMg0HNt.mjs} +5 -5
- package/dist/{logpush-SuJyO-uX.mjs → logpush-C0_lZTyY.mjs} +3 -3
- package/dist/{logs-DcDNRPRl.mjs → logs-BtpWZQfV.mjs} +2 -2
- package/dist/magic-cloud-networking-u6rwYbGg.mjs +5 -0
- package/dist/{magic-network-monitoring-CqtvOePQ.mjs → magic-network-monitoring-CKgQyRj4.mjs} +3 -3
- package/dist/{magic-transit-BTbkhBtF.mjs → magic-transit-CLhMcJ_-.mjs} +32 -32
- package/dist/managed-transforms-D0Z2mlth.mjs +3 -0
- package/dist/mtls-certificates-BL65NK5T.mjs +3 -0
- package/dist/{network-interconnects-DsiNytOU.mjs → network-interconnects-Bgu9gmaG.mjs} +5 -5
- package/dist/oauth-Bk-F-tIO.mjs +52 -0
- package/dist/{observability-CLqZ7OSi.mjs → observability-BynRbTF4.mjs} +3 -3
- package/dist/{open-YWOUIZ5Y-BpqIuBsR.mjs → open-YWOUIZ5Y-3jqSKAB1.mjs} +1 -1
- package/dist/{organizations-aRi1bhFC.mjs → organizations-BqJHyvMK.mjs} +3 -3
- package/dist/origin-ca-certificates-BGvYwm3C.mjs +3 -0
- package/dist/origin-post-quantum-encryption-9KOE8YPI.mjs +2 -0
- package/dist/{origin-tls-client-auth-CnQNy9-l.mjs → origin-tls-client-auth-d3snC3vr.mjs} +3 -3
- package/dist/{output-CUxZRM5A.mjs → output-B6fBFRqe.mjs} +1 -1
- package/dist/{page-rules-CYqtPU1p.mjs → page-rules-EZHJePmn.mjs} +4 -4
- package/dist/{page-shield-D8l9ZMUl.mjs → page-shield-CXJioWPs.mjs} +5 -5
- package/dist/{pages-ChurJ2H7.mjs → pages-D4aYteKk.mjs} +8 -8
- package/dist/{pipelines-CeyujvRf.mjs → pipelines-G8Iusxq-.mjs} +5 -5
- package/dist/progress-DrDErV9w.mjs +2 -0
- package/dist/queues-DEkbKqZX.mjs +6 -0
- package/dist/{r2-BtuTO3vQ.mjs → r2-CV0IkCAW.mjs} +9 -9
- package/dist/r2-data-catalog-NtqGC_a_.mjs +14 -0
- package/dist/{radar-CzGM92uM.mjs → radar-D986zPJr.mjs} +1 -1
- package/dist/{rate-limits-Bbk7HxP7.mjs → rate-limits-B2wRsUX1.mjs} +3 -3
- package/dist/raw-fetch-_n0lMAnD.mjs +2 -0
- package/dist/{realtime-kit-CivLpkpg.mjs → realtime-kit-Ld3c5eU6.mjs} +9 -9
- package/dist/{registrar-8IeA5DKd.mjs → registrar-CDIwTz3G.mjs} +6 -6
- package/dist/request-tracers-D7SFMDik.mjs +2 -0
- package/dist/{resource-sharing-B-Pcto7-.mjs → resource-sharing-YIQ04jXE.mjs} +4 -4
- package/dist/{resource-tagging-Bpb6Qq1M.mjs → resource-tagging-Bd6Y03sg.mjs} +7 -7
- package/dist/rules-DHjLP5Kx.mjs +4 -0
- package/dist/{rulesets-lYczEcJp.mjs → rulesets-q4QABpKs.mjs} +7 -7
- package/dist/rum-SmT4HZmM.mjs +4 -0
- package/dist/{schema-hefO-tzo.mjs → schema-BR31o4P6.mjs} +1 -1
- package/dist/{schema-validation-DTq517Em.mjs → schema-validation-vVetgC_P.mjs} +5 -5
- package/dist/{scim-BiLfOQ89.mjs → scim-ChOkZpNx.mjs} +2 -2
- package/dist/{session-CsvPYFj8.mjs → sdk-DhIhH6GB.mjs} +4 -4
- package/dist/{secrets-store-CBX0dvHL.mjs → secrets-store-BAK9G12O.mjs} +12 -12
- package/dist/security-center-eScuYDKP.mjs +2 -0
- package/dist/security-txt-x7R4gmQu.mjs +3 -0
- package/dist/session-DHYCE-PM.mjs +93 -0
- package/dist/shared-BAjo72Lz.mjs +2 -0
- package/dist/{smart-shield-DblHIce0.mjs → smart-shield-CWlSsNi8.mjs} +2 -2
- package/dist/snippets-DrlgYJYp.mjs +4 -0
- package/dist/{spawn-DK7pott_.mjs → spawn-CCGzKlC4.mjs} +1 -1
- package/dist/{spectrum-CnrG0jIC.mjs → spectrum-pVGxb7u5.mjs} +6 -6
- package/dist/speed-ZFrMWDgd.mjs +4 -0
- package/dist/src-DU7FBCOX.mjs +108 -0
- package/dist/ssl-9JY05sYt.mjs +15 -0
- package/dist/{stream-CGTRN4ZN.mjs → stream-tRU39b8K.mjs} +13 -13
- package/dist/{tenants-o_M62Y1n.mjs → tenants-HLGUazms.mjs} +1 -1
- package/dist/{token-validation-Ca5AGEns.mjs → token-validation-_VdamKpz.mjs} +4 -4
- package/dist/{tools-DtNNmO6l.mjs → tools-D_hfUU_Z.mjs} +1 -1
- package/dist/{turnstile-l7mo9BWL.mjs → turnstile-BRzXd28B.mjs} +4 -4
- package/dist/{ui-B97lRnOv.mjs → ui-erjBdVKL.mjs} +1 -1
- package/dist/url-normalization-D-NxuLtN.mjs +3 -0
- package/dist/url-scanner-BzzR6iDx.mjs +2 -0
- package/dist/{user-CiyYZ69X.mjs → user-C4omq__w.mjs} +1 -1
- package/dist/vectorize-By6EqcNR.mjs +4 -0
- package/dist/{versions-B6E8WQyA.mjs → versions-CBHwWPAM.mjs} +1 -1
- package/dist/{waiting-rooms-Bhy_nuV3.mjs → waiting-rooms-u6KwrzWd.mjs} +6 -6
- package/dist/{web3-DlHE0CZc.mjs → web3-DQ5dmE9W.mjs} +3 -3
- package/dist/{workers-DRAkU6YR.mjs → workers-D8Be7_as.mjs} +14 -14
- package/dist/workers-builds-BE3W3qNk.mjs +7 -0
- package/dist/{workflows-z6oapEJs.mjs → workflows-BWWufqFA.mjs} +3 -3
- package/dist/zaraz-Bsa9AvVL.mjs +2 -0
- package/dist/{zero-trust-fyyIelWx.mjs → zero-trust-UNVZFnKu.mjs} +87 -87
- package/dist/zero_trust-B0_Rk4p2.mjs +3 -0
- package/dist/{zones-MSULnDwW.mjs → zones-BXtdwt6E.mjs} +6 -6
- package/package.json +1 -1
- package/dist/ai-DS3i-I1a.mjs +0 -2
- package/dist/ai-gateway-RIsegO2x.mjs +0 -8
- package/dist/ai-search-Dcj4BauG.mjs +0 -7
- package/dist/ai_gateway-w7YwfcPE.mjs +0 -4
- package/dist/analytics_engine-B7qgDJCA.mjs +0 -2
- package/dist/argo-DnJRVnGX.mjs +0 -2
- package/dist/artifacts-BVWKiJUl.mjs +0 -4
- package/dist/audit-logs-DjTstbzL.mjs +0 -2
- package/dist/auth-BqDOIrKX.mjs +0 -150
- package/dist/auth-DKkSwnxh.mjs +0 -5
- package/dist/billing-3rEqF83h.mjs +0 -2
- package/dist/bot-management-CJxD1pqi.mjs +0 -5
- package/dist/botnet-feed-MG91D7BR.mjs +0 -3
- package/dist/brand-protection-CK7gJi06.mjs +0 -3
- package/dist/certificate-authorities-BR3gXBLs.mjs +0 -2
- package/dist/client-certificates-B0ebLJdk.mjs +0 -3
- package/dist/cloud-connector-BOjaggJk.mjs +0 -2
- package/dist/connectivity-welFvZ7X.mjs +0 -3
- package/dist/connector-interrupts-DTV3F-50.mjs +0 -2
- package/dist/connector-telemetry-events-kDqb_AGm.mjs +0 -2
- package/dist/connector-telemetry-snapshots-DC-wD75E.mjs +0 -2
- package/dist/connectors-3vjrdFLB.mjs +0 -3
- package/dist/context-CONbNKO-.mjs +0 -2
- package/dist/custom-nameservers-BGkAD_PZ.mjs +0 -3
- package/dist/custom-pages-5fCSP8in.mjs +0 -4
- package/dist/d1-CyiRbZZn.mjs +0 -4
- package/dist/data-security-Casx4OS_.mjs +0 -6
- package/dist/dcv-delegation-DVYO10oA.mjs +0 -2
- package/dist/diagnostics-BqYDoDfw.mjs +0 -3
- package/dist/dns-firewall-Coy8d47t.mjs +0 -57
- package/dist/durable-objects-BSuRERkw.mjs +0 -2
- package/dist/email-sending-CVrRqn6S.mjs +0 -3
- package/dist/google-tag-gateway-B00MHDfB.mjs +0 -2
- package/dist/hostnames-BdAQo1Mr.mjs +0 -3
- package/dist/hyperdrive-99OJV9nl.mjs +0 -18
- package/dist/iam-BRbpg3lN.mjs +0 -6
- package/dist/intel-C3ajLpXd.mjs +0 -3
- package/dist/keyless-certificates-C4MZ4xnf.mjs +0 -3
- package/dist/leaked-credential-checks-Dgs2oKm9.mjs +0 -3
- package/dist/magic-cloud-networking-D-T0RCvi.mjs +0 -5
- package/dist/managed-transforms-CfUBSz9p.mjs +0 -3
- package/dist/mtls-certificates-Cf1O8c2E.mjs +0 -3
- package/dist/origin-ca-certificates-BB4H89a_.mjs +0 -3
- package/dist/origin-post-quantum-encryption-DurP3PXG.mjs +0 -2
- package/dist/progress-Cent9Lsg.mjs +0 -2
- package/dist/queues-Rf_n11Cx.mjs +0 -6
- package/dist/r2-data-catalog-Debz38kv.mjs +0 -14
- package/dist/raw-fetch-DnbAMFBp.mjs +0 -2
- package/dist/request-tracers-D1aH4NmL.mjs +0 -2
- package/dist/rules-B10XWY10.mjs +0 -4
- package/dist/rum-B5GUKa4I.mjs +0 -4
- package/dist/security-center-AVpTOBK3.mjs +0 -2
- package/dist/security-txt-DVlh8y9l.mjs +0 -3
- package/dist/shared-0bwWVDLo.mjs +0 -2
- package/dist/snippets-DrpqSXYC.mjs +0 -4
- package/dist/speed-BzRY3Xlh.mjs +0 -4
- package/dist/src-D9_Gq68b.mjs +0 -108
- package/dist/ssl-Cp6tQkZH.mjs +0 -15
- package/dist/url-normalization-D1CogSIG.mjs +0 -3
- package/dist/url-scanner-BnJHJqcz.mjs +0 -2
- package/dist/vectorize-D3LgMLOn.mjs +0 -4
- package/dist/workers-builds-BmNjiHDZ.mjs +0 -7
- package/dist/zaraz-CyzfYOEU.mjs +0 -2
- package/dist/zero_trust-BAhlNkjo.mjs +0 -3
- /package/dist/{body-parser-CBpeIUns.mjs → body-parser-DWSy7uZ8.mjs} +0 -0
- /package/dist/{chunk-6IEM75FG-U3L9fKgi.mjs → chunk-6IEM75FG-BEjRFMGh.mjs} +0 -0
- /package/dist/{cli-types-CMNMD1V7.mjs → cli-types-BeyOc81z.mjs} +0 -0
- /package/dist/{input-validation-CTqtyiY9.mjs → input-validation-_fMCApaH.mjs} +0 -0
- /package/dist/{lib-B6xvCJjc.mjs → lib-4PQI6yRW.mjs} +0 -0
- /package/dist/{local-D8bhHUMK.mjs → local-CYc9q7l2.mjs} +0 -0
- /package/dist/{metadata-jh2EIan8.mjs → metadata-OOwvpR8m.mjs} +0 -0
- /package/dist/{resolve-D1mG0REg.mjs → resolve-C3h-mwp7.mjs} +0 -0
- /package/dist/{theme-CFHr0Dh9.mjs → theme-DbNbIY4d.mjs} +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{
|
|
3
|
-
`);return}l(await d(`Deleting`,async()=>
|
|
4
|
-
Notes: For example, the string 'attack' would match IP Access rules with notes 'Attack 26/02' and 'Attack 27/02'. The search is case insensitive.`}).option(`match`,{type:`string`,description:"Defines the search requirements. When set to `all`, all the search requirements must match. When set to `any`, only one of the search requirements has to match.",choices:[`any`,`all`]}).option(`page`,{type:`number`,description:`Defines the requested page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`Defines the maximum number of results requested.`}).option(`order`,{type:`string`,description:`Defines the field used to sort returned rules.`,choices:[`configuration.target`,`configuration.value`,`mode`]}).option(`direction`,{type:`string`,description:`Defines the direction used to sort returned rules.`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const S={command:`list`,describe:`Fetches IP Access rules of an account. These rules apply to all the zones in the account. You can filter the results using several optional parameters.`,builder:m(x),handler:async t=>{let
|
|
5
|
-
`);return}l(await d(`Deleting`,async()=>t.firewall.lockdowns.delete({zone_id:
|
|
6
|
-
`);return}if(e.body){let
|
|
7
|
-
`);return}if(e.body){let
|
|
8
|
-
`);return}l(await d(`Deleting`,async()=>t.firewall.uaRules.delete({zone_id:
|
|
9
|
-
`);return}l(await d(`Deleting`,async()=>t.firewall.waf.overrides.delete({zone_id:i,overrides_id:e[`overrides-id`]})),{successLabel:`Deleted`})}};function ve(e){return e.positional(`overrides-id`,{type:`string`,description:`The unique identifier of the WAF override.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ye={command:`get <overrides-id>`,describe:`Fetches the details of a URI-based WAF override. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:ve,handler:async e=>{if(e.dryRun){u({command:`cf firewall waf overrides get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/overrides/${e[`overrides-id`]==null?`<overrides-id>`:encodeURIComponent(String(e[`overrides-id`]))}`,pathParams:{"overrides-id":String(e[`overrides-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,l(await d(`Loading`,async()=>t.firewall.waf.overrides.get({zone_id:r,overrides_id:e[`overrides-id`]})),{successLabel:`Loaded`})}};function be(e){return e.option(`page`,{type:`number`,description:`The page number of paginated results.`}).option(`per-page`,{type:`number`,description:`The number of WAF overrides per page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const xe={command:`list`,describe:`Fetches the URI-based WAF overrides in a zone. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:be,handler:async e=>{let t={page:e.page,per_page:e[`per-page`]};if(e.dryRun){u({command:`cf firewall waf overrides list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/overrides`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let r=await o(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,l(await d(`Loading`,async()=>r.firewall.waf.overrides.list({zone_id:i,...t})),{successLabel:`Loaded`})}};function Se(e){return e.positional(`overrides-id`,{type:`string`,description:`The unique identifier of the WAF override.`,demandOption:!0}).option(`urls`,{type:`string`,array:!0,description:`The URLs to include in the current WAF override. You can use wildcards. Each entered URL will be escaped before use, which means you can only use simple wildcard patterns.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ce={command:`update <overrides-id>`,describe:`Updates an existing URI-based WAF override. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:Se,handler:async e=>{if(e.dryRun){u({command:`cf firewall waf overrides update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/overrides/${e[`overrides-id`]==null?`<overrides-id>`:encodeURIComponent(String(e[`overrides-id`]))}`,pathParams:{"overrides-id":String(e[`overrides-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({urls:e.urls}):s(e.body)});return}let t=await o(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=s(e.body);l(await d(`Updating`,async()=>t.firewall.waf.overrides.update({...n,zone_id:r,overrides_id:e[`overrides-id`]})),{successLabel:`Updated`});return}if(e.urls===void 0)throw Error(`--urls is required (or pass --body with this field set).`);let i=c({urls:e.urls});l(await d(`Updating`,async()=>t.firewall.waf.overrides.update({...i,zone_id:r,overrides_id:e[`overrides-id`]})),{successLabel:`Updated`})}},we={command:`overrides`,describe:`Legacy WAF managed rule packages, rule groups, individual rules, and override configurations`,builder:e=>e.command(he).command(_e).command(ye).command(xe).command(Ce).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Te(e){return e.positional(`package-id`,{type:`string`,description:`Defines a package identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ee={command:`get <package-id>`,describe:`Fetches the details of a WAF package. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:Te,handler:async e=>{if(e.dryRun){u({command:`cf firewall waf packages get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages/${e[`package-id`]==null?`<package-id>`:encodeURIComponent(String(e[`package-id`]))}`,pathParams:{"package-id":String(e[`package-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,l(await d(`Loading`,async()=>t.firewall.waf.packages.get({zone_id:r,package_id:e[`package-id`]})),{successLabel:`Loaded`})}};function De(e){return e.positional(`group-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`package-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`mode`,{type:`string`,description:"Defines the state of the rules contained in the rule group. When `on`, the rules in the group are configurable/usable.",choices:[`on`,`off`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Oe={command:`edit <group-id>`,describe:"Updates a WAF rule group. You can update the state (`mode` parameter) of a rule group. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).",builder:De,handler:async e=>{if(e.dryRun){u({command:`cf firewall waf packages groups edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages/${e[`package-id`]==null?`<package-id>`:encodeURIComponent(String(e[`package-id`]))}/groups/${e[`group-id`]==null?`<group-id>`:encodeURIComponent(String(e[`group-id`]))}`,pathParams:{"group-id":String(e[`group-id`]??``),"package-id":String(e[`package-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({mode:f(e.mode,`mode`,`text`)}):s(e.body)});return}let t=await o(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=s(e.body);l(await d(`Updating`,async()=>t.firewall.waf.packages.groups.edit({...n,zone_id:r,package_id:e[`package-id`],group_id:e[`group-id`]})),{successLabel:`Updated`});return}let i=c({mode:f(e.mode,`mode`,`text`)});l(await d(`Updating`,async()=>t.firewall.waf.packages.groups.edit({...i,zone_id:r,package_id:e[`package-id`],group_id:e[`group-id`]})),{successLabel:`Updated`})}};function ke(e){return e.positional(`group-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`package-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ae={command:`get <group-id>`,describe:`Fetches the details of a WAF rule group. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:ke,handler:async e=>{if(e.dryRun){u({command:`cf firewall waf packages groups get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages/${e[`package-id`]==null?`<package-id>`:encodeURIComponent(String(e[`package-id`]))}/groups/${e[`group-id`]==null?`<group-id>`:encodeURIComponent(String(e[`group-id`]))}`,pathParams:{"group-id":String(e[`group-id`]??``),"package-id":String(e[`package-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,l(await d(`Loading`,async()=>t.firewall.waf.packages.groups.get({zone_id:r,package_id:e[`package-id`],group_id:e[`group-id`]})),{successLabel:`Loaded`})}};function je(e){return e.option(`package-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`mode`,{type:`string`,description:"Defines the state of the rules contained in the rule group. When `on`, the rules in the group are configurable/usable.",choices:[`on`,`off`]}).option(`page`,{type:`number`,description:`Defines the page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Defines the number of rule groups per page.`}).option(`order`,{type:`string`,description:`Defines the field used to sort returned rule groups.`,choices:[`mode`,`rules_count`]}).option(`direction`,{type:`string`,description:`Defines the direction used to sort returned rule groups.`,choices:[`asc`,`desc`]}).option(`match`,{type:`string`,description:"Defines the condition for search requirements. When set to `all`, all the search requirements must match. When set to `any`, only one of the search requirements has to match.",choices:[`any`,`all`]}).option(`name`,{type:`string`,description:`Defines the name of the rule group.`}).option(`rules-count`,{type:`number`,description:`Defines the number of rules in the current rule group.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Me={command:`list`,describe:`Fetches the WAF rule groups in a WAF package. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:m(je),handler:async e=>{let t={mode:e.mode,page:e.page,per_page:e[`per-page`],order:e.order,direction:e.direction,match:e.match,name:e.name,rules_count:e[`rules-count`]};if(e.dryRun){u({command:`cf firewall waf packages groups list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages/${e[`package-id`]==null?`<package-id>`:encodeURIComponent(String(e[`package-id`]))}/groups`,pathParams:{"package-id":String(e[`package-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let r=await o(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,l(await d(`Loading`,async()=>r.firewall.waf.packages.groups.list({zone_id:i,package_id:e[`package-id`],...t})),{successLabel:`Loaded`})}},Ne={command:`groups`,describe:`Legacy WAF managed rule packages, rule groups, individual rules, and override configurations`,builder:e=>e.command(Oe).command(Ae).command(Me).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Pe(e){return e.option(`page`,{type:`number`,description:`The page number of paginated results.`}).option(`per-page`,{type:`number`,description:`The number of packages per page.`}).option(`order`,{type:`string`,description:`The field used to sort returned packages.`,choices:[`name`]}).option(`direction`,{type:`string`,description:`The direction used to sort returned packages.`,choices:[`asc`,`desc`]}).option(`match`,{type:`string`,description:"When set to `all`, all the search requirements must match. When set to `any`, only one of the search requirements has to match.",choices:[`any`,`all`]}).option(`name`,{type:`string`,description:`The name of the WAF package.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Fe={command:`list`,describe:`Fetches WAF packages for a zone. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:m(Pe),handler:async e=>{let t={page:e.page,per_page:e[`per-page`],order:e.order,direction:e.direction,match:e.match,name:e.name};if(e.dryRun){u({command:`cf firewall waf packages list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let r=await o(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,l(await d(`Loading`,async()=>r.firewall.waf.packages.list({zone_id:i,...t})),{successLabel:`Loaded`})}};function Ie(e){return e.positional(`rule-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`package-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`mode`,{type:`string`,description:"Defines the mode/action of the rule when triggered. You must use a value from the `allowed_modes` array of the current rule.",choices:[`default`,`disable`,`simulate`,`block`,`challenge`,`on`,`off`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Le={command:`edit <rule-id>`,describe:`Updates a WAF rule. You can only update the mode/action of the rule. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:Ie,handler:async e=>{if(e.dryRun){u({command:`cf firewall waf packages rules edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages/${e[`package-id`]==null?`<package-id>`:encodeURIComponent(String(e[`package-id`]))}/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"rule-id":String(e[`rule-id`]??``),"package-id":String(e[`package-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({mode:f(e.mode,`mode`,`text`)}):s(e.body)});return}let t=await o(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=s(e.body);l(await d(`Updating`,async()=>t.firewall.waf.packages.rules.edit({...n,zone_id:r,package_id:e[`package-id`],rule_id:e[`rule-id`]})),{successLabel:`Updated`});return}let i=c({mode:f(e.mode,`mode`,`text`)});l(await d(`Updating`,async()=>t.firewall.waf.packages.rules.edit({...i,zone_id:r,package_id:e[`package-id`],rule_id:e[`rule-id`]})),{successLabel:`Updated`})}};function Re(e){return e.positional(`rule-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`package-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ze={command:`get <rule-id>`,describe:`Fetches the details of a WAF rule in a WAF package. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:Re,handler:async e=>{if(e.dryRun){u({command:`cf firewall waf packages rules get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages/${e[`package-id`]==null?`<package-id>`:encodeURIComponent(String(e[`package-id`]))}/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"rule-id":String(e[`rule-id`]??``),"package-id":String(e[`package-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,l(await d(`Loading`,async()=>t.firewall.waf.packages.rules.get({zone_id:r,package_id:e[`package-id`],rule_id:e[`rule-id`]})),{successLabel:`Loaded`})}};function Be(e){return e.option(`package-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`mode`,{type:`string`,description:`Defines the action/mode a rule has been overridden to perform.`,choices:[`DIS`,`CHL`,`BLK`,`SIM`]}).option(`group-id`,{type:`string`,description:`Defines the unique identifier of the rule group.`}).option(`page`,{type:`number`,description:`Defines the page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Defines the number of rules per page.`}).option(`order`,{type:`string`,description:`Defines the field used to sort returned rules.`,choices:[`priority`,`group_id`,`description`]}).option(`direction`,{type:`string`,description:`Defines the direction used to sort returned rules.`,choices:[`asc`,`desc`]}).option(`match`,{type:`string`,description:"Defines the search requirements. When set to `all`, all the search requirements must match. When set to `any`, only one of the search requirements has to match.",choices:[`any`,`all`]}).option(`description`,{type:`string`,description:`Defines the public description of the WAF rule.`}).option(`priority`,{type:`string`,description:`Defines the order in which the individual WAF rule is executed within its rule group.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ve={command:`list`,describe:`Fetches WAF rules in a WAF package. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:m(Be),handler:async e=>{let t={mode:e.mode,group_id:e[`group-id`],page:e.page,per_page:e[`per-page`],order:e.order,direction:e.direction,match:e.match,description:e.description,priority:e.priority};if(e.dryRun){u({command:`cf firewall waf packages rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages/${e[`package-id`]==null?`<package-id>`:encodeURIComponent(String(e[`package-id`]))}/rules`,pathParams:{"package-id":String(e[`package-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let r=await o(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,l(await d(`Loading`,async()=>r.firewall.waf.packages.rules.list({zone_id:i,package_id:e[`package-id`],...t})),{successLabel:`Loaded`})}},$={command:`rules`,describe:`Legacy WAF managed rule packages, rule groups, individual rules, and override configurations`,builder:e=>e.command(Le).command(ze).command(Ve).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},He={command:`packages`,describe:`Legacy WAF managed rule packages, rule groups, individual rules, and override configurations`,builder:e=>e.command(Ee).command(Fe).command(Ne).command($).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Ue={command:`waf`,describe:`Operations for waf`,builder:e=>e.command(we).command(He).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function We(e){return e.option(`configuration-target`,{type:`string`,description:"The configuration target. You must set the target to `ip` when specifying an IP address in the rule.",choices:[`ip`,`ip6`,`ip_range`,`asn`,`country`]}).option(`configuration-value`,{type:`string`,description:`The IP address to match. This address will be compared to the IP address of incoming requests.`}).option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ge={command:`create`,describe:`Creates a new IP Access rule for a zone. Note: To create an IP Access rule that applies to multiple zones, refer to [IP Access rules for a user](#ip-access-rules-for-a-user) or [IP Access rules for an account](#ip-access-rules-for-an-account) as appropriate.`,builder:We,handler:async e=>{if(e.dryRun){u({command:`cf firewall zone-access-rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/access_rules/rules`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({configuration:{target:f(e[`configuration-target`],`configuration-target`,`text`),value:f(e[`configuration-value`],`configuration-value`,`text`)},mode:f(e.mode,`mode`,`text`)}):s(e.body)});return}let r=await o(e),i=await n({zone:e.zone},r,{quiet:e.quiet});if(e.zoneId=i,e.body){let t=s(e.body);l(await d(`Creating`,async()=>r.firewall.zoneAccessRules.create({...t,zone_id:i})),{successLabel:`Created`});return}e.mode===void 0&&(e.mode=await t(`mode`,`The action to apply to a matched request.`,[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]));let a=c({configuration:{target:f(e[`configuration-target`],`configuration-target`,`text`),value:f(e[`configuration-value`],`configuration-value`,`text`)},mode:f(e.mode,`mode`,`text`)});l(await d(`Creating`,async()=>r.firewall.zoneAccessRules.create({...a,zone_id:i})),{successLabel:`Created`})}};function Ke(e){return e.positional(`rule-id`,{type:`string`,description:`Unique identifier for a rule.`,demandOption:!0}).option(`cascade`,{type:`string`,description:"The level to attempt to delete similar rules defined for other zones with the same owner. The default value is `none`, which will only delete the current rule. Using `basic` will delete rules that match the same action (mode) and configuration, while using `aggressive` will delete rules that match the same configuration.",choices:[`none`,`basic`,`aggressive`],default:`none`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const qe={command:`delete <rule-id>`,describe:"Deletes an IP Access rule defined at the zone level. Optionally, you can use the `cascade` property to specify that you wish to delete similar rules in other zones managed by the same zone owner.",builder:Ke,handler:async e=>{if(e.dryRun){u({command:`cf firewall zone-access-rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/access_rules/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"rule-id":String(e[`rule-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({cascade:f(e.cascade,`cascade`,`text`)}):s(e.body)});return}let t=await o(e),i=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=i,!await r({force:!!e.force})){process.stderr.write(`Aborted.
|
|
10
|
-
`);return}if(e.body){let
|
|
11
|
-
Notes: For example, the string 'attack' would match IP Access rules with notes 'Attack 26/02' and 'Attack 27/02'. The search is case insensitive.`}).option(`match`,{type:`string`,description:"When set to `all`, all the search requirements must match. When set to `any`, only one of the search requirements has to match.",choices:[`any`,`all`]}).option(`page`,{type:`number`,description:`Requested page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results requested.`}).option(`order`,{type:`string`,description:`The field used to sort returned rules.`,choices:[`configuration.target`,`configuration.value`,`mode`]}).option(`direction`,{type:`string`,description:`The direction used to sort returned rules.`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ze={command:`list`,describe:`Fetches IP Access rules of a zone. You can filter the results using several optional parameters.`,builder:m(Xe),handler:async e=>{let t={mode:e.mode,"configuration.target":e[`configuration-target`],"configuration.value":e[`configuration-value`],notes:e.notes,match:e.match,page:e.page,per_page:e[`per-page`],order:e.order,direction:e.direction};if(e.dryRun){u({command:`cf firewall zone-access-rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/access_rules/rules`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let
|
|
2
|
+
import{S as e,T as t,g as n,w as r,x as i}from"./oauth-Bk-F-tIO.mjs";import{i as a,n as o}from"./auth-CSC4yhEJ.mjs";import{n as s,t as c}from"./body-parser-DWSy7uZ8.mjs";import{t as l}from"./output-B6fBFRqe.mjs";import{n as u,t as d}from"./progress-DrDErV9w.mjs";import{n as f}from"./input-validation-_fMCApaH.mjs";import{t as p}from"./local-CYc9q7l2.mjs";import{t as m}from"./cli-types-BeyOc81z.mjs";function ee(e){return e.option(`configuration-target`,{type:`string`,description:"The configuration target. You must set the target to `ip` when specifying an IP address in the rule.",choices:[`ip`,`ip6`,`ip_range`,`asn`,`country`]}).option(`configuration-value`,{type:`string`,description:`The IP address to match. This address will be compared to the IP address of incoming requests.`}).option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const te={command:`create`,describe:`Creates a new IP Access rule for an account. The rule will apply to all zones in the account. Note: To create an IP Access rule that applies to a single zone, refer to the [IP Access rules for a zone](#ip-access-rules-for-a-zone) endpoints.`,builder:ee,handler:async r=>{if(r.dryRun){u({command:`cf firewall access-rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/firewall/access_rules/rules`,pathParams:{},bodyKind:`json`,body:r.body===void 0?c({configuration:{target:f(r[`configuration-target`],`configuration-target`,`text`),value:f(r[`configuration-value`],`configuration-value`,`text`)},mode:f(r.mode,`mode`,`text`)}):s(r.body)});return}let i=await o(r),a=r.local?p:await n(i);if(r.accountId=a,r.body){let e=s(r.body);l(await d(`Creating`,async()=>i.firewall.accessRules.create({...e,account_id:a})),{successLabel:`Created`});return}r.mode===void 0&&(r.mode=await t(`mode`,`The action to apply to a matched request.`,[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]));let m=c({configuration:{target:f(r[`configuration-target`],`configuration-target`,`text`),value:f(r[`configuration-value`],`configuration-value`,`text`)},mode:f(r.mode,`mode`,`text`)});l(await d(`Creating`,async()=>i.firewall.accessRules.create({...m,account_id:a})),{successLabel:`Created`})}};function h(e){return e.positional(`rule-id`,{type:`string`,description:`Unique identifier for a rule.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const g={command:`delete <rule-id>`,describe:`Deletes an existing IP Access rule defined at the account level. Note: This operation will affect all zones in the account.`,builder:h,handler:async t=>{if(t.dryRun){u({command:`cf firewall access-rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/firewall/access_rules/rules/${t[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(t[`rule-id`]))}`,pathParams:{"rule-id":String(t[`rule-id`]??``)},bodyKind:`none`});return}let i=await o(t),a=t.local?p:await n(i);if(t.accountId=a,!await r({force:!!t.force})){process.stderr.write(`Aborted.
|
|
3
|
+
`);return}l(await d(`Deleting`,async()=>i.firewall.accessRules.delete({account_id:a,rule_id:t[`rule-id`]})),{successLabel:`Deleted`})}};function _(e){return e.positional(`rule-id`,{type:`string`,description:`Unique identifier for a rule.`,demandOption:!0}).option(`configuration-target`,{type:`string`,description:"The configuration target. You must set the target to `ip` when specifying an IP address in the rule.",choices:[`ip`,`ip6`,`ip_range`,`asn`,`country`]}).option(`configuration-value`,{type:`string`,description:`The IP address to match. This address will be compared to the IP address of incoming requests.`}).option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).option(`notes`,{type:`string`,description:`An informative summary of the rule, typically used as a reminder or explanation.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const v={command:`edit <rule-id>`,describe:`Updates an IP Access rule defined at the account level. Note: This operation will affect all zones in the account.`,builder:_,handler:async r=>{if(r.dryRun){u({command:`cf firewall access-rules edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/firewall/access_rules/rules/${r[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(r[`rule-id`]))}`,pathParams:{"rule-id":String(r[`rule-id`]??``)},bodyKind:`json`,body:r.body===void 0?c({configuration:{target:f(r[`configuration-target`],`configuration-target`,`text`),value:f(r[`configuration-value`],`configuration-value`,`text`)},mode:f(r.mode,`mode`,`text`),notes:f(r.notes,`notes`,`text`)}):s(r.body)});return}let i=await o(r),a=r.local?p:await n(i);if(r.accountId=a,r.body){let e=s(r.body);l(await d(`Updating`,async()=>i.firewall.accessRules.edit({body:e,account_id:a,rule_id:r[`rule-id`]})),{successLabel:`Updated`});return}r.mode===void 0&&(r.mode=await t(`mode`,`The action to apply to a matched request.`,[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]));let m=c({configuration:{target:f(r[`configuration-target`],`configuration-target`,`text`),value:f(r[`configuration-value`],`configuration-value`,`text`)},mode:f(r.mode,`mode`,`text`),notes:f(r.notes,`notes`,`text`)});l(await d(`Updating`,async()=>i.firewall.accessRules.edit({body:m,account_id:a,rule_id:r[`rule-id`]})),{successLabel:`Updated`})}};function y(e){return e.positional(`rule-id`,{type:`string`,description:`Unique identifier for a rule.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`get <rule-id>`,describe:`Fetches the details of an IP Access rule defined at the account level.`,builder:y,handler:async t=>{if(t.dryRun){u({command:`cf firewall access-rules get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/firewall/access_rules/rules/${t[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(t[`rule-id`]))}`,pathParams:{"rule-id":String(t[`rule-id`]??``)},bodyKind:`none`});return}let r=await o(t),i=t.local?p:await n(r);t.accountId=i,l(await d(`Loading`,async()=>r.firewall.accessRules.get({account_id:i,rule_id:t[`rule-id`]})),{successLabel:`Loaded`})}};function x(e){return e.option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).option(`configuration-target`,{type:`string`,description:`Defines the target to search in existing rules.`,choices:[`ip`,`ip_range`,`asn`,`country`]}).option(`configuration-value`,{type:`string`,description:"Defines the target value to search for in existing rules: an IP address, an IP address range, or a country code, depending on the provided `configuration.target`.\nNotes: You can search for a single IPv4 address, an IP address range with a subnet of '/16' or '/24', or a two-letter ISO-3166-1 alpha-2 country code."}).option(`notes`,{type:`string`,description:`Defines the string to search for in the notes of existing IP Access rules.
|
|
4
|
+
Notes: For example, the string 'attack' would match IP Access rules with notes 'Attack 26/02' and 'Attack 27/02'. The search is case insensitive.`}).option(`match`,{type:`string`,description:"Defines the search requirements. When set to `all`, all the search requirements must match. When set to `any`, only one of the search requirements has to match.",choices:[`any`,`all`]}).option(`page`,{type:`number`,description:`Defines the requested page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`Defines the maximum number of results requested.`}).option(`order`,{type:`string`,description:`Defines the field used to sort returned rules.`,choices:[`configuration.target`,`configuration.value`,`mode`]}).option(`direction`,{type:`string`,description:`Defines the direction used to sort returned rules.`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const S={command:`list`,describe:`Fetches IP Access rules of an account. These rules apply to all the zones in the account. You can filter the results using several optional parameters.`,builder:m(x),handler:async t=>{let r={mode:t.mode,"configuration.target":t[`configuration-target`],"configuration.value":t[`configuration-value`],notes:t.notes,match:t.match,page:t.page,per_page:t[`per-page`],order:t.order,direction:t.direction};if(t.dryRun){u({command:`cf firewall access-rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/firewall/access_rules/rules`,pathParams:{},query:r,bodyKind:`none`});return}let i=await o(t),a=t.local?p:await n(i);t.accountId=a,l(await d(`Loading`,async()=>i.firewall.accessRules.list({account_id:a,...r})),{successLabel:`Loaded`})}},C={command:`access-rules`,describe:`IP-based access rules that allow, block, challenge, or whitelist traffic globally or per-zone`,builder:e=>e.command(te).command(g).command(v).command(b).command(S).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function w(e){return e.option(`description`,{type:`string`,description:`An informative summary of the rule. This value is sanitized and any tags will be removed.`}).option(`paused`,{type:`boolean`,description:`When true, indicates that the rule is currently paused.`}).option(`priority`,{type:`number`,description:`The priority of the rule to control the processing order. A lower number indicates higher priority. If not provided, any rules with a configured priority will be processed before rules without a priority.`}).option(`urls`,{type:`string`,array:!0,description:`The URLs to include in the current WAF override. You can use wildcards. Each entered URL will be escaped before use, which means you can only use simple wildcard patterns.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const T={command:`create`,describe:`Creates a new Zone Lockdown rule.`,builder:w,handler:async e=>{if(e.dryRun){u({command:`cf firewall lockdowns create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/lockdowns`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({description:f(e.description,`description`,`text`),paused:e.paused,priority:e.priority,urls:e.urls}):s(e.body)});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=s(e.body);l(await d(`Creating`,async()=>t.firewall.lockdowns.create({...r,zone_id:n})),{successLabel:`Created`});return}if(e.urls===void 0)throw Error(`--urls is required (or pass --body with this field set).`);let r=c({description:f(e.description,`description`,`text`),paused:e.paused,priority:e.priority,urls:e.urls});l(await d(`Creating`,async()=>t.firewall.lockdowns.create({...r,zone_id:n})),{successLabel:`Created`})}};function E(e){return e.positional(`lock-downs-id`,{type:`string`,description:`The unique identifier of the Zone Lockdown rule.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const D={command:`delete <lock-downs-id>`,describe:`Deletes an existing Zone Lockdown rule.`,builder:E,handler:async e=>{if(e.dryRun){u({command:`cf firewall lockdowns delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/lockdowns/${e[`lock-downs-id`]==null?`<lock-downs-id>`:encodeURIComponent(String(e[`lock-downs-id`]))}`,pathParams:{"lock-downs-id":String(e[`lock-downs-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,!await r({force:!!e.force})){process.stderr.write(`Aborted.
|
|
5
|
+
`);return}l(await d(`Deleting`,async()=>t.firewall.lockdowns.delete({zone_id:n,lock_downs_id:e[`lock-downs-id`]})),{successLabel:`Deleted`})}};function O(e){return e.positional(`lock-downs-id`,{type:`string`,description:`The unique identifier of the Zone Lockdown rule.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const k={command:`get <lock-downs-id>`,describe:`Fetches the details of a Zone Lockdown rule.`,builder:O,handler:async e=>{if(e.dryRun){u({command:`cf firewall lockdowns get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/lockdowns/${e[`lock-downs-id`]==null?`<lock-downs-id>`:encodeURIComponent(String(e[`lock-downs-id`]))}`,pathParams:{"lock-downs-id":String(e[`lock-downs-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,l(await d(`Loading`,async()=>t.firewall.lockdowns.get({zone_id:n,lock_downs_id:e[`lock-downs-id`]})),{successLabel:`Loaded`})}};function A(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`description`,{type:`string`,description:`A string to search for in the description of existing rules.`}).option(`modified-on`,{type:`string`,description:`The timestamp of when the rule was last modified.`}).option(`ip`,{type:`string`,description:`A single IP address to search for in existing rules.`}).option(`priority`,{type:`number`,description:`The priority of the rule to control the processing order. A lower number indicates higher priority. If not provided, any rules with a configured priority will be processed before rules without a priority.`}).option(`uri-search`,{type:`string`,description:`A single URI to search for in the list of URLs of existing rules.`}).option(`ip-range-search`,{type:`string`,description:`A single IP address range to search for in existing rules.`}).option(`per-page`,{type:`number`,description:"The maximum number of results per page. You can only set the value to `1` or to a multiple of 5 such as `5`, `10`, `15`, or `20`."}).option(`created-on`,{type:`string`,description:`The timestamp of when the rule was created.`}).option(`description-search`,{type:`string`,description:`A string to search for in the description of existing rules.`}).option(`ip-search`,{type:`string`,description:`A single IP address to search for in existing rules.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const j={command:`list`,describe:`Fetches Zone Lockdown rules. You can filter the results using several optional parameters.`,builder:A,handler:async e=>{let t={page:e.page,description:e.description,modified_on:e[`modified-on`],ip:e.ip,priority:e.priority,uri_search:e[`uri-search`],ip_range_search:e[`ip-range-search`],per_page:e[`per-page`],created_on:e[`created-on`],description_search:e[`description-search`],ip_search:e[`ip-search`]};if(e.dryRun){u({command:`cf firewall lockdowns list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/lockdowns`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let n=await o(e),r=await i({zone:e.zone},n,{quiet:e.quiet});e.zoneId=r,l(await d(`Loading`,async()=>n.firewall.lockdowns.list({zone_id:r,...t})),{successLabel:`Loaded`})}};function M(e){return e.positional(`lock-downs-id`,{type:`string`,description:`The unique identifier of the Zone Lockdown rule.`,demandOption:!0}).option(`urls`,{type:`string`,array:!0,description:`The URLs to include in the current WAF override. You can use wildcards. Each entered URL will be escaped before use, which means you can only use simple wildcard patterns.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const N={command:`update <lock-downs-id>`,describe:`Updates an existing Zone Lockdown rule.`,builder:M,handler:async e=>{if(e.dryRun){u({command:`cf firewall lockdowns update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/lockdowns/${e[`lock-downs-id`]==null?`<lock-downs-id>`:encodeURIComponent(String(e[`lock-downs-id`]))}`,pathParams:{"lock-downs-id":String(e[`lock-downs-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({urls:e.urls}):s(e.body)});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=s(e.body);l(await d(`Updating`,async()=>t.firewall.lockdowns.update({...r,zone_id:n,lock_downs_id:e[`lock-downs-id`]})),{successLabel:`Updated`});return}if(e.urls===void 0)throw Error(`--urls is required (or pass --body with this field set).`);let r=c({urls:e.urls});l(await d(`Updating`,async()=>t.firewall.lockdowns.update({...r,zone_id:n,lock_downs_id:e[`lock-downs-id`]})),{successLabel:`Updated`})}},P={command:`lockdowns`,describe:`Zone lockdown rules that restrict access to URLs by IP address or range`,builder:e=>e.command(T).command(D).command(k).command(j).command(N).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function F(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const I={command:`bulk-delete`,describe:`Deletes existing firewall rules.`,builder:F,handler:async e=>{if(e.dryRun){u({command:`cf firewall rules bulk-delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/rules`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:s(e.body)});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,!await r({force:!!e.force})){process.stderr.write(`Aborted.
|
|
6
|
+
`);return}if(e.body){let r=s(e.body);l(await d(`Deleting`,async()=>t.firewall.rules.bulkDelete({...r,zone_id:n})),{successLabel:`Deleted`});return}l(await d(`Deleting`,async()=>t.firewall.rules.bulkDelete({zone_id:n})),{successLabel:`Deleted`})}};function L(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const R={command:`bulk-edit`,describe:`Updates the priority of existing firewall rules.`,builder:L,handler:async e=>{if(e.dryRun){u({command:`cf firewall rules bulk-edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/rules`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:s(e.body)});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=s(e.body);l(await d(`Updating`,async()=>t.firewall.rules.bulkEdit({body:r,zone_id:n})),{successLabel:`Updated`});return}l(await d(`Updating`,async()=>a(t,`PATCH`,`/zones/${e.zoneId}/firewall/rules`)),{successLabel:`Updated`})}};function z(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const B={command:`bulk-update`,describe:`Updates one or more existing firewall rules.`,builder:z,handler:async e=>{if(e.dryRun){u({command:`cf firewall rules bulk-update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/rules`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:s(e.body)});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=s(e.body);l(await d(`Updating`,async()=>t.firewall.rules.bulkUpdate({body:r,zone_id:n})),{successLabel:`Updated`});return}l(await d(`Updating`,async()=>a(t,`PUT`,`/zones/${e.zoneId}/firewall/rules`)),{successLabel:`Updated`})}};function V(e){return e.option(`filter-description`,{type:`string`,description:`An informative summary of the filter.`}).option(`filter-expression`,{type:`string`,description:`The filter expression. For more information, refer to [Expressions](https://developers.cloudflare.com/ruleset-engine/rules-language/expressions/).`}).option(`filter-paused`,{type:`boolean`,description:`When true, indicates that the filter is currently paused.`}).option(`filter-ref`,{type:`string`,description:`A short reference tag. Allows you to select related filters.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const H={command:`create`,describe:`Create one or more firewall rules.`,builder:V,handler:async e=>{if(e.dryRun){u({command:`cf firewall rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/rules`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({filter:{description:f(e[`filter-description`],`filter-description`,`text`),expression:f(e[`filter-expression`],`filter-expression`,`text`),paused:e[`filter-paused`],ref:f(e[`filter-ref`],`filter-ref`,`text`)}}):s(e.body)});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=s(e.body);l(await d(`Creating`,async()=>t.firewall.rules.create({...r,zone_id:n})),{successLabel:`Created`});return}let r=c({filter:{description:f(e[`filter-description`],`filter-description`,`text`),expression:f(e[`filter-expression`],`filter-expression`,`text`),paused:e[`filter-paused`],ref:f(e[`filter-ref`],`filter-ref`,`text`)}});l(await d(`Creating`,async()=>t.firewall.rules.create({...r,zone_id:n})),{successLabel:`Created`})}};function U(e){return e.positional(`rule-id`,{type:`string`,description:`The unique identifier of the firewall rule.`,demandOption:!0}).option(`delete-filter-if-unused`,{type:`boolean`,description:`When true, indicates that Cloudflare should also delete the associated filter if there are no other firewall rules referencing the filter.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const W={command:`delete <rule-id>`,describe:`Deletes an existing firewall rule.`,builder:U,handler:async e=>{if(e.dryRun){u({command:`cf firewall rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"rule-id":String(e[`rule-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({delete_filter_if_unused:e[`delete-filter-if-unused`]}):s(e.body)});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,!await r({force:!!e.force})){process.stderr.write(`Aborted.
|
|
7
|
+
`);return}if(e.body){let r=s(e.body);l(await d(`Deleting`,async()=>t.firewall.rules.delete({...r,zone_id:n,rule_id:e[`rule-id`]})),{successLabel:`Deleted`});return}let a=c({delete_filter_if_unused:e[`delete-filter-if-unused`]});l(await d(`Deleting`,async()=>t.firewall.rules.delete({...a,zone_id:n,rule_id:e[`rule-id`]})),{successLabel:`Deleted`})}};function G(e){return e.positional(`rule-id`,{type:`string`,description:`The unique identifier of the firewall rule.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const K={command:`edit <rule-id>`,describe:`Updates the priority of an existing firewall rule.`,builder:G,handler:async e=>{if(e.dryRun){u({command:`cf firewall rules edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"rule-id":String(e[`rule-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:s(e.body)});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=s(e.body);l(await d(`Updating`,async()=>t.firewall.rules.edit({...r,zone_id:n,rule_id:e[`rule-id`]})),{successLabel:`Updated`});return}l(await d(`Updating`,async()=>t.firewall.rules.edit({zone_id:n,rule_id:e[`rule-id`]})),{successLabel:`Updated`})}};function q(e){return e.positional(`rule-id`,{type:`string`,description:`The unique identifier of the firewall rule.`,demandOption:!0}).option(`id`,{type:`string`,description:`The unique identifier of the firewall rule.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const J={command:`get <rule-id>`,describe:`Fetches the details of a firewall rule.`,builder:q,handler:async e=>{let t={id:e.id};if(e.dryRun){u({command:`cf firewall rules get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"rule-id":String(e[`rule-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let n=await o(e),r=await i({zone:e.zone},n,{quiet:e.quiet});e.zoneId=r,l(await d(`Loading`,async()=>n.firewall.rules.get({zone_id:r,rule_id:e[`rule-id`],...t})),{successLabel:`Loaded`})}};function Y(e){return e.option(`description`,{type:`string`,description:`A case-insensitive string to find in the description.`}).option(`action`,{type:`string`,description:`The action to search for. Must be an exact match.`}).option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Number of firewall rules per page.`}).option(`id`,{type:`string`,description:`The unique identifier of the firewall rule.`}).option(`paused`,{type:`boolean`,description:`When true, indicates that the firewall rule is currently paused.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const X={command:`list`,describe:`Fetches firewall rules in a zone. You can filter the results using several optional parameters.`,builder:Y,handler:async e=>{let t={description:e.description,action:e.action,page:e.page,per_page:e[`per-page`],id:e.id,paused:e.paused};if(e.dryRun){u({command:`cf firewall rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/rules`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let n=await o(e),r=await i({zone:e.zone},n,{quiet:e.quiet});e.zoneId=r,l(await d(`Loading`,async()=>n.firewall.rules.list({zone_id:r,...t})),{successLabel:`Loaded`})}};function Z(e){return e.positional(`rule-id`,{type:`string`,description:`The unique identifier of the firewall rule.`,demandOption:!0}).option(`filter-description`,{type:`string`,description:`An informative summary of the filter.`}).option(`filter-expression`,{type:`string`,description:`The filter expression. For more information, refer to [Expressions](https://developers.cloudflare.com/ruleset-engine/rules-language/expressions/).`}).option(`filter-paused`,{type:`boolean`,description:`When true, indicates that the filter is currently paused.`}).option(`filter-ref`,{type:`string`,description:`A short reference tag. Allows you to select related filters.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Q={command:`update <rule-id>`,describe:`Updates an existing firewall rule.`,builder:Z,handler:async e=>{if(e.dryRun){u({command:`cf firewall rules update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"rule-id":String(e[`rule-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({filter:{description:f(e[`filter-description`],`filter-description`,`text`),expression:f(e[`filter-expression`],`filter-expression`,`text`),paused:e[`filter-paused`],ref:f(e[`filter-ref`],`filter-ref`,`text`)}}):s(e.body)});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=s(e.body);l(await d(`Updating`,async()=>t.firewall.rules.update({...r,zone_id:n,rule_id:e[`rule-id`]})),{successLabel:`Updated`});return}let r=c({filter:{description:f(e[`filter-description`],`filter-description`,`text`),expression:f(e[`filter-expression`],`filter-expression`,`text`),paused:e[`filter-paused`],ref:f(e[`filter-ref`],`filter-ref`,`text`)}});l(await d(`Updating`,async()=>t.firewall.rules.update({...r,zone_id:n,rule_id:e[`rule-id`]})),{successLabel:`Updated`})}},ne={command:`rules`,describe:`Legacy firewall rules with filter expressions — prefer Rulesets for new configurations`,builder:e=>e.command(I).command(R).command(B).command(H).command(W).command(K).command(J).command(X).command(Q).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function re(e){return e.option(`configuration-target`,{type:`string`,description:"The configuration target. You must set the target to `ua` when specifying a user agent in the rule.",choices:[`ua`]}).option(`configuration-value`,{type:`string`,description:`the user agent to exactly match`}).option(`description`,{type:`string`,description:`An informative summary of the rule. This value is sanitized and any tags will be removed.`}).option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).option(`paused`,{type:`boolean`,description:`When true, indicates that the rule is currently paused.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ie={command:`create`,describe:`Creates a new User Agent Blocking rule in a zone.`,builder:re,handler:async e=>{if(e.dryRun){u({command:`cf firewall ua-rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/ua_rules`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({configuration:{target:f(e[`configuration-target`],`configuration-target`,`text`),value:f(e[`configuration-value`],`configuration-value`,`text`)},description:f(e.description,`description`,`text`),mode:f(e.mode,`mode`,`text`),paused:e.paused}):s(e.body)});return}let n=await o(e),r=await i({zone:e.zone},n,{quiet:e.quiet});if(e.zoneId=r,e.body){let t=s(e.body);l(await d(`Creating`,async()=>n.firewall.uaRules.create({...t,zone_id:r})),{successLabel:`Created`});return}e.mode===void 0&&(e.mode=await t(`mode`,`The action to apply to a matched request.`,[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]));let a=c({configuration:{target:f(e[`configuration-target`],`configuration-target`,`text`),value:f(e[`configuration-value`],`configuration-value`,`text`)},description:f(e.description,`description`,`text`),mode:f(e.mode,`mode`,`text`),paused:e.paused});l(await d(`Creating`,async()=>n.firewall.uaRules.create({...a,zone_id:r})),{successLabel:`Created`})}};function ae(e){return e.positional(`ua-rule-id`,{type:`string`,description:`The unique identifier of the User Agent Blocking rule.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const oe={command:`delete <ua-rule-id>`,describe:`Deletes an existing User Agent Blocking rule.`,builder:ae,handler:async e=>{if(e.dryRun){u({command:`cf firewall ua-rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/ua_rules/${e[`ua-rule-id`]==null?`<ua-rule-id>`:encodeURIComponent(String(e[`ua-rule-id`]))}`,pathParams:{"ua-rule-id":String(e[`ua-rule-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,!await r({force:!!e.force})){process.stderr.write(`Aborted.
|
|
8
|
+
`);return}l(await d(`Deleting`,async()=>t.firewall.uaRules.delete({zone_id:n,ua_rule_id:e[`ua-rule-id`]})),{successLabel:`Deleted`})}};function se(e){return e.positional(`ua-rule-id`,{type:`string`,description:`The unique identifier of the User Agent Blocking rule.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ce={command:`get <ua-rule-id>`,describe:`Fetches the details of a User Agent Blocking rule.`,builder:se,handler:async e=>{if(e.dryRun){u({command:`cf firewall ua-rules get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/ua_rules/${e[`ua-rule-id`]==null?`<ua-rule-id>`:encodeURIComponent(String(e[`ua-rule-id`]))}`,pathParams:{"ua-rule-id":String(e[`ua-rule-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,l(await d(`Loading`,async()=>t.firewall.uaRules.get({zone_id:n,ua_rule_id:e[`ua-rule-id`]})),{successLabel:`Loaded`})}};function le(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`description`,{type:`string`,description:`A string to search for in the description of existing rules.`}).option(`per-page`,{type:`number`,description:"The maximum number of results per page. You can only set the value to `1` or to a multiple of 5 such as `5`, `10`, `15`, or `20`."}).option(`user-agent`,{type:`string`,description:`A string to search for in the user agent values of existing rules.`}).option(`paused`,{type:`boolean`,description:`When true, indicates that the rule is currently paused.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ue={command:`list`,describe:`Fetches User Agent Blocking rules in a zone. You can filter the results using several optional parameters.`,builder:le,handler:async e=>{let t={page:e.page,description:e.description,per_page:e[`per-page`],user_agent:e[`user-agent`],paused:e.paused};if(e.dryRun){u({command:`cf firewall ua-rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/ua_rules`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let n=await o(e),r=await i({zone:e.zone},n,{quiet:e.quiet});e.zoneId=r,l(await d(`Loading`,async()=>n.firewall.uaRules.list({zone_id:r,...t})),{successLabel:`Loaded`})}};function de(e){return e.positional(`ua-rule-id`,{type:`string`,description:`The unique identifier of the User Agent Blocking rule.`,demandOption:!0}).option(`configuration-target`,{type:`string`,description:"The configuration target. You must set the target to `ip` when specifying an IP address in the rule.",choices:[`ip`,`ip6`,`ip_range`,`asn`,`country`]}).option(`configuration-value`,{type:`string`,description:`The IP address to match. This address will be compared to the IP address of incoming requests.`}).option(`description`,{type:`string`,description:`An informative summary of the rule. This value is sanitized and any tags will be removed.`}).option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).option(`paused`,{type:`boolean`,description:`When true, indicates that the rule is currently paused.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const fe={command:`update <ua-rule-id>`,describe:`Updates an existing User Agent Blocking rule.`,builder:de,handler:async e=>{if(e.dryRun){u({command:`cf firewall ua-rules update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/ua_rules/${e[`ua-rule-id`]==null?`<ua-rule-id>`:encodeURIComponent(String(e[`ua-rule-id`]))}`,pathParams:{"ua-rule-id":String(e[`ua-rule-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({configuration:{target:f(e[`configuration-target`],`configuration-target`,`text`),value:f(e[`configuration-value`],`configuration-value`,`text`)},description:f(e.description,`description`,`text`),mode:f(e.mode,`mode`,`text`),paused:e.paused}):s(e.body)});return}let n=await o(e),r=await i({zone:e.zone},n,{quiet:e.quiet});if(e.zoneId=r,e.body){let t=s(e.body);l(await d(`Updating`,async()=>n.firewall.uaRules.update({...t,zone_id:r,ua_rule_id:e[`ua-rule-id`]})),{successLabel:`Updated`});return}e.mode===void 0&&(e.mode=await t(`mode`,`The action to apply to a matched request.`,[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]));let a=c({configuration:{target:f(e[`configuration-target`],`configuration-target`,`text`),value:f(e[`configuration-value`],`configuration-value`,`text`)},description:f(e.description,`description`,`text`),mode:f(e.mode,`mode`,`text`),paused:e.paused});l(await d(`Updating`,async()=>n.firewall.uaRules.update({...a,zone_id:r,ua_rule_id:e[`ua-rule-id`]})),{successLabel:`Updated`})}},pe={command:`ua-rules`,describe:`Block or challenge requests based on the User-Agent header string`,builder:e=>e.command(ie).command(oe).command(ce).command(ue).command(fe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function me(e){return e.option(`urls`,{type:`string`,array:!0,description:`The URLs to include in the current WAF override. You can use wildcards. Each entered URL will be escaped before use, which means you can only use simple wildcard patterns.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const he={command:`create`,describe:`Creates a URI-based WAF override for a zone. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:me,handler:async e=>{if(e.dryRun){u({command:`cf firewall waf overrides create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/overrides`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({urls:e.urls}):s(e.body)});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=s(e.body);l(await d(`Creating`,async()=>t.firewall.waf.overrides.create({...r,zone_id:n})),{successLabel:`Created`});return}if(e.urls===void 0)throw Error(`--urls is required (or pass --body with this field set).`);let r=c({urls:e.urls});l(await d(`Creating`,async()=>t.firewall.waf.overrides.create({...r,zone_id:n})),{successLabel:`Created`})}};function ge(e){return e.positional(`overrides-id`,{type:`string`,description:`The unique identifier of the WAF override.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const _e={command:`delete <overrides-id>`,describe:`Deletes an existing URI-based WAF override. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:ge,handler:async e=>{if(e.dryRun){u({command:`cf firewall waf overrides delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/overrides/${e[`overrides-id`]==null?`<overrides-id>`:encodeURIComponent(String(e[`overrides-id`]))}`,pathParams:{"overrides-id":String(e[`overrides-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,!await r({force:!!e.force})){process.stderr.write(`Aborted.
|
|
9
|
+
`);return}l(await d(`Deleting`,async()=>t.firewall.waf.overrides.delete({zone_id:n,overrides_id:e[`overrides-id`]})),{successLabel:`Deleted`})}};function ve(e){return e.positional(`overrides-id`,{type:`string`,description:`The unique identifier of the WAF override.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ye={command:`get <overrides-id>`,describe:`Fetches the details of a URI-based WAF override. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:ve,handler:async e=>{if(e.dryRun){u({command:`cf firewall waf overrides get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/overrides/${e[`overrides-id`]==null?`<overrides-id>`:encodeURIComponent(String(e[`overrides-id`]))}`,pathParams:{"overrides-id":String(e[`overrides-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,l(await d(`Loading`,async()=>t.firewall.waf.overrides.get({zone_id:n,overrides_id:e[`overrides-id`]})),{successLabel:`Loaded`})}};function be(e){return e.option(`page`,{type:`number`,description:`The page number of paginated results.`}).option(`per-page`,{type:`number`,description:`The number of WAF overrides per page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const xe={command:`list`,describe:`Fetches the URI-based WAF overrides in a zone. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:be,handler:async e=>{let t={page:e.page,per_page:e[`per-page`]};if(e.dryRun){u({command:`cf firewall waf overrides list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/overrides`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let n=await o(e),r=await i({zone:e.zone},n,{quiet:e.quiet});e.zoneId=r,l(await d(`Loading`,async()=>n.firewall.waf.overrides.list({zone_id:r,...t})),{successLabel:`Loaded`})}};function Se(e){return e.positional(`overrides-id`,{type:`string`,description:`The unique identifier of the WAF override.`,demandOption:!0}).option(`urls`,{type:`string`,array:!0,description:`The URLs to include in the current WAF override. You can use wildcards. Each entered URL will be escaped before use, which means you can only use simple wildcard patterns.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ce={command:`update <overrides-id>`,describe:`Updates an existing URI-based WAF override. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:Se,handler:async e=>{if(e.dryRun){u({command:`cf firewall waf overrides update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/overrides/${e[`overrides-id`]==null?`<overrides-id>`:encodeURIComponent(String(e[`overrides-id`]))}`,pathParams:{"overrides-id":String(e[`overrides-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({urls:e.urls}):s(e.body)});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=s(e.body);l(await d(`Updating`,async()=>t.firewall.waf.overrides.update({...r,zone_id:n,overrides_id:e[`overrides-id`]})),{successLabel:`Updated`});return}if(e.urls===void 0)throw Error(`--urls is required (or pass --body with this field set).`);let r=c({urls:e.urls});l(await d(`Updating`,async()=>t.firewall.waf.overrides.update({...r,zone_id:n,overrides_id:e[`overrides-id`]})),{successLabel:`Updated`})}},we={command:`overrides`,describe:`Legacy WAF managed rule packages, rule groups, individual rules, and override configurations`,builder:e=>e.command(he).command(_e).command(ye).command(xe).command(Ce).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Te(e){return e.positional(`package-id`,{type:`string`,description:`Defines a package identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ee={command:`get <package-id>`,describe:`Fetches the details of a WAF package. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:Te,handler:async e=>{if(e.dryRun){u({command:`cf firewall waf packages get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages/${e[`package-id`]==null?`<package-id>`:encodeURIComponent(String(e[`package-id`]))}`,pathParams:{"package-id":String(e[`package-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,l(await d(`Loading`,async()=>t.firewall.waf.packages.get({zone_id:n,package_id:e[`package-id`]})),{successLabel:`Loaded`})}};function De(e){return e.positional(`group-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`package-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`mode`,{type:`string`,description:"Defines the state of the rules contained in the rule group. When `on`, the rules in the group are configurable/usable.",choices:[`on`,`off`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Oe={command:`edit <group-id>`,describe:"Updates a WAF rule group. You can update the state (`mode` parameter) of a rule group. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).",builder:De,handler:async e=>{if(e.dryRun){u({command:`cf firewall waf packages groups edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages/${e[`package-id`]==null?`<package-id>`:encodeURIComponent(String(e[`package-id`]))}/groups/${e[`group-id`]==null?`<group-id>`:encodeURIComponent(String(e[`group-id`]))}`,pathParams:{"group-id":String(e[`group-id`]??``),"package-id":String(e[`package-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({mode:f(e.mode,`mode`,`text`)}):s(e.body)});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=s(e.body);l(await d(`Updating`,async()=>t.firewall.waf.packages.groups.edit({...r,zone_id:n,package_id:e[`package-id`],group_id:e[`group-id`]})),{successLabel:`Updated`});return}let r=c({mode:f(e.mode,`mode`,`text`)});l(await d(`Updating`,async()=>t.firewall.waf.packages.groups.edit({...r,zone_id:n,package_id:e[`package-id`],group_id:e[`group-id`]})),{successLabel:`Updated`})}};function ke(e){return e.positional(`group-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`package-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ae={command:`get <group-id>`,describe:`Fetches the details of a WAF rule group. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:ke,handler:async e=>{if(e.dryRun){u({command:`cf firewall waf packages groups get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages/${e[`package-id`]==null?`<package-id>`:encodeURIComponent(String(e[`package-id`]))}/groups/${e[`group-id`]==null?`<group-id>`:encodeURIComponent(String(e[`group-id`]))}`,pathParams:{"group-id":String(e[`group-id`]??``),"package-id":String(e[`package-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,l(await d(`Loading`,async()=>t.firewall.waf.packages.groups.get({zone_id:n,package_id:e[`package-id`],group_id:e[`group-id`]})),{successLabel:`Loaded`})}};function je(e){return e.option(`package-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`mode`,{type:`string`,description:"Defines the state of the rules contained in the rule group. When `on`, the rules in the group are configurable/usable.",choices:[`on`,`off`]}).option(`page`,{type:`number`,description:`Defines the page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Defines the number of rule groups per page.`}).option(`order`,{type:`string`,description:`Defines the field used to sort returned rule groups.`,choices:[`mode`,`rules_count`]}).option(`direction`,{type:`string`,description:`Defines the direction used to sort returned rule groups.`,choices:[`asc`,`desc`]}).option(`match`,{type:`string`,description:"Defines the condition for search requirements. When set to `all`, all the search requirements must match. When set to `any`, only one of the search requirements has to match.",choices:[`any`,`all`]}).option(`name`,{type:`string`,description:`Defines the name of the rule group.`}).option(`rules-count`,{type:`number`,description:`Defines the number of rules in the current rule group.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Me={command:`list`,describe:`Fetches the WAF rule groups in a WAF package. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:m(je),handler:async e=>{let t={mode:e.mode,page:e.page,per_page:e[`per-page`],order:e.order,direction:e.direction,match:e.match,name:e.name,rules_count:e[`rules-count`]};if(e.dryRun){u({command:`cf firewall waf packages groups list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages/${e[`package-id`]==null?`<package-id>`:encodeURIComponent(String(e[`package-id`]))}/groups`,pathParams:{"package-id":String(e[`package-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let n=await o(e),r=await i({zone:e.zone},n,{quiet:e.quiet});e.zoneId=r,l(await d(`Loading`,async()=>n.firewall.waf.packages.groups.list({zone_id:r,package_id:e[`package-id`],...t})),{successLabel:`Loaded`})}},Ne={command:`groups`,describe:`Legacy WAF managed rule packages, rule groups, individual rules, and override configurations`,builder:e=>e.command(Oe).command(Ae).command(Me).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Pe(e){return e.option(`page`,{type:`number`,description:`The page number of paginated results.`}).option(`per-page`,{type:`number`,description:`The number of packages per page.`}).option(`order`,{type:`string`,description:`The field used to sort returned packages.`,choices:[`name`]}).option(`direction`,{type:`string`,description:`The direction used to sort returned packages.`,choices:[`asc`,`desc`]}).option(`match`,{type:`string`,description:"When set to `all`, all the search requirements must match. When set to `any`, only one of the search requirements has to match.",choices:[`any`,`all`]}).option(`name`,{type:`string`,description:`The name of the WAF package.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Fe={command:`list`,describe:`Fetches WAF packages for a zone. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:m(Pe),handler:async e=>{let t={page:e.page,per_page:e[`per-page`],order:e.order,direction:e.direction,match:e.match,name:e.name};if(e.dryRun){u({command:`cf firewall waf packages list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let n=await o(e),r=await i({zone:e.zone},n,{quiet:e.quiet});e.zoneId=r,l(await d(`Loading`,async()=>n.firewall.waf.packages.list({zone_id:r,...t})),{successLabel:`Loaded`})}};function Ie(e){return e.positional(`rule-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`package-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`mode`,{type:`string`,description:"Defines the mode/action of the rule when triggered. You must use a value from the `allowed_modes` array of the current rule.",choices:[`default`,`disable`,`simulate`,`block`,`challenge`,`on`,`off`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Le={command:`edit <rule-id>`,describe:`Updates a WAF rule. You can only update the mode/action of the rule. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:Ie,handler:async e=>{if(e.dryRun){u({command:`cf firewall waf packages rules edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages/${e[`package-id`]==null?`<package-id>`:encodeURIComponent(String(e[`package-id`]))}/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"rule-id":String(e[`rule-id`]??``),"package-id":String(e[`package-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({mode:f(e.mode,`mode`,`text`)}):s(e.body)});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=s(e.body);l(await d(`Updating`,async()=>t.firewall.waf.packages.rules.edit({...r,zone_id:n,package_id:e[`package-id`],rule_id:e[`rule-id`]})),{successLabel:`Updated`});return}let r=c({mode:f(e.mode,`mode`,`text`)});l(await d(`Updating`,async()=>t.firewall.waf.packages.rules.edit({...r,zone_id:n,package_id:e[`package-id`],rule_id:e[`rule-id`]})),{successLabel:`Updated`})}};function Re(e){return e.positional(`rule-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`package-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ze={command:`get <rule-id>`,describe:`Fetches the details of a WAF rule in a WAF package. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:Re,handler:async e=>{if(e.dryRun){u({command:`cf firewall waf packages rules get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages/${e[`package-id`]==null?`<package-id>`:encodeURIComponent(String(e[`package-id`]))}/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"rule-id":String(e[`rule-id`]??``),"package-id":String(e[`package-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,l(await d(`Loading`,async()=>t.firewall.waf.packages.rules.get({zone_id:n,package_id:e[`package-id`],rule_id:e[`rule-id`]})),{successLabel:`Loaded`})}};function Be(e){return e.option(`package-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`mode`,{type:`string`,description:`Defines the action/mode a rule has been overridden to perform.`,choices:[`DIS`,`CHL`,`BLK`,`SIM`]}).option(`group-id`,{type:`string`,description:`Defines the unique identifier of the rule group.`}).option(`page`,{type:`number`,description:`Defines the page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Defines the number of rules per page.`}).option(`order`,{type:`string`,description:`Defines the field used to sort returned rules.`,choices:[`priority`,`group_id`,`description`]}).option(`direction`,{type:`string`,description:`Defines the direction used to sort returned rules.`,choices:[`asc`,`desc`]}).option(`match`,{type:`string`,description:"Defines the search requirements. When set to `all`, all the search requirements must match. When set to `any`, only one of the search requirements has to match.",choices:[`any`,`all`]}).option(`description`,{type:`string`,description:`Defines the public description of the WAF rule.`}).option(`priority`,{type:`string`,description:`Defines the order in which the individual WAF rule is executed within its rule group.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ve={command:`list`,describe:`Fetches WAF rules in a WAF package. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:m(Be),handler:async e=>{let t={mode:e.mode,group_id:e[`group-id`],page:e.page,per_page:e[`per-page`],order:e.order,direction:e.direction,match:e.match,description:e.description,priority:e.priority};if(e.dryRun){u({command:`cf firewall waf packages rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages/${e[`package-id`]==null?`<package-id>`:encodeURIComponent(String(e[`package-id`]))}/rules`,pathParams:{"package-id":String(e[`package-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let n=await o(e),r=await i({zone:e.zone},n,{quiet:e.quiet});e.zoneId=r,l(await d(`Loading`,async()=>n.firewall.waf.packages.rules.list({zone_id:r,package_id:e[`package-id`],...t})),{successLabel:`Loaded`})}},$={command:`rules`,describe:`Legacy WAF managed rule packages, rule groups, individual rules, and override configurations`,builder:e=>e.command(Le).command(ze).command(Ve).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},He={command:`packages`,describe:`Legacy WAF managed rule packages, rule groups, individual rules, and override configurations`,builder:e=>e.command(Ee).command(Fe).command(Ne).command($).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Ue={command:`waf`,describe:`Operations for waf`,builder:e=>e.command(we).command(He).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function We(e){return e.option(`configuration-target`,{type:`string`,description:"The configuration target. You must set the target to `ip` when specifying an IP address in the rule.",choices:[`ip`,`ip6`,`ip_range`,`asn`,`country`]}).option(`configuration-value`,{type:`string`,description:`The IP address to match. This address will be compared to the IP address of incoming requests.`}).option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ge={command:`create`,describe:`Creates a new IP Access rule for a zone. Note: To create an IP Access rule that applies to multiple zones, refer to [IP Access rules for a user](#ip-access-rules-for-a-user) or [IP Access rules for an account](#ip-access-rules-for-an-account) as appropriate.`,builder:We,handler:async e=>{if(e.dryRun){u({command:`cf firewall zone-access-rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/access_rules/rules`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({configuration:{target:f(e[`configuration-target`],`configuration-target`,`text`),value:f(e[`configuration-value`],`configuration-value`,`text`)},mode:f(e.mode,`mode`,`text`)}):s(e.body)});return}let n=await o(e),r=await i({zone:e.zone},n,{quiet:e.quiet});if(e.zoneId=r,e.body){let t=s(e.body);l(await d(`Creating`,async()=>n.firewall.zoneAccessRules.create({...t,zone_id:r})),{successLabel:`Created`});return}e.mode===void 0&&(e.mode=await t(`mode`,`The action to apply to a matched request.`,[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]));let a=c({configuration:{target:f(e[`configuration-target`],`configuration-target`,`text`),value:f(e[`configuration-value`],`configuration-value`,`text`)},mode:f(e.mode,`mode`,`text`)});l(await d(`Creating`,async()=>n.firewall.zoneAccessRules.create({...a,zone_id:r})),{successLabel:`Created`})}};function Ke(e){return e.positional(`rule-id`,{type:`string`,description:`Unique identifier for a rule.`,demandOption:!0}).option(`cascade`,{type:`string`,description:"The level to attempt to delete similar rules defined for other zones with the same owner. The default value is `none`, which will only delete the current rule. Using `basic` will delete rules that match the same action (mode) and configuration, while using `aggressive` will delete rules that match the same configuration.",choices:[`none`,`basic`,`aggressive`],default:`none`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const qe={command:`delete <rule-id>`,describe:"Deletes an IP Access rule defined at the zone level. Optionally, you can use the `cascade` property to specify that you wish to delete similar rules in other zones managed by the same zone owner.",builder:Ke,handler:async e=>{if(e.dryRun){u({command:`cf firewall zone-access-rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/access_rules/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"rule-id":String(e[`rule-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({cascade:f(e.cascade,`cascade`,`text`)}):s(e.body)});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,!await r({force:!!e.force})){process.stderr.write(`Aborted.
|
|
10
|
+
`);return}if(e.body){let r=s(e.body);l(await d(`Deleting`,async()=>t.firewall.zoneAccessRules.delete({...r,zone_id:n,rule_id:e[`rule-id`]})),{successLabel:`Deleted`});return}let a=c({cascade:f(e.cascade,`cascade`,`text`)});l(await d(`Deleting`,async()=>t.firewall.zoneAccessRules.delete({...a,zone_id:n,rule_id:e[`rule-id`]})),{successLabel:`Deleted`})}};function Je(e){return e.positional(`rule-id`,{type:`string`,description:`Unique identifier for a rule.`,demandOption:!0}).option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).option(`notes`,{type:`string`,description:`An informative summary of the rule, typically used as a reminder or explanation.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ye={command:`edit <rule-id>`,describe:"Updates an IP Access rule defined at the zone level. You can only update the rule action (`mode` parameter) and notes.",builder:Je,handler:async e=>{if(e.dryRun){u({command:`cf firewall zone-access-rules edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/access_rules/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"rule-id":String(e[`rule-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({mode:f(e.mode,`mode`,`text`),notes:f(e.notes,`notes`,`text`)}):s(e.body)});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=s(e.body);l(await d(`Updating`,async()=>t.firewall.zoneAccessRules.edit({...r,zone_id:n,rule_id:e[`rule-id`]})),{successLabel:`Updated`});return}let r=c({mode:f(e.mode,`mode`,`text`),notes:f(e.notes,`notes`,`text`)});l(await d(`Updating`,async()=>t.firewall.zoneAccessRules.edit({...r,zone_id:n,rule_id:e[`rule-id`]})),{successLabel:`Updated`})}};function Xe(e){return e.option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).option(`configuration-target`,{type:`string`,description:`The target to search in existing rules.`,choices:[`ip`,`ip_range`,`asn`,`country`]}).option(`configuration-value`,{type:`string`,description:"The target value to search for in existing rules: an IP address, an IP address range, or a country code, depending on the provided `configuration.target`.\nNotes: You can search for a single IPv4 address, an IP address range with a subnet of '/16' or '/24', or a two-letter ISO-3166-1 alpha-2 country code."}).option(`notes`,{type:`string`,description:`The string to search for in the notes of existing IP Access rules.
|
|
11
|
+
Notes: For example, the string 'attack' would match IP Access rules with notes 'Attack 26/02' and 'Attack 27/02'. The search is case insensitive.`}).option(`match`,{type:`string`,description:"When set to `all`, all the search requirements must match. When set to `any`, only one of the search requirements has to match.",choices:[`any`,`all`]}).option(`page`,{type:`number`,description:`Requested page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results requested.`}).option(`order`,{type:`string`,description:`The field used to sort returned rules.`,choices:[`configuration.target`,`configuration.value`,`mode`]}).option(`direction`,{type:`string`,description:`The direction used to sort returned rules.`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ze={command:`list`,describe:`Fetches IP Access rules of a zone. You can filter the results using several optional parameters.`,builder:m(Xe),handler:async e=>{let t={mode:e.mode,"configuration.target":e[`configuration-target`],"configuration.value":e[`configuration-value`],notes:e.notes,match:e.match,page:e.page,per_page:e[`per-page`],order:e.order,direction:e.direction};if(e.dryRun){u({command:`cf firewall zone-access-rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/access_rules/rules`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let n=await o(e),r=await i({zone:e.zone},n,{quiet:e.quiet});e.zoneId=r,l(await d(`Loading`,async()=>n.firewall.zoneAccessRules.list({zone_id:r,...t})),{successLabel:`Loaded`})}},Qe={command:`zone-access-rules`,describe:`Zone-scoped IP access rules for blocking or allowing traffic`,builder:e=>e.command(Ge).command(qe).command(Ye).command(Ze).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},$e={command:`firewall`,describe:`Legacy firewall rules, zone lockdowns, access rules, user-agent blocking, and WAF packages`,builder:e=>e.command(C).command(P).command(ne).command(pe).command(Ue).command(Qe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{$e as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{
|
|
2
|
+
import{x as e}from"./oauth-Bk-F-tIO.mjs";import{n as t}from"./auth-CSC4yhEJ.mjs";import{n,t as r}from"./body-parser-DWSy7uZ8.mjs";import{t as i}from"./output-B6fBFRqe.mjs";import{n as a,t as o}from"./progress-DrDErV9w.mjs";import{n as s}from"./input-validation-_fMCApaH.mjs";function c(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const l={command:`get`,describe:`Retrieve Fraud Detection settings for a zone.`,builder:c,handler:async n=>{if(n.dryRun){a({command:`cf fraud get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/fraud_detection/settings`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`none`});return}let r=await t(n),s=await e({zone:n.zone},r,{quiet:n.quiet});n.zoneId=s,i(await o(`Loading`,async()=>r.fraud.get({zone_id:s})),{successLabel:`Loaded`})}};function u(e){return e.option(`authentication-settings-failure-criteria-kind`,{type:`string`,description:"The type of criterion. Currently only `status_code` is supported.",choices:[`status_code`]}).option(`authentication-settings-failure-criteria-status-codes`,{type:`string`,array:!0,description:`HTTP status codes to match against the origin response.
|
|
3
3
|
- Maximum of 10 codes per criterion.
|
|
4
4
|
- Each code must be a valid HTTP status code (100-599).
|
|
5
5
|
- Codes are deduplicated and sorted on save.
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{E as e,x as t}from"./oauth-Bk-F-tIO.mjs";import{n}from"./auth-CSC4yhEJ.mjs";import{n as r,t as i}from"./body-parser-DWSy7uZ8.mjs";import{t as a}from"./output-B6fBFRqe.mjs";import{n as o,t as s}from"./progress-DrDErV9w.mjs";import{n as c}from"./input-validation-_fMCApaH.mjs";function l(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const u={command:`get`,describe:`Gets the Google Tag Gateway configuration for a zone.`,builder:l,handler:async e=>{if(e.dryRun){o({command:`cf google-tag-gateway config get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/google-tag-gateway/config`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let r=await n(e),i=await t({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,a(await s(`Loading`,async()=>r.googleTagGateway.config.get({zone_id:i})),{successLabel:`Loaded`})}};function d(e){return e.option(`enabled`,{type:`boolean`,description:`Enables or disables Google Tag Gateway for this zone.`}).option(`endpoint`,{type:`string`,description:`Specifies the endpoint path for proxying Google Tag Manager requests. Use an absolute path starting with '/', with no nested paths and alphanumeric characters only (e.g. /metrics).`}).option(`hide-original-ip`,{type:`boolean`,description:`Hides the original client IP address from Google when enabled.`}).option(`measurement-id`,{type:`string`,description:`Specify the Google Tag Manager container or measurement ID (e.g. GTM-XXXXXXX or G-XXXXXXXXXX).`}).option(`set-up-tag`,{type:`boolean`,description:`Set up the associated Google Tag on the zone automatically when enabled.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Google Tag Gateway configuration for a zone.`})}const f={command:`update`,describe:`Updates the Google Tag Gateway configuration for a zone.`,builder:d,handler:async l=>{if(l.dryRun){o({command:`cf google-tag-gateway config update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${l.zone??l.zoneId??`<zone>`}/settings/google-tag-gateway/config`,pathParams:{"zone-id":String(l.zone??l[`zone-id`]??``)},bodyKind:`json`,body:l.body===void 0?i({enabled:l.enabled,endpoint:c(l.endpoint,`endpoint`,`text`),hideOriginalIp:l[`hide-original-ip`],measurementId:c(l[`measurement-id`],`measurement-id`,`text`),setUpTag:l[`set-up-tag`]}):r(l.body)});return}let u=await n(l),d=await t({zone:l.zone},u,{quiet:l.quiet});if(l.zoneId=d,l.body){let e=r(l.body);a(await s(`Updating`,async()=>u.googleTagGateway.config.update({body:e,zone_id:d})),{successLabel:`Updated`});return}if(l.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);if(l.endpoint===void 0&&(l.endpoint=await e(`endpoint`,`Specifies the endpoint path for proxying Google Tag Manager requests. Use an absolute path starting with '/', with no nested paths and alphanumeric characters only (e.g. /metrics).`)),l[`hide-original-ip`]===void 0)throw Error(`--hide-original-ip is required (or pass --body with this field set).`);l[`measurement-id`]===void 0&&(l[`measurement-id`]=await e(`measurement-id`,`Specify the Google Tag Manager container or measurement ID (e.g. GTM-XXXXXXX or G-XXXXXXXXXX).`));let f=i({enabled:l.enabled,endpoint:c(l.endpoint,`endpoint`,`text`),hideOriginalIp:l[`hide-original-ip`],measurementId:c(l[`measurement-id`],`measurement-id`,`text`),setUpTag:l[`set-up-tag`]});a(await s(`Updating`,async()=>u.googleTagGateway.config.update({body:f,zone_id:d})),{successLabel:`Updated`})}},p={command:`config`,describe:`Operations for config`,builder:e=>e.command(u).command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},m={command:`google-tag-gateway`,describe:`Google Tag Gateway operations`,builder:e=>e.command(p).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{m as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{
|
|
3
|
-
`);return}o(await c(`Deleting`,async()=>i.healthchecks.delete({zone_id:a,healthcheck_id:e[`healthcheck-id`]})),{successLabel:`Deleted`})}};function m(e){return e.positional(`healthcheck-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`address`,{type:`string`,description:`The hostname or IP address of the origin server to run health checks on.`}).option(`check-regions`,{type:`string`,array:!0,description:`A list of regions from which to run health checks. Null means Cloudflare will pick a default region.`}).option(`consecutive-fails`,{type:`number`,description:`The number of consecutive fails required from a health check before changing the health to unhealthy.`}).option(`consecutive-successes`,{type:`number`,description:`The number of consecutive successes required from a health check before changing the health to healthy.`}).option(`description`,{type:`string`,description:`A human-readable description of the health check.`}).option(`http-config-allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when the health check uses HTTPS.`}).option(`http-config-expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy.`}).option(`http-config-expected-codes`,{type:`string`,array:!0,description:`The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check.`}).option(`http-config-follow-redirects`,{type:`boolean`,description:`Follow redirects if the origin returns a 3xx status code.`}).option(`http-config-method`,{type:`string`,description:`The HTTP method to use for the health check.`,choices:[`GET`,`HEAD`]}).option(`http-config-path`,{type:`string`,description:`The endpoint path to health check against.`}).option(`http-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS.`}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.`}).option(`name`,{type:`string`,description:`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`}).option(`suspended`,{type:`boolean`,description:`If suspended, no health checks are sent to the origin.`}).option(`tcp-config-method`,{type:`string`,description:`The TCP connection method to use for the health check.`,choices:[`connection_established`]}).option(`tcp-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80.`}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const h={command:`edit <healthcheck-id>`,describe:`Patch a configured health check.`,builder:m,handler:async n=>{if(n.dryRun){s({command:`cf healthchecks edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/healthchecks/${n[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(n[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(n[`healthcheck-id`]??``),"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`json`,body:n.body===void 0?a({address:l(n.address,`address`,`text`),check_regions:n[`check-regions`],consecutive_fails:n[`consecutive-fails`],consecutive_successes:n[`consecutive-successes`],description:l(n.description,`description`,`text`),http_config:{allow_insecure:n[`http-config-allow-insecure`],expected_body:l(n[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:n[`http-config-expected-codes`],follow_redirects:n[`http-config-follow-redirects`],method:l(n[`http-config-method`],`http-config-method`,`text`),path:l(n[`http-config-path`],`http-config-path`,`text`),port:n[`http-config-port`]},interval:n.interval,name:l(n.name,`name`,`text`),retries:n.retries,suspended:n.suspended,tcp_config:{method:l(n[`tcp-config-method`],`tcp-config-method`,`text`),port:n[`tcp-config-port`]},timeout:n.timeout,type:l(n.type,`type`,`text`)}):i(n.body)});return}let u=await r(n),d=await t({zone:n.zone},u,{quiet:n.quiet});if(n.zoneId=d,n.body){let e=i(n.body);o(await c(`Updating`,async()=>u.healthchecks.edit({body:e,zone_id:d,healthcheck_id:n[`healthcheck-id`]})),{successLabel:`Updated`});return}n.address===void 0&&(n.address=await e(`address`,`The hostname or IP address of the origin server to run health checks on.`)),n.name===void 0&&(n.name=await e(`name`,`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`));let f=a({address:l(n.address,`address`,`text`),check_regions:n[`check-regions`],consecutive_fails:n[`consecutive-fails`],consecutive_successes:n[`consecutive-successes`],description:l(n.description,`description`,`text`),http_config:{allow_insecure:n[`http-config-allow-insecure`],expected_body:l(n[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:n[`http-config-expected-codes`],follow_redirects:n[`http-config-follow-redirects`],method:l(n[`http-config-method`],`http-config-method`,`text`),path:l(n[`http-config-path`],`http-config-path`,`text`),port:n[`http-config-port`]},interval:n.interval,name:l(n.name,`name`,`text`),retries:n.retries,suspended:n.suspended,tcp_config:{method:l(n[`tcp-config-method`],`tcp-config-method`,`text`),port:n[`tcp-config-port`]},timeout:n.timeout,type:l(n.type,`type`,`text`)});o(await c(`Updating`,async()=>u.healthchecks.edit({body:f,zone_id:d,healthcheck_id:n[`healthcheck-id`]})),{successLabel:`Updated`})}};function g(e){return e.positional(`healthcheck-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _={command:`get <healthcheck-id>`,describe:`Fetch a single configured health check.`,builder:g,handler:async e=>{if(e.dryRun){s({command:`cf healthchecks get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/healthchecks/${e[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(e[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(e[`healthcheck-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let n=await r(e),i=await t({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>n.healthchecks.get({zone_id:i,healthcheck_id:e[`healthcheck-id`]})),{successLabel:`Loaded`})}};function v(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page. Must be a multiple of 5.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`list`,describe:`List configured health checks.`,builder:v,handler:async e=>{let n={page:e.page,per_page:e[`per-page`]};if(e.dryRun){s({command:`cf healthchecks list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/healthchecks`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:n,bodyKind:`none`});return}let i=await r(e),a=await t({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,o(await c(`Loading`,async()=>i.healthchecks.list({zone_id:a,...n})),{successLabel:`Loaded`})}};function b(e){return e.option(`address`,{type:`string`,description:`The hostname or IP address of the origin server to run health checks on.`}).option(`check-regions`,{type:`string`,array:!0,description:`A list of regions from which to run health checks. Null means Cloudflare will pick a default region.`}).option(`consecutive-fails`,{type:`number`,description:`The number of consecutive fails required from a health check before changing the health to unhealthy.`,default:1}).option(`consecutive-successes`,{type:`number`,description:`The number of consecutive successes required from a health check before changing the health to healthy.`,default:1}).option(`description`,{type:`string`,description:`A human-readable description of the health check.`}).option(`http-config-allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when the health check uses HTTPS.`,default:!1}).option(`http-config-expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy.`,default:``}).option(`http-config-expected-codes`,{type:`string`,array:!0,description:`The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check.`}).option(`http-config-follow-redirects`,{type:`boolean`,description:`Follow redirects if the origin returns a 3xx status code.`,default:!1}).option(`http-config-method`,{type:`string`,description:`The HTTP method to use for the health check.`,choices:[`GET`,`HEAD`],default:`GET`}).option(`http-config-path`,{type:`string`,description:`The endpoint path to health check against.`,default:`/`}).option(`http-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS.`,default:80}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.`,default:60}).option(`name`,{type:`string`,description:`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`,default:2}).option(`suspended`,{type:`boolean`,description:`If suspended, no health checks are sent to the origin.`,default:!1}).option(`tcp-config-method`,{type:`string`,description:`The TCP connection method to use for the health check.`,choices:[`connection_established`],default:`connection_established`}).option(`tcp-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80.`,default:80}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`,default:5}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'.`,default:`HTTP`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const x={command:`create`,describe:`Create a new preview health check.`,builder:b,handler:async n=>{if(n.dryRun){s({command:`cf healthchecks previews create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/healthchecks/preview`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`json`,body:n.body===void 0?a({address:l(n.address,`address`,`text`),check_regions:n[`check-regions`],consecutive_fails:n[`consecutive-fails`],consecutive_successes:n[`consecutive-successes`],description:l(n.description,`description`,`text`),http_config:{allow_insecure:n[`http-config-allow-insecure`],expected_body:l(n[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:n[`http-config-expected-codes`],follow_redirects:n[`http-config-follow-redirects`],method:l(n[`http-config-method`],`http-config-method`,`text`),path:l(n[`http-config-path`],`http-config-path`,`text`),port:n[`http-config-port`]},interval:n.interval,name:l(n.name,`name`,`text`),retries:n.retries,suspended:n.suspended,tcp_config:{method:l(n[`tcp-config-method`],`tcp-config-method`,`text`),port:n[`tcp-config-port`]},timeout:n.timeout,type:l(n.type,`type`,`text`)}):i(n.body)});return}let u=await r(n),d=await t({zone:n.zone},u,{quiet:n.quiet});if(n.zoneId=d,n.body){let e=i(n.body);o(await c(`Creating`,async()=>u.healthchecks.previews.create({body:e,zone_id:d})),{successLabel:`Created`});return}n.address===void 0&&(n.address=await e(`address`,`The hostname or IP address of the origin server to run health checks on.`)),n.name===void 0&&(n.name=await e(`name`,`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`));let f=a({address:l(n.address,`address`,`text`),check_regions:n[`check-regions`],consecutive_fails:n[`consecutive-fails`],consecutive_successes:n[`consecutive-successes`],description:l(n.description,`description`,`text`),http_config:{allow_insecure:n[`http-config-allow-insecure`],expected_body:l(n[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:n[`http-config-expected-codes`],follow_redirects:n[`http-config-follow-redirects`],method:l(n[`http-config-method`],`http-config-method`,`text`),path:l(n[`http-config-path`],`http-config-path`,`text`),port:n[`http-config-port`]},interval:n.interval,name:l(n.name,`name`,`text`),retries:n.retries,suspended:n.suspended,tcp_config:{method:l(n[`tcp-config-method`],`tcp-config-method`,`text`),port:n[`tcp-config-port`]},timeout:n.timeout,type:l(n.type,`type`,`text`)});o(await c(`Creating`,async()=>u.healthchecks.previews.create({body:f,zone_id:d})),{successLabel:`Created`})}};function S(e){return e.positional(`healthcheck-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const C={command:`delete <healthcheck-id>`,describe:`Delete a health check.`,builder:S,handler:async e=>{if(e.dryRun){s({command:`cf healthchecks previews delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/healthchecks/preview/${e[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(e[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(e[`healthcheck-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let i=await r(e),a=await t({zone:e.zone},i,{quiet:e.quiet});if(e.zoneId=a,!await n({force:!!e.force})){process.stderr.write(`Aborted.
|
|
4
|
-
`);return}o(await c(`Deleting`,async()=>i.healthchecks.previews.delete({zone_id:a,healthcheck_id:e[`healthcheck-id`]})),{successLabel:`Deleted`})}};function w(e){return e.positional(`healthcheck-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`get <healthcheck-id>`,describe:`Fetch a single configured health check preview.`,builder:w,handler:async e=>{if(e.dryRun){s({command:`cf healthchecks previews get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/healthchecks/preview/${e[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(e[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(e[`healthcheck-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let
|
|
2
|
+
import{E as e,w as t,x as n}from"./oauth-Bk-F-tIO.mjs";import{n as r}from"./auth-CSC4yhEJ.mjs";import{n as i,t as a}from"./body-parser-DWSy7uZ8.mjs";import{t as o}from"./output-B6fBFRqe.mjs";import{n as s,t as c}from"./progress-DrDErV9w.mjs";import{n as l}from"./input-validation-_fMCApaH.mjs";function u(e){return e.option(`address`,{type:`string`,description:`The hostname or IP address of the origin server to run health checks on.`}).option(`check-regions`,{type:`string`,array:!0,description:`A list of regions from which to run health checks. Null means Cloudflare will pick a default region.`}).option(`consecutive-fails`,{type:`number`,description:`The number of consecutive fails required from a health check before changing the health to unhealthy.`,default:1}).option(`consecutive-successes`,{type:`number`,description:`The number of consecutive successes required from a health check before changing the health to healthy.`,default:1}).option(`description`,{type:`string`,description:`A human-readable description of the health check.`}).option(`http-config-allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when the health check uses HTTPS.`,default:!1}).option(`http-config-expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy.`,default:``}).option(`http-config-expected-codes`,{type:`string`,array:!0,description:`The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check.`}).option(`http-config-follow-redirects`,{type:`boolean`,description:`Follow redirects if the origin returns a 3xx status code.`,default:!1}).option(`http-config-method`,{type:`string`,description:`The HTTP method to use for the health check.`,choices:[`GET`,`HEAD`],default:`GET`}).option(`http-config-path`,{type:`string`,description:`The endpoint path to health check against.`,default:`/`}).option(`http-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS.`,default:80}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.`,default:60}).option(`name`,{type:`string`,description:`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`,default:2}).option(`suspended`,{type:`boolean`,description:`If suspended, no health checks are sent to the origin.`,default:!1}).option(`tcp-config-method`,{type:`string`,description:`The TCP connection method to use for the health check.`,choices:[`connection_established`],default:`connection_established`}).option(`tcp-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80.`,default:80}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`,default:5}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'.`,default:`HTTP`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const d={command:`create`,describe:`Create a new health check.`,builder:u,handler:async t=>{if(t.dryRun){s({command:`cf healthchecks create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/healthchecks`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?a({address:l(t.address,`address`,`text`),check_regions:t[`check-regions`],consecutive_fails:t[`consecutive-fails`],consecutive_successes:t[`consecutive-successes`],description:l(t.description,`description`,`text`),http_config:{allow_insecure:t[`http-config-allow-insecure`],expected_body:l(t[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:t[`http-config-expected-codes`],follow_redirects:t[`http-config-follow-redirects`],method:l(t[`http-config-method`],`http-config-method`,`text`),path:l(t[`http-config-path`],`http-config-path`,`text`),port:t[`http-config-port`]},interval:t.interval,name:l(t.name,`name`,`text`),retries:t.retries,suspended:t.suspended,tcp_config:{method:l(t[`tcp-config-method`],`tcp-config-method`,`text`),port:t[`tcp-config-port`]},timeout:t.timeout,type:l(t.type,`type`,`text`)}):i(t.body)});return}let u=await r(t),d=await n({zone:t.zone},u,{quiet:t.quiet});if(t.zoneId=d,t.body){let e=i(t.body);o(await c(`Creating`,async()=>u.healthchecks.create({body:e,zone_id:d})),{successLabel:`Created`});return}t.address===void 0&&(t.address=await e(`address`,`The hostname or IP address of the origin server to run health checks on.`)),t.name===void 0&&(t.name=await e(`name`,`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`));let f=a({address:l(t.address,`address`,`text`),check_regions:t[`check-regions`],consecutive_fails:t[`consecutive-fails`],consecutive_successes:t[`consecutive-successes`],description:l(t.description,`description`,`text`),http_config:{allow_insecure:t[`http-config-allow-insecure`],expected_body:l(t[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:t[`http-config-expected-codes`],follow_redirects:t[`http-config-follow-redirects`],method:l(t[`http-config-method`],`http-config-method`,`text`),path:l(t[`http-config-path`],`http-config-path`,`text`),port:t[`http-config-port`]},interval:t.interval,name:l(t.name,`name`,`text`),retries:t.retries,suspended:t.suspended,tcp_config:{method:l(t[`tcp-config-method`],`tcp-config-method`,`text`),port:t[`tcp-config-port`]},timeout:t.timeout,type:l(t.type,`type`,`text`)});o(await c(`Creating`,async()=>u.healthchecks.create({body:f,zone_id:d})),{successLabel:`Created`})}};function f(e){return e.positional(`healthcheck-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const p={command:`delete <healthcheck-id>`,describe:`Delete a health check.`,builder:f,handler:async e=>{if(e.dryRun){s({command:`cf healthchecks delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/healthchecks/${e[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(e[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(e[`healthcheck-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let i=await r(e),a=await n({zone:e.zone},i,{quiet:e.quiet});if(e.zoneId=a,!await t({force:!!e.force})){process.stderr.write(`Aborted.
|
|
3
|
+
`);return}o(await c(`Deleting`,async()=>i.healthchecks.delete({zone_id:a,healthcheck_id:e[`healthcheck-id`]})),{successLabel:`Deleted`})}};function m(e){return e.positional(`healthcheck-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`address`,{type:`string`,description:`The hostname or IP address of the origin server to run health checks on.`}).option(`check-regions`,{type:`string`,array:!0,description:`A list of regions from which to run health checks. Null means Cloudflare will pick a default region.`}).option(`consecutive-fails`,{type:`number`,description:`The number of consecutive fails required from a health check before changing the health to unhealthy.`}).option(`consecutive-successes`,{type:`number`,description:`The number of consecutive successes required from a health check before changing the health to healthy.`}).option(`description`,{type:`string`,description:`A human-readable description of the health check.`}).option(`http-config-allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when the health check uses HTTPS.`}).option(`http-config-expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy.`}).option(`http-config-expected-codes`,{type:`string`,array:!0,description:`The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check.`}).option(`http-config-follow-redirects`,{type:`boolean`,description:`Follow redirects if the origin returns a 3xx status code.`}).option(`http-config-method`,{type:`string`,description:`The HTTP method to use for the health check.`,choices:[`GET`,`HEAD`]}).option(`http-config-path`,{type:`string`,description:`The endpoint path to health check against.`}).option(`http-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS.`}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.`}).option(`name`,{type:`string`,description:`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`}).option(`suspended`,{type:`boolean`,description:`If suspended, no health checks are sent to the origin.`}).option(`tcp-config-method`,{type:`string`,description:`The TCP connection method to use for the health check.`,choices:[`connection_established`]}).option(`tcp-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80.`}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const h={command:`edit <healthcheck-id>`,describe:`Patch a configured health check.`,builder:m,handler:async t=>{if(t.dryRun){s({command:`cf healthchecks edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/healthchecks/${t[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(t[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(t[`healthcheck-id`]??``),"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?a({address:l(t.address,`address`,`text`),check_regions:t[`check-regions`],consecutive_fails:t[`consecutive-fails`],consecutive_successes:t[`consecutive-successes`],description:l(t.description,`description`,`text`),http_config:{allow_insecure:t[`http-config-allow-insecure`],expected_body:l(t[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:t[`http-config-expected-codes`],follow_redirects:t[`http-config-follow-redirects`],method:l(t[`http-config-method`],`http-config-method`,`text`),path:l(t[`http-config-path`],`http-config-path`,`text`),port:t[`http-config-port`]},interval:t.interval,name:l(t.name,`name`,`text`),retries:t.retries,suspended:t.suspended,tcp_config:{method:l(t[`tcp-config-method`],`tcp-config-method`,`text`),port:t[`tcp-config-port`]},timeout:t.timeout,type:l(t.type,`type`,`text`)}):i(t.body)});return}let u=await r(t),d=await n({zone:t.zone},u,{quiet:t.quiet});if(t.zoneId=d,t.body){let e=i(t.body);o(await c(`Updating`,async()=>u.healthchecks.edit({body:e,zone_id:d,healthcheck_id:t[`healthcheck-id`]})),{successLabel:`Updated`});return}t.address===void 0&&(t.address=await e(`address`,`The hostname or IP address of the origin server to run health checks on.`)),t.name===void 0&&(t.name=await e(`name`,`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`));let f=a({address:l(t.address,`address`,`text`),check_regions:t[`check-regions`],consecutive_fails:t[`consecutive-fails`],consecutive_successes:t[`consecutive-successes`],description:l(t.description,`description`,`text`),http_config:{allow_insecure:t[`http-config-allow-insecure`],expected_body:l(t[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:t[`http-config-expected-codes`],follow_redirects:t[`http-config-follow-redirects`],method:l(t[`http-config-method`],`http-config-method`,`text`),path:l(t[`http-config-path`],`http-config-path`,`text`),port:t[`http-config-port`]},interval:t.interval,name:l(t.name,`name`,`text`),retries:t.retries,suspended:t.suspended,tcp_config:{method:l(t[`tcp-config-method`],`tcp-config-method`,`text`),port:t[`tcp-config-port`]},timeout:t.timeout,type:l(t.type,`type`,`text`)});o(await c(`Updating`,async()=>u.healthchecks.edit({body:f,zone_id:d,healthcheck_id:t[`healthcheck-id`]})),{successLabel:`Updated`})}};function g(e){return e.positional(`healthcheck-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _={command:`get <healthcheck-id>`,describe:`Fetch a single configured health check.`,builder:g,handler:async e=>{if(e.dryRun){s({command:`cf healthchecks get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/healthchecks/${e[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(e[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(e[`healthcheck-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>t.healthchecks.get({zone_id:i,healthcheck_id:e[`healthcheck-id`]})),{successLabel:`Loaded`})}};function v(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page. Must be a multiple of 5.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`list`,describe:`List configured health checks.`,builder:v,handler:async e=>{let t={page:e.page,per_page:e[`per-page`]};if(e.dryRun){s({command:`cf healthchecks list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/healthchecks`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let i=await r(e),a=await n({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,o(await c(`Loading`,async()=>i.healthchecks.list({zone_id:a,...t})),{successLabel:`Loaded`})}};function b(e){return e.option(`address`,{type:`string`,description:`The hostname or IP address of the origin server to run health checks on.`}).option(`check-regions`,{type:`string`,array:!0,description:`A list of regions from which to run health checks. Null means Cloudflare will pick a default region.`}).option(`consecutive-fails`,{type:`number`,description:`The number of consecutive fails required from a health check before changing the health to unhealthy.`,default:1}).option(`consecutive-successes`,{type:`number`,description:`The number of consecutive successes required from a health check before changing the health to healthy.`,default:1}).option(`description`,{type:`string`,description:`A human-readable description of the health check.`}).option(`http-config-allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when the health check uses HTTPS.`,default:!1}).option(`http-config-expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy.`,default:``}).option(`http-config-expected-codes`,{type:`string`,array:!0,description:`The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check.`}).option(`http-config-follow-redirects`,{type:`boolean`,description:`Follow redirects if the origin returns a 3xx status code.`,default:!1}).option(`http-config-method`,{type:`string`,description:`The HTTP method to use for the health check.`,choices:[`GET`,`HEAD`],default:`GET`}).option(`http-config-path`,{type:`string`,description:`The endpoint path to health check against.`,default:`/`}).option(`http-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS.`,default:80}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.`,default:60}).option(`name`,{type:`string`,description:`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`,default:2}).option(`suspended`,{type:`boolean`,description:`If suspended, no health checks are sent to the origin.`,default:!1}).option(`tcp-config-method`,{type:`string`,description:`The TCP connection method to use for the health check.`,choices:[`connection_established`],default:`connection_established`}).option(`tcp-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80.`,default:80}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`,default:5}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'.`,default:`HTTP`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const x={command:`create`,describe:`Create a new preview health check.`,builder:b,handler:async t=>{if(t.dryRun){s({command:`cf healthchecks previews create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/healthchecks/preview`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?a({address:l(t.address,`address`,`text`),check_regions:t[`check-regions`],consecutive_fails:t[`consecutive-fails`],consecutive_successes:t[`consecutive-successes`],description:l(t.description,`description`,`text`),http_config:{allow_insecure:t[`http-config-allow-insecure`],expected_body:l(t[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:t[`http-config-expected-codes`],follow_redirects:t[`http-config-follow-redirects`],method:l(t[`http-config-method`],`http-config-method`,`text`),path:l(t[`http-config-path`],`http-config-path`,`text`),port:t[`http-config-port`]},interval:t.interval,name:l(t.name,`name`,`text`),retries:t.retries,suspended:t.suspended,tcp_config:{method:l(t[`tcp-config-method`],`tcp-config-method`,`text`),port:t[`tcp-config-port`]},timeout:t.timeout,type:l(t.type,`type`,`text`)}):i(t.body)});return}let u=await r(t),d=await n({zone:t.zone},u,{quiet:t.quiet});if(t.zoneId=d,t.body){let e=i(t.body);o(await c(`Creating`,async()=>u.healthchecks.previews.create({body:e,zone_id:d})),{successLabel:`Created`});return}t.address===void 0&&(t.address=await e(`address`,`The hostname or IP address of the origin server to run health checks on.`)),t.name===void 0&&(t.name=await e(`name`,`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`));let f=a({address:l(t.address,`address`,`text`),check_regions:t[`check-regions`],consecutive_fails:t[`consecutive-fails`],consecutive_successes:t[`consecutive-successes`],description:l(t.description,`description`,`text`),http_config:{allow_insecure:t[`http-config-allow-insecure`],expected_body:l(t[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:t[`http-config-expected-codes`],follow_redirects:t[`http-config-follow-redirects`],method:l(t[`http-config-method`],`http-config-method`,`text`),path:l(t[`http-config-path`],`http-config-path`,`text`),port:t[`http-config-port`]},interval:t.interval,name:l(t.name,`name`,`text`),retries:t.retries,suspended:t.suspended,tcp_config:{method:l(t[`tcp-config-method`],`tcp-config-method`,`text`),port:t[`tcp-config-port`]},timeout:t.timeout,type:l(t.type,`type`,`text`)});o(await c(`Creating`,async()=>u.healthchecks.previews.create({body:f,zone_id:d})),{successLabel:`Created`})}};function S(e){return e.positional(`healthcheck-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const C={command:`delete <healthcheck-id>`,describe:`Delete a health check.`,builder:S,handler:async e=>{if(e.dryRun){s({command:`cf healthchecks previews delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/healthchecks/preview/${e[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(e[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(e[`healthcheck-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let i=await r(e),a=await n({zone:e.zone},i,{quiet:e.quiet});if(e.zoneId=a,!await t({force:!!e.force})){process.stderr.write(`Aborted.
|
|
4
|
+
`);return}o(await c(`Deleting`,async()=>i.healthchecks.previews.delete({zone_id:a,healthcheck_id:e[`healthcheck-id`]})),{successLabel:`Deleted`})}};function w(e){return e.positional(`healthcheck-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`get <healthcheck-id>`,describe:`Fetch a single configured health check preview.`,builder:w,handler:async e=>{if(e.dryRun){s({command:`cf healthchecks previews get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/healthchecks/preview/${e[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(e[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(e[`healthcheck-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>t.healthchecks.previews.get({zone_id:i,healthcheck_id:e[`healthcheck-id`]})),{successLabel:`Loaded`})}},E={command:`previews`,describe:`Test a health check configuration before deploying it to production`,builder:e=>e.command(x).command(C).command(T).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function D(e){return e.positional(`healthcheck-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`address`,{type:`string`,description:`The hostname or IP address of the origin server to run health checks on.`}).option(`check-regions`,{type:`string`,array:!0,description:`A list of regions from which to run health checks. Null means Cloudflare will pick a default region.`}).option(`consecutive-fails`,{type:`number`,description:`The number of consecutive fails required from a health check before changing the health to unhealthy.`}).option(`consecutive-successes`,{type:`number`,description:`The number of consecutive successes required from a health check before changing the health to healthy.`}).option(`description`,{type:`string`,description:`A human-readable description of the health check.`}).option(`http-config-allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when the health check uses HTTPS.`}).option(`http-config-expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy.`}).option(`http-config-expected-codes`,{type:`string`,array:!0,description:`The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check.`}).option(`http-config-follow-redirects`,{type:`boolean`,description:`Follow redirects if the origin returns a 3xx status code.`}).option(`http-config-method`,{type:`string`,description:`The HTTP method to use for the health check.`,choices:[`GET`,`HEAD`]}).option(`http-config-path`,{type:`string`,description:`The endpoint path to health check against.`}).option(`http-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS.`}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.`}).option(`name`,{type:`string`,description:`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`}).option(`suspended`,{type:`boolean`,description:`If suspended, no health checks are sent to the origin.`}).option(`tcp-config-method`,{type:`string`,description:`The TCP connection method to use for the health check.`,choices:[`connection_established`]}).option(`tcp-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80.`}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const O={command:`update <healthcheck-id>`,describe:`Update a configured health check.`,builder:D,handler:async t=>{if(t.dryRun){s({command:`cf healthchecks update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/healthchecks/${t[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(t[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(t[`healthcheck-id`]??``),"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?a({address:l(t.address,`address`,`text`),check_regions:t[`check-regions`],consecutive_fails:t[`consecutive-fails`],consecutive_successes:t[`consecutive-successes`],description:l(t.description,`description`,`text`),http_config:{allow_insecure:t[`http-config-allow-insecure`],expected_body:l(t[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:t[`http-config-expected-codes`],follow_redirects:t[`http-config-follow-redirects`],method:l(t[`http-config-method`],`http-config-method`,`text`),path:l(t[`http-config-path`],`http-config-path`,`text`),port:t[`http-config-port`]},interval:t.interval,name:l(t.name,`name`,`text`),retries:t.retries,suspended:t.suspended,tcp_config:{method:l(t[`tcp-config-method`],`tcp-config-method`,`text`),port:t[`tcp-config-port`]},timeout:t.timeout,type:l(t.type,`type`,`text`)}):i(t.body)});return}let u=await r(t),d=await n({zone:t.zone},u,{quiet:t.quiet});if(t.zoneId=d,t.body){let e=i(t.body);o(await c(`Updating`,async()=>u.healthchecks.update({body:e,zone_id:d,healthcheck_id:t[`healthcheck-id`]})),{successLabel:`Updated`});return}t.address===void 0&&(t.address=await e(`address`,`The hostname or IP address of the origin server to run health checks on.`)),t.name===void 0&&(t.name=await e(`name`,`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`));let f=a({address:l(t.address,`address`,`text`),check_regions:t[`check-regions`],consecutive_fails:t[`consecutive-fails`],consecutive_successes:t[`consecutive-successes`],description:l(t.description,`description`,`text`),http_config:{allow_insecure:t[`http-config-allow-insecure`],expected_body:l(t[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:t[`http-config-expected-codes`],follow_redirects:t[`http-config-follow-redirects`],method:l(t[`http-config-method`],`http-config-method`,`text`),path:l(t[`http-config-path`],`http-config-path`,`text`),port:t[`http-config-port`]},interval:t.interval,name:l(t.name,`name`,`text`),retries:t.retries,suspended:t.suspended,tcp_config:{method:l(t[`tcp-config-method`],`tcp-config-method`,`text`),port:t[`tcp-config-port`]},timeout:t.timeout,type:l(t.type,`type`,`text`)});o(await c(`Updating`,async()=>u.healthchecks.update({body:f,zone_id:d,healthcheck_id:t[`healthcheck-id`]})),{successLabel:`Updated`})}},k={command:`healthchecks`,describe:`Standalone health checks that monitor origin server availability from Cloudflare's edge`,builder:e=>e.command(d).command(p).command(h).command(_).command(y).command(O).command(E).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{k as default};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{w as e,x as t}from"./oauth-Bk-F-tIO.mjs";import{i as n,n as r}from"./auth-CSC4yhEJ.mjs";import{n as i}from"./body-parser-DWSy7uZ8.mjs";import{t as a}from"./output-B6fBFRqe.mjs";import{n as o,t as s}from"./progress-DrDErV9w.mjs";import{t as c}from"./cli-types-BeyOc81z.mjs";function l(e){return e.positional(`hostname`,{type:`string`,description:`The hostname for which the tls settings are set.`,demandOption:!0}).option(`setting-id`,{type:`string`,description:'The TLS Setting name.\nThe value type depends on the setting:\n- `ciphers`: value is an array of cipher suite strings (e.g., `["ECDHE-RSA-AES128-GCM-SHA256", "AES128-GCM-SHA256"]`).\n- `min_tls_version`: value is a TLS version string (`"1.0"`, `"1.1"`, `"1.2"`, or `"1.3"`).\n- `http2`: value is `"on"` or `"off"`.',demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const u={command:`get <hostname>`,describe:`Get the requested TLS setting for the hostname.`,builder:c(l),handler:async e=>{if(e.dryRun){o({command:`cf hostnames settings tls-single get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/hostnames/settings/${e[`setting-id`]==null?`<setting-id>`:encodeURIComponent(String(e[`setting-id`]))}/${e.hostname==null?`<hostname>`:encodeURIComponent(String(e.hostname))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"setting-id":String(e[`setting-id`]??``),hostname:String(e.hostname??``)},bodyKind:`none`});return}let n=await r(e),i=await t({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,a(await s(`Loading`,async()=>n.hostnames.settings.tlsSingle.get({zone_id:i,setting_id:e[`setting-id`],hostname:e.hostname})),{successLabel:`Loaded`})}},d={command:`tls-single`,describe:`Operations for settings.tls-single`,builder:e=>e.command(u).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function f(e){return e.positional(`hostname`,{type:`string`,description:`The hostname for which the tls settings are set.`,demandOption:!0}).option(`setting-id`,{type:`string`,description:'The TLS Setting name.\nThe value type depends on the setting:\n- `ciphers`: value is an array of cipher suite strings (e.g., `["ECDHE-RSA-AES128-GCM-SHA256", "AES128-GCM-SHA256"]`).\n- `min_tls_version`: value is a TLS version string (`"1.0"`, `"1.1"`, `"1.2"`, or `"1.3"`).\n- `http2`: value is `"on"` or `"off"`.',demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const p={command:`delete <hostname>`,describe:`Delete the tls setting value for the hostname.`,builder:c(f),handler:async n=>{if(n.dryRun){o({command:`cf hostnames settings tls delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/hostnames/settings/${n[`setting-id`]==null?`<setting-id>`:encodeURIComponent(String(n[`setting-id`]))}/${n.hostname==null?`<hostname>`:encodeURIComponent(String(n.hostname))}`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``),"setting-id":String(n[`setting-id`]??``),hostname:String(n.hostname??``)},bodyKind:`none`});return}let i=await r(n),c=await t({zone:n.zone},i,{quiet:n.quiet});if(n.zoneId=c,!await e({force:!!n.force})){process.stderr.write(`Aborted.
|
|
3
|
+
`);return}a(await s(`Deleting`,async()=>i.hostnames.settings.tls.delete({zone_id:c,setting_id:n[`setting-id`],hostname:n.hostname})),{successLabel:`Deleted`})}};function m(e){return e.positional(`setting-id`,{type:`string`,description:'The TLS Setting name. The value type depends on the setting: - `ciphers`: value is an array of cipher suite strings (e.g., `["ECDHE-RSA-AES128-GCM-SHA256", "AES128-GCM-SHA256"]`). - `min_tls_version`: value is a TLS version string (`"1.0"`, `"1.1"`, `"1.2"`, or `"1.3"`). - `http2`: value is `"on"` or `"off"`.',demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const h={command:`get <setting-id>`,describe:`List the requested TLS setting for the hostnames under this zone.`,builder:c(m),handler:async e=>{if(e.dryRun){o({command:`cf hostnames settings tls get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/hostnames/settings/${e[`setting-id`]==null?`<setting-id>`:encodeURIComponent(String(e[`setting-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"setting-id":String(e[`setting-id`]??``)},bodyKind:`none`});return}let n=await r(e),i=await t({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,a(await s(`Loading`,async()=>n.hostnames.settings.tls.get({zone_id:i,setting_id:e[`setting-id`]})),{successLabel:`Loaded`})}};function g(e){return e.positional(`hostname`,{type:`string`,description:`The hostname for which the tls settings are set.`,demandOption:!0}).option(`setting-id`,{type:`string`,description:'The TLS Setting name.\nThe value type depends on the setting:\n- `ciphers`: value is an array of cipher suite strings (e.g., `["ECDHE-RSA-AES128-GCM-SHA256", "AES128-GCM-SHA256"]`).\n- `min_tls_version`: value is a TLS version string (`"1.0"`, `"1.1"`, `"1.2"`, or `"1.3"`).\n- `http2`: value is `"on"` or `"off"`.',demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const _={command:`update <hostname>`,describe:`Update the tls setting value for the hostname.`,builder:c(g),handler:async e=>{if(e.dryRun){o({command:`cf hostnames settings tls update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/hostnames/settings/${e[`setting-id`]==null?`<setting-id>`:encodeURIComponent(String(e[`setting-id`]))}/${e.hostname==null?`<hostname>`:encodeURIComponent(String(e.hostname))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"setting-id":String(e[`setting-id`]??``),hostname:String(e.hostname??``)},bodyKind:`json`,body:e.body===void 0?void 0:i(e.body)});return}let c=await r(e),l=await t({zone:e.zone},c,{quiet:e.quiet});if(e.zoneId=l,e.body){let t=i(e.body);a(await s(`Updating`,async()=>c.hostnames.settings.tls.update({...t,zone_id:l,setting_id:e[`setting-id`],hostname:e.hostname})),{successLabel:`Updated`});return}a(await s(`Updating`,async()=>n(c,`PUT`,`/zones/${e.zoneId}/hostnames/settings/${encodeURIComponent(String(e[`setting-id`]))}/${encodeURIComponent(String(e.hostname))}`)),{successLabel:`Updated`})}},v={command:`tls`,describe:`Operations for settings.tls`,builder:e=>e.command(p).command(h).command(_).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},y={command:`settings`,describe:`Operations for settings`,builder:e=>e.command(v).command(d).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},b={command:`hostnames`,describe:`Per-hostname TLS settings — minimum TLS version, ciphers, and certificate pinning overrides`,builder:e=>e.command(y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{b as default};
|