cf 0.4.0 → 0.6.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.
Files changed (255) hide show
  1. package/README.md +7 -1
  2. package/dist/{abuse-reports-Dy76QPNP.mjs → abuse-reports-DUs4SKVx.mjs} +2 -2
  3. package/dist/accounts-BIY8wNGA.mjs +22 -0
  4. package/dist/{acm-C2lYIWs1.mjs → acm-SqcV8o5o.mjs} +2 -2
  5. package/dist/addressing-CygRm0pN.mjs +12 -0
  6. package/dist/{agent-context-CgGCT0xU.mjs → agent-context-CKb6w43K.mjs} +1 -1
  7. package/dist/ai-BAmEAjN3.mjs +2 -0
  8. package/dist/ai-gateway-BENwPvvB.mjs +8 -0
  9. package/dist/ai-search-Bv_Whw3E.mjs +7 -0
  10. package/dist/ai_gateway-C6WP9oBH.mjs +4 -0
  11. package/dist/alerting-D_qWrsoY.mjs +6 -0
  12. package/dist/{analytics-CkhhhZWZ.mjs → analytics-CwFrx-Dr.mjs} +1 -1
  13. package/dist/analytics_engine-BjV6XLyG.mjs +2 -0
  14. package/dist/api-gateway-D9PMVVqL.mjs +33 -0
  15. package/dist/argo-DwYGbyld.mjs +2 -0
  16. package/dist/artifacts-DKAjY_n4.mjs +4 -0
  17. package/dist/audit-logs-BvQ9uwuy.mjs +2 -0
  18. package/dist/auth-DX9KnJ0P.mjs +9 -0
  19. package/dist/auth-TYwGydWg.mjs +5 -0
  20. package/dist/billing-CRTlRU88.mjs +2 -0
  21. package/dist/{bot-management-CJxD1pqi.mjs → bot-management-DgW--8wM.mjs} +2 -2
  22. package/dist/botnet-feed-CIX6ZORT.mjs +3 -0
  23. package/dist/brand-protection-ZikBtl0y.mjs +3 -0
  24. package/dist/browser-rendering-D_ZQVWn8.mjs +4 -0
  25. package/dist/build-Bgw8TV1p.mjs +134 -0
  26. package/dist/{cache-B7pRbpTy.mjs → cache-CeN5t6_W.mjs} +4 -4
  27. package/dist/calls-Cv0ieVg4.mjs +4 -0
  28. package/dist/certificate-authorities-BzZnWCac.mjs +2 -0
  29. package/dist/client-certificates-BFuzeBrj.mjs +3 -0
  30. package/dist/cloud-connector-D5h8Dzzg.mjs +2 -0
  31. package/dist/cloudforce-one-aqDCIBMp.mjs +21 -0
  32. package/dist/{completions-D_9WsLG7.mjs → completions-Bvzav4Mj.mjs} +2 -2
  33. package/dist/{config-7CBz8Xm0.mjs → config-B5k-XbwS.mjs} +1 -1
  34. package/dist/connectivity-CjkXmEhO.mjs +3 -0
  35. package/dist/connector-interrupts-B7eSface.mjs +2 -0
  36. package/dist/connector-telemetry-events-F3Co8HUf.mjs +2 -0
  37. package/dist/connector-telemetry-snapshots-CQY8XMUg.mjs +2 -0
  38. package/dist/connectors-YYu_Vx3H.mjs +3 -0
  39. package/dist/content-scanning-BorfRGKT.mjs +4 -0
  40. package/dist/context-C-WbewL6.mjs +2 -0
  41. package/dist/{custom-certificates-CnYh6Yi-.mjs → custom-certificates-CfRj7QZb.mjs} +4 -4
  42. package/dist/{custom-hostnames-C2upqZso.mjs → custom-hostnames-CcK7_17e.mjs} +4 -4
  43. package/dist/custom-nameservers-BkKx0THn.mjs +3 -0
  44. package/dist/custom-pages-DamGVA75.mjs +4 -0
  45. package/dist/d1-sK0O5THv.mjs +4 -0
  46. package/dist/data-security-DsWpoWiS.mjs +6 -0
  47. package/dist/dcv-delegation-BYsNl3qc.mjs +2 -0
  48. package/dist/{deploy-KBRFIatG.mjs → deploy-BzlPv3ro.mjs} +1 -1
  49. package/dist/{dev-pPazzZvt.mjs → dev-IOg-_s5_.mjs} +1 -1
  50. package/dist/diagnostics-CH7T2WR3.mjs +3 -0
  51. package/dist/dispatch-namespaces-Bgj9XCRx.mjs +7 -0
  52. package/dist/dist-B7hsuvbF.mjs +57 -0
  53. package/dist/{dist-DpDjsWWn.mjs → dist-C6zxsVdY.mjs} +2 -2
  54. package/dist/dns-firewall-VmQf3UVP.mjs +57 -0
  55. package/dist/dns-o7hUPMCG.mjs +29 -0
  56. package/dist/durable-objects-DgrTbvoF.mjs +2 -0
  57. package/dist/email-routing-owCvAEpf.mjs +10 -0
  58. package/dist/email-security-Dng3DVuf.mjs +8 -0
  59. package/dist/email-sending-bExMH4lu.mjs +3 -0
  60. package/dist/filters-DKs-wEzt.mjs +4 -0
  61. package/dist/{firewall-C3DDwfwh.mjs → firewall-BLaTtX3r.mjs} +10 -10
  62. package/dist/{fraud-DY3YXFVf.mjs → fraud-D8WmLKyH.mjs} +1 -1
  63. package/dist/google-tag-gateway-DyCY43k0.mjs +2 -0
  64. package/dist/{healthchecks-Drvb79v0.mjs → healthchecks-BBtW8vRh.mjs} +3 -3
  65. package/dist/{hostnames-BdAQo1Mr.mjs → hostnames-Bh2IFxIw.mjs} +2 -2
  66. package/dist/hyperdrive-DJm1eD-M.mjs +18 -0
  67. package/dist/iam-apCCcy7R.mjs +6 -0
  68. package/dist/images-Cxe45OHm.mjs +7 -0
  69. package/dist/index.mjs +1 -1
  70. package/dist/intel-8V4h6H46.mjs +3 -0
  71. package/dist/{ips-B6JETVOY.mjs → ips-BE7JbAnc.mjs} +1 -1
  72. package/dist/{keyless-certificates-C4MZ4xnf.mjs → keyless-certificates-CfJmXccT.mjs} +2 -2
  73. package/dist/kv-Dz6then8.mjs +5 -0
  74. package/dist/leaked-credential-checks-BJ-zQMlx.mjs +3 -0
  75. package/dist/load-balancers-ilsGgudX.mjs +6 -0
  76. package/dist/logpush-BH14TtuA.mjs +4 -0
  77. package/dist/logs-B8-mkf_I.mjs +3 -0
  78. package/dist/magic-cloud-networking-DylCXoG4.mjs +5 -0
  79. package/dist/magic-network-monitoring-DnyrZy77.mjs +4 -0
  80. package/dist/magic-transit-B-kU5e3s.mjs +89 -0
  81. package/dist/managed-transforms-GC9Pq5dg.mjs +3 -0
  82. package/dist/mtls-certificates-BRlhWw_G.mjs +3 -0
  83. package/dist/network-interconnects-DuyoFD9_.mjs +36 -0
  84. package/dist/oauth-B5k80sip.mjs +61 -0
  85. package/dist/observability-9APhqFHo.mjs +4 -0
  86. package/dist/{open-YWOUIZ5Y-BpqIuBsR.mjs → open-YWOUIZ5Y-3jqSKAB1.mjs} +1 -1
  87. package/dist/{organizations-aRi1bhFC.mjs → organizations-Dy3kiV_z.mjs} +6 -6
  88. package/dist/origin-ca-certificates-2rwPoQdG.mjs +3 -0
  89. package/dist/origin-post-quantum-encryption-BnBLTvEO.mjs +2 -0
  90. package/dist/{origin-tls-client-auth-CnQNy9-l.mjs → origin-tls-client-auth-B30_2_dO.mjs} +3 -3
  91. package/dist/{output-CUxZRM5A.mjs → output-B6fBFRqe.mjs} +1 -1
  92. package/dist/{page-rules-CYqtPU1p.mjs → page-rules-zQJGmTCd.mjs} +5 -5
  93. package/dist/{page-shield-D8l9ZMUl.mjs → page-shield-CxQk5k9X.mjs} +5 -5
  94. package/dist/pages-5DKLs7CQ.mjs +11 -0
  95. package/dist/pipelines-DfGE44xo.mjs +6 -0
  96. package/dist/progress-CL8I-7YK.mjs +2 -0
  97. package/dist/prompt-q3B7sM2A.mjs +3 -0
  98. package/dist/queues-BoenUGIw.mjs +6 -0
  99. package/dist/r2-Cq_JCjK0.mjs +21 -0
  100. package/dist/r2-data-catalog-eLxltWdO.mjs +14 -0
  101. package/dist/{radar-CzGM92uM.mjs → radar-YNOCio6T.mjs} +1 -1
  102. package/dist/rate-limits-CcAF3tMl.mjs +5 -0
  103. package/dist/raw-fetch-bIXC9D1m.mjs +2 -0
  104. package/dist/realtime-kit-4bCGviO5.mjs +18 -0
  105. package/dist/{registrar-8IeA5DKd.mjs → registrar-CfHlaOOf.mjs} +6 -6
  106. package/dist/request-tracers-DlHawg5l.mjs +2 -0
  107. package/dist/resource-sharing-7FhuboJE.mjs +5 -0
  108. package/dist/resource-tagging-divcugVb.mjs +16 -0
  109. package/dist/rules-CAXkege8.mjs +4 -0
  110. package/dist/rulesets-CBsdc8IV.mjs +8 -0
  111. package/dist/rum-D0hHPNl9.mjs +4 -0
  112. package/dist/{schema-hefO-tzo.mjs → schema-D8o6HcCr.mjs} +1 -1
  113. package/dist/schema-validation-BWNDnnIT.mjs +24 -0
  114. package/dist/scim-CWLli4fi.mjs +3 -0
  115. package/dist/{session-CsvPYFj8.mjs → sdk-DhIhH6GB.mjs} +4 -4
  116. package/dist/{secrets-store-CBX0dvHL.mjs → secrets-store-B7_HkE8I.mjs} +19 -19
  117. package/dist/security-center-BQT21oiM.mjs +2 -0
  118. package/dist/security-txt-CVpmJo29.mjs +3 -0
  119. package/dist/session-B8r8LNQN.mjs +93 -0
  120. package/dist/{build-BE4o4imx.mjs → shared-DQI8NGja.mjs} +324 -388
  121. package/dist/{smart-shield-DblHIce0.mjs → smart-shield-BreBC1Ap.mjs} +2 -2
  122. package/dist/{snippets-DrpqSXYC.mjs → snippets-BAJoWMSJ.mjs} +3 -3
  123. package/dist/{spawn-DK7pott_.mjs → spawn-pmGERpdB.mjs} +1 -1
  124. package/dist/{spectrum-CnrG0jIC.mjs → spectrum-DnIRLY95.mjs} +6 -6
  125. package/dist/speed-UYEVue28.mjs +4 -0
  126. package/dist/src-BQ1dr9xR.mjs +108 -0
  127. package/dist/{ssl-Cp6tQkZH.mjs → ssl-D3Pixs8M.mjs} +3 -3
  128. package/dist/stream-BUsuOfQh.mjs +14 -0
  129. package/dist/{tenants-o_M62Y1n.mjs → tenants-BdWJTtcg.mjs} +1 -1
  130. package/dist/{token-validation-Ca5AGEns.mjs → token-validation-DUvtXWur.mjs} +5 -5
  131. package/dist/{tools-DtNNmO6l.mjs → tools-CQtA5-cr.mjs} +1 -1
  132. package/dist/turnstile-CAKVnS1L.mjs +23 -0
  133. package/dist/{ui-B97lRnOv.mjs → ui-BrNwNHX9.mjs} +1 -1
  134. package/dist/url-normalization-DA-RAxs4.mjs +3 -0
  135. package/dist/url-scanner-DmYu43f7.mjs +2 -0
  136. package/dist/user-Bah4wGGN.mjs +10 -0
  137. package/dist/vectorize-DhvVG2By.mjs +4 -0
  138. package/dist/{versions-B6E8WQyA.mjs → versions-NUXxCr0s.mjs} +1 -1
  139. package/dist/{waiting-rooms-Bhy_nuV3.mjs → waiting-rooms-DoOkT4Mu.mjs} +6 -6
  140. package/dist/web3-n3GW50u-.mjs +4 -0
  141. package/dist/workers-D6IaQ_F0.mjs +18 -0
  142. package/dist/workers-builds-DYi0OMMU.mjs +7 -0
  143. package/dist/workflows-DrdXUQ2g.mjs +4 -0
  144. package/dist/{zaraz-CyzfYOEU.mjs → zaraz-9l7KuLqh.mjs} +1 -1
  145. package/dist/zero-trust-D6V9GH2W.mjs +118 -0
  146. package/dist/zero_trust-BzXKAX_x.mjs +3 -0
  147. package/dist/{zones-MSULnDwW.mjs → zones-0MTkuaFk.mjs} +8 -8
  148. package/package.json +3 -1
  149. package/dist/accounts-CjtZ8x1z.mjs +0 -22
  150. package/dist/addressing-CHFK6uxW.mjs +0 -12
  151. package/dist/ai-DS3i-I1a.mjs +0 -2
  152. package/dist/ai-gateway-RIsegO2x.mjs +0 -8
  153. package/dist/ai-search-Dcj4BauG.mjs +0 -7
  154. package/dist/ai_gateway-w7YwfcPE.mjs +0 -4
  155. package/dist/alerting-Bk85NNf5.mjs +0 -6
  156. package/dist/analytics_engine-B7qgDJCA.mjs +0 -2
  157. package/dist/api-gateway-CWdR4Ne7.mjs +0 -33
  158. package/dist/argo-DnJRVnGX.mjs +0 -2
  159. package/dist/artifacts-BVWKiJUl.mjs +0 -4
  160. package/dist/audit-logs-DjTstbzL.mjs +0 -2
  161. package/dist/auth-BqDOIrKX.mjs +0 -150
  162. package/dist/auth-DKkSwnxh.mjs +0 -5
  163. package/dist/billing-3rEqF83h.mjs +0 -2
  164. package/dist/botnet-feed-MG91D7BR.mjs +0 -3
  165. package/dist/brand-protection-CK7gJi06.mjs +0 -3
  166. package/dist/browser-rendering-Rae0AUt0.mjs +0 -4
  167. package/dist/calls-DXRWsZ8n.mjs +0 -4
  168. package/dist/certificate-authorities-BR3gXBLs.mjs +0 -2
  169. package/dist/client-certificates-B0ebLJdk.mjs +0 -3
  170. package/dist/cloud-connector-BOjaggJk.mjs +0 -2
  171. package/dist/cloudforce-one-B6HYfk5Z.mjs +0 -21
  172. package/dist/connectivity-welFvZ7X.mjs +0 -3
  173. package/dist/connector-interrupts-DTV3F-50.mjs +0 -2
  174. package/dist/connector-telemetry-events-kDqb_AGm.mjs +0 -2
  175. package/dist/connector-telemetry-snapshots-DC-wD75E.mjs +0 -2
  176. package/dist/connectors-3vjrdFLB.mjs +0 -3
  177. package/dist/content-scanning-CnW2A0pv.mjs +0 -4
  178. package/dist/context-CONbNKO-.mjs +0 -2
  179. package/dist/custom-nameservers-BGkAD_PZ.mjs +0 -3
  180. package/dist/custom-pages-5fCSP8in.mjs +0 -4
  181. package/dist/d1-CyiRbZZn.mjs +0 -4
  182. package/dist/data-security-Casx4OS_.mjs +0 -6
  183. package/dist/dcv-delegation-DVYO10oA.mjs +0 -2
  184. package/dist/diagnostics-BqYDoDfw.mjs +0 -3
  185. package/dist/dispatch-namespaces-Cz2rajnP.mjs +0 -7
  186. package/dist/dist-DA54ZQu0.mjs +0 -82
  187. package/dist/dns-62t95Xif.mjs +0 -29
  188. package/dist/dns-firewall-Coy8d47t.mjs +0 -57
  189. package/dist/durable-objects-BSuRERkw.mjs +0 -2
  190. package/dist/email-routing-BDUYYeV3.mjs +0 -10
  191. package/dist/email-security-ChHA6eqQ.mjs +0 -8
  192. package/dist/email-sending-CVrRqn6S.mjs +0 -3
  193. package/dist/filters-qJpU9uAS.mjs +0 -4
  194. package/dist/google-tag-gateway-B00MHDfB.mjs +0 -2
  195. package/dist/hyperdrive-99OJV9nl.mjs +0 -18
  196. package/dist/iam-BRbpg3lN.mjs +0 -6
  197. package/dist/images-D1jI3r3O.mjs +0 -7
  198. package/dist/intel-C3ajLpXd.mjs +0 -3
  199. package/dist/kv-CSWoD9ks.mjs +0 -5
  200. package/dist/leaked-credential-checks-Dgs2oKm9.mjs +0 -3
  201. package/dist/load-balancers-Du1tNuUt.mjs +0 -6
  202. package/dist/logpush-SuJyO-uX.mjs +0 -4
  203. package/dist/logs-DcDNRPRl.mjs +0 -3
  204. package/dist/magic-cloud-networking-D-T0RCvi.mjs +0 -5
  205. package/dist/magic-network-monitoring-CqtvOePQ.mjs +0 -4
  206. package/dist/magic-transit-BTbkhBtF.mjs +0 -89
  207. package/dist/managed-transforms-CfUBSz9p.mjs +0 -3
  208. package/dist/mtls-certificates-Cf1O8c2E.mjs +0 -3
  209. package/dist/network-interconnects-DsiNytOU.mjs +0 -36
  210. package/dist/observability-CLqZ7OSi.mjs +0 -4
  211. package/dist/origin-ca-certificates-BB4H89a_.mjs +0 -3
  212. package/dist/origin-post-quantum-encryption-DurP3PXG.mjs +0 -2
  213. package/dist/pages-ChurJ2H7.mjs +0 -11
  214. package/dist/pipelines-CeyujvRf.mjs +0 -6
  215. package/dist/progress-Cent9Lsg.mjs +0 -2
  216. package/dist/queues-Rf_n11Cx.mjs +0 -6
  217. package/dist/r2-BtuTO3vQ.mjs +0 -21
  218. package/dist/r2-data-catalog-Debz38kv.mjs +0 -14
  219. package/dist/rate-limits-Bbk7HxP7.mjs +0 -5
  220. package/dist/raw-fetch-DnbAMFBp.mjs +0 -2
  221. package/dist/realtime-kit-CivLpkpg.mjs +0 -18
  222. package/dist/request-tracers-D1aH4NmL.mjs +0 -2
  223. package/dist/resource-sharing-B-Pcto7-.mjs +0 -5
  224. package/dist/resource-tagging-Bpb6Qq1M.mjs +0 -16
  225. package/dist/rules-B10XWY10.mjs +0 -4
  226. package/dist/rulesets-lYczEcJp.mjs +0 -8
  227. package/dist/rum-B5GUKa4I.mjs +0 -4
  228. package/dist/schema-validation-DTq517Em.mjs +0 -24
  229. package/dist/scim-BiLfOQ89.mjs +0 -3
  230. package/dist/security-center-AVpTOBK3.mjs +0 -2
  231. package/dist/security-txt-DVlh8y9l.mjs +0 -3
  232. package/dist/shared-0bwWVDLo.mjs +0 -2
  233. package/dist/speed-BzRY3Xlh.mjs +0 -4
  234. package/dist/src-D9_Gq68b.mjs +0 -108
  235. package/dist/stream-CGTRN4ZN.mjs +0 -14
  236. package/dist/turnstile-l7mo9BWL.mjs +0 -23
  237. package/dist/url-normalization-D1CogSIG.mjs +0 -3
  238. package/dist/url-scanner-BnJHJqcz.mjs +0 -2
  239. package/dist/user-CiyYZ69X.mjs +0 -10
  240. package/dist/vectorize-D3LgMLOn.mjs +0 -4
  241. package/dist/web3-DlHE0CZc.mjs +0 -4
  242. package/dist/workers-DRAkU6YR.mjs +0 -18
  243. package/dist/workers-builds-BmNjiHDZ.mjs +0 -7
  244. package/dist/workflows-z6oapEJs.mjs +0 -4
  245. package/dist/zero-trust-fyyIelWx.mjs +0 -118
  246. package/dist/zero_trust-BAhlNkjo.mjs +0 -3
  247. /package/dist/{body-parser-CBpeIUns.mjs → body-parser-DWSy7uZ8.mjs} +0 -0
  248. /package/dist/{chunk-6IEM75FG-U3L9fKgi.mjs → chunk-6IEM75FG-BEjRFMGh.mjs} +0 -0
  249. /package/dist/{cli-types-CMNMD1V7.mjs → cli-types-DGgEbf8K.mjs} +0 -0
  250. /package/dist/{input-validation-CTqtyiY9.mjs → input-validation-_fMCApaH.mjs} +0 -0
  251. /package/dist/{lib-B6xvCJjc.mjs → lib-4PQI6yRW.mjs} +0 -0
  252. /package/dist/{local-D8bhHUMK.mjs → local-CYc9q7l2.mjs} +0 -0
  253. /package/dist/{metadata-jh2EIan8.mjs → metadata-MPDDi08e.mjs} +0 -0
  254. /package/dist/{resolve-D1mG0REg.mjs → resolve-DGD57PFH.mjs} +0 -0
  255. /package/dist/{theme-CFHr0Dh9.mjs → theme-DbNbIY4d.mjs} +0 -0
@@ -0,0 +1,89 @@
1
+ #!/usr/bin/env node
2
+ import{O as e,P as t}from"./oauth-B5k80sip.mjs";import{i as n,n as r}from"./auth-DX9KnJ0P.mjs";import{n as i,r as a,t as o}from"./body-parser-DWSy7uZ8.mjs";import{t as s}from"./output-B6fBFRqe.mjs";import{n as c,t as l}from"./progress-CL8I-7YK.mjs";import{n as u}from"./input-validation-_fMCApaH.mjs";import{t as d}from"./local-CYc9q7l2.mjs";import{n as f,r as p,t as m}from"./prompt-q3B7sM2A.mjs";import{n as h,t as g}from"./raw-fetch-bIXC9D1m.mjs";function _(e){return e.option(`burst-sensitivity`,{type:`string`,description:`The burst sensitivity. Must be one of 'low', 'medium', 'high'.`}).option(`mode`,{type:`string`,description:`The mode for DNS Protection. Must be one of 'enabled', 'disabled', 'monitoring'.`}).option(`name`,{type:`string`,description:`The name of the DNS Protection rule. Value is relative to the 'scope' setting. For 'global' scope, name should be 'global'. For either the 'region' or 'datacenter' scope, name should be the actual name of the region or datacenter, e.g., 'wnam' or 'lax'.`}).option(`profile-sensitivity`,{type:`string`,description:`The profile sensitivity. Recommended setting is 'low'. Must be one of 'low', 'medium', 'high', or 'very_high'.`}).option(`rate-sensitivity`,{type:`string`,description:`The rate sensitivity. Must be one of 'low', 'medium', 'high'.`}).option(`scope`,{type:`string`,description:`The scope for the DNS Protection rule. Must be one of 'global', 'region', or 'datacenter'.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`The new DNS Protection rule to add.`})}const ee={command:`create`,describe:`Create a DNS Protection rule for an account.`,builder:_,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-dns-protection configs dns protection rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/advanced_dns_protection/configs/dns_protection/rules`,pathParams:{},bodyKind:`json`,body:n.body===void 0?o({burst_sensitivity:u(n[`burst-sensitivity`],`burst-sensitivity`,`text`),mode:u(n.mode,`mode`,`text`),name:u(n.name,`name`,`text`),profile_sensitivity:u(n[`profile-sensitivity`],`profile-sensitivity`,`text`),rate_sensitivity:u(n[`rate-sensitivity`],`rate-sensitivity`,`text`),scope:u(n.scope,`scope`,`text`)}):i(n.body)});return}let a=await r(n),f=n.local?d:await e();if(n.accountId=f,n.body){let e=i(n.body);s(await l(`Creating`,async()=>a.magicTransit.advancedDnsProtection.configs.dns.protection.rules.create({...e,account_id:f})),{successLabel:`Created`});return}n[`burst-sensitivity`]===void 0&&(n[`burst-sensitivity`]=await p(`burst-sensitivity`,`The burst sensitivity. Must be one of 'low', 'medium', 'high'.`)),n.mode===void 0&&(n.mode=await p(`mode`,`The mode for DNS Protection. Must be one of 'enabled', 'disabled', 'monitoring'.`)),n.name===void 0&&(n.name=await p(`name`,`The name of the DNS Protection rule. Value is relative to the 'scope' setting. For 'global' scope, name should be 'global'. For either the 'region' or 'datacenter' scope, name should be the actual name of the region or datacenter, e.g., 'wnam' or 'lax'.`)),n[`profile-sensitivity`]===void 0&&(n[`profile-sensitivity`]=await p(`profile-sensitivity`,`The profile sensitivity. Recommended setting is 'low'. Must be one of 'low', 'medium', 'high', or 'very_high'.`)),n[`rate-sensitivity`]===void 0&&(n[`rate-sensitivity`]=await p(`rate-sensitivity`,`The rate sensitivity. Must be one of 'low', 'medium', 'high'.`)),n.scope===void 0&&(n.scope=await p(`scope`,`The scope for the DNS Protection rule. Must be one of 'global', 'region', or 'datacenter'.`));let m=o({burst_sensitivity:u(n[`burst-sensitivity`],`burst-sensitivity`,`text`),mode:u(n.mode,`mode`,`text`),name:u(n.name,`name`,`text`),profile_sensitivity:u(n[`profile-sensitivity`],`profile-sensitivity`,`text`),rate_sensitivity:u(n[`rate-sensitivity`],`rate-sensitivity`,`text`),scope:u(n.scope,`scope`,`text`)});s(await l(`Creating`,async()=>a.magicTransit.advancedDnsProtection.configs.dns.protection.rules.create({...m,account_id:f})),{successLabel:`Created`})}};function te(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})}const v={command:`account`,describe:`Delete all DNS Protection rules for an account.`,builder:te,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-dns-protection configs dns protection rules delete for account`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/advanced_dns_protection/configs/dns_protection/rules`,pathParams:{},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();if(n.accountId=a,!await m({force:!!n.force})){process.stderr.write(`Aborted.
3
+ `);return}s(await l(`Deleting`,async()=>i.magicTransit.advancedDnsProtection.configs.dns.protection.rules.delete.for.account({account_id:a})),{successLabel:`Deleted`})}},y={command:`for`,describe:`Advanced Dns Protection operations`,builder:e=>e.command(v).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function b(e){return e.positional(`rule-id`,{type:`string`,description:`The UUID of the DNS Protection rule to delete.`,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 x={command:`rule <rule-id>`,describe:`Delete a DNS Protection rule specified by the given UUID.`,builder:b,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-dns-protection configs dns protection rules delete protection rule`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/advanced_dns_protection/configs/dns_protection/rules/${n[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(n[`rule-id`]))}`,pathParams:{"rule-id":String(n[`rule-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();if(n.accountId=a,!await m({force:!!n.force})){process.stderr.write(`Aborted.
4
+ `);return}s(await l(`Deleting`,async()=>i.magicTransit.advancedDnsProtection.configs.dns.protection.rules.delete.protection.rule({account_id:a,rule_id:n[`rule-id`]})),{successLabel:`Deleted`})}},S={command:`protection`,describe:`Advanced Dns Protection operations`,builder:e=>e.command(x).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},C={command:`delete`,describe:`Operations for advanced-dns-protection.configs.dns.protection.rules.delete`,builder:e=>e.command(y).command(S).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function w(e){return e.positional(`rule-id`,{type:`string`,description:`The UUID of the DNS Protection rule.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`get <rule-id>`,describe:`Get a DNS Protection rule specified by the given UUID.`,builder:w,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-dns-protection configs dns protection rules get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/advanced_dns_protection/configs/dns_protection/rules/${n[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(n[`rule-id`]))}`,pathParams:{"rule-id":String(n[`rule-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,s(await l(`Loading`,async()=>i.magicTransit.advancedDnsProtection.configs.dns.protection.rules.get({account_id:a,rule_id:n[`rule-id`]})),{successLabel:`Loaded`})}};function E(e){return e.option(`page`,{type:`number`,description:`The page number for pagination. Defaults to 1.`}).option(`per-page`,{type:`number`,description:`The number of items per page. Must be between 10 and 1000. Defaults to 25.`}).option(`order`,{type:`string`,description:`The field to order by. Defaults to 'prefix'.`}).option(`direction`,{type:`string`,description:`The direction of ordering (ASC or DESC). Defaults to 'ASC'.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const D={command:`list`,describe:`List all DNS Protection rules for an account.`,builder:E,handler:async n=>{let i={page:n.page,per_page:n[`per-page`],order:n.order,direction:n.direction};if(n.dryRun){c({command:`cf magic-transit advanced-dns-protection configs dns protection rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/advanced_dns_protection/configs/dns_protection/rules`,pathParams:{},query:i,bodyKind:`none`});return}let a=await r(n),o=n.local?d:await e();n.accountId=o,s(await l(`Loading`,async()=>a.magicTransit.advancedDnsProtection.configs.dns.protection.rules.list({account_id:o,...i})),{successLabel:`Loaded`})}};function O(e){return e.positional(`rule-id`,{type:`string`,description:`The UUID of the DNS Protection rule to update.`,demandOption:!0}).option(`burst-sensitivity`,{type:`string`,description:`The new burst sensitivity. Optional. Must be one of 'low', 'medium', 'high'.`}).option(`mode`,{type:`string`,description:`The new mode for DNS Protection. Optional. Must be one of 'enabled', 'disabled', 'monitoring'.`}).option(`profile-sensitivity`,{type:`string`,description:`The new profile sensitivity. Optional. Recommended setting is 'low'. Must be one of 'low', 'medium', 'high', or 'very_high'.`}).option(`rate-sensitivity`,{type:`string`,description:`The new rate sensitivity. Optional. Must be one of 'low', 'medium', 'high'.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`The updates to apply to the DNS Protection rule.`})}const k={command:`update <rule-id>`,describe:`Update a DNS Protection rule specified by the given UUID.`,builder:O,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-dns-protection configs dns protection rules update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/advanced_dns_protection/configs/dns_protection/rules/${n[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(n[`rule-id`]))}`,pathParams:{"rule-id":String(n[`rule-id`]??``)},bodyKind:`json`,body:n.body===void 0?o({burst_sensitivity:u(n[`burst-sensitivity`],`burst-sensitivity`,`text`),mode:u(n.mode,`mode`,`text`),profile_sensitivity:u(n[`profile-sensitivity`],`profile-sensitivity`,`text`),rate_sensitivity:u(n[`rate-sensitivity`],`rate-sensitivity`,`text`)}):i(n.body)});return}let a=await r(n),f=n.local?d:await e();if(n.accountId=f,n.body){let e=i(n.body);s(await l(`Updating`,async()=>a.magicTransit.advancedDnsProtection.configs.dns.protection.rules.update({...e,account_id:f,rule_id:n[`rule-id`]})),{successLabel:`Updated`});return}let p=o({burst_sensitivity:u(n[`burst-sensitivity`],`burst-sensitivity`,`text`),mode:u(n.mode,`mode`,`text`),profile_sensitivity:u(n[`profile-sensitivity`],`profile-sensitivity`,`text`),rate_sensitivity:u(n[`rate-sensitivity`],`rate-sensitivity`,`text`)});s(await l(`Updating`,async()=>a.magicTransit.advancedDnsProtection.configs.dns.protection.rules.update({...p,account_id:f,rule_id:n[`rule-id`]})),{successLabel:`Updated`})}},A={command:`rules`,describe:`Advanced Dns Protection operations`,builder:e=>e.command(ee).command(T).command(D).command(k).command(C).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},j={command:`protection`,describe:`Operations for advanced-dns-protection.configs.dns.protection`,builder:e=>e.command(A).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},M={command:`dns`,describe:`Operations for advanced-dns-protection.configs.dns`,builder:e=>e.command(j).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},N={command:`configs`,describe:`Operations for advanced-dns-protection.configs`,builder:e=>e.command(M).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},P={command:`advanced-dns-protection`,describe:`Operations for advanced-dns-protection`,builder:e=>e.command(N).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function F(e){return e.option(`comment`,{type:`string`,description:`An comment describing the allowlist prefix.`}).option(`enabled`,{type:`boolean`,description:`Whether to enable the allowlist prefix into effect.`}).option(`prefix`,{type:`string`,description:`The allowlist prefix to add in CIDR format.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`The new allowlist prefix to create.`})}const I={command:`create`,describe:`Create an allowlist prefix for an account.`,builder:F,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs allowlist create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/advanced_tcp_protection/configs/allowlist`,pathParams:{},bodyKind:`json`,body:n.body===void 0?o({comment:u(n.comment,`comment`,`text`),enabled:n.enabled,prefix:u(n.prefix,`prefix`,`text`)}):i(n.body)});return}let a=await r(n),f=n.local?d:await e();if(n.accountId=f,n.body){let e=i(n.body);s(await l(`Creating`,async()=>a.magicTransit.advancedTcpProtection.configs.allowlist.create({...e,account_id:f})),{successLabel:`Created`});return}if(n.comment===void 0&&(n.comment=await p(`comment`,`An comment describing the allowlist prefix.`)),n.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);n.prefix===void 0&&(n.prefix=await p(`prefix`,`The allowlist prefix to add in CIDR format.`));let m=o({comment:u(n.comment,`comment`,`text`),enabled:n.enabled,prefix:u(n.prefix,`prefix`,`text`)});s(await l(`Creating`,async()=>a.magicTransit.advancedTcpProtection.configs.allowlist.create({...m,account_id:f})),{successLabel:`Created`})}};function L(e){return e.positional(`prefix-id`,{type:`string`,description:`The UUID of the allowlist prefix to delete.`,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 R={command:`prefix <prefix-id>`,describe:`Delete the allowlist prefix for an account given a UUID.`,builder:L,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs allowlist delete allowlist prefix`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/advanced_tcp_protection/configs/allowlist/${n[`prefix-id`]==null?`<prefix-id>`:encodeURIComponent(String(n[`prefix-id`]))}`,pathParams:{"prefix-id":String(n[`prefix-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();if(n.accountId=a,!await m({force:!!n.force})){process.stderr.write(`Aborted.
5
+ `);return}s(await l(`Deleting`,async()=>i.magicTransit.advancedTcpProtection.configs.allowlist.delete.allowlist.prefix({account_id:a,prefix_id:n[`prefix-id`]})),{successLabel:`Deleted`})}},z={command:`allowlist`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(R).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function B(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})}const V={command:`account`,describe:`Delete all allowlist prefixes for an account.`,builder:B,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs allowlist delete for account`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/advanced_tcp_protection/configs/allowlist`,pathParams:{},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();if(n.accountId=a,!await m({force:!!n.force})){process.stderr.write(`Aborted.
6
+ `);return}s(await l(`Deleting`,async()=>i.magicTransit.advancedTcpProtection.configs.allowlist.delete.for.account({account_id:a})),{successLabel:`Deleted`})}},H={command:`for`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(V).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},U={command:`delete`,describe:`Operations for advanced-tcp-protection.configs.allowlist.delete`,builder:e=>e.command(z).command(H).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function W(e){return e.positional(`prefix-id`,{type:`string`,description:`The UUID of the allowlist prefix.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const G={command:`get <prefix-id>`,describe:`Get an allowlist prefix specified by the given UUID.`,builder:W,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs allowlist get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/advanced_tcp_protection/configs/allowlist/${n[`prefix-id`]==null?`<prefix-id>`:encodeURIComponent(String(n[`prefix-id`]))}`,pathParams:{"prefix-id":String(n[`prefix-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,s(await l(`Loading`,async()=>i.magicTransit.advancedTcpProtection.configs.allowlist.get({account_id:a,prefix_id:n[`prefix-id`]})),{successLabel:`Loaded`})}};function K(e){return e.option(`page`,{type:`number`,description:`The page number for pagination. Defaults to 1.`}).option(`per-page`,{type:`number`,description:`The number of items per page. Must be between 10 and 1000. Defaults to 25.`}).option(`order`,{type:`string`,description:`The field to order by. Defaults to 'prefix'.`}).option(`direction`,{type:`string`,description:`The direction of ordering (ASC or DESC). Defaults to 'ASC'.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const q={command:`list`,describe:`List all allowlist prefixes for an account.`,builder:K,handler:async n=>{let i={page:n.page,per_page:n[`per-page`],order:n.order,direction:n.direction};if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs allowlist list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/advanced_tcp_protection/configs/allowlist`,pathParams:{},query:i,bodyKind:`none`});return}let a=await r(n),o=n.local?d:await e();n.accountId=o,s(await l(`Loading`,async()=>a.magicTransit.advancedTcpProtection.configs.allowlist.list({account_id:o,...i})),{successLabel:`Loaded`})}};function J(e){return e.positional(`prefix-id`,{type:`string`,description:`The UUID of the allowlist prefix to update.`,demandOption:!0}).option(`comment`,{type:`string`,description:`A comment describing the allowlist prefix. Optional.`}).option(`enabled`,{type:`boolean`,description:`Whether to enable the allowlist prefix into effect. Optional.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`The updates to apply to the allowlist prefix.`})}const Y={command:`update <prefix-id>`,describe:`Update an allowlist prefix specified by the given UUID.`,builder:J,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs allowlist update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/advanced_tcp_protection/configs/allowlist/${n[`prefix-id`]==null?`<prefix-id>`:encodeURIComponent(String(n[`prefix-id`]))}`,pathParams:{"prefix-id":String(n[`prefix-id`]??``)},bodyKind:`json`,body:n.body===void 0?o({comment:u(n.comment,`comment`,`text`),enabled:n.enabled}):i(n.body)});return}let a=await r(n),f=n.local?d:await e();if(n.accountId=f,n.body){let e=i(n.body);s(await l(`Updating`,async()=>a.magicTransit.advancedTcpProtection.configs.allowlist.update({...e,account_id:f,prefix_id:n[`prefix-id`]})),{successLabel:`Updated`});return}let p=o({comment:u(n.comment,`comment`,`text`),enabled:n.enabled});s(await l(`Updating`,async()=>a.magicTransit.advancedTcpProtection.configs.allowlist.update({...p,account_id:f,prefix_id:n[`prefix-id`]})),{successLabel:`Updated`})}},X={command:`allowlist`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(I).command(G).command(q).command(Y).command(U).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};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:`The list of new prefixes to create.`})}const Q={command:`create`,describe:`Create multiple prefixes for an account.`,builder:Z,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs prefixes bulk create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/advanced_tcp_protection/configs/prefixes/bulk`,pathParams:{},bodyKind:`json`,body:n.body===void 0?void 0:i(n.body)});return}let a=await r(n),o=n.local?d:await e();if(n.accountId=o,n.body){let e=i(n.body);s(await l(`Creating`,async()=>a.magicTransit.advancedTcpProtection.configs.prefixes.bulk.create({body:e,account_id:o})),{successLabel:`Created`});return}if(n.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},ne={command:`bulk`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(Q).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function re(e){return e.option(`comment`,{type:`string`,description:`A comment describing the prefix.`}).option(`excluded`,{type:`boolean`,description:`Whether to exclude the prefix from protection.`}).option(`prefix`,{type:`string`,description:`The prefix to add in CIDR format.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`The new prefix to create.`})}const ie={command:`create`,describe:`Create a prefix for an account.`,builder:re,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs prefixes create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/advanced_tcp_protection/configs/prefixes`,pathParams:{},bodyKind:`json`,body:n.body===void 0?o({comment:u(n.comment,`comment`,`text`),excluded:n.excluded,prefix:u(n.prefix,`prefix`,`text`)}):i(n.body)});return}let a=await r(n),f=n.local?d:await e();if(n.accountId=f,n.body){let e=i(n.body);s(await l(`Creating`,async()=>a.magicTransit.advancedTcpProtection.configs.prefixes.create({body:e,account_id:f})),{successLabel:`Created`});return}if(n.comment===void 0&&(n.comment=await p(`comment`,`A comment describing the prefix.`)),n.excluded===void 0)throw Error(`--excluded is required (or pass --body with this field set).`);n.prefix===void 0&&(n.prefix=await p(`prefix`,`The prefix to add in CIDR format.`));let m=o({comment:u(n.comment,`comment`,`text`),excluded:n.excluded,prefix:u(n.prefix,`prefix`,`text`)});s(await l(`Creating`,async()=>a.magicTransit.advancedTcpProtection.configs.prefixes.create({body:m,account_id:f})),{successLabel:`Created`})}};function ae(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})}const oe={command:`account`,describe:`Delete all prefixes for an account.`,builder:ae,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs prefixes delete for account`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/advanced_tcp_protection/configs/prefixes`,pathParams:{},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();if(n.accountId=a,!await m({force:!!n.force})){process.stderr.write(`Aborted.
7
+ `);return}s(await l(`Deleting`,async()=>i.magicTransit.advancedTcpProtection.configs.prefixes.delete.for.account({account_id:a})),{successLabel:`Deleted`})}},se={command:`for`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(oe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ce(e){return e.positional(`prefix-id`,{type:`string`,description:`The UUID of the prefix to delete.`,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 le={command:`prefix <prefix-id>`,describe:`Delete the prefix for an account given a UUID.`,builder:ce,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs prefixes delete prefix`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/advanced_tcp_protection/configs/prefixes/${n[`prefix-id`]==null?`<prefix-id>`:encodeURIComponent(String(n[`prefix-id`]))}`,pathParams:{"prefix-id":String(n[`prefix-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();if(n.accountId=a,!await m({force:!!n.force})){process.stderr.write(`Aborted.
8
+ `);return}s(await l(`Deleting`,async()=>i.magicTransit.advancedTcpProtection.configs.prefixes.delete.prefix({account_id:a,prefix_id:n[`prefix-id`]})),{successLabel:`Deleted`})}},ue={command:`delete`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(le).command(se).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function de(e){return e.positional(`prefix-id`,{type:`string`,description:`The UUID of the prefix.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const fe={command:`get <prefix-id>`,describe:`Get a prefix specified by the given UUID.`,builder:de,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs prefixes get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/advanced_tcp_protection/configs/prefixes/${n[`prefix-id`]==null?`<prefix-id>`:encodeURIComponent(String(n[`prefix-id`]))}`,pathParams:{"prefix-id":String(n[`prefix-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,s(await l(`Loading`,async()=>i.magicTransit.advancedTcpProtection.configs.prefixes.get({account_id:a,prefix_id:n[`prefix-id`]})),{successLabel:`Loaded`})}};function pe(e){return e.option(`page`,{type:`number`,description:`The page number for pagination. Defaults to 1.`}).option(`per-page`,{type:`number`,description:`The number of items per page. Must be between 10 and 1000. Defaults to 25.`}).option(`order`,{type:`string`,description:`The field to order by. Defaults to 'prefix'.`}).option(`direction`,{type:`string`,description:`The direction of ordering (ASC or DESC). Defaults to 'ASC'.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const me={command:`list`,describe:`List all prefixes for an account.`,builder:pe,handler:async n=>{let i={page:n.page,per_page:n[`per-page`],order:n.order,direction:n.direction};if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs prefixes list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/advanced_tcp_protection/configs/prefixes`,pathParams:{},query:i,bodyKind:`none`});return}let a=await r(n),o=n.local?d:await e();n.accountId=o,s(await l(`Loading`,async()=>a.magicTransit.advancedTcpProtection.configs.prefixes.list({account_id:o,...i})),{successLabel:`Loaded`})}};function he(e){return e.positional(`prefix-id`,{type:`string`,description:`The UUID of the prefix to update.`,demandOption:!0}).option(`comment`,{type:`string`,description:`A new comment for the prefix. Optional.`}).option(`excluded`,{type:`boolean`,description:`Whether to exclude the prefix from protection. Optional.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`The updates to apply to the prefix.`})}const ge={command:`update <prefix-id>`,describe:`Update a prefix specified by the given UUID.`,builder:he,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs prefixes update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/advanced_tcp_protection/configs/prefixes/${n[`prefix-id`]==null?`<prefix-id>`:encodeURIComponent(String(n[`prefix-id`]))}`,pathParams:{"prefix-id":String(n[`prefix-id`]??``)},bodyKind:`json`,body:n.body===void 0?o({comment:u(n.comment,`comment`,`text`),excluded:n.excluded}):i(n.body)});return}let a=await r(n),f=n.local?d:await e();if(n.accountId=f,n.body){let e=i(n.body);s(await l(`Updating`,async()=>a.magicTransit.advancedTcpProtection.configs.prefixes.update({...e,account_id:f,prefix_id:n[`prefix-id`]})),{successLabel:`Updated`});return}let p=o({comment:u(n.comment,`comment`,`text`),excluded:n.excluded});s(await l(`Updating`,async()=>a.magicTransit.advancedTcpProtection.configs.prefixes.update({...p,account_id:f,prefix_id:n[`prefix-id`]})),{successLabel:`Updated`})}},_e={command:`prefixes`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(ie).command(fe).command(me).command(ge).command(ne).command(ue).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ve(e){return e.option(`expression`,{type:`string`,description:`The filter expression.`}).option(`mode`,{type:`string`,description:`The filter's mode. Must be one of 'enabled', 'disabled', 'monitoring'.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`The new filter to create.`})}const ye={command:`create`,describe:`Create a SYN Protection filter for an account.`,builder:ve,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs syn protection filters create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/filters`,pathParams:{},bodyKind:`json`,body:n.body===void 0?o({expression:u(n.expression,`expression`,`text`),mode:u(n.mode,`mode`,`text`)}):i(n.body)});return}let a=await r(n),f=n.local?d:await e();if(n.accountId=f,n.body){let e=i(n.body);s(await l(`Creating`,async()=>a.magicTransit.advancedTcpProtection.configs.syn.protection.filters.create({body:e,account_id:f})),{successLabel:`Created`});return}n.expression===void 0&&(n.expression=await p(`expression`,`The filter expression.`)),n.mode===void 0&&(n.mode=await p(`mode`,`The filter's mode. Must be one of 'enabled', 'disabled', 'monitoring'.`));let m=o({expression:u(n.expression,`expression`,`text`),mode:u(n.mode,`mode`,`text`)});s(await l(`Creating`,async()=>a.magicTransit.advancedTcpProtection.configs.syn.protection.filters.create({body:m,account_id:f})),{successLabel:`Created`})}};function be(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})}const xe={command:`account`,describe:`Delete all SYN Protection filters for an account.`,builder:be,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs syn protection filters delete for account`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/filters`,pathParams:{},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();if(n.accountId=a,!await m({force:!!n.force})){process.stderr.write(`Aborted.
9
+ `);return}s(await l(`Deleting`,async()=>i.magicTransit.advancedTcpProtection.configs.syn.protection.filters.delete.for.account({account_id:a})),{successLabel:`Deleted`})}},Se={command:`for`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(xe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ce(e){return e.positional(`filter-id`,{type:`string`,description:`The UUID of the filter to delete.`,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 we={command:`filter <filter-id>`,describe:`Delete a SYN Protection filter specified by the given UUID.`,builder:Ce,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs syn protection filters delete protection filter`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/filters/${n[`filter-id`]==null?`<filter-id>`:encodeURIComponent(String(n[`filter-id`]))}`,pathParams:{"filter-id":String(n[`filter-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();if(n.accountId=a,!await m({force:!!n.force})){process.stderr.write(`Aborted.
10
+ `);return}s(await l(`Deleting`,async()=>i.magicTransit.advancedTcpProtection.configs.syn.protection.filters.delete.protection.filter({account_id:a,filter_id:n[`filter-id`]})),{successLabel:`Deleted`})}},Te={command:`protection`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(we).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Ee={command:`delete`,describe:`Operations for advanced-tcp-protection.configs.syn.protection.filters.delete`,builder:e=>e.command(Se).command(Te).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function De(e){return e.positional(`filter-id`,{type:`string`,description:`The UUID of the filter to retrieve.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Oe={command:`get <filter-id>`,describe:`Get a SYN Protection filter specified by the given UUID.`,builder:De,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs syn protection filters get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/filters/${n[`filter-id`]==null?`<filter-id>`:encodeURIComponent(String(n[`filter-id`]))}`,pathParams:{"filter-id":String(n[`filter-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,s(await l(`Loading`,async()=>i.magicTransit.advancedTcpProtection.configs.syn.protection.filters.get({account_id:a,filter_id:n[`filter-id`]})),{successLabel:`Loaded`})}};function ke(e){return e.option(`mode`,{type:`string`,description:`The mode of the filters to get. Optional. Valid values: 'enabled', 'disabled', 'monitoring'.`}).option(`page`,{type:`number`,description:`The page number for pagination. Defaults to 1.`}).option(`per-page`,{type:`number`,description:`The number of items per page. Must be between 10 and 1000. Defaults to 25.`}).option(`order`,{type:`string`,description:`The field to order by. Defaults to 'prefix'.`}).option(`direction`,{type:`string`,description:`The direction of ordering (ASC or DESC). Defaults to 'ASC'.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ae={command:`list`,describe:`List all SYN Protection filters for an account.`,builder:ke,handler:async n=>{let i={mode:n.mode,page:n.page,per_page:n[`per-page`],order:n.order,direction:n.direction};if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs syn protection filters list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/filters`,pathParams:{},query:i,bodyKind:`none`});return}let a=await r(n),o=n.local?d:await e();n.accountId=o,s(await l(`Loading`,async()=>a.magicTransit.advancedTcpProtection.configs.syn.protection.filters.list({account_id:o,...i})),{successLabel:`Loaded`})}};function je(e){return e.positional(`filter-id`,{type:`string`,description:`The UUID of the filter to update.`,demandOption:!0}).option(`expression`,{type:`string`,description:`The new filter expression. Optional.`}).option(`mode`,{type:`string`,description:`The new mode for the filter. Optional. Must be one of 'enabled', 'disabled', 'monitoring'.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`The updates to apply to the filter.`})}const Me={command:`update <filter-id>`,describe:`Update a SYN Protection filter specified by the given UUID.`,builder:je,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs syn protection filters update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/filters/${n[`filter-id`]==null?`<filter-id>`:encodeURIComponent(String(n[`filter-id`]))}`,pathParams:{"filter-id":String(n[`filter-id`]??``)},bodyKind:`json`,body:n.body===void 0?o({expression:u(n.expression,`expression`,`text`),mode:u(n.mode,`mode`,`text`)}):i(n.body)});return}let a=await r(n),f=n.local?d:await e();if(n.accountId=f,n.body){let e=i(n.body);s(await l(`Updating`,async()=>a.magicTransit.advancedTcpProtection.configs.syn.protection.filters.update({body:e,account_id:f,filter_id:n[`filter-id`]})),{successLabel:`Updated`});return}let p=o({expression:u(n.expression,`expression`,`text`),mode:u(n.mode,`mode`,`text`)});s(await l(`Updating`,async()=>a.magicTransit.advancedTcpProtection.configs.syn.protection.filters.update({body:p,account_id:f,filter_id:n[`filter-id`]})),{successLabel:`Updated`})}},Ne={command:`filters`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(ye).command(Oe).command(Ae).command(Me).command(Ee).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Pe(e){return e.option(`burst-sensitivity`,{type:`string`,description:`The burst sensitivity. Must be one of 'low', 'medium', 'high'.`}).option(`mitigation-type`,{type:`string`,description:`The type of mitigation. Must be one of 'challenge' or 'retransmit'. Optional. Defaults to 'challenge'.`}).option(`mode`,{type:`string`,description:`The mode for SYN Protection. Must be one of 'enabled', 'disabled', 'monitoring'.`}).option(`name`,{type:`string`,description:`The name of the SYN Protection rule. Value is relative to the 'scope' setting. For 'global' scope, name should be 'global'. For either the 'region' or 'datacenter' scope, name should be the actual name of the region or datacenter, e.g., 'wnam' or 'lax'.`}).option(`rate-sensitivity`,{type:`string`,description:`The rate sensitivity. Must be one of 'low', 'medium', 'high'.`}).option(`scope`,{type:`string`,description:`The scope for the SYN Protection rule. Must be one of 'global', 'region', or 'datacenter'.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`The new SYN Protection rule to add.`})}const Fe={command:`create`,describe:`Create a SYN Protection rule for an account.`,builder:Pe,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs syn protection rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/rules`,pathParams:{},bodyKind:`json`,body:n.body===void 0?o({burst_sensitivity:u(n[`burst-sensitivity`],`burst-sensitivity`,`text`),mitigation_type:u(n[`mitigation-type`],`mitigation-type`,`text`),mode:u(n.mode,`mode`,`text`),name:u(n.name,`name`,`text`),rate_sensitivity:u(n[`rate-sensitivity`],`rate-sensitivity`,`text`),scope:u(n.scope,`scope`,`text`)}):i(n.body)});return}let a=await r(n),f=n.local?d:await e();if(n.accountId=f,n.body){let e=i(n.body);s(await l(`Creating`,async()=>a.magicTransit.advancedTcpProtection.configs.syn.protection.rules.create({...e,account_id:f})),{successLabel:`Created`});return}n[`burst-sensitivity`]===void 0&&(n[`burst-sensitivity`]=await p(`burst-sensitivity`,`The burst sensitivity. Must be one of 'low', 'medium', 'high'.`)),n.mode===void 0&&(n.mode=await p(`mode`,`The mode for SYN Protection. Must be one of 'enabled', 'disabled', 'monitoring'.`)),n.name===void 0&&(n.name=await p(`name`,`The name of the SYN Protection rule. Value is relative to the 'scope' setting. For 'global' scope, name should be 'global'. For either the 'region' or 'datacenter' scope, name should be the actual name of the region or datacenter, e.g., 'wnam' or 'lax'.`)),n[`rate-sensitivity`]===void 0&&(n[`rate-sensitivity`]=await p(`rate-sensitivity`,`The rate sensitivity. Must be one of 'low', 'medium', 'high'.`)),n.scope===void 0&&(n.scope=await p(`scope`,`The scope for the SYN Protection rule. Must be one of 'global', 'region', or 'datacenter'.`));let m=o({burst_sensitivity:u(n[`burst-sensitivity`],`burst-sensitivity`,`text`),mitigation_type:u(n[`mitigation-type`],`mitigation-type`,`text`),mode:u(n.mode,`mode`,`text`),name:u(n.name,`name`,`text`),rate_sensitivity:u(n[`rate-sensitivity`],`rate-sensitivity`,`text`),scope:u(n.scope,`scope`,`text`)});s(await l(`Creating`,async()=>a.magicTransit.advancedTcpProtection.configs.syn.protection.rules.create({...m,account_id:f})),{successLabel:`Created`})}};function Ie(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})}const Le={command:`account`,describe:`Delete all SYN Protection rules for an account.`,builder:Ie,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs syn protection rules delete for account`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/rules`,pathParams:{},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();if(n.accountId=a,!await m({force:!!n.force})){process.stderr.write(`Aborted.
11
+ `);return}s(await l(`Deleting`,async()=>i.magicTransit.advancedTcpProtection.configs.syn.protection.rules.delete.for.account({account_id:a})),{successLabel:`Deleted`})}},Re={command:`for`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(Le).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ze(e){return e.positional(`rule-id`,{type:`string`,description:`The UUID of the SYN Protection rule to delete.`,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 Be={command:`rule <rule-id>`,describe:`Delete a SYN Protection rule specified by the given UUID.`,builder:ze,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs syn protection rules delete protection rule`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/rules/${n[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(n[`rule-id`]))}`,pathParams:{"rule-id":String(n[`rule-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();if(n.accountId=a,!await m({force:!!n.force})){process.stderr.write(`Aborted.
12
+ `);return}s(await l(`Deleting`,async()=>i.magicTransit.advancedTcpProtection.configs.syn.protection.rules.delete.protection.rule({account_id:a,rule_id:n[`rule-id`]})),{successLabel:`Deleted`})}},Ve={command:`protection`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(Be).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},He={command:`delete`,describe:`Operations for advanced-tcp-protection.configs.syn.protection.rules.delete`,builder:e=>e.command(Re).command(Ve).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ue(e){return e.positional(`rule-id`,{type:`string`,description:`The UUID of the SYN Protection rule.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const We={command:`get <rule-id>`,describe:`Get a SYN Protection rule specified by the given UUID.`,builder:Ue,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs syn protection rules get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/rules/${n[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(n[`rule-id`]))}`,pathParams:{"rule-id":String(n[`rule-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,s(await l(`Loading`,async()=>i.magicTransit.advancedTcpProtection.configs.syn.protection.rules.get({account_id:a,rule_id:n[`rule-id`]})),{successLabel:`Loaded`})}};function Ge(e){return e.option(`page`,{type:`number`,description:`The page number for pagination. Defaults to 1.`}).option(`per-page`,{type:`number`,description:`The number of items per page. Must be between 10 and 1000. Defaults to 25.`}).option(`order`,{type:`string`,description:`The field to order by. Defaults to 'prefix'.`}).option(`direction`,{type:`string`,description:`The direction of ordering (ASC or DESC). Defaults to 'ASC'.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ke={command:`list`,describe:`List all SYN Protection rules for an account.`,builder:Ge,handler:async n=>{let i={page:n.page,per_page:n[`per-page`],order:n.order,direction:n.direction};if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs syn protection rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/rules`,pathParams:{},query:i,bodyKind:`none`});return}let a=await r(n),o=n.local?d:await e();n.accountId=o,s(await l(`Loading`,async()=>a.magicTransit.advancedTcpProtection.configs.syn.protection.rules.list({account_id:o,...i})),{successLabel:`Loaded`})}};function qe(e){return e.positional(`rule-id`,{type:`string`,description:`The UUID of the SYN Protection rule to update.`,demandOption:!0}).option(`burst-sensitivity`,{type:`string`,description:`The new burst sensitivity. Optional. Must be one of 'low', 'medium', 'high'.`}).option(`mitigation-type`,{type:`string`,description:`The new mitigation type. Optional. Must be one of 'challenge' or 'retransmit'.`}).option(`mode`,{type:`string`,description:`The new mode for SYN Protection. Optional. Must be one of 'enabled', 'disabled', 'monitoring'.`}).option(`rate-sensitivity`,{type:`string`,description:`The new rate sensitivity. Optional. Must be one of 'low', 'medium', 'high'.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`The fields to update on the SYN Protection rule.`})}const Je={command:`update <rule-id>`,describe:`Update a SYN Protection rule specified by the given UUID.`,builder:qe,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs syn protection rules update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/rules/${n[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(n[`rule-id`]))}`,pathParams:{"rule-id":String(n[`rule-id`]??``)},bodyKind:`json`,body:n.body===void 0?o({burst_sensitivity:u(n[`burst-sensitivity`],`burst-sensitivity`,`text`),mitigation_type:u(n[`mitigation-type`],`mitigation-type`,`text`),mode:u(n.mode,`mode`,`text`),rate_sensitivity:u(n[`rate-sensitivity`],`rate-sensitivity`,`text`)}):i(n.body)});return}let a=await r(n),f=n.local?d:await e();if(n.accountId=f,n.body){let e=i(n.body);s(await l(`Updating`,async()=>a.magicTransit.advancedTcpProtection.configs.syn.protection.rules.update({...e,account_id:f,rule_id:n[`rule-id`]})),{successLabel:`Updated`});return}let p=o({burst_sensitivity:u(n[`burst-sensitivity`],`burst-sensitivity`,`text`),mitigation_type:u(n[`mitigation-type`],`mitigation-type`,`text`),mode:u(n.mode,`mode`,`text`),rate_sensitivity:u(n[`rate-sensitivity`],`rate-sensitivity`,`text`)});s(await l(`Updating`,async()=>a.magicTransit.advancedTcpProtection.configs.syn.protection.rules.update({...p,account_id:f,rule_id:n[`rule-id`]})),{successLabel:`Updated`})}},Ye={command:`rules`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(Fe).command(We).command(Ke).command(Je).command(He).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Xe={command:`protection`,describe:`Operations for advanced-tcp-protection.configs.syn.protection`,builder:e=>e.command(Ne).command(Ye).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Ze={command:`syn`,describe:`Operations for advanced-tcp-protection.configs.syn`,builder:e=>e.command(Xe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Qe(e){return e.option(`expression`,{type:`string`,description:`The filter expression.`}).option(`mode`,{type:`string`,description:`The filter's mode. Must be one of 'enabled', 'disabled', 'monitoring'.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`The new filter to create.`})}const $e={command:`create`,describe:`Create a TCP Flow Protection filter for an account.`,builder:Qe,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs tcp flow protection filters create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/filters`,pathParams:{},bodyKind:`json`,body:n.body===void 0?o({expression:u(n.expression,`expression`,`text`),mode:u(n.mode,`mode`,`text`)}):i(n.body)});return}let a=await r(n),f=n.local?d:await e();if(n.accountId=f,n.body){let e=i(n.body);s(await l(`Creating`,async()=>a.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.filters.create({body:e,account_id:f})),{successLabel:`Created`});return}n.expression===void 0&&(n.expression=await p(`expression`,`The filter expression.`)),n.mode===void 0&&(n.mode=await p(`mode`,`The filter's mode. Must be one of 'enabled', 'disabled', 'monitoring'.`));let m=o({expression:u(n.expression,`expression`,`text`),mode:u(n.mode,`mode`,`text`)});s(await l(`Creating`,async()=>a.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.filters.create({body:m,account_id:f})),{successLabel:`Created`})}};function et(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})}const tt={command:`account`,describe:`Delete all TCP Flow Protection filters for an account.`,builder:et,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs tcp flow protection filters delete for account`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/filters`,pathParams:{},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();if(n.accountId=a,!await m({force:!!n.force})){process.stderr.write(`Aborted.
13
+ `);return}s(await l(`Deleting`,async()=>i.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.filters.delete.for.account({account_id:a})),{successLabel:`Deleted`})}},nt={command:`for`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(tt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function rt(e){return e.positional(`filter-id`,{type:`string`,description:`The UUID of the filter to delete.`,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 it={command:`filter <filter-id>`,describe:`Delete a TCP Flow Protection filter specified by the given UUID.`,builder:rt,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs tcp flow protection filters delete protection filter`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/filters/${n[`filter-id`]==null?`<filter-id>`:encodeURIComponent(String(n[`filter-id`]))}`,pathParams:{"filter-id":String(n[`filter-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();if(n.accountId=a,!await m({force:!!n.force})){process.stderr.write(`Aborted.
14
+ `);return}s(await l(`Deleting`,async()=>i.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.filters.delete.protection.filter({account_id:a,filter_id:n[`filter-id`]})),{successLabel:`Deleted`})}},at={command:`protection`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(it).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ot={command:`delete`,describe:`Operations for advanced-tcp-protection.configs.tcp.flow.protection.filters.delete`,builder:e=>e.command(nt).command(at).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function st(e){return e.positional(`filter-id`,{type:`string`,description:`The UUID of the filter to retrieve.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ct={command:`get <filter-id>`,describe:`Get a TCP Flow Protection filter specified by the given UUID.`,builder:st,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs tcp flow protection filters get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/filters/${n[`filter-id`]==null?`<filter-id>`:encodeURIComponent(String(n[`filter-id`]))}`,pathParams:{"filter-id":String(n[`filter-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,s(await l(`Loading`,async()=>i.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.filters.get({account_id:a,filter_id:n[`filter-id`]})),{successLabel:`Loaded`})}};function lt(e){return e.option(`mode`,{type:`string`,description:`The mode of the filters to get. Optional. Valid values: 'enabled', 'disabled', 'monitoring'.`}).option(`page`,{type:`number`,description:`The page number for pagination. Defaults to 1.`}).option(`per-page`,{type:`number`,description:`The number of items per page. Must be between 10 and 1000. Defaults to 25.`}).option(`order`,{type:`string`,description:`The field to order by. Defaults to 'prefix'.`}).option(`direction`,{type:`string`,description:`The direction of ordering (ASC or DESC). Defaults to 'ASC'.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ut={command:`list`,describe:`List all TCP Flow Protection filters for an account.`,builder:lt,handler:async n=>{let i={mode:n.mode,page:n.page,per_page:n[`per-page`],order:n.order,direction:n.direction};if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs tcp flow protection filters list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/filters`,pathParams:{},query:i,bodyKind:`none`});return}let a=await r(n),o=n.local?d:await e();n.accountId=o,s(await l(`Loading`,async()=>a.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.filters.list({account_id:o,...i})),{successLabel:`Loaded`})}};function dt(e){return e.positional(`filter-id`,{type:`string`,description:`The UUID of the filter to update.`,demandOption:!0}).option(`expression`,{type:`string`,description:`The new filter expression. Optional.`}).option(`mode`,{type:`string`,description:`The new mode for the filter. Optional. Must be one of 'enabled', 'disabled', 'monitoring'.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`The updates to apply to the filter.`})}const ft={command:`update <filter-id>`,describe:`Update a TCP Flow Protection filter specified by the given UUID.`,builder:dt,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs tcp flow protection filters update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/filters/${n[`filter-id`]==null?`<filter-id>`:encodeURIComponent(String(n[`filter-id`]))}`,pathParams:{"filter-id":String(n[`filter-id`]??``)},bodyKind:`json`,body:n.body===void 0?o({expression:u(n.expression,`expression`,`text`),mode:u(n.mode,`mode`,`text`)}):i(n.body)});return}let a=await r(n),f=n.local?d:await e();if(n.accountId=f,n.body){let e=i(n.body);s(await l(`Updating`,async()=>a.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.filters.update({body:e,account_id:f,filter_id:n[`filter-id`]})),{successLabel:`Updated`});return}let p=o({expression:u(n.expression,`expression`,`text`),mode:u(n.mode,`mode`,`text`)});s(await l(`Updating`,async()=>a.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.filters.update({body:p,account_id:f,filter_id:n[`filter-id`]})),{successLabel:`Updated`})}},pt={command:`filters`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command($e).command(ct).command(ut).command(ft).command(ot).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function mt(e){return e.option(`burst-sensitivity`,{type:`string`,description:`The burst sensitivity. Must be one of 'low', 'medium', 'high'.`}).option(`mode`,{type:`string`,description:`The mode for the TCP Flow Protection. Must be one of 'enabled', 'disabled', 'monitoring'.`}).option(`name`,{type:`string`,description:`The name of the TCP Flow Protection rule. Value is relative to the 'scope' setting. For 'global' scope, name should be 'global'. For either the 'region' or 'datacenter' scope, name should be the actual name of the region or datacenter, e.g., 'wnam' or 'lax'.`}).option(`rate-sensitivity`,{type:`string`,description:`The rate sensitivity. Must be one of 'low', 'medium', 'high'.`}).option(`scope`,{type:`string`,description:`The scope for the TCP Flow Protection rule.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`The new TCP Flow Protection rule.`})}const ht={command:`create`,describe:`Create a TCP Flow Protection rule for an account.`,builder:mt,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs tcp flow protection rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/rules`,pathParams:{},bodyKind:`json`,body:n.body===void 0?o({burst_sensitivity:u(n[`burst-sensitivity`],`burst-sensitivity`,`text`),mode:u(n.mode,`mode`,`text`),name:u(n.name,`name`,`text`),rate_sensitivity:u(n[`rate-sensitivity`],`rate-sensitivity`,`text`),scope:u(n.scope,`scope`,`text`)}):i(n.body)});return}let a=await r(n),f=n.local?d:await e();if(n.accountId=f,n.body){let e=i(n.body);s(await l(`Creating`,async()=>a.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.rules.create({...e,account_id:f})),{successLabel:`Created`});return}n[`burst-sensitivity`]===void 0&&(n[`burst-sensitivity`]=await p(`burst-sensitivity`,`The burst sensitivity. Must be one of 'low', 'medium', 'high'.`)),n.mode===void 0&&(n.mode=await p(`mode`,`The mode for the TCP Flow Protection. Must be one of 'enabled', 'disabled', 'monitoring'.`)),n.name===void 0&&(n.name=await p(`name`,`The name of the TCP Flow Protection rule. Value is relative to the 'scope' setting. For 'global' scope, name should be 'global'. For either the 'region' or 'datacenter' scope, name should be the actual name of the region or datacenter, e.g., 'wnam' or 'lax'.`)),n[`rate-sensitivity`]===void 0&&(n[`rate-sensitivity`]=await p(`rate-sensitivity`,`The rate sensitivity. Must be one of 'low', 'medium', 'high'.`)),n.scope===void 0&&(n.scope=await p(`scope`,`The scope for the TCP Flow Protection rule.`));let m=o({burst_sensitivity:u(n[`burst-sensitivity`],`burst-sensitivity`,`text`),mode:u(n.mode,`mode`,`text`),name:u(n.name,`name`,`text`),rate_sensitivity:u(n[`rate-sensitivity`],`rate-sensitivity`,`text`),scope:u(n.scope,`scope`,`text`)});s(await l(`Creating`,async()=>a.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.rules.create({...m,account_id:f})),{successLabel:`Created`})}};function gt(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})}const _t={command:`account`,describe:`Delete all TCP Flow Protection rules for an account.`,builder:gt,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs tcp flow protection rules delete for account`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/rules`,pathParams:{},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();if(n.accountId=a,!await m({force:!!n.force})){process.stderr.write(`Aborted.
15
+ `);return}s(await l(`Deleting`,async()=>i.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.rules.delete.for.account({account_id:a})),{successLabel:`Deleted`})}},vt={command:`for`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(_t).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function yt(e){return e.positional(`rule-id`,{type:`string`,description:`The UUID of the TCP Flow Protection rule to delete.`,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 bt={command:`rule <rule-id>`,describe:`Delete a TCP Flow Protection rule specified by the given UUID.`,builder:yt,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs tcp flow protection rules delete protection rule`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/rules/${n[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(n[`rule-id`]))}`,pathParams:{"rule-id":String(n[`rule-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();if(n.accountId=a,!await m({force:!!n.force})){process.stderr.write(`Aborted.
16
+ `);return}s(await l(`Deleting`,async()=>i.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.rules.delete.protection.rule({account_id:a,rule_id:n[`rule-id`]})),{successLabel:`Deleted`})}},xt={command:`protection`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(bt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},St={command:`delete`,describe:`Operations for advanced-tcp-protection.configs.tcp.flow.protection.rules.delete`,builder:e=>e.command(vt).command(xt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ct(e){return e.positional(`rule-id`,{type:`string`,description:`The UUID of the TCP Flow Protection rule.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const wt={command:`get <rule-id>`,describe:`Get a TCP Flow Protection rule specified by the given UUID.`,builder:Ct,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs tcp flow protection rules get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/rules/${n[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(n[`rule-id`]))}`,pathParams:{"rule-id":String(n[`rule-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,s(await l(`Loading`,async()=>i.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.rules.get({account_id:a,rule_id:n[`rule-id`]})),{successLabel:`Loaded`})}};function Tt(e){return e.option(`page`,{type:`number`,description:`The page number for pagination. Defaults to 1.`}).option(`per-page`,{type:`number`,description:`The number of items per page. Must be between 10 and 1000. Defaults to 25.`}).option(`order`,{type:`string`,description:`The field to order by. Defaults to 'prefix'.`}).option(`direction`,{type:`string`,description:`The direction of ordering (ASC or DESC). Defaults to 'ASC'.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Et={command:`list`,describe:`List all TCP Flow Protection rules for an account.`,builder:Tt,handler:async n=>{let i={page:n.page,per_page:n[`per-page`],order:n.order,direction:n.direction};if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs tcp flow protection rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/rules`,pathParams:{},query:i,bodyKind:`none`});return}let a=await r(n),o=n.local?d:await e();n.accountId=o,s(await l(`Loading`,async()=>a.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.rules.list({account_id:o,...i})),{successLabel:`Loaded`})}};function Dt(e){return e.positional(`rule-id`,{type:`string`,description:`The UUID of the TCP Flow Protection rule to update.`,demandOption:!0}).option(`burst-sensitivity`,{type:`string`,description:`The new burst sensitivity. Optional. Must be one of 'low', 'medium', 'high'.`}).option(`mode`,{type:`string`,description:`The new mode for TCP Flow Protection. Optional. Must be one of 'enabled', 'disabled', 'monitoring'.`}).option(`rate-sensitivity`,{type:`string`,description:`The new rate sensitivity. Optional. Must be one of 'low', 'medium', 'high'.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`The updates to apply to the TCP Flow Protection rule.`})}const Ot={command:`update <rule-id>`,describe:`Update a TCP Flow Protection rule specified by the given UUID.`,builder:Dt,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs tcp flow protection rules update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/rules/${n[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(n[`rule-id`]))}`,pathParams:{"rule-id":String(n[`rule-id`]??``)},bodyKind:`json`,body:n.body===void 0?o({burst_sensitivity:u(n[`burst-sensitivity`],`burst-sensitivity`,`text`),mode:u(n.mode,`mode`,`text`),rate_sensitivity:u(n[`rate-sensitivity`],`rate-sensitivity`,`text`)}):i(n.body)});return}let a=await r(n),f=n.local?d:await e();if(n.accountId=f,n.body){let e=i(n.body);s(await l(`Updating`,async()=>a.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.rules.update({...e,account_id:f,rule_id:n[`rule-id`]})),{successLabel:`Updated`});return}let p=o({burst_sensitivity:u(n[`burst-sensitivity`],`burst-sensitivity`,`text`),mode:u(n.mode,`mode`,`text`),rate_sensitivity:u(n[`rate-sensitivity`],`rate-sensitivity`,`text`)});s(await l(`Updating`,async()=>a.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.rules.update({...p,account_id:f,rule_id:n[`rule-id`]})),{successLabel:`Updated`})}},kt={command:`rules`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(ht).command(wt).command(Et).command(Ot).command(St).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},At={command:`protection`,describe:`Operations for advanced-tcp-protection.configs.tcp.flow.protection`,builder:e=>e.command(pt).command(kt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},jt={command:`flow`,describe:`Operations for advanced-tcp-protection.configs.tcp.flow`,builder:e=>e.command(At).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Mt(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Nt={command:`get`,describe:`Get the protection status of the account.`,builder:Mt,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs tcp protection status get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_protection_status`,pathParams:{},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,s(await l(`Loading`,async()=>i.magicTransit.advancedTcpProtection.configs.tcp.protection.status.get({account_id:a})),{successLabel:`Loaded`})}};function Pt(e){return e.option(`enabled`,{type:`boolean`,description:`Enables or disables protection.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`The update to apply to the protection status.`})}const Ft={command:`update`,describe:`Update the protection status of the account.`,builder:Pt,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs tcp protection status update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_protection_status`,pathParams:{},bodyKind:`json`,body:n.body===void 0?o({enabled:n.enabled}):i(n.body)});return}let a=await r(n),u=n.local?d:await e();if(n.accountId=u,n.body){let e=i(n.body);s(await l(`Updating`,async()=>a.magicTransit.advancedTcpProtection.configs.tcp.protection.status.update({...e,account_id:u})),{successLabel:`Updated`});return}if(n.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);let f=o({enabled:n.enabled});s(await l(`Updating`,async()=>a.magicTransit.advancedTcpProtection.configs.tcp.protection.status.update({...f,account_id:u})),{successLabel:`Updated`})}},It={command:`status`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(Nt).command(Ft).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Lt={command:`protection`,describe:`Operations for advanced-tcp-protection.configs.tcp.protection`,builder:e=>e.command(It).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Rt={command:`tcp`,describe:`Operations for advanced-tcp-protection.configs.tcp`,builder:e=>e.command(jt).command(Lt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},zt={command:`configs`,describe:`Operations for advanced-tcp-protection.configs`,builder:e=>e.command(X).command(_e).command(Ze).command(Rt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Bt={command:`advanced-tcp-protection`,describe:`Operations for advanced-tcp-protection`,builder:e=>e.command(zt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Vt(e){return e.option(`hostnames`,{type:`string`,array:!0,description:`FQDNs to associate with traffic decisions.`}).option(`name`,{type:`string`,description:`Display name for the app.`}).option(`type`,{type:`string`,description:`Category of the app.`}).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 Ht={command:`create`,describe:`Creates a new App for an account`,builder:Vt,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit apps create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/apps`,pathParams:{},bodyKind:`json`,body:n.body===void 0?o({hostnames:n.hostnames,name:u(n.name,`name`,`text`),type:u(n.type,`type`,`text`)}):i(n.body)});return}let a=await r(n),f=n.local?d:await e();if(n.accountId=f,n.body){let e=i(n.body);s(await l(`Creating`,async()=>a.magicTransit.apps.create({body:e,account_id:f})),{successLabel:`Created`});return}n.name===void 0&&(n.name=await p(`name`,`Display name for the app.`)),n.type===void 0&&(n.type=await p(`type`,`Category of the app.`));let m=o({hostnames:n.hostnames,name:u(n.name,`name`,`text`),type:u(n.type,`type`,`text`)});s(await l(`Creating`,async()=>a.magicTransit.apps.create({body:m,account_id:f})),{successLabel:`Created`})}};function Ut(e){return e.positional(`account-app-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 Wt={command:`delete <account-app-id>`,describe:`Deletes specific Account App.`,builder:Ut,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit apps delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/apps/${n[`account-app-id`]==null?`<account-app-id>`:encodeURIComponent(String(n[`account-app-id`]))}`,pathParams:{"account-app-id":String(n[`account-app-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();if(n.accountId=a,!await m({force:!!n.force})){process.stderr.write(`Aborted.
17
+ `);return}s(await l(`Deleting`,async()=>i.magicTransit.apps.delete({account_id:a,account_app_id:n[`account-app-id`]})),{successLabel:`Deleted`})}};function Gt(e){return e.positional(`account-app-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`hostnames`,{type:`string`,array:!0,description:`FQDNs to associate with traffic decisions.`}).option(`name`,{type:`string`,description:`Display name for the app.`}).option(`type`,{type:`string`,description:`Category of the app.`}).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 Kt={command:`edit <account-app-id>`,describe:`Updates an Account App`,builder:Gt,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit apps edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/apps/${n[`account-app-id`]==null?`<account-app-id>`:encodeURIComponent(String(n[`account-app-id`]))}`,pathParams:{"account-app-id":String(n[`account-app-id`]??``)},bodyKind:`json`,body:n.body===void 0?o({hostnames:n.hostnames,name:u(n.name,`name`,`text`),type:u(n.type,`type`,`text`)}):i(n.body)});return}let a=await r(n),f=n.local?d:await e();if(n.accountId=f,n.body){let e=i(n.body);s(await l(`Updating`,async()=>a.magicTransit.apps.edit({body:e,account_id:f,account_app_id:n[`account-app-id`]})),{successLabel:`Updated`});return}let p=o({hostnames:n.hostnames,name:u(n.name,`name`,`text`),type:u(n.type,`type`,`text`)});s(await l(`Updating`,async()=>a.magicTransit.apps.edit({body:p,account_id:f,account_app_id:n[`account-app-id`]})),{successLabel:`Updated`})}};function qt(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Jt={command:`list`,describe:`Lists Apps associated with an account.`,builder:qt,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit apps list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/apps`,pathParams:{},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,s(await l(`Loading`,async()=>i.magicTransit.apps.list({account_id:a})),{successLabel:`Loaded`})}};function Yt(e){return e.positional(`account-app-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`hostnames`,{type:`string`,array:!0,description:`FQDNs to associate with traffic decisions.`}).option(`name`,{type:`string`,description:`Display name for the app.`}).option(`type`,{type:`string`,description:`Category of the app.`}).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 Xt={command:`update <account-app-id>`,describe:`Updates an Account App`,builder:Yt,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit apps update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/apps/${n[`account-app-id`]==null?`<account-app-id>`:encodeURIComponent(String(n[`account-app-id`]))}`,pathParams:{"account-app-id":String(n[`account-app-id`]??``)},bodyKind:`json`,body:n.body===void 0?o({hostnames:n.hostnames,name:u(n.name,`name`,`text`),type:u(n.type,`type`,`text`)}):i(n.body)});return}let a=await r(n),f=n.local?d:await e();if(n.accountId=f,n.body){let e=i(n.body);s(await l(`Updating`,async()=>a.magicTransit.apps.update({body:e,account_id:f,account_app_id:n[`account-app-id`]})),{successLabel:`Updated`});return}let p=o({hostnames:n.hostnames,name:u(n.name,`name`,`text`),type:u(n.type,`type`,`text`)});s(await l(`Updating`,async()=>a.magicTransit.apps.update({body:p,account_id:f,account_app_id:n[`account-app-id`]})),{successLabel:`Updated`})}},Zt={command:`apps`,describe:`Operations for apps`,builder:e=>e.command(Ht).command(Wt).command(Kt).command(Jt).command(Xt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Qt(e){return e.option(`description`,{type:`string`,description:`Description of the filter profile`,default:``}).option(`match-action`,{type:`string`,description:`Action to take when a route matches one of the targets in this profile`,choices:[`allow`,`deny`]}).option(`name`,{type:`string`,description:`Friendly name for the filter profile`}).option(`targets`,{type:`string`,array:!0,description:`List of CIDR prefixes. Each entry may carry an optional suffix that specifies which prefix lengths to match relative to the prefix length N: '{X,Y}' matches prefix lengths in the inclusive range [X, Y] where N <= X <= Y <= max (max is 32 for IPv4, 128 for IPv6), '{X}' matches exactly length X (equivalent to {X,X}), '+' is shorthand for {N, max} (the prefix and all more-specific subnets, including at length N itself; valid even when N is the maximum length). Omit the suffix to match the prefix exactly at length N.`}).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 BGP filter profile for an account.`,builder:Qt,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit bgp-filter-profiles create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/bgp/filter_profiles`,pathParams:{},bodyKind:`json`,body:n.body===void 0?o({description:u(n.description,`description`,`text`),match_action:u(n[`match-action`],`match-action`,`text`),name:u(n.name,`name`,`text`),targets:n.targets}):i(n.body)});return}let a=await r(n),m=n.local?d:await e();if(n.accountId=m,n.body){let e=i(n.body);s(await l(`Creating`,async()=>a.magicTransit.bgpFilterProfiles.create({...e,account_id:m})),{successLabel:`Created`});return}if(n[`match-action`]===void 0&&(n[`match-action`]=await f(`match-action`,`Action to take when a route matches one of the targets in this profile`,[`allow`,`deny`])),n.name===void 0&&(n.name=await p(`name`,`Friendly name for the filter profile`)),n.targets===void 0)throw Error(`--targets is required (or pass --body with this field set).`);let h=o({description:u(n.description,`description`,`text`),match_action:u(n[`match-action`],`match-action`,`text`),name:u(n.name,`name`,`text`),targets:n.targets});s(await l(`Creating`,async()=>a.magicTransit.bgpFilterProfiles.create({...h,account_id:m})),{successLabel:`Created`})}};function en(e){return e.positional(`profile-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 tn={command:`delete <profile-id>`,describe:`Deletes a BGP filter profile.`,builder:en,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit bgp-filter-profiles delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/bgp/filter_profiles/${n[`profile-id`]==null?`<profile-id>`:encodeURIComponent(String(n[`profile-id`]))}`,pathParams:{"profile-id":String(n[`profile-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();if(n.accountId=a,!await m({force:!!n.force})){process.stderr.write(`Aborted.
18
+ `);return}s(await l(`Deleting`,async()=>i.magicTransit.bgpFilterProfiles.delete({account_id:a,profile_id:n[`profile-id`]})),{successLabel:`Deleted`})}};function nn(e){return e.positional(`profile-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const rn={command:`get <profile-id>`,describe:`Gets a specific BGP filter profile for an account.`,builder:nn,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit bgp-filter-profiles get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/bgp/filter_profiles/${n[`profile-id`]==null?`<profile-id>`:encodeURIComponent(String(n[`profile-id`]))}`,pathParams:{"profile-id":String(n[`profile-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,s(await l(`Loading`,async()=>i.magicTransit.bgpFilterProfiles.get({account_id:a,profile_id:n[`profile-id`]})),{successLabel:`Loaded`})}};function an(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const on={command:`list`,describe:`Lists all BGP filter profiles for an account.`,builder:an,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit bgp-filter-profiles list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/bgp/filter_profiles`,pathParams:{},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,s(await l(`Loading`,async()=>i.magicTransit.bgpFilterProfiles.list({account_id:a})),{successLabel:`Loaded`})}};function sn(e){return e.positional(`profile-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`description`,{type:`string`,description:`Description of the filter profile`}).option(`match-action`,{type:`string`,description:`Action to take when a route matches one of the targets in this profile`,choices:[`allow`,`deny`]}).option(`name`,{type:`string`,description:`Friendly name for the filter profile`}).option(`targets`,{type:`string`,array:!0,description:`List of CIDR prefixes. Each entry may carry an optional suffix that specifies which prefix lengths to match relative to the prefix length N: '{X,Y}' matches prefix lengths in the inclusive range [X, Y] where N <= X <= Y <= max (max is 32 for IPv4, 128 for IPv6), '{X}' matches exactly length X (equivalent to {X,X}), '+' is shorthand for {N, max} (the prefix and all more-specific subnets, including at length N itself; valid even when N is the maximum length). Omit the suffix to match the prefix exactly at length N.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:'Partial update for a BGP filter profile. At least one property must be provided; omitted properties are left unchanged. To clear an existing description send `description: ""`.'})}const cn={command:`update <profile-id>`,describe:'Updates a BGP filter profile. Omitted properties are left unchanged. To clear an existing description send `description: ""`.',builder:sn,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit bgp-filter-profiles update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/bgp/filter_profiles/${n[`profile-id`]==null?`<profile-id>`:encodeURIComponent(String(n[`profile-id`]))}`,pathParams:{"profile-id":String(n[`profile-id`]??``)},bodyKind:`json`,body:n.body===void 0?o({description:u(n.description,`description`,`text`),match_action:u(n[`match-action`],`match-action`,`text`),name:u(n.name,`name`,`text`),targets:n.targets}):i(n.body)});return}let a=await r(n),f=n.local?d:await e();if(n.accountId=f,n.body){let e=i(n.body);s(await l(`Updating`,async()=>a.magicTransit.bgpFilterProfiles.update({...e,account_id:f,profile_id:n[`profile-id`]})),{successLabel:`Updated`});return}let p=o({description:u(n.description,`description`,`text`),match_action:u(n[`match-action`],`match-action`,`text`),name:u(n.name,`name`,`text`),targets:n.targets});s(await l(`Updating`,async()=>a.magicTransit.bgpFilterProfiles.update({...p,account_id:f,profile_id:n[`profile-id`]})),{successLabel:`Updated`})}},ln={command:`bgp-filter-profiles`,describe:`Operations for bgp-filter-profiles`,builder:e=>e.command($t).command(tn).command(rn).command(on).command(cn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function un(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const dn={command:`get`,describe:`Gets the BGP settings for an account, including the default ASN and redistribution configuration.`,builder:un,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit bgp-settings get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/bgp/settings`,pathParams:{},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,s(await l(`Loading`,async()=>i.magicTransit.bgpSettings.get({account_id:a})),{successLabel:`Loaded`})}};function fn(e){return e.option(`cloudflare-asn`,{type:`number`,description:`Route advertisements from Cloudflare to ramps in this account will use this ASN.`}).option(`redistribute-static:wan`,{type:`boolean`,description:`Redistribute static WAN routes into BGP`}).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 pn={command:`update`,describe:`Modifies the BGP settings for an account, including the default ASN and redistribution configuration.`,builder:fn,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit bgp-settings update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/bgp/settings`,pathParams:{},bodyKind:`json`,body:n.body===void 0?o({cloudflare_asn:n[`cloudflare-asn`],redistribute:{"static:wan":n[`redistribute-static:wan`]}}):i(n.body)});return}let a=await r(n),u=n.local?d:await e();if(n.accountId=u,n.body){let e=i(n.body);s(await l(`Updating`,async()=>a.magicTransit.bgpSettings.update({...e,account_id:u})),{successLabel:`Updated`});return}let f=o({cloudflare_asn:n[`cloudflare-asn`],redistribute:{"static:wan":n[`redistribute-static:wan`]}});s(await l(`Updating`,async()=>a.magicTransit.bgpSettings.update({...f,account_id:u})),{successLabel:`Updated`})}},mn={command:`bgp-settings`,describe:`Operations for bgp-settings`,builder:e=>e.command(dn).command(pn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function hn(e){return e.option(`x-magic-new-hc-target`,{type:`string`,description:`If true, the health check target in the request and response bodies will be presented using the new object format. Defaults to false.`}).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 gn={command:`bulk-update`,describe:"Updates multiple interconnects associated with an account. Use `?validate_only=true` as an optional query parameter to only run validation without persisting changes.",builder:hn,handler:async a=>{let o={};if(a[`x-magic-new-hc-target`]!==void 0&&(o[`x-magic-new-hc-target`]=String(a[`x-magic-new-hc-target`])),a.dryRun){c({command:`cf magic-transit cf-interconnects bulk-update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/cf_interconnects`,pathParams:{},bodyKind:`json`,body:a.body===void 0?void 0:i(a.body)});return}let u=await r(a),f=a.local?d:await e();if(a.accountId=f,a.body){let e=i(a.body);s(await l(`Updating`,async()=>n(u,`PUT`,`/accounts/${f}/magic/cf_interconnects`,{body:e,headers:Object.keys(o).length>0?o:void 0})),{successLabel:`Updated`});return}s(await l(`Updating`,async()=>n(u,`PUT`,`/accounts/${f}/magic/cf_interconnects`,{headers:Object.keys(o).length>0?o:void 0})),{successLabel:`Updated`})}};function _n(e){return e.positional(`cf-interconnect-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`x-magic-new-hc-target`,{type:`string`,description:`If true, the health check target in the response body will be presented using the new object format. Defaults to false.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const vn={command:`get <cf-interconnect-id>`,describe:`Lists details for a specific interconnect.`,builder:_n,handler:async i=>{let a={};if(i[`x-magic-new-hc-target`]!==void 0&&(a[`x-magic-new-hc-target`]=String(i[`x-magic-new-hc-target`])),i.dryRun){c({command:`cf magic-transit cf-interconnects get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/cf_interconnects/${i[`cf-interconnect-id`]==null?`<cf-interconnect-id>`:encodeURIComponent(String(i[`cf-interconnect-id`]))}`,pathParams:{"cf-interconnect-id":String(i[`cf-interconnect-id`]??``)},bodyKind:`none`});return}let o=await r(i),u=i.local?d:await e();i.accountId=u,s(await l(`Loading`,async()=>n(o,`GET`,`/accounts/${u}/magic/cf_interconnects/${encodeURIComponent(String(i[`cf-interconnect-id`]))}`,{headers:Object.keys(a).length>0?a:void 0})),{successLabel:`Loaded`})}};function yn(e){return e.option(`x-magic-new-hc-target`,{type:`string`,description:`If true, the health check target in the response body will be presented using the new object format. Defaults to false.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const $={command:`list`,describe:`Lists interconnects associated with an account.`,builder:yn,handler:async i=>{let a={};if(i[`x-magic-new-hc-target`]!==void 0&&(a[`x-magic-new-hc-target`]=String(i[`x-magic-new-hc-target`])),i.dryRun){c({command:`cf magic-transit cf-interconnects list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/cf_interconnects`,pathParams:{},bodyKind:`none`});return}let o=await r(i),u=i.local?d:await e();i.accountId=u,s(await l(`Loading`,async()=>n(o,`GET`,`/accounts/${u}/magic/cf_interconnects`,{headers:Object.keys(a).length>0?a:void 0})),{successLabel:`Loaded`})}};function bn(e){return e.positional(`cf-interconnect-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`x-magic-new-hc-target`,{type:`string`,description:`If true, the health check target in the request and response bodies will be presented using the new object format. Defaults to false.`}).option(`automatic-return-routing`,{type:`boolean`,description:"True if automatic stateful return routing should be enabled for a tunnel, false otherwise. Requires the `coupler_integration` account flag to be enabled; requests setting this to `true` without that flag will be rejected."}).option(`description`,{type:`string`,description:`An optional description of the interconnect.`}).option(`gre-cloudflare-endpoint`,{type:`string`,description:`The IP address assigned to the Cloudflare side of the GRE tunnel created as part of the Interconnect.`}).option(`health-check-enabled`,{type:`boolean`,description:`Determines whether to run healthchecks for a tunnel.`}).option(`health-check-rate`,{type:`string`,description:"How frequent the health check is run. The default value is `mid`.",choices:[`low`,`mid`,`high`]}).option(`health-check-target-saved`,{type:`string`,description:`The saved health check target. Setting the value to the empty string indicates that the calculated default value will be used.`}).option(`health-check-type`,{type:`string`,description:"The type of healthcheck to run, reply or request. The default value is `reply`.",choices:[`reply`,`request`]}).option(`interface-address`,{type:`string`,description:`A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side of the tunnel. Select the subnet from the following private IP space: 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255.`}).option(`interface-address6`,{type:`string`,description:`A 127 bit IPV6 prefix from within the virtual_subnet6 prefix space with the address being the first IP of the subnet and not same as the address of virtual_subnet6. Eg if virtual_subnet6 is 2606:54c1:7:0:a9fe:12d2::/127 , interface_address6 could be 2606:54c1:7:0:a9fe:12d2:1:200/127`}).option(`mtu`,{type:`number`,description:`The Maximum Transmission Unit (MTU) in bytes for the interconnect. The minimum value is 576.`}).option(`name`,{type:`string`,description:`The name of the interconnect. The name cannot share a name with other tunnels.`}).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 xn={command:`update <cf-interconnect-id>`,describe:"Updates a specific interconnect associated with an account. Use `?validate_only=true` as an optional query parameter to only run validation without persisting changes.",builder:bn,handler:async f=>{let p={};if(f[`x-magic-new-hc-target`]!==void 0&&(p[`x-magic-new-hc-target`]=String(f[`x-magic-new-hc-target`])),f.dryRun){c({command:`cf magic-transit cf-interconnects update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/cf_interconnects/${f[`cf-interconnect-id`]==null?`<cf-interconnect-id>`:encodeURIComponent(String(f[`cf-interconnect-id`]))}`,pathParams:{"cf-interconnect-id":String(f[`cf-interconnect-id`]??``)},bodyKind:`json`,body:f.body===void 0?o({automatic_return_routing:f[`automatic-return-routing`],description:u(f.description,`description`,`text`),gre:{cloudflare_endpoint:u(f[`gre-cloudflare-endpoint`],`gre-cloudflare-endpoint`,`text`)},health_check:{enabled:f[`health-check-enabled`],rate:u(f[`health-check-rate`],`health-check-rate`,`text`),target:{saved:u(f[`health-check-target-saved`],`health-check-target-saved`,`text`)},type:u(f[`health-check-type`],`health-check-type`,`text`)},interface_address:u(f[`interface-address`],`interface-address`,`text`),interface_address6:u(f[`interface-address6`],`interface-address6`,`text`),mtu:f.mtu,name:u(f.name,`name`,`text`)}):i(f.body)});return}let m=await r(f),h=f.local?d:await e();if(f.accountId=h,f.body){let e=i(f.body);s(await l(`Updating`,async()=>n(m,`PUT`,`/accounts/${h}/magic/cf_interconnects/${encodeURIComponent(String(f[`cf-interconnect-id`]))}`,{body:e,headers:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`});return}let g={};f[`automatic-return-routing`]!==void 0&&a(g,[`automatic_return_routing`],f[`automatic-return-routing`]),f.description!==void 0&&a(g,[`description`],u(f.description,`description`,`text`)),f[`gre-cloudflare-endpoint`]!==void 0&&a(g,[`gre`,`cloudflare_endpoint`],u(f[`gre-cloudflare-endpoint`],`gre-cloudflare-endpoint`,`text`)),f[`health-check-enabled`]!==void 0&&a(g,[`health_check`,`enabled`],f[`health-check-enabled`]),f[`health-check-rate`]!==void 0&&a(g,[`health_check`,`rate`],u(f[`health-check-rate`],`health-check-rate`,`text`)),f[`health-check-target-saved`]!==void 0&&a(g,[`health_check`,`target`,`saved`],u(f[`health-check-target-saved`],`health-check-target-saved`,`text`)),f[`health-check-type`]!==void 0&&a(g,[`health_check`,`type`],u(f[`health-check-type`],`health-check-type`,`text`)),f[`interface-address`]!==void 0&&a(g,[`interface_address`],u(f[`interface-address`],`interface-address`,`text`)),f[`interface-address6`]!==void 0&&a(g,[`interface_address6`],u(f[`interface-address6`],`interface-address6`,`text`)),f.mtu!==void 0&&a(g,[`mtu`],f.mtu),f.name!==void 0&&a(g,[`name`],u(f.name,`name`,`text`)),s(await l(`Updating`,async()=>n(m,`PUT`,`/accounts/${h}/magic/cf_interconnects/${encodeURIComponent(String(f[`cf-interconnect-id`]))}`,{body:Object.keys(g).length>0?g:void 0,headers:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}},Sn={command:`cf-interconnects`,describe:`Operations for cf-interconnects`,builder:e=>e.command(gn).command(vn).command($).command(xn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Cn(e){return e.option(`x-magic-new-hc-target`,{type:`string`,description:`If true, the health check target in the request and response bodies will be presented using the new object format. Defaults to false.`}).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 wn={command:`bulk-update`,describe:"Updates multiple GRE tunnels. Use `?validate_only=true` as an optional query parameter to only run validation without persisting changes.",builder:Cn,handler:async a=>{let o={};if(a[`x-magic-new-hc-target`]!==void 0&&(o[`x-magic-new-hc-target`]=String(a[`x-magic-new-hc-target`])),a.dryRun){c({command:`cf magic-transit gre-tunnels bulk-update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/gre_tunnels`,pathParams:{},bodyKind:`json`,body:a.body===void 0?void 0:i(a.body)});return}let u=await r(a),f=a.local?d:await e();if(a.accountId=f,a.body){let e=i(a.body);s(await l(`Updating`,async()=>n(u,`PUT`,`/accounts/${f}/magic/gre_tunnels`,{body:e,headers:Object.keys(o).length>0?o:void 0})),{successLabel:`Updated`});return}s(await l(`Updating`,async()=>n(u,`PUT`,`/accounts/${f}/magic/gre_tunnels`,{headers:Object.keys(o).length>0?o:void 0})),{successLabel:`Updated`})}};function Tn(e){return e.option(`x-magic-new-hc-target`,{type:`string`,description:`If true, the health check target in the request and response bodies will be presented using the new object format. Defaults to false.`}).option(`automatic-return-routing`,{type:`boolean`,description:"True if automatic stateful return routing should be enabled for a tunnel, false otherwise. Requires the `coupler_integration` account flag to be enabled; requests setting this to `true` without that flag will be rejected.",default:!1}).option(`bgp-customer-asn`,{type:`number`,description:`ASN used on the customer end of the BGP session`}).option(`bgp-export-filter-id`,{type:`string`,description:`ID of the BGP filter profile applied to routes advertised to the customer.`}).option(`bgp-extra-prefixes`,{type:`string`,array:!0,description:`Prefixes in this list will be advertised to the customer device, in addition to the routes in the Magic routing table.`}).option(`bgp-import-filter-id`,{type:`string`,description:`ID of the BGP filter profile applied to routes received from the customer.`}).option(`bgp-md5-key`,{type:`string`,description:`MD5 key to use for session authentication.
19
+
20
+ Note that *this is not a security measure*. MD5 is not a valid security mechanism, and the
21
+ key is not treated as a secret value. This is *only* supported for preventing
22
+ misconfiguration, not for defending against malicious attacks.
23
+
24
+ The MD5 key, if set, must be of non-zero length and consist only of the following types of
25
+ character:
26
+
27
+ * ASCII alphanumerics: \`[a-zA-Z0-9]\`
28
+ * Special characters in the set \`'!@#$%^&*()+[]{}<>/.,;:_-~\`= \\|\`
29
+
30
+ In other words, MD5 keys may contain any printable ASCII character aside from newline (0x0A),
31
+ quotation mark (\`"\`), vertical tab (0x0B), carriage return (0x0D), tab (0x09), form feed
32
+ (0x0C), and the question mark (\`?\`). Requests specifying an MD5 key with one or more of
33
+ these disallowed characters will be rejected.`}).option(`cloudflare-gre-endpoint`,{type:`string`,description:`The IP address assigned to the Cloudflare side of the GRE tunnel.`}).option(`customer-gre-endpoint`,{type:`string`,description:`The IP address assigned to the customer side of the GRE tunnel.`}).option(`description`,{type:`string`,description:`An optional description of the GRE tunnel.`}).option(`health-check-enabled`,{type:`boolean`,description:`Determines whether to run healthchecks for a tunnel.`,default:!0}).option(`health-check-rate`,{type:`string`,description:"How frequent the health check is run. The default value is `mid`.",choices:[`low`,`mid`,`high`],default:`mid`}).option(`health-check-target-saved`,{type:`string`,description:`The saved health check target. Setting the value to the empty string indicates that the calculated default value will be used.`}).option(`health-check-type`,{type:`string`,description:"The type of healthcheck to run, reply or request. The default value is `reply`.",choices:[`reply`,`request`],default:`reply`}).option(`health-check-direction`,{type:`string`,description:`The direction of the flow of the healthcheck. Either unidirectional, where the probe comes to you via the tunnel and the result comes back to Cloudflare via the open Internet, or bidirectional where both the probe and result come and go via the tunnel.`,choices:[`unidirectional`,`bidirectional`],default:`unidirectional`}).option(`interface-address`,{type:`string`,description:`A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side of the tunnel. Select the subnet from the following private IP space: 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255.`}).option(`interface-address6`,{type:`string`,description:`A 127 bit IPV6 prefix from within the virtual_subnet6 prefix space with the address being the first IP of the subnet and not same as the address of virtual_subnet6. Eg if virtual_subnet6 is 2606:54c1:7:0:a9fe:12d2::/127 , interface_address6 could be 2606:54c1:7:0:a9fe:12d2:1:200/127`}).option(`mtu`,{type:`number`,description:`Maximum Transmission Unit (MTU) in bytes for the GRE tunnel. The minimum value is 576.`,default:1476}).option(`name`,{type:`string`,description:`The name of the tunnel. The name cannot contain spaces or special characters, must be 15 characters or less, and cannot share a name with another GRE tunnel.`}).option(`ttl`,{type:`number`,description:`Time To Live (TTL) in number of hops of the GRE tunnel.`,default:64}).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)`}).check(e=>{if([`bgp-customer-asn`,`bgp-export-filter-id`,`bgp-extra-prefixes`,`bgp-import-filter-id`,`bgp-md5-key`].some(t=>e[t]!==void 0)){let t=[`bgp-customer-asn`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --bgp-* flag is set`)}return!0})}const En={command:`create`,describe:"Creates a new GRE tunnel. Use `?validate_only=true` as an optional query parameter to only run validation without persisting changes.",builder:Tn,handler:async f=>{let m={};if(f[`x-magic-new-hc-target`]!==void 0&&(m[`x-magic-new-hc-target`]=String(f[`x-magic-new-hc-target`])),f.dryRun){c({command:`cf magic-transit gre-tunnels create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/gre_tunnels`,pathParams:{},bodyKind:`json`,body:f.body===void 0?o({automatic_return_routing:f[`automatic-return-routing`],bgp:{customer_asn:f[`bgp-customer-asn`],export_filter_id:u(f[`bgp-export-filter-id`],`bgp-export-filter-id`,`text`),extra_prefixes:f[`bgp-extra-prefixes`],import_filter_id:u(f[`bgp-import-filter-id`],`bgp-import-filter-id`,`text`),md5_key:u(f[`bgp-md5-key`],`bgp-md5-key`,`text`)},cloudflare_gre_endpoint:u(f[`cloudflare-gre-endpoint`],`cloudflare-gre-endpoint`,`text`),customer_gre_endpoint:u(f[`customer-gre-endpoint`],`customer-gre-endpoint`,`text`),description:u(f.description,`description`,`text`),health_check:{enabled:f[`health-check-enabled`],rate:u(f[`health-check-rate`],`health-check-rate`,`text`),target:{saved:u(f[`health-check-target-saved`],`health-check-target-saved`,`text`)},type:u(f[`health-check-type`],`health-check-type`,`text`),direction:u(f[`health-check-direction`],`health-check-direction`,`text`)},interface_address:u(f[`interface-address`],`interface-address`,`text`),interface_address6:u(f[`interface-address6`],`interface-address6`,`text`),mtu:f.mtu,name:u(f.name,`name`,`text`),ttl:f.ttl}):i(f.body)});return}let h=await r(f),g=f.local?d:await e();if(f.accountId=g,f.body){let e=i(f.body);s(await l(`Creating`,async()=>n(h,`POST`,`/accounts/${g}/magic/gre_tunnels`,{body:e,headers:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`});return}f[`cloudflare-gre-endpoint`]===void 0&&(f[`cloudflare-gre-endpoint`]=await p(`cloudflare-gre-endpoint`,`The IP address assigned to the Cloudflare side of the GRE tunnel.`)),f[`customer-gre-endpoint`]===void 0&&(f[`customer-gre-endpoint`]=await p(`customer-gre-endpoint`,`The IP address assigned to the customer side of the GRE tunnel.`)),f[`interface-address`]===void 0&&(f[`interface-address`]=await p(`interface-address`,`A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side of the tunnel. Select the subnet from the following private IP space: 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255.`)),f.name===void 0&&(f.name=await p(`name`,`The name of the tunnel. The name cannot contain spaces or special characters, must be 15 characters or less, and cannot share a name with another GRE tunnel.`));let _={};f[`automatic-return-routing`]!==void 0&&a(_,[`automatic_return_routing`],f[`automatic-return-routing`]),f[`bgp-customer-asn`]!==void 0&&a(_,[`bgp`,`customer_asn`],f[`bgp-customer-asn`]),f[`bgp-export-filter-id`]!==void 0&&a(_,[`bgp`,`export_filter_id`],u(f[`bgp-export-filter-id`],`bgp-export-filter-id`,`text`)),f[`bgp-extra-prefixes`]!==void 0&&a(_,[`bgp`,`extra_prefixes`],f[`bgp-extra-prefixes`]),f[`bgp-import-filter-id`]!==void 0&&a(_,[`bgp`,`import_filter_id`],u(f[`bgp-import-filter-id`],`bgp-import-filter-id`,`text`)),f[`bgp-md5-key`]!==void 0&&a(_,[`bgp`,`md5_key`],u(f[`bgp-md5-key`],`bgp-md5-key`,`text`)),f[`cloudflare-gre-endpoint`]!==void 0&&a(_,[`cloudflare_gre_endpoint`],u(f[`cloudflare-gre-endpoint`],`cloudflare-gre-endpoint`,`text`)),f[`customer-gre-endpoint`]!==void 0&&a(_,[`customer_gre_endpoint`],u(f[`customer-gre-endpoint`],`customer-gre-endpoint`,`text`)),f.description!==void 0&&a(_,[`description`],u(f.description,`description`,`text`)),f[`health-check-enabled`]!==void 0&&a(_,[`health_check`,`enabled`],f[`health-check-enabled`]),f[`health-check-rate`]!==void 0&&a(_,[`health_check`,`rate`],u(f[`health-check-rate`],`health-check-rate`,`text`)),f[`health-check-target-saved`]!==void 0&&a(_,[`health_check`,`target`,`saved`],u(f[`health-check-target-saved`],`health-check-target-saved`,`text`)),f[`health-check-type`]!==void 0&&a(_,[`health_check`,`type`],u(f[`health-check-type`],`health-check-type`,`text`)),f[`health-check-direction`]!==void 0&&a(_,[`health_check`,`direction`],u(f[`health-check-direction`],`health-check-direction`,`text`)),f[`interface-address`]!==void 0&&a(_,[`interface_address`],u(f[`interface-address`],`interface-address`,`text`)),f[`interface-address6`]!==void 0&&a(_,[`interface_address6`],u(f[`interface-address6`],`interface-address6`,`text`)),f.mtu!==void 0&&a(_,[`mtu`],f.mtu),f.name!==void 0&&a(_,[`name`],u(f.name,`name`,`text`)),f.ttl!==void 0&&a(_,[`ttl`],f.ttl),s(await l(`Creating`,async()=>n(h,`POST`,`/accounts/${g}/magic/gre_tunnels`,{body:Object.keys(_).length>0?_:void 0,headers:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function Dn(e){return e.positional(`gre-tunnel-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`x-magic-new-hc-target`,{type:`string`,description:`If true, the health check target in the response body will be presented using the new object format. Defaults to false.`}).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 On={command:`delete <gre-tunnel-id>`,describe:"Disables and removes a specific static GRE tunnel. Use `?validate_only=true` as an optional query parameter to only run validation without persisting changes.",builder:Dn,handler:async i=>{let a={};if(i[`x-magic-new-hc-target`]!==void 0&&(a[`x-magic-new-hc-target`]=String(i[`x-magic-new-hc-target`])),i.dryRun){c({command:`cf magic-transit gre-tunnels delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/gre_tunnels/${i[`gre-tunnel-id`]==null?`<gre-tunnel-id>`:encodeURIComponent(String(i[`gre-tunnel-id`]))}`,pathParams:{"gre-tunnel-id":String(i[`gre-tunnel-id`]??``)},bodyKind:`none`});return}let o=await r(i),u=i.local?d:await e();if(i.accountId=u,!await m({force:!!i.force})){process.stderr.write(`Aborted.
34
+ `);return}s(await l(`Deleting`,async()=>n(o,`DELETE`,`/accounts/${u}/magic/gre_tunnels/${encodeURIComponent(String(i[`gre-tunnel-id`]))}`,{headers:Object.keys(a).length>0?a:void 0})),{successLabel:`Deleted`})}};function kn(e){return e.positional(`gre-tunnel-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`x-magic-new-hc-target`,{type:`string`,description:`If true, the health check target in the response body will be presented using the new object format. Defaults to false.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const An={command:`get <gre-tunnel-id>`,describe:`Lists informtion for a specific GRE tunnel.`,builder:kn,handler:async i=>{let a={};if(i[`x-magic-new-hc-target`]!==void 0&&(a[`x-magic-new-hc-target`]=String(i[`x-magic-new-hc-target`])),i.dryRun){c({command:`cf magic-transit gre-tunnels get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/gre_tunnels/${i[`gre-tunnel-id`]==null?`<gre-tunnel-id>`:encodeURIComponent(String(i[`gre-tunnel-id`]))}`,pathParams:{"gre-tunnel-id":String(i[`gre-tunnel-id`]??``)},bodyKind:`none`});return}let o=await r(i),u=i.local?d:await e();i.accountId=u,s(await l(`Loading`,async()=>n(o,`GET`,`/accounts/${u}/magic/gre_tunnels/${encodeURIComponent(String(i[`gre-tunnel-id`]))}`,{headers:Object.keys(a).length>0?a:void 0})),{successLabel:`Loaded`})}};function jn(e){return e.option(`x-magic-new-hc-target`,{type:`string`,description:`If true, the health check target in the response body will be presented using the new object format. Defaults to false.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Mn={command:`list`,describe:`Lists GRE tunnels associated with an account.`,builder:jn,handler:async i=>{let a={};if(i[`x-magic-new-hc-target`]!==void 0&&(a[`x-magic-new-hc-target`]=String(i[`x-magic-new-hc-target`])),i.dryRun){c({command:`cf magic-transit gre-tunnels list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/gre_tunnels`,pathParams:{},bodyKind:`none`});return}let o=await r(i),u=i.local?d:await e();i.accountId=u,s(await l(`Loading`,async()=>n(o,`GET`,`/accounts/${u}/magic/gre_tunnels`,{headers:Object.keys(a).length>0?a:void 0})),{successLabel:`Loaded`})}};function Nn(e){return e.positional(`gre-tunnel-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`x-magic-new-hc-target`,{type:`string`,description:`If true, the health check target in the request and response bodies will be presented using the new object format. Defaults to false.`}).option(`automatic-return-routing`,{type:`boolean`,description:"True if automatic stateful return routing should be enabled for a tunnel, false otherwise. Requires the `coupler_integration` account flag to be enabled; requests setting this to `true` without that flag will be rejected."}).option(`cloudflare-gre-endpoint`,{type:`string`,description:`The IP address assigned to the Cloudflare side of the GRE tunnel.`}).option(`customer-gre-endpoint`,{type:`string`,description:`The IP address assigned to the customer side of the GRE tunnel.`}).option(`description`,{type:`string`,description:`An optional description of the GRE tunnel.`}).option(`health-check-enabled`,{type:`boolean`,description:`Determines whether to run healthchecks for a tunnel.`}).option(`health-check-rate`,{type:`string`,description:"How frequent the health check is run. The default value is `mid`.",choices:[`low`,`mid`,`high`]}).option(`health-check-target-saved`,{type:`string`,description:`The saved health check target. Setting the value to the empty string indicates that the calculated default value will be used.`}).option(`health-check-type`,{type:`string`,description:"The type of healthcheck to run, reply or request. The default value is `reply`.",choices:[`reply`,`request`]}).option(`health-check-direction`,{type:`string`,description:`The direction of the flow of the healthcheck. Either unidirectional, where the probe comes to you via the tunnel and the result comes back to Cloudflare via the open Internet, or bidirectional where both the probe and result come and go via the tunnel.`,choices:[`unidirectional`,`bidirectional`]}).option(`interface-address`,{type:`string`,description:`A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side of the tunnel. Select the subnet from the following private IP space: 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255.`}).option(`interface-address6`,{type:`string`,description:`A 127 bit IPV6 prefix from within the virtual_subnet6 prefix space with the address being the first IP of the subnet and not same as the address of virtual_subnet6. Eg if virtual_subnet6 is 2606:54c1:7:0:a9fe:12d2::/127 , interface_address6 could be 2606:54c1:7:0:a9fe:12d2:1:200/127`}).option(`mtu`,{type:`number`,description:`Maximum Transmission Unit (MTU) in bytes for the GRE tunnel. The minimum value is 576.`}).option(`name`,{type:`string`,description:`The name of the tunnel. The name cannot contain spaces or special characters, must be 15 characters or less, and cannot share a name with another GRE tunnel.`}).option(`ttl`,{type:`number`,description:`Time To Live (TTL) in number of hops of the GRE tunnel.`}).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 Pn={command:`update <gre-tunnel-id>`,describe:"Updates a specific GRE tunnel. Use `?validate_only=true` as an optional query parameter to only run validation without persisting changes.",builder:Nn,handler:async f=>{let m={};if(f[`x-magic-new-hc-target`]!==void 0&&(m[`x-magic-new-hc-target`]=String(f[`x-magic-new-hc-target`])),f.dryRun){c({command:`cf magic-transit gre-tunnels update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/gre_tunnels/${f[`gre-tunnel-id`]==null?`<gre-tunnel-id>`:encodeURIComponent(String(f[`gre-tunnel-id`]))}`,pathParams:{"gre-tunnel-id":String(f[`gre-tunnel-id`]??``)},bodyKind:`json`,body:f.body===void 0?o({automatic_return_routing:f[`automatic-return-routing`],cloudflare_gre_endpoint:u(f[`cloudflare-gre-endpoint`],`cloudflare-gre-endpoint`,`text`),customer_gre_endpoint:u(f[`customer-gre-endpoint`],`customer-gre-endpoint`,`text`),description:u(f.description,`description`,`text`),health_check:{enabled:f[`health-check-enabled`],rate:u(f[`health-check-rate`],`health-check-rate`,`text`),target:{saved:u(f[`health-check-target-saved`],`health-check-target-saved`,`text`)},type:u(f[`health-check-type`],`health-check-type`,`text`),direction:u(f[`health-check-direction`],`health-check-direction`,`text`)},interface_address:u(f[`interface-address`],`interface-address`,`text`),interface_address6:u(f[`interface-address6`],`interface-address6`,`text`),mtu:f.mtu,name:u(f.name,`name`,`text`),ttl:f.ttl}):i(f.body)});return}let h=await r(f),g=f.local?d:await e();if(f.accountId=g,f.body){let e=i(f.body);s(await l(`Updating`,async()=>n(h,`PUT`,`/accounts/${g}/magic/gre_tunnels/${encodeURIComponent(String(f[`gre-tunnel-id`]))}`,{body:e,headers:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated`});return}f[`cloudflare-gre-endpoint`]===void 0&&(f[`cloudflare-gre-endpoint`]=await p(`cloudflare-gre-endpoint`,`The IP address assigned to the Cloudflare side of the GRE tunnel.`)),f[`customer-gre-endpoint`]===void 0&&(f[`customer-gre-endpoint`]=await p(`customer-gre-endpoint`,`The IP address assigned to the customer side of the GRE tunnel.`)),f[`interface-address`]===void 0&&(f[`interface-address`]=await p(`interface-address`,`A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side of the tunnel. Select the subnet from the following private IP space: 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255.`)),f.name===void 0&&(f.name=await p(`name`,`The name of the tunnel. The name cannot contain spaces or special characters, must be 15 characters or less, and cannot share a name with another GRE tunnel.`));let _={};f[`automatic-return-routing`]!==void 0&&a(_,[`automatic_return_routing`],f[`automatic-return-routing`]),f[`cloudflare-gre-endpoint`]!==void 0&&a(_,[`cloudflare_gre_endpoint`],u(f[`cloudflare-gre-endpoint`],`cloudflare-gre-endpoint`,`text`)),f[`customer-gre-endpoint`]!==void 0&&a(_,[`customer_gre_endpoint`],u(f[`customer-gre-endpoint`],`customer-gre-endpoint`,`text`)),f.description!==void 0&&a(_,[`description`],u(f.description,`description`,`text`)),f[`health-check-enabled`]!==void 0&&a(_,[`health_check`,`enabled`],f[`health-check-enabled`]),f[`health-check-rate`]!==void 0&&a(_,[`health_check`,`rate`],u(f[`health-check-rate`],`health-check-rate`,`text`)),f[`health-check-target-saved`]!==void 0&&a(_,[`health_check`,`target`,`saved`],u(f[`health-check-target-saved`],`health-check-target-saved`,`text`)),f[`health-check-type`]!==void 0&&a(_,[`health_check`,`type`],u(f[`health-check-type`],`health-check-type`,`text`)),f[`health-check-direction`]!==void 0&&a(_,[`health_check`,`direction`],u(f[`health-check-direction`],`health-check-direction`,`text`)),f[`interface-address`]!==void 0&&a(_,[`interface_address`],u(f[`interface-address`],`interface-address`,`text`)),f[`interface-address6`]!==void 0&&a(_,[`interface_address6`],u(f[`interface-address6`],`interface-address6`,`text`)),f.mtu!==void 0&&a(_,[`mtu`],f.mtu),f.name!==void 0&&a(_,[`name`],u(f.name,`name`,`text`)),f.ttl!==void 0&&a(_,[`ttl`],f.ttl),s(await l(`Updating`,async()=>n(h,`PUT`,`/accounts/${g}/magic/gre_tunnels/${encodeURIComponent(String(f[`gre-tunnel-id`]))}`,{body:Object.keys(_).length>0?_:void 0,headers:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated`})}},Fn={command:`gre-tunnels`,describe:`Operations for gre-tunnels`,builder:e=>e.command(wn).command(En).command(On).command(An).command(Mn).command(Pn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function In(e){return e.option(`x-magic-new-hc-target`,{type:`string`,description:`If true, the health check target in the request and response bodies will be presented using the new object format. Defaults to false.`}).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 Ln={command:`bulk-update`,describe:"Update multiple IPsec tunnels associated with an account. Use `?validate_only=true` as an optional query parameter to only run validation without persisting changes.",builder:In,handler:async a=>{let o={};if(a[`x-magic-new-hc-target`]!==void 0&&(o[`x-magic-new-hc-target`]=String(a[`x-magic-new-hc-target`])),a.dryRun){c({command:`cf magic-transit ipsec-tunnels bulk-update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/ipsec_tunnels`,pathParams:{},bodyKind:`json`,body:a.body===void 0?void 0:i(a.body)});return}let u=await r(a),f=a.local?d:await e();if(a.accountId=f,a.body){let e=i(a.body);s(await l(`Updating`,async()=>n(u,`PUT`,`/accounts/${f}/magic/ipsec_tunnels`,{body:e,headers:Object.keys(o).length>0?o:void 0})),{successLabel:`Updated`});return}s(await l(`Updating`,async()=>n(u,`PUT`,`/accounts/${f}/magic/ipsec_tunnels`,{headers:Object.keys(o).length>0?o:void 0})),{successLabel:`Updated`})}};function Rn(e){return e.option(`x-magic-new-hc-target`,{type:`string`,description:`If true, the health check target in the request and response bodies will be presented using the new object format. Defaults to false.`}).option(`automatic-return-routing`,{type:`boolean`,description:"True if automatic stateful return routing should be enabled for a tunnel, false otherwise. Requires the `coupler_integration` account flag to be enabled; requests setting this to `true` without that flag will be rejected.",default:!1}).option(`bgp-customer-asn`,{type:`number`,description:`ASN used on the customer end of the BGP session`}).option(`bgp-export-filter-id`,{type:`string`,description:`ID of the BGP filter profile applied to routes advertised to the customer.`}).option(`bgp-extra-prefixes`,{type:`string`,array:!0,description:`Prefixes in this list will be advertised to the customer device, in addition to the routes in the Magic routing table.`}).option(`bgp-import-filter-id`,{type:`string`,description:`ID of the BGP filter profile applied to routes received from the customer.`}).option(`bgp-md5-key`,{type:`string`,description:`MD5 key to use for session authentication.
35
+
36
+ Note that *this is not a security measure*. MD5 is not a valid security mechanism, and the
37
+ key is not treated as a secret value. This is *only* supported for preventing
38
+ misconfiguration, not for defending against malicious attacks.
39
+
40
+ The MD5 key, if set, must be of non-zero length and consist only of the following types of
41
+ character:
42
+
43
+ * ASCII alphanumerics: \`[a-zA-Z0-9]\`
44
+ * Special characters in the set \`'!@#$%^&*()+[]{}<>/.,;:_-~\`= \\|\`
45
+
46
+ In other words, MD5 keys may contain any printable ASCII character aside from newline (0x0A),
47
+ quotation mark (\`"\`), vertical tab (0x0B), carriage return (0x0D), tab (0x09), form feed
48
+ (0x0C), and the question mark (\`?\`). Requests specifying an MD5 key with one or more of
49
+ these disallowed characters will be rejected.`}).option(`cloudflare-endpoint`,{type:`string`,description:`The IP address assigned to the Cloudflare side of the IPsec tunnel.`}).option(`custom-remote-identities-fqdn-id`,{type:`string`,description:`A custom IKE ID of type FQDN that may be used to identity the IPsec tunnel. The
50
+ generated IKE IDs can still be used even if this custom value is specified.
51
+
52
+ Must be of the form \`<custom label>.<account ID>.custom.ipsec.cloudflare.com\`.
53
+
54
+ This custom ID does not need to be unique. Two IPsec tunnels may have the same custom
55
+ fqdn_id. However, if another IPsec tunnel has the same value then the two tunnels
56
+ cannot have the same cloudflare_endpoint.`}).option(`customer-endpoint`,{type:`string`,description:`The IP address assigned to the customer side of the IPsec tunnel. Not required, but must be set for proactive traceroutes to work.`}).option(`description`,{type:`string`,description:`An optional description forthe IPsec tunnel.`}).option(`health-check-enabled`,{type:`boolean`,description:`Determines whether to run healthchecks for a tunnel.`,default:!0}).option(`health-check-rate`,{type:`string`,description:"How frequent the health check is run. The default value is `mid`.",choices:[`low`,`mid`,`high`],default:`mid`}).option(`health-check-target-saved`,{type:`string`,description:`The saved health check target. Setting the value to the empty string indicates that the calculated default value will be used.`}).option(`health-check-type`,{type:`string`,description:"The type of healthcheck to run, reply or request. The default value is `reply`.",choices:[`reply`,`request`],default:`reply`}).option(`health-check-direction`,{type:`string`,description:`The direction of the flow of the healthcheck. Either unidirectional, where the probe comes to you via the tunnel and the result comes back to Cloudflare via the open Internet, or bidirectional where both the probe and result come and go via the tunnel.`,choices:[`unidirectional`,`bidirectional`],default:`unidirectional`}).option(`interface-address`,{type:`string`,description:`A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side of the tunnel. Select the subnet from the following private IP space: 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255.`}).option(`interface-address6`,{type:`string`,description:`A 127 bit IPV6 prefix from within the virtual_subnet6 prefix space with the address being the first IP of the subnet and not same as the address of virtual_subnet6. Eg if virtual_subnet6 is 2606:54c1:7:0:a9fe:12d2::/127 , interface_address6 could be 2606:54c1:7:0:a9fe:12d2:1:200/127`}).option(`name`,{type:`string`,description:`The name of the IPsec tunnel. The name cannot share a name with other tunnels.`}).option(`psk`,{type:`string`,description:`A randomly generated or provided string for use in the IPsec tunnel.`}).option(`replay-protection`,{type:`boolean`,description:"If `true`, then IPsec replay protection will be supported in the Cloudflare-to-customer direction.",default:!1}).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)`}).check(e=>{if([`bgp-customer-asn`,`bgp-export-filter-id`,`bgp-extra-prefixes`,`bgp-import-filter-id`,`bgp-md5-key`].some(t=>e[t]!==void 0)){let t=[`bgp-customer-asn`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --bgp-* flag is set`)}return!0})}const zn={command:`create`,describe:"Creates a new IPsec tunnel associated with an account. Use `?validate_only=true` as an optional query parameter to only run validation without persisting changes.",builder:Rn,handler:async f=>{let m={};if(f[`x-magic-new-hc-target`]!==void 0&&(m[`x-magic-new-hc-target`]=String(f[`x-magic-new-hc-target`])),f.dryRun){c({command:`cf magic-transit ipsec-tunnels create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/ipsec_tunnels`,pathParams:{},bodyKind:`json`,body:f.body===void 0?o({automatic_return_routing:f[`automatic-return-routing`],bgp:{customer_asn:f[`bgp-customer-asn`],export_filter_id:u(f[`bgp-export-filter-id`],`bgp-export-filter-id`,`text`),extra_prefixes:f[`bgp-extra-prefixes`],import_filter_id:u(f[`bgp-import-filter-id`],`bgp-import-filter-id`,`text`),md5_key:u(f[`bgp-md5-key`],`bgp-md5-key`,`text`)},cloudflare_endpoint:u(f[`cloudflare-endpoint`],`cloudflare-endpoint`,`text`),custom_remote_identities:{fqdn_id:u(f[`custom-remote-identities-fqdn-id`],`custom-remote-identities-fqdn-id`,`text`)},customer_endpoint:u(f[`customer-endpoint`],`customer-endpoint`,`text`),description:u(f.description,`description`,`text`),health_check:{enabled:f[`health-check-enabled`],rate:u(f[`health-check-rate`],`health-check-rate`,`text`),target:{saved:u(f[`health-check-target-saved`],`health-check-target-saved`,`text`)},type:u(f[`health-check-type`],`health-check-type`,`text`),direction:u(f[`health-check-direction`],`health-check-direction`,`text`)},interface_address:u(f[`interface-address`],`interface-address`,`text`),interface_address6:u(f[`interface-address6`],`interface-address6`,`text`),name:u(f.name,`name`,`text`),psk:u(f.psk,`psk`,`text`),replay_protection:f[`replay-protection`]}):i(f.body)});return}let h=await r(f),g=f.local?d:await e();if(f.accountId=g,f.body){let e=i(f.body);s(await l(`Creating`,async()=>n(h,`POST`,`/accounts/${g}/magic/ipsec_tunnels`,{body:e,headers:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`});return}f[`cloudflare-endpoint`]===void 0&&(f[`cloudflare-endpoint`]=await p(`cloudflare-endpoint`,`The IP address assigned to the Cloudflare side of the IPsec tunnel.`)),f[`interface-address`]===void 0&&(f[`interface-address`]=await p(`interface-address`,`A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side of the tunnel. Select the subnet from the following private IP space: 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255.`)),f.name===void 0&&(f.name=await p(`name`,`The name of the IPsec tunnel. The name cannot share a name with other tunnels.`));let _={};f[`automatic-return-routing`]!==void 0&&a(_,[`automatic_return_routing`],f[`automatic-return-routing`]),f[`bgp-customer-asn`]!==void 0&&a(_,[`bgp`,`customer_asn`],f[`bgp-customer-asn`]),f[`bgp-export-filter-id`]!==void 0&&a(_,[`bgp`,`export_filter_id`],u(f[`bgp-export-filter-id`],`bgp-export-filter-id`,`text`)),f[`bgp-extra-prefixes`]!==void 0&&a(_,[`bgp`,`extra_prefixes`],f[`bgp-extra-prefixes`]),f[`bgp-import-filter-id`]!==void 0&&a(_,[`bgp`,`import_filter_id`],u(f[`bgp-import-filter-id`],`bgp-import-filter-id`,`text`)),f[`bgp-md5-key`]!==void 0&&a(_,[`bgp`,`md5_key`],u(f[`bgp-md5-key`],`bgp-md5-key`,`text`)),f[`cloudflare-endpoint`]!==void 0&&a(_,[`cloudflare_endpoint`],u(f[`cloudflare-endpoint`],`cloudflare-endpoint`,`text`)),f[`custom-remote-identities-fqdn-id`]!==void 0&&a(_,[`custom_remote_identities`,`fqdn_id`],u(f[`custom-remote-identities-fqdn-id`],`custom-remote-identities-fqdn-id`,`text`)),f[`customer-endpoint`]!==void 0&&a(_,[`customer_endpoint`],u(f[`customer-endpoint`],`customer-endpoint`,`text`)),f.description!==void 0&&a(_,[`description`],u(f.description,`description`,`text`)),f[`health-check-enabled`]!==void 0&&a(_,[`health_check`,`enabled`],f[`health-check-enabled`]),f[`health-check-rate`]!==void 0&&a(_,[`health_check`,`rate`],u(f[`health-check-rate`],`health-check-rate`,`text`)),f[`health-check-target-saved`]!==void 0&&a(_,[`health_check`,`target`,`saved`],u(f[`health-check-target-saved`],`health-check-target-saved`,`text`)),f[`health-check-type`]!==void 0&&a(_,[`health_check`,`type`],u(f[`health-check-type`],`health-check-type`,`text`)),f[`health-check-direction`]!==void 0&&a(_,[`health_check`,`direction`],u(f[`health-check-direction`],`health-check-direction`,`text`)),f[`interface-address`]!==void 0&&a(_,[`interface_address`],u(f[`interface-address`],`interface-address`,`text`)),f[`interface-address6`]!==void 0&&a(_,[`interface_address6`],u(f[`interface-address6`],`interface-address6`,`text`)),f.name!==void 0&&a(_,[`name`],u(f.name,`name`,`text`)),f.psk!==void 0&&a(_,[`psk`],u(f.psk,`psk`,`text`)),f[`replay-protection`]!==void 0&&a(_,[`replay_protection`],f[`replay-protection`]),s(await l(`Creating`,async()=>n(h,`POST`,`/accounts/${g}/magic/ipsec_tunnels`,{body:Object.keys(_).length>0?_:void 0,headers:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function Bn(e){return e.positional(`ipsec-tunnel-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`x-magic-new-hc-target`,{type:`string`,description:`If true, the health check target in the response body will be presented using the new object format. Defaults to false.`}).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 Vn={command:`delete <ipsec-tunnel-id>`,describe:"Disables and removes a specific static IPsec Tunnel associated with an account. Use `?validate_only=true` as an optional query parameter to only run validation without persisting changes.",builder:Bn,handler:async i=>{let a={};if(i[`x-magic-new-hc-target`]!==void 0&&(a[`x-magic-new-hc-target`]=String(i[`x-magic-new-hc-target`])),i.dryRun){c({command:`cf magic-transit ipsec-tunnels delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/ipsec_tunnels/${i[`ipsec-tunnel-id`]==null?`<ipsec-tunnel-id>`:encodeURIComponent(String(i[`ipsec-tunnel-id`]))}`,pathParams:{"ipsec-tunnel-id":String(i[`ipsec-tunnel-id`]??``)},bodyKind:`none`});return}let o=await r(i),u=i.local?d:await e();if(i.accountId=u,!await m({force:!!i.force})){process.stderr.write(`Aborted.
57
+ `);return}s(await l(`Deleting`,async()=>n(o,`DELETE`,`/accounts/${u}/magic/ipsec_tunnels/${encodeURIComponent(String(i[`ipsec-tunnel-id`]))}`,{headers:Object.keys(a).length>0?a:void 0})),{successLabel:`Deleted`})}};function Hn(e){return e.positional(`ipsec-tunnel-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`x-magic-new-hc-target`,{type:`string`,description:`If true, the health check target in the response body will be presented using the new object format. Defaults to false.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Un={command:`get <ipsec-tunnel-id>`,describe:`Lists details for a specific IPsec tunnel.`,builder:Hn,handler:async i=>{let a={};if(i[`x-magic-new-hc-target`]!==void 0&&(a[`x-magic-new-hc-target`]=String(i[`x-magic-new-hc-target`])),i.dryRun){c({command:`cf magic-transit ipsec-tunnels get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/ipsec_tunnels/${i[`ipsec-tunnel-id`]==null?`<ipsec-tunnel-id>`:encodeURIComponent(String(i[`ipsec-tunnel-id`]))}`,pathParams:{"ipsec-tunnel-id":String(i[`ipsec-tunnel-id`]??``)},bodyKind:`none`});return}let o=await r(i),u=i.local?d:await e();i.accountId=u,s(await l(`Loading`,async()=>n(o,`GET`,`/accounts/${u}/magic/ipsec_tunnels/${encodeURIComponent(String(i[`ipsec-tunnel-id`]))}`,{headers:Object.keys(a).length>0?a:void 0})),{successLabel:`Loaded`})}};function Wn(e){return e.option(`x-magic-new-hc-target`,{type:`string`,description:`If true, the health check target in the response body will be presented using the new object format. Defaults to false.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Gn={command:`list`,describe:`Lists IPsec tunnels associated with an account.`,builder:Wn,handler:async i=>{let a={};if(i[`x-magic-new-hc-target`]!==void 0&&(a[`x-magic-new-hc-target`]=String(i[`x-magic-new-hc-target`])),i.dryRun){c({command:`cf magic-transit ipsec-tunnels list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/ipsec_tunnels`,pathParams:{},bodyKind:`none`});return}let o=await r(i),u=i.local?d:await e();i.accountId=u,s(await l(`Loading`,async()=>n(o,`GET`,`/accounts/${u}/magic/ipsec_tunnels`,{headers:Object.keys(a).length>0?a:void 0})),{successLabel:`Loaded`})}};function Kn(e){return e.positional(`ipsec-tunnel-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const qn={command:`psk-generate <ipsec-tunnel-id>`,describe:"Generates a Pre-Shared Key for a specific IPsec tunnel used in the IKE session. Use `?validate_only=true` as an optional query parameter to only run validation without persisting changes. After a PSK is generated, the PSK is immediately persisted to Cloudflare's edge and cannot be retrieved later. Store the PSK in a safe place.",builder:Kn,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit ipsec-tunnels psk-generate`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/ipsec_tunnels/${n[`ipsec-tunnel-id`]==null?`<ipsec-tunnel-id>`:encodeURIComponent(String(n[`ipsec-tunnel-id`]))}/psk_generate`,pathParams:{"ipsec-tunnel-id":String(n[`ipsec-tunnel-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,s(await l(`Creating`,async()=>i.magicTransit.ipsecTunnels.pskGenerate({account_id:a,ipsec_tunnel_id:n[`ipsec-tunnel-id`]})),{successLabel:`Created`})}};function Jn(e){return e.positional(`ipsec-tunnel-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`x-magic-new-hc-target`,{type:`string`,description:`If true, the health check target in the request and response bodies will be presented using the new object format. Defaults to false.`}).option(`automatic-return-routing`,{type:`boolean`,description:"True if automatic stateful return routing should be enabled for a tunnel, false otherwise. Requires the `coupler_integration` account flag to be enabled; requests setting this to `true` without that flag will be rejected."}).option(`bgp-customer-asn`,{type:`number`,description:`ASN used on the customer end of the BGP session`}).option(`bgp-export-filter-id`,{type:`string`,description:`ID of the BGP filter profile applied to routes advertised to the customer.`}).option(`bgp-extra-prefixes`,{type:`string`,array:!0,description:`Prefixes in this list will be advertised to the customer device, in addition to the routes in the Magic routing table.`}).option(`bgp-import-filter-id`,{type:`string`,description:`ID of the BGP filter profile applied to routes received from the customer.`}).option(`bgp-md5-key`,{type:`string`,description:`MD5 key to use for session authentication.
58
+
59
+ Note that *this is not a security measure*. MD5 is not a valid security mechanism, and the
60
+ key is not treated as a secret value. This is *only* supported for preventing
61
+ misconfiguration, not for defending against malicious attacks.
62
+
63
+ The MD5 key, if set, must be of non-zero length and consist only of the following types of
64
+ character:
65
+
66
+ * ASCII alphanumerics: \`[a-zA-Z0-9]\`
67
+ * Special characters in the set \`'!@#$%^&*()+[]{}<>/.,;:_-~\`= \\|\`
68
+
69
+ In other words, MD5 keys may contain any printable ASCII character aside from newline (0x0A),
70
+ quotation mark (\`"\`), vertical tab (0x0B), carriage return (0x0D), tab (0x09), form feed
71
+ (0x0C), and the question mark (\`?\`). Requests specifying an MD5 key with one or more of
72
+ these disallowed characters will be rejected.`}).option(`cloudflare-endpoint`,{type:`string`,description:`The IP address assigned to the Cloudflare side of the IPsec tunnel.`}).option(`custom-remote-identities-fqdn-id`,{type:`string`,description:`A custom IKE ID of type FQDN that may be used to identity the IPsec tunnel. The
73
+ generated IKE IDs can still be used even if this custom value is specified.
74
+
75
+ Must be of the form \`<custom label>.<account ID>.custom.ipsec.cloudflare.com\`.
76
+
77
+ This custom ID does not need to be unique. Two IPsec tunnels may have the same custom
78
+ fqdn_id. However, if another IPsec tunnel has the same value then the two tunnels
79
+ cannot have the same cloudflare_endpoint.`}).option(`customer-endpoint`,{type:`string`,description:`The IP address assigned to the customer side of the IPsec tunnel. Not required, but must be set for proactive traceroutes to work.`}).option(`description`,{type:`string`,description:`An optional description forthe IPsec tunnel.`}).option(`health-check-enabled`,{type:`boolean`,description:`Determines whether to run healthchecks for a tunnel.`}).option(`health-check-rate`,{type:`string`,description:"How frequent the health check is run. The default value is `mid`.",choices:[`low`,`mid`,`high`]}).option(`health-check-target-saved`,{type:`string`,description:`The saved health check target. Setting the value to the empty string indicates that the calculated default value will be used.`}).option(`health-check-type`,{type:`string`,description:"The type of healthcheck to run, reply or request. The default value is `reply`.",choices:[`reply`,`request`]}).option(`health-check-direction`,{type:`string`,description:`The direction of the flow of the healthcheck. Either unidirectional, where the probe comes to you via the tunnel and the result comes back to Cloudflare via the open Internet, or bidirectional where both the probe and result come and go via the tunnel.`,choices:[`unidirectional`,`bidirectional`]}).option(`interface-address`,{type:`string`,description:`A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side of the tunnel. Select the subnet from the following private IP space: 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255.`}).option(`interface-address6`,{type:`string`,description:`A 127 bit IPV6 prefix from within the virtual_subnet6 prefix space with the address being the first IP of the subnet and not same as the address of virtual_subnet6. Eg if virtual_subnet6 is 2606:54c1:7:0:a9fe:12d2::/127 , interface_address6 could be 2606:54c1:7:0:a9fe:12d2:1:200/127`}).option(`name`,{type:`string`,description:`The name of the IPsec tunnel. The name cannot share a name with other tunnels.`}).option(`psk`,{type:`string`,description:`A randomly generated or provided string for use in the IPsec tunnel.`}).option(`replay-protection`,{type:`boolean`,description:"If `true`, then IPsec replay protection will be supported in the Cloudflare-to-customer direction."}).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)`}).check(e=>{if([`bgp-customer-asn`,`bgp-export-filter-id`,`bgp-extra-prefixes`,`bgp-import-filter-id`,`bgp-md5-key`].some(t=>e[t]!==void 0)){let t=[`bgp-customer-asn`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --bgp-* flag is set`)}return!0})}const Yn={command:`update <ipsec-tunnel-id>`,describe:"Updates a specific IPsec tunnel associated with an account. Use `?validate_only=true` as an optional query parameter to only run validation without persisting changes.",builder:Jn,handler:async f=>{let m={};if(f[`x-magic-new-hc-target`]!==void 0&&(m[`x-magic-new-hc-target`]=String(f[`x-magic-new-hc-target`])),f.dryRun){c({command:`cf magic-transit ipsec-tunnels update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/ipsec_tunnels/${f[`ipsec-tunnel-id`]==null?`<ipsec-tunnel-id>`:encodeURIComponent(String(f[`ipsec-tunnel-id`]))}`,pathParams:{"ipsec-tunnel-id":String(f[`ipsec-tunnel-id`]??``)},bodyKind:`json`,body:f.body===void 0?o({automatic_return_routing:f[`automatic-return-routing`],bgp:{customer_asn:f[`bgp-customer-asn`],export_filter_id:u(f[`bgp-export-filter-id`],`bgp-export-filter-id`,`text`),extra_prefixes:f[`bgp-extra-prefixes`],import_filter_id:u(f[`bgp-import-filter-id`],`bgp-import-filter-id`,`text`),md5_key:u(f[`bgp-md5-key`],`bgp-md5-key`,`text`)},cloudflare_endpoint:u(f[`cloudflare-endpoint`],`cloudflare-endpoint`,`text`),custom_remote_identities:{fqdn_id:u(f[`custom-remote-identities-fqdn-id`],`custom-remote-identities-fqdn-id`,`text`)},customer_endpoint:u(f[`customer-endpoint`],`customer-endpoint`,`text`),description:u(f.description,`description`,`text`),health_check:{enabled:f[`health-check-enabled`],rate:u(f[`health-check-rate`],`health-check-rate`,`text`),target:{saved:u(f[`health-check-target-saved`],`health-check-target-saved`,`text`)},type:u(f[`health-check-type`],`health-check-type`,`text`),direction:u(f[`health-check-direction`],`health-check-direction`,`text`)},interface_address:u(f[`interface-address`],`interface-address`,`text`),interface_address6:u(f[`interface-address6`],`interface-address6`,`text`),name:u(f.name,`name`,`text`),psk:u(f.psk,`psk`,`text`),replay_protection:f[`replay-protection`]}):i(f.body)});return}let h=await r(f),g=f.local?d:await e();if(f.accountId=g,f.body){let e=i(f.body);s(await l(`Updating`,async()=>n(h,`PUT`,`/accounts/${g}/magic/ipsec_tunnels/${encodeURIComponent(String(f[`ipsec-tunnel-id`]))}`,{body:e,headers:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated`});return}f[`cloudflare-endpoint`]===void 0&&(f[`cloudflare-endpoint`]=await p(`cloudflare-endpoint`,`The IP address assigned to the Cloudflare side of the IPsec tunnel.`)),f[`interface-address`]===void 0&&(f[`interface-address`]=await p(`interface-address`,`A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side of the tunnel. Select the subnet from the following private IP space: 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255.`)),f.name===void 0&&(f.name=await p(`name`,`The name of the IPsec tunnel. The name cannot share a name with other tunnels.`));let _={};f[`automatic-return-routing`]!==void 0&&a(_,[`automatic_return_routing`],f[`automatic-return-routing`]),f[`bgp-customer-asn`]!==void 0&&a(_,[`bgp`,`customer_asn`],f[`bgp-customer-asn`]),f[`bgp-export-filter-id`]!==void 0&&a(_,[`bgp`,`export_filter_id`],u(f[`bgp-export-filter-id`],`bgp-export-filter-id`,`text`)),f[`bgp-extra-prefixes`]!==void 0&&a(_,[`bgp`,`extra_prefixes`],f[`bgp-extra-prefixes`]),f[`bgp-import-filter-id`]!==void 0&&a(_,[`bgp`,`import_filter_id`],u(f[`bgp-import-filter-id`],`bgp-import-filter-id`,`text`)),f[`bgp-md5-key`]!==void 0&&a(_,[`bgp`,`md5_key`],u(f[`bgp-md5-key`],`bgp-md5-key`,`text`)),f[`cloudflare-endpoint`]!==void 0&&a(_,[`cloudflare_endpoint`],u(f[`cloudflare-endpoint`],`cloudflare-endpoint`,`text`)),f[`custom-remote-identities-fqdn-id`]!==void 0&&a(_,[`custom_remote_identities`,`fqdn_id`],u(f[`custom-remote-identities-fqdn-id`],`custom-remote-identities-fqdn-id`,`text`)),f[`customer-endpoint`]!==void 0&&a(_,[`customer_endpoint`],u(f[`customer-endpoint`],`customer-endpoint`,`text`)),f.description!==void 0&&a(_,[`description`],u(f.description,`description`,`text`)),f[`health-check-enabled`]!==void 0&&a(_,[`health_check`,`enabled`],f[`health-check-enabled`]),f[`health-check-rate`]!==void 0&&a(_,[`health_check`,`rate`],u(f[`health-check-rate`],`health-check-rate`,`text`)),f[`health-check-target-saved`]!==void 0&&a(_,[`health_check`,`target`,`saved`],u(f[`health-check-target-saved`],`health-check-target-saved`,`text`)),f[`health-check-type`]!==void 0&&a(_,[`health_check`,`type`],u(f[`health-check-type`],`health-check-type`,`text`)),f[`health-check-direction`]!==void 0&&a(_,[`health_check`,`direction`],u(f[`health-check-direction`],`health-check-direction`,`text`)),f[`interface-address`]!==void 0&&a(_,[`interface_address`],u(f[`interface-address`],`interface-address`,`text`)),f[`interface-address6`]!==void 0&&a(_,[`interface_address6`],u(f[`interface-address6`],`interface-address6`,`text`)),f.name!==void 0&&a(_,[`name`],u(f.name,`name`,`text`)),f.psk!==void 0&&a(_,[`psk`],u(f.psk,`psk`,`text`)),f[`replay-protection`]!==void 0&&a(_,[`replay_protection`],f[`replay-protection`]),s(await l(`Updating`,async()=>n(h,`PUT`,`/accounts/${g}/magic/ipsec_tunnels/${encodeURIComponent(String(f[`ipsec-tunnel-id`]))}`,{body:Object.keys(_).length>0?_:void 0,headers:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated`})}},Xn={command:`ipsec-tunnels`,describe:`Operations for ipsec-tunnels`,builder:e=>e.command(Ln).command(zn).command(Vn).command(Un).command(Gn).command(qn).command(Yn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Zn(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 Qn={command:`create`,describe:`Create new PCAP request for account.`,builder:Zn,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit pcaps create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/pcaps`,pathParams:{},bodyKind:`json`,body:n.body===void 0?void 0:i(n.body)});return}let a=await r(n),o=n.local?d:await e();if(n.accountId=o,n.body){let e=i(n.body);s(await l(`Creating`,async()=>a.magicTransit.pcaps.create({body:e,account_id:o})),{successLabel:`Created`});return}if(n.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function $n(e){return e.positional(`pcap-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`text`,{type:`boolean`,description:`Decode the response body as UTF-8 text instead of writing raw bytes`,default:!1})}const er={command:`get <pcap-id>`,describe:`Download PCAP information into a file. Response is a binary PCAP file.`,builder:$n,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit pcaps download get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/pcaps/${n[`pcap-id`]==null?`<pcap-id>`:encodeURIComponent(String(n[`pcap-id`]))}/download`,pathParams:{"pcap-id":String(n[`pcap-id`]??``)},bodyKind:`none`});return}await r(n);let i=n.local?d:await e();n.accountId=i;let a=await l(`Loading`,async()=>g(`/accounts/${i}/pcaps/${encodeURIComponent(String(n[`pcap-id`]))}/download`,{method:`GET`,localEndpoint:n.local?n.localEndpoint:void 0}));h(n.text===!0?a.toString(`utf-8`):a)}},tr={command:`download`,describe:`Packet capture requests for debugging traffic flowing through Magic Transit tunnels`,builder:e=>e.command(er).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function nr(e){return e.positional(`pcap-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const rr={command:`get <pcap-id>`,describe:`Get information for a PCAP request by id.`,builder:nr,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit pcaps get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/pcaps/${n[`pcap-id`]==null?`<pcap-id>`:encodeURIComponent(String(n[`pcap-id`]))}`,pathParams:{"pcap-id":String(n[`pcap-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,s(await l(`Loading`,async()=>i.magicTransit.pcaps.get({account_id:a,pcap_id:n[`pcap-id`]})),{successLabel:`Loaded`})}};function ir(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ar={command:`list`,describe:`Lists all packet capture requests for an account.`,builder:ir,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit pcaps list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/pcaps`,pathParams:{},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,s(await l(`Loading`,async()=>i.magicTransit.pcaps.list({account_id:a})),{successLabel:`Loaded`})}};function or(e){return e.option(`destination-conf`,{type:`string`,description:"The full URI for the bucket. This field only applies to `full` packet captures."}).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 sr={command:`create`,describe:`Adds an AWS or GCP bucket to use with full packet captures.`,builder:or,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit pcaps ownership create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/pcaps/ownership`,pathParams:{},bodyKind:`json`,body:n.body===void 0?o({destination_conf:u(n[`destination-conf`],`destination-conf`,`text`)}):i(n.body)});return}let a=await r(n),f=n.local?d:await e();if(n.accountId=f,n.body){let e=i(n.body);s(await l(`Creating`,async()=>a.magicTransit.pcaps.ownership.create({...e,account_id:f})),{successLabel:`Created`});return}n[`destination-conf`]===void 0&&(n[`destination-conf`]=await p(`destination-conf`,"The full URI for the bucket. This field only applies to `full` packet captures."));let m=o({destination_conf:u(n[`destination-conf`],`destination-conf`,`text`)});s(await l(`Creating`,async()=>a.magicTransit.pcaps.ownership.create({...m,account_id:f})),{successLabel:`Created`})}};function cr(e){return e.positional(`ownership-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 lr={command:`delete <ownership-id>`,describe:`Deletes buckets added to the packet captures API.`,builder:cr,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit pcaps ownership delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/pcaps/ownership/${n[`ownership-id`]==null?`<ownership-id>`:encodeURIComponent(String(n[`ownership-id`]))}`,pathParams:{"ownership-id":String(n[`ownership-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();if(n.accountId=a,!await m({force:!!n.force})){process.stderr.write(`Aborted.
80
+ `);return}s(await l(`Deleting`,async()=>i.magicTransit.pcaps.ownership.delete({account_id:a,ownership_id:n[`ownership-id`]})),{successLabel:`Deleted`})}};function ur(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const dr={command:`get`,describe:`List all buckets configured for use with PCAPs API.`,builder:ur,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit pcaps ownership get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/pcaps/ownership`,pathParams:{},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,s(await l(`Loading`,async()=>i.magicTransit.pcaps.ownership.get({account_id:a})),{successLabel:`Loaded`})}};function fr(e){return e.option(`destination-conf`,{type:`string`,description:"The full URI for the bucket. This field only applies to `full` packet captures."}).option(`ownership-challenge`,{type:`string`,description:`The ownership challenge filename stored in the bucket.`}).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 pr={command:`validate`,describe:`Validates buckets added to the packet captures API.`,builder:fr,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit pcaps ownership validate`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/pcaps/ownership/validate`,pathParams:{},bodyKind:`json`,body:n.body===void 0?o({destination_conf:u(n[`destination-conf`],`destination-conf`,`text`),ownership_challenge:u(n[`ownership-challenge`],`ownership-challenge`,`text`)}):i(n.body)});return}let a=await r(n),f=n.local?d:await e();if(n.accountId=f,n.body){let e=i(n.body);s(await l(`Creating`,async()=>a.magicTransit.pcaps.ownership.validate({...e,account_id:f})),{successLabel:`Created`});return}n[`destination-conf`]===void 0&&(n[`destination-conf`]=await p(`destination-conf`,"The full URI for the bucket. This field only applies to `full` packet captures.")),n[`ownership-challenge`]===void 0&&(n[`ownership-challenge`]=await p(`ownership-challenge`,`The ownership challenge filename stored in the bucket.`));let m=o({destination_conf:u(n[`destination-conf`],`destination-conf`,`text`),ownership_challenge:u(n[`ownership-challenge`],`ownership-challenge`,`text`)});s(await l(`Creating`,async()=>a.magicTransit.pcaps.ownership.validate({...m,account_id:f})),{successLabel:`Created`})}},mr={command:`ownership`,describe:`Packet capture requests for debugging traffic flowing through Magic Transit tunnels`,builder:e=>e.command(sr).command(lr).command(dr).command(pr).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function hr(e){return e.positional(`pcap-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 gr={command:`stop <pcap-id>`,describe:`Stop full PCAP.`,builder:hr,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit pcaps stop`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/pcaps/${n[`pcap-id`]==null?`<pcap-id>`:encodeURIComponent(String(n[`pcap-id`]))}/stop`,pathParams:{"pcap-id":String(n[`pcap-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();if(n.accountId=a,!await m({force:!!n.force,message:`This operation halts an in-progress full packet capture. Any unsaved capture data will be lost.`})){process.stderr.write(`Aborted.
81
+ `);return}s(await l(`Deleting`,async()=>i.magicTransit.pcaps.stop({account_id:a,pcap_id:n[`pcap-id`]})),{successLabel:`Deleted`})}},_r={command:`pcaps`,describe:`Packet capture requests for debugging traffic flowing through Magic Transit tunnels`,builder:e=>e.command(Qn).command(rr).command(ar).command(gr).command(tr).command(mr).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function vr(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 yr={command:`bulk-update`,describe:"Update multiple Magic static routes. Use `?validate_only=true` as an optional query parameter to run validation only without persisting changes. Only fields for a route that need to be changed need be provided.",builder:vr,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit routes bulk-update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/routes`,pathParams:{},bodyKind:`json`,body:n.body===void 0?void 0:i(n.body)});return}let a=await r(n),o=n.local?d:await e();if(n.accountId=o,n.body){let e=i(n.body);s(await l(`Updating`,async()=>a.magicTransit.routes.bulkUpdate({...e,account_id:o})),{successLabel:`Updated`});return}if(n.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function br(e){return e.option(`description`,{type:`string`,description:`An optional human provided description of the static route.`}).option(`nexthop`,{type:`string`,description:`The next-hop IP Address for the static route.`}).option(`prefix`,{type:`string`,description:`IP Prefix in Classless Inter-Domain Routing format.`}).option(`priority`,{type:`number`,description:`Priority of the static route.`}).option(`scope-colo-names`,{type:`string`,array:!0,description:`List of colo names for the ECMP scope.`}).option(`scope-colo-regions`,{type:`string`,array:!0,description:`List of colo regions for the ECMP scope.`}).option(`weight`,{type:`number`,description:`Optional weight of the ECMP scope - if provided.`}).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 xr={command:`create`,describe:"Creates a new Magic static route. Use `?validate_only=true` as an optional query parameter to run validation only without persisting changes.",builder:br,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit routes create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/routes`,pathParams:{},bodyKind:`json`,body:n.body===void 0?o({description:u(n.description,`description`,`text`),nexthop:u(n.nexthop,`nexthop`,`text`),prefix:u(n.prefix,`prefix`,`text`),priority:n.priority,scope:{colo_names:n[`scope-colo-names`],colo_regions:n[`scope-colo-regions`]},weight:n.weight}):i(n.body)});return}let a=await r(n),f=n.local?d:await e();if(n.accountId=f,n.body){let e=i(n.body);s(await l(`Creating`,async()=>a.magicTransit.routes.create({...e,account_id:f})),{successLabel:`Created`});return}if(n.nexthop===void 0&&(n.nexthop=await p(`nexthop`,`The next-hop IP Address for the static route.`)),n.prefix===void 0&&(n.prefix=await p(`prefix`,`IP Prefix in Classless Inter-Domain Routing format.`)),n.priority===void 0)throw Error(`--priority is required (or pass --body with this field set).`);let m=o({description:u(n.description,`description`,`text`),nexthop:u(n.nexthop,`nexthop`,`text`),prefix:u(n.prefix,`prefix`,`text`),priority:n.priority,scope:{colo_names:n[`scope-colo-names`],colo_regions:n[`scope-colo-regions`]},weight:n.weight});s(await l(`Creating`,async()=>a.magicTransit.routes.create({...m,account_id:f})),{successLabel:`Created`})}};function Sr(e){return e.positional(`route-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 Cr={command:`delete <route-id>`,describe:`Disable and remove a specific Magic static route.`,builder:Sr,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit routes delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/routes/${n[`route-id`]==null?`<route-id>`:encodeURIComponent(String(n[`route-id`]))}`,pathParams:{"route-id":String(n[`route-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();if(n.accountId=a,!await m({force:!!n.force})){process.stderr.write(`Aborted.
82
+ `);return}s(await l(`Deleting`,async()=>i.magicTransit.routes.delete({account_id:a,route_id:n[`route-id`]})),{successLabel:`Deleted`})}};function wr(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 Tr={command:`empty`,describe:`Delete multiple Magic static routes.`,builder:wr,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit routes empty`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/routes`,pathParams:{},bodyKind:`json`,body:n.body===void 0?void 0:i(n.body)});return}let a=await r(n),o=n.local?d:await e();if(n.accountId=o,!await m({force:!!n.force})){process.stderr.write(`Aborted.
83
+ `);return}if(n.body){let e=i(n.body);s(await l(`Deleting`,async()=>a.magicTransit.routes.empty({...e,account_id:o})),{successLabel:`Deleted`});return}if(n.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function Er(e){return e.positional(`route-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Dr={command:`get <route-id>`,describe:`Get a specific Magic static route.`,builder:Er,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit routes get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/routes/${n[`route-id`]==null?`<route-id>`:encodeURIComponent(String(n[`route-id`]))}`,pathParams:{"route-id":String(n[`route-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,s(await l(`Loading`,async()=>i.magicTransit.routes.get({account_id:a,route_id:n[`route-id`]})),{successLabel:`Loaded`})}};function Or(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const kr={command:`list`,describe:`List all Magic static routes.`,builder:Or,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit routes list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/routes`,pathParams:{},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,s(await l(`Loading`,async()=>i.magicTransit.routes.list({account_id:a})),{successLabel:`Loaded`})}};function Ar(e){return e.positional(`route-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`description`,{type:`string`,description:`An optional human provided description of the static route.`}).option(`nexthop`,{type:`string`,description:`The next-hop IP Address for the static route.`}).option(`prefix`,{type:`string`,description:`IP Prefix in Classless Inter-Domain Routing format.`}).option(`priority`,{type:`number`,description:`Priority of the static route.`}).option(`scope-colo-names`,{type:`string`,array:!0,description:`List of colo names for the ECMP scope.`}).option(`scope-colo-regions`,{type:`string`,array:!0,description:`List of colo regions for the ECMP scope.`}).option(`weight`,{type:`number`,description:`Optional weight of the ECMP scope - if provided.`}).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 jr={command:`update <route-id>`,describe:"Update a specific Magic static route. Use `?validate_only=true` as an optional query parameter to run validation only without persisting changes.",builder:Ar,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit routes update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/routes/${n[`route-id`]==null?`<route-id>`:encodeURIComponent(String(n[`route-id`]))}`,pathParams:{"route-id":String(n[`route-id`]??``)},bodyKind:`json`,body:n.body===void 0?o({description:u(n.description,`description`,`text`),nexthop:u(n.nexthop,`nexthop`,`text`),prefix:u(n.prefix,`prefix`,`text`),priority:n.priority,scope:{colo_names:n[`scope-colo-names`],colo_regions:n[`scope-colo-regions`]},weight:n.weight}):i(n.body)});return}let a=await r(n),f=n.local?d:await e();if(n.accountId=f,n.body){let e=i(n.body);s(await l(`Updating`,async()=>a.magicTransit.routes.update({body:e,account_id:f,route_id:n[`route-id`]})),{successLabel:`Updated`});return}if(n.nexthop===void 0&&(n.nexthop=await p(`nexthop`,`The next-hop IP Address for the static route.`)),n.prefix===void 0&&(n.prefix=await p(`prefix`,`IP Prefix in Classless Inter-Domain Routing format.`)),n.priority===void 0)throw Error(`--priority is required (or pass --body with this field set).`);let m=o({description:u(n.description,`description`,`text`),nexthop:u(n.nexthop,`nexthop`,`text`),prefix:u(n.prefix,`prefix`,`text`),priority:n.priority,scope:{colo_names:n[`scope-colo-names`],colo_regions:n[`scope-colo-regions`]},weight:n.weight});s(await l(`Updating`,async()=>a.magicTransit.routes.update({body:m,account_id:f,route_id:n[`route-id`]})),{successLabel:`Updated`})}},Mr={command:`routes`,describe:`Operations for routes`,builder:e=>e.command(yr).command(xr).command(Cr).command(Tr).command(Dr).command(kr).command(jr).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Nr(e){return e.positional(`site-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`description`,{type:`string`,description:`Description for the ACL.`}).option(`forward-locally`,{type:`boolean`,description:`The desired forwarding action for this ACL policy. If set to "false", the policy will forward traffic to Cloudflare. If set to "true", the policy will forward traffic locally on the Magic Connector. If not included in request, will default to false.`}).option(`lan-1-lan-id`,{type:`string`,description:`The identifier for the LAN you want to create an ACL policy with.`}).option(`lan-1-lan-name`,{type:`string`,description:`The name of the LAN based on the provided lan_id.`}).option(`lan-1-port-ranges`,{type:`string`,array:!0,description:`Array of port ranges on the provided LAN that will be included in the ACL. If no ports or port rangess are provided, communication on any port on this LAN is allowed.`}).option(`lan-1-ports`,{type:`string`,array:!0,description:`Array of ports on the provided LAN that will be included in the ACL. If no ports or port ranges are provided, communication on any port on this LAN is allowed.`}).option(`lan-2-lan-id`,{type:`string`,description:`The identifier for the LAN you want to create an ACL policy with.`}).option(`lan-2-lan-name`,{type:`string`,description:`The name of the LAN based on the provided lan_id.`}).option(`lan-2-port-ranges`,{type:`string`,array:!0,description:`Array of port ranges on the provided LAN that will be included in the ACL. If no ports or port rangess are provided, communication on any port on this LAN is allowed.`}).option(`lan-2-ports`,{type:`string`,array:!0,description:`Array of ports on the provided LAN that will be included in the ACL. If no ports or port ranges are provided, communication on any port on this LAN is allowed.`}).option(`name`,{type:`string`,description:`The name of the ACL.`}).option(`protocols`,{type:`string`,array:!0,description:`The protocols field`}).option(`unidirectional`,{type:`boolean`,description:`The desired traffic direction for this ACL policy. If set to "false", the policy will allow bidirectional traffic. If set to "true", the policy will only allow traffic in one direction. If not included in request, will default to false.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Bidirectional ACL policy for local network traffic within a site.`})}const Pr={command:`create <site-id>`,describe:`Creates a new Site ACL.`,builder:Nr,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit sites acls create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/sites/${n[`site-id`]==null?`<site-id>`:encodeURIComponent(String(n[`site-id`]))}/acls`,pathParams:{"site-id":String(n[`site-id`]??``)},bodyKind:`json`,body:n.body===void 0?o({description:u(n.description,`description`,`text`),forward_locally:n[`forward-locally`],lan_1:{lan_id:u(n[`lan-1-lan-id`],`lan-1-lan-id`,`text`),lan_name:u(n[`lan-1-lan-name`],`lan-1-lan-name`,`text`),port_ranges:n[`lan-1-port-ranges`],ports:n[`lan-1-ports`]},lan_2:{lan_id:u(n[`lan-2-lan-id`],`lan-2-lan-id`,`text`),lan_name:u(n[`lan-2-lan-name`],`lan-2-lan-name`,`text`),port_ranges:n[`lan-2-port-ranges`],ports:n[`lan-2-ports`]},name:u(n.name,`name`,`text`),protocols:n.protocols,unidirectional:n.unidirectional}):i(n.body)});return}let a=await r(n),f=n.local?d:await e();if(n.accountId=f,n.body){let e=i(n.body);s(await l(`Creating`,async()=>a.magicTransit.sites.acls.create({...e,account_id:f,site_id:n[`site-id`]})),{successLabel:`Created`});return}n[`lan-1-lan-id`]===void 0&&(n[`lan-1-lan-id`]=await p(`lan-1-lan-id`,`The identifier for the LAN you want to create an ACL policy with.`)),n[`lan-2-lan-id`]===void 0&&(n[`lan-2-lan-id`]=await p(`lan-2-lan-id`,`The identifier for the LAN you want to create an ACL policy with.`)),n.name===void 0&&(n.name=await p(`name`,`The name of the ACL.`));let m=o({description:u(n.description,`description`,`text`),forward_locally:n[`forward-locally`],lan_1:{lan_id:u(n[`lan-1-lan-id`],`lan-1-lan-id`,`text`),lan_name:u(n[`lan-1-lan-name`],`lan-1-lan-name`,`text`),port_ranges:n[`lan-1-port-ranges`],ports:n[`lan-1-ports`]},lan_2:{lan_id:u(n[`lan-2-lan-id`],`lan-2-lan-id`,`text`),lan_name:u(n[`lan-2-lan-name`],`lan-2-lan-name`,`text`),port_ranges:n[`lan-2-port-ranges`],ports:n[`lan-2-ports`]},name:u(n.name,`name`,`text`),protocols:n.protocols,unidirectional:n.unidirectional});s(await l(`Creating`,async()=>a.magicTransit.sites.acls.create({...m,account_id:f,site_id:n[`site-id`]})),{successLabel:`Created`})}};function Fr(e){return e.positional(`acl-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`site-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 Ir={command:`delete <acl-id>`,describe:`Remove a specific Site ACL.`,builder:Fr,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit sites acls delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/sites/${n[`site-id`]==null?`<site-id>`:encodeURIComponent(String(n[`site-id`]))}/acls/${n[`acl-id`]==null?`<acl-id>`:encodeURIComponent(String(n[`acl-id`]))}`,pathParams:{"site-id":String(n[`site-id`]??``),"acl-id":String(n[`acl-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();if(n.accountId=a,!await m({force:!!n.force})){process.stderr.write(`Aborted.
84
+ `);return}s(await l(`Deleting`,async()=>i.magicTransit.sites.acls.delete({account_id:a,site_id:n[`site-id`],acl_id:n[`acl-id`]})),{successLabel:`Deleted`})}};function Lr(e){return e.positional(`acl-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`site-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`description`,{type:`string`,description:`Description for the ACL.`}).option(`forward-locally`,{type:`boolean`,description:`The desired forwarding action for this ACL policy. If set to "false", the policy will forward traffic to Cloudflare. If set to "true", the policy will forward traffic locally on the Magic Connector. If not included in request, will default to false.`}).option(`lan-1-lan-id`,{type:`string`,description:`The identifier for the LAN you want to create an ACL policy with.`}).option(`lan-1-lan-name`,{type:`string`,description:`The name of the LAN based on the provided lan_id.`}).option(`lan-1-port-ranges`,{type:`string`,array:!0,description:`Array of port ranges on the provided LAN that will be included in the ACL. If no ports or port rangess are provided, communication on any port on this LAN is allowed.`}).option(`lan-1-ports`,{type:`string`,array:!0,description:`Array of ports on the provided LAN that will be included in the ACL. If no ports or port ranges are provided, communication on any port on this LAN is allowed.`}).option(`lan-2-lan-id`,{type:`string`,description:`The identifier for the LAN you want to create an ACL policy with.`}).option(`lan-2-lan-name`,{type:`string`,description:`The name of the LAN based on the provided lan_id.`}).option(`lan-2-port-ranges`,{type:`string`,array:!0,description:`Array of port ranges on the provided LAN that will be included in the ACL. If no ports or port rangess are provided, communication on any port on this LAN is allowed.`}).option(`lan-2-ports`,{type:`string`,array:!0,description:`Array of ports on the provided LAN that will be included in the ACL. If no ports or port ranges are provided, communication on any port on this LAN is allowed.`}).option(`name`,{type:`string`,description:`The name of the ACL.`}).option(`protocols`,{type:`string`,array:!0,description:`The protocols field`}).option(`unidirectional`,{type:`boolean`,description:`The desired traffic direction for this ACL policy. If set to "false", the policy will allow bidirectional traffic. If set to "true", the policy will only allow traffic in one direction. If not included in request, will default to false.`}).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)`}).check(e=>{if([`lan-1-lan-id`,`lan-1-lan-name`,`lan-1-port-ranges`,`lan-1-ports`].some(t=>e[t]!==void 0)){let t=[`lan-1-lan-id`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --lan_1-* flag is set`)}return!0}).check(e=>{if([`lan-2-lan-id`,`lan-2-lan-name`,`lan-2-port-ranges`,`lan-2-ports`].some(t=>e[t]!==void 0)){let t=[`lan-2-lan-id`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --lan_2-* flag is set`)}return!0})}const Rr={command:`edit <acl-id>`,describe:`Patch a specific Site ACL.`,builder:Lr,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit sites acls edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/sites/${n[`site-id`]==null?`<site-id>`:encodeURIComponent(String(n[`site-id`]))}/acls/${n[`acl-id`]==null?`<acl-id>`:encodeURIComponent(String(n[`acl-id`]))}`,pathParams:{"site-id":String(n[`site-id`]??``),"acl-id":String(n[`acl-id`]??``)},bodyKind:`json`,body:n.body===void 0?o({description:u(n.description,`description`,`text`),forward_locally:n[`forward-locally`],lan_1:{lan_id:u(n[`lan-1-lan-id`],`lan-1-lan-id`,`text`),lan_name:u(n[`lan-1-lan-name`],`lan-1-lan-name`,`text`),port_ranges:n[`lan-1-port-ranges`],ports:n[`lan-1-ports`]},lan_2:{lan_id:u(n[`lan-2-lan-id`],`lan-2-lan-id`,`text`),lan_name:u(n[`lan-2-lan-name`],`lan-2-lan-name`,`text`),port_ranges:n[`lan-2-port-ranges`],ports:n[`lan-2-ports`]},name:u(n.name,`name`,`text`),protocols:n.protocols,unidirectional:n.unidirectional}):i(n.body)});return}let a=await r(n),f=n.local?d:await e();if(n.accountId=f,n.body){let e=i(n.body);s(await l(`Updating`,async()=>a.magicTransit.sites.acls.edit({body:e,account_id:f,site_id:n[`site-id`],acl_id:n[`acl-id`]})),{successLabel:`Updated`});return}let p=o({description:u(n.description,`description`,`text`),forward_locally:n[`forward-locally`],lan_1:{lan_id:u(n[`lan-1-lan-id`],`lan-1-lan-id`,`text`),lan_name:u(n[`lan-1-lan-name`],`lan-1-lan-name`,`text`),port_ranges:n[`lan-1-port-ranges`],ports:n[`lan-1-ports`]},lan_2:{lan_id:u(n[`lan-2-lan-id`],`lan-2-lan-id`,`text`),lan_name:u(n[`lan-2-lan-name`],`lan-2-lan-name`,`text`),port_ranges:n[`lan-2-port-ranges`],ports:n[`lan-2-ports`]},name:u(n.name,`name`,`text`),protocols:n.protocols,unidirectional:n.unidirectional});s(await l(`Updating`,async()=>a.magicTransit.sites.acls.edit({body:p,account_id:f,site_id:n[`site-id`],acl_id:n[`acl-id`]})),{successLabel:`Updated`})}};function zr(e){return e.positional(`acl-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`site-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Br={command:`get <acl-id>`,describe:`Get a specific Site ACL.`,builder:zr,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit sites acls get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/sites/${n[`site-id`]==null?`<site-id>`:encodeURIComponent(String(n[`site-id`]))}/acls/${n[`acl-id`]==null?`<acl-id>`:encodeURIComponent(String(n[`acl-id`]))}`,pathParams:{"site-id":String(n[`site-id`]??``),"acl-id":String(n[`acl-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,s(await l(`Loading`,async()=>i.magicTransit.sites.acls.get({account_id:a,site_id:n[`site-id`],acl_id:n[`acl-id`]})),{successLabel:`Loaded`})}};function Vr(e){return e.option(`site-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Hr={command:`list`,describe:`Lists Site ACLs associated with an account.`,builder:Vr,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit sites acls list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/sites/${n[`site-id`]==null?`<site-id>`:encodeURIComponent(String(n[`site-id`]))}/acls`,pathParams:{"site-id":String(n[`site-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,s(await l(`Loading`,async()=>i.magicTransit.sites.acls.list({account_id:a,site_id:n[`site-id`]})),{successLabel:`Loaded`})}};function Ur(e){return e.positional(`acl-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`site-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`description`,{type:`string`,description:`Description for the ACL.`}).option(`forward-locally`,{type:`boolean`,description:`The desired forwarding action for this ACL policy. If set to "false", the policy will forward traffic to Cloudflare. If set to "true", the policy will forward traffic locally on the Magic Connector. If not included in request, will default to false.`}).option(`lan-1-lan-id`,{type:`string`,description:`The identifier for the LAN you want to create an ACL policy with.`}).option(`lan-1-lan-name`,{type:`string`,description:`The name of the LAN based on the provided lan_id.`}).option(`lan-1-port-ranges`,{type:`string`,array:!0,description:`Array of port ranges on the provided LAN that will be included in the ACL. If no ports or port rangess are provided, communication on any port on this LAN is allowed.`}).option(`lan-1-ports`,{type:`string`,array:!0,description:`Array of ports on the provided LAN that will be included in the ACL. If no ports or port ranges are provided, communication on any port on this LAN is allowed.`}).option(`lan-2-lan-id`,{type:`string`,description:`The identifier for the LAN you want to create an ACL policy with.`}).option(`lan-2-lan-name`,{type:`string`,description:`The name of the LAN based on the provided lan_id.`}).option(`lan-2-port-ranges`,{type:`string`,array:!0,description:`Array of port ranges on the provided LAN that will be included in the ACL. If no ports or port rangess are provided, communication on any port on this LAN is allowed.`}).option(`lan-2-ports`,{type:`string`,array:!0,description:`Array of ports on the provided LAN that will be included in the ACL. If no ports or port ranges are provided, communication on any port on this LAN is allowed.`}).option(`name`,{type:`string`,description:`The name of the ACL.`}).option(`protocols`,{type:`string`,array:!0,description:`The protocols field`}).option(`unidirectional`,{type:`boolean`,description:`The desired traffic direction for this ACL policy. If set to "false", the policy will allow bidirectional traffic. If set to "true", the policy will only allow traffic in one direction. If not included in request, will default to false.`}).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)`}).check(e=>{if([`lan-1-lan-id`,`lan-1-lan-name`,`lan-1-port-ranges`,`lan-1-ports`].some(t=>e[t]!==void 0)){let t=[`lan-1-lan-id`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --lan_1-* flag is set`)}return!0}).check(e=>{if([`lan-2-lan-id`,`lan-2-lan-name`,`lan-2-port-ranges`,`lan-2-ports`].some(t=>e[t]!==void 0)){let t=[`lan-2-lan-id`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --lan_2-* flag is set`)}return!0})}const Wr={command:`update <acl-id>`,describe:`Update a specific Site ACL.`,builder:Ur,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit sites acls update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/sites/${n[`site-id`]==null?`<site-id>`:encodeURIComponent(String(n[`site-id`]))}/acls/${n[`acl-id`]==null?`<acl-id>`:encodeURIComponent(String(n[`acl-id`]))}`,pathParams:{"site-id":String(n[`site-id`]??``),"acl-id":String(n[`acl-id`]??``)},bodyKind:`json`,body:n.body===void 0?o({description:u(n.description,`description`,`text`),forward_locally:n[`forward-locally`],lan_1:{lan_id:u(n[`lan-1-lan-id`],`lan-1-lan-id`,`text`),lan_name:u(n[`lan-1-lan-name`],`lan-1-lan-name`,`text`),port_ranges:n[`lan-1-port-ranges`],ports:n[`lan-1-ports`]},lan_2:{lan_id:u(n[`lan-2-lan-id`],`lan-2-lan-id`,`text`),lan_name:u(n[`lan-2-lan-name`],`lan-2-lan-name`,`text`),port_ranges:n[`lan-2-port-ranges`],ports:n[`lan-2-ports`]},name:u(n.name,`name`,`text`),protocols:n.protocols,unidirectional:n.unidirectional}):i(n.body)});return}let a=await r(n),f=n.local?d:await e();if(n.accountId=f,n.body){let e=i(n.body);s(await l(`Updating`,async()=>a.magicTransit.sites.acls.update({body:e,account_id:f,site_id:n[`site-id`],acl_id:n[`acl-id`]})),{successLabel:`Updated`});return}let p=o({description:u(n.description,`description`,`text`),forward_locally:n[`forward-locally`],lan_1:{lan_id:u(n[`lan-1-lan-id`],`lan-1-lan-id`,`text`),lan_name:u(n[`lan-1-lan-name`],`lan-1-lan-name`,`text`),port_ranges:n[`lan-1-port-ranges`],ports:n[`lan-1-ports`]},lan_2:{lan_id:u(n[`lan-2-lan-id`],`lan-2-lan-id`,`text`),lan_name:u(n[`lan-2-lan-name`],`lan-2-lan-name`,`text`),port_ranges:n[`lan-2-port-ranges`],ports:n[`lan-2-ports`]},name:u(n.name,`name`,`text`),protocols:n.protocols,unidirectional:n.unidirectional});s(await l(`Updating`,async()=>a.magicTransit.sites.acls.update({body:p,account_id:f,site_id:n[`site-id`],acl_id:n[`acl-id`]})),{successLabel:`Updated`})}},Gr={command:`acls`,describe:`Operations for sites.acls`,builder:e=>e.command(Pr).command(Ir).command(Rr).command(Br).command(Hr).command(Wr).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Kr(e){return e.positional(`site-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`breakout`,{type:`boolean`,description:`Whether to breakout traffic to the app's endpoints directly. Null preserves default behavior.`}).option(`preferred-wans`,{type:`string`,array:!0,description:`WAN interfaces to prefer over default WANs, highest-priority first. Can only be specified for breakout rules (breakout must be true).`}).option(`priority`,{type:`number`,description:`Priority of traffic. 0 is default, anything greater is prioritized. (Currently only 0 and 1 are supported)`}).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 qr={command:`create <site-id>`,describe:`Creates a new App Config for a site`,builder:Kr,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit sites app-configuration create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/sites/${n[`site-id`]==null?`<site-id>`:encodeURIComponent(String(n[`site-id`]))}/app_configs`,pathParams:{"site-id":String(n[`site-id`]??``)},bodyKind:`json`,body:n.body===void 0?o({breakout:n.breakout,preferred_wans:n[`preferred-wans`],priority:n.priority}):i(n.body)});return}let a=await r(n),u=n.local?d:await e();if(n.accountId=u,n.body){let e=i(n.body);s(await l(`Creating`,async()=>a.magicTransit.sites.appConfiguration.create({...e,account_id:u,site_id:n[`site-id`]})),{successLabel:`Created`});return}let f=o({breakout:n.breakout,preferred_wans:n[`preferred-wans`],priority:n.priority});s(await l(`Creating`,async()=>a.magicTransit.sites.appConfiguration.create({...f,account_id:u,site_id:n[`site-id`]})),{successLabel:`Created`})}};function Jr(e){return e.positional(`app-config-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`site-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 Yr={command:`delete <app-config-id>`,describe:`Deletes specific App Config associated with a site.`,builder:Jr,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit sites app-configuration delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/sites/${n[`site-id`]==null?`<site-id>`:encodeURIComponent(String(n[`site-id`]))}/app_configs/${n[`app-config-id`]==null?`<app-config-id>`:encodeURIComponent(String(n[`app-config-id`]))}`,pathParams:{"site-id":String(n[`site-id`]??``),"app-config-id":String(n[`app-config-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();if(n.accountId=a,!await m({force:!!n.force})){process.stderr.write(`Aborted.
85
+ `);return}s(await l(`Deleting`,async()=>i.magicTransit.sites.appConfiguration.delete({account_id:a,site_id:n[`site-id`],app_config_id:n[`app-config-id`]})),{successLabel:`Deleted`})}};function Xr(e){return e.positional(`app-config-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`site-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`account-app-id`,{type:`string`,description:`Magic account app ID.`}).option(`breakout`,{type:`boolean`,description:`Whether to breakout traffic to the app's endpoints directly. Null preserves default behavior.`}).option(`managed-app-id`,{type:`string`,description:`Managed app ID.`}).option(`preferred-wans`,{type:`string`,array:!0,description:`WAN interfaces to prefer over default WANs, highest-priority first. Can only be specified for breakout rules (breakout must be true).`}).option(`priority`,{type:`number`,description:`Priority of traffic. 0 is default, anything greater is prioritized. (Currently only 0 and 1 are supported)`}).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 Zr={command:`edit <app-config-id>`,describe:`Updates an App Config for a site`,builder:Xr,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit sites app-configuration edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/sites/${n[`site-id`]==null?`<site-id>`:encodeURIComponent(String(n[`site-id`]))}/app_configs/${n[`app-config-id`]==null?`<app-config-id>`:encodeURIComponent(String(n[`app-config-id`]))}`,pathParams:{"site-id":String(n[`site-id`]??``),"app-config-id":String(n[`app-config-id`]??``)},bodyKind:`json`,body:n.body===void 0?o({account_app_id:u(n[`account-app-id`],`account-app-id`,`text`),breakout:n.breakout,managed_app_id:u(n[`managed-app-id`],`managed-app-id`,`text`),preferred_wans:n[`preferred-wans`],priority:n.priority}):i(n.body)});return}let a=await r(n),f=n.local?d:await e();if(n.accountId=f,n.body){let e=i(n.body);s(await l(`Updating`,async()=>a.magicTransit.sites.appConfiguration.edit({body:e,account_id:f,site_id:n[`site-id`],app_config_id:n[`app-config-id`]})),{successLabel:`Updated`});return}let p=o({account_app_id:u(n[`account-app-id`],`account-app-id`,`text`),breakout:n.breakout,managed_app_id:u(n[`managed-app-id`],`managed-app-id`,`text`),preferred_wans:n[`preferred-wans`],priority:n.priority});s(await l(`Updating`,async()=>a.magicTransit.sites.appConfiguration.edit({body:p,account_id:f,site_id:n[`site-id`],app_config_id:n[`app-config-id`]})),{successLabel:`Updated`})}};function Qr(e){return e.option(`site-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const $r={command:`list`,describe:`Lists App Configs associated with a site.`,builder:Qr,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit sites app-configuration list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/sites/${n[`site-id`]==null?`<site-id>`:encodeURIComponent(String(n[`site-id`]))}/app_configs`,pathParams:{"site-id":String(n[`site-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,s(await l(`Loading`,async()=>i.magicTransit.sites.appConfiguration.list({account_id:a,site_id:n[`site-id`]})),{successLabel:`Loaded`})}};function ei(e){return e.positional(`app-config-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`site-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`account-app-id`,{type:`string`,description:`Magic account app ID.`}).option(`breakout`,{type:`boolean`,description:`Whether to breakout traffic to the app's endpoints directly. Null preserves default behavior.`}).option(`managed-app-id`,{type:`string`,description:`Managed app ID.`}).option(`preferred-wans`,{type:`string`,array:!0,description:`WAN interfaces to prefer over default WANs, highest-priority first. Can only be specified for breakout rules (breakout must be true).`}).option(`priority`,{type:`number`,description:`Priority of traffic. 0 is default, anything greater is prioritized. (Currently only 0 and 1 are supported)`}).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 ti={command:`update <app-config-id>`,describe:`Updates an App Config for a site`,builder:ei,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit sites app-configuration update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/sites/${n[`site-id`]==null?`<site-id>`:encodeURIComponent(String(n[`site-id`]))}/app_configs/${n[`app-config-id`]==null?`<app-config-id>`:encodeURIComponent(String(n[`app-config-id`]))}`,pathParams:{"site-id":String(n[`site-id`]??``),"app-config-id":String(n[`app-config-id`]??``)},bodyKind:`json`,body:n.body===void 0?o({account_app_id:u(n[`account-app-id`],`account-app-id`,`text`),breakout:n.breakout,managed_app_id:u(n[`managed-app-id`],`managed-app-id`,`text`),preferred_wans:n[`preferred-wans`],priority:n.priority}):i(n.body)});return}let a=await r(n),f=n.local?d:await e();if(n.accountId=f,n.body){let e=i(n.body);s(await l(`Updating`,async()=>a.magicTransit.sites.appConfiguration.update({body:e,account_id:f,site_id:n[`site-id`],app_config_id:n[`app-config-id`]})),{successLabel:`Updated`});return}let p=o({account_app_id:u(n[`account-app-id`],`account-app-id`,`text`),breakout:n.breakout,managed_app_id:u(n[`managed-app-id`],`managed-app-id`,`text`),preferred_wans:n[`preferred-wans`],priority:n.priority});s(await l(`Updating`,async()=>a.magicTransit.sites.appConfiguration.update({body:p,account_id:f,site_id:n[`site-id`],app_config_id:n[`app-config-id`]})),{successLabel:`Updated`})}},ni={command:`app-configuration`,describe:`Operations for sites.app-configuration`,builder:e=>e.command(qr).command(Yr).command(Zr).command($r).command(ti).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ri(e){return e.option(`connector-id`,{type:`string`,description:`Magic Connector identifier tag.`}).option(`description`,{type:`string`,description:`The description field`}).option(`ha-mode`,{type:`boolean`,description:`Site high availability mode. If set to true, the site can have two connectors and runs in high availability mode.`}).option(`location-lat`,{type:`string`,description:`Latitude`}).option(`location-lon`,{type:`string`,description:`Longitude`}).option(`name`,{type:`string`,description:`The name of the site.`}).option(`secondary-connector-id`,{type:`string`,description:`Magic Connector identifier tag. Used when high availability mode is on.`}).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 ii={command:`create`,describe:`Creates a new Site`,builder:ri,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit sites create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/sites`,pathParams:{},bodyKind:`json`,body:n.body===void 0?o({connector_id:u(n[`connector-id`],`connector-id`,`text`),description:u(n.description,`description`,`text`),ha_mode:n[`ha-mode`],location:{lat:u(n[`location-lat`],`location-lat`,`text`),lon:u(n[`location-lon`],`location-lon`,`text`)},name:u(n.name,`name`,`text`),secondary_connector_id:u(n[`secondary-connector-id`],`secondary-connector-id`,`text`)}):i(n.body)});return}let a=await r(n),f=n.local?d:await e();if(n.accountId=f,n.body){let e=i(n.body);s(await l(`Creating`,async()=>a.magicTransit.sites.create({...e,account_id:f})),{successLabel:`Created`});return}n.name===void 0&&(n.name=await p(`name`,`The name of the site.`));let m=o({connector_id:u(n[`connector-id`],`connector-id`,`text`),description:u(n.description,`description`,`text`),ha_mode:n[`ha-mode`],location:{lat:u(n[`location-lat`],`location-lat`,`text`),lon:u(n[`location-lon`],`location-lon`,`text`)},name:u(n.name,`name`,`text`),secondary_connector_id:u(n[`secondary-connector-id`],`secondary-connector-id`,`text`)});s(await l(`Creating`,async()=>a.magicTransit.sites.create({...m,account_id:f})),{successLabel:`Created`})}};function ai(e){return e.positional(`site-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 oi={command:`delete <site-id>`,describe:`Remove a specific Site.`,builder:ai,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit sites delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/sites/${n[`site-id`]==null?`<site-id>`:encodeURIComponent(String(n[`site-id`]))}`,pathParams:{"site-id":String(n[`site-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();if(n.accountId=a,!await m({force:!!n.force})){process.stderr.write(`Aborted.
86
+ `);return}s(await l(`Deleting`,async()=>i.magicTransit.sites.delete({account_id:a,site_id:n[`site-id`]})),{successLabel:`Deleted`})}};function si(e){return e.positional(`site-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`connector-id`,{type:`string`,description:`Magic Connector identifier tag.`}).option(`description`,{type:`string`,description:`The description field`}).option(`location-lat`,{type:`string`,description:`Latitude`}).option(`location-lon`,{type:`string`,description:`Longitude`}).option(`name`,{type:`string`,description:`The name of the site.`}).option(`secondary-connector-id`,{type:`string`,description:`Magic Connector identifier tag. Used when high availability mode is on.`}).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 ci={command:`edit <site-id>`,describe:`Patch a specific Site.`,builder:si,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit sites edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/sites/${n[`site-id`]==null?`<site-id>`:encodeURIComponent(String(n[`site-id`]))}`,pathParams:{"site-id":String(n[`site-id`]??``)},bodyKind:`json`,body:n.body===void 0?o({connector_id:u(n[`connector-id`],`connector-id`,`text`),description:u(n.description,`description`,`text`),location:{lat:u(n[`location-lat`],`location-lat`,`text`),lon:u(n[`location-lon`],`location-lon`,`text`)},name:u(n.name,`name`,`text`),secondary_connector_id:u(n[`secondary-connector-id`],`secondary-connector-id`,`text`)}):i(n.body)});return}let a=await r(n),f=n.local?d:await e();if(n.accountId=f,n.body){let e=i(n.body);s(await l(`Updating`,async()=>a.magicTransit.sites.edit({body:e,account_id:f,site_id:n[`site-id`]})),{successLabel:`Updated`});return}let p=o({connector_id:u(n[`connector-id`],`connector-id`,`text`),description:u(n.description,`description`,`text`),location:{lat:u(n[`location-lat`],`location-lat`,`text`),lon:u(n[`location-lon`],`location-lon`,`text`)},name:u(n.name,`name`,`text`),secondary_connector_id:u(n[`secondary-connector-id`],`secondary-connector-id`,`text`)});s(await l(`Updating`,async()=>a.magicTransit.sites.edit({body:p,account_id:f,site_id:n[`site-id`]})),{successLabel:`Updated`})}};function li(e){return e.positional(`site-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`x-magic-new-hc-target`,{type:`string`,description:`If true, the health check target in the response body will be presented using the new object format. Defaults to false.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ui={command:`get <site-id>`,describe:`Get a specific Site.`,builder:li,handler:async i=>{let a={};if(i[`x-magic-new-hc-target`]!==void 0&&(a[`x-magic-new-hc-target`]=String(i[`x-magic-new-hc-target`])),i.dryRun){c({command:`cf magic-transit sites get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/sites/${i[`site-id`]==null?`<site-id>`:encodeURIComponent(String(i[`site-id`]))}`,pathParams:{"site-id":String(i[`site-id`]??``)},bodyKind:`none`});return}let o=await r(i),u=i.local?d:await e();i.accountId=u,s(await l(`Loading`,async()=>n(o,`GET`,`/accounts/${u}/magic/sites/${encodeURIComponent(String(i[`site-id`]))}`,{headers:Object.keys(a).length>0?a:void 0})),{successLabel:`Loaded`})}};function di(e){return e.positional(`site-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`bond-id`,{type:`number`,description:`The bond_id field`}).option(`ha-link`,{type:`boolean`,description:`mark true to use this LAN for HA probing. only works for site with HA turned on. only one LAN can be set as the ha_link.`}).option(`is-breakout`,{type:`boolean`,description:`mark true to use this LAN for source-based breakout traffic`}).option(`is-prioritized`,{type:`boolean`,description:`mark true to use this LAN for source-based prioritized traffic`}).option(`name`,{type:`string`,description:`The name field`}).option(`nat-static-prefix`,{type:`string`,description:`A valid CIDR notation representing an IP range.`}).option(`physport`,{type:`number`,description:`The physport field`}).option(`static-addressing-address`,{type:`string`,description:`A valid CIDR notation representing an IP range.`}).option(`static-addressing-dhcp-relay-server-addresses`,{type:`string`,array:!0,description:`List of DHCP server IPs.`}).option(`static-addressing-dhcp-server-dhcp-pool-end`,{type:`string`,description:`A valid IPv4 address.`}).option(`static-addressing-dhcp-server-dhcp-pool-start`,{type:`string`,description:`A valid IPv4 address.`}).option(`static-addressing-dhcp-server-dns-server`,{type:`string`,description:`A valid IPv4 address.`}).option(`static-addressing-dhcp-server-dns-servers`,{type:`string`,array:!0,description:`The static_addressing.dhcp_server.dns_servers field`}).option(`static-addressing-secondary-address`,{type:`string`,description:`A valid CIDR notation representing an IP range.`}).option(`static-addressing-virtual-address`,{type:`string`,description:`A valid CIDR notation representing an IP range.`}).option(`vlan-tag`,{type:`number`,description:`VLAN ID. Use zero for untagged.`}).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)`}).check(e=>{if([`static-addressing-address`,`static-addressing-dhcp-relay-server-addresses`,`static-addressing-dhcp-server-dhcp-pool-end`,`static-addressing-dhcp-server-dhcp-pool-start`,`static-addressing-dhcp-server-dns-server`,`static-addressing-dhcp-server-dns-servers`,`static-addressing-secondary-address`,`static-addressing-virtual-address`].some(t=>e[t]!==void 0)){let t=[`static-addressing-address`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --static_addressing-* flag is set`)}return!0})}const fi={command:`create <site-id>`,describe:`Creates a new Site LAN. If the site is in high availability mode, static_addressing is required along with secondary and virtual address.`,builder:di,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit sites lans create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/sites/${n[`site-id`]==null?`<site-id>`:encodeURIComponent(String(n[`site-id`]))}/lans`,pathParams:{"site-id":String(n[`site-id`]??``)},bodyKind:`json`,body:n.body===void 0?o({bond_id:n[`bond-id`],ha_link:n[`ha-link`],is_breakout:n[`is-breakout`],is_prioritized:n[`is-prioritized`],name:u(n.name,`name`,`text`),nat:{static_prefix:u(n[`nat-static-prefix`],`nat-static-prefix`,`text`)},physport:n.physport,static_addressing:{address:u(n[`static-addressing-address`],`static-addressing-address`,`text`),dhcp_relay:{server_addresses:n[`static-addressing-dhcp-relay-server-addresses`]},dhcp_server:{dhcp_pool_end:u(n[`static-addressing-dhcp-server-dhcp-pool-end`],`static-addressing-dhcp-server-dhcp-pool-end`,`text`),dhcp_pool_start:u(n[`static-addressing-dhcp-server-dhcp-pool-start`],`static-addressing-dhcp-server-dhcp-pool-start`,`text`),dns_server:u(n[`static-addressing-dhcp-server-dns-server`],`static-addressing-dhcp-server-dns-server`,`text`),dns_servers:n[`static-addressing-dhcp-server-dns-servers`]},secondary_address:u(n[`static-addressing-secondary-address`],`static-addressing-secondary-address`,`text`),virtual_address:u(n[`static-addressing-virtual-address`],`static-addressing-virtual-address`,`text`)},vlan_tag:n[`vlan-tag`]}):i(n.body)});return}let a=await r(n),f=n.local?d:await e();if(n.accountId=f,n.body){let e=i(n.body);s(await l(`Creating`,async()=>a.magicTransit.sites.lans.create({...e,account_id:f,site_id:n[`site-id`]})),{successLabel:`Created`});return}let p=o({bond_id:n[`bond-id`],ha_link:n[`ha-link`],is_breakout:n[`is-breakout`],is_prioritized:n[`is-prioritized`],name:u(n.name,`name`,`text`),nat:{static_prefix:u(n[`nat-static-prefix`],`nat-static-prefix`,`text`)},physport:n.physport,static_addressing:{address:u(n[`static-addressing-address`],`static-addressing-address`,`text`),dhcp_relay:{server_addresses:n[`static-addressing-dhcp-relay-server-addresses`]},dhcp_server:{dhcp_pool_end:u(n[`static-addressing-dhcp-server-dhcp-pool-end`],`static-addressing-dhcp-server-dhcp-pool-end`,`text`),dhcp_pool_start:u(n[`static-addressing-dhcp-server-dhcp-pool-start`],`static-addressing-dhcp-server-dhcp-pool-start`,`text`),dns_server:u(n[`static-addressing-dhcp-server-dns-server`],`static-addressing-dhcp-server-dns-server`,`text`),dns_servers:n[`static-addressing-dhcp-server-dns-servers`]},secondary_address:u(n[`static-addressing-secondary-address`],`static-addressing-secondary-address`,`text`),virtual_address:u(n[`static-addressing-virtual-address`],`static-addressing-virtual-address`,`text`)},vlan_tag:n[`vlan-tag`]});s(await l(`Creating`,async()=>a.magicTransit.sites.lans.create({...p,account_id:f,site_id:n[`site-id`]})),{successLabel:`Created`})}};function pi(e){return e.positional(`lan-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`site-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 mi={command:`delete <lan-id>`,describe:`Remove a specific Site LAN.`,builder:pi,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit sites lans delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/sites/${n[`site-id`]==null?`<site-id>`:encodeURIComponent(String(n[`site-id`]))}/lans/${n[`lan-id`]==null?`<lan-id>`:encodeURIComponent(String(n[`lan-id`]))}`,pathParams:{"site-id":String(n[`site-id`]??``),"lan-id":String(n[`lan-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();if(n.accountId=a,!await m({force:!!n.force})){process.stderr.write(`Aborted.
87
+ `);return}s(await l(`Deleting`,async()=>i.magicTransit.sites.lans.delete({account_id:a,site_id:n[`site-id`],lan_id:n[`lan-id`]})),{successLabel:`Deleted`})}};function hi(e){return e.positional(`lan-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`site-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`bond-id`,{type:`number`,description:`The bond_id field`}).option(`is-breakout`,{type:`boolean`,description:`mark true to use this LAN for source-based breakout traffic`}).option(`is-prioritized`,{type:`boolean`,description:`mark true to use this LAN for source-based prioritized traffic`}).option(`name`,{type:`string`,description:`The name field`}).option(`nat-static-prefix`,{type:`string`,description:`A valid CIDR notation representing an IP range.`}).option(`physport`,{type:`number`,description:`The physport field`}).option(`static-addressing-address`,{type:`string`,description:`A valid CIDR notation representing an IP range.`}).option(`static-addressing-dhcp-relay-server-addresses`,{type:`string`,array:!0,description:`List of DHCP server IPs.`}).option(`static-addressing-dhcp-server-dhcp-pool-end`,{type:`string`,description:`A valid IPv4 address.`}).option(`static-addressing-dhcp-server-dhcp-pool-start`,{type:`string`,description:`A valid IPv4 address.`}).option(`static-addressing-dhcp-server-dns-server`,{type:`string`,description:`A valid IPv4 address.`}).option(`static-addressing-dhcp-server-dns-servers`,{type:`string`,array:!0,description:`The static_addressing.dhcp_server.dns_servers field`}).option(`static-addressing-secondary-address`,{type:`string`,description:`A valid CIDR notation representing an IP range.`}).option(`static-addressing-virtual-address`,{type:`string`,description:`A valid CIDR notation representing an IP range.`}).option(`vlan-tag`,{type:`number`,description:`VLAN ID. Use zero for untagged.`}).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)`}).check(e=>{if([`static-addressing-address`,`static-addressing-dhcp-relay-server-addresses`,`static-addressing-dhcp-server-dhcp-pool-end`,`static-addressing-dhcp-server-dhcp-pool-start`,`static-addressing-dhcp-server-dns-server`,`static-addressing-dhcp-server-dns-servers`,`static-addressing-secondary-address`,`static-addressing-virtual-address`].some(t=>e[t]!==void 0)){let t=[`static-addressing-address`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --static_addressing-* flag is set`)}return!0})}const gi={command:`edit <lan-id>`,describe:`Patch a specific Site LAN.`,builder:hi,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit sites lans edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/sites/${n[`site-id`]==null?`<site-id>`:encodeURIComponent(String(n[`site-id`]))}/lans/${n[`lan-id`]==null?`<lan-id>`:encodeURIComponent(String(n[`lan-id`]))}`,pathParams:{"site-id":String(n[`site-id`]??``),"lan-id":String(n[`lan-id`]??``)},bodyKind:`json`,body:n.body===void 0?o({bond_id:n[`bond-id`],is_breakout:n[`is-breakout`],is_prioritized:n[`is-prioritized`],name:u(n.name,`name`,`text`),nat:{static_prefix:u(n[`nat-static-prefix`],`nat-static-prefix`,`text`)},physport:n.physport,static_addressing:{address:u(n[`static-addressing-address`],`static-addressing-address`,`text`),dhcp_relay:{server_addresses:n[`static-addressing-dhcp-relay-server-addresses`]},dhcp_server:{dhcp_pool_end:u(n[`static-addressing-dhcp-server-dhcp-pool-end`],`static-addressing-dhcp-server-dhcp-pool-end`,`text`),dhcp_pool_start:u(n[`static-addressing-dhcp-server-dhcp-pool-start`],`static-addressing-dhcp-server-dhcp-pool-start`,`text`),dns_server:u(n[`static-addressing-dhcp-server-dns-server`],`static-addressing-dhcp-server-dns-server`,`text`),dns_servers:n[`static-addressing-dhcp-server-dns-servers`]},secondary_address:u(n[`static-addressing-secondary-address`],`static-addressing-secondary-address`,`text`),virtual_address:u(n[`static-addressing-virtual-address`],`static-addressing-virtual-address`,`text`)},vlan_tag:n[`vlan-tag`]}):i(n.body)});return}let a=await r(n),f=n.local?d:await e();if(n.accountId=f,n.body){let e=i(n.body);s(await l(`Updating`,async()=>a.magicTransit.sites.lans.edit({body:e,account_id:f,site_id:n[`site-id`],lan_id:n[`lan-id`]})),{successLabel:`Updated`});return}let p=o({bond_id:n[`bond-id`],is_breakout:n[`is-breakout`],is_prioritized:n[`is-prioritized`],name:u(n.name,`name`,`text`),nat:{static_prefix:u(n[`nat-static-prefix`],`nat-static-prefix`,`text`)},physport:n.physport,static_addressing:{address:u(n[`static-addressing-address`],`static-addressing-address`,`text`),dhcp_relay:{server_addresses:n[`static-addressing-dhcp-relay-server-addresses`]},dhcp_server:{dhcp_pool_end:u(n[`static-addressing-dhcp-server-dhcp-pool-end`],`static-addressing-dhcp-server-dhcp-pool-end`,`text`),dhcp_pool_start:u(n[`static-addressing-dhcp-server-dhcp-pool-start`],`static-addressing-dhcp-server-dhcp-pool-start`,`text`),dns_server:u(n[`static-addressing-dhcp-server-dns-server`],`static-addressing-dhcp-server-dns-server`,`text`),dns_servers:n[`static-addressing-dhcp-server-dns-servers`]},secondary_address:u(n[`static-addressing-secondary-address`],`static-addressing-secondary-address`,`text`),virtual_address:u(n[`static-addressing-virtual-address`],`static-addressing-virtual-address`,`text`)},vlan_tag:n[`vlan-tag`]});s(await l(`Updating`,async()=>a.magicTransit.sites.lans.edit({body:p,account_id:f,site_id:n[`site-id`],lan_id:n[`lan-id`]})),{successLabel:`Updated`})}};function _i(e){return e.positional(`lan-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`site-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const vi={command:`get <lan-id>`,describe:`Get a specific Site LAN.`,builder:_i,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit sites lans get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/sites/${n[`site-id`]==null?`<site-id>`:encodeURIComponent(String(n[`site-id`]))}/lans/${n[`lan-id`]==null?`<lan-id>`:encodeURIComponent(String(n[`lan-id`]))}`,pathParams:{"site-id":String(n[`site-id`]??``),"lan-id":String(n[`lan-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,s(await l(`Loading`,async()=>i.magicTransit.sites.lans.get({account_id:a,site_id:n[`site-id`],lan_id:n[`lan-id`]})),{successLabel:`Loaded`})}};function yi(e){return e.option(`site-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const bi={command:`list`,describe:`Lists Site LANs associated with an account.`,builder:yi,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit sites lans list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/sites/${n[`site-id`]==null?`<site-id>`:encodeURIComponent(String(n[`site-id`]))}/lans`,pathParams:{"site-id":String(n[`site-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,s(await l(`Loading`,async()=>i.magicTransit.sites.lans.list({account_id:a,site_id:n[`site-id`]})),{successLabel:`Loaded`})}};function xi(e){return e.positional(`lan-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`site-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`bond-id`,{type:`number`,description:`The bond_id field`}).option(`is-breakout`,{type:`boolean`,description:`mark true to use this LAN for source-based breakout traffic`}).option(`is-prioritized`,{type:`boolean`,description:`mark true to use this LAN for source-based prioritized traffic`}).option(`name`,{type:`string`,description:`The name field`}).option(`nat-static-prefix`,{type:`string`,description:`A valid CIDR notation representing an IP range.`}).option(`physport`,{type:`number`,description:`The physport field`}).option(`static-addressing-address`,{type:`string`,description:`A valid CIDR notation representing an IP range.`}).option(`static-addressing-dhcp-relay-server-addresses`,{type:`string`,array:!0,description:`List of DHCP server IPs.`}).option(`static-addressing-dhcp-server-dhcp-pool-end`,{type:`string`,description:`A valid IPv4 address.`}).option(`static-addressing-dhcp-server-dhcp-pool-start`,{type:`string`,description:`A valid IPv4 address.`}).option(`static-addressing-dhcp-server-dns-server`,{type:`string`,description:`A valid IPv4 address.`}).option(`static-addressing-dhcp-server-dns-servers`,{type:`string`,array:!0,description:`The static_addressing.dhcp_server.dns_servers field`}).option(`static-addressing-secondary-address`,{type:`string`,description:`A valid CIDR notation representing an IP range.`}).option(`static-addressing-virtual-address`,{type:`string`,description:`A valid CIDR notation representing an IP range.`}).option(`vlan-tag`,{type:`number`,description:`VLAN ID. Use zero for untagged.`}).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)`}).check(e=>{if([`static-addressing-address`,`static-addressing-dhcp-relay-server-addresses`,`static-addressing-dhcp-server-dhcp-pool-end`,`static-addressing-dhcp-server-dhcp-pool-start`,`static-addressing-dhcp-server-dns-server`,`static-addressing-dhcp-server-dns-servers`,`static-addressing-secondary-address`,`static-addressing-virtual-address`].some(t=>e[t]!==void 0)){let t=[`static-addressing-address`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --static_addressing-* flag is set`)}return!0})}const Si={command:`update <lan-id>`,describe:`Update a specific Site LAN.`,builder:xi,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit sites lans update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/sites/${n[`site-id`]==null?`<site-id>`:encodeURIComponent(String(n[`site-id`]))}/lans/${n[`lan-id`]==null?`<lan-id>`:encodeURIComponent(String(n[`lan-id`]))}`,pathParams:{"site-id":String(n[`site-id`]??``),"lan-id":String(n[`lan-id`]??``)},bodyKind:`json`,body:n.body===void 0?o({bond_id:n[`bond-id`],is_breakout:n[`is-breakout`],is_prioritized:n[`is-prioritized`],name:u(n.name,`name`,`text`),nat:{static_prefix:u(n[`nat-static-prefix`],`nat-static-prefix`,`text`)},physport:n.physport,static_addressing:{address:u(n[`static-addressing-address`],`static-addressing-address`,`text`),dhcp_relay:{server_addresses:n[`static-addressing-dhcp-relay-server-addresses`]},dhcp_server:{dhcp_pool_end:u(n[`static-addressing-dhcp-server-dhcp-pool-end`],`static-addressing-dhcp-server-dhcp-pool-end`,`text`),dhcp_pool_start:u(n[`static-addressing-dhcp-server-dhcp-pool-start`],`static-addressing-dhcp-server-dhcp-pool-start`,`text`),dns_server:u(n[`static-addressing-dhcp-server-dns-server`],`static-addressing-dhcp-server-dns-server`,`text`),dns_servers:n[`static-addressing-dhcp-server-dns-servers`]},secondary_address:u(n[`static-addressing-secondary-address`],`static-addressing-secondary-address`,`text`),virtual_address:u(n[`static-addressing-virtual-address`],`static-addressing-virtual-address`,`text`)},vlan_tag:n[`vlan-tag`]}):i(n.body)});return}let a=await r(n),f=n.local?d:await e();if(n.accountId=f,n.body){let e=i(n.body);s(await l(`Updating`,async()=>a.magicTransit.sites.lans.update({body:e,account_id:f,site_id:n[`site-id`],lan_id:n[`lan-id`]})),{successLabel:`Updated`});return}let p=o({bond_id:n[`bond-id`],is_breakout:n[`is-breakout`],is_prioritized:n[`is-prioritized`],name:u(n.name,`name`,`text`),nat:{static_prefix:u(n[`nat-static-prefix`],`nat-static-prefix`,`text`)},physport:n.physport,static_addressing:{address:u(n[`static-addressing-address`],`static-addressing-address`,`text`),dhcp_relay:{server_addresses:n[`static-addressing-dhcp-relay-server-addresses`]},dhcp_server:{dhcp_pool_end:u(n[`static-addressing-dhcp-server-dhcp-pool-end`],`static-addressing-dhcp-server-dhcp-pool-end`,`text`),dhcp_pool_start:u(n[`static-addressing-dhcp-server-dhcp-pool-start`],`static-addressing-dhcp-server-dhcp-pool-start`,`text`),dns_server:u(n[`static-addressing-dhcp-server-dns-server`],`static-addressing-dhcp-server-dns-server`,`text`),dns_servers:n[`static-addressing-dhcp-server-dns-servers`]},secondary_address:u(n[`static-addressing-secondary-address`],`static-addressing-secondary-address`,`text`),virtual_address:u(n[`static-addressing-virtual-address`],`static-addressing-virtual-address`,`text`)},vlan_tag:n[`vlan-tag`]});s(await l(`Updating`,async()=>a.magicTransit.sites.lans.update({body:p,account_id:f,site_id:n[`site-id`],lan_id:n[`lan-id`]})),{successLabel:`Updated`})}},Ci={command:`lans`,describe:`Operations for sites.lans`,builder:e=>e.command(fi).command(mi).command(gi).command(vi).command(bi).command(Si).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function wi(e){return e.option(`connectorid`,{type:`string`,description:`Identifier`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ti={command:`list`,describe:`Lists Sites associated with an account. Use connectorid query param to return sites where connectorid matches either site.ConnectorID or site.SecondaryConnectorID.`,builder:wi,handler:async n=>{let i={connectorid:n.connectorid};if(n.dryRun){c({command:`cf magic-transit sites list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/sites`,pathParams:{},query:i,bodyKind:`none`});return}let a=await r(n),o=n.local?d:await e();n.accountId=o,s(await l(`Loading`,async()=>a.magicTransit.sites.list({account_id:o,...i})),{successLabel:`Loaded`})}};function Ei(e){return e.positional(`site-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`active-timeout`,{type:`number`,description:`Timeout in seconds for active flows.`}).option(`collector-ip`,{type:`string`,description:`IPv4 address of the NetFlow collector.`}).option(`collector-port`,{type:`number`,description:`UDP port of the NetFlow collector.`}).option(`inactive-timeout`,{type:`number`,description:`Timeout in seconds for inactive flows.`}).option(`sampling-rate`,{type:`number`,description:`Sampling rate for NetFlow records (1 = every packet).`}).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 Di={command:`create <site-id>`,describe:`Creates a NetFlow configuration for a site.`,builder:Ei,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit sites netflow-config create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/sites/${n[`site-id`]==null?`<site-id>`:encodeURIComponent(String(n[`site-id`]))}/netflow_config`,pathParams:{"site-id":String(n[`site-id`]??``)},bodyKind:`json`,body:n.body===void 0?o({active_timeout:n[`active-timeout`],collector_ip:u(n[`collector-ip`],`collector-ip`,`text`),collector_port:n[`collector-port`],inactive_timeout:n[`inactive-timeout`],sampling_rate:n[`sampling-rate`]}):i(n.body)});return}let a=await r(n),f=n.local?d:await e();if(n.accountId=f,n.body){let e=i(n.body);s(await l(`Creating`,async()=>a.magicTransit.sites.netflowConfig.create({body:e,account_id:f,site_id:n[`site-id`]})),{successLabel:`Created`});return}let p=o({active_timeout:n[`active-timeout`],collector_ip:u(n[`collector-ip`],`collector-ip`,`text`),collector_port:n[`collector-port`],inactive_timeout:n[`inactive-timeout`],sampling_rate:n[`sampling-rate`]});s(await l(`Creating`,async()=>a.magicTransit.sites.netflowConfig.create({body:p,account_id:f,site_id:n[`site-id`]})),{successLabel:`Created`})}};function Oi(e){return e.positional(`site-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 ki={command:`delete <site-id>`,describe:`Remove NetFlow configuration for a site.`,builder:Oi,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit sites netflow-config delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/sites/${n[`site-id`]==null?`<site-id>`:encodeURIComponent(String(n[`site-id`]))}/netflow_config`,pathParams:{"site-id":String(n[`site-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();if(n.accountId=a,!await m({force:!!n.force})){process.stderr.write(`Aborted.
88
+ `);return}s(await l(`Deleting`,async()=>i.magicTransit.sites.netflowConfig.delete({account_id:a,site_id:n[`site-id`]})),{successLabel:`Deleted`})}};function Ai(e){return e.positional(`site-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`active-timeout`,{type:`number`,description:`Timeout in seconds for active flows.`}).option(`collector-ip`,{type:`string`,description:`IPv4 address of the NetFlow collector.`}).option(`collector-port`,{type:`number`,description:`UDP port of the NetFlow collector.`}).option(`inactive-timeout`,{type:`number`,description:`Timeout in seconds for inactive flows.`}).option(`sampling-rate`,{type:`number`,description:`Sampling rate for NetFlow records (1 = every packet).`}).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 ji={command:`edit <site-id>`,describe:`Updates NetFlow configuration for a site.`,builder:Ai,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit sites netflow-config edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/sites/${n[`site-id`]==null?`<site-id>`:encodeURIComponent(String(n[`site-id`]))}/netflow_config`,pathParams:{"site-id":String(n[`site-id`]??``)},bodyKind:`json`,body:n.body===void 0?o({active_timeout:n[`active-timeout`],collector_ip:u(n[`collector-ip`],`collector-ip`,`text`),collector_port:n[`collector-port`],inactive_timeout:n[`inactive-timeout`],sampling_rate:n[`sampling-rate`]}):i(n.body)});return}let a=await r(n),f=n.local?d:await e();if(n.accountId=f,n.body){let e=i(n.body);s(await l(`Updating`,async()=>a.magicTransit.sites.netflowConfig.edit({body:e,account_id:f,site_id:n[`site-id`]})),{successLabel:`Updated`});return}let p=o({active_timeout:n[`active-timeout`],collector_ip:u(n[`collector-ip`],`collector-ip`,`text`),collector_port:n[`collector-port`],inactive_timeout:n[`inactive-timeout`],sampling_rate:n[`sampling-rate`]});s(await l(`Updating`,async()=>a.magicTransit.sites.netflowConfig.edit({body:p,account_id:f,site_id:n[`site-id`]})),{successLabel:`Updated`})}};function Mi(e){return e.positional(`site-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ni={command:`get <site-id>`,describe:`Get NetFlow configuration for a site.`,builder:Mi,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit sites netflow-config get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/sites/${n[`site-id`]==null?`<site-id>`:encodeURIComponent(String(n[`site-id`]))}/netflow_config`,pathParams:{"site-id":String(n[`site-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,s(await l(`Loading`,async()=>i.magicTransit.sites.netflowConfig.get({account_id:a,site_id:n[`site-id`]})),{successLabel:`Loaded`})}};function Pi(e){return e.positional(`site-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`active-timeout`,{type:`number`,description:`Timeout in seconds for active flows.`}).option(`collector-ip`,{type:`string`,description:`IPv4 address of the NetFlow collector.`}).option(`collector-port`,{type:`number`,description:`UDP port of the NetFlow collector.`}).option(`inactive-timeout`,{type:`number`,description:`Timeout in seconds for inactive flows.`}).option(`sampling-rate`,{type:`number`,description:`Sampling rate for NetFlow records (1 = every packet).`}).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 Fi={command:`update <site-id>`,describe:`Updates NetFlow configuration for a site (partial update).`,builder:Pi,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit sites netflow-config update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/sites/${n[`site-id`]==null?`<site-id>`:encodeURIComponent(String(n[`site-id`]))}/netflow_config`,pathParams:{"site-id":String(n[`site-id`]??``)},bodyKind:`json`,body:n.body===void 0?o({active_timeout:n[`active-timeout`],collector_ip:u(n[`collector-ip`],`collector-ip`,`text`),collector_port:n[`collector-port`],inactive_timeout:n[`inactive-timeout`],sampling_rate:n[`sampling-rate`]}):i(n.body)});return}let a=await r(n),f=n.local?d:await e();if(n.accountId=f,n.body){let e=i(n.body);s(await l(`Updating`,async()=>a.magicTransit.sites.netflowConfig.update({body:e,account_id:f,site_id:n[`site-id`]})),{successLabel:`Updated`});return}let p=o({active_timeout:n[`active-timeout`],collector_ip:u(n[`collector-ip`],`collector-ip`,`text`),collector_port:n[`collector-port`],inactive_timeout:n[`inactive-timeout`],sampling_rate:n[`sampling-rate`]});s(await l(`Updating`,async()=>a.magicTransit.sites.netflowConfig.update({body:p,account_id:f,site_id:n[`site-id`]})),{successLabel:`Updated`})}},Ii={command:`netflow-config`,describe:`Operations for sites.netflow-config`,builder:e=>e.command(Di).command(ki).command(ji).command(Ni).command(Fi).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Li(e){return e.positional(`site-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`connector-id`,{type:`string`,description:`Magic Connector identifier tag.`}).option(`description`,{type:`string`,description:`The description field`}).option(`location-lat`,{type:`string`,description:`Latitude`}).option(`location-lon`,{type:`string`,description:`Longitude`}).option(`name`,{type:`string`,description:`The name of the site.`}).option(`secondary-connector-id`,{type:`string`,description:`Magic Connector identifier tag. Used when high availability mode is on.`}).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 Ri={command:`update <site-id>`,describe:`Update a specific Site.`,builder:Li,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit sites update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/sites/${n[`site-id`]==null?`<site-id>`:encodeURIComponent(String(n[`site-id`]))}`,pathParams:{"site-id":String(n[`site-id`]??``)},bodyKind:`json`,body:n.body===void 0?o({connector_id:u(n[`connector-id`],`connector-id`,`text`),description:u(n.description,`description`,`text`),location:{lat:u(n[`location-lat`],`location-lat`,`text`),lon:u(n[`location-lon`],`location-lon`,`text`)},name:u(n.name,`name`,`text`),secondary_connector_id:u(n[`secondary-connector-id`],`secondary-connector-id`,`text`)}):i(n.body)});return}let a=await r(n),f=n.local?d:await e();if(n.accountId=f,n.body){let e=i(n.body);s(await l(`Updating`,async()=>a.magicTransit.sites.update({body:e,account_id:f,site_id:n[`site-id`]})),{successLabel:`Updated`});return}let p=o({connector_id:u(n[`connector-id`],`connector-id`,`text`),description:u(n.description,`description`,`text`),location:{lat:u(n[`location-lat`],`location-lat`,`text`),lon:u(n[`location-lon`],`location-lon`,`text`)},name:u(n.name,`name`,`text`),secondary_connector_id:u(n[`secondary-connector-id`],`secondary-connector-id`,`text`)});s(await l(`Updating`,async()=>a.magicTransit.sites.update({body:p,account_id:f,site_id:n[`site-id`]})),{successLabel:`Updated`})}};function zi(e){return e.positional(`site-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`name`,{type:`string`,description:`The name field`}).option(`physport`,{type:`number`,description:`The physport field`}).option(`priority`,{type:`number`,description:`The priority field`}).option(`static-addressing-address`,{type:`string`,description:`A valid CIDR notation representing an IP range.`}).option(`static-addressing-gateway-address`,{type:`string`,description:`A valid IPv4 address.`}).option(`static-addressing-secondary-address`,{type:`string`,description:`A valid CIDR notation representing an IP range.`}).option(`vlan-tag`,{type:`number`,description:`VLAN ID. Use zero for untagged.`}).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)`}).check(e=>{if([`static-addressing-address`,`static-addressing-gateway-address`,`static-addressing-secondary-address`].some(t=>e[t]!==void 0)){let t=[`static-addressing-address`,`static-addressing-gateway-address`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --static_addressing-* flag is set`)}return!0})}const Bi={command:`create <site-id>`,describe:`Creates a new Site WAN.`,builder:zi,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit sites wans create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/sites/${n[`site-id`]==null?`<site-id>`:encodeURIComponent(String(n[`site-id`]))}/wans`,pathParams:{"site-id":String(n[`site-id`]??``)},bodyKind:`json`,body:n.body===void 0?o({name:u(n.name,`name`,`text`),physport:n.physport,priority:n.priority,static_addressing:{address:u(n[`static-addressing-address`],`static-addressing-address`,`text`),gateway_address:u(n[`static-addressing-gateway-address`],`static-addressing-gateway-address`,`text`),secondary_address:u(n[`static-addressing-secondary-address`],`static-addressing-secondary-address`,`text`)},vlan_tag:n[`vlan-tag`]}):i(n.body)});return}let a=await r(n),f=n.local?d:await e();if(n.accountId=f,n.body){let e=i(n.body);s(await l(`Creating`,async()=>a.magicTransit.sites.wans.create({...e,account_id:f,site_id:n[`site-id`]})),{successLabel:`Created`});return}if(n.physport===void 0)throw Error(`--physport is required (or pass --body with this field set).`);let p=o({name:u(n.name,`name`,`text`),physport:n.physport,priority:n.priority,static_addressing:{address:u(n[`static-addressing-address`],`static-addressing-address`,`text`),gateway_address:u(n[`static-addressing-gateway-address`],`static-addressing-gateway-address`,`text`),secondary_address:u(n[`static-addressing-secondary-address`],`static-addressing-secondary-address`,`text`)},vlan_tag:n[`vlan-tag`]});s(await l(`Creating`,async()=>a.magicTransit.sites.wans.create({...p,account_id:f,site_id:n[`site-id`]})),{successLabel:`Created`})}};function Vi(e){return e.positional(`wan-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`site-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 Hi={command:`delete <wan-id>`,describe:`Remove a specific Site WAN.`,builder:Vi,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit sites wans delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/sites/${n[`site-id`]==null?`<site-id>`:encodeURIComponent(String(n[`site-id`]))}/wans/${n[`wan-id`]==null?`<wan-id>`:encodeURIComponent(String(n[`wan-id`]))}`,pathParams:{"site-id":String(n[`site-id`]??``),"wan-id":String(n[`wan-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();if(n.accountId=a,!await m({force:!!n.force})){process.stderr.write(`Aborted.
89
+ `);return}s(await l(`Deleting`,async()=>i.magicTransit.sites.wans.delete({account_id:a,site_id:n[`site-id`],wan_id:n[`wan-id`]})),{successLabel:`Deleted`})}};function Ui(e){return e.positional(`wan-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`site-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`name`,{type:`string`,description:`The name field`}).option(`physport`,{type:`number`,description:`The physport field`}).option(`priority`,{type:`number`,description:`The priority field`}).option(`static-addressing-address`,{type:`string`,description:`A valid CIDR notation representing an IP range.`}).option(`static-addressing-gateway-address`,{type:`string`,description:`A valid IPv4 address.`}).option(`static-addressing-secondary-address`,{type:`string`,description:`A valid CIDR notation representing an IP range.`}).option(`vlan-tag`,{type:`number`,description:`VLAN ID. Use zero for untagged.`}).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)`}).check(e=>{if([`static-addressing-address`,`static-addressing-gateway-address`,`static-addressing-secondary-address`].some(t=>e[t]!==void 0)){let t=[`static-addressing-address`,`static-addressing-gateway-address`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --static_addressing-* flag is set`)}return!0})}const Wi={command:`edit <wan-id>`,describe:`Patch a specific Site WAN.`,builder:Ui,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit sites wans edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/sites/${n[`site-id`]==null?`<site-id>`:encodeURIComponent(String(n[`site-id`]))}/wans/${n[`wan-id`]==null?`<wan-id>`:encodeURIComponent(String(n[`wan-id`]))}`,pathParams:{"site-id":String(n[`site-id`]??``),"wan-id":String(n[`wan-id`]??``)},bodyKind:`json`,body:n.body===void 0?o({name:u(n.name,`name`,`text`),physport:n.physport,priority:n.priority,static_addressing:{address:u(n[`static-addressing-address`],`static-addressing-address`,`text`),gateway_address:u(n[`static-addressing-gateway-address`],`static-addressing-gateway-address`,`text`),secondary_address:u(n[`static-addressing-secondary-address`],`static-addressing-secondary-address`,`text`)},vlan_tag:n[`vlan-tag`]}):i(n.body)});return}let a=await r(n),f=n.local?d:await e();if(n.accountId=f,n.body){let e=i(n.body);s(await l(`Updating`,async()=>a.magicTransit.sites.wans.edit({body:e,account_id:f,site_id:n[`site-id`],wan_id:n[`wan-id`]})),{successLabel:`Updated`});return}let p=o({name:u(n.name,`name`,`text`),physport:n.physport,priority:n.priority,static_addressing:{address:u(n[`static-addressing-address`],`static-addressing-address`,`text`),gateway_address:u(n[`static-addressing-gateway-address`],`static-addressing-gateway-address`,`text`),secondary_address:u(n[`static-addressing-secondary-address`],`static-addressing-secondary-address`,`text`)},vlan_tag:n[`vlan-tag`]});s(await l(`Updating`,async()=>a.magicTransit.sites.wans.edit({body:p,account_id:f,site_id:n[`site-id`],wan_id:n[`wan-id`]})),{successLabel:`Updated`})}};function Gi(e){return e.positional(`wan-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`site-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ki={command:`get <wan-id>`,describe:`Get a specific Site WAN.`,builder:Gi,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit sites wans get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/sites/${n[`site-id`]==null?`<site-id>`:encodeURIComponent(String(n[`site-id`]))}/wans/${n[`wan-id`]==null?`<wan-id>`:encodeURIComponent(String(n[`wan-id`]))}`,pathParams:{"site-id":String(n[`site-id`]??``),"wan-id":String(n[`wan-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,s(await l(`Loading`,async()=>i.magicTransit.sites.wans.get({account_id:a,site_id:n[`site-id`],wan_id:n[`wan-id`]})),{successLabel:`Loaded`})}};function qi(e){return e.option(`site-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ji={command:`list`,describe:`Lists Site WANs associated with an account.`,builder:qi,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit sites wans list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/sites/${n[`site-id`]==null?`<site-id>`:encodeURIComponent(String(n[`site-id`]))}/wans`,pathParams:{"site-id":String(n[`site-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,s(await l(`Loading`,async()=>i.magicTransit.sites.wans.list({account_id:a,site_id:n[`site-id`]})),{successLabel:`Loaded`})}};function Yi(e){return e.positional(`wan-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`site-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`name`,{type:`string`,description:`The name field`}).option(`physport`,{type:`number`,description:`The physport field`}).option(`priority`,{type:`number`,description:`The priority field`}).option(`static-addressing-address`,{type:`string`,description:`A valid CIDR notation representing an IP range.`}).option(`static-addressing-gateway-address`,{type:`string`,description:`A valid IPv4 address.`}).option(`static-addressing-secondary-address`,{type:`string`,description:`A valid CIDR notation representing an IP range.`}).option(`vlan-tag`,{type:`number`,description:`VLAN ID. Use zero for untagged.`}).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)`}).check(e=>{if([`static-addressing-address`,`static-addressing-gateway-address`,`static-addressing-secondary-address`].some(t=>e[t]!==void 0)){let t=[`static-addressing-address`,`static-addressing-gateway-address`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --static_addressing-* flag is set`)}return!0})}const Xi={command:`update <wan-id>`,describe:`Update a specific Site WAN.`,builder:Yi,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit sites wans update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/magic/sites/${n[`site-id`]==null?`<site-id>`:encodeURIComponent(String(n[`site-id`]))}/wans/${n[`wan-id`]==null?`<wan-id>`:encodeURIComponent(String(n[`wan-id`]))}`,pathParams:{"site-id":String(n[`site-id`]??``),"wan-id":String(n[`wan-id`]??``)},bodyKind:`json`,body:n.body===void 0?o({name:u(n.name,`name`,`text`),physport:n.physport,priority:n.priority,static_addressing:{address:u(n[`static-addressing-address`],`static-addressing-address`,`text`),gateway_address:u(n[`static-addressing-gateway-address`],`static-addressing-gateway-address`,`text`),secondary_address:u(n[`static-addressing-secondary-address`],`static-addressing-secondary-address`,`text`)},vlan_tag:n[`vlan-tag`]}):i(n.body)});return}let a=await r(n),f=n.local?d:await e();if(n.accountId=f,n.body){let e=i(n.body);s(await l(`Updating`,async()=>a.magicTransit.sites.wans.update({body:e,account_id:f,site_id:n[`site-id`],wan_id:n[`wan-id`]})),{successLabel:`Updated`});return}let p=o({name:u(n.name,`name`,`text`),physport:n.physport,priority:n.priority,static_addressing:{address:u(n[`static-addressing-address`],`static-addressing-address`,`text`),gateway_address:u(n[`static-addressing-gateway-address`],`static-addressing-gateway-address`,`text`),secondary_address:u(n[`static-addressing-secondary-address`],`static-addressing-secondary-address`,`text`)},vlan_tag:n[`vlan-tag`]});s(await l(`Updating`,async()=>a.magicTransit.sites.wans.update({body:p,account_id:f,site_id:n[`site-id`],wan_id:n[`wan-id`]})),{successLabel:`Updated`})}},Zi={command:`wans`,describe:`Operations for sites.wans`,builder:e=>e.command(Bi).command(Hi).command(Wi).command(Ki).command(Ji).command(Xi).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Qi={command:`sites`,describe:`Operations for sites`,builder:e=>e.command(ii).command(oi).command(ci).command(ui).command(Ti).command(Ri).command(Gr).command(ni).command(Ci).command(Ii).command(Zi).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},$i={command:`magic-transit`,describe:`DDoS-protected network transit — GRE/IPsec tunnels, static routes, Magic WAN sites, connectors, and packet captures`,builder:e=>e.command(P).command(Bt).command(Zt).command(ln).command(mn).command(Sn).command(Fn).command(Xn).command(_r).command(Mr).command(Qi).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{$i as default};